authorIDs
stringlengths
7
14
fullText
listlengths
9
994
cluster
int64
0
511
retrieval_idx
listlengths
499
499
STX_10.0
[ [ "Commercial air transportation is heavily regulated by the U.S. Code. [14 CFR Part 250](_URL_0_) explicitly allows (and regulates) the practice of overselling flights. [For example](_URL_1_):\r\n\r\n > ### &#167; 250.11 Public disclosure of deliberate overbooking and boarding procedures.\r\n(a) Every carrier shall cause to be displayed continuously\r\n > in a conspicuous public place at each desk, station and position in\r\n > the United States which is in the charge of a person employed\r\n > exclusively by it, or by it jointly with another person, or by any\r\n > agent employed by such air carrier or foreign air carrier to sell\r\n > tickets to passengers, a sign located so as to be clearly visible and\r\n > clearly readable to the traveling public, which shall have printed\r\n > thereon the following statement in boldface type at least one-fourth\r\n > of an inch high:\r\n > \r\n > > **Notice - Overbooking of Flights**\r\n\r\n > > Airline flights may be overbooked, and\r\n > there is a slight chance that a seat will not be available on a flight\r\n > for which a person has a confirmed reservation. If the flight is\r\n > overbooked, no one will be denied a seat until airline personnel first\r\n > ask for volunteers willing to give up their reservation in exchange\r\n > for compensation of the airline&#39;s choosing. If there are not enough\r\n > volunteers, the airline will deny boarding to other persons in\r\n > accordance with its particular boarding priority. With few exceptions,\r\n > including failure to comply with the carrier&#39;s check-in deadline\r\n > (carrier shall insert either “of _ minutes prior to each flight\r\n > segment” or “(which are available upon request from the air carrier)”\r\n > here), persons denied boarding involuntarily are entitled to\r\n > compensation. The complete rules for the payment of compensation and\r\n > each airline&#39;s boarding priorities are available at all airport ticket\r\n > counters and boarding locations. Some airlines do not apply these\r\n > consumer protections to travel from some foreign countries, although\r\n > other consumer protections may be available. Check with your airline\r\n > or your travel agent.\r\n\r\n > (b) Every carrier shall include with each ticket\r\n > sold in the United States the notices set forth in paragraph (a) of\r\n > this section, printed in at least 12-point type. The notice may be\r\n > printed on a separate piece of paper, on the ticket stock, or on the\r\n > ticket envelope. The last two sentences of the notice shall be printed\r\n > in a type face contrasting with that of the rest of the notice.\r\n > \r\n > (c) It shall be the responsibility of each carrier to ensure that\r\n > travel agents authorized to sell air transportation for that carrier\r\n > comply with the notice provisions of paragraphs (a) and (b) of this\r\n > section.", "587" ], [ "I have my doubts all visitors would have filled in that survey, I surely didn&#39;t. Whether the group that does is representative of the whole stackoverflow community, I don&#39;t know. Another point to keep in mind is that many of those questions allowed naming more than one editor, so it could have included people using Emacs along with something else, like for Org only.", "862" ], [ "I like the question, but right now it seems pedantic: Wikipedia isn&#39;t law, and many border checkpoints are well within the territory of their countries. Is there a law that says, \" ;One must clear customs *before* crossing the border? \" ; or \" ;Exactly at the physical border? \" ; Even the Korean peninsula has (and the Berlin wall had) crossings where there is some significant distance between where you leave one country and are checked for entry to the other. If you turn around before being \" ;checked \" ; in the country you just entered, they don&#39;t shoot at you (anymore).", "565" ], [ "Remapping keys in isearch is nothing special, however isearch is not using the minibuffer, but the echo area for displaying its state. This means that trying to use a conventional editing command like `delete-word` will not have the intended effect (deleting a word in the minibuffer), but rather edit text in the buffer you started the search from.\r\n\r\nTo solve this, you must write your own function in the style of what&#39;s been bound to `C-w` before, manipulating isearch state. Judging by the sources of `isearch-delete-char`, you&#39;re working with a sequence of isearch commands (one for each char) and can pop these to undo what has been typed. I&#39;d consider reporting a bug to request this feature to be implemented as it&#39;s not obvious how you&#39;d do it yourself.", "631" ], [ "We require a review process using Pull requests in github onto our main dev or master branches. During that review process, we will mark pull requests as requiring changes if many files have white space or line ending differences, and insist that they follow the formatting of the dev or master branch they are making the pull request for.\r\n\r\nThere are also some nice tools depending on which languages you use and which CI tools you use, which can, during the build process or pull request step auto format the code based on rules that you set up. That also helps with keeping code looking consistent and minimizing formatting issues when committing code.", "405" ], [ "Yes, anyone who has had their property seized pursuant to a search warrant can appeal for relief. Especially an innocent party might contact the law enforcement agency that seized the property, and/or the government attorney&#39;s office handling the case for which the property was seized.\r\n\r\nAlthough I am not aware of formal rules requiring the state to compensate third parties for the costs imposed on them by judicial processes, I have seen police departments and distract attorney offices make accommodations, including payments, to defray those. (Perhaps this is motivated by nothing more than an interest in maintaining positive community relations and avoiding bad publicity.)\r\n\r\nThe formal process to obtain relief is to file a Motion to Return Property. Following is the text from [FRCP 41(g)](_URL_0_), but state rules I have seen are virtually identical:\r\n\r\n > (g) Motion to Return Property. A person aggrieved by an unlawful\r\n > search and seizure of property or by the deprivation of property may\r\n > move for the property&#39;s return. The motion must be filed in the\r\n > district where the property was seized. The court must receive\r\n > evidence on any factual issue necessary to decide the motion. If it\r\n > grants the motion, the court must return the property to the movant,\r\n > but may impose reasonable conditions to protect access to the property\r\n > and its use in later proceedings.\r\n\r\nFinally, it is *possible* that private vehicle insurance will cover costs associated with being deprived of a car seized as evidence. (The closest analogy I know for certain: If a law enforcement agency causes damage to property, many homeowner and renter insurance policies will cover that damage under their \" ;casualty \" ; clause.)", "174" ], [ "In this case, \" ;Fire and Forget \" ; doesn&#39;t mean what you think it means.\r\n\r\nIt isn&#39;t the case that you fire the build and then forget about the outcome. What actually happens is that you fire the event, and then forget about what the process is doing up until the point where the process returns feedback to you and reminds you about what was fired.\r\n\r\nAs an example, the old way of doing things might be to trigger a build and then let it run while you watch the output. You sit there watching the results of the build as they occur and don&#39;t work on anything else productive during that time. Or you do work on something productive, but you have one eye on the build process. When it is done, you need to either be paying attention, or remember to check on it to see the results and then continue based on that.\r\n\r\nIn <PERSON> model of \" ;Fire and Forget \" ;, you have some automated process do the build for you, and your mind is not focused on the build process until something goes wrong, or the build completes. At that point, you get a message from Jenkins, either as an email or in a program like slack, which now reminds you of the build process and tells you all the information you need to know to move on. In the meantime, you were working on some other task with your full focus, because you knew that you didn&#39;t have to keep an eye on it. The automated system would alert you to anything you needed to know.", "123" ], [ "There&#39;s a tradeoff in written contracts: The more precise and comprehensive, the longer they have to be.\r\n\r\nThe [basics of a contract are described here](_URL_0_), and it&#39;s possible to have a legally valid contract without writing anything at all.\r\n\r\nBut the more you care about avoiding ambiguity and covering \" ;corner cases, \" ; the more you need an experienced attorney to write your contract.\r\n\r\nYou can ask an attorney to [avoid \" ;legalese \" ;](_URL_1_) to the extent possible, and to try to make a contract as \" ;easy to read and understand \" ; as possible. Some are better at that than others.", "174" ], [ "The examples you gave for Geography based questions are also very limited in terms of Time.\r\n\r\nConferences, Seminars, University programs, etc, all change from Year to year and can exist for a very short amount of time.\r\n\r\nOn the other hand, people often travel across the globe to attend a specific University or Conferences, so I don&#39;t really think the question is limited to a specific geography.", "146" ], [ "Even your question points out, \" ;What is Justice? \" ; has been debated *as a matter of philosophy* for thousands of years. The question is often raised and addressed in judicial opinions, with answers as varied as the person answering and the specific circumstances in question. What you ask is a matter of opinion and ongoing debate, and hence is not amenable to a good answer on Stack Exchange.", "727" ], [ "As far as I was able to tell it&#39;s not possible.\r\n\r\nWe solved this by using Pipeline putting the custom messages in the Jenkinsfile.\r\n\r\nThe flexibility gained by having the Jenkinsfile in the git repo really helped our developers have a better understanding of the build process, and allowed them to make necessary changes to the build commands without the communications headache.\r\n\r\nIt&#39;s a nice excuse to move over to Pipeline.\r\n\r\nIt also happens to be very easy to do:\r\n\r\n`slackSend (color: colorCode, message: customMessage)`", "857" ], [ "In principle, police are liable for the safety of anyone they detain. If an officer creates a hazardous condition, as was described in this scenario, he or his agency (which effectively means the taxpayers who fund his agency) can be held liable for damages resulting from that action. (Whether it is the officer or instead the taxpayers who get stuck with the bill is a separate question of \" ;qualified [immunity](_URL_1_). \" ;)\r\n\r\nThis idea has been formalized under two theories:\r\n\r\n1. The \" ;[special relationship doctrine](_URL_0_) \" ; would apply in this case because the officer was detaining the driver.\r\n2. Otherwise, the liability could be argued under the more broad \" ;[state-created danger doctrine](_URL_2_). \" ;", "273" ], [ "1. The Nazi gas chambers used Zyklon B, a device and formulation for dispersing hydrogen cyanide (HCN), which is an extraordinarily lethal chemical.\r\n2. In gas chambers these devices were employed in a manner specifically to cause the death of masses of persons through direct exposure to the chemical HCN.\r\n3. But Zyklon B devices were developed and used for peaceful industrial and agricultural pest control.\r\n\r\nI could see arguments going both ways. On the one hand: The Nazis used a lethal chemical to efficiently kill people on a massive scale. If that fails to trigger a convention on chemical weapons the convention probably needs to be rewritten.\r\n\r\nOn the other hand: The gas chambers employed a literally unmodified industrial product, albeit contrary to its indicated use. If the Nazis had instead built water-tight chambers and drowned the same civilians, that would also be constructing a device to use a chemical to cause mass death. Does that make water a \" ;chemical weapon? \" ;", "561" ], [ "Interestingly enough, Evil *does* define an initial state for `view-mode`, but it won&#39;t do anything because `view-mode` is a minor mode and initial states are for major modes only. The correct way to change the associated state is by using a hook:\r\n\r\n (add-hook &#39;view-mode-hook &#39;evil-motion-state)\r\n\r\nThat way, `q` does the right thing, simply because it is not bound in `evil-motion-state-map` and Emacs looks up the mode-specific key instead. You can alternatively enter Emacs state by adding `evil-emacs-state` to the hook, like I do for more vanilla behavior.", "71" ], [ "It&#39;s important to distinguish between customization code (part of your init file) and package code (part of a package). In customization code one appends something to a list with\r\n\r\n (add-to-list &#39;savehist-additional-variables &#39;evil-ex-history)\r\n\r\nWhereas in package code you use\r\n\r\n ;; creates duplicates\r\n (push &#39;evil-ex-history savehist-additional-variables)\r\n ;; avoids duplicates\r\n (cl-pushnew &#39;evil-ex-history savehist-additional-variables)\r\n\r\nNow, how do these interact and why does the manual state it&#39;s safe in customization code to just set the variable? In this case, it&#39;s because `savehist-additional-variables` is an empty list! If the variable was defined at the time `add-to-list` is used (like, if one used `(require &#39;savehist)` before), it appends to it, otherwise it defines the variable and when `savehist.el` is loaded, the `defcustom` form (or rather `defvar`, which it expands to) keeps that value and marks the variable as special.\r\n\r\nThis strategy will work out fine with simple values, like strings, numbers and `nil` (which doubles as the empty list), non-empty lists (and other composite data structures) are a bit tricky though. Assuming `savehist-additional-variables` were initialized to `(foo bar baz)`, you&#39;d end up with `(evil-ex-history foo bar baz)` if it&#39;s loaded up before customization or `(evil-ex-history)` if done afterwards. For this reason, composite values shouldn&#39;t be put as default value into customizables. A possible solution is to add the initial values immediately after definition of the variable. That way both package-provided values and user-provided values will be in the list:\r\n\r\n ;; package code\r\n (defvar save-hist-additional-variables nil ...)\r\n (push &#39;foo save-hist-additional-variables)\r\n (push &#39;bar save-hist-additional-variables)\r\n (push &#39;baz save-hist-additional-variables)\r\n \r\n ;; user code\r\n (add-to-list &#39;save-hist-additional-variables &#39;evil-ex-history)\r\n\r\nSame trick works with non-empty hooks, just replace `push` with `add-hook`.\r\n\r\nAn alternative version of this technique can be used for variables not intended for customization. Just write a function that&#39;s concerned with initializing variables and call it later.", "730" ], [ "In the U.S. sales tax is not generally assessed on transactions of goods or services for resale. (E.g., search for \" ;sales tax resale certificate \" ; and whatever states you&#39;re interested in.)\r\n\r\nFurthermore, [in the U.S. businesses are generally only liable for collecting sales & use tax in states and jurisdictions in which they have a \" ;business presence. \" ;](_URL_0_)\r\n\r\nTherefore: A U.S. business selling goods or services to anyone in a \" ;foreign \" ; state does not collect sales tax. Nor would it collect sales tax selling to an in-state entity that provides a resale certificate.", "544" ], [ "Strictly speaking, if party *X* agrees to indemnify party *Y* for damage *Z*, then *X* is only agreeing to pay *Y* for realized damages *Z*.\r\n\r\nExample: I agree to print something you wrote about about Acme. In exchange, you agree to indemnify and defend me against any defamation claims by Acme. Acme sues me for defamation.\r\n\r\n1. Since you agreed to *defend* me, you have to provide a legal defense against Acme&#39;s lawsuit. If you didn&#39;t agree to indemnify me, and Acme wins a judgment, you wouldn&#39;t be obligated to pay the judgment.\r\n\r\n2. If you only agreed to *indemnify* me, you could choose to let the lawsuit run its course without providing any legal defense. Indemnification only requires you to pay any judgment Acme might win.", "174" ], [ "@DaleM - I think I could come up with a moral hazard scenario, but *in general* I don&#39;t see how it would be in *Y*&#39;s *interest* to concede a third-party claim. In the example given: With no defense I am adjudged a libeler, even though I don&#39;t have to pay the associated damages. I&#39;m having trouble imagining people who have an interest in being so branded.", "174" ], [ "Explanations of Apple&#39;s MagSafe patent are [here](_URL_6_).\r\n\r\n[The USPTO explains what can be patented under U.S. statute](_URL_2_) (which is generally informative for all member countries of the [Patent Cooperation Treaty](_URL_4_)):\r\n\r\n > [A]ny person who “invents or discovers any new and useful process,\r\n > machine, manufacture, or composition of matter, or any new and useful\r\n > improvement thereof, may obtain a patent,” subject to the conditions\r\n > and requirements of the law. The word “process” is defined by law as a\r\n > process, act, or method, and primarily includes industrial or\r\n > technical processes. The term “machine” used in the statute needs no\r\n > explanation. The term “manufacture” refers to articles that are made,\r\n > and includes all manufactured articles. The term “composition of\r\n > matter” relates to chemical compositions and may include mixtures of\r\n > ingredients as well as new chemical compounds. These classes of\r\n > subject matter taken together include practically everything that is\r\n > made by man and the processes for making the products. \r\n\r\n > Interpretations of the statute by the courts have defined the limits\r\n > of the field of subject matter that can be patented, thus it has been\r\n > held that the laws of nature, physical phenomena, and abstract ideas\r\n > are not patentable subject matter.\r\n\r\n > A patent cannot be obtained upon a\r\n > mere idea or suggestion. The patent is granted upon the new machine,\r\n > manufacture, etc., as has been said, and not upon the idea or\r\n > suggestion of the new machine. A complete description of the actual\r\n > machine or other subject matter for which a patent is sought is\r\n > required.\r\n\r\nAs noted [here](_URL_3_):\r\n\r\n > Despite the best efforts of patent offices many patents are granted\r\n > that may not meet these criteria: that&#39;s why a patent can be\r\n > challenged in court. An invalid patent may stand for many years (or\r\n > even expire) without ever being reviewed by a court.\r\n\r\nIt is possible to win and enforce a patent that might not withstand a vigorous administrative or legal challenge.\r\n\r\nIn fact, [there is a great deal of ongoing rule- and law-making regarding what can be patented](_URL_0_). It *is* possible to patent things that you might consider to cover a \" ;search engine \" ; or \" ;e-commerce platform. For example, [_URL_1_ famously patented \" ;one-click \" ; ordering](_URL_5_) in the U.S., but its application with the European Patent Office was refused.", "525" ], [ "This article about \" ;[How healthy is your Dockerized application? \" ;][1] explains the trouble with monitoring, but it doesn&#39;t provide any good examples of how to actually monitor a microservice inside of the docker container.\r\n\r\nWe are currently using PM2 monit to monitor our microservices, but as we put them into docker containers we lose the ability to access this data within one screen for all the various microservices which each run in their own docker container.\r\n\r\nDockerswarm monitoring will tell us the state of the containers, but not the microservice running inside of them.\r\n\r\nWhat&#39;s a solid proven way of solving this problem?\r\n\r\n\r\n [1]: _URL_0_", "736" ], [ "Assume someone is exploiting DigitalNote, Dashcoin, or Bytecoin. Apparently, they could issue large amounts of those coins to manipulate that individual coin value. But what keeps them from exchanging this fictional value for other cryptos, and thus creating fictional demand for Monero and other coins? Also, do we know if these other cryptonote coins HAVE been exploited, yet? Should we be exploring attack-vectors from even state level attackers who might exploit one broken coin to devalue others?", "427" ], [ "One can argue that [you should always be worried](_URL_0_). Much more so when you are addressing legal questions without the legal advice of a qualified attorney.\r\n\r\nThe email you got from your company *says something*. It offers \" ;[protection](_URL_1_) \" ; to the extent that:\r\n\r\n1. Your written contract doesn&#39;t have an integration clause.\r\n2. The person who sent the email is authorized to modify the written contract.\r\n3. The contents of the email do in fact address the concerns you have.\r\n4. There are no laws that constrain the principles and interests at stake.\r\n\r\nOnly your lawyer, paid for by you to act in your interest, could verify these questions and offer an opinion on your legal vulnerability.", "174" ], [ "**Date/Time (EST):** Wednesday, June 28, 2017, 6:30 PM\r\n\r\n**Date/Time (UTC):** Wednesday, June 28, 2017, 23:30\r\n\r\n**Location:** [Roam Buckhead][1], 3365 Piedmont Rd NE, Suite 1400, Atlanta, GA\r\n\r\n**RSVP:** _URL_4_\r\n\r\n**Twitter:** [@AtlantaSitecore][2]\r\n\r\n![Atlanta Sitecore User Group][3]\r\n\r\nMark your calendars for the next [Atlanta Sitecore User Group][5] meeting on June 28, at 6:30 pm, at [Roam in Buckhead][1]! \r\n\r\nThe theme of this quarter&#39;s meeting will be focusing on case studies from [Global Payments][6] and [Iron Mountain][7]. <PERSON> of [Global Payments][6] will be presenting on their Sitecore brand framework that they use to manage all of their distinct brands and local market websites.\r\n\r\n<PERSON>, of [Iron Mountain][7] will be presenting on their journey with Sitecore, lessons learned, current use, and future vision.\r\n\r\nAdditionally, [<PERSON>] of [Perficient][9] will provide everyone a recap of the recent SUGCON Europe event.\r\n\r\nParking will be complimentary. We will be providing prepaid validations to all of our guests. \r\n\r\nLooking forward to seeing everyone!\r\n\r\n\r\n [1]: _URL_5_\r\n [2]: _URL_0_\r\n [3]: _URL_1_\r\n [5]: _URL_4_\r\n [6]: _URL_7_\r\n [7]: _URL_3_\r\n [8]: _URL_2_\r\n [9]: _URL_6_", "456" ], [ "Given the current state of law, [police can effectively search any car they have stopped on a public road](_URL_2_). There is no legal requirement for police to identify any person pursuant to a search of a vehicle.\r\n\r\nIn fact, [in many states the police need probable cause to detain a person and demand identification](_URL_0_).\r\n\r\nYou describe a situation in which you were subject to a detention and search. In general, you have the right to remain silent when questioned by police, and to refuse to consent to searches. If you think your civil rights were violated [you can seek redress through the courts](_URL_1_).", "669" ], [ "You can&#39;t, at least not yet. \r\n\r\nRemember, YouTube was originally designed to be a video hosting site and not a *music sharing* service (but it&#39;s heading that way). The autoplay&#39;d videos you watch are from the &#39;up next&#39; sidebar which recommends other videos for you to watch next. These are typically based on a combination of what *other* users have watched following your video plus sponsored content folks pay to have added to that list. \r\n\r\nYou can exclude certain artists from your *search* by using the minus (-) operator, but that will *only* affect the search results and ***not*** what shows up in your recommended play list after:\r\n\r\n > **YouTube Search:** `Beyonc&#233; - \" ;<PERSON> \" ;` (this wont fix the autoplay list)\r\n\r\nYou can certainly turn *off* the &#39;autoplay&#39; feature, but then you&#39;ll have to click on each video individually to listen to it. \r\n\r\n ![](_URL_0_)", "261" ], [ "The Wilderness Protocol is: \" ; \" ;The Wilderness protocol (see page 101, August 1995 QST) calls for hams in the wilderness to announce their presence on, and to monitor, the national calling frequencies for five minutes beginning at the top of the hour, every three hours from 7 AM to 7 PM while in the back country. A ham in a remote location may be able to relay emergency information through another wilderness ham who has better access to a repeater. National calling frequencies: 52.525, 146.52, 223.50, 446.00, 1294.50 MHz. \" ;", "750" ], [ "This is a classic case where reading the docs gives you the answer immediately:\r\n\r\n > unwind-protect is a special form in ‘C source code’.\r\n > \r\n > (unwind-protect BODYFORM UNWINDFORMS...)\r\n > \r\n > Do BODYFORM, protecting with UNWINDFORMS.\r\n > If BODYFORM completes normally, its value is returned\r\n > after executing the UNWINDFORMS.\r\n > If BODYFORM exits nonlocally, the UNWINDFORMS are executed anyway.\r\n\r\nThe name is weird, but describes that the body form is *protect*ed against stack *unwind*ing, which happens when running into an error. `unwind-protect` is therefore equivalent to the `finally` keyword as seen in Java and alike. If you want to handle errors, use `condition-case` (which is like `case`, but for error *condition*s).", "326" ], [ "I&#39;m currently hacking on an elisp IRC bot and have a section of code that I want to enable only when it&#39;s run on a remote machine with a specific hostname. However, I couldn&#39;t find any premade function to retrieve the machine&#39;s hostname. Eventually I settled for `(shell-command-to-string \" ;uname -n \" ;)`, but this feels wrong and will certainly not work on other operating systems. Is there anything better suited for this task?", "883" ], [ "Many times we try to blend in with some friend&#39;s friends. However, being accepted into that group of friends is not so simple, for a few reasons. \r\n\r\nWhile hanging around that group does allow someone to familiarize with the group and also creates introductions, it does not mean that one is fully integrated into the group. It is not the same as being an active member of the group. Personally, I noticed that I don&#39;t get invited to their meetups, unless I specifically ask to join, which isn&#39;t the case for most of the members of the group.\r\n\r\nThis specific group of friends is not a diverse one. There is a very leveled plain in terms of background.\r\n\r\nWhat can I do to make the rest of the group of friends more at ease with me, and possibly accept me into their group? \r\n\r\nMore specifically, what should I do so that they would invite me to meet-ups?\r\n\r\n---\r\n < sup > This is adapted from an example question, and it is also something I am personally trying to learn. < /sup >", "701" ], [ "\" ;Probable cause \" ; is a disturbingly subjective and vague standard that is nevertheless central to the criminal justice system: \" ;Probable cause \" ; is the standard that justifies everything from search to arrest to a judge&#39;s decision in a preliminary hearing to hold a person for trial.\r\n\r\n[Black&#39;s Law Dictionary](_URL_0_) explains:\r\n\r\n > Facts and evidences that lead many to believe that the accused\r\n > actually committed the crime. A probable cause is not a fail proof\r\n > evidence as it only provides enough grounds to deem the convicted\r\n > guilty of the crime, and thus to arrest and put the accused to trial.", "273" ], [ "@TomAu - I don&#39;t think it has to do with \" ;proof, \" ; since nothing is really *proven* when a question of \" ;probable cause \" ; is challenged. It&#39;s more like a judge agrees that a reasonable person perceiving the same facts and/or circumstances would consider there to be sufficient probability that a person committed a crime to warrant search, seizure, and/or trial. There is *a lot* of jurisprudence on this question.", "5" ], [ "Ask the court clerk if they have a form or specification for what they are requesting. *If they don&#39;t, then any unspecified detail probably doesn&#39;t matter.*\r\n\r\nFor example, if the clerk refused to provide further instructions or information then, based on the note you received, as a layperson I would reply with a notarized paper saying, \" ;Under penalty of perjury I declare that I am still living in the same residence *X* with *Y*. \" ; If that turns out to be inadequate the clerk will have to provide some explanation of why, which will give you more information for your next attempt to satisfy the court&#39;s requirement.", "174" ], [ "The International Amateur Radio Union (IARU) has established a small set of emergency frequencies. Some of these are global and some are for one of the three IARU regions. The IARU calls these frequencies \" ;emergency centres of activity \" ;.\r\n\r\nThe full list is here:\r\n\r\n_URL_3_\r\n\r\nBy far the most common one is 14.300 MHz. That is monitored in the US by the Maritime Mobile Service Network (_URL_4_).\r\n\r\nFor your game, if you need global broadcast, I&#39;d use one of the global frequencies. If it is more local, use one of the regional frequencies that are around 3xxx kHz (80 m band) or 7xxx kHz (40 m band). 80m is good at nightime, 40m at daytime. Either one is regional, covering something like most of California.\r\n\r\nThe regions (_URL_0_) are:\r\n\r\nIARU Region 1: Europe, Africa, Middle East and Northern Asia\r\n\r\nIARU Region 2: The Americas\r\n\r\nIARU Region 3: Asia-Pacific\r\n\r\nThere are other frequencies for non-amateur use, mostly marine and aircraft. The primary marine distress frequency was 2182 kHz, but the US Coast Guard stopped monitoring that in 2013. Marine distress traffic now digital to satellites with GPS data.\r\n\r\nThis is a good list of those frequencies.\r\n\r\n_URL_1_\r\n\r\nIf you want a US-oriented throwback flavor, I&#39;d go with the CONELRAD frequencies from the Cold War era. In case of a major attack, AM broadcast stations would shut down, with only specific stations on either 640 or 1240 kHz continuing to broadcast. Those frequencies were marked with a triangle-in-circle icon on radio dials.\r\n\r\n_URL_2_", "507" ], [ "This sounds like a semantic question, and the answer is that when the two terms can be brought to bear on the same question they would mean the same thing.\r\n\r\nE.g., \" ;affirmative action \" ; could be described as a racist program \" ;tailored \" ; to extend preference to certain races. However, one could instead parse a description of affirmative action as a \" ;restriction \" ; on the rights of those who are *not* given preference. Obviously it could simultaneously be declared \" ;*narrowly-tailored* to benefit injured classes \" ; and \" ;the *least restrictive* way of infringing the rights of the other classes. \" ;\r\n\r\n(I await any counterexample ;)", "675" ], [ "A subject&#39;s religion, house rules, etc. are simply not a consideration in the issuance and execution of a search warrant. A warrant authorizes officers to take whatever measures they consider necessary to safely search for and secure whatever is being sought. The only variations in a search warrant are whether:\r\n\r\n 1. It has to be served during normal waking hours.\r\n 2. The officers have to knock first, or whether they can conduct a \" ;no-knock \" ; raid.\r\n\r\nA subject and his property have virtually no rights in the face of a warrant & ndash; certainly no rights to impose rules. See [these](_URL_0_) [previous questions](_URL_1_).", "273" ], [ "In the U.S.: To my knowledge all states and jurisdictions that with a \" ;sales tax \" ; technically have a \" ;use \" ; tax, which means the tax liability falls on the purchaser. However, they require \" ;businesses \" ; (whose exact definition varies by jurisdiction) to collect and remit that tax on behalf of \" ;consumers \" ; (which can also vary, e.g., to exclude businesses that resell).\r\n\r\nHistorically consumers have avoided paying use taxes by purchasing from out-of-state businesses that are not subject to their home states&#39; laws on withholding the use tax: while technically a violation of the tax law neither consumers nor states have had an interest in calculating or auditing use taxes owed, except in the case of very large and unusual transactions.\r\n\r\nThere is a large effort underway by states and \" ;brick-and-mortar \" ; stores that lose business to this virtual \" ;mail order tax exemption \" ; to subject out-of-state businesses to the requirement of collecting use taxes on behalf of the state. A few online businesses (notably Amazon) have acquiesced to this demand.\r\n\r\nTo answer your question: In the U.S., an individual who is not making a \" ;business \" ; of selling items or services is generally exempt from the requirement to collect sales tax. It is the purchaser who has the legal obligation to declare and pay tax on such transactions. But purchasers rarely do.", "544" ], [ "The burden for proving claims in civil actions is \" ;[preponderance of evidence][1], \" ; i.e., merely that \" ;more than 50% of the evidence favors a conclusion. \" ;\r\n\r\nHowever, the standard for conviction of any *crime* is \" ;beyond a reasonable doubt. \" ; I.e., if the defense can raise reasonable doubt about one&#39;s guilt then the defendant should be acquitted. \r\n\r\nThere is quite a bit of space between the two standards, which is compounded by prosecutorial discretion to even bring criminal charges.\r\n\r\n\r\n [1]: _URL_0_", "273" ], [ "Following [this question](_URL_0_), which is part of a chain of interesting posts exploring the use of civil actions to force liability insurers to pay for unintentional torts of their insureds: Suppose a person wishes to *lose* a lawsuit for \" ;wrongful death \" ; in order to benefit some third party (e.g., the kids orphaned by an accident in which the policyholder was involved but not charged with any crime).\r\n\r\nThe person *wants* to establish liability for wrongful death, but *does not want* to risk a charge and conviction for the crime associated with that tort: involuntary manslaughter.\r\n\r\nCan the civil trial be conducted in such a way that any concessions or evidence supporting the wrongful death verdict cannot be used against the person in a criminal trial, should at any later time a prosecutor decide to pursue the charge of involuntary manslaughter?\r\n\r\nAre there any reliable means of presenting testimony at a civil trial that allow it to be excluded, refuted, or disclaimed in a criminal trial (without committing perjury)?", "273" ], [ "All use of intellectual property (IP) that you do not own must comply with the license terms of the IP. Most open-source software is released/shared under licensing terms. Typically they are not onerous, but legally they must still be respected.\r\n\r\nSome licenses distinguish between commercial vs. non-commercial, profit vs. non-profit, or personal vs. business use. The use case you describe sounds like \" ;business \" ; use, and unless your organization is a non-profit presumably it sounds like \" ;non-commercial, for-profit, business use. \" ; But a large organization should have general counsel that could confirm whether your use is compliant with the license terms of all the IP you use.", "497" ], [ "But there are principled circumstances in which such actions are *not* allowed? It does seem unsporting to allow an action in which a plaintiff member can also essentially throw the defense, thereby taking from the pockets of all co-defendants! I.e., your note that, \" ;Generally speaking, a court does not allow a co-respondent where that person is also a petitioner, because they recognize that such a person will by definition be hostile to their own defense, and usually to the detriment of the other co-respondents \" ; makes sense. Wondering how that is codified?", "273" ], [ "This sounds a little scary/surprising: entities can be bound merely by \" ;ostensible authority? \" ; Can you provide any references? Because I might know a guy in a non-extraditing country who is ready to visit Australia, dress up in a suit, print some business cards, and sign a bunch of lucrative contracts on behalf of deep-pocketed entities for the extraordinary benefit of third parties that happen to be publicly traded.", "781" ], [ "I agree there is an argument from a Stack Exchange policy perspective for closing this sort of question because each answer for a different jurisdiction could be correct, and we don&#39;t like questions that have multiple correct answers (even though we encourage multiple answers per question, so not sure how to reconcile that secondary objective with the primary directive).\r\n\r\nBut then theory runs into practice and it doesn&#39;t seem like that ideal is sustainable. For example: Suppose we think that the underlying question & ndash; say, \" ;Do I need to collect taxes when selling personal items? \" ; & ndash; is a *really great question of worldwide interest*. Do we want to have a few hundred instances of the same question? E.g.,\r\n\r\n1. Do I need to collect taxes when selling personal items in the U.S.?\r\n2. Do I need to collect taxes when selling personal items in the U.K.?\r\n3. Do I need to collect taxes when selling personal items in Canada?\r\n4. Etc.?\r\n\r\nThis is sort of an unresolved matter, but certainly *at this stage* I think it would be not only presumptuous but also hopeless to pursue the \" ;separate question for each jurisdiction \" ; approach because we only have good answerers from a few large jurisdictions. So we would end up with a morass of unanswered questions. And if the question is good for the U.S. isn&#39;t it \" ;just as good \" ; for, say, Singapore? It would only seem fair to have each instance voted up equally. Keep in mind: The site has only been in operation for five months, during which we have accumulated 1,300 questions, and we are struggling to maintain a high answer rate. If we *required* a separate question for every jurisdiction of interest we&#39;d immediately be contemplating an increase in the number of questions by at least an order of magnitude, with a corresponding decrease in the answer rate.\r\n\r\nThe custom so far on _URL_0_ has been to allow answers for different jurisdictions, even when a specific jurisdiction was specified, and especially when the answers for unspecified jurisdictions are particularly illuminating.\r\n\r\nAnother common practice is for someone to ask in a comment what jurisdiction is involved. Again, that doesn&#39;t shut down answers for other jurisdictions, because it appears that everybody is happy knowing *something* applicable to the question if the alternative is having *nothing* because there is no expert in the desired jurisdiction.\r\n\r\nI just don&#39;t see any practical alternative to the current customs. And it does seem to be illuminating to have experts from multiple jurisdictions providing good answers, especially when the desired jurisdiction may not have anyone with expertise to answer.", "359" ], [ "What you describe is nothing malicious. I&#39;m not a lawyer, so I can&#39;t say whether it *technically* runs afoul of laws proscribing \" ;unauthorized access/use of computer systems. \" ; Also, it may *technically* run afoul of the host&#39;s terms and conditions.\r\n\r\nAgain, IANAL, so I can&#39;t rule out the sad possibility that you could be in legal trouble for what you did ... assuming that a hosting service that left a vulnerability like that open had the means and interest to review your activity (I leave it to the reader to assess the probability of *that*). However, as a businessman I think the following facts are salient:\r\n\r\n1. You noticed a security hole.\r\n1. You did the bare minimum to verify it.\r\n1. You did absolutely no damage to the computer system, and you did not access any substantial unauthorized data.\r\n\r\nIf I were you I&#39;d first check with the host to see if they offer bounties for finding security holes. If they don&#39;t, I&#39;d notify them. If you alert them and don&#39;t ask for money, make threats, or anything else, you&#39;re going as white-hat as you can, and they *should* be relieved that you aren&#39;t attempting to exploit or extort your find. (Heck, they *should* be so grateful that they should offer you a substantial reward, but again, reality often fulls short of such ideals ;)", "873" ], [ "@cnst - I don&#39;t quite follow: Are you saying *this* question appears to be asking for specific legal advice? If so: I picked a \" ;strong \" ; hypothetical to illustrate the titular question (and to relate it to the \" ;inspiring \" ; Q & A), but the hypothetical could be *any* tort with a potentially associated crime. As for differences between the two: This focuses on what theoretical mechanisms exist to avoid what was suggested in the title of the \" ;inspiring \" ; question.", "273" ], [ "**To clarify the moderator involvement here:** The current moderators have agreed to avoid voting to close when there appears to be reasonable room for debate, because a moderator can&#39;t \" ;vote \" ;: a moderator close has immediate effect and so it stymies the development of community norms and participation, and can seem heavy-handed. For this reason you will often see a moderator *comment* suggesting that a post is defective and explaining why, but leaving it open for review and/or correction by the community.\r\n\r\nTo my knowledge the current moderators have never reversed community votes. Therefore **the fact that a moderator has posted an answer should not be taken as an endorsement of the suitability of the question *any more than* an answer by other community members**.\r\n\r\nThe moderators are active users, but we do our best to disclaim any more *authority* than any other active user. All current moderators [explicitly committed](_URL_0_) to minimalist/*laissez-faire* moderation. Furthermore, we go out of our way to explain our actions, accept criticism, and avoid any appearance of conflicts of interest.\r\n\r\nSo, for example, in the question cited you should feel free to vote to close. If you leave a comment, that upvote it gets could very well be from the moderator who posted the answer!", "101" ], [ "Processing creates an \" ;identity. \" ; Not that it would serve the alien for any positive purposes, but his fingerprints, photograph, physical description, and whatever name/alias he provided would be in a national database should any law enforcement agency come across him in the future.\r\n\r\nBut after being processed, if it&#39;s for a minor crime, he will probably be released, perhaps after being required to post a small bail to ensure his appearance for arraignment.", "465" ], [ "In the U.S. there is no law that requires you to ever say a word to a law enforcement officer, and lawyers generally encourage you to minimize what you communicate to them anyway.\r\n\r\nI can&#39;t think of any situation where a request for information could not be demanded in writing. As a practical matter, in some situations you will probably be subject to some extra scrutiny and inconvenience: E.g., in a [stop-and-identify](_URL_1_) situation, you could hand the officer a note saying, \" ;Please make any requests for information from me in writing. \" ; The officer may infer that you have some disability, but if he does not (or discovers you don&#39;t) he may get irritated enough to subject you to harassment for \" ;[contempt of cop](_URL_0_) \" ;.\r\n\r\nOf course, if you can understand him, you are still required to obey an officer&#39;s lawful orders no matter how they are communicated. But \" ;speak \" ; is not a lawful order.", "273" ], [ "In my experience anytime somebody is going so slow as to cause a nuisance they are subject to a moving violation like \" ;[Impeding the Flow of Traffic](_URL_0_). \" ;\r\n\r\nIn general statutes do not specify minimum speeds because the \" ;safe and reasonable \" ; speed for a road can vary (downward) with conditions.\r\n\r\nI have occasionally seen posted minimums on highways in the U.S., but I have never found a special statute associated with those, so as far as I can tell they are merely encouragements to not impede the flow by driving too slowly.\r\n < !-- (In any case, presumably those are \" ;fair weather \" ; minimums and would be subject to reasonable reductions under inclement conditions, as well as all manner of exceptions. And unlike maximum speed limits I am not aware of any statutes that \" ;grade \" ; violations of falling short of minimum speeds. E.g., \" ;5-15mph over limit \" ; is a distinct and lesser infraction from \" ;16-25mph over limit, \" ; but \" ;5mph *under* minimum \" ; is not distinct from \" ;15mph *under* limit. \" ;)-- >", "669" ], [ "This happens all the time in the U.S.: Someone does internal work on their house that, according to ordinances, requires permits. Eventually, if they go to sell the house, the unpermitted work is discovered. In every case I have seen, the municipality will require the work to be inspected. Any additional work required to bring it up to code will have to be performed before a new certificate of occupancy is issued. But that&#39;s the end of the matter.\r\n\r\n(What I haven&#39;t seen, but which wouldn&#39;t surprise me, is a claim by a jurisdiction that depends heavily on property taxes for back-taxes due on the change in assessed value occasioned by the improvements.)", "354" ], [ "@SergZ. - Protection of \" ;domestic animals, \" ; which I understood to mean pets, is likewise allowed, but I assume livestock are also \" ;domestic animals. \" ; Two points I am unsure of, and I would like to see answered: (1) Can one defend domestic animals against *endangered* animals? (2) Can one use lethal force to protect *property* against damage from *any* animal? I&#39;ll keep looking for answers to those if nobody else can find them.", "234" ], [ "Thank you for another fascinating and informative answer! So: Time spent discussing billing is not billable to a client. What if those discussions diverge into questions of strategy: E.g., \" ;Why did you do this, or why didn&#39;t you do that? Or why was this a reasonable outcome, and why couldn&#39;t you have done better? \" ; Is that billable? I can certainly understand, having dealt with some lawyers who are very slow and methodical in their answers, why a client would be hesitant to even broach the subject if there&#39;s a chance he&#39;s paying $500/hour for answers.", "174" ], [ "*If you don&#39;t make any false or misleading claims* I don&#39;t believe there is any law or regulatory agency in the free world that would prohibit this. Since I can&#39;t prove a negative, here is a broad analogy followed by a fun anecdote:\r\n\r\nThere are plenty of products that are functionally equivalent but where the price charged is entirely determined by the labeling. In the U.S., \" ;store-brand \" ; (a.k.a. white-label) products are often literally the same as the brand-name products that may be stocked immediately adjacent to them. I.e., they come off the same production line, and the only difference is the packaging.\r\n\r\nBottled water might be another great example. Especially water that is filtered and remineralized, as opposed to (maybe) spring water.\r\n\r\nNow the fun but perhaps not perfectly related example: You can cripple a product to sell it at different prices: Intel famously segmented the market for its processors with its 486 CPU: It was offered in a DX version, which had the full functionality, and a cheaper SX version, which started as a DX chip to which extra manufacturing steps were applied in order to disable the math co-processor. So even though the SX cost (marginally) more to manufacture, it was sold at a lower price because it had been crippled.", "345" ], [ "The only way to absolutely guarantee that your headphones don&#39;t get chewed on is to place them in a container that the cats cannot open. Do not assume that just because the container is difficult to imagine opening by a cat that it will be impossible (or even difficult). I have seen cats knock things off the counter just to break open a container.\r\n\r\nYou can find a lot of example videos of cats opening things they shouldn&#39;t be able to: [Cat opens door with round doorknob][1]\r\n\r\nFind a hardened container with multiple catches to prevent the cat from getting to your headphones. Add foam to keep the headphones from rattling around inside.\r\n\r\n[![Harden plastic container with multiple latches][2]][2]\r\n\r\n\r\n [1]: _URL_0_ \" ;Cat opens door with round doorknob \" ;\r\n [2]: _URL_1_", "239" ], [ "Contracts are allowed to address or stipulate anything that is not illegal. Employers are generally allowed to apply restrictions that do not discriminate against protected characteristics. I.e., unless there is a law against it, employers are almost certainly allowed to regulate the relationships between employees.\r\n\r\nIn the U.S. this is quite common. For example, many companies have [ \" ;anti-nepotism \" ; and/or \" ;fraternization \" ; policies](_URL_0_). The former restricts employment of people with a (usually pre-existing) familial relationship. The latter restricts *behavior that could be perceived as \" ;dating. \" ;* Sometimes the restrictions only apply to employees with a supervisor/subordinate relationship, but it is not unusual to see a blanket prohibition.", "174" ], [ "@WoJ - For nepotism it is defined by law: E.g., legal marriage, children, relatives within some degree. For fraternization it is the *appearance* that is at stake, and it most certainly bears on the workplace: If someone in a supervisory position *appears* to have a relationship with a subordinate then it colors all of their supervisory work as being unfairly biased towards that subordinate. In this sense, practice and the policy align: If the relationship can be kept a secret, then there&#39;s no problem. If it comes out, that&#39;s exactly when there is a problem. One knows it when one sees it.", "596" ], [ "1) The most basic facility for this would be [abbrevs](_URL_1_). They correspond to Vim&#39;s abbreviations, but are in so far different that you need to enable `abbrev-mode` first and can define mode-specific abbrevs. I&#39;d use these for correcting typos, expanding acronyms and other basic expansions.\r\n\r\n2) I haven&#39;t heard of `C-j` for this purpose before, must be something specific to that plugin. My approach to this would be different, I&#39;d use an advanced snippet system like [Yasnippet](_URL_0_) which supports template expansion reminiscent of Sublime Text and Textmate, including their feature of jumping to fields inside the template for filling out subparts easily.\r\n\r\n3) Management of delimiters is generally done with something like paredit or smartparens and would allow you to do things like automatic pairing, moving beyond limiters and much more.", "774" ], [ "Emacs does generally use `C-p` and `C-n` for moving the cursor up and down, ` < up > ` and ` < down > ` are usually bound to the same command. That&#39;s why you get the unfamiliar behaviour of the arrow keys not cycling the history. As a compromise `M-p` and `M-n` are bound in these contexts to history cycling commands. The only exception I&#39;m aware of would be `term-mode` which captures nearly all of your input and passes it on to the application.\r\n\r\nYou can of course adjust the respective keymaps to get the familiar behaviour back, but be warned that this will prevent you from moving the cursor elsewhere with the keyboard (the mouse can still be used to position it anywhere though). The general approach to this is finding out what commands are bound to the respective keys (`F1 k < key sequence > `) and what keymap they belong to (Emacs 25 provides this in the output of `F1 k`, but as I&#39;m not using that, I jump to the sources with the link present in the `F1 k` output and search these). Doing so reveals that the commands are `previous-line`/`next-line` and `comint-previous-input`/`comint-next-input`, the latter two being bound in `comint-mode-map`. Therefore, the following suffices:\r\n\r\n (eval-after-load &#39;comint\r\n &#39;(progn\r\n (define-key comint-mode-map (kbd \" ; < up > \" ;) &#39;comint-previous-input)\r\n (define-key comint-mode-map (kbd \" ;C-p \" ;) &#39;comint-previous-input)\r\n (define-key comint-mode-map (kbd \" ; < down > \" ;) &#39;comint-next-input)\r\n (define-key comint-mode-map (kbd \" ;C-n \" ;) &#39;comint-previous-input)))", "71" ], [ "Maybe the title should be changed? I think there are excellent *arguments* for these theories: aside from early U.S. founding documents like the Federalist Papers that support them, there are more explicit American political philosophers like <PERSON> who is worth reading on the subject. But you seem to be asking if a U.S. court has ever respected them. And by its current construction the answer to your question will, of course, be \" ;no. \" ; I.e., when accepted they are considered \" ;rights, \" ; and when not they are considered (by *the government*) \" ;crackpot theories. \" ;", "781" ], [ "I won&#39;t address the legal questions: You would need to consult a solicitor in your jurisdiction if you&#39;re concerned with that.\r\n\r\nPractically matters of this magnitude rarely get litigated once liability has been accepted. It would be more common to confirm the terms of coverage with the roofer&#39;s insurance. As soon as an insurer says, \" ;Yes, we will cover the cost of repair, \" ; the question is, \" ;Will you repair it, or shall I arrange for repair? \" ; The advantage in the latter case is that you get to select the craftsmen to do the repair. The advantage in the former is that you expend less effort, but you *might* not like the craftsmen the insurer picks.\r\n\r\nTypically the insurer would require (and you would have the right to demand) that repairs be effected by licensed craftsmen in a \" ;timely and workmanship-like manner. \" ; If the insurer wants to inspect and bring in multiple craftsmen to quote the job that&#39;s their prerogative (within reason), but **it&#39;s not your obligation to do that for them**. Once you have presented a proposal for mitigation they either have to approve it or make their own counterproposal, which is subject to your acceptance. If this process is pursued in good faith by both parties it generally goes smoothly & ndash; at least in the U.S. where insurers are regulated by the government & ndash; because the insurer&#39;s time is worth money, just like yours.\r\n\r\nIn fact, insurers will often pay a premium to established contractors they know can get repairs done in a timely and proper fashion because they don&#39;t want to deal with blowback: You are already an \" ;aggrieved party \" ; because of the actions of their insured, so if anything were ever litigated it would not go well for them.", "174" ], [ "Take option #2. Your concern in that scenario is not realistic: A lawyer who \" ;reported \" ; you to the counterparty of your settlement for such a consultation would be disbarred so quickly and harshly that it might actually give you faith in the Bar Associations. Consultations with lawyers are [privileged](_URL_0_), and [lawyers have a duty to maintain client confidentiality in all but the most extreme situations](_URL_1_).\r\n\r\nFurthermore, you might (ultimately) be entitled to whistleblower compensation, and unless you&#39;re an SEC rules specialist you probably wouldn&#39;t know how to get that without an advocate like a securities industry lawyer.", "174" ], [ "I welcome the update. The old design was ok, but feels a little forced. I love classic typography, but something a little more modern feels appropriate now that a lot of WP sites don&#39;t really have that old style horizontal navigation any longer.\r\n\r\nThe new design looks more usable, but I would stay with the monochrome scheme personally.", "395" ], [ "You can use the < code > get_template_part < /code > to load different files into your template, using whatever combination of name/slug you want. Works friendly with child themes also, which might be worth investigating if you want to have multiple different themes. \r\n\r\n[The documentation says](_URL_0_):\r\n\r\n > **Function Reference/get template part**\r\n > \r\n > Load a template part (other than header, sidebar, footer) into a\r\n > template. Makes it easy for a theme to reuse sections of code and an\r\n > easy way for child themes to replace sections of their parent theme.\r\n\r\nPretty easy to use too:\r\n\r\n # if you want to include blabla.php into your template\r\n < ?php get_template_part( &#39;blabla&#39; ); ? >", "811" ], [ "@A.S. - Basically, yes, that will probably be the second thing you&#39;d say. First should be something like, \" ;Are you a lawyer, and are you available to provide me with legal advice on a securities industry matter? \" ; If they say yes, then the attorney-client relationship is established. Then, when you tell them who is involved, they would immediately run a conflict-of-interest check to confirm they can still advise you, or else tell you to seek another lawyer due to conflicts in their firm.", "174" ], [ "Normally, payments between entities other than Corporations of more than $600 need to be reported to the IRS using form 1099-MISC. This is the obligation of the payer, not the payee. You should expect the company paying yours to request a [Form W-9](_URL_1_) from you at some point, and then by February 16 of the next year you should expect to receive a [1099-MISC](_URL_0_) declaring all the money they paid you.\r\n\r\nRegardless of whether they report it (not everyone does this correctly ... or on time), you are legally obligated to include payments received in your business taxes.", "544" ], [ "I&#39;m afraid you can&#39;t influence this in the HTML export (as opposed to the LaTeX export which allows adding arbitrary captioning code) because the behaviour is hardcoded in Org&#39;s `org-html-paragraph`:\r\n\r\n (if (not (org-string-nw-p raw)) raw\r\n (concat\r\n \" ; < span class=\\ \" ;figure-number\\ \" ; > \" ;\r\n (format (org-html--translate \" ;Figure %d: \" ; info)\r\n (org-export-get-ordinal\r\n (org-element-map paragraph &#39;link\r\n &#39;identity info t)\r\n info nil &#39;org-html-standalone-image-p))\r\n \" ; < /span > \" ; raw))\r\n\r\nTherefore, the only alternative I can imagine is using raw HTML:\r\n\r\n #+BEGIN_HTML\r\n < div class= \" ;figure \" ; > \r\n < p > < img src= \" ;_URL_0_; / > < /p > \r\n < p > Lisp is a language of timeless elegance < /p > \r\n < /div > \r\n #+END_HTML\r\n\r\nDid you consider handing in a bug report with `M-x org-submit-bug-report`?", "470" ], [ "Post an answer if Spotify does it differently. My general understanding is that you \" ;put it out there \" ; however possible, and meanwhile register with the performance fee management companies in the big markets you think it might hit, then hope that they can catch and collect on all commercial use. Maybe releasing on major platforms like Spotify and iTunes you make a direct arrangement for compensation.", "609" ], [ "If this question weren&#39;t about programmatic access (for designing something like a printable cheatsheet), I&#39;d suggest you to look at either `evil-maps.el` or `evil-motions` in `evil-vars.el`.\r\n\r\nEvil&#39;s motions are bound in `evil-motion-state-map`, so a possible approach would be just traversing that keymap and tracking both the key and command while doing so. The problem with that is that (surprise, surprise), it&#39;s not just motions there, for example `digit-argument` is bound there to the number keys.\r\n\r\nAn alternative approach would be traversing `evil-command-properties` (which is a variable altered by every Evil command defined) and looking for items with `:repeat motion` as their property, these should be motions. You could then look up what key these are bound to.", "859" ], [ "See [tag:jury-nullification]. I&#39;m not a legal historian, so I can&#39;t say for sure what the laws on jury acquittals were at that time in that jurisdiction. However, when a jury has final discretion to acquit a defendant of a crime that&#39;s it: They can effectively ignore laws if they want to acquit someone. Such acquittals do not set a precedent or have any bearing outside of the trial in which they issue their verdict.", "273" ], [ "@MarchHo - Yes, *could* be something else. As <PERSON> suggested: at best this is a history question. There is probably a transcript of the trial, and given the attention to the matter I would imagine there is *a lot* of ex post analysis of the trial and acquittal that would be more illuminating than anything a general expert in Weimar German law (if such exists) might say. Maybe [_URL_0_] can help you track down primary and contemporary sources on the question.", "686" ], [ "\" ;Whistleblowing \" ; by publicizing classified information does not have a safe harbor in the law. In the U.S., everyone who is given access to classified information signs NDAs acknowledging that unauthorized disclosure of classified information will subject them to both civil and criminal penalties. (Even non-government NDAs subject violators to civil penalties, unless used to report a crime.)\r\n\r\nGranted: no contract can be used to punish someone for reporting a crime. But there are means to report crimes one sees in classified information without breaking the law.\r\n\r\nIf one believes that classified information showing law-breaking is being tolerated \" ;all the way to the top \" ; then, in principle, one would have to take one&#39;s allegations public, which *does* violate the law. Of course, such legitimate disclosures become highly politicized. If the \" ;whistleblower \" ; in such a case is actually charged then he can ask for a jury trial and try to convince the jury that breaking the law was justified, or even morally necessary.\r\n\r\n \" ;Treason \" ; is just one of the more severe crimes you can face for \" ;whistleblowing \" ; by injudiciously disclosing particularly sensitive classified information. The elements of treason are very simple. From [18 USC 115](_URL_0_):\r\n\r\n > Whoever, owing allegiance to the United States, levies war against\r\n > them or adheres to their enemies, giving them aid and comfort within\r\n > the United States or elsewhere, is guilty of treason....", "273" ], [ "You could only be charged with Treason in connection with leaking information if the government could establish not only that you violated your duty to protect the information but also that the leak provided aid and comfort to enemies of the country. Otherwise the *most* serious criminal charge you could face would be something like [Unauthorized disclosure of classified information](_URL_0_). But again, there are ways to share/reference classified information for the purposes of addressing wrongdoing that wouldn&#39;t require unauthorized disclosure.", "465" ], [ "The IRS rules on deductibility of business gifts are in [Pub 463](_URL_0_). Deductibility of business gifts \" ;for the eventual personal use or benefit of a particular person or a limited class of people \" ; is limited to $25 per person per year.\r\n\r\n[Furthermore](_URL_1_), \r\n\r\n > Cash & ndash; or cash equivalents, such as gift certificates & ndash; are looked\r\n > at differently through the tax authorities&#39; eyes.... You must\r\n > treat such gifts as additional compensation, no matter what the\r\n > amount. These gifts are subject to withholding.\r\n\r\nI wouldn&#39;t be surprised if there were a restriction on giving gifts to yourself, but since you&#39;re talking about a maximum tax benefit of single-digit dollars per year I don&#39;t consider it likely to make a material difference whether you claim it or not.", "544" ], [ "@Mr.A - *nomen agentis* made it answerable and on-topic. He is correct that such a broad question as you seem to want to pose would not be appropriate here. If you don&#39;t like what was done with this question you&#39;re welcome to try again with a different question. (You can even disclaim ownership of this question by using the \" ;contact us \" ; form.) NB: If you want to submit further questions along these lines you ought to first peruse the \" ;frivolous tax arguments \" ; law [mentioned here](_URL_0_).", "544" ], [ "Yes, you can be compelled by the government to reveal information: All it takes is a judge agreeing with a plaintiff or prosecutor that it has some relevance to a complaint over which the court has jurisdiction. If that point arrives and you want to protect that information you only have three choices:\r\n\r\n 1. Get a legal team good enough to convince the court otherwise.\r\n\r\n 1. Face the consequences of contempt of court for failing to supply the information requested.\r\n\r\n 1. Flee to another jurisdiction before #2 happens.", "465" ], [ "Suppose I commit a murder of a federal official and get away with it. Later I discover that some other unfortunate individual is being prosecuted for the murder I committed. I feel sorry for him, so I confess to a lawyer and wonder if I can do anything to get the innocent defendant free.\r\n\r\n 1. Can my lawyer communicate anything to the prosecutor (or defense counsel) that would cause me to be subpoenaed, at which point I would invoke my fifth-amendment rights? Can this be done in such a way that the prosecutor would absolutely move the court to compel my testimony under immunity?\r\n\r\n 2. Suppose I have been given prosecutorial immunity. Now I provide testimony that exculpates the defendant and implicates me beyond a reasonable doubt for a number of crimes in multiple jurisdictions: murder subject to both state and federal prosecution, as well as other felonies related to the commission of the murder that would have never come to light but for my testimony. *Am I truly immune to prosecution for any of those crimes in any U.S. jurisdiction?*\r\n\r\n 3. But now aren&#39;t I subject to civil liability? E.g., the family of the victim would absolutely win a judgement for Wrongful Death. How is it justifiable for a court to compel me to give evidence that will ultimately impoverish me, even though it does not result in my incarceration? Or is there some protection against this sort of collateral damage?", "273" ], [ "Yes: Many states have laws against \" ;hoax bombs \" ; or \" ;false bombs. \" ; E.g., [in Texas](_URL_1_):\r\n\r\n > (a) A person commits an offense if the person knowingly manufactures,\r\n > sells, purchases, transports, or possesses a hoax bomb with intent to\r\n > use the hoax bomb to:\r\n > \r\n > 1. make another believe that the hoax bomb is\r\n > an explosive or incendiary device; or\r\n > 2. cause alarm or reaction of\r\n > any type by an official of a public safety agency or volunteer agency\r\n > organized to deal with emergencies.\r\n\r\n[In New York](_URL_0_):\r\n\r\n > A person is guilty of placing a false bomb or hazardous substance in\r\n > the second degree when he or she places, or causes to be placed, any\r\n > device or object that by its design, construction, content or\r\n > characteristics appears to be or to contain, a bomb, destructive\r\n > device, explosive or hazardous substance, but is, in fact, an\r\n > inoperative facsimile or imitation of such a bomb, destructive device,\r\n > explosive or hazardous substance and which he or she knows, intends or\r\n > reasonably believes will appear to be a bomb, destructive device,\r\n > explosive or hazardous substance under circumstances in which it is\r\n > likely to cause public alarm or inconvenience.\r\n\r\nEven without the *mens rea* requirements of these crimes, the common-law standard for other crimes like Disturbing the Peace is the \" ;reasonable person \" ; doctrine. So even if you honestly didn&#39;t think your device resembled a bomb, if a court concludes that a \" ;reasonable person \" ; would think it did then you can be convicted of such lesser crimes.", "273" ], [ "Are there clear rules on when to use subpoenas for discovery as opposed to requests? E.g., is it correct that subpoenas are supposed to be served for discovery from third parties to a legal action, whereas discovery on a counterparty is supposed to be through requests?\r\n\r\nMy current understanding of *custom* is that a plaintiff should use requests to begin discovery & ndash; Requests for Production (RFPs), written interrogatories (IROGs), etc. When the counterparty objects to these the parties are supposed to \" ;meet and confer \" ; to try to agree on discovery. Only then is it considered proper for the plaintiff to file a Motion to Compel. Is my understanding so far correct?\r\n\r\nIf a Motion to Compel a response is granted then isn&#39;t it legally equivalent to a subpoena? If not what are the differences?\r\n\r\nAnd if everything so far is correct then isn&#39;t it weird that the more \" ;compelling \" ; process is used immediately on third parties and not on the direct adversary?", "273" ], [ "Good answer, and good proposed response. But does a warning/ \" ;reservation of rights \" ; letter like that generally merit a direct response? I don&#39;t see an actual accusation in it (though I don&#39;t claim to know what the best course of action is based on that observation). I did once respond to such a letter in a similar fashion, and received the reply, \" ;You should consult a lawyer for legal advice. \" ; Maybe these letters are just an ongoing joke in the Bar Associations.", "174" ], [ "When a lawyer needs an expert witness I assume he looks for three things:\r\n\r\n 1. Unimpeachable credentials\r\n 1. Motivation to support his case\r\n 1. The ability to favorably impress a jury, via a compelling demeanor and convincing, lucid, and engaging testimony.\r\n\r\nFor commonly litigated fields like medicine I assume there are directories and services for experts? But what about less common fields? Maybe statistics, ballistics, chemistry, applied physics?\r\n\r\nOr, looking at this question another way: Suppose I am an expert in a field and I have been told that I have a gift for engaging a lay audience in it. How might I alert interested lawyers to my willingness to serve as an expert witness? Is there a competitive market for expert witnessing?", "76" ], [ "> In all criminal prosecutions, the accused shall enjoy the right ... to\r\n > have the Assistance of Counsel for his defence. *(U.S. Constitution, Sixth Amendment.)*\r\n\r\nThe last Supreme Court ruling on this appears to be [<PERSON> v. Wainwright](_URL_2_), which applies the Sixth Amendment \" ;right to counsel \" ; for *indigent* defendants to the states. Apparently even that right is still [under contention](_URL_4_): [many jurisdictions](_URL_3_) [impose fees on defendants](_URL_0_) for the use of public counsel, regardless of their (in)ability to pay.\r\n\r\nI&#39;m still confounded by the reality that an American of *any* means could be *required* to pay for counsel in defense against criminal charges. Since, AFAIK, there is no way for an exonerated defendant to recoup the costs of his criminal defense, doesn&#39;t this amount to an \" ;unconstitutional taking \" ; of property?\r\n\r\nI.e., does the present system really say, \" ;You are presumed innocent, and you have the right to counsel in defense of that assertion, but you have to spend down to your last dollar to assert that right? \" ;\r\n\r\nIf true, I guess the \" ;American \" ; solution might be something like [legal insurance](_URL_1_), but the principle sounds terrible.", "174" ], [ "Your question is no longer consistent: Public counsel withdrew. Defendant retained private counsel. Defendant was never without counsel. Your question *suggests* that at some point Defendant requested different public counsel and was rebuffed. Did that occur? Or are you asking in general whether one has the right to *a public defender of one&#39;s choosing*? I.e., *if* he had wanted to retain the original counsel could he have moved the court to compel that?", "174" ], [ "The question is whether the lawyer *could be required to speak* against his client. E.g., client is in court or administrative hearings and says, \" ;My defense is that my attorney said *Z*. \" ; *Z* isn&#39;t implausible, but questionable enough that the opposition would like to confirm he said *Z*. Would they even entertain the idea of questioning the attorney? And if they did, would he just say, \" ;You know I can&#39;t answer that due to privilege? \" ; Or, under Rule 1.6(b)(5) would he not only answer, but be professionally compelled to speak up if he heard the client make that assertion in a proceeding?", "174" ], [ "Wow, [that](_URL_0_) is confusing: The lawyer for a woman accusing a man of sexual assault not only \" ;abruptly quit the case \" ; but even called a hasty press conference to *publicly declare*, \" ;I can only say that I don&#39;t know what&#39;s true and what&#39;s not true. I received the storyline from the mother. And it&#39;s my position that I&#39;m not comfortable with that version of the events. \" ; I wonder how *that* comports with his professional obligations?", "189" ], [ "You are talking about \" ;joint tenancy. \" ; I am familiar with bank accounts having multiple owners characterized as \" ;Joint tenants with rights of survivorship \" ; (JTWROS). This keeps the account out of probate: a death certificate simply removes the name of any owner who dies. *But* a probate court afraid that a deceased may not have enough assets to satisfy debts can still freeze the account for the duration of probate.\r\n\r\n**These really are not tools for estate planning.** For example, you can&#39;t use them to avoid gift or estate taxes. Also a JTWROS account is fully exposed to the liability/creditors of *every* owner. So **no, a JTWROS does not shield assets from creditors**. Finally, encumbrance of or distribution from a JTWROS account requires the consent of *every* owner. Any unresolved disputes are probably headed to court.", "354" ], [ "@DaleM - The Constitution actually enumerates quite a few more rights than that. Among them, as I understand it, is the right to not be deprived of property without due process. If the \" ;due process \" ; itself deprives you of property that seems like a glaring defect, for which this question seeks an explanation. E.g., if the state accuses you of murder, and ultimately concludes it was mistaken, it has already *taken* devastating amounts of your *time*, *reputation*, and *circumstances* that it can&#39;t restore. It has also taken your *money*, but at least that it *could* restore.", "273" ], [ "If what you show is correct and above-board then you are being sued in superior court. However it sounds unlikely that the plaintiff could have served you with notice of such a lawsuit without you realizing it, so if I were you I would *first* call the court to see if they do in fact have a case with the docket number listed. Then ask:\r\n\r\n* When and who served the original notice in the case (because if you really didn&#39;t get it then whoever said you did majorly screwed up and is probably in trouble)\r\n* Who the plaintiff&#39;s counsel is\r\n\r\nIf the letter was from a real lawyer on the California Bar, and that case really is open in the superior court with you as a defendant, then you really are being sued, and you should either get a lawyer or negotiate a settlement, because if you don&#39;t answer and defend then you&#39;re just going to have more judgments against you.\r\n\r\nIf any of the above does *not* check out then whoever sent that letter is in big trouble if you report it to the DA, postal inspector, and (if they are a real lawyer) the Bar.", "174" ], [ "@JamesTrotter Only a solicitor could address your prospects in your particular case. You might be able to assess on your own if this is just administrative -- e.g., it simply got filed in court before you got it straightened out with the DVLA, but ultimately you have the evidence necessary to absolve yourself of liability. If you *can&#39;t* tell or risk it, I don&#39;t know what solicitors run in your area, but consulting one might be prudent.", "174" ], [ "@NateEldredge Superior court is a significant step up from small claims court. Unless in CA you can continue a case from small claims in a trial court, and unless the docket number is the same, then I assume it would be a *new* action (even if likely brought pursuant to the small claims judgement). I&#39;m not a lawyer, but I would expect to be served notice of the new action before receiving an IROG.", "174" ], [ "<PERSON> -- I agree a reasonable argument can be made for that, and I won&#39;t keep it from closing if it gets the votes. However check my answer: I essentially took this as a, \" ;What the heck is this? \" ; question, and answered with, \" ;It probably means you&#39;re being sued, *in which case you need to get a lawyer*, but here&#39;s one way to confirm that first. \" ; These days I wouldn&#39;t put it past someone to use this as a phishing pretext.", "727" ], [ "@jqning - I think the U.S. government set the upper limit for passive security on its nuclear weapon sites. Nowhere is anything resembling a \" ;weapon \" ; employed. It&#39;s just layers of steel, cement, and earth. ( \" ;Active \" ; security, when present, takes the form of a guard detail.) Other than *maybe* zoning and fire codes I can&#39;t come up with any idea of how \" ;hardening \" ; or \" ;passive security \" ; might break any law.", "780" ], [ "**Probably**, up to $5,250 per year per employee, *if* the employer sets up a \" ;Qualified Educational Assistance Plan \" ; (a.k.a. a [section 127](_URL_0_) plan) that doesn&#39;t disproportionately benefit \" ;highly-compensated employees. \" ;\r\n\r\nThis, like most of the tax code, is grossly complicated. If you or your employer want to look into all the rules and means of using this section to pay small amounts of education expenses with untaxed dollars then \" ;QEAP \" ; and \" ;section 127 \" ; are the search terms to start with.", "0" ], [ "In general: If the contract specifies some term (or \" ;duration \" ;), then it can only be modified in accordance with its own terms. When the employment contract expires any future employment term is subject to negotiation, and benefits could certainly be modified at that time. There are exceptions to this in labor law, but those vary by jurisdiction and won&#39;t be addressed here.\r\n\r\nGenerally \" ;vested \" ; benefits like accrued vacation time or pension balances are treated like the property of the employee: They cannot be unilaterally reduced by the employer. One notable exception would be bankruptcy of the employer. I don&#39;t know where employee claims rank in Canadian bankruptcy law, but they are one of the debts that might not be paid in full.", "692" ], [ "Could you elaborate on that? All roads must go through a law enforcement officer? Even if one fears that those immediately available would be less-than-perfectly-objective in such a scenario? So if one manages to arrest a police officer, who promptly declares the arresting citizen to be \" ;under arrest, \" ; the citizen would be guilty of a crime if he *detained* the cop until he could be delivered to a court marshal or some law enforcement officer of an independent agency?", "273" ], [ "As long as you comply with Oregon laws regarding the display of the temporary registration/tag (as well as the state&#39;s other laws regarding insurance and documentation you must have when operating the vehicle on public roads) then you cannot be found guilty of operating an unregistered vehicle or improper documentation in Washington.\r\n\r\n*In theory* police in any state can pull you over for anything they think looks questionable. They can even, in theory, write you citations for violations of which you are not guilty. But when you present compelling evidence to whatever court they charge you in that you are *not* guilty then you should expect to be absolved of guilt.\r\n\r\n*In practice* police are familiar with temporary tags and new cars, especially for neighboring states. If they had any question they would run the temporary plate to confirm it is valid, that you are compliant with your state&#39;s laws, and send you on your way.", "669" ], [ "I frequently encounter situations in which there is likely civil liability between two parties but where the aggrieved party does not pursue legal action because they lack money and/or expertise.\r\n\r\nOccasionally I have approached lawyers when I see such cases with apparently positive (risk-adjusted) expected return from at least threatening, if not actually carrying out, litigation. And I usually get one of two answers:\r\n\r\n1. We&#39;re too busy to do something like that on contingency right now.\r\n1. We don&#39;t think the odds of prevailing and collecting merit the cost of pursuing that on contingency.\r\n\r\nI&#39;m not a lawyer, but I follow the industry well enough to know that there are a lot of lawyers lacking for work. If you&#39;re an unemployed lawyer, or a solo practitioner without a full caseload, then isn&#39;t *any* non-frivolous case with a positive potential payout worth pursuing? And if you&#39;re a firm with the sunk cost of offices, staff, subscriptions, etc., wouldn&#39;t you always want those assets working at 100% capacity?\r\n\r\nTherefore, why doesn&#39;t every practice *want* a queue of potentially profitable contingency cases that they can chip away at when they don&#39;t have a 100% paid workload? I can understand that if one took a contingency case into litigation, and then paid work came along, one wouldn&#39;t want the contingency case distracting from the paid work. But can&#39;t one accept a case on contingency *and* \" ;as time permits, \" ; so that in such an event one would simply drop the contingency case (or, if it looked promising, hand it off to some other lawyer in a slump)?\r\n\r\nAre there practical or professional reasons this is not standard practice?\r\n\r\nFrom an economic perspective this seems odd: As a client if I don&#39;t have the means to pursue a legitimate claim, then (on principle) I might be willing to give up to 100% of any winnings to a lawyer who does pursue it. As a lawyer, if I have a positive expected return to a contingency case, I&#39;d like to have the option of picking that up when I can&#39;t find other work (to within some error term & ndash; perhaps the alternative of running a coffee shop out of my office, or taking a minimum-wage writing job.)", "174" ], [ "@gracey209 - To your first question: Sometimes as a potential client, sometimes on behalf of a potential client. \" ;Risk-adjusted expected return \" ; means the expected winnings/settlement multiplied by the probability of getting it. So if by sending a demand letter there&#39;s a 10% chance they&#39;ll acquiesce to a $5,000 payment for release, then the expected return of the demand letter is $500. If you ask for a 50% contingency fee, then your expected return for writing the letter would be $250.", "512" ], [ "@gracey209 A \" ;queue of contingency cases \" ; would be ones where you say, \" ;I&#39;m willing to put it in my pile, and if I find free time and decide it&#39;s worth working yours (as opposed to some other one in the pile) it I will do so under terms X, Y, Z. But I won&#39;t guarantee that I&#39;ll ever work on it. \" ; The premise of this question is that there is a lot of potential settlement/litigation money sitting out there that nobody&#39;s claiming because lawyers don&#39;t conditionally queue contingency cases, and victims therefore don&#39;t always shop good cases around to lawyers who might want them in their \" ;queue. \" ;", "174" ], [ "In general it is the *policy* of law enforcement organizations to maintain the details of open investigations in confidence. Certainly, disclosing details of an allegation to an accused would be unusual, although some investigatory techniques do depend on strategic revelations.\r\n\r\nThe disclosure of a detailed complaint to the alleged perpetrator when the perp is a fellow law enforcement officer as described in this question, almost certainly constitutes gross misconduct. As with the initial complaint, when criminal behavior is alleged to have been perpetrated by a law enforcement officer, one need not take one&#39;s complaint to the department that employs the officer. It would be reasonable (and I would encourage) in such a situation to make a direct complaint to the District Attorney. One could also complain to an independent law enforcement agency: e.g., the Sheriff or State Police. (Similarly, if one&#39;s complaint involves a member of the DA&#39;s office one can instead complain to the State Attorney General&#39;s office.)\r\n\r\nThe unfortunate reality is that there often is a \" ;blue line \" ; of police who collaborate to protect each other, including illegally. When the police force is large enough, or when it has demonstrated itself corrupt enough, there will often be an independent \" ;watchdog \" ; agency created just to \" ;police the police. \" ; A citizen concerned that her complaints won&#39;t be given a fair hearing should take her complaint to these independent agencies until she feels that it has been appropriately dealt with.\r\n\r\nThe last safety valve that exists is a direct appeal to the courts. This would require the assistance and advice of an attorney. Fortunately, when the violations of one&#39;s civil rights reach such a level there are lawyers and entities (e.g., the ACLU) who may advocate on behalf of victims *pro bono*.", "273" ], [ "Fair enough. So to put a bow on the answer: I get a kick out of designing *mock* booby-traps and *pretending* my home is an impregnable fortress. I have warnings and everything. The warranted search party sees those and I&#39;m not around to say, \" ;No, it&#39;s all fake, see? \" ; So they freak out, call in SWAT, HazMat, bomb squad, etc. Any possibility I have incurred civil or criminal liability by staging this on my own property, out of public view or access, for (I allege) my personal amusement?", "273" ], [ "So *if I, as the potential client*, go to a lawyer and say, \" ;I agree to let you withdraw from this case at any time and for any reason, and to keep 100% of the award, because the chance that my adversary will get a taste of justice is all the reward I need, \" ; that won&#39;t fly? The *judge* could insist that the lawyer continue to pursue the case, even though both he and I agree to withdrawal of the lawyer and (if necessary) the case? And what are the typical limits on contingency fees?", "174" ], [ "I was surprised to learn that [police can question a minor without the presence, permission, or even notification of the minor&#39;s legal guardian](_URL_0_). (Even when investigating a matter unrelated to the guardian.) Apparently children can even be Mirandized! Which means that in theory they can demand a lawyer if questioned. Do they also have a right to demand their guardian?\r\n\r\nSince schools are pseudo guardians are there any restraints on school authorities detaining and questioning a minor, *if that minor demands they stop and summon his legal guardian*?\r\n\r\nOr, to put it more flavorfully: Does a minor saying, \" ;I want my mommy \" ; have the same legal effect as an adult saying, \" ;I want my lawyer \" ;? (Or can a school respond, \" ;From 8AM to 3PM *we are your Mommy*!)", "596" ], [ "The more I look into this the more astonished I am. E.g., [There is no federal law banning the controversial practices of restraint and seclusion](_URL_0_). \" ;This could mean something like using tape or rope to restrain a child in his seat. It could mean holding a student facedown on the ground. Seclusion is when a teacher or administrator puts a student in a locked room separate from other students. \" ; **So it appears children *can&#39;t* just leave.**", "596" ], [ "Here&#39;s a more elegant way of doing it:\r\n\r\n < !-- language-all: lang-el -- > \r\n\r\n (defun foo (arg)\r\n (interactive\r\n (list (if (consp current-prefix-arg)\r\n (read-number \" ;Number: \" ;)\r\n (prefix-numeric-value current-prefix-arg))))\r\n (message \" ;prefix = %0d \" ; arg))\r\n\r\n`current-prefix-arg` holds the value you&#39;d get from `(interactive \" ;P \" ;)`. You can convert it to what `(interactive \" ;p \" ;)` would return with `prefix-numeric-value`. Finally, the universal argument is represented as `(4)`, `(16)`, `(64)`, etc., depending on the times you&#39;ve hit `C-u`. It&#39;s tempting to use the `listp` predicate to detect it, but that would return `t` for no argument as `nil` and `()` are the same, so I&#39;m using `consp` instead to explicitly test whether we&#39;ve got a cons cell there.", "904" ], [ "Conventional guns are not \" ;registered \" ; in free America. (Only a few jurisdictions like NYC, DC, and maybe still Chicago, have laws requiring licensing of gun owners *and* registration of firearms.)\r\n\r\nThe interstate *transfer* of guns between individuals/owners is regulated by federal law and must be conducted by Federal Firearm Licensees (FFLs). Many states also regulate certain intrastate transfer of guns (e.g., handguns, or transfers to individuals who are not immediate family members). For a fee any [FFL](_URL_1_) local to you can ensure that any transfer is compliant with local, state, and federal law.\r\n\r\nIn general inheritance and transfer between family members is not restricted, so long as the receiver is not a \" ;[prohibited person](_URL_0_) \" ; ineligible to possess firearms. (Though, again, the details of this vary by jurisdiction and change frequently.)\r\n\r\nIn the situation described, if you are not a prohibited person, you could \" ;inherit \" ; the gun in Florida without any paperwork and simply mail it to yourself in Virginia. If you are uncertain or want to ensure that no laws are broken in that process, have the gun mailed to an FFL local to where you live, and pay the FFL to \" ;transfer \" ; it to you.", "781" ], [ "I&#39;m trying to perfect the run at the end of the solo of \" ;Heaven \" ; by Los Lonely Boys which occurs at about 2:13.\r\n\r\nI *think* this is how the left hand is played:\r\n\r\n E|-----------------------------------------------------------------\r\n B|-12-11----11-----------------------------------------------------\r\n G|-------13----13-11-13-11----11-----------------------------------\r\n D|-------------------------13----13-11-13-11----11-----------------\r\n A|-------------------------------------------<PHONE_NUMBER>-\r\n E|------------------------------------------------------------11---\r\n\r\nI&#39;m not so sure how to play the right hand (picking) part.\r\n\r\nIs he using alternate picking for every note, or are there pull-offs involved? \r\n\r\nCould economy picking be used to optimize it?\r\n\r\nWould it be easier if played in a different position?", "729" ], [ "The purpose of an NDA is to bind the two parties. The correct answer is to sign it in any way that satisfies both you and the counterparty.\r\n\r\nIn general, if you are a party to a contract as an individual, and someone hands you a stock contract designed for entities, either of the following should be acceptable:\r\n\r\n1. Sign it as an individual. You can leave fields applicable to entities blank, cross them out; it doesn&#39;t matter.\r\n\r\n1. You can present yourself as an entity. As a 1099 (in the U.S.) freelance contractor, at the very least you are a \" ;Sole Proprietor. \" ; You can declare yourself to be President or whatever title you want of your sole proprietorship. You can name your proprietorship (so long as you don&#39;t claim any entity type you have not established, like a Corporation, and so long as your name doesn&#39;t infringe somebody&#39;s trademark). Whatever floats your boat!", "174" ], [ "To clarify the final hypothetical: I have put up \" ;threats \" ; that are not meant to be seen by anyone. The only people who could see *and* feel threatened by them would be a warranted search party. So do I incur liability by posting the (empty) threats (for my own amusement)? Or because it&#39;s inside my property am I free of liability? This goes back to the earlier question: If I incur liability, then wouldn&#39;t that essentially be saying, \" ;Comport your life and keep your property under the assumption that you are subject to warranted, invasive search at any time? \" ;", "465" ], [ "Yes, there is no general restraint on signing a contract that incorporates conditions on future events. Most contracts are of that form & ndash; \" ;For consideration *X* from Party *A*, Party *B* will (or will not) do *Y*. \" ;\r\n\r\nYou could certainly say, \" ;If I establish entity *A* in timeframe *B* then the counterparty agrees to *C*. \" ;\r\n\r\nOf course: You should consult a qualified lawyer to draft or review the terms if you want to ensure that the contract will have the desired effect *and* be enforceable.", "174" ], [ "OK, that&#39;s a sort of surprising/alarming result, even though I can&#39;t pretend I&#39;m completely surprised by the answer. I *think* we&#39;ve seen an analog sometime recently: like somebody writing a threat in their personal journal, and then being prosecuted for it after the journal was subpoenaed? Saying, \" ;That wasn&#39;t intended for anyone else to see \" ; is not a defense. Which suggests that we indeed *should* comport our lives and property as if they are subject to invasive search at any time. And, by extension, as soon as they can read our minds we can&#39;t *think* illegal thoughts! Right?", "273" ], [ "Again, I might suggest *mens rea* here, but *explicitly* I&#39;m a law-abiding citizen doing something for my own amusement. I assert that I have no reason to *expect* to be raided, other perhaps than to observe that even wrong (innocent) addresses are raided disturbingly often. So does the fact that a LEO, whether accidentally or intentionally, raids my property under warrant, color my activities? If I&#39;m truly innocent of other crimes is my strange hobby/obsession defensible, and that defense disappears if I&#39;m convicted? Or is this activity illegal in itself? Like writing a threat in my diary?", "273" ], [ "Years ago I asked a question along these lines of a law professor. This is the answer I got:\r\n\r\nThe problem with lawyers is that you are not guaranteed results, any more than you are when you go to a doctor. You are getting professional advice, which is worth about as much as you trust it. So those are the proxies you look for:\r\n\r\n1. Are the bills detailed?\r\n2. Does the lawyer explain in plain English what he is doing and why it takes as long as it does?\r\n3. Does the lawyer have notable recommendations or references you trust?\r\n4. Is the lawyer willing to let you talk to other clients about their experience with the him?\r\n5. Has the lawyer had malpractice claims?", "174" ], [ "The school-teacher-student relationship has historically often been given some of the same privileges and legal exemptions that are granted to the family-parent-child relationship, corporal punishment among them.\r\n\r\nAll I can find on Pakistani law [suggests corporal punishment is legal but discouraged](_URL_0_):\r\n\r\n > At federal level, corporal punishment is lawful in schools under\r\n > Article 89 of the Penal Code. Ministerial directives in the different\r\n > provinces have instructed teachers not to use it, in some cases even\r\n > in private schools ... but these are clearly not enforced in practice.", "273" ], [ "My first question would be, \" ;*Can* you change a license at any time? \" ; I doubt you can make arbitrary and unilateral changes to a license after it has been accepted. If you know ahead of time what terms you might want to impose in the future I suspect you would have to outline them in the initial license.\r\n\r\nOne way around that problem is to only grant a license for a certain period of time. After that the license expires and users would have to review and accept a new license with whatever new terms you may wish to add.\r\n\r\nI suppose, in the limit, you could require the software to download the \" ;current \" ; license every time it is started and require the users to review and accept any changes from the last license version they accepted. Maybe you could even try to have running software callback with some frequency to a licensing server to check for new licenses, and then terminate if the user refuses a new license.", "497" ], [ "Presumably you are referring to works commonly called \" ;fan fiction. \" ; Under copyright law these *might* be considered \" ;derivative works \" ; and therefore subject to the rights of the copyright owner. However, they *might* also qualify for exemption from copyright enforcement under \" ;fair use. \" ;\r\n\r\nIt appears that the legality of fan fiction is not settled law, and the outcome of legal challenges have turned on facts specific to each case. Decent background on the question is [summarized on wikipedia](_URL_0_).", "609" ], [ "First of all, Vim and Emacs have different approaches to keymaps. Keep in mind that the following sentences are merely observations I&#39;ve made over time, I do neither know how they&#39;re actually implemented (yet), nor do I condemn either approach. They do only serve to explain the expectations of the questioner and how these differ from reality.\r\n\r\nIn Vim you&#39;re allowed to bind nearly any key sequence to a sequence of commands, even if these involve switches between Vim modes or insertion of text. In case a key sequence is used on its own *and* as prefix for other key sequences, Vim utilizes a timeout to decide whether to prefer the shorter key sequence. This is done in a transparent manner, in fact quite a number of Vim users aren&#39;t aware of this feature unless they use it for the insert mode where delays are much more noticable (or customize the respective setting for it).\r\n\r\nIn Emacs there is a sharp distinction between standalone keys and prefixes. A key can be only bound to either of those. There do exist a number of workarounds for this, including using hackery with timers (see `key-chord.el`) and devising commands that can read in extra input on their own. Evil makes use of the latter and on some occasions of the former as well (see its handling of the escape key).\r\n\r\nThe former approach with `key-chord.el` is reasonably popular, but [was tried by the author already](_URL_1_) and disregarded because `key-chord.el` simply doesn&#39;t support function keys. Given its implementation and limitations, it&#39;s about time for someone else to step up and create a more powerful package... Maybe some other day, I&#39;ve only toyed around with [rate-limiting keys](_URL_0_) so far.\r\n\r\nThis leaves the other approach. It&#39;s not ideal as it doesn&#39;t compose (all multiplexing must be defined manually and cannot be properly done by external packages at all), but good enough for customization:\r\n\r\n (defun my-evil-find-char (arg char)\r\n (interactive (list (prefix-numeric-value current-prefix-arg) (read-key)))\r\n (cond\r\n ((characterp char)\r\n (evil-find-char arg char))\r\n ((eq char &#39;f9)\r\n (foobar))\r\n (t\r\n (user-error \" ;Unknown key combination \" ;))))\r\n\r\n (define-key evil-motion-state-map (kbd \" ;f \" ;) &#39;my-evil-find-char)", "71" ], [ "I have added notches to the side of the key head in the past. One of the **advantages** to using this method is that you can find the correct key in the dark.\r\n\r\nStart with this:\r\n\r\n[![Image of a key][1]][1]\r\n\r\nTake a file to the edge of the key head. Move it back and forth to create a furrow. End up with this:\r\n\r\n[![Image of a key with notches filed into the large turning area][2]][2]\r\n\r\nAdd as many notches to the key as you require. If your key has a flat edge that isn&#39;t used by the pins to unlock the lock, you can also use that side.\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_1_\r\n [3]: _URL_0_", "129" ], [ "@lawlist The documentation states priorities may only be numbers and anything else is for internal use only. Yet the region uses what appears to be a secondary priority which is undocumented. I&#39;ve tried out values under 100, but they didn&#39;t have any effect unless you&#39;ve set the priority of show-paren to `nil` which had another side effect: showing the highlighted expression in reverse video.", "432" ], [ "I think a general question about attaching non-wooded things to a piece of wood as part of a woodworking project is on-topic here. \r\n\r\nI think making an initial edge on a blade is close enough to sharpening a blade and could be on-topic. Maybe it&#39;s the same technique that you&#39;d use if your blade becomes too dull to sharpen (which would certainly be on-topic).\r\n\r\nHowever, if you&#39;re trying to build a lathe from scratch and want to know what type of wires to use in your motor, we would probably flag that as off-topic.\r\n\r\nSo the distinction of whether a tool-building question is on-topic is probably gradual, but certainly at some point, it becomes off-topic.", "369" ], [ "The question is oddly phrased: The law does not give allowances for its violation.\r\n\r\nMany laws have exceptions. E.g., [the law against killing endangered animals contains an exception for defensive killings](_URL_0_).\r\n\r\nPerhaps you are thinking of safe harbors? For example, there are general provisions in the law like \" ;exigent circumstances \" ; that allow police to proceed with actions that, absent those provisions, would constitute violations of law.\r\n\r\n \" ;Permission \" ; to violate a right can be granted explicitly in the form of a warrant, which allows law enforcement to \" ;violate \" ; specific property and freedom rights.\r\n\r\nFinally, one might consider an executive pardon or [tag:jury-nullification] to be ex post \" ;permission to break the law. \" ;", "273" ], [ "Since this is a largely semantic question I think it&#39;s worth clarifying that, like anyone else, police **can and do break the law**, and they are supposed to be held accountable for violations of law just like anyone else. Yes, laws vary by situation, occupation, etc. But saying \" ;police cannot break the law \" ; sounds like you are saying either that police are infallible or else that they are above the law.", "273" ], [ "Update: `evil-define-key` is for a different purpose, namely installing a keybinding for a specific Evil state involving a mode&#39;s map. For example you could configure `emacs-lisp-mode` to do something different with `RET` in `insert` state. As you&#39;re not making use of this, `define-key` with `eval-after-load` or `with-eval-after-load` is the more sensible option for customizing Evil.\r\n\r\nPlease study `evil-maps.el` (which you can look up from inside Emacs with `M-x find-library`) to know what keymaps to modify. Given this information, the correct invocations are:\r\n\r\n (define-key evil-window-map (kbd \" ;C-k \" ;) &#39;evil-window-up)\r\n (define-key evil-window-map (kbd \" ;C-j \" ;) &#39;evil-window-down)\r\n\r\nOr if you want to do it properly, defer these forms until Evil is enabled:\r\n\r\n (with-eval-after-load &#39;evil-maps\r\n (define-key evil-window-map (kbd \" ;C-k \" ;) &#39;evil-window-up)\r\n (define-key evil-window-map (kbd \" ;C-j \" ;) &#39;evil-window-down))\r\n\r\nOn older Emacs versions than 24.4:\r\n\r\n (eval-after-load &#39;evil-maps\r\n &#39;(progn\r\n (define-key evil-window-map (kbd \" ;C-k \" ;) &#39;evil-window-up)\r\n (define-key evil-window-map (kbd \" ;C-j \" ;) &#39;evil-window-down)))", "71" ], [ "I can do a replacement of an expression with some variables to alternate symbols:\r\n\r\n {sx^2, sxy} /. {sx - > Subscript[J, x], \r\n sxy - > Subscript[J, x] Subscript[J, y]}\r\n\r\nbut if this replacement includes matching square braces, for example instead of $J_x$ above using:\r\n\r\n {sx^2, sxy} /. {sx - > [Subscript[J, x]], \r\n sxy - > [ Subscript[J, x] Subscript[J, y]]}\r\n\r\nthen the replacement fails with:\r\n\r\n Expression cannot begin with \" ;[Subscript[J, x]] \" ;.\r\n\r\nI&#39;d like this replacement (only for display purposes) to be $sx \\rightarrow [J_x]$, where square brackets is the notation we are using in class for an \" ;ensemble average \" ;.\r\n\r\nIs there a way to escape the square braces so that the sequence &#39;[&#39;, J_x, &#39;]&#39; will be treated as an opaque entity?", "352" ], [ "First of all, Emacs is a text editor. Teaching it other tricks is a neat pastime (I engage in it all the time), but I&#39;ve learned to lower my expectations. I know of [a single framework attempt](_URL_2_) (which the author scrapped for standalone implementation in CL) or maybe even two if the built-in `grid.el` counts (it&#39;s the basis behind `M-x tetris`, `M-x snake`, `M-x pong`, etc.). 3D games rely on graphical acceleration, typically solved with OpenGL, DirectX or whatever the favored low-level solution to leverage your GPU is. Emacs doesn&#39;t have FFI and even with the upcoming module support this kind of thing is possible, but far from on the same level of convenience as SDL or comparable solutions. You could alternatively write a software rasterizer, but I doubt this will have comparable speeds unless you restrict yourself to wireframe rendering maybe.\r\n\r\nRegarding the graphical abilities, the display engine allows you to display images. Most games go for tiling by generating many square-sized images and moving them around, others generate a single one, place it in a suitable location and update. Puzzle games can get away with updating on user input, anything more advanced will need to build its own game loop hosted on top of Emacs editing loop. It&#39;s tricky to do this in a speedy manner, but I&#39;ve succeeded in doing so for [a XPM Tetris](_URL_0_). [SVG allows you more freedom ultimately](_URL_1_), so that&#39;s where my future demos will go. For further details, check out my [Quasiconf 2015 talk](_URL_3_).\r\n\r\ntl;dr: You can make games, it&#39;s not a walk in the park, a 3D FPS is currently out of the question.", "71" ], [ "I&#39;ve got an $Assumptions variable that I&#39;d like to apply to my whole notebook, looking like so at the moment:\r\n\r\n $Assumptions = a > 0 & & a ∈ Reals & & m > 0 & & m ∈ Reals ;\r\n\r\nI&#39;ve actually got a number of variables, and would like to treat all of them as Real and greater than zero. Is there a way to apply such assumptions in batch for a set of variables?\r\n\r\nEDIT: comments suggested that only the > checks were required, and that {a,m} > 0 can be used. The greater comment appears to be true, but the set greater than doesn&#39;t appear to work:\r\n\r\n ClearAll[ a, m, x, psi] ;\r\n\r\n psi[x_, a_] = E^(-x^2/2/a^2) / Sqrt[ a Sqrt[Pi]] ;\r\n\r\n $Assumptions = a > 0 & & a ∈ Reals ;\r\n Integrate[ psi[x, a]^2, {x, -Infinity, Infinity}]\r\n\r\n $Assumptions = a > 0 ;\r\n Integrate[ psi[x, a]^2, {x, -Infinity, Infinity}]\r\n\r\n $Assumptions = {a, m} > 0 ;\r\n Integrate[ psi[x, a]^2, {x, -Infinity, Infinity}] // Simplify\r\n\r\n Integrate[psi[x, a]^2, {x, -Infinity, Infinity}] // FullSimplify\r\n\r\n(This gives 1,1, Abs[a]/a, and 1/Sign[a] respectively).\r\n\r\nSo the question is reduced to how to list a set of variables in Assumptions so that all of them are > 0 (without writing `a > 0 & & b > 0 & & c > 0 & & ...`).", "352" ], [ "I just came back from the first trip with my [f-stop][1] backpack. I have only good things to say about it. I have a smaller laptop, but my friend who has the same backback has a quite large and heavy 15 \" ; laptop, and that works out well. \r\n\r\n > *I have the Satori model, they seem to have had som production issues\r\nwith that one, so it&#39;s off the site right now, but apparently coming\r\nback in the spring. This particular model is quite big, and just barely fits within the carry-on regulations.*\r\n\r\nThey have plenty of different backpack sizes, and you buy the bag and the interior separately from each other, so you can adjust the balance between space for camera gear and other stuff, to fit your needs.\r\n\r\n\r\n [1]: _URL_0_", "798" ], [ "[Minors do not have full legal rights](_URL_0_), so the legal threshold for establishing curfews on unsupervised/unaccompanied minors is very low.\r\n\r\n[Curfews](_URL_1_) that apply to full citizens would be subject to [strict scrutiny](_URL_2_) if challenged in court because they infringe constitutional rights. However, for this reason, when broad curfews are enacted they tend to satisfy the requirements of strict scrutiny: namely, they serve a compelling government interest (like the preservation of life or property during emergencies) and are narrowly tailored to achieve that interest.", "273" ], [ "Get a corporate lawyer. The standard practice is to create two LLCs (usually in Delaware, which offers some of the best protections): A holding company owned by the individuals, and an operating company, owned by the holding company. If done correctly (which is why you need a lawyer to review the creation and operating agreements) it is nearly impossible for an adversary to follow the operating company back to the individuals without a compelling legal reason ordered by a court.", "174" ], [ "Great question! The broader form would be, \" ;***If I have suffered torts due to a crime, what efforts can I make to try to get the crime prosecuted, and if it is prosecuted does that help my attempts to recover damages in civil court?*** \" ; E.g., if the criminal case is pursued should I wait for it to be completed before pursuing civil action? Is there a means to recover my damages as part of some \" ;victim compensation \" ; or \" ;restitution \" ; if the criminal prosecution is successful, or do I always have to file my own legal action?", "273" ], [ "That&#39;s a silly semantic argument. Logically, nobody has any rights if everyone has the right to infringe the rights of others. So to avoid that trivial contradiction there&#39;s an implied caveat in statements like the one you quote (a nuance so obvious that nobody considered it worth elaborating): We are endowed with inalienable rights, and no one *should* deprive of us those, *except* that if we don&#39;t respect that premise then we *should not* expect to enjoy those rights.", "932" ], [ "@gracey209 - Basically, yes: IIRC the original idea is that a couple gets in a car accident. Passenger dies. <PERSON> has liability insurance, and is also beneficiary of Passenger&#39;s estate. <PERSON>, as representative of Passenger&#39;s estate, wants to sue <PERSON> (self) for wrongful death, thereby compelling Driver&#39;s insurance to pay out to Passenger&#39;s estate, whose beneficiary is (tada!) <PERSON>.", "174" ], [ "@gracey209 - Check the linked question: At least in Utah you can sue yourself as defendant in your capacity as the executor of the estate (as plaintiff)! Otherwise, sure, let us imagine that if necessary one would find a sympathetic executor to stand as plaintiff. The point is that, thanks to insurance, there are incentives for defendants to throw civil cases, but *not if they could implicate themselves criminally*. So this question is: Can that be done?", "174" ], [ "Practically it appears unlikely that Polaroid can protect that border shape. In addition to [the background on Polaroid&#39;s failed attempts to protect it described here](_URL_1_), you can find borders like that in use without attribution in other commercial applications and even AppStore products, like [HP&#39;s Social Media Snapshots](_URL_0_).", "345" ], [ "@gracey209 - Ah ha, that would explain why \" ;suing yourself \" ; is not going to work. Let me rephrase the question so that the plaintiff doesn&#39;t fall under those exclusions. E.g., maybe I was involved in a fatal accident, and even though I&#39;m not being prosecuted for manslaughter I really feel bad for the victim&#39;s family, who is eyeing my liability insurance. So I might say, \" ;Yeah, my insurer will probably drop me, but these people just lost their father. Losing my current insurance is a small price to pay for his kids getting $1MM. \" ; But I don&#39;t want any possibility of criminal blowback.", "273" ], [ "Without knowing what we&#39;re missing from the situation: I would **contact the Bar association** in any state that may have jurisdiction in the matter. They all have referral services, and if you explain that you have been denied service by licensed attorneys for \" ;reputational \" ; risk [I would hope](_URL_0_) that the Bar would take an exceptional interest in seeing that you find competent representation. Ensuring accessibility to legal counsel is, after all, one of the supposed foundations of the legal profession and its cartel.\r\n\r\nIf you are still unable to find a competent lawyer through the Bar please share the details of your efforts and their results, because that would be a fascinating and eye-opening situation! (And, in such a case, there would be some more extreme measures available to you. E.g., I imagine if you fully documented your efforts then you could petition a court to *compel* one of its officers to serve as your legal council.)", "174" ], [ "Nobody can enter your home without permission, nor can they stay on your property after you ask them to leave, unless they have a warrant, or unless there exists some \" ;exigent circumstance \" ; (e.g., \" ;hot pursuit \" ; by police, or evidence of something like a fire or medical emergency). Obviously neither of these exceptions applies to a census worker.\r\n\r\nSomeone (including a census worker) who enters your home without permission could be charged with various crimes (e.g., Breaking or Entering). Likewise, someone who stays on your property after you ask them to leave could be charged with lesser crimes like \" ;Trespass. \" ; In any case, only the law enforcement system can prosecute crimes, so someone faced with such a situation should call the police and/or file a criminal complaint.", "273" ], [ "@DanBryant Unless the law obligates you to speak with them *on your property* (which I can&#39;t see that it does) then you are correct. Furthermore, you could avoid breaking the law by providing them some other means of \" ;speaking \" ; with you -- a telephone number, an Email address, a public place and time of your choosing. E.g., \" ;Sure, I&#39;ll speak to you. Get off my property. Come back to my curb tomorrow at 8AM. I&#39;ll be sitting in my patio chair just out of the right-of-way, and you can stand in the right-of-way and speak for as long as the law requires me to be there. \" ;", "823" ], [ "@phoog - *Government worker* and *minimum fuss* aren&#39;t phrases I find easy to associate ;) In the ideal world it would be, \" ;I decline; here&#39;s my fine. \" ; I have no idea whether the Census Bureau or its employees have the ability or inclination to behave that competently. I wouldn&#39;t be surprised to hear that somewhere is a citizen who responded but has not only been erroneously fined but also called every business day since then by agents re-soliciting their response to the survey.... So there&#39;s my dose of cynicism for the day!", "818" ], [ "The right to dispute credit card charges is at least two steps away from litigation. First the credit card company investigates any dispute/charge-back to determine whether to hold the consumer responsible, and whether to pay the company claiming the charge. Then, if either of those parties disagrees with the credit card company they are typically subject to arbitration before anyone can sue in court.", "687" ], [ "Only if the OP takes it to arbitration. People dispute charges all the time. They virtually never take card companies to arbitration over a disputed charge. **The correct answer to the question&#39;s first level is: \" ;In the worst case, if the credit card company thinks you&#39;re abusing the dispute system, they can close your account. \" ;**", "687" ], [ "At least in the U.S., criminal investigations are privileged. The victims of a crime do not have a special right to information while an investigation is open; all information made public is done so at the discretion of the investigating officers. Only once an investigation is closed is there considered to be a public right to know the results of the investigation, and even then many \" ;work-product \" ; details can be withheld from the public.\r\n\r\nUnless India has much more liberal \" ;right-to-know \" ; laws (which I doubt) the only means by which you can obtain information is by appealing to the sympathies of the investigators and convincing them that whatever information you seek will not jeopardize their investigation.\r\n\r\nOnly if you suspect and can provide compelling evidence of corruption or gross incompetence could you appeal an investigator&#39;s discretion to another law enforcement agency, or to a court.", "273" ], [ "You can use cyanoacrylate glue to fit the \" ;glass \" ; back together. The bond will probably not be as strong as the original if it is glass.\r\n\r\nFollow the instructions on the glue bottle for the best results.\r\n\r\nA lot of glass lens are made from some type of plastic material. Glues can damage the lens in those cases.\r\n\r\nThe only good repair is to replace the lenses.", "129" ], [ "It&#39;s possible to specify a string instead of a mode, but this only works for subdirectories. So I&#39;ll use `nil` instead to match all modes, then the `eval` key to change the major mode conditionally:\r\n\r\n ((nil\r\n (eval\r\n (lambda ()\r\n (when (string= (file-name-nondirectory buffer-file-name)\r\n \" ;file-name.extension \" ;)\r\n (my-mode))))))\r\n\r\nA downside of this approach is that the `eval` key is unsafe, so you&#39;ll need to confirm the variable permanently for this to have an effect.", "730" ], [ "I&#39;ll address the potential effect on the site. If SE is unable to find enough qualified users to moderate, the site will be shut down.\r\n\r\n > What does this mean? If there&#39;s enough moderation for a public beta\r\n > site to consistently remain free of spam, for flags to be cleared, and\r\n > for our Be Nice policy to be upheld, your site will remain open.\r\n > However, if community leaders drop off, flags sit without being\r\n > addressed, and we can’t find any suitable volunteers to step forward,\r\n > the site gets closed.\r\n > \r\n > < sub > from _URL_0_;", "101" ], [ "What you are describing is not \" ;phishing. \" ; It does, however, violate all sorts of laws against copyright and trademark infringement. Furthermore you would have compelling claims against the former employee for various torts & ndash; e.g., breach of trust.\r\n\r\nThe prudent course of action in this scenario would be to contact a lawyer assess the value of your claims and consider suing the former employee for damages and injunctions. If the potential damages (and the ability to collect them) are high enough you might be able to retain a lawyer&#39;s services on contingency.\r\n\r\nAt the very least you could send the former employee a \" ;cease and desist \" ; letter. Ideally that should be drafted by a lawyer, but there is plenty of boilerplate and samples to be found online if you lack the money to properly defend your business.", "174" ], [ "I have occasionally used fingernail polish. It will go on the same way as White Out. \r\n\r\nYou can also get non-gloss (matte) finishes so that your repair doesn&#39;t show as much.\r\n\r\nAs a side bonus, if the polish color doesn&#39;t match the paper color, you can use it to make art on the page. This will make it look like you decided to do artwork in the middle of the writing areas (camouflage).", "484" ], [ "The mode line is rendered from a list of segments, each of which come with their own special rules. See [Mode Line Data](_URL_0_) for the details. The symbol section contains a crucial hint to make your code work:\r\n\r\n > Unless SYMBOL is marked as “risky” (i.e., it has a non-‘nil’\r\n > ‘risky-local-variable’ property), all text properties specified in\r\n > SYMBOL’s value are ignored. This includes the text properties of\r\n > strings in SYMBOL’s value, as well as all ‘:eval’ and ‘:propertize’\r\n > forms in it. (The reason for this is security: non-risky variables\r\n > could be set automatically from file variables without prompting\r\n > the user.)\r\n\r\nI suspect [nyan-mode is doing it in a less than ideal way](_URL_1_), so here&#39;s my minimal example:\r\n\r\n (defvar my-nyan-mode-lighter\r\n (list \" ; \" ; (propertize \" ;:3 \" ; &#39;display\r\n `(image :type imagemagick\r\n :file ,(expand-file-name \" ;~/nyan.png \" ;)))))\r\n (put &#39;my-nyan-mode-lighter &#39;risky-local-variable t)\r\n\r\n (define-minor-mode my-nyan-mode\r\n \" ;Nyan mode \" ;\r\n :lighter my-nyan-mode-lighter)\r\n\r\n (my-nyan-mode)\r\n\r\nThe reason why I use a list of a space and an image is because it is convention to start a lighter with a space for separating it from the preceding ones.", "950" ], [ "Just before printing, remove the paper from the printer and fan it to prevent the paper from sticking. One of the sources I reviewed said that in an arid environment, fanning could cause sticking due to a build up of static electricity.\r\n\r\nGrab one end of the paper with one hand. Grab the opposite side with the other hand. Bend the paper (without causing damage) so that an arch is formed. Using your thumb (either hand will work for this), release that side so that the paper is allowed to separate.\r\n\r\n[![Picture showing how to fan the paper][1]][1]\r\nImage from [Lexmark][2]\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "214" ], [ "No, generally only the state can \" ;press charges. \" ; You can encourage the state to do that by reporting the saga to the Attorney General, which typically maintains an office devoted to consumer protection. That office may help resolve your problem, or it may just add it to a file and when the file gets big enough it will prosecute the business.\r\n\r\nInsurers also have a state regulator, and you could report your grievance to the regulator. The possible results are the same as with the Attorney General, but typically the regulators are more focused on their subjects.\r\n\r\nYou should also notify your bank that it was a \" ;fraudulent \" ; transaction ( \" ;fraudulent \" ; in quotes because there&#39;s a good chance it was in reality either an honest or negligent mistake). Banks have offices devoted to dealing with those.", "174" ], [ "The rules governing ownership of intellectual property are essentially the same as the rules governing ownership any other property. *Somebody* retains ownership when a company goes defunct. It may not be as easy to determine who that owner is, because with real property \" ;possession is nine-tenths of the law. \" ; But a good starting point would be a presumption that, absent a contract indicating transfer to another entity, the original author of the IP still owns it.\r\n\r\nI.e., if someone can establish authorship, the burden would fall to the entity claiming legitimate license to that author&#39;s IP to prove by a preponderance of evidence that rights passed from the author to it.", "609" ], [ "To provide a counterpoint to the other answers: **Yes**, I think certified and practicing professionals should be accorded deference not given users of uncertain or anonymous expertise. This applies to many Stack Exchanges. And the problem, to a degree, is that SE is not in the business of vetting users or credentials.\r\n\r\nFor example, we did have one user who claimed a J.D. in his profile and who didn&#39;t have anything of the sort. Fortunately, his utter lack of expertise was unmistakable in his answers.\r\n\r\nOn the other hand, one particularly valuable user is a retired lawyer. You have to take a few steps past his profile to discover that fact. When he writes an answer he simply answers the question based on his knowledge and experience. They are excellent and correct answers, but they almost never cite anything so if you don&#39;t know that he&#39;s an experienced lawyer and know that he is correct you may complain, \" ;Hey, I don&#39;t see any references, why is this a good answer; why should I trust what you say? \" ;\r\n\r\nPerhaps our most valuable user to date is a practicing lawyer and is quite open about using her professional experience to inform her answers.\r\n\r\nI believe active members of the community quickly get a sense for the expertise of the more prolific answerers. But two problems remain:\r\n\r\n1. Somebody new to the scene, or just passing through, doesn&#39;t have that context.\r\n2. When a bona fide lawyer shows up and starts answering questions it isn&#39;t immediately clear that they deserve the deference they should be accorded due to their expertise.\r\n\r\nTo solve these problems I would love to pin a badge on certain answerers that says: This is a professional, so listen to what they say! But not all lawyers want to advertise their credentials, and, as we have already seen, some pretenders would claim authority they lack.", "109" ], [ "The *most* they can possibly give you are forwarding addresses and contact information for an entity they represent.\r\n\r\nOne of the functions of a corporation is to shield the identity of owners. If an owner specifically does *not* want to be found then you&#39;re not going to find that person through its registered agent.\r\n\r\nHowever, there&#39;s no law against asking. At the very least you could ask the registered agent to forward a message asking that you be contacted. Though, AFAIK, they can&#39;t be *required* to forward anything but legal notices.", "465" ], [ "The question is vague enough that I&#39;m not sure I have the precise answer, but it seems to me that it may be referring to the work *[The Art of Noises][1]* (1913) by <PERSON>.\r\n\r\nThe original is in Italian, but there&#39;s an [English translation here][2]. A couple of choice quotes getting at theme:\r\n\r\n > In antiquity, life was nothing but silence. Noise was really not born before the 19th century, with the advent of machinery. Today noise reigns supreme over human sensibility. ...we are approaching noise-sound. This revolution of music is paralleled by the increasing proliferation of machinery sharing in human labor. In the pounding atmosphere of great cities as well as in the formerly silent countryside, machines create today such a large number of varied noises that pure sound, with its littleness and its monotony, now fails to arouse any emotion.\r\n\r\nand\r\n\r\n > ...music has developed into a search for a more complex polyphony and a greater variety of instrumental tones and coloring. It has tried to obtain the most complex succession of dissonant chords, thus preparing the ground for Musical Noise. This evolution toward noise-sound is only possible today.\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "229" ], [ "So, this is nearly impossible to give a concise or specific answer, as it&#39;ll depend a lot on your tastes and/or your goals. Without knowing that, here&#39;s how I&#39;d go (...and have gone) about it.\r\n\r\nFirst, go here -- _URL_2_ -- and click around. Seriously. Listen to the sample, read his descriptions. This will give you a sense of how the different microgenres relate to one another, both stylistically and temporally. Since this site also provides samples for every (I think) microgenre, you should also be able to find a few bands to your liking to help direct your path.\r\n\r\n(Do note that this site, while extensive and overall pretty great, is not without its faults. In particular, the author appears fairly opinionated and may have biases. Additionally, while the samples are *representative*, they are not necessarily the *best* or, especially, the most well known.)\r\n\r\nSecond, pick up the \" ;consensus \" ; picks for best in genre. You can google things like \" ;best electronica albums \" ; and see some lists -- [this NME list][1] looks pretty decent -- but I&#39;d just go to [Acclaimed Music&#39;s][2] consolidation of lists and pull up their genre-specific rankings. They do break them out somewhat based on subgenre. (Due to their site design, I can&#39;t link directly, but click the \" ;genre \" ; link in the header.)\r\n\r\nAt this point, you should begin to see how things fit together, what People generally consider the best, and have an idea of what/who you like. Then, it&#39;s just a matter of digging deeper.\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "307" ], [ "It&#39;s a bug for projectile to do this synchronously, not for Emacs to do what it&#39;s told to. There is no magical switch that makes every single operation in Emacs non-blocking, it&#39;s up to package authors to leverage its possibilities properly. You may believe it&#39;s normal for a text editor to not ever hang up, but that&#39;s their authors respecting this very basic design assumption.", "71" ], [ "Agents of the state are not presumed to be perfect. The justice system and due process are designed to weigh all the nuances of evidence and try to provide a fair outcome. So in a trial the fact that there was a conflict of interest would and should be brought to light, and the judge and jury will consider that conflict and how it should color the evidence.\r\n\r\nEven when there is no *explicit* conflict of interest, a great deal of a criminal trial may be spent by each side trying to impress upon the jury the reliability or dubiousness of the provenance and import of every piece of evidence.\r\n\r\nOnly when the justice system determines that fundamental rights have been violated (e.g., fourth- and fifth-amendment rights) will it completely exclude evidence so procured.", "273" ], [ "@TechnikEmpire - Well it&#39;s the defense&#39;s job to make it clear that it&#39;s a big problem. Prosecutors are *supposed* to be impartial ministers of justice, and police are *supposed* to be detached officers of the law, but in practice they have an extremely wide berth before their actions are considered so abusive as to be subject to anything more than scrutiny or question. As people they tend to enjoy seeing \" ;bad guys \" ; put away, and so in practice they rarely consider it \" ;a problem \" ; if questionable conduct still leads to the right result.", "273" ], [ "Under print settings there are a number of options for print format (working, condensed, printout, printout grey, ...).\r\n\r\nIt seems clear that the print settings are configurable, but perhaps that is only possible programatically? I&#39;d like to know to edit the print settings for a document, so the font size for the selected print setting is increased in size.\r\n\r\nUnder options inspector I did find Printing Environment, but don&#39;t see font options there. I also found global print options, and tried changing magnification:\r\n\r\n[![magnification][1]][1]\r\n\r\nfrom 1 to 1.5, but didn&#39;t see the effects of that when I did print preview.\r\n\r\nEDIT: \r\n\r\nA partial answer to this question is using Style:\r\n\r\n _URL_0_\r\n\r\nThis allowed me to increase the size of unreadably small output (both in the notebook and when it is printed). However, I&#39;d still like to know how to magnify all the font sizes in the document when printing it, if this is possible, or set a minimum font size for all printed output.\r\n\r\n [1]: _URL_1_", "30" ], [ "For what it&#39;s worth, I&#39;m tending to agree with @JasonC here. It&#39;s hard to imagine we&#39;ll ever be at a place where there&#39;s so many obscure finishing questions that it becomes distracting, and we&#39;re wishing we had marked the early ones as off-topic. At worst, we&#39;ll get a few, no one will know the answer, and they&#39;ll just sit there, unanswered.", "359" ], [ "*Disclaiming* liability might offer some protection, but there&#39;s no general immunity from being sued. You might do what many large companies do and assert a mandatory arbitration clause in your license. (Many argue that such clauses actually form a larger barrier to being pursued for liability, especially when damages are small.)\r\n\r\nYou don&#39;t *need* to insure yourself unless required to by some contract. (E.g., it&#39;s *conceivable* that some app store will require that all apps be published by entities that carry some level of liability insurance, but I don&#39;t actually know of any such cases (yet).)\r\n\r\nYou can, however, *choose* to buy professional insurance policies that cover claims against you and/or your business resulting from unintentional harm.", "174" ], [ "@JRFerrell - You don&#39;t *have* to \" ;register \" ; anything to receive protection under either category. Logos are protected by copyright, period. If a logo is used (without infringing copyright) as a trademark it is also protected by trademark law. Trademark is most typically asserted for words or phrases used in branding, which can&#39;t be copyrighted. I can&#39;t imagine a scenario in which a copyrighted logo would get further protection by use or registration as a trademark. (But maybe there&#39;s some rare \" ;fair use \" ; copyright exception that is not granted for trademarks?)", "345" ], [ "@JRFerrell - For a large company the marginal cost of registering a trademark is virtually zero. In theory I would always prefer to seek protection under as many laws as possible if the cost were zero. In any case, you should pose this as the separate question it has become: I.e., \" ;*Why would a company register a logo as a trademark? Does a trademark offer any protections that the logo&#39;s copyright does not?* \" ;", "345" ], [ "If I arrange output in a `Grid`, which is nice to summarize work, the output ends up greyed (or not bold?) compared to regular output. Here&#39;s an example:\r\n\r\n ClearAll[ display, nplus, nminus, theta, phi]\r\n\r\n display = {theta - > Subscript[θ, 0], phi - > Subscript[ϕ, 0]} ;\r\n nplus = {E^(-I phi) Cos[theta/2], Sin[theta/2]} ;\r\n nminus = {-E^(-I phi) Sin[theta/2], Cos[theta/2]} ;\r\n\r\n {#1, \" ; = \" ;, (#2 // FullSimplify) /. display // TraditionalForm} & @@@ {\r\n { \" ;|+ > \" ;, nplus // MatrixForm},\r\n { \" ;|- > \" ;, nminus // MatrixForm}\r\n } // Grid\r\n\r\n (nplus /. display) // MatrixForm // TraditionalForm\r\n (nminus /. display) // MatrixForm // TraditionalForm\r\n\r\nWhich looks like:\r\n\r\n![output comparison grid vs default][1]\r\n\r\nThe greyed output can be almost unreadable once printed (using a print configuation: `Printing Settings - > Printing Environment - > Printout`).\r\n\r\nWhat is controlling the `Grid` vs normal output style, and how can I change it to match the default output style?\r\n\r\n [1]: _URL_0_", "950" ], [ "What you&#39;re proposing isn&#39;t really a text object. To recap:\r\n\r\n > Text objects are defined with `evil-define-text-object`. In Visual\r\n > state, they modify the current selection; in Operator-Pending state,\r\n > they return a pair of buffer positions. Outer text objects are bound\r\n > in the keymap `evil-outer-text-objects-map`, and inner text objects\r\n > are bound in `evil-inner-text-objects-map`.\r\n > \r\n > Common text objects like words, WORDS, paragraphs and sentences are\r\n > defined via a corresponding move-function. […]\r\n\r\nThe definition of a text object as movement means that it must be part of the buffer to allow each Evil operator to work upon it. If you look at the arguments of `evil-delete` for example, you&#39;ll notice the first two are BEG and END.\r\n\r\nTherefore I can only imagine the approach of overloading the operators you have in mind to work. [It isn&#39;t nearly as easy to do as in Vim](_URL_0_) (where you just override a mapping with your custom command and are done), but still possible.", "538" ], [ "You are in the right. Your only mistake, perhaps, was doing anything via telephone. Everything should have been done in writing. Fortunately there are *a lot* of consumer protection laws and government agencies that will help you rectify this if you are willing to do the work.\r\n\r\nThere is a formal process for disputing anything on your credit report. Contact the big three credit agencies to begin that process. I haven&#39;t done it myself, but I don&#39;t believe it is more onerous than sending a letter containing the details you posted here as well as copies of supporting documents.\r\n\r\nCollections agencies are regulated by at least one government agency in each state and numerous laws. Contact the collections agency and tell them you&#39;re going to report them if they don&#39;t rectify the adverse report within 10 days. If you do it by phone follow-up with a letter. Then report them if they don&#39;t. A quick web search will tell you who their regulator is and what rights you have.\r\n\r\nThe only claim you have against the doctor is if you were covered by insurance and he accepted the insurance at the time. If so his fees would have been governed by an agreement with the insurance company. It&#39;s tough this long afterwards, but in theory you could take up the matter with the insurance company, the state medical licensing board, and (not that it&#39;s really worth anything) the BBB.", "174" ], [ "> if I printed it in a different orientation it would delaminate too easily\r\n\r\nIf you flip it around, the orientation of the layers would be the same, except that you would print from top to bottom instead of bottom to top.\r\n\r\nWith the arch opening to the top, there would be **no overhang**. Without overhang, you don&#39;t need support structures (red). The holes for screw heads have flat roofs (green) that the printer should be able to gap by moving over them quickly.\r\n\r\nHere&#39;s an image that shows the original orientation at the top and my proposed flipped orientation at the bottom. The blue lien is the print bed.\r\n[![both orientations][1]][1]\r\n\r\n\r\n [1]: _URL_0_", "214" ], [ "With [tag:fdm] printers, the 3D object that should be printed can be positioned anywhere in the build volume. But it&#39;s only practical to place it on the bottom, because otherwise support material would be necessary.\r\n\r\nstereolithography has the same problem. Even though the photopolymer can be cured at any position in the build volume, the result would drift away if it was not held in place by support material.\r\n\r\nThe powderbed based printers (either powder+binder or any of the laser/electron beam sintering/melting variants) do not have this problem, because they continuously fill the entire build volume with powder. The support material that other printing technologies require is part of the powder based printing anyway. It would be possible to pack the build volume with many prints and print them in one go.\r\n\r\nGiven that the machines are relatively expensive, it would be economical to increase the throughput. A company that does use such printers heavily could wait a certain amount of time until a few print queued up that fit together in the build volume and only then start the process. Do people do this?", "214" ], [ "@KaushalModi Deciding before executing a program whether it will terminate. This one isn&#39;t as severe, but close, the very act of executing a command in Emacs will run hooks, if a command was defined with a macro running hooks (like nearly every major mode) these will be run as well and finally, any code of the command can run hooks or functions running hooks which can go arbitrarily deep.", "71" ], [ "For that you&#39;d need to write a company frontend using Helm. I&#39;ve actually attempted to do such a thing, but gave up once I realized that Helm sucks for this task because first, it pops up at a completely different place than where you are completing (makes for an annoying distance your eyes have to travel) and second, the keys to navigate Helm are completely different from what you&#39;d typically go for for completion. In other words, the impedance mismatch is too great.", "330" ], [ "For regular firearms you only have to comply with the laws of the state to which you are moving. Since Utah (presently) has no state-specific restrictions on ownership or possession of AR-15 rifles that means in this case, as you say, \" ;no problem. \" ;\r\n\r\n(The only exception would be registered NFA items & ndash; e.g., machine-guns, suppressors, SBR, SBS, DD, AOW & ndash; for which the BATFE typically requires notice when you are moving them interstate. But if you have gone through the trouble of registering such an item, you probably already know that.)\r\n\r\nFinally, you have to exercise some care in the actual interstate transportation of firearms: *If you are passing through a jurisdiction where possession of them is restricted* then you have to follow the rules provided in the [Firearms Owners Protection Act](_URL_0_). In particular:\r\n\r\n > Under FOPA, notwithstanding any state or local law, a person is\r\n > entitled to transport a firearm from any place where he or she may\r\n > lawfully possess and carry such firearm to any other place where he or\r\n > she may lawfully possess and carry it, if the firearm is unloaded and\r\n > locked out of reach. In vehicles without a trunk, the unloaded firearm\r\n > must be in a locked container other than the glove compartment or\r\n > console. Ammunition that is either locked out of reach in the trunk or\r\n > in a locked container other than the glove compartment or console is\r\n > also covered.", "780" ], [ "I&#39;m in the process of building a 3D printer and have all the stepper motors wired up and the controller connected to the computer running pronterface.\r\n\r\nI can move each axis and also send g-code to the printer.\r\n\r\nNow **how can I define the current position to be the 0/0/0 position?**\r\nI&#39;d like to move the printer into a position where I think should be the zero position and define it as such in pronterface somehow.", "214" ], [ "It&#39;s not the wire or its specifications that melt anything, it&#39;s the power that goes through them, which is determined by the load: the power supply that supplies your printer. The standard wire can handle what the outlet can supply. If your printer draws more power than that, you have other problems. If you buy a bigger TV you don&#39;t start thinking about metric wire sizes either, do you?", "214" ], [ "*Very* basically speaking, electricity works like this:\r\n\r\n 1. There&#39;s some source that delivers a certain **voltage**.\r\n 2. You have a device that operates at a certain voltage. **The device voltage and supply voltage should always match.** No, don&#39;t put that 120V US device in a 230V outlet in Europe.\r\n 3. The device does something. By doing something it draws **current**. Most devices also draw some current when not doing anything.\r\n 4. How much power your device draws is the product of these two values:`voltage x current = power` \r\n\r\nSo far, so good. In your case:\r\n\r\n 1. \r\n > US AC outlet.\r\n \r\n the **voltage is 120V**.\r\n 2. On [this other question of yours][1] you linked to [this power\r\n supply on amazon][2]. Besides being available gift-wrapped, it\r\n states the following feature:\r\n \r\n > You can choose the input voltage (110V/240V) by switch.\r\n \r\n 110V ≈ 120V, which means the **device voltage matches your supply\r\n voltage**.\r\n 3. The supply can deliver 30A at 12V on the DC side which means 360W.\r\n If it could transform the electricity ideally, without any\r\n inefficiency, that would be **3A** at 120V on the AC side. But your\r\n supply is unlikely ideal. [Wikipedia suggests 60-95% efficiency][3].\r\n Let&#39;s be super pessimistic and assume 50%. That means half the power\r\n that goes into the switch power supply is turned into heat. In order\r\n to still get the 360W out, you have to insert 720W. That means\r\n **your device draws 6A** on the AC side.\r\n\r\nWhat does this all mean for your wire?\r\nWhat wire size do you need for this supply?\r\n\r\nCoincidentally, the above link to the amazon website showing your power supply also suggests the following PC ATX power supplies to me:\r\n\r\n - [Sentey Power Supply 725 Watt][4]\r\n - [Sentey Power Supply 1000 Watt][5]\r\n\r\nLet&#39;s get this straight: You can buy a power supply for a PC and plug it into your outlet without even thinking about what a wire size is. You&#39;d just plug and play. **That PC power supply will potentially draw more current** than **the power supply of your 3D printer**. A standard wire would be able to supply either one of the PC ATX power supplies linked above and would not have a problem delivering a lower current to the power supply of your 3D printer.\r\n\r\nThe switching supply doesn&#39;t have a plug like a PC ATX supply, but that on its own doesn&#39;t make it any less secure (if wired up properly). It&#39;s just less common for household appliances.\r\n\r\n > Ultimately, I&#39;d like to avoid a fire, or damage to the house wiring.\r\n\r\nThat&#39;s a good and valid concern. \r\n\r\nPC Power supplies deliver 12V and supply more than enough current (like the examples above). They are probably in use in your house already and did neither set it on fire nor damage the house wiring.\r\n\r\nA switching mode power supply is just as secure and if bought from a known brand unlikely to do you any harm either if used properly and within its specifications.\r\n\r\n**Ultimately**, this is not a question of secure electricity but a trade-off between secure electricity and the price to pay for it. The standard wire and it&#39;s specifications have little to do with this.\r\n\r\n---\r\n\r\nPersonally, I also use a cheap switching power supply made in china for my printer. It&#39;s very noisy and I pull the plug when I leave it unattended.\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_2_\r\n [3]: _URL_0_\r\n [4]: _URL_4_\r\n [5]: _URL_3_", "803" ], [ "There&#39;s no fighting a fine where the facts are not in dispute; only asking for clemency. Bring in evidence that you acted in good faith and corrected the infraction as soon as you were alerted to it. If you can determine why you didn&#39;t get a renewal application (e.g., did the state have an old address?) that might also justify the oversight.\r\n\r\nWhen I was cited for driving a friend&#39;s car that (unbeknownst to me) had expired registration the cop actually said if I renewed it promptly and brought evidence of that to court she wouldn&#39;t press the charge. Fifteen minutes later I was in front of a computer printing out a receipt. When I showed up to court a few weeks later and the judge saw the time difference between the citation and the renewal he joked to the cop, \" ;He renewed it fifteen minutes later? What did you do to him? \" ; Obviously they&#39;re used to dealing with far less attentive citizens.", "174" ], [ "An animated GIF is a multi-frame image to Emacs. You can display an arbitrary frame of it by specifying the `:index` property in the image specification. `image-animate` does modify the index of the given image specification with a timer.\r\n\r\nThat being said, [it works for me](_URL_0_). What you could do is finding the definition of `image-animate` with `M-x find-function`, then instrument it with `C-u C-M-x` and step through its execution to see what&#39;s going wrong. Alternatively, try figuring out whether something about the image spec is wrong, like by using an absolute file name as argument to `create-image`.", "93" ], [ "I think only moderators can see deleted comments. <PERSON> did the delete, apparently in response to a \" ;Not Constructive \" ; flag. Since I know your reputation here I agree the comment was helpful, but in isolation I can see how it could be (and was) taken as an ad hominem attack. <PERSON> will probably be up on [chat](_URL_0_) soon if you want to get his view or ask him to undelete.", "792" ], [ "Sure: No Constitutional rights are totally unencumbered. Even natural rights like the \" ;right to life \" ; are legally \" ;infringed \" ; through various theories (e.g., self-defense, capital punishment, warfare).\r\n\r\nThe Second Amendment [has been interpreted](_URL_0_) as a right to keep and bear weapons that would reasonably be used in self-defense or in military service. You don&#39;t have to go to strategic weapons like nukes to find \" ;reasonable infringement \" ; of that right. For example, even though the military and even police routinely use explosives, individuals are absolutely subject to the whims of a federal regulatory agency (the BATFE) as well as state restrictions if they want to keep and bear detonators.\r\n\r\nAlso, I&#39;m not aware of an *absolute* prohibition on the possession of nuclear devices by non-government entities. E.g., various government regulators oversee private entities that operate commercial and research nuclear reactors and other activities that put them all-but in possession of nuclear arms. If an individual *really* wanted to *legally* keep and bear a nuclear weapon it could probably be done with enough money and oversight. (**Amendment:** Except, as cpast points out in the comments, that [there *is* a law against private possession of nuclear weapons in the U.S.](_URL_1_) Which just goes back to the broad answer to your general question: In practice there are no unencumbered rights. Constitutional \" ;rights \" ; might better be called *things that require \" ;strict scrutiny \" ; and \" ;narrow tailoring \" ; of government infringement*.)", "781" ], [ "In my browser, I often keep a lot of tabs open as a sort of *to-do/reading list*, and sometimes those tabs include YouTube videos.\r\n\r\nIs there a way to **keep a video from playing again automatically** every time I reopen the browser? \r\n\r\nI&#39;m not as interested in a playlist hack or browser-wide setting that will turn off AUTOPLAY for *all* videos. I really need something to turn off particular tabs/videos specifically & hellip; **like a URL parameter?**\r\n\r\nI generally use Firefox, but if the solution is browser specific, a Chrome and Safari solution would also be helpful.", "261" ], [ "Your code is not doing what you think it is doing. The latter example wraps two forms in a lambda, so all that happens is that `sql-evaluate` is going to return an anonymous function (or `nil` if you&#39;re not in visual state).\r\n\r\nPlease don&#39;t do that. Use either `progn` for wrapping forms to be evaluated sequentially (with the last form as return value) or use special forms using an implicit `progn`, such as `when` (which is like `if`, but doesn&#39;t have an else clause, so it does allow you to specify as many then clauses as you need).\r\n\r\n---\r\n\r\nAnd now, a rewritten variant of the above (untested):\r\n\r\n (defun my-eval-sql ()\r\n (interactive)\r\n (cond\r\n ((evil-visual-state-p)\r\n (sql-send-region (region-beginning) (region-end)))\r\n ((evil-normal-state-p)\r\n (sql-send-region (beginning-of-thing &#39;paragraph) (end-of-thing &#39;paragraph)))\r\n (t (user-error \" ;Not in visual or normal state \" ;))))", "492" ], [ "Battery & ndash; offensive, nonconsensual contact with another person & ndash; is a crime unless it is justifiable. There are numerous justifications, and the standards for them can vary.\r\n\r\nFor example, [tag:self-defense] is a justification for battery, and the standard is usually the \" ;reasonable person. \" ; I.e., would a reasonable person in the position feel that force was necessary to defend against imminent injury, and was the force used reasonable and proportional to the perceived threat?\r\n\r\nForce can be used to effect a lawful [tag:arrest]. The standards for arrest are different for police officers. For example, police typically need only have \" ;probable cause \" ; (i.e., a justifiable belief that a person likely committed a crime) to effect an arrest, and at the point police are typically allowed to use _any force necessary_ to effect the arrest. On the other hand, \" ;citizens&#39; arrests \" ; are typically limited to more serious suspected crimes and, in practice if not in theory, subject to higher levels of scrutiny.\r\n\r\nSo, for example, a cop grabbing the person being chased from a store would almost certainly be immune to charges of battery. A bystander doing the same thing would have to be prepared to justify his interference in civil, if not criminal, court.\r\n\r\nSome jurisdictions accord a higher right to use force to owners of property. For example, \" ;shopkeeper&#39;s privilege \" ; allows merchants to use reasonable force to detain individuals they reasonably believe to have stolen from them. \" ;Castle doctrine \" ; allows people to use lethal force against any intruder in their residence.\r\n\r\nIn the bus fare scenario you describe the bus driver is guilty of battery. Even if a prosecutor declined to charge him for the crime, the victim of that battery could sue the driver civilly. Likewise, the passenger who chose to subsequently attack the bus driver is guilty of battery, because (presumably) there was no ongoing physical threat once he was off the bus.", "273" ], [ "Get some of the sunscreen material from an auto parts shop that has lots of small holes punched in it. Cut it into strips that will fit over the gap from the inside roof to the top of the window. You will have to attach it to the roof (inside) and the window (also inside), forming a channel where most of the rain will fall. Run the lower end of the channel into a container to collect the rain. Dump it as needed.\r\n\r\nThis method will not absolutely prevent rain from entering the vehicle, but will reduce it enough to prevent most of the issues you are having.", "672" ], [ "I think it would be a good idea to specify what type of 3D printer you are talking about. Layer sizes can very a lot between different technologies and printing materials. On top of that, the application plays an important role. There&#39;s no general answer to the question how small a layer should be. I suggest changing this question to ask how to know what layer thickness to use and what influences that decision. That would be a canonical question an much more useful.", "214" ], [ "Apart from the inherent process itself and direct health hazards from that, many 3D printers also require some complementary technology to work.\r\n\r\n[tag:FDM] printers have a printing head that needs to move around in 3D space. **Moving machinery parts can be a hazard**. In a home/hobbyist environment with children for example, I would recommend to buy a printer with a housing. \r\n\r\n \" ;open \" ; designs often feature **bare electronics** mounted directly to the printer structure. This rises the possibility of short circuits and electric shock.\r\n\r\nThe printers that heat material often do so at very high temperatures. **Hot parts of the printer** should not be touched.", "214" ], [ "There are many different printing technologies. While it might be clear to the asker that he&#39;s talking about his home 3D printing machine, that&#39;s not necessarily the case for those that try to answer the question.\r\n\r\nI think it would help to specify the scope of questions with tags, to allow future visitors to identify what type of 3D printer it is about. Answers to a lot of questions related to general properties of the printing process like printing speed, resolution, additional manual work, support structures, etc. depend heavily on the technology that&#39;s being used.\r\n\r\nThis also prevents \" ;Well, it depends... \" ; type of answers that cover a lot of possibly unrelated things.", "214" ], [ "The reprap printers have often been compared to plants, providing fruits to you and the possibility to reproduce themselves.\r\n\r\nThis analogy holds in both good and bad ways. Any life form can reproduce itself only so often without artefacts (mutations) being introduced.\r\n\r\nIt takes a bit of **skill to build, configure and run a reprap printer**. While the parts can be passed on, that doesn&#39;t necessarily hold for gained experience.\r\nChances are that the parts your printer produces are not as good as those that you have received to build the printer. At least not until you caught up on the learning curve.\r\n\r\nA reprap has a lot **other parts that are not printed and can vary in quality independently from the printed parts**. It makes a difference what steel rods are used, what driver circuit for the motors, etc. If you give printed parts away that are as good as those that you received yourself, the added parts are not necessarily as good as your.\r\n\r\n----------\r\n\r\nMy recommendation would be that **you and your friends get printer parts from that somebody and you build your printers together**. While giving parts to others is a great thing, building 3D printers together with friends is greater.", "214" ], [ "The best way to get rid of them is to change the design of the printed object to make them unnecessary.\r\n\r\nInstead of printing the one part with support material, the piece can be split into two or more parts which can be printed without support material and assembled after the printing.\r\n\r\n\r\n----------\r\n\r\n\r\nGiven that this is not always fully possible, a convenient way to get rid of additional structures is to use a different fillament for them that can be removed easily. [This list of printing materials][1] includes Polyvinyl Acetate (**PVA**), which is water soluble. You can wash the support material away given that your actual printign material is not water soluble. Here&#39;s a quote from the website (emphasize mine):\r\n\r\n > PVA (Polyvinyl Acetate) filament prints translucent with a slightly yellow tint and is **primarily used as a 3D printing support material** because it is water-soluble, meaning that **it will dissolve when exposed to water** (and so MUST be kept dry prior to use). PVA is most often used with 3D printers capable of dual extrusion: one extruder printing a primary material (such as ABS or PLA) and the other printing this dissolvable filament to provide support for overhanging features. PVA 3D printer filament is available in 1.75mm and 3mm.\r\n\r\n [1]: _URL_0_", "214" ], [ "@deltree if you feel like this is not answering the question, please flag it. There&#39;s no such thing as a \" ;spirit of the site \" ;. 3D printing has its limitations. Knowledge about technology includes knowledge about when said technology is not well suited for a job or if there&#39;s an alternative to it. I did answer the question. If I thought the question was wrong, I would have downvoted it. But I didn&#39;t because I think it&#39;s perfectly fine.", "214" ], [ "This workflow might be necessary for home/hobbies printers, which are more or less \" ;open \" ;, which has the advantage to choose a slicer of your choice for example. For commercial machines, this does not necessarily hold true. If you sell the whole package, the workflow can be hidden. I&#39;d be surprised if commercial industrial printers do not offer integration with the most common and popular CAD and CAM software. After all, most CNC machines come with a post processor for exactly that purpose.", "214" ], [ "Competent parties can contract for any terms that are not forbidden by law, and a contract is valid if each party provides consideration (i.e., something of value). It sounds like the contract you&#39;re questioning is essentially, \" ;I will give you money in exchange for you showing me an agreement and giving me the option to sign it. \" ; The act of \" ;showing an agreement \" ; evidently has some value, as does the \" ;option to sign, \" ; so your counterparty has provided consideration. Therefore, the high-level answer is that the only way this contract would be inherently flawed would be if a law explicitly forbids it.", "174" ], [ "@Viktor - Your question and observation really merit more research ... which I haven&#39;t had time to perform. \" ;[Abuse of discretion](_URL_0_) \" ; usually takes other forms. But I suspect that, if nothing else, there must be examples of courts ruling that a prosecutor has abused his discretion for failing to enforce desegregation laws in the U.S. civil rights era. I wonder what the remedies are. Perhaps this merits its own question.", "273" ], [ "[Private prosecution of crimes](_URL_9_) has become increasingly uncommon under common law systems, which have [increased deference to public prosecutors](_URL_5_).\r\n\r\nThe U.S. Supreme Court eliminated private prosecution at the federal level in *[<PERSON> v. Timmerman](_URL_2_)*, (1981), 452 U.S. 83. The closest exception found in case law appears to be an allowance for a federal court to appoint a private attorney to prosecute a criminal contempt action if the executive refuses to prosecute. (*[<PERSON> v. U.S. ex rel. <PERSON> et Fils](_URL_7_)*, (1987)\r\n481 U.S. 787.)\r\n\r\nAt least some U.S. states allow \" ;[Private Challenges to Prosecutorial Inaction](_URL_8_). \" ; These [can take different forms](_URL_10_):\r\n\r\n > Some states do allow a complainant to either file a request for an\r\n > order to show cause or to actually prosecute as a private prosecutor.\r\n\r\nFor example, in Pennsylvania, private criminal complaints are forwarded to a public prosecutor. If the public attorney declines to prosecute then [the complainant can request a judicial review of that decision](_URL_1_). The standard of review almost always requires the petitioner to show that the failure to prosecute was \" ;[an abuse of prosecutorial discretion](_URL_6_). \" ; And I can&#39;t find any such case in which the complainant prevailed, so it&#39;s not certain what the remedy would be in that event. (Our best guess is that the private complainant would be allowed to prosecute the case.)\r\n\r\n[Wisconsin](_URL_4_) provides a similar [statutory mechanism for judicial review of prosecutorial inaction](_URL_3_). [This good Law Review article](_URL_4_) explains the Wisconsin law.\r\n\r\n[This 2004 Law Review article](_URL_0_) compares New Hampshire (which does have mechanisms for private prosecution) with Massachusetts (which does not).", "781" ], [ "**TL;DR: No. But maybe there should be.**\r\n\r\nHere is a Law Review article addressing the sub-question: [Does the Fifth Amendment Mandate Compensation When Property is Damaged During the Course of Police Activities?](_URL_0_)\r\n\r\nThe author concludes that in practice the remedies offered seem to fall short of the Constitutional mandate:\r\n\r\n > The Fifth Amendment of the United States Constitution, along with\r\n > similar provisions in state constitutions, forbids the taking of\r\n > private property by the government for a public use without just\r\n > compensation. Despite this protection, many courts have denied takings\r\n > claims made by innocent third party landowners when police officers\r\n > caused damage to their property during the course of executing their\r\n > official duties. These courts held that the damage was not for a\r\n > \" ;public use \" ; in the narrow sense, and have refused to analyze the\r\n > claims under takings jurisprudence. This narrow view of \" ;public use \" ;\r\n > ignores the fact that society as a whole benefits from the police\r\n > activity, including any resulting damage to property, while the\r\n > innocent, individual owner alone is forced to bear the burden. This\r\n > Note argues that a broader interpretation of \" ;public use \" ; is required\r\n > to redistribute justly and fairly the costs of such burdens to the\r\n > society that benefits from them in order to comport with the mandate\r\n > of the Fifth Amendment.", "273" ], [ "See _URL_0_ for more background.\r\n\r\nYAML defines a comment as a `#` either preceded by the beginning of the line or whitespace (more specifically, `TAB` or `SPC`). This means that `foo#bar` is a normal token, not `foo` with a `#bar` comment. You can get most of the way there with the traditional syntax rules:\r\n\r\n (modify-syntax-entry ?# \" ; < \" ;)\r\n (modify-syntax-entry ?\\n \" ; > \" ;)\r\n\r\nUnfortunately this will highlight `foo#bar` incorrectly. I&#39;ve been pointed to `syntax-propertize-function` which allows for more powerful syntax rules, but behaves weirdly. Depending on the specific code I write, either insertion of new characters or deletion invalidates the existing fontification.\r\n\r\nExample 1 (marking `#` preceded by non-whitespace as `_`):\r\n\r\n (modify-syntax-entry ?# \" ; < \" ;)\r\n (modify-syntax-entry ?\\n \" ; > \" ;)\r\n\r\n ;; invalidated by deletion\r\n (syntax-propertize-rules\r\n ( \" ;[^ \\t]# \" ; (0 \" ;_ \" ;)))\r\n\r\nExample 2 (marking `#` preceded by whitespace as ` < `):\r\n\r\n (modify-syntax-entry ?\\n \" ; > \" ;)\r\n\r\n ;; invalidated by insertion\r\n (syntax-propertize-rules\r\n ( \" ;^# \" ; (0 \" ; < \" ;)))\r\n ( \" ;[ \\t]# \" ; (0 \" ; < \" ;)))\r\n\r\nIf I rewrite either of these in terms of a function scanning for appliable parts and edebug it, edebug does *not* take me through the function for the invalidating case. Any idea why?\r\n\r\nBonus - Syntax propertize functions:\r\n\r\nExample 1:\r\n\r\n (defun yaml-mode-syntax-propertize-function (beg end)\r\n (save-excursion\r\n (goto-char beg)\r\n (while (search-forward \" ;# \" ; end t)\r\n (save-excursion\r\n (forward-char -2) ;; move to char preceding #\r\n (when (looking-at \" ;[^ \\t] \" ;)\r\n (forward-char 1) ;; move to # again\r\n (put-text-property (point) (1+ (point))\r\n &#39;syntax-table (string-to-syntax \" ;_ \" ;))))))\r\n\r\nExample 2:\r\n\r\n (defun yaml-mode-syntax-propertize-function (beg end)\r\n (save-excursion\r\n (goto-char beg)\r\n (while (search-forward \" ;# \" ; end t)\r\n (save-excursion\r\n (forward-char -1)\r\n (if (bolp)\r\n (put-text-property (point) (1+ (point))\r\n &#39;syntax-table (string-to-syntax \" ; < \" ;))\r\n (forward-char -1)\r\n (when (looking-at \" ;[ \\t] \" ;)\r\n (forward-char 1)\r\n (put-text-property (point) (1+ (point))\r\n &#39;syntax-table (string-to-syntax \" ; < \" ;))))))))\r\n\r\nTest file:\r\n\r\n keyword: token#token\r\n #comment comment\r\n token #comment", "784" ], [ "You will probably find it easier and less expensive to purchase a local prepaid phone for traveling to the US from overseas. Many include \" ;unlimited \" ; data plans. And if you are going to be in the US for more than a few days, it can save you a great deal of money.\r\n\r\nIt appears that you have several choices for smartphones from the local retailers (Walmart, among so many others). As of this writing, the prices run about $100, including the phone and air time.\r\n\r\nYou can forward calls from your normal phone to the prepaid, but may incur charges from your home cell phone carrier. Check with them.", "0" ], [ "I guess you should clarify which scenario you are asking about. If the executive asserts \" ;this law *permits* this office to *xxx* \" ; that&#39;s a little different from \" ;this law *requires* this office to *xxx*. \" ; There are laws of both types. In the latter case there is a presumption of no discretion granted to the executive w.r.t. enforcement/implementation. In the former case, action may be \" ;permitted \" ; under all sorts of theories, and perhaps the executive cited an incorrect authorization but the action could still be permitted under a different source or theory.", "781" ], [ "Most keyboards are dishwasher safe. \r\n\r\nUnplug the keyboard from whatever you have it connected to. Remove any batteries and attachments (non-glued in place items, but not the keys). Place on the top tray of the dishwasher, face down. Wash using your normal detergent. **Do not go through the heated drying cycle** as it may damage the plastics. Allow the keyboard to thoroughly air dry before reattaching it to your device. Put the batteries and other attachments back in place.\r\n\r\nIf you don&#39;t have a dishwasher, you can use a shower head to clean almost as much as the dishwasher. I would not add liquid dish soap to assist the cleaning as it becomes extremely difficult to remove all of it.", "484" ], [ "Sorry for your confusion. With good reason, [none of the sites](_URL_0_) on the StackExchange network permit questions that merely ask for external resources (like woodworking plans). See the link for details, but the main reason is we&#39;re trying to build an enduring resource and community. Links to external resources go stale and that makes questions that ask for them have a much more limited lifespan. Also, people that ask others to do their research often don&#39;t make good contributions to the community (though I&#39;m not accusing you of that!).", "862" ], [ "@chazza That&#39;s not the only reason. When a browser detects any styles after the body tag is written, it stops whatever else it is doing until that style is loaded and applied, which is bad for performance and leads to screen reflows and flashes of unstyled text.\n\nHowever, if it doesn&#39;t really matter, throw those css files in like you said. I do it all the time, and at the end of the day it&#39;s fine. Not optimal, but fine.", "255" ], [ "Disclaimer: I assume this is in no way related to Spacemacs.\r\n\r\nThe `evil-emacs-state-modes` variable is initialized with a list of modes to start in Emacs state. This is a mishap as it makes it harder to customize it properly, any successful change to the variable will not take this value into account and Evil&#39;s code will not change it either because the variable is defined and initialized by then. In your example, nothing happens as `add-to-list` does only do something if the variable has already been defined. You can circumvent this by using a hook run after the package has been loaded up or with `eval-after-load`:\r\n\r\n (eval-after-load &#39;evil-vars &#39;(add-to-list &#39;evil-emacs-state-modes &#39;term-mode))\r\n\r\nThe official way of changing that list though is via `evil-set-initial-state`:\r\n\r\n (eval-after-load &#39;evil-vars &#39;(evil-set-initial-state &#39;term-mode &#39;emacs))", "71" ], [ "A corporate entity has to have a (single) domicile somewhere, because its members/owners will always want it governed by a single set of non-conflicting rules and laws. [Many businesses incorporate in Delaware because it has gone out of its way to make itself an attractive corporate domicile](_URL_0_).\r\n\r\nWhen a business takes up activity in another state or country it does so as a \" ;foreign \" ; entity. For example, a Delaware corporation that employs someone in another U.S. state will have to register as a \" ;foreign corporation \" ; with that state (usually with the Office of the Secretary of State), pay \" ;franchise \" ; taxes/fees to that state, and comply with that state&#39;s employment law. A corporation with a \" ;business presence \" ; in another state will also likely incur tax liabilities associated with its \" ;nexus \" ; to the state. The most famous liability is the obligation to collect sales tax on all sales to entities within the state. But it may also incur corporate tax liabilities on the portion of its profit attributable to that state.", "544" ], [ "FWIW, I cannot reproduce the condition as reported above. It would be helpful if you could share a minimal configuration that can reproduce this error of yours.\r\n\r\nAn alternative way of solving this is writing a command bound to the initial key of the escape sequence that waits with a timeout for another event to occur. If this event happens in a timely manner and matches the final key of the escape sequence, execute the command to exit insert state. If the timeout is met, but the final key is wrong, insert the initial key and the different one. If the timeout is missed, insert the first key.\r\n\r\n (defun my-jk ()\r\n (interactive)\r\n (let* ((initial-key ?j)\r\n (final-key ?k)\r\n (timeout 0.5)\r\n (event (read-event nil nil timeout)))\r\n (if event\r\n ;; timeout met\r\n (if (and (characterp event) (= event final-key))\r\n (evil-normal-state)\r\n (insert initial-key)\r\n (push event unread-command-events))\r\n ;; timeout exceeded\r\n (insert initial-key))))\r\n\r\n (define-key evil-insert-state-map (kbd \" ;j \" ;) &#39;my-jk)\r\n\r\nAnother implementation of the above with slightly different semantics can be found in [cofi&#39;s config](_URL_0_).", "326" ], [ "@jimsug - A traditional wedding alone can be a huge commitment of time and money, often demanded by one partner, and granted by the other for ... consideration. The enforcement of the marriage contract has varied over time, but AFAIK it has always involved a commitment to do certain things and not do other things. When the contract is liquidated by a divorce court usually some financial consideration is exacted from one of the parties. As for the \" ;physical \" ; consideration, even if they aren&#39;t now, weren&#39;t \" ;conjugal *rights* \" ; a traditional part of the contract?", "126" ], [ "Get some rare earth magnets. Depending on the magnet field strength, you can bind large amounts of paper together. I have used them multiple times to keep things together that I didn&#39;t want punctured.\r\n\r\nSome downsides to using this method: the magnets want to stick to each other more than through the paper, so stacking bound documents would be almost impossible; they are expensive; magnets that are strong enough can cause damage to magnetic media (think computer hard drive); magnets can snap together when close, possibly causing injury in the process; extremely strong magnets are difficult to separate.", "798" ], [ "Evil has not one, but two settings to customize the behaviour of point at EOL:\r\n\r\n- `evil-move-beyond-eol` decides whether movement beyond EOL is possible at all. When set to `t`, you can move towards it, but things like `i` or `a` will still put cursor back after exiting insert state.\r\n- `evil-move-cursor-back` is a superset of the above as it disables moving cursor back, both after normal movement commands and after exiting insert state. If you&#39;re after more Emacs-like behaviour, set it to `nil`.", "71" ], [ "I have been looking at tags and synonyms lately (can you tell?).\r\n\r\nWhile the tags [tag:stationery] and [tag:stationary] may sound the same, they have very different meanings. Currently, [tag:stationary] ([which means not moving][1]) is a synonmym to [tag:stationery] ([which means related to paper products][2]).\r\n\r\nI saw where the [tags were made synonyms][3] due to user confusion. I think this might lead to more confusion, especially by people who know the difference.\r\n\r\nIf the tags are split, we (or I) should update the description to match the definitions.\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_\r\n [3]: _URL_2_", "224" ], [ "This recently came up in a local PA homeowner association. Legally they own the roads in their development, but they have erected stop signs to make it clear who has the right of way and asked the township police to enforce them. A resident challenged the right of the police to enforce traffic laws on private property, but lost his appeal (albeit at the municipal level). The judge explained that the residents and any visitors had a reasonable expectation that the traffic signs would be obeyed, and that therefore violating them was just as dangerous as violating them on public roads, and that the same law and penalties would therefore be applied.", "669" ], [ "For Meta there is a [meta-tag:faq] tag. That might require a moderator to use, but there is also [meta-tag:common-questions] that contains some FAQs.\r\n\r\nOne practice that I have occasionally employed on the main site is to list \" ;canonical \" ; answers in the detail of the associated tag. [tag:fair-use] is a good example: presently [the tag-info](_URL_0_) includes two canonical answers.\r\n\r\nGranted, this has a few problems:\r\n\r\n1. To my knowledge this isn&#39;t a common practice, so I don&#39;t think many people delve into the tag info (which takes two clicks) to even discover such details.\r\n\r\n1. The list there is subjective, coming as it does from the whims of whoever bothers to edit the tag. If anybody cared I suppose it could become a point of contention.\r\n\r\nOne alternative mechanism for finding the best answers on a FAQ is to pick the relevant tag and search for it with the search limiter `is:answer`, then sort by Votes & ndash; e.g., [`[contract-law] is:answer`](_URL_1_). That will give you the highest-rated answers for that tag, but as you can see, that doesn&#39;t necessarily yield the best answers for the tag&#39;s FAQs.\r\n\r\nFinally, I personally appreciate a good list or two in Meta. We [have one for legal references](_URL_2_). We could certainly start another for main-site FAQs.", "423" ], [ "I wrote [an interpreter](_URL_0_) by leveraging `--batch`, `read-from-minibuffer` and `princ`. Now, reading input is relatively limited, you can type consecutive characters, erase the last character with ` < backspace > `, send a line with `RET` and cancel input with `C-d` (or `C-c`, but that aborts the entire program). This is good enough for testing, but I&#39;d like to shoot for more readline-like editing. Is it possible to intercept individual control keys before printing them and how?", "567" ], [ "You can not be \" ;made a Power of Attorney. \" ; Power of Attorney is a legal authorization that grants authority to an Agent to act on the Grantor&#39;s behalf in some capacity.\r\n\r\nBecause it is not a contract, but rather a unilateral authorization, the Grantor cannot *impose* responsibility or obligations through Power of Attorney, and therefore there is nothing for a Grantee to \" ;deny. \" ;\r\n\r\nHowever, typically some agreement (i.e., contract) accompanies the grant of Power of Attorney, in which case you would be bound by the terms of such an agreement.", "174" ], [ "In general property owners and employers can impose any rules on their property and employees (respectively) that are not prohibited by law.\r\n\r\nGranted, there are extensive statutes and regulations to protect \" ;employee rights. \" ; I have not heard of protections that include \" ;possession of prescribed medications, \" ; but that does not mean they don&#39;t exist in your jurisdiction.\r\n\r\nIf you really want to know whether you have a legal right as an employee, and you can&#39;t find it in written law or regulation, you would have to consult regulators or employment law attorneys in your jurisdiction. (As a practical matter, of course, it might make sense to first find out whether one&#39;s employer wants to assert a policy infringing the right in question.)", "174" ], [ "I&#39;m working with a U.S. dot-com that sells around the world. A lot of corporate customers, especially in Spain and Italy, insist that they need *their* VAT number listed on all receipts for payments they make to the U.S. company. Is this correct by law or regulation?\r\n\r\nIs there any guidance that makes it clear whether they can just print the receipt and write their company&#39;s VAT number on it? (Customers I&#39;ve asked say that they can&#39;t do that. So our current solution is to give them blank letterhead and tell them to put whatever they need for their books on it.)", "544" ], [ "I use shampoo to clean my glasses. While showering, lather your hair with shampoo. Use the lather with rubbing motion over the entire surface of the lenses. Rinse with clear water. Dry the lenses with cloths that will not damage the lenses (I use a microfiber drying cloth).\r\n\r\nThe reason this works well is that shampoo is designed to break up body and hair oils.", "484" ], [ "**tl;dr:**\r\n\r\n1. No.\r\n2. You don&#39;t have a choice.\r\n3. It depends, but the options are \" ;no form \" ; or 1099-MISC. You&#39;ll never send a 1099-K.\r\n\r\nThe only 1099 you would potentially be required to send for business payments is a 1099-MISC. The [IRS instructions on that](_URL_0_) are pretty clear as to when and how you must use that.\r\n\r\nNote that *you* don&#39;t send 1099-K&#39;s unless you are a payment settlement entity. Furthermore, if you transmit the funds using a payment settlement entity who will report the transaction on a 1099-K, then you don&#39;t need to report it on a 1099-MISC. (See \" ;Form 1099-K \" ; [ibid](_URL_0_).)\r\n\r\nFortunately, PayPal is a payment settlement entity, so you don&#39;t need to worry about reporting payments you send through them ... with one big exception: PayPal does not report \" ;payments to friends and family, \" ; and so if you&#39;re using that to avoid their fees then the IRS would consider you liable for reporting payments on a 1099-MISC. To my knowledge banks do not report wire transfers, so you would have to file 1099-MISC when required for payments sent that way.\r\n\r\nRegarding your TIN: Yes, these numbers get circulated in the course of business. But this is actually one of the few *legal* uses of those numbers, and it&#39;s required, so if you&#39;re worried about identity theft or something then buy insurance against that. And if you think *you&#39;ve* got it bad, just think how your payment recipient must feel: Before you send funds that would need to be reported next year you are supposed to demand a signed [W-9](_URL_2_) from them (so that you can make the report). But hey, the IRS isn&#39;t oblivious to your concern: Check their \" ;helpful \" ; advice on [the last page of W-9](_URL_1_) to \" ;Secure Your Tax Records from Identity Theft. \" ;\r\n\r\nRegarding payments to entities not subject to U.S. taxation: You don&#39;t have to report those, and the fact that you reasonably believe the entity to be foreign is considered adequate to omit them from your 1099-MISC filings.", "687" ], [ "I was trying to make a Hawaiian ipu drum out of a gourd grown from a seed I planted that was marketed as a \" ;birdhouse gourd \" ; and dried this winter. I&#39;ve been looking up what ipu drums are made out of and apparently it&#39;s supposed to be a calabash. I consulted the Book of Knowledge for [calabash](_URL_0_) and it didn&#39;t reference a use as a birdhouse. \r\n\r\nRecently I talked to some gourd artists and they didn&#39;t seem to know what a birdhouse gourd was, so I&#39;m guessing I&#39;m just calling it by what it was marketed as, not necessarily what it is. So, I&#39;d like to know, how much variation is there in the calabash variety of gourds and what kinds are good for birdhouses and what kinds are good for ipu drums?", "909" ], [ "Four years is a lot of time to just throw out, and 5 publications seems like you should (at least) be close to having enough completed for a Ph.D. Could you switch advisors to someone who would count your past work? Does she have any previous students you can talk to about what they did? Are there faculty with whom you are on good terms who could give honest advice? If what you say is true, you might not be the only one who has noticed this behavior.", "906" ], [ "Another possible answer: The legal profession is a cartel, protected by laws. \" ;Unlicensed/Unauthorized Practice of Law \" ; is a big enough issue that its acronym (UPL) is well known among people who discuss law. Non-lawyers may decline to [provide legal advice](_URL_0_) because they don&#39;t want to be charged with UPL.\r\n\r\nLikewise, as a matter of policy (at least in the U.S.) most government agencies and many employers in businesses that frequently receive requests for legal information instruct their employees to avoid giving anything that could be construed as legal advice. Which policy employees might cite to avoid helping with requests for even the most basic legal information.", "174" ], [ "TheDude: Note again that this question boils down to, \" ;Is this OK? \" ; Here&#39;s a single answer that may apply to all your questions: **Nothing is illegal unless it violates a law.** Now: Asking whether a law exists is generally a bad question because it&#39;s very hard to prove that a law *doesn&#39;t* exist in whatever jurisdiction you might be referencing.", "273" ], [ "It sounds like you are asking three separate questions, each without any context. Is this really a question about <PERSON>? Or do you mean \" ;any wealthy American? \" ; What points of the question do you think might make murder for hire *not* illegal? In the second paragraph: the terrorist is trying to kill *whose* family? And the terrorist *is* a Russian? How does that matter? Third paragraph: Now you&#39;re asking about a lawyer killing <PERSON> in an accident? What is the legal question there?", "273" ], [ "This is not correct. The issue is that you have installed python.el from GNU ELPA which is the version made for Emacs 25. Using this version in Emacs 24 will give you an error as it&#39;s using Emacs 25 functionality. As Emacs 24 contains an older version of python.el that works just fine, it&#39;s sufficient to delete the user-installed version to solve this problem.", "347" ], [ "<PERSON> - True, but offsetting that is the fact that cartel ... erm, *bar* members know exactly where the line is, while relatively few laymen are as sure. Professional lawyers probably compound this confusion when they decline to dispense free advice with the excuse, \" ;I can&#39;t ethically advise you outside of a formal client relationship \" ; instead of, \" ;I don&#39;t want to work for free. \" ; (NB: I don&#39;t mean to impugn the entire profession: for example, on this very site there are some members of the bar who are extremely generous with their time and expertise.)", "622" ], [ "@Thedude: You are mistaken. Your questions are of poor quality. They are attracting neither positive votes nor even significant view numbers. Some number of active users review almost every post, especially by users like yourself with no reputation. Do not mistake their attempts to salvage your contributions or encourage you to make meaningful ones for any measure of approval. If your interest is in making positive contributions the metric to watch is upvotes. If your intention is to be disruptive then please stop.", "641" ], [ "@Michael With a modern block cipher (e.g. AES), 128-bit keys are _good enough_ (in the sense that a brute-force attack is utterly infeasible). 256-bit keys just waste electricity and CPU time. This will change if quantum computers become practical, but we can worry about that then. Changing from CBC to GCM, however, really does increase your security. GCM is a newer, better-designed [mode of operation](_URL_0_) which avoids several known weaknesses in CBC (as used by TLS).", "844" ], [ "It is possible to cut glass using a string that has been lit on fire, and quenching the fire with a much cooler liquid (water works best).\r\n\r\n* Soak the string (twine is my preference, but I have used yarn) in a liquid fuel that burns (lighter fluid is my choice, but others use acetone or alcohol). Thicker string works better in most cases as you want to string to work like a wick in a candle, to keep the flame in a specific place.\r\n* Tie the string around the glass.\r\n* Light the string on fire. Use caution not to burn yourself.\r\n* The hot glass may change color when it reaches a point where quenching will assure a good break.\r\n* If the glass is small enough to fully immerse in the quenching liquid, fully immerse the whole piece as quickly as possible. If not, cover as much of the burning area as quickly as possible.\r\n* You should hear a snapping sound when the glass breaks.\r\n\r\nThicker glass will require more time for the glass to heat before attempting a break.", "129" ], [ "No. The law is written more clearly in Pennsylvania [Title 18](_URL_0_):\r\n\r\n > 5301. Official oppression. A person acting or purporting to act in an official capacity or taking advantage of such actual or purported\r\n > capacity commits a misdemeanor of the second degree if, knowing that\r\n > his conduct is illegal, he: (1) subjects another to arrest,\r\n > detention, search, seizure, mistreatment, dispossession, assessment,\r\n > lien or other infringement of personal or property rights; or (2) \r\n > denies or impedes another in the exercise or enjoyment of any right,\r\n > privilege, power or immunity.\r\n\r\nI&#39;ve seen complaints made under Official Oppression statutes against police officers, but they have all been rejected because the statute requires not only that the act be performed in one&#39;s official capacity, but also that, *beyond a reasonable doubt*, the official knew the act to be *illegal*. Since police are *authorized* in the course of their duties to commit on behalf of the state all of the torts and crimes enumerated under Official Oppression, proving that they *knew that a particular instance was illegal* is practically impossible if they don&#39;t outright admit it.\r\n\r\nMaine&#39;s statute further requires that *intent* to benefit the official or harm another also be established beyond a reasonable doubt.\r\n\r\nConvictions under Maine&#39;s Official Oppression for *refraining* to do something are even more difficult. At least for police the threshold for a \" ;duty to act \" ; may be insurmountable, as suggested by the frequently-cited [<PERSON> v. District of Columbia](_URL_2_).\r\n\r\n(*Amendment:* I just found [this telling article](_URL_1_). Of note: \" ;Convicting a police officer of a civil rights violation is one of the toughest challenges a prosecutor can face, numerous legal and civil rights experts told the Trib. \" ;)", "273" ], [ "In the U.S., at least through the end of the twentieth century, there were [SCI](_URL_0_) clearances for which personnel were required to notify the relevant program agency *in advance* of any foreign travel. I think this may still apply to people in the [PRP](_URL_1_). (More than once I heard a joke was that this was so that if a transport they were on was hijacked the U.S. could shoot it down to prevent them being taken hostage and tortured for the information.)\r\n\r\nIn a similar vein: I was told (but can&#39;t confirm) that some information was considered so sensitive to national security that any individual \" ;read in \" ; had to have a minder present during any medical procedure in which they would be sedated to prevent them from inadvertently divulging secrets while impaired by anesthetics.\r\n\r\nPlenty of U.S. security clearance contracts require signers to keep classified data they encounter secret for the rest of their life (or until it is properly declassified), not just while on the job or while the program is funded.\r\n\r\nWhen people are entrusted with information that in the wrong hands would easily compromise multi-billion-dollar weapons or intelligence systems, or put the lives of other people in imminent jeopardy, the general policy of the U.S. government is to take all reasonable measures to ensure that information is kept safe. Nobody is forced to acquire such sensitive information: Those clearance contracts are signed voluntarily.", "465" ], [ "Wouldn&#39;t \" ;a version of the IRI \" ; that does something significant different than the actual IRI not conform to the IOTA Protocol. This is a little bit like saying: \" ;What if there was a version of the IRI, that does not check if the PoW was done? \" ;. Of course IOTA doesn&#39;t work if you remove core characteristics of the protocol. IOTA relies on the fact, that it&#39;s hard to find hash collisions **AND** the `exists(tangle, hash)` line.", "432" ], [ "I&#39;ve made a Mathematica package available, and it&#39;s been reported to me that it doesn&#39;t work with Mathematica 4. I&#39;ve guessed at some of the issues, and provided work arounds, but that process is awkward without being able to try things myself.\r\n\r\nI&#39;ve had licences for various Mathematica versions since I started using it (8, 9, 10, 11). I was wondering if:\r\n\r\n* Do such licences give me access to older versions too (although I expect they may require old os versions to install)? \r\n* Perhaps Wolfram has made really old versions of Mathematica freely available for test purposes, knowing that nobody was likely to want to install them for production use?", "1023" ], [ "**Date/Time (EST):** Thursday, August 23, 2018, 6:30 PM\r\n\r\n**Date/Time (UTC):** Thursday, August 23, 2018, 22:30\r\n\r\n**Location:** [Roam Buckhead][1], 3365 Piedmont Rd NE, Suite 1400, Atlanta, GA\r\n\r\n**RSVP:** _URL_1_\r\n\r\n**Twitter:** [@AtlantaSitecore][2]\r\n\r\n![Atlanta Sitecore User Group][3]\r\n\r\nMark your calendars for the next Atlanta Sitecore User Group meeting on August 23rd, at 6:30 pm, at Roam in Buckhead!\r\n\r\nParking will be complimentary. We will be providing prepaid validations to all our guests. Dinner and drinks will be served.\r\n\r\n## Agenda\r\n- 6:30 - 7:00 PM: Food, drinks, and social time\r\n- 7:00 - 7:15 PM: [<PERSON>] ([Arke][5]) - [Women of Sitecore][6]\r\n- 7:15 - 7:50 PM: [<PERSON>] & [<PERSON>] ([Brainjocks][9]) - Taming the Content Monster\r\n- 7:50 - 8:25 PM: [<PERSON>] & [<PERSON>] ([Perficient][12]) - Glass Mapper 5\r\n- 8:25 - 8:30 PM: Final announcements\r\n\r\n## Presentations\r\n### Women of Sitecore\r\n**Speaker:** [<PERSON>] - [Arke][5]\r\n\r\nOur goal is to find out more about other women in the field, including information about your careers, issues you may be facing, and what you think a community can or should provide.\r\n\r\n### Taming the Content Monster: Six Strategies for Slaying Content Creation\r\n**Speakers:** [<PERSON>] and [<PERSON>] - [Brainjocks][9]\r\n\r\nImproving the user experience is a KPI on nearly everyone’s digital scorecard these days. But have you ever considered the user experience of your content team? If authoring content were easier, would the quality of the content be better? This session will explore ways to simplify the content authoring process and improve the UX of your team. Using real-world examples, the session will show you how to accelerate content assembly and ensure that even the newest content authors can create pages quickly.\r\n\r\n### Glass Mapper 5\r\n**Speakers:** [Shu Jackson][10] and [<PERSON>] - [Perficient][12]\r\n\r\n1. What is Glass Mapper/ORM?\r\n2. How to use Glass Mapper\r\n3. What&#39;s new and changed in Glass Mapper 5\r\n\r\n [1]: _URL_10_\r\n [2]: _URL_3_\r\n [3]: _URL_5_\r\n [4]: _URL_4_\r\n [5]: _URL_6_\r\n [6]: _URL_9_\r\n [7]: _URL_0_\r\n [8]: _URL_8_\r\n [9]: _URL_11_\r\n [10]: _URL_2_\r\n [11]: _URL_12_\r\n [12]: _URL_7_", "456" ], [ "Which [parts of a transaction][1] need to have what value in order for it to be stored and broadcast by the IRI?\r\n\r\nI know that there are some _**bundle level**_ conditions like\r\n\r\n* valid signature\r\n* sum of all values is 0\r\n* ... **?**\r\n\r\nand some _**transaction level**_ conditions like\r\n\r\n* POW was done\r\n* ... **?**\r\n\r\nI&#39;ve also heard something about timestamps needing to be within a certain range. **True?**\r\n\r\n---\r\n\r\n**What other conditions are there? \r\nIs there another _level_ i.e. what happens to transactions that have trunk/branch transactions that don&#39;t exist (yet)? \r\nWhere can I find these checks in the IRI&#39;s source code? \r\nI know this is a long shot but is there any documentation on it?**\r\n\r\n [1]: _URL_0_", "910" ], [ "# When is it required to initiate an intentional partitioning of the Tangle?\r\n\r\n## Offline Subtangles\r\n\r\nIf two parties are disconnected from the internet (no connection to main Tangle) temporarily and still want to send Iotas to each other, they could do that in an offline subtangle. Further explanation can be found here:\r\n\r\n* _URL_3_\r\n* _URL_0_ \r\n* _URL_6_ \r\n* _URL_1_\r\n\r\n## Economic Clustering\r\n\r\nIn the future, it would be _overkill_, if every node would process all transactions. If we have millions of transactions, it would even be physically _difficult_, probably impossible for every node to to process all transactions. These clusters would almost act like different cryptocurrencies, but they would follow they almost the same (or exactly the same) rules and could be merged or at least synchronized if needed. \r\nThis sounds like an inconvenient solution and I&#39;m not denying that it is, but you can&#39;t argue with physics. And to be honest, the coffeemaker in China doesn&#39;t have to know that the drone in South Africa just got paid for delivering a package.\r\n\r\nSince it&#39;s not necessary to do economic clustering now, everything about the topic is very experimental. Maybe we find a different solution to the problems that is not at all similar to my description. But this is how it could work.\r\n\r\nAlso: [Article on EC by CFB][1]\r\n\r\n---\r\n\r\nThere are probably more reasons that no one thought of yet. Point is: Partition tolerance is a useful and necessary feature of the Tangle.\r\n\r\n# How is the Tangle able to survive long-sustained partitioning of the network without the reversal of a large number of transactions?\r\n\r\n## Tangle\r\n\r\n[![tanglemerge][2]][2]\r\n\r\nAs long as the top and bottom transactions don&#39;t conflict e.g. try to spend the same funds twice, this is possible.\r\n\r\n## Blockchain\r\n\r\n[![blockchainfork][3]][3]\r\n\r\nSince a block can only reference one previous one, even if there are no conflicting transactions at the top and bottom, the transactions can never be merged again and the top transactions have to be redone. This is a typical blockchain fork where the longest chain wins.\r\n\r\n [1]: _URL_4_\r\n [2]: _URL_2_\r\n [3]: _URL_5_", "427" ], [ "1. Yes, it does. 2. Probably doesn&#39;t, if it would, one of them would switch cluster or the clusters would merge. Clusters don&#39;t have to be only geographical. There could be a global banking cluster, global Electric Vehicle Charging cluster, etc. Hence \" ;economic cluster \" ; and not \" ;geographic cluster \" ;. I don&#39;t know anything about network-bound PoW.", "753" ], [ "Redefining IOTA? How so? It would not poll all the clusters constantly because that would recause exactly the problem we are trying to solve with EC. Maybe it would poll more than just one cluster though. As I said, this is completely experimental and nothing is set in stone. How it will be implemented is impossible to predict at this point in time. There is a lot of research to be done for this to work properly.", "847" ], [ "For \" ;insanely high power \" ; professional broadcast systems use coax. Period. The 500 kW transmitters at the Voice of America used coax built from a central circle of wires surrounded by a bigger circle of wires. It is built from \" ;open wire \" ;, but it is a coaxial transmission line.\n\nThe only other transmission line used for high power is waveguide.", "507" ], [ "# Data authenticity in general\r\n\r\nIota will use [Qubic and Oracles][1].\r\n\r\n > Qubic uses a quorum to reach consensus on both the input data and the results of computations\r\n\r\n[...]\r\n > data are only considered valid when at least 2/3 of all participants agree. Hence the term: Quorum-Based Computations The quorum makes it difficult for malicious actors to falsify data, and lowers the impact of sporadic or unintentionally erroneous data.\r\n\r\n# Your use case\r\n\r\nThis approach may seem not suitable for your specific use case \" ;a temperature sensor on shipment of food \" ;. But it could also be solved with it.\r\n\r\nE.g.: \r\n\r\n* We have **3 food shippers**: A, B, C\r\n* We have **2 food customers**: I, J\r\n* each food shipper ships one crate of food\r\n* each crate has 5 temperature sensors inside of it, one provided by each entity (assume the sensors cannot be removed from the crate and cannot be tampered with*). Each entity knows, that the temperature sensor provided by them works properly.\r\n\r\nAnother solution would be to create another entity \" ;F \" ; that all 3 shippers and their customers trust i.e. food inspection authority. The advantage is that we only need one sensor per crate. The problem is that we introduce **centralization**.\r\n\r\n---\r\n\r\n \\* to make sure that the crates + sensors have not been compromised, one would have to introduce some kind of detection mechanism e.g. post message to tangle immediately after somebody tries to open the case of the sensor, etc.\r\n\r\nFor more on sensor hackability try: _URL_1_\r\n \r\n\r\n\r\n\r\n [1]: _URL_0_", "124" ], [ "The answer to your explicit question is no: The only intentional Stack Exchange mechanism for \" ;reawakening \" ; a question is to offer a bounty.\r\n\r\nHowever, my opinion is that the reason that question has received no answers is because the correct answer is simply, \" ;No law requires special permission for a private company to run facial recognition software on images to which they have unrestricted license. \" ; [And this type of \" ;Is *X* legal? \" ; question is difficult to answer](_URL_0_).", "345" ], [ "EOS ecosystem is still very young. Mainnet has been out couple of months. People have not yet learnt how to use EOS and EOS itself has had teething problems.\r\n\r\nThere isn&#39;t simply enough wallets, exchanges, forums, etc. to make EOS token sales more attractive to compare e.g. Ethereum. There are no programming libraries, frameworks, blockchain explorers. Development tools are still very crude.\r\n\r\nHowever do not expect the matters stay same in medium long term.", "910" ], [ "Milestones are bundles that reference a certain part of the Tangle. All transactions within this part are considered confirmed by those who trust the COO. In my eyes, milestones behave very much like a transactions with **infinite weight**. Other nodes can only issue transactions with a weight of 1 [(Maybe more in the future)][1]. The problem with that is, that malicious actors could issue a lot of transactions with weight 1 to build parasite chains or similar attacks. To counter that, we use transactions, currently issued by a central authority, with *infinite weight*.\r\n\r\nThis is assuming, that the Coordinator does not start acting maliciously. If it would, human intervention would be necessary.\r\n\r\nOne could argue, that the statement in _The Transparency Compendium_: \" ;the network is _100%_ decentralized \" ; is a bit of an overstatement. But the point is that it is still decentralized _enough_ even with the Coordinator.\r\n\r\n[1]: _URL_0_", "427" ], [ "> [The promissory estoppel doctrine allows an injured party to recover on a promise upon which he relied, and then suffered a loss as a result. ... All that must be proven is that a promise was made, and that in relying on that promise, a party suffered a loss as a result.](_URL_0_)\r\n\r\nWhat are terms for the tort or cause of action for which one might claim damages under the doctrine of promissory estoppel?\r\n\r\nFor example: under the theory of \" ;negligence \" ; a tortfeasor or his actions might be called \" ;negligent, \" ; and one might sue for relief from \" ;tortious negligence. \" ;\r\n\r\nBut under the theory of promissory estoppel, what words apply to the tort and tortfeasor? E.g., does one sue an \" ;unreliable \" ; tortfeasor for \" ;tortiously changing his mind? \" ;", "174" ], [ "Your first comment isn&#39;t math related nor a valid argument. You&#39;re just naming some of the centralized aspects of the current IOTA protocol (ignoring the decentralized ones), then appending \" ;== true \" ; (what does that even mean?) and \" ;== 100% Centralized \" ; (where did you get the number 100% from?). ; I wouldn&#39;t suggest trying to calculate or estimate to what extent Iota is centralized. I think this question is easier to answer by just thinking of worst case/bad case scenarios and their short-term and long-term consequences. If you do that you may realize that most of them aren&#39;t that devastating.", "994" ], [ "I agree that *legislative intent* is in scope on _URL_1_. Your answer to that question is an excellent example of why.\r\n\r\nHowever, since the inception of _URL_1_ I don&#39;t think I&#39;ve seen more than a handful of answers that have helpfully illuminated a question of legislative intent. Meanwhile, we are constantly bombarded with questions of the form, \" ;*Why is the law this way?* \" ; Consequently, early on we developed a norm that you can see reiterated in the comments of numerous migrations to _URL_0_:\r\n\r\n > This Stack Exchange addresses *what the law is*. *Why the law is that way* is generally a political question more suitable to _URL_0_.\r\n\r\nOr,\r\n\r\n > What the law *should be* is generally a matter of opinion and hence not suited to Stack Exchange.\r\n\r\n###What happened in this case?\r\nIn retrospect, given your excellent answer, I would neither migrate nor close that question.\r\n\r\nHowever, the question as stated does not seem to specify an interest in *legislative intent* any more than it does *political or administrative expedience*. The latter two interests (in my mind) justify a migration to either _URL_0_ or _URL_2_ respectively.\r\n\r\nIn this particular case we can only get the question back if a _URL_2_ moderator rejects the migration.\r\n\r\n###Going Forward\r\n\r\nI think it would be great if we have contributors able to continue to provide legislative-intent answers of that caliber. In order to give such questions a fighting chance I just created the [tag:legislative-intent] tag.", "781" ], [ "Permission is not a physical thing that disappears when a piece of paper evidencing that permission is lost or handed to another party. When someone gives you permission as part of an agreement having the necessary characteristics of a [tag:contract], then the revocation of that permission is governed by the terms of the contract itself and your jurisdiction&#39;s [tag:contract-law].\r\n\r\nYou may not need any permission to use the photos you paid to have taken. (For example, in the U.S. if they were taken in a public place and you are not displaying them for profit.)\r\n\r\nOr, you might need permission due to various rules or laws protecting minors – only an IP lawyer familiar with your jurisdiction can confirm this is the case – and, unless it was drafted by a competent lawyer, it is quite possible that your \" ;permission statement \" ; was legally insufficient or defective.\r\n\r\nOr, you might have legally secured necessary permission and still have that permission even though you handed the \" ;permission statement \" ; back to the parents of the subject.\r\n\r\nIn practice: Only a lawyer in your jurisdiction can offer an opinion on which of these scenarios is in fact the case. And only via litigation can you establish further confidence that legal opinion is correct.", "609" ], [ "You are asking about undocumented and _closed source_ behaviour. I can only explain how the open source part of IOTA works and make assumptions and draw conclusions about their consequences to the closed source part.\r\n\r\n# How does one know that it‘s not a legitimate spend?\r\n\r\nYou can publish your Iota address to the Tangle by making a 0-value-transaction with it.\r\n\r\n* Your address is `ABCO9ZDEF...`.\r\n* You publish this address.\r\n* Someone sends Iotas to **`B`**`BCO9ZDEF...`\r\n* it is close to impossible that another address similar to yours exists", "427" ], [ "I can&#39;t say whether your organization&#39;s sysadmins will go for it, but you could suggest to them that they make a specific exception in their VPN configuration to allow direct, unencrypted connections to the website _URL_0_. The entire purpose of this site is to be hijacked by captive portals. Nobody will ever need to visit via the corporate VPN, because it&#39;s useless except when you need to allow a captive portal to hijack an unencrypted HTTP connection and present its login page, and it doesn&#39;t accept any information, so nobody could exfiltrate corporate data that way. The remaining risk is that the captive portal itself might be malicious, and that&#39;s a real risk, so they might not go for it. But it&#39;s worth a try.", "873" ], [ "Nodes will not be in different states **regarding your balance** as long as you don‘t sign bundles.\r\n\r\nSo you can be 100% sure that you have ***X*** Iotas on `ADDRESS9` and you can be 100% sure that you have ***X-Y*** Iotas on `ADDRESS9` after you sign and publish a bundle that spends ***Y*** Iotas from `ADDRESS9`\r\n\r\nIt makes no difference, if a node does 7 or 700 snapshots a day or if there are 10 or 10000 TPS as long as none of them spend from `ADDRESS9`. Switching between nodes will also not decrease the balance of `ADDRESS9`.", "427" ], [ "This is related/a follow up question to \" ;_URL_2_;\r\n\r\nImagine two transactions that hash to the same value but have different [trunks and branches][1].\r\nLike this:\r\n\r\n[![enter image description here][2]][2] \r\n\\* I used \" ;3 tryte hashes \" ; without [MWM][3] instead of 81 tryte hashes for the sake of lucidity. For your answer, please just pretend they are 81 tryte hashes with default MWM.\r\n\r\nI know, that it&#39;s **very** difficult to find a CURL-P/CURL collision.\r\n\r\n1. Is it difficult enough for this to actually **NEVER** happen, even if someone tries to make it happen?\r\n\r\n----\r\n\r\nLet&#39;s assume, someone managed to find two `JOE`s, and they also manage to publish them to different places in the network so that approximately half of all nodes get the red `JOE` and the other half get the blue `JOE`.\r\n\r\nThis also means that half of the network does **not** get to see blue `JOE` and the other half does **not** get to see red `JOE`.\r\n\r\n2. What would happen, if none of the `JOE`s carry information like _bundle signatures_? i.e., they are just spam transaction;\r\n3. What would happen, if one of the `JOE`s carries a _bundle signature_ (and the other one is just a spam transaction) or if they belong to two different bundles and both carry a signature for their bundle? The two bundles do **not** spend funds from the same address.\r\n4. What would happen, if the `JOE`s carry signatures for two different bundles that try to spend from the same address.\r\n\r\n[![enter image description here][4]][4]\r\n\r\n\r\n [1]: _URL_3_\r\n [2]: _URL_4_\r\n [3]: _URL_1_\r\n [4]: _URL_0_", "260" ], [ "There are various reasons for making software Open Source. Iota&#39;s reason was not \" ;Here&#39;s the source code, feel free to copy it and make your own ICO \" ; but rather reasons like \" ;Here&#39;s the source code, we won&#39;t steal your money \" ;, \" ;Here&#39;s the source code, feel free to improve it \" ;, etc. Why [GNU GPL](_URL_0_) was chosen over others, I don&#39;t know. Maybe interesting [new question](_URL_1_)?", "497" ], [ "Since I am not CfB, I cannot guarantee that my answer aligns 100% with his vision but this is my understanding of it:\r\n\r\n### 1. Functionality of distributed coordinator in Cluster 0\r\n\r\nYes, exactly. The entities don&#39;t have to be companies, but it&#39;s very likely, that they will be.\r\n\r\n### 2. Need of coordinator(s) in other clusters\r\n\r\nI don&#39;t know if Cluster 0 will need a Coordinator forever. If the honest transaction rate reaches a certain point, I think we could get rid of it entirely, but with current PoW (Proof of Work) and difficulty that point is just too high. *Maybe* Network bound PoW will change something about this but we know hardly anything about it.\r\n\r\nFor other clusters with \" ;colored tokens \" ;, as you called them, we definitely need a Coordinator because/if the transaction rate is significantly lower.\r\n\r\n### 3. Benefit of the Tangle structure when relying on coordinators\r\n\r\n1. **Permissionless** \r\n We don&#39;t need an API key or similar to send and receive Iotas. The only cost is the PoW. This can of course also be seen as a disadvantage since we have to do PoW.\r\n2. **Ease of switching** \r\n It&#39;s easy to build an automated check into every full node similar to:\r\n > *If Coordinator A tries something malicious or stops working, don&#39;t trust it anymore. Trust Fallback Coordinator B instead. If Coordinator B tries something malicious or stops working, don&#39;t trust it anymore. Rely on weight only instead.*\r\n\r\n Since the Coordinator is not a central instance, even if it fails to do what it is supposed to, the network can continue working.\r\n3. **We need a [`HAPPENED BEFORE`][1] relation anyway** \r\n The Tangle has a very clear structure when it comes to which transaction happened before which transaction. If `TXA` is directly or indirectly referenced by `TXB`, we know that `TXA`→`TXB`. Therefore we also know that a Milestone `MS9` confirms all transactions that happened before it.\r\n4. **Missing transactions** \r\n We know exactly, if we are missing a transaction or if our Tangle is [*solid*][2] because of the references. If one of our transactions points to `TXC` and we don&#39;t have a `TXC` in our database, we know that we have to request it from our neighbors.\r\n\r\n\r\n[1]: _URL_0_\r\n[2]: _URL_1_", "753" ], [ "At the moment, we rely on [Milestones issued by the Coordinator][1]. In the future we might be able to rely on [weight][2], which is the [DAG][3] equivalent of chain *length*.\r\n\r\nI don&#39;t know if Iota will need a Coordinator forever. If the honest transaction rate reaches a certain point, I think we could get rid of it entirely, but with current PoW (Proof of Work) and difficulty that point is just too high. Maybe Network bound PoW will change something about this but we know hardly anything about it.\r\n\r\nAs for immutability, Iota uses the same mechanism as Blockchains:\r\n\r\n[![enter image description here][4]][4] \r\n[![enter image description here][5]][5]\r\n\r\nThe block with hash value `cof` points at the previous block `eef`. If someone changes the content of `eef`, the hash value of the block changes as well. It will no longer be `eef`, in fact `eef` will no longer exist.\r\n\r\n[![tangle][6]][6]\r\n[![tangle 404][7]][7]\r\n\r\n\r\nThe transactions with hash value `PMF` and `VQT` point at the transaction `JOE`. If someone tries to change the content of `JOE`, the hash value of the transaction changes as well. It will no longer be `JOE`, in fact `JOE` will no longer exist.\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_4_\r\n [3]: _URL_3_\r\n [4]: _URL_5_\r\n [5]: _URL_6_\r\n [6]: _URL_2_\r\n [7]: _URL_1_", "427" ], [ "As for Distributed Coordinator(s): The word \" ;distributed \" ; already implies multiple entities so I&#39;d leave the \" ;s \" ; out unless you are really talking about multiple e.g. \" ;2 distributed Coordinators in 2 different clusters \" ; or \" ;a main and a backup distributed Coordinator in the same cluster \" ;. Compare it to \" ;a distributed database \" ; or \" ;a distributed OS \" ; but I guess it&#39;s just semantics...", "224" ], [ "Here&#39;s what happens, for those of you who write and hack on packages:\r\n\r\nEmacs tries balancing the customization abilities and expressiveness of its extension language. This is why `defvar` (and by extension, `defcustom`) behaves in a somewhat surprising way. Consider this:\r\n\r\n (defvar foo 42) ; define foo with 42 as value\r\n (setq foo 13) ; set foo to 13\r\n\r\nNothing special here. A variable is declared and initialized, then it&#39;s set to a different value. What happens if we do it the other way around?\r\n\r\n (setq foo 13) ; set foo to 13, defining it in the process\r\n (defvar foo 42) ; marks variable as special, but doesn&#39;t change value\r\n\r\nYou might have expected that the `defvar` overrides the previous assignment, but Emacs treats this case deliberately different. The idea is that if the user has set a variable before it has been declared and initialized, whatever the user set it to shall stay its value. Therefore the `defvar` merely marks the variable as special, but doesn&#39;t change its value. This is usually the right thing to do with customizables.\r\n\r\nNow, imagine we&#39;re not working with `foo`, but a hook variable and the contents aren&#39;t a number, but a list of symbols. In this case we really want to start out with a meaningful value (as opposed to it being ignored if the variable is set before that) and allow the user (or any code of our own) to add functions. For this case there&#39;s the following idiom:\r\n\r\n (defvar some-hook nil)\r\n (add-hook &#39;some-hook &#39;foo)\r\n (add-hook &#39;some-hook &#39;bar)\r\n\r\nSuppose the user did `(add-hook &#39;some-hook &#39;baz)`. No matter whether this has been evaluated before or after the above code, you&#39;d always have the functions `foo` and `bar` and `baz` in the hook, only the ordering would be different. This is the recommended pattern for hooks and other customizables where the initial contents matter.", "373" ], [ "In fungible tokens you track number of tokens per an account.\r\n\r\nIn non-fungible tokens you track individual token per account.\r\n\r\nThe latter is the only way to do non-fungible tokens - you need to track an individual token, as it would not be non-fungible otherwise.\r\n\r\nYou cannot compress the memory cost beyond `account:token id` pair, so there is no way to reduce the cost beyond raw RAM consumption.", "427" ], [ "The question misses the point. Sure, suppose you do `(car huge-list)`, the evaluator will eval `huge-list` by checking for its type, finding that it&#39;s a symbol, looking it up in the environment and returning the bound value (a list object that has been created earlier). However, by that point the huge list has already been generated. Evaluating it over and over again won&#39;t change anything about this fact. Even if we were evaluating a list literal, we&#39;d just get a pointer back to the object that was created at read time. `(car (huge-list))` isn&#39;t much different, here `car` would get a Lisp object and evaluating it will return it unchanged.\r\n\r\nThe point of lazy data structures is deferring the *creation* of the huge list as long as possible. What you really want is a function that when given a directory, produces one directory item at a time, allowing you to stop early. Unfortunately such a thing doesn&#39;t exist. The closest thing to this is the `readdir` function in C which isn&#39;t directly exposed to users, `directory-files` (used by `f--files` and everything else) is using it to create the full list. The only thing you can do to limit this list is using the match argument to only list files matching the given regular expression. Or write an Emacs module that gives you `readdir`. If you&#39;re absolutely sure it&#39;s a performance issue (have you proven it by measuring?), you know what to do...", "712" ], [ "There is no such facility for loops. Considering `next` in Ruby is the idiom to avoid a nested `if`, you can easily work around this by using this advice the other way around.\r\n\r\n (dotimes (i 6)\r\n (unless ( < i 2)\r\n (message \" ;Value of local variable is %d \" ; i)))\r\n\r\nAn even uglier workaround is using the `throw`/`catch` facility (which is designed for control flow, not exception handling):\r\n\r\n (dotimes (i 6)\r\n (catch &#39;next\r\n (when ( < i 2)\r\n (throw &#39;next t))\r\n (message \" ;Value of local variable is %d \" ; i)))\r\n\r\nI&#39;d recommend rethinking the problem so that you don&#39;t need `next` at all. Or use a more powerful looping construct, such as `cl-loop`.", "1007" ] ]
408
[ 13184, 9539, 15351, 3381, 16373, 11916, 18595, 13071, 7943, 8810, 1879, 17033, 640, 1030, 8327, 18658, 2229, 14680, 10348, 13136, 12670, 5635, 1324, 3910, 2835, 5321, 5519, 14416, 3621, 18832, 7167, 1402, 2115, 620, 11770, 6913, 7179, 10599, 5037, 14087, 1691, 12523, 2626, 1802, 10683, 5435, 1453, 18601, 1574, 10470, 1304, 11381, 2008, 5089, 14602, 1084, 9469, 847, 925, 16868, 11754, 3697, 12598, 10330, 9320, 1023, 10258, 7020, 18646, 8558, 279, 9023, 15719, 4344, 18040, 10911, 18314, 11356, 6222, 2770, 7875, 9099, 5077, 16149, 14783, 19500, 19079, 9610, 1277, 9574, 13623, 6318, 1956, 2363, 14900, 10090, 16804, 15923, 15767, 13185, 16287, 15956, 9701, 19251, 17463, 14785, 9600, 18879, 11665, 10966, 18699, 13896, 6276, 933, 310, 725, 6171, 5777, 8908, 8923, 10556, 14281, 5893, 9439, 12036, 2853, 7679, 12283, 4944, 299, 4091, 15551, 5984, 18557, 6150, 12887, 488, 11327, 17136, 17769, 4614, 9702, 16120, 9117, 97, 9303, 5211, 18974, 13933, 2355, 476, 13146, 8004, 4333, 19262, 5154, 5677, 16824, 2353, 19614, 11229, 9961, 2701, 710, 10048, 16103, 4544, 16712, 6396, 16161, 16536, 5528, 5223, 4815, 19285, 5575, 13733, 9993, 703, 18224, 19111, 5424, 14098, 4973, 19569, 12690, 5566, 3821, 4885, 15344, 4272, 7585, 9131, 17766, 7810, 1125, 18877, 8263, 17977, 613, 5046, 19507, 9767, 12994, 6547, 11843, 635, 8621, 7312, 16262, 9411, 987, 8328, 12738, 10148, 3913, 16617, 6940, 3301, 7350, 2263, 3134, 11140, 18618, 18391, 17008, 15438, 2046, 8311, 14097, 1339, 2472, 2773, 3371, 908, 18541, 421, 396, 18002, 1239, 12222, 5122, 2113, 19211, 18400, 5534, 14345, 13080, 10703, 17945, 3928, 2914, 5743, 16261, 17930, 19206, 4255, 19315, 6024, 3818, 6452, 1757, 5186, 15647, 4068, 5300, 13970, 10155, 12148, 16012, 596, 18353, 10420, 8936, 19230, 6760, 17924, 14617, 14603, 16834, 9169, 98, 11145, 1056, 4036, 12034, 7995, 5401, 16063, 2322, 10074, 6580, 15779, 7403, 3793, 1124, 15674, 2889, 14932, 16309, 18402, 14962, 19145, 11095, 19270, 184, 3039, 18920, 16745, 4250, 16944, 14390, 6084, 14516, 11171, 15158, 4212, 8062, 442, 7721, 10065, 8160, 12908, 9569, 16133, 18474, 2402, 12464, 2686, 5185, 18293, 11165, 5752, 3514, 2286, 1922, 8916, 1390, 6897, 18611, 11273, 12280, 9190, 2976, 9840, 16708, 16882, 10920, 12331, 2227, 6053, 12504, 6383, 16195, 2900, 6230, 18801, 15439, 8639, 8055, 2399, 10314, 4667, 4153, 3970, 7850, 251, 12612, 19344, 15482, 1876, 13286, 11753, 8784, 15519, 16958, 6970, 18677, 15313, 3698, 814, 18476, 8881, 7655, 3473, 7622, 5308, 6671, 10696, 8892, 17576, 12953, 11025, 1897, 11379, 5903, 18039, 8867, 11187, 17571, 11493, 3363, 5914, 7230, 14886, 14014, 2273, 5290, 1923, 13412, 2067, 9100, 10444, 19356, 2769, 10303, 4754, 11524, 6930, 2682, 13977, 6337, 17403, 499, 15408, 2475, 1582, 8269, 14571, 2395, 16407, 12233, 4898, 12189, 11451, 4033, 6275, 13917, 10202, 4208, 1318, 18254, 7931, 1674, 3267, 12023, 3151, 4179, 1590, 16691, 5306, 15302, 4472, 1072, 12382, 3644, 6330, 3307, 6426, 9938, 25, 14033, 19417, 15033, 17997, 16469, 3873, 9962, 10046, 11688, 13178, 301, 2379, 906, 7519, 19131, 8988, 437, 5324, 9380, 18524, 10472, 3292, 14975, 657, 1801, 6059, 4491, 11841, 5857, 3838, 15740, 2868, 4405, 19579, 8853, 1800, 1039, 3861 ]
STX_100.0
[ [ "I have never used any checklist or Mnemonic for this, but I do use it as a sneaky way to make myself look professional to my passengers while *really* using it to remind myself what the hell I&#39;m actually meant to be doing. \r\n\r\nTypically it will contain the following\r\n\r\n - What will happen in the next 5 minutes ( \" ;We&#39;ll line up on the runway when told to.... we will begin rolling..... we will lift off at about [speed] \" ;)\r\n\r\n - What will happen immediately after take off ( \" ;We will climb until X, at which point I will turn [left|right] and head towards Y \" ;)\r\n\r\n - What the intention of the flight is ( \" ;We will continue via X & Y to Z \" ;)\r\n\r\n - Any quick emergency procedures which might be necessary (Much like your instructor demonstrated, along with briefly what the passenger should do in case of this emergency.)\r\n\r\nI do this at the hold when with an instructor, or experienced pilot in the other seat. If its an inexperienced or nervous flyer I take longer about it, usually sitting in the aircraft prior to startup.", "463" ], [ "Well, the 3 points you make are easily demonstrable to be true, and also a fairly unique feature of all three if looked at side-by-side.\r\n\r\nThe 747 is the only one with an obvious hump towards the front of the aircraft. This upper row of windows is unlike either of the other two\r\n\r\n![747](_URL_6_)\r\n < sub > Photo <PERSON>:: source: _URL_4_;\r\n\r\nThe A380 has an entire upper row of windows - it does indeed have 2 full decks.\r\n\r\n![A380](_URL_5_)\r\n < sub > \t<PERSON> source: _URL_3_;\r\n\r\nIf it has 4 engines, but neither a half upper deck and hump or a full upper deck (and it&#39;s an airbus!) then yes it is an A340\r\n\r\n![A340](_URL_2_)\r\n < sub > Aero Icarus source: _URL_8_;\r\n\r\nHowever, that is not all the 4 engine passenger aircraft.\r\n\r\nThe BAe 146 is a 4 engine regional airliner, and you could add to your distinguishing features \" ;has a T-tail, must be a 146 \" ;. It is also the only one of the bunch with a high wing.\r\n\r\n![BAe146](_URL_7_)\r\n < sub > \t<PERSON> source: _URL_0_;\r\n\r\nAnd then we&#39;re into the Ilyushins. The Il-96, is easily distinguishable from the similar(ish) A340 as it is considerably smaller - hard to tell from a close-in photo, but in real life if one were parked next to the other the IL-96 is smaller.\r\n\r\n![IL-96](_URL_11_)\r\n < sub > <PERSON> source:_URL_9_;\r\n\r\nThe Il-86 has 4 engines but does not fit your criteria, as it only remains in service with the Russian Military, but the Il-62 is still in commercial service. It&#39;s *very* easy to distinguish by having its 4 engines mounted on the tail\r\n\r\n![Il-62](_URL_10_)\r\n < sub > <PERSON><IP_ADDRESS> source: _URL_4_;\r\n\r\nThe A380 has an entire upper row of windows - it does indeed have 2 full decks.\r\n\r\n![A380](_URL_5_)\r\n < sub > \tRichard Vandervord source: _URL_3_;\r\n\r\nIf it has 4 engines, but neither a half upper deck and hump or a full upper deck (and it&#39;s an airbus!) then yes it is an A340\r\n\r\n![A340](_URL_2_)\r\n < sub > Aero Icarus source: _URL_8_;\r\n\r\nHowever, that is not all the 4 engine passenger aircraft.\r\n\r\nThe BAe 146 is a 4 engine regional airliner, and you could add to your distinguishing features \" ;has a T-tail, must be a 146 \" ;. It is also the only one of the bunch with a high wing.\r\n\r\n![BAe146](_URL_7_)\r\n < sub > \tAdrian Pingstone source: _URL_0_;\r\n\r\nAnd then we&#39;re into the Ilyushins. The Il-96, is easily distinguishable from the similar(ish) A340 as it is considerably smaller - hard to tell from a close-in photo, but in real life if one were parked next to the other the IL-96 is smaller.\r\n\r\n![IL-96](_URL_11_)\r\n < sub > Anna Zvereva source:_URL_9_;\r\n\r\nThe Il-86 has 4 engines but does not fit your criteria, as it only remains in service with the Russian Military, but the Il-62 is still in commercial service. It&#39;s *very* easy to distinguish by having its 4 engines mounted on the tail\r\n\r\n![Il-62](_URL_10_)\r\n < sub > Tim Rees source: _URL_1_;", "440" ], [ "From the [yellow paper](_URL_0_) Appendix G. Fee Schedule:\r\n\r\n Gcall 700 Paid for a CALL operation.\r\n Gnewaccount 25000 Paid for a CALL or SUICIDE operation which creates an account.\r\n\r\nIn your first (successful) transaction you are sending ether to address [78d2...4821](_URL_1_) which is already \" ;created \" ; (i.e. has some transactions). So you are paying 700 gas for executing `CALL` instruction.\r\n\r\nBut in the second (failed) transaction you are sending ether to address [c11b...d675](_URL_3_) which is \" ;new \" ; (i.e. does not have any incoming transactions). In this case executing `CALL` costs 25000 gas.\r\n\r\n---\r\n\r\nThis distinction was added in response to the DoS attack on the Ethereum network which occurred at the end of 2016. See [EIP158](_URL_4_) and [EIP161](_URL_2_) for more details.", "910" ], [ "Cuando trabajes con archivos en tu formulario tienes que especificar el atributo `enctype= \" ;multipart/form-data \" ;`:\r\n\r\n < form action= \" ;/prueba/formulario/ \" ; method= \" ;post \" ; enctype= \" ;multipart/form-data \" ; > \r\n {% csrf_token %}\r\n {{ form }}\r\n < input type= \" ;submit \" ; value= \" ;Submit \" ; > \r\n < /form > \r\n\r\nEsto est&#225; especificado en la documentaci&#243;n de Django para [Basic file uploads](_URL_0_):\r\n\r\n > Note that request.FILES will only contain data if the request method was POST and the < form > that posted the request has the attribute enctype= \" ;multipart/form-data \" ;. Otherwise, request.FILES will be empty.\r\n\r\nEs decir, `request.FILES` solo contendr&#225; informaci&#243;n de tus archivos siempre y cuando hayas usado el atributo `enctype= \" ;multipart/form-data \" ;`. Es por eso que te sale el error.", "973" ], [ "I think that deferring emails is the wrong solution for you here. A question like this often indicates the hosting may not be suitable for the site profile.\r\n\r\nUnless it&#39;s part of your site model, a workaround of delaying delivery will just show user engagement. Over the course of a day you&#39;ll end up sending the same number of emails, so this won&#39;t reduce your chances of being flagged as a spammer.\r\n\r\nWhat will work better is to ensure you use a reliable mail delivery mechanism, and avoid spam behavior (like sending excessive or unwanted notifications).\r\n\r\nIf your existing hosting limits outbound email, and you need to send more emails than the limits they offer, find a provider who does suit your needs (and will scale for future success). There are plenty of mail providers on the market for you to choose from, and options for reliable self hosted systems too.", "503" ], [ "You should probably look first at either not storing this data but instead deferring its calculation, or at alternative storage methods, eg perhaps [`cache_set()`](_URL_0_) and `cache_get()`. You could easily run into the same DB limitations there of course.\r\n\r\n**You probably don&#39;t need to store this data to the session at all**, and as you&#39;ve discovered it can be problematic to do so.\r\n\r\nI&#39;ve seen developers use `$_SESSION` as a global variable to pass data around, and as temporary per-visitor storage. This is possible, but there are limitations and likely better ways - for which you might need to zoom out to the actual problem at hand. (*Do you need to store a rendered collection of kitten profiles, or just a list of kitten IDs then render later?*)\r\n\r\nIf you do actually need to store such large datasets to the session, you&#39;d probably have to replace the default session management in Drupal or reconfigure your DB (which you&#39;ve said you&#39;d rather not do). In that case perhaps modules like Session Proxy or perhaps Memcache would help ... But try not to go there :)", "756" ], [ "Automated scans sometimes report issues that are non-issues, and the results of an automated scan do need to be combined with an understanding of the issues at hand (and, if they require fixing, the risks of introducing new code to mitigate supposed vulnerabilities).\r\n\r\nAs <PERSON> says, in Drupal there are multiple URLs that may work to access the same node or path directly. While this might not be ideal for SEO (if people link to multiple URLs), it likely isn&#39;t an actual security concern.\r\n\r\nThis can likely be solved using approaches like the [Global Redirect](_URL_3_) module in Drupal 7, and the [Redirect](_URL_2_) module in Drupal 8 (and in D7 if patched from [#905914: Merge global redirect functions into Redirect module](_URL_0_)).\r\n\r\nYou&#39;ll get the SEO improvements, and if the security team really need convincing, hopefully it&#39;s an easy item to knock off the list!\r\n\r\nIf those don&#39;t cut it, you could do something similar to what Global Redirect or Redirect do, eg implement [`hook_url_inbound_alter()`](_URL_1_) or [`hook_init()`](_URL_4_), check for those zeroes, and redirect them. In that case, be careful that the \" ;fix \" ; for this \" ;problem \" ; is not riskier than the existing situation.\r\n\r\nYou could also handle this with redirects at the webserver layer.", "110" ], [ "Your understanding is half correct. Yes, we can measure the amount of radiation the Earth receives from the Sun.\r\n\r\nYes, it is difficult to get an *extremely* precise measure of how much radiation the Earth receives from the Sun in any one time interval. But there&#39;s not really much value in such extreme precision anyway.\r\n\r\nHowever, it is fairly easy to measure solar irradiance at any one place (on earth, in the atmosphere or in space); as [NASA and others](_URL_0_) currently do (kudos to farrenthorpe for the link). These measurements account for the changing distance to the sun, and the tilt of the earth, and to a very large extent the variable amount of radiation emitted from different parts of the sun&#39;s surface, because the Sun&#39;s diameter is tiny compared to the distance between the Earth and the Sun (just under 1%).\r\n\r\nAnd having measured solar irradiance at one or more places, it is then easy to get a fairly precise estimate of how much radiation the Earth receives from the Sun in any one time interval.", "1014" ], [ "I&#39;m not aware of a report (a good home for such a thing might be the [Site Audit project](_URL_1_)? ([#2882555](_URL_0_))\r\n\r\nHere&#39;s a *very* quick report for D7 that shows:\r\n\r\n* Custom modules\r\n* Modules without a release covered by Security Policy\r\n\r\nYou can download this and use it with `drush scr`, or copy it for `drush eval` directly. [Feel free to improve on it!](_URL_2_)\r\n\r\n < ?php\r\n $projects = update_get_available(true);\r\n $uncovered = [];\r\n foreach ($projects as $name = > $project) {\r\n if (!isset($project[ \" ;releases \" ;])) {\r\n $uncovered[$name] = \" ;No releases found \" ;;\r\n }\r\n else {\r\n $latest_release = reset($project[ \" ;releases \" ;]);\r\n if (!empty($latest_release[ \" ;security \" ;])) {\r\n $uncovered[$name] = $latest_release[ \" ;security \" ;];\r\n }\r\n }\r\n };\r\n print_r($uncovered);", "110" ], [ "Yes, you can. It means giving a commitment for a fair number of years in service of your country, where you will be trained as a pilot (assuming you get on to that - there are more jobs in the RAF than just pilot!). After your service, one thing you can do with your military flying experience is become a commercial pilot.\r\n\r\nWhen I was young enough to consider it, there were 3 ways to become a commercial pilot\r\n\r\n - Learn in the airforce\r\n - Pay your own way (PPL, CPL, ATPL etc)\r\n - Get a scholarship from a big carrier like BA. There were usually about 4-6 given per year to the highest achievers.", "463" ], [ "You can&#39;t. A windrose aggregates over time, so you lose all the information about patterns over time. You&#39;re trying to do a time-based simulation, but your data source discards all time-specific information.\r\n\r\nYou need a different set of data, to base your simulation on. One that contains the dimension of time.\r\n\r\nThe changes in direction and speed over time vary hugely depending on the local climate and topology.", "130" ], [ "Here is a short English example from the paper [Non-Projective Dependency Parsing in Expected Linear Time][1]:\r\n\r\n[![Dependency tree for an English sentence (non-projective).][2]][2]\r\n\r\nOr, if you want it in [Universal Dependencies][3],\r\n\r\n[![Universal Dependencies non-projective tree for an English sentence.][4]][4]\r\n\r\nHere is the LaTeX code to generate the latter:\r\n\r\n \\begin{dependency}\r\n \t\\begin{deptext}[column sep=1.2em]\r\n \t A \\ & hearing \\ & is \\ & scheduled \\ & on \\ & the \\ & issue \\ & today \\\\\r\n \t\\end{deptext}\r\n \t\\deproot{4}{root}\r\n \t\\depedge{2}{1}{det}\r\n \t\\depedge{4}{2}{nsubj:pass}\r\n \t\\depedge{4}{3}{aux:pass}\r\n \t\\depedge{7}{5}{case}\r\n \t\\depedge{7}{6}{det}\r\n \t\\depedge[edge start x offset=-6pt]{2}{7}{nmod}\r\n \t\\depedge[edge slant=6pt]{4}{8}{nmod:tmod}\r\n \\end{dependency}\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_2_\r\n [3]: _URL_1_\r\n [4]: _URL_3_", "931" ], [ "This may be confirmation bias on my part, this might be impatient passengers pressing the call button, and it might be me imagining things, but it&#39;s one of those I&#39;ve wondered about. I&#39;ll try to describe as best I can.\r\n\r\n---\r\n\r\nOf all the times I&#39;ve flown recently on an airliner, of which most of the time it&#39;s a short haul carrier often flying smaller Boeing/Airbus aircraft*, I have been aware that there is an audible chime which can be heard throughout the cabin (ie, not only when sat in the vicinity of crew seats) very soon (30-45 seconds) after take-off. \r\n\r\nIt is heard well before the passenger seat-belt signs are switched off.\r\n\r\nCan anyone describe what I am hearing and what its purpose is? Who is this a signal for, and who is sending the signal?\r\n\r\n----\r\n\r\n < sub > * the two times I&#39;ve flown on an <PERSON> I don&#39;t recall hearing it < /sub >", "463" ], [ "According to [this](_URL_0_) page the airframe was donated to Embry-Riddle Aeronautical University:\r\n\r\n > The Superstar airframe was later used as the prototype Aerostar 800. The prototype 800 was the Superstar airframe with two more seats (due to a 32” extension of the cabin) and featured two 400-hp. Lycoming engines. The 800 was under development when <PERSON> unexpectedly passed on in 1976. Piper continued development of the airplane as a replacement for their P Navajo but never certified it and eventually donated the airframe to **Emery Riddle [sic] Aeronautical University**. \r\n\r\nThis is the only reference I can find to the ultimate location of the Aerostar 800.", "472" ], [ "**TL;DR** Probably \" ;Operational \" ; reasons\r\n\r\n----\r\n\r\nI would hazard a guess that this is a combination of a few factors\r\n\r\n 1. A longer route flown inbound to London\r\n 2. Flying in to a busy airspace like London requiring particular routing, particularly oft requiring length hold patterns\r\n 3. The time of day the flight in to London arrives being particularly busy (late afternoon/early evening)\r\n\r\nThese three factors may cause the airline to list the flight duration as longer than it would usually, in order to account for the possibility of a lengthy flight time.\r\n\r\nIf you look at the [track of the outbound flight](_URL_1_) and compare it to the [inbound flight](_URL_0_) you see that, at least on that occasion, a much longer track was followed. The airline may know that the route back to London is longer (for whatever reason) and adjust expected flight times accordingly.\r\n\r\nAlso, when you compare it to the only other direct flight departing and returning to the same airport (LGW) on skyscanner for the same route, the time difference is much less (15 minutes difference) which is much more usual. It may well be that the route to/from LGW is more equal outbound/return than the route taken to STN. It may also be that this flight in to LGW is at a typically quieter time of day.", "587" ], [ "You&#39;ve not specified how much you consider \" ;so much \" ;, however it&#39;s unlikely to matter too much to the answer. What you&#39;re paying for is (at least) twofold, and *probably* consists of\r\n\r\n1. The rental of somebody else&#39;s aircraft. Every hour you fly this aircraft takes it an hour closer to an expensive maintenance window. There are costs involved in running an aircraft much like there are costs associated with owning/maintaining any vehicle. Also, fuel isn&#39;t free - its is often rolled in to the cost of rental for aircraft.\r\n2. The time of an instructor, who himself has spent time/money learning his craft, and quite possibly does this as his job (as in, its his sole purpose to earn money from teaching you to fly). He has skill and experience, and like all jobs, the more his skill/experience the greater fees he can charge.\r\n\r\nYou may have missed the first rule of purchasing a service - shop around. Is your flight school/instructor of a comparable price to others in the locality? Is the instructor you&#39;re using a senior CFI, or a new CPL hour-building to get a job with an airline? You will potentially get a different level of service depending on price, but this may suit your wallet better while still giving you the skills you need to get your own pilots license.\r\n\r\nAnectote: When I was training for my PPL (circa 2001-2002) in the UK I paid roughly &#163;150/hr. This included the hire of a C152 and a pretty experienced instructor. From memory the instructor was &#163;80/hr and the remainder was the aircraft. When I got sick of being cramped in a C152 with another 6&#39;2 \" ; guy, I paid more to fly a C172 - probably added about &#163;40/hr to the cost.", "0" ], [ "If you have access to Drush and want a quick solution which lets you whitelist users to keep and doesn&#39;t involve installing additional modules:\r\n\r\n drush @example.org sqlq \" ;SELECT name FROM users WHERE name NOT IN (&#39;keepthisuser1&#39;, &#39;andthisuser2&#39;) \" ; | while read NAME; do\r\n drush -y @example.org user-cancel $NAME ; \r\n done\r\n\r\nMake sure to adjust both the `@example.org` and list of users to keep `(&#39;keepthisuser1&#39;, &#39;andthisuser2&#39;)` in the above before copy pasting :)", "721" ], [ "Install Drush and use `drush uli` from within the site directory; you&#39;ll get a login URL you can use to log in and change your password.\n\nThe URL will start with `_URL_0_` unless you set `$base_url` in `settings.php` or use the `-l` option to Drush to correct it.\n\nJust replace _default_ with your local IP etc.", "406" ], [ "How did you used edge detection algorithms? Not sure it works and can&#39;t test now (so no answer for now :P), but just off the top of my head, you can divide your image in subregions and measure the value of gradients. Based on a threshold you can then decide whether that subregion is \" ;in-focus \" ; or not. Then you can re-use the edge info to refine your first approximation I described before. It makes sense to me know, but it may very well be a brain-fart being it late here :) I&#39;ll give it a try tomorrow if I have a minute to.", "102" ], [ "Just to an add another way to the excellent <PERSON> answer, you can use mean and gaussian curvature that can be obtained with a discrete Laplace-Beltrami. \r\n\r\nSo suppose that the 1-ring neighbourhood of $v_i$ in your mesh looks like this\r\n\r\n & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; [![enter image description here][1]][1] \r\n\r\n\r\n$A(v_i)$ can be simply a $\\frac{1}{3}$ of the areas of the triangles that form this ring and the indicated $v_j$ is one of the neighbouring vertices. \r\n\r\nNow let&#39;s call $f(v_i)$ the function defined by your mesh (must be a differentiable manifold) at a certain point. The most popular discretization of the Laplace-Beltrami operator that I know is the cotangent discretization and is given by: \r\n\r\n\r\n$$\\Delta_S f(v_i) = \\frac{1}{2A(v_i)} \\sum_{v_j \\in N_1(v_i)} (cot \\alpha_{ij} + cot \\beta_{ij}) (f(v_j) - f(v_i)) $$\r\n\r\nWhere $v_j \\in N_1(v_i)$ means every vertex in the one ring neighbourhood of $v_i$. \r\n\r\nWith this is pretty simple to compute the mean curvature (now for simplicity let&#39;s call the function of your mesh at the vertex of interest simply $v$ ) is\r\n\r\n$$H = \\frac{1}{2} || \\Delta_S v || $$\r\n\r\nNow let&#39;s introduce the angle $\\theta_j$ as \r\n\r\n\r\n & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp;[![enter image description here][2]][2]\r\n\r\nThe Gaussian curvature is:\r\n\r\n$$K = (2\\pi - \\sum_j \\theta_j) / A$$\r\n\r\n\r\nAfter all of this pain, the principal discrete curvatures are given by: \r\n\r\n$$k_1 = H + \\sqrt{H^2 - K} \\ \\ \\text{and} \\ \\ k_2 = H - \\sqrt{H^2 - K}$$\r\n\r\n___ \r\n\r\nIf you are interested in the subject (and to add some reference to this post) an excellent read is: [Discrete Differential-Geometry Operators\r\nfor Triangulated 2-Manifolds][3] [<PERSON> et al. 2003]. \r\n\r\nFor the images I thank my ex-professor <PERSON> as I found them in some notes I took for his lectures.\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_1_\r\n [3]: _URL_0_", "450" ], [ "O problema &#233; que a implementa&#231;&#227;o de `@Transactional` por padr&#227;o usa um *proxy*. Quando voc&#234; anota o mesmo m&#233;todo com uma anota&#231;&#227;o como `@Scheduled` ela n&#227;o passa por nenhum *proxy* e assim o Spring n&#227;o tem como interceptar as chamadas para controlar transa&#231;&#245;es.\r\n\r\n### Solu&#231;&#227;o\r\n\r\nMova o `demoService` para uma outra classe mantendo a anota&#231;&#227;o `Transacional` nesse segundo n&#237;vel: \r\n\r\n @Service\r\n public class DemoService {\r\n @Autowired\r\n private OpenServiceRepository openServiceRepository;\r\n \r\n @Transactional(propagation = Propagation.REQUIRED)\r\n public void demoServiceMethod(){\r\n long count = openServiceRepository.count();\r\n System.out.println( \" ;O numero de Servi&#231;os em aberto &#233;: \" ; + count);\r\n }\r\n }\r\n\r\nE use sua nova classe dentro do ervi&#231;o de *scheduling*:\r\n\r\n @Service\r\n public class Tasks { \r\n @Autowired\r\n private DemoService demoService;\r\n \r\n @Scheduled(cron= \" ;*/5 * * * * ? \" ;)\r\n public void fireDemoService(){\r\n demoService.demoServiceMethod();\r\n System.out.println( \" ;O numero de Servi&#231;os em aberto &#233;: \" ; + count);\r\n }\r\n }\r\n\r\nDessa forma a *task* passar&#225; pelo *proxy* na chamada de `demoServiceMethod` e a transa&#231;&#227;o ser&#225; aberta como esperado. \r\n\r\nAdicionalmente, caso voc&#234; realmente precise de transa&#231;&#245;es dentro da mesma classe, uma op&#231;&#227;o &#233; habilitar *weaving* em tempo de compila&#231;&#227;o ou *loading* (e.g., usando: [`@EnableTransactionManagement(mode = AdviceMode.ASPECTJ)`](_URL_3_) e [@EnableLoadTimeWeaving](_URL_5_))\r\n\r\n----\r\n\r\n##Refer&#234;ncias:\r\n\r\n* [SOen - Spring3 &#39;s @Transactional @Scheduled not committed to DB?][1]\r\n* [Spring Framework reference - Using @Transactional][2]\r\n* [Load-time weaving with AspectJ in the Spring Framework][3]\r\n* [Spring transactions on non-public methods with load-time weaving][4]\r\n\r\n[1]: _URL_1_\r\n[2]: _URL_4_\r\n[3]: _URL_0_\r\n[4]: _URL_2_", "147" ], [ "## Goals\r\nIt sounds like you&#39;re starting a small business, in which case, you will quickly outgrow 5 gallon batch sizes as you begin distribution. \r\n\r\nDepending on your needs, I would suggest purchasing industrial beer brewing equipment, such as conical fermenters and brite tanks. \r\n\r\n___\r\n## Use of Conical Fermenter \r\n\r\n[![Conical Fermenter][1]][1]\r\n\r\nThe conical fermenter would allow you to long brew a batch, bubble nitrogen or CO2 up from the bottom for agitation (increasing extraction and preventing oxidation), and will let the grinds settle into the bottom shoulder of the tank when the brewing process is complete. \r\n\r\n_____ \r\n\r\n## Use of Brite Tanks\r\n\r\n[![Large Brite Tank][2]][2] \r\n\r\nBrite tanks come in a range of sizes from ~1 gallon up to tens of thousands of gallons. They are primarily used as a glycol jacketed pressure rated storage vessel for keeping beer (and similar beverages) in optimial conditions before storage. They may also be used as part of the forced carbonation of the liquid in the tank. A brite tank will be useful for your cold brew business as you scale up because it will give you an intermediary vessel to blend out and store batches before packaging. \r\n\r\n_____ \r\n\r\n## Scaling up your production \r\n\r\nDepending on your business plans and packaging / distribution ability, \r\nyou will probably want to start with a slightly larger setup that gives you 1) room to grow and 2) the ability to expand without changing process or systems. Beer equiptment is well suited to meet these goals. \r\n\r\n____ \r\n\r\n## Quality, consistency, and some notes on process: \r\n\r\nThe majority of consumers demand a consistent product with an interesting flavor-profile that they can enjoy *every* time they purchase your product. Flavor-profile deviations will cause you to loose consumers to a more consistent product in the long run. The following points will help ensure a more consistent product: \r\n\r\n1. blend out batches of cold brew from the fermenters into a single brite tank\r\n2. use CO2 or nitrogen to prevent oxidation\r\n3. manual agitation is inconsistent - use a bubbler with CO2 or nitrogrn instead. This will also help with goal 2. \r\n4. Packaging lines make a huge difference. Invest for growth in a rotary topper, not a 4 or 6 head. \r\n5. Don&#39;t attempt to use the same blend of beans for cold brew, draft cold brew, and nitro. \r\n\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "29" ], [ "The standard recommended ratios for cold brew are: \r\n\r\n````\r\n| Roaster | oz Coffee | oz water | time | ratio | \r\n|----------------------------------------------------------| \r\n|Stumptown | 12oz | 56oz | 16 hours | .214 | \r\n|Blue Bottle | 16oz | 67.6oz | 12 hour | .236 | \r\n|Ritual | 4oz | 35.2oz | 18 hours | .113 | \r\n|Intelligentsia | 8oz | 56oz | 12 hours | .142 |\r\n````\r\n\r\nThese recipes vary in concentration - the lower ~0.1 recipes are designed to be consumed without dilution, while the ~0.2 recipes are designed to be consumed in a 1:2 cold brew concentrate to water dilution.", "29" ], [ "There&#39;s no point in adding tags in advance of them being used, because they&#39;ll get auto-removed.\r\n\r\nIf you see existing questions for which a new tag would add clarity, and/or would help experts pick the right question to answer, then please do create the tag by adding it to those questions. If you want to be extra-helpful, and give your new tag more chance of surviving and prospering, create a tag wiki excerpt for it too, as soon as you&#39;ve added the tag to one or more questions.", "423" ], [ "This seems like a very messy solution, especially given that the introduction to Luke&#39;s gospel states outright that he is *not* an eyewitness, but that he is aware of multiple *written* accounts of Jesus&#39; life. To suggest he chose here to not use/modify any of those accounts (whether they be <PERSON> and \" ;Q \" ; or [<PERSON> and Matthew](_URL_0_)) but to go with a separate, apparently oral, \" ;eyewitness \" ; testimony--and that <PERSON> likewise chose to ignore the written testimony he had available--raises more questions than it solves.", "719" ], [ "Yes, it is *possible*, however unlikely!\r\n\r\n---\r\n\r\nThe [final report into the downing of MH17](_URL_0_) investigated the possibility that the aeroplane was hit by \" ;meteor or space debris \" ;\r\n\r\n > In section 3.5 a number of scenarios are analysed that relate to the possible source or sources of the object that perforated the aeroplane. These include meteor and space debris.\r\n\r\nIt was concluded that\r\n\r\n > The chance of a meteor striking an aeroplane was calculated as being one event in 59,000 to 77,000 years. This value was obtained from the University of Pittsburgh&#39;s Department of Geology and Planetary Science and was originally part of the NTSB&#39;s investigation into the 1996 accident to TWA flight 800 (see NTSB Report AAR-00/03, dated 23 August 2000)", "850" ], [ "**Mg C is a tonne of Carbon.**\r\n\r\nAn Mg - a megagramme - is a tonne. It&#39;s a silly way of writing a tonne for a general readership, but it&#39;s the strict SI equivalent of a tonne. So an \" ;Mg C \" ; is a tonne of Carbon - the standard unit when it comes to talking about pricing Carbon.\r\n\r\nNormally you wouldn&#39;t see anyone writing about a million Mg of anything; (in this case, of carbon). You&#39;d either write about a Teragramme, or a million tonnes, but not a million Mg.\r\n\r\nHowever, if you draft a paper referring to millions of tonnes, and then the editor or a peer reviewer comes back and says that the tonne is not a strict SI unit but the Mg is, then someone in the chain of authors and editors may just do a search and replace on all the \" ;tonnes \" ; to replace them with \" ;Mg \" ;. And that&#39;s one way that you might end up with lots of references to \" ;million Mg C \" ;, instead of the more usual \" ;million tonnes of carbon \" ;", "603" ], [ "Moderators are not required to judge the correctness of answers. In the most egregious and obvious cases, we will delete incorrect answers, but as none of us are experts everywhere, we will generally tread on the side of caution.\r\n\r\nWith respect to your questions, \r\n\r\n1. There is no guarantee that a moderator will view a post unless it is flagged, and the post has not been so flagged.\r\n\r\n2/3. The answer is not spam or offensive, and is an answer.", "629" ], [ "*Note: I have answered before the edit from trichoplax and I thought you were searching for other transformations other than the one you mentioned. The informations below are still useful so I will keep the answer here, but it does not directly answer your question.*\r\n____ \r\n\r\nAffine transformations (surprise!) map affine spaces to affine spaces. An affine space is substantially a vector space where you can establish an origin and define points as tuples of their coordinates. This is far from a formal definition, if you are interested in one I can edit the answer. \r\n\r\nNow an affine transformation $T$ transform points into points and must preserve affine combinations: \r\n\r\n$T(\\lambda_1 P_1 + \\lambda_2 P_2 + ... + \\lambda_n P_n) = \\lambda_1 T(P_1) + \\lambda_2 T(P_2) + ... + \\lambda_n T(P_n) $ \r\n\r\nGiven $\\sum_{i}^{n} \\lambda_i = 1 $\r\n\r\nHowever these transformations can&#39;t be arbitrary as the following must be preserved: \r\n\r\n- ***Parallelism is preserved***. This means that if you transform parallel lines they remain parallel after the affine transformation.\r\n\r\n- ***Relative ratios are preserved***. This means that if you have $R = (1-\\beta) P + \\beta Q$ then $T(R) = (1 - \\beta) T(P) + \\beta T(Q)$ \r\n\r\n- ***Addition between vector and points are preserved***. Meaning that $T( P + \\vec{v} ) = T(P) + T(\\vec{v})$\r\n\r\n\r\nWith these properties in mind you can come up with a very big number of affine transforms yourself. A couple of obvious ones other the ones you mentioned are: \r\n\r\n\r\n**Translation** \r\n\r\n\r\n$$T_vp = \r\n\\begin{bmatrix}\r\n1 & 0 & 0 & v_x\\\\0 & 1 & 0 & v_y\\\\0 & 0 & 1 & v_z\\\\0 & 0 & 0 & 1\\end{bmatrix}\r\n\\begin{bmatrix}\r\np_x+v_x\\\\p_x+v_y\\\\p_z+v_z\\\\1\\end{bmatrix}=p+v$$\r\n\r\n\r\n\r\nThat moves a point into a specific direction by a specific amount specified by a displacement vector. \r\n\r\n**Shearing** \r\n\r\n[![enter image description here][2]][2]\r\n*image from wikipedia*\r\n\r\nThat is a transform that displace all points in a given direction by an amount that is proportional to their perpendicular distance to a line parallel to that direction. \r\n\r\nFor example the transform matrix for an horizontal shear in a 2D space is given by: \r\n\r\n\r\n$$\r\n\\begin{bmatrix}x&#39;\\\\y&#39;\\end{bmatrix} = \\begin{bmatrix}x+my\\\\y\\end{bmatrix} = \r\n\\begin{bmatrix}1 & m\\\\0 & 1\\end{bmatrix}\\begin{bmatrix}x\\\\y\\end{bmatrix}$$\r\n\r\n\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_2_\r\n [3]: _URL_0_\r\n\r\n_____\r\n\r\n\r\n\r\nAgain, these two are just example, the important information you should really keep is the definition (and properties) of an affine transform; with that in mind it shouldn&#39;t be too hard to recognize an affine transform. Also note that combining affine transforms will give you an affine transform!", "1" ], [ "It looks like you&#39;ve omitted the `$val` in your user-add-role invoke.\r\n\r\nDrush won&#39;t know which user to add the role to!\r\n\r\nYou have\r\n\r\n drush_invoke(&#39;user-add-role&#39;, \" ;Premium members \" ;); \r\n\r\nYou should have\r\n\r\n drush_invoke(&#39;user-add-role&#39;, \" ;Premium members \" ;, $val); \r\n\r\nIf that doesn&#39;t solve it, you next might need to check the handling of role name, since it contains a space. A quick test (`drush user-add-role &#39;Some role&#39; <EMAIL_ADDRESS>`) locally suggests that this should work OK if the Drush command gets the parameter with the space in it.\r\n\r\nAs far as * \" ;Is there a better way to achieve this? \" ;* goes, yes - you could be checking the results of each command and reporting back failures, rather than moving on to the next step. (If the user account already exists when you call `drush user-create`, your code may want to stop before changing the password for an existing account with `drush user-password`.)", "103" ], [ "En general, cuando trabajas con ese tipo de relaciones (`Autor/Libro`, `Factura/Item`, etc.) lo que deber&#237;as usar son [`Formsets`](_URL_3_) que te ayudan a trabajar con m&#250;ltiples formularios en la misma vista.\r\n\r\nEn este caso puedes usar un [`InlineFormset`](_URL_2_):\r\n\r\n from django.core.urlresolvers import reverse\r\n from django.forms import inlineformset_factory\r\n from django.http import HttpResponseRedirect\r\n from django.shortcuts import render\r\n\r\n from .forms import InvoiceForm, ItemForm\r\n \r\n\r\n def invoice_generator(request):\r\n ItemFormSet = inlineformset_factory(\r\n Invoice,\r\n Item,\r\n form=ItemForm,\r\n fields=(&#39;description&#39;, &#39;quantity&#39;, &#39;rate&#39;, &#39;amount&#39;, &#39;subtotal&#39;, &#39;tax&#39;),\r\n extra=4\r\n )\r\n form = InvoiceForm()\r\n formset = ItemFormSet()\r\n if request.method == &#39;POST&#39;:\r\n form = InvoiceForm(_URL_0_)\r\n formset = ItemFormSet(_URL_0_)\r\n if form.is_valid() and formset.is_valid():\r\n form.save()\r\n formset.save()\r\n url = reverse(&#39;alguna_url&#39;)\r\n return HttpResponseRedirect(url)\r\n return render(request, &#39;invoiceapp/invoice_generator.html&#39;, {\r\n &#39;form&#39;: form,\r\n &#39;formset&#39;: formset\r\n })\r\n\r\nY en tu template `invoice_generator.html`:\r\n\r\n ...\r\n < form method= \" ;POST \" ; > \r\n {% csrf_token %}\r\n {{ form.non_field_errors }}\r\n < !-- La factura -- > \r\n {{ form.vendor.label_tag }}\r\n {{ form.vendor }}\r\n ...\r\n \r\n < !-- Los items -- > \r\n {{ formset.management_form }}\r\n {% for form in formset %}\r\n {{ form.non_field_errors }}\r\n {{ _URL_4_ }}\r\n {{ form.description }}\r\n {{ form.quantity }}\r\n ...\r\n {% endfor %}\r\n\r\n < button type= \" ;submit \" ; > <PERSON> < /button > \r\n < /form > \r\n ...\r\n\r\nAlgunas consideraciones:\r\n\r\n- El par&#225;metro `form` del `inlineformset_factory` es opcional, yo lo estoy usando debido a que ya hab&#237;as definido tu formulario.\r\n- El par&#225;metro `extra` del `inlineformset_factory` sirve para indicar la cantidad de `items` que tendr&#225;s inicialmente, es decir, tu factura aparecer&#225; con 4 formularios para `Item`.\r\n- Cuando usas `FormSets` y renderizas manualmente los formularios tienes que definir el [`management_form`](_URL_1_) (`{{ formset.management_form }}`)\r\n- Cuando usas `FormSets` y renderizas manualmente los formularios tienes que indicar el `id` para que funcione correctamente (`{{ _URL_4_ }}`)", "34" ], [ "You can combine <PERSON> with Proposition 6.9 of [my paper][1] with <PERSON> to prove that there are these kinds of localization sequences in a great deal of generality. (Note that our proposition is simply an analogue for stable $\\infty$-categories of a dg-categorical result of To&#235;n.) So, if $A$ is a sheaf of (quasi-coherent) dg algebras on $X$, then this proposition shows that there is a fiber sequence $$K_Z(X,A)\\rightarrow K(X,A)\\rightarrow K(U,A).$$ Identifying the fiber term as $K(Z,i^*A)$, where $i:Z\\rightarrow X$ is the inclusion and $i^*A$ is the derived pullback, is not something I&#39;ve thought about. This kind of d&#233;vissage statement is much more difficult for dg algebras than it is for ordinary algebras, and it fails in some cases. There&#39;s a discussion of this in [my paper][2] with <PERSON> and <PERSON>.\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "278" ], [ "Estoy observando un mensaje de alerta (no es un error) `InsecurePlatformWarning` al ejecutar el comando `pip` en Linux:\r\n\r\n $ pip search reportlab\r\n /usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90:\r\n InsecurePlatformWarning: A true SSLContext object is not available.\r\n This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail.\r\n For more information, see _URL_2_.\r\n InsecurePlatformWarning\r\n reportlab - The ReportLab Toolkit\r\n\r\nTengo instalada la &#250;ltima versi&#243;n de `pip`:\r\n\r\n $ pip show pip\r\n ---\r\n Metadata-Version: 2.0\r\n Name: pip\r\n Version: 7.1.2\r\n Summary: The PyPA recommended tool for installing Python packages.\r\n Home-page: _URL_3_\r\n Author: The pip developers\r\n Author-email: python-virtualenv@groups._URL_0_\r\n License: MIT\r\n Location: /usr/local/lib/python2.7/dist-packages\r\n Requires: \r\n\r\nEstoy usando Python 2.7.6.\r\n\r\nEn versiones anteriores no me mostraba este mensaje. Entiendo que me est&#225; indicando que mi plataforma es insegura, &#191;c&#243;mo o qu&#233; tengo que instalar para evitar recibir esta alerta?\r\n\r\n**Actualizaci&#243;n:**\r\n\r\nYa tengo instalada la &#250;ltima versi&#243;n de PyOpenSSL:\r\n\r\n $ pip show pyOpenSSL\r\n ---\r\n Metadata-Version: 1.0\r\n Name: pyOpenSSL\r\n Version: 0.13\r\n Summary: Python wrapper module around the OpenSSL library\r\n Home-page: _URL_1_\r\n Author: Jean-Paul Calderone\r\n Author-email: <EMAIL_ADDRESS><PERSON>\r\n Author-email: exarkun@twistedmatrix.com\r\n License: APL2\r\n Location: /usr/lib/python2.7/dist-packages\r\n Requires: \r\n\r\nSi intento instalar `request[security]` me da el siguiente mensaje:\r\n\r\n $ pip install &#39;request[security]&#39;\r\n requests 2.2.1 does not provide the extra &#39;security&#39;", "435" ], [ "Yo vengo usando ya hace alg&#250;n tiempo la funci&#243;n creada por [<PERSON>_), me va muy bien, no he tenido problemas y no usa expresiones regulares:\r\n\r\n function getQueryVariable(variable) {\r\n var query = window.location.search.substring(1);\r\n var vars = query.split( \" ; & \" ;);\r\n for (var i=0; i < vars.length; i++) {\r\n var pair = vars[i].split( \" ;= \" ;);\r\n if(pair[0] == variable) {\r\n return pair[1];\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n**Ejemplo**: \r\n\r\nURL: _URL_2_\r\n\r\n < !-- begin snippet: js hide: false -- > \r\n\r\n < !-- language: lang-html -- > \r\n\r\n < div > \r\n < button type= \" ;button \" ; onclick= \" ;alert(getQueryVariable(&#39;sessionid&#39;)); \" ; > \r\n sessionid\r\n < /button > \r\n < button type= \" ;button \" ; onclick= \" ;alert(getQueryVariable(&#39;xyz&#39;)); \" ; > \r\n xyz\r\n < /button > \r\n < button type= \" ;button \" ; onclick= \" ;alert(getQueryVariable(&#39;product_id&#39;)); \" ; > \r\n product_id \r\n < /button > \r\n < /div > \r\n < script type= \" ;text/javascript \" ; > \r\n function getQueryVariable(variable) {\r\n // Estoy asumiendo que query es window.location.search.substring(1);\r\n var query = \" ;product_id=32 & cat_id=1 & sessionid=123 \" ;;\r\n var vars = query.split( \" ; & \" ;);\r\n alert(vars);\r\n for (var i=0; i < vars.length; i++) {\r\n var pair = vars[i].split( \" ;= \" ;); \r\n if (pair[0] == variable) {\r\n return pair[1];\r\n }\r\n }\r\n return false;\r\n }\r\n < /script > \r\n \r\n\r\n < !-- end snippet -- > \r\n\r\nReferencias:\r\n-----------\r\n\r\n- [Get URL Variables](_URL_1_)", "730" ], [ "This sort of FOD is often not an immediate problem, however introducing any slight knick or gouge to a propeller could be the beginning of a stress fracture. The last thing you want is a catastrophic prop failure whilst flying!\r\n\r\nThe correct course of action, much like any minor damage to the airframe, is to note it in the logs, have a mechanic look at it, and make the call if a repair is necessary.", "440" ], [ "@curious_cat I&#39;m not sure i&#39;m qualified to answer that, however I suppose it would depend a lot on the type of propeller, specifically what it is made out of. Carbon fibre can be patched, wood can have an extra layer lamenated on top, metals may be harder I don&#39;t know. This prop overhaul company has a [video of them repairing a prop](_URL_0_)", "440" ], [ "There is no any limitation, this is just syntactic feature. It is quite unusual but has some rationale behind it.\r\n\r\nE.g. in C language `int8 x[5]` reads as \" ;x is an array of 5 int8 elements \" ;. And this one `int8 y[5][4]` is \" ;y is an array of 5 arrays of 4 int8 elements each \" ;.\r\n\r\nNote that order of terms `x`, `int8`, `5`, `4` in declaration and in English explanation is not the same.\r\n\r\nIn Solidity `int8[5][4] x` reads as \" ;x is array of 4 arrays of 5 int8 elements each \" ;. You need to read backwards but order of terms is now consistent.\r\n\r\nGo language goes one step further — it has terms in order and does not require you to read backwards: `var a [5][4]int` is \" ;variable a is array of 5 arrays of 4 int elements each \" ;. \r\n\r\nSo, \" ;T[5] is always an array of 5 T&#39;s \" ; means that for any type `T` (be it `int8` or `bool[3][2]`) `T[5]` will always be array of 5 elements. This is not true for some languages like C: `T[5]` could be\r\n\r\n - array of 5 ints: `int x[5]` (T is `int x`)\r\n - array of 4 arrays of ints: `int x[4][5]` (T is `int x[4]`)\r\n - ...", "252" ], [ "The [MERRA][1] dataset has data for the world from 1979 to date. It updates frequently.\r\n\r\nYou can get the data as HDF or NETCDF. If your GIS package doesn&#39;t read those, there will be translation packages around the web to convert them into a suitable format.\r\n\r\nYou&#39;ll want the U- and V- wind data. You might want pressure too. And possibly even turbulence data.\r\n\r\nIf you&#39;re interested in using this for simulating wind generation, then I highly recommend [the paper by <PERSON> et al on analysing the MERRA data for wind energy simulation][2].\r\n\r\nYou might also be interested in the [CFSR][3] data, which runs 1979-2010: in connection with using this paper for wind energy simulation, see [this paper][4] by <PERSON> et al.\r\n\r\n([I&#39;ve previously posted this elsewhere on StackExchange][5])\r\n\r\n\r\n [1]: _URL_4_\r\n [2]: _URL_0_\r\n [3]: _URL_1_\r\n [4]: _URL_2_\r\n [5]: _URL_3_", "307" ], [ "Runaway climate change is, given our current state of knowledge, only something that could be confirmed in historic context - in the rear-view mirror. Inconveniently, there&#39;s likely to be a much-diminished version of human civilisation around to observe it, if and when it does happen.\r\n\r\nIn other words, it&#39;s too early to tell if we&#39;ve passed a catastrophic tipping point.\r\n\r\nWe don&#39;t know what the equilibrium state of the Earth&#39;s atmosphere is. It will take 30 years for our current stock of GHG emissions to fully show its effects: and we&#39;ll be continuing to release GHGs for a while, so the equilibrium will continue to change.\r\n\r\nBut it&#39;s worth bearing in mind what we can do, when we really have to; World War II saw massive realignments both in industrial production and in expectations within a very short space of time: after decades of delay, it now seems likely that decarbonisation will require at least a similarly fast and large industrial realignment; and it is possible.", "591" ], [ "We have a circumstance where we have a multi select custom field with around 200 options. We then have this field loaded into a Drupal webform (for this project we need to use Webforms). \r\n\r\nThe standard Drupal Webform field options only allow either a CTRL click multi select or radio buttons, neither of which will work with that many options.\r\n\r\nWe have also tried a module called Chosen (_URL_0_) but have failed to get this to work with the Webform. Has anyone got any experience of getting Chosen working with Webforms or an alternative approach?\r\n\r\n<PERSON>", "110" ], [ "@MTSan There is a strong \" ;direct relationship \" ; between Turkish coffee and sugar - the method of preparation calls for boiling or simmering the ground coffee and water with the sugar, and letting those all settle down together. It is possible to make Turkish or Greek coffee without sugar, but that&#39;s like drinking a cafe Cubano without sugar - possible, but not common, and the method has been optimized for it&#39;s inclusion. Anyway, because of how common sugar is with Turkish coffee, good flavor profile data is hard to come by.", "29" ], [ "Previamente he instalado el [Stand-alone SDK](_URL_2_), luego de descargarlo lo he actualizado usando:\r\n\r\n $ ./android update sdk --no-ui\r\n (Larga espera)\r\n\r\nDespu&#233;s instal&#233; [Ionic](_URL_0_), inici&#233; mi sesi&#243;n y cre&#233; una aplicaci&#243;n desde [Ionic Creator](_URL_1_):\r\n\r\n $ sudo npm install -g cordova ionic\r\n ...\r\n $ ionic login\r\n ...\r\n $ ionic start chambba creator:xxxxxxxxxxxx\r\n ...\r\n $ cd chambba/\r\n $ ionic platform add android\r\n ...\r\n\r\nPuedo usar `ionic build` sin que me cause problemas:\r\n\r\n $ ionic build android\r\n ...\r\n BUILD SUCCESSFUL\r\n \r\n Total time: 21.078 secs\r\n Built the following apk(s):\r\n /home/cesar/Development/Work/chambba/platforms/android/build/outputs/apk/android-debug.apk\r\n\r\nPero cuando intento usar `ionic emulate` para emular la aplicaci&#243;n:\r\n\r\n $ ionic emulate android\r\n Running command: /home/cesar/Development/Work/chambba/hooks/after_prepare/010_add_platform_class.js /home/cesar/Development/Work/chambba\r\n add to body class: platform-android\r\n Running command: /home/cesar/Development/Work/chambba/platforms/android/cordova/run --emulator\r\n ANDROID_HOME=/home/cesar/Development/Android/android-sdk-linux\r\n JAVA_HOME=/usr/lib/jvm/java-7-openjdk-i386\r\n \r\n /home/cesar/Development/Work/chambba/platforms/android/cordova/node_modules/q/q.js:126\r\n throw e;\r\n ^\r\n Error executing \" ;adb devices \" ;: /home/cesar/Development/Android/android-sdk-linux/platform-tools/adb: 1: /home/cesar/Development/Android/android-sdk-linux/platform-tools/adb: Syntax error: \" ;) \" ; unexpected\r\n \r\n Error: /home/cesar/Development/Work/chambba/platforms/android/cordova/run: Command failed with exit code 1\r\n\r\nSi ejecuto `adb` independientemente:\r\n\r\n $ ./adb devices\r\n bash: ./adb: cannot execute binary file: Exec format error\r\n\r\nSeg&#250;n he le&#237;do necesito un sistema de 64-bits, sin embargo me encuentro limitado en este aspecto ya que mi Laptop corre bajo el sistema Ubuntu 14.04 de 32-bits. \r\n\r\nEn estos casos lo que recomiendan es hacer uso del flag `-force-32bit` o exportando la variable al entorno `export ANDROID_EMULATOR_FORCE_32BIT=true`, entonces lo que hice fue agregarlo en mi `.profile` junto con otras rutas:\r\n\r\n $ cat ~/.profile\r\n ...\r\n export ANDROID_HOME= \" ;$HOME/Development/Android/android-sdk-linux \" ;\r\n export PATH=$PATH:$HOME/Development/Android/android-sdk-linux/platform_tools:$HOME/Development/Android/android-sdk-linux/tools\r\n export ANDROID_EMULATOR_FORCE_32BIT=true\r\n $ source ~/.profile\r\n\r\nSin embargo, el error mencionado persiste. &#191;Existe alguna forma de emular la aplicaci&#243;n en mi sistema de 32-bits?", "477" ], [ "Just got the email about this.\r\n\r\nJust so you know, page size in the user list differs depending on whether you&#39;re on the mobile or desktop site. Assuming you have the desktop site in mind, I can see that the user who just didn&#39;t make the cut, <PERSON>, has been actively posting this month - today even - whereas my last contribution was in 2011. Much as I appreciate the initiative, I&#39;d be happy to hand my spot over to someone who is actively contributing.", "755" ], [ "No, you&#39;ve misunderstood it. There&#39;s lots of information you&#39;re missing. Every data point is information, and you&#39;ve listed a tiny proportion of them.\r\n\r\nFurthermore, 4-7 km/h and 11-16 km/h aren&#39;t frequencies at all, they&#39;re wind speeds. The distance from the centre gives you the frequency.\r\n\r\nSo the spike towards N means that North winds are much much more frequent than the NNW and NNE winds. There may be some protection in those directions such that the winds that would come from there, are actually getting channelled to come from the North instead. Or there&#39;s a particular time-of-day effect, or a recording artifact, or one of a dozen other explanations that only someone with more information about the site and the data collection could assess.\r\n\r\nHowever, the fastest winds don&#39;t blow from that direction at all: they&#39;re all coming from the quadrant between S and W.", "396" ], [ "You can answer your own question re 4-7 km/h, which is the darker red line: is it as far from the centre in the Westerly direction as the Easterly? Use the concentric rings to judge. The best way to learn them is to collect your own data and then make your own wind rose. The second best way is to use someone else&#39;s data and then make your own wind rose.", "159" ], [ "A model is a simplified representation of a system.\r\n\r\nRather than try to model everything down to the microscopic level, or as vectors, we often aggregate phenomena across geographic areas, to simplify the computation a lot, and to lose only a little accuracy and precision.\r\n\r\nSo if I want to model the UK, which roughly spans 8 & deg;W - 2 & deg;E, 50 & deg;N - 60 & deg;N, that&#39;s an area of 10 & deg; x 10 & deg;. I can split that up into 400 cells, each 0.5 & deg;x0.5 & deg;. So, starting in the south-west corner, I model the area 8 & deg;W-7.5 & deg;W x 50 & deg;N-50.5 & deg;N as a single homogenous area, with no variation within it. And the same for the other 399 cells (8 & deg;W-7.5 & deg;W x 50.5 & deg;N-51 & deg;N and so on all the way through to 1.5 & deg;E-2 & deg;E x 59.5 & deg;N-60 & deg;N). That would be a 0.5 & deg; grid.\r\n\r\nNote that the gridcells do not overlap at all, and they completely cover the area of interest. (in mathematical terms, they are exclusive and exhaustive - every point of interest is in exactly one gridcell).\r\n\r\nThat can create vast amounts of data - particularly if I&#39;m doing this for the whole world, at second-by-second resolution for ten years, for a few hundred variables of interest. And no one will ever need that amount of precision from my results. So I aggregate up to a more coarse grid: so that I take 25 grid squares that form a larger square, and aggregate each of my statistics of interest in them. So now my area 8 & deg;W-7.5 & deg;W x 50 & deg;N-50.5 & deg;N is just one of 25 cells in a square in the coarser grid which spans 8 & deg;W-5.5 & deg;W x 50 & deg;N-52.5 & deg;N, and I report statistics for 16 cells in a 2.5 & deg; grid, rather than 400 cells in a 0.5 & deg; grid.\r\n\r\nExactly how that aggregation is done, will vary for each statistic:\r\n\r\n* If it&#39;s a minimum overnight temperature, then I&#39;ll take the minimum across all 25 0.5 & deg; gridcells, to give the minimum overnight temperature for the 2.5 & deg; grid cell that consists of those 25.\r\n\r\n* If it&#39;s an average rainfall, I&#39;ll take an average.\r\n\r\n* If it&#39;s insolation per unit area, and I&#39;m interested in insolation per unit land area, then I&#39;ll take a weighted average of insolation, weighting by the proportion of each 0.5 & deg; gridcell that contains land.\r\n\r\nAnd then I&#39;ll have modelled on a 0.5 & deg; grid, and archived on a 2.5 & deg; grid\r\n\r\nHere, for illustration, is Britain in a 100km grid:\r\n\r\n[![enter image description here][1]][1] < sub > [source][2] < /sub > \r\n\r\nIf I wanted to aggregate that to a 200km grid, then the four squares in the bottom-left corner, SQ, SR, SV, SW, would be combined into a single grid cell. And SS, ST, SX, SY would be combined into another grid cell. And so on.\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "603" ], [ "We have a client we would like to show the current logged in users membership status in a Drupal View alongside other contact fields. As the user may not have a membership yet at all then this can&#39;t be a CiviMember based View. \r\n\r\nInstead we wanted to use a Smart Group in CiviCRM based on the membership status. Then in a standard CiviContact based View show details about the logged in user including the status of the smart group. But it looks like smart group data isn&#39;t available to Views. I found a few old posts about this, does anyone know if this is still the case?\r\n\r\n<PERSON>", "979" ], [ "I did toyed with SISR a while ago, but my mind cleverly decided to erase that information from the brain. If I can recall though one important bit (mentioned in the paper) that I would explicit in your excellent answer is that the patterns or substructures are to be searched not only in the original image but also in multiple scales of it. That IIRC lead to significantly better results, although as I said I don&#39;t remember that much details :(", "685" ], [ "Estoy tratando de obtener <PERSON> de un `Pointer` de la forma sugerida en este [post](_URL_2_) pero siempre me retorna `undefined`.\r\n\r\nTabla `Publication`:\r\n\r\n- `userId` - > `User`\r\n- `subCategoryId` - > `Subcategory`\r\n- `title`\r\n- `description`\r\n- `budget`\r\n\r\nTabla `SubCategory`:\r\n\r\n- `categoryId` - > `Category`\r\n- `name`\r\n- `isActive`\r\n\r\nY este el c&#243;digo que estoy intentando (solo tengo un registro en la tabla):\r\n\r\n var user = Parse.User.current();\r\n var User = Parse.Object.extend( \" ;User \" ;);\r\n var userQuery = new Parse.Query(User);\r\n userQuery.equalTo( \" ;objectId \" ;, _URL_0_);\r\n\r\n var Publication = Parse.Object.extend( \" ;Publication \" ;);\r\n var publicationQuery = new Parse.Query(Publication);\r\n publicationQuery.include( \" ;subCategoryId \" ;);\r\n publicationQuery.matchesQuery( \" ;userId \" ;, userQuery); \t \r\n publicationQuery.find({\r\n \tsuccess: function(publications) {\r\n \t\tconsole.log(publications[0].get( \" ;title \" ;));\r\n // Me <PERSON> undefined\r\n \t\tconsole.log(publications[0].get( \" ;subCategoryId \" ;));\r\n \t}\r\n });\r\n\r\nLo que necesito hacer es:\r\n\r\n publications[0].get( \" ;subCategoryId \" ;).get( \" ;name \" ;);\r\n\r\nPero lo anterior obviamente me retorna:\r\n\r\n Uncaught TypeError: Cannot read property &#39;get&#39; of undefined\r\n\r\n---\r\n\r\n[Cross-post](_URL_1_) en Stack Overflow", "824" ], [ "The *Curious* badge is awarded only when two separate criteria are both met: \r\n\r\n- Asking a question that is open, not deleted and positively scored on 5 separate days\r\n- Having a positive question record, which is defined as:\r\n - (total q&#39;s - negative q&#39;s - closed q&#39;s - deleted q&#39;s)/total q&#39;s > = 0.5\r\n \r\nNote in particular that a question that has both a negative score and is closed will count as two penalties, etc.\r\n\r\nSource: _URL_0_\r\n\r\nUnfortunately, you don&#39;t currently have a positive question record. You&#39;ve asked 19 questions, 4 of which have a negative score, 6 of which have been closed, and 3 of which have been deleted. The relevant figure is thus (19 - 4 - 6 - 3)/19 = 6/19 which is less than 0.5.\r\n\r\n---\r\nIn general, if you feel you haven&#39;t been awarded a badge you should have been and 24 hours have elapsed (badges can take some time to be awarded), you should post here on meta so that we can look into the issue.", "233" ], [ "There&#39;s just not that much kinetic energy in the air within the urban canopy layer; much of what there is, is in the form of turbulence, rather than the laminar flow that turbines harness.\r\n\r\nFurthermore, air is very low density, which means that to get a decent amount of energy out of it, we need lots of effective rotor area, and even with the funnelling effect of buildings, it&#39;s not economically viable to get the rotor area required. A lot of small-to-medium sized devices within the urban canopy layer would still produce very little energy, and would cost a lot.\r\n\r\nFurthermore, although the opposition to rural turbines is very noisy, it&#39;s also (in almost all the world) a small minority.\r\n\r\n![enter image description here][1] < sub > < sub > [source][2] < /sub > < /sub > \r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "875" ], [ "Esto es muy sencillo de lograr, solo tienes que sobreescribir el m&#233;todo `__init__` de tu formulario y actualizar los atributos del campo.\r\n\r\nTe dejo un ejemplo usando tu formulario `AffiliatesForm`:\r\n\r\n class AffiliatesForm(forms.ModelForm):\r\n def __init__(self, *args, **kwargs):\r\n super(AffiliatesForm, self).__init__(*args, **kwargs)\r\n # Agregar el atributo &#39;required&#39; al campo name\r\n self.fields[&#39;name&#39;].widget.attrs = {\r\n &#39;required&#39;: True\r\n }\r\n \r\n class Meta:\r\n model = Affiliates\r\n fields = [\r\n &#39;name&#39;, \r\n # Los dem&#225;s campos\r\n &#39;...&#39;, \r\n ]\r\n\r\nDe hecho, puedes agregar los atributos que quieras, ejemplo con un formulario cualquiera:\r\n\r\n class MyForm(forms.ModelForm):\r\n def __init__(self, *args, **kwargs):\r\n super(MyForm, self).__init__(*args, **kwargs)\r\n self.fields[&#39;campo1&#39;].widget.attrs = {\r\n &#39;required&#39;: True\r\n &#39;placeholder&#39;: &#39;Ejemplo de placeholder&#39;\r\n }\r\n self.fields[&#39;campo2&#39;].widget.attrs = {\r\n &#39;required&#39;: True\r\n &#39;data-bar&#39;: &#39;Algo aqu&#237;&#39;\r\n }\r\n self.fields[&#39;campo3&#39;].widget.attrs = {\r\n &#39;disabled&#39;: True,\r\n &#39;data-foo&#39;: &#39;Algo m&#225;s por aqu&#237;&#39;\r\n }\r\n \r\n class Meta:\r\n model = MyModel\r\n fields = [\r\n &#39;campo1&#39;, \r\n &#39;campo2&#39;,\r\n &#39;campo3&#39;\r\n ]\r\n\r\nYo, por ejemplo uso Bootstrap y necesito que todos mis inputs contengan la clase `form-control`, si tengo muchos campos ser&#237;a una locura hacerlo uno por uno, pero puedes hacer algo as&#237;:\r\n\r\n class MyForm(forms.ModelForm):\r\n def __init__(self, *args, **kwargs):\r\n super(MyForm, self).__init__(*args, **kwargs)\r\n for field in self.fields:\r\n self.fields[field].widget.attrs = {\r\n &#39;class&#39;: &#39;form-control&#39;\r\n }\r\n \r\n class Meta:\r\n model = MyModel\r\n fields = [\r\n &#39;campo1&#39;, \r\n &#39;...&#39;,\r\n &#39;campo99999999&#39;\r\n ]", "223" ], [ "Experiments don&#39;t necessarily prove things, *per se*; and in particular, a single experiment tends not to prove anything - at the very least, replication of the experiment is required. Experiments provide contributory evidence. Confidence in a hypothesis can come about from a combination of theory, lab experiments and natural experiments.\r\n\r\nOur knowledge about the greenhouse effect comes about from a combination of lab experiment and natural experiment, complemented by various theories that are testable and have tested successfully.\r\n\r\nThe first experimenters and theorists worked in the nineteenth and early-to-mid twentieth century: <PERSON>, <PERSON>, <PERSON>, <PERSON>. Perhaps most notably, it&#39;s [<PERSON>] with a thermopile, measuring the absorption spectrum of various gases, that were the first to most directly address your question. More recently, advances in spectrographic analysis mean that lab experiments can identify which parts of the electromagnetic spectrum are absorbed by $\\ce{CO2}$, and by how much. Crucially, there are bands of very high absorption by $\\ce{CO2}$, at frequencies where $\\ce{H2O}$ has much lower absorption:\r\n\r\n[![enter image description here][2]][3]\r\n\r\nSo, we have lab experiments that demonstrate that CO2 with atmospheric concentrations do contribute to the greenhouse effect. These experiments go back almost two hundred years, and the more research we do, the greater corroboration we find, from both lab experiments, natural experiments, and wider theories in physics and chemistry.\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_2_\r\n [3]: _URL_0_", "591" ], [ "We are attempting a CiviCRM Member import for a client on CiviCRM 4.6.12.\r\nThe import starts to run but then fails saying no memberships were created. \r\n\r\n- Nothing is logged to the CiviCRM log file.\r\n- The .csv file detailing the import errors says for ecah line *&#39;DB Constraint Violation - possibly membership_type_id should possibly be marked as mandatory for this API. If so, please raise a bug report&#39;*\r\n\r\nThe client says there have been no reported upgrade errors and each member record in the Db has a valid membership type ID.\r\n\r\nHas anyone had a similar issue?\r\n\r\n<PERSON>", "979" ], [ "@CharlieJiang you asked specifically about experiments showing CO2 absorption - which I&#39;ve answered. Please don&#39;t ask more than one question at one time. This site works by asking one question at a time. If you want to ask whether and why CO2 has a greater contribution to the greenhouse effect than H2O does, then please post that as a separate question. But do bear in mind that you&#39;ll get the same answer as <PERSON> has posted above. If you think you can overturn 200 years of science, then go ahead and write up your work: Nobel prizes and billions of dollars await you.", "281" ], [ "Antes que nada, cabe resaltar que el campo `geo` del [API de Tweets](_URL_0_) ha sido deprecado:\r\n\r\n > Deprecated. Nullable. Use the “coordinates” field instead. [Discussion](_URL_1_)\r\n\r\nLo correcto es usar el campo [`coordinates`](_URL_0_#obj-coordinates):\r\n\r\n > The longitude and latitude of the Tweet’s location, as an collection in the form of [longitude, latitude].\r\n\r\nEjemplo:\r\n\r\n \" ;coordinates \" ;:<PHONE_NUMBER>,<PHONE_NUMBER>]\r\n\r\nTen en cuenta que no todos los tweets tienen geolocalizaci&#243;n por lo que tendr&#237;as que validar antes el campo. Te dejo un peque&#241;o ejemplo que acabo de hacer:\r\n\r\n # -*- coding: utf-8 -*-\r\n import tweepy\r\n \r\n \r\n # Tus credenciales\r\n ACCESS_TOKEN = &#39;xxxxxxxxxxxxxxxxxxxxxx&#39;\r\n ACCESS_TOKEN_SECRET = &#39;xxxxxxxxxxxxxxxxxxxxxx&#39;\r\n CONSUMER_KEY = &#39;xxxxxxxxxxxxxxxxxxxxxx&#39;\r\n CONSUMER_SECRET = &#39;xxxxxxxxxxxxxxxxxxxxxx&#39;\r\n \r\n auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)\r\n auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET)\r\n api = tweepy.API(auth)\r\n public_tweets = api.search(&#39;#python&#39;)\r\n for tweet in public_tweets:\r\n if tweet.coordinates:\r\n print tweet.coordinates\r\n print tweet.coordinates[&#39;coordinates&#39;]\r\n\r\nUna salida de ejemplo ser&#237;a:\r\n\r\n {u&#39;type&#39;: u&#39;Point&#39;, u&#39;coordinates&#39;: [106.86663792, -6.16509361]}\r\n [106.86663792, -6.16509361]", "537" ], [ "Al parecer tu funci&#243;n `normalize` est&#225; entrando en conflicto con [`String.prototype.normalize()`](_URL_0_). \r\n\r\nSimplemente c&#225;mbiale el nombre a tu funci&#243;n:\r\n\r\n < !-- begin snippet: js hide: false -- > \r\n\r\n < !-- language: lang-js -- > \r\n\r\n function myChange(boton) {\r\n boton.style.backgroundColor = \" ;green \" ;;\r\n boton.style.color = \" ;black \" ;;\r\n boton.style.border = \" ;none \" ;;\r\n }\r\n\r\n function myNormalize(boton) {\r\n boton.style.backgroundColor = \" ;blue \" ;;\r\n boton.style.color = \" ;white \" ;;\r\n boton.style.border = \" ;none \" ;;\r\n }\r\n\r\n < !-- language: lang-html -- > \r\n\r\n < button type= \" ;button \" ; id= \" ;myButton \" ; onmouseover= \" ;myChange(this) \" ; onmouseout= \" ;myNormalize(this) \" ; > Click me! < /button > \r\n\r\n < !-- end snippet -- >", "930" ], [ "I&#39;m looking at also getting either a MS Surface Pro 3 or a Macbook Air very soon, and installing elementary OS on it when I get it. My decision on which to get actually depends partly on how well the hardware of each is supported; things like the networking card, all keyboard keys, speakers, etc. Also, is the touch-screen well-supported? And how about the &#39;pen&#39; / stylus?\r\n\r\nAlso directly related; is there a place where we can see information on how well supported any given device is?", "506" ], [ "This was due to an import bug. During the import some contacts were set as deceased (value 1). The remaining contacts were then set to null by the import tool. But all the elements like Do Not Email if Deceased require a value of 0 for the deceased field. So they wouldn&#39;t show on the mailing labels as the system thought they were deceased. A simple export of all individuals (contact ID and deceased value), remove those who are deceased and re-import with a value of 0 on the deceased field solved the issue. –", "190" ], [ "Como mencion&#233; en mi comentario, podr&#237;as usar [sesiones](_URL_0_) para que el valor persista cuando lo incrementes o lo decrementes. Para esto, `bottle` recomienda hacer uso de la librer&#237;a [`beaker`](_URL_1_).\r\n\r\n## Instalaci&#243;n\r\n\r\n $ pip install bottle beaker\r\n\r\n## Ejemplo\r\n\r\nTu vista o controlador:\r\n\r\n # -*- coding: utf-8 -*-\r\n import bottle\r\n from beaker.middleware import SessionMiddleware\r\n \r\n \r\n session_opts = {\r\n &#39;session.type&#39;: &#39;file&#39;,\r\n &#39;session.cookie_expires&#39;: 300,\r\n &#39;session.data_dir&#39;: &#39;./data&#39;,\r\n &#39;session.auto&#39;: True\r\n }\r\n app = SessionMiddleware(bottle.app(), session_opts)\r\n \r\n \r\n @bottle.route(&#39;/&#39;, method=[&#39;GET&#39;, &#39;POST&#39;])\r\n def web_index():\r\n # Obtenemos el valor actual de la sesi&#243;n\r\n s = bottle.request.environ.get(&#39;beaker.session&#39;)\r\n val = s.get(&#39;val&#39;, 0)\r\n if &#39;incrementar&#39; in _URL_2_:\r\n val += 1\r\n elif &#39;decrementar&#39; in _URL_2_:\r\n val -= 1\r\n # Guardamos el valor en la sesi&#243;n\r\n s[&#39;val&#39;] = val\r\n s.save()\r\n return bottle.template(&#39;my_template.html&#39;, val=val)\r\n \r\n bottle.run(app=app, port=8080)\r\n\r\nEl template:\r\n\r\n < !DOCTYPE html > \r\n < html > \r\n < head > \r\n < /head > \r\n < body > \r\n < p > Valor actual: {{ val }} < /p > \r\n < form method= \" ;POST \" ; > \r\n < input name= \" ;incrementar \" ; type= \" ;submit \" ; value= \" ;Incrementar \" ; > \r\n < input name= \" ;decrementar \" ; type= \" ;submit \" ; value= \" ;Decrementar \" ; > \r\n < /form > \r\n < /body > \r\n < /html >", "147" ], [ "Complete, unless you want to know the height of base of those TCU&#39;s!\r\n\r\nThe bulk of the information you&#39;re after can be found in [AIS-GEN 3.5](_URL_0_) Section 10.17 - AUTO METAR coding\r\n\r\nIn describing the coding used by automated systems, it gives this example\r\n\r\n > NNNhhh/// Cloud detected, but it is unknown whether it is a convective cloud type (ie TCU or CB)\r\n\r\nAnd this one\r\n\r\n > //////TCU Towering Cumulus detected, but no information on its height or cloud cover is available\r\n\r\nWhich more-or-less covers your two questions, I hope.", "339" ], [ "He puesto la cabecera en un archivo `header` que contiene tu ejemplo:\r\n\r\n $ cat header\r\n link: < _URL_1_;; rel= \" ;monitor \" ;, < _URL_0_ > ; rel= \" ;parent \" ;\r\n\r\nUsando `--only-matching`, `--perl-regexp` y aserciones _lookbehind_ y _lookahead_ ([Advanced Grep Topics](_URL_3_)):\r\n\r\n $ cat header | grep --only-matching --perl-regexp \" ;(? < =,\\ < )(.*?)(?=\\ > ; rel=\\ \" ;parent\\ \" ;) \" ;\r\n\r\nSe obtiene:\r\n\r\n _URL_0_\r\n\r\nEn tu bash script:\r\n\r\n my_url = $(echo $complete_header | grep --only-matching --perl-regexp \" ;(? < =,\\ < )(.*?)(?=\\ > ; rel=\\ \" ;parent\\ \" ;) \" ;)\r\n\r\nCreo que para tu caso espec&#237;fico podr&#237;a funcionar muy bien.", "143" ], [ "Warning: \" ;long-term wind-speed forecasting for generation \" ; has (at least) two very different meanings. One refers to forecasting a distribution of wind speeds; the other refers to hour-by-hour (or half-hour by half-hour) forecasting of wind speeds.\r\n\r\nGenerally, when we talk about long-term forecasting of wind speeds for wind generation, we&#39;re talking about estimating the distribution of wind speeds over the next few years. That is to say, we&#39;re not talking about what the wind speed will be exactly two years from today, at 15.00 UTC. We&#39;re talking about what the shape of the distribution of the wind speeds will be - maybe in terms of the two parameters of a Weibull distribution, together with some indication of how the distribution varies by time of day, and by season of the year.\r\n\r\nThere is some skill in hour-by-hour wind speed forecasts up to about two weeks away. But for longer than that, there&#39;s very little skill in the models at all. In that regard, if we are talking about hour-by-hour wind speed forecasts, then short term is the next 0.5 - 4 hours, and long-term is 1-2 weeks.\r\n\r\nIn both cases, I&#39;d look at recent publications from Reading University - [<PERSON>] and [others][2] - and specifically on the accuracy of wind forecasts for wind generation, I&#39;d also recommend work by [<PERSON>] and [<PERSON>].\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_\r\n [3]: _URL_2_\r\n [4]: _URL_3_", "130" ], [ "En una parte del libro que estoy leyendo necesito reescribir un juego de \" ;Laberinto \" ; que usa sentencias `goto` a otro que no las use.\r\n\r\nEl laberinto es muy sencillo, solo tiene 4 habitaciones y se comienza desde la habitaci&#243;n #1:\r\n\r\n ---------\r\n | 1 | 2 |\r\n ---------\r\n | 3 | 4 |\r\n ---------\r\n\r\nEsta es la versi&#243;n original del libro usando `goto`:\r\n\r\n goto room1 -- initial room\r\n ::room1:: do\r\n local move = io.read()\r\n if move == \" ;south \" ; then goto room3\r\n elseif move == \" ;east \" ; then goto room2\r\n else\r\n print( \" ;invalid move \" ;)\r\n <PERSON> room1 -- stay in the same room\r\n end\r\n end\r\n \r\n ::room2:: do\r\n local move = io.read()\r\n if move == \" ;south \" ; then goto room4\r\n elseif move == \" ;west \" ; then goto room1\r\n else\r\n print( \" ;invalid move \" ;)\r\n goto room2\r\n end\r\n end\r\n \r\n ::room3:: do\r\n local move = io.read()\r\n if move == \" ;north \" ; then goto room1\r\n elseif move == \" ;east \" ; then goto room4\r\n else\r\n print( \" ;invalid move \" ;)\r\n <PERSON><IP_ADDRESS>room1<IP_ADDRESS> do\r\n local move = io.read()\r\n if move == \" ;south \" ; then goto room3\r\n elseif move == \" ;east \" ; then goto room2\r\n else\r\n print( \" ;invalid move \" ;)\r\n goto room1 -- stay in the same room\r\n end\r\n end\r\n \r\n <IP_ADDRESS>room2<IP_ADDRESS> do\r\n local move = io.read()\r\n if move == \" ;south \" ; then goto room4\r\n elseif move == \" ;west \" ; then goto room1\r\n else\r\n print( \" ;invalid move \" ;)\r\n goto room2\r\n end\r\n end\r\n \r\n <IP_ADDRESS>room3<IP_ADDRESS> do\r\n local move = io.read()\r\n if move == \" ;north \" ; then goto room1\r\n elseif move == \" ;east \" ; then goto room4\r\n else\r\n print( \" ;invalid move \" ;)\r\n goto room3\r\n end\r\n end\r\n \r\n <IP_ADDRESS>room4<IP_ADDRESS> do\r\n print( \" ;Congratulations, you won! \" ;)\r\n end\r\n\r\nY este es mi intento de reescribirlo:\r\n\r\n local rooms = {}\r\n rooms[1] = {\r\n south=3,\r\n east=2\r\n }\r\n rooms[2] = {\r\n south=4,\r\n west=1\r\n }\r\n rooms[3] = {\r\n north=1,\r\n east=4\r\n }\r\n currentRoom = 1\r\n repeat\r\n local move = io.read()\r\n local room = rooms[currentRoom][move]\r\n if room == nil then\r\n room = currentRoom\r\n print( \" ;Invalid move \" ;)\r\n elseif room == 4 then\r\n print( \" ;Congratulations, you won! \" ;)\r\n end\r\n currentRoom = room or currentRoom\r\n until currentRoom == 4 \r\n\r\nEn este caso me pareci&#243; m&#225;s adecuado usar `repeat` en vez de un `while` aunque en este caso espec&#237;fico creo que ambos funcionan igual.\r\n\r\n&#191;Mi soluci&#243;n es la m&#225;s &#243;ptima o podr&#237;a cambiar algo en mi c&#243;digo para mejorarlo?", "94" ], [ "Cuando usas `is()` tienes que usar el selector [`:checked`](_URL_1_):\r\n\r\n < !-- begin snippet: js hide: false -- > \r\n\r\n < p class= \" ;auto-style3 \" ; > \r\n < input name= \" ;pago1 \" ; type= \" ;radio \" ; value= \" ;Ventanilla \" ;/ > \r\n < span class= \" ;auto-style4 \" ; > \r\n Recoger en Ventanilla\r\n < /span > \r\n < /p > \r\n < p class= \" ;auto-style3 \" ; > \r\n < input checked= \" ;checked \" ; name= \" ;pago1 \" ; type= \" ;radio \" ; value= \" ;Deposito \" ;/ > \r\n < span class= \" ;auto-style4 \" ; > \r\n Deposito Bancario\r\n < /span > \r\n < /p > \r\n\r\n < !-- language: lang-js -- > \r\n\r\n $(document).ready(function() {\r\n $( \" ;#submit \" ;).on( \" ;click \" ;, function() {\r\n var condiciones = $( \" ;#aceptar \" ;).is( \" ;:checked \" ;);\r\n if (!condiciones) {\r\n alert( \" ;Debe aceptar las condiciones \" ;);\r\n event.preventDefault();\r\n }\r\n });\r\n });\r\n\r\n < !-- language: lang-html -- > \r\n\r\n < script src= \" ;_URL_2_;\r\n < form action= \" ; \" ; > \r\n < div > \r\n < p > <PERSON>: < /p > \r\n < input type= \" ;email \" ; name= \" ;<PERSON> \" ; id= \" ;<PERSON> \" ; > \r\n < /div > \r\n < div > \r\n < p > Telefono: < /p > \r\n < input type= \" ;text \" ; name= \" ;telefono \" ; id= \" ;telefono \" ; > \r\n < /div > \r\n < div > \r\n < p > Aceptar condiciones: < /p > \r\n < input type= \" ;checkbox \" ; name= \" ;aceptar \" ; id= \" ;aceptar \" ; > \r\n < /div > \r\n < button type= \" ;submit \" ; id= \" ;submit \" ; > <PERSON> < /button > \r\n < /form > \r\n\r\n < !-- end snippet -- > \r\n\r\nCuando no se han marcado las condiciones debes usar [`event.preventDefault()`](_URL_0_) para evitar que el formulario haga el `post`.", "832" ], [ "Me parece que est&#225;s haciendo demasiado trabajo extra en tus m&#233;todos, este es el c&#243;digo que he hecho funcionar:\r\n\r\n import os, sys\r\n from PyQt4.QtGui import QMessageBox, QStackedWidget\r\n from PyQt4 import QtCore, QtGui\r\n \r\n \r\n class MainWindow(QtGui.QMainWindow):\r\n def __init__(self, parent=None):\r\n super(MainWindow, self).__init__(parent)\r\n self.central_widget = QtGui.QStackedWidget()\r\n self.setCentralWidget(self.central_widget)\r\n # Login\r\n self.login_widget = LoginWidget(self)\r\n self.login_widget.button.clicked.connect(self.login)\r\n self.central_widget.addWidget(self.login_widget)\r\n # Return\r\n self.search_widget = SearchWidget(self)\r\n self.search_widget.returnButton.clicked.connect(self.returning)\r\n self.central_widget.addWidget(self.search_widget)\r\n \r\n def login(self):\r\n self.central_widget.setCurrentWidget(self.search_widget)\r\n \r\n def returning(self):\r\n self.central_widget.setCurrentWidget(self.login_widget)\r\n \r\n \r\n class LoginWidget(QtGui.QWidget):\r\n def __init__(self, parent=None):\r\n super(LoginWidget, self).__init__(parent)\r\n layout = QtGui.QHBoxLayout()\r\n self.button = QtGui.QPushButton(&#39;Login&#39;)\r\n self.label = QtGui.QLabel(&#39;You are on the menu now&#39;)\r\n layout.addWidget(self.button)\r\n layout.addWidget(self.label)\r\n self.setLayout(layout)\r\n \r\n class SearchWidget(QtGui.QWidget):\r\n def __init__(self, parent=None):\r\n super(SearchWidget, self).__init__(parent)\r\n layout = QtGui.QHBoxLayout()\r\n self.returnButton = QtGui.QPushButton(&#39;Return&#39;)\r\n self.label = QtGui.QLabel(&#39;logged in in searchwidget!!!!&#39;)\r\n layout.addWidget(self.returnButton)\r\n layout.addWidget(self.label)\r\n self.setLayout(layout)\r\n \r\n \r\n if __name__ == &#39;__main__&#39;:\r\n app = QtGui.QApplication([])\r\n window = MainWindow()\r\n window.show()\r\n app.exec_()\r\n\r\n## Notas:\r\n\r\n- Observa como he definido `self.login_widget` y `self.search_widget` en el m&#233;todo `__init__` como atributos del `MainWindow` para ser usados posteriormente en sus respectivos m&#233;todos\r\n- En los m&#233;todos `login` y `returning` solo necesitas especificar el `Widget` actual. Seg&#250;n la documentaci&#243;n para el m&#233;todo [QStackedWidget.setCurrentWidget](_URL_0_), el `Widget` ya debe de estar contenido dentro del `QStackedWidget`, y esto lo hemos hecho en el m&#233;todo `__init__`:\r\n\r\n self.central_widget.addWidget(self.login_widget)\r\n self.central_widget.addWidget(self.search_widget)", "147" ], [ "Yes, the most commonly used distribution for wind speed is the Weibull - at least when it comes to predicting wind speeds at prospective wind farm locations.\r\n\r\nYes, the parameters vary.\r\n\r\nSee, for example, the book [ \" ;Wind Energy - The Facts \" ;][1], the output of an EU research programme (ISBN 9781844077106, also freely available online).\r\n\r\nOr <PERSON> & Lambert&#39;s paper [Modern estimation of the parameters of the Weibull wind speed distribution for wind energy analysis][2]\r\n\r\nAs a starting point for estimation, it&#39;s usual to take $k=2$; this is equivalent to the Rayleigh distribution. However, the Weibull is more generalised, and often provides a better fit (i.e. $k$ isn&#39;t exactly 2).\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "1019" ], [ "Seg&#250;n la definici&#243;n del `Image`:\r\n\r\n > Image(filename, width=None, height=None)\r\n\r\nPor lo tanto, es posible que consigas lo que quieres haciendo esto:\r\n\r\n imagen = Image(url_logo, height=3*cm)\r\n\r\nIncluso si quieres ser mas curiosa, puedes instalar [`ipython`](_URL_0_) y ver como es que se crea una instancia de `Image`:\r\n\r\n $ ipython\r\n IPython 3.1.0 -- An enhanced Interactive Python.\r\n ? - > Introduction and overview of IPython&#39;s features.\r\n %quickref - > Quick reference.\r\n help - > Python&#39;s own help system.\r\n object? - > Details about &#39;object&#39;, use &#39;object??&#39; for extra details.\r\n\r\n In [1]: from reportlab.platypus import Image\r\n \r\n In [2]: Image??\r\n ...\r\n\r\nPodr&#225;s notar la definici&#243;n del m&#233;todo `__init__`:\r\n\r\n def __init__(self, filename, width=None, height=None, kind=&#39;direct&#39;,\r\n mask= \" ;auto \" ;, lazy=1, hAlign=&#39;CENTER&#39;):\r\n \r\nIncluso podr&#237;as pasarle el atributo `hAlign` al instanciar la imagen:\r\n\r\n imagen = Image(url_logo, height=3*cm, hAlign=&#39;RIGHT&#39;)\r\n\r\nSi me preguntas, yo siempre consulto la [documentaci&#243;n oficial](_URL_2_) de ReportLab y la [Gu&#237;a de Usuario](_URL_1_)", "969" ], [ "[MERMA](_URL_0_) is an aviation waypoint\r\n\r\n > Waypoints used in aviation are given five-letter names. These names are meant to be pronounceable or have a mnemonic value, so that they may easily be conveyed by voice. \r\n\r\nAccording to [this page](_URL_1_) back before the FAA decided all waypoints must have 5 character names, this waypoint - being out in the ocean - was called \" ;Mermaid \" ; and after renaming this became simply MERMA.", "339" ], [ "The pilot has 100% responsibility for how, where and when to fly/land. The movies make it seem like pilots are just mindless drones, under the control of ATC. \r\n\r\nIn actual fact ATC are there as an aid to the pilot, helping stop big metal tubes from colliding with one another.\r\n\r\nThis was borne out (to some extent) on [US Airways 1549](_URL_0_) where ATC were *advising* the pilot he could aim for his nearest airfield. His skill and experience (and of course having a front-row seat!) told him he would not make it, and he took the action to ditch on the Hudson river - saving all on board. We will never know what the outcome would have been if he had followed ATC advice, but multiple trips in a simulator have told us it might not have ended so well.\r\n\r\nFinal say is ALWAYS, 100% of the time, with the PIC.", "463" ], [ "I think you&#39;re asking about the sort of outputs that are obtained from climate-change **integrated assessment models** [IAMs] And now you&#39;ve got the right search term, your quest will get a lot easier.\r\n\r\nYou&#39;re doing the right thing: start with the IPCC reports. The next step is to follow through on reading their references. And then use google scholar or any proper academic search engine you have access to, to find more recent papers that have also cited those papers that the IPCC cited.\r\n\r\nHere&#39;s [a pdf on the PAGE09][1] IAM, an updated version of the PAGE2002 model used for the Stern Review. <PERSON> makes his PAGE model available to other researchers, on request.\r\n\r\nHere&#39;s [the UK&#39;s Committee on Climate Change report on IAMs][2]\r\n\r\nHere&#39;s the [London School of Economics&#39; page on IAMs][3].\r\n\r\nAnd the [TIAM IAM from UCL][4].\r\n\r\nGoogle Scholar claims to have [3000 results][5] from the last five years on IAMs and climate change.\r\n\r\nAs you can probably imagine, there are uncertainties piled on top of uncertainties in this field. The scholarly work on them nevertheless represents the best available set of expert expectations on the sort of damages we are likely to experience with different increases in the concentrations of greenhouse gases.\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_1_\r\n [3]: _URL_4_\r\n [4]: _URL_3_\r\n [5]: _URL_0_", "307" ], [ "In my opinion, no, this would not be an acceptable comprimise for the following reasons\r\n\r\n - Whereas you might get some traction with regular users following this guidance, expecting new or casual users to know about arbitrary rules like this is unlikely to work.\r\n - Where do you draw the line between a humorous-but-valid answer, and a plain old joke?\r\n - This is not a big enough problem to have a solution. We might get one or two joke answers a week, if they dont answer the question they should be downvoted, VtD, or whatever the agreed process is. If they do answer the question, then there is nothing to do.\r\n\r\nBasically, this is not a problem big enough for a solution.", "359" ], [ "El problema es que est&#225;s llamando al c&#243;digo HTML para tu `input` y tu `select`. Lo que deber&#237;as estar haciendo es seguir buscando por cada uno de ellos respectivamente y obtener sus valores a trav&#233;s de `val()`:\r\n\r\n\r\n < !-- begin snippet: js hide: false console: true babel: false -- > \r\n\r\n < !-- language: lang-js -- > \r\n\r\n function crearDatos() {\r\n var listaRequisitos = [];\r\n $( \" ;#t_cuerpo tr \" ;).each(function(index, elem){\r\n listaRequisitos.push({\r\n id: $(this).find(&#39;td&#39;).eq(0).html(),\r\n descri: $(this).find(&#39;td&#39;).eq(1).html(),\r\n fecha: $(this).find(&#39;td&#39;).eq(2).find(&#39;input&#39;).val(),\r\n estado: $(this).find(&#39;td&#39;).eq(3).find(&#39;select&#39;).val()\r\n });\r\n });\r\n console.log(listaRequisitos);\r\n }\r\n\r\n\r\n < !-- language: lang-html -- > \r\n\r\n < script src= \" ;_URL_0_;\r\n\r\n < table class= \" ;table table-bordered \" ; id= \" ;tabla \" ; > \r\n < thead > \r\n < th > # < /th > \r\n < th > <PERSON> < /th > \r\n < th > <PERSON> <PERSON> < /th > \r\n < th > <PERSON> < /th > \r\n < th > Observacion < /th > \r\n < /thead > \r\n < tbody id= \" ;t_cuerpo \" ; > \r\n < tr > \r\n < td > 1 < /td > \r\n < td > Ceremonia de bienvenida < /td > \r\n < td > < input type= \" ;text \" ; id= \" ;fecha \" ; class= \" ;form-control \" ; > < /td > \r\n < td > < select name= \" ; \" ; id= \" ;estado \" ; class= \" ;form-control \" ; > \r\n < option value= \" ;si \" ; > si < /option > \r\n < option value= \" ;no \" ; > no < /option > \r\n < /select > < /td > \r\n < td > < textarea name= \" ; \" ; id= \" ;obs \" ; cols= \" ;20 \" ; rows= \" ;2 \" ; class= \" ;form-control \" ; > < /textarea > < /td > \r\n < /tr > \r\n < tr > \r\n < td > 2 < /td > \r\n < td > Sermon nocturno < /td > \r\n < td > < input type= \" ;text \" ; id= \" ;fecha \" ; class= \" ;form-control \" ; > < /td > \r\n < td > < select name= \" ; \" ; id= \" ;<PERSON> \" ; class= \" ;form-control \" ; > \r\n < option value= \" ;si \" ; > si < /option > \r\n < option value= \" ;no \" ; > no < /option > \r\n < /select > < /td > \r\n < td > < textarea name= \" ; \" ; id= \" ;obs \" ; cols= \" ;20 \" ; rows= \" ;2 \" ; class= \" ;form-control \" ; > < /textarea > < /td > \r\n < /tr > \r\n < /tbody > \r\n < /table > \r\n < button type= \" ;button \" ; id= \" ;obtener \" ; onclick= \" ;crearDatos(); \" ; > Obtener < /button > \r\n\r\n < !-- end snippet -- >", "645" ], [ "I&#39;ve had this happen a few times on aging C152&#39;s and in all cases I have been able to simply push it against the airflow enough to pull it closed. On a PA28 with the door the other side of the cabin from the pilot seat, this wouldnt be possible. Not that I have experienced it in a PA28, but I might ask a passenger to attempt the same (hard push followed by a hard pull).\r\n\r\nSome things to note:\r\n\r\n 1. There&#39;s no massive danger of a door slightly ajar, so waiting until out of a critical phase of flight is advisable (ie, climbed to cruise, clear of any ATZ)\r\n 2. In all but one time I had another competent pilot sitting next to me who can keep an eye out and even hold the controls for a few seconds. Just one reason flying with other pilots is nicer than flying alone.\r\n \r\nHowever, I would suggest that every situation is different. The most important thing is, as always, Aviate first. A light aircraft is unlikely to be critically unable to continue flying with a door ajar. Don&#39;t get distracted by something like an ajar door - fly the aircraft.\r\n\r\nIf in any doubt, land as soon as possible and fix the problem. It would, I think, be acceptable to call \" ;Pan Pan \" ; if you feel you need to expedite a landing.", "463" ], [ "We can use the [truncate](ftp://_URL_0_) package to truncate a piece of text so that it fits e.g. in a 5cm wide box.\r\n\r\nHowever, the package can only handle one line of text.\r\n\r\nWhat if I have got a (possibly long) text that I would like to typeset in a 5cm wide minipage, **ragged right**, so that it uses at most 6 lines?\r\n\r\nBasically, I would just like to ask LaTeX to typeset a piece of text so that we add line breaks as usual at most 5 times, and then the last line is truncated (with some kind of a truncation marker such as \" ;… \" ;) if needed.\r\n\r\nI can see that this would be very hard to implement with properly justified text, but for ragged right text this might be doable?\r\n\r\n---\r\n\r\n**Edit:** To clarify, I would like to produce an output that looks like this if the text is truncated:\r\n\r\n Lorem ipsum dolor sit amet,\r\n consectetur adipiscing\r\n elit, sed do eiusmod tempor\r\n incididunt ut labore et\r\n dolore magna aliqua. Ut\r\n enim ad minim veniam, ...\r\n\r\n(The truncation marker would be part of the last line, not a separate line.)", "63" ], [ "As you can see on [google maps](_URL_2_) Gatwick&#39;s runways are aligned (like many in the UK due to our prevailing winds) roughly east-west. In actual fact the runways are numbered 08 & 26 relating to 080 and 260 degrees respectively. \r\n\r\nA wind coming from the SSW, for arguments sake, blow at roughly 200 degrees. Aircraft take off into wind, so you will invariably depart from runway 26. There is therefore a 60 degree difference between take off and wind direction (not exactly, but for illustration sake.)\r\n\r\n18 m/s in roughly 35 knots, and if the whole of that wind speed was at exactly 90 degrees to the runway it might be close to the maximum, but it&#39;s not, only 60/90 of it is the \" ;crosswind \" ; component. When you calculate the numbers you would have roughly\r\n\r\n- 30 knots crosswind\r\n- 17 knots headwind.\r\n\r\nWhich is not close to the maximum.\r\n\r\n[Bergen airport](_URL_0_) is roughly north-south, but I imagine the weather there will be considerably different and I&#39;ll forgo the same illustration as above - suffice it to say the Pilot will not fly outside of his own and his aircraft&#39;s abilities. They always have the ability to divert, to wait out bad weather, or to turn back. \r\n\r\nRelax, flying is statistically the [safest way to travel](_URL_1_).", "850" ], [ "I have an item with version in `en` only. I have set the `en-GB` language to fallback to `en`, and it works great. With Sitecore&#39;s [language fallback][1] functionality, I do not have to have a version in the `en-GB` language, unless I decide to create one and localize some content.\r\n\r\nThe same is true for Datasource content items. I have them set to fallback and I only need to create localized versions if I am translating their content.\r\n\r\nThat said, this makes it very difficult for me to determine if a given page item/request/URL is falling back or not. Simply checking for the presence of the context item&#39;s language versions will not always work, as most, if not all, of the page&#39;s content is data-sourced. \r\n\r\nKnowing this information would be useful for several scenarios:\r\n\r\n 1. Determining whether or not to output [hreflang&#39;s][2]. For example, I would not want to generate hreflangs for a page that is falling back 100% and contains zero translations.\r\n 2. Determining how to include the page in a sitemap. \r\n 3. Determining whether or not to offer visitors a given language as a selection in a language switcher.\r\n 4. Possibly something in reverse, such as alerting content authors that Datasource item is missing a translated version.\r\n\r\nThis begs the question: **Is there a generally accepted way of determining whether a given page item/request/url is being translated?**\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "270" ], [ "In an emergency, such as an engine failure, the answer to \" ;can I do X \" ; is almost always a resounding \" ;YES \" ;. \r\n\r\nYou can do anything within your power to protect the safety of those on board. That is your job as pilot in command. If you think it is safer to ask a controller to manoeuvre big jets out your way so you can touch down on an otherwise busy Airport, then you do it. If you see a farmer&#39;s strip that you can land on, you do it. You do whatever is necessary to safely bring that aircraft down. \r\n\r\nAviate. Then navigate. Then communicate.", "463" ], [ "@CarstenGehling * \" ;Is there any place where I can download an updated list like this one as a CSV file (or XML)? \" ;* is a resource request. What I linked to includes what is off topic, and includes resource location with the specific example * \" ; Where can I get a feed of flight-related data? \" ;*. Again, please stick around, it&#39;s good to have new users, but this particular question is specifically off topic.", "307" ], [ "Thanks for the very detailed question!\r\n\r\nBased on your description for how you created the Edit Frame Buttons and how you are referencing them, I suspect that the path the buttons is incorrect. Specifically, you said that you created the buttons at `/sitecore/content/Applications/WebEdit/Edit Frame Buttons/RelatedEvents/`, yet, your parameter reads `Related Events` in your View screenshot.\r\n\r\nThe `@Html.EditFrame()` extension method takes a \" ;Buttons \" ; parameter that is used to attempt to match a *folder name* under `/sitecore/content/Applications/WebEdit/Edit Frame Buttons` which should contain one or more Edit Frame buttons underneath it.\r\n\r\nSee also:\r\n\r\n_URL_0_\r\n\r\nSteps #2 and #7 under the Edit Frames Buttons section of this blog post: _URL_1_", "343" ], [ "I am working on a feature that should behave differently based on whether or not Sitecore believes that the current Contact is legitimate or a malicious bot.\r\n\r\nI am using `ContactClassification.IsRobot(Tracker.Current.Contact.System.Classification)` to determine whether the current contact has been flagged as a robot. It&#39;s been pretty easy for me to persist this Boolean value on a view model, surface it in my view, and change the behavior on the front end as a result.\r\n\r\nThe main issue I am facing is testing my feature. I would be easy for me to inject a superficial True/False value for testing purposes, however, I&#39;m more interested in testing the feature as a true bot would see it. This begs the question: Is there a known way to have a visit flagged as a robot for testing purposes?\r\n\r\nMy goal is not to have to develop an actual malicious bot just to test my feature.", "241" ], [ "The \" ;Existing Page \" ; EXM template uses the target page&#39;s browser title (i.e.` < html > < head > < title > ...`) to determine the email&#39;s subject. Is it possible that you aren&#39;t outputting a title for this page? \r\n\r\nIn any case, I don&#39;t believe that the `Set Page Title` rendering is intended to be placed on to items in your content tree. [Sitecore documentation][1] has you place it on the message root&#39;s presentation details (ex: `/sitecore/templates/Branches/System/Email Campaign/Messages/Custom newsletter/Monthly newsletter/Name/Message root`).\r\n\r\nThe `Set Page Title` rendering is an Xsl Rendering that points to `/xsl/EmailCampaign/Set Page Title.xslt` in your webroot. This file simply renders the \" ;Subject \" ; field off the email message item.\r\n\r\n [1]: _URL_0_", "856" ], [ "I found another approach whereby I forego adding the `VisitorIdentification()` method call in my main layout when I want to pretend I am a robot. Sitecore automatically flags all traffic with a visitor identification level of 925 (IsAutoDetectedRobot) until they can prove they are human. By excluding this method call, that never happens:\r\n < !-- language: c# -- > \r\n\r\n @if (string.IsNullOrEmpty(Request.QueryString[ \" ;sc_robot \" ;]))\r\n {\r\n @Html.Sitecore().VisitorIdentification()\r\n }", "786" ] ]
234
[ 17252, 3698, 18402, 14098, 9961, 350, 19414, 97, 12222, 4226, 2890, 16834, 1771, 5122, 15224, 4272, 15767, 3928, 7283, 3240, 2404, 10470, 12751, 17945, 17346, 3325, 15438, 12856, 12463, 16691, 711, 16031, 18039, 10361, 3712, 1913, 18915, 16941, 3953, 2816, 6545, 15519, 17050, 5867, 2458, 3603, 822, 11229, 16159, 7996, 4068, 14628, 14219, 16261, 2166, 10074, 17111, 7655, 17670, 6315, 10966, 12715, 536, 10046, 13809, 7679, 5893, 6940, 972, 12307, 10879, 6275, 2, 18040, 8326, 6941, 17948, 8991, 2573, 18001, 3282, 13204, 7446, 14345, 11852, 1765, 2675, 17493, 16892, 1519, 11465, 2083, 18224, 8226, 18748, 13623, 9323, 5752, 16407, 2719, 3096, 17490, 780, 2121, 4204, 1670, 3335, 6114, 18914, 5874, 18360, 17356, 1393, 2001, 7097, 10464, 8024, 15355, 19251, 13734, 5114, 46, 8559, 2632, 1892, 967, 3350, 13523, 13183, 15867, 17936, 17941, 10965, 4694, 6617, 16504, 4273, 18325, 6158, 476, 9450, 17223, 1964, 13689, 602, 3004, 6040, 19420, 11573, 9096, 16900, 9023, 18167, 6580, 6422, 2227, 4348, 18090, 6774, 17766, 5546, 4544, 18274, 17913, 16171, 5883, 14919, 1772, 5520, 1919, 1410, 1581, 575, 4296, 1641, 17395, 2123, 15675, 15226, 6789, 6452, 16518, 17453, 7810, 10959, 5162, 19686, 7035, 15452, 9040, 14584, 2542, 7842, 1321, 5480, 14114, 3127, 7143, 12432, 1027, 9403, 10468, 3284, 16647, 9287, 16489, 18429, 18586, 14197, 3514, 12234, 8485, 1709, 1908, 8558, 6429, 15731, 5320, 7350, 5406, 17029, 16773, 9529, 507, 11228, 18998, 12447, 2498, 9912, 10068, 6396, 11749, 17155, 2430, 5545, 18279, 5894, 4212, 9866, 4970, 3821, 6234, 7882, 8877, 14027, 6258, 1933, 4469, 17697, 17707, 9774, 5581, 14071, 3504, 9379, 2006, 7804, 5389, 10925, 4313, 1790, 9600, 710, 6659, 8676, 1264, 19306, 1082, 8567, 3129, 17030, 554, 1396, 1145, 1100, 5490, 10124, 7256, 2198, 13093, 7636, 10094, 2561, 15181, 5735, 18259, 12396, 18557, 15768, 16617, 4701, 8056, 15043, 14892, 4657, 6552, 785, 461, 8737, 3968, 10999, 18163, 4578, 19493, 4546, 18848, 14530, 17479, 1402, 3426, 8613, 425, 2845, 18248, 2697, 8958, 13008, 3984, 5322, 3971, 10328, 13062, 4548, 14939, 14960, 16362, 13871, 8704, 6864, 10149, 910, 18431, 978, 3067, 6706, 1802, 18391, 10747, 6866, 5357, 12822, 1175, 2063, 4036, 18376, 16152, 12701, 4891, 850, 10497, 3222, 7033, 10420, 1785, 3593, 3749, 13414, 19253, 14273, 7385, 13181, 4586, 19707, 10715, 6999, 17953, 2616, 16435, 13422, 18216, 18138, 18474, 9817, 19372, 13379, 5519, 18445, 12710, 11537, 18353, 5483, 689, 1648, 8784, 3267, 9675, 14559, 4730, 9345, 17822, 10373, 15642, 5379, 7348, 18778, 13456, 11550, 15334, 18347, 5526, 18197, 16115, 12268, 19353, 13344, 11685, 10673, 19177, 6991, 2583, 14318, 501, 982, 9997, 17554, 17516, 5966, 14543, 4674, 19621, 7115, 14571, 2802, 14028, 8754, 16878, 6584, 7618, 18526, 3468, 2889, 10588, 3954, 13655, 3371, 2035, 1876, 2506, 19030, 19753, 4216, 3915, 6635, 471, 13038, 5677, 17323, 10589, 14912, 14835, 538, 11967, 19054, 18135, 17046, 1040, 17391, 9622, 11786, 16963, 7945, 17831, 1801, 9984, 6514, 11193, 14574, 6913, 12406, 11324, 907, 3929, 16011, 1171, 16373, 4709, 4962, 16639, 14088, 4815, 7331, 9574, 18378, 16987, 1258, 5889, 3299, 9048, 18786, 16299, 10800, 13390, 2603, 791, 15964, 5263, 4478, 7894, 16475 ]
STX_1000.0
[ [ "I have some initialization code that I would like to run on any newly started kernel, and, following [this question](_URL_1_), my code starts with a call to `Parallelize;` on its own, which as I understand it functions to trigger the loading of the Parallel package components.\r\n\r\nThis was working just fine yesterday, but as of today it returns an error message:\r\n\r\n Image<IP_ADDRESS>imgarray: The specified argument {{{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, < < 100 > > },{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, < < 100 > > }, < < 47 > > ,{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\r\n 255,255,0,0,0,0,0,0,0, < < 100 > > }, < < 43 > > },{ < < 1 > > }} \r\n should be an array of rank 2 or 3 with machine-sized numbers. > > \r\n\r\n > ![](_URL_0_)\r\n\r\nI imagine this is not a big deal, but I&#39;m still a bit worried about it and if it&#39;s fixable I would like to do that. I know that the code in the answer I referenced is undocumented and therefore caveat-worthy, but this behaviour also appears with things as innocuous as\r\n\r\n ParallelTable[\r\n n\r\n , {n, 1, 20}]\r\n\r\nand that definitely shouldn&#39;t be happening, right?\r\n\r\nIn case it&#39;s necessary, I&#39;m running v10.0.2.0 for Linux x86 (64-bit) (December 4, 2014). I had hoped this would go away after a system restart but it persists.", "921" ], [ "From time to time, and in several different computers running various versions of Ubuntu, I&#39;ve had Mathematica tooltips get \" ;stuck \" ;, and persist on the screen even when I navigate away to other windows, which can be [very disruptive](_URL_0_):\r\n\r\n > ![](_URL_1_)\r\n\r\nThe tooltip appears in front of all other windows, except new tooltips, and it interrupts things like middle-wheel scroll. This normally goes away if I quit and restart the front-end, but of course that can be pretty inconvenient.\r\n\r\nIs this behaviour known? Is there a simple way to kill the Front End&#39;s tooltips without killing the session?", "12" ], [ "I&#39;ve been using computed fields forever when I need to build a custom type of functionality that doesn&#39;t exist as a physical field in Sitecore when using ContentSearch, but I was just reading about Virtual Fields in the index and I&#39;m not really sure where the use case is for using one other another.\r\n\r\nHow are they different? How are they the same? Is there a performance benefit over one vs. the other?", "330" ], [ "I&#39;m looking for a simple algorithm to compare astronomical images (of the same sky region) against each other, compute their movement and rotation, to finally stack them.\r\n\r\nAt the moment I&#39;m already having a more or less working algorithm. First I extract all the stars out of an image (including information like brightness and FWHM), and then I walk through all the resulting \" ;points \" ; and create triangles out of the current point and those two other stars that have the shortest distance to this star.\r\n\r\nThis list of triangles is created for every image. After this I take one image as a reference and then I walk through the list of triangles in the reference image to find a triangle in the other image with the same length of each side of the triangle (I also \" ;allow \" ; some tolerance due minimal relative differences of the star positions in each image). For this matches I calculate movement and rotation relative to the reference image. The last step is to find the matched triangles that have to same relative movement and rotation like the other matches. This is done by calculating the standard deviation, sorting out triangles that are not within 1 or 2 sigma and repeat this process until I have a very small standard deviation.\r\n\r\nThe last part, finding \" ;valid \" ; triangles with the same movement/rotation, is working fine. The problem is that sometimes I have only like 2 or 3 \" ;valid \" ; triangles out of 300 initial triangles. All other triangles have side lengths different to those of the reference image. \r\n\r\nSo I assume it&#39;s the way I generate my initial triangles which causes the problem. Sortings stars by their brightness and using this data to generate the triangles also doesn&#39;t work. So is there a better way to create the initial triangles in all the images?", "102" ], [ "We&#39;ve built a register form inside WFFM with a custom save action. The custom save action tries to create a new user with an exterior service. However sometimes the e-mail they use to register, already exists in the exterior service.\r\n\r\nWhen a user registers with an account that&#39;s already in use, we would like to display a message at the top where the usual error message that says: \" ;There was a problem while trying to register your account \" ;.\r\n\r\nIs this possible?", "855" ], [ "Yes they overlap significantly. I could also say it&#39;s exact the same region with normally less than 10 pixels movement. You can also compare different recording sessions where you have a bit more movement and also some rotation - but the major part of the area is visible in each image. By stacking the images I want to minimize the background noise (high SNR) and also get a higher value of color bits per channel.", "601" ], [ "What Sitecore Climber mentioned for Static Renderings in a layout is correct. However I think you also asked how you would vary the cache by a page (or section). VaryBySection doesn&#39;t exist, neither does VaryByUrl. But you can add custom Vary By logic pretty easily. On my blog: _URL_0_ I talk about how you can do this.\r\n\r\nSo to achieve a Vary By Url, you would need to extend the GenerateCacheKey pipeline in RenderRendering processor group, using code like this:\r\n\r\n\r\n using Sitecore;\r\n using Sitecore.Data.Items;\r\n using Sitecore.Mvc.Pipelines.Response.RenderRendering;\r\n using Sitecore.Mvc.Presentation;\r\n using Sitecore.Web;\r\n using System;\r\n using System.Collections.Generic;\r\n using System.Linq;\r\n using System.Text;\r\n using System.Threading.Tasks;\r\n\r\n namespace Site.Infrastructure.Pipelines.Renderings\r\n {\r\n public class GenerateCacheKey : \r\n Sitecore.Mvc.Pipelines.Response.RenderRendering.GenerateCacheKey\r\n {\r\n private const string VARYBYURL = \" ;VaryByUrl \" ;;\r\n\r\n protected override string GenerateKey(Rendering rendering, RenderRenderingArgs args)\r\n {\r\n string cacheKey = base.GenerateKey(rendering, args);\r\n Item renderingItem = rendering.RenderingItem.InnerItem;\r\n\r\n if (!string.IsNullOrEmpty(renderingItem[VARYBYURL]))\r\n {\r\n cacheKey += \" ;_#url: \" ; + Sitecore.Context.RawUrl;\r\n }\r\n\r\n return cacheKey;\r\n }\r\n }\r\n }\r\n\r\nAnd you would patch it by using the following code:\r\n\r\n < ?xml version= \" ;1.0 \" ;? > \r\n < configuration xmlns:patch= \" ;_URL_1_;\r\n < sitecore > \r\n < pipelines > \r\n < mvc.renderRendering > \r\n < processor patch:instead= \" ;processor[@type=&#39;Sitecore.Mvc.Pipelines.Response.RenderRendering.GenerateCacheKey, Sitecore.Mvc&#39;] \" ;\r\n type= \" ;Site.Infrastructure.Pipelines.Renderings.GenerateCacheKey, Site.Infrastructure \" ; / > \r\n < /mvc.renderRendering > \r\n < /pipelines > \r\n < /sitecore > \r\n < /configuration > \r\n\r\nYou would need to extend /sitecore/templates/System/Layout/Sections/Caching to include the checkbox option to \" ;VaryByUrl \" ; for the rendering that you&#39;ve defined.", "340" ], [ "As the other suggested answers suggest is correct. When you are creating a new user programmatically, you can get the Full name by using the following code:\r\n\r\n`string domainUser = Sitecore.Context.Domain.GetFullName( \" ;<EMAIL_ADDRESS> \" ;);`\r\n\r\nThis will give you the full user which would include the current context domain. This is what you should pass to your Create User method:\r\n\r\n`System.Web.Security.Membership.CreateUser(domainUser, \" ;password \" ;, \" ;<EMAIL_ADDRESS> \" ;);`\r\n\r\nYou can define which domain applies to the current context site, by setting the attribute in the SiteDefinition.", "103" ], [ "Another option you could do, is handle the experience editor interface differently than the rest of the page. You can get knowledge from the page by using the page mode detection methods, which can be done from within Javascript:\r\n\r\n var isPageEditor = function(){\r\n return !!(Sitecore & & Sitecore.PageModes & & Sitecore.PageModes.PageEditor);\r\n };\r\n\r\n if(isPageEditor()) {\r\n // Logic for when in the experience editor\r\n }\r\n\r\nOr you can determine the page mode via c# razor syntax like this:\r\n\r\n @if (Sitecore.Context.PageMode.IsExperienceEditor) \r\n {\r\n // Load a unique interface that contains all items \r\n // (not paginated using ajax so you can use experience editor to make changes)\r\n } else {\r\n // Load existing logic (for when not in experience editor\r\n }\r\n\r\nNow there is a slight issue with loading everything all at once, if you have a lot of data (since that&#39;s the reason you are paginating the data in the first place). You could build some sort of custom speak interface to manipulate the large data set of information. Also in this situation is when I would think it would make more sense to edit the data in the content editor, if the user might be editing 1 item on page 100 out of 1000 pages of data. Even if you could get the data to paginate and be editable via the experience editor with the use of ajax, there would be usability concerns with this scenario.", "843" ], [ "So I am architecting a solution that uses Glass in a Helix implementation. We would like to automatically generate the Glass models using a T4 template, but one of the challenges we are running into is that we have a feature that relies on base item types and it&#39;s recreating the model for those base types multiple times.\r\n\r\nSo an example from the habitat project, is that you have the \" ;Feature \" ; Metadata, which contains a base template _PageMetadata. We would then have either other Feature or Project templates that define _PageMetadata as a base template. When the T4 generator runs, it generates models for the pages that we created in the \" ;Feature \" ; or \" ;Project \" ;, but also it recreates the _PageMetadata model, even though it would also get generated in the Sitecore.Feature.MetaData project.\r\n\r\nHas anyone come across this challenge with Helix and the use of auto-generated glass models?", "213" ], [ "Well there&#39;s almost two questions there. One is how to get a friendly Url from a General Link Field. This will first require you to determine if it&#39;s an internal link and therefore there is an ID for the item they link to, or if it&#39;s external, that should already have a friendly url.\r\n\r\nKeep in mind the General Link field stores everything in Xml, so you&#39;ll need to parse this xml to determine the link type.\r\n\r\nIf it&#39;s an internal Url and therefore ID, you can get the Item by it&#39;s ID and then pass it into the Link Manager to get it&#39;s friendly url based on Link Manager settings for your site.\r\n\r\n ID itemId = new ID( \" ;{EB18D6BC-4264-42B0-9480-21C10BA13706} \" ;);\r\n Sitecore.Links.UrlOptions urlOptions = Sitecore.Links.UrlOptions.DefaultOptions;\r\n string friendlyUrl = string.Empty;\r\n\r\n if (itemId != null)\r\n {\r\n Item urlItem = Sitecore.Context.Database.GetItem(itemId);\r\n\r\n if (urlItem != null) \r\n {\r\n friendlyUrl = Sitecore.Links.LinkManager.GetItemUrl(urlItem, urlOptions);\r\n }\r\n }\r\n\r\nSo you would want to get the id from the xml, whereas I just show how to get the Url using the LinkManager once you have an id above.\r\n\r\nIf you wanted to build that into a class that represents the Rendering Parameter Template, that&#39;s fairly straight forward as well, just create a Property on your class called `Url` or something like that, and inside that Property declaration you can perform the logic I mention above.", "706" ], [ "I like to fry up chicken occasionally and I&#39;ve used a few different methods over the years. Typically my recipe is something like:\r\n\r\n - Place milk or egg in one dish\r\n - Place a flour mixture in another\r\n - Drag chicken through liquid, then through flour, then fry up.\r\n\r\nIt usually turns out pretty well, but I was hoping to get some clarification on what some variations on this recipe do - so:\r\n\r\nSome recipes call for dipping the chicken in egg before coating with flour while others call for milk (or butter milk). \r\n\r\n 1. What is the difference between these two? \r\n 2. Can I mix the two together and use that - if so, how would it be different than using just one?\r\n 3. Does it matter if I soak in the liquid for hours or do i just need to get it wet so the flour will stick?\r\n\r\nI&#39;ve seen some recipes that call for dipping in egg and flour twice. I&#39;m assuming this just makes the skin crustier? \r\n\r\n 4. If I want an even thicker crust could I go even more than twice or will the batter just start falling off while frying if there is too much on there?\r\n\r\nIt can be sort of a time consuming process and I&#39;ve wondered about doing some of the prep work the night before I cook. \r\n\r\n 5. Is it possible to egg wash and dredge in flour and then store overnight?\r\n 6. If so, does this affect how the chicken fries up? \r\n 7. If so, what is the proper technique? I&#39;m concerned that if I had a bunch of battered chicken breasts that were stacked on top of each other the batter might peel off when I tried to separate them the next day.\r\n\r\nI realize that I could probably figure this out through trial and error, but was hoping to figure it out without wasting any food. Thanks for any help!", "928" ], [ "So it sounds like you are trying to get access to a datasource (Article) item as well as the current context item (WebPage). To do that, you would need to use a controller rendering. And within that controller rendering, you would want to have code that looks something like this:\r\n\r\n public ActionResult Display()\r\n {\r\n var model = new ArticleViewModel();\r\n \r\n model.Article = GetDataSourceItem < Article > ();\r\n model.CurrentPage = GetContextItem < WebPage > ();\r\n \r\n return View(model);\r\n }\r\n\r\nMake sure that your Controller inherits from GlassController.\r\n\r\nObviously with that you will need to create a new View Model that has two properties. And then in your view you would have something like this:\r\n\r\n @model ArticleViewModel\r\n \r\n @* Pull Article Datasource Data *@\r\n @Html.Glass().Editable(Model.Article, x = > x.Tittle)\r\n \r\n @* Pull WebPage Data *@\r\n @Html.Glass().Editable(Model.CurrentPage, x = > x.Description)", "343" ], [ "@Felix I find SciDraw to impose a prohibitively high overhead compared to its returns. Arranging things inside Mathematica is an option, but `GraphicsGrid` is notoriously bad at managing spacings between its constituents, and `Grid` does not return a `Graphics` object, which can mess up the export step (particularly if e.g. some plots later need to be exported to png or eps to meet journal requirements). Either way, I think that the specific plot-range-size control I&#39;m asking for is worthwhile on its own.", "616" ], [ "The one problem I can think of with using MemoryCache vs. the Html Caching is that, what happens if it&#39;s cached in memory and you publish new items. They won&#39;t display until the cached items expire. Now you can probably get around this by customizing the on publish event to clear your custom memory cache, or just use the Sitecore caching engine instead, which should clear on publish. I generally stick with Html Caching when I can because it doesn&#39;t require a ton of customization.", "422" ], [ "You can publish a single project by right clicking on the project and selecting the `Publish` option in Visual Studio. Or if you have Click Once publishing toolbar open, you can select the project and publish by clicking the `Publish Web` button.\r\n\r\nTypically I will use this process when I am working on a single project, vs waiting for all the projects to complete publishing.", "363" ], [ "Here are couple of examples which don&#39;t employ objects resembling real-life stack:\r\n\r\n- Russian doll (matryoshka). It is a stack if you use the relationship `contained_in(BiggerDoll, SmallerDoll)` as a model for stack. `push` in this context would be equivalent to encasing a stack of Russian dolls in a yet bigger Russian doll, `pop` would be equivalent to opening the outermost doll and extracting the remaining dolls.\r\n- Literary figure \" ;story within a story \" ; (or \" ;dream within a dream \" ;), although the analogy is a little imprecise since any \" ;inner \" ; story can be observed from an \" ;outer \" ; story. The examples of such stories are plentiful, but since this should appeal to high-school students, I think, the movie Inception (the one starring <PERSON>) could be used. In this movie, the `push` is when the characters enter a dream, and `pop` is when they wake up from the dream. Characters must wake up from their dreams in the exact reverse order from the one in which they entered them.\r\n- Palindrome. I.e. the way to recognize one by `push`ing half of it on a stack and then `pop`ing the other half.", "867" ], [ "# Save the trees\r\n\r\nRequiring the exam be completed with pen and paper is a ridiculous anachronism.\r\n\r\n----\r\n\r\n* If you are teaching something practical, like, say, Java 101, there is absolutely no point in asking a student to write Java code on paper. Nobody, not a single person, needs this. Why not use clay tablets if you are going for hard labor?\r\n\r\n* If you teach something like automata theory, then use a language capable of embedding proofs of what you teach, and require that students complete their tests by submitting proofs in that language. There is not a single reason why computer scientist wouldn&#39;t know how to use the most widely available form of computer as a tool in her work. And if proofs aren&#39;t possible or are too difficult, then use code that illustrates the solution. Anything other than that is \" ;hot air \" ;; feels unjust and discriminating due to the randomness of the opinion of the person responsible for verifying such test.\r\n\r\n----\r\n\r\n### Some background info \r\n\r\nI&#39;ve studied CS and was briefly a TA. I had to submit exercises in Java written in pen on paper. I also saw the exercises submitted by other students. None had even a correct number of opening and closing brackets, let alone other typos.\r\n\r\nMy other background is in printing and typography. Having worked for a while in a publishing house, I assure you that the number of mistakes in mathematical and programming-related books is astronomical when compared to regular prose. It is not humanly possible to verify handwritten formulas in reasonable time. Every single textbook I had on subjects like math and CS had dozens of mistakes that I was able to discover, and the denser the material, the more mistakes there were.\r\n\r\nThere are prominent mathematicians like <PERSON> who try to change this situation by developing better foundations for automating proofs. I believe that this is the way to go.", "795" ], [ "@BenI. Now you resemble my wife when she claims all sorts of bad things about computer games. :) Are ruler and compass social or antisocial? Why would you even bring the subject of being social into this discussion? It is completely orthogonal to the quality of the tool. Do ruler and compass make a good \" ;cognitive match \" ; with our brain? Modern science knows squat about brain, and that would be an exaggeration. How can anyone make claims about what matches it and what doesn&#39;t, keeping a straight face, escapes me.", "276" ], [ "When specifying fields for the `Field Editor Button` type button, make sure the Fields you specify are using the **Item Name** instead of the Display Name.\r\n\r\nAdditionally, you must make sure that field that you are specifying in the `Fields` field, maps directly to the same field in the data that&#39;s being displayed by your rendering.\r\n\r\nI covered this and other topics related to creating `Field Editor Buttons` in Sitecore in my video: _URL_0_", "223" ], [ "From a perspective of someone working in the industry: please don&#39;t. Just tell them it was a design mistake in the language. Seemed like a good idea at the time, but turned out to be a huge hurdle in everyday lives of poor Java programmers. Your own example is a good illustration for why it is a bad idea: you have repeated the same code over and over. Obviously, the text of the song won&#39;t change, but if you used switch with something that could, you&#39;d again, had a problem with propagating the change through the code (possibly not owned by you).", "372" ], [ "You should be able to achieve this with Sitecore and Placeholders. This doesn&#39;t really rely on the use of Sitecore MVC or using a Controller Rendering. You would want to create 2 renderings (either controller or a view rendering would also work here):\r\n\r\n 1. Tab Container\r\n 2. Tab Item\r\n\r\nThe `Tab Container` rendering would have a placeholder such as `Tab.Container` that you would add Tab Items to it, for any number of tab items you want for that page. The code would look like this:\r\n\r\n @model RenderingModel\r\n\r\n < div > \r\n @Html.Sitecore().Placeholder( \" ;Tab.Container \" ;)\r\n < /div > \r\n\r\nThen you would define another rendering. It would be called `Tab Item`. It would have a data source Template which would contain the following fields:\r\n\r\n - Title (Single-Line Text)\r\n - Placeholder Key (optional) (Single-Line Text)\r\n\r\nThe code for this rendering would look like the following:\r\n\r\n @model RenderingModel\r\n\r\n < div class= \" ;tab \" ; > \r\n < div class= \" ;header \" ; > @Html.Sitecore().Field( \" ;Title \" ;) < /div > \r\n < div class= \" ;content \" ; > \r\n @Html.Sitecore().Placeholder( \" ;Tab \" ;)\r\n < /div > \r\n < /div > \r\n\r\nYou would define items that will represent the data source for your `Tab Item` rendering. In the case of your sports page, you would define 3 items:\r\n\r\n 1. Cricket\r\n 2. Football\r\n 3. Tennis\r\n\r\nNext you would need to configure the Presentation details for the `Sports` page. You would add the initial `Tab Container` to the presentation details by assigning it to the placeholder used in your layout. Then you would assign 3 renderings for the tab item rendering. Their placeholder key would be set to `Tab.Container`.\r\n\r\nLastly when you want to assign renderings to a specific tab item, you would do so via the placeholder key. So example, if you wanted to assign a `Article Rendering` to the first tab, you can add it to the presentation details and set the placeholder key to `Tab`.\r\n\r\nNow there&#39;s one caveat to what I mentioned above. If you don&#39;t have Dynamic Placeholders defined, you will run into an issue, because it won&#39;t know which `Tab` (since in our example there would be 3 `Tab` placeholder keys defined) to assign the `Article Rendering` to. You could get around that by either setting the placeholder key in the view with something like this:\r\n\r\n @model RenderingModel\r\n\r\n @{\r\n Rendering currentRendering = RenderingContext.Current.Rendering;\r\n }\r\n\r\n < div class= \" ;tab \" ; > \r\n < div class= \" ;header \" ; > @Html.Sitecore().Field( \" ;Title \" ;) < /div > \r\n < div class= \" ;content \" ; > \r\n @Html.Sitecore().Placeholder( \" ;Tab-@(currentRendering.UniqueId) \" ;)\r\n < /div > \r\n < /div > \r\n\r\nBut I would highly recommend using a Dynamic Placeholder control on your site. I have one on the Sitecore Market place: _URL_0_\r\n\r\nGoing this approach, is the best approach, because you don&#39;t lose any of the benefits such as personalization or A/B testing, or the flexibility to use any type of rendering in your tabs in any order. Also this approach will work well with the experience editor.", "340" ], [ "You can indeed get this information from the UCSC Table Browser. Select knownGene as your primary table, make a filter, add knownCanonical to as a linked table to filter on, then in the free-form query section add \" ;1 \" ; without the quotes. Then click submit and select Bed output, where you can choose \" ;exons plus \" ; as an output option. This will lead to output like the following:\r\n\r\n chr1\t17368\t17436\tuc031tla.1_exon_0_0_chr1_17369_r\t0\t-\r\n chr1\t29553\t30039\tuc057aty.1_exon_0_0_chr1_29554_f\t0\t+\r\n chr1\t30563\t30667\tuc057aty.1_exon_1_0_chr1_30564_f\t0\t+\r\n chr1\t30975\t31097\tuc057aty.1_exon_2_0_chr1_30976_f\t0\t+\r\n chr1\t30365\t30503\tuc031tlb.1_exon_0_0_chr1_30366_f\t0\t+\r\n chr1\t34553\t35174\tuc001aak.4_exon_0_0_chr1_34554_r\t0\t-\r\n chr1\t35276\t35481\tuc001aak.4_exon_1_0_chr1_35277_r\t0\t-\r\n chr1\t35720\t36081\tuc001aak.4_exon_2_0_chr1_35721_r\t0\t-\r\nFor more step-by-step information, please check the answer from the mailing list archives here (in particular the Exon Method 1 section):\r\nhttps://groups.google.com/a/soe._URL_0_/d/msg/genome/BJ-6DlaZNCY/grgGIpuJAwAJ\r\n\r\nAlso note that UCSC provides several mailing lists for support, if you have futher questions please send them there:\r\n\r\n - General questions: genome@soe._URL_0_ \r\n - Questions involving private\r\n data: genome-www@soe._URL_0_ \r\n - Questions involving mirror sites:\r\n genome-mirror@ose._URL_0_", "651" ], [ "Before that screen when you specify a Template and Destination, what did you put for those options? And assuming Template is a custom structure, could you provide details about what fields are a part of that template? I just tested this but using a slightly newer version of Sitecore and WFFM and I&#39;m seeing Not Defined, but when I click I see the fields. So its possible it might be fixed in a newer version (which I will test your specific version tomorrow) or it might very well have something to do with the Template you&#39;ve selected initially.", "343" ], [ "I have a (vaguely) complex curve with some self-intersections, and I would like to add a filling to the interior. However, the recommended method (of turning `Line`s into [`FilledCurve`](_URL_0_)s), i.e. by doing something like\r\n\r\n ParametricPlot[\r\n {Cos[t] + 2 Cos[2 t], Sin[t] - 2 Sin[2 t]}\r\n , {t, 0, 2 π}\r\n , Frame - > True\r\n ] /. {Line[pts_] : > {FilledCurve[{Line[pts]}]}}\r\n\r\nis unsatisfactory, since, as the documentation puts it,\r\n\r\n > Filled curves can be non-convex and intersect themselves. Self-intersecting curves are filled according to an even-odd rule that alternates between filling and not at each crossing.\r\n\r\nThis puts a big hole in the middle of my figure that I would also like to fill:\r\n\r\n![Mathematica graphics](_URL_1_)\r\n\r\nHow can I control the filling in that hole?", "447" ], [ "We are having an issue with Synthesis and Unicorn in the same solution. I&#39;m not sure if Helix really applies in this scenario but might be something to consider, since there are multiple projects and multiple Synthesis and Unicorn configurations. \r\n\r\nBut if Developer A creates new Sitecore items and then creates a new Unicorn configuration (usually for a feature). They then create the Synthesis based models. That all works perfectly fine. \r\n\r\nDeveloper B gets latest and runs the gulp task to publish all files. Then they go to /unicorn.aspx to sync the new sitecore items, but they get a Synthesis error about the items not existing in the tree. (because they didn&#39;t sync the items with unicorn yet)\r\n\r\nIs there an option in Synthesis to prevent this scenario from occurring, and to give the developer enough time to Sync Unicorn, before any Synthesis functionality occurs?", "693" ], [ "As pointed out in the comments, `MeshRegion` objects are \" ;atomized \" ;, which is not particularly well described in the documentation, as mentioned in [an earlier question](_URL_2_) and more importantly [this other one](_URL_0_). This can be brought to the fore via\r\n\r\n AtomQ[region]\r\n (*True*)\r\n\r\nwhere [`AtomQ`](_URL_4_) is a function which\r\n\r\n > yields True if expr is an expression which cannot be divided into subexpressions, and yields False otherwise.\r\n\r\nor in more detail\r\n\r\n > - You can use AtomQ in a recursive procedure to tell when you have reached the bottom of the tree corresponding to an expression.\r\n > - AtomQ gives True for symbols, numbers, strings, and other raw objects, such as sparse arrays.\r\n > - AtomQ gives True for any object whose subparts cannot be accessed using functions like Map.\r\n\r\nThis is briefly mentioned in the documentation for [`MeshRegion`](_URL_3_), which states\r\n\r\n > MeshRegion is always converted to an optimized representation and treated as raw by functions like AtomQ for purposes of pattern matching.\r\n\r\nThat still does not explain why MMA is unwilling to break up the expression when explicitly told to do so (via e.g. [`Apply`](_URL_1_)ing a different head to it), though in that sense it does behave like *some* other &#39;atomic&#39; expressions, such as\r\n\r\n f @@ Rational[2, 3]\r\n (*2/3*)\r\n\r\nbut not others, such as\r\n\r\n f @@ SparseArray[{{1, 1} - > 1, {1, 2} - > 3}]\r\n\r\n(which returns, for some reason, an object of the type `f[SparseArray[...]]`, but with dimensions `{2}` instead of `{1,2}` as the initial array).\r\n\r\n\r\n\r\nThe bottom line, it seems, is that this is for performance reasons which are not particularly well documented.", "352" ], [ "@Mr.<PERSON> Frankly, I don&#39;t think the documentation is quite at the level where it can fend off accusations of \" ;doesn&#39;t explain \" ;. If I run Sjoerd&#39;s `deAtomized` on my `region` I get a `LeafCount` of over 600; if such an object is \" ;atomic \" ; then it would frankly need to be the very first thing in the Details section if it wanted to not be misleading. Similarly, `region` has a `Head` and the docs for `Apply` says that it will replace that `Head` - with no mention at all of atomic objects in the details section. Call it a documentation bug if you want, but this isn&#39;t up to scratch, I think.", "321" ], [ "As a naive guess, the double call to `re` in `re=Append[re,...]` seems to be causing some form of cross-talk trouble between the different kernels, with kernel 1 trying to write to `re` while kernel 2 is reading from it. Changing the [`Append`](_URL_0_) call for an equivalent [`AppendTo`](_URL_1_) call returns the expected results:\r\n\r\n d = 6;\r\n SetSharedVariable[re];\r\n re = {};\r\n ParallelDo[\r\n x = RandomReal[];\r\n y = x;\r\n ser = {};\r\n Do[\r\n y = y + 1;\r\n ser = {ser, y}, {d}\r\n ];\r\n AppendTo[re, Partition[Flatten[ser], d]]\r\n , {d}];\r\n re\r\n\r\nAlternatively, you can switch your reporting to a [`Sow`](_URL_2_)+[`Reap`](_URL_3_) scheme, which also returns the expected results.\r\n\r\n d = 5;\r\n SetSharedFunction[Sow]\r\n Reap[\r\n ParallelDo[\r\n x = RandomReal[];\r\n y = x;\r\n ser = {};\r\n Do[\r\n y = y + 1;\r\n ser = {ser, y}, {d}\r\n ];\r\n Sow[\r\n Partition[Flatten[ser], d]\r\n ];\r\n , {d}];\r\n re\r\n ]\r\n\r\nAs to *why* the explicit `Set`+`Append` call fails to work, I&#39;m not really sure. But hopefully these workarounds are useful, and they do shed some light on the mechanisms.", "739" ], [ "I have a notebook that I would like to export as a pdf file. I currently want to send this to a collaborator, but in general I&#39;d like to keep the technique to future-proof my notebook collection against a day when I might no longer have Mathematica installed.\r\n\r\nThe notebook in question has a lot of very wide graphics of various sizes, and it occupies most of the 1920px of my screen. The pdf printout is mostly meant to be read on-screen instead of printed, so I do not care about either page width or page breaks. On the other hand, I would like to avoid excessive whitespace on either the right hand side of the page or the bottom. I want the pdf page to be as big as it needs to be, but not bigger - in essence, to be a direct representation of what the Front End actually puts on my screen.\r\n\r\nMoreover, I would like to be able to do this programmatically from an external notebook or script that I can then run on a larger collection of notebooks.\r\n\r\nWhat is the cleanest way to do this?", "177" ], [ "I need a small monitor that can display only 5 digits. The monitor needs to show number of visits to my site in real-time - every time someone visits, it needs to increase by one.\r\n\r\nI thought to create an app, that queries the server every 10 seconds, and checks the new number of visitors.\r\n\r\nThe question: Do you know about a monitor that can be programmed from the command line?\r\n\r\nAll of what I found in Ebay & DealExtreme you need to program the LED monitor by software - you cannot add it to your program.", "736" ], [ "This integral is unknown to Mathematica and indeed it appears that there is no simple solution at all. You can try rooting around the [DLMF](_URL_0_), and using [the relations of $\\operatorname{erfi}$ to the incomplete gamma and Kummer $M$ functions](_URL_0_7.11) to look for similar relations in the standard books of integrals (such as <PERSON> & Ryzhik, <PERSON> et al., <PERSON> et al., and so on), but I had a look and there&#39;s nothing remotely hopeful in there. Whatever you find will probably be quite ugly.\r\n\r\nAs such, your best bet is to encapsulate your integral into a single function which you can then evaluate numerically when needed. Using your simple example as a starting point,\r\n\r\n f[z_?NumericQ, L_?NumericQ] := NIntegrate[Erfi[y] Erfi[z + y], {y, -L, L}]\r\n LogPlot[f[z, 1], {z, -3, 3}]\r\n\r\nproduces the plot below without a complaint in a couple of seconds.\r\n\r\n![Mathematica graphics](_URL_1_)\r\n\r\nFor your more complicated case, it depends what you want to do with your bigger integral, but you probably want to hold off on the integration and simply do it numerically when it&#39;s needed. An analytical result is not likely to be possible, unless you have some guarantee that it is (in which case, edit the question to make it clear why you expect the integral to be doable at all). \r\n\r\nWhether direct numerical integration is the best strategy or not (versus e.g. doing some transformation or series representation on the error functions before integrating, which could then be exact) is potentially up for grabs, but unless you have very good reasons to think otherwise, the starting assumption should be that if there&#39;s something clever to be done to the integrand to do it numerically, Mathematica&#39;s NIntegrate is probably already doing it behind the scenes.", "534" ], [ "This seems to be caused by the boundary condition evaluated at a variable point. As an illustration, this\r\n\r\n y[4][3] /. ParametricNDSolve[{\r\n y&#39;&#39;[x] + y&#39;[x] + y[x] == 0, \r\n y&#39;[10] == y[10], \r\n y[0] == u\r\n }, y, {x, 0, 10}, u]\r\n\r\nwill evaluate just fine, but changing the `y&#39;` initial condition to\r\n\r\n y[4][3] /. ParametricNDSolve[{\r\n y&#39;&#39;[x] + y&#39;[x] + y[x] == 0, \r\n y&#39;[u] == y[u], \r\n y[0] == u\r\n }, y, {x, 0, 10}, u]\r\n\r\nwill return the error\r\n\r\n ParametricNDSolve<IP_ADDRESS>ndsv: Cannot find starting value for the variable y&#39;.\r\n\r\nIn your case, of course, you&#39;ve got your boundary conditions and that&#39;s that, and you can&#39;t really change them without changing your problem. What you can do is either\r\n\r\n - move away from `ParametricNDSolve` as a solver, in favour of functionalized constructs such as\r\n\r\n f[u_?NumericQ] := f[u] = y /. First[NDSolve[{\r\n y&#39;&#39;[x] + y&#39;[x] + y[x] == 0,\r\n y&#39;[u] == y[u], \r\n y[0] == u\r\n }, y, {x, 0, 10}]]\r\n\r\n which evaluates `f[4][3]` just fine, or\r\n\r\n - re-scale your problem to a new independent variable `ζ` with a fixed range, such as `ζ=z/(z0-a-zb)`, for which this shouldn&#39;t be a problem.", "839" ], [ "Always test with a specific value before you run with it. Try `Block[{w = 0.001, z0 = 2}, NDSolve[{DE, x&#39;[z0 - a] == -I (z0 w)/(6 a^2) x[z0 - a], x[zb] == 1}, x, {z, zb, z0 - a}] ]`. It returns the error `NDSolve<IP_ADDRESS>bvluc: The equations derived from the boundary conditions are numerically ill-conditioned. The boundary conditions may not be sufficient to uniquely define a solution`. This is a fundamental problem with your equation and you need to address it directly; there&#39;s little that we can do to help without knowing what it is you&#39;re working on.", "56" ], [ "Natural weapons and unarmed combat are two different things. Natural weapons are claws, horns, spikes, teeth... that said creature has. Humans in Anima do not have natural weapons and when they fight with martial arts (exceptions aside) they use unarmed combat rules.\r\n\r\nI do not remember where I read the breakage of unarmed combat, but I think I it is -2. Of course Ki abilities and some martial arts give bonus to this (and of course, having a lot of strength).\r\n\r\nFinally, using this rule will be unfair, since most of martial arts give different numbers for base damage, not 10.\r\n\r\nI will have to check, but I do remember that, even more, you cannot combine natural weapons with martial arts.", "717" ], [ "I&#39;m unsure how to override variables between roles in Ansible.\r\n\r\nTo simplify the setup a little, I have two roles applied to the same host. The first role defines a variable in its `default/main.yml`:\r\n\r\n do_some_task: yes\r\n\r\nAnd looks for that variable in its tasks:\r\n\r\n - name: Some Task\r\n when: do_some_task\r\n\r\nThe second role overrides that in its `vars/main.yml`, which is supposed to take precedence over the defaults:\r\n\r\n do_some_task: no\r\n\r\nHowever, the task is still being run, indicating that the variable wasn&#39;t overridden. It seems that the override is scoped to the tasks of the second role. I tested that by adding a debug task to both roles:\r\n\r\n - name: Test some task\r\n debug: \" ;msg=&#39;do_some_task = {{ do_some_task }}&#39; \" ;\r\n\r\nThis confirms that the first role sees a different value of the variable than the second.\r\n\r\n\r\n TASK: [role1 | Test some task]\r\n ok: [myhost] = > {\r\n \" ;msg \" ;: \" ;do_some_task = True \" ; \r\n }\r\n \r\n ...\r\n \r\n TASK: [role2 | Test some task]\r\n ok: [myhost] = > {\r\n \" ;msg \" ;: \" ;do_some_task = False \" ; \r\n }\r\n\r\nThe common answer to this appears to be to set the variables in the inventory or the host vars. However this isn&#39;t particularly DRY: if you have many hosts in different inventories, you&#39;d have to set the same variables in lots of places.\r\n\r\nSo is there some way of overriding a variable from another role?", "730" ], [ "I&#39;m trying to avoid putting the variables in the playbook. The question is boiled down to a single variable because that&#39;s easier, but in practice it could easily be a large number of variables. I don&#39;t want to repeat those in several playbooks, or several inventories. I want to set a single flag - assigning a host to a role - and have that bring in all the necessary config. Nice and DRY.", "730" ], [ "Hi @R.M., can I ask the same favour again? We need to change the canvas to [this one](_URL_0_) to meet the new size specs. Is that a reasonable ask? Ideally Liberation Sans Bold on the counter, to look like [this](_URL_1_). Is that something you&#39;ve got time for, and which is allowed by the web app tier? Or is the code lost in some previous machine? Thanks a huge bunch in advance!", "317" ], [ "I am writing a package where I would like to be able to pass replacement rules to a function inside the package and have the function manipulate its symbols using those replacement rules. However, I&#39;m having some trouble implementing it. \r\n\r\n(I&#39;m rather baffled because the files used to work and no longer do, coinciding with a change from v10 to v10.1. However, I would be surprised if that is actually the cause as I feel the MWE below completely encapsulates the problem and it looks like a language issue, so instead it may be that I ran the files differently in ways that are hard to reconstruct.)\r\n\r\nThe specific thing I have in mind is this. Make two files, `testpackage.m` containing \r\n\r\n BeginPackage[ \" ;Test` \" ;];\r\n replace<IP_ADDRESS>usage = \" ;Returns var/.rules. \" ;;\r\n Begin[ \" ;`Private` \" ;];\r\n replace[rules_] := ReplaceAll[var, rules]\r\n End[];\r\n EndPackage[];\r\n\r\nand `testnotebook.nb` containing\r\n\r\n Needs[ \" ;Test` \" ;, \" ;/path/to/testpackage.m \" ;]\r\n \r\n replace[var- > 0]\r\n replace[Test`Private`var - > 0]\r\n\r\nOpen the notebook file on a fresh session and load the package. I would like the usage `replace[var- > 0]` to return `0` - that is, I would like `replace` to be able to tell `var` to zero itself. However, it returns ``Test`Private`var``, which upon closer examination of the code is in fact a pretty reasonable thing for it to return. The reasonableness of this is compounded by the fact that ``replace[Test`Private`var - > 0]`` will return `0` as expected.\r\n\r\nAs I said, the usage `replace[var- > 0]` used to work fine for my bigger package, and indeed it can work fine in some circumstances (which I cannot pin down exactly, and which I have not been able to reproduce in this MWE yet) if the notebook file is opened on the same Mathematica instance (and thus kernel session) as the package file, with the package file (in practice, a `.m` auto-generated from a notebook) having been used to run the definition of `replace`.\r\n\r\nSo: I have some wonky code, which is probably returning the results it needs to but not the results I want it to, and I would like to amend it to return it to the desired behaviour. In particular: is there some way to take the call\r\n\r\n ReplaceAll[var, rules]\r\n\r\nand make it forget contexts for a minute?\r\n\r\nAlternatively, I&#39;m painfully aware of the possibility that this simply means that I&#39;ve completely misunderstood the concept of contexts, and that what I want simply isn&#39;t doable. This would mean that the behaviour I want, for example, can only be produced by e.g. adding the symbol `var` to the ``Test` `` context, such as by adding the line\r\n\r\n var<IP_ADDRESS>usage = \" ;var is the variable that gets replaced \" ;;\r\n\r\nbelow the usage message for `replace`. I&#39;m reluctant to take such a step as the package is relatively big (and organically grown, so somewhat messy and without comprehensive unit tests, unfortunately) and I&#39;m afraid of breaking something. If there are no shortcuts then I&#39;m OK with it, but I would like to know if there&#39;s a hackier way to get the behaviour I want.", "730" ], [ "<PERSON> I suspect that simply my original code is just badly designed, but it&#39;s probably not worth the effort to fix it given the future use it will get. Thanks all for your responses - they are all helpful. I&#39;m accepting Chris&#39;s solution as it&#39;s the simplest to implement, though it is not very suitable for a package that one will distribute given the issues pointed out by <PERSON> and <PERSON>.", "84" ], [ "You can fix this by wrapping the plotting function inside an [`Evaluate`](_URL_0_):\r\n\r\n Manipulate[\r\n Plot[\r\n Evaluate[(f /. x - > (x - h)) + k]\r\n , {x, -10, 10}\r\n , PlotRange - > {{-10, 10}, {-10, 10}}\r\n , Epilog - > Text[(f /. x - > (x - h)) + k, {7, 9}]\r\n , GridLines - > {Range[-10, 10], Range[-10, 10]}\r\n , GridLinesStyle - > Opacity[.04]\r\n ]\r\n , {{f, x^2, \" ;base function: \" ;}, {x^2, Cos[x] - > \" ;cos(x) \" ;}}\r\n , {{k, 0, \" ;k \" ;}, -10, 10, 1}\r\n , {{h, 0, \" ;h \" ;}, -10, 10, 1}\r\n ]\r\n\r\nThis seems to be related to the [`HoldAll`](_URL_1_) attribute of `Plot`, which can cause some counter-intuitive evaluations. The `Evaluate` trick is pretty useful when plotting commands fail to recognize some aspect of the plotting function. For example, the naive attempt\r\n\r\n Plot[\r\n Table[x^n, {n, 0, 5}]\r\n , {x, 0, 1}\r\n ]\r\n\r\nwill produce a bunch of blue lines - `Plot` will fail to realize that it&#39;s been fed six different lines to plot, and that it needs to render them in different colours, unless it&#39;s given an explicit `List` header. Wrapping the `Table` inside an `Evaluate` will then produce the desired behaviour.\r\n\r\n Plot[\r\n Evaluate[Table[x^n, {n, 0, 5}]]\r\n , {x, 0, 1}\r\n ]\r\n\r\nIt seems your code falls prey to something similar, since the `ReplaceAll` works fine if you change the `Plot` to a dummy `nonPlottingPlot`, but the details are not that clear to me.\r\n\r\n---\r\n\r\nAlternatively, switching to pure functions for `f` (rather than expressions) will also fix it:\r\n\r\n Manipulate[\r\n Plot[\r\n f[x - h] + k\r\n , {x, -10, 10}\r\n , PlotRange - > {{-10, 10}, {-10, 10}}\r\n , Epilog - > Text[f[x - h] + k, {7, 9}]\r\n , GridLines - > {Range[-10, 10], Range[-10, 10]}\r\n , GridLinesStyle - > Opacity[.04]\r\n ]\r\n , {{f, #^2 & , \" ;base function: \" ;},\r\n {#^2 & - > \" ;\\!\\(\\*SuperscriptBox[\\(x\\), \\(2\\)]\\) \" ;, Cos - > \" ;cos(x) \" ;}}\r\n , {{k, 0, \" ;k \" ;}, -10, 10, 1}\r\n , {{h, 0, \" ;h \" ;}, -10, 10, 1}\r\n ]", "616" ], [ "I made some coconut pudding using [a recipe I had found][1], but I&#39;m having some trouble getting it to set. I used this recipe once before and ended up boiling it for probably closer to 2 minutes instead of the suggested 1 minute and it thickened up fine. This time I did exactly 1 minute and it&#39;s still pretty liquidly after a few hours in the fridge. \r\n\r\nI&#39;m wondering if I should return the pudding to a pot and boil it a little more - or if I have missed my chance at this point?\r\n\r\n [1]: _URL_0_", "928" ], [ "The Mage Storyteller&#39;s Companion from MtA Reviewed (a book published a few years before Forged by Dragons) has some rules on this (page 54).\r\n\r\n > Artifacts and Inventions maybe created with Prime 3 if\r\nthe mage uses Tass of appropriate Resonance, Prime 4 with\r\nregular Quintessence or Prime 5 in the case of making a\r\nliving Artifact. (A mage may use Prime 4 to create a living\r\nArtifact if he uses the right sort of Tass.) The mages working\r\nthe enchantment must perform an extended ritual, and the\r\nplayers must score total successes equal to twice the value of\r\nthe Artifact. An equal quantity of Quintessence must be\r\ninvested as well. Naturally, this undertaking is extremely\r\ndifficult. Making even a simple item can require a great\r\noutlay of time and Quintessence, since the Effect must be\r\nrendered more or less permanent, which could require greater\r\nsuccess at the Storyteller&#39;s discretion. As with any sort of\r\nWonder-creation, making an Artifact or Invention is a\r\nheroic undertaking. These quests are excellent stories for\r\nmages who want to search out special components, ritual\r\nformulae and resonant Tass in the pursuit of the creation of\r\nan item of ultimate craftsmanship.\r\nSome sorts of pseudo-Artifacts, such as silk shirts with\r\nthe strength of steel, can be created solely with Pattern\r\nmagic. Such enchantments actually rework the Pattern itself\r\ninto a new form, though, instead of leaving a magical\r\nenchantment bound to the item&#39;s Pattern. A creation of that\r\nsort can functionally be considered an Artifact, but the\r\nmagic can only be undone by reversing the Effect.\r\n\r\nThis is for general artifacts, next page contains how to do charms:\r\n\r\n > One builds a Charm or Gadget just like an Artifact or\r\nInvention, but because it is not permanently empowered,\r\ndoing so requires one less level of Prime Sphere skill. With\r\nthe right Tass, apprentices can forge Charms with Prime 2,\r\nso these items are key stepping stones in the creation of more\r\npowerful magical Wonders.\r\n\r\nSo, to answer your questions:\r\n\r\n1. It success at Storyteller&#180;s discretion as RAW. Also states that you requiere double de success of the charm. So a level 1 charm requieres 2 success, and a level 5 charm requieres 10 success.\r\n\r\n2. An equal quantity of quintessence is needed (again, depends on the level).\r\n\r\n3. When you create an artifact you assign a series of spheres effects depending on the level (5 per level), you must have that spheres to begin with (you cannot create a time 4 effect if you yourself do not have time 4). The power of each effect is rolled every time you use it (you throw one dice of arete for every level of the artifact). The same happens with the charms (since they follow the same rules), with the exception that charms can be used by sleepers if they believe in the paradigm. The maximum arete that you can assign an artifact (I believe, I haven&#180;t double checked this) is your own arete. So the maximum amount of dice that you could get depends on the level of the artifact and that depends on your arete (you can, of course, create an artifact of a level lower than your arete).\r\nThe selection of effects has some additional rules on charms (again, same page)\r\n\r\n > Charms are valuable according to their one-shot power.\r\nIf a Charm duplicates a particular Effect or Merit, then its\r\nvalue is one-tenth the Sphere rating or Merit cost. Therefore, it is best to buy Charms in groups (like a box of candles,\r\na bunch of flowers or whatnot).", "796" ], [ "@Quantum_Oli I can&#39;t detect the spilling you mention but you&#39;re right that the clipping option for the `Show` can indeed override the one for the inner plot. The problem you mention is, I think, more to do with the corners `Line` object overstepping the bounds, and it&#39;s really tricky to control - I usually end up putting white rectangles around the plot whenever this becomes a problem.", "616" ], [ "I have run into some weird behaviour on the part of `NDSolve` which I find pretty bizarre and which I would like to understand better.\r\n\r\nSuppose, for the sake of argument, that I want to study the ODE system\r\n$$\r\n\\left\\{\\begin{array}{l}\r\ny&#39;(x)=\\cos(x)\\phantom{y(x)}\\\\\r\nz&#39;(x)=y(x),\\phantom{\\cos(x)}\r\n\\end{array}\\right.\r\n$$\r\nand that I want to do it sequentially. This is pretty easy: I begin by solving the first equation and setting the resulting `InterpolatingFunction` to a placeholder `f`,\r\n\r\n f = y /. First[NDSolve[{y&#39;[x] == Cos[x], y[0] == 0}, y, {x, 0, 20}]]\r\n\r\nand then I use this `f` inside the second `NDSolve`,\r\n\r\n NDSolve[{z&#39;[x] == f[x], z[0] == 0}, z, {x, 0, 20}]\r\n\r\nand everything is dandy.\r\n\r\nGoing a bit further down For The Sake Of Argument alley, suppose that for whatever reason I want my forcing functions and dependent variables to have vector values (with a single entry). I need to adjust the initial conditions to match, but otherwise everything works fine:\r\n\r\n g = y /. First[NDSolve[{y&#39;[x] == {Cos[x]}, y[0] == {0}}, y, {x, 0, 20}]]\r\n NDSolve[{z&#39;[x] == g[x], z[0] == {0}}, z, {x, 0, 20}]\r\n\r\nNow finally, suppose that some devious, argumentative trickster decides to sneak in to change the `g[x]` and add a zero of appropriate dimensions, changing that right-hand side to `{0}+g[x]`, so the command will look like\r\n\r\n NDSolve[{z&#39;[x] == {0} + g[x], z[0] == {0}}, z, {x, 0, 20}]\r\n\r\n \" ;That&#39;s not a problem! \" ;, I hear you say, \" ;surely that&#39;s not something that will cause *Mathematica* to just suddenly throw its hands up in the air and give up, right? \" ;, and I wholeheartedly agree with you.\r\n\r\nUnfortunately, that&#39;s not really the case. For some reason, that last bit seems to simply be too much, and *Mathematica* returns the whole `NDSolve` construct undigested:\r\n\r\n![](_URL_1_)\r\n\r\nNow this is pretty weird. Watering down the `NDSolve` commands to non-evaluating `ndsolve`s throws some light into what&#39;s going on: when the arguments to the solver are processed, adding the explicit `{0}` to the symbolic `g[x]` results in the equation `z&#39;[x]=={g[x]}`, where the right-hand side is one level too deep:\r\n\r\n![](_URL_2_)\r\n\r\nAs such, putting in an explicit part statement on the `g`, or making the initial condition for `z` one level deeper will produce mostly acceptable results (or at least, it will produce results, but the second option gives the wrong shape). Thus\r\n\r\n NDSolve[{z&#39;[x] == {0} + g[x][[1]], z[0] == {0}}, z, {x, 0, 20}]\r\n NDSolve[{z&#39;[x] == {0} + g[x], z[0] == {{0}}}, z, {x, 0, 20}]\r\n\r\nproduces\r\n\r\n![](_URL_0_)\r\n\r\nNow this is sort of acceptable (at least it sort of kind of fixes the problem) but it feels like a horrible kludge to me.\r\n\r\nMostly, though, I&#39;m deeply uncomfortable with the fact that expressions which look equivalent (`g[x]` and `{0}+g[x]`) produce wildly different results, in an unstable, you-can&#39;t-know-what-you&#39;ll-get sort of way. Is there a unified way to ensure a more uniform output in this sort of situation?", "292" ], [ "Suppose I have a function $f(t)$, and I want to compute its indefinite integral\r\n$$F(t)=\\int_0^tf(\\tau)\\mathrm d\\tau.$$\r\nMoreover, suppose that, for any of a number of reasons, I require this integral to be done numerically, I need it to be done in a single swoop for all $t$ in a range $[0,T]$ of interest, and I need to be able to evaluate $F(t)$ for any $t$ in that range.\r\n\r\nOne standard trick (which is perhaps not as well known as it should be) is that one of the better ways to do this is to reinterpret the indefinite integral as an initial-value problem,\r\n$$F&#39;(t)=f(t)\\quad\\text{under }F(0)=0$$\r\nand then simply give it to the differential-equations solver [`NDSolve`](_URL_0_) directly, e.g.\r\n\r\n NDSolve[{F&#39;[t]==f[t], F[0]==0}, F, {t, 0, T}]\r\n\r\nand this will return $F$ as an [`InterpolatingFunction`](_URL_3_) object which can be evaluated anywhere in $[0,T]$.\r\n\r\n---\r\n\r\nI would like to extend this to the case where the indefinite integral comes with a parameter, say, of the form\r\n$$F(t,t&#39;)=\\int_{0}^tf(\\tau,t&#39;)\\mathrm d\\tau.$$\r\n**Is there an equivalently clean way to obtain $F$ as an indefinite integral?**\r\n\r\n---\r\n\r\nOne such way is to invoke a similar solver, [`ParametricNDSolve`](_URL_2_), in the form\r\n\r\n ParametricNDSolve[{F&#39;[t]==f[t,tt], F[0]==0}, F, {t, 0, T}, {tt}]\r\n\r\nwhich will return a solution of the form `{f- > ParametricFunction}`, where the [`ParametricFunction`](_URL_1_) is evaluated as `ParametricFunction[tt]` (for a numeric `tt`) to give an `InterpolatingFunction` object, so e.g. `ParametricFunction[4][5]` will return a number.\r\n\r\nI find this solution unsatisfactory because it is very slow when one needs to repeat the process over and over for different $t&#39;$s. While the `ParametricFunction` object it returns is nice (including, for example, the ability to compute derivatives like $\\frac{\\partial F}{\\partial t&#39;}$), it is essentially based on a single ray on the $(t,t&#39;)$ plane, and there&#39;s no way for the different rays to talk to each other, with the downside that Mathematica ends up calculating many things which are very similar in a highly sub-optimal way.\r\n\r\nI would like, then, clean solutions where I can run the whole calculation once, and then simply query for the values of $F(t,t&#39;)$ without incurring in additional computation.", "534" ], [ "Here is one way (but I remain interested in other ways to solve the problem).\r\n\r\nThe indefinite integral can still be reinterpreted as a differential equation, of the form\r\n$$\r\n\\frac{\\partial F}{\\partial t}(t,t&#39;)=f(t,t&#39;)\r\n\\quad \\text{under }F(0,t&#39;)=0\r\n$$\r\nand, though this isn&#39;t obvious, it can still be handled as a differential equation by `NDSolve` - except this time it needs to be treated as a PDE.\r\n\r\nTo set a more concrete example, consider the integrand $f(t,t&#39;)=\\cos(t)-\\cos(t&#39;)$. In this case, simply giving the differential equation to `NDSolve` and using the PDE syntax (with two independent variables)\r\n\r\n NDSolve[\r\n {D[F[t, tt], t] == Cos[t] - Cos[tt], F[0, tt] == 0}\r\n , F\r\n , {t, 0, 50}, {tt, 0, 50}\r\n ]\r\n\r\nevaluates perfectly fine, returning a two-dimensional `InterpolatingFunction` which reproduces the correct solution:\r\n\r\n![Mathematica graphics](_URL_1_)\r\n\r\nIn terms of what&#39;s happening, Mathematica seems to interpret the equation as a [convection-diffusion](_URL_0_) equation with a vanished diffusion term, which can occasionally cause some instabilities and some jumpy results; these can sometimes be eliminated by adding some artificial diffusion (a small multiple of $\\nabla^2F$ on the right-hand side) which can help stabilize the solver without appreciably changing the results.\r\n\r\nHowever, this stabilization [does not always work](_URL_2_), particularly with complicated domains, so there&#39;s definitely a good bit of room for improvement.", "292" ], [ "@DanielLichtblau Indeed, it&#39;s just an ODE at heart. However, I&#39;m struggling to &#39;glue&#39; together all the different single ODEs to get a fast calculation of the whole thing. In particular, if $f(t,t&#39;)$ doesn&#39;t change much for any $t$ for all $t&#39;$ between $t_1&#39;$ and $t_2&#39;$ and I&#39;ve already run the ODE for $F(t,t_1&#39;)$ and $F(t,t_2&#39;)$, I would like a scheme that doesn&#39;t need to re-run the entire ODE every time I ask for $F(t,t&#39;)$ for some $t&#39;$ in between the two.", "292" ], [ "Some evidence may suggest that it is to avoid unnecessary arousal, there is some medical evidence that one can get addicted to arousal and it affects the brain in a negative way in the long term. (allahu alim) \r\n\r\nSo if this is bad:\r\n\r\n > The Messenger of Allaah (Peace & Blessings of Allaah be upon Him) said: \" ;O <PERSON>, do not follow a glance with another, for you will be forgiven for the first, but not for the second. \" ; (Reported by al-Tirmidhi, 2701; see <PERSON>’, 7953)\r\n\r\nAnd this is bad:\r\n\r\n > <PERSON> (sal Allahu alaihi wa sallam) said: “Whenever a non-mahram man and woman meet in seclusion, <PERSON> definitely is the third one joining them.” [Tirmidhi]\r\n\r\nImagine pornography, which is a plague upon the whole of society those who are engaged in watching/producing are often among some of the most depressed individuals.\r\n\r\n > _URL_0_\r\n\r\nAlso historically what often happened to society engaged in depravity were met by a very peculiar end. Such society had high living standards for their time and both started to engage in immorality thus forgetting/rejecting the blessing that Allah (swt) bestowed upon them.", "937" ], [ "Recite what you learned, if you know only \" ;Al-Fatiha \" ; then you can repeat it. \r\n\r\n > _URL_1_\r\n > \r\n > But if a person is able to recite part of al-Faatihah only, he should \r\n > recite that which he is able to recite. And he has to repeat what he\r\n > can recite well (i.e., so that the total number of what he recites\r\n > will be seven verses, equivalent to the number of verses in\r\n > al-Faatihah). \r\n > \r\n > <PERSON> said: \r\n > \r\n > It may be sufficient for him to say alhamdu-Lillaah (praise be to\r\n > Allaah), laa ilaaha ill-Allaah (there is no god but Allaah) and\r\n > <PERSON> (Allaah is most great), because the <PERSON> (peace and\r\n > blessings of Allaah be upon him) said: “Whatever you know of Qur’aan,\r\n > recite it, otherwise praise Allaah, proclaim His Oneness and magnify\r\n > Him.” (Narrated by <PERSON>)\r\n\r\n \r\n\r\n\r\nIf you a traveling you are allowed to combine your prayers even shorten them. \r\n\r\n > Ruling\r\n > \r\n > _URL_0_\r\n\r\n > <PERSON> (may Allaah have mercy on him) said in Majmoo’ al-Fataawa (22/293): \r\n > \r\n > The reason for shortening prayers is travelling only, and it is not\r\n > permissible in situations other than travelling. As for joining\r\n > prayers, the reason for it is need and excuses, so if a person needs\r\n > to he may join both shortened and full-length prayers whilst\r\n > travelling, and he may join prayers when it is raining and so on, or\r\n > because of sickness and the like, and for other reasons, because the\r\n > purpose behind it is to spare the ummah hardship. End quote.\r\n\r\nI&#39;m not sure about shorthen and combined prayers. But from what i know ( please correct me if i&#39;m wrong) you could combine <PERSON> and <PERSON> (praying <PERSON> just before the time of <PERSON>) and combining <PERSON> and <PERSON> ( praying <PERSON> just before the time for <PERSON>).", "664" ], [ "I am trying to get Mathematica to produce suitable asymptotic expansions for some modified Bessel functions at large argument (more specifically, the expansion in [the DLMF&#39;s eq. (10.40.1)](_URL_1_)), and I&#39;m struggling with some subexponential terms which I would like to eliminate in a systematic fashion.\r\n\r\nMore to the point, suppose I try something of the form\r\n\r\n Series[BesselI[n, z], {z, Infinity, 1}]\r\n\r\nwhich is perfectly consistent with [the documentation&#39;s description of the use of `Series` for asymptotic expansions](_URL_2_), and which normally works perfectly well, but which in this occasion returns\r\n\r\n$$\r\ne^{-z} \r\n\\left(e^{2 z} \r\n\\left(\\frac{\\sqrt{\\frac{1}{z}}}{\\sqrt{2 \\pi }}+O\\left(\\left(\\frac{1}{z}\\right)^{3/2}\\right)\\right)\r\n+\\left(\\frac{i e^{i n \\pi } \\sqrt{\\frac{1}{z}}}{\\sqrt{2 \\pi }}+O\\left(\\left(\\frac{1}{z}\\right)^{3/2}\\right)\\right)\\right)\r\n\\tag{1}.$$\r\n\r\nThis is in contrast with the asymptotic series in the DLMF,\r\n\r\n$$\\mathop{I_{\\nu}}\\nolimits\\!\\left(z\\right)\\sim\\frac{e^{z}}{(2\\pi z)^{\\frac{1}%\r\n{2}}}\\sum_{k=0}^{\\infty}(-1)^{k}\\frac{a_{k}(\\nu)}{z^{k}},\r\n\\qquad\\qquad |\\mathrm{arg}(z)| < \\pi/2 -\\delta < \\pi/2.\r\n$$\r\n\r\nwhich contains no exponentially-decreasing term. I understand where this comes from, since, for example,\r\n\r\n BesselI[1/2, z]\r\n\r\nevaluates to \r\n$$\\frac{\\sqrt{\\frac{2}{\\pi }} \\sinh (z)}{\\sqrt{z}},$$\r\nwhich obviously has both exponential and subexponential terms, with the terms in $e^{-z}$ playing a role for negative $z$, which Mathematica doesn&#39;t quite (yet) have a way to know isn&#39;t the case. (I&#39;m also baffled as to why it&#39;s factorized it in the bizarre grouping of $(1)$, but that&#39;s relatively unimportant.)\r\n\r\nI would like to get rid of these exponentially-decaying terms, in as systematic and general a way as possible. I have tried providing assumptions of various forms (e.g. $\\mathrm{Re}(z) > 1$, or $\\arg(z) < \\pi/4$, or $z > 1$, and variations on that theme) with little success. I am currently using a scheme using [`Delete`](_URL_0_), but it is (i) a horrible hack, and (ii) liable to fail if `Series` returns its output in a different order than what the `Delete` construct is expecting.\r\n\r\nI could also implement the DLMF series directly, but I was hoping that Mathematica is good enough at symbolic calculus that such a step shouldn&#39;t be necessary; and in any case I feel the problem is interesting and general enough to consider without recourse to that.\r\n\r\nIs there an in-built, or at least a cleaner, way to get this expansion?", "186" ], [ "@Dr.WolfgangHintze I&#39;m not saying it&#39;s incorrect, I&#39;m saying it&#39;s not what I want. For the stated domain of DLMF (10.40.1), ($|\\arg(z)| < \\pi/2-\\delta < \\pi/2$), the additional terms do very little. In my application, $z$ is on or near the positive real axis ($\\mathrm{Re}(z)\\approx10$, $|\\mathrm{Im}(z)|\\lesssim1$), so each additional term in the $e^z$ series is ~10 times smaller than the previous one, but the leading term in the $e^{-z}$ series is ${\\sim}e^{-20}{\\sim}10^{-9}$ times smaller than the leading term in the $e^z$ series. Hence them being negligible and more a hindrance than help.", "186" ], [ "@Dr.WolfgangHintze It&#39;s important to note that *both* results are correct; they just have different domains of applicability. There is the more general result which applies in a wider domain, and a more restricted result which applies to a smaller domain; the more general result is also valid in the narrower domain but many of its terms are irrelevant there (in a strict, mathematical, asymptotic sense). I don&#39;t want an incorrect result, I want a relevant result. And yes, it&#39;s a matter of simplifying the expression, but it is not trivial and that is precisely what I&#39;m asking for.", "675" ], [ "The documentation of [`ParallelTable`](_URL_0_) indicates that if you want to parallelize the evaluation of a table of more than one dimension, such as\r\n\r\n Table[f[i,j], {i, 5}, {j, 5}]\r\n\r\nit is often not enough to simply use `ParallelTable`, as this will in general only parallelize over the outermost index.\r\n\r\n > Parallelization happens along the outermost (first) index:\r\n > \r\n > ParallelTable[Labeled[Framed[f[i, j]], $KernelID], {i, 4}, {j, i}]\r\n > \r\n > ![](_URL_1_)\r\n > \r\n > ---\r\n > \r\n > Using multiple iteration specifications is equivalent to nesting Table functions:\r\n > \r\n > ParallelTable[i + j, {i, 3}, {j, i}]\r\n > \r\n > ![](_URL_3_)\r\n > \r\n > ParallelTable[Table[i + j, {j, i}], {i, 3}]\r\n > \r\n > ![](_URL_2_)\r\n\r\nIn some use cases (such as a relatively long computation to be run for a limited number of instances, say this five by five array, with more cores than each dimension, say eight kernels) this can be a significant under-use of system resources.\r\n\r\nThis can be overcome by joining the two indices into one multi-index and parallelizing over that, in the form\r\n\r\n ParallelTable[\r\n With[{i=index[[1]], j=index[[2]]},\r\n f[i,j]\r\n ],\r\n {index, Flatten[Array[List, {5, 5}], 1] }]\r\n\r\nbut this feels like a bad hack.\r\n\r\nIs there a cleaner way to make `ParallelTable` throw those bounds to the wind and simply hand out computation to any kernel that&#39;s free for it?", "739" ], [ "This is a small question regarding the relationship between the [`$DistributedContexts`](_URL_1_) variable and the [`ParallelEvaluate`](_URL_0_) command. Specifically, the Properties and Relations section of the documentation of the former documents the following behaviour:\r\n\r\n > Find all parallel functions that currently use `$DistributedContexts`:\r\n > \r\n > Select[Names[ \" ;System`Parallel* \" ;], \r\n > MemberQ[Options[Symbol[#]], \r\n > DistributedContexts : > $DistributedContexts] & ]\r\n > \r\n > ![](_URL_2_)\r\n\r\nHowever, if I evaluate that code I get \r\n\r\n { \" ;ParallelArray \" ;, \" ;ParallelCombine \" ;, \" ;ParallelDo \" ;, \" ;ParallelEvaluate \" ;, \" ;ParallelMap \" ;,\r\n \" ;ParallelProduct \" ;, \" ;ParallelSum \" ;, \" ;ParallelTable \" ;, \" ;ParallelTry \" ;}\r\n\r\nwhich differs from the above by the addition of `ParallelEvaluate`. I find this pretty bizarre, as that function is present since v7.0, and it is quite natural for it to have\r\n\r\n Options[ParallelEvaluate]\r\n \r\n (* - > {DistributedContexts : > $DistributedContexts}*)\r\n\r\nIs this behaviour version-dependent? Can someone explain why that function is missing from that list? Or is this simply a documentation bug?\r\n\r\n---\r\n\r\n**Update**: I have been in touch with WRI and they concur that this is a documentation bug, so it should probably be fixed in the next release.", "74" ], [ "Piling on: what&#39;s the deal with transporters needing human operators? For complex and high risk transport operations I can understand, but no Star Trek series ever seemed to progress to where the (otherwise highly advanced) computer could handle all aspects of transporting better than any human engineer. Heck, a computer can be a ship doctor, why not its transporter chief? (Pardon the word \" ;human \" ;, I mean to include most aliens and Data as well.)", "337" ], [ "I&#39;m not exactly sure why exactly this happens. However, the solution is explained by a Wolfram Community post by <PERSON> [here](_URL_2_), which is buried in a bunch of other things so I thought I would make it easier to find:\r\n\r\n > The issue is caused by the file that is supposed to make the prediction of your autocomplete better. Go to `$UserBaseDirectory/.Mathematica/SystemFiles/FrontEnd/SystemResources` `/FunctionalFrequency` and check the .m-file there. Everytime this happens to me, this file was several hundred MB large. Deleting it solves the problem.\r\n\r\nThat said, I still have no idea why this became an issue, or how exactly that file (`CodeAssistHistory10.3.m`) became so bloated.\r\n\r\n---\r\n\r\nIf you do run into this problem in the future, it&#39;s worth pointing out [this response](_URL_1_) by WRI autocompletion engineer <PERSON>), indicating that a bug report with the bloated file is probably helpful on the WRI end:\r\n\r\n > The files in this directory store your autocompletion history to help the system make accurate completions based on your past choices. Several hundred megabytes seems quite excessive. If anyone here encounters this problem again and there is a very large file in this directory, you can help me track down the problem by sending the file into tech support along with a description of the problem (assuming that deleting the file actually does cure the issue). I&#39;ll get notified and be better able to fix the issue.", "871" ], [ "Simon&#39;s [answer](_URL_1_) provides a good way to save clean versions of the file one is working on, but it is not particularly easy to automate. In particular, I was looking for a way to store *two* copies of the notebook I was working on - one with the output for ease of reading, and another one with the output stripped to commit to source control - and this should ideally happen automatically when saving the main file.\r\n\r\nSaving to a package file programmatically can be done as explained in [this answer](_URL_0_), and this leads to the following options code,\r\n\r\n SetOptions[\r\n EvaluationNotebook[],\r\n NotebookEventActions- > {\r\n { \" ;MenuCommand \" ;, \" ;Save \" ;}: > (\r\n FrontEndTokenExecute[\r\n FrontEnd`InputNotebook[],\r\n \" ;SaveRename \" ;,\r\n { \" ;CleanFile.m \" ;, \" ;Package \" ;}\r\n ];\r\n NotebookSave[];\r\n )\r\n }\r\n ];\r\n\r\nwhich will save a clean version to `CleanFile.m` whenever the main file is saved. I&#39;m not sure how much this matches the behaviour the OP was looking for, but this is probably still the best place to document it.", "92" ], [ "The question is not particularly clear or easy to understand. You already seem to have an acceptable answer but you should still edit your question for clarity for the benefit of future visitors (so they can understand whether the answer is what they&#39;re looking for or not). To be clear, you&#39;re looking to select the words from `listb` whose characters are a subset of the ones in `lista`? From the stated `listb`, what is the expected output? You&#39;ve stated that \" ;carefree \" ; is out, but which ones should it accept?", "421" ], [ "When a psychic uses one of his powers, he can tie it to a innate ‘slot’, the power stays as it has been used, with the sole exception that the Potential of the power is your Psychic Potential (or the minimum required to be able to use the power). \r\n\r\nThis means that when you Innate a power, it will stay in the same target.\r\n\r\nOn your example, you cannot ‘move’ your telekinesis to another target, if you want to affect a new target, you must use Telekinesis again, and either maintain it in a different Innate ‘slot’ or stop maintaining the old one. If you want to affect two different persons, you can divide your Potential to use two powers on the same turn, but both need to be in different Innate ‘slots’.\r\n\r\nThe Telekinesis power state that is one individual affected per use of power. Again, to affect both on the same turn you must divide your Potential. Besides it will be really strange to calculate Physical Resistances to escape the power…\r\n\r\n\r\nIf you are a Spanish speaker, I suggest you talk to the Spanish community in the [official site][1]. They are very knowledgeable and have access to Anima Studio (the creator of the game) official answers.\r\n\r\n\r\n [1]: _URL_0_", "271" ], [ "#As of v10.3, this is now possible\r\nusing the built-in commands [**`DEigensystem`**](_URL_1_) and [**`NDEigensystem`**](_URL_4_) functions. These work pretty much as you hope they would, along the lines of\r\n\r\n > `DEigensystem[ℒ[u[x, y, …]], u, {x, y, …} ∈ Ω, n]` \r\ngives the n smallest magnitude eigenvalues and eigenfunctions for the linear differential operator ℒ over the region Ω.\r\n\r\nHat-tip to <PERSON> for [pointing these out](_URL_2_) to me.\r\n\r\n\r\nAs a simple illustration, \r\n\r\n {eigenvalues[region], eigenfunctions[region]}=NDEigensystem[\r\n {-Laplacian[u[x,y], {x,y}],\r\n DirichletCondition[u[x,y]==0, True]}\r\n , u[x,y]\r\n , {x,y} ∈ region\r\n , 6\r\n ];\r\n Grid[Partition[Table[\r\n Show[{\r\n ContourPlot[\r\n eigenfunctions[region][[j]]\r\n , {x,y} ∈ region\r\n , Frame - > None, PlotPoints - > 60, PlotRange - > Full\r\n , PlotLabel - > eigenvalues[region][[j]]\r\n ],\r\n RegionPlot[region, PlotStyle - > None, BoundaryStyle - > {Black, Thick}]\r\n }]\r\n ,{j, 1, Length[eigenvalues[region]]}], 3]]\r\n\r\nproduces with, for example, a disk,\r\n\r\n region = Disk[]\r\n\r\nplots like\r\n\r\n![](_URL_5_)\r\n\r\nor with the star from above,\r\n\r\n With[{n=20},\r\n region=Polygon[Table[(1+(-1)^k/5) {Cos[2 Pi*k/n],Sin[2 Pi*k/n]},{k,1,n}]]\r\n ];\r\n\r\n![](_URL_6_)\r\n\r\nor for the implicit region with a hole,\r\n\r\n region = ImplicitRegion[1/4 < x^2 + y^2 & & x^4 + y^6 < = 1, {x, y}];\r\n\r\n![](_URL_7_)\r\n\r\n\r\nand even for the <PERSON> snowflake of user21, defined as\r\n\r\n lev = 3;\r\n boundaryLev = lev + 1;\r\n KochStep[{p1_, p2_}] := \r\n With[{q1 = p1 + (p2 - p1)/3, \r\n q2 = (p1 + (p2 - p1)/3) + RotationMatrix[-Pi/3].(p2 - p1)/3, \r\n q3 = p1 + 2 (p2 - p1)/3}, {p1, q1, q2, q3, p2}];\r\n KochStep[pp : {{_, _} ..}] := \r\n Join[Partition[Flatten[Most /@ (KochStep /@ Partition[pp, 2, 1])], \r\n 2], {pp[[-1]]}];\r\n KochVertices = \r\n Nest[KochStep, \r\n N@{{3 Sqrt[3]/4, 3/4}, {-3 Sqrt[3]/4, \r\n 3/4}, {0, -3/2}, {3 Sqrt[3]/4, 3/4}}, boundaryLev];\r\n region=Polygon[KochVertices];\r\n\r\nthe first nine eigenfunctions look like\r\n\r\n![](_URL_3_)\r\n\r\nor zooming in to the fourth one, using\r\n\r\n Plot3D[\r\n Quiet[eigenfunctions[region][[4]]]\r\n , {x, y} ∈ region\r\n , PlotRange - > Full\r\n , ImageSize - > 600\r\n , Boxed - > False, Axes - > False\r\n , BoxRatios - > {1, 1, 0.25}\r\n , MeshFunctions - > {#3 & }\r\n , PlotPoints - > 100\r\n ]\r\n\r\nyou get\r\n\r\n![](_URL_0_)\r\n\r\n\r\nThis is in no way meant to underappreciate the really good work by <PERSON> and user21, of course - just to say that you&#39;d hope for this functionality to be built-in and, since recently, it finally is.", "898" ], [ "Performance is the big reason. Creating a new slice and copying all the elements over to it is expensive, so the slice code doesn&#39;t copy without good reason. However, if you exceed the slice&#39;s capacity, it grows by a suitable amount by copying the underlying slice. That means that the slice that&#39;s returned from `append` may not be the same slice you passed in.\r\n\r\nThe preferred way to use is:\r\n\r\n args = append(args, newarg)\r\n\r\nIf you take a subslice, the capacity stays the same but your view into the slice changes. That means the missing elements are still there but outside the bounds of the new slice.\r\n\r\nThis explains the odd output of your code. You&#39;re printing the result of `append` each time but not storing that result, which means `args` isn&#39;t the same as what you printed.\r\n\r\nThe initial `args` slice is 3 elements big. For each index `i` - which is to say for `0`, `1` and `2` - you take a subslice `args[:i]` and append all the elements of the remainder of the array `args[i+1:]` to it. That means that for:\r\n\r\n i args[:i] args[i+1]... Result args\r\n 0 {} { \" ;3 \" ;, \" ;8 \" ;} { \" ;3 \" ;, \" ;8 \" ;} { \" ;3 \" ;, \" ;8 \" ;, \" ;8 \" ;}\r\n 1 { \" ;3 \" ;} { \" ;8 \" ;} { \" ;3 \" ;, \" ;8 \" ;} { \" ;3 \" ;, \" ;8 \" ;, \" ;8 \" ;}\r\n 2 { \" ;3 \" ;, \" ;8 \" ;} {} { \" ;3 \" ;, \" ;8 \" ;} { \" ;3 \" ;, \" ;8 \" ;, \" ;8 \" ;}\r\n\r\n\r\n**tl;dr** you should always save the result of `append`, and if you want to make a copy so you can change it then make a copy yourself.", "17" ], [ "I want to create an SVG that scales to the width of the container *without* the parts of it resizing or distorting. So depending on the width, the same image might be rendered as any of the following:\r\n\r\n\r\n[![enter image description here][1]][1]\r\n\r\n\r\nAs you can see, the left and right parts are (or at least appear to be) part of the same path, and they&#39;re the same size and aspect ratio in all cases.\r\n\r\nIt seems like the capabilities of SVG should allow this, but I don&#39;t know how. Obviously no graphics program will do this, so the SVG will need to be hand-crafted.\r\n\r\nPossible solutions:\r\n\r\n - Multiple objects: constructing the shape out of overlapping parts is an option, but risks messy overlap artefacts.\r\n\r\n - Image swap: I don&#39;t want to construct a fixed number of these sizes, because I can&#39;t anticipate every possible screen, window or device size. Instead I want an image that scales to whatever the size is.\r\n\r\n - JavaScript: I&#39;d really prefer to avoid this, as it requires every page or context the SVG is placed in to run a script to fix it.\r\n\r\n\r\n\r\n [1]: _URL_0_", "662" ], [ "Suppose I have a table with some data that are &#39;lumped&#39; around some central location, such as the dummy example\r\n\r\n i0 = 22.3;\r\n j0 = 34.1;\r\n table = Table[\r\n Exp[-((i - i0)^2 + (j - j0)^2)/10^2]\r\n , {i, 1, 50}, {j, 1, 50}\r\n ]\r\n\r\nwhich kind of looks like\r\n\r\n ListPointPlot3D[table, PlotRange - > Full]\r\n\r\n![Mathematica graphics](_URL_0_)\r\n\r\n**I would like to recover the centroid of the \" ;mass \" ; determined by the signal in my table**, i.e. in the case above, the tuplet `{i0,j0}`, in the cleanest way possible. I&#39;ve managed to do it in the obvious but expensive way with a bunch of explicit sums and products with explicit `Range`s, but it feels like there should be a built-in function that will do this ─ and I&#39;ve as yet been unable to find it.\r\n\r\nCan this be done? If so, how?", "898" ], [ "I was recently looking for contrast-uniform colormaps to produce a density plot for publication and among a bunch of nice resources (including in particular [this one](_URL_0_) and [this one](_URL_1_)) I found a nice paper,\r\n\r\n > Optimizing colormaps with consideration for color vision deficiency to enable accurate interpretation of scientific data, J.R. Nu&#241;ez, <PERSON> and <PERSON>, [arXiv:1712.01662](_URL_2_) (2017)\r\n\r\nwhich describes an algorithm and python code to take some given color gradient and make it safe for use on print and on publications that will be viewed by the general public (thus including a several-percent fraction of readers with color vision deficiencies):\r\n\r\n > We developed a Python module, cmaputil, to create [Color Vision Deficiency]-optimized colormaps, which imports colormaps and modifies them to be perceptually uniform in CVD-safe colorspace while linearizing and maximizing the brightness range\r\n\r\nIs there some existing facility within Mathematica to do this type of task?", "682" ], [ "Yes, you can create a Bucketable template that you can then set as a base template for any templates that you want to be bucketable as well. I used to do this in the past. In fact, I would have a base bucketable template and base bucket template that I would assign to templates so they would have those characteristics.\r\n\r\nThe Base bucket on the standard values, you could set the field __Is Bucket to true.\r\n\r\nThen on the Base bucketable, update the standard values item to set __Bucketable to true.\r\n\r\nThen just assign this base template to those 10 templates as a base template. Whenever you create a new item based on any of those ten base templates, it should be bucketable based on the inherited base template of that template.", "213" ], [ "I am trying to make a 3D contour plot of a complicated function over a large parameter range, and I am struggling a bit to make it compute nicely and in a reasonable length of time: more specifically, if I chop the range into chunks then I can get those in a reasonable time, but if I go for the whole range then it takes ages, and I&#39;m struggling to get a good compromise between recursion / `PlotPoints` / timing.\r\n\r\nHowever, I can get an *almost* good enough plot by just joining together the different chunks of the parameter range, including them inside a single `Show`:\r\n\r\n Show[{\r\n ContourPlot3D[\r\n (x - 2 Cos[z])^2 + (y - 2 Sin[z])^2\r\n , {x, -4, 4}, {y, -4, 4}, {z, 0, π}\r\n , Contours - > {1}\r\n , Mesh - > None\r\n ],\r\n ContourPlot3D[\r\n (x - 2 Cos[z])^2 + (y - 2 Sin[z])^2\r\n , {x, -4, 4}, {y, -4, 4}, {z, π, 2 π}\r\n , Contours - > {1}\r\n , Mesh - > None\r\n ]\r\n }\r\n , PlotRange - > All\r\n , BoxRatios - > {1, 1, 2}\r\n , ViewVertical - > {0, 1, 0}\r\n , ImageSize - > 600\r\n ]\r\n\r\n![Mathematica graphics](_URL_0_)\r\n\r\nHowever, that still leaves a mark where the two chunks get welded. \r\n\r\n**Is it possible to do this join seamlessly?**", "898" ], [ "This is more of an Azure feature question.\r\n\r\nYou can not stop an Azure Resource Group, because technically the resource group isn&#39;t running, but there is also no feature to disable or pause all of the resources in Azure currently. \r\n\r\nLike you said, you can pause the Web App roles, however, pausing them, does not remove all the costs of running those web app roles.\r\n\r\nThere is an open suggestion here: _URL_0_ related to adding in this support.\r\n\r\nMy suggestion for now, until Microsoft adds this feature (if they ever do), is to just delete the resource group. If you used an ARM Template to create the resource group and the roles within that, than use the same ARM Template to recreate it. If you didn&#39;t use an ARM template, than I would recommend using one of the existing Sitecore ARM templates and/or modifying it to meet your needs.", "433" ], [ "Paper isn&#39;t the same shape the world over. I have a document that I want to print differently when it&#39;s printed on A4 versus US Letter. Some elements should be hidden or shown. The obvious suggestion is to use a media query like so:\r\n\r\n @media print and (max-height: 280mm) {\r\n \t.a4-only {\r\n \t\tdisplay: none;\r\n \t}\r\n }\r\n\r\nThis doesn&#39;t appear to work, though, presumably because it&#39;s using the total document height or some irrelevant window height rather than the page height.\r\n\r\nIs there a way of addressing page size accurately?", "30" ], [ "The quick answer is that you should always use option #1 over option #2. When you make a request to `LookupManager.GetInformationByIp()`, this makes a direct service call to map the ip to a location. That might seem to be what you are trying to achieve, but there are several issues with that. Including some of the following:\r\n\r\n - No caching to return previously looked up Ip Addresses\r\n - Before Sitecore 9, or if you are using your own Geo IP Service, you could be looking up IP addresses unnecessarily, which will cause you to incur more credit expenses ($$$).\r\n - Subsequent IP Lookups will return results slower than if you returned them from local caching or lookup tables.\r\n\r\nUsing `GeoIpManager` will check internal caches and databases to see if that IP has been requested before, which will result in several benefits to your application. Some of the steps that take place include (these may vary based on the version of Sitecore):\r\n\r\n - Access Data Dictionary of recent lookups in memory\r\n - Access GeoIp Table of Ip Address Mappings\r\n - Use Service to Lookup Ip\r\n - Store resolved service ip to geo information in data dictionary/ip table.\r\n\r\nIt&#39;s also important to note that if you are just trying to get the current users country code for example, it probably would make more sense to use the current Tracker, using `Sitecore.Analytics.Tracker.Current.Interaction.GeoData.Country` will return a string value of the country.\r\n\r\nKeeping in mind that with most of the options above, you are unlikely to have the Geo Ip information available on the first page load (unless you run the service calls synchronously which isn&#39;t recommended).", "537" ], [ "Try this instead:\r\n\r\n _URL_0_\r\n\r\nIt should return a value for `__Display name` as well as all other standard field values.\r\n\r\nI just realized I didn&#39;t read all of the question. In the case of a multilist field (or any data field), the field only contains the raw ids, not any additional information. You would need to customize this service to return something else in this case. Or you can return the result, pull the values for the multilist and then query again using the API to get those display names (or any other fields you need).", "97" ], [ "If you need to personalize or A/B test the Header and Footer (or any other global presentation detail, than they cannot be statically rendered to the page.\r\n\r\nIn other words you cannot do:\r\n\r\n`@Html.Sitecore().Rendering( \" ;{guid} \" ;)`\r\n\r\nYou must apply a placeholder that applies the navigation or global elements to the page, so that they can be personalized. This is also known as `Dynamic Renderings` and is at the core of being able to use datasources and using different mechanisms to change the datasource based on conditions.\r\n\r\nTypically that would also mean that now you would have to have this navigation applied to every page item of your site. There are a couple of options you have to help reduce the amount of effort that this would require.\r\n\r\nYou could define a Base Template that includes information about the placement in Presentation Details in the Standard Values, and then apply that template to all of your Templates that would need it. I&#39;m not sure that would work too beautifully if this is a change you are making. That works better if it&#39;s a new build out.\r\n\r\nSecond option is that you could build something similar to SxA&#39;s feature `Partial Designs` that would basically be a way to define a grouping of presentation details and include that on a page. All modifications would happen on the grouping, and the pages would just inherit the changes you make to the grouping or partial design.", "340" ], [ "As <PERSON> mentions, you are doing it wrong. You have a page item that has fields on it, and then building components that pull fields from the current context item. As <PERSON> noted, you should always build components that are reusable with a data source (with fields) that are contained within another item. That way if you want to add 50 headline components to a page, you don&#39;t run into a scenario where you can&#39;t because you need to add another headline to your page template.\r\n\r\nHaving said all that, there is a way you can get around that. It&#39;s bad practice, and I highly recommend that you do not follow this. You could create on your headline component a rendering parameter. This rendering parameter would include the name of the field to pull from. Example, if you had on your context item 5 headline fields, such as (headline 1, headline 2, etc), you could specify in the rendering parameters that this component will pull in the value `headline 1`. Then on the second headline component on that same page, you could set the rendering parameters to pull from `headline 2`. This would also allow you to get around the issue of building 5 headline components for a page.\r\n\r\nBut like I said, this is a bad practice.", "1009" ] ]
418
[ 2616, 16941, 14329, 1277, 6790, 16475, 17252, 2561, 18138, 8475, 17697, 18224, 2166, 6940, 10715, 13624, 2063, 8855, 7925, 9675, 6913, 9961, 14856, 3928, 18557, 13266, 13623, 8745, 8881, 17913, 689, 5893, 17268, 8853, 10387, 2404, 4272, 18827, 9840, 1, 19251, 15767, 7679, 6843, 3240, 14359, 14345, 3793, 5263, 1100, 1873, 16834, 15224, 1393, 3172, 14098, 9600, 13870, 18039, 16617, 10046, 476, 5122, 13183, 16489, 6831, 1771, 725, 4944, 17945, 10328, 13830, 10761, 9136, 12280, 2458, 14424, 4226, 10470, 1801, 17050, 12432, 5920, 16691, 1402, 18402, 16152, 9433, 3134, 7350, 15519, 4348, 12222, 592, 1062, 12055, 11795, 19285, 11177, 14658, 18376, 1453, 18786, 3698, 4958, 3325, 2001, 9941, 972, 7881, 1709, 18360, 13523, 9023, 710, 17618, 14114, 11228, 18567, 17356, 13087, 2517, 5305, 2121, 6396, 2784, 15975, 3970, 4673, 2816, 17953, 15356, 18586, 13384, 15074, 18090, 97, 1923, 4033, 17888, 1670, 2542, 19320, 6424, 14028, 5320, 14197, 1158, 5546, 1331, 16518, 6972, 16776, 16195, 9403, 11229, 8825, 575, 11685, 14783, 5889, 805, 11635, 3371, 12307, 5752, 5318, 14459, 18748, 2742, 1922, 17490, 15184, 3603, 18167, 6452, 7256, 13062, 3127, 6422, 16435, 7525, 780, 5030, 5638, 1551, 350, 7655, 6618, 17766, 18914, 1503, 10319, 7605, 2920, 7918, 17941, 11125, 1772, 18001, 9997, 2890, 12715, 17239, 7067, 7916, 9612, 18010, 19507, 13734, 16900, 10644, 5894, 18915, 967, 4815, 7672, 1938, 8913, 16159, 5947, 7283, 10072, 17887, 18527, 1144, 11308, 12234, 7788, 16133, 10966, 18844, 18040, 1769, 7875, 8038, 15586, 12463, 11440, 1586, 11524, 4273, 14273, 10074, 19414, 7446, 17155, 17263, 7668, 15438, 6864, 4199, 11916, 9574, 1919, 13445, 6774, 9701, 348, 14434, 19420, 822, 12701, 15658, 11476, 12315, 4204, 16348, 2515, 7638, 1559, 4554, 9569, 5707, 12396, 3483, 19020, 14209, 904, 6696, 409, 1333, 16031, 16443, 12690, 8326, 9112, 18974, 7621, 8558, 9411, 5867, 4212, 442, 5526, 14919, 16495, 6617, 9376, 18353, 3821, 1171, 817, 711, 15439, 13379, 19058, 19547, 3067, 15857, 3733, 9198, 16208, 1959, 9702, 4344, 10973, 4205, 15925, 2697, 2155, 16407, 10361, 3335, 10149, 434, 2379, 17822, 1876, 14698, 17493, 3953, 17453, 6158, 15362, 9380, 10556, 17968, 3984, 10420, 16262, 16261, 13809, 10536, 18998, 3504, 4503, 11605, 6583, 1790, 19353, 17111, 5901, 15872, 3220, 3593, 1231, 6150, 1785, 4583, 985, 5761, 18331, 16138, 2853, 611, 4068, 1964, 18699, 17346, 2675, 2835, 7810, 9890, 19753, 2717, 2067, 19521, 8024, 6659, 15688, 16373, 15142, 3514, 5483, 5575, 11465, 18779, 1396, 8559, 15095, 3177, 6336, 8991, 3712, 16012, 3004, 8858, 5519, 6545, 557, 7733, 11302, 17670, 1145, 11573, 18622, 6876, 8524, 1304, 5963, 16456, 3662, 1003, 2719, 4036, 11878, 18116, 15719, 2415, 3282, 11267, 11235, 18002, 17125, 10295, 15642, 19256, 6514, 12112, 3880, 12566, 9866, 9439, 5735, 793, 10068, 8755, 551, 6646, 8676, 3342, 16907, 4578, 1712, 2227, 12223, 16089, 16171, 19084, 10065, 13150, 15355, 14565, 5161, 17936, 8485, 15537, 9482, 11749, 9807, 5673, 4884, 5634, 13510, 7415, 8711, 18314, 596, 12856, 18929, 8994, 8263, 15569, 8716, 18332, 10747, 16382, 15522, 5036, 16299, 19625, 12887, 1556, 13787, 11356, 19707, 8964, 3915, 19533, 5485, 16917, 6409, 15226, 4754, 494, 488, 978, 602 ]
STX_10000.0
[ [ "I install Magento 2 on IIS 7, it is working good, but on home page and all other pages including admin panel \r\na JavaScript error occurred\r\n\r\nthe error is :\r\n\r\n > NetworkError: 404 Not Found - _URL_1_; \r\n > SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data \r\n > `$.mage.translate.add(JSON.parse(string));`\r\n\r\nthen I explore location \r\n`/pub/static/frontend/Magento/luma/en_US/` and found that the file is there\r\nwhen open the file it is contain just two square bracket `[]`.\r\n\r\nthen i delete my old magento store and setup with new magento store with second level domain.\r\nbut still problem is not fixed, but another issue arise my admin penal stopped work.!\r\nnow the error look like\r\n\r\n > NetworkError: 404 Not Found - \r\n > _URL_0_;\r\n > SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data\r\n > $.mage.translate.add(JSON.parse(string));\r\n\r\ni dont know why magento show that file is not found, because it is already there \r\n\r\nI already delete folders in `pub/static` directory and then re-run the deploy command from cmd \r\n\r\n php bin/magento setup:static-content:deploy\r\n\r\nbut it is not work for me.\r\nis magento support IIS 7 ?\r\nis problem occurred due to iis ?", "136" ], [ "Firstly, you need all products collection then you get it product list as per manufacture.\r\nTry This\r\n\r\n $name = &#39;brand&#39;;\r\n $attributeInfo = Mage<IP_ADDRESS>getResourceModel(&#39;eav/entity_attribute_collection&#39;)- > setCodeFilter($name)- > getFirstItem();\r\n $attributeId = $attributeInfo- > getAttributeId();\r\n $attribute = Mage<IP_ADDRESS>getModel(&#39;catalog/resource_eav_attribute&#39;)- > load($attributeId);\r\n $attributeOptions = $attribute - > getSource()- > getAllOptions(false);\r\n \r\n $specificbrand = array();\r\n foreach ($attributeOptions as $_option)\r\n {\r\n \t$productcollection = Mage<IP_ADDRESS>getModel(&#39;catalog/product&#39;)- > getCollection()\r\n \t- > addAttributeToSelect(&#39;*&#39;)\r\n \t- > addAttributeToFilter($name, $_option[&#39;value&#39;]);\r\n \tforeach ($productcollection as $_product)\r\n \t{\r\n \t\tif($_option[&#39;label&#39;] == &#39;specificbrand&#39;)\r\n \t\t{\r\n \t\t\t$specificbrand[] = $_product- > getSku();\r\n \t\t}\r\n \t}\r\n } \r\n \r\n print_R($specificbrand);", "25" ], [ "I have magento2 installed in IIS server (version 7), problem is not load any js and css.\r\nI already have mod_rewrite is on and it is cheeked by this script.\r\n\r\n if(isset($_SERVER[&#39;IIS_UrlRewriteModule&#39;]))\r\n {\r\n $mod_rewrite = \" ;TRUE \" ;;\r\n }\r\n else\r\n {\r\n $mod_rewrite = \" ; FALSE \" ;;\r\n }\r\n echo $mod_rewrite; \r\nIts return me true.\r\nI also update the `app/etc/di.xml` and change \r\n\r\n`Magento\\Framework\\App\\View\\Asset\\MaterializationStrategy\\Symlink` \r\n\r\nto \r\n\r\n Magento\\Framework\\App\\View\\Asset\\MaterializationStrategy\\Copy\r\nthen delete _requirejs folder in `pub\\static` (only one dir `_requirejs` is there) but not work at all.\r\n\r\nI also try with this command \r\n\r\n php dev/tools/Magento/Tools/View/deploy.php\r\nbut in my installation there is no `View/location` folder in same path, path just end with `magentoroot\\dev\\tools\\Magento\\Tools`\r\n\r\nI also run this command \r\n\r\n php bin/magento setup:static-content:deploy\r\nand this also \r\n\r\n php bin/magento setup:static-content:deploy en_US\r\nbut both not work and not return anything.", "136" ], [ "I need a code to create order in Magento programmatically.\r\n\r\nI used this script for simple product order and it works good.\r\n\r\n\r\n require_once &#39;app/Mage.php&#39;; \r\n Mage::app(); \r\n $quote = Mage::getModel(&#39;sales/quote&#39;)\r\n - > setStoreId(Mage::app()- > getStore(&#39;default&#39;)- > getId());\r\n $customer = Mage::getModel(&#39;customer/customer&#39;)\r\n - > setWebsiteId(1)\r\n - > loadByEmail(&#39;<EMAIL_ADDRESS><IP_ADDRESS>app(); \r\n $quote = Mage<IP_ADDRESS>getModel(&#39;sales/quote&#39;)\r\n - > setStoreId(Mage<IP_ADDRESS>app()- > getStore(&#39;default&#39;)- > getId());\r\n $customer = Mage<IP_ADDRESS>getModel(&#39;customer/customer&#39;)\r\n - > setWebsiteId(1)\r\n - > loadByEmail(&#39;test@example.com&#39;);\r\n $quote- > assignCustomer($customer); \r\n $product = Mage<IP_ADDRESS>getModel(&#39;catalog/product&#39;)- > load(2770);\r\n $buyInfo = array(\r\n &#39;qty&#39; = > 1, \r\n );\r\n $quote- > addProduct($product, new Varien_Object($buyInfo)); \r\n $addressData = array(\r\n &#39;firstname&#39; = > &#39;Test&#39;,\r\n &#39;lastname&#39; = > &#39;Test&#39;,\r\n &#39;street&#39; = > &#39;Sample Street 10&#39;,\r\n &#39;city&#39; = > &#39;Somewhere&#39;,\r\n &#39;postcode&#39; = > &#39;123456&#39;,\r\n &#39;telephone&#39; = > &#39;123456&#39;,\r\n &#39;country_id&#39; = > &#39;US&#39;,\r\n &#39;region_id&#39; = > 12, // id from directory_country_region table\r\n ); \r\n $billingAddress = $quote- > getBillingAddress()- > addData($addressData);\r\n $shippingAddress = $quote- > getShippingAddress()- > addData($addressData);\r\n \r\n $shippingAddress- > setCollectShippingRates(true)- > collectShippingRates()\r\n - > setShippingMethod(&#39;freeshipping_freeshipping&#39;)\r\n - > setPaymentMethod(&#39;checkmo&#39;);\r\n $quote- > getPayment()- > importData(array(&#39;method&#39; = > &#39;checkmo&#39;));\r\n $quote- > collectTotals()- > save();\r\n $service = Mage<IP_ADDRESS>getModel(&#39;sales/service_quote&#39;, $quote);\r\n $service- > submitAll();\r\n $order = $service- > getOrder();\r\n printf( \" ;Created order %s\\n \" ;, $order- > getIncrementId());\r\n\r\nBut i also want to create order of grouped product as well as bundle product,\r\nI try with using grouped and bundle product id but it does not work", "173" ], [ "Just for fun, I tried to work this out a bit, and any answer would be very long. You&#39;d have to consider evacuations, which, with the tsunami&#39;s this thing would generate, would be unprecedented, like, half of the pacific coastal cities in the word would be evacuation recommendations. The debris fallout could affect anyone in the wind direction for a thousand or more miles, and they&#39;d need to take shelter probably underground and even with a 1 mile asteroid hitting ocean there could still be enough global dimming enough to create colder winters and food shortages for a few years.", "591" ], [ "There&#39;s a lot of overlap with Schwern&#39;s answer, which I upvoted, but I can try to finish it. The ocean and the meteor aren&#39;t just water though. The ocean is full of salt, the meteor full of sulfur compounds and silicates and ices including ammonia. Yes, the atmospheric haze would be much less than a land impact, but with a 1 mile object, there&#39;s still a good chance it would be significant, including some toxins. The calculations get way over my head but dimming might still be an issue even with an ocean impact.", "445" ], [ "Venus is hotter than Mercury, so there&#39;s more going on than just proximity. It&#39;s very thick atmosphere, greenhouse gas rich atmosphere is why it&#39;s so hot. Venus&#39; atmosphere is so good at trapping heat that it&#39;s the same temperature on the north pole mid winter than on the equator mid summer. It&#39;s the same temperature day and night, even though the nights last over a month.", "281" ], [ "Mass is mostly irrelevant, though you&#39;d probably want plate tectonics and that is thought to be related to mass. Something roughly Earth mass should be OK, anywhere from maybe 0.6-0.8 Earth masses, you might still get plate tectonics and have a magnetic field to up to 2 possibly 3 or 4 Earth masses. Note, 8 earth masses, equal density = 2 Earth gravities, so 2, 3 or even 4 earth masses wouldn&#39;t be over the top gravitation wise, but anything over 4 earth masses, you might run into problems with the planet retaining too much hydrogen which might interfere with oxygen formation and if it gets too heavy you lose plate tectonics, so, 3 or 4 earth masses might be the upper limit.\r\n\r\nRotation is important but flexible. You probably wouldn&#39;t want days that last 3 months like they do on Venus, but 8-10-12 hour days or even 48 hours might be OK, though the longer the day, you run the risk of scorching under the mid-day sun. If I was to choose, I&#39;d go with about 16 hour days. 8 hours of sunlight on average, to avoid too much mid-day heating.\r\n\r\nThe real trick is atmosphere and oceans. I think you&#39;d want a dry planet, cause too wet, water can be a powerful greenhouse gas and that close to the sun, the hotter it gets the more water would evaporate, and that&#39;s a problem. If you have a not entirely desert, but say 50% desert with tiny desert plants that suck the water out of the air, you could get a low heat trapping, rapidly cooling planet at night, with some spots of green on the wind side of the oceans where there would be more rain.\r\n\r\nSuch a situation might have high winds with all the rapid warming and cooling, but, that&#39;s what I&#39;m thinking might work.\r\n\r\nYou could also have a planet with many active volcanoes. Volcanoes help make the soil fertile, so it&#39;s not all bad. Volcanic soil over time can be very good, and with enough SO2 released in the air, that would increase reflectivity and create a haze of sorts over the planet, which would have a cooling (and darkening) effect. Personally, I&#39;d rather low water than haze - but pick your poison. I think you need one or the other. That&#39;s the only real answer to this question. Significantly lower greenhouse gas or significantly higher natural upper atmosphere reflection, either SO2 or perhaps tiny dust clouds constantly being kicked up into the higher atmosphere like Mars has. Venus is generally considered inside the <PERSON> zone, though that&#39;s not a well defined border, so you&#39;d need a pretty darn big heat reflection or lack of heat retention designed into the planet.\r\n\r\nVenus has sulfuric acid rain, and with enough SO2 to keep the planet cool, acid rain could be a problem, but with enough water (Venus has essentially no water), but with water to dilute it, the acidity would probably be manageable for life.\r\n\r\nA rather, perhaps unlikely idea could be natural formation of white rocks, sand and lighter colors. Plants, in abundant sunlight, might develop white leaves that reflect a lot of the sun away - why would plants do that naturally? Water retention and a cool undergrowth, with white leaves on top. The cool wet air like you get naturally in jungle would be the goal, and absorbing sunlight could be more secondary under a very bright sun. I&#39;m not saying that&#39;s likely, but it might be possible.", "281" ], [ "I like all the answers above. One possible method would be to build an envelope around the moon. This is an alternate to giving the planet an entire atmosphere, which it would periodically lose and need replenished, but it&#39;s still a gonzo engineering feet and the envelope would be subject to regular meteor strikes and punctures. It would need regular repair, or perhaps, some self repairing technology and leak plugging - that&#39;s no simple task.\r\n\r\nAnother method, which I like, would be to dig a very deep hole into the moon and have a kind of deep underground dwelling, with big fans to enable circulation and mirrors to reflect in sunlight.\r\n\r\nAs an earthly example, the Dead Sea is some 400 meters below sea level and as a result, it&#39;s atmosphere is about 5% more pressure. [Source][1]. On the Moon, with 1/6th the gravity of Earth, well, calculating it gets ugly, but if you dig a hole, some, 30-50 miles into the Moon&#39;s surface, perhaps at a steep incline to avoid direct sunlight but still take advantage of reflected sunlight. It might be possible.\r\n\r\nSomething, kind of like this but about 500 or 1,000 times bigger.\r\n\r\n[![enter image description here][2]][2]\r\n\r\nThe hole or whatever you call it (Atmosphere well?) should requires far less replenishment of atmosphere than the surface terraforming idea. There would still be some, you&#39;d need a light atmosphere around the entire moon to avoid too much loss and preserve most of the atmosphere in the deep hole, but it&#39;s more feasible than making the surface habitable. \r\n\r\nAnother alternative, with enough energy would be to generate to Oxygen directly from the silicate material of the moon, so the oxygen would be generated from within the hole.\r\n\r\nDigging deep into the Moon might provide water sources and other minerals as well. I&#39;m not sure anyone would want to live in a hole, but it beats living in a pressurized suit, never going outside. \r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "281" ], [ "The Earth&#39;s magnetic field doesn&#39;t reach close to the Moon, at least, not in a protective way, though the tail of or magnetic field (magnetotail) reaches about 1 1/2 to twice as far as the moon, but that&#39;s not much protection, only when the Moon is behind the Earth. The earth&#39;s magnetic field does protect the space station and our satellites for the most part.", "55" ], [ "With near-by contact and open communication (presumably pictures, videos & sounds) and back and forth. Clear teaching methods could be transmitted and all that&#39;s needed for communication would be for one to learn the other&#39;s language, not for each side to learn the others. I think it would happen pretty quickly.\r\n\r\nIt&#39;s a different ball game when you have reciprocity and you can work out Yes/No and build from there. (2+2=4) is yes (2+2=3) is no. A couple months max, I think, with top minds working on it. It can take years to work out ancient languages, but that&#39;s just a handful of tablets and ruins. Back and Forth with graphics and being interactive, much faster I would think, unless the languages are just light-years apart, then it might take longer, but I think a relatively short period of a couple months would likely be sufficient. I can&#39;t prove that, but that&#39;s my guess.", "133" ], [ "There is sence that every group and bundle product has a simple product and magento add all those simple product individual \r\nnot as full product sku of group or bundle, so we can use every product&#39;s sku in order\r\nfor example if we have group product with id 2828 & 2827 so we can order that grouped product like below\r\n\r\n < ?php\r\n require_once &#39;app/Mage.php&#39;; \r\n Mage::app(); \r\n ini_set(&#39;display_errors&#39;, 1);\r\n \r\n $skus = array(&#39;2828&#39;= > 1,&#39;2827&#39;= > 3); // 2828 & 282 are idproducts and 1 & 3 are Qty\r\n $email = &#39;<EMAIL_ADDRESS><IP_ADDRESS>app(); \r\n ini_set(&#39;display_errors&#39;, 1);\r\n \r\n $skus = array(&#39;2828&#39;= > 1,&#39;2827&#39;= > 3); // 2828 & 282 are idproducts and 1 & 3 are Qty\r\n $email = &#39;test@example.com&#39;;\r\n \r\n $quote = Mage<IP_ADDRESS>getModel(&#39;sales/quote&#39;)- > setStoreId(Mage<IP_ADDRESS>app()- > getStore(&#39;default&#39;)- > getId());\r\n $customer = Mage<IP_ADDRESS>getModel(&#39;customer/customer&#39;)- > setWebsiteId(1)- > loadByEmail($email);\r\n $quote- > assignCustomer($customer);\r\n foreach($skus as $key= > $val)\r\n {\r\n \t$quote[] = $quote- > addProduct(Mage<IP_ADDRESS>getModel(&#39;catalog/product&#39;)- > load($key), new Varien_Object(array(&#39;qty&#39; = > $val,)));\r\n }\r\n $addressData = array(\r\n \t&#39;firstname&#39; = > &#39;Test&#39;,\r\n \t&#39;lastname&#39; = > &#39;Test&#39;,\r\n \t&#39;street&#39; = > &#39;test Street 10&#39;,\r\n \t&#39;city&#39; = > &#39;test&#39;,\r\n \t&#39;postcode&#39; = > &#39;123456&#39;,\r\n \t&#39;telephone&#39; = > &#39;123456&#39;,\r\n \t&#39;country_id&#39; = > &#39;US&#39;,\r\n \t&#39;region_id&#39; = > 12,\r\n \t);\r\n $billingAddress = $quote- > getBillingAddress()- > addData($addressData);\r\n $shippingAddress = $quote- > getShippingAddress()- > addData($addressData);\r\n \r\n $shippingAddress- > setCollectShippingRates(true)- > collectShippingRates()\r\n \t\t\t\t\t- > setShippingMethod(&#39;freeshipping_freeshipping&#39;)\r\n \t\t\t\t\t- > setPaymentMethod(&#39;checkmo&#39;);\r\n $quote- > getPayment()- > importData(array(&#39;method&#39; = > &#39;checkmo&#39;));\r\n $quote- > collectTotals()- > save();\r\n $service = Mage<IP_ADDRESS>getModel(&#39;sales/service_quote&#39;, $quote);\r\n $service- > submitAll();\r\n $order = $service- > getOrder(); \r\n echo $order- > getIncrementId();", "25" ], [ "I want the search results to be ordered based on the maximum number of occurrences of search text in the documents. I am using sharepoint search api query in sharepoint online site.\r\n\r\nEx: If I search’s for \" ;Blow \" ;, and there are 100 documents with the word “Blow“, we should show the documents on top where “Blow” word is found more. i.e document with 50 times word found on top and document with 1 time word found on bottom of the list. \r\nThanks in advance.", "1012" ], [ "Some very nice answers. I&#39;ll add one more that as the Moon was slowly lowered to the Earth, it&#39;s tidal forces on the Earth would have an effect. You&#39;d get tides hundreds of feet high moving towards the moon. In some parts of the Earth you might see oceans withdraw from their shores to the point of no longer being visible. Other parts would find themselves entirely under water. Even before the Moon touches down, Earth would likely experience several large earthquakes from the tidal forces.\r\n\r\nUpon touching down and being released to gravity, things would get much worse. It would take only about 15 minutes or so (1/2 a t^2 for the diameter of the moon) for the Moon to push its way into the Earth and that pushing would not be pretty. Even touching the surface the Moon would still have enormous gravitational potential energy, enough to probably leave half the Earth a molten lava mess and the other half shaken and broken and flooded beyond all recognition and the air would be unbreathable and a wild guess, the sky would be black - for a few years. And enveloped in water vapor for many years after that until the surface cooled. Lets not actually do this. It wouldn&#39;t be a good day. \r\n\r\nA final point, it would be loud, and incredibly windy, but I&#39;m not sure the loudness would matter as the Earth was shaking like you&#39;d never seen it shake before.", "55" ], [ "That&#39;s a very nice answer to a very broad and complex question, so, 100% props. Only thing I strongly disagree with you on is \" ;Winds would not have been very strong, as little to no strong pressure gradient \" ;, that&#39;s an oversimplification as there would still be temperature variation equator to poll, and day to night, and altitude. The warmer air would hold more water which would serve as an energy transfer. You&#39;d have bigger rain storms, bigger floods and perhaps even bigger hurricanes. You&#39;d still have high wind in places. I may add an answer on winds, but it&#39;s a very complex topic.", "591" ], [ "It&#39;s an interesting puzzle, and some good answers already.\r\n\r\nThe thing to keep in mind is that stars are pretty much fixed in the sky at least on a human lifespan. Stars do move around somewhat, based on their [proper motion][1] (very slow) and [Earth&#39;s axial procession][2] (25,700 year cycle, give or take). Neither happens fast enough for what you&#39;re looking to do.\r\n\r\nWith sufficient gravitational interaction, you could increase the planet&#39;s wobble. See [this about Pluto&#39;s moons][3] or [Youtube video][4].\r\n\r\n[Saturn&#39;s Moon Hyperion][5] undergoes a similar shift. In both cases, what you need is two large gravitational bodies tugging on your planet. The planet can either orbit a binary system, keep in mind, it would need to be a somewhat distant orbit to be stable and that would be iffy.\r\n\r\nOr, your planet could orbit between two large bodies. The planet that comes closest to that situation in our solar system is Mars, which is tugged on by Jupiter as it orbits the sun. [Mars, while it&#39;s axis is prone to large shifts][6], it doesn&#39;t happen fast enough for what you describe.\r\n\r\nYou mention a super-earth. A faster rotation and larger equatorial bulge and perhaps, I would think, a less flat solar system could all assist a faster planetary wobble, which is what you&#39;d need.\r\n\r\nA planet trapped in a Jupiter Trojan or Hilda orbit might experience sufficient wobbles, maybe. A large enough mass could coalesce but still be prone to significant wobbles. I can&#39;t do the math on precisely how fast those wobbles might be, but that might be your best option.\r\n\r\nIt might be possible, however, to observe the direction the sun rises in combination with the stars and work something out. The details get a little bit tricky at my pay grade.\r\n\r\nI like the near the galactic core idea or the very short year too, but since those were already mentioned, no need to mention them again. You could also do some combination of the above. \r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_4_\r\n [3]: _URL_0_\r\n [4]: _URL_5_\r\n [5]: _URL_3_\r\n [6]: _URL_1_", "55" ], [ "Lets see, what part of the body can become stiff without a bone . . . oh, I know.\r\n\r\nBlood flow might work, a steady pressure of blood flow to maintain upright posture, which could be turned off when the body sleeps, or sits/lays down. It&#39;s not ideal. A bone maintains structure on it&#39;s own, while bloodflow requires energy, but it&#39;s possible.\r\n\r\nGiving the planet lower gravity might help too.", "382" ], [ "@L.Dutch I&#39;m not sure that&#39;s the point. A boron cell could (in theory) use something like photosynthesis to break up CH4 and pull hydrogen, for breathing hydrogen and for energy storage. Photosynthesis and blood don&#39;t go together on Earth, but perhaps in this scenario. The whole non carbon based life idea is replete with issues, but a type of photosynthesis might enable CH4 respiration.", "281" ], [ "@L.Dutch If the CH4 is hard to break up for the necessary hydrogen, then anything that breaks it up would be an advantage. But, to dial it back a bit, any chemical reaction that pulls hydrogen from Methane and releases carbon could be a net positive. To be honest, the more I think about this, it&#39;s starting to make my head hurt, but you may be right. CH4 is perhaps chemically reactive enough (unlike CO2) that it might not develop photosynthesis. Photosynthesis is necessary and came to be because cells need carbon and CO2 is so hard to break.", "162" ], [ "Do you need a rocky world or could you have an ice world. Europa doesn&#39;t have plate tectonics, just volcanism, but it completely resurfaced between probes sent to Jupiter. For that kind of velocity you need a liquid mantle, not a plasticy mantle like on Earth. More internal heat and a smaller planet, so less weight and pressure from above . . . Even so, your numbers feel impossible to me.", "281" ], [ "Xenon doesn&#39;t freeze or bind with other elements, so it&#39;s basically not around for planet formation. It&#39;s abundant enough in the universe overall, but I see no natural means how Xenon could accumulate in a planet&#39;s atmosphere at anywhere close to those amounts. H20, CH4, CO2, NH3, CO, to a lesser extent N2 (lower freezing point), those gasses all freeze and clump into comets and other icy bodies during solar-system formation. Xenon doesn&#39;t.", "281" ], [ "It kind of could happen with a few caveats. A warm planet would help, because warm air holds more water and the only mechanism for creating waterfalls is evaporation and weather systems. Water doesn&#39;t rise, unless it evaporates, then it rises. All the rain in the world is evaporated, risen water.\r\n\r\nSo you&#39;d need a warm planet with a strong weather system, perhaps a lower gravity planet, half way between Earth and Mars with lower surface gravity, and a more massive atmosphere, which would balance out with the lower gravity to a similar atmospheric pressure. More volume in the atmosphere would assist in more stored atmospheric water vapor.\r\n\r\nLower gravity would allow higher stable plateaus and cliffs and rain would fall slower and rivers flow with less force, causing less erosion. None of these factors in and of themselves is essential, but each helps.\r\n\r\nLower gravity also leads to [lower lapse rate][1], which means the atmosphere loses heat as air rises more slowly. Clouds could rise higher and there could be more of them. More atmosphere, warm air, so more water vapor and more rain to feed the waterfalls.\r\n\r\nThe 2nd problem is the shape or drop off, from the continent into the ocean. Granite/continental plates is lighter than Basalt rock that makes up most of the crust. Continents essentially float on the Earth&#39;s crust like corks in water.\r\n\r\n[![enter image description here][2]][2]\r\n\r\n[Source of image][3]\r\n\r\n[Oceanside cliffs do exist][4], but they&#39;re relatively rare, only a small percentage of total coastline. And oceanside waterfalls are even more rare, if they exist at all. That&#39;s the real problem, how to create abundant oceanside waterfalls. Rivers tend to flow somewhat steadily into oceans. They rarely fall from above.\r\n\r\nBut lets say we have a warm planet with abundant granite and high plateau land masses, mostly a couple/few miles above sea level. The weather on the land masses is warm/temperate, so there&#39;s enough water vapor and rain. The weather at sea level is balmy/hot, leading to high evaporation rates, formation of clouds which rise, create rain and disappear. Because much of the rain happens at lower elevation, much of the erosion happens there too, leaving high plateau land masses.\r\n\r\nThe waterfalls would mostly be cloud fed, not river fed. There will never be enough rivers to make entire coastlines of waterfalls. Rivers tend to combine as they flow down hill, they don&#39;t spread out, though there can be some spreading right on the coast.\r\n\r\nSo, basically this, at least, the left part of the diagram, but instead of a mountain, it&#39;s a plateau.\r\n\r\n[![enter image description here][5]][5]\r\n\r\nSo if you stood at the edge of the cliff overlooking the ocean, you&#39;d see clouds below you. You probably wouldn&#39;t see the ocean at all and you might (just maybe) hear the flow of water down the cliff below you, but it wouldn&#39;t be a traditional waterfall from the land above. It would look more like a continent wide waterfall flowing down the Oceanside cliffs from below.\r\n\r\nIts worth noting that we&#39;ve never seen a planet in another solar-system. So we don&#39;t really know what to expect, but many things are possible. Lower or higher gravity, certainly. Thicker or thinner atmospheres, hotter, colder, more water, less water more extreme seasons, due to higher axial tilt, higher winds. There&#39;s an enormous range of what might exist on other planets.\r\n\r\nAn entire coastline of waterfalls is problematic because rivers tend to cause grooves and combine as they flow downhill, so river based waterfalls should be local, not spread out. Glacial melt waterfalls might be more spread out, and maybe you could have a weather system where a glacier forms every winter and melts every summer, but glacial melt waterfalls would be periodic, like a flood, not permanent.\r\n\r\nSo, as others have said, not really possible, but some adjustments, you can sort of have that.\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_1_\r\n [3]: _URL_0_\r\n [4]: _URL_3_\r\n [5]: _URL_4_", "445" ], [ "I would have mad an answer similar to this. I&#39;ve taken pills for various issues, insomnia, ADHD, I even tried pills for depression, now it might sound like I&#39;m a chemical mess, but this is over a 20 year period. Pills for insomnia were the worst. Pills, at least the one I took, or depression, didn&#39;t do anything. I gave those up after 30 days. ADHD pills actually worked the best for what their objective was, but pills have issues, addiction, partial effect, side effects and crashes. They&#39;re not nearly the \" ;solution \" ; that the original poster suggests they might be. Pills are limited.", "916" ], [ "I&#39;m not talking about the Earth&#39;s shadow on the gas giant. It probably wouldn&#39;t create one anyway, but the gas giant would create a sizable shadow that could lead to some unexplained phenomenon observable by people on the far side of the planet/moon. And, I think you&#39;re wrong about seasons. All you need for seasons is axial tilt.", "55" ] ]
447
[ 16769, 7669, 8955, 2764, 9036, 9390, 9825, 6853, 8147, 9074, 7816, 14490, 3278, 4700, 3014, 10397, 1637, 16053, 2055, 15838, 1455, 10766, 2637, 13307, 7186, 5535, 184, 8220, 12314, 10960, 2947, 9603, 1215, 4491, 12980, 7601, 6057, 1275, 10866, 4649, 6907, 5300, 5645, 17930, 4794, 11230, 9733, 8668, 19674, 9337, 19262, 14174, 2240, 16679, 10303, 635, 8177, 12694, 14033, 8070, 368, 902, 5853, 11413, 18560, 8732, 6344, 9201, 13693, 8328, 14963, 13253, 16539, 12533, 1542, 13001, 2470, 16654, 7760, 17576, 14091, 10497, 19390, 17330, 12107, 19637, 15103, 9864, 6912, 8266, 7735, 3366, 247, 19403, 8208, 13185, 255, 4681, 18886, 5835, 2976, 14761, 10499, 5435, 5801, 413, 12351, 3823, 10433, 16700, 11905, 1164, 8910, 2002, 168, 5275, 623, 10125, 3893, 5439, 11426, 1714, 11760, 18333, 14009, 18264, 19569, 18145, 12009, 1953, 14975, 18869, 15902, 7015, 5571, 3071, 17284, 10409, 18250, 13136, 18340, 3805, 16979, 7990, 5068, 13457, 11451, 305, 14644, 440, 14824, 13362, 10721, 13003, 14664, 5388, 5781, 18416, 9881, 6087, 11356, 6046, 2357, 16161, 5962, 16562, 4904, 19554, 19046, 12973, 8160, 18441, 5646, 18987, 1801, 1091, 16079, 11536, 11858, 18400, 10712, 6102, 708, 330, 8922, 6387, 1039, 11381, 11711, 1582, 669, 15712, 8624, 306, 2623, 19111, 7543, 16888, 16408, 12848, 12800, 13977, 17130, 7548, 2173, 9357, 17406, 13223, 16246, 6586, 5449, 1506, 10596, 8722, 12915, 657, 4896, 11165, 12615, 9530, 18002, 8942, 19206, 7126, 3377, 1125, 10185, 1468, 9373, 13428, 2177, 2959, 7439, 12935, 1261, 4208, 13541, 3951, 1230, 13841, 5065, 15990, 405, 18314, 9777, 16013, 14247, 2628, 19140, 2113, 938, 10330, 2420, 3795, 13320, 5016, 4260, 13034, 13275, 16118, 4016, 17801, 9277, 278, 2355, 12305, 13472, 6755, 15870, 637, 4817, 12972, 16132, 1023, 12488, 4648, 6230, 110, 14550, 15956, 8822, 12192, 2032, 9746, 14506, 18536, 11706, 6734, 18852, 7721, 19274, 1937, 5178, 9259, 10795, 8497, 5881, 1696, 4221, 13230, 1595, 8284, 15302, 3451, 2561, 8648, 7621, 2829, 3700, 984, 5921, 13561, 16526, 4459, 18046, 449, 3371, 15290, 17688, 18373, 774, 14823, 17769, 3193, 8680, 18535, 13793, 4468, 19412, 921, 10156, 17463, 16310, 10472, 11629, 672, 7031, 8144, 1297, 17572, 10641, 5970, 6363, 18246, 6367, 15792, 10048, 5077, 2651, 14603, 17168, 5807, 10911, 9700, 16708, 3840, 9994, 2626, 16593, 17337, 1089, 18834, 8501, 7807, 9924, 6070, 12733, 2840, 1732, 12857, 1668, 10610, 15158, 12981, 3120, 16800, 14337, 499, 3817, 4746, 16363, 6010, 12106, 10759, 18450, 12783, 6753, 17654, 6508, 16282, 970, 2168, 14962, 5401, 14008, 19044, 3351, 15868, 1324, 11992, 6693, 11032, 2024, 19066, 18830, 9958, 17183, 7890, 12420, 11181, 7483, 16300, 491, 10118, 18225, 1404, 18791, 10469, 8087, 2070, 18776, 15520, 11273, 14221, 2480, 7810, 6396, 18618, 13059, 1124, 5100, 12953, 5750, 10562, 17514, 4081, 6580, 14605, 19362, 6496, 4960, 2546, 18595, 7403, 3514, 5458, 8271, 14392, 3844, 7147, 10872, 9225, 6876, 140, 3548, 13063, 18903, 5429, 9286, 17699, 2535, 3004, 8096, 6649, 12343, 12775, 18331, 2571, 1671, 4527, 16469, 10019, 10767, 1030, 6331, 10155, 5421, 10654, 15026, 10059, 19356, 2778, 8385, 944, 1788, 2609, 7220, 10083, 8331, 19162, 8272, 11436, 2239, 17964, 13450, 4813, 13807, 6680, 18974 ]
STX_1000011.0
[ [ "How do I format the column headers in handsontable?\r\n\r\nI have a [jsfiddle][1] to demonstrate what I have so far. I can format the first row of data change the column headers to my titles but I can&#39;t seem to format the column headers.\r\n\r\n var secondData = [\r\n [ \" ;2008 \" ;, -0.5, 2, 2.2, -7],\r\n [ \" ;2009 \" ;, -0.1, 3, 4.2, -2.6],\r\n [ \" ;2010 \" ;, 3, 2, -1, 1]\r\n ];\r\n \r\n var secondHeader = [\r\n {title: \" ;Year \" ;, type: &#39;text&#39;},\r\n {title: \" ;Kia \" ;, type: &#39;numeric&#39;, format: &#39;0.0%&#39;, renderer: percentRenderer},\r\n {title: \" ;Nissan \" ;, type: &#39;numeric&#39;, format: &#39;0.0%&#39;, renderer: percentRenderer},\r\n {title: \" ;Toyota \" ;, type: &#39;numeric&#39;, format: &#39;0.0%&#39;, renderer: percentRenderer},\r\n {title: \" ;Honda \" ;, type: &#39;numeric&#39;, format: &#39;0.0%&#39;, renderer: percentRenderer}\r\n ];\r\n \r\n $( \" ;#headerGrid \" ;).handsontable({\r\n data: secondData,\r\n columns: secondHeader,\r\n minSpareCols: 0,\r\n minSpareRows: 0,\r\n rowHeaders: false,\r\n colHeaders: true,\r\n contextMenu: true,\r\n cells: function (row, col, prop) {\r\n var cellProperties = {};\r\n if (row === 0) {\r\n cellProperties.renderer = firstRowRenderer; \r\n }\r\n return cellProperties;\r\n }\r\n });\r\n \r\n function percentRenderer (instance, td, row, col, prop, value, cellProperties) {\r\n Handsontable.renderers.NumericRenderer.apply(this, arguments);\r\n td.style.color = (value < 0) ? &#39;red&#39; : &#39;green&#39;;\r\n };\r\n \r\n function firstRowRenderer(instance, td, row, col, prop, value, cellProperties) {\r\n Handsontable.renderers.TextRenderer.apply(this, arguments);\r\n td.style.fontWeight = &#39;bold&#39;;\r\n td.style.color = &#39;green&#39;;\r\n td.style.background = &#39;#CEC&#39;;\r\n }\r\n\r\n\r\n\r\n\r\n [1]: _URL_0_", "990" ], [ "In my tests, the other answers take ~150-300ms on a 118.5k line file.\r\nThe following takes 1ms but is only approximate (reports 117k lines) and is dependent on each line being of similar size.\r\n\r\n private static void countSize(File file) {\r\n long fileLength = file.length();\r\n BufferedReader reader = null;\r\n try {\r\n reader = new BufferedReader(new FileReader(file));\r\n //Skip header as it is of different size\r\n reader.readLine();\r\n String text = reader.readLine();\r\n int lineLength = text.length();\r\n long lines = fileLength / lineLength;\r\n System.out.println(lines);\r\n } catch(IOException e) {\r\n e.printStackTrace();\r\n } finally {\r\n if(reader != null) {\r\n try {\r\n reader.close();\r\n } catch(IOException e) {\r\n //no-op\r\n }\r\n }\r\n }\r\n }", "782" ], [ "The third option is that Handsontable has its own CSS for `th` that you need to override for cell formatting. If you want a single header to change you can modify the CSS like this:\r\n\r\n .handsontable th:nth-child(1){\r\n background-color:aquamarine;\r\n font-weight:bold;\r\n }\r\n\r\nThe `columns` property also takes HTML in the title so you can add a `span` and style the text (but not the cell) in CSS.\r\n\r\n var secondHeader = [\r\n {title: \" ;Year \" ;, type: &#39;text&#39;},\r\n {title: \" ;Kia \" ;, type: &#39;numeric&#39;, format: &#39;0.0%&#39;, renderer: percentRenderer},\r\n {title: \" ; < span class=&#39;headerBold&#39; > Nissan < /span > \" ;, type: &#39;numeric&#39;, format: &#39;0.0%&#39;, renderer: percentRenderer},\r\n {title: \" ;Toyota \" ;, type: &#39;numeric&#39;, format: &#39;0.0%&#39;, renderer: percentRenderer},\r\n {title: \" ;Honda \" ;, type: &#39;numeric&#39;, format: &#39;0.0%&#39;, renderer: percentRenderer}\r\n\t\r\n ];\r\n \r\n span.headerBold{\r\n font-weight:bold;\r\n }\r\n\t\r\n\r\nThe jsfiddle has been updated _URL_0_", "626" ], [ "I have a view in Oracle that uses `PIVOT` and I would like to apply it to an h2 database. However, Pivot is not yet supported in h2.\r\n\r\nI am currently using `CASE` statements to do the pivot which is fine for now.\r\n\r\nHowever, I am intrigued by user defined functions in h2.\r\n\r\nIs it possible to create a generic `PIVOT` function in h2 by using user defined functions? Has anyone already done it?", "3" ], [ "How can I download OracleXE using wget and avoid the login?\r\n\r\nI tried applying logic from [this question for Oracle Java][1] but I couldn&#39;t get it to work.\r\n\r\n wget --no-check-certificate --no-cookies --header \" ;Cookie: oraclelicense=accept-securebackup-cookie \" ; _URL_0_ .0.x86_64.rpm.zip\r\n \r\nI get:\r\n \r\n --2015-10-13 04:51:03-- _URL_0_.0.x86_64.rpm.zip\r\n Resolving _URL_7_ (_URL_7_)... <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, ...\r\n Connecting to _URL_7_ (_URL_7_)|<IP_ADDRESS>|:80... connected.\r\n HTTP request sent, awaiting response... 302 Moved Temporarily\r\n Location: _URL_1_ [following]\r\n --2015-10-13 04:51:03-- _URL_1_\r\n Resolving _URL_4_ (_URL_4_)... <IP_ADDRESS>, <IP_ADDRESS>\r\n Connecting to _URL_4_ (_URL_4_)|<IP_ADDRESS>|:443... connected.\r\n HTTP request sent, awaiting response... 302 Moved Temporarily\r\n Location: _URL_5_ [following]\r\n --2015-10-13 04:51:03-- _URL_5_\r\n Resolving _URL_6_ (_URL_6_)... <IP_ADDRESS>, <IP_ADDRESS>\r\n Connecting to _URL_6_ (_URL_6_)|<IP_ADDRESS>|:443... connected.\r\n HTTP request sent, awaiting response... 200 OK\r\n Length: 2051 (2.0K) [text/html]\r\n Saving to: ‘oracle-xe-11.2.0-1.0.x86_64.rpm.zip’\r\n \r\n 100%[====================================================================================================================================================== > ] 2,051 --.-K/s in 0s\r\n \r\n 2015-10-13 04:51:03 (142 MB/s) - ‘oracle-xe-11.2.0-1.0.x86_64.rpm.zip’ saved [2051/2051]\r\n\r\n\r\n [1]: _URL_3_", "381" ], [ "I have a vagrant/puppet project in source control that requires some dependencies to be downloaded.\r\nHowever, these dependencies are on a password protected nexus instance.\r\n\r\nIf I use wget with `--username` and `--password` I can download the files, however, I can&#39;t check in my username and password to source control.\r\n\r\nI don&#39;t want to ask people to make modifications to the source files (by putting in their usernames/passwords) after they check out as I prefer projects to just run.\r\n\r\nIs it possible to use an encrypted password with wget or curl?\r\n\r\nI can&#39;t just set permissions on a file as it is a vagrant box and developers will have full root access.", "915" ], [ "I am running a simple log in test using PhantomJS 1.9.8 and Selenium 2.42.2. Everything is setup with maven and I am using embedded Jetty 8.1.14.v20131031.\r\n\r\nBefore starting jetty I also add all the webjars to `org.eclipse.jetty.webapp.WebAppContext#setExtraClasspath`\r\n\r\nMy login.jsp is using webjars to reference jquery.\r\n\r\n < script src= \" ;webjars/jquery/1.10.2/jquery.js \" ; > < /script > \r\n\r\nWhen I run my test I get the following error:\r\n\r\n Session [81d93a00-9101-11e5-bc34-79a9cbd8ffe4] - page.onError - msg: ReferenceError: Can&#39;t find variable: $\r\n\r\nIf I change the login.jsp to the full URL the test passes.\r\n\r\n < script src= \" ;_URL_0_;\r\n\r\nIs it PhantomJS that is having a problem reading from the webjars or is it Jetty not serving them?", "64" ], [ "The key was to iterate over the webjars and add each as a classpath resource.\r\n\r\n //Ensure that webjars are visible as they are packaged in META-INF/resources\r\n ResourcePatternResolver patternResolver = new PathMatchingResourcePatternResolver();\r\n Resource[] webjarResources = patternResolver.getResources( \" ;classpath*:/META-INF/resources \" ;);\r\n String[] resources = new String[webjarResources.length + 1];\r\n for(int i = 0; i < webjarResources.length; i++) {\r\n Resource webjarResource = webjarResources[i];\r\n resources[i] = webjarResource.getURI().toString();\r\n }\r\n\r\n //Try to find the webapp source regardless of the current working directory\r\n URL resource = this.getClass().getClassLoader().getResource( \" ;app.properties \" ;);\r\n String resourcePath = resource.getPath();\r\n String root = resourcePath.substring(0, resourcePath.lastIndexOf( \" ;myapp \" ;));\r\n String path = root + \" ;myapp/src/main/webapp \" ;;\r\n File webAppDir = new File(path);\r\n\r\n resources[resources.length - 1] = webAppDir.getAbsolutePath();\r\n webapp.setBaseResource(new ResourceCollection(resources));", "473" ], [ "Part of my web app has configuration that requires a file upload. This is currently implemented using AngularJS\r\n\r\n < div ng-file-drop= \" ;onFileSelected($files) \" ; > Upload Files < /div > \r\n\r\nDropping a file from the filesystem using Selenium seems nearly impossible and the SendKeys method wont work here as all I have is a `div` and not an `input`.\r\n\r\nThe alternative seems to be to call the Angular function directly.\r\nHow would I do this?", "973" ], [ "I am using Selenium and PhantomJS to do integration testing on my web app.\r\n\r\nWhen something goes wrong, how do I debug the Javascript?\r\n\r\nCan I connect with Firefox Developer Tools using Valence?\r\n\r\nNote: I already save a screenshot and the page source when the test fails. What I want to do now is set break points and step through the code.", "64" ], [ "The bootstrap pagination control doesn&#39;t appear to have an option to set the number of rows per page on the UI.\r\n\r\nI have seen lots of pagination controls based on bootstrap but very few have this option.\r\n\r\n[bs_pagination][1] comes close, however, it seems to just be a fixed value in the settings rather than an array.\r\n[![enter image description here][2]][2]\r\n\r\n[jeasyui][3] can do it but the license is not compatible with my project and it has a style of its own.\r\n[![enter image description here][4]][4]\r\n\r\nSomething like [Angular UI Pagination][5] would fit well with the project but I don&#39;t know how to handle the missing \" ;rows per page \" ; component.\r\n\r\nIs there something pre-built for what I want?\r\nIf not, how would I go about adding it to an existing control?\r\n\r\nEDIT: I have tried adding a control to the Angular UI component using Bootstrap input groups but I end up with a really wide select box with massive amounts of padding in the grouped control.\r\n_URL_2_\r\n\r\n < div class= \" ;input-group \" ; > \r\n < span class= \" ;input-group-addon \" ; > \r\n < uib-pagination total-items= \" ;bigTotalItems \" ; ng-model= \" ;bigCurrentPage \" ; max-size= \" ;maxSize \" ; boundary-links= \" ;true \" ; rotate= \" ;true \" ; num-pages= \" ;numPages \" ; previous-text= \" ; & lsaquo; \" ; next-text= \" ; & rsaquo; \" ; first-text= \" ; & laquo; \" ; last-text= \" ; & raquo; \" ; > < /uib-pagination > \r\n < /span > \r\n < span class= \" ;input-group-addon \" ; > \r\n < select id= \" ;numbers \" ; class= \" ;form-control \" ; > \r\n < option > 1 < /option > \r\n < option > 2 < /option > \r\n < option > 3 < /option > \r\n < option > 4 < /option > \r\n < option > 5 < /option > \r\n < /select > \r\n < /span > \r\n < /div > \r\n\r\n\r\n\r\n [1]: _URL_4_\r\n [2]: _URL_1_\r\n [3]: _URL_3_\r\n [4]: _URL_5_\r\n [5]: _URL_0_", "843" ], [ "I have created a select box in two different ways with AngularJS. One with static options in the HTML and ng-model and one with ng-options.\r\n\r\nBoth populate the select box, however, when a value comes back from the REST API the select box stays blank.\r\n\r\nThe docs suggest tracking by id.\r\n\r\n < select id= \" ;delimiter \" ; name= \" ;delimiter \" ; ng-model= \" ;config.delimiter \" ;\r\n ng-options= \" ;_URL_0_ for option in data.availableOptions track by _URL_1_ \" ; > \r\n < /select > \r\n\r\n $scope.data = {\r\n availableOptions: [\r\n {id: &#39;44&#39;, name: &#39;Comma&#39;},\r\n {id: &#39;9&#39;, name: &#39;Tab&#39;},\r\n {id: &#39;32&#39;, name: &#39;Space&#39;},\r\n {id: &#39;124&#39;, name: &#39;Pipe&#39;},\r\n {id: &#39;59&#39;, name: &#39;Semi-Colon&#39;},\r\n {id: &#39;58&#39;, name: &#39;Colon&#39;}\r\n ],\r\n selectedOption: {id: &#39;44&#39;, name: &#39;Comma&#39;} //This allegedly sets the default value of the select in the ui\r\n };\r\n \r\n //Truncated version of what happens after API call\r\n $scope.config = $scope.result.selectedConfig;\r\n\r\nThe data that comes from the server contains the numbers i.e. the ids.\r\nThe config option is supposed to have the delimiter set on it and then the select box is supposed to select the correct item, but it doesn&#39;t.\r\n\r\nHowever, a simple example like this DOES work at selecting the correct item so it must be something with the binding after the REST call.\r\n\r\n < body ng-app ng-controller= \" ;AppCtrl \" ; > \r\n < div > \r\n < label > Delimiter < /label > \r\n < select ng-model= \" ;mydelimiter \" ; > \r\n < option value= \" ;44 \" ; > Comma < /option > \r\n < option value= \" ;9 \" ; > Tab < /option > \r\n < option value= \" ;32 \" ; > Space < /option > \r\n < option value= \" ;124 \" ; > Pipe < /option > \r\n < option value= \" ;59 \" ; > Semi-Colon < /option > \r\n < option value= \" ;58 \" ; > Colon < /option > \r\n < /select > \r\n < /div > \r\n < /body > \r\n \r\n function AppCtrl($scope) {\r\n $scope.mydelimiter = &#39;59&#39;;\r\n }", "196" ], [ "I have two same-sized tables on the same page.\r\nHow can I link the scrolling between them so that when I scroll to the right at the top it also scrolls to the right at the bottom etc?\r\n\r\n_URL_0_\r\n\r\n \r\n < div class= \" ;scroll-left \" ; > \r\n < div id= \" ;example1 \" ; > < /div > \r\n < /div > \r\n < div class= \" ;scroll-right \" ; > \r\n < div id= \" ;example2 \" ; > < /div > \r\n < /div > \r\n \r\n document.addEventListener( \" ;DOMContentLoaded \" ;, function() {\r\n \r\n function getData() {\r\n var data = [\r\n [1,2,4,5,6,7,8,9,0],[0,0,0,0,0,0,0,0,0,0],[1,2,3,4,5,6,7,8,9,0],\r\n [1,2,4,5,6,7,8,9,0],[0,0,0,0,0,0,0,0,0,0],[1,2,3,4,5,6,7,8,9,0],\r\n [0,0,0,0,0,0,0,0,0],[1,2,3,4,5,6,7,8,9,0],[0,0,0,0,0,0,0,0,0,0],\r\n [0,0,0,0,0,0,0,0,0],[1,2,3,4,5,6,7,8,9,0],[0,0,0,0,0,0,0,0,0,0],\r\n [1,2,4,5,6,7,8,9,0],[0,0,0,0,0,0,0,0,0,0],[1,2,3,4,5,6,7,8,9,0],\r\n [1,2,4,5,6,7,8,9,0],[0,0,0,0,0,0,0,0,0,0],[1,2,3,4,5,6,7,8,9,0],\r\n [0,0,0,0,0,0,0,0,0],[1,2,3,4,5,6,7,8,9,0],[0,0,0,0,0,0,0,0,0,0],\r\n [0,0,0,0,0,0,0,0,0],[1,2,3,4,5,6,7,8,9,0],[0,0,0,0,0,0,0,0,0,0],\r\n [1,2,4,5,6,7,8,9,0],[0,0,0,0,0,0,0,0,0,0],[1,2,3,4,5,6,7,8,9,0],\r\n [1,2,4,5,6,7,8,9,0],[0,0,0,0,0,0,0,0,0,0],[1,2,3,4,5,6,7,8,9,0],\r\n [0,0,0,0,0,0,0,0,0],[1,2,3,4,5,6,7,8,9,0],[0,0,0,0,0,0,0,0,0,0],\r\n [0,0,0,0,0,0,0,0,0],[1,2,3,4,5,6,7,8,9,0],[0,0,0,0,0,0,0,0,0,0],\r\n [1,2,4,5,6,7,8,9,0],[0,0,0,0,0,0,0,0,0,0],[1,2,3,4,5,6,7,8,9,0],\r\n [1,2,4,5,6,7,8,9,0],[0,0,0,0,0,0,0,0,0,0],[1,2,3,4,5,6,7,8,9,0],\r\n [0,0,0,0,0,0,0,0,0],[1,2,3,4,5,6,7,8,9,0],[0,0,0,0,0,0,0,0,0,0],\r\n [0,0,0,0,0,0,0,0,0],[1,2,3,4,5,6,7,8,9,0],[0,0,0,0,0,0,0,0,0,0]\r\n ];\r\n return data;\r\n }\r\n \r\n var example1 = document.getElementById(&#39;example1&#39;);\r\n var example2 = document.getElementById(&#39;example2&#39;);\r\n \r\n var hot1 = new Handsontable(example1, {\r\n data: getData(),\r\n rowHeaders: true,\r\n colHeaders: true,\r\n });\r\n \r\n var hot2 = new Handsontable(example2, {\r\n data: getData(),\r\n rowHeaders: true,\r\n colHeaders: true,\r\n });\r\n \r\n \r\n \r\n });", "882" ], [ "This might be a bit late for you but I have an example that fakes a REST service using a function.\r\nYou can modify it to put in a real REST call instead.\r\n_URL_3_\r\n\r\n < !-- begin snippet: js hide: false -- > \r\n\r\n < !-- language: lang-js -- > \r\n\r\n\r\n function MainCtrl($scope) {\r\n this.settings = {\r\n\r\n };\r\n this.data = [\r\n [ \" ;Year \" ;, \" ;Kia \" ;, \" ;Nissan \" ;, \" ;Toyota \" ;, \" ;Honda \" ;],\r\n [ \" ;2008 \" ;, 10, 11, 12, 13],\r\n [ \" ;2009 \" ;, 20, 11, 14, 13],\r\n [ \" ;2010 \" ;, 30, 15, 12, 13]\r\n ];\r\n var that = this;\r\n $scope.fakeRestRequest = function () {\r\n var restData = [\r\n [ \" ;Year \" ;, \" ;Kia \" ;, \" ;Mazda \" ;, \" ;Toyota \" ;, \" ;Honda \" ;],\r\n [ \" ;2018 \" ;, 13, 41, 12, 13],\r\n [ \" ;2019 \" ;, 23, 41, 14, 13],\r\n [ \" ;2020 \" ;, 33, 45, 12, 13]\r\n ];\r\n that.data = restData;\r\n };\r\n }\r\n\r\n angular\r\n .module(&#39;app&#39;, [&#39;ngHandsontable&#39;])\r\n .controller(&#39;MainCtrl&#39;, MainCtrl);\r\n \r\n\r\n < !-- language: lang-html -- > \r\n\r\n < !DOCTYPE html > \r\n < html data-ng-app= \" ;app \" ; > \r\n\r\n < head > \r\n < script src= \" ;_URL_0_;\r\n < script src= \" ;_URL_4_;\r\n < script src= \" ;_URL_1_;\r\n\r\n < link rel= \" ;stylesheet \" ; href= \" ;_URL_2_; / > \r\n\r\n < /head > \r\n\r\n < body ng-controller= \" ;MainCtrl as ctrl \" ; > \r\n < h2 > Handsontable Stackoverflow REST Question < /h2 > \r\n\r\n < div id= \" ;grid \" ; > \r\n < hot-table\r\n col-headers= \" ;true \" ;\r\n row-headers= \" ;false \" ;\r\n datarows= \" ;ctrl.data \" ;\r\n settings= \" ;ctrl.settings \" ; > \r\n < /hot-table > \r\n < /div > \r\n \r\n < button type= \" ;button \" ; ng-click= \" ;fakeRestRequest() \" ; > Update Data < /button > \r\n \r\n < /body > \r\n\r\n < /html > \r\n\r\n < !-- end snippet -- >", "806" ], [ "I have a REST application that reads from a database repository.\r\n\r\nI want to add a command line application that reads a CSV and imports the data to the database.\r\n\r\nIf I add another `@SpringBootApplication` class that implements `CommandLineRunner` to the project/jar, Spring starts it at the same time as my main server.\r\n\r\nIf I add a class that initialises the spring context itself, the jdbc url on the JPARepository uses the defaults instead of those from the spring boot properies\r\n\r\n spring.datasource.url=jdbc:h2:file:./test;AUTO_SERVER=TRUE;DB_CLOSE_ON_EXIT=FALSE\r\n\r\n @ComponentScan(basePackages = \" ;com.test \" ;)\r\n public class CsvImport {\r\n\r\n @Autowired\r\n private Repository repository;\r\n\r\n public static void main(String[] args) {\r\n AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(CsvImport.class);\r\n context.start();\r\n\r\n CsvImport csvImport = context.getBean(CsvImport.class);\r\n File file = new File(args[0]);\r\n if (file.isFile()) {\r\n csvImport.importCsv(file);\r\n }\r\n context.stop();\r\n }\r\n\r\n private void importCsv(File file) {\r\n ....\r\n ....\r\n\r\n\r\nIs there a better way to do this?", "958" ], [ "There are several steps required to get this working.\r\n\r\nThe first thing is that `@SpringBootApplication` auto-scans any packages below it and will auto-start any CommandLineRunner that it finds so the command line application needs to be in a parallel package.\r\n\r\ne.g.\r\n\r\n - com\r\n - test\r\n - rest\r\n - model\r\n - repository\r\n - controller\r\n #RestSpringBoot.java\r\n - Commands\r\n #ImportCsv.java\r\n\r\nThe next thing is that since the command line application is in a parallel package you need to specify the scanning yourself.\r\n\r\nThere are 3 parts to this:\r\n\r\n - @ComponentScan\r\n - @EntityScan\r\n - @EnableJpaRepositories\r\n\r\nThe first ensures the beans are created, the second ensures that the hibernate entities are created and the third ensures that the JPA classes are generated correctly.\r\n\r\nThe last part is to disable the start of the spring boot webserver otherwise you will have port conflicts.\r\n\r\nThis ends up with:\r\n\r\n\r\n @SpringBootApplication\r\n @ComponentScan(basePackageClasses = {Repository.class})\r\n @EntityScan(basePackageClasses = {MyEntity.class})\r\n @EnableJpaRepositories(basePackageClasses = {Repository.class})\r\n public class CsvImport {\r\n\r\n @Autowired\r\n private RiskRepository repository;\r\n\r\n public static void main(String[] args) {\r\n SpringApplication app = new SpringApplication(CsvImport.class);\r\n app.setBannerMode(Banner.Mode.OFF);\r\n app.setWebApplicationType(WebApplicationType.NONE);\r\n app.run(args);\r\n }\r\n\r\n @Override\r\n public void run(String... args) throws Exception {\r\n File file = new File(args[0]);\r\n if (file.isFile()) {\r\n importCsv(file);\r\n }\r\n }\r\n\r\n private void importCsv(File file) {\r\n ....\r\n ....", "958" ], [ "I am working with a REST API that is using Jersey with Spring Boot (so no specific application context in XML or Java) and Spring Data JPA.\r\n\r\nI want to write unit tests on the GET and POST endpoints, however, I don&#39;t want to start a web server as it takes too long.\r\n\r\nIf I use `JerseyTest` my Spring Beans don&#39;t get loaded into the context.\r\n\r\n < !-- language: lang-java -- > \r\n\r\n public class InMemoryContainerPackageTest extends \r\n JerseyTestNg.ContainerPerClassTest {\r\n\r\n @Override\r\n protected TestContainerFactory getTestContainerFactory() {\r\n return new InMemoryTestContainerFactory();\r\n }\r\n\r\n @Override\r\n public Application configure() {\r\n ResourceConfig config = new ResourceConfig()\r\n .register(SpringLifecycleListener.class)\r\n .register(RequestContextFilter.class)\r\n .register(this)\r\n .register(MyController.class)\r\n .packages( \" ;_URL_0_.service \" ;);\r\n return config;\r\n }\r\n\r\nIf I use `SpringBootTest` it starts up a web server which takes about 30 seconds and ideally I want all my tests to complete in under 5 seconds otherwise developers won&#39;t run them.\r\n\r\n < !-- language: lang-java -- > \r\n\r\n @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)\r\n public class TestNGClass1 extends AbstractTestNGSpringContextTests {\r\n\r\nI don&#39;t think `MockMvc` works with Jersey endpoints.", "64" ], [ "I want users to be able to look at the documentation in Swagger-UI and run the \" ;Try It Out \" ; option and have that return data from mocks.\r\n\r\nHowever, I want proper client applications to go through the real end points.\r\n\r\nI am deploying my rest server and documentation in a single war using gradle and springfox.\r\n\r\nThere is no yaml file as the documentation is generated from annotations and there is no possibility of using a third party service like swaggerhub.", "64" ], [ "I have started to use Spring Rest Docs for a project but other APIs in the company are still using Swagger/OpenAPI which has led to a style inconsistency.\r\n\r\nThe usual Swagger view (e.g. _URL_0_) has collapsible sections for each url and CSS colouring GET/POST/PUT/DELETE etc.\r\n\r\nI should be able to customise the asciidoctor with a line in the adoc\r\n\r\n :stylesheet: custom.css\r\n\r\nIs there an existing template for Spring Rest Docs that gives an output similar to what the default Swagger output looks like?\r\n\r\nCan you add javascript to the asciidoctor output to animate some of the documentation like collapsible url sections?", "811" ], [ "Related to [this question][1] I want to generate the swagger.json from springfox then parse and validate it.\r\n\r\nHowever, I don&#39;t want to run a web server to get the swagger.json as it takes too long to start and I am not using SpringMvc so MockSpringMvc doesn&#39;t work either.\r\n\r\nHow does SpringFox actually generate the swagger.json?\r\n\r\nIs there any technical reason why I can&#39;t call that code from my test class?\r\n\r\n [1]: _URL_0_", "64" ], [ "When I run a job in TeamCity it filters the job history by branch.\r\n\r\n_URL_0_\r\n\r\n[![TeamCity Branch Label 2012][1]][1]\r\n\r\nThe [Jenkins multi-branch plugin][2] seemed to provide some of this, but it is now deprecated in favour of the jenkins pipeline plugin.\r\n\r\nHowever, I am not using pipelines.\r\n\r\nThe multi-branch plugin also seems to be creating a new project for each branch instead of just filtering the existing project by branch.\r\n\r\nIs there a way to provide this filtering feature in Jenkins in another way? (i.e. without changing my build to pipelines).\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_2_", "857" ], [ "My application is actually three separate applications with a shared database.\r\n\r\nInitially I was launching my applications using the embedded Tomcat in Spring Boot and using a relative URL for the H2 location\r\n\r\n jdbc:h2:file:./db/myapp;AUTO_SERVER=TRUE\r\n\r\nThis was fine as it creates the database in the application directory and everything is self contained with the correct permissions.\r\n\r\nHowever, I now need to repackage as a war and deploy to a standalone Tomcat that I don&#39;t administer. I want the application to be as self contained as possible and not require modifying parts of Tomcat in order for it to run.\r\n\r\nUsing the url above wont work as it will try to put the database in the tomcat bin dir.\r\n\r\nOther options that I have thought of require changes to how Tomcat is run and I&#39;d like to avoid that.\r\ne.g.\r\n\r\n - Adding an environment variable before starting Tomcat\r\n - Putting a setenv script Tomcat bin dir\r\n - Starting Tomcat using `CATALINA_BASE`\r\n\r\nIf I use an absolute path it will work but requires me to set it on each deploy and also each developer will have to set it to their specific directory and have local changes.\r\n\r\nWhat are my alternatives?", "240" ], [ "It is very easy for Swagger annotations to drift away from the actual code.\r\n\r\nE.g. \r\n\r\nI could change the return from `Response.ok` to `Response.created` and easily forget to update the annotations from 200 to 201.\r\n\r\nOr I could change what is valid as null or not null and the end user will get confusing rejection messages even though their payload matches exactly what the documentation says.\r\n\r\nHow do I test that my swagger documentation matches what my code is doing?\r\n\r\n - A test that uses selenium and phantomjs to parse the swagger-ui web page?\r\n - Reflection to parse the annotations?\r\n - Get the generated swagger.json and parse it?\r\n - Something else?\r\n\r\nUnfortunately I can&#39;t switch to Spring REST Docs.", "64" ] ]
311
[ 1627, 1142, 16463, 19271, 17875, 15936, 9880, 3374, 3482, 6699, 13224, 17351, 17985, 6111, 5520, 3265, 7274, 3341, 2733, 211, 1740, 2858, 3153, 11151, 18205, 16102, 3787, 9959, 656, 6358, 127, 15379, 9067, 13681, 7145, 12288, 12717, 5971, 2786, 2256, 6448, 1314, 2061, 14931, 7515, 8729, 14039, 10935, 1566, 8203, 7127, 8893, 1965, 3952, 18184, 43, 14513, 7698, 10089, 18258, 14838, 6702, 11041, 15041, 10497, 13072, 6598, 4812, 11879, 19395, 1346, 6565, 537, 8917, 11667, 8588, 10309, 6371, 6973, 574, 4330, 17920, 15201, 17230, 13906, 11447, 4505, 12048, 4185, 6030, 5985, 316, 18534, 3812, 15940, 10467, 6630, 577, 3063, 2640, 7157, 14378, 526, 8759, 10096, 1729, 9406, 2654, 13344, 9661, 13824, 13854, 7743, 8902, 19522, 14216, 3284, 14615, 1450, 12191, 3418, 6076, 3397, 3722, 7680, 3768, 13109, 17579, 13737, 11892, 1648, 9791, 14177, 10449, 266, 718, 298, 3248, 13423, 7718, 11416, 16859, 19511, 14540, 10294, 8753, 11194, 5946, 3298, 9269, 12591, 5236, 11049, 12878, 13872, 18348, 6260, 1793, 16447, 4309, 5091, 2669, 14954, 2684, 387, 3967, 11912, 10848, 19185, 15630, 2331, 15401, 9756, 3061, 5232, 1408, 11917, 1127, 13738, 4246, 15770, 12936, 616, 2847, 10161, 10230, 11505, 19215, 19501, 2827, 3091, 12721, 257, 17516, 701, 3484, 10835, 12853, 3103, 15424, 2393, 10686, 7624, 19737, 126, 19371, 2189, 1147, 15080, 6999, 5253, 11087, 8518, 14242, 914, 13763, 17815, 10093, 7690, 2166, 13847, 11003, 11055, 14626, 4482, 12869, 12574, 269, 15161, 5715, 7335, 9332, 8202, 717, 7528, 4577, 6968, 10763, 11057, 1677, 14898, 3405, 7009, 5888, 9928, 1040, 15334, 15496, 9111, 18436, 19186, 6185, 9237, 7919, 3553, 14211, 3862, 7449, 15046, 11935, 17784, 17523, 9712, 3691, 12828, 4879, 19407, 15509, 1894, 8990, 18614, 272, 7069, 10762, 9724, 12263, 17328, 4980, 3737, 19749, 175, 1607, 5021, 6168, 11086, 6255, 6786, 2296, 9573, 9426, 817, 14515, 16961, 9584, 17535, 9720, 8501, 19549, 4200, 9992, 17164, 5487, 17896, 18633, 6514, 3958, 4721, 935, 6258, 5274, 8087, 2134, 2028, 2963, 15728, 1842, 17337, 15188, 8299, 1511, 9522, 14879, 10136, 4178, 10680, 5841, 12985, 15986, 18279, 18559, 4139, 14362, 11201, 14610, 17322, 980, 1050, 1804, 16424, 10212, 18533, 14644, 11142, 14468, 16622, 18488, 9558, 9945, 17772, 3189, 2120, 13607, 2995, 15922, 5423, 15675, 7478, 6621, 4355, 8405, 5825, 12114, 18414, 4231, 18458, 8935, 2792, 18435, 4275, 16386, 4323, 313, 5060, 5391, 4840, 3630, 6139, 8252, 15849, 3195, 9888, 12234, 2981, 11178, 4698, 18399, 13535, 425, 16415, 11193, 3688, 13077, 18306, 15467, 9954, 12645, 2409, 16106, 9499, 1693, 7838, 7767, 8119, 7487, 2573, 3391, 16438, 14022, 8337, 10714, 11292, 19228, 3531, 16639, 5345, 9080, 12639, 963, 3096, 110, 17908, 10854, 4880, 16031, 2533, 13326, 14850, 10443, 13507, 16285, 19289, 10198, 587, 9005, 15732, 1515, 5680, 12220, 8662, 6504, 4673, 13202, 18678, 15339, 18831, 5883, 8967, 4267, 1414, 13849, 18903, 12895, 338, 13390, 2744, 3337, 9481, 5891, 8951, 8531, 8052, 10741, 3325, 6207, 17430, 4111, 17498, 5508, 18380, 6162, 11545, 17282, 10069, 7368, 10570, 8320, 8862, 4707, 11186, 16635, 13386, 4334, 10483, 598, 6300, 9218, 16605, 14742, 6569, 1307, 778, 1004, 3389, 232, 18733, 14201, 54, 12442, 9705 ]
STX_1000095.0
[ [ "I would implement OnRowDataBound method on the server. Do the check on the cell that is under the column and if the value is equal to 0 then throw your validation message here. You could even highlight the cell as red or something to signal to the user the data can&#39;t be 0.\r\n\r\nThis is assuming you already have calculated the Total Funds before data binding to the grid view.", "653" ], [ "To fix the paging issue you need to rebind the data on every page index change. The issue with your markup is although you have AllowPaging set to true you never implemented the on page index changing event thus the data gets \" ;lost \" ; when the page index changes. Here is example markup and code behind. Please let me know if you need further clarification.\r\n\r\nMarkUp:\r\n\r\n < asp:GridView ID= \" ;ProjectTable \" ; runat= \" ;server \" ; Font-Names= \" ;Verdana,Arial \" ; Font-Size= \" ;12px \" ; AutoGenerateColumns= \" ;False \" ; AutoGenerateEditButton= \" ;True \" ; DataSourceID= \" ;PopulateProjectTable \" ; AllowPaging= \" ;True \" ; OnPageIndexChaning= \" ;ProjectTable_PageIndexChanging \" ; > \r\n\r\nCode Behind:\r\n\r\n protected void ProjectTable_PageIndexChanging(object sender, GridViewPageEventArgs e)\r\n {\r\n //Set the page index\r\n this.ProjectTable_PageIndexChanging.PageIndex = e.NewPageIndex;\r\n \r\n //Rebind the data\r\n this.ProjectTable_PageIndexChanging.DataSource = PopulateProjectTable;\r\n this.ProjectTable_PageIndexChanging.DataBind();\r\n }", "843" ], [ "You need to implement those events. In your markup you set auto generate edit button to true but you never implement the On Row Editing event and On Row Cancelling Edit event. Updating your markup to:\r\n\r\n < asp:GridView ID= \" ;ProjectTable \" ; runat= \" ;server \" ; Font-Names= \" ;Verdana,Arial \" ; Font-Size= \" ;12px \" ; AutoGenerateColumns= \" ;False \" ; AutoGenerateEditButton= \" ;True \" ; DataSourceID= \" ;PopulateProjectTable \" ; AllowPaging= \" ;True \" ; OnPageIndexChanging= \" ;ProjectTable_PageIndexChanging \" ; OnRowEditing= \" ;ProjectTable_OnRowEditing \" ; OnRowCancelingEdit= \" ;ProjectTable_OnRowCancellingEdit \" ; > \r\n\r\nand then add that method to your code behind:\r\n\r\n protected void ProjectTable_OnRowEditing(object sender, GridViewEditEventArgs e)\r\n {\r\n \r\n }\r\n\r\n protected void ProjectTable_OnRowCancellingEdit(object sender, GridViewCancelEditEventArgs e)\r\n {\r\n\r\n }", "653" ], [ "This will stop at 4 or 5. If you don&#39;t want 5 at all then you need to update your question how to handle that scenario.\r\n\r\n public void levelUp()\r\n {\r\n int <PERSON> = 0;\r\n Random randomGenerator = new Random();\r\n int A = 0;\r\n int B = 0;\r\n int C = 0;\r\n int D = 0;\r\n while (zaehler < = 4)\r\n {\r\n int randomInt1 = randomGenerator.nextInt(3);\r\n A += randomInt1;\r\n <PERSON> = <PERSON> + randomInt1;\r\n\r\n if (<PERSON> > = 4)\r\n break;\r\n\r\n int randomInt2 = randomGenerator.nextInt(3);\r\n B += randomInt2;\r\n <PERSON> = <PERSON> + randomInt2;\r\n\r\n if (<PERSON> > = 4)\r\n break;\r\n\r\n int randomInt3 = randomGenerator.nextInt(3);\r\n C += randomInt3;\r\n <PERSON> = <PERSON> + randomInt3;\r\n\r\n if (<PERSON> > = 4)\r\n break;\r\n\r\n int randomInt4 = randomGenerator.nextInt(3);\r\n D += randomInt4;\r\n <PERSON> = <PERSON> + randomInt4;\r\n\r\n if (<PERSON> > = 4)\r\n break;\r\n }\r\n\r\n System.out.println( \" ;A = \" ; + A);\r\n System.out.println( \" ;B = \" ; + B);\r\n System.out.println( \" ;C = \" ; + C);\r\n System.out.println( \" ;D = \" ; + D);\r\n\r\n System.out.println(zaehler);\r\n }", "418" ], [ "Give this a try. \r\n\r\n < asp:DropDownList ID= \" ;ddlSelectWeek \" ; runat= \" ;server \" ; OnSelectedIndexChanged= \" ;ddlSelectWeek_SelectedIndexChanged \" ; Width= \" ;200px \" ; > \r\n < asp:ListItem Text= \" ;2015-11-15 \" ; Value= \" ;2015-11-15 \" ; > < /asp:ListItem > \r\n < asp:ListItem Text= \" ;2015-11-22 \" ; Value= \" ;015-11-22 \" ; > < /asp:ListItem > \r\n < asp:ListItem Text= \" ;2015-11-29 \" ; Value= \" ;2015-11-29 \" ; > < /asp:ListItem > \r\n < /asp:DropDownList > \r\n\r\n protected void ddlSelectWeek_SelectedIndexChanged(object sender, EventArgs e)\r\n {\r\n DateTime theDate;\r\n DateTime.TryParseExact(this.ddlSelectWeek.SelectedValue, \" ;yyyy-MM-dd \" ;, CultureInfo.InvarientCulture, DateTimeStyles.None, out theDate);\r\n BindGridview(theDate);\r\n }\r\n\r\n protected void BindGridview(DateTime theDate)\r\n {\r\n DataTable dt = new DataTable();\r\n dt.Columns.AddRange(new DataColumn[8] {\r\n new DataColumn( \" ;Category \" ;),\r\n new DataColumn( \" ;Day1 \" ;),\r\n new DataColumn( \" ;Day2 \" ;),\r\n new DataColumn( \" ;Day3 \" ;),\r\n new DataColumn( \" ;Day4 \" ;),\r\n new DataColumn( \" ;Day5 \" ;),\r\n new DataColumn( \" ;Day6 \" ;),\r\n new DataColumn( \" ;Day7 \" ;)\r\n });\r\n\r\n //add your category\r\n dt.Rows.Add( \" ;Travelling \" ;);\r\n dt.Rows.Add( \" ;Food \" ;);\r\n dt.Rows.Add( \" ;Air Fare, \" ;);\r\n dt.Rows.Add( \" ;Auto Rental \" ;);\r\n \r\n gvCategory.DataSource = dt;\r\n gvCategory.DataBind();\r\n //for generating datewise coloumn\r\n for (int i = 1; i < gvCategory.HeaderRow.Cells.Count; i++)\r\n {\r\n gvCategory.HeaderRow.Cells[i].Text = theDate.AddDays(i - 1).ToString( \" ;ddd \" ;) + \" ; \" ; + theDate.AddDays(i - 1).ToShortDateString();\r\n }\r\n }", "653" ], [ "I&#39;m trying to create a string extension method with the following signature:\r\n\r\n public static DateTime? TryParseExact(this string src, string format, IFormatProvider provider = DateTimeFormatInfo.CurrentInfo, DateTimeStyles style = DateTimeStyles.None)\r\n {\r\n }\r\n\r\nI&#39;m getting a compiler error:\r\n\r\n\r\n\r\n > Default parameter value for &#39;provider&#39; must be a compile-time constant\r\n\r\n\r\nCouldn&#39;t find anything on google and my only work around is to do this:\r\n\r\n \r\n\r\n \r\n\r\n public static DateTime? TryParseExact(this string src, string format, IFormatProvider provider = null, DateTimeStyles style = DateTimeStyles.None)\r\n {\r\n if (provider == null)\r\n provider = DateTimeFormatInfo.CurrentInfo;\r\n }\r\n\r\nAnyone know how I can set the default value of IFormatProvider in the signature? Is it even possible? IFormatProvider is an interface so I&#39;m assuming that&#39;s where the issue lies.", "764" ], [ "I think this should work just tested it on some examples. Doesn&#39;t use string.Replace or IndexOf\r\n\r\n static void Main(string[] args)\r\n {\r\n Console.WriteLine( \" ;enter one string: \" ;);\r\n var input = Console.ReadLine();\r\n Console.WriteLine(RemoveCBC(input));\r\n }\r\n \r\n static string RemoveCBC(string source)\r\n {\r\n var result = new StringBuilder();\r\n \r\n for (int i = 0; i < source.Length; i++)\r\n {\r\n if (i + 2 == source.Length)\r\n break;\r\n \r\n var c = source[i];\r\n var b = source[i + 1];\r\n var c2 = source[i + 2];\r\n \r\n if (c == &#39;c&#39; & & c2 == &#39;c&#39; & & b == &#39;b&#39;)\r\n i = i + 2;\r\n else\r\n result.Append(source[i]);\r\n }\r\n \r\n return result.ToString();\r\n }", "819" ], [ "You want to store the input integers and random generated integers in two separate lists respectively. Then you want to remove any duplicates before you count the number of matches. So for your example 123 and 313 would become 123 and 31 which would result in two matches. Here is code on how to do it with just if statements:\r\n\r\n \r\n\r\n private void button1_Click(object sender, EventArgs e)\r\n {\r\n var e1 = int.Parse(textBox1.Text);\r\n var e2 = int.Parse(textBox2.Text);\r\n var e3 = int.Parse(textBox3.Text);\r\n \r\n //Code to display winning numbers here\r\n \r\n var input = new List < int > ();\r\n input.Add(e1);\r\n if (!input.Contains(e2))\r\n input.Add(e2);\r\n if (!input.Contains(e3))\r\n input.Add(e3);\r\n \r\n var lotteryNum = new Random();\r\n \r\n var randoms = new List < int > ();\r\n randoms.Add(lotteryNum.Next(1,4));\r\n var rand2 = lotteryNum.Next(1, 4);\r\n if (!randoms.Contains(rand2))\r\n randoms.Add(rand2);\r\n var rand3 = lotteryNum.Next(1, 4);\r\n if (!randoms.Contains(rand3))\r\n randoms.Add(rand3);\r\n \r\n //Code to display random numbers here\r\n \r\n //Compare the two lists. Since they both have distinct values respectively no worries of duplicate matches\r\n var matches = 0;\r\n if(input.Contains(randoms[0]))\r\n matches++;\r\n if (input.Contains(randoms[1]))\r\n matches++;\r\n if (input.Contains(randoms[2]))\r\n matches++;\r\n \r\n //Do logic for displaying matches to user\r\n }", "418" ], [ "Ok got it to work. Check out my working jsfiddle. _URL_0_.\r\n\r\nHTML\r\n\r\n < select id= \" ;dropDown \" ; onchange= \" ;changeColor(); \" ; > \r\n < option val= \" ;Red \" ; > Red < /option > \r\n < option val= \" ;Yellow \" ; > Yellow < /option > \r\n < option val= \" ;Green \" ; > Green < /option > \r\n < /select > \r\n\r\nCSS \r\n\r\n select option[val= \" ;Red \" ;] {\r\n background-color: red;\r\n }\r\n \r\n select option[val= \" ;Yellow \" ;] {\r\n background-color: yellow;\r\n }\r\n \r\n select option[val= \" ;Green \" ;] {\r\n background-color: green;\r\n }\r\n\r\nJS\r\n\r\n function changeColor() {\r\n var select = $( \" ;#dropDown \" ;);\r\n if(select.val() === \" ;Red \" ;) {\r\n select.css( \" ;background-color \" ;, \" ;Red \" ;);\r\n }\r\n else if(select.val() === \" ;Yellow \" ;) {\r\n select.css( \" ;background-color \" ;, \" ;Yellow \" ;);\r\n }\r\n else if(select.val() === \" ;Green \" ;) {\r\n select.css( \" ;background-color \" ;, \" ;Green \" ;);\r\n }\r\n }", "574" ], [ "This will update all records that have a matching ID_ON_DISCOGS. \r\n\r\n \r\n\r\n REPLACE INTO ALBUM\r\n (ID_ON_DISCOGS, ARTIST_ID, LABEL_ID)\r\n SELECT src.ID_ON_DISCOGS, src.ARTIST_ID, src.LABEL_ID\r\n FROM ImportTable src\r\n INNER JOIN ALBUM dest\r\n ON src.ID_ON_DISCOGS = dest.ID_ON_DISCOGS\r\n\r\nThe next query will then insert the remaining records not in the table already.\r\n\r\n INSERT INTO ALBUM\r\n SELECT imp.ID_ON_DISCOGS\r\n ,imp.ARTIST_ID\r\n \t ,imp.LABEL_ID\r\n FROM ImportTable imp\r\n WHERE imp.ID_ON_DISCOGS NOT IN (SELECT ID_ON_DISCOGS FROM ALBUM)", "154" ], [ "Yes use an ASP Button control. Set the OnClick event to your server side function and the OnClientClick to your client side function.\r\n\r\nNote if you want to execute both the client and server click events you need to either return true in the OnClick event to execute the PostBack, or remove the OnClick event all together and register the client side function as a start up script on the server side event.", "88" ], [ "I&#39;m getting the following error when using MSBuild. The error I am getting is:\r\n\r\n > C:\\Windows\\_URL_0_\\Framework\\v4.0.30319\\Microsoft.Common.targets(2769,5):\r\n > error MSB3086: Task could not find \" ;sgen.exe \" ; using the SdkToolsPath\r\n > \" ; \" ; or the registry key\r\n > \" ;HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.\r\n > 0A\\WinSDK-NetFx40Tools-x86 \" ;. Make sure the SdkToolsPath is set and the\r\n > tool exi sts in the correct processor specific location under the\r\n > SdkToolsPath and that the Microsoft Windows SDK is installed\r\n\r\nSo far I have done the following:\r\n\r\n1) Install Windows SDK v8 from [here][1]\r\n\r\n2) I confirmed that the registry key \" ;HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8. 0A\\WinSDK-NetFx40Tools-x86 \" ; exists in the registry\r\n\r\n3) The registry key from 2 above points to the path \" ;C:\\Program Files\\Microsoft SDKs\\Windows\\v8.0A\\bin\\NETFX 4.0 Tools \" ; and I have confirmed that the path exists and that sgen.exe is located in that directory\r\n\r\n4) I have also did some of my own research and came across [this SO post][2] but the answer involves installing visual studio on the server itself which is NOT an option for me. However I do want to point out that I have another build server with the exact same setup and it&#39;s working fine so my temporary work around is to build it on that server and then copy the build over.\r\n\r\nAnyone have any insight on what the problem might be?\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_1_", "206" ], [ "I was finally able to resolve it. Steps to resolution:\r\n\r\n1) Uninstall windows sdk 8 via Program and Features. \r\n\r\n2) Install windows sdk 8.1 from [here][1]. \r\n\r\n3) Edit the registry keys \r\n\r\n - SDK40ToolsPath\r\n - SDK35ToolsPath\r\n\r\nunder \r\n\r\n > HKLM\\SOFTWARE\\Wow6432Node\\MSBuild\\ToolsVersions\\11.0\r\n\r\n to \r\n\r\n > $(Registry:HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft\r\n > SDKs\\Windows\\v8.1A\\WinSDK-NetFx40Tools-x86@InstallationFolder)\r\n\r\nand the registery keys\r\n\r\n - FrameworkSDKRoot\r\n - WindowsSDK80Path \r\n\r\nto \r\n\r\n > $(Registry:HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft\r\n > SDKs\\Windows\\v8.1@InstallationFolder)\r\n\r\nHope this might help someone else in the future if they run into the same problem.\r\n\r\n [1]: _URL_0_", "66" ] ]
83
[ 9720, 18691, 14601, 14381, 5804, 15201, 9928, 4088, 15513, 1607, 15917, 14850, 4665, 15188, 10848, 4889, 11792, 8906, 19662, 8299, 18614, 13665, 14156, 6808, 16415, 14136, 15630, 17351, 12263, 112, 4880, 5476, 6520, 6973, 4323, 3124, 3654, 14177, 16961, 1153, 19407, 10689, 9756, 4258, 1510, 3553, 10990, 3298, 13757, 12121, 2469, 7919, 17481, 607, 13507, 13240, 16172, 8629, 2039, 7335, 8483, 6076, 7138, 11925, 16463, 18873, 1749, 5382, 18988, 1214, 17270, 17838, 13687, 1677, 18062, 12853, 4418, 10448, 5500, 8202, 7863, 5703, 5253, 2409, 7131, 18414, 9307, 2688, 3497, 13649, 6388, 9764, 3313, 1346, 8967, 10485, 6030, 6815, 11217, 7274, 11660, 19194, 10711, 3885, 1320, 3660, 1828, 12552, 1450, 18528, 7095, 3535, 16233, 5768, 12792, 12922, 1703, 5274, 3195, 12793, 2858, 9744, 12721, 15936, 14805, 8984, 14515, 7280, 2330, 1596, 14610, 8486, 9790, 6448, 19575, 7007, 16580, 12945, 9025, 8511, 2331, 8203, 12271, 387, 54, 12828, 17381, 13535, 13423, 14233, 10570, 12160, 14216, 17447, 450, 12812, 8946, 12220, 9838, 17794, 9394, 131, 14581, 12578, 4309, 7291, 12291, 17373, 17328, 13780, 10096, 15304, 13072, 7732, 7718, 1793, 9712, 13235, 5293, 7361, 18126, 11416, 6554, 16405, 17427, 8609, 17304, 9945, 5776, 5843, 10740, 6786, 11601, 10692, 13699, 14006, 13749, 13188, 4896, 7116, 17663, 7758, 11480, 9044, 13590, 18275, 13344, 1565, 11477, 718, 15517, 3681, 6232, 6371, 3459, 2899, 12717, 12667, 6598, 9772, 12246, 15401, 5130, 15124, 2669, 10315, 5681, 5708, 14255, 12585, 19029, 14689, 15541, 9880, 9499, 19469, 6990, 1910, 15566, 1555, 5784, 16101, 8518, 16876, 4673, 15334, 8763, 11041, 12073, 11594, 11003, 180, 4632, 4308, 1322, 18392, 9762, 13176, 2698, 1965, 2069, 9406, 17110, 2792, 5816, 717, 16278, 9541, 11879, 9021, 6675, 10762, 18790, 3237, 19271, 8227, 14838, 13311, 5643, 3787, 14589, 8662, 8466, 3944, 8337, 14039, 5316, 4269, 2393, 1159, 14553, 12760, 9005, 183, 594, 10982, 2444, 1688, 17091, 526, 9162, 2028, 18435, 5365, 5774, 8753, 930, 18195, 4378, 11047, 5097, 15842, 2206, 510, 19654, 19371, 10919, 4125, 6879, 9584, 3389, 11520, 15014, 12844, 4613, 16180, 17438, 12936, 12795, 8590, 399, 15940, 182, 4042, 1269, 11143, 3061, 7442, 9727, 12739, 15879, 15396, 7581, 3103, 19228, 3418, 19633, 15209, 8970, 9269, 11637, 9731, 5232, 4176, 9858, 2094, 14923, 5742, 12320, 1949, 12083, 5503, 9278, 11774, 14670, 5342, 13601, 2654, 6693, 15981, 11505, 5953, 13348, 8302, 14569, 10006, 19649, 14257, 9743, 18257, 17987, 4178, 7792, 4264, 3439, 3341, 13332, 15108, 11809, 5985, 4569, 7805, 12457, 15050, 15080, 3444, 10371, 17579, 13336, 10171, 10672, 3590, 12965, 13690, 7121, 16953, 7390, 17875, 18534, 8177, 11087, 924, 9661, 12094, 14242, 1127, 266, 14358, 7180, 9399, 4331, 8426, 11611, 10885, 18184, 19788, 3737, 16023, 8133, 5825, 16396, 17146, 14408, 104, 1818, 17498, 10777, 13224, 8252, 13104, 13927, 1598, 14171, 11364, 6123, 12395, 10834, 12871, 16550, 16313, 9447, 11667, 17702, 8606, 9318, 16360, 6397, 9888, 17337, 7487, 1217, 2170, 1147, 2981, 13201, 7114, 11807, 3531, 1825, 7427, 10835, 3858, 17534, 14955, 18756, 219, 12357, 14545, 3248, 15059, 16771, 12669, 5391, 16859, 10198, 2482, 1566, 14954, 15174, 14206, 1882, 11755, 14931, 15049, 4838, 17071, 8072, 3969, 13762 ]
STX_10001851.0
[ [ "I am now trying to replicate the tutorial of creating an organization chart in Tableau. The link to the tutorial is _URL_3_. \r\n\r\nHowever, when I try to calculate the values in the X-axis, I cannot find the Specific Dimension in the table calculation, which exists in the tutorial. The pictures of the tutorials and my case are shown below. My version is Tableau 2018.1. Can anyone help me? Thank you!\r\n\r\n![The screen cut in the tutorial][1]\r\n\r\n\r\n![The screen cut in my case][2]\r\n![The screen cut in my case 2][3]\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_0_\r\n [3]: _URL_1_", "616" ], [ "I am now trying to use the IBM Natural Language Translator in AWS EC2. However, I find I cannot import the LanguageTranslatorV3 in the AWS EC2, which can be done on my laptop. The error is shown below. Is there anyone that can help me to solve this problem? Thank you!\r\n\r\n from watson_developer_cloud import LanguageTranslatorV3\r\n ---------------------------------------------------------------------------\r\n ImportError Traceback (most recent call last)\r\n < ipython-input-62-0d0e9b329a15 > in < module > ()\r\n ---- > 1 from watson_developer_cloud import LanguageTranslatorV3\r\n\r\n ImportError: cannot import name &#39;LanguageTranslatorV3&#39;", "46" ], [ "I have a dataframe shown below. \r\n\r\n\r\n Supervisor-L3\tSupervisor-L2\tSupervisor-L1\tEmployee\r\n O\t M J\t A\r\n O\t M\t J\t B\r\n O\t M\t J\t C\r\n O\t M\t K\t D\r\n O\t N\t K\t E\r\n O\t N\t K\t F\r\n O\t N\t L\t G\r\n O\t N\t L\t H\r\n O\t N\t L\t I\r\n\r\n\r\nI want to convert the dataframe to a json file to make an organizational chart. However, when I use the pandas.to_json function. The output is:\r\n\r\n { \" ;Supervisor-L3 \" ;:{ \" ;0 \" ;: \" ;O \" ;, \" ;1 \" ;: \" ;O \" ;, \" ;2 \" ;: \" ;O \" ;, \" ;3 \" ;: \" ;O \" ;, \" ;4 \" ;: \" ;O \" ;, \" ;5 \" ;: \" ;O \" ;, \" ;6 \" ;: \" ;O \" ;, \" ;7 \" ;: \" ;O \" ;, \" ;8 \" ;: \" ;O \" ;}, \" ;Supervisor-L2 \" ;:{ \" ;0 \" ;: \" ;M \" ;, \" ;1 \" ;: \" ;M \" ;, \" ;2 \" ;: \" ;M \" ;, \" ;3 \" ;: \" ;M \" ;, \" ;4 \" ;: \" ;N \" ;, \" ;5 \" ;: \" ;N \" ;, \" ;6 \" ;: \" ;N \" ;, \" ;7 \" ;: \" ;N \" ;, \" ;8 \" ;: \" ;N \" ;}, \" ;Supervisor-L1 \" ;:{ \" ;0 \" ;: \" ;J \" ;, \" ;1 \" ;: \" ;J \" ;, \" ;2 \" ;: \" ;J \" ;, \" ;3 \" ;: \" ;K \" ;, \" ;4 \" ;: \" ;K \" ;, \" ;5 \" ;: \" ;K \" ;, \" ;6 \" ;: \" ;L \" ;, \" ;7 \" ;: \" ;L \" ;, \" ;8 \" ;: \" ;L \" ;}, \" ;Name \" ;:{ \" ;0 \" ;: \" ;A \" ;, \" ;1 \" ;: \" ;B \" ;, \" ;2 \" ;: \" ;C \" ;, \" ;3 \" ;: \" ;D \" ;, \" ;4 \" ;: \" ;E \" ;, \" ;5 \" ;: \" ;F \" ;, \" ;6 \" ;: \" ;G \" ;, \" ;7 \" ;: \" ;H \" ;, \" ;8 \" ;: \" ;I \" ;}}\r\n\r\n\r\nI need a json file that can describe the hierarchical relationships between the people in the dataset. Does anyone that can help me? Thank you!\r\n\r\n[relationships][1]\r\n\r\n\r\n [1]: _URL_0_", "8" ], [ "I revise the name of &#39;Supervisor-L3&#39; to &#39;Supervisor,&#39; &#39;Supervisor-L2&#39; to &#39;Team Leader,&#39; and &#39;Supervisor-L1&#39; to &#39;Company&#39;. Because one company might belong to multiple team leaders. Hence, I write three loops to achieve the json file that can describe the relationships. \r\n \r\n \r\n a = {&#39;name&#39;:&#39;O&#39;,\r\n &#39;Subordinate&#39;:[]}\r\n\r\n ##merge these columns to have a one-to-one mapping\r\n df[&#39;merge&#39;] = df[&#39;Team Leader&#39;]+&#39;,&#39;+df[&#39;Company&#39;]\r\n df[&#39;merge2&#39;] = df[&#39;Team Leader&#39;]+&#39;,&#39;+df[&#39;Company&#39;] +&#39;,&#39;+df[&#39;Name&#39;]\r\n\r\n\r\n ##get the list of unique elements\r\n set1 = list(set(df[&#39;Supervisor&#39;]))\r\n set2 = list(set(df[&#39;Team Leader&#39;]))\r\n set3 = list(set(df[&#39;merge&#39;]))\r\n set4 = list(set(df[&#39;merge2&#39;]))\r\n\r\n ## write the loop\r\n for i in range(len(set2)):\r\n temp_dict1 = {&#39;name&#39;:set2[i],\r\n &#39;Subordinate&#39;:[]}\r\n a[&#39;Subordinate&#39;].append(temp_dict1)\r\n m = -1\r\n for j in range(len(set3)):\r\n list1 = set3[j].split( \" ;, \" ;)\r\n if set2[i] == list1[0]:\r\n temp_dict2 = {&#39;name&#39;:list1[1],\r\n &#39;Subordinate&#39;:[]}\r\n a[&#39;Subordinate&#39;][i][&#39;Subordinate&#39;].append(temp_dict2)\r\n m += 1\r\n for k in range(len(set4)):\r\n list2 = set4[k].split( \" ;, \" ;)\r\n if (list1[0] == list2[0]) and (list1[1] == list2[1]):\r\n temp_dict3 = {&#39;name&#39;:list2[2]}\r\n a[&#39;Subordinate&#39;][i][&#39;Subordinate&#39;][m][&#39;Subordinate&#39;].append(temp_dict3)\r\n \r\nOutput:\r\n\r\n Out[86]: \r\n {&#39;Subordinate&#39;: [{&#39;Subordinate&#39;: [{&#39;Subordinate&#39;: [{&#39;name&#39;: &#39;F&#39;},\r\n {&#39;name&#39;: &#39;E&#39;}],\r\n &#39;name&#39;: &#39;K&#39;},\r\n {&#39;Subordinate&#39;: [{&#39;name&#39;: &#39;I&#39;}, {&#39;name&#39;: &#39;H&#39;}, {&#39;name&#39;: &#39;G&#39;}],\r\n &#39;name&#39;: &#39;L&#39;}],\r\n &#39;name&#39;: &#39;N&#39;},\r\n {&#39;Subordinate&#39;: [{&#39;Subordinate&#39;: [{&#39;name&#39;: &#39;D&#39;}], &#39;name&#39;: &#39;K&#39;},\r\n {&#39;Subordinate&#39;: [{&#39;name&#39;: &#39;B&#39;}, {&#39;name&#39;: &#39;A&#39;}, {&#39;name&#39;: &#39;C&#39;}],\r\n &#39;name&#39;: &#39;J&#39;}],\r\n &#39;name&#39;: &#39;M&#39;}],\r\n &#39;name&#39;: &#39;O&#39;}", "8" ], [ "I am now using Jupyter notebook in the AWS EC2. However, after successfully install the nltk package. I find I cannot download the collections of nltk by using the nltk.download(&#39;all&#39;) command. Does anyone know how to solve it? Thank you!\r\n\r\n\r\n import nltk\r\n nltk.download(&#39;all&#39;)\r\n ---------------------------------------------------------------------------\r\n AttributeError Traceback (most recent call last)\r\n < ipython-input-15-b8dcd8d8d54f > in < module > ()\r\n 1 import nltk\r\n ---- > 2 nltk.download(&#39;all&#39;)\r\n\r\n AttributeError: &#39;module&#39; object has no attribute &#39;download&#39;", "46" ], [ "I am now using NMF to generate topics. My code is shown below. However, I do not know how to get the frequency of each topic. Does anyone that can help me? Thank you!\r\n\r\n def fit_tfidf(documents):\r\n tfidf = TfidfVectorizer(input = &#39;content&#39;, stop_words = &#39;english&#39;, \r\n use_idf = True, ngram_range = NGRAM_RANGE,lowercase = True, max_features = MAX_FEATURES, min_df = 1 )\r\n tfidf_matrix = tfidf.fit_transform(documents.values).toarray()\r\n tfidf_feature_names = np.array(tfidf.get_feature_names())\r\n tfidf_reverse_lookup = {word: idx for idx, word in enumerate(tfidf_feature_names)}\r\n return tfidf_matrix, tfidf_reverse_lookup, tfidf_feature_names\r\n\r\n def vectorization(documments):\r\n if VECTORIZER == &#39;tfidf&#39;:\r\n vec_matrix, vec_reverse_lookup, vec_feature_names = fit_tfidf(documents) \r\n if VECTORIZER == &#39;bow&#39;:\r\n vec_matrix, vec_reverse_lookup, vec_feature_names = fit_bow(documents)\r\n return vec_matrix, vec_reverse_lookup, vec_feature_names\r\n\r\n def nmf_model(vec_matrix, vec_reverse_lookup, vec_feature_names, NUM_TOPICS):\r\n topic_words = []\r\n nmf = NMF(n_components = NUM_TOPICS, random_state=3).fit(vec_matrix)\r\n for topic in nmf.components_:\r\n word_idx = np.argsort(topic)[<IP_ADDRESS>-1][0:N_TOPIC_WORDS]\r\n topic_words.append([vec_feature_names[i] for i in word_idx])\r\n return topic_words", "421" ], [ "Currently, I am trying to query data from IBM DB2 and then present it in Power BI. However, I notice the information that Power BI needs is different from what I got from the IBM DB2.\r\n\r\nThe information that Power BI needs is:\r\n\r\n[![Power BI interface][1]][1]\r\n\r\nThe connection information of IBM DB2 is shown as below:\r\n\r\n Host name:\t_URL_1_\r\n Port number:\t50001\r\n Database name:\tBLUDB\r\n User ID:\tuserid\r\n Password:\t********\r\n\r\nWhat should I fill in? \r\n\r\n\r\n [1]: _URL_0_", "486" ], [ "I am trying to use networkD3 in Power BI, because I saw that Power BI can support networdD3 in R from _URL_1_. My test dataset is:\r\n\r\n[![enter image description here][1]][1]\r\n\r\nMy code is:\r\n\r\n library(networkD3)\r\n simpleNetwork(dataset)\r\n\r\nHowever, I have an error which is:\r\n\r\n[![enter image description here][2]][2]\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_0_\r\n\r\nI have checked that I can use ggplot2 in Power BI. However, I do not know why I cannot get the visualization in Power BI. Does anyone know how to do it?", "549" ], [ "I have created some graphs by using networkD3 package in R studio. A demo of these graphs is shown below:\r\n\r\n[demo][1]\r\n\r\nThe format of these files is either HTML. Now I am required to output these files to the SharePoint daily automatically. Does anyone know how to do it? Thank you!\r\n\r\nI try to use the code as below. But it does not work. Does anyone know how to do it? Thank you!\r\n\r\n system( \" ;curl --ntlm --user useid:password --upload-file C:/Users/Demo/1.html _URL_0_;)\r\n\r\n\r\n\r\n\r\n\r\n\r\n [1]: _URL_1_", "165" ] ]
85
[ 15670, 19007, 16298, 8378, 14608, 11211, 196, 10809, 16109, 19768, 10600, 12205, 391, 16724, 10305, 10634, 16920, 13536, 13740, 8228, 15451, 19337, 9466, 2638, 19225, 11544, 17043, 5464, 11851, 18803, 7923, 9289, 654, 6839, 14085, 11517, 18158, 19397, 9402, 15570, 13905, 10661, 11875, 4104, 13262, 16978, 6491, 14843, 12558, 16369, 5383, 7166, 1529, 1759, 11746, 14021, 7286, 16564, 10546, 2739, 10984, 15755, 12239, 129, 8340, 14531, 4947, 16545, 16380, 13540, 19433, 19016, 14084, 3474, 10228, 15211, 13973, 19119, 13388, 2398, 3126, 16625, 18149, 2158, 9597, 11616, 11757, 14631, 14150, 2351, 2537, 11612, 15003, 5140, 3564, 18278, 3872, 19409, 8184, 3842, 1253, 2850, 13659, 12886, 10213, 13565, 10343, 13602, 17254, 12469, 18282, 15337, 15760, 5478, 14107, 19695, 10728, 14278, 19122, 18366, 15443, 16644, 3668, 19241, 3141, 18161, 19666, 16946, 16228, 17668, 11998, 18681, 296, 14564, 4541, 3547, 2774, 5836, 5961, 4696, 8093, 14450, 15635, 15144, 4298, 13595, 14842, 2877, 15016, 15017, 15333, 19413, 10487, 12948, 15656, 4809, 15467, 17568, 16209, 909, 18191, 14716, 5748, 7156, 12768, 6681, 18173, 6200, 3789, 200, 17233, 743, 18660, 15342, 14195, 18883, 18289, 8986, 15009, 5775, 14304, 17583, 18861, 6807, 13749, 4334, 14173, 15199, 16873, 12339, 17763, 11877, 9588, 1523, 18221, 18032, 13418, 19784, 17290, 15341, 17518, 14151, 12962, 12922, 17059, 4474, 17999, 8859, 9188, 548, 18186, 16984, 19118, 19700, 2295, 16513, 14354, 12786, 1059, 8847, 1740, 12167, 17460, 17457, 16974, 6283, 9347, 8135, 3137, 18531, 8189, 11075, 12677, 9652, 14198, 12254, 16646, 14043, 5111, 7708, 14890, 4002, 13495, 14554, 19309, 12709, 18316, 13015, 15353, 12697, 12125, 18144, 16938, 14745, 4251, 16389, 4949, 17998, 3585, 9916, 13993, 4948, 12657, 17874, 14254, 11832, 17602, 15264, 14938, 11148, 18426, 9876, 15786, 13594, 12845, 17371, 17900, 10633, 5054, 4119, 3352, 365, 289, 12958, 8557, 15815, 13577, 19249, 3206, 3330, 14475, 12577, 18111, 4464, 5886, 16652, 7764, 18317, 5224, 2196, 4925, 5872, 5125, 4811, 14520, 17299, 8957, 3486, 10288, 9426, 14060, 4615, 13073, 15166, 16588, 1798, 10337, 121, 15177, 9858, 8100, 8944, 12198, 8337, 15221, 17384, 8935, 5131, 19000, 10245, 2360, 615, 11497, 10707, 7447, 14860, 18050, 14849, 2684, 4135, 4038, 15738, 16179, 16403, 7848, 17123, 5783, 3567, 14339, 6287, 514, 9848, 103, 8535, 7074, 16890, 2970, 10628, 11815, 13934, 120, 3285, 17026, 17175, 17947, 11068, 4262, 18969, 2077, 12221, 13527, 12111, 230, 10253, 7311, 5618, 5989, 9050, 7281, 17974, 7509, 1238, 1024, 4323, 11371, 18120, 14427, 13201, 6870, 14911, 17623, 13765, 2235, 3437, 6806, 8827, 13824, 10952, 9356, 19534, 8507, 13284, 4144, 3801, 13258, 13389, 15286, 13434, 7741, 3108, 2800, 11022, 15702, 16838, 9624, 12052, 19186, 16424, 5808, 16400, 404, 44, 15077, 12507, 7994, 7616, 12466, 8346, 8106, 13872, 13010, 17187, 7040, 726, 4861, 195, 5281, 68, 10777, 16242, 72, 19472, 12909, 5381, 12531, 4901, 15684, 18003, 18704, 19436, 7054, 18146, 9385, 14656, 5142, 14969, 2350, 17629, 239, 6633, 19298, 11453, 13481, 14660, 3440, 15034, 13579, 5327, 16876, 10354, 18558, 19508, 13535, 7036, 13729, 320, 3575, 17204, 10593, 2652, 15335, 525, 7977, 16337, 5465, 16744, 19489, 1520, 9132, 14650, 13092, 3021, 7315, 15428, 19318, 8067, 8376, 16768, 17957 ]
STX_10002118.0
[ [ "The QnAMaker is currently in GA version, and is no longer in Preview. This doesn&#39;t seem like much, but it does mean the difference of a single recognizer variable: endpointHostName.\r\n\r\nYou currently have:\r\n\r\n const recognizer = new cognitiveServices.QnAMakerRecognizer({\r\n knowledgeBaseId: \" ;kbid \" ;,\r\n subscriptionKey: \" ;subKey \" ;\r\n });\r\n\r\nINSTEAD, it should read as follows:\r\n\r\n const recognizer = new cognitiveServices.QnAMakerRecognizer({\r\n knowledgeBaseId: \" ;kbid \" ;,\r\n authKey: \" ;subKey \" ;,\r\n endpointHostName: \" ;_URL_0_;\r\n });\r\n\r\nThe endpoint is listed as &#39;HOST&#39; on the code snippet from _URL_2_.\r\n\r\nAs for the reason you&#39;re not getting any replies, it&#39;s because you don&#39;t have the code necessary for your bot to tell you it has no idea which QnAMaker Knowledgebase you&#39;re talking about. A minor alteration to your final bot.dialog portion will help this.\r\n\r\n bot.dialog(&#39;qnaMakerDialog&#39;, qnaMakerDialog); \r\n \r\n bot.dialog(&#39;/&#39;, \r\n [\r\n function (session) {\r\n var qnaKnowledgebaseId = \" ;kbid \" ;;\r\n var qnaAuthKey = \" ;subKey \" ;;\r\n var endpointHostName = \" ;_URL_0_;;\r\n \r\n // QnA Subscription Key and KnowledgeBase Id null verification\r\n if ((qnaAuthKey == null || qnaAuthKey == &#39;&#39;) || (qnaKnowledgebaseId == null || qnaKnowledgebaseId == &#39;&#39;))\r\n session.send(&#39;Please set QnAKnowledgebaseId, QnAAuthKey and QnAEndpointHostName (if applicable) in App Settings. Learn how to get them at _URL_1_;);\r\n else {\r\n session.replaceDialog(&#39;qnaMakerDialog&#39;);\r\n }\r\n }\r\n ]);\r\n\r\nThat way, if any of them are missing or incorrect, your bot will return the canned message shown above to let you know something&#39;s missing. \r\n\r\nHappy coding!", "964" ], [ "Per the the documentation on QnAMaker, they currently do not support authenticated data sources, such as those on SharePoint. The only way to use documents from SharePoint as knowledge-base data is to download the files manually from SharePoint, and then use QnAMaker&#39;s file-upload option to extract the question-answer pairs. \r\n\r\nBear in mind, the files must be in the supported format of .tsv, .pdf, .doc, .docx, or .xlsx. Also, as you&#39;ve stated &#39;lots of information&#39;, QnAMaker does limit how many documents you can add to the free tier: 3 documents, up to 1MB per. The standard tier, which is $10/month, allows for unlimited documents.\r\n\r\nHope this helps!", "165" ], [ "Unfortunately, I am not a web security expert, but as a bot is just another form of web app, I imagine you would secure against DDOS or traffic surges against bots the same way as any other app. If you&#39;re looking to code that only a human can interact with your bot, thus limiting the amount of API calls over time to what a human can realistically create, you would want to look into making a form of login/registration before the client interacts with the bot, and institute some form of captcha.", "230" ], [ "For the Preview version of a Skype bot at least, the &#39;Capabilities&#39; and &#39;Privacy&#39; sections are automatically generated by Skype, and are not something that can be altered by the developer when building the bot. The only changes that can be made to that section are if you disable the bot&#39;s ability to make messages, that particular bullet goes away, and if you allow the bot the ability to make calls, it adds in the -Make calls bullet.", "259" ], [ "While I am unfamiliar with Facebook Messenger for bots, as far as I can tell, a postback button seems to work the same as any other button, with added async functionality. The intermittent internet connection appears to be interrupting that async call. There isn&#39;t a work around that I know of, as your bot is still waiting for a response from your user, a response that won&#39;t come, if your user thinks they&#39;ve already sent info to the bot. \r\n\r\nI would put a proactive/welcome message in the very beginning of your bot dialog that if the user is connecting with a weak/intermittent internet connection, to resend their response if the bot doesn&#39;t respond. If you&#39;re using the bot for sales purposes, then a message to not use the bot unless they&#39;re using a stable internet connection as they could accidentally send a purchase order twice, would be more appropriate.", "812" ], [ "Using the generic code, the bot created is simply an echo bot, replying with what the user says. Can you clarify what you mean by &#39;saying both user and bot&#39;? Do you mean, if you say into a mic \" ;Hello Echo Bot \" ;, does it say back \" ;Hello Echo Bot you said Hello Echo Bot \" ;? Or does it simply say \" ;You said \" ; and what the user said to it?", "224" ], [ "Hi <PERSON>! This is theoretically possible, using custom storage, and passing a conversationID along with the dialogs to ensure it all stays in one conversation (thus, no new conversationIDs would be started by new users), however, if you have all members of a group in one place along with the bot, such as a slack channel, your users wouldn&#39;t be able to have \" ;side conversations \" ; (with each other) AFAIK because the bot would interpret them as incoming dialog to it&#39;s on dialog flow. I&#39;m working on a sample case at the moment for this, because this idea is fascinating, however.", "855" ], [ "If you&#39;re JUST testing the bot, for thing such as channel specific functionality, you don&#39;t need a Privacy Policy and Terms of Use. Those are for if you are going to actually publish your bot for others to see.\r\n\r\nConnect your Bot to the Skype channel on the channels list in Azure under bot management. It will open the configuration settings page. Since this is just a test bot, you can click over to the &#39;calling&#39; section, and click &#39;disable calling&#39;. This will enable the &#39;Save&#39; button. Click save, then click the &#39;channels&#39; list again. Skype will now be listed (possibly with a warning &#39;There was a problem synchronizing your bot to Skype.&#39; You can ignore this for now). \r\n\r\nClick on the actual word &#39;Skype&#39; in the list, and a _URL_0_ page will open in a separate tab or window. Click &#39;Add to Contacts&#39;, and follow the prompts. When you next open Skype, your bot will be listed in your contacts.\r\n\r\nAgain, this is ONLY for testing. No other person will be able to connect to your bot, and you won&#39;t be able to list your bot in the [Skype Bot Shop][1]. If you do decide to officially publish your bot, there are sites such as [TermsFeed][2] to help with creating a Privacy Policy and Terms of Service.\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_2_", "220" ], [ "Hi <PERSON>! I have one request and one question. Can you link the tutorial you used to configure (the outdated one) and the question is: does that tutorial instruct you to change the messaging endpoint on Azure? (Currently (8-9-18) Azure is experiencing a bug where altering the messaging endpoint causes the bot to cease responding. The team is working on the issue, but if this is not the case, we can look deeper into your issue.", "220" ], [ "That doc is outdated, to some extent. The portion **UP TO** connecting your Slack App to Bot Framework is correct, however, there are both difference and addtional steps that must be taken from that point.\r\n\r\nAs you&#39;re aware, the bot must be created in the Azure Portal. **AFTER** the step that instructs you to create a Bot User on the Slack API page, go ahead and swap over to Azure and create your bot. For assistance on how to do that, you can follow [Create A Bot with Bot Service](_URL_2_)\r\n\r\nOnce your bot is created and deployed successfully, click over to the Bot Management Setting blade. You&#39;re going to need your bot handle, and ***YES it is case sensitive***. That is what you&#39;re going to use for your &#39;Subscribe to Bot Events&#39; Request URL.\r\n\r\n [![Settings and Bot Handle][1]][1]\r\n\r\nFrom there, you can go ahead and follow the **&#39;Subscribe to Bot Events&#39;**, **&#39;Add and Configure Interactive Messages (optional)&#39;**, and **&#39;Gather credentials&#39;** sections of the tutorial as is.\r\n\r\nNext, head back to Azure Portal and your bot there. Click the **Channels** under Bot Management (link above settings), scroll to the bottom, and select **Slack**. THAT is where you&#39;re going to put your Slack credentials. Once you push save, a new window will open, asking you to Authorize your bot. Go ahead and click &#39;Authorize&#39;.\r\n\r\n\r\n[![Authorize Bot][2]][2]\r\n \r\n\r\nThe Tutorial ends there, however, there are a few small steps that still need to be taken. Go back to the Slack App and click **&#39;Basic Information&#39;**. On the main screen, there is a list of checked steps under the heading **&#39;Building Apps for Slack&#39;** Click on the one that says **&#39;Install your app to your workspace&#39;** (1), then click the button that says &#39;Install App to Workspace&#39;(2)\r\n\r\n[![Install App to Workspace and Authorize][3]][3]\r\n\r\n\r\nOnce more, a new window will pop up, asking for authorization. Again, select &#39;Authorize&#39;\r\n\r\n[![Authorize Final][4]][4]\r\n\r\nAfter that, wait a few minutes for Slack to finalize the authorization on their end (I&#39;ve had a bot take 5 min to authorize the connection). Then, you can go back into the Slack workspace, and either directly message your bot or add them to a channel and test.\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_3_\r\n [3]: _URL_4_\r\n [4]: _URL_0_", "220" ], [ "I recently had a similar issue with changing messaging endpoints on bots via the Azure Portal, though I was just trying to use ngrok. If you change the endpoint, the bot does in fact, cease to respond. The work around for this is to put your Microsoft AppId and AppPassword in your bot code, to validate it. \r\n\r\nI&#39;m not sure how Watson works, but for BotBuilder node.js bots, the code below is what you have to do to connect the non-azure code to the bot endpoint:\r\n\r\n var builder = require(&#39;botbuilder&#39;)\r\n var connector = new builder.ChatConnector({\r\n appId: process.env.MICROSOFT_APP_ID,\r\n appPassword: process.env.MICROSOFT_APP_PASSWORD\r\n });\r\n\r\n[Here](_URL_0_) is the link to bot-builder&#39;s ChatConnector in the documentation so you can see exactly what it does, and find a way to implement it in your Watson code.", "220" ], [ "Hi <PERSON>! This is theoretically possible, using custom storage, and passing a conversationID along with the dialogs to ensure it all stays in one conversation, however, if you have all members of a group in one place along with the bot, such as a slack channel, you wouldn&#39;t be able to have \" ;side conversations \" ; AFAIK because the bot would interpret them as incoming dialog. I&#39;m working on a sample case at the moment for this.", "812" ], [ "You can get phone numbers and emails of logged in users by accessing the Microsoft AAD Graph API. For example:\r\n\r\n public async Task < User > GetMe()\r\n {\r\n var graphClient = GetAuthenticatedClient();\r\n var me = await _URL_1_.Request().GetAsync();\r\n return me;\r\n }\r\n\r\nA full sample can be found [here](_URL_0_).", "651" ] ]
477
[ 18607, 15794, 8932, 17869, 7685, 9473, 15464, 5763, 4610, 19770, 19715, 20, 14565, 3635, 12569, 12456, 8964, 12601, 17222, 15304, 11017, 10096, 4635, 13734, 13589, 3681, 18591, 4331, 2802, 15954, 15729, 12010, 10401, 7618, 19704, 13947, 8113, 16348, 12365, 16657, 16422, 14647, 18214, 8445, 15839, 6629, 14855, 17140, 3269, 11247, 199, 1586, 13844, 10680, 15136, 13087, 4299, 1474, 5898, 13333, 554, 1144, 16582, 15640, 15569, 17913, 17646, 15801, 5485, 17659, 17743, 11648, 7599, 1259, 5728, 9086, 2482, 11495, 8412, 9112, 17909, 693, 5833, 11550, 9307, 11919, 13932, 5235, 10729, 11220, 6261, 7045, 15800, 19419, 17147, 10522, 18088, 8970, 10085, 1291, 10691, 8302, 9364, 16092, 10919, 4632, 15095, 15104, 17497, 6132, 4363, 13240, 10233, 8665, 1749, 17466, 15362, 17091, 14471, 6336, 19045, 15492, 11515, 3235, 5608, 1231, 924, 8824, 13062, 17360, 17892, 3890, 8938, 9612, 12478, 5316, 11178, 10150, 19469, 14394, 18048, 4418, 15324, 11660, 18993, 11038, 3459, 14919, 7238, 10644, 7077, 8676, 3712, 13269, 17753, 17119, 8069, 13657, 3387, 13084, 7137, 1683, 12851, 10411, 10100, 13225, 3129, 11129, 13437, 6956, 15030, 8125, 13930, 7770, 15168, 4381, 11163, 1208, 3172, 13176, 6909, 9062, 4673, 13690, 11973, 15219, 3220, 17910, 2404, 17812, 5929, 19005, 8611, 19788, 12188, 17481, 15892, 16895, 17937, 10829, 14580, 19168, 6631, 6429, 1185, 9602, 13560, 14955, 344, 3984, 7664, 19195, 14366, 8024, 14056, 9890, 6424, 18378, 15226, 9931, 2742, 5735, 19462, 13628, 6055, 4309, 8763, 4229, 3304, 10697, 5015, 10078, 2715, 18586, 16249, 3094, 12079, 5073, 1240, 11601, 16492, 3798, 1331, 11318, 13534, 17030, 8716, 11442, 14234, 17354, 19029, 3251, 12876, 6583, 1888, 19591, 3143, 19197, 1316, 4719, 8352, 12913, 7487, 12271, 11049, 13311, 13014, 10899, 5053, 15409, 15098, 14912, 18696, 5254, 8111, 16025, 9957, 5042, 8902, 16927, 2385, 5331, 13880, 19679, 14137, 19547, 7446, 4396, 18376, 15310, 5681, 7919, 13563, 14275, 18195, 12778, 18667, 1739, 8291, 1130, 10642, 14483, 10403, 6941, 19724, 1873, 2648, 6554, 11322, 12793, 3535, 14760, 11934, 8146, 1964, 9818, 4657, 1618, 14283, 13344, 2330, 19428, 15074, 8524, 11795, 5067, 16349, 18668, 12797, 9226, 1688, 5320, 1653, 16159, 17144, 5776, 2001, 5715, 183, 12298, 3764, 12637, 12763, 14376, 15453, 14688, 6540, 252, 13759, 14448, 9675, 3238, 16180, 18392, 18495, 3886, 18542, 18858, 14539, 17516, 3752, 9228, 4659, 19032, 6147, 207, 14103, 4070, 13762, 2313, 11263, 956, 978, 7140, 2059, 10885, 6340, 17733, 4272, 1551, 7798, 15413, 6991, 3973, 14543, 18863, 10459, 12497, 15997, 2542, 9543, 5305, 275, 3955, 17936, 7253, 14695, 5720, 14341, 14404, 5122, 8018, 1242, 17780, 15650, 5263, 1665, 8014, 10982, 15950, 15748, 18843, 14560, 8561, 9452, 17478, 2597, 4848, 17670, 8010, 9482, 3603, 12132, 13405, 14326, 3755, 19304, 4705, 7093, 2305, 14787, 4895, 6709, 14344, 16253, 1656, 19453, 3067, 3368, 7354, 18368, 1742, 57, 10957, 9433, 15606, 3092, 16056, 1077, 4567, 14703, 5691, 1294, 817, 2035, 9744, 9312, 16580, 17838, 10639, 10715, 19353, 7880, 18980, 15438, 13319, 17223, 6412, 3876, 6940, 3047, 4721, 17338, 11774, 12855, 19738, 16162, 10332, 8106, 9447, 7805, 8741, 7938, 12159, 13857, 14614, 11324, 2117, 15365, 2890, 14459, 11190, 16031, 14197, 18184, 6612, 3711, 5964, 9635 ]
STX_1000254.0
[ [ "Because java generics is used at compile time to provide tighter type checks, the type parameter is erased by compiler according [Type Erasure rules][1]:\r\n\r\n- Replace all type parameters in generic types with their bounds or Object if the type parameters are unbounded. The produced bytecode, therefore, contains only ordinary classes, interfaces, and methods.\r\n- Insert type casts if necessary to preserve type safety.\r\n- Generate bridge methods to preserve polymorphism in extended generic types.\r\n\r\nIn code `Map < String, Map > aMap = new HashMap < String, Map > ();`, the value in `aMap` is a raw type `Map`, which means the compiler has no idea what&#39;s the type it contains, when you try to cast a raw type of `Map` to any generics type of `Map` like `Map < String, Integer > `, the best compiler can do is giving you a warning. The generic type is erased at compile time and type cast will be generated when you get value from a generic map, so you can only get a **runtime** `ClassCastException` exception if the type mismatchs.\r\n\r\n Let&#39;s have a look at the following example:\r\n\r\n public static void main(String[] args) {\r\n Map map = new HashMap();\r\n\r\n map.put( \" ;hello \" ;, \" ;world \" ;);\r\n map.put(new Integer(1), 1);\r\n map.put(new Object(), Lists.newArrayList( \" ;hello \" ;));\r\n\r\n Map < String, Integer > m = (Map < String, Integer > ) map;\r\n System.out.println(m);\r\n\r\n Integer i = m.get( \" ;hello \" ;);// ClassCastException happens at here at runtime\r\n }\r\n\r\nI&#39;m trying to convert a `Map` containing all kinds of keys and values to `Map < String, Integer > ` but there&#39;s no compile error, after type erasure, the above code is actually equivalent to:\r\n\r\n public static void main(String[] args) {\r\n Map map = new HashMap();\r\n\r\n map.put( \" ;hello \" ;, \" ;world \" ;);\r\n map.put(new Integer(1), 1);\r\n map.put(new Object(), Lists.newArrayList( \" ;hello \" ;));\r\n\r\n Map m = (Map) map;\r\n System.out.println(m);\r\n\r\n Integer i = (Integer)m.get( \" ;hello \" ;);\r\n }\r\n\r\nNow you can easily tell why the last line caused `ClassCastException`.\r\n\r\n [1]: _URL_0_", "6" ], [ "First of all, container is not a virtual machine, container is an isolation environment for a running a process, the life-circle of container is bound to the process running inside, when the process exits, the container also exits, and the isolation environment is gone. The meaning of \" ;attach to container \" ; or \" ;enter an container \" ; actually means you go inside the isolation environment of the **running process**, so if your process has been exited, your container has also been exited, thus there&#39;s no container for you to `attach` or `enter`. So the command of `docker attach`, `docker exec` are target at **running** container.\r\n\r\nWhich process will be started when you `docker run` is configured in `Dockerfile` and built into docker image. Take image `ubuntu` as example, \r\nif you run `docker inspect ubuntu`, you&#39;ll find the following configs in the output:\r\n\r\n \" ;Cmd \" ;: [ \" ;/bin/bash \" ;]\r\n\r\nwhich means the process got started when you run `docker run ubuntu` is `/bin/bash`, but you&#39;re not in an interactive mode and does not allocate an tty to it, so the process exited immediately and the container exited. That&#39;s why you have no way to enter the container again.\r\n\r\nTo start a container and enter `bash`, just try:\r\n\r\n docker run -it ubuntu\r\n\r\nThen you&#39;ll be brought into the container shell. If you open another terminal and `docker ps`, you&#39;ll find the container is running and you can `docker attach` to it or `docker exec -it < container_id > bash` to enter it again.\r\n\r\nYou can also refer to [this link][1] for more info.\r\n\r\n\r\n [1]: _URL_0_", "707" ], [ "I tried with your command and got the following output:\r\n\r\n $ > docker exec -it some-mariadb mysql -p -e &#39;select * from my_table&#39; my_db\r\n Enter password:\r\n ERROR 1049 (42000): Unknown database &#39;my_db&#39;\r\n\r\nActually your mariadb is running, and the output error message makes sense. There&#39;re two errors in your `docker run` command:\r\n\r\n- `-p <IP_ADDRESS>:8002:80`, mariadb is listening on port `3306`, and you can find out in [Dockerfile of Mariadb][1] that the only port exposed is 3306. I guess what you want is `-p 3306:3306`\r\n- `-v c:/mysql`, you&#39;re adding extra volume under container directory `/c:/mysql`, but the data volume for mariadb is `/var/lib/mysql`. If you want to use mysql data on your host, you need `-v < your_host_directory > :/var/lib/mysql`\r\n\r\nIf you go inside the container `some-mariadb` and try `mysql` cleint, you&#39;ll see there&#39;s no database called `my_db`:\r\n\r\n $ > docker exec -it some-mariadb bash\r\n root@63154453ff14:/# mysql -u root -pmy-secret-pw\r\n MariaDB [(none)] > show databases;\r\n +--------------------+\r\n | Database |\r\n +--------------------+\r\n | information_schema |\r\n | mysql |\r\n | performance_schema |\r\n +--------------------+\r\n 3 rows in set (0.00 sec)\r\n \r\nSo you need either mount the correct mysql data volume, or init mariadb firstly.\r\n\r\n [1]: _URL_0_", "486" ], [ "First of all, you can&#39;t embed Docker build command into shell of `RUN`, the shell will run inside the intermediate container during build process, and Docker build commands will be ran by Docker build engine, they&#39;re different things. And besides, Docker does not support conditional commands like `IF` or something like that. Docker is about immutable infrastructure, Dockerfile is the definition of your image and it&#39;s supposed to be able to generate the same image no matter what build context it is in. And from the delivery perspective of view, the image is your deliverable build artifacts, if you want to deliver different stuff, then use different Dockerfile to build different images, otherwise if the differences is about the runtime, I think you could really consider postpone the `env` definition to the runtime with `-e` option of `docker run`.", "324" ], [ "You can configure docker daemon by option `--graph(-g for short)`. In CentOS the service is managed by Systemd, you can find the link of service unit file at `/etc/systemd/system/multi-user.target.wants/docker.service`, or the original place `/usr/lib/systemd/system/docker.service` and change the `ExecStart` line, like:\r\n\r\n ExecStart=/usr/bin/dockerd -H unix:///var/run/docker.sock -g /opt\r\n\r\nThen use `systemctl daemon-reload` to reload the changes, and `systemctl restart docker` to restart docker service.", "707" ], [ "The decorated function is passed to the decorator as an argument and returned another function to replace the original one, the returned function is no recursive function, but when you call it, it&#39;ll call the original recursive function:\r\n\r\n def clock(func):\r\n def clocked(*args):\r\n t0 = time.perf_counter()\r\n result = func(*args) # You call your original recursive function here\r\n elapsed = time.perf_counter() - t0\r\n name = func.__name__\r\n arg_str = &#39;, &#39;.join(repr(arg) for arg in args)\r\n print(&#39;[%0.8fs] %s(%s) - > %r&#39; % (elapsed, name, arg_str, result))\r\n return result\r\n return clocked\r\n\r\nWhen you call your decorated function `factorial`, what you actually called is `clocked`, and it actually call `factorial` in the following line:\r\n\r\n result = func(*args)\r\n\r\nThe decorator is executed only once.\r\n\r\nFor understanding, you can think your function becomes to the following one after `@clock`:\r\n\r\n def factorial(*args):\r\n def _factorial(n):\r\n return 1 if n < 2 else n*_factorial(n-1)\r\n t0 = time.perf_counter()\r\n result = _factorial(*args)\r\n elapsed = time.perf_counter() - t0\r\n name = _factorial.__name__\r\n arg_str = &#39;, &#39;.join(repr(arg) for arg in args)\r\n print(&#39;[%0.8fs] %s(%s) - > %r&#39; % (elapsed, name, arg_str, result))\r\n return result", "799" ], [ "Java is a strong-type programming language, which means to define every variable, you need to specify its type, and for each variable, it can only hold a value belongs to the same type. For primitive types Java also defines the rules how different types can be casted to each other, there&#39;s `Widening Primitive Conversion`(no info loss) and `Narrowing Primitive Conversion`(info may loss), you can find more details at [the official Java docs][1]. So the reason you can do `int i = (int) f;` is that the conversion rule is defined in Java Spec and Java compiler **allows** you to do so. You can&#39;t do `int a = (int) true` if you tried, because there&#39;s no such a rule to convert `boolean` type to `int`.\r\n\r\nType casting rules for reference types are also simple, the compiler only allow you to do type casting `A a = (A) b` when it thinks the type of `b` **maybe** `A` or some `sub-type` of `A` in the type hierarchy, take a look at the following code:\r\n\r\n Object b = c;\r\n A a = (A) b;\r\n\r\n compiler only knows that b is type `Object` but has no idea of its specific type, because `Object` is the `root` of Java type hierarchy, so the real type of `b` maybe any type, like type `A`, so the compiler will allow you to do so. If `b` actually is **not** a `A`, the error can only be found at runtime, when a `ClassCastException` will be thrown.\r\n\r\nOn the other hand, the compiler will prevent you to do `A a = (A) b` when it **clearly knows** that `b` is not type `A`:\r\n\r\n class A {}\r\n class B {}\r\n\r\nIf you have the above definition of type `A` and `B`, then compiler has enough information that an instance `B` is absolutely not type `A`, so it will give you a compile error of `Inconvertible types` when you try to do `A a = (A) new B()`. And this is one of big benefits to use a strong-type programming language: to guarantee type safety (at compile time for Java). \r\n\r\n [1]: _URL_0_", "372" ], [ "As far as I know Marathon has no such feature, Marathon is used to manage(create/delete/scale/health-check) apps on Mesos cluster as what `init` process(e.g. Systemd) do for Linux. Scheduled jobs is delegated to other frameworks, [scheduled jobs functionality on CS/OS][1] mentioned in your question is provided by [metronome][2], and there&#39;s also a sophisticated framework [Chronos][3] to do the same thing, as what `crontab` job for Linux.\r\n\r\nEven Marathon has no built-in features like that, it provides rich [RESTful APIs][4], you can easily resolve your problem by using Chronos and Marathon together:\r\n\r\n1. Create a script to stop/start your app through Marathon API\r\n2. Create Chronos job to run your script at midnight to stop your app\r\n3. Create Chronos job to run your script at 6AM to start app\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_1_\r\n [3]: _URL_3_\r\n [4]: _URL_0_", "496" ], [ "This is not about your disk partition but I think you&#39;re doing too much things in startup shell, I&#39;d like to suggest you to define your own `Dockerfile` and build your own image. I test with the following `Dockerfile`:\r\n\r\n FROM continuumio/miniconda3\r\n\r\n RUN /opt/conda/bin/conda install jupyter -y --quiet & & mkdir /opt/notebooks\r\n\r\n VOLUME /opt/notebooks\r\n EXPOSE 8888\r\n WORKDIR /opt/notebooks\r\n\r\n CMD [ \" ;/opt/conda/bin/jupyter \" ;, \" ;notebook \" ;, \" ;--notebook-dir=/opt/notebooks \" ;, \" ;--ip=&#39;*&#39; \" ;, \" ;--port=8888 \" ;, \" ;--no-browser \" ;, \" ;--allow-root \" ;]\r\n\r\nThen build your own image:\r\n\r\n docker build -t jupyter .\r\n\r\nAfter than you can easily start your service like:\r\n\r\n docker run -d -v `pwd`/notebooks:/opt/notebooks -p 8888:8888 jupyter\r\n\r\nOf course you can mount any directory on your host to `VOLUME /opt/notebooks` inside container.", "324" ], [ "The [official FAQ page][1] has detailed explanation for this error:\r\n\r\n > > > x = 10\r\n > > > def foo():\r\n ... print(x)\r\n ... x += 1\r\n > > > foo()\r\n Traceback (most recent call last):\r\n ...\r\n UnboundLocalError: local variable &#39;x&#39; referenced before assignment\r\n\r\n > This is because when you make an assignment to a variable in a scope, that variable becomes local to that scope and shadows any similarly named variable in the outer scope. Since the last statement in foo assigns a new value to x, the compiler recognizes it as a local variable. Consequently when the earlier print(x) attempts to print the uninitialized local variable and an error results. \r\n\r\nAnd for code:\r\n\r\n a = [1]\r\n def a_add():\r\n a[0] += 1\r\n\r\n a_add()\r\n print(a)\r\n\r\nIt just reads value from and assigns value to the first slot of the `global` array, so there&#39;s no problem.\r\n\r\n [1]: _URL_0_", "373" ], [ "`virtualenv` is a good idea as @cricket_007 points out in comment. For your question why pip does not use the cache when you re-run it with `sudo`, that&#39;s because the cache directory is related with the user who owns the running process. More specific for Unix and MacOS, it&#39;s:\r\n\r\n- Unix: `~/.cache/pip and it respects the XDG_CACHE_HOME directory.`\r\n- macOS: `~/Library/Caches/pip`\r\n\r\nYou can find more details at [cache docs of pip][1], or explore the source code at [user_cache_dir][2]. So when you retry with `sudo`, the cache directory is expanded to `/root/.cache` \r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "708" ], [ "Your first piece of code will not loop list `grains` as your expectation, it&#39;ll actually only compare `grains[0] == [x, y]` and the `for` loop will exit due to you have `return` in either `if` and `else` branch, while the second implementation will check whether `[x, y]` is in the whole list `grains` or not. \r\n\r\nYou should **NOT** use code like this but the `for` loop code is supposed to be:\r\n \r\n for i in grains:\r\n if i == [x,y] :\r\n break\r\n else:\r\n grains.append([x,y])\r\n grains_restants = grains_restants - 1\r\n fourmi_chargee = False", "598" ], [ "> which user would be to perform commandC?\r\n\r\nIf there&#39;s no `USER` command between `commandB` and `commandC`, it&#39;s the user `www` to run `commandC`, from the [official docs of USER][1]:\r\n\r\n > The USER instruction sets the user name or UID to use when running the image and for any RUN, CMD and ENTRYPOINT instructions that **follow** it in the Dockerfile\r\n\r\nSo you only need to use `USER user` to switch the user at the place you really need to, not every `RUN` command. By the way, `USER` also applies to `CMD` and `ENTRYPOINT`, which means the user in the last `USER` command is also the user to run your process in container. \r\n\r\n\r\n [1]: _URL_0_", "742" ], [ "They are not equivalent, in the first code snippet, `parameter` will be 1.0 **if and only if** `parameter` is `None`, but in the second one, `parameter` will be 1.0 for any `falsy value`.The following values are all `falsy` in Python:\r\n\r\n- None\r\n\r\n- False\r\n\r\n- zero of any numeric type, for example, 0, 0L, 0.0, 0j.\r\n\r\n- any empty sequence, for example, &#39;&#39;, (), [].\r\n\r\n- any empty mapping, for example, {}.\r\n\r\n- instances of user-defined classes, if the class defines a __nonzero__() or __len__() method, when that method returns the integer zero or bool value False. \r\n\r\nSo the first code snippet is more strict. Official docs please refer to:\r\n\r\n- Python 2: _URL_1_\r\n- Python 3: _URL_0_", "419" ], [ "Credentials in Jenkins are managed at page: Jenkins - > Credentials - > System - > Global credentials, which looks like:\r\n\r\n[![Global credentials page][1]][1]\r\n\r\nThen you can find your git credential from the list, click the `update` icon at the right-most side to update your existing git credential info. Or you can click `Add Credentials` link at the left-bottom conner, add a new entry and choose it from all Job configuration page.\r\n\r\n [1]: _URL_0_", "857" ], [ "You can&#39;t run `docker exec` against a stopped container. From `docker help exec`:\r\n\r\n > $ docker help exec\r\n\r\n > Usage: docker exec [OPTIONS] CONTAINER COMMAND [ARG...]\r\n\r\n > Run a command in a **running container**\r\n\r\nSo if your target container has been stopped by some reason, you need to start it by `docker start < your_container > ` before you can do `docker exec ....`\r\n\r\nBTW, `docker run` command has an option called `--restart` to let you to specify a restart policy for the container, you can find more details on [docker run --restart docs][1]. There&#39;re 4 policies available:\r\n\r\n- **no**: Do not automatically restart the container when it exits. This is the default.\r\n\r\n- **on-failure[:max-retries]**: Restart only if the container exits with a non-zero exit status. Optionally, limit the number of restart retries the Docker daemon attempts.\r\n\r\n- **always**: Always restart the container regardless of the exit status. When you specify always, the Docker daemon will try to restart the container indefinitely. The container will also always start on daemon startup, regardless of the current state of the container.\r\n- **unless-stopped**: Always restart the container regardless of the exit status, but do not start it on daemon startup if the container has been put to a stopped state before.\r\n\r\nBy default it&#39;s `no`, you could choose another one based on your requirement. For example if you choose `non-stopped`, your container will got restarted automatically when docker daemon is ready after your server reboot.\r\n\r\n\r\n [1]: _URL_0_", "707" ], [ "The metadata in Hadoop NN consists of:\r\n\r\n- `fsimage`: contains the complete state of the file system at a point in time\r\n- `edit logs`: contains each file system change (file creation/deletion/modification) that was made after the most recent fsimage.\r\n\r\nIf you list all files inside your NN workspace directory, you&#39;ll see files include:\r\n\r\n fsimage_0000000000000000000 (fsimage)\r\n fsimage_0000000000000000000.md5\r\n edits_0000000000000003414-0000000000000003451 (edit logs, there&#39;re many ones with different name)\r\n seen_txid (a separated file contains last seen transaction id)\r\n\r\nWhen NN starts, Hadoop will load fsimage and apply all edit logs, and meanwhile do a lot of consistency checks, it&#39;ll abort if the check failed. Let&#39;s make it happen, I&#39;ll `rm edits_0000000000000000001-0000000000000000002` from many of my `edit logs` in my NN workspace, and then try to `sbin/_URL_1_`, I&#39;ll get error message in log like:\r\n\r\n _URL_0_.IOException: There appears to be a gap in the edit log. We expected txid 1, but got txid 3.\r\n\r\nSo your error message indicates that your `edit logs` is inconsitent(may be corrupted or maybe some of them are missing). If you just want to play hadoop on your local and don&#39;t care its data, you could simply `hadoop namenode -format` to re-format it and start from beginning, otherwise you need to recovery your edit logs, from SNN or somewhere you backed up before.", "859" ], [ "I&#39;m running Docker on CentOS 7, from time to time there&#39;s the following message displayed:\r\n\r\n Message from syslogd@dev-master at Mar 29 17:23:03 ...\r\n kernel:unregister_netdevice: waiting for lo to become free. Usage count = 1\r\n\r\nI&#39;ve googled a lot, read a lot of resources found and tried many ways like keeping my system updated, upgrading kernel etc, but the message still keeps showing up, it&#39;s not too often but sooner or later I&#39;ll see it. Also I found [issue for this problem on docker github][1] is still open, then my questions are:\r\n\r\n1. What does this message mean? Could somebody give me a simple explanation why docker causes it?\r\n2. Is there any workaround for this?\r\n3. If it could not be fixed yet(the issue is still open), will it affect the server or services running inside docker container? Will it be a serious performance issue because it also happens on our production servers? \r\n\r\nDocker version:\r\n\r\n Client:\r\n Version: 1.11.1\r\n API version: 1.23\r\n Go version: go1.5.4\r\n Git commit: 5604cbe\r\n Built: Wed Apr 27 00:34:42 2016\r\n OS/Arch: linux/amd64\r\n\r\n Server:\r\n Version: 1.11.1\r\n API version: 1.23\r\n Go version: go1.5.4\r\n Git commit: 5604cbe\r\n Built: Wed Apr 27 00:34:42 2016\r\n OS/Arch: linux/amd64\r\n\r\nOS info: \r\n\r\n CentOS 7, with kernel version: 4.6.0-1.el7.elrepo.x86_64\r\n\r\nI really appreciate for any info/tips or resources, thanks a lot. \r\n\r\n\r\n [1]: _URL_0_", "707" ], [ "The key difference between `String.replace` and `String.replaceAll` is that the first parameter for `String.replace` is `string literal`, but for `String.replaceAll` it is a `regex`. [java doc of those two methods][1] has great explanation about it. So if there&#39;s special chars like `\\` or `$` in the string which you want to replace, you&#39;ll see the different behaves again, like:\r\n\r\n public static void main(String[] args) {\r\n String str = \" ; < style type=\\ \" ;text/css\\ \" ; > #include\\ \" ;Invoice_Service_Tax\\\\.css\\ \" ; < /style > \" ;;\r\n String pattern = \" ;#include\\ \" ;Invoice_Service_Tax\\\\.css\\ \" ; \" ;;\r\n System.out.println(str.replace(pattern, \" ;some-value \" ;)); // works\r\n System.out.println(str.replaceAll(pattern, \" ;some-value \" ;)); // not works, pattern should be: \" ;#include\\ \" ;Invoice_Service_Tax\\\\\\\\.css\\ \" ; \" ;\r\n }\r\n\r\n \r\n [1]: _URL_0_", "829" ], [ "I made the following changes to make `mvn clean spring-boot:run` work:\r\n\r\n- Move `pom.xml` to the root directory, which makes the directory hierarchy to be:\r\n\r\nDirectory hierarchy:\r\n\r\n .\r\n ├── pom.xml\r\n └── src\r\n └── main\r\n ├── java\r\n │&#160;&#160; └── hello\r\n │&#160;&#160; ├── Application.java\r\n │&#160;&#160; └── GreetingController.java\r\n └── resources\r\n └── templates\r\n └── greeting.html\r\n\r\n- Commented out the `extensions` in the following part:\r\n\r\nCommented out part:\r\n\r\n < dependency > \r\n < groupId > org.springframework.boot < /groupId > \r\n < artifactId > spring-boot-starter-web < /artifactId > \r\n < !-- Exclusions to allow SpringBoot execute on HCP -- > \r\n < !-- < exclusions > -- > \r\n < !-- < exclusion > -- > \r\n < !-- < groupId > org.springframework.boot < /groupId > -- > \r\n < !-- < artifactId > spring-boot-starter-tomcat < /artifactId > -- > \r\n < !-- < /exclusion > -- > \r\n < !-- < exclusion > -- > \r\n < !-- < groupId > org.apache.tomcat.embed < /groupId > -- > \r\n < !-- < artifactId > tomcat-embed-el < /artifactId > -- > \r\n < !-- < /exclusion > -- > \r\n < !-- < exclusion > -- > \r\n < !-- < artifactId > logback-classic < /artifactId > -- > \r\n < !-- < groupId > ch.qos.logback < /groupId > -- > \r\n < !-- < /exclusion > -- > \r\n < !-- < /exclusions > -- > \r\n < /dependency > \r\n\r\nIt seems you meant to exclude those dependencies. `mvn clean spring-boot:run` will just exit successfully if the embed tomcat is excluded, but I think this is the correct behave because there&#39;s no container to deploy the application. Anyway, you can try it out and make changes according your requirements.", "429" ], [ "Glad to help. Traditionally, we follow J2EE specification and build our web application to a war, then deploy it to servlet container like Tomcat, Spring Boot tries to build/deploy/run spring based applications easier by package all necessary stuff into one bundle, it has different `starter`s for different kinds of applications, for web applications, the specific starter also packages servlet container inside, like Tomcat or Jetty. `spring-boot-starter-web` uses embed tomcat by default, so if you excludes it when build the package, there&#39;s no place to deploy your application, so it just exits.", "240" ], [ "The root cause you got the exception is that you&#39;re against the convention/rules to declare/create queries in Spring Data JPA.\r\n\r\n[The official docs of Spring Data JPA][1] mentioned that:\r\n\r\n > The goal of Spring Data repository abstraction is to significantly reduce the amount of boilerplate code required to implement data access layers for various persistence stores.\r\n\r\nThe central interface of abstraction is `Repository`, to manage your entity, you need to declare your own interface of `Repository` and JPA will help you to create proxy instances for those interfaces. There&#39;re already some base `Repositories` like `CrudRepository` or `PagingAndSortingRepository` to provide basic functionalities as you can tell from their names, so by extending those basic ones, you&#39;ll have many basic methods. To define more specific access methods, you need to follow the ways JPA provided to create queries:\r\n\r\n- Define method in your interface following the method name convention\r\n- Use @Query annotation to define it manually\r\n\r\nFor the first method, [the docs of Query Create][2] has detailed clarification, here&#39;s some key idea:\r\n\r\n > The mechanism strips the prefixes find…By, read…By, query…By, count…By, and get…By from the method and starts parsing the rest of it. The introducing clause can contain further expressions such as a Distinct to set a distinct flag on the query to be created. However, the first By acts as delimiter to indicate the start of the actual criteria. At a very basic level you can define conditions on entity properties and concatenate them with And and Or\r\n\r\nSimply speaking, JPA will parse the method name and try to find the related property to create query criteria for you. \r\n\r\nNow let&#39;s have a look at your code, if you just want to retrieve all of your entities, you don&#39;t need to define your own method, there&#39;s already `findAll` methods pre-defined, if you want to retrieve entities based on `text` content, it&#39;s supposed to look like:\r\n\r\n Entity findByText(String text)\r\n\r\nbut your method `findAllEntites` just don&#39;t match any rules, so JPA throws such an error message to you.\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_0_.query-methods.query-creation", "87" ], [ "There&#39;re many options to deserialize JSON as mentioned in other answers, most of the time it would be better to define a corresponding Java class and then do serialization/deserialization. One example implementation with [Gson][1] would be:\r\n\r\n public class Main {\r\n public static void main(String[] args) {\r\n Gson gson = new Gson();\r\n String jsonString = \" ;{\\ \" ;to\\ \" ;: \\ \" ;INR\\ \" ;, \\ \" ;rate\\ \" ;: 64.806700000000006, \\ \" ;from\\ \" ;: \\ \" ;USD\\ \" ;} \" ;;\r\n CurrencyRate currencyRate = gson.fromJson(jsonString, CurrencyRate.class);\r\n }\r\n \r\n class CurrencyRate {\r\n private String from;\r\n private String to;\r\n private BigDecimal rate;\r\n \r\n public String getFrom() {\r\n return from;\r\n }\r\n \r\n public void setFrom(String from) {\r\n this.from = from;\r\n }\r\n \r\n public String getTo() {\r\n return to;\r\n }\r\n \r\n public void setTo(String to) {\r\n _URL_1_ = to;\r\n }\r\n \r\n public BigDecimal getRate() {\r\n return rate;\r\n }\r\n \r\n public void setRate(BigDecimal rate) {\r\n this.rate = rate;\r\n }\r\n }\r\n }\r\n\r\nAnd Gson is `Thread Safe`, so it&#39;s OK to init only one Gson instance and share it among all threads.\r\n\r\n [1]: _URL_0_", "125" ], [ "> should I move the creation of the executorService right above?\r\n\r\nNo you don&#39;t, you have your `ExecutorService` the right place in your example code. Think it as a thread pool, you will not want to init a new thread pool and close it for each method call of `handleRequest`. Of course `ExecutorService` does more job than a thread pool, actually it&#39;ll manage a thread pool underneath, and provides life-circle management for async tasks. \r\n\r\n > I am not really calling shutdown anywhere since the app will always run in it&#39;s docker container.\r\n\r\nIn most of cases you init your `ExecutorService` when applications starts and shut it down when applications shuts down. So you can just leave it there, because it&#39;ll be closed when application exits, or you can add some kind of `shutdown hooks` if you need to do graceful shutdown.\r\n\r\n > Is it costly to keep creating and discarding the pool.\r\n\r\nKind of, we don&#39;t want to create and discard `Thread` very often, so we have thread pool, if you create/discard pool for each method call, what&#39;s the point to have a thread pool.\r\n\r\n > or is the current way going to leak memory?\r\n\r\nNo, as long as the task you submitted does not leak memory. The implementation of `ExecutorService` itself is good to use.\r\n\r\n > And I think calling the pool static as a private field var is redundant since the class is a spring bean anyways (singleton)\r\n\r\nYes, you&#39;re correct. You can also define `ExecutorService` as Spring Bean and inject it to service bean, if you want to do some customized init process.\r\n\r\n > should I be using a cachedThreadPool, I am not sure how to approximate the number of threads I need.\r\n\r\nThat&#39;s hard to say, you need to do some test to get the right number of threads for your application. But most of NIO or EventDriven framework has the twice number of available cores to be the number of threads by default.", "880" ], [ "From your code I think simply remove ` < T extends Comparable < T > > ` from your method is not enough because it is a `override` method but there&#39;s no type declaration in your interface `IMergeSorter`.\r\n\r\nI don&#39;t know your `IMergeSorter` declaration but it could be:\r\n\r\n public interface IMergeSorter < T extends Comparable < T > > {\r\n int sort(List < T > list);\r\n }\r\n\r\nAnd then your `MergeSorter` should be:\r\n\r\n import java.util.Comparator;\r\n import java.util.List;\r\n\r\n public class MergeSorter < T extends Comparable < T > > implements IMergeSorter < T > {\r\n private List < T > arrayStore;\r\n private List < T > temp;\r\n private int arrSize;\r\n\r\n @Override\r\n public int sort(List < T > list) {\r\n this.arrayStore = list;\r\n return 0;\r\n }\r\n }", "842" ], [ "Problems in your config:\r\n > -Xms1536m -Xmx5120 \r\n\r\nIf you don&#39;t specify the unit of this config, it will be parsed as `bytes`, which means your `Xmx` is less than your `Xms`, if this config applies JVM will failed to launch:\r\n\r\n  ~/ java -Xms1536m -Xmx5120 -XX:+PrintFlagsFinal -version\r\n Error occurred during initialization of VM\r\n Initial heap size set to a larger value than the maximum heap size\r\n\r\nYour JVM did not aborted because you have following configs:\r\n\r\n > -XX:InitialHeapSize=2570m -XX:MaxHeapSize=2570m\r\n\r\n`-Xms` is `-XX:InitialHeapSize` and `-Xmx` is `-XX:MaxHeapSize`, so your previous wrong config of `-Xms1536m -Xmx5120` is replaced by the later ones, which specified `Xmx` to be 2570M.", "741" ], [ "Your volume directory is `/var/lib/docker/volumes/blog_postgres-data/_data`, and `/var/lib/docker` usually mounted on `C:\\Users\\Public\\Documents\\Hyper-V\\Virtual hard disks`, anyway you can check it out by looking docker settings.\r\n\r\nYou can refer to [this docs][1] for info of how to share drives with docker on windows.\r\n\r\nBTW, `Source` is the location on the host and `Destination` is the location inside container in the following output:\r\n\r\n \" ;Mounts \" ;: [\r\n {\r\n \" ;Name \" ;: \" ;fac362...80535 \" ;,\r\n \" ;Source \" ;: \" ;/var/lib/docker/volumes/fac362...80535/_data \" ;,\r\n \" ;Destination \" ;: \" ;/webapp \" ;,\r\n \" ;Driver \" ;: \" ;local \" ;,\r\n \" ;Mode \" ;: \" ; \" ;,\r\n \" ;RW \" ;: true,\r\n \" ;Propagation \" ;: \" ; \" ;\r\n }\r\n ]\r\n\r\n===========================================================================\r\n\r\nUpdated to answer questions in the comment:\r\n\r\n > My main curiosity here is that sharing images etc is great but how do I share my data?\r\n\r\nActually `volume` is designed for this purpose(manage data in docker container), the data in volume is persisted on host FS and isolated with the life-circle of docker container/image. You can share your data with volume by:\r\n\r\n- Mount docker volume to host and reuse it\r\n\r\n `docker run -v /path/on/host:/path/inside/container image`\r\n\r\n Then all your data will persisted in `/path/on/host`, you could backup it, copy it to other machine and re-run your container with the same volume. \r\n\r\n- Create and mount a data container.\r\n\r\n Create data container: `docker create -v /dbdata --name dbstore training/postgres /bin/true`\r\n Run other container based on this container using `--volumes-from`: `docker run -d --volumes-from dbstore --name db1 training/postgres`, then all data generated by `db1` will persisted in the volume of container `dbstore`.\r\n\r\nFor more information you could refer to [official docs of docker volumes][2], simply speaking, `volumes` is just a directory on your host with all your container data, so you could use any methods you used before to backup/share your data.\r\n\r\n > can I push a volume to docker-hub like I do with images?\r\n\r\nNo, docker image is something you deliver, but data is not. You could backup/persist/share your data with any method you like, but pushing data to docker registry to share it does not make any sense.\r\n\r\n > can I make backups etc?\r\n\r\nYes, as posted above :-)\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "324" ], [ "To schedule job programatically, you have the following options:\r\n\r\n- For simple cases you can have a look at `ScheduledExecutorService`, which can schedule commands to run after a given delay, or to execute periodically. It&#39;s in package `java.util.concurrent` and easy to use.\r\n- To schedule Crontab job dynamically, you can use quartz and [here&#39;s official examples][1], basically what you&#39;ll do is:\r\n\r\n - Create instance `Scheduler`, which can be defined as a java bean and `autowire` by Spring, example code:\r\n - Create `JobDetail`\r\n - Create `CronTrigger`\r\n - Schedule the `job` with `cron`\r\n\r\nOfficial example code(scheduled to run every 20 seconds):\r\n\r\n SchedulerFactory sf = new StdSchedulerFactory();\r\n Scheduler sched = sf.getScheduler();\r\n\r\n JobDetail job = newJob(SimpleJob.class)\r\n .withIdentity( \" ;job1 \" ;, \" ;group1 \" ;)\r\n .build();\r\n\r\n CronTrigger trigger = newTrigger()\r\n .withIdentity( \" ;trigger1 \" ;, \" ;group1 \" ;)\r\n .withSchedule(cronSchedule( \" ;0/20 * * * * ? \" ;))\r\n .build();\r\n\r\n sched.scheduleJob(job, trigger);\r\n\r\n [1]: _URL_0_", "496" ], [ "From `man service`:\r\n\r\n > service runs a System V init script in as predictable environment as possible, removing most environment variables and with current working directory set to /.\r\n\r\nSo when you try to run a service script, only several env variables like `TERM`, `LANG` remains, your `http_proxy` and `https_proxy` is discarded. To use environment variables you need, you could define them in file `/etc/default/yourservice` with:\r\n\r\n http_proxy=_URL_0_\r\n https_proxy=_URL_0_\r\n\r\n and `source` it in the beginning of your script:\r\n\r\n [ -f /etc/default/yourservice ] & & . /etc/default/yourservice", "191" ], [ "Because you call `canceled[0] = future.cancel(false);` with parameter `false`. From <PERSON> of `Future.cancel`:\r\n\r\n > If the task has already started, then the mayInterruptIfRunning parameter determines whether the thread executing this task should be interrupted in an attempt to stop the task.\r\n\r\n > @param mayInterruptIfRunning {@code true} if the thread executing this task should be interrupted; otherwise, in-progress tasks are allowed to complete\r\n\r\nWhen you call `cancel`, your task has already started and you allow it to complete, so cancel operation is actually successful and return `true`, if you call `canceled[0] = future.cancel(true);`, you&#39;ll not see the output.", "123" ], [ "Other answers have given the hits to change `char` to `int`, but actually you don&#39;t need use `switch-case`, try the following code:\r\n\r\n public static void main(String[] args) {\r\n\r\n Scanner scan = new Scanner(_URL_0_);\r\n String input = scan.next();\r\n int[] numberAmount = new int[10];\r\n for (int i = 0; i < input.length(); i++) {\r\n numberAmount[(int)input.charAt(i) - 48] ++; // This is enough\r\n }\r\n for (int i = 0; i < = 9; i++) {\r\n System.out.printf( \" ;%d: %d\\n \" ;, i, numberAmount[i]);\r\n }\r\n }", "552" ], [ "Thanks for your extra info, I was really thinking I got your idea until I reached `So, my output would be that each meetingDetails object contains a list of Booking objects`, do you just want to sort &#39;Bookings&#39; by &#39;meetingDetails&#39;, or do you want to group your &#39;bookings&#39; by &#39;meetingDetail&#39;? I think it&#39;ll be clear if you could give an example input and desired output.", "837" ], [ "If you plan to run all your applications inside one docker container, don&#39;t do it. One of the purpose to use Docker is to isolate applications from each other, putting all of them into one container will bring more troubles than benefits, one example is it&#39;ll be more difficult if you just want to upgrade one of the applications.\r\n\r\nIf you really need/have to put them into one container, and then use `localhost:port` is OK for them to communicate with each other, just like they&#39;re running on one machine.\r\n\r\nIf you decide to run them in separated containers and even further they maybe run on multiple machines, this problem goes to multi-container communication and it&#39;s a big topic. The options you have include:\r\n\r\n- Docker multi-host networking, basically you&#39;ll need some docker networking driver to connect dockers across multi-hosts together, and then containers can connect to each other by container name or hostname e.g.\r\n \r\n There&#39;re many resources talking about this, you can refer to the following links for more info:\r\n\r\n - [overlay network][1]\r\n - [understanding docker networking drivers and use cases][2]\r\n - [weave driver][3]\r\n - [flannel][4]\r\n\r\n- Jump over docker multi-host networking, map your service port to a random host port, and then use a kind of `service discovery` service to facilitate the communication. Actually in our company, we&#39;re using [Mesos][5] to manage cluster, [marathon][6] to deploy our services, and then [Bamboo][7] as service discovery and LB, they&#39;re working together very well.\r\n\r\nThis is some sharing of my ideas, hope it could be helpful to you.\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_2_\r\n [3]: _URL_4_\r\n [4]: _URL_6_\r\n [5]: _URL_5_\r\n [6]: _URL_3_\r\n [7]: _URL_0_", "324" ], [ "Don&#39;t `new Node` itself in its constructor, it&#39;ll never end till stackoverflow or heap out of memory, you could do it:\r\n\r\n- Pass `left`, `right` to constructor:\r\n\r\nCode: \r\n\r\n public class Node {\r\n Node right;\r\n Node left;\r\n String element;\r\n Node parent;\r\n\r\n public Node(Node left, Node right){ \r\n this.left = left;\r\n this.right = right;\r\n }\r\n }\r\n\r\n- With `setter`:\r\n\r\nCode: \r\n\r\n public class Node {\r\n Node right;\r\n Node left;\r\n String element;\r\n Node parent;\r\n\r\n public Node(){ \r\n }\r\n\r\n public void setLeft(Node left) {\r\n this.left = left;\r\n }\r\n\r\n\r\n public void setRight(Node right) {\r\n this.right = right;\r\n }\r\n }", "959" ], [ "Sorry that this is not a direct answer to your programming problem, but if you&#39;re open for all options rather than implement it by yourself, I&#39;d like to share you our experiences with [fluentd][1] and it&#39;s [HDFS (WebHDFS) Output Plugin][2].\r\n\r\nFluentd is a open source, pluggable data collector and by which you can build your data pipeline easily, it&#39;ll read data from inputs, process it and then write it to the specified outputs, in your scenario, the input is `kafka` and the output is `HDFS`. What you need to do is:\r\n\r\n- Config fluentd `input` following [fluentd kafka plugin][3], you&#39;ll config the `source` part with your kafka/topic info\r\n- Enable `webhdfs` and `append` operation for your HDFS cluster, you can find how to do it following [HDFS (WebHDFS) Output Plugin][2]\r\n- Config your `match` part to write your data to `HDFS`, there&#39;s example on the plugin docs page. For partition your data by month and day, you can configure `path` parameter with time slice placeholders, something like:\r\n\r\n `path \" ;/event_data/%Y/%m/data%d \" ;`\r\n \r\nWith this option to collect your data, you can then write your mapreduce job to do ETL or whatever you like.\r\n\r\nI don&#39;t know if this is suitable for your problem, just provide one more option here.\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_2_\r\n [3]: _URL_0_", "841" ], [ "This is the [official explanation][1] you&#39;re looking for\r\n\r\n > > > x = 10\r\n > > > def foo():\r\n ... print(x)\r\n ... x += 1\r\n > > > foo()\r\n Traceback (most recent call last):\r\n ...\r\n UnboundLocalError: local variable &#39;x&#39; referenced before assignment\r\n\r\n > This is because when you make an assignment to a variable in a scope, that variable becomes local to that scope and shadows any similarly named variable in the outer scope. Since the last statement in foo assigns a new value to x, the compiler recognizes it as a local variable. Consequently when the earlier print(x) attempts to print the uninitialized local variable and an error results.\r\n\r\n\r\n\r\n [1]: _URL_0_", "373" ], [ "If `jsonString` is generated by you, you can consider to add `type info` and then use it to convert deserialized object. You could refer to [this post][1] for how to do it.\r\n\r\nIf `jsonString` is generated by other services beyond your control, then there&#39;s no type info you can get so you can only try it one by one, <PERSON> answer would be a nice choice.\r\n\r\nI&#39;d like to provide an additional option: define an `all-in-one` entity including all fields of `MyClass1`, `MyClass2` and `MyClass3`, and make `MyClass1`, `MyClass2` and `MyClass3` be separated wrapper and only expose related fields for each. Code as follows:\r\n\r\nClass `AllInOne`:\r\n\r\n public class AllInOne {\r\n protected String a;\r\n protected String b;\r\n protected String c;\r\n \r\n public A asA() {\r\n return new A(this);\r\n }\r\n \r\n public B asB() {\r\n return new B(this);\r\n }\r\n \r\n public C asC() {\r\n return new C(this);\r\n }\r\n }\r\n\r\n\r\nClass `A`:\r\n\r\n public class A {\r\n private AllInOne allInOne;\r\n \r\n public A(AllInOne allInOne) {\r\n this.allInOne = allInOne;\r\n }\r\n \r\n public String getA() {\r\n return allInOne.a;\r\n }\r\n }\r\n\r\nClass `B`:\r\n\r\n public class B {\r\n private AllInOne allInOne;\r\n \r\n public B(AllInOne allInOne) {\r\n this.allInOne = allInOne;\r\n }\r\n \r\n public String getB() {\r\n return allInOne.b;\r\n }\r\n }\r\n\r\nClass `C`:\r\n\r\n public class C {\r\n private AllInOne allInOne;\r\n \r\n public C(AllInOne allInOne) {\r\n this.allInOne = allInOne;\r\n }\r\n \r\n public String getC() {\r\n return allInOne.c;\r\n }\r\n }\r\n\r\nTest code:\r\n\r\n public class Main {\r\n public static void main(String[] args) throws IOException {\r\n ObjectMapper om = new ObjectMapper();\r\n om.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY);\r\n \r\n String jsonA = \" ;{\\ \" ;a\\ \" ;:\\ \" ;a value\\ \" ;} \" ;;\r\n String jsonB = \" ;{\\ \" ;b\\ \" ;:\\ \" ;b value\\ \" ;} \" ;;\r\n String jsonC = \" ;{\\ \" ;c\\ \" ;:\\ \" ;c value\\ \" ;} \" ;;\r\n \r\n needTypeA(om.readValue(jsonA, AllInOne.class).asA());\r\n needTypeB(om.readValue(jsonB, AllInOne.class).asB());\r\n needTypeC(om.readValue(jsonC, AllInOne.class).asC());\r\n }\r\n \r\n private static void needTypeA(A a) {\r\n System.out.println(a.getA());\r\n }\r\n \r\n private static void needTypeB(B b) {\r\n System.out.println(b.getB());\r\n }\r\n \r\n private static void needTypeC(C c) {\r\n System.out.println(c.getC());\r\n }\r\n }\r\n\r\nWith implementation like this, we erased the specific type info at deserialization step, and bring it back at the moment we really need/use it. And as you can see there&#39;s not too much extra code, because what we actually did is just moving all fields declaration together, and added couple methods.\r\n\r\nNotes:\r\n\r\n- I declare fields in `AllInOne` to be `protected`, putting all POJO class in the same package will make `A`, `B` and `C` be able to access them directly, but not for other classes outside.\r\n- Setting `om.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY);` to make jackson deserialize by `field`, so that we can remove duplicate `setter` and `getter` from `AllInOne` class\r\n- If you do need to know the type info, you could add methods like `isA` inside `AllInOne` based on the fields info\r\n\r\n [1]: _URL_0_", "125" ], [ "You can always process/transform your data from kafka in your service and push the well-formatted data to 3rd party service(like fluentd) to take care of the process of loading data into HDFS, which makes your service focus on data transform/process only and be one of steps in your entire data pipeline. Anyway, it&#39;s your choice based on your tech stack and preference. Sorry that no clue for your bug, I just can&#39;t reproduce it.", "841" ], [ "`EnableAsync` is used for configuration and enable Spring&#39;s asynchronous method execution capability, it should not be put on your `Service` or `Component` class, it should be put on your `Configuration` class like:\r\n\r\n @Configuration\r\n @EnableAsync\r\n public class AppConfig {\r\n\r\n }\r\n\r\nOr with more configuration of your `AsyncExecutor` like:\r\n\r\n @Configuration\r\n @EnableAsync\r\n public class AppConfig implements AsyncConfigurer {\r\n\r\n @Override\r\n public Executor getAsyncExecutor() {\r\n ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();\r\n executor.setCorePoolSize(7);\r\n executor.setMaxPoolSize(42);\r\n executor.setQueueCapacity(11);\r\n executor.setThreadNamePrefix( \" ;MyExecutor- \" ;);\r\n executor.initialize();\r\n return executor;\r\n }\r\n }\r\n\r\nPlease refer to [it&#39;s java doc][1] for more details.\r\n\r\nAnd for the tutorial you followed, `EnableAsync` is put above `Application` class, which `extends AsyncConfigurerSupport` with AsyncExecutor configuration:\r\n\r\n @SpringBootApplication\r\n @EnableAsync\r\n public class Application extends AsyncConfigurerSupport {\r\n\r\n public static void main(String[] args) {\r\n SpringApplication.run(Application.class, args);\r\n }\r\n\r\n @Override\r\n public Executor getAsyncExecutor() {\r\n ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();\r\n executor.setCorePoolSize(2);\r\n executor.setMaxPoolSize(2);\r\n executor.setQueueCapacity(500);\r\n executor.setThreadNamePrefix( \" ;GithubLookup- \" ;);\r\n executor.initialize();\r\n return executor;\r\n }\r\n }\r\n\r\n\r\n [1]: _URL_0_", "283" ], [ "Answer your updated question. You did not reach the code of writing data to file, If you scroll up your output I believe the error you got is:\r\n\r\n > IOError: [Errno 63] File name too long:...\r\n\r\nThe first parameter of `codecs.open(r.text, &#39;r&#39;, &#39;utf-8-sig&#39;)` is `filename`, as you can find out following [docs of `codecs.open`][1]. I think <PERSON> is enough to write response to a file, but \r\nif you really need to decode the response, you could try:\r\n\r\n data = codecs.decode(str(response.text), &#39;utf-8-sig&#39;)\r\n\r\nAnother error in your code: `data = json.load(codecs.open(r.text, &#39;r&#39;, &#39;utf-8-sig&#39;))` make `data` to be type of `unicode`, you can&#39;t write an `unicode` object to file. you can just dump it to your file:\r\n\r\n import requests\r\n import json\r\n import codecs\r\n\r\n r = requests.get( \" ;_URL_1_;)\r\n data = codecs.decode(str(r.text), &#39;utf-8-sig&#39;)\r\n\r\n with open(&#39;data.json&#39;, &#39;w&#39;) as f:\r\n json.dump(data, f)\r\n\r\nAnd you can load it back later with code:\r\n\r\n with open(&#39;data.json&#39;, &#39;r&#39;) as f:\r\n data = json.load(f)\r\n\r\n [1]: _URL_0_", "652" ], [ "It has to appear in somewhere in someway, otherwise you can&#39;t get such information.\r\n\r\n- Option 1: use an `ENV` for previous entrypoint in `Dockerfile`, and then refer to it in your own _URL_0_:\r\n\r\n Dockerfile:\r\n\r\n FROM alpine:3.3\r\n\r\n ENV MYSQL_ENTRYPOINT \" ;/usr/bin/mysql mysqld \" ;\r\n ADD _URL_0_ /\r\n ENTRYPOINT [ \" ;/_URL_0_ \" ;]\r\n\r\n _URL_1_:\r\n\r\n #!/bin/sh\r\n\r\n echo $MYSQL_ENTRYPOINT\r\n\r\n- Option 2: just pass previous entrypoint command as parameter to your entrypoint:\r\n\r\n Dockerfile:\r\n\r\n FROM alpine:3.3\r\n\r\n ADD _URL_0_ /\r\n ENTRYPOINT [ \" ;/_URL_0_ \" ;]\r\n CMD [ \" ;/usr/bin/mysql mysqld \" ;]\r\n\r\n _URL_1_:\r\n\r\n #!/bin/sh\r\n\r\n echo $1\r\n\r\nPersonally I prefer option #1.", "486" ], [ "Thanks for your info guys, I believe it has to appear in somewhere in some way, and I don&#39;t think pass it at runtime is a good idea, this env variable is not different for each runtime, or for different platform on which you&#39;re going to run this container, it has been certain at build stage, passing it at runtime does nothing more but adding extra work.", "191" ], [ "<PERSON>, as far as I know there&#39;s no pre-defined variable for each entrypoint, and I don&#39;t see the necessary because it could be overridden for many many times in real practices, when people overrides it, it&#39;s for sure that they want their own way to start the container. Starting mysqld is just last step of your own logic, and the command of starting mysql is some info contained in the base image, so I think it&#39;s the appropriate place to define it in your Dockerfile. This is my understanding and I&#39;ll appreciate if you can share me with other ideas. Have a nice day:-)", "730" ], [ "Try the following code(I declared a list for `desiredKeys`):\r\n\r\n public class Main {\r\n public static void main(String[] args) {\r\n Map < String, String > m0 = new HashMap < > ();\r\n m0.put( \" ;x \" ;, \" ;123 \" ;);\r\n m0.put( \" ;y \" ;, \" ;456 \" ;);\r\n m0.put( \" ;z \" ;, \" ;789 \" ;);\r\n\r\n Map < String, String > m1 = new HashMap < > ();\r\n m1.put( \" ;x \" ;, \" ;000 \" ;);\r\n m1.put( \" ;y \" ;, \" ;111 \" ;);\r\n m1.put( \" ;z \" ;, \" ;222 \" ;);\r\n\r\n List < Map < String, String > > l = new ArrayList < > (Arrays.asList(m0, m1));\r\n\r\n List < String > desiredKeys = Lists.newArrayList( \" ;x \" ;, \" ;z \" ;);\r\n\r\n List < Map < String, String > > transformed = l.stream().map(map - > map.entrySet().stream()\r\n .filter(e - > desiredKeys.stream().anyMatch(k - > k.equals(e.getKey())))\r\n .collect(Collectors.toMap(e - > e.getKey(), p - > p.getValue()))).filter(m - > !m.isEmpty()).collect(Collectors.toList());\r\n\r\n System.err.println(l);\r\n System.err.println(transformed);\r\n }\r\n }", "142" ], [ "*(This is more like a comment but the message length is beyond the comment limit, so I leave it here as an answer so that other people can maybe give more useful info based on what I&#39;ve done.)*\r\n\r\nSeems it&#39;s really an unresolved issue, I reproduced your problem by image `enoniccloud/java6` running with `root` user, I also tried `docker run -it --privileged ...` to run it manually but it does not help. I also tried `jdk8` with base image `alpine:3.3` but also failed with:\r\n\r\n Downloaded file to /tmp/tz.tmp/sha512hash\r\n Renaming /opt/jdk1.8.0_91/jre/lib/tzdb.dat to /opt/jdk1.8.0_91/jre/lib/tzdb.dat.tzdata2016a failed.\r\n Cant rename {0} to {1}.\r\n Validating for : tzdata2017b\r\n Validation complete\r\n JRE updated to version : tzdata2017b\r\n\r\nI searched and the only info I found is as follows:\r\n\r\n- An open issue: _URL_1_\r\n- Related but not the same: _URL_0_\r\n\r\nBefore you find the root cause for this issue, I think an alternative way to build your image could be:\r\n\r\n- Download a JDK tarball for your platform\r\n- Untar it, setup `JAVA_HOME` and `PATH`, run `java -jar tzupdater.jar -v -l` on your host\r\n- Build your base image based on this updated JDK, `ADD` to image and setup environment variable like `JAVA_HOME` and `PATH`\r\n\r\nHope this could be helpful to you :-)", "741" ], [ "From the [docs of java generic wildcard][1] it says:\r\n\r\n > In generic code, the question mark (?), called the wildcard, represents an **unknown type**.\r\n\r\nAnd also:\r\n\r\n > The wildcard is never used as a type argument for a generic method invocation, a generic class instance creation, or a supertype.\r\n\r\nSo if you have the following declaration:\r\n\r\n List < ? > list = new ArrayList < > ();\r\n\r\nThen you can&#39;t add anything to `list`, because you just told compiler that \" ;I don&#39;t know the type of objects which are going to be put in `list` \" ; \r\n\r\nSo your code `List < Comparable < ? > > ` means that \" ;I want a list to contains comparable objects, but I don&#39;t know its type \" ;, which is not OK for compiler, because the compiler do need to know the type info for its work.\r\n\r\nTo use list contains any `Comparable` objects, you can use [upper bounded wildcards][2] like:\r\n\r\n Map < String, List < ? extends Comparable > > map = new HashMap < > ();\r\n\r\nThen you&#39;re fine to put any `comparable` list as value for this map:\r\n\r\n public static void main(String[] args) {\r\n Map < String, List < ? extends Comparable > > map = new HashMap < > ();\r\n List < Integer > as = new ArrayList < > ();\r\n as.add(1);\r\n as.add(5);\r\n as.add(3);\r\n\r\n map.put( \" ;as \" ;, as);\r\n\r\n List < String > bs = new ArrayList < > ();\r\n bs.add( \" ;hello \" ;);\r\n bs.add( \" ;world \" ;);\r\n bs.add( \" ;generics \" ;);\r\n\r\n map.put( \" ;bs \" ;, bs);\r\n }\r\n\r\nFinally I guess you&#39;ll be interested in [inheritance and subtypes in generics][3], hope this could be helpful to you.\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_0_\r\n [3]: _URL_1_", "6" ], [ "You could have a look at [BeanFactoryPostProcessor][1], I tried with following code and it&#39;s working just fine, `Bean`s depends on `MyBean` could also be `autowire`d:\r\n\r\n @Configuration\r\n public class AppConfig implements BeanFactoryPostProcessor {\r\n @Override\r\n public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {\r\n for (int i = 0; i < 3; i++) {\r\n System.out.println( \" ;register my bean: \" ; + i);\r\n beanFactory.registerSingleton( \" ;bean- \" ; + i, new MyBean( \" ;MyBean- \" ; + i));\r\n }\r\n }\r\n }\r\n\r\nSince you have complete control of creation process of `MyBean` instance, you can simply pass other beans in through constructor if it&#39;s necessary. Hope this could be helpful to you :-)\r\n\r\n [1]: _URL_0_", "958" ], [ "@JuanZhong, sorry for late response, I think you can declare `init` and `destroy` for `MyBean` and overwrite/implement them when you `new` each bean, sorry to say but I failed to make annotation `@PostConstruct` and `@PreDestroy` work :&#39;(. Maybe I missed something simple or got the wrong way to do this. Anyway, I asked another question _URL_0_ for this issue, good choice to learn and let&#39;s wait to see how other people will say.", "958" ], [ "Three steps to resolve this problem:\r\n\r\n1. Find out those elements should be in the final list, which is the `intersection` of two lists\r\n2. For each element found in step #1, find out how many times it should be in final list\r\n3. Generate final list based on the info found by previous two steps\r\n\r\nAnd then translate these 3 steps to three lines of code:\r\n\r\n def common(l1, l2):\r\n intersection = [e for e in l1 if e in l2] \r\n elemnts_counters = {e: min(l1.count(e), l2.count(e)) for e in intersection} \r\n return sum([[e] * c for e, c in elemnts_counters.items()], []) \r\n\r\nThen\r\n\r\n print common([1,3,3,3], [1,3,3,3,3,4])\r\n\r\nwill give you:\r\n\r\n > [1, 3, 3, 3]", "319" ], [ "Docker exposes restful API on its daemon, you can use any CLI HTTP client tool to get such information. Docker daemon option `-H` is where it listens incoming requests. Take `cURL` as example:\r\n\r\n- If your docker daemon only binds to unix domain socket like `-H unix:///var/run/docker.sock`, then you need the latest `cURL` which supports `--unix-socket` option, I&#39;m using `curl 7.52.1` to run the following command on docker host:\r\n\r\n $ > curl --unix-socket /var/run/docker.sock _URL_2_\r\n No such container: unexisted_container\r\n\r\n- If your docker daemon binds to TCP port like `-H tcp://<IP_ADDRESS>:4322`, the above command would be:\r\n\r\n $ > curl _URL_0_\r\n\r\nYou can refer to [docs of docker engine API][1] for more details.\r\n\r\n\r\n [1]: _URL_1_", "707" ], [ "The error message indicates that maven can&#39;t find plugin `echo`, it tries to find this plugin in plugin groups `[org.apache.maven.plugins, org.codehaus.mojo]` and repos `[local (C:\\Users\\Dell Latitude E7450\\.m2\\repository), central (_URL_1_)]` but failed, because its plugin group is `com.soebes.maven.plugins`. [this official doc][1] has very detailed information about how maven maps a prefix to a plugin.\r\n\r\n\r\nIn order to let maven be able to find it, you can add the following line to ` < pluginGroups > ` in your `settings.xml`:\r\n\r\n < pluginGroup > com.soebes.maven.plugins < /pluginGroup > \r\n\r\nBut it&#39;ll still failed to run `mvn echo:echo` because this plugin need parameter `echos` to be configured. You can refer to [their guide][2] for more details. An example configuration to your pom.xml to make it run:\r\n\r\n < plugin > \r\n < groupId > com.soebes.maven.plugins < /groupId > \r\n < artifactId > echo-maven-plugin < /artifactId > \r\n < version > 0.3.0 < /version > \r\n < executions > \r\n < execution > \r\n < phase > initialize < /phase > \r\n < goals > \r\n < goal > echo < /goal > \r\n < /goals > \r\n < /execution > \r\n < /executions > \r\n < configuration > \r\n < echos > \r\n < echo > This is the Text which will be printed out. < /echo > \r\n < /echos > \r\n < /configuration > \r\n < /plugin > \r\n\r\n [1]: _URL_0_\r\n [2]: _URL_2_", "78" ], [ "By default, each container will use `bridge` network driver and has its own isolation network environment. It&#39;s not the same thing but you can just simply think they are different servers and has their own private IPs. So when you started a client container and try to connect the address `hdfs://localhost:50075`, it&#39;ll actually try to connect the port `50075` of itself, rather than connecting the hadoop server container, obviously it&#39;ll be refused. Please refer to their [official network docs][1] for more info.\r\n\r\nContainers on the same host can communicate with each other by their private IPs, so to connect to your hadoop server container, you can firstly find out it private IP by:\r\n\r\n $ > docker inspect --format &#39;{{ .NetworkSettings.IPAddress }}&#39; 378\r\n <IP_ADDRESS>\r\n\r\nAnd then I can use the client by(And I think the port should be 9000):\r\n\r\n $ > docker run --rm sequenceiq/hadoop-docker:2.6.0 /usr/local/hadoop-2.6.0/bin/hadoop fs -fs hdfs://<IP_ADDRESS>:9000 -ls /\r\n Found 1 items\r\n drwxr-xr-x - root supergroup 0 2015-01-15 04:04 /user\r\n\r\nIf you want to run client container on another host, then you need to know [multi-host networking][2].\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_0_get-started-overlay/", "166" ], [ "I checked your Dockerfile and found it does nothing more but expose an extra port `2022`, but this port is not used in your server container, so is there reason you have to do this? And additionally, mapping ports to host with `-p` is to expose your service inside container to the outside world, and also is one of ways to do multi-host communication between containers. As I mentioned in my answer, if you just want to test `client` and `server` on the same machine, you don&#39;t have to do this to make them be capable of talking to each other, using IPs of the container is just enough.", "707" ], [ "First of all, there&#39;s no `running image`, only `running container`. Image is something deliverable in Docker way, you build your `image` and then start a `container` from it. \r\n\r\nTo your problem, I think you have mentioned your options:\r\n\r\n1. Rebuild your image\r\n2. Go inside a running container, make changes and `docker commit` it back. Personally I only use this way to fix a tiny problem or make a hotfix to my image if `docker build` takes a really long time.\r\n\r\n\r\nDocker uses [union FS][1] with [copy on write][2] to build image, which means if you want make a change to an image, you can&#39;t change it in-place, it&#39;ll create extra layer(s) to reflect your change(s), it&#39;ll just use the same image name in some cases. And from the perspective of delivery, I think it&#39;s totally OK to build a new image (with different tag) for each release, or even it should be done this way, that&#39;s why you have an `Dockerfile`, and images are not only something you start your container, they&#39;re actually versioned delivery artifacts and you can roll back to any version if you want/need. So I think your current solution is OK.\r\n\r\nA few more words here: for local development and test, you can just mount your `/_URL_2_` as a volume to your container when you start it, something like `docker run -v /path/to/host/_URL_2_:/path/to/container/_URL_2_ your_base_image_to_run_app`, then anything you changed on your local FS to `_URL_2_`, it&#39;ll reflect to the container. When you finish your job, build a new image.\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "324" ], [ "I don&#39;t know which image you&#39;re using but I believe every `Dockerfile` of [official mysql images][1] has following command:\r\n\r\n VOLUME /var/lib/mysql\r\n\r\nwhich means all mysql data goes to volume. From [docker volume docs][2] they specially mentioned that:\r\n\r\n > Changes to a data volume will not be included when you update an image.\r\n\r\nAnd this is the root cause you loss your data in newly started container.\r\n\r\nFor your question: \r\n > How to achieve this?\r\n\r\nYou can use either [mounted volumes][3], or create a [data volume container][4], then run mysql container with option `--volumes-from`. The former links contain step-by-step guide of how to do it.\r\n\r\n > I don&#39;t want to use mounted volumes because i want to link this container with another container of my application so that it can inset and update into db\r\n\r\nI don&#39;t know what other concerns you have about mounted volumes, but as far as I can tell, using mounted volumes does not prevent you to link containers.\r\n\r\nHope this helps you.\r\n\r\n\r\n [1]: _URL_3_\r\n [2]: _URL_1_\r\n [3]: _URL_0_\r\n [4]: _URL_1_#creating-and-mounting-a-data-volume-container\r\n [5]: _URL_4_", "324" ], [ "I&#39;m afraid there&#39;s no such a way to archive this. `docker attach` and `docker exec` are working against running container only, but if you `docker start` the container in your case, it&#39;ll exited immediately again because the `CMD` is `/bin/bash`.\r\n\r\nThere&#39;s also [a discussion][1] about this, post some key info here:\r\n\r\n > It&#39;s not possible to enter a stopped container, because the processes are gone, and therefore, the namespaces are gone as well.\r\n\r\n\r\n [1]: _URL_0_", "707" ], [ "There&#39;s no special meaning for each. \r\n\r\n`Marker interface` is kind of \" ;[design pattern][1] \" ;, you attach a label/tag to a set of objects in order to indicates that they have something in common, they&#39;re OK for some kind of process or operations. `Serializable` is a typical example, it **marks** objects that they can be serialized/deserialized.\r\n\r\nOn the other hand for `FunctionalInterface`, it&#39;s just an `interface` with restriction that can only have one abstract method, and thus represents a single function contract. Java 8 add `lambda expression` for `functional programming`, for `FP` we need to pass `function` back and forth so often. Say we have an interface like:\r\n\r\n public interface StringTrasformer {\r\n String transform(Object obj);\r\n }\r\n\r\nTraditionally we can only create instance of asynchronous class like:\r\n\r\n someObj.doTransform(new StringTransformer() {\r\n @Override\r\n public String transform(Object object) {\r\n return \" ;result \" ;;\r\n }\r\n });\r\n\r\nBut there&#39;s only one method to be implemented, so it&#39;s no need to make code so verbose, with `lambda expression` it could be as short as:\r\n\r\n abc.doTransform(object - > \" ;result \" ;);\r\n\r\nAnnotation `FunctionalInterface` is used for compiler to check whether the interface you have annotated is a valid one. Even functional interface is for `lambda expressions`, `method references `and `constructor references`, but nothing prevents you to use it the traditional way. Because essentially it is just an normal interface. \r\n\r\n [1]: _URL_0_", "48" ], [ "The root cause of your bug has been well-explained in <PERSON> answer, another way is to remove `for` loop and forget the index of list at all, by using the following code:\r\n\r\n def specialparseFile(fname):\r\n with open(fname) as f:\r\n lines = filter(None, map(lambda x: x.strip(), f))\r\n result = [[l, &#39;a&#39;] if &#39; < &#39; in l else [l] for l in lines]\r\n return sum(result, []) # flatten the nested list generated by previous line of code", "319" ], [ "First of all, method `__call__` should be:\r\n\r\n def __call__(self, *args):\r\n return self.cls(*args)\r\n\r\nYour code will raise an error inside `__call__` and brought you directly to `print &#39;Not catched&#39;`, this is the first level error. After fixing this error, you&#39;ll reach the second level error of type mismatch, which is well-explained in comment by <PERSON>. Basic idea is that `Err` is actually type `ClsDecor` after `@ClsDecor`, but you return an instance of raw type `Err` in `__call__`, which is obvious not matched with `except Err`. You can easily use an decorator to archive your purpose like:\r\n\r\n def err_dec(Cls):\r\n class NewErr(Exception):\r\n def __init__(self, *args, **kwargs):\r\n self.err = Cls(*args, **kwargs)\r\n return NewErr\r\n\r\n @err_dec\r\n class Err(Exception):\r\n def __init__(self):\r\n Exception.__init__(self)\r\n\r\nUpdated for requirement in comment:\r\n\r\n def err_dec(Cls):\r\n class NewErr(Exception):\r\n c = 0\r\n def __init__(self, *args, **kwargs):\r\n NewErr.c = NewErr.c + 1\r\n self.err = Cls(*args, **kwargs)\r\n def counter(self):\r\n return NewErr.c\r\n return NewErr\r\n\r\n @err_dec\r\n class Err(Exception):\r\n def __init__(self):\r\n Exception.__init__(self)\r\n\r\n try:\r\n Err()\r\n Err()\r\n raise Err()\r\n except Err as e:\r\n print e.counter()\r\n print &#39;catched&#39;\r\n except Exception as e:\r\n print &#39;Not catched&#39;", "56" ], [ "Because the `expression` to generate new list in `[k in x and x[k][0] for k in items]` is `k in x and x[k][0]`, and the evaluation of `and` process is that it&#39;ll split the whole expression by `and`, then evaluate each ` \" ;sub-expression \" ;`, return the first `falsy` value or the last value no matter whatever it is. In this case it&#39;ll first evaluate `k in x`, which will always be `true`, then it will return the result of `x[k][0]`, which generates the final result:\r\n > `[True, False]`\r\n\r\nIf you try `[k in x and x[k][0] for k in items]`, you&#39;ll get result:\r\n > [&#39;first description&#39;, &#39;second description&#39;]\r\n\r\nTo filter element, you need to put the test condition at the tail of the whole expression like:\r\n\r\n [k for k in items if k in x and x[k][0]]", "305" ], [ "You can&#39;t use `~` or environment variable like `$HOME` to specify the file path, they&#39;re string literal and means actual path. The error you got is because it treat `~/golang-server.log` as a relative path of current directory, and there&#39;s no directory `~` in current directory.\r\n\r\nWith manually created sub-directory `~`, your code will succeed:\r\n\r\n  ~/test/ mkdir \\~\r\n  ~/test/ go run t.go\r\n  ~/test/ ls \\~\r\n golang-server.log\r\n\r\nSo need to pass an `absolute path` or `relative path` to `os.Create`.", "20" ], [ "> However testCase2 does not handles the exception\r\n\r\nYour `testCase2` did handled the exception, you can add extra `print` statement to check it.\r\n\r\nThe reason `testCase2` throws an Exception is that code:\r\n\r\n cf.exceptionally((ex) - > {\r\n System.out.println( \" ;Fake Promise: \" ; + System.nanoTime());\r\n return \" ;Fake Promise \" ;;\r\n })\r\nwill return a new `CompletableFuture` but you just discard it, the variable `cf` in `cf.get` is still not registered with any exception handler. The code should be:\r\n\r\n @Test\r\n public void testCase2() throws Exception {\r\n CompletableFuture < String > cf = CompletableFuture.supplyAsync(() - > {\r\n if (true) throw new RuntimeException();\r\n return \" ;Promise \" ;;\r\n });\r\n CompletableFuture < String > handledCf = cf.exceptionally((ex) - > {\r\n return \" ;Fake Promise \" ;;\r\n });\r\n return handledCf.get();\r\n }", "759" ], [ "Using data volume and sharing RDB file manually is not ugly, actually that&#39;s what data volume is designed for, to separate data from container.\r\n\r\nBut if you really need/want to save data to image and share it that way, you can just change the redis working directory from volume `/data` to somewhere else:\r\n\r\n- Option 1 is changing `--dir` when start the redis container:\r\n\r\n docker run -d redis --dir /tmp\r\n Then you can follow your steps to create new image. Note that only `/tmp` could be used by this method due to permission issue.\r\n\r\n- Option 2 is creating a new image with changed `WORKDIR`:\r\n\r\n FROM redis\r\n\r\n RUN mkdir /opt/redis & & chown redis:redis /opt/redis\r\n WORKDIR /opt/redis\r\n\r\n Then `docker build -t redis-new-image` and use this image to do your job.", "324" ], [ "> I have to use grep in order to List the lines in this file that does NOT have digits in them\r\n\r\nTry `grep -v -e &#39;[0-9]&#39; t.txt`\r\n\r\n > I also have another question in which I have to List all lines that have a 2 digit or 3 digit number that begins with a 4 and ends with an 8. If it is a 3 digit number, the middle digit must be 6 or greater\r\n\r\nTry `grep -e &#39;\\b4[6789]\\?8\\b&#39; t.txt`\r\n\r\nBTW, you could list what kind of trouble you had, so that others can help you to fix it and understand regex more.", "143" ], [ "First of all, Spark will not build `spark-assembly.jar` from 2.0.0, but build all dependency jars to directory `$SPARK_HOME/jars`\r\n\r\nBesides, Hive does not support every version of Spark, actually it has a strong version compatibility restrictions to run Hive on Spark. Depends on which version of Hive you&#39;re using, you can always find out the corresponding Spark version in `pom.xml` file of Hive. For `Hive 2.1.1`, the [spark version specified in pom.xml][1] is:\r\n\r\n > ` < spark.version > 1.6.0 < /spark.version > ` \r\n\r\nAs you already know that you need to build spark without hive support. I don&#39;t know why but the command in [Hive on Spark - Getting Started][2] does not work for me, finally I succeeded with following command:\r\n\r\n mvn -Pyarn -Phadoop-2.6 -Dscala-2.11 -DskipTests clean package\r\n\r\nAnd few other troubleshooting tips which I met before(Hope you&#39;re not going to meet):\r\n\r\n- Starting Spark Master failed due to failed to find slf4f or hadoop related classes, run `export SPARK_DIST_CLASSPATH=$(hadoop classpath)` and try again\r\n- Failed to load snappy native libs, which is caused by that there&#39;s no snappy dependency in classpath, or the snappy lib under hadoop classpath is not the correct version for Spark. You can download a correct version of snappy lib and put it under `$SPARK_HOME/lib/`, and run `export SPARK_DIST_CLASSPATH=$SPARK_HOME/lib/*:$(hadoop classpath)` and try again.\r\n\r\nHope this could be helpful and everything goes well to you.\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "407" ], [ "Try the following code:\r\n\r\n public static void main(String[] args) {\r\n String text = \" ;hello world java stream stream \" ;;\r\n\r\n Map < String, String > result = new HashSet < String > (Arrays.asList(text.split( \" ; \" ;))).stream().collect(Collectors.toMap(word - > word, word - > translate(word)));\r\n\r\n System.out.println(result);\r\n }\r\n\r\n private static String translate(String word) {\r\n return \" ;T- \" ; + word;\r\n }\r\n\r\nWill give you output:\r\n\r\n > {java=T-java, world=T-world, stream=T-stream, hello=T-hello}", "776" ], [ "The `shell` you configured in your Jenkins job is executed by Jenkins executor on Jenkins machine(or Jenkins Slave machine if you&#39;re using Jenkins the Master-Slave way), so whatever command you would like to use, it must be installed correctly and in the `PATH` of the target machine, just like you execute command on terminal manually.\r\n\r\nSo the error message is self-explained now:\r\n > C:\\WINDOWS\\TEMP\\_URL_0_: line 4: docker: command not found\r\n\r\nwhich means you have not installed docker on your Jenkins machine, you need to install and configure it firstly.\r\n\r\nAdditionally, you may want to have a look at [Docker build step plugin][1] for Jenkins.\r\n\r\n\r\n [1]: _URL_1_", "857" ], [ "You can create a list with weekday sorted, and then sort list `a` by its key:\r\n\r\n > > > a = [[ \" ;Wed \" ;, 27], [ \" ;Sun \" ;, 90], [ \" ;Fri \" ;, 69], [ \" ;Tue \" ;, 47], [ \" ;Mon \" ;, 54], [ \" ;Thu \" ;, 40], [ \" ;Sat \" ;, 78]]\r\n > > > order = [ \" ;Mon \" ;, \" ;Tue \" ;, \" ;Wed \" ;, \" ;Thu \" ;, \" ;Fri \" ;, \" ;Sat \" ;, \" ;Sun \" ;]\r\n > > > sorted(a, key=lambda x: order.index(x[0]))\r\n\r\nThe output will be:\r\n\r\n > [[&#39;Mon&#39;, 54], [&#39;Tue&#39;, 47], [&#39;Wed&#39;, 27], [&#39;Thu&#39;, 40], [&#39;Fri&#39;, 69], [&#39;Sat&#39;, 78], [&#39;Sun&#39;, 90]]", "837" ], [ "The early version Docker used VirtualBox to run virtual machine for Docker. Since June 2016, the way to run Docker on Mac and Windows became much simpler, there&#39;s the [official release introduction blog for Docker on Mac/Windows][1], and there&#39;s also some introduction from [docker mac website][2]:\r\n\r\n > Docker for Mac is a complete development environment deeply integrated with the MacOS Hypervisor framework, networking and filesystem. \r\n\r\nAnd with the structure looks like:\r\n\r\n[![enter image description here][3]][3]\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_2_\r\n [3]: _URL_0_", "324" ], [ "While @Prune has provided detailed explanation about the error in your code, I&#39;d like to provide alternative solutions to your problem.\r\n\r\nBasically, you can define a function `remove_duplicate` for your 2nd level array to remove 3rd level arrays based on its first element, and then generate your final result with `list comprehensive`:\r\n\r\n def remove_duplicate(sublist): \r\n seen = set()\r\n return [e for e in sublist if not (e[0] in seen or seen.add(e[0]))]\r\n\r\n result = [remove_duplicate(sublist) for sublist in All_Data]", "379" ], [ "To start docker daemon, `fd://` means it&#39;s being started by Systemd, and the listening socket is created by Systemd and passed to docker daemon. So if you try to using it from terminal, it will fail because you don&#39;t create socket and pass it to docker daemon. For docker cli, you can use it the same way with `tcp` protocol if you have tcp socket listening.\r\n\r\nI&#39;ve answered a similar question at _URL_0_, you can refer to it for more details.", "707" ], [ "I think the second way is better, `map` is used to apply a function to every item of an `iterable` and return a list of the results, so:\r\n\r\n map(lambda x: x.set_ID(), list_objects)\r\n\r\nwill actually generate a list of 1000000 `None`, since you did not assign it to a variable, it will be discarded immediately and be garbage collected, since all item in this list is `None`, it will not eat too much memory. The state of your items in `list_objects` are changed because of the `side effect` of your `lambda`, I don&#39;t think this is the appropriate way to use `map`.\r\n\r\nThe second second method has nothing extra object created during the whole process. By the way, it could just be:\r\n\r\n for obj in list_objects:\r\n obj.set_ID()", "597" ], [ "[Docs of redis image][1] has detailed description of how to run and access redis container. Basically you have the following options:\r\n\r\n- Go inside your redis container with the following command and then play with `redis-cli`:\r\n \r\n `docker exec -it some-redis bash`\r\n\r\n- Map redis port to host when launching the redis container\r\n \r\n `docker run -d --name some-redis -p 6379:6379 redis`\r\n\r\n Then you can just connect to redis like it&#39;s running on your host machine\r\n\r\n- Container link, connect to redis within another container on the same host machine\r\n\r\n `docker run -it --link some-redis:redis --rm redis redis-cli -h redis -p 6379`\r\n\r\n\r\n [1]: _URL_0_", "707" ], [ "`/etc/init.d/promethus` is a service init script rather than Prometheus binary executable, typically you&#39;ll use it like:\r\n\r\n- sudo service prometheus start/stop/status/restart\r\n\r\nTo pass additional arguments to the daemon you&#39;re going to start, you can configure arguments in file `/etc/default/prometheus`, or you can read the shell script to see if there&#39;s any environment variable could be used.", "742" ] ]
123
[ 16257, 3229, 17026, 6488, 16670, 18735, 14832, 4002, 11365, 2307, 9750, 15017, 18456, 15300, 12909, 8610, 16652, 16589, 18945, 12539, 5655, 17053, 3594, 5838, 16170, 10937, 12746, 16215, 4647, 18423, 5705, 16879, 14343, 4757, 15834, 12304, 826, 15199, 19452, 307, 11877, 18545, 1736, 13594, 5393, 13376, 3716, 10620, 13595, 7428, 12109, 6095, 11100, 7405, 14613, 5882, 10491, 8168, 19503, 2780, 15170, 17617, 17856, 5770, 6689, 13356, 10661, 1358, 3043, 13706, 13576, 9523, 5836, 7078, 13151, 10346, 9869, 19302, 1710, 18130, 16238, 10299, 601, 18478, 15811, 18003, 11847, 765, 5478, 8760, 1948, 12088, 13597, 17294, 3595, 9305, 8626, 1958, 18036, 7749, 6339, 18186, 4969, 11037, 12256, 19242, 12558, 4615, 10323, 10551, 6128, 12771, 4000, 19409, 13304, 8100, 15165, 3427, 1383, 4519, 9759, 3215, 3674, 10849, 9054, 155, 13431, 10017, 10732, 16534, 2238, 10386, 9003, 12919, 17086, 9783, 3185, 14303, 16535, 8157, 17246, 2510, 11504, 6791, 9633, 13444, 6142, 19655, 12496, 41, 4223, 19499, 13131, 5814, 18977, 9322, 15036, 6283, 12185, 19764, 16632, 17371, 13891, 3386, 10245, 15523, 12350, 5618, 8526, 7891, 2243, 14652, 17832, 3859, 1649, 7801, 1775, 17423, 9124, 18575, 17559, 9616, 11851, 38, 18149, 14235, 2460, 8818, 3747, 9399, 9895, 16974, 1374, 7441, 17416, 12047, 1057, 1529, 15229, 9247, 15105, 14384, 18952, 16411, 13554, 15237, 18606, 9188, 13011, 9837, 10634, 4853, 11708, 12528, 13920, 9227, 10001, 4251, 18738, 17283, 15710, 2531, 3649, 1943, 15129, 3547, 14828, 10719, 5997, 6287, 13494, 7518, 4011, 4436, 7156, 15051, 6306, 11073, 4851, 8907, 8350, 8428, 14699, 5115, 14982, 4589, 15116, 12131, 4522, 16522, 3647, 11449, 17599, 14921, 4371, 10144, 4093, 5671, 3980, 15291, 13740, 2398, 19280, 6638, 13318, 19549, 318, 14084, 12571, 10289, 447, 17999, 13088, 6988, 15483, 15510, 1972, 12040, 7923, 4917, 7172, 13702, 5302, 11798, 9571, 7364, 19597, 5064, 19384, 3679, 14773, 10421, 7879, 11000, 4145, 3585, 5437, 14611, 2107, 8848, 2201, 631, 4772, 9442, 7946, 17020, 4183, 12330, 10404, 12870, 16286, 14976, 8619, 16919, 2645, 17297, 9435, 12977, 4581, 8802, 7529, 4203, 12859, 10463, 14794, 14054, 895, 2671, 3364, 5372, 4574, 3668, 11149, 5213, 121, 14558, 2303, 10113, 14532, 14495, 12475, 15357, 17240, 15546, 10043, 7178, 2656, 16213, 14406, 14451, 18512, 1628, 17380, 14831, 10345, 16250, 9810, 19365, 9718, 3440, 13887, 11927, 1806, 1482, 7974, 10456, 7814, 14429, 13396, 17622, 8536, 1391, 1132, 17972, 13078, 7928, 19750, 15581, 7082, 18847, 10250, 17762, 3837, 9968, 1644, 6980, 18639, 10437, 8342, 5079, 17723, 10809, 11978, 15993, 14052, 18934, 13024, 10684, 11204, 13848, 16765, 2696, 12563, 7237, 14485, 4039, 17843, 17503, 4675, 17882, 7856, 14762, 7279, 1253, 15635, 4305, 14295, 17123, 11500, 12905, 9220, 13701, 4748, 17467, 2216, 6700, 11833, 862, 12948, 16664, 8304, 8664, 15167, 11686, 11329, 18531, 10152, 19779, 18012, 12927, 16209, 8617, 5906, 19122, 7854, 8407, 4857, 10548, 4245, 7190, 2088, 4206, 961, 3642, 2045, 3086, 17148, 17066, 12820, 6303, 12167, 11483, 3623, 17956, 8103, 12028, 19071, 9882, 5809, 293, 4474, 14737, 18221, 832, 3905, 17465, 5547, 5900, 271, 6568, 11040, 473, 8945, 15032, 9623, 17686, 15542, 17732, 15758, 5088, 406, 629, 12964, 5349, 16323, 2614, 5385, 8553, 18442 ]
STX_10002550.0
[ [ "Why is it that I am getting an error when trying to add an animation from the pushPow function? The #selector is set to the handleRegister function and inside that function I have pulsePow, the error I get is in the line: loginRegisterButton.add(pulse, forKey: nil).\r\n\r\n\r\n\r\n lazy var loginRegisterButton: UIButton = {\r\n \r\n \r\n let button = UIButton(type: .system)\r\n button.backgroundColor = UIColor(red:1.00, green:1.00, blue:1.00, alpha:1.0)\r\n button.titleLabel!.font = UIFont(name: \" ;ProximaNova-Semibold \" ;, size: 18)\r\n button.setTitle( \" ;Register \" ;, for: .normal)\r\n button.translatesAutoresizingMaskIntoConstraints = false\r\n button.setTitleColor(UIColor.black, for: .normal)\r\n button.layer.cornerRadius = 20\r\n button.layer.masksToBounds = true\r\n \r\n\r\n \r\n button.addTarget(self, action: #selector(handleRegister), for: .touchUpInside)\r\n \r\n return button\r\n }()\r\n \r\n\r\n\r\n\r\n @objc func handleRegister()\r\n {\r\n \r\n func pulsePow() {\r\n let pulse = CASpringAnimation(keyPath: \" ;transform.scale \" ;)\r\n pulse.duration = 0.6\r\n pulse.fromValue = 0.95\r\n pulse.toValue = 1.0\r\n pulse.autoreverses = true\r\n pulse.repeatCount = 1\r\n pulse.initialVelocity = 0.5\r\n pulse.damping = 1.0\r\n \r\n \r\n loginRegisterButton.add(pulse, forKey: nil)\r\n }", "52" ], [ "How can I make this imagePickerController able to accept edited images?\r\n\r\n\r\nWhen selecting an image and adjusting it (zoom in and out) and selecting done, the image reverts back to its original state. What can I add to to my code to have the zoomed image save and show up in my image view?\r\n\r\nThe following is my code so far:\r\n\r\n let cameraRollAction = UIAlertAction(title: \" ;Camera Roll \" ;, style: .default) { (action) in\r\n if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.photoLibrary) {\r\n let picker = UIImagePickerController()\r\n picker.delegate = self\r\n picker.allowsEditing = true\r\n picker.mediaTypes = [kUTTypeImage as String]\r\n picker.sourceType = UIImagePickerControllerSourceType.photoLibrary\r\n self.present(picker, animated: true, completion: nil)\r\n self.newPic = false\r\n }\r\n\r\n func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {\r\n let mediaType = info[UIImagePickerControllerMediaType] as! NSString\r\n if mediaType.isEqual(to: kUTTypeImage as String) {\r\n let selectedImage = info[UIImagePickerControllerOriginalImage] as! UIImage\r\n profileImageView.image = selectedImage\r\n if newPic == true {\r\n UIImageWriteToSavedPhotosAlbum(selectedImage, self, #selector(imageError), nil)\r\n }\r\n }\r\n self.dismiss(animated: true, completion: nil)\r\n }", "696" ], [ "Is there anyway to implement this loading HUD into the LaunchImage when the application first starts. The link to the progress hud is called ACProgressHUD: _URL_0_\r\n\r\nIf not, is there a way to control the launch image and what it should present using the app delegate like\r\n \r\n func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions:\r\n\r\nUltimately I would like to implement a loading animation to the launch image, and these are just some ways I am thinking it can be done.", "766" ], [ "I have a root view that shows up when I first start my app. The root view has a button that when pressed opens another view controller that should have a nav bar at the top with an (add) navigation item. The problem is when I set the root view as the root view in app delegate, my other controller (that opens from a button) fails to show the nav bar with the nav item.\r\n\r\nHeres what I mean:\r\n\r\nWhen App Delegate is set to\r\n\r\n class AppDelegate: UIResponder, UIApplicationDelegate {\r\n\r\n var window: UIWindow?\r\n\r\n\r\n func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) - > Bool {\r\n // Override point for customization after application launch.\r\n \r\n \r\n \r\n window = UIWindow(frame: UIScreen.main.bounds)\r\n window?.makeKeyAndVisible()\r\n \r\n let firstviewController = FirstViewController()\r\n let navController = UINavigationController(rootViewController: firstviewController)\r\n let core = CoreViewController()\r\n window?.rootViewController = navController\r\n \r\n return true\r\n }\r\n\r\nThe navigation controls and navbar all show up but the CoreViewController (the view with the button) fails to show up first as the root controller.\r\n\r\nHow can first view controller keep its NavControls while have CoreViewController launch first as the root screen?\r\n\r\nView Controller with Button\r\n\r\n![][1]\r\n\r\nWhen View Controller is a Nav Controller\r\n\r\n![][2]\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "735" ], [ "I have an image that I am using instead of text in a navigation bar, I want this image to act a button and open another view controller. Why is this not working. I am not receiving any error.\r\n\r\n override func viewDidLoad() {\r\n super.viewDidLoad()\r\n\r\n let titleView = UIView(frame: CGRect(0, 0, 40, 40))\r\n let titleImageView = UIImageView(image: UIImage(named: \" ;titleimage \" ;))\r\n titleImageView.frame = CGRect(0, 0, titleView.frame.width, titleView.frame.height)\r\n titleImageView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(specialController)))\r\n\r\n\r\n }\r\n\r\n\r\n\r\n @objc func specialController() {\r\n let picker = SpecialMessage()\r\n \r\n present(picker, animated: true, completion: nil)\r\n }", "735" ], [ "I am writing my entire application programmatically and for some reason when running my app on either an iPhone 6 Plus, 7 Plus, or 8 Plus simulator everything fits perfectly with no black bars but when running in an iPhone non plus model or iPhone X the black bars appear on the top and bottom of the screen.\r\n\r\nI did not have this issue before, any thoughts on what it could be?", "923" ], [ "Any idea&#39;s how I can fix the following issues.\r\nI keep getting the error: Value of type &#39;StorageMetadata&#39; has no member &#39;downloadURL&#39; and Use of unresolved identifier &#39;uid&#39; than \r\n\r\n \r\n\r\n storageRef.putData(uploadData, metadata: nil, completion: { (metadata, error) in\r\n \r\n if let error = error {\r\n print(error)\r\n return\r\n }\r\n \r\n if let profileImageUrl = metadata?.downloadURL()?.absoluteString {\r\n \r\n let values = [ \" ;name \" ;: name, \" ;email \" ;: email, \" ;profileImageUrl \" ;: profileImageUrl]\r\n \r\n self.registerUserIntoDatabaseWithUID(uid: uid, values: values as [String: AnyObject])\r\n }\r\n })\r\n }\r\n })\r\n }", "885" ], [ "I recently updated my Firebase pods and now receive this error: \" ;Initializer for conditional binding must have Optional type, not &#39;String&#39; \" ; for the second line of code. \r\n\r\n storageRef.downloadURL { (url, error) in\r\n guard let url = url, let profileImageUrl = url.absoluteString else { return }\r\n let values = [ \" ;name \" ;: name, \" ;email \" ;: email, \" ;profileImageUrl \" ;: profileImageUrl]\r\n self.registerUserIntoDatabaseWithUID(uid: uid, values: values as [String: AnyObject])\r\n }", "824" ], [ "I would like my image to animate when it is being tapped on, this is my code so far, nothing happens for some reason when I tap on the image.\r\n\r\n lazy var profileImageView: UIImageView = {\r\n let imageView = UIImageView()\r\n imageView.image = UIImage(named: \" ;made \" ;)\r\n imageView.translatesAutoresizingMaskIntoConstraints = false\r\n imageView.contentMode = .scaleAspectFill\r\n imageView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(taptap)))\r\n imageView.isUserInteractionEnabled = true\r\n return imageView\r\n }()\r\n\r\n @objc func taptap() {\r\n let pulse = CASpringAnimation(keyPath: \" ;transform.scale \" ;)\r\n pulse.duration = 0.6\r\n pulse.fromValue = 0.95\r\n pulse.toValue = 1.0\r\n pulse.autoreverses = true\r\n pulse.repeatCount = 2\r\n pulse.initialVelocity = 0.5\r\n pulse.damping = 1.0\r\n layer.add(pulse, forKey: nil)\r\n }", "93" ], [ "I have a program that takes weather information from the Dark Sky API and displays it in a table view. Currently I have the app set to:\r\n\r\n forecastData.count\r\n\r\ncount in this case shows all of the data for the all of the days supported by the API. How can I make it so that only the first day is shown (just the first cell)?\r\n\r\nWhat can I replace \" ;.count \" ; with to only display the current day and not every other day provided by the API.\r\n\r\n\r\n\r\nThis is what I have my cells set to now:\r\n \r\n\r\n override func tableView(_ tableView: UITableView, cellForRowAt \r\n indexPath: IndexPath) - > UITableViewCell {\r\n\r\n let cell = tableView.dequeueReusableCell(withIdentifier: \" ;Cell \" ;, for: indexPath)\r\n\r\n let weatherObject = forecastData[indexPath.row]\r\n \r\n cell.detailTextLabel?.text = weatherObject.summary\r\n cell.textLabel?.text = \" ;\\(Int(weatherObject.temperature)) &#176;F \" ;\r\n\r\n \r\n \r\n return cell\r\n }", "870" ], [ "Currently I have an imageview set up that refers to and presents an image I am storing in the assets folder. How can have it pull the user image from Firebase? \r\n\r\n lazy var profileImageView: UIImageView = {\r\n \r\n let imageView = UIImageView()\r\n imageView.image = UIImage(named: \" ;profileUpload \" ;)\r\n imageView.translatesAutoresizingMaskIntoConstraints = false\r\n imageView.contentMode = .scaleAspectFill\r\n imageView.clipsToBounds = true\r\n //imageView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(handleSelectProfileImageView)))\r\n imageView.isUserInteractionEnabled = true\r\n return imageView\r\n \r\n }()\r\n\r\nThis function is referencing and pulling the profileImageUrl I need to have presented. How could I add this to my previous lazy var?\r\n\r\n func fetchUser() {\r\n Database.database().reference().child( \" ;users \" ;).observe(.childAdded, with: { (snapshot) in\r\n \r\n if let dictionary = snapshot.value as? [String: AnyObject] {\r\n let user = User()\r\n\r\n user.profileImageUrl = dictionary[ \" ;profileImageUrl \" ;]as? String\r\n\r\n }\r\n \r\n }, withCancel: nil)\r\n }\r\n\r\n\r\n\r\nIs there a way to replicate this method by replacing cell with imageView? It seems a lot easier, and requires a lot less code. \r\n\r\n override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) - > UITableViewCell {\r\n let cell = tableView.dequeueReusableCell(withIdentifier: cellId, for: indexPath) as! UserCell\r\n cell.textLabel?.textColor = UIColor.white\r\n let user = users[indexPath.row]\r\n cell.textLabel?.text = _URL_0_\r\n cell.detailTextLabel?.text = user.email\r\n cell.detailTextLabel?.textColor = UIColor.white\r\n cell.textLabel?.font = UIFont.boldSystemFont(ofSize: 15.0)\r\n \r\n if let profileImageUrl = user.profileImageUrl {\r\n cell.profileImageView.loadImageUsingCacheWithUrlString(profileImageUrl)\r\n }\r\n \r\n return cell\r\n }\r\nThe code above pulls and presents the image I need in a tableview.", "696" ], [ "I&#39;m getting data from the OpenWeatherMap API.\r\n\r\nWhy do I keep getting the error:\r\n\r\n > Value of type &#39;Double&#39; has no member &#39;text&#39;\r\n\r\nfor only the `humidity.text` line?\r\n\r\n let humidity = (self.document?.main?.humidity!)!\r\n let tempeMax = (self.document?.main?.temp_max!)! - 273.15\r\n let tempeMin = (self.document?.main?.temp_min!)! - 273.15\r\n humidity.text = humidity.text! + \" ; \" ; + String(format: \" ;%.0f \" ;, humidity)\r\n temp.text = temp.text! + \" ; \" ; + String(format: \" ;%.0f \" ;, tempe)", "824" ] ]
452
[ 12594, 10324, 15385, 11424, 12941, 13888, 6018, 6133, 12215, 5426, 15180, 15653, 12673, 18751, 13720, 10086, 6528, 14667, 14913, 15554, 12334, 14972, 8663, 6509, 14002, 3775, 14671, 16385, 17128, 17813, 16750, 13043, 1405, 10291, 16556, 10045, 3088, 12834, 3614, 9202, 14187, 16578, 13645, 3666, 15612, 19093, 19475, 14654, 15225, 11314, 11581, 13125, 166, 9719, 14640, 11458, 9721, 10609, 14993, 14252, 12989, 12880, 16529, 6493, 4797, 12556, 18146, 4480, 13097, 13018, 8017, 9991, 17871, 642, 16571, 16540, 17718, 17398, 4631, 11835, 19749, 1731, 8317, 6460, 3272, 12955, 17747, 10484, 14730, 11752, 13744, 1199, 844, 19765, 19575, 13284, 18960, 4254, 905, 15326, 14528, 17879, 16501, 9258, 13780, 8782, 7353, 12861, 16380, 547, 6291, 5522, 17345, 2565, 11738, 10460, 11518, 8289, 11863, 16933, 11645, 5108, 1819, 3936, 586, 1049, 15206, 17203, 19189, 15928, 2190, 4717, 4367, 10660, 12663, 5858, 4645, 14066, 12005, 13487, 19515, 5552, 12863, 9647, 14202, 14633, 3400, 13654, 465, 13312, 9070, 10895, 13343, 15543, 6922, 5602, 8339, 10147, 10635, 5183, 3135, 18859, 2960, 9933, 7702, 18682, 9937, 11494, 19777, 11402, 18554, 18648, 10425, 1544, 1532, 9252, 13091, 13612, 17013, 5055, 13849, 9743, 11256, 7835, 3258, 12786, 517, 78, 15024, 15527, 7164, 11896, 4606, 10846, 16591, 18547, 15648, 10304, 13711, 13845, 14236, 1491, 8337, 10852, 9522, 13398, 2391, 1298, 4239, 10757, 12788, 7674, 7120, 17151, 13127, 8570, 14407, 13802, 17926, 12918, 5848, 5495, 13982, 5976, 10783, 11055, 15480, 18326, 11161, 15152, 11082, 12692, 7667, 12469, 10817, 9584, 14630, 13074, 14683, 17952, 9103, 8306, 13020, 12521, 10833, 12100, 2447, 18316, 12403, 11917, 5190, 11667, 9063, 13274, 2164, 13692, 13042, 18077, 4707, 15885, 17639, 19064, 11271, 16421, 4352, 13601, 11495, 590, 9372, 5890, 4903, 10625, 6391, 8156, 450, 19076, 10968, 13025, 5580, 14718, 19171, 8819, 5625, 5953, 11480, 8346, 19062, 9526, 12683, 8210, 12996, 7081, 18458, 14045, 14639, 11924, 1174, 10576, 13729, 9954, 9573, 16859, 19494, 616, 13072, 16715, 320, 1015, 15912, 11411, 9488, 11776, 12085, 9525, 4979, 13569, 11060, 13321, 6682, 1347, 12969, 11682, 12723, 14544, 10580, 19635, 7653, 13227, 13332, 16033, 14188, 11151, 1153, 489, 18159, 9113, 17785, 18623, 14577, 13198, 1598, 1430, 10111, 14228, 878, 7509, 13969, 1782, 16090, 2077, 939, 18599, 11998, 15382, 410, 13245, 11609, 10340, 2094, 3108, 10354, 19508, 228, 1906, 12060, 6684, 8486, 11675, 11086, 11358, 730, 14012, 11664, 1895, 2859, 15082, 1214, 16755, 13950, 19592, 11263, 12572, 4823, 14117, 12634, 7578, 15132, 10884, 6817, 1916, 17543, 6852, 6341, 11750, 12068, 14106, 14898, 2321, 13348, 2469, 12846, 12547, 4334, 10171, 11777, 9855, 3393, 5776, 11585, 14472, 14959, 871, 5399, 43, 3517, 13800, 8184, 19773, 15243, 14992, 17109, 7787, 1307, 14593, 3545, 11383, 18282, 4270, 9742, 4294, 7443, 14874, 17217, 15003, 8588, 11955, 11918, 10602, 18843, 15305, 5097, 11002, 14242, 17444, 14386, 11300, 6077, 5993, 16841, 8252, 13691, 10003, 8111, 235, 14766, 12849, 2184, 14941, 553, 18198, 13296, 15909, 4178, 10873, 1699, 10851, 7884, 10989, 11834, 17542, 11062, 14906, 11217, 3531, 8959, 7512, 14954, 14847, 191, 15084, 9748, 13647, 10950, 11952, 6599, 14961, 131, 183, 17072, 6382, 15685, 2640, 11064, 1031, 6534, 12434, 19085, 17145, 7812 ]
STX_10003.0
[ [ "The function `dtostrf()` is prototyped as:\r\n\r\n char *dtostrf (double val,\r\n signed char width,\r\n unsigned char prec,\r\n char *sout);\r\n \r\n Where: \r\n val Your float variable;\r\n width Length of the string that will be created INCLUDING decimal point;\r\n prec Number of digits after the deimal point to print;\r\n sout Destination of output buffer;\r\n\r\nAn example of usage is as follows:\r\n\r\n\r\n /* OPTION ONE */\r\n\r\n char msgBuffer[20]; // make sure this is big enough to hold your string\r\n char *pointer_to_created_string;\r\n \r\n float testFloat = 123.45;\r\n\r\n pointer_to_created_string = dtostrf(testFloat, 6, 2, msgBuffer);\r\n client.Publish( \" ;...topic... \" ;, pointer_to_created_string);\r\n \r\n /* OPTION TWO */\r\n \r\n char msgBuffer[20]; // make sure this is big enough to hold your string\r\n \r\n float testFloat = 123.45;\r\n \r\n client.Publish( \" ;...topic... \" ;, dtostrf(testFloat, 6, 2, msgBuffer));\r\n\r\nDon&#39;t be put off by the code in the link you included in your question. The first argument sent to `dtostrf` (everything before the first comma) is nothing more than a some calculations bundled into one single line.", "511" ], [ "Read [this article](_URL_0_) and [this article](_URL_1_) on using AJAX/JSON to control your Yun via a webpage. I found the former covers the basics, but presents a very basic HTML page; the latter doesn&#39;t explain quite so well, but includes a much &#39;prettier&#39; web interface.\r\n\r\nIf you study the similarities between the two articles (or, rather, the HTML code) you&#39;ll see what is required for the backbone of the communication and what is there to make it look fancy.\r\n\r\nOnce you&#39;ve understood how it works it&#39;s just a question on learning HTML - there are plenty of tutorials and books online covering that sort of thing, and the Arduino control element becomes nothing more than a few added lines of code at the right moment.", "642" ], [ "I have replaced both &#39;mode&#39; and &#39;control&#39; (they were identical) with a single variable, `btChar`. At the end of `setup()`, wait for a transmission to be received before entering the main loop.\r\n\r\nOnce the main loop begins, a while loop executes until the serial receives a new transmission. Once it is received it is read, btChar is updated and the main loop starts again.\r\n\r\n\r\n char btChar;\r\n \r\n void setup()\r\n {\r\n /* AT THE END OF SETUP() */\r\n\r\n // Wait in setup for first BT transmission\r\n \r\n while (!serial1.available())\r\n { /* do nothing */ }\r\n btChar = serial1.read();\r\n }\r\n\r\n void loop()\r\n {\r\n while(!serial1.available())\r\n {\r\n // Program will stay in this &#39;while&#39; loop until\r\n // a new BT character is recv&#39;d\r\n\r\n switch(btChar)\r\n {\r\n case(&#39;a&#39;):\r\n {\r\n // do the &#39;auto&#39; stuff\r\n break;\r\n }\r\n case(&#39;r&#39;):\r\n {\r\n // do the &#39;remote&#39; stuff\r\n break;\r\n }\r\n default: // this &#39;block&#39; is not essential\r\n {\r\n // you end up here if neither &#39;a&#39; nor &#39;r&#39; was received\r\n }\r\n }\r\n }\r\n btChar = serial1.read();\r\n }\r\n\r\nYou can adapt the setup while-loop further to make sure that the main loop doesn&#39;t begin until the a correct character is received - change the line to:\r\n\r\n while ((!serial1.available()) & & (btChar != &#39;a&#39;) & & (btChar != &#39;r&#39;))\r\n\r\nUsing a `switch-case` statement within the main while-loop is not essential, and I included it out of interest more than necessity. You can use `if` statements instead, with one for &#39;a&#39; and one for &#39;r&#39;. However, in the event that you have a third or fourth (or more-th) mode then a switch-case statement, in my view, looks easier to read.", "730" ], [ "Yes, this is possible. However, you need to have some programming skills (Java, C, C++, anything really that can cope with serial comms) to write the computer-side program.\n\nForget &#39;automatic&#39; running of a program without installing a service on the target computer to constantly monitor incoming serial comms. That said, there&#39;s nothing to stop you doing that but to me it&#39;s an unnecessary extra step. If the End User can handle connecting the Arduino to the computer without having a breakdown, then they can probably cope with launching the input program themselves.\n\nHence, write a program for the target computer that analyses COM ports for active connections. For each connection, listen for some kind of identification sequence. Perform a basic &#39;handshake&#39; to verify that it&#39;s found the Arduino. Once it has, allow the User to enter the WiFi details, which are then passed on to the Arduino via serial. If you&#39;re feeling *slightly* adventurous (the necessary code is provided with the Arduino IDE as an Example, so it&#39;s no real challenge) you could have the Arduino scan for networks and offer the User a list to choose from.\n\nOn the Arduino, include within the sketch a method of opening serial comms with the target computer. This can be either:\n\n - **Within `loop()`**, at regular intervals, which becomes redundant after you&#39;ve performed the setup correctly; or\n - **A one-time affair within `setup()`**. Each time the Arduino is powered on it attempts to establish comms with the computer, but times out after 30 seconds of &#39;silence&#39;, thus the User has to launch the program on the computer within a reasonable time.\n\nWhichever approach you choose, the code in the sketch follows a similar essence - send a unique message to whatever is listening (if anything at all!) and wait for a specific response. If the computer is connected and the program is running, it should answer. Provided the answer received by the Arduino is expected (thus &#39;handshake&#39; mentioned earlier), it should then wait for the SSID/pass to be entered by the User and sent by the computer. From there, connecting the Arduino to the network is a trivial process.", "322" ], [ "The `goto` labels (like &#39;loop&#39; or &#39;delay&#39;) are there to make it easier for you to read your own code, but they don&#39;t get included in the final assembly code when it is compiled. Instead, the `goto` arguement is changed to indicate the amount of lines of code to skip foward or backwards. For example, `goto $+2` is &#39;go to the line 2 on from here&#39; and `goto $-1` is &#39;go to previous line&#39;.", "252" ], [ "This is, for the most part, exactly what others have said. However, nobody has managed to actually use a `for` loop properly; they&#39;ve carried forward your inefficiencies for some unknown reason.\r\n\r\nThe whole point of a `for` loop is to execute a block of code a predetermined number of times. In your code, you create a loop that loops for a ridiculous length (65,536 times) but each time checks how many loops there have been.\r\n\r\nOnce the `for` loop has been constructed properly there are two approaches:\r\n\r\n int NUMBER_LEDS = 100; // you only ever have to change this\r\n // if the number of LEDs change - and it&#39;s really\r\n // easy to find if you put it at the start of\r\n // your code.\r\n \r\n for (int x = 0; x < NUMBER_LEDS; x++)\r\n {\r\n if (x % 2 == 0)\r\n leds[x] = CRGB(x,0,0);\r\n else\r\n leds[x] = CRGB(0,x,0);\r\n Serial.println(x);\r\n FastLED.show();\r\n delay(10);\r\n }\r\n\r\nThe above code is fine if you just want two LED subsets. If you want more than two, you can use a `switch/case` statement:\r\n\r\n int NUMBER_LEDS = 100; // you only ever have to change this\r\n // if the number of LEDs change - and it&#39;s really\r\n // easy to find if you put it at the start of\r\n // your code.\r\n int NUMBER_SETS = 4; // this will give four groups.\r\n\r\n \r\n for (int x = 0; x < NUMBER_LEDS; x++)\r\n {\r\n switch (x % NUMBER_SETS)\r\n {\r\n case (0):\r\n {\r\n leds[x] = CRGB(0,0,0);\r\n break;\r\n }\r\n case (1):\r\n {\r\n leds[x] = CRGB(x,0,0);\r\n break;\r\n }\r\n case (2):\r\n {\r\n leds[x] = CRGB(0,x,0);\r\n break;\r\n }\r\n case (3):\r\n {\r\n leds[x] = CRGB(0,0,x);\r\n break;\r\n }\r\n }\r\n Serial.println(x);\r\n FastLED.show();\r\n delay(10);\r\n }\r\n\r\nYou don&#39;t have to write a `case` block for every outcome of `x%2`; you might want a certain group of LEDs to stay on for two iterations, for example. More information on `switch/case` can be found [here](_URL_1_), towards the bottom of the page.\r\n\r\n\r\nI recommend you read this article on [Operators in C++](_URL_0_), starting from \" ;Compound Assignement \" ;. It helps make code more readable and can considerably decrease the amount of typing you have to do - `i = i + 1` neatly becomes `i++`.", "598" ], [ "Can you confirm that the problem still occurs with the CAT4101 not only excluded from the code, but disconnected from the circuit too? So you just have the LCD and the RTC module connected to the Arduino. Try the following, one at a time: **[1]** power it *directly* via USB, rather than by the 2A transformer **[2]** Ditch the RTC and have the LCD just update arbitrary numbers **[3]** Disconnect LCD and connect the RTC. After each `rtc.now()`, test if `now.second()` is the same as the previous call - if not then toggle the LED. If the LED stops blinking the program has frozen.", "963" ], [ "There are some fundamental problems in the code - `bufferPosition` never stops increasing (until it reaches 32768) and so `buffer` will overflow. However, neither of these two problems are causing the &#39;trash&#39;, as you are outputting the result of reading the serial, not anything from the buffer.\r\n\r\nThe problem lies in the casting of the result from `BTSerial.read()` to `unsigned char`.\r\n\r\n`Serial.print()` does not like this. Actually it doesn&#39;t care, but it won&#39;t give you what you expect. It just prints out the value stored - so &#39;a&#39;, which is 97, will come out as &#39;97&#39; on the serial monitor. `Serial.print()` only outputs ASCII characters when you give it a `char` or `char[]`.", "863" ], [ "The OP uses an `int` array yet stores only the lowest significant byte into the EEPROM. Bad practice but goes unnoticed because the maximum value ever stored is only 255 (MAX_ADC / 4). The uninitiated could be misled into thinking one call each to `EEPROM.write()` and `EEPROM.read()` will magically store and retrieve a multibyte value. In hindsight my comment should have been clearer.", "893" ], [ "Don&#39;t think of inflation as super luminal movement of our galaxy from others. Think about the &#39;stuff&#39; that makes space-time between the galaxies simply increasing (this is inflation). This causes the light to travel through more and more &#39;stuff&#39; as time is passing by. \r\n\r\nImagine a clump of space-time A, and another B, next to each other at the start of the Big Bang. Then add some more clumps of space-time between them. You wouldn&#39;t think that the objects within space-time A and B have actually moved. A really basic analogy would be two pool balls next to each other with an ant on each. The ants can only travel to the next ball by walking on the the balls (ignore the ground). Then imagine the same scenario, but you add another ball between them. The ants haven&#39;t moved on the balls, but they would have to travel further now to get to the ball the other ant is on. The balls in the example would represent space-time, and the ants any galaxy/star.", "146" ], [ "Must:\r\n\r\n* Spider-sense: utilize your location sensor and use visual data from other users to construct 360 degree perception. Pro version offer hilighting important information and suppressing noise\r\n\r\nGames:\r\n\r\n* Ears wiggler\r\n* Chameleon: changing your outer features at will\r\n* Fart to music\r\n\r\nFlappy bird would be: Endless Orgasm Pro version", "153" ], [ "I&#39;m going through this now and I&#39;m slightly confused as to precisely what you&#39;re trying to achieve. Ultimately do you want to be able to choose starting brightness, end brightness, and the time it takes to go from one to the other? That seems the most obvious, but it also seems like you want to specifiy how many individual brightness levels there are inbetween. Also, do you have any timers spare that you aren&#39;t using?", "24" ], [ "Would there be much overhead in wrapping this in a simple class? I know there are a host of container classes in the C++ STL but they are all overkill, in this case at least. The ability to iterate and reference only within the bounds of the array would be a handy tool, and adding a copy function (a copy constructor, even?) could make using the array painless. Apart from the time taken to actually write the class, are there any drawbacks from an embedded point of view that would make this more harm than good?", "711" ], [ "From the Arduino website:\r\n\r\n > ## shiftOut() ##\r\n > \r\n > Description\r\n > \r\n > Shifts out a byte of data one bit at a time. [...]\r\n > \r\n > Note: if you&#39;re interfacing with a device that&#39;s clocked by rising\r\n > edges, you&#39;ll need to make sure that the clock pin is low before the\r\n > call to shiftOut(), e.g. with a call to digitalWrite(clockPin, LOW).\r\n\r\nYou need to pull `clockPin` low before each `shiftOut()` call, as the documentation says.\r\n\r\nAlso, you have misunderstood the behaviour of the `latchPin`. This can be high or low at any time; it&#39;s the *change from low to high* that latches the data into the output cells.", "963" ], [ "How much do you know about network protocols? What it seems that you need answers an age-old situation of multiple nodes with interlinked communication. This is answered todaywith Ethernet as the &#39;default&#39; machine to machine link, but there have been several iterations of network communications/protocols/topology. Start with ALOHA, and then maybe Token Ring. Working through the timeline of network comms I&#39;m sure you&#39;ll find something that balances your needs versus advantages/disadvantages.", "169" ], [ "When one selects a board within Arduino IDE, a preprocessor definition is added to one of the behind-the-scenes files.\r\n\r\nAfter a lot of hunting and some good fortune I found that the format of this definition is:\r\n\r\n #define ARDUINO_ < PROCESSOR-DESCRIPTOR > _ < BOARDNAME > \r\n\r\nSome are easy to guess (`ARDUINO_AVR_UNO`, for example), but others are less so. The Pro Micro has &#39;16&#39; or &#39;8&#39; appended to the definition depending on the speed. I do not know if the definition is different for 5V or 3.3V. I haven&#39;t managed to guess the definition for the Mega2560, but it isn&#39;t anything obvious.\r\n\r\n**Question 1**: Is there a list in existence of the possible definitions?\r\n\r\n**Question 2**: Is there any distinction, as far as compilation and preprocessor involvement is concerned, between _BoardX_-5V and _BoardX_-3.3V, and how is this distinction defined?", "322" ], [ "\" ;you&#39;re supposed to check oil and tyre pressure at every stop for petrol \" ; - It makes one wonder why no manufacturer or government department cares that 99.9% of car owners are apparently not properly maintaining their vehicles or tyres. Since almost no one actually follows instructions like that (for better or worse), I&#39;m guessing the inclusion of such instructions is just legal CYA and a way for manufacturers to get out of having to pay for warranty repairs.", "669" ], [ "Of course, if those instructions are actually important and are intended to be followed, almost everyone who owns a car needs to be educated and petrol stations need to be equipped to accommodate this essential maintenance. Many petrol stations have no air for tyres, or only 1 compressor for the entire station. They also generally do not have sufficient parking for every custom to check the air in their tires. Petrol station staffing and lighting are often inadequate for checking oil levels, and clean towels are often not present to wipe dip sticks.", "141" ], [ "The operate/release time for a [typical relay](_URL_0_) is 10ms/4ms - that means it takes 14ms for the contacts to close and open again. 14ms equates to a maximum &#39;click&#39; frequency of 71Hz.\r\n\r\nTypical rates of cycles-before-failure are in the region of 100,000 minimum - but at a rate of 5 cycles per second. This will rapidly decrease as you increase the switching rate.\r\n\r\nFurthermore, as alluded to in the above datasheet, must-operate and must-release voltages increase as the number of completed cycles moves into the tens-of-thousands. Thus, if you were to find a relay that switched fast enough you will eventually (and maybe only after a 100 seconds of non-continuous operation) run its operating voltage above a level that can be achieved.\r\n\r\n----------\r\n\r\nDue to the maximum switching frequency of a relay you **cannot** use one, or many, to synthesise speech. Speech is an incredibly complex mixture of frequencies, the majority of which are well above those that can be produced by switching a relay on and off.\r\n\r\n\r\n----------\r\n\r\n\r\n*Music* is a loose term. Simply switching the relay on and off once per second is technically a rythym, and therefore music. Different relay models will have different &#39;clicks&#39; - the smaller the contacts the higher the click will be in pitch (logically speaking, that is). A collection of *different* relays could definitely create music, akin to percussion, but by their *individual clicks* and **not by the rapid switching thereof**.", "478" ], [ "@vsz I&#39;d tried that. None of my men returns from those covert missions. They&#39;re either killed or converted, either way, I assumed that they could spot the ill intention in my men. (refer to point 5 above)\nEven if I could smuggle men in, it could take decades to be safe from suspicion. And could a few thousands disrupt their society when lies don&#39;t work on them? Sabotage only reveal my men&#39;s true allegiance.", "790" ], [ "I&#39;m a Father. Through the love that we share, I protect my [children][1], show them how to fight. There was time when we don&#39;t have to fight, but the <PERSON> wants our Lovestones for his so-called &#39;industry&#39;. So.\r\n\r\nIt was the fifth year of the world. Their attacks is less and less frequent. Maybe he is losing interest in killing us. I feel less my children dead from the their skirmish. But things are not getting better. A strange disease is spreading.\r\n\r\nIt started at the borders, no doubt from some evil scheme the Stupi had thought of. My children showed no apparent symptoms that the Mothers could do about. They just suddenly turned ill in a few days and then their love winked out. The Hight Father knew about this, but he had not thought of way to stop it, yet.\r\n\r\nFeeling the love of my children winked out all over the Land, I wanted to freak out, but couldn&#39;t - thank to the Mothers. I suspect most of us had been infected, but I&#39;m not sure. Are we all doomed? O Spirits! Show us the way to salvation! How do I protect my children from this?\r\n\r\n**Notes**:\r\n\r\n 1. The only enemy we have is no the south: the Stupi\r\n 2. The rate of winking out is increasing, maybe we have a year, or a month\r\n 3. We only have 150 000 Brothers fit for fighting, spreading all the border to maintain the illusion of the invincible army\r\n 4. The population is gathering at 13 Great Altars around the country.\r\n 5. On the north is the great winter land, we don&#39;t know what&#39;s up there, we hadn&#39;t needed to ventured there before\r\n 6. Our people live with nature, resources were plentiful, we don&#39;t make anything new, if the old still serve us well enough (my cloths were of my great grand..)\r\n 7. I have no illusion of getting out of this the easy way, saving even one of the Altar is good enough\r\n 8. The Lovestones were the manifestation of our deceased ones&#39;s love, there&#39;s nothing magical about it, but we&#39;re not giving it away\r\n\r\n**Edit 1**:\r\n\r\n 1. Father is a title of a leader (equivalent of a lord), High Father is the king\r\n 2. Mother is a title of a psychic healer, their only purpose is to maintain the positive emotional atmosphere\r\n 3. Lovestones offer no magical power, they slowly crystallized from nothing where someone (of that race) died.\r\n\r\n**Third person perspective**: The <PERSON> is a close people. They&#39;re not very friendly to strangers. Everything about them is pretty much ambiguous, plenty of rumors, nobody sure. The <PERSON> thought the <PERSON> are the source of their psychic power, so obviously his Evilness wants it. The <PERSON> tried many kind tactics against them but couldn&#39;t make a noticeable victory in decades. One day, he forced villagers (infected with a terrible disease that is well known in his country) to take up arms and march into the Wussname. Then he quarantine his borders, shoot anything that try to cross and at the same time, lied to his men to continue the attacks as usual to pretend that he had nothing to do with spreading the disease (he had good public image).\r\n\r\n [1]: _URL_0_", "462" ], [ "You should write out *in plain English/language* what you want to happen and then translate that to code. Your current program doesn&#39;t seem to follow any logic and it&#39;s hard for us to know your intentions. For example, your first `if` statement says `if E is greater than W then print *west*` - that&#39;s why you see \" ;west \" ; when E is bigger, but you are saying you don&#39;t want that.", "157" ], [ "You have misunderstood how shift registers work - and one of the main reasons they exist in the first place.\r\n\r\nShift register ICs have a common &#39;latch&#39; pin which latches the data present at the input of the cell into the cell, thus updating the output. Some ICs also offer an \" ;output enable \" ;, which switches the outputs to a high-impedance state irrespective of the values in the cells - this might not be useful in your case, but the feature exists.\r\n\r\nWith a serial-to-parallel shift register you can shift in as many bits as you want, at whatever rate you choose, and the outputs will never change **until you trigger a rising edge on the LATCH pin**.\r\n\r\n\r\n----------\r\n\r\n**How a (latching) Shift Register works:**\r\n\r\nYou have eight spaces within the register:\r\n\r\n ___ ___ ___ ___ ___ ___ ___ ___ \r\n [DATA_IN]-- > |___|--|___|--|___|--|___|--|___|--|___|--|___|--|___|-- > [DATA_OUT]\r\n BIT0 BIT7\r\n\r\nThe &#39;spaces&#39; are chained together; at one end of the chain is the `DATA_IN` pin and at the other end is the `DATA_OUT` pin.\r\n\r\nEvery time there is a rising edge on the `CLOCK` pin, data is *shifted* down the chain from `DATA_IN` to `DATA_OUT`, one space at a time. For example, if the state of the &#39;spaces&#39; is as the left hand column, then upon the rising edge of the `CLOCK` pin the spaces will change to the values in the right hand column:\r\n\r\n DATA_IN PIN = 1 - > C - > ?\r\n BIT0 &#39;SPACE&#39; = 0 - > L - > 1\r\n BIT1 &#39;SPACE&#39; = 1 - > O - > 0\r\n BIT2 &#39;SPACE&#39; = 1 - > C - > 1\r\n BIT3 &#39;SPACE&#39; = 0 - > K - > 1\r\n BIT4 &#39;SPACE&#39; = 0 - > E - > 0\r\n BIT5 &#39;SPACE&#39; = 1 - > D - > 0\r\n BIT6 &#39;SPACE&#39; = 1 - > G - > 1\r\n BIT7 &#39;SPACE&#39; = 0 - > E - > 1\r\n\r\nYou will see that `BIT(n)` changes to the value of `BIT(n-1)`, with `BIT0` changing to the value of `DATA_IN`. The `DATA_OUT` pin is used to daisy-chain multiple shift registers together. The important thing to note here is that **the outputs do not change without a rising edge on the `LATCH` pin**. You can pulse `CLOCK` as many times as you want, with whatever values on `DATA_IN`, and the outputs will not change. Ever.\r\n\r\nWhen you finally trigger the `LATCH` pin, the value in each &#39;space&#39; is latched into a second row of &#39;spaces&#39; - these represent the outputs. On a latch trigger, the outputs therefore change to the values of the *last eight* bits that were shifted into the `DATA_IN` pin. For example:\r\n\r\n OUTPUT = 11001010\r\n SHIFT IN \" ;01101111 \" ; (starting with RHS first)\r\n TRIGGER RISING EDGE ON &#39;LATCH&#39; PIN\r\n OUTPUT = 01101111\r\n SHIFT IN \" ;11110000110011001100 \" ;\r\n TRIGGER RISING EDGE ON &#39;LATCH&#39; PIN\r\n OUTPUT = 11110000 i.e. the LAST EIGHT BITS that were shifted in\r\n SHIFT IN \" ;10 \" ;\r\n TRIGGER RISING EDGE ON &#39;LATCH&#39; PIN\r\n OUTPUT = 10111100 again the LAST EIGHT BITS that were shifted in\r\n\r\nIt is generally never the case with a serial-in-parallel-out register that you would ever shift in less that eight bits at a time, so the last example is only there to illustrate the functioning of the IC.", "963" ], [ "I asked a [related question](_URL_0_) a while ago.\r\n\r\nAn internal *.h file exists which is created by the IDE, and holds in it the type of board that has been selected. The list of possible options is given in the linked question, but only for AVR boards. I believe the non-AVR list is much shorter.\r\n\r\nIt is simply a matter of adding some conditional statements to send the PC the correct information. A simple example:\r\n\r\n < !-- language = C++ -- > \r\n\r\n //...within your code, perhaps during setup()...\r\n #ifdef ARDUINO_AVR_UNO\r\n serial.println( \" ;UNO \" ;);\r\n #endif\r\n #ifdef ARDUINO_AVR_LEONARDO\r\n serial.println( \" ;LEONARDO \" ;);\r\n #endif\r\n // etc...\r\n\r\nIf you need to refer to the board type more than once in the sketch, use the following format:\r\n\r\n < !-- language = C++ -- > \r\n\r\n //...BEFORE setup(), or otherwise in the global namespace...\r\n #ifdef ARDUINO_AVR_UNO\r\n #define __BOARD_TYPE \" ;UNO \" ;\r\n #endif\r\n #ifdef ARDUINO_AVR_LEONARDO\r\n #define __BOARD_TYPE \" ;LEONARDO \" ;\r\n #endif\r\n // etc...\r\n\r\n // within your code, wherever necessary:\r\n serial.println(__BOARD_TYPE);\r\n\r\nThe latter is much tidier, even if you only need `__BOARD_TYPE` once, as it removes the cumbersome `#ifdef` chunk from your functions.\r\n\r\nYou will, of course, have to write one for each board that you expect your end-user could have, and you will possibly need to update this list as new models appear.", "322" ], [ "Oh, the joys of buying something off the Internet with no datasheet, no part number and no clue how to use it. And then expecting somebody else to tell you how it works.\r\n\r\nThat module looks like a KY-038, made by Keyes. No guarantees, though, because I&#39;m not telepathic.\r\n\r\nBytes don&#39;t \" ;pass through the soundsensor \" ;. Bytes don&#39;t pass anywhere, in fact. That board has an analogue output, `A0`, which is the amplified audio sensed by the microphone. It swings between 0 and 5 volts, and is 2.5V when no sound is being picked up. The board also has a digital output, `D0`, which is **active-low** when the intensity of the sound picked up by the microphone exceeds a thershold. I have no idea what this threshold is or what volume it represents, or if it can be changed.\r\n\r\nHave a look at the pages on [AnalogRead()](_URL_0_) for information on how to convert analogue audio to a digital signal.\r\n\r\nI don&#39;t know what you mean by \" ;a Lib PCM thats converts chars in voices \" ; - &#39;chars&#39; as in the C-type `chars` or do you mean literal &#39;characters from a voice&#39;, i.e. speech recognition? I cannot tell if you have misunderstood something or there&#39;s an unfortunate translation coincidence which is confusing matters.", "887" ], [ "I had a Leonardo sending data to a FTDI-breakout-driven 3.3V Pro Mini and to a Mega2560. Both the Mini and Mega had idenctial code, except for the pipe addresses. The Mega was able to pick up every transmission (perhaps six losses out of 10,000 attempts) but the Mini was missing at least half of the packets. I changed the datarate to 2MBps (call `radio.setDataRate(RF24_2MBPS)` in `setup()` *for each device*) and the Mini&#39;s success rate jumped from under 50% to over 90%. It might be a bodge - the transmission has finished before the voltage has a chance to drop low enough - but it worked.", "1004" ], [ "\" ;103 \" ; is standard resistor (and other component) numbering - the first two digits specify a value and the third is a power-of-ten multiplier:\r\n\r\n 1 0 3 = 10 * 10^3 = 10K\r\n \r\n 4 7 2 = 47 * 10^2 = 4.7K\r\n\r\nFor devices that are typically measured in *thousandths*, *millionths* or smaller (like a capacitor) then the third digit is a *minus* power-of-ten:\r\n\r\n 1 0 6 = 10 * 10^-6 = 1u\r\n\r\nThat black disc labelled &#39;103&#39; is a [thermistor](_URL_0_) - a temperature-controlled resistor. It is most likely NTC, or negative-temperature coeffiecient, thus the resistance decreases as the temperature increases. This is contrary to typical physics where an increase in the temperature of a generic conductive material results in an increase in its electrical resistance.\r\n\r\nThe LM358 is included to *buffer* the thermistor from the Arduino/microcontroller. In simple terms, this means that the effective resistance of the analogue input pin does not have to be taken into consideration when converting the voltage measured to into a value for the temperature.\r\n\r\nWithout a better picture of both sides of the board, or better yet a circuit diagram, it is not possible to determine what the voltage on pin `S` will be for a given temperature. However, it seems that the thermistor is in series with another 10K resistor (`R3`, marked &#39;103&#39; of course) such that an increase in temperature results in an increase in voltage. At roughly 20 degrees Celsius (it depends on the manufacturer and their specifications) the resistance of the thermistor will be 10K, thus the voltage at `S` will be `Vcc/2`. Calculating the voltage for different temperatures requires you to know the temperature coefficient, which can be found from the datasheet or by measuring the resistance at various known temperatures and plugging those values into an equation.", "124" ], [ "The shop is set outside of time and space. It only opens to travelers who happens to possess some insignificant-seeming items (but actually have hidden attributes the shop can activate). The shop then offers the traveler an item that looks pretty awesome. While the traveler is distracted, it steal the artifact.\r\n\r\nAfter the traveler left, the shop activate the artifact and sell it to the next innocent traveler. The act of activating artifact is expensive and exhausting, so the shop put a magic-sapping charm (and/or other evil viruses) on the artifact so the traveler will stupidly spread all over the world.\r\n\r\nThe shop sit back and collect the magic transferred from countless artifacts it sold.", "96" ], [ "As mentioned in a comment, your code has some fundamental flaws. **Do not** call `loop()` from within `loop()`! Aside from the code errors, your question has a legitimate element.\r\n\r\nTesting the tri-state behaviour of an input pin will let you know if it is genuinely high, genuinely low, or floating (disconnected). The technique was given in [this answer](_URL_0_) to similar problem I was encountering.\r\n\r\nIn short:\r\n\r\nConnect a large (1MOhm) resistor to each input between the pin and ground, then for each pin:\r\n\r\n- Turn off internal pullup;\r\n- Read value of input pin;\r\n- Turn on internal pullup;\r\n- Read value again.\r\n\r\nIf the value changes from the first to the second `digitalRead()`, the input was not connected to anything. If the value remains the same then it is a genuine value from a connected device.", "963" ], [ "You should specify that you are using a *breakout board* or a *module* for the amplifier. The PAM8403 is useless by itself without some specific external components - as are many many other ICs that are popular with Arduinoists - and so third-party companies such as Adafruit make breakout boards so that you can use these ICs without having to worry about the necessary extras. Thus, in your case, pin 9 does not go &#39;straight into the PAM8403&#39;, or at least I doubt it does. However, nothing can be said for certain without seeing a schematic for the module board.", "322" ], [ "Using `digitalWrite()` is the slowest by far.\r\n\r\nUsing PWM could be the fastest.\r\n\r\nUsing Serial could be the fastest.\r\n\r\n**PWM:**\r\n\r\nYou have to filter the PWM output to be a smooth analogue signal for it to be of any use. The filtering adds an inherent sluggishness, or response time, to the system - the harder the filtering the slower the reaction to changes in the PWM duty cycle. Adjusting the filter component&#39;s values will give an optimum point between smoothness and response time. Bear in mind that the motors may respond erratically if there is insufficient damping of the signal. This will probably give the Sabertooth a hard time, too. The datasheet recommends are filter response time of greater than 1ms.\r\n\r\n**Serial:**\r\n\r\nIf you are considering the 2x 60Amp version (thanks for adding plenty of information in the question, by the way) then the fastest baud rate is 384kbps - or 48k commands per second. The Arduino will of course not be churning data continuously because it&#39;ll be busy running the rest of the program, but using serial it is theoretically possible to send commands *faster than the motor controller&#39;s output PWM*.\r\n\r\n**So which is faster?**\r\n\r\nNo idea. Only you can determine this, and I doubt you&#39;ll be able to determine the answer without wasting your time on some experiments.\r\n\r\nThe motors will have an inherent mechanical dampening thus creating an overall bottleneck in the whole system response time. I can almost guarantee that both PWM and Serial methods will be much faster than the response time of the motors themselves.", "478" ] ]
0
[ 7828, 11575, 3834, 8965, 597, 16878, 8704, 1151, 1044, 9984, 9106, 11061, 3520, 10490, 821, 18328, 14414, 10420, 5379, 3712, 18689, 4061, 16845, 8318, 19067, 18086, 17475, 4708, 3571, 3539, 9389, 18922, 12407, 174, 17275, 10468, 6045, 7545, 5995, 11573, 4961, 18402, 4588, 513, 1088, 2816, 11063, 3611, 12003, 11717, 3764, 3792, 2083, 2060, 1, 17177, 6550, 19401, 17176, 5947, 15897, 7748, 11354, 4098, 1328, 18576, 9096, 2904, 995, 4890, 17490, 5084, 3526, 19642, 2748, 10718, 1670, 18385, 11410, 9949, 19509, 16691, 664, 3925, 13244, 4036, 15340, 12843, 19239, 345, 18, 9450, 1919, 3576, 19394, 14050, 2740, 145, 4484, 2675, 6985, 4938, 13098, 19677, 749, 8498, 8868, 12030, 17126, 17029, 9576, 16575, 13430, 11574, 7589, 6158, 3528, 9974, 10910, 17111, 16407, 4997, 15313, 5709, 13806, 4204, 11864, 3031, 3222, 6545, 19479, 4027, 8213, 16526, 3267, 7804, 14357, 5490, 17945, 18040, 19235, 2148, 2458, 350, 10470, 14628, 61, 9749, 10462, 7097, 17463, 19192, 1268, 15038, 13171, 17486, 1922, 46, 711, 3335, 6774, 12856, 14458, 4976, 7024, 2362, 18319, 4212, 11576, 18469, 9613, 7035, 3475, 16281, 11849, 18539, 1410, 11048, 19698, 1258, 12455, 19686, 11008, 17670, 12701, 18683, 7153, 3350, 15503, 7626, 19216, 13809, 5082, 18026, 9638, 18274, 6059, 785, 7629, 18508, 7672, 3192, 6065, 5475, 4870, 1641, 12307, 8062, 12751, 17897, 3916, 8808, 9592, 7679, 17223, 18163, 5072, 9693, 16145, 13181, 13064, 9091, 11219, 1145, 13362, 14098, 10108, 7810, 6040, 13970, 1929, 4694, 15054, 15867, 15104, 19693, 17096, 15452, 3004, 4157, 2125, 14755, 16350, 1681, 1785, 13734, 2890, 5245, 18180, 14219, 803, 15531, 3109, 2542, 5058, 8158, 15773, 9866, 19379, 12926, 18888, 5874, 10148, 3320, 4682, 19418, 3070, 716, 10544, 15364, 684, 2759, 14919, 10747, 1120, 10956, 4860, 4546, 15805, 19392, 18915, 5395, 5752, 461, 4739, 13871, 2845, 6452, 17571, 974, 5406, 17660, 11928, 4970, 15438, 11749, 13442, 2001, 16784, 14200, 17215, 8056, 16383, 1232, 14552, 13204, 2253, 3127, 14497, 2338, 8737, 7283, 12020, 1616, 19160, 17454, 10733, 8229, 15641, 13085, 5526, 8000, 2784, 752, 11695, 10966, 5103, 18300, 7143, 18557, 18647, 6359, 17395, 17330, 16900, 10925, 4499, 8563, 4068, 5263, 2746, 18911, 1790, 5981, 16252, 226, 14071, 16467, 19353, 9899, 19426, 9694, 16175, 1772, 16650, 19753, 568, 967, 8991, 18118, 13014, 14114, 9341, 16725, 15980, 3282, 15119, 9368, 9936, 7510, 4840, 9384, 5567, 14471, 11115, 18232, 14530, 16748, 10155, 8004, 4815, 8006, 1393, 14154, 6746, 14714, 16270, 3514, 4282, 18090, 13093, 10959, 18039, 1440, 4544, 10019, 2498, 2862, 18845, 6897, 11303, 6429, 5122, 3295, 13008, 576, 7875, 1416, 97, 15519, 12388, 3971, 17823, 1913, 13938, 19430, 6495, 8010, 11136, 15749, 1794, 10673, 3240, 1984, 7837, 6208, 18573, 5109, 6635, 2430, 9600, 17913, 16542, 2445, 16906, 19058, 4004, 19069, 3426, 5669, 12826, 11297, 12489, 17941, 11176, 11280, 4644, 17030, 10588, 13390, 11582, 9146, 17493, 948, 16852, 910, 10879, 15956, 18223, 10621, 1507, 12675, 1032, 6050, 185, 10464, 9380, 16987, 4891, 5322, 950, 6864, 1869, 7918, 18360, 9379, 16737, 2541, 18419, 12933, 9846, 4537, 5677, 3748, 3662, 17831, 19420, 17453, 3081, 11685, 3676, 7321, 2758, 3598, 10137, 11653, 15696, 9702, 6659 ]
STX_1000514.0
[ [ "I&#39;m trying to deploy an Angular app using Capistrano following [this](_URL_0_) tutorial. So in my Capfile I have the following:\r\n\r\n require &#39;capistrano/setup&#39;\r\n require &#39;capistrano/deploy&#39;\r\n Dir.glob(&#39;lib/capistrano/tasks/*.rake&#39;).each { |r| import r }\r\n\r\nAnd in my `config/deploy` file I&#39;ve got the following:\r\n\r\n ...\r\n task :bower_and_npm_install do \r\n on roles(:app), in: :sequence, wait: 5 do\r\n within release_path do \r\n execute :npm, \" ;install \" ;\r\n execute :bower, \" ;install \" ;\r\n end\r\n end\r\n end\r\n after :published, :bower_and_npm_install\r\n ...\r\n\r\nWhen I try to deploy I get the following error: \r\n\r\n [6ff53bb3] Command: cd /home/user/apps/myapp/releases/20151015095546 & & /usr/bin/env npm install\r\n DEBUG [6ff53bb3] /usr/bin/env:\r\n DEBUG [6ff53bb3] npm\r\n DEBUG [6ff53bb3] : No such file or directory\r\n\r\nI&#39;ve tried the following:\r\n\r\n ...\r\n execute \" ;bash -c &#39;. /usr/bin/npm & & cd #{current_path} & & npm install&#39; \" ;\r\n ...\r\n OR\r\n execute \" ;/usr/bin/npm & & cd #{current_path} & & npm install&#39; \" ;\r\n OR\r\n execute \" ;cd #{current_path} & & npm install&#39; \" ;\r\n\r\nAnd none of it worked.\r\n\r\nAny ideas?", "46" ], [ "First things first: I was given the task to deploy a Drupal website on Azure.\r\n\r\nLocally I use OS X running Apache and everything works ok. When I deploy the project to Azure, I get an error. After some debugging I isolated the error to this snippet of code:\r\n\r\n private function getToken(){\r\n\t\t$ch = curl_init($this- > host . $this- > clientId . \" ; & client_secret= \" ; . $this- > clientSecret);\r\n\t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\r\n\t\tcurl_setopt($ch, CURLOPT_HTTPHEADER, array(&#39;accept: application/json&#39;,));\r\n\t\t$response = json_decode(curl_exec($ch));\r\n\t\tcurl_close($ch);\r\n\t\t$token = $response- > access_token;\r\n\t\tdvm($response, $name = NULL);\r\n\t\treturn $token;\r\n\t}\r\n\r\n`dvm()` is a Drupal Devel function, but suffice to say that&#39;s sort of `print_r` for Drupal on steroids. \r\n\r\nThe problem I&#39;m getting is that for whatever reason, `$result` is coming back `NULL`. When I run the same code on my local machine and on a Linux/Debian box, all worked as expected (I get an Object as a result of the `curl`). \r\n\r\nThis leads to the conclusion that Azure is not liking something in this piece code. The problem is finding out what. Any ideas?", "220" ], [ "Ok, I&#39;ve got a Drupal site which I&#39;m deploying on Azure. My App perform an API call to Marketo to trigger an action in Marketo&#39;s API.\r\n\r\nOn my local dev and on a Debian server (regular lamp stack) all works fine.\r\n\r\nWhen I deploy the site to Azure, it doesn&#39;t work and all I get is `NULL`.\r\n\r\nHere&#39;s my code:\r\n\r\n public function postData(){\r\n\t\t\t$url = $this- > host . \" ;/rest/v1/campaigns/ \" ; . $this- > id . \" ;/schedule.json?access_token= \" ; . $this- > getToken();\r\n\t\t\t$ch = curl_init($url);\r\n\t\t\t$requestBody = $this- > bodyBuilder();\r\n\t\t\tprint_r($requestBody);\r\n\t\t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\r\n\t\t\tcurl_setopt($ch, CURLOPT_HTTPHEADER, array(&#39;accept: application/json&#39;,&#39;Content-Type: application/json&#39;));\r\n\t\t\tcurl_setopt($ch, CURLOPT_POST, 1);\r\n\t\t\tcurl_setopt($ch, CURLOPT_VERBOSE, true);\r\n\t\t\tcurl_setopt($ch, CURLOPT_POSTFIELDS, $requestBody);\r\n\t\t\tcurl_getinfo($ch);\r\n\t\t\t$response = curl_exec($ch);\r\n\t\t\tdvm($response, $name = NULL);\r\n\t\t\treturn $response;\r\n\t\t}\r\n\r\n\t\tprivate function getToken(){\r\n\t\t\t$ch = curl_init($this- > host . \" ;/identity/oauth/token?grant_type=client_credentials & client_id= \" ; . $this- > clientId . \" ; & client_secret= \" ; . $this- > clientSecret);\r\n\t\t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\r\n\t\t\tcurl_setopt($ch, CURLOPT_HTTPHEADER, array(&#39;accept: application/json&#39;,));\r\n\t\t\tcurl_setopt($ch, CURLOPT_VERBOSE, true);\r\n\t\t\t$response = json_decode(curl_exec($ch));\r\n\t\t\tcurl_close($ch);\r\n\t\t\t$token = $response- > access_token;\r\n\t\t\tdvm($response, $name = NULL);\r\n\t\t\treturn $token;\r\n\t\t}\r\n\r\n**Please note:**\r\n\r\nThere are 2 calls: one to get the access_token and another the actual trigger.\r\n\r\n`dvm($response, $name = NULL);` in simplistic terms is a Drupal equivalent to `print_r`\r\n\r\nThis exact same code works on my local machine (OS X, Apache, PHP5.6) and on Debian (Apache, PHP 5.6).\r\n\r\nI&#39;m using SQLite which is not exactly relevant but I though I should add just in case.\r\n\r\nWhen I execute this code locally or on the Debian server I get the `$result` variable printed which tells me whether it was successful or not. On Azure I get just `NULL` for the first `FALSE` to the second.\r\n\r\nThe variables (`$this- > id`, `$this- > getToken()`, etc) are correctly set and I can I print them fine. Like I said, all works locally.\r\n\r\nWhat am I missing?", "220" ], [ "I&#39;m trying to use Angular Typeahead to return an object rather than the string search but I can&#39;t get it to work. Here&#39;s my code in the controller:\r\n\r\n $scope.getLocation = function(val) {\r\n return $http.get(API_PROVIDER.full_path + &#39;users.json&#39;, {\r\n params: {\r\n first_name: val,\r\n _role: &#39;voiceArtist&#39;\r\n }\r\n }).then(function(resultonse){\r\n return resultonse.data.users.map(function(item){\r\n return item;\r\n });\r\n });\r\n };\r\n\r\nAnd in my view:\r\n\r\n < input type= \" ;text \" ; ng-model= \" ;asyncSelected \" ; placeholder= \" ;Search here \" ; typeahead= \" ;name.first_name for name in getLocation($viewValue) | filter:{first_name:$viewValue} \" ; typeahead-loading= \" ;loadingLocations \" ; class= \" ;form-control \" ; > \r\n < i ng-show= \" ;loadingLocations \" ; class= \" ;fa fa-spin fa-refresh \" ; > < /i > \r\n\r\nBut all I get back is the string. What am I missing?", "964" ], [ "I resolved at the end. It was the order of it I was getting wrong. Instead of \r\n\r\n < input type= \" ;text \" ; ng-model= \" ;asyncSelected \" ; placeholder= \" ;Search here \" ; typeahead= \" ;name.first_name for name in getLocation($viewValue) | filter:{first_name:$viewValue} \" ; typeahead-loading= \" ;loadingLocations \" ; class= \" ;form-control \" ; > \r\n\r\nShould be this:\r\n\r\n < input type= \" ;text \" ; ng-model= \" ;voice.voiceArtist \" ; placeholder= \" ;Search voice artist \" ; typeahead= \" ;state as state.first_name for state in getLocation($viewValue) | filter:{name:$viewValue} \" ; class= \" ;form-control \" ; >", "714" ], [ "I&#39;m using HTTParty to do an external API call like so:\r\n\r\n @result = HTTParty.get(&#39;some/url&#39;)\r\n\r\nThe result is a 3/4 layers nested JSON object with arrays (the result is not always the same though, some times there are more nested objects, some times more arrays, some times no arrays, etc but it always either nested objects nested objects with arrays):\r\n\r\n {\r\n \" ;something \" ;: \" ;10100014 \" ;,\r\n \" ;something \" ;: \" ;025MH-V0625 \" ;,\r\n \" ;something \" ;: null,\r\n \" ;something \" ;: null,\r\n \" ;something \" ;: \" ;SALE \" ;,\r\n \" ;nested \" ;: {\r\n \" ;something \" ;: \" ;DETACHED_HOUSE \" ;,\r\n \" ;something \" ;: null,\r\n \" ;something \" ;: \" ;2014 \" ;,\r\n \" ;something \" ;: 0,\r\n \" ;something \" ;: 138,\r\n \" ;something \" ;: 0,\r\n \" ;something \" ;: null,\r\n \" ;something \" ;: \" ;A2010 \" ;,\r\n \" ;something \" ;: \" ;M2 \" ;,\r\n \" ;nested \" ;: {\r\n \" ;something \" ;: \" ;Tv&#230;ragervej \" ;,\r\n \" ;something \" ;: \" ;34A \" ;,\r\n \" ;something \" ;: \" ; \" ;,\r\n \" ;something \" ;: null,\r\n \" ;something \" ;: \" ;K&#248;benhavn S \" ;,\r\n \" ;something \" ;: \" ;2300 \" ;,\r\n \" ;something \" ;: \" ;DK \" ;\r\n }\r\n ...\r\n }\r\n\r\nNow I need to iterate over key/values (including nested key/values) of the result but when I do:\r\n\r\n @result.respond_to?(:each)\r\n\r\nor \r\n\r\n @result[ \" ;nested \" ;].respond_to?(:each)\r\n\r\nI get a `false`. I&#39;ve also tried:\r\n\r\n @n_result = @result.to_json\r\n\r\nand\r\n\r\n @n_result = JSON.parse(@result)\r\n\r\nBut I get the `false` in both cases. Any ideas?", "912" ], [ "I&#39;m building an API which has CORS enabled like so (Its in dev mode so the rules are quite lax):\r\n\r\n config.middleware.insert_before 0, \" ;Rack<IP_ADDRESS>Cors \" ;, :debug = > true, :logger = > (- > { Rails.logger }) do\r\n allow do\r\n origins &#39;*&#39;\r\n\r\n resource &#39;/cors&#39;,\r\n :headers = > :any,\r\n :methods = > [:post],\r\n :credentials = > true,\r\n :max_age = > 0\r\n\r\n resource &#39;*&#39;,\r\n :headers = > :any,\r\n :methods = > [:get, :post, :delete, :put, :options, :head],\r\n :max_age = > 0\r\n end\r\n end\r\n\r\nAnd the client is consuming the API fine, no problem. Now I&#39;m trying to add file upload via Carrierwave, Fog and S3. In my config I&#39;ve got the following:\r\n\r\nWhenever I add the following config:\r\n\r\n CarrierWave.configure do |config|\r\n\t config.fog_provider = &#39;fog/aws&#39; # required\r\n\t config.fog_credentials = {\r\n\t provider: &#39;AWS&#39;, # required\r\n\t aws_access_key_id: &#39;xxx&#39;, # required\r\n\t aws_secret_access_key: &#39;yyy&#39;, # required\r\n\t region: &#39;eu-west-1&#39;, # optional, defaults to &#39;us-east-1&#39;\r\n\t host: &#39;_URL_0_&#39;, # optional, defaults to nil\r\n\t endpoint: &#39;https://_URL_0_:8080&#39; # optional, defaults to nil\r\n\t }\r\n\t config.fog_directory = &#39;name_of_directory&#39; # required\r\n\t config.fog_public = false # optional, defaults to true\r\n\t config.fog_attributes = { &#39;Cache-Control&#39; = > \" ;max-age=#{365.day.to_i} \" ; } # optional, defaults to {}\r\n\tend\r\n\r\nWhen without any contact with S3, my API/CORS stops working. So I thought the problem was the CORS on my S3 bucket.\r\n\r\nSo I&#39;ve added the following CORS on the bucket:\r\n\r\n < CORSConfiguration > \r\n < CORSRule > \r\n < AllowedOrigin > MYIP < /AllowedOrigin > \r\n\r\n < AllowedMethod > PUT < /AllowedMethod > \r\n < AllowedMethod > POST < /AllowedMethod > \r\n < AllowedMethod > DELETE < /AllowedMethod > \r\n < AllowedMethod > PUT < /AllowedMethod > \r\n\r\n < AllowedHeader > * < /AllowedHeader > \r\n < /CORSRule > \r\n < /CORSConfiguration > \r\n\r\nI still get the CORS blocking the API calls. Any ideas on how to make this work?", "660" ], [ "I&#39;m trying to display an avatar of an user once the user logs in:\r\n\r\n < img src= \" ;{{(API_PROVIDER.domain + user.avatar.small_thumb.url)}} \" ; alt= \" ; \" ; class= \" ;img-circle size-30x30 \" ; > \r\n\r\nBut the above code only works if I reload the page after login. How can I get it to work without having to programmatically reload the page?\r\n\r\nPS: The above resolves to something like this: _URL_1_\r\n\r\n**EDIT:**\r\n\r\nI have tried using `ng-src` instead of `src` and it didn&#39;t work. As to the other comment whether my variables were in scope, yes, the avatar link is only defined when the user signs in. Then I use `$state.go(&#39;somewhere&#39;)` to change the template, in which case I&#39;d image the variable should be updated. \r\n\r\nHere&#39;s my main controller:\r\n\r\n (function() {\r\n &#39;use strict&#39;;\r\n\r\n angular\r\n .module(&#39;admin&#39;)\r\n .controller(&#39;MainController&#39;, MainController);\r\n\r\n /** @ngInject */\r\n function MainController($timeout, webDevTec, toastr, $scope, $http, authenticatedUser, Session, $anchorScroll, API_PROVIDER) {\r\n\r\n ...\r\n\r\n $scope.session = Session;\r\n $scope.user = Session.user;\r\n $scope.API_PROVIDER = API_PROVIDER;\r\n\r\n ...\r\n\r\n }\r\n })();\r\n\r\nHere ar the components of my Session (reduced for brevity):\r\n\r\n ...\r\n this.create = function(user) {\r\n\t\tthis.user = user;\r\n\t\tthis.role = user._role;\r\n\t\tthis.token = user.auth_token;\r\n\t this.userRole = user._role;\r\n };\r\n return this;\r\n ...\r\n\r\nAnd how the session is saved for later retrieval:\r\n\r\n ...\r\n $window.sessionStorage[ \" ;userInfo \" ;] = JSON.stringify(loginData);\r\n ...\r\n\r\nDo I need to use `$apply()` in this case? If yes, how so?\r\n\r\n**EDIT 3: Here&#39;s how I&#39;m setting my `Session` object**\r\n\r\n authService.login = function(user, success, error, $state) {\r\n $_URL_0_(API_PROVIDER.full_path + &#39;signin&#39;, user).success(function(data) {\r\n \r\n if(data.success){\r\n var user = data.user;\r\n var loginData = user;\r\n $window.sessionStorage[ \" ;userInfo \" ;] = JSON.stringify(loginData);\r\n delete loginData.password;\r\n Session.create(loginData);\r\n $rootScope.$broadcast(AUTH_EVENTS.loginSuccess);\r\n success(loginData);\r\n } else {\r\n $rootScope.$broadcast(AUTH_EVENTS.loginFailed);\r\n error();\r\n } \r\n });\r\n };", "822" ], [ "I&#39;m using Mongoid on this project. Lets say I have a model like so:\r\n\r\n class Voice\r\n\r\n \t include Mongoid<IP_ADDRESS>Document\r\n include Mongoid<IP_ADDRESS>Timestamps\r\n include Mongoid<IP_ADDRESS>Enum\r\n include Mongoid<IP_ADDRESS>Paperclip\r\n\r\n enum :status, [:enabled, :disabled], :validate = > true, :default = > :enabled\r\n\r\n ...\r\n\r\n has_and_belongs_to_many \t\t\t\t\t\t :categories\r\n has_and_belongs_to_many :builder_types\r\n has_and_belongs_to_many :voice_types\r\n has_and_belongs_to_many :preferences\r\n has_and_belongs_to_many :languages\r\n embeds_many \t\t\t\t\t\t\t:comments\r\n embeds_many \t\t\t\t\t\t\t:ratings\r\n belongs_to \t\t\t\t\t\t\t\t\t\t\t:artist,\t\t\t\t\t\t:class_name = > \" ;User \" ;\r\n\r\n ...\r\n\r\n end\r\n\r\nAs you can see, `Voice` has and belongs to `Category`, `BuilderType`, `VoiceType` and so on. At the moment, if I want to search for all voices that belongs to a specific category I&#39;d do the following (pseudo code):\r\n\r\n @category = Category.find(id)\r\n @voices = @category.voices\r\n\r\nWhich works fine. How about search for `Voice` that has or belong to multiple relations and relations type .e.g. (pseudo code that doesn&#39;t work):\r\n\r\n @cat1 = Category.find(id)\r\n @cat2 = Category.find(id)\r\n @voice_type = VoiceType.find(id)\r\n @voices = @cat1.voices.where(category_id: @cat2.id).where(voice_type_id: @voice_type.id)\r\n\r\n\r\nBut that doesn&#39;t work. Any ideas if 1) that&#39;s at all possible and 2) how could I do it?", "547" ], [ "I&#39;m trying to do a ajax call using `$.get` like so:\r\n\r\n jQuery.get(&#39;_URL_1_;, function(result) {\r\n console.log(result);\r\n });\r\n\r\nPlease note the url is an empty string. Even though I&#39;ve purposely left it empty, when I check the request is being made to the current `url` that originates the request (where my js sits). \r\n\r\nFor clarity, let&#39;s say my js is within a page viewable on this address: `_URL_3_`, with the above code, even though I&#39;ve left the `url` string empty, on Firebug console I can see a request is being made to `_URL_3_`. Why is that? And most importantly, how I can get rid of this behaviour?\r\n\r\nPlease note that if I add anything to the url string like so:\r\n\r\n jQuery.get(&#39;myfile.php&#39;, function(result) {\r\n console.log(result);\r\n });\r\n\r\nThe request is made to `_URL_2_`, meaning that it appends to whatever I use on the url string.\r\n\r\nNote: For reasons beyond the scope of the question, the js in inline. Here&#39;s some of my code:\r\n\r\n MktoForms2.loadForm( \" ;_URL_0_ \" ;, \" ;98978782 \" ;, 1273, function (form) {\r\n\t\tvar data = modal.find(&#39;.downloadResource&#39;);\r\n\t\t...\r\n\t jQuery.ajax({url: \" ; \" ;, cache: false, success: function (result) {\r\n\t\t console.log(result);\r\n\t\t}});\r\n\t}});\r\n\r\nPlease ignore some of the pseudo code above. This code sits within a Drupal page. And it has to inline", "526" ], [ "I know this question has been asked before, but most answers I&#39;ve found are related to ActiveRecord or old (most cases, both) and I was wondering whether there&#39;s a new take on this.\r\n\r\nIs short, my Rails app is an API, so please keep this in mind (can&#39;t normally use lots of helpful little view related helpers).\r\n\r\nI&#39;ve been reading about this and found the [MoneyRails](_URL_0_) which seems quite neat. The problem I&#39;m having with it is that when I retrieve the data, it returns an object instead of the an usable value:\r\n\r\n class MyModel\r\n include Mongoid<IP_ADDRESS>Document\r\n ...\r\n field :price_GBP, type: Money\r\n ...\r\n end\r\n\r\nSo to create the document I send a number and it created the document fine. Now when I query the same document it returns an object for `price_GBP`, which is fine, but my main grip is that it return the value `fractional` as in `my_obj.price_GBP[:fractional]` as a string rather than a number.\r\n\r\nI&#39;d rather not have my client to have to do the conversion fro string to number than to decimal.\r\n\r\nI guess I could create a little helper that would convert the value in such circumstances like so (in my Model):\r\n\r\n def my_helper\r\n self.price_GBP = BigDecimal(self.price_GBP) # or something along those lines\r\n end\r\n\r\nThen in my controller:\r\n\r\n @my_model = Model.find(id)\r\n @my_model.price_GBP = @my_model.price_GBP = @my_model.my_helper\r\n render json: @my_model\r\n\r\nWith the above in mind, would this be the best approach? If yes, what&#39;s the point of using the MoneyRails gem then?\r\n\r\nSecondly, if not using the MoneyRails gem, should I use `BigDecimal` or `Float` as the field type?\r\n\r\nWhen I tried `BigDecimal`, the data was saved ok, but when I&#39;ve retrieve it, I got an string rather than a number. Is this the correct behaviour?\r\n\r\nWhen I tried `Float` it all worked fine, but I read somewhere that `Float` is not the most accurate.\r\n\r\nWhat are your thoughts?", "835" ], [ "I don&#39;t have any View (API only app) so the helpers don&#39;t work. I&#39;ve tried including `include ActionView<IP_ADDRESS>Base` in my model which didn&#39;t work. If I use `ActionController<IP_ADDRESS>Base.helpers.humanized_money` instead works, though not very elegant. Lastly, when I use jBuilder, all values (including numbers) are being sent as `String` which definitely I do not want. Is this the standard behaviour of jBuilder?", "343" ], [ "I&#39;m adding some authentication into my Rails API only app like so in my application_controller.rb:\r\n\r\n def is_admin\r\n authenticate_or_request_with_http_token do |token, options|\r\n if User.find_by(:auth_token = > token)\r\n value = true\r\n else \r\n value = false\r\n end\r\n end\r\n end\r\n\r\nAnd in my controller:\r\n\r\n admin = is_admin\r\n if admin\r\n @voices = Voice.all.map do |voice| \r\n voice.format\r\n end\r\n else\r\n @voices = &#39;Something else&#39;\r\n end\r\n\r\nWhen I&#39;m logged in, everything works fine as expected, however when I&#39;m not logged in, I get the following error: `Render and/or redirect were called multiple times in this action. Please note that you may only call render OR redirect, and at most once per action. Also note that neither redirect nor render terminate execution of the action, so if you want to exit an action after redirecting, you need to do something like \" ;redirect_to(...) and return \" ;.`\r\n\r\nWhile not logged in, I was expecting to get the &#39;Something else&#39; response, which I&#39;d then go ahead and deal with it accordingly.\r\n\r\nAny ideas why is this happening?", "384" ], [ "I&#39;ve changed the block inside `authenticate_or_request_with_http_token` and works fine as you suggested. The problem is that I can&#39;t find the first render call on `development.log`. Every time is called, it seems to origin from my Controller (the one I&#39;m working on) and it only happened if I use `authenticate_or_request_with_http_token`. Let&#39;s say I manually set the value of `admin = false` instead of `admin = is_admin` I don&#39;t get the error.", "384" ], [ "I wrote a little helper for my app in `app/helpers/currency_helper.rb`, but one method in it depends on `request`. It seem `request` is not available from within the Module. Here&#39;s my code:\r\n\r\n module CurrencyHelper\r\n\r\n\t\tdef define_currency\r\n\t\t\t...\r\n\t\t\tlocation = request.location\r\n\t\t\t...\t\r\n\t\tend\r\n\r\n\tend\r\n\r\nAnd I have included the above module in my Model and ApplicationController:\r\n\r\n include CurrencyHelper\r\n\r\nAll other methods within the module works fine as expected but whenever I execute `define_currency` I get the error: `undefined local variable or method &#39;request&#39; for # < Voice:0x007ff02d43bc30 > `\r\n\r\nHow can I make `request` available from my module? Alternatively, where else can I define this method that will be available both at Controller and Model level? \r\n\r\nPS: Note that I&#39;ve tried adding the method within `ApplicationController` which did work for `Controllers` but not on `Models`\r\n\r\n**EDIT**\r\n\r\nWhat I&#39;m trying to achieve is for the Model to be formatted based on the request location (pseudo-code, please note I&#39;m using the [Geocoder](_URL_0_) gem):\r\n\r\n class Model\r\n ...\r\n def localize\r\n ...\r\n if request.location == \" ;GB \" ;\r\n self.as_json(method: method_available_for_both_model_and_controller)\r\n else\r\n self.as_son(method: another_method)\r\n end\r\n ...\r\n end\r\n ...\r\n end", "835" ], [ "I have create a simple Nginx config file to server an Angular like so:\r\n\r\n server {\r\n listen 80;\r\n listen [<IP_ADDRESS>]:80;\r\n\r\n root /path/to/apps/myapp/current/dist;\r\n access_log /path/to/apps/myapp/current/log/nginx.access.log;\r\n error_log /path/to/apps/myapp/current/log/nginx.error.log info;\r\n\r\n index index.html;\r\n\r\n location ^~ /assets/ {\r\n gzip_static on;\r\n expires max;\r\n add_header Cache-Control public;\r\n }\r\n\r\n location / {\r\n try_files $uri $uri/ =404;\r\n }\r\n }\r\n\r\nAnd all works fine as expected. because I&#39;m using [Angular UI Router](_URL_4_), I&#39;d like to forward all pages to `index.html` so Angular will take over (so a request to `_URL_2_` will be redirect by Nginx to `index.html`, for Angular UI to handle it) for pages reloads, links, etc.\r\n\r\nHow can I achieve this?\r\n\r\nI&#39;ve playing around with options like:\r\n\r\n server {\r\n #implemented by default, change if you need different ip or port\r\n #listen *:80 | *:8000;\r\n server_name _URL_0_;\r\n return 301 $scheme://www._URL_0_$request_uri;\r\n }\r\n\r\nAs specified in [this](_URL_1_) answer. But I couldn&#39;t anything similar to work based on all requests.\r\n\r\nSuggestions will be much appreciated.", "222" ], [ "Consider the follow:\r\n\r\n @posts = Post.all\r\n render json: { success: true, data: @posts }\r\n\r\nNow, each `post` will have parameters that are not required to be sent in this particular scenario (although it&#39;ll be in others), so I&#39;d like to restrict the parameters sent and I thought maybe I could use `map` like so:\r\n\r\n @posts = Post.all.map { |user| [user.email, user.first_name, user.last_name] }\r\n render json: { success: true, data: @posts }\r\n\r\nAs you can imagine that doesn&#39;t work. Its very likely I&#39;m using - or intending to use - map in a completely incorrect way and I&#39;d appreciate your comments on how to achieve the above.\r\n\r\nThanks in advance!", "785" ], [ "Imagine the following Model:\r\n\r\n class Model\r\n ...\r\n field :things, type Hash\r\n ...\r\n end \r\n\r\nI would like then to be able to search for documents which has a specific attribute inside the `things` hash like so:\r\n\r\n model = Model.where(&#39;things.order_id&#39; = > 9689689)\r\n\r\nor\r\n\r\n model = Model.where(&#39;things.order_id&#39; = > 9689689).all\r\n\r\nBut that doesn&#39;t find the document(s) I&#39;m looking for. Neither does the following:\r\n\r\n model = Model.elem_match(inside: {order_id: 116152})\r\n\r\nnor this one:\r\n\r\n model = Model.where(:inside.elem_match = > {order_id: 116152})\r\n\r\nWhat am I missing here?\r\n\r\nPlease note this is not an embedded document, but simply a model which contains hashes (though would be nice to find a way to do similar searches in embedded models).\r\n\r\nAny ideas?", "1012" ], [ "I&#39;m trying to use curl to get data from a specific website and am getting a 404 as response. The curious thing is that i can visit the url just fine.\r\n\r\nI guess the problem lies elsewhere (likely with my malformed request to start with) and was wondering if someone could shed some light:\r\n\r\n ...\r\n curl_setopt($ch, CURLOPT_TIMEOUT, 30);\r\n\t\tcurl_setopt($ch, CURLOPT_USERAGENT, &#39;my own agent&#39;);\r\n\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);\r\n\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);\r\n\t\tcurl_setopt($ch, CURLOPT_URL, $url);\r\n\t\tif (! empty($data)) {\r\n\t\t\tcurl_setopt($ch, CURLOPT_POST, 1);\r\n\t\t\tcurl_setopt($ch, CURLOPT_POSTFIELDS, $data);\r\n\t\t}\r\n\t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\r\n\t\tcurl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);\r\n\t\tcurl_setopt($ch, CURLOPT_COOKIEJAR, &#39;c4l.cookie&#39;);\r\n\t\t$output[&#39;returned&#39;] = curl_exec($ch);\r\n\t\t$output[&#39;info&#39;] = curl_getinfo($ch);\r\n\r\n\t\treturn $output;\r\n\r\nPS: The above code was not written by me nor I&#39;m that good with PHP but I need to need to debug and find whatever is causing the error.\r\n\r\nAny help would be much appreciated.\r\n\r\n**EDIT:** \r\n\r\nThe url is: `_URL_0_`\r\n\r\n**EDIT2:**\r\n\r\nThe actual response is:\r\n\r\n < !DOCTYPE HTML PUBLIC \" ;-//IETF//DTD HTML 2.0//EN \" ; > \r\n < HTML > < HEAD > \r\n < TITLE > 404 Not Found < /TITLE > \r\n < /HEAD > < BODY > \r\n < H1 > Not Found < /H1 > \r\n The requested URL /something/else/here.also was not found on this server. < P > \r\n < HR > \r\n < ADDRESS > Oracle-Application-Server-10g/<IP_ADDRESS>.0 Oracle-HTTP-Server Server at _URL_1_ Port 61000 < /ADDRESS > \r\n < /BODY > < /HTML >", "833" ], [ "I&#39;m confused with something. I&#39;m trying to access a nested attribute in the params like so:\r\n\r\n var = params[&#39;filter&#39;][&#39;status&#39;]\r\n\r\nAnd I get the following error: `undefined method `[]&#39; for nil:NilClass`\r\nWhen I do the following:\r\n\r\n render json: params[&#39;filter&#39;]\r\n\r\nI get the following result: `{ \" ;status \" ;: \" ;complete \" ;}`\r\n\r\nHow can I access `params[&#39;filter&#39;][&#39;status&#39;]`?\r\n\r\nI&#39;ve tried: `var = params[&#39;filter&#39;][&#39;status&#39;]`, `params[:filter][:status]`\r\n\r\nAnd always get the same error.\r\n\r\nWhen I&#39;ve done `params[&#39;filter&#39;].class` I got `{}`\r\n\r\n**EDIT:**\r\n\r\nThis is the result of `puts params`:\r\n\r\n Parameters: { \" ;filter \" ;= > \" ;{\\ \" ;status\\ \" ;:\\ \" ;complete\\ \" ;} \" ;, \" ;paging.pageNumber \" ;= > \" ;1 \" ;, \" ;paging.pageSize \" ;= > \" ;10 \" ;, \" ;sorting \" ;= > \" ;{} \" ;, \" ;order \" ;= > {}}", "824" ], [ "I&#39;m using Money-Rails as field like so:\r\n\r\n class Product\r\n ...\r\n field :price_GBP, type: Money\r\n ...\r\n end\r\n\r\nAnd I&#39;m trying to get the average for all `price_GBP` documents. If the `price_GBP` field were a float or integer I would something like this:\r\n\r\n avg = Product.avg(:price_GBP)\r\n\r\nAnd that would provide me the average price for all products. I&#39;ve tried:\r\n\r\n avg = Product.avg( \" ;:price_GBP.cents \" ;) #or\r\n avg = Product.avg( \" ;price_GBP.fractional \" ;)\r\n\r\nBut neither works. Any ideas?\r\n\r\n**EDIT:**\r\n\r\nHere&#39;s the `price_GBP` attribute:\r\n\r\n price_GBP: {\r\n cents: 220,\r\n currency_iso: \" ;GBP \" ;\r\n },", "18" ], [ "I&#39;ve got this Angular App which is fuelled by a Rails API. As part of the setup I needed to add Stripe payments for debit/credit cards and PayPal for people who wanted to their PayPal account.\r\n\r\nStripe was a breeze to setup (thanks to a straight forward API and proper documentation) while PayPal is turning out to be the exact opposite.\r\n\r\nStarting with their documentation, it is very unclear what methods to use, but after a lot googling the best way forward seems to be sticking with Express Checkout (remember this is just for users who will pay using their PayPal accounts).\r\n\r\nIt seems I can&#39;t do a `SetExpressCheckout` call via the Angular App directly because I&#39;m getting a CORS error.\r\n\r\nSo, my question is: Is at all possible to initiate the process via the Angular App or do I need to do it through my Rails API?\r\n\r\nIf I have to do through the API, is there a tutorial out there anyone can recommend? I&#39;ve tried those: \r\n\r\n* _URL_1_, \r\n* _URL_3_, \r\n* _URL_3_, \r\n* _URL_2_, \r\n* _URL_0_\r\n\r\nWhenever I tried any of the above, I got stuck at one point or another. before pursuing any of the aforementioned approaches further, I&#39;d like to know whether I&#39;m on the right path, so I&#39;d REALLY appreciate if someone could pinpoint whether using the Express Checkout is the best approach and whether is definitely not possible initiate the process (get the token) through Angular. Lastly if there&#39;s recent and complete tutorial out there would also be extremely helpful.\r\n\r\nThanks in advance!", "75" ], [ "Imagine I have the following Models:\r\n\r\n class Voice\r\n include Mongoid<IP_ADDRESS>Document\r\n ...\r\n has_and_belongs_to_many :productions\r\n ...\r\n def define_user_currency\r\n ...\r\n end\r\n end\r\n\r\n class Production\r\n include Mongoid<IP_ADDRESS>Document\r\n ...\r\n has_and_belongs_to_many :voices\r\n ...\r\n def production_currency\r\n ...\r\n end\r\n end\r\n\r\nI&#39;d like to get all `Voices` including all productions and call the `define_user_currency` on each `Voice` as well as `production_currency ` on each Production. I&#39;ve tried the following (I&#39;ve added this method on `Voice`):\r\n\r\n def_custom_format\r\n self.as_json(\r\n method: self.define_user_currency(currency, ip),\r\n include: [:builder_types, :voice_types, :preferences, :languages, :productions = > {:methods = > production_currency(currency, ip)}],\r\n except: [:avatar_content_type, :avatar_file_size, :avatar_file_name, :avatar_fingerprint, :avatar_updated_at, :voice_content_type, :voice_file_size, :voice_fingerprint, \r\n :voice_updated_at, :artist_id, :price_per_word_GBP, :price_per_word_EUR, :price_per_word_USD, :price_GBP, :price_EUR, :price_USD, :categories_name, :category_ids, :production_ids, \r\n :language_ids, :preference_ids, :voice_type_ids, :builder_type_ids]\r\n )\r\n end\r\n \r\nBut `Production` is not coming within `Voice` and I get `Undefined method production_currency`. If I try `include: [:builder_types, :voice_types, :preferences, :languages, :productions = > {:methods = > self.production_currency(currency, ip)}],` I get the same result.\r\n\r\nHow can I apply the `production_method` on each production?", "835" ] ]
320
[ 12078, 7720, 18833, 14863, 7784, 19629, 7443, 2844, 11567, 18209, 10181, 7396, 15942, 12765, 16486, 16225, 12606, 19352, 5661, 6211, 2556, 4526, 13660, 8499, 6382, 4158, 6914, 7961, 15042, 19593, 19348, 947, 13002, 9884, 10668, 5637, 10193, 12176, 13877, 139, 13737, 7148, 2119, 15132, 10161, 43, 18810, 12466, 1423, 7271, 10275, 19254, 8242, 16468, 16546, 6400, 16736, 16509, 18612, 13863, 11072, 10424, 6356, 7057, 9338, 15748, 13190, 8043, 8883, 14211, 17510, 15066, 17842, 914, 1480, 12384, 11454, 10568, 14684, 15146, 8132, 18156, 2768, 9629, 3781, 639, 6444, 15453, 4137, 5900, 17150, 1310, 14294, 15305, 17432, 6140, 8461, 15345, 13336, 15471, 3604, 1877, 7048, 1108, 3013, 11449, 2164, 18606, 1664, 2197, 11281, 18000, 8259, 14057, 6658, 11036, 1050, 13808, 12082, 9247, 7661, 11002, 322, 11041, 16899, 2836, 3940, 11341, 16634, 7093, 982, 8941, 5868, 11735, 12534, 13427, 1487, 16386, 14042, 5617, 10474, 5924, 6614, 11661, 7304, 12693, 7805, 10198, 14508, 3304, 12717, 15046, 12639, 3958, 5256, 18672, 4725, 17327, 7678, 11163, 5430, 19085, 11263, 4223, 6888, 67, 6733, 1316, 18195, 7195, 13462, 1027, 11719, 5073, 7454, 16227, 13116, 2635, 6708, 19372, 15105, 14851, 14224, 5250, 15249, 6401, 1947, 11251, 14874, 1515, 17495, 12834, 12174, 19381, 2827, 12700, 14933, 1355, 3723, 10449, 7701, 11033, 13079, 15056, 4548, 19195, 9991, 9748, 4833, 8588, 5497, 7253, 9493, 10004, 7842, 14344, 3429, 9485, 11186, 1597, 1965, 16635, 13600, 7043, 3125, 9933, 1870, 9523, 4355, 1943, 17370, 1996, 17638, 3168, 11224, 4631, 2531, 17503, 12119, 2640, 5349, 3382, 7688, 12971, 11407, 10933, 19233, 13682, 13179, 11632, 17875, 5044, 7069, 8951, 19387, 6988, 9208, 14523, 19764, 15424, 9843, 12652, 14765, 17986, 12637, 4329, 4182, 521, 15943, 14216, 460, 2738, 1356, 15849, 10483, 13474, 7281, 3858, 19751, 9724, 5564, 6623, 12969, 272, 13471, 13922, 12913, 2460, 10975, 11151, 5270, 1184, 5302, 18549, 11571, 248, 6638, 980, 18348, 4577, 2325, 7715, 3638, 1209, 14295, 7856, 5495, 11346, 7644, 8260, 11086, 8763, 10417, 19074, 2094, 14169, 10243, 2206, 14982, 3147, 6983, 9570, 15014, 10625, 9078, 9270, 11786, 19522, 208, 17983, 15969, 3108, 5715, 6255, 16904, 18534, 10867, 17036, 3967, 6569, 13368, 674, 598, 13105, 6878, 2981, 4234, 9743, 11768, 1188, 10123, 8342, 16080, 10461, 12870, 16436, 11411, 4008, 17072, 12949, 6784, 2039, 7705, 10370, 13409, 9242, 18738, 14574, 17247, 2774, 10899, 1649, 5487, 8097, 7475, 7032, 17003, 12160, 7610, 6389, 17639, 19684, 10149, 11984, 4962, 11288, 7664, 232, 11518, 15876, 11660, 134, 8885, 1139, 3492, 18466, 10638, 4034, 18288, 8068, 2852, 9003, 13364, 19685, 5333, 4445, 7301, 19253, 16859, 2128, 1621, 15628, 9525, 11495, 19744, 10066, 5067, 6630, 18819, 14702, 14769, 1779, 10834, 16354, 2573, 6253, 9497, 5626, 2134, 9343, 9132, 17367, 7766, 13108, 17380, 8050, 19562, 6991, 17972, 17975, 12853, 8383, 10525, 11055, 6007, 19174, 392, 18858, 6904, 9065, 5199, 13645, 14524, 16630, 1408, 15580, 8751, 17338, 16424, 12536, 13287, 3722, 1237, 5965, 9266, 489, 17505, 16008, 9828, 7238, 12054, 6185, 13009, 10291, 15533, 16844, 10611, 3630, 15631, 17164, 11416, 8789, 14482, 14056, 2684, 12593, 3856, 6435, 12016, 9194, 8151, 5114, 12947, 8917, 8756, 17559, 18239, 4022, 2025 ]
STX_10007038.0
[ [ "So it seems like your new to StackOverflow and SQL. First, I&#39;ll try and answer your original question. \r\n\r\nMy interpretation is that you are asking if the second `LEFT JOIN` (which is also sometimes referred to as a `LEFT OUTER JOIN`) is a valid statement in SQL even though it does not contain either the `job.order_id` nor the `fiscal.cal_id`. \r\n\r\nThe answer to this question is **yes** the statement is a valid one and it will run. That does not mean it will necessarily return any records or that it is doing exactly what you want it to be doing. \r\n\r\nI apologize if that was not your intended question, but this brings me to my second point. \r\n\r\nYou should edit your original question to be more clear about what you want to know. If you did any research on your own before asking it, provide links to the sites you were looking through. Add the relevant columns on the tables in the `FROM` clause of your query. Lastly, think carefully about what specifically it is that you don&#39;t understand. Perhaps highlight those line(s) of code in your question. \r\n\r\nAll of this will help us to better answer your question.", "308" ], [ "You will have to join to `Persons` twice since you are looking for two different personid values.\r\n\r\n SELECT \r\n \t\tone.processid\r\n \t,\t_URL_0_\r\n \t,\t_URL_1_\r\n FROM table1 AS one \r\n INNER JOIN table2 AS two \r\n \tON one.item = two.item\r\n INNER JOIN persons as pone\r\n \tON pone.personid = one.personid\r\n INNER JOIN persons as ptwo \r\n \tON ptwo.personid = two.delegatepersonid\r\n\r\nI believe <PERSON> may work as well.", "720" ], [ "You will have to include all the components of the composite key on the `ORDER BY`\r\n\r\nSo the statements become. \r\n\r\n`SELECT * FROM t WHERE ? < id ORDER BY id DESC, letter DESC limit 1`\r\n\r\nand \r\n\r\n`SELECT * FROM t WHERE ? > id ORDER BY id ASC, letter ASC limit 1`\r\n\r\nNote that you will have to pay attention to which order you want the separate components to be in.", "142" ], [ "I am making a `subreport` in `MS Access 2007` for a `detail` table. \r\nI would like to create a `combo-box` on this `subreport` that pulls `t_item.item_id` & `t_item.description` from the `t_item` table. I then want it to pull the data from the chosen record into the `MS Access subreport` in order to populate `read-only` fields. These `read-only` fields will then be used to populate their corresponding fields on `t_detail`. Note that `t_item` is not the `master` table to this `detail` table. \r\n\r\nUsers will then be able to fill in the missing data that only exists on `t_detail` and create the new record.\r\n\r\nI have successfully created the `combo-box` and successfully populated it with `t_item.item_id` and `t_item.description`, but I have been unable to force any additional fields to pull in data from the same record. See below. \r\n\r\n[![Image of Form as Currently Exists][1]][1]\r\n\r\nIdeally, all of the information that already exists on `t_item` for this record should automatically populated the fields in this snippet. The only ones left blank for the users to enter will be `Net Weight` and `Package Count`since there is no way to know those values ahead of time. \r\n\r\nHere is the query that is pulling up that combo box:\r\n\r\n`SELECT t_item.[Item ID], t_item.[Description] FROM t_item;` \r\n\r\nI&#39;ve attempted to change the control source for the remaining fields, but nothing I have tried so far has successfully caused them to auto populate.\r\n\r\nA short list of my attempts:\r\n\r\n`=[t_item].[Item ID]`\r\n\r\n`=[t_item].[HACCP] -- or whatever is appropriate`\r\n\r\nMy research has led me to an Access DB `Macro` that uses the `SearchForRecord` action and this `where condition` \r\n\r\n`= \" ;[Customer ID] = \" ; & Str(Nz([Screen].[ActiveControl],0))`\r\n\r\nHowever, I have no idea exactly what this does or how to modify it to suit my purposes. Any guidance would be much appreciated. \r\n\r\n [1]: _URL_0_", "254" ], [ "This depends on how the reporting for your users works. I would tend towards the first option and add a `note` column or similar to the `institutions` table. You can then `insert` the `non-null` string from &#39;other&#39; and have the option to capture more info about each of the institutions a user has selected in the future. The reason for creating a separate field for the &#39;other&#39; is so that you will have a predictable field (probably something like `institutions.type`) to search on in the future.", "107" ], [ "Insert into `barcode` a left padded string using `ProducerCode` instead of an entered \" ;Barcode \" ;\r\n\r\nCode would look like \r\n\r\n INSERT INTO Product ( ProductCode , ProducerCode , BarCode ) \r\n VALUES (&#39;product1&#39; , &#39;1&#39; , LPAD(&#39;1&#39; , 13 , &#39;0&#39;))\r\n\r\nWould result in a unique `Barcode` for each `ProducerCode`\r\n\r\nEnd data would looks like this \r\n\r\n (&#39;product1&#39; , &#39;1&#39; , &#39;0000000000001&#39;);\r\n (&#39;product2&#39; , &#39;1&#39; , &#39;0000000000001&#39;);\r\n (&#39;product3&#39; , &#39;2&#39; , &#39;0000000000002&#39;);\r\n\r\nNote the repeated `Barcode` for the corresponding `ProducerCode` in lines 1 and 2", "670" ], [ "I&#39;m creating a `form` in `MS Access 2007`. The `form` is pulling from a single `parent table`. It also contains a `sub-form` that is pulling from a `query`. The `query` is itself pulling from the `child table` associated to the parent and a related `table` called `t_item`.\r\n\r\nI&#39;ve created a `lookup field` on the `child table` relating back to `t_item` in order to auto fill in fields on the `form`. This all works wonderfully. \r\n\r\nMy issues is this, the values that in the `query` that are pulled from `t_item` by my `lookup field` are not getting pulled in the `child table`. I&#39;m not really sure where I need to go to fix this issue. I keep looking for something that will allow me to control the `writing` of data for the `sub-form`, but nothing appears to be working. \r\n\r\nThis is the query \r\n\r\n \r\n\r\n SELECT \r\n \t\t[t_export_details].[Export ID]\r\n \t, \t[t_export_details].[ItemLookup]\r\n \t, \t[t_item].[Description]\r\n \t, \t[t_item].[HACCP]\r\n \t, \t[t_item].[Species]\r\n \t, \t[t_item].[Maturity]\r\n \t, \t[t_item].[Frozen / Shelf Storeable]\r\n \t, \t[t_item].[Package Type]\r\n \t, \t[t_export_details].[Package Count]\r\n \t, \t[t_export_details].[Net Weight]\r\n \t, \t[t_export_details].[Marks]\r\n \t, \t[t_export_details].[Establishment Number] \r\n FROM t_item INNER JOIN t_export_details ON t_item.[Item ID]\r\n\r\nHere is an example of the current results. The wanted outcome is for the fields being pulled from `t_item` in the query to be carried over onto the `child table`. This is a snippet of how the `child` currently looks after \" ;creating \" ; the record from the form.\r\n\r\n[![You can see that the fields being pulled from `t_item` are remaining blank][2]][2]\r\n\r\nSo after some comments, I&#39;ve altered the SQL Statement. This is how it looks now. \r\n\r\n SELECT \r\n t_export_details.[Export ID]\r\n , t_export_details.ItemLookup\r\n , t_item.Description\r\n , t_item.HACCP\r\n , t_item.Species\r\n , t_item.Maturity\r\n , t_item.[Frozen / Shelf Storeable]\r\n , t_item.[Package Type]\r\n , t_export_details.[Package Count]\r\n , t_export_details.[Net Weight]\r\n , t_export_details.Marks\r\n , t_export_details.[Establishment Number]\r\n FROM t_item INNER JOIN t_export_details \r\n ON (t_item.[Item ID] = t_export_details.ItemLookup) AND (t_item.[Item ID] = t_export_details.[Item ID]);\r\n\r\nBut this is still not writing across to the `child table` `t_export_details` \r\n\r\nHere is the query design view on Access 2007 \r\n\r\n[![enter image description here][1]][1]\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "280" ], [ "My best guess at the moment would be something along the lines of. \r\n\r\n USE [database_name]\r\n GO \r\n \r\n CREATE TABLE t_employee ( \r\n eid INT IDENTITY(1,1) \r\n , name NVARCHAR(50) );\r\n \r\n CREATE TABLE t_reports ( \r\n report_id INT IDENTITY (1,1) \r\n , eid INT );\r\n \r\n ALTER TABLE t_reports \r\n ADD FOREIGN KEY (eid) REFERENCES t_employee(eid);\r\n\r\nTo clarify, this is `SQL Server` syntax, but it should work on the common RMDBs except for `Oracle` which uses almost `SQL` syntax.", "1001" ], [ "Quick stored procedure to dynamically build your query string and execute it. You can control the execute with the first input `@in_run_query`.\r\n\r\n CREATE PROCEDURE dynamic_sql_query \r\n @in_run_query INT \r\n , @in_count_results_sets INT \r\n AS \r\n BEGIN \r\n \r\n IF @in_count_results_sets IS NULL \r\n EXIT \r\n \r\n IF TRY_CONVERT(INT,@in_count_results_sets) IS NULL \r\n EXIT \r\n\t \r\n\t IF @in_count_results_sets < 2 \r\n\t\tBEGIN \r\n\t\t\tSELECT &#39;Counter must be between 2 and 100&#39;\r\n\t\t\tEXIT \r\n\t\tEND\r\n \r\n\tIF @in_count_results_sets > 100 \r\n BEGIN \r\n\t\t\tSELECT &#39;Build a better database&#39;\r\n\t\t\tEXIT \r\n\t\tEND\t\t\r\n\t\r\n DECLARE @sql_string NVARCHAR(MAX) , @counter INT = 2 \r\n \r\n SET @select = &#39;SELECT _URL_0_, r1.sum1, r1.sum2&#39;\r\n SET @from = &#39;FROM result1 AS r1&#39;\r\n \t\r\n\tLOOP:\r\n\r\n\tSET @prefix = &#39;r&#39; + CAST(@counter AS String) \r\n\tSET @full_name = &#39;result&#39; + CAST(@counter AS String) \r\n\t-- select \r\n SET @select = @select + &#39;, &#39; + @prefix + &#39;.name, &#39; + @prefix + &#39;.sum1, &#39; + @prefix + &#39;.sum2&#39;\r\n -- from \r\n\tSET @from = @from + &#39; join &#39; + @full_name + &#39; AS &#39; + @prefix + &#39; on _URL_0_ = &#39; + @prefix + &#39;.name&#39;\r\n\t\r\n\tIF @counter = @in_count_results_sets\r\n\t GOTO AppendStrings \r\n\t\r\n @counter = @counter + 1 \r\n \r\n GOTO LOOP \t \r\n\t\t\r\n\t\t\r\n AppendStrings: \r\n\t\r\n\tSET @sql_string = @select + &#39; &#39; + @from + &#39;;&#39;\r\n\t\r\n\tIF @in_run_query < > 1\r\n\t\tBEGIN \r\n\t\t\tSELECT @sql_string \r\n\t\t\tEXIT \r\n\t\tEND\r\n EXECUTE sp_executesql @sql_string \r\n END", "290" ], [ "A bit of weird joins going on here. You should add this to a SQL fiddle so that we can see our work easier. \r\n\r\nA link to SQL fiddle: _URL_1_\r\n\r\nHere is my first attempt \r\n\r\n\r\n SELECT\r\n \t\t_URL_0_\r\n \t,\tpo.ordernumber\r\n \t,\tpo.lotsize \r\n \t,\tpo2.productionorder \r\n \t,\tSUM(h.completed) \r\n FROM productionorder as po \r\n INNER JOIN history as h \r\n \tON _URL_2_ = _URL_0_ \r\n INNER JOIN prodcuctionorder as po2 \r\n \tON po2.ordernumberid = h.ordernumberid \r\n WHERE _URL_0_ NOT EXISTS IN ( SELECT ordernumberid FROM history ) \r\n GROUP BY \r\n \t\t_URL_0_ \r\n \t,\tpo.ordernumber \r\n \t,\tpo.lotzise \r\n \t,\tpo2.productionorder \r\n\r\n\r\nHow far does that get you?", "308" ], [ "Throw the query results into a temporary table and re-query it like this. \r\n\r\nYou can do a basic `SELECT` query. \r\n\r\n SELECT name , code \r\n FROM [table] AS t1 \r\n INNER JOIN [table] AS t2 \r\n ON _URL_1_ = _URL_0_\r\n WHERE t1.code = &#39;111&#39; AND t2.code = &#39;333&#39;\r\n\r\nThis will get inefficient for larger data sets though. \r\n\r\nAnother method would be to use `ROW_NUMBER()` and a `sub-SELECT`.\r\n\r\n SELECT DISTINCT name FROM ( \r\n SELECT name , ROW_NUMBER () OVER (PARTITION BY name ORDER BY code) AS row_count\r\n FROM [table] AS t1 \r\n WHERE t1.code IN (&#39;333&#39; , &#39;111&#39;)\r\n GROUP BY _URL_1_, t1.code ) AS list\r\n WHERE list.row_count > 1", "374" ], [ "I&#39;m working on a project using `SQL Server 2012` and I am running into an issue while attempting to update a `login`. \r\n\r\nI was attempting to add DDL permissions to a `login` and when I went to hit `OK` and close the properties window, I received this error. \r\n\r\n[![SQL Server Error][1]][1]\r\n\r\nI closed the `login` properties window and reopened it to find that the `login`&#39;s database role changes had indeed been updated to reflect the changes I made. \r\n\r\nIt looked to me like my changes had been committed, and **then** this error popped up. \r\n\r\nI went to connect over an `ODBC` connection I had made earlier for the same login, but discovered I no longer could, I was getting this error from the `ODBC`.\r\n\r\n[![ODBC Error][2]][2] \r\n\r\n\r\nI know for a fact that this `ODBC` connection was working for this login at some point before my changes since I had a linked table that was using this same connection. It was able to both pull down updates from the `SQL Server` and push through changes back up to the server level. \r\n\r\nCan anyone help shed some light onto what a solution to these errors may be? I assumed they were related since they both began occurring this morning, but I&#39;m not positive of that fact. My database administrator is out of the office till tomorrow, so I&#39;d really like to get this resolved before then. \r\n\r\nThis is what I get when I try to use that logon through `SSMS` \r\n\r\n[![SSMS logon][3]][3]\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_0_\r\n [3]: _URL_1_", "548" ], [ "The either col_Id column on tbl_Datos or col_Leyenda in table tbl_Leyenda is declared as a data type NVARCHAR. There is probably data in that column with at least some non-numeric characters in it. \r\n\r\nWhen SQL tries to run your WHERE statment: `WHERE col_Id in (@Ids)`\r\n\r\nIt fails to convert the non-numeric data in col_Id to your list of data in @Ids that it is assuming are integers.\r\n\r\nYou can fix this by putting single quote marks around each Id in your list. It will look more like this: \r\n \r\n\r\n &#39;2844099&#39;,&#39;2844100&#39;,&#39;2844101&#39;,&#39;2844102&#39;,&#39;2844103&#39;,&#39;2844104&#39;,&#39;2844105&#39;,&#39;2844106&#39;,&#39;2844107&#39;,&#39;2844108&#39;,&#39;2844109&#39;,&#39;2844110&#39;,&#39;2844111&#39;,&#39;2844112&#39;,&#39;2844113&#39;,&#39;2844114&#39;,&#39;2844115&#39;,&#39;2844116&#39;,&#39;2844117&#39;,&#39;2844118&#39;\r\n\r\n\r\nIt could also be that the variable @p_Leyenda is being passed in as an integer value. You should attempt to force that to be a string as well. Similarly to your list of col_Ids above.", "38" ], [ "Something like this should give you what you want. \r\n \r\n\r\n SELECT \r\n Orders.EmployeeID AS EmployeeID,\r\n SUM([Order Details].Quantity) AS TotalQty\r\n FROM Orders \r\n INNER JOIN DimEmployee \r\n ON Orders.EmployeeID=DimEmployee.EmployeeID \r\n INNER JOIN [Order Details] \r\n ON [Order Details].OrderID=Orders.OrderID \r\n GROUP BY \r\n Orders.EmployeeID", "195" ], [ "Since <PERSON> appears to be offline right now I&#39;ll post my edit here as another answer. This should give you the order by that you want. \r\n\r\n select a.*,\r\n (select count(*)\r\n from views v\r\n where _URL_0_ = v.post_id\r\n ) as num_views\r\n from article a\r\n where a.created > = coalesce((select a2.created\r\n from article a2\r\n where a2.category = a.category\r\n order by a2.created desc\r\n limit 5, 1\r\n ), a.created\r\n )\r\n ORDER BY a.created DESC;", "837" ], [ "This should be a good starting point. Of course, I don&#39;t have your table names.\r\n\r\n\tDECLARE @total_matches INT \r\n\tDECLARE @non_matches INT \r\n\tDECLARE @region_or_zip_matches INT \r\n\t-- this will return a count of all matches \r\n\tSELECT @total_matches = COUNT(m.&#39;8&#39;)\r\n\tFROM Matches as m \r\n\t-- this will return a count of matches where there is no zip/region match \r\n\tSELECT @non_matches = COUNT(&#39;8&#39;) \r\n\tFROM Matches AS m \r\n\tINNER JOIN Clients AS c \r\n\t\tON c.client_id = m.client_id\r\n\tINNER JOIN Partners AS p \r\n\t\tON p.partner_id = m.partner_id\r\n\tWHERE \r\n\tAND c.geo_region IS NOT NULL --not null&#39;s may be unnecessary based on column criteria. \r\n\tAND p.geo_region IS NOT NULL \r\n\tAND c.geo_zip_code IS NOT NULL \r\n\tAND p.geo_zip_code IS NOT NULL \r\n\tAND (c.geo_region != p.geo_region\r\n\tAND c.geo_zip_code != p.geo_zip_code)\r\n\t\r\n\tSET @region_or_zip_matches = @total_matches - @non_matches\r\n\t\r\n\tSELECT (CAST(@region_or_zip_matches AS FLOAT) / CAST(@total_matches AS FLOAT) * 100;", "374" ], [ "If the table structure you provided is correct, then you do have a link between videos and people. You have village_id... \r\n\r\n SELECT _URL_1_ , _URL_0_ \r\n FROM people as p \r\n INNER JOIN video as vid \r\n \tON vid.village_id = p.village_id \r\n\r\nIF you don&#39;t want any repeated values, then you could do a `SELECT DISTINCT` like this \r\n\r\n SELECT DISTINCT _URL_1_ , _URL_0_ \r\n FROM people as p \r\n INNER JOIN video as vid \r\n \tON vid.village_id = p.village_id \r\n\r\nCould you provide more details on what exactly you are wanting?", "308" ], [ "Hey, without knowing your indexes, then it will be hard to see where this can be optimized. Since you are searching a Transaction History table, my guess is that it may not be indexed at all, and that is why you are having such low performance. This is especially true since you are essentially full table scanning it twice in this query. I have experience doing something similar to what you are doing. Adding an index to the table may be too costly in both time and memory. I would suggest adapting your query into a stored procedure and processing hist_tran in chunks using an id column.", "502" ], [ "Check that the name for your foreign key is unique for the database \r\n\r\n\r\n SELECT \r\n constraint_name,\r\n table_name\r\n FROM \r\n information_schema.table_constraints \r\n WHERE \r\n constraint_type = &#39;FOREIGN KEY&#39; \r\n AND table_schema = DATABASE()\r\n AND constraint_name = &#39;_config__entitycreateuser_fk&#39;\r\n\r\nThat&#39;s one of the most common fixes. \r\n\r\nOpen search version.\r\n\r\n SELECT \r\n constraint_name,\r\n table_name\r\n FROM \r\n information_schema.table_constraints \r\n WHERE \r\n constraint_type = &#39;FOREIGN KEY&#39; \r\n AND table_schema = DATABASE()\r\n ORDER BY constraint_name ASC \r\n\r\n\r\n\r\nIn response to your comment, I am editing my answer once again. \r\n\r\n\r\nDouble check that the tables in question, `_config` and `_usuarios` are not partitioned. InnoDB has limitations on `FK` constraints for partitioned tables. You should be able to read up on specifics in the manual. \r\n\r\nOn a more useful note, try to run this `SHOW ENGINE innodb STATUS` after attempting to add the `FK` constraint again. It will show you details of the error. \r\n\r\nMy guess now is that your issue is `...ON UPDATE SET NULL`. Since you would be trying to `SET NULL` on the `_usuarios.UsuarioId` column which appears to be an `IDENTITY` on your table. Being an `IDENTITY` automatically sets the column to `NOT NULLABLE`", "1001" ], [ "I suppose we can start here. Make sure to initialize your tables before you run this. I assumed that #TIMEGAPS has a weight column based on your output.\r\n\r\n\r\n\r\n DECLARE \r\n \t\t@Pack_id INT\r\n \t,\t@Weight_id INT\r\n \t,\t@mloop INT = 0 \r\n \r\n DECLARE @possible TABLE ( \r\n \t\tid \tINT IDENTITY (1,1) \r\n \t,\tpack_id \tINT \r\n \t,\tweight ) \r\n\r\n\r\n BEGIN_LABEL:\r\n \r\n SELECT TOP 1 @pack_id = PACK_ID \r\n FROM #TIMEGAPS AS g\r\n WHERE g.WEIGHT IS NULL \r\n ORDER BY PACK_ID ASC \r\n \r\n IF @pack_id IS NULL \r\n \tBEGIN \r\n \t\tPRINT &#39;Done&#39;\r\n \t\tEXIT \r\n \tEND\r\n \r\n INSERT INTO @possible (pack_id , weight ) \r\n SELECT PACK_ID , WEIGHT \r\n FROM #REALVALUES as r \r\n\tLEFT JOIN #TIMEGAPS as g \r\n\t\tON g.WEIGHT = r.PACK_ID \r\n\tWHERE g.WEIGHT IS NULL \r\n ORDER BY ABS(@pack_id - PACK_ID) ASC , WEIGHT DESC\r\n \r\n SELECT TOP 1 @Weight_id = weight \r\n FROM @possible \r\n ORDER BY id ASC \r\n \r\n IF (@Weight_id IS NULL)\r\n \tBEGIN \r\n \t\t\tRAISERROR(&#39;No Weights available&#39; , 18 , 1)\r\n \t\t\tEXIT \r\n \tEND\r\n\r\n UPDATE #TIMEGAPS \r\n SET WEIGHT = @Weight_id \r\n WHERE PACK_ID = @Pack_id \r\n \r\n SET @mloop = @mloop + 1 \r\n \r\n IF @mloop > 99 \r\n \tBEGIN \r\n \t\tPRINT &#39;Hit Safety&#39;\r\n \t\tEXIT \r\n \tEND\r\n \r\n SELECT @Pack_id = NULL , @Weight_id = NULL;\r\n\r\n DELETE @possible;\r\n\r\n GOTO BEGIN_LABEL \r\n\r\n SELECT g.PACK_ID , g.Local_Time , r.WEIGHT \r\n FROM #TIMEGAPS AS g\r\n INNER JOIN #REALVALUES AS r\r\n r.PACK_ID = g.WEIGHT;\r\n\r\nIm pretty sure RAISERROR() works in SQL 2008, but you can just replace them with print statements if they don&#39;t", "539" ], [ "First, two potential problems here. There are no input variables on your query, so we have to ask this first.\r\n\r\nDid you hardcode the parameter pass-in for the `WHERE` clause at the end of statement? \r\n\r\nDid you hardcode the parameter pass-in for the `SUM` statements in the sub-query? The ones that are splitting the month up into weeks. \r\n\r\nThese could both be the cause of the results not changing. \r\n\r\nOne for sure problem with this query is that you are going to be double counting the driving time for the days that signify the start/end of a week. \r\n\r\n ...SUM( case when TodayDate > = &#39;01-07-2018&#39; and TodayDate < = &#39;<PHONE_NUMBER>&#39; then PaidKM else 0 end) KM_W1,\r\n SUM( case when TodayDate > = &#39;<PHONE_NUMBER>&#39; and TodayDate < = &#39;14-07-2018&#39; then PaidKM else 0 end) KM_W2,...\r\n\r\nYou&#39;ll need to increment the days before the start of the next week\r\nI&#39;ve done so here by updating `<PHONE_NUMBER>` to `<PHONE_NUMBER>`", "956" ], [ "In the following query I am trying to get TotalQty to `SUM` across both the locations for item `6112040`, but so far I have been unable to make this happen. I do need to keep both lines for `6112040` separate in order to capture the different location. \r\n\r\nThis query feeds into a Jasper ireport using something called Java.Groovy. Despite this, none of the PDFs printed yet have been either stylish or stained brown. Perhaps someone could address that issue as well, but this `SUM` issue takes priority\r\n\r\nI know <PERSON> will get on in about an hour so maybe he can help. \r\n\r\n DECLARE @receipt INT \r\n SET @receipt = 20 \r\n \r\n SELECT\r\n \tent.WarehouseSku AS WarehouseSku,\r\n \tent.PalletId AS [ReceivedPallet],\r\n \tISNULL(inv.LocationName,&#39;&#39;) AS [ActualLoc],\r\n \tSUM(ISNULL(inv.Qty,0)) AS [LocationQty],\r\n \tSUM(ISNULL(inv.Qty,0)) AS [TotalQty],\r\n \tMAX(CAST(ent.ReceiptLineNumber AS INT)) AS [LineNumber],\r\n \tMAX(ent.WarehouseLotReference) AS [WarehouseLot],\r\n \tLEFT(SUM(ent.WeightExpected),7) AS [GrossWeight],\r\n \tLEFT(SUM(inv.[Weight]),7) AS [NetWeight]\r\n FROM WarehouseReceiptDetail AS det\r\n INNER JOIN WarehouseReceiptDetailEntry AS ent\r\n \tON det.ReceiptNumber = ent.ReceiptNumber\r\n \tAND det.FacilityName = ent.FacilityName\r\n \tAND det.WarehouseName = ent.WarehouseName\r\n \tAND det.ReceiptLineNumber = ent.ReceiptLineNumber\r\n LEFT OUTER JOIN Inventory AS inv\r\n \tON inv.WarehouseName = det.WarehouseName\r\n \tAND inv.FacilityName = det.FacilityName\r\n \tAND inv.WarehouseSku = det.WarehouseSku\r\n \tAND inv.CustomerLotReference = ent.CustomerLotReference\r\n \tAND inv.LotReferenceOne = det.ReceiptNumber\r\n \tAND ISNULL(ent.CaseId,&#39;&#39;) = ISNULL(inv.CaseId,&#39;&#39;)\r\n WHERE\r\n \tdet.WarehouseName = $Warehouse\r\n \tAND det.FacilityName = $Facility\r\n \tAND det.ReceiptNumber = @receipt\r\n GROUP BY\r\n \t\tent.PalletId\r\n \t,\tent.WarehouseSku\r\n \t,\tinv.LocationName\r\n \t,\tinv.Qty\r\n \t,\tinv.LotReferenceOne\r\n ORDER BY ent.WarehouseSku\r\n\r\n\r\n\r\n [![sample data][1]][1]\r\n [1]: _URL_0_\r\n\r\nThe lines I need partially coalesced are 4 and 5 in the above return.", "195" ], [ "You second statement is creating the temporary table `#Stats` without any preset column definitions. It instead creates the columns based on the return data type of the `SELECT`\r\n\r\nThis means that the SQL Server is not reading the output in question as a `DATETIME` but instead as a `STR`. \r\n\r\nI would try to use a `CONVERT` in your modified statement to see if you get different functionality. \r\n\r\nIt sounds like this question is mostly for your curiosity so I will add that the original statement is the standard way to accomplish what you&#39;ve outlined. \r\n\r\nThis is because `SELECT`... `INTO` statements are harder to read and revise for new users and because they can lead to some unexpected functionality as you have displayed above.", "338" ], [ "SELECT _URL_0_ , c.nombre , m.nombre , i.nombre \r\n FROM Clients AS c \r\n INNER JOIN <PERSON> AS m \r\n ON m.menuID = _URL_0_ \r\n INNER JOIN menuitem AS i \r\n ON i.catID = m.IDcat\r\n\r\nThis will return ALL menu items with their associated menus and clients. (Assuming they are associated) \r\n\r\nConsider renaming the columns in your table to make the references in your database easier. For instance the `FK` constraint on `menucat` that references `_URL_1_` should be on a column called `ClientID` or something similar. Not on one called `menuID` since it is relating to a client, not a menu. \r\n\r\nIt would also help if you gave us an example of what you want to return.", "720" ], [ "So if we can&#39;t change anything after the `FROM`, then we cannot get a perfect solution here. Since you are `SELECT`ing out the `NULL` values. One thing that we can try if we can only modify the final output is this. \r\n\r\n`SELECT MAX(ISNULL(scen.Date,0))...`\r\n\r\nThis will replace all the `NULL`s with 0, but it would help to know exactly what you are trying to do. Why are you so convinced that the query itself cannot be modified in any way?\r\n\r\nThe other solution would be to put the whole query in another wrapper. \r\n\r\nThat would look like: \r\n\r\n SELECT * \r\n FROM ( \r\n [your whole query here]\r\n ) AS inner\r\n WHERE inner.Date IS NOT NULL", "914" ], [ "So this is going to depend on a few other factors. \r\n\r\nIs this a new environment or one that has already been running for awhile? Altering db design on something currently being used is a headache. This is especially true if the `OrderItem` table is a critical part of the Inbound business processes. \r\n\r\nIf we are on a fresh db environment with no users or data to worry about, then I would say we are safe to make the change. However, we should also ask whether its a possibility that this &#39;historical data&#39; will ever become &#39;active data&#39; in the future. \r\n\r\nIf the this is an active db, then we need a good reason to go through the headache of altering table schema with data already associated to it. How often are we needing to hit `VatCodeID` (FK) in our current reporting processes? If the answer is &#39;not very often&#39;, then we can save ourselves a lot of time and a lot of money by leaving it as is.\r\n\r\nBut maybe we are using `OrderItem` quite often and it would be nice to have all our data on a flat table for a business reason. Then we should ask, can I get away with doing less and achieve a similar performance increase? \r\n\r\nSince we checked how often that `OrderItem` was being queried while being join to whatever `VatCodeId` is referencing, then we can look up those queries and to see if they can be optimized at all. This may involve adding an index to either `OrderItem` or the reference of `VatCodeId`, that would still be preferable to altering the table structure most of the time. \r\n\r\nKeep in mind that even after you&#39;ve `altered` the tables involved and migrated the data across, that you may then have to fix any `insert` statements where a developer got lazy and wasn&#39;t as explicit as they should have been. Additionally, if a record on `OrderItem` is associated to multiple records on the table `VatCodeId` is referencing, then we may also have to through and fix the `group by` statements that are pulling from `OrderItem`. \r\n\r\nYou will then likely need to touch up any third-party reporting software that references the tables you changed because that reporting software also often requires explicit call outs. \r\n\r\nBasically, the answer to your question is that no, we should probably leave that table as is unless we have a very good reason not. But, if we do think we have a **very** good reason, then the next step is to spend several hours researching everything else we would need to change in order to make this work.", "564" ], [ "In response to your clarification I have updated my answer. You will need to use some identifier for each person that remains the same across years/districts. I have called this person_id. If your identifying feature is spread across multiple columns, then this query will change slightly. \r\n\r\n SELECT DISTINCT t1.person_id , ... \r\n FROM database.table AS t1\r\n INNER JOIN database.table AS t2\r\n ON t2.person_id = t1.person_id\r\n WHERE \r\n (t1.year ==&#39;2015&#39; AND t1.district == 5) \r\n AND \r\n (t2.year ==&#39;2016&#39; AND t2.district ==6)\r\n\r\nA `DISTINCT` is needed to filter out duplicate rows. If you are performing `Aggregate` type functions, then you may also need a `GROUP BY` statement.", "374" ], [ "A quick and dirty generalized method. \r\n\r\nReplace `@User` with whomever you would like to remove. \r\n \r\n DECLARE @table TABLE ( \r\n \tID Int\r\n \t,[User] VARCHAR(2) \r\n \t,Form VARCHAR(3)\r\n \t,Depth INT \r\n ) \r\n \r\n DECLARE @User VARCHAR(2) = &#39;A&#39; \r\n \r\n INSERT INTO @table (ID , [User], Form, Depth)\r\n VALUES \r\n \t(1 , &#39;A&#39; , &#39;ABC&#39; , 2001),\r\n \t(1 , &#39;A&#39; , &#39;XYZ&#39; , 1001),\r\n \t(1 , &#39;B&#39; , &#39;XYZ&#39; , 1003),\r\n \t(1 , &#39;B&#39; , &#39;DEF&#39; , 3001),\r\n \t(1 , &#39;C&#39; , &#39;XYZ&#39; , 1000)\r\n \r\n SELECT _URL_2_, t1.[User], t1.Form, t1.Depth , ROW_NUMBER() OVER(ORDER BY _URL_2_, t1.[User], t1.Form, t1.Depth) AS [row_number] \r\n INTO #temp \r\n FROM @table as t1 \r\n INNER JOIN ( \r\n \tSELECT _URL_0_, t.Form, COUNT(&#39;8&#39;) as [count] \r\n \tFROM @table as t\r\n \tGROUP BY ID, Form \r\n \tHAVING COUNT(&#39;8&#39;) > 1 \r\n ) as duplicates\r\n ON _URL_1_ = _URL_2_ \r\n AND duplicates. Form = t1.Form \r\n ORDER BY ID, User, Form, Depth\r\n \r\n \r\n -- SELECT * FROM #temp \r\n \r\n SELECT [row_number] - 2 as value \r\n INTO #range \r\n FROM #temp as t\r\n WHERE t.[User] = @User\r\n \r\n \r\n --SELECT * FROM #range\r\n \r\n INSERT INTO #range \r\n SELECT [row_number] - 1 \r\n FROM #temp as t \r\n WHERE t.[User] = @User\r\n \r\n INSERT INTO #range \r\n SELECT [row_number] + 1 \r\n FROM #temp as t\r\n WHERE t.[User] = @User\r\n \r\n INSERT INTO #range \r\n SELECT [row_number] + 2\r\n FROM #temp as t \r\n WHERE t.[User] = @User\r\n \r\n SELECT * FROM #temp \r\n WHERE [row_number] IN (SELECT value FROM #range)\r\n \r\n \r\n DROP TABLE #temp \r\n DROP TABLE #range", "374" ], [ "If it does not matter which operator or drone you choose and there is data in both the `OperatorStore` and `DroneStore` tables, then you can execute this to assign a single drone to a single operator. \r\n\r\n INSERT INTO Operations (operatorId , droneId)\r\n SELECT TOP 1 _URL_0_ , _URL_1_ \r\n FROM OperatorStore AS OS \r\n CROSS JOIN \r\n DroneStore AS DS\r\n\r\nAlso nice question formatting. Keep up the good work!", "3" ], [ "This question may have already been asked, but I have been seeing it pop up numerous places here. \r\n\r\nLet&#39;s take a basic table: \r\n\r\n**[Table A]**\r\n\r\n id value attribute \r\n 1 4 yellow\r\n 2 6 green \r\n 3 5 blue \r\n\r\nI want to create a query that will find the `MAX()` of the field `value` in `[Table A]` and then return its associated attribute. In this case, that would be `green`. \r\n\r\nHere is how I would write this given what I currently know about `SQL`. \r\n\r\n SELECT id, value , attribute FROM [Table A]\r\n WHERE value IN (\r\n SELECT MAX(value) FROM [Table A] ) \r\n ORDER BY id \r\n\r\nThis is not optimal for larger tables since I have full scan `[Table A]` at least once, and because most designs will not have an index on the `value` column. \r\n\r\nThis question gets even more complicated when we attempt to add windowed functions into the mix. \r\n\r\nLet&#39;s make another table. \r\n\r\n**[Table B]**\r\n\r\n id value attribute id_group \r\n 1 4 yellow 1\r\n 2 4 yellow 1\r\n 3 5 blue 1 \r\n 4 9 green 2 \r\n 5 8 yellow 2 \r\n 6 7 yellow 2 \r\n 7 9 blue 3 \r\n 8 3 yellow 3\r\n 9 4 blue 3\r\n\r\nInstead of simply taking the `MAX()` value of the entire table, this time I want the `MAX()` over a grouping of `id` values. I&#39;ve gone ahead and already pre-assigned the `id` fields in `[Table B]` to the correct grouping in `id_group`\r\n\r\nNow I could do something similar to my query above for the windowed function. As I understand it, it would look something like this. \r\n\r\n SELECT id , value , attribute \r\n FROM [Table B] WHERE value IN ( \r\n SELECT MAX(value) OVER (PARTITION BY id_group)) \r\n\r\nHowever, this will not return the desired result. This is because we have lost information within the `WHERE` clause sub-select. We would need to return the `id_group` field *associated to the MAX(value) returned* from that sub-select as well. \r\n\r\nObviously, returning two fields from the same sub-select would break our `WHERE` clause syntax. \r\n\r\nSo my question is this. What is the best method for aggregating a field on a table and returning the information for fields on the same record?\r\n\r\nOf course there will be instances where the aggregate record, in this case MAX(), could actually be a record set and not a single record line. \r\n\r\nDoes anyone have extensive experience writing queries that will do this without the need for extraneous variables? \r\n\r\nTerribly sorry if this has already been asked and answered.", "374" ], [ "You&#39;ll need to assign the `id` values to their appropriate `group` and then use `rank()` in combination with `windowed functions` to create the output. \r\n\r\nTry this to get started. Replace `[your_table_name]` with whatever table you&#39;re pulling the data from in your post. \r\n\r\n DECLARE @table TABLE ( \r\n \ttime int\r\n \t,value int \r\n \t, group_id int \r\n \t) \r\n \t\r\n \t\r\n INSERT INTO @table ( time , value ) \r\n SELECT time , value \r\n FROM [your_table_name]\r\n \r\n UPDATE t\r\n SET group_id = CEILING(_URL_0_)\r\n FROM @table as t \r\n\r\n \t\r\n \r\n \t\r\n SELECT id , value , group_id\r\n FROM ( \r\n \t\t\tSELECT \r\n \t\t\t\t\tid\r\n \t\t\t\t,\tvalue \r\n \t\t\t\t,\tgroup_id\r\n \t\t\t\t,\trank() OVER (PARTITION BY group_id ORDER BY value DESC) AS r \r\n \t\t\tFROM @table ) As x \r\n \tWHERE x.r = 1;", "374" ], [ "You are getting this issue because of the `ON UPDATE CASCADE` is locking the `Foreign Keys` in your `child-table`. In this case, your `child-table` is `posts`. \r\n\r\nThe purpose of `ON UPDATE CASCADE` would be to update the `category_id` field in `posts` if it changed in `categories` (the `parent-table`). \r\n\r\nFor instance, changing `c_id` on the `categories` table form `1` to `001` would alter all the `category_id` fields on `posts` to match that change (assuming that the data types allowed for this change).\r\n\r\nIf this is the functionality you want to keep, then you need to perform your `update` statement on the `parent-table`, not the `child`.\r\n\r\nSo instead of updating `posts`, you need to perform this `update` on `categories` and then it will `cascade` down to `posts` for the relevant `category_id`s \r\n\r\n\r\n\r\n----------\r\n\r\n\r\n\r\nAhh, so looking at your use of `CASCADE`, I don&#39;t think what you want can happen in the current design. You will be unable to `update` the `category_id` of `posts` due to the `on update cascade`, and if you attempt to `update` table `categories` setting `c_id = 100 where c_id = 2` and then deleting `c_id = 100`, you will delete all the `posts` with `category_id = 100` as well. \r\n\r\nI would recommend removing that `on update cascade` constraint from your table if you want to keep the `posts` from `deleted` categories. \r\n\r\nAdditionally, using the `category_id` column as an indication of belonging to a `deleted` category is bad practice. What if you wanted to know what a post&#39;s former category was? \r\n\r\nIt is also generally bad to alter `id` columns in this way because it means that they cannot be indexed as easily. Consider changing the database design to move `deleted` categories to some sort of history table. You can then search records on `posts` as normal and simply included the `deleted` categories as you need to.", "154" ], [ "You could move the `posts` to a different table, but that may be unnecessary. Instead, I would move the deleted `category_id`s to a different table. Then you can leave the records on `posts` as they are. To know whether a post&#39;s category is deleted, you simply check to see if that `category_id` is in the new `deleted_categories` table. Since doing this would change the database design, you may have to update your old queries searching the `posts` table. You could also add a field to the `categories` table like `is_deleted` 1=yes, 0=no and then key off of that. Anything that preserves the id.", "564" ], [ "This is not the correct way to implement `SQL` functionality. \r\n\r\nInstead you will want to create a third table that establishes a relationship between users and their completed quizzes. It will look something like this. \r\n\r\n CREATE TABLE users_completed_quizzes ( \r\n -- completion_id INT IDENTITY \r\n , user_id INT \r\n , quiz_id INT\r\n , score FLOAT\r\n , notes NVARCHAR(255)\r\n -- , PRIMARY KEY (user_id , quiz_id) -- PK One\r\n -- , PRIMARY KEY (relationship_id) -- PK Two \r\n , FOREIGN KEY (quiz_id) REFERENCES Quizzes(id)\r\n , FOREIGN KEY (user_id) REFERENCES Users(id) \r\n ) \r\n\r\nFor each quiz a user completes, you `insert` a record into this table that contains the user&#39;s `user_id` and the quiz&#39;s `quiz_id`. I&#39;ve added some other fields as well so that you can keep track of additional data like their score or any relevant notes on how that quiz went. \r\n\r\nYou will see some lines are greyed out. These relate to the primary key of your table. This is the `field` that will uniquely identify the records on the table. \r\n\r\n**Determine which primary key you would like to use.**\r\n\r\nThe first one is a composite of the Foreign Keys. This is fairly standard and is easy to think through, but can be harder to use. It will also be more difficult to implement the same users taking the same quiz multiple times with this method. \r\n\r\nThe second one is a unique identity column. This is an autoincrement number that will track each insertion of a new record. It is easier to use, but may be harder to follow logically for new users. It is easier to implement quiz history with this method. \r\n\r\nIf you choose to use the second primary key, the you must un-comment the top line to add that field to the table. \r\n\r\nIf you choose to use the first primary key, then you will need to remove the comma before `user_id` in order to keep proper syntax. \r\n\r\nDo not use both Primary Keys (PKs). SQL will get mad at you if you attempt to do so. \r\n\r\nComments are signified by `--`. \r\n\r\n\r\n----------\r\n\r\nSome examples on what queries would look like for the Primary Key One. \r\n\r\n\r\n -- returns all the quizzes a single user has completed. \r\n SELECT quiz_id FROM users_completed_quizzes WHERE user_id = &#39;1&#39;\r\n \r\n -- returns all quizzes that have not been completed by a any user. \r\n SELECT id FROM Quizzes \r\n LEFT OUTER JOIN users_completed_quizzes \r\n ON _URL_0_ = users_completed_quizzes.quiz_id \r\n WHERE quiz_id = NULL;\r\n\r\n -- returns all quizzes that have been completed by at least one user. \r\n SELECT id FROM Quizzes \r\n WHERE id EXISTS (SELECT quiz_id FROM users_completed_quizzes)\r\n\r\n -- returns user and quiz info using the association table. \r\n SELECT quiz_id, user_id , Users.region , Quizzes.category\r\n FROM users_completed_quizzes\r\n INNER JOIN Users ON \r\n _URL_1_ = users_completed_quizzes.user_id\r\n INNER JOIN Quizzes ON \r\n _URL_0_ = users_completed_quizzes.quiz_id \r\n \r\n\r\n\r\n----------\r\n\r\n\r\nOnce a user has completed a quiz, you will need a `sql` statement to be executed that looks like this. \r\n\r\n INSERT INTO users_completed_quizzes (user_id , quiz_id) -- you can add more fields here if you wish. \r\n VALUES ( {User&#39;s Id from _URL_1_} , {Quiz&#39;s Id from _URL_0_} )", "480" ], [ "No, I believe you are correct. That is the correct `constraint`. Remove it an you will be able to implement your original intention. However, if you do so, then you will lose the ability to recover a `posts` old `category_id`. Think carefully whether there is any situation where you would need that information again. If you do need to keep that information, then follow one of my previous suggestions to retain it in your database model, `or` ask your database administrator/ solution architect if they have any ideas.", "721" ], [ "Take care with what happens when a user attempts to re-take the same quiz when using the Primary Key One method. You will get an error when the `insert` statement I provided is run when a `user` and `quiz` are already associated on the `users_completed_quizzes` table. This is because `SQL` will see this as a `duplicate key`. This may actually be a good thing if you want to totally prevent retakes. Of course it is still possible to change the data model to allow for quiz re-takes in the future if you find it is necessary.", "480" ], [ "This the start. It will pull out all the fee increases from 2019 to 2022. It does assume that any record that satisfies `Increase = &#39;Yes&#39;` will increase in each year of the stated range. \r\n\r\n SELECT \r\n INTO #temp \r\n \t\tID \r\n \t,\tName\r\n \t,\tStartdate \r\n \t,\tFee As [BaseFee]\r\n \t,\tto_char(IncreaseDate, &#39;mon-dd&#39;) as [IncreaseDate]\r\n \t, \tFee * (1.07) AS [Fee2018] \r\n \t,\tFee * POWER(1.07,2) AS [Fee2019] \r\n \t, \tFee * POWER(1.07,3) AS [Fee2020] \r\n \t,\tFee * POWER(1.07,4) AS [Fee2021]\r\n \t,\tFee * POWER(1.07,5) AS [Fee2022]\r\n FROM {table_name} AS t \r\n WHERE t.Increase = &#39;Yes&#39;;\r\n \r\n \r\n SELECT \r\n \t\tID \r\n \t,\tName \r\n \t,\tStartdate \r\n \t,\tCAST(BaseFee AS VARCHAR) + &#39;, &#39; + CAST([Fee2018] AS VARCHAR) + &#39; from &#39; + CAST(IncreaseDate AS VARCHAR) AS [2018]\r\n \t,\tCAST([Fee2018] AS VARCHAR) + &#39;, &#39; + CAST([Fee2019] AS VARCHAR) + &#39; from &#39; + CAST(DATEADD(year, 1, IncreaseDate) AS VARCHAR) AS [2019]\r\n \t,\tCAST([Fee2019] AS VARCHAR) + &#39;, &#39; + CAST([Fee2020] AS VARCHAR) + &#39; from &#39; + CAST(DATEADD(year, 2, IncreaseDate) AS VARCHAR) AS [2020]\r\n \t,\tCAST([Fee2020] AS VARCHAR) + &#39;, &#39; + CAST([Fee2021] AS VARCHAR) + &#39; from &#39; + CAST(DATEADD(year, 3, IncreaseDate) AS VARCHAR) AS [2021]\r\n \t,\tCAST([Fee2021] AS VARCHAR) + &#39;, &#39; + CAST([Fee2022] AS VARCHAR) + &#39; from &#39; + CAST(DATEADD(year, 4, IncreaseDate) AS VARCHAR) AS [2022]\r\n FROM #temp;\r\n Drop #temp;\r\n\r\nAdditional logic would be needed to check the `[IncreaseDate]` and then adjust the yearly output accordingly. \r\n\r\nWill all the records have fee increases in 2018?", "733" ], [ "I am having an issue with an `MS Access 2007` `report`. The print margins for my `report` are not staying consistent. \r\n\r\nWhen I open the report in print preview, I can set the margins as I wish. However, once I go to print the report, the `bottom margin` is set to a value that I did not enter. \r\n\r\nThis does not occur when I select a different printer from the drop-down menu. The printer causing this error is a `Cannon MG2900`. It cannot be switched out for a different printer.\r\n\r\nThe margin being altered is a problem for me because it causes my single-page report to split and print out onto two pages. It does this despite the print preview showing me that the report is a single page.\r\n\r\nThe printing is not handled through VBA. The print preview is brought up using VBA code, but the users have to use the `Print` button provided by `MS Access` to actually print the report. \r\n\r\nI am using the report to print over another sheet. So it has to print out on one sheet of paper, and have a small enough margin to reach the bottom of the page. \r\n\r\n\r\nPictures are provided to show what I am talking about. \r\n\r\nDoes anyone have any ideas?\r\n\r\n[![Print Window After Printing][1]][1]\r\n\r\nNotice the bottom margin in this photo is set to `0.3`\r\n\r\n[![Print Margins Window Before Printing][3]][3]\r\n\r\nNotice that the bottom margin has been set to `0.66`.\r\n[![Print Margins Window Before Printing][2]][2]\r\n\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_2_\r\n [3]: _URL_0_", "214" ], [ "Ahh, so let me check if I am understanding you. I&#39;m going to call the `MG 2900 printer` `Final` since it is what I want to ultimately print on. I&#39;ll call the other one `Default`. So I currently open a `print window` that assumes `Default`&#39;s settings. I alter those settings with no issues since `Default`&#39;s setting don&#39;t preclude the margins I need. Then I switch the printer over to `Final` and my settings get over written by `Final`&#39;s settings. Then the document prints before I can alter those. Changing the process to `VBA` would presumable allow me to edit the margins before printing correct?", "214" ], [ "I think I understand. Here is my remaining concern, and it was not well illustrated in my above question so I apologize for that. When the printer called `Final` has been specified in the report settings to be THE printer that the report will print on, the printer margins window shows up as it does in my final picture (with the `.66` in the bottom margin box). When I attempt to update this value, it is automatically reset to `.66` if I choose a lower value. It does this without me printing or even closing the window. If I exit that box, it will get reset back to `.66`. It may remain an issue.", "214" ], [ "This can be done on `SQL Server` through the use of an `Instead of Update` `Trigger` and a control value to set the `Max_Num`. However, this is generally not advisable to do on the back end database. Does your project involve some kind of web form or other application to enter booking data into? Generally it would be easier to implement what you are suggesting on the software that users are using to enter data.", "3" ], [ "You have a query call returning more than one value. \r\n\r\nIt is this one here. It is at the top of the `ELSE` statement that contains your &#39;problem line&#39; from your original question. \r\n\r\n SET max_percentage = (SELECT percentage FROM options_percentage WHERE percentage = (SELECT MAX(percentage) FROM options_percentage));\r\n\r\nExplanation below\r\n\r\n`SELECT MAX(percentage) FROM options_percentage`\r\n\r\nThis is good, it will only return a single value. \r\n\r\n`SELECT percentage FROM options_percentage WHERE percentage = {scalar}`\r\n\r\nThis is not always valid. What happens when multiple `percentage` matches occur?\r\n\r\nYou can use a `TOP` in `SQL Server` to limit your results. Other RMDBs have similar functions that you can lookup. I believe the `MySQL` equivalent is `LIMIT` and it goes at the end of the `SELECT Statement`. Hope that helps. \r\n\r\nIn response to your question update 8/31 \r\n\r\nThis is what you currently have\r\n`(SELECT MAX(percentage) FROM options_percentage LIMIT 1))`\r\n\r\nIt needs to become this \r\n`(SELECT MAX(percentage) FROM options_percentage )LIMIT 1)`\r\n\r\nCurrently, you&#39;re `LIMIT`ing the &#39;good&#39; query, not the one that has the issue. \r\n\r\nSo the full line with the change noted above would be this: \r\n\r\n SET max_percentage = (SELECT percentage FROM options_percentage WHERE percentage = (SELECT MAX(percentage) FROM options_percentage) LIMIT 1);", "38" ], [ "You cant set a field in `B` by running an `UPDATE` on `A`. You&#39;ll need two `update` statements. \r\n\r\nTry this. \r\n\r\n UPDATE B \r\n SET B.PONumber = &#39;&#39;, B.ReceivingID = B.ReceivingID + &#39;-EBI&#39; \r\n FROM ComponentInventory AS B\r\n INNER JOIN CompStagingReturnByPO AS A\r\n ON A.ReceivingID = B.ReceivingID\r\n WHERE A.Component=&#39;bulk&#39;;\r\n\r\nI spoke to hastily when I stated that you would need two `update` statements. Since you are only changing fields in `B`, you can get away with a single `UPDATE`.", "154" ], [ "I am trying to implement a `GUI` through an `Access 2007` `Form` for users to enter data through. \r\n\r\nI am using a `continuous` style form in `Access` because the users are entering data line-by-line as they appear on a shipping invoice. \r\n\r\nThrough repeated discussions with multiple end-users and managers, it has become apparent that users will need the ability to `insert` a new record into these itemized lists if they realize that they have mistakenly skipped a line. \r\n\r\nThis means that I need to have some mechanism to manipulate the record order on-the-fly in a continuous form in `Access`. So far, I have been unable to find answers on how to do this. \r\n\r\nDoes anyone have any suggestions? \r\n\r\n**Important Details:** \r\n\r\n - The lists are composed of `child` records and are each assigned a\r\n `detail_id`. \r\n \r\n - The `parent` record contains a `master_id` which is associated to the\r\n `child` records. \r\n \r\n - The current `order by` is `detail_id ASC`.\r\n\r\n \r\nIt would be best to not have users type the row_order they wish the final information to be entered in. I would like `Access` to either key off a separate sequence field or use an additional field in the `order by` to accomplish this.", "461" ], [ "Yes, but the item number on the invoice doesn&#39;t appear on the report. Instead, the item description is used (which is apparently unique enough). Mhm I know that I will need an additional field to determine the record sequence. My hope was to allow users to push a button once and I could manipulate everything on the back-end. That would be preferable to having them enter a sequence order for the entire report, since they are likely to make an error.", "858" ], [ "I am creating a `Jaspersoft` `iReport` for a logistics company. \r\n\r\nMy report structure is like this. \r\n\r\n ...\r\n Sku Group \r\n Pallet Group \r\n Details \r\n Pallet Group Footer \r\n Sku Group Footer \r\n ...\r\n\r\nSo the final report looks like this: \r\n\r\n` ^^^^^^^^^^^^^^^^^^ qty ^^^^^ weight`\r\n\r\n`Item Code A 127 600`\r\n\r\n` ^^ Pallet A1 80 450`\r\n\r\n` ^^ Pallet A2 80 450`\r\n\r\n`Item Code B 200 530`\r\n\r\n`etc. etc. `\r\n\r\n\r\n#Issue##\r\n\r\nThe true value for `qty` of `Pallet A1` should be 47 and its `weight` should be 150. \r\n\r\nHowever, my variable has instead put in the `qty` and `weight` information fro `Pallet A2` for both of my pallets holding `Item A`\r\n\r\nThe variable is setup as follows \r\n\r\n < variable name= \" ;PalletQty \" ; class= \" ;java.lang.Integer \" ; resetType= \" ;Group \" ; resetGroup= \" ;Pallet \" ; calculation= \" ;Sum \" ; > \r\n \t\t < variableExpression > < ![CDATA[$F{QtyReceived}]] > < /variableExpression > \r\n \t\t < initialValueExpression > < ![CDATA[0]] > < /initialValueExpression > \r\n \t < /variable > \r\n \t < variable name= \" ;PalletWeight \" ; class= \" ;java.math.BigDecimal \" ; resetType= \" ;Group \" ; resetGroup= \" ;Pallet \" ; calculation= \" ;Sum \" ; > \r\n \t\t < variableExpression > < ![CDATA[$F{WeightReceived}]] > < /variableExpression > \r\n \t < /variable > \r\n\r\nCan someone help me find the reason it is not evaluating properly?\r\n\r\nI am using a variable to `Sum` for the Pallet Qty because some of the Pallets contain cases on them, and I need to `Sum` the individual case quantities in order to `output` the pallet `qty`.", "821" ], [ "I would attempt to do this using CTEs. \r\n\r\n WITH \r\n Qrtr(Q) AS (\r\n SELECT 1 \r\n UNION ALL\r\n SELECT Q + 1 FROM Qrtr\r\n WHERE Q < 4\r\n ),\r\n Yr(Y) AS (\r\n SELECT 2018 \r\n UNION ALL\r\n SELECT Y - 1 FROM Yr\r\n WHERE Y > 2018 - 5\r\n ),\r\n Cls(C) AS (\r\n SELECT &#39;CRAFT&#39; \r\n UNION \r\n SELECT &#39;DANCE&#39; \r\n )\r\n SELECT CTE.C , CTE.Y , CTE.Q , DB.[Num] \r\n FROM ( \r\n SELECT C , Y , Q FROM Cls AS C, Yr AS Y, Qrtr AS Q ) AS CTE \r\n LEFT OUTER JOIN \r\n ( SELECT R.PRODUCTCLASS , R.YEAR , R.QUARTER , COUNT(ISNULL(P.CUSTOMERCODE,0) AS [Num] FROM PRODUCTPOSTINGS AS R\r\n INNER JOIN POSTINGS AS P ON P.PRODID = R.PRODID ) AS DB \r\n ON DB.YEAR = CTE.Y AND DB.QUARTER = CTE.Q AND DB.PRODUCTCLASS = CTE.C\r\n GROUP BY CTE.C, CTE.Y, CTE.Q \r\n ORDER BY C, Y DESC, Q ASC;", "720" ], [ "You can accomplish this with a `UNION ALL`. \r\n\r\n SELECT column_A , column_B , ... {your query}\r\n \r\n UNION ALL \r\n \r\n SELECT &#39;&#39; as Column_A , SUM(column_B) as column_B,... {your totals query}\r\n\r\n`column_B` in this case can be whichever numerical column that you want totals for. `column_A` is a non-numerical column or any column you do not want a total for. Note that all columns `selected` in `{your totals query}` should be `aggregated` or `NULL` if you want this to return only a single row. \r\n\r\nYou will also need to include the same number of columns in both queries for the `UNION` method to work properly.\r\n\r\nIf you include your `RMDB`, then we can tailor a more specific solution. `UNION ALL` is the syntax for `SQL-Server`.\r\n\r\n-- so in response to your comment 9/6, it sounds like you can run an `offset` `fetch` command. \r\n\r\n SELECT {your query} OFFSET 1 \r\n UNION ALL \r\n SELECT {your query} OFFSET 0 FETCH NEXT 1 ROW ONLY \r\n\r\nKeep the `ORDER BY` the same for both queries or you will get unexpected results.", "195" ], [ "You have `DECLARE @yearly Datetime`. \r\n\r\nYou attempt to set it in `SELECT ... @yearly = Out.Datetime FROM Out`, but then you have this `WHERE` statement: `YEAR(@yearly) = @year`\r\n\r\nThis returns nothing since `@yearly` is `NULL` when called by `YEAR()`\r\n\r\nThis makes the statement equivalent to `WHERE NULL = 2018` \r\n\r\nWhich will never be true. \r\n\r\nTo fix this, you need to set yearly before calling it in your `WHERE` clause or use something else there. \r\n\r\nIt looks like you want to use `YEAR(Dbo.Out.Datetime)` instead there\r\n\r\n\r\n----------\r\n\r\n\r\nSince it looks like you&#39;re new to `SQL` I will add some extra explanation. This is an oversimplification.\r\n\r\nMost programming languages run top to bottom. Executing the line1 first, line2 second, line3 third, and so on. `SQL` does not do this. \r\n\r\nThe command `SELECT Name FROM Employee WHERE EmpID = 1` Runs in the following order. \r\n\r\n First - FROM Employee -- > Load the Employee table \r\n Second - WHERE EmpID = 1 -- > Scan Employee for the records where EmpID = 1\r\n Third - SELECT Name -- > Display the `Name` field of the records I found.\r\n\r\nYour command looks like this to the `SQL` `compiler` \r\n\r\n First - FROM dbo.Out -- > Load Out table \r\n Second - WHERE YEAR(@yearly) = @year -- > Scan for records that meet this req.\r\n Third - SELECT ... @yearly = dbo.Out.Datetime -- > Set @yearly to the [Datetime] field associated to the record(s) I found.\r\n\r\n\r\nNote that if your statement had returned multiple records, then `SQL` would have tried to set your `1-dimensional` variable to an array of values. It would fail and give you something like \r\n\r\n > Too many records returned. Have me only return 1 record.", "338" ], [ "Everyone is down voting this question so I&#39;m going to write a brief explanation. This new user is likely using a version of `MS-Access` to write their `VBA` code. On older versions of `Access`, if there is an error in the `VBA` code the debugger only takes you to that line and states either &#39;Error&#39; or &#39;Syntax Error&#39;; nothing else. We should encourage good question asking to maintain the integrity of this site, but keep in mind that this is quite literally all the information this user had to go on before asking us here. This error is also not easily fixed if you don&#39;t know what syntax means.", "56" ], [ "Since `Departments` must have exactly one `manager` only, then you can add a field to `Departments` that will hold the `Employee.EmployeeID` of the manager. It appears that you have already done this part. \r\n\r\nThat field should be a foreign key `1:1` relationship with the `Employee` table. You can then also add the fields `manager_start_date` and `manager_end_date` to the `Department` table to track the `manager`&#39;s employment range. \r\n\r\nNote that an employee&#39;s start and end dates may not necessarily be their managerial start and end dates. Presumably someone could have started in `March` and then become a manager in `July`. \r\n\r\nIdeally, the `PK` on `Department` would be `BranchID, Name`. Using `DepartmentID`is okay, but unnecessary with the requirements you&#39;ve outlined in your question. \r\n\r\nIt is unclear to me from your snippet what exactly the relationship between `Department` and `Employee` currently is. There should be a `FK` reference to `Employee.employee_id` that would be made on `Department.manager_employee_id` and this would be a one-to-one relationship.", "107" ], [ "For prosperity, you can also load these onto global temporary tables. \r\n\r\nThe advantage of of using a global temp table over a `CTE` or traditional temp table is that the global table can be initialized in a stored procedure and then referenced in another stored procedure nested within the outer one. \r\n\r\nIt also lets you use super fast and loose `SELECT ... INTO` syntax without needing to define a table ahead of time. \r\n\r\n SELECT * \r\n INTO #Global_Temp \r\n FROM (\r\n SELECT LOADDATE, LOADNUM, 1 AS LOADROLE, LOADDRIV AS EMPID, RATEDRIV AS RATE FROM CERTODB.LOADS WHERE LOADDRIV > 0\r\n UNION SELECT LOADDATE, LOADNUM, 2 AS LOADROLE, LOADHLP1 AS EMPID, RATEHLP1 AS RATE FROM CERTODB.LOADS WHERE RATEHLP1 > 0\r\n UNION SELECT LOADDATE, LOADNUM, 3 AS LOADROLE, LOADHLP2 AS EMPID, RATEHLP2 AS RATE FROM CERTODB.LOADS WHERE RATEHLP2 > 0\r\n );\r\n \r\n SELECT ORDDATE, ORDNUM, ORDACCT, ORDLOAD, TYPECODE AS LOADTYPE, EMPID, RATE\r\n \r\n FROM CERTODB.ORDERS AS ORDERS\r\n \r\n -- THE SUBQUERY BELOW IS THE FIRST DUPLICATION\r\n INNER JOIN ( \t\t\t\t\tSELECT LOADDATE, LOADROLE, EMPID, RATE FROM #Global_Temp \r\n ) AS LOADEMPS ON ORDERS.ORDDATE = LOADEMPS.LOADDATE\r\n AND ORDERS.ORDLOAD = LOADEMPS.LOADNUM\r\n INNER JOIN ( SELECT LOADDATE, LOADNUM, COUNT(LOADROLE) AS TYPECODE\r\n -- THE SUBQUERY BELOW IS THE SECOND DUPLICATION\r\n FROM ( SELECT LOADDATE, LOADROLE, EMPID, RATE FROM #Global_Temp \r\n ) AS LOADEMPS\r\n GROUP BY LOADDATE, LOADNUM\r\n ) AS LOADTYPE ON ORDERS.ORDDATE = LOADTYPE.LOADDATE \r\n AND ORDERS.ORDLOAD = LOADTYPE.LOADNUM\r\n ORDER BY ORDDATE, ORDNUM, ORDLOAD, LOADROLE;\r\n\r\n DROP TABLE #Global_Temp;", "83" ], [ "Well this is fascinating. I am using `MS-Access 2007` to make a from that will allow users to enter data from lab results. \r\n\r\nThe from utilizes a `VBA` code call: \r\n\r\n`DAO.OpenRecordset( \" ;{Sql query} \" ; , DB_OPEN_DYNASET, dbSeeChanges)`\r\n\r\nThis call normally works just fine, but I&#39;ve noticed that when this form is closed and then re-opened, a `3151 ODBC` error is generated. \r\n\r\nWe are using linked tables through `Access 2007` for this form, our `SQL-Server 2012` version is as follows. \r\n\r\n Microsoft SQL Server Management Studio\t\t\t\t\t\t11.0.2100.60\r\n Microsoft Analysis Services Client Tools\t\t\t\t\t11.0.2100.60\r\n Microsoft Data Access Components (MDAC)\t\t\t\t\t\t6.1.7601.17514\r\n Microsoft MSXML\t\t\t\t\t\t\t\t\t\t\t\t3.0 6.0 \r\n Microsoft Internet Explorer\t\t\t\t\t\t\t\t\t8.0.7601.17514\r\n Microsoft .NET Framework\t\t\t\t\t\t\t\t\t<PHONE_NUMBER>\r\n Operating System\t\t\t\t\t\t\t\t\t\t\t6.1.7601\r\n\r\nThe `DAO.OpenRecordset` call is utilized in multiple events. Here is the list. \r\n\r\n`On_Current , _AfterUpdate , Form_Unload`\r\n\r\nI have found several reported instances of similar errors on `Access 2007` with linked tables to `SQL-Server`, but none seem to have workable solutions for this issue. \r\n\r\nAs best I can tell, the `3151` doesn&#39;t appear to be affecting the form or data in any negative way. I am able to open the form and everything is where it should be as best I can tell. There are about 20 thousand records on this table, so I may be missing something. \r\n\r\nDoes anyone have any ideas? \r\n\r\n9/14 In response to comments I am adding some additional code. \r\n\r\nHere is the call on Form_Unload. It contains the failing line.\r\n\r\n Private Sub Form_Unload(Cancel As Integer)\r\n Dim ImportID\r\n Dim rst As DAO.Recordset\r\n Dim db As Database\r\n Set db = CurrentDb\r\n Set ImportID = Me.ImportID\r\n \r\n #This is the failing line below. \r\n Set rst = db.OpenRecordset( \" ;SELECT [dbo_t_inspect].* FROM [dbo_t_inspect] WHERE [dbo_t_inspect].ImportID= \" ; & ImportID & \" ;; \" ;, DB_OPEN_DYNASET, dbSeeChanges)\r\n\r\n\r\nHere is the call from On_Current. This On_Current call is actually made by a sub-form on the main form. \r\n\r\n\r\n Private Sub Form_Current()\r\n Dim rst As DAO.Recordset\r\n Dim strImportID As String\r\n If IsNull(Me.ImportID) Then\r\n [Forms]![Inspection Receiving]![LabComplete].Visible = False\r\n [Forms]![Inspection Receiving]![LabPending].Visible = True\r\n Else\r\n strImportID = Me.ImportID\r\n \r\n Dim db As Database\r\n Set db = CurrentDb\r\n Set rst = db.OpenRecordset( \" ;SELECT [dbo_t_health].*, [dbo_t_health].ImportID FROM [dbo_t_health] WHERE ((([dbo_t_health].ImportID)= \" ; & Me.ImportID & \" ;)); \" ;, DB_OPEN_DYNASET, dbSeeChanges)\r\n \r\n\r\nI am not sure where `DAO` is defined in this solution. I cannot find it&#39;s declaration in my folder titled `Microsoft Office Access Class Objects` I am open to suggestions on where that might be located. \r\n\r\nThe precise error message is as follows \r\n\r\n > Failed to connect to {ODBC Connection Name} Error 3151. \r\n\r\nI can then select the debug option and the debugger will take me to the line that tried and failed to connect the the ODBC Connection I am using. \r\n\r\nThe Error is highly reproducible. All I have to do is enable `VBA` Macros on the Security Alert and then open the form in question. I close out the form after it loads. Once I attempt to reopen the form, I get the error described above. The Form opens anyway after I click `Ok` on the error.", "452" ], [ "Hello, all this solution was built circa 2008 on `MS-Access 2007`. I have not asked my manager who originally built this system, I know that it wasn&#39;t him since he doesn&#39;t know enough `VBA` to make something like what I am currently working on. Based on some other parts of the implementation I&#39;ve seen so far, I would guess that the person/team that built this for my company was definitely using outdated practices.I will post the specific line that is failing, but it is very similar to what is already in the question. What is the issue with using On_Current?", "858" ] ]
383
[ 5964, 19029, 14156, 15997, 10919, 15917, 8141, 15981, 4632, 8511, 8938, 18414, 3237, 14647, 5015, 18275, 6786, 6388, 15413, 11601, 4657, 19704, 7770, 2305, 13235, 4665, 12945, 4406, 1607, 8136, 7805, 9499, 6310, 3787, 5654, 4070, 508, 399, 14341, 19495, 717, 8202, 1153, 9791, 12497, 6742, 17663, 5316, 12717, 10096, 11525, 12913, 14999, 19712, 15334, 12193, 10829, 18725, 17481, 14255, 18455, 12647, 7460, 12184, 5569, 18591, 4896, 9890, 15049, 12793, 15127, 8970, 14742, 10885, 13778, 16550, 7499, 10642, 6412, 16895, 18691, 3737, 8984, 4176, 783, 13880, 8840, 7427, 2189, 2016, 13589, 12365, 15732, 9931, 13104, 15396, 13129, 17909, 9278, 16771, 1316, 5293, 19469, 4634, 15569, 9744, 13796, 15426, 7416, 12965, 16415, 12271, 2792, 10740, 12853, 14056, 9406, 11324, 1645, 13704, 109, 4275, 14515, 14448, 14606, 12844, 7253, 18700, 7515, 3047, 13903, 10443, 1703, 18194, 15108, 1925, 15398, 12795, 6667, 7095, 9940, 16081, 3143, 1677, 14180, 10786, 19703, 3269, 1054, 6047, 9307, 9683, 5212, 14670, 11477, 5953, 2858, 529, 4309, 711, 17030, 10485, 9541, 6815, 2206, 5859, 13311, 13590, 1231, 9792, 16233, 3052, 12592, 7140, 14760, 1208, 6076, 11178, 15892, 779, 9925, 1240, 16349, 12669, 13566, 6999, 19679, 4346, 19749, 3681, 944, 14703, 7921, 3752, 16137, 7114, 13854, 10401, 16106, 18454, 18944, 252, 732, 11495, 18586, 14580, 3654, 641, 13932, 1064, 14480, 12079, 14326, 8486, 5487, 15437, 13321, 9992, 8964, 12889, 7077, 4913, 4673, 1818, 12812, 1515, 8608, 13319, 3794, 5801, 2094, 15774, 11263, 15014, 8943, 10061, 4418, 11786, 14923, 17646, 1793, 15883, 9366, 7599, 9542, 17328, 4721, 17910, 3027, 10834, 13657, 15149, 3803, 2330, 14302, 16405, 11792, 18187, 8172, 4337, 17838, 6949, 1320, 14136, 6756, 6129, 15723, 14358, 14206, 1742, 18048, 14275, 3636, 8299, 5232, 1720, 15730, 8861, 16180, 17435, 16834, 13947, 18126, 5466, 2583, 18079, 11909, 3886, 3061, 8711, 12443, 5766, 275, 7093, 12489, 1540, 13427, 8676, 12856, 3663, 5320, 8662, 3074, 4174, 4661, 2480, 19094, 7677, 5130, 387, 15219, 18614, 6615, 10315, 489, 17282, 9745, 17343, 1514, 18297, 8613, 15858, 17642, 13846, 6343, 3371, 12414, 2170, 17506, 2120, 425, 7402, 10505, 19547, 7842, 1739, 3963, 1705, 1749, 10522, 14177, 17272, 6941, 11550, 15080, 1712, 5700, 12514, 2726, 13535, 10483, 152, 10708, 3535, 9928, 5883, 17784, 2296, 18502, 12083, 14955, 12010, 10377, 14165, 10497, 12370, 18542, 1229, 5816, 75, 235, 4331, 10835, 16941, 2669, 19662, 9020, 5865, 3235, 1683, 15464, 8609, 7335, 5776, 13762, 5675, 13803, 17686, 14378, 3387, 17078, 6986, 16580, 13451, 2331, 15319, 3110, 10403, 574, 11716, 17270, 19540, 689, 10332, 9046, 13336, 17426, 1533, 19746, 14078, 9727, 2654, 18873, 18667, 9979, 8133, 16810, 14062, 9510, 8457, 11952, 199, 12307, 12714, 10729, 5253, 12432, 5, 11903, 5742, 13437, 15492, 753, 11065, 10686, 7906, 5804, 622, 8040, 4848, 675, 11925, 18548, 13176, 2928, 16121, 13247, 12988, 6336, 8496, 7131, 8072, 1971, 10038, 2733, 12062, 10762, 5833, 19324, 16603, 16807, 7541, 2799, 6403, 6258, 7266, 8341, 15630, 14582, 18975, 13859, 17378, 7337, 17892, 2314, 17447, 17466, 14565, 12160, 12248, 1587, 9635, 17438, 15862, 14237, 7291, 18184, 6991, 13337, 2474, 3123, 13462, 1882, 5500, 45, 18988, 12876, 17012, 17373 ]
STX_100073.0
[ [ "If cost permits, you may want to have Linear Technologies LTM4623 micro switching power supply module. This finger nail size chip can buck down 9v to 5v at 85% efficiency, just needed a voltage setting fixed resistor and two equally tiny capacitors at input and output. Great performance for battery powered loads. The only concern it costs usd10 a piece. Check their website.", "274" ], [ "Its correct..... Capacitor can discharge very rapidly thus able to deliver higher output power. However, their input power could be very less depends on the current capability of the power supply that charges it.\n\nIf look closely at xenon flash lamp in cameras, most cameras operates on tiny battery but xenon tube operated from them flashes at kilowatts. This is true because a high voltage capacitor inside the unit is charged to +350V by a boost converter. The capacitor takes few seconds to be fully charged. During flashing the entire charge is dumped into xenon tube in mere milliseconds.\n\nPower is actually the rate of energy conversion. Capacitors can do this very fast thus can exhibit very high output power.\n\nThis is why capacitors are also known as condensers or accumulators.", "520" ], [ "Your device /load will only draw what it needs for its normal operations. But in general if the source is able to supply much larger current than what actually the load needs, it will be a good practice to install a current limiting device (a fuse or thermal breakers) in the current path. \n\nThis is necessary because in the case of failure the internal parts of your load probably will fail catastrophically if incoming current is unlimited.\n\nAn example of this is charging a mobile phone from a standard USB charger and charge the same phone from +5V sourced from 20 Ampere Atx power supply.\n\nIn case of charge controller failure, can you imagine what 20 Amps will do to the type C USB port, the tiny wires it is attached to, the internal components of your phone?", "803" ], [ "If you have some old scrapped atx power supplies, you may salvage 40Amps 3 pins dual schottky diodes in to247 packages. \n\nGet 4 of these, wire each of the dual diodes as a single diode by shorting out two outer pins. Now built your bridge rectifier using these to247. \n\nThese packages are easy to mount on heatsinks with very low chip-to-sink thermal resistance. \n\nVery cheap and super reliable high power rectifier. This is what I have done for my 12 volt 30Amp battery charger PSU.", "274" ], [ "Voltage drop will surely happen when the current draw exceeds the capability of the source. Almost all computer systems are powered by switching power supplies frequently at DC 5volts and 3.3volts. \n\nThis voltages are further bucked down by on board regulator to the regions of 1 volt to be used by processors, memory chips and chipsets. The exact voltages depends of the specifics.\n\nIntel i7 processor requires 130w at 1 volt needs 130 Amps of current. The amazing thing about processor power requirement is, during idle it may require only 5Amps but at the moment a program is executed the current jumps to 100 Amps in microsecond. All available low ESR capacitors at the vicinity of the regulator will help to maintain stability during this sudden changes.\n\nThis demand will increase the main current at 5 volt lines proportionally. The current transients normally are well damped by capacitors.\n\nProblem occurs mostly when the capacitors degrades. Voltage drop below minimum stable operation threshold during current steps from low to high.\n\nSuch circumstances cause indeterminate logic states in computer operation causing data corruption. There may not be hardware damage but data loss, program halted with blue screens are real cause of such instability.", "803" ], [ "Your hum must be at 100 hertz, not 50 Hertz. Its nothing wrong with your transformer or rectifier. If anything is seriously wrong with any of those, you will hear the hum louder.\n\nYour problem is improper grounding. Do some studies on star grounding, ground loop and ground current in amplifier circuits.\n\nYou can solve your problem simply by shifting the ground point.", "887" ], [ "The answer is NO. It won&#39;t work. \n\nSome ups will kick in only when the supply voltage drop low enough. For instance, in 240V system its normal for an ups ignore the voltage drop up to 220V. The value of this margin may not be universally true but such tolerance is always exist.\n\nYour computer might be more sensitive to voltage drop. For instance it may go blank at 230V while your ups stays dumb without doing anything.\n\nYour entire setup must be tested for slow brownout (not quick blackout) to find out what happens.\n\nThe most frequent power supply problem is voltage sag or brownout. Unfortunately most ups are not designed so cater this. You may need to read about DySC equipment to learn more about this real world problem.", "803" ], [ "Electrical input power of the motor on the name plate is actually for the full rated mechanical power output of the motor.\n\nThus a 750W motor run from 24 V will not demand 30Amp without mechanically coupled to anything significant.\n\nThere is no law to say mechanical power must only be stated in horsepowers. One horsepower is 746W and this means the motor is one HP motor. \n\nThis motor during free run (zero mechanical load) probably will demand a mere 5 Amps or even less.", "137" ], [ "There is an efficient way of doing this cheaply **for AC**, using:\r\n\r\n - a high-voltage non-polar capacitor\r\n - a 400V 1A bridge rectifier\r\n - a 5V 1W Zener\r\n - a 220μF 16V smoothing capacitor\r\n - a 1K 5W surge limiting resistor (to stop it blowing up)\r\n\r\nSince you need only **5 mA** at your output, calculate the needed capacitive reactance:\r\n\r\n240V / 5mA = **48000 Ω** (Ohms)\r\n\r\nThe capacitor needed for this reactance at say **50 Hz**:\r\n\r\n48000 Ω = 1 / (2 * pi * 50 Hz * **C**)\r\n\r\nC = **0.07 μF**\r\n\r\nFor proper regulation, let&#39;s double the capacitance, giving about **0.15 μF**.\r\n\r\nConnect your bridge rectifier through this capacitor to the 240V mains.\r\n\r\nConnect your 5V Ζener in reverse bias mode across the DC output of the rectifier.\r\n\r\nSmooth out the 5V across the Zener using the 220μF capacitor.\r\n\r\nYou may also use a **0.5 A fuse** at the input side for protection, in case the high voltage capacitor gives way.", "274" ], [ "Possible cheap approach. !! \r\n\r\nIf you have a high power car stereo power amplifier that runs normal impedence speakers like say 4 ohms , the voltage at the current you are asking could be already available inside it. The power amplifiers are having built in DC to DC converter to step up 12V automobile voltage to bipolar high voltage e.g. +35V and -35V. The exact current limit is depend on the power rating of the amplifier.\r\n\r\n388 watts is not uncommon among car power amplifiers, thus what you trying to get is already available.", "887" ], [ "What you are asking can be done easily.. What you need are two 1000uF capacitors, a piezo buzzer, a 1 Amp diode and a single pole relay with normally closed contact.\n\n![The hand drawn simple schematic explain the buzzer operation as intended][1]\n\n\n [1]: _URL_0_\n\nDuring power up buzzer sounds momentarily until the first capacitor fully charged. During power down the second capacitor discharge through the buzzer again sounds the buzzer momentarily.\n\nThe first cap may need a high ohm resistor in parallel to discharge it to prepare it for next power up buzz.", "274" ], [ "My hand drawn diagram is not great and I intentionally didn&#39;t label anything. Pls put some effort to crank your brain to relate the circuit to it&#39;s descriptions to understand which us which and how it works. <PERSON>, it does not need a second power supply, only the second capacitor is needed. Such a simple circuit still need to stimulated in LTSpice?", "520" ], [ "The description for the LED headlight given in that web link is useless. It doesn&#39;t explain why the unit has three wire connection. No information about its internal circuitry or any protection it may have. Without any such detail, u suggest you to look for well built external voltage regulator to maintain 12V output for the headlight for whatever input the CDI may produce. CDI output sometimes are not well regulated, it may shoot as high as 30V momentarily and your headlight may not like it. Building your own regulator is easy but got to make it rugged enough for your application.", "1020" ], [ "As it is pointed out jms, star connection is the best solution to reduce loading on a particular phase. Star connected load share the all three phases equally.\n\nMost water heater elements are thrystor/triac controlled by phase chopping. The photo you have posted shows 3 independent relays for each heaters but thrystor cannot be seen. So I conclude there is no phase control but the elements are simply on and off by the relays. I also assume the switching circuits are independent from each other and the heater elements are electrically isolated from each other.\n\nAs such, feed the 3 input lines to the relays from 3 different phases (L1,L2, L3), connect the outputs from the relays to the respective heater elements, terminate the other ends of the elements to the Neutral.\n\nIn this mod, your professional electrician will need to cut and splice some wires with connectors. It should cost you minimum.", "955" ], [ "Input power equals to the output power plus loses. For all switching power supplies like those USB chargers, the loses are generally very less. That&#39;s why they heats up only mildly even during peak output operations. But as it is pointed out by uint138_t, the spec marking on the USB charger units indicate higher current rating than what it really should be for the given power output. This is because the spec actually stating the initial momentary inrush current d", "803" ], [ "High voltage wiring in ships, planes and trains using dedicated return (neutral) line. Earth in technically the chassis of the vehicles. \n\nAlthough the neutral is also connected to the chassis around the transformer location, it doesn&#39;t mean the chassis can be considered as the neutral.\n\nThe very important reason why this is not allowed in wiring codes is because the chassis cannot be trusted as the good conductor. \n\nWhen the chassis is used as neutral (return line), if the return current encounter high impedances, voltage drop will occur and resultant voltage differences in the chassis will be a very serious safety hazard.\n\nPeople accidentally exposed to this voltage may died electrocuted. High current in poorly conducting joints will generate excessive heat and create fire hazard.\n\nTo put in general term, the answer for the question is, Don&#39;t Do It...!!", "269" ], [ "Yes, the poly phase switching power supply interleaved in 12 phases is now common in high end computer boards. The connection between the source and load are made through different copper clad layers in the 8 layer circuit board. The efficiency of the poly phase regulator can be as high as 97%. You may check such products listed in linear technology website.", "269" ], [ "I&#39;m making a bigger site for the first time so security really matters, unlike for my really-bad boards with maybe 10 users. So I wanted to ask if the way I&#39;m doing it is secure enough for a semi-big application where money is involved.\r\n\r\nThe site is written in PHP, database is MySql. This is the current login.\r\n\r\nFirst off, I have a 128 sign long salt and session key saved in the local config. \r\nOn every site that interacts with sessions (e.g. the user control panel) I have this snippet at the start of the code: \r\n\r\n session_start();\r\n if (empty($_SESSION)) {\r\n session_regenerate_id(true);\r\n }\r\n\r\nAfter that I connect to the database, escape all the strings and read out the data. \r\nAfter that, I compare the two passwords which got hashed with SHA-512 and the salt from before:\r\n\r\n public static function hashValue($str) {\r\n for ($x = 0; $x < 10000; $x++) {\r\n $str = hash(&#39;sha512&#39;, $str . self<IP_ADDRESS>$salt);\r\n }\r\n \r\n return $str;\r\n }\r\n\r\nIf everything is correct, `$_SESSION[$sessionkey]` gets set with the user ID from the database (altough the long session key shouldn&#39;t be neccessary because the client can&#39;t change the `$_SESSION` vars locally anyway, IIRC. Right?) \r\nIf the site is secured (as in, users not logged in don&#39;t have access) this code is called to redirect them back to the index if they aren&#39;t logged in:\r\n\r\n if (!isset($_SESSION[$sessionkey])) {\r\n header( \" ;Location: ?view=default \" ;);\r\n exit;\r\n }\r\n\r\n\r\nIs this application secure? I&#39;ve read somewhere that its better to have a randomly generated salt for each user, saved in the database. Is that really neccessary, considering it only really prevents brute forcing a bit better, which shouldnt be a problem with a captcha anyway?", "957" ], [ "I&#39;d define it in my case as that the user can&#39;t take advantage of obvious security openings, e.g. I don&#39;t need to worry that I go online after my site is online for one day and someone is able to login as another user, change database values or anything else that breaks important stuff.", "873" ], [ "Thanks for the answer! Good to know about all this, I&#39;ll use bcrypt from now on. If I understand password_hash and your answer correctly I don&#39;t need to generate an extra salt, right? \nWell, im not replacing the session ID with my own, im simply regenerating it. I also meant the session key, eg $_SESSION[keyhere], which shouldnt impact anything right? \nAlso thanks for the prepared statement stuff, didnt know about that!", "957" ], [ "The only advantage of having zener before the rectification diode is less component count..!\n\nOutput voltage is the function of choice of the zener and any voltage dropping elements e.g. the diode as in the top circuit.\n\nIn this types of circuit the continuous current limitation is always dictated by the input Xc and nothing else, but peak momentary output current is determined by the final output capacitor.\n\nFor example if you use 1000uF low ESR capacitor for the output, you may able to draw even 100 Ampere at 5Volt for a brief 1 millisecond.", "520" ], [ "My bad... I wanted to say if the capacitor is discharged very rapidly even hundreds of amperes can be drawn from it. \n\nA 1000uF capacitor charged to 5V holds energy of 12.5 mili Joules. Assuming the capacitor is very low ESR type, if this capacitor is forced to discharge into 5 mili ohm resistance the discharge time constant (T=RC) will be 50 micro second. Peak initial current of 100A will decay almost linearly within that time constant and the capacitor will be near empty in 1 mili second.", "803" ], [ "Looks like the \" ;ground \" ; of your digital piano is floating above the actual ground that you are standing. \n\nReading from your experiments, it suggest the ground of your piano might be at very high AC potential referenced to the earth. You didn&#39;t say how your piano is powered but i assume it operates from mains voltage. It may have poorly designed power supply which capacitively couples high voltage to the low voltage side amplifier section of the piano. \n\nIn addition to that, its internal circuitry may have been designed poorly which causes 50 Hz hum picked up by high gain amplifiers when ever the capacitively coupled leaking current find its way to the earth.\n\nYou should try these...\n\n - Find the way to earth the star ground of the low voltage side of your digital piano. This will drive all leakage current away from the sensitive audio input sections.\n - Feed the audio input to the piano thru an isolation transformer. This will eliminate the audio ground shorting to earth, however AC coupling might still be a problem.\n\nGood luck.", "887" ], [ "The emi filter is an AC device. Operating this with AC voltage, no matter how big the capacitor is, \" ;keep power longer to circuit \" ; is an absurd statement, unless you use it with DC supply. But then, in DC application the inductance in the filter will be totally useless.\n\nFilters are designed to attenuate particular band or bands of interference from getting into (or out from) the circuit of interest, for instance a switching mode power supply.\n\nTo achieve that goal firstly the noise spectrum of the SMPS is analyzed using a spectrum analyzer. Then the filter components (the henries and farads) will be chosen to achieve the best attenuation for the noise frequencies detected by the analyzer. Inductors will be sized to handle the required load current and capacitors are sized for the desired operating voltage. \n\nHaving said this, you must understand the components inside a filter are application specific and should not be meddled.", "520" ], [ "\" ;Any attempt to change that DC current level \" ; is always best dealt with larger capacitor rather than inductor because the former helps to reduce power supply impedance but the latter do exactly opposite. But inductor can be used in DC supply sourced from everywhere else except batteries to filter out any AC signal riding on DC.", "520" ], [ "Sure you can.... If the battery is a 3V type you may need to drop 5V USB supply to around that. This can be done easily by connecting three ordinary silicon diodes in series so that their total voltage drop is about 2volts. \n\nUse these 3 series connected diodes between the USB +5V and the positive terminal point of your microphone. This will ensure the microphone gets the 3V. You may need to bypass this 3V to the common ground by a 100uF capacitor.", "120" ], [ "The MVT600, whatever it is, it should have the ground connection, without which it can&#39;t possibly control the relay solenoid. \n\nHaving said this, the function of this immobilizer is easy to explain. MVT600 normally keep the relay switched on thru pin 85 and 86 by pulling the yellow wire to the ground. This in turn closes the relay contacts (pin 30 and 87a) so that ignition key is enabled. \n\nWhen the immobilizer is active, the yellow wire is left floating and relay is killed thus cutting off the 12V to the ignition key.", "274" ], [ "You can&#39;t design Bluetooth chips in DIP package, you can&#39;t have 2.4 gigahertz circuit designed in thru hole form. Do you think any hobbyist can successfully built a circuit operates at 2 gigahertz using only discrete components? I&#39;m damn sure parasitics capacitance and inductance will kill you at your first step. The task is not impossible but every single circuit elements, e.g. track length, distance between components, and their orientation needs serious look.\n\nSmt in the other end having very much tight physical tolerance makes them more predictable in high frequency operation. There are buck and boost voltage regulators made in micro module form where their internal MOSFETs switching at 2MHz. This is possible entirely because of the surface mount design.", "478" ], [ "Do some studies on LM3914 bar graph driver... This ic can be configured to lit any one of the 10 LEDs on its output line depending on the input voltage.\n\nYou only need to scale your resistors (in your ladder) properly to lit any of the desired LED in accordance to your individual push buttons. \n\nWith proper resistor choice you may design it so well where if more than one button pressed simultaneously, non of the LEDs will lit.\n\nAs its said in the comment, here we don&#39;t offer design service, but if you can pick up something from here, I&#39;m sure there are many helping hands will guide you through the design.\n\nUsing LM3914 is easier for non-software geeks. Not everyone understand microcontrollers so well.", "1020" ], [ "Possible solution for the problem is using cascade transistor connection.\nUse the 70 volt optocoupler to control a high voltage transistor which in turn will switch the 170v.\n![enter image description here][1]\n\n\n [1]: _URL_0_\n\nIn this way your optocoupler will see only about 0.8V. You may need to modify the codes so that the microcontroller will provide active low output.", "274" ], [ "Probably what you have read about MOSFETs are comparison between a specific MOSFET and a specific junction transistor. There are thousands types of BJT and MOSFETs. Each are superior in term of spesific parameter compare to another. Generally the gate capacitance makes MOSFETs slower than BJT but modern MOSFETs are made with very small gate capacitance makes then super fast. Computer CPUs are now running at around 1V power supply. The fets in the cpu don&#39;t need 10V to fully turn on.", "520" ], [ "You said current transformer is expensive.... But if you think about it, current transformer can be DIYed easily... Just check your electronic scrap bin, look for small smps toroids core. \n\nWind five turns primary on the toroid using well insulated, at least 1mm thick copper wire. 0ne mm thickness should bear 5Amps well. Insulation on the wire should be good for mains voltage operation.\n\nThe secondary can be very fine insulated wire. You can salvage this kind of wire from any small magnetic relay solenoids. Make at least 20 turns on the toroid. The primary and secondary can be wound without overlapping. \n\nSince you most likely will have to do this winding manually, first calculate the length of the wire needed for the number of turns beforehand. Simply measure the length of one loop thru the toroid and multiply by the number of turns will be just fine.\n\nSignal amplification and conditioning can be implemented easily using a cheap op amp and a comparator.\n\n![enter image description here][1]\n\n\n [1]: _URL_0_", "274" ], [ "LM3914 has open collector output on its pins... When a particular output is active the internal chip transistors will pull the output pin towards ground. But when the output is not active then it remains open and floating.\n\nThus, when connecting the LM3914&#39;s output to the input of other ICs which expecting logical high or low signals, a pull up resistors might be a good idea to avoid random states. Use a cheap 10x resistor network of 10Kilo ohm to pull up all outputs of LM3914 when connecting it to logic gates.\n\nIf active high outputs are required from ULN2003, inverters are necessary between LM3914 and ULN2003. Use either hex CMOS inverters or built simple pnp inverter for every channels. If pnps are used, connect the output of LM3914 to the transistor base, link the emitter to Vcc through 10K resistor. Connect the collector of the PNP to ULN2003. In this case, separate pull up resistors will not be required.", "274" ], [ "I want to increase the size of the bracket to display more nicely the output, but I didn&#39;t find out how.\r\n\r\n $$s^2 = \\frac{1}{n-1}[\\sum\\limits_{i=1}^n x_i^2 -\r\n \\frac{(\\sum\\limits_{i=1}^n x_i)^2}{n}]$$\r\n\r\nHere is the image that I obtain : \r\n\r\n[![enter image description here][1]][1]\r\n\r\nAnd here is the output that I want. (PS. I want the sum with i=1 below and n above, in the image the output is not 100% what I want), I took that from a word document)\r\n\r\n[![enter image description here][2]][2]\r\n\r\nTo test the output, I use the sample file : sample-dynamic-2.html from MathJax.\r\n\r\nUPDATED : \r\n\r\nI changed the formula to :\r\n\r\n $$s^2 = \\frac{1}{n-1}\\Biggl[\\sum\\limits_{i=1}^n x_i^2 - \\frac{(\\su\\limits_{i=1}^n x_i)^2}{n}\\Biggr]$$\r\n\r\nI obtain this instead :\r\n\r\n[![enter image description here][3]][3]\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_1_\r\n [3]: _URL_0_", "757" ], [ "Keep both secondaries separated. Use bridge rectifiers on each secondaries. Use 680uF smoothing cap for each bridge&#39;s outputs. Use 7824 regulator for each side, keep the ground isolated. Now you should have two isolated 24V power source. \n\nFinally link these in series and take the mid point as your common ground. Don&#39;t forget heatsinks (maintain isolation) for both 7824. Output smoothing caps of 1000uF will help too. These linear regulators needs reverse protection diodes (check datasheet) to prevent current flow into the output terminals. Beware of that.\n\n![enter image description here][1]\n\n\n [1]: _URL_0_", "274" ], [ "Any Smps with well regulated 5V DC can be used as a charger. But there must be some sort of safety/ protection be in place so that the output current is limited.\n\nA standard mobile or tablet nay demand 2Amps of charging current from a 5V smps. A standard ATX power supply may capable of delivering 25A on its DC 5V output. Designated chargers will have internal current limit to avoid excessive current flow during malfunction of the connected gadget. But having these gadgets connected to an ATX will reduce the gadget to ugly burnt thingy in case of malfunction of the battery/ charger controller. Safety is thus seriously jeopardize.\n\nSo, what can be done is build a simple current limiter and install it between the SMPS and yr gadget.\n\n![current limiter circuit][1]\n\n\n [1]: _URL_0_\n\nCurrent sense resistor of 0.33ohm will turn on the Q2 at about 2Amps and the base bias for Q1 will be removed thus limiting the current at that value.\n\nQ1 must be rated at least two times of the intended charging current and it must be on the heatsink.", "803" ] ]
360
[ 317, 18238, 13836, 3518, 18745, 1160, 18576, 10618, 19237, 2029, 16793, 1564, 12944, 3283, 13223, 1616, 18830, 11320, 1969, 457, 292, 4596, 7117, 542, 1970, 17803, 5408, 15931, 1976, 2129, 19642, 1988, 9652, 2759, 18845, 16014, 17211, 3475, 3165, 10194, 7924, 1350, 18609, 5262, 2946, 10956, 2862, 2125, 18063, 2338, 12416, 14803, 2568, 12843, 12931, 15624, 15897, 16872, 727, 1120, 679, 2926, 19399, 15722, 1704, 18441, 3916, 28, 13631, 1918, 10910, 9901, 9974, 33, 18328, 19401, 13244, 11410, 4424, 17862, 19160, 16760, 2798, 18199, 8392, 10043, 18296, 10994, 17176, 8045, 2973, 3477, 14714, 17100, 346, 11536, 16982, 19355, 11499, 14497, 3671, 18782, 2369, 16845, 8914, 2110, 15738, 10108, 15595, 4317, 17845, 1182, 6872, 3774, 19698, 17275, 11294, 10796, 1995, 716, 9341, 533, 334, 15232, 7310, 804, 17130, 16836, 17597, 9408, 3595, 18403, 2340, 15980, 17757, 6205, 8225, 5482, 18227, 4465, 15546, 9090, 3852, 14305, 5072, 1506, 18715, 18928, 10779, 11111, 9424, 9936, 974, 15625, 18855, 18869, 3611, 14077, 5117, 17918, 12617, 18973, 2034, 19400, 11260, 2276, 16350, 18037, 7929, 11115, 7112, 12827, 528, 19479, 11864, 4928, 13882, 19067, 16441, 4651, 8178, 278, 6998, 3355, 5276, 995, 15744, 1900, 18319, 18093, 5027, 17513, 4301, 1306, 19769, 10654, 10718, 11717, 1044, 11152, 4682, 566, 3065, 16175, 16040, 10633, 18856, 15910, 12796, 16991, 11817, 3422, 16, 10513, 2562, 492, 19138, 19099, 4369, 1176, 11862, 16577, 18313, 4855, 18689, 17364, 2740, 16651, 3526, 17330, 16799, 631, 12120, 27, 19455, 19477, 13430, 17177, 2309, 8498, 11197, 6066, 18573, 8191, 513, 18718, 10575, 18781, 2656, 8013, 19481, 17773, 7364, 12330, 8130, 3920, 17133, 18118, 1967, 19001, 353, 17619, 10733, 4210, 16575, 15139, 9693, 3333, 14525, 13597, 4861, 19572, 3783, 13959, 19693, 7489, 3328, 16748, 13362, 12310, 16660, 12451, 19436, 9201, 3717, 11760, 13806, 3668, 1048, 19383, 4588, 13497, 4961, 15415, 4905, 10159, 3806, 16088, 19513, 4076, 2639, 18505, 18128, 9766, 19542, 2559, 4531, 11692, 7848, 1268, 15116, 3788, 7261, 1419, 4311, 3352, 18121, 12003, 18404, 19446, 18791, 2241, 12541, 18983, 8213, 6748, 1884, 10949, 16065, 11221, 19470, 339, 10893, 4959, 2211, 18840, 4679, 16270, 10621, 2084, 5733, 2362, 9182, 11219, 17267, 17486, 15170, 5245, 884, 7418, 4370, 18807, 18263, 19535, 11707, 2866, 19242, 9135, 8904, 13554, 565, 15578, 16747, 12086, 9371, 2106, 13772, 5076, 5317, 1057, 5029, 14140, 3823, 18437, 6167, 5222, 5686, 13171, 7757, 4098, 18003, 7728, 9800, 5679, 3576, 7740, 13007, 19096, 1568, 18711, 3855, 11354, 18067, 201, 2143, 1695, 19554, 9798, 8366, 24, 4860, 12753, 14762, 2811, 2401, 3571, 5363, 14032, 15715, 19553, 6245, 11568, 15123, 2504, 14406, 2024, 940, 1830, 601, 17656, 9454, 4013, 11618, 12958, 7629, 1468, 7752, 14616, 4436, 18119, 3837, 4219, 16661, 6670, 8848, 10969, 3716, 821, 3199, 13938, 15103, 10118, 1273, 18868, 6304, 15119, 3432, 2757, 17514, 17732, 15230, 3071, 2082, 7343, 1151, 6063, 3925, 18016, 17044, 16595, 11074, 9172, 12091, 19539, 17412, 1941, 17756, 11872, 19645, 14047, 15172, 4274, 319, 3295, 17192, 16050, 104, 8798, 5506, 2200, 833, 5797, 8849, 12030, 1253, 5068, 16891, 198, 10437, 8529, 3505, 12633, 13860, 7276, 18922, 12515, 13994, 13962, 9686 ]
STX_10007488.0
[ [ "I have a Xubuntu install running in a VM (VirtualBox) on a Windows 10 host. There is a directory on the Windows file system which I have mounted in the guest as a vboxsf. I think it&#39;s a Linux problem but that&#39;s the background in case it&#39;s relevant.\r\n\r\n\r\nI have write access to this directory and all files within it (everything is -rwxrwxrwx). I can create, modify and delete files and directories in it. But trying to create a soft link (ln -s) or chown a file or directory to a different owner produces the following message:\r\n\r\n ln: failed to create symbolic link &#39;myLink&#39;: Read-only file system\r\n\r\nHave tried everything I can think of including unmounting and re-mounting. I don&#39;t understand how I am able to write, modify and delete files, yet a symbolic link produces \" ;read only \" ;. Chown completes without an error or warning, but still hasn&#39;t changed ownership when done.", "708" ], [ "Thanks.I saw that there were both Razor pages and MVC tutorials and it advised me to follow the former as this was the new approach. It looks MCV-ish in that it leads you through creating models and views. But then just runs out of tutorial leaving me trying to guess multiple approaches not really sure which to use as they&#39;re all slightly incompatible yet overlapping. Just finding how to create several related models at the same time (simple in Django) is proving a challenge. I&#39;m following your linked tutorial now and scrapping some of the previous approach. I&#39;ll close this question. Thanks.", "895" ], [ "I am juggling different VPNs due to my company&#39;s rather fragmented set-up. Is there a way to run a Git Status command WITHOUT checking status against the remotes? I.e. just check local changes? Or an equivalent command? It&#39;s a PITA not to be able to just do a Git Status without switching VPNs just to do that.", "405" ], [ "So eventually I found the answer to this. It&#39;s a bug / design decision in VirtualBox itself. See here: \r\n\r\n_URL_0_\r\n\r\nThey used to support it and then realised it enabled a very hard to fix security vulnerability and so deliberately disabled linking in their shared folders. There&#39;s no great work around. You can edit your \r\n\r\nto add the following:\r\n\r\n < ExtraDataItem name= \" ;VBoxInternal2/SharedFoldersEnableSymlinksCreate/SHARE_NAME \" ; value= \" ;1 \" ;/ > \r\n\r\nThat comes with security risks so you must trust your guest. You can also (and this is what I might do) create an NFS mount point and connect to it in more old school ways.", "181" ], [ "I have created the following classes:\r\n\r\n public class Character\r\n\t{\r\n\t\tpublic int ID { get; set; }\r\n\t\tpublic string Title { get; set; }\r\n\r\n\t\tpublic ICollection < Relationship > RelatedTo { get; set; }\r\n\t\tpublic ICollection < Relationship > RelatedFrom { get; set; }\r\n\t}\r\n\r\n\tpublic class Relationship\r\n\t{\r\n\t\tpublic int ToID { get; set; }\r\n\t\tpublic int FromID { get; set; }\r\n\r\n\t\tpublic Character CharacterFrom { get; set; }\r\n\t\tpublic Character CharacterTo { get; set; }\r\n\r\n\t\tpublic string Details { get; set; }\r\n\t}\r\n\r\nIn my Context I have this:\r\n\r\n \tprotected override void OnModelCreating(ModelBuilder modelBuilder)\r\n\t\t{\r\n\t\t\tmodelBuilder.Entity < Relationship > ()\r\n\t\t\t\t.HasKey(r = > new { r.ToID, r.FromID });\r\n\r\n\t\t\tmodelBuilder.Entity < Relationship > ()\r\n\t\t\t\t.HasOne(r = > r.CharacterFrom)\r\n\t\t\t\t.WithMany(r = > r.RelatedTo)\r\n\t\t\t\t.HasForeignKey(r = > r.FromID)\r\n\t\t\t\t.OnDelete(DeleteBehavior.ClientSetNull);\r\n\t\t\r\n\t\t\tmodelBuilder.Entity < Relationship > ()\r\n\t\t\t\t.HasOne(r = > r.CharacterTo)\r\n\t\t\t\t.WithMany(r = > r.RelatedFrom)\r\n\t\t\t\t.HasForeignKey(r = > r.ToID)\r\n\t\t\t\t.OnDelete(DeleteBehavior.ClientSetNull);\r\n\t\t}\r\n\r\n\r\nI *think* that it is right but I cannot apply the migration due to the following error:\r\n\r\n Cannot create the foreign key \" ;FK_Relationship_Character_FromID \" ; with the SET NULL referential action, because one or more referencing columns are not nullable.\r\n\r\n\r\nI&#39;ve tried every combination of **DeleteBehaviour** for OnDelete. None of them work. I don&#39;t believe I can make the ICollections nullable and it doesn&#39;t seem right that I&#39;d want to. I&#39;ve spent two hours on this searching for answers. Every tutorial or explanation on EF Core that I&#39;ve tried to follow seems to take a slightly different approach and be subtly incompatible with every other one. Please help!", "1001" ], [ "I want to store a List of objects in my model but I know EFCore doesn&#39;t support that. To work around it I have created a private string attribute on the model to hold the IDs of the objects in the list. My intention is to populate the list in the constructor of the class when it is restored. My class is as follows:\r\n\r\n\tpublic class Visitor\r\n\t{\r\n\t\tpublic int ID { get; set; }\r\n\r\n\t\tprivate string _DepartmentIds { get; set; }\r\n\r\n\t\tpublic List < Department > Departments { get; set; }\r\n\r\n\t\tpublic Visitor()\r\n\t\t{\r\n\t\t\tif (_DepartmentIds.Length > 0)\r\n\t\t\t{\r\n\t\t\t\tDepartments = JsonConvert.DeserializeObject < List < Department > > (_DepartmentIds);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tDepartments = new List < Department > ();\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\r\nI have two problems. One is that _DepartmentIds does not get saved / tracked by EFCore. I presume because it is private. The second is I need to create a method that will read the IDs from the department list to put them into the _DepartmentIds string but I don&#39;t know how to call this method on the object&#39;s saving. Is it possible to override or extend the entity model saving in EFCore?\r\n\r\n*EDIT: I&#39;m using deserialization rather than just concatenating IDs with a separator because I might want to expand this later.*", "145" ], [ "The information you&#39;ve read is probably old. MyISAM was the standard table for MySQL for a long time and InnoDB used to have much worse performance. But InnoDB is the standard for MySQL these days. MyISAM *might* be slightly faster but InnoDB is very close and has a lot of good reasons to use it. MyISAM is mainly there for legacy reasons now. Use InnoDB. If you still find you need more performance there are better ways to speed it up than using MyISAM. I&#39;ve worked on very big systems and InnoDB has been fine. Hope that helps! :)", "287" ], [ "I have a model which has an auto-incrementing ID field by default as is normal. However, I wish to seed the database with initial data and because there are foreign keys I wish to explicitly set the IDs of the seeded data.\r\n\r\nMy model\r\n\r\n public class EntAttribute\r\n {\r\n public int ID { get; set; }\r\n public string Title { get; set; }\r\n }\r\n\r\nMy seeding code:\r\n\r\n public class Seeder\r\n {\r\n private class AllAttributes\r\n {\r\n public List < EntAttribute > Attributes { get; set; }\r\n }\r\n\r\n public bool SeedData()\r\n {\r\n AllAttributes seedAttributes;\r\n string strSource;\r\n JsonSerializer JsonSer = new JsonSerializer();\r\n\r\n strSource = _URL_0_.File.ReadAllText(@ \" ;Data/SeedData/Attributes.json \" ;);\r\n seedAttributes = JsonConvert.DeserializeObject < AllAttributes > (strSource);\r\n\r\n _context.AddRange(seedAttributes.Attributes);\r\n _context.SaveChanges();\r\n return true;\r\n }\r\n }\r\n\r\nPlease note, I&#39;m very new to both EFCore and C#. The above is what I&#39;ve managed to cobble together and it seems to work right up until I save the changes. At this point I get:\r\n\r\n**SqlException: Cannot insert explicit value for identity column in table &#39;Attribute&#39; when IDENTITY_INSERT is set to OFF.**\r\n\r\nNow I&#39;m smart enough to know that this is because I can&#39;t explicitly set the ID field in the EntAttribute table because it wants to assign its own via auto-increment. But I&#39;m not smart enough to know what to do about it.\r\n\r\nAny help appreciated.\r\n\r\n\r\n\r\n\r\n***EDIT: Adding the solution based on the accepted answer below because the actual code might help others...***\r\n\r\nSo I added to my Context class the following:\r\n\r\n\r\n\t\tprotected override void OnModelCreating(ModelBuilder modelBuilder)\r\n\t\t{\r\n\t\t\tmodelBuilder.HasSequence < int > ( \" ;EntAttributeNumbering \" ;)\r\n\t\t\t\t.StartsAt(10);\r\n\r\n\t\t\tmodelBuilder.Entity < EntAttribute > ()\r\n\t\t\t\t.Property(i = > _URL_1_)\r\n\t\t\t\t.HasDefaultValueSql( \" ;NEXT VALUE FOR EntAttributeNumbering \" ;);\r\n\t\t}\r\n\r\n\r\nThis first ensures the a sequence is created (the name is arbitrary) and then secondly, sets it to be used for the relevant table instead of auto-increment. Once this was done I was able to my seed data. There are fewer than 10 records so I only needed to set the start value for the sequence to 10. More would normally make sense but I know there will never be more.\r\n\r\nI also had to blitz my migrations because they&#39;d somehow got in a mess but that&#39;s probably unrelated.", "480" ], [ "**EDIT: I don&#39;t have enough reputation to comment on the accepted answer above but it WILL break on later versions of MySQL and I don&#39;t think it&#39;s what the poster actually wants - it will not produce the output they said they wanted.**\r\n\r\nYou need to use GROUP BY to collapse several rows into one. And then you want to use an aggregating function to join the data in those rows. An aggregate function is one that takes several rows as input and does something with them to return a single value. In this case you want group_concat.\r\n\r\n\r\nHOWEVER, you need to tell MySQL what to do with EVERY SINGLE ELEMENT you select from the results if you use GROUP BY. This is because in ANSI SQL a statement must be deterministic. I.e. return the same output every time for the same input. Older versions of MySQL would &#39;guess&#39; values for you but newer ones (5.7.5 and after) by default wont. Also, it&#39;s good practice to explicitly tell MySQL how to handle each value anyway. So you want something like this:\r\n\r\n SELECT userId, ANY_VALUE(movieId), GROUP_CONCAT(date SEPARATOR \" ;, \" ;) \r\n FROM tableName GROUP BY UserId;\r\n\r\nThe above will give you each user id and the list of dates. But the movie code will be randomly selected.\r\n\r\nOR you want something like this:\r\n\r\n SELECT userId, GROUP_CONCAT(movieId SEPARATOR \" ;, \" ;), GROUP_CONCAT(date SEPARATOR \" ;, \" ;)\r\n FROM tableName GROUP BY UserId;\r\n\r\nThis will give you the same as before but it will list all the movie codes instead of randomly selecting any value.\r\n\r\nOR you want to group by userId AND movieID so that you can have a row for each user and movie combination. Then you would change the GROUP BY clause at the end, like this:\r\n\r\n SELECT userId, movieId, GROUP_CONCAT(date SEPARATOR \" ;, \" ;)\r\n FROM tableName GROUP BY UserId, movieId;\r\n\r\n\r\nI&#39;ve included three different options because I think you may actually want the third one even though you asked for the first.\r\n\r\n\r\nMySQL version matters. If you are before MySQL 5.7 then the AnyValue(…) function doesn&#39;t exist and you should simply remove it and put \" ;movieId \" ; by itself. But if you ware after MySQL 5.7 and also if you want to do things the right way, you should include it.\r\n\r\nAlso, two suggestions. Firstly, don&#39;t use letters for the movieID unless you have a good reason to. Use integers like you have for the userId and put any information about the movies in a separate table that the movieID is a key for. Secondly, add a column called \" ;id \" ; to your table and make it the Primary Key. This makes many things a lot easier. You can set the id field to be AUTO_INCREMENT - that&#39;s the normal thing to do.\r\n\r\nHope this helps.", "374" ], [ "This is nothing to do with MySQL but to do with your design which is flawed. You should have one table for all your employees. This contains information unique to the employees such as firstname, lastname and email address.\r\n\r\n |ID | \" ;John \" ; | \" ;Smith \" ; | \" ;<EMAIL_ADDRESS> \" ; |\r\n |1 | \" ;James \" ; | \" ;Smith \" ; | \" ;<EMAIL_ADDRESS> \" ; |\r\n |2 | \" ;jane \" ; | \" ;Jones \" ; | \" ;<EMAIL_ADDRESS> \" ; |\r\n |3 | \" ;Joanne \" ; | \" ;DiMaggio \" ; | \" ;<EMAIL_ADDRESS><PERSON> \" ; | \" ;<PERSON> \" ; | \" ;john.smith@gmail.com \" ; |\r\n |1 | \" ;<PERSON> \" ; | \" ;<PERSON> \" ; | \" ;james.smith@gmail.com \" ; |\r\n |2 | \" ;<PERSON> \" ; | \" ;<PERSON> \" ; | \" ;jane.jones.smith@yahoo.com \" ; |\r\n |3 | \" ;<PERSON> \" ; | \" ;DiMaggio \" ; | \" ;jdimaggio@outlook.com \" ; |\r\n\r\n\r\nNote the ID column. Typicially this would be an integer with AUTO_INCREMENT set and you would make it the Primary Key. Then you get a new unique number every time you add a new user.\r\n\r\nNow you have separate tables for every piece of RELATED data. E.g. the city they live in or their login time (which I&#39;m guessing you want from the table name).\r\n\r\nIf it&#39;s a one to many relationship (i.e. each user has many login times), you create a single extra table which REFERENCES your first table. This is a DEPENDENT table. Like so:\r\n\r\n | UserId | LoginTime |\r\n | 1 | \" ;10:00:<PHONE_NUMBER> \" ; |\r\n | 2 | \" ;11:00:00 13-09-2018 \" ; |\r\n | 3 | \" ;11:29:<PHONE_NUMBER> \" ; |\r\n | 1 | \" ;09:00:00 15-09-2018 \" ; |\r\n | 2 | \" ;10:00:00 15-09-2018 \" ; |\r\n\r\nNow when you query your database you do a JOIN on the UserId field to connect the two tables. If it were only their LAST login time, then you could put it in the user table because it would be a single piece of data. But because they will have many login times, then login times needs to be its own table.\r\n(N.b. I haven&#39;t put an ID column on this table but it&#39;s a good idea.)\r\n\r\n\r\nIf it&#39;s data that ISN&#39;T unique to the each user, i.e. it&#39;s a MANY to MANY relationship, such as the city they live in, then you need two tables. One contains the cities and the other is an INTERMEDIARY table that joins the two. So as follows:\r\n\r\n(city table)\r\n\r\n | ID | City |\r\n | 1 | \" ;London \" ; |\r\n | 2 | \" ;Paris \" ; |\r\n | 3 | \" ;New York \" ; |\r\n\r\n(city-user table)\r\n\r\n | UserID | CityID |\r\n | 1 | 1 |\r\n | 2 | 1 |\r\n | 3 | 3 |\r\n\r\n\r\nThen you would do two JOINS to connect all three tables and get which city each employee lived in. Again, I haven&#39;t added an ID field and PRIMARY KEY to the intermediary table because it isn&#39;t strictly necessary (you could create a unique composite key which is a different discussion) but it would be a good idea.\r\n\r\nThat&#39;s the basic thing you need to know. Always divide your data up by function. Do NOT divide it up by the data itself (i.e. table per user). The thing you want to look up right now is called \" ;Database Normalization \" ;. Stick that into a search engine and read a good overview. It wont take long and will help you enormously.", "107" ], [ "Creating and closing a statement doesn&#39;t really make sense. I believe what you mean is creating and closing a cursor. A cursor is a query that you iterate over the results of. Typically you see them in Stored Procedures and Functions in MySQL. Yes, they have a cost to open and close and you should iterate over the entire set.\r\n\r\nAlternately you&#39;re talking about prepared statements such as you might create using the PDO library in PHP. In which case, you can use them as many times as possible and indeed you should, as this is more efficient.\r\n\r\nEvery time MySQL receives a statement, it translates that into its own internal logic and creates a query plan. Using prepared statements means it only has to do this once rather than every time you call it.\r\n\r\nFinally, you might be trying to ask about a connection, rather than a statement. In which case, again, the answer is yes - you can (and should) use it as many time as you need as there&#39;s a significant performance impact of opening it. Though you don&#39;t want to keep it open longer than you need it because MySQL has a maximum number of connections it can open.\r\n\r\n\r\nHopefully one of those will answer your question.", "287" ], [ "There are three layers that can be causing your problem.\r\nFirstly, your database will have a default character encoding.\r\nSecondly, your table can have an explicit character encoding which takes precedence. So you need to make sure you have a Unicode encoding set for your table through one of these methods. You say your table is set to utf8_general_ci so this part should be fine.\r\nThirdly, there is the connection itself which has a specific encoding. This can be set up in MySQL client configuration defaults with the following:\r\n [mysqld]\r\n init_connect=&#39;SET NAMES utf8&#39;\r\n\r\nYou can also set it in the code. For PHP for example, you might do the following:\r\n mysql_set_charset( \" ;UTF8 \" ;, $conn);\r\nor\r\n $db- > exec( &#39;SET CHARACTER SET UTF8&#39; )\r\n\r\nYou haven&#39;t said anything about what $db is, so can&#39;t be certain. But something like that.\r\n\r\nFinally, make sure it&#39;s not actually working but you just don&#39;t know it. Your web page should be set to utf8. Check what you&#39;re actually receiving from the web page and don&#39;t just assume it&#39;s sending Unicode.", "312" ], [ "You could randomly select a page in the Javascript but if you want to actually guarantee that it&#39;s a different page then you need to create a SESSION so that you can recognize the same visitor again and send them to a different place. As you tagged this PHP, you could do something like this:\r\n\r\n < ?php\r\n \r\n $urls = array(\r\n \t&#39;_URL_0_;,\r\n \t&#39;_URL_2_;,\r\n \t&#39;_URL_1_;);\r\n \r\n session_start();\r\n if(!isset($_SESSION[&#39;urlNumber&#39;])) {\r\n \t$_SESSION[&#39;urlNumber&#39;] = 0;\r\n } else {\r\n \t$_SESSION[&#39;urlNumber&#39;]++;\r\n }\r\n ? > \r\n < !DOCTYPE html > \r\n < html > \r\n < head > \r\n < meta http-equiv= \" ;refresh \" ; content= \" ;0; url= < ?php echo($urls[$_SESSION[&#39;urlNumber&#39;]]); ? > \" ; / > \r\n < /head > \r\n < body > \r\n < /body > \r\n < /html > \r\n\r\nWhat this does is start a session for each visitor and keep track of which URLs they have gone through by incrementing the session variable on each subsequent visit.\r\n\r\nNote, it&#39;s not a very good approach. You&#39;d be better sending a HTTP_REDIRECT response from the server. Also, it will break after three URLs because it&#39;s run out. You&#39;d want to put a little code in there to reset it back to 0 once it reached the maximum URLs. But that is in line with your approach that you wanted to use.", "132" ], [ "mysqldump has an option to turn on or off using multi-value inserts. You can do either of the following according to which you prefer:\r\n\r\nSeparate Insert statements per value:\r\n\r\n mysqldump -t -h192.168.212.128 -P3306 --default-character-set=utf8 --skip-extended-insert -uroot -proot database_name table_name > test.sql \r\n\r\nMulti-value insert statements:\r\n\r\n mysqldump -t -h192.168.212.128 -P3306 --default-character-set=utf8 --extended-insert -uroot -proot database_name table_name > test.sql \r\n\r\nSo what you can do is dump the schema first with the following:\r\n\r\n mysqldump -t -h192.168.212.128 -P3306 --default-character-set=utf8 --no-data -uroot -proot database_name > dbschema.sql \r\n\r\nThen dump the data as individual insert statements by themselves:\r\n\r\n mysqldump -t -h192.168.212.128 -P3306 --default-character-set=utf8 --skip-extended-insert --no-create-info -uroot -proot database_name table_name > test.sql \r\n\r\nYou can then split the INSERT file into as many pieces as possible. If you&#39;re on UNIX use the split command, for example.\r\n\r\nAnd if you&#39;re worried about how long the import takes you might also want to add the --disable-keys option to speed up inserts as well..\r\n\r\nBUT my recommendation is not to worry about this so much. mysqldump should not exceed MySQL&#39;s ability to import in a single statement and it should run faster than individual inserts. As to file size, one nice thing about SQL is that it compresses beautifully. That multi-gigabyte SQL dump will turn into a nicely compact gzip or bzip or zip file.\r\n\r\nEDIT: If you really want to adjust the amount of values per insert in a multi-value insert dump, you can add the --max_allowed_packet option. E.g. --max_allowed_packet=24M . Packet size determines the size of a single data packet (e.g. an insert) so if you set it low enough it should reduce the number of values per insert. Still, I&#39;d try it as is before you start messing with that.", "287" ], [ "Use BigInts to store a unix timestamp. This is functionally equivalent to the TIMESTAMP type though lacking some of the sugar that is attached to that. However, if at the application level you&#39;re happy to just consume UNIX timestamps, it makes no difference at all and, for me so far at least, is trivial to handle at the database layer with the occasional UNIX_TIMESTAMP(…) / FROM_UNIXTIME(…) call. That will keep you going far beyond 2038.\r\n\r\n\r\nThough I expect the MySQL / Maria mob will create some hack in version X.y that will automatically update TimeStamp fields as part of the upgrade path. It will probably be released on January the 18th, 2038, mind you. ;)\r\n\r\n\r\nAnyway, if you want to future proof, BIGINT treated as a UNIX time stamp is your answer.", "705" ], [ "No. Datetime has the same upper limit as the 32-bit UNIX time stamp that you&#39;re concerned about. Plenty of applications might want to set a date ahead of this. Doesn&#39;t even have to be 20 years in the future. Just has to be more years in the future than however long before 2038 they finally fix this. I also prefer something that is an ACTUAL measure of time, not something that changes with the timezone. Datetime is currently no more future proof than Timestamp or 32bit int UNIX time. Datetime doesn&#39;t answer your question.", "518" ], [ "You can set a global variable in the mysqld config file and have your tasks change that value after they complete. It would be reset every time the server starts. That would work as the flag you are looking for. You could also use an EVENT to check for that.\r\n\r\n\r\nHowever, you would be better scripting the start up process of your MySQL service to carry out your cleanup tasks once it returned that it was up and establishing a connection locally to execute them. You could, if it&#39;s critical, have this same process enable remote connections only after it had executed its tasks.", "287" ], [ "My error. But the rest of it stands. DateTime is not an actual value of time. You asked how to deal with the 2038 issue in MySQL / MariaDB and that you didn&#39;t like DateTime and did like Timestamp. So I gave you a way to use UNIX timestamps which will work for most scenarios and is future proof. Unless you&#39;re doing a lot of your business logic in the database (bad practice), it shouldn&#39;t be a big deal. At any rate, that&#39;s the answer I have for you.", "338" ], [ "For MySQL 8 the default authentication is now SHA-2 which you can read about here: _URL_1_\r\n\r\nYou should probably use it however if you don&#39;t wish to you can change the default to the legacy mode for any given user with something like this:\r\n\r\n ALTER USER myUser IDENTIFIED WITH mysql_native_password BY &#39;PASSWORD&#39;;\r\n\r\nThat will force the old method if you&#39;re looking for a quick fix.\r\n\r\nYou don&#39;t (I suspect) want to start altering the source code for your client because then you have a branched version of it which is going to make deployment and updating on your servers a nightmare. You&#39;re better off simply waiting until such time as a new version of your client software is available that supports the new method.\r\n\r\nMySQL source is here:\r\n_URL_0_", "486" ] ]
102
[ 8616, 14378, 3794, 6554, 9307, 6040, 9651, 17310, 5163, 425, 5695, 6565, 14610, 8729, 13689, 14428, 18948, 3222, 16010, 508, 112, 19371, 2733, 10423, 14973, 15675, 14543, 7274, 19639, 7580, 14931, 13763, 12048, 1925, 9714, 15630, 19185, 8778, 18448, 17048, 19202, 16773, 17799, 14919, 3389, 10443, 13077, 15201, 5964, 5545, 6201, 10803, 15041, 16960, 15729, 17282, 12489, 9744, 2181, 8203, 11193, 13336, 14103, 1320, 3325, 7996, 13456, 6517, 9925, 817, 18184, 538, 18667, 17481, 10680, 5520, 16412, 15223, 17346, 1264, 13958, 3660, 6919, 18824, 6030, 14071, 7919, 3812, 9482, 8902, 13181, 12263, 6737, 18586, 15334, 19767, 695, 1082, 1559, 7354, 7280, 2573, 16233, 7676, 2131, 19306, 14892, 18676, 4694, 8412, 272, 554, 10879, 14685, 461, 16892, 109, 6551, 12439, 2981, 4936, 6143, 11698, 3129, 7009, 17707, 316, 19559, 10740, 8877, 7541, 9890, 13906, 5319, 1677, 3731, 10483, 11057, 3810, 5850, 16647, 6584, 10468, 10999, 577, 13859, 501, 7383, 12248, 1, 14771, 2621, 507, 13344, 19724, 12822, 1785, 4121, 14628, 12772, 11852, 13846, 1446, 12717, 8812, 2083, 10485, 2256, 5623, 10885, 3862, 10642, 18800, 15997, 6338, 8119, 5096, 3284, 8141, 4997, 13240, 7743, 14219, 2348, 5326, 3350, 5015, 12945, 7145, 17030, 14589, 46, 10965, 10361, 5971, 18392, 13173, 8014, 9832, 18604, 13796, 8453, 14810, 4313, 13826, 4109, 10161, 5484, 6210, 2669, 114, 5642, 2412, 17772, 3127, 8468, 9727, 2039, 2166, 5320, 5316, 14939, 3630, 15936, 1092, 19606, 10134, 12234, 18347, 8056, 5859, 6111, 1607, 2526, 4634, 19414, 10150, 15, 7895, 1581, 15967, 2762, 11475, 9499, 5114, 7331, 12856, 2498, 3677, 16080, 14165, 7033, 17252, 3663, 5529, 6884, 17046, 2404, 10570, 2542, 15533, 1310, 12154, 1095, 15195, 2693, 5946, 18195, 7647, 4987, 14494, 8704, 19268, 10447, 17025, 3520, 3876, 717, 3153, 1408, 18944, 556, 14999, 14357, 19547, 14822, 10763, 2816, 9452, 4591, 8559, 8917, 12913, 17875, 8226, 15075, 3074, 4309, 10061, 6114, 3535, 1231, 10464, 4185, 6239, 14095, 16157, 16031, 12792, 4781, 13947, 9209, 10158, 5212, 13737, 6493, 8595, 4134, 15839, 13835, 2664, 2319, 13780, 11505, 6569, 6096, 924, 5074, 4594, 17453, 16639, 17351, 5332, 15462, 4546, 8516, 1346, 3095, 13649, 16741, 4577, 7525, 6852, 9635, 2255, 15420, 9542, 17296, 9269, 15339, 9931, 7241, 1450, 16612, 6225, 4665, 6552, 2858, 1519, 16159, 11836, 6115, 2540, 5715, 6065, 2458, 5678, 2936, 9851, 15530, 14741, 13326, 10606, 10235, 19556, 6786, 16102, 3737, 15769, 9364, 1793, 1229, 2979, 6855, 7516, 3746, 15524, 4246, 2313, 13411, 14582, 18744, 18143, 3648, 3997, 791, 1965, 11573, 2843, 18700, 19195, 1154, 3189, 14571, 711, 13876, 12455, 18205, 17766, 8008, 17838, 15244, 126, 7874, 5883, 1870, 8991, 3681, 19462, 14273, 6105, 1213, 3096, 1856, 14703, 8970, 14498, 12645, 6185, 10685, 649, 2430, 16285, 16905, 17248, 7327, 16870, 15356, 12928, 10552, 1314, 6873, 11732, 6343, 12083, 6742, 4913, 4978, 16617, 2675, 6780, 10295, 3240, 14955, 7416, 6261, 11550, 7390, 12432, 16362, 9112, 13588, 6572, 14838, 9928, 9880, 6412, 14341, 16171, 43, 18863, 5902, 5530, 14545, 3952, 13932, 12855, 5638, 17516, 8040, 3061, 8111, 5965, 7433, 16867, 10254, 18276, 338, 7660, 19352, 3335, 4378, 9940, 2695, 10698, 1810, 12524, 16895, 9096 ]
STX_1000753.0
[ [ "Looks like a v3 specific issue. I suggest using v2 for that particular call. See _URL_1_ , where you will see that the revision resource contains an array called exportLinks. Within that you should find an element { \" ;pdf \" ;: \" ;_URL_0_;}. Make an authenticated GET on that URL.\r\n\r\nimho, the provided libraries cause as many problems as they solve. This is a case in point where the library masks access to the v2 API, even though the v2 API is fully supported. So in your code, you will need to extract the Access Token from the drive service object, set that as an http `Authorization: Bearer 4a343234we43w43w44` header, then make the two GET REST calls to GET the revisions list and then GET the url corresponding to pdf in the exportLinks.", "177" ], [ "Change `google.picker.ViewId.DOCUMENTS` to `google.picker.ViewId.DOCS`\r\n\r\nSee _URL_0_ for details. \r\n\r\nThis will list all files. If you want to limit it to a specific mime type, you&#39;ll need to create your own view. Something like\r\n\r\n var myExcelView = new google.picker.View(google.picker.ViewId.DOCS);\r\n myExcelView.setMimeTypes( \" ;application/_URL_1_-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet \" ;); // or whatever mime types you&#39;ve used\r\n var picker = new google.picker.PickerBuilder()\r\n .enableFeature(google.picker.Feature.NAV_HIDDEN)\r\n .enableFeature(google.picker.Feature.MULTISELECT_ENABLED)\r\n .addView(myExcelView)\r\n .etc etc", "363" ], [ "Simple. \r\n\r\n**Do not use a Service Account - that&#39;s not what they&#39;re there for.**\r\n\r\nYou need to obtain an Access Token for the target YouTube account. The simples way to do that is to get yourself a Refresh Token for that account from the Oauth Playground, and use it to fetch an Access Token whenever you need one. The steps to do this are enumerated at _URL_0_ . In the comments there is a link to a YouTube video which also explains the steps.", "261" ], [ "The example you linked to uses Google Drive Android API, which is an offline API that manipulates Drive files on your device. Therefore there is no OAuth and no Access Token. Google Play Services take care of syncing your device files with Google Drive automagically. \r\n\r\nAs an aside, it would never make sense to store an Access Token as they typically expire after one hour.", "594" ], [ "I don&#39;t think the Drive API has a feature to specify a sheet name.\r\n\r\nTwo workarounds spring to mind...\r\n\r\n1. You could use the Sheets API (_URL_0_) and write your own csv formatter. It sounds more complex than it is. It&#39;s probably 10 lines of code, especially if you go for Tab Separated instead of Comma Separated.\r\n\r\n2. Use the Google Spreadsheet `File/Publish to the Web` feature to publish a csv of any given sheet. Note that the content will be public, so anybody with the link (which is pretty obtuse) would be able to read the data.", "288" ], [ "According to the readme \" ;Google Drive Android API Delete Sample app demonstrates deleting of DriveResources via the Google Drive Android API available in Google Play Services. \" ; GDAA is definitely not a wrapper for the REST service. It&#39;s a native Android API manipulating local copies of files.", "594" ], [ "You should clarify what you mean by \" ;token \" ;. In Google Oauth there are Refresh Tokens and there are Access Tokens. These have different purposes and characteristics. Can I suggest you edit your question to be specific which tokens you are saving. Also clarify what you mean by \" ;user \" ; and by \" ;account \" ;. In Google, user=account, but you seem to be saying that a user has more than one account. Again, it would be helpful if you could add more information to your question so it&#39;s clear what you&#39;re asking.", "623" ], [ "No it isn&#39;t possible.\r\n\r\nScopes aren&#39;t nested. So although logically `analytics.readonly` is a subset of `analytics`, that&#39;s not how they are viewed internally. Thus there is no downgrade from `analytics` to `analytics.readonly`, as they are completely separate scopes. Therefore, since you must go through the additional-scopes process to acquire `analytics.readonly`, you might as well revoke the existing token, that being the only way to remove the existing `analytics` grant.", "1007" ], [ "You originally request both analytics **and** analytics.readonly? Odd, but hey ho. Either way, it isn&#39;t possible to revoke bits of a token, so you&#39;re stuck with revoking the token and requesting a new one. Since you aren&#39;t requesting any new scopes, if you set \" ;prompt=none \" ;, you might get away with the user not being asked re re-authorize.", "623" ], [ "Your code doesn&#39;t specify a redirect_url. I suspect that the Java library is making the assumption that if you don&#39;t specify a redirect_url, it&#39;s because you don&#39;t have one, so it defaults to a fake URL. It looks like you&#39;ve copy/pasted the Quickstart code which says at the top of the page \" ;a simple Java **command-line** application \" ;, whereas I think you&#39;re building a web server application.\r\n\r\nSooo, dig into the Java OAuth library docs (good luck - try _URL_0_) and see where to set the redirect URL to your `ttp://localhost:8080/CommunityUmcPasadena/Callback`", "741" ], [ "I think you&#39;re placing too much emphasis on the word \" ;method \" ;. \r\n\r\nThere is still a link to export a file, it&#39;s `_URL_0_`. Make sure you URL encode the mime type.\r\n\r\nEg\r\n\r\n _URL_2_\r\n\r\nThese links form part of the API, so the expectation is that you&#39;ve written a client that sends **authenticated** requests, and deals with the response data. This explains why, if you simply paste the link into a browser without an `access_token`, it will fail. It also explains why the filename is `export`, ie. it isn&#39;t intended that your client would ever use a filename, but rather it should receive the data as a stream. This SO answer discusses the situation in more detail _URL_1_", "833" ], [ "It&#39;s happening because the file meta data is being updated asynchronously and there is nothing you can do to rectify it because it isn&#39;t a fault.\r\n\r\nIf you explain why this causes you a problem, there may be an alternative approach. Eg:-\r\n\r\n 1. Use the revisions feed \r\n 1. Use the changes feed \r\n 1. For non-Google files, you can use the md5sum \r\n 1. If you are happy to use the v2 API, you can\r\n use etag\r\n 1. Use the Properties feature to \" ;tag \" ; the file manually with an increment or timestamp", "871" ], [ "Firstly, and before you do anything else, make sure you understand that **Service Accounts can only impersonate users within their own Gsuite domain. They cannot impersonate <EMAIL_ADDRESS> users**.\r\n\r\nAssuming that you do indeed want to impersonate a Gsuite user, \r\nsee _URL_0_ which says \r\n\r\n > If you have delegated domain-wide access to the service account and\r\n > you want to impersonate a user account, specify the email address of\r\n > the user account using the method setSubject:\r\n > \r\n > $client- > setSubject($user_to_impersonate);", "103" ], [ "Try changing \r\n\r\n`var param={}` \r\n\r\nto \r\n\r\n`var param={q: \" ;mimeType=&#39;application/vnd.google-apps.folder&#39; and trashed=false \" ;}`\r\n\r\nWith all due respect to the authors of the library you are using, be very careful. Either a library deal with **all** of Drive&#39;s subtleties (eg. following nextPageTokens) or it will cause you problems. The Drive REST API is a very well formed API, and you could just as easily access it using Fetch, which, being Promise based, makes for much cleaner code and allows you to use `async await`.", "477" ], [ "Assuming that what you&#39;re looking to do is test your app, rather than test the OAuth dialogue, then there is an easier approach.\r\n\r\nFirst an OAuth refresher, the whole point of doing all the OAuth stuff is that you end up with an Access Token that you can include as an \" ;Authorization: Bearer xxxxx \" ; HTTP Header with your Google API (eg. Drive, YouTube, Calendar, etc) requests. Sooooooo, if you had an Access Token, you could bypass all the OAuth stuff and your app will be active and able to be tested.\r\n\r\nSo, what you want is an automated way to get an Access Token. That&#39;s pretty simple. Somewhere, either in your app code or in your Protractor preamble scripts, you need to ingest a Refresh Token, and use that to generate an Access Token which is available to your app.\r\n\r\nI do this with a file `refreshtoken.js` which I carefully do NOT check in to git for security reasons. `refreshtoken.js` is\r\n\r\n var refreshtoken= \" ;1x97e978a7a0977... \" ;;\r\n var client_id= \" ;423432423@gfgfd \" ;;\r\n\r\nIf you look at the answer to _URL_0_, you will see the steps to get a Refresh Token, and at the bottom, some JavaScript to show how to use the Refresh Token to fetch an Access Token. It might look like a lot of steps, but you only ever do them once, so it&#39;s not too onerous.\r\n\r\nThis approach bypasses OAuth, so isn&#39;t the answer if it&#39;s specifically OAuth that you want to test. However it does allow you to test your app in a much more robust manner. It also has the benefit that it can be used for Karma unit testing as well as Protractor e2e testing.", "623" ], [ "@fommil I followed the instructions yesterday and they work *exactly* as stated - INCLUDING STEP 4! The result is a Refresh Token which can be used in ANY app - web, embedded, installed, HEADLESS SERVER, IoT. Instead of choosing \" ;other \" ; you should have chosen \" ;Web Application \" ;. IT DOES NOT MATTER THAT YOU DON&#39;T THINK YOU&#39;RE WRITING A WEB APP - JUST CHOOSE \" ;Web Application \" ;. I&#39;ve updated the answer to reflect the latest jargon changes in the dev console.", "623" ], [ "@fommil Google&#39;s tools seem to work fine for everybody else. The Dev Console has been rewritten at least twice since the video was made, so some of the jargon and UX has changed, but the principles are identical, the solution is identical, and the result is identical. A lot of people get confused (it seems you included) by the phrase \" ;server-to-server \" ;. That is specifically for Service Accounts (aka \" ;robot accounts \" ;) using two-legged OAuth.", "623" ], [ "You are saying that all users login to the same Google account?\r\n\r\nIn that case you have 2 options.\r\n\r\n1/ write a server application that has a stored refresh token. Create an endpoint that allows an authenticated user to request an access token.\r\n\r\n2/ embed a refresh token in your JavaScript, but make sure that only authenticated users can load the JS", "623" ], [ "See _URL_1_ for the available video metadata. Specifically:-\r\n\r\n > videoMediaMetadata\tobject\tAdditional metadata about video media. This\r\n > may not be available immediately upon upload.\t\r\n\r\n > videoMediaMetadata.width\tinteger\tThe width of the video in pixels.\t\r\n\r\n > videoMediaMetadata.height\tinteger\tThe height of the video in pixels.\t\r\n\r\n > videoMediaMetadata.durationMillis\tlong\tThe duration of the video in\r\n > milliseconds.\r\n\r\nI suggest you use the \" ;try it now \" ; facility of _URL_0_ to get a file and see if the vailable meta data is what you are looking for.", "261" ], [ "From _URL_1_\r\n\r\n FilesResource.ListRequest listRequest = service.Files.List();\r\n listRequest.PageSize = 10;\r\n listRequest.Fields = \" ;nextPageToken, files(id, name) \" ;;\r\n\r\n // List files.\r\n IList < Google.Apis.Drive.v3.Data.File > files = listRequest.Execute()\r\n .Files;\r\n\r\nThis will list all files. To list files within a given folder id (ie. its children), refer to _URL_0_ and add \r\n\r\n listRequest.Q = \" ;&#39;my_folder_id&#39; in parents \" ;;", "523" ], [ "I presume by \" ;download \" ;, you want to avoid the delay while the entire file is fetched before the user sees the first video frames. The only approach I can think of is to chunk the downloads using standard http chunking between Laravel and Drive, and then echo that in the http session between your Angular app and Laravel. NB I haven&#39;t tested this, but I believe chunking is supported by Drive.", "381" ], [ "I spotted this \" ;Restart uploads if a 404 Not Found error is received after attempting to resume or upload a chunk. This indicates the upload session has expired and must be restarted from the beginning. Upload sessions expire after 1 week of inactivity. \" ; So it could be that Drive is interpreting your PUT as a continuation, rather than a new request. Try setting the \" ;optional \" ; headers. If that fails, try including an empty metadata object in the body.", "861" ], [ "You haven&#39;t included an http `Authorization` header, so your app is unauthorised. There is a daily limit for unauthorised apps which happens to be zero.\r\n\r\nI suggest:-\r\n\r\n1/ read about Google OAuth and how to authorise apps and make authenticated requests.\r\n\r\n2/ learn to search for existing questions on StackOverflow. This question has been asked and answered many times, eg _URL_0_", "594" ], [ "and this is why I don&#39;t like libraries! \r\n\r\nThe documentation should describe how errors are presented, ideally at _URL_0_\r\n\r\nTo confirm if the insert succeeded, checking `file` for a string in the `id` property would suffice. Unfortunately that doesn&#39;t answer your next question which will be \" ;if there is an error, how do I find out what it is, so I can deal with it correctly? \" ;.\r\n\r\nHopefully somebody who&#39;s used the Python lib can provide more info.", "347" ], [ "The redirect URL in your app and the redirect URL you configure in the API console must be an exact character-for-character match. Remember you can configure multiple redirect URLs in the APi Console, so don&#39;t be shy and add all possible variants, eg with both http and https. You should really be using https for a redirect URL and I wouldn&#39;t be surprised if a future change disallowed plaintext URLs.", "250" ], [ "I don&#39;t understand why you think it&#39;s only accessible using an SDK. The link you posted clearly shows the URL endpoint, lists the optional parameters and gives the format of the JSON response.\r\n\r\nIf you click \" ;Try it now \" ; and open your browser console, you will see the http request and response which you can mirror in your app.\r\n\r\nThe only thing you also need to consider is that before making a REST request to Google, you must obtain an Access Token and set it in an `Authorization: Bearer xxxxxxxx` header, or provide it as a query parameter as ` & access_token=xxxxxxxxx`", "88" ], [ "Have a look at the `$file` object returned by `$file = $this- > service- > files- > get($fileID)`. My guess is that it it contains a bunch of fields that are not defined as writeable at _URL_0_\r\n\r\nSo when you send the same $file object to Drive in `$file = $this- > service- > files- > update($fileID, $file,`, Drive is objecting to their presence. Since you are only updating the content, you can send an empty meta data object in place of $file.\r\n\r\nAlso, as <PERSON> pointed out, the quickstart you are following is labelled as v2, but if you are using the latest PHP library, that has probably changed to v3. Whether or not that affects the quickstart is anybody&#39;s guess.", "434" ], [ "You are probably looking for the properties in the returned file resource. \r\n\r\nThe reason they aren&#39;t there is that Drive only returns a small number of the file properties (name, mime type, id). If you want to see the full file resource you need to include `fields=*` in the request. So a correct request would look something like \r\n\r\n`POST _URL_0_`\r\n\r\nI don&#39;t know the PHP library, so you&#39;ll need to figure that bit out. It will be something like\r\n\r\n `&#39;fields&#39; = > &#39;*&#39;,`", "132" ], [ "You can&#39;t set an arbitrary unique ID. You have two options\r\n\r\n1. **Leave it null.**\r\nThe most common mechanism is to not set any ID at all. When you create the file, Google Drive will create an ID and return in `_URL_1_`.\r\n\r\n2. **Request a cache of IDs.**\r\nYou can use _URL_2_ to fetch some IDs which are then reserved for you to use. You can set one of these IDs in your `_URL_3_`.\r\n\r\nHowever, I suspect your real problem is that you have yet to understand the significance of the file ID vs the file name. In Google Drive, **files are identified by their ID, not their name**. A filename is simply a property of a file, just like modified date and mime-type. If you 10 creates, you will get 10 files. If those creates all had the same name the, guess what, each of the 10 files will have the same name.\r\n\r\nIf it is your intention to update the same file, rather than create a new one, then you should be using _URL_0_ instead of Create.", "43" ], [ "My code consumes an API from XYZ which is being served through CloudFlare. From time to time, the XYZ server is overloaded and the CloudFlare - > XYZ connection times out. When that happens, I get a human readable HTML page from CloudFlare.\r\n\r\nIs there anything I can include in my HTTP request to tell CloudFlare that I am an App, not a person, and to report any errors in a JSON response?", "311" ], [ "I&#39;m running a batch Geocode from JavaScript using the Google Maps JS library (_URL_0_).\r\n\r\nInevitably I&#39;m getting an intermittent OVER_QUERY_LIMIT response, so I&#39;m looking at the best algorithm to use to ensure maximum throughput. I&#39;ve read the \" ;10/sec \" ; and the \" ;wait 2s then try again \" ; from the docs.\r\n\r\nHere&#39;s the question...\r\n\r\n**Looking at the network monitor in the dev console, it seems that the OVER_QUERY_LIMIT failures are NOT coming from the server. All of the requests that get through to the server are being resolved correctly. So, is the Google JS library doing its own throttling and returning that OVER_QUERY_LIMIT, and if so, what algorithm is it using to throttle?**\r\n\r\nI ask because the throttling I&#39;m seeing doesn&#39;t appear to make any sense so I&#39;m considering bypassing the library and using my own server API calls.", "966" ], [ "I don&#39;t have an issue! I have a simple question - Is the JS library throttling? The pattern I&#39;m seeing is a progressively higher proportion of my Geolocates fails OVER_QUERY_LIMIT. If I wait 20 minutes and repeat, I still get a higher number of OVER_QUERY_LIMIT failures than I would expect. However, IF I RELOAD THE BROWSER, I get high throughput with few failures. So all the evidence points to the JS library keeping count and doing its own throttling. If you know the answer, please share. If not, just say so.", "966" ], [ "@Dr.<PERSON> many thanks. I&#39;ll add a bounty tomorrow to see if anybody has any more details on the algorithm that is used. My testing shows it to be pretty brutal, eg after a few hundred geolocates it drops to one success every 20-30 seconds. I&#39;m advising my customer to go away and rethink, but you know what customers are like :-(", "966" ], [ "My app requires complex steps within the UX to reach some of its many states. This is making the dev/test cycle extremely cumbersome for simple layout changes which have to be visually verified for a wide range of states.\r\n\r\nSo, I&#39;m looking into the practicality of taking a dump/snapshot of the running app (ie. window.angular, or perhaps $rootscope) in such a way that I can quickly restore from that snapshot, run a $rootscope.$digest() and et voila. \r\n\r\nAny suggestions on how this can be achieved?\r\n\r\nI&#39;m not looking for a restored snapshot to be functional, eg it needn&#39;t have active watchers or broadcast subscriptions. It just needs to faithfully render a view for visual inspection.\r\n\r\n\r\n\r\n**--edit--**\r\n\r\nI&#39;m starting to think this can&#39;t be done.\r\n\r\n\r\nWhat I have come to realise is that all of my Angular projects from now on will have a single service called VmStateService, and basically, every single item of VM data that affects the rendered view **must** live in this single service, which is injected into every controller. That way I only have a single, clean object (it has no functions), that I can dump to a string, or save to local storage, and restore to create any view that I want to test.\r\n\r\nI guess it&#39;s unfortunate that everybody learns AngularJS by doing $scope.foo = \" ;bar \" ;, and then spends the rest of their career realising what a mess that creates.", "586" ], [ "SUMMARY:\r\n\r\nOn Monday 7 December 2015, 1.29% of Google App Engine applications received errors when issuing authenticated calls to Google APIs over a period of 17 hours and 3 minutes. During a 45-minute period, authenticated calls to Google APIs from outside of App Engine also received errors, with the error rate peaking at 12%. We apologise for the impact of this issue on you and your service. We consider service degradation of this level and duration to be very serious and we are planning many changes to prevent this occurring again in the future.\r\n\r\nDETAILED DESCRIPTION OF IMPACT:\r\n\r\nBetween Monday 7 December 2015 20:09 PST and Tuesday 8 December 2015 13:12, 1.29% of Google App Engine applications using service accounts received error 401 \" ;Access Denied \" ; for all requests to Google APIs requiring authentication. Unauthenticated API calls were not affected. Different applications experienced impact at different times, with few applications being affected for the full duration of the incident.\r\n\r\nIn addition, between 23:05 and 23:50, an average of 7% of all requests to Google Cloud APIs failed or timed out, peaking briefly at 12%. Outside of this time only API calls from App Engine were affected.\r\n\r\nROOT CAUSE:\r\n\r\nGoogle engineers have recently carried out a migration of the Google Accounts system to a new storage backend, which included copying API authentication service credentials data and redirecting API calls to the new backend.\r\n\r\nTo complete this migration, credentials were scheduled to be deleted from the previous storage backend. This process started at 20:09 PST on Monday 7 December 2015. Due to a software bug, the API authentication service continued to look up some credentials, including those used by Google App Engine service accounts, in the old storage backend. As these credentials were progressively deleted, their corresponding service accounts could no longer be authenticated.\r\n\r\nThe impact increased as more credentials were deleted and some Google App Engine applications started to issue a high volume of retry requests. At 23:05, the retry volume exceeded the regional capacity of the API authentication service, causing 1.3% of all authenticated API calls to fail or timeout, including Google APIs called from outside Google App Engine. At 23:30 the API authentication service exceeded its global capacity, causing up to 12% of all authenticated API calls to fail until 23:50, when the overload issue was resolved.", "594" ], [ "You&#39;re right. Like many apps that we end up inheriting \" ;I wouldn&#39;t start from here \" ;. Just to clarify what I&#39;m looking for, it&#39;s not the logic that I&#39;m testing (got that covered with Karma), it&#39;s the rendering. Let&#39;s say I have a table, I need to be able to quickly see that table with 0, 1 a screenfull, more than a screenfull of rows. I need to see it with very short data strings, and also very long strings. I need to be able to see it in multiple languages. I also need to be able to see it in a variety of skins (we support skinning). So it&#39;s all &#39;bout the view, &#39;bout the view...view...view", "395" ], [ "Hi <PERSON>. You&#39;ve missed the point of the question. I have Karma and Protractor providing logic testing already. I&#39;m NOT looking for another testing tool. I&#39;m looking for a tool to supplement that by allowing me to quickly restore to any given model state, so I can visually inspect the aesthetics of the rendered view.", "726" ], [ "** \" ;I&#39;m not trying to access the users drive, (right, I&#39;m accessing my own) \" ;.** \r\n\r\nBut\r\n1/ how does Google know it&#39;s you?\r\n2/ how does Google know that the app is one that you have granted permissions to?\r\n\r\nThe answer to both questions is OAuth, assuming that you want to access the files using an app. \r\n\r\nSo the pseudo code for your app will look something like.\r\n - get an Access token\r\n - use that access token to get the parent folder. save its ID\r\n - use the ID of the parent folder to get the contents of all of its children", "594" ], [ "**How should I keep the access_token valid?** \r\nYou can&#39;t. It will expire as sure as eggs is eggs. All you can do is get a replacement.\r\n\r\n**Is it possible to check it before making a request, or should I just try to make a request and renew it if error?**\r\n\r\nYou can check it by referring to the expiration time(1), or try and catch the 401 exception(2).\r\n\r\n**Or maybe set up a cronjob that renews all the access_tokens?**\r\n\r\nYep (3)\r\n\r\nCongratulations, you&#39;ve won a prize by enumerating all three access token refresh policies :-). As to which one should you use, it depends. You need to decide if speed, user experience, or network bandwidth matter most to you. By far the safest is to catch the 401, and refresh, because that deals with all eventualities. With that in place, you may decide to speed things up by doing a refresh after 3550 seconds.\r\n\r\n\r\n**The expires_in field, is it seconds?**\r\n\r\nYes\r\n\r\n**Can an access_token expire before this value?**\r\n\r\nGood question. I&#39;m going to say yes, if the user withdraws permission to the app. Otherwise no.", "623" ], [ "**The email is in \" ;2015/North/City 1 \" ; in Gmail and want to save it in the identical folder structure in Google Drive** \r\n\r\nThe pseudo code is:-\r\n\r\n 1. Find \" ;2015 \" ;\r\n 2. If not exists, create it\r\n 3. Save ID of 2015\r\n 4. Find \" ;North \" ; with a parent of 2015&#39;s ID \r\n 5. If not exists, create it\r\n 6. Save ID of North\r\n 7. Find \" ;City \" ; with a parent of North&#39;s ID \r\n 8. If not exists, create it\r\n 9. Save ID of City\r\n 10. Create your email with City&#39;s ID as its parent\r\n\r\nIt&#39;s also possible to fetch all folders in a single query, and then construct your own hierarchy in memory, but since you&#39;re using AppScript, network latency shouldn&#39;t be a big deal.", "43" ], [ "The github project I pasted, pretty much does what you&#39;re looking for. You can do two things with it. Firstly, you can install it somewhere and run it standalone from cron. It isn&#39;t a library, it&#39;s an executable application. Secondly, feel free to read the code and extract the logic into whatever programming language you choose.", "153" ], [ "<PERSON> welcome to SO. Noobs are an important constituency in any community and your role within SO is no exception. I guess reaching 2,000 rep gives you some kind of buzz, so congrats on that. Thank you for taking the time to comment on a subject, about which you have no practical experience, or contribution to make. If you read the OP&#39;s question (before the later edit to add \" ;in php \" ;, which is a red herring anyway), and then match it to the readme of the cited git repo, you will see that it&#39;s a pretty close match. ie. the code in the repo does what he&#39;s asking for.", "434" ], [ "You could have a look at _URL_1_ which provides Drive integration for AngularJS. It includes support for resumeable uploads and chunked uploads so you can display a progress bar for large files.\r\n\r\nThere is a demo app at _URL_0_.\r\n\r\nThe demo snippet for a file upload is \r\n\r\n DriveService.files.insertWithContent(\r\n {\r\n title: &#39;myfile.txt&#39;,\r\n mimeType: &#39;text/plain&#39;\r\n },\r\n { uploadType: &#39;resumable&#39; },\r\n content,\r\n undefined).promise\r\n .then(function (resp) {\r\n console.log(&#39;finished&#39;);\r\n }, function (reason) {\r\n console.warn(&#39;upload failed because &#39;+reason);\r\n }, function (position) {\r\n console.log(&#39;Uploading... Currently at &#39; + position);\r\n });", "973" ], [ "It sounds like you have used a Service Account and so the credentials you are using and hence the one file you are seeing, belong to the Service Account, **not** your user account. Some ways to confirm:-\r\n\r\n 1. Check the created date of the file. If it was the same date as you generated the credentials, it&#39;s a Service Account.\r\n 1. Check the owner of the file. \r\n 1. Get the About resource _URL_0_\r\n\r\nUnfortunately, the Google documentation leads people to conclude that Service Accounts are a convenient way to bypass OAuth in order to get to your files, whereas it should say in large red letter \" ;SERVICE ACCOUNTS ARE **NOT** THE ACCOUNT YOU THINK THERE ARE!!! \" ;\r\n\r\nYou have 2 choices:-\r\n 1. Share all the files you want to access with the Service Account\r\n 1. Stop using Service Accounts and follow the steps in the last link you posted (_URL_1_) to access your regular account directly", "708" ], [ "take a step back and make sure you understand that OAuth and the Drive API are two different things, connected by an Access Token. OAuth (2 legged Service Account or 3 legged User Account) will produce an Access Token. OAuth doesn&#39;t care what you do with that token. GDrive needs an Access Token (unless the files are public). GDrive doesn&#39;t care how you got that token.", "623" ], [ "The most likely reason for it not working is that you have failed to deal with the asynchronous nature of JavaScript. Your statements will execute something like:-\r\n\r\n get_metadata\r\n get_metadata\r\n get_metadata\r\n get_metadata\r\n get_metadata\r\n get_metadata\r\n get_metadata\r\n get_metadata\r\n names.push\r\n get_metadata\r\n get_metadata\r\n names.push\r\n\r\nSecondly, your function param is `fileId` but this is never used in the function body. Instead you are using `id`.\r\n\r\nIt&#39;s worth looking at option 3 of _URL_0_ which means you can do what you are trying to do in a single GDrive API call.\r\n\r\nSo, with the best will in the world, you have a lot of JavaScript learning you need to do.", "706" ], [ "The fix that you are looking to implement from your question only deals with a specific scenario, ie webviews. Somehow you need to determine if that&#39;s what is going on. You&#39;re http server logs should tell you which browsers are being used. You might need to around your problem by giving your users instructions to copy paste the link into a supported browser instead of clicking the link from chat.", "861" ], [ "Firstly, `com.google.api.services.drive.model.File myFile = new com.google.api.services.drive.model.File();\r\nmyFile.getDownloadUrl();` makes no sense. You are trying to assign a String (the return value of getDownloadUrl()) to a File object. \r\n\r\nHowever, the compiler hasn&#39;t got round to complaining about this yet because it can&#39;t find the `downloadUrl()` method signature. My guess is that you are using the wrong jar file for the API. In this case I think you&#39;re trying to use the v2 API but have probably downloaded the v3 jar. It is better to follow the Google documentation rather than copy/paste code from StackOverflow.", "381" ], [ "The Google user ID is encoded as the `sub` of the JWT returned from the call to exchange the Auth Code for tokens. You&#39;re using the Java client library which obfuscates everything, so where the JWT token is exposed is anybody&#39;s guess. My personal advice is discard the library and just call the two OAuth URLs directly. \r\nThe steps are:-\r\n\r\n 1. Construct the OAuth request URL containing your client ID, scopes and callback URL\r\n 1. Redirect to that URL\r\n 1. When the browser redirects back to your callback Servlet, call the token endpoint to request the tokens including the identity.\r\n\r\nThis is all described really well at _URL_0_\r\n\r\nNb, you need to include the `email` scope as well as the appropriate Drive scope(s).", "623" ], [ "Batch does not support media uploads. It can only be used for metadata operations. Therefore it is *not* an option for the OP. Moreover, the batch does not succeed or fail. Rather each individual request succeeds or fails and the batch response is a multipart mime document with a part for each request indicating the success or failure of that request. Batch is nearly always a bad idea as it complicates the codebase with no benefit in return.", "1007" ], [ "from _URL_0_ \" ;Google Drive does not support batch operations for media, either for upload \" ; and \" ;Response to a batch request: The server&#39;s response is a single standard HTTP response with a multipart/mixed content type; each part is the response to one of the requests in the batched request \" ;.\n\nBatch achieves nothing towards the OP&#39;s requirement, and introduces unnecessary complications. Please remove it from your answer which is otherwise correct.", "261" ], [ "Using batches increases the probability of hitting 403 rate limits because the batch is unpacked in the front-end server and then each individual request is fired at Drive without any flow control. So all in all, Batch adds masses of complexity to the OP for zero benefit. Finally, your statement that an individual failure causes the batch to fail remains incorrect and will lead the OP down the wrong path for his error handling. For these reasons I am forced to downvote your answer. I&#39;ll happily turn that into an upvote for the first part of your answer once you remove the Batch suggestion.", "1007" ], [ "The standard way to achieve this would be to have the files&#39; host server support CORS. I&#39;m guessing that they don&#39;t and you have no control over them.\r\n\r\nDrive does not have an upload from URL capability, so that&#39;s not an option.\r\n\r\nPerhaps the most elegant solution would be for you to implement your own Drive proxy endpoint that accepts a source URL, fetches the content from that URL into a buffer, then uploads that buffer to Drive. Such a proxy would be fairly simple to write ( < 50 lines of code) and could be hosted in a serverless environment such as Appengine, AWS Lambda, etc.", "43" ], [ "A couple of pointers\r\n\r\n 1. You need to differentiate between a content/media sync vs a metadata sync. Eg. if I rename a file, I only want to sync the new filename, not the file content. Therefore you need two status flags. If you use the V2 API, you can use ETAGs, but they have disappeared in v3. So you might want to use MD5 checksum to detect changes.\r\n 2. You&#180;ll need to deal with sub-folders, either with recursion or by using a universal parent folder.\r\n 1. Guard against sync-loops when you update a local file, sync to a GDrive file, which then shows up as a change on GDrive and triggers a download.\r\n 1. SyncAdapters are your friend, even though they seem hostile at first.", "510" ], [ "Your symptoms are consistent with using `drive.file` scope instead of `drive`. Is it possible that you granted access using `drive.file` and haven&#39;t yet repeated the grant procedure with `drive`?\r\n\r\nThe other possible explanation is that you are in two different Drive Accounts. Many people use a Service Account because the Google docs refer to this as server-to-server, without realising that the Service Account is a totally different account to their User Account, ie. the one with the Drive UI. So your app will be uploading and reading files in the Service Account, your UI-created files are in your User Account.", "594" ], [ "saying you understand OAuth, and then getting the tokens wrong, isn&#39;t a great look :-) You&#39;ve got your Refresh Token and Access Token the wrong way round. You say you got an error, but don&#39;t say what that error is. Having read the question 3 times, I&#39;m still unclear what it is that you are trying to do that differs from the standard OAuth flow, and why. Try explaining your use case in a bit more detail so we can help.", "623" ], [ "Both Service Account and a stored OAuth Refresh Token are viable approaches. Each has its pros and cons.\r\n\r\nA Service Account will work where your users only need to grant access to a specific folder which they can share to the SA. Be aware that any files the SA creates are owned by, and consume quota of, the SA. You can&#39;t \" ;share the user&#39;s Drive account to the SA \" ;, you can only share individual folders.\r\n\r\nStoring a RT is the more permissive option. You wouldn&#39;t use the OAuth playground as described in my answer that you referenced as that&#39;s far to clunky to ask users to go through. Instead you would need to write your own registration/authorisation service (you can use AppEngine, Lambda, etc - so it&#39;s not difficult to write and host).", "43" ] ]
477
[ 11919, 18182, 19197, 13997, 7660, 3734, 3222, 15951, 6040, 3306, 15202, 12856, 10681, 2542, 4936, 10074, 14628, 3712, 461, 14638, 3325, 12822, 19414, 2404, 5163, 6584, 8991, 4840, 7009, 6114, 14219, 3520, 3676, 9694, 8932, 866, 695, 19371, 6132, 5994, 1, 9510, 6737, 507, 8917, 3794, 1388, 13947, 17772, 8616, 2675, 1264, 13835, 2733, 1082, 19610, 8111, 15519, 7385, 2430, 17346, 10800, 13175, 7088, 4709, 8778, 18448, 9866, 17707, 1095, 13008, 3129, 13062, 10803, 18184, 4313, 13689, 10134, 13240, 16892, 16741, 5735, 16483, 6999, 2083, 3096, 5526, 8419, 10680, 4730, 3681, 16875, 4295, 16102, 5946, 4694, 4586, 3603, 14855, 8902, 12194, 15367, 18088, 1833, 14543, 10468, 18135, 13181, 16241, 4060, 13456, 16647, 4157, 19367, 19639, 6234, 780, 14483, 2669, 14685, 8014, 9482, 4798, 5326, 17611, 4980, 3067, 1054, 9727, 3663, 14071, 14, 2255, 1284, 4812, 16031, 10606, 17310, 13763, 17025, 5728, 18276, 9364, 15098, 7920, 18402, 11324, 7182, 19372, 5485, 16227, 12715, 16667, 7157, 363, 8877, 6573, 19215, 17766, 2415, 1519, 46, 649, 19708, 18744, 16159, 5546, 15569, 18678, 10879, 10483, 14378, 15217, 3127, 2719, 5414, 5971, 7655, 11800, 9558, 14610, 4997, 3722, 2166, 6160, 19547, 11611, 15168, 5454, 13516, 1448, 8034, 11967, 13038, 17878, 12135, 2744, 1648, 17213, 15244, 14376, 3282, 14331, 4548, 9086, 3350, 7354, 7842, 19680, 15953, 7143, 16364, 3812, 16895, 8613, 9345, 15675, 18445, 1624, 11935, 6359, 6774, 9168, 10041, 126, 18444, 18586, 711, 3971, 11491, 10094, 15075, 17516, 16620, 13880, 3731, 10854, 7331, 10423, 1790, 538, 18376, 7525, 15642, 1746, 8958, 4447, 5520, 5475, 18676, 1978, 8041, 6941, 12002, 9961, 17799, 2493, 6065, 15729, 10441, 6343, 11573, 16639, 17252, 12772, 817, 9888, 8226, 7685, 16693, 10200, 14931, 1027, 6545, 18001, 14919, 3648, 17375, 9899, 4021, 9359, 2262, 1641, 10455, 4333, 16900, 12447, 97, 7769, 1771, 12932, 11852, 2693, 11167, 16773, 88, 2742, 5883, 3091, 12035, 2005, 4727, 14357, 17498, 6517, 9052, 11732, 5673, 17913, 19462, 15226, 6552, 9307, 20, 8516, 11635, 16051, 4501, 18279, 6565, 2181, 14098, 350, 11122, 9473, 2715, 4776, 16691, 7490, 7406, 11749, 8008, 9023, 7033, 5605, 9832, 13411, 8024, 8595, 6344, 4629, 10999, 10685, 16044, 4204, 1780, 14922, 18090, 5613, 6300, 13384, 18915, 9165, 10464, 18857, 16987, 9323, 16091, 18109, 1100, 17412, 924, 5094, 19185, 4739, 17030, 16069, 9062, 5033, 4611, 1425, 3240, 14095, 9450, 18116, 2001, 2256, 3928, 8647, 371, 8056, 16960, 13093, 4273, 12569, 584, 16171, 1092, 7010, 7071, 15773, 5581, 19074, 19231, 5641, 7465, 2458, 14695, 15770, 11559, 14273, 4546, 2897, 12489, 14093, 19032, 17056, 19334, 2563, 4299, 4444, 7541, 10361, 15059, 2583, 9355, 13311, 14428, 5545, 1314, 6206, 5490, 12926, 18347, 15310, 15986, 8050, 16785, 16904, 13906, 3810, 6826, 18748, 8813, 1489, 15356, 1229, 14382, 13109, 7996, 4578, 12179, 5161, 8352, 17566, 16348, 18758, 7494, 13846, 1294, 6168, 16442, 6903, 15964, 13809, 12524, 13140, 12455, 8860, 17937, 4226, 5011, 7500, 13566, 257, 6453, 13871, 5319, 1665, 17360, 1259, 4186, 9313, 4478, 12222, 6310, 13087, 6514, 5692, 18667, 5715, 11945, 7077, 16906, 11229, 6212, 15334, 17941, 17048, 2000, 1627, 19625, 1295, 8251, 4781, 6143, 17388, 13295, 12158 ]
STX_10008.0
[ [ "I don&#39;t really see the intent of the question, but I will give a stab at it anyway.\r\nFor a start, there is no silver bullet, if you want shadows, you need to some form of shadow test. Commonly in current hardware this is achieved with shadow maps. But there are a few \" ;hacks \" ; that can be used to speed up the entire process.\r\n\r\n**Deferred Rendering**\r\n\r\nSpeeds up the rendering of large amount of light sources. Normally with forward rendering you have to render each geometry (G) for each light (L), resulting in cubic complexity. O(G*L) Deferred rendering allows you to render the geometry once and each light separately, resulting in linear complexity. O(G+L) The only downside here is that you need to have some special handling for transparency. But if you want to do that properly, you need to do it separately anyway.\r\n\r\n**Baked Light & Shadow Maps**\r\n\r\nOne trick that the Unreal Engine uses a lot, is pre-computing or baking the lighting information for everything static. The engine separates the geometry and lights into static and dynamic items. \r\nStatic lights on static geometry are backed into a light map with lightmass. This uses a high quality global illumination solution and results in nice looking shadows. They are \" ;free \" ; since they are just blended onto the geometry in the standard render pass.\r\nEverything dynamic computes a shadow map on the fly. The renderer then decides based on the dynamic / static light and geometry if to apply shadows or not. But since the number of dynamic objects tend to be few, this works quite well.\r\n\r\nIf you can live with dynamic objects not casting shadows, you can pre-compute the shadow map from all static lights.", "371" ], [ "If battery life is the most important factor, you should move away from LDO regulators and go switched instead; at the cost of increased noise and complexity.\r\n\r\nBy design, linear regulators waste power to drop voltage down to an intended level. This is rarely a good idea in a battery-powered environment. You can get integrated PMICs that will condition your rails from a battery source and offer other features such as protection, brown-out detection, etc. \r\n\r\nA quite simple solution is a pair of parallel switching regulators.\r\n\r\nI see that you need at least 500mA maximum output and an enable line.\r\n\r\nFor down conversion, something like the \r\n\r\n[PAM2305 series][1] ($0.91)\r\n\r\nAnd for the up conversion - \r\n\r\n[FAN4860UC5X][2] ($1.21)\r\n\r\n\r\n [1]: _URL_1_ \" ;PAM2305 series \" ;\r\n [2]: _URL_0_ \" ;FAN4860 series \" ;", "274" ], [ "One simple circuit to do what you want is a rectification circuit. The chain of sub-circuits would look like:\r\n\r\n 1. Decoupler\r\n 2. Rectifier\r\n 3. buffer + bias op-amp\r\n 4. Filter\r\n 5. LED bias.\r\n\r\n- The decoupler will remove any DC component from the waveform.\r\n- The rectifier will convert from a ground-centered 4Vpp sine wave to a 2Vpp half-sinewave.\r\n- The buffer will reduce load on the laptop and should be connected to shift up the signal to be biased such that a max amplitude will present 30mA to the LED, and a min amplitude will present 0 - for this you will need to know the forward voltage drop of the LED.\r\n- The filter will convert from the half-sinewave to a DC rail.\r\n- The LED bias will be a simple resistor.", "1020" ], [ "What you&#39;re describing is a passive attenuation circuit as a stage prior to your ADC, probably because you expect there to be some voltage exceeding the accepted range of the ADC and you want to either (1) protect it from damage, or (2) scale the data so that you can still perform ADC measurements on large voltages.\r\n\r\nFor aim (1), this is not sufficient. It is very important that you have TVS (transient voltage suppression) and/or over-voltage zener protection on every input line to your system. If it is a 5V-tolerant input at the MCU, you can connect every input line after your 10k resistor bank to a Shottky diode, each connected to 5V. This is what I consider a bare minimum for circuit protection.\r\n\r\nFor (2) (scaling your data), it seems you have two attenuation modes - the first, where you have a 20k/10k divider scaling to an equivalent 66%, and the second where you have a (20k||1k)/10k divider scaling to an equivalent 8.7%.\r\n\r\nIn the first mode, your maximum input voltage would be 7.5V. In the second mode, your maximum input voltage would be 57.5V.\r\n\r\nYou probably also want to consider stability - get some idea of how fast you expect your input to vary, and then add stabilization capacitors to all of your inputs, likely across your 20k resistors, to filter out noise.", "274" ], [ "Garuda Purana 1.115.64 \r\n\r\n > ”A barren woman shall be abandoned in the eighth year after marriage;\r\n > a woman whose children die in infancy shall be abandoned in the ninth\r\n > year; **a woman who gives birth only to daughters shall be abandoned in\r\n > the eleventh year** and a woman who speaks unpleasant words shall be\r\n > abandoned immediately.”\r\n\r\n**Yajnavalkya Smriti verse 73**\r\n\r\n > The liquor drinker, the diseased, the cunning, the barren, the killer\r\n > of wealth, the unpleasant spoken, **who bears female children should be\r\n > superseded**, so also (one) who hates people.\r\n\r\n**Manu Smriti 9.81** \r\n\r\n > A barren wife may be superseded in the eighth year, she whose children\r\n > (all) die in the tenth, **she who bears only daughters in the eleventh**,\r\n > but she who is quarrelsome without delay.\r\n\r\n**Narada Smriti 12.94** \r\n\r\n > **Let not a husband show love to a barren woman, or to one who gives birth to female children only,** or whose conduct is blamable, or who\r\n > constantly contradicts him; if he does (have conjugal intercourse with\r\n > her), he becomes liable to censure (himself).\r\n\r\n**Satapatha Brahmana 5.3.1.13**\r\n\r\n > And on the following day he goes to the house of a discarded (wife),\r\n > and prepares a pap for Nirriti;–a **discarded wife is one who has no\r\n > son**…hail!’ For **a wife that is without a son, is possessed with\r\n > <PERSON><IP_ADDRESS>**\r\n\r\n > And on the following day he goes to the house of a discarded (wife),\r\n > and prepares a pap for Nirriti;–a **discarded wife is one who has no\r\n > son**…hail!’ For **a wife that is without a son, is possessed with\r\n > Nirriti** (destruction, calamity)…\r\n\r\n \r\n\r\n**Devi Bhagavatam 2.6.36-48** \r\n\r\n\r\n > Once while he was listening to the religious discourses of the Munis,\r\n > he heard unmistakeably the Munis telling that the man who is sonless\r\n > can never go to the Heavens; so he must get a son somehow or other\r\n\r\n \r\n\r\n**Devi Bhagavatam 1.4.15-27** \r\n\r\n > **There is no prospect in the after birth of the sonless;** never, never will Heaven be his. Without son, there is none other who can be\r\n > of help in the next world. Thus in the Dharma S’&#226;stras, Manu and other\r\n > Munis declare that the man who has sons goes to Heaven and the sonless\r\n > one can never go to Heaven. The man possessing a son is entitled to\r\n > the Heavenly pleasures can be vividly seen, rather than imagined. The\r\n > man with son is freed from sins; this is the word of the Vedas…", "140" ], [ "[Manusmriti 9:17][1]\r\n\r\n > शय्याऽऽसनमलङ्कारं कामं क्रोधमनार्जवम् । द्रोहभावं कुचर्यां च\r\n > स्त्रीभ्यो मनुरकल्पयत् ॥ १७ ॥\r\n > \r\n > śayyā&#39;&#39;sanamalaṅkāraṃ kāmaṃ krodhamanārjavam | drohabhāvaṃ kucaryāṃ\r\n > ca strībhyo manurakalpayat || 17 ||\r\n > \r\n > <PERSON> assigned to women sleep, sitting, ornament, lust, anger,\r\n > dishonesty, malice and bad conduct.—(17)\r\n\r\n[Mahabharata 13.40][2]\r\n\r\n > O son of <PERSON>, women were all virtuous. Those, however, that sprang\r\n > from this creation by <PERSON> with the aid of an illusion became\r\n > sinful. The grandsire bestowed upon them the desire of enjoyment, all\r\n > kinds of carnal pleasure. Tempted by the desire of enjoyment, they\r\n > began to pursue persons of the other sex. The puissant lord of the\r\n > deities created <PERSON> as the companion of Lust. Women have no especial acts prescribed for them. Even this\r\n > is the ordinance that was laid down. The Shruti declares that **women** are\r\n > endued with senses the most powerful, that they have no scriptures to\r\n > follow, and that they **are living lies**. B**eds and seats and ornaments\r\n > and food and drink and the absence of all that is respectable and\r\n > righteous, indulgence in disagreeable words, and love of sexual\r\n > companionship,--these were bestowed by <PERSON> upon women. Men are\r\n > quite unable to restrain them within bounds.**\r\n\r\n \r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "140" ], [ "Yes your right it would. Only way to properly do it is to track via a list on SharePoint that is updated on a timer service (show user logged in or logged out). the timer service checks against server IIS logs and eventViewer logs. It should also have a check every 30 min (timer job runs every 30min, could run every 5min but need keepalive check for 30). If no logs from user reported after that time the user is considered logged off otherwise if logs keep coming in with the users account then the user is active so list is updated every time timer is run with a list of active users ;).", "981" ], [ "**Sky can fall on Earth:**\r\n\r\n**Rig Veda II.17.5** \r\n\r\n > Fast (<PERSON>) upheld the earth that nourisheth all life, and stayed the\r\n > **heaven from falling by his wondrous skill**.\r\n\r\n**Cooked articles causes rain:**\r\n\r\n**Yajur Veda III.49**\r\n\r\n > The oblation full of cooked articles put into the fire, goes up to the\r\n > sky. And returns there from full of rain.”\r\n\r\n**Yajur Veda II.16**\r\n\r\n > ”We perform the yajna for <PERSON>, <PERSON> and <PERSON>…The desired\r\n > oblation (Ahuti) reaches the space, comes in contact with air and the\r\n > light of that sun. It thence brings down rain for us…”\r\n\r\n**Earth has ends:**\r\n\r\n\r\n**Rig Veda X.58.3**\r\n\r\n > Thy spirit, that went far away, away to the **four-cornered earth**, We\r\n > cause to come to thee again that thou mayst live and sojourn here.\r\n\r\n**Earth is flat:**\r\n\r\n**Rig Veda III.6.5** \r\n\r\n > Great are the deeds of thee, the Great, O Agni: thou by thy power hast\r\n > **spread out earth and heaven.**", "140" ], [ "I provide some translation by <PERSON> here:\r\n\r\n**Atharva Veda 6.77.1** Firm stands the heaven, **firm stands the earth**, firm stands this universal world\r\n\r\n**Atharva Veda 6.44.1** Firm stood the heaven, **firm stood the earth**, firm stood this universal world. Firm stood the trees that sleep erect: let this thy malady be still.\r\n\r\n**Atharva Veda 13.1.6** …<PERSON> with his might hath established Earth and Heaven.\r\n\r\n**Atharva Veda 6.88.1** Firm is the sky, firm is the earth, and firm is all this living world;\r\n Firm are these mountains on their base, and stedfast is this King\r\n of men.", "205" ], [ "Is this possible that we make a real world transaction (buying goods/services for money) decentralised using Ethereum to avoid trust issues?\r\n\r\nExample: let&#39;s take an example of virtual currency exchange, someone is selling Bitcoins, and I want to buy, we agreed on terms and price, now he asked me to transfer money to his/her bank account. I have a fear what will happen if I move money and he is not transferring Bitcoins?\r\n\r\nCan we avoid this situation? Using a smart contract which can hold a real money and only transfer to the seller if can verify transaction on the blockchain, If not send me back.\r\n\r\nI know Escrow contracts can do same but that will hold Ethers and value of Ether can go up and down, so there is a possibility I don&#39;t get the same amount back.", "910" ] ]
367
[ 2951, 1221, 13996, 6952, 11610, 10860, 19473, 6508, 9507, 398, 1457, 13223, 7846, 16700, 18830, 8731, 3398, 5987, 3004, 1182, 11552, 16507, 11986, 278, 17536, 10618, 6135, 16610, 14221, 2374, 3916, 408, 12753, 711, 18319, 5943, 2834, 12576, 11387, 10621, 19485, 19052, 16428, 2055, 17130, 3055, 19693, 9936, 10888, 8646, 16539, 10268, 4904, 2338, 2973, 4685, 18745, 8843, 3477, 10366, 18644, 18764, 4156, 902, 3420, 9963, 4013, 19481, 8529, 18576, 17964, 18915, 17330, 170, 10871, 9018, 18855, 18782, 15076, 9745, 13003, 6286, 4612, 821, 5921, 8013, 7472, 12440, 11396, 247, 8180, 5027, 17027, 1121, 3764, 10398, 19237, 14241, 528, 18581, 3426, 18419, 3576, 2902, 360, 4941, 161, 2532, 761, 16711, 3449, 3611, 13100, 5139, 1319, 1233, 10695, 6097, 5591, 5750, 1234, 12617, 19687, 7728, 3963, 7804, 8836, 12917, 12416, 5733, 6748, 6322, 11014, 11499, 10897, 2866, 513, 1044, 7973, 19761, 3671, 4431, 3355, 15886, 11931, 5000, 2024, 19642, 9910, 3464, 8335, 4817, 15931, 13762, 8062, 1420, 8175, 6194, 13028, 7924, 716, 18869, 2658, 4959, 4956, 2369, 12096, 9763, 19470, 16040, 13685, 19477, 10962, 536, 727, 679, 18086, 5160, 15406, 7255, 13285, 13497, 5839, 9766, 9331, 5082, 436, 9234, 19169, 2480, 2609, 285, 1647, 3580, 8201, 8418, 6872, 9037, 5690, 1285, 18791, 2346, 2759, 10194, 9373, 2630, 2869, 13362, 1230, 16236, 4651, 12003, 7513, 3698, 6501, 3246, 11058, 10457, 18579, 2187, 3783, 9994, 2639, 696, 9454, 3196, 18223, 18856, 12120, 3359, 1964, 11410, 2162, 10043, 19686, 2959, 2562, 11221, 19066, 2056, 12844, 1005, 4468, 5357, 14364, 7489, 9390, 16089, 2389, 6461, 4502, 3121, 753, 828, 8983, 12944, 1847, 5425, 168, 11465, 1616, 3414, 6876, 12241, 10118, 3740, 12420, 10607, 3817, 7629, 9172, 8784, 7576, 17430, 14687, 11749, 14234, 6954, 5901, 18845, 16363, 19061, 983, 12112, 880, 15897, 1254, 9479, 7129, 19096, 15766, 4649, 4063, 11760, 2034, 3159, 18026, 6452, 1720, 2568, 5360, 14944, 12898, 15868, 1765, 19637, 9198, 10046, 9554, 9453, 17431, 7543, 768, 8850, 19698, 6532, 9178, 789, 19067, 14193, 18199, 9701, 1232, 3577, 8960, 19239, 17858, 10956, 14978, 12782, 14140, 11858, 1064, 18113, 3475, 8563, 4890, 2129, 5178, 4848, 5128, 10155, 1969, 6781, 3624, 18263, 16282, 19656, 14526, 16835, 10254, 4103, 7636, 12305, 10454, 18592, 5998, 8586, 9556, 10497, 10820, 5100, 11568, 16979, 16941, 15290, 10615, 2735, 13672, 13244, 2949, 13712, 19514, 9223, 8991, 383, 9547, 3371, 8395, 3432, 350, 18180, 16834, 4314, 18, 7655, 11182, 533, 9795, 4700, 2401, 6514, 4511, 4588, 6469, 11390, 4061, 12785, 10629, 10910, 18006, 17803, 16012, 9919, 4515, 4670, 253, 5605, 10319, 2561, 14047, 13796, 8927, 10645, 12091, 15867, 292, 5030, 9471, 13354, 10718, 16661, 17421, 16577, 8040, 10569, 7012, 13390, 4874, 15430, 19399, 808, 13316, 12450, 11015, 14676, 3422, 1120, 4566, 4729, 5068, 9344, 3787, 2123, 10044, 5657, 1927, 7483, 14246, 14414, 11573, 15059, 18238, 18262, 12533, 657, 9530, 399, 19553, 1040, 15038, 5634, 18650, 4210, 17619, 3855, 4739, 4565, 18162, 6333, 10338, 11115, 8261, 17461, 17284, 9642, 4790, 9995, 2798, 10019, 18573, 14247, 4023, 15005, 974, 9958, 1995, 5262, 16793, 8441, 7347, 19401, 17009, 4311, 832, 5421, 10948, 13669, 2987 ]
STX_10008173.0
[ [ "Docker Compose will implicitly create a private network for you, and once it&#39;s created that private network, Docker provides a DNS service that will resolve container names to IP addresses. (The explicit `networks:` declaration isn&#39;t harmful and has the same effect.) You can refer to a container by its name and by additional aliases. [Docker Compose will register aliases to reach each container under its key in the `docker-compose.yml` file.](_URL_0_)\r\n\r\nAll of this means that you can use the other container names as the values of the various `*_HOST` environment variables. Note that the ports used are the container _internal_ ports; if you&#39;re connecting to a service port that&#39;s also being published to the host, it&#39;s the port on the _right_ side of the colon.\r\n\r\nIn your example, you should specify (for different containers as appropriate):\r\n\r\n environment:\r\n - DB_SERVER_HOST=mysql-zabbix\r\n - DB_SERVER_PORT=3306\r\n - ZBX_SERVER_HOST=zabbix-server\r\n\r\nYou do not need to specify links of any sort. `depends_on` is strictly optional, but if you run `docker-compose up zabbix-web`, it will also start the things it depends on.", "324" ], [ "Since you ran\r\n\r\n docker run -p 3306:3306 ...\r\n\r\nyou should access the service via port 3306 using your host&#39;s DNS name or IP address.\r\n\r\nIn the very specific case where you&#39;re at a shell prompt or browser URL entry on the machine where you ran `docker run`, assuming you&#39;re not using Docker Machine or Docker Toolbox, in this case and in this case only, you can use `localhost:3306` to access the container. Never ever use `localhost` for anything else around Docker unless you&#39;re totally clear what it means. (If you ever start writing a question that uses the words \" ;...the localhost of... \" ; then localhost isn&#39;t what you want.)\r\n\r\nIf you are trying to reach this container from another container, since you ran\r\n\r\n docker run --name=blogdb --network=blognetwork ...\r\n\r\nyou can use the name `blogdb` as a host name, and Docker provides an internal DNS service that can resolve it to something that will reach the container.\r\n\r\nYou never want the Docker-internal IP address, and should never run `docker inspect` to try to find it. The two biggest problems with it are that it&#39;s unreachable from off-host and that it changes when the container is deleted and recreated.", "707" ], [ "> Do I really have to create another input type just to eliminate the mandatory property of the field?\r\n\r\nYes.\r\n\r\nIf there&#39;s more than the one field that&#39;s in common (same names, exact same types) between then you could break that out into a separate type that gets embedded into your input object type;\r\n\r\n input ObjectIdentity {\r\n name: String!\r\n }\r\n input ObjectInput {\r\n identity: ObjectIdentity!\r\n description: String!\r\n }\r\n\r\nbut that changes the object format (adds an extra \" ;identity \" ; object field) in a way you may not want.", "816" ], [ "In general when I&#39;ve done this sort of thing I&#39;ve found it easiest to write a Dockerfile that does exactly one thing, and to write multiple Dockerfiles if you need substantially different behavior. In the case you describe, I&#39;d expect Windows vs. Linux container setup to be so different (_every_ command will be different) that I&#39;d just write a separate Dockerfile.\r\n\r\nIf an image will be very lightly parameterized – you might want to run essentially the same thing on different JVMs, say, but the install process is the same no matter which one – ARGs can address this. You can use shell logic within an individual RUN command to make decisions based on an ARG value.\r\n\r\nIf you do need more than this, then Docker doesn&#39;t have a built-in preprocessor, but Dockerfiles are just text files, and so your choice of preprocessor or templating language (envsubst, m4, Jinja, ...) will work fine.\r\n\r\nYou can see this in some of the standard Docker images. For instance, the [openjdk](_URL_1_) image has Java 7, 8, 10, and 11; with the full JDK, the base runtime, or a stripped-down runtime; for Windows, Debian, or Alpine Linux. Within the [openjdk GitHub repository](_URL_0_) there is a separate Dockerfile for each flavor, but they are all generated by [a hairy bash script](_URL_0_/blob/master/update.sh).", "324" ], [ "I might write a decorator function for the exception handling; for instance using [functool.wraps](_URL_0_).\r\n\r\n from functool import wraps\r\n def retry(f):\r\n @wraps(f)\r\n def wrapper(*args, **kwargs):\r\n error_count = 0\r\n while error_count < 10:\r\n try:\r\n return f(*args, **kwargs)\r\n except MalformedRequest:\r\n print(&#39;Order ID not yet findable, keep trying&#39;)\r\n except InternalError:\r\n print(&#39;Order check returned InternalError, keep trying&#39;)\r\n error_count += 1\r\n time.sleep(int(1))\r\n print(&#39;Error loop, give up&#39;)\r\n return None\r\n return wrapper\r\n\r\nThen you can write a very simple API call function, and wrap it with the retry wrapper:\r\n\r\n @retry\r\n def get_order(order_id):\r\n stat_get = client.queryOrder(orderId=order_id)\r\n return stat_get[&#39;status&#39;]\r\n\r\nIn your original function, notice that you can move the contents of the `try`...`else` block into the main `try` block without affecting the logic (extracting the value from the query result won&#39;t raise one of the network-related exceptions), and then you can just return out of the `try` block instead of arranging to stop the loop. Then the contents of the `try` block are what I&#39;ve broken out here into `get_order()`. I restructured the remaining loop a little and turned it into decorator form.", "759" ], [ "(1) The image Dockerfile presumably says `EXPOSE 1433` because that&#39;s the port the server listens on; the bare `1433/tcp` output in `docker ps` means that port isn&#39;t published to the host.\r\n\r\n(2) When you `docker run -p 600:600`, you tell Docker to forward port 600 on the host to port 600 in the container. Nothing&#39;s listening on that port, so you can&#39;t connect.\r\n\r\n(3) If you `docker run -p 600:1433`, you&#39;d tell Docker to forward port 600 on the host to port 1433 in the container, where the server is listening, and I would expect this to work.", "707" ], [ "If the script is an entrypoint script, you shouldn’t need to set the username at all; a USER directive in the Dockerfile can set the (default) user name or user ID.\r\n\r\nFor this simple setup I wouldn’t use an entrypoint script at all. I’d put in my Dockerfile\r\n\r\n USER newuser\r\n CMD [ \" ;node \" ;, \" ;index.js \" ;]\r\n\r\nIn general I’d avoid entrypoint scripts or ENTRYPOINT directives that run fixed commands (and prefer CMD over ENTRYPOINT) because they make it difficult to do the otherwise very-useful-when-things-are-broken\r\n\r\n docker run --rm -it myimage sh", "103" ], [ "There are three separate similar things going on here. The file is a sequence of _bytes_, and the Python byte string `b&#39;\\xff\\xfe \" ;\\x00v\\x00e\\x00...&#39;` shows things in the same order the bytes are in in the file:\r\n\r\n FF FE 22 00 76 00 65 00\r\n\r\nWhen you ran `od -x`, it grouped pairs of bytes into _16-bit numbers_. On x86 systems the standard byte ordering for 2-byte 16-bit numbers is for the least-significant byte ( \" ;ones byte \" ;) to be first and the most-significant byte ( \" ;256s byte \" ;) to be second (in Python, `n=b[0]+256*b[1]`). So you get this _little-endian_ decoding:\r\n\r\n FEFF 0022 0076 0065\r\n\r\nMeanwhile, you want to decode this into Unicode _characters_. So long as no character is above U+FFFF, the _UTF-16 little-endian (UTF-16LE) encoding_ translates that same decoding into Unicode characters:\r\n\r\n U+FEFF U+0022 U+0076 U+0065\r\n < BOM > \" ; v e\r\n\r\nWhat happens at the end of the line? Let&#39;s consider the string `u&#39;... \" ;,\\n ...&#39;` and do this exercise in reverse order.\r\n\r\n \" ; , \\n < SPC > \r\n U+0022 U+002C U+000A U+0020\r\n 22 00 2C 00 0A 00 20 00\r\n b&#39; \" ;\\x00,\\x00\\n\\x00 \\x00&#39;\r\n\r\nMeanwhile: what happens if you don&#39;t actually think about the character encoding, and \" ;split this on newlines \" ;? You&#39;d see `[b&#39; \" ;\\x00,\\x00 \" ;&#39;, b&#39;\\n&#39;, b&#39;\\x00 \\x00&#39;]`. That looks like the first part is little-endian byte order (quote null comma null) but the last part is big-endian (null space). But the second half isn&#39;t actually a valid UTF-16 string: it contains odd numbers of bytes, because the first byte is actually the second half of the newline. That&#39;s what&#39;s happening when you call `readline`.\r\n\r\nYou have a couple of options to deal with this. One, mentioned in another answer, is to `open(filename, &#39;r&#39;, encoding=&#39;utf-16&#39;)` (without a \" ;b \" ; in the file mode). Then Python will do the correct UTF-16 decoding (taking the byte-order mark into account) and you will get a character string. Calls like `str.readline` will also do what you expect here.\r\n\r\nYou also said your goal is just to split the file. If you know with absolute certainty that the file is UTF-16LE encoded (the first two bytes are definitely FF FE) then you could process it as a byte string (with mode `&#39;rb&#39;` as in the code in the question) and split it on the UTF-16-encoded byte sequence you want\r\n\r\n everything = f.read()\r\n lines = everything.split(b&#39;\\x0A\\x00&#39;)\r\n for line in lines:\r\n parts = line.split(b&#39;\\x3A\\x26&#39;)\r\n\r\nThis is easier to do if you can read the entire file in one chunk; at 10 GB that could be tricky in Python.", "412" ], [ "Consider writing a simple state machine to do this. You have two states: you are looking for the first line in a block, or you are in a block and looking for the blank line. ( \" ;Two consecutive newlines \" ; is the same as \" ;I see a blank line when I read through the file line by line \" ;.)\r\n\r\n import enum from Enum, auto\r\n\r\n class LookFor(Enum):\r\n REPORT = auto()\r\n BLANK = auto()\r\n\r\n state = LookFor.REPORT\r\n with open(filename, &#39;r&#39;) as f:\r\n for line in f:\r\n if state == LookFor.REPORT:\r\n print(line, end=&#39;&#39;)\r\n if line.startswith(&#39;Report from&#39;):\r\n state = LookFor.BLANK\r\n elif state == LookFor.BLANK:\r\n if line == &#39;\\n&#39;:\r\n print(line, end=&#39;&#39;)\r\n state = _URL_0_\r\n\r\nThe specific code I&#39;ve written makes some assumptions about what you&#39;re looking for, and in particular that you _can_ iterate through it line-by-line; you could adapt this to make more complex decisions about what state to switch to or add additional states as suited your application.", "782" ], [ "You can&#39;t directly call binaries from one container to another. ( \" ;Filesystem isolation \" ; is also a main goal of Docker.)\r\n\r\nIn this particular case, you might consider \" ;generate a PDF \" ; as an action your service takes and not a separate service in itself, and so executing the binary as a subprocess is a means to an end. This doesn&#39;t even raise any complications since presumably `mkhtmltopdf` isn&#39;t a long-running process, you&#39;ll launch it once per request and not respond until the subprocess runs to completion. I&#39;d install or include it in the `Dockerfile` that packages your PHP application, and be architecturally content with that.\r\n\r\nOtherwise the main communication between containers is via network I/O and so you&#39;d have to wrap this process in a simple network protocol, probably a minimal HTTP service in your choice of language/framework. That&#39;s probably not worth it for this, but it&#39;s how you&#39;d turn this binary into \" ;a separate service \" ; that you&#39;d package and run as a separate container.", "324" ], [ "Use `docker build`. Really.\r\n\r\nAn image is supposed to be a static copy of your application and its runtime, and not the associated data. The statement \" ;only the jars changed \" ; means \" ;we rebuilt the application \" ;. While you _can_ use bind mounts to inject an application into a runtime-only container, I don&#39;t feel like it&#39;s really a best practice, and that&#39;s doubly true in a language where there&#39;s already a significant compile-time step.\r\n\r\nIf you&#39;re in an air-gapped environment, you need to figure out how you&#39;re going to provide application updates (regardless of the deployment framework). The best solution, if you can manage it, is to set up a private Docker registry on the isolated network, `docker save` your images (with the tars embedded), then `docker load`, `docker tag`, and `docker push` them into the registry. Then you can use the registry-tagged image name everywhere and not need to worry about manually pushing the images and/or jar files across.\r\n\r\nOtherwise you need to manually distribute the image tar and `docker load` it, or manually push your updated jars on to each of the target systems. An automation system like [Ansible](_URL_0_) works well for this; I&#39;m partial to Ansible because it doesn&#39;t require a central server.", "324" ], [ "IMHO live-editing a container and committing it is distinctly not a best practice: the Dockerfile/`docker build` system is pretty efficient and you always have a record in the filesystem or source control of what exactly went into your image, and when you need to rebuild it in six months with security updates there&#39;s no guesswork. Still, the list of commands in `docker help` might suggest something like what you&#39;re asking about.", "324" ], [ "It doesn&#39;t surprise me that a billion variable assignments take some time. This is also in the class of \" ;optimization \" ; where, unless you&#39;re seriously considering assembly as an implementation path, the clock cycle or two you save isn&#39;t going to matter at all, and you&#39;re better off focusing your performance measurement and tuning efforts elsewhere.", "659" ], [ "It looks like at the point you are executing this you will know the length of the output. In this \" ;language \" ; the input and output are consecutive in \" ;memory \" ;. So you start with:\r\n\r\n abcdefghijklmnop----------------------------\r\n | < - S - > || < - T - > |\r\n\r\nFirst `COPY` 4 bytes starting at offset 0 in the combined string:\r\n\r\n ABCDefghijklmnopABCD------------------------\r\n | < - S - > || < - T - > |\r\n\r\nThen `ADD` 4 bytes, literally `w x y z`:\r\n\r\n abcdefghijklmnopabcdWXYZ--------------------\r\n | < - S - > || < - T - > |\r\n\r\nThen `COPY` 4 bytes starting at offset 4:\r\n\r\n abcdEFGHijklmnopabcdwxyzEFGH----------------\r\n | < - S - > || < - T - > |\r\n\r\nThen `COPY` 12 bytes starting at offset 24. This is a little tricky, because offset 24 is the \" ;efgh \" ; we just wrote and we haven&#39;t written the last 8 bytes yet, but if you do it one byte at a time the overlap doesn&#39;t matter:\r\n\r\n | < - from - > |\r\n | < - to - > |\r\n abcdEFGHijklmnopabcdwxyzefghEFGHEFGHEFGH----\r\n | < - S - > || < - T - > |\r\n\r\nFinally there is a `RUN` of 4 consecutive bytes all \" ;z \" ;:\r\n\r\n abcdEFGHijklmnopabcdwxyzefghefghefghefghZZZZ\r\n | < - S - > || < - T - > |", "212" ], [ "How many packages are there? How important are the time intervals you mention? There are several approaches that come to mind:\r\n\r\n**Kubernetes [cron jobs](_URL_3_)** can run on a schedule, and presumably solve your third need. If you have \" ;some \" ; packages (I wouldn&#39;t necessarily try this with more than \" ;hundreds \" ;) then for each package you could create a new cron job which runs once then deletes itself. Cron jobs can&#39;t run more often than once a minute. If you can relax your \" ;poll once every 10 seconds \" ; requirement to \" ;poll once a minute \" ; and the number of packages is small, you could do everything this way.\r\n\r\nFor the second requirement, you can **check every package for expiration on an interval**. This works better if the \" ;after 3 hours \" ; requirement isn&#39;t particularly strict. Write a program that looks at _every_ package, and if the three-hour delay has passed, changes its state, then write a cron job that runs this every 15 minutes. The scaling issues around this are different, but \" ;find expired packages \" ; sounds like a single SQL query; it depends on your backend technology.\r\n\r\nYou can write **one long-running program that does all of the interval-based checks**. You hint at using Go, and you can set up a `time.Timer` that triggers every 10 seconds (either one for the entire program, or one per package). I would probably have the program know, in memory, each package ID, its current state, and when it needs to change state to \" ;delivering tomorrow \" ;, and run all of this in a single process. An ordinary Deployment would manage this. You should also keep this state in a database, and that might introduce some scaling limits.\r\n\r\nFinally, you can **use a message queueing system**. [RabbitMQ](_URL_2_) is a popular open-source choice for this. You can arrange for messages to be delayed (send a message to exchange `_URL_1_` that routes to a queue `package.wait` with a [TTL](_URL_2_/ttl.html) of 10 seconds, set that queue&#39;s [dead-letter exchange](_URL_0_) to `package.ready`, send that to a queue `package.out`, and have applications consume from that queue). Again you&#39;d write a long-running process; this one gets items from the queue, retrieves their state from the database, polls for their current location, and marks them as \" ;delivered tomorrow \" ; or requeues them in `_URL_1_` as appropriate. This is the most scalable answer (you can launch many workers via a Kubernetes Deployment) but also makes the least use of inbuilt Kubernetes parts.", "246" ], [ "On (1) and (2), if you have a job that runs every 10 seconds until the package is delivered, then it will run after 3 hours if the package isn&#39;t delivered yet. So a couple of my solutions combine these. In particular my description of the RabbitMQ setup basically only has a single queue where messages get delivered after a 10-second delay that does both halves. You could implement a similar queue with a 3-hour delay if you wanted. The RabbitMQ broker itself implements the delay (via the TTL/DLX trick) and the job would continuously consume messages as they become ready.", "527" ], [ "You can implement a simple job queue on Redis easily enough, especially if you use a sorted set where the \" ;scores \" ; are the Unix timestamps when the job needs to next execute. Kafka isn&#39;t quite designed for a pattern like this: you can&#39;t add delays or message requeueing like RabbitMQ provides, and you can&#39;t selectively refuse messages (what happens if polling a specific package&#39;s location fails?). At the scale you describe, any basic database-backed system would work fine and if I was doing it I&#39;d use PostgreSQL, mostly out of personal preference.", "756" ], [ "The subprocess isn&#39;t actually writing anything to its own stdout, so nothing is reaching the parent.\r\n\r\nThe [documentation for sys.stdout](_URL_0_) notes\r\n\r\n > When interactive, stdout and stderr streams are line-buffered. Otherwise, they are block-buffered like regular text files.\r\n\r\nThat means that when you `print \" ;Yes! \" ;`, it goes into an in-memory buffer, and sits there until it&#39;s explicitly flushed, some amount of output data is produced (I think 4 KB is typical), or the program exits normally.\r\n\r\nThe best fix would be to update your subprocess script to something like\r\n\r\n #!/usr/bin/env python3\r\n import sys\r\n while True:\r\n line = input()\r\n sys.stdout.write( \" ;Yes!\\n \" ;)\r\n sys.stdout.flush()", "227" ], [ "Docker never uses any of the host system&#39;s filesystem unless you explicitly instruct it to. The device files in `/dev` are whatever (if anything) is baked into the image.\r\n\r\nAlso note that the conventional Unix device model is that a device \" ;file \" ; is either a character- or block-special device, and a pair of major and minor device numbers, and any actual handling is done in the kernel. Relatedly, the host&#39;s kernel is shared across all Docker containers. So if you fix your host&#39;s broken implementation of `/dev/random` then your containers will inherit this fix too; but merely changing what&#39;s in the host&#39;s `/dev` will have no effect.", "324" ], [ "For Docker for Mac, you should use your host&#39;s DNS name or IP address to access exposed services. The \" ;external IP \" ; field will never fill in here. (If you were in an environment like AWS or GCP where a LoadBalancer Kubernetes Service creates a cloud-hosted load balancer, the cloud provider integration would provide the load balancer&#39;s IP address here, but that doesn&#39;t make sense for single-host solutions.)\r\n\r\nNote that [I&#39;ve had some trouble](_URL_0_) figuring out which _port_ is involved; answers to that issue suggest you need to use the service port (80) but you might need to try other things.", "707" ], [ "`kubectl port-forward` makes a specific [Kubernetes API request](_URL_0_). That means the system running it needs access to the API server, and any traffic will get tunneled over a single HTTP connection.\r\n\r\nHaving this is really useful for debugging (if one specific pod is acting up you can connect to it directly; in a microservice environment you can talk to a back-end service you wouldn&#39;t otherwise expose) but it&#39;s not an alternative to setting up service objects. When I&#39;ve worked with `kubectl port-forward` it&#39;s been visibly slower than connecting to a pod via a service, and I&#39;ve found seen the command just stop after a couple of minutes. Again these aren&#39;t big problems for debugging, but they&#39;re not what I&#39;d want for a production system.", "966" ], [ "You should build a custom Docker image containing your application’s code. The `composer install` command should be in your `Dockerfile`. When you build a new version of your application that you want to deploy, you (or, better, your CI system) need to `docker build` a new image, `docker push` it to a registry, and then update the version tag in the Kubernetes Deployment object.\r\n\r\nThe Docker development pattern of “running a Docker container” where the image only has the language runtime and the application code actually lives on a bind-mounted host directory doesn’t really work in Kubernetes, or any other clustered installation (people have had trouble trying to do it in Docker Swarm too, for similar reasons).", "324" ], [ "Nope, that’s the way `docker build` and `docker images -a` interact.\r\n\r\nUnless you’re really really interested, I’d suggest just not running `docker images -a`. Ordinary maintenance commands like `docker rmi` will delete any unused intermediate layers, and you need all of the base layers to run a top-level image. This command doesn’t really tell you anything you actually need to use Docker on a day-to-day basis.", "324" ], [ "> How do I go about referencing the container in a way I can run its commands?\r\n\r\nYou don&#39;t. The container has its own filesystem that&#39;s isolated from the host&#39;s. The host can&#39;t run commands in the container (directly), the container can&#39;t run commands on the host, and containers can&#39;t run commands in other containers.\r\n\r\nThe usual way to do this is to install a client package on the host (on OSX with Homebrew, `brew install postgres`), `docker run` the server, and run the client commands against the server. In this very specific case where you&#39;re running a command from a shell directly on the host against a container on that same host it&#39;s okay to use `localhost` as the `$PGHOST` value.", "707" ], [ "At a technical level, nothing would stop you from launching a plain container with an attached volume and installing software there.\r\n\r\n docker run -v my_opt:/opt -it --rm ubuntu sh\r\n\r\nI wouldn&#39;t consider this an especially effective use of Docker. If your colleague wants to use your database installation, you have no way of giving it to them; if you leave the project for six months and come back to it, you&#39;ll have no record of how you built this setup. If you were set on this approach, you might find the networking and snapshot setups for more typical virtual machines to be better matched to it.", "324" ], [ "In your first Dockerfile, use the `COPY` directive to copy your application into the image before you do things like `RUN composer install`. It&#39;d look something like\r\n\r\n FROM php:7.0-cli\r\n COPY . /usr/src/app\r\n WORKDIR /usr/src/app\r\n RUN composer install\r\n\r\n(cribbed from the [php image documentation](_URL_0_); that image may not have composer preinstalled).\r\n\r\nIn both Dockerfiles, remember that each `RUN` command creates a new empty container, runs its command, and cleans up after itself. That means commands like `RUN cd ...` have no effect, and you can&#39;t start a service in the background in one `RUN` command and have it available later; it will get stopped before the Dockerfile moves on to the next line.\r\n\r\nIn the second Dockerfile, commands like `service` or `systemctl` or `initctl` just don&#39;t work in Docker and you shouldn&#39;t try to use them. Standard practice is to start the server process as a foreground process when the container launches via a default `CMD` directive. The flip side of this is that, since the server won&#39;t start until `docker run` time, your volume will be available at that point. I might `RUN mkdir` in the Dockerfile just to be sure it exists.", "324" ], [ "If it’s a Linux container, and the requestor is specifically your Java process running inside the container, then `file:///resources` will point at the directory you added (a subdirectory of the image root directory). If the URL is being served to something outside the container (like an HTML link or image reference) then a `file:` URL won’t be able to access files inside the container; you’d have to come up with something else to serve up the files and provide an HTTP URL to them.", "473" ], [ "Docker images are generally designed to run a single process or server, in the foreground, until they exit. The standard `mysql` image works this way: if you `docker run mysql` without `-d` you will see all of the server logs printed to stdout, and there’s not an immediate option to get a shell. You should think of interactive shells in containers as a debugging convenience, and not the usual way Docker containers run.\r\n\r\nWhen you `docker run --rm -it /bin/bash`, it runs the interactive shell _instead_ of the database server, and that’s why you get the “can’t connect to server” error. As a general rule you should assume things like init.d scripts just don’t work in Docker; depending on the specific setup they might, but again, they’re not the usual way Docker containers run.\r\n\r\nYou can install a `mysql` client binary on your host or elsewhere and use that to interact with the server running in the container. You don’t need an interactive shell in a container to do any of what you’re describing here.", "324" ], [ "Use the [stock `mysql` image](_URL_0_) for the database; don&#39;t try to roll your own database container. Build a custom image (probably based on the [stock `tomcat` image](_URL_1_)) and push that to Docker Hub. Add the `Dockerfile` you used to build the image and the `docker-compose.yml` that drives the combined application to the root of your repository, next to your `pom.xml` file, and check them in to source control.\r\n\r\nThere&#39;s no way to push a Docker Compose YAML file or a \" ;combination of multiple images \" ; to Docker Hub in any form, only individual images, so those need to be stored separately.", "324" ], [ "If the options are more dynamic, this is a typical use for an entrypoint script. You can write a script that runs as the container is starting up, and it&#39;s given the `CMD` from the Dockerfile or whatever was passed at the end of the `docker run` command as arguments. In this case it would be very simple:\r\n\r\n #!/bin/sh\r\n\r\n # Load in the environment variables\r\n # ( \" ;. \" ; is the same as \" ;source \" ;, but works in all POSIX shells)\r\n . /usr/local/tomcat/bin/_URL_0_\r\n\r\n # Run the CMD (keeping it as pid 1)\r\n exec \" ;$@ \" ;\r\n\r\nThen you can include this in your Dockerfile:\r\n\r\n FROM tomcat:9.0.10-jre8\r\n COPY _URL_0_ _URL_1_ /usr/local/tomcat/bin/\r\n RUN chmod +x /usr/local/tomcat/bin/_URL_1_\r\n COPY application.war /usr/local/tomcat/webapps/\r\n ENTRYPOINT [ \" ;/usr/local/tomcat/bin/_URL_1_ \" ;]\r\n CMD [ \" ;/usr/local/tomcat/bin/_URL_2_ \" ;]\r\n\r\nThe other important thing about this approach is that if you think something might be wrong in your image you can get a shell in a new container in the usual way\r\n\r\n docker run --rm -it myimage sh\r\n\r\nwithout trying to remember the syntax for `--entrypoint`, and still getting your first-time setup. (It will run the entrypoint script, which will set environment variables and then `exec sh`.)", "324" ], [ "This is a common pattern in Dockerfiles (in all languages). The `npm install` step takes a long time, but you only need to run it when the package dependencies change. So it&#39;s typical to see one step that just installs dependencies, and a second step that adds the actual application, because it makes rebuilding the container go faster.\r\n\r\nYou&#39;re right that this is essentially identical if you&#39;re building the image once; you get the same filesystem contents out at the end.\r\n\r\nSay this happens while you&#39;re working on the package, though. You&#39;ve changed some `src/*.js` file, but haven&#39;t changed the `package.json`. You run `npm test` and it looks good. Now you re-run `docker build`. Docker notices that the `package*.json` files haven&#39;t changed, so it uses the same image layer it built the first time without re-running anything, _and it also skips the `npm install` step_ (because it assumes running the same command on the same input filesystem produces the same output filesystem). So this makes the _second_ build run faster.", "324" ], [ "The `docker logs` command will copy the container process&#39;s stdout and stderr to its own stdout and stderr, and you can save them from there. You can also configure `docker run` to send the logs to another service like your local syslog or a logstash installation somewhere (but this makes `docker logs` not work any more).\r\n\r\n docker logs $CONTAINER_ID > $CONTAINER_ID.log 2 > & 1\r\n\r\nIf it&#39;s logging to a file, you can `docker cp` it out\r\n\r\n docker cp $CONTAINER_ID/usr/local/apache2/logs/access.log $CONTAINER_ID.access.log\r\n\r\nBut it&#39;s better still to just start the container with a host directory bind-mounted on to your logs directory, so this isn&#39;t a problem\r\n\r\n docker stop $CONTAINER_ID\r\n docker rm $CONTAINER_ID\r\n docker run -v $PWD/logs:/usr/local/apache2/logs ...\r\n\r\nDirectly accessing things in `/var/lib/docker` usually isn&#39;t considered a good idea. The `overlay2` directories have _parts_ of the per-image and per-container filesystems, _if_ your system is using the \" ;overlay2 \" ; storage driver (aufs and devicemapper used to both be fairly common and would keep things in different subdirectories).", "324" ], [ "I&#39;d just do this sort of thing at the Python layer.\r\n\r\n # for i in $(seq 10); do ...; done\r\n for i in range(10):\r\n subprocess.call([...])\r\n\r\n # for f in *.py; do ...; done\r\n py_files = [f for f in os.listdir(&#39;.&#39;) where f.endswith(&#39;*.py&#39;)]\r\n for f in py_files:\r\n subprocess.call([..., f, ...])\r\n\r\nIf at all possible you should avoid using `shell=True` because it is actually dangerous. Consider a filename or user input that contains a `;` or a ` ` in it: how do you protect against it not doing what you expect (and how do you protect against a caller running any shell command on behalf of your process)? The array form avoids this problem.", "227" ], [ "Debug it on the host, outside Docker. If you need access to databases that are running in Docker, you can set environment variables like `MYSQL_HOST` or `PGHOST` to point at `localhost`. You don&#39;t need root privileges at all (any `docker` command implies unrestricted root access). Your IDE won&#39;t be upset at your code running \" ;somewhere else \" ; with a different filesystem layout. If you have a remote debugger, you won&#39;t need to traverse the Docker divide to get access to it.\r\n\r\nOnce you have it running reasonably on the host and your `py.test` tests pass, _then_ run `docker build`.\r\n\r\n(In the particular case of server-rendered views, you should be able to see almost exactly the same thing via the Flask debug server without having the nginx proxy in front of it, and you can control the library versions that get installed via requirements in your `_URL_0_` file. So the desktop environment will be much simpler, and you should be able to convince yourself it&#39;s very close to what would be running in the Docker world.)", "324" ], [ "Use the stock `mysql` container and just run:\r\n\r\n < !-- language: lang-sh -- > \r\n\r\n docker run -p3306:3306 --name mysql1 mysql\r\n docker run -p3316:3306 --name mysql2 mysql\r\n # plus appropriate -d -e ... -v ... as needed on both commands\r\n\r\nDon&#39;t try to build your own image and definitely don&#39;t try to run two servers with expected different lifetimes in a single container.", "707" ], [ "If your end goal is to run this in Kubernetes, your easiest path will be to put this config file into a [ConfigMap](_URL_0_) and just configure your Deployment to run the standard nginx image. (In plain Docker, you can use `docker run -v` to inject the config file into the container at runtime to similar effect.)\r\n\r\nIt doesn&#39;t really matter what port nginx listens on inside the container. If the stock nginx container expects to listen on the standard HTTP port 80 (and it looks like its `Dockerfile` has an `EXPOSE 80` directive) then you can embrace that and `listen 80` in your nginx config (over TCP, not UDP). Then in your Kubernetes deployment you can specify that as a container port, and if you want to map it to something else, you can do that in the Service that wraps this. (In plain Docker, if you want host port 8000 to avoid conflicting with other things, `docker run -p8000:80`.)\r\n\r\nIn terms of best practices I&#39;d discourage directly writing IP addresses into config files. If it&#39;s a persistent server outside your cluster, you can set up a DNS server in your network to resolve its hostname, or get a cloud service like Amazon&#39;s Route 53 to do it for you. If it&#39;s in Kubernetes, use the service&#39;s DNS name, `backend.default.svc.cluster.local`. Even if you really have only an IP address, creating an [ExternalName service](_URL_2_) will help you if the service ever moves.\r\n\r\nAssuming you have the config file in a ConfigMap, your Deployment would look very much like [the sample Deployment in the Kubernetes documentation](_URL_1_) (it even runs an `nginx:1.7.9` container publishing port 80).", "222" ], [ "The short answer is that you can&#39;t use a `print` statement inside an expression the way you&#39;re proposing. You&#39;d have to answer questions like \" ;when does it get evaluated \" ; that some languages have answers to, but not Python.\r\n\r\nThat having been said, and especially if you&#39;re new to Python but have familiarity with other functional languages, you can create a dictionary that has functions as values. Here&#39;s a way to recast your example:\r\n\r\n #!/usr/bin/env python3\r\n \r\n def main():\r\n print( \" ;option 1) check updates 2) rewrite index 3) ... \" ;)\r\n option = input().strip()\r\n print( \" ;the option: is: \" ; + option)\r\n switch_option(option)\r\n \r\n def switch_option (option):\r\n options = {\r\n &#39;1&#39;: option_one,\r\n &#39;2&#39;: lambda: 2\r\n }\r\n f = options[option]\r\n result = f()\r\n print( \" ;the result is: \" ; + str(result))\r\n \r\n def option_one():\r\n print( \" ;option is 1 \" ;)\r\n return 1\r\n \r\n if __name__ == &#39;__main__&#39;:\r\n main()", "941" ], [ "Two options:\r\n\r\n1. Yes, run the Rabbit server outside the ECS cluster. Since it has persistent state associated with it it&#39;s difficult to move between nodes or replicate, so there&#39;s not a lot of benefit to managing it in ECS.\r\n\r\n2. Ask AWS to [deploy a load balancer in front of RabbitMQ in ECS](_URL_0_). You can give that load balancer its own DNS name (via Route 53) or use its default name, but either way you can use that DNS name to refer to RabbitMQ and it will route whichever host(s) are actually running it.", "166" ], [ "There are two forms of the `CMD` (and `ENTRYPOINT` and `RUN`) commands. The form you wrote is preferred:\r\n\r\n CMD [ \" ;command_name \" ;, \" ;--option \" ;, \" ;value \" ;]\r\n\r\nBut, it doesn&#39;t run a shell to preprocess the command line. So if you run, for instance,\r\n\r\n CMD [ \" ;ls \" ;, \" ; > \" ;, \" ;/host/directory/_URL_0_ \" ;]\r\n\r\nit will pass ` > ` as an argument to the program and not do a shell redirect.\r\n\r\nSo for your construct to work, you need to use the other form, that does implicitly wrap it in a shell execution (`/bin/sh -c &#39;...&#39;`)\r\n\r\n CMD gunicorn --bind :8000 ...\r\n\r\nIn practice, trying to force runtime constraints like worker count via the Dockerfile isn&#39;t what you want; you should allow things like this to be specified in the `docker run` command or similar. @HassanMusavi&#39;s answer is a better one.", "351" ], [ "In the query, any `$variables` you use have to essentially be \" ;declared \" ; as input parameters to the whole thing:\r\n\r\n const AssetAllQuery = gql`\r\n AssetAll($assetName: String!) {\r\n assetAll(assetName: $assetName){\r\n ...\r\n }\r\n } \r\n `;\r\n\r\nThe top-level operation name doesn&#39;t really matter; the `$variable` has its own declared type and must match what gets used inside the body of the query; and when you make the query, the names of the `variables:` there have to match the names of the declared query parameters.", "492" ], [ "> The problem is that file.Seek needs bytes length and i&#39;ve only characters count (block may have unicode data with two-byte charcters). Is there any chance to skip blocks using characters count?\r\n\r\nThat&#39;s actually impossible. As you&#39;ve described the file format, both of the following are possible:\r\n\r\n ...VersionInfo\\1\r\n [ 20 ]\r\n ...VersionInfo\\1\r\n [ C2 A0 ]\r\n\r\nIf you&#39;ve just read the newline and you know you need to read one character, you know it&#39;s somewhere between 1 and 2 bytes (UTF-8 characters can go up to 4 bytes even) but not which, and blindly launching forward some number of bytes without inspecting the intermediate data won&#39;t work. The pathological case is a larger block, where the first half has many multi-byte characters and the last half has text that happens to look like one of your entry headers.\r\n\r\nWith this file format you&#39;re forced to read it a character at a time.", "961" ], [ "That&#39;s not a legal GraphQL response. As per [section 7.1 of the spec](_URL_0_), after describing the `data`, `errors`, and `extensions`: top-level keys:\r\n\r\n > ... the top level response map must not contain any entries other than the three described above.\r\n\r\nYou might put this data into `extensions`; or make it an explicit part of your GraphQL API; or simply let \" ;success \" ; be implied by the presence of a result and the lack of an error.", "458" ], [ "Go has the notion of public and private fields in objects, and the only distinction is whether they start with an initial capital letter or not. This applies to not just code modules but also the `reflect` package and things that use it. So in your initial version\r\n\r\n type Response struct {\r\n action string `json: \" ;action \" ;`\r\n ...\r\n }\r\n\r\nnothing outside your source package, _not even the \" ;encoding/json \" ; module_, can see the private fields, so it can&#39;t fill them in. Changing these to public fields by capitalizing `Action` and the other field names makes them visible to the JSON decoder.", "785" ], [ "My read of [The Go Memory Model](_URL_1_) is that this is a correct execution of the program you&#39;ve written: nothing guarantees that the `AddUint64()` calls in the main program _happen before_ the `LoadUint64()` calls in the goroutine, so it&#39;s legitimate for every read of the variable to happen before any write occurs. I wouldn&#39;t be totally shocked if the compiler knew about ` \" ;sync/atomic \" ;` as special and concluded that the result of the increment was unobservable, so just deleted the final loop.\r\n\r\nBoth [The Go Memory Model](_URL_1_) and the [sync/atomic documentation](_URL_0_) recommend against the approach you&#39;re using. ` \" ;sync/atomic \" ;` admonishes:\r\n\r\n > Share memory by communicating; don&#39;t communicate by sharing memory.\r\n\r\nA better program might look like this:\r\n\r\n package main\r\n \r\n import \" ;fmt \" ;\r\n import \" ;time \" ;\r\n \r\n func count(op < -chan struct{}) {\r\n \tt1 := time.Now()\r\n \tops := 0\r\n \ttick := time.Tick(time.Second)\r\n \tfor {\r\n \t\tselect {\r\n \t\tcase < -op:\r\n \t\t\tops++\r\n \t\tcase < -tick:\r\n \t\t\tdt := time.Since(t1).Seconds()\r\n \t\t\tfmt.Printf( \" ;ops: %d qps: %f\\n \" ;, ops, float64(ops)/dt)\r\n \t\t}\r\n \t}\r\n }\r\n \r\n func main() {\r\n \top := make(chan struct{})\r\n \tgo count(op)\r\n \tfor {\r\n \t\top < - struct{}{}\r\n \t}\r\n }\r\n\r\nNote that no state is shared between the main program and the goroutine, except the data that is sent across the channel.", "389" ], [ "In both examples, your code launches a subprocess. That subprocess, which has its own environment, attempts to run the \" ;source \" ; command, and then exits. Since the subprocess has its own environment, this has no effect on the current process.\r\n\r\nAssuming your end goal is to run some other command in the subprocess, you should just run it directly. You don&#39;t specifically need to activate the virtual environment.\r\n\r\n subprocess.call([ \" ;./env/bin/pip \" ;, \" ;list \" ;])\r\n\r\nAvoid using the `shell=True` option if at all possible; it can be quite dangerous if you&#39;re not extremely careful with it.\r\n\r\nIf you really need to set the environment variables that the `activate` script sets in this script, you need to manually set them in `os.environ`. You can read the `activate` script to see what they are. They usually won&#39;t matter, though.", "191" ], [ "Anybody who has your image can always do\r\n\r\n docker run -u root imagename sh\r\n\r\nAnybody who can run Docker commands at all has root access to their system (or can trivially give it to themselves via `docker run -v /etc:/hostetc ...`) and so can freely poke around in `/var/lib/docker` to see what&#39;s there. It will have all of the contents of all of the images, if scattered across directories in a system-specific way.\r\n\r\nIf your source code is actually secret, you should make sure you&#39;re using a compiled language (C, Go, Java kind of) and that your build process doesn&#39;t accidentally leak the source code into the built image, and it will be as secure as anything else where you&#39;re distributing binaries to end users. If you&#39;re using a scripting language (Python, JavaScript, Ruby) then intrinsically the end user has to have the code to be able to run the program.", "324" ], [ "Use the [slice function](_URL_0_). That page describes the full expression language available to you.\r\n\r\nDepending on where that list comes from, you might find it more convenient to split it up at its source. For instance, instead of declaring 5 `aws_instance` resources then trying to slice their output this way, have two separate `aws_instance` declarations of 3 and 2 instances respectively, and just deal with the entire list of outputs.", "17" ], [ "From your `docker ps` output, your image is configured to only run a shell. Since you ran it as a background process without any input, it processed all of its input and exited successfully (status code 0). `docker logs 6adc34244350` will show you what output (if any) it produced.\r\n\r\nDocker has an excellent [tutorial on writing and running custom images](_URL_0_) that&#39;s worth reading. In particular, you shouldn&#39;t copy the official `golang` Dockerfile; your own Dockerfile can start with `FROM golang:1.10` and it will inherit everything in that image. You also almost certainly want to make sure you have a `CMD` command that runs your application (by default) when the container starts up.", "324" ], [ "The best way is to make sure there&#39;s nothing of actual importance in a running container and nothing that lives only in `/var/lib/docker`. That means:\r\n\r\n* When you start a container, make sure the actual command is recorded somewhere (like a shell script or a Docker Compose YAML file) and checked into source control.\r\n\r\n* Never \" ;exec into a container and install software \" ;. Learn the `Dockerfile` system, use `docker build` to create custom images, and check the `Dockerfile`s into source control. If you can, push the actual images to some repository server (Docker Hub, AWS ECR, something you run yourself).\r\n\r\n* Design your application to not need storage in the container if at all possible. A \" ;remote \" ; database (could be in another container; could be on a dedicated server) is common. This both helps the backup situation and makes it easier to run multiple copies of a container.\r\n\r\n* If your container does have persistent storage (maybe it is the database) use `docker run -v` to give it a location on the host system outside the Docker tree.\r\n\r\n* Never use `docker commit`; if you need to change an image, update the `Dockerfile`, check it in, and rebuild the image.\r\n\r\nIf all of this works, then you can lose all of `/var/lib/docker` and it won&#39;t matter. You should be able to test this by launching a new VM and recreating your system state there. Having proven this to yourself, exclude `/var/lib/docker` from backups, because it&#39;s large and contains only data you can reproduce and reload.", "324" ], [ "Whenever you `docker run` an image, you get a container with a clean filesystem that&#39;s identical to its base image. So in your case you can\r\n\r\n docker stop my_nginx\r\n docker rm my_nginx\r\n docker run ... # the same command as before\r\n\r\nFor configuration files it&#39;s often easier to keep them on the host and use the `docker run -v` option to inject them into a container at startup time. Manually editing files inside containers tends to not be sustainable: you need to `docker rm` a container for a lot of routine things (changing volume mappings, port mappings, environment variables, upgrading to a newer version of the image) and if you&#39;ve made a bunch of hand edits inside the container you&#39;ll lose that work.", "324" ], [ "None of these things should be in your Dockerfile. Putting an ssh private key in your Dockerfile is especially dangerous, since anyone who has your image can almost trivially get the key out.\r\n\r\nAlso consider that it&#39;s unusual to make either inbound or outbound ssh connections from a Docker container at all; they are usually self-contained, all of the long-term state should be described by the `Dockerfile` and the source control repository in which it lives, and they conventionally run a single server-type process which isn&#39;t sshd.\r\n\r\nThat all having been said: if you _really_ want to do this, the right way is to build an image that expects the `.ssh` directory to be injected from the host and takes the outbound IP address as a parameter of some sort. One way is to write a shell script that&#39;s \" ;the single thing the container does \" ;:\r\n\r\n < !-- language: lang-sh -- > \r\n\r\n #!/bin/sh\r\n usage() {\r\n echo \" ;Usage: docker run --rm -it -v ...:$HOME/.ssh myimage $0 <IP_ADDRESS> \" ;\r\n }\r\n if [ -n \" ;$1 \" ; ]; then\r\n usage > & 2\r\n exit 1\r\n fi\r\n if [ ! -f \" ;$HOME/.ssh \" ; ]; then\r\n usage > & 2\r\n exit 1\r\n fi\r\n exec ssh \" ;user@$1 \" ;\r\n\r\nThen build this into your Dockerfile:\r\n\r\n FROM easypi/alpine-arm\r\n RUN apk update \\\r\n & & apk upgrade \\\r\n & & apk add openssh\r\n COPY ssh_user.sh /usr/bin\r\n CMD [ \" ;/usr/bin/ssh_user.sh \" ;]\r\n\r\nNow _on the host_ generate the ssh key pair\r\n\r\n < !-- language: lang-sh -- > \r\n\r\n mkdir some_ssh\r\n ssh-keygen -f some_ssh/id_rsa\r\n ssh-copy-id -i some_ssh/id_rsa user@<IP_ADDRESS>\r\n sudo chown root some_ssh\r\n\r\nAnd then inject that into the Docker container at runtime\r\n\r\n < !-- language: lang-sh -- > \r\n\r\n sudo docker run --rm -it \\\r\n -v $PWD/some_ssh:/root/.ssh \\\r\n my_image \\\r\n ssh_user.sh <IP_ADDRESS>\r\n\r\n(I&#39;m pretty sure the outbound ssh connection will complain if the bind-mounted .ssh directory isn&#39;t owned by the same numeric user ID that&#39;s running the process; hence the `chown root` above. Also note that you&#39;re setting up a system where you have to have root permissions on the host to make a simple outbound ssh connection, which feels a little odd from a security perspective. [Consider that you could put _any_ directory into that `-v` option and run an interactive shell.])", "324" ], [ "The [standard library documentation](_URL_1_) has a little bit of detail. Hash functions generally have the properties:\r\n\r\n1. If two values are equal, they always have the same hash value; and\r\n2. If two values are different, they probably have different hash values.\r\n\r\nThere are simpler and harder ways to write these, and faster and slower ways, but the important thing is how rarely different values produce the same hash value. A good one is tricky, but you usually don&#39;t care deeply about the implementation.\r\n\r\n(In Python you almost never need to directly call `hash()`; I wouldn&#39;t be surprised if it&#39;s part of the dictionary implementation for custom types used as keys. The [`Object.__hash__()` documentation](_URL_0_) says quite a bit more.)", "569" ], [ "`docker run -v` causes a host directory to be mounted into a container&#39;s filesystem as-is. There&#39;s no \" ;copying \" ; and no \" ;ignore \" ; facility. (It doesn&#39;t cost extra time or space to have the unwanted directory, but you also can&#39;t hide it.)\r\n\r\nIf this is a problem, you might need to restructure your application to keep its data somewhere other than its own source tree. If you&#39;re bind-mounting your application&#39;s code into a container you should also consider setting up a `docker build` pipeline and _not_ bind-mounting your code, which can simplify some complicated bind-mount setups.", "324" ], [ "Just because a write can’t succeed immediately, you won’t get the “deadlock” error so long as there’s some other goroutine that can run.\r\n\r\nLet’s imagine a scheduling model where a `go` function immediately starts the goroutine and makes as much forward progress as it can before yielding to someone else. Then this will happen:\r\n\r\n1. The program will call `sum()` for the first half of the list, calculate the sum, and try to write it to the channel, but since there is no listener, it will block.\r\n2. The program will call `sum()` for the second half of the list, calculate the sum, and try to write it to the channel, but since there is no listener, it will block.\r\n3. `main()` will try to read from the channel, wakes up one of the previous goroutines, and gets the value from it.\r\n4. `main()` will try to read from the channel, wakes up the other blocked goroutine, and gets the value from it.\r\n5. Nobody’s blocked on channel input or output any more and all of the goroutines (including `main()`) can run to completion.\r\n\r\nYou can do the same exercise if you pretend `go` just schedules something in the background and continues running the main goroutine. The important thing is that as soon as there’s a paired read and write on the same channel, both will proceed.", "326" ], [ "What happens if you delete the `volumes:` block in the `docker-compose.yml`? That has the effect of overwriting basically everything that gets installed in the `Dockerfile` with what&#39;s on your host system, which I&#39;m guessing your Kubernetes Deployment doesn&#39;t do. I&#39;d also delete the custom `entrypoint:` line unless you know the Deployment spec has something similar.", "324" ], [ "You need to delete the `volumes:` block in your `docker-compose.yml` file.\r\n\r\nThe `volumes:` block in your `docker-compose.yml` directs Docker to take the contents of your local directory and mount them into the container, which hides everything that you add in the `Dockerfile`. When you deploy this with Kompose, this gets translated to Kubernetes directives, but since the Kubernetes environment doesn&#39;t have your local development environment, this results in the deployed containers failing.", "324" ], [ "However you would configure an application running directly on that EC2 instance to talk to RDS, or any other external database: do the exact same thing in your Docker setup. You might need to pass the RDS host name as an environment variable or otherwise cause it to be injected. You do not need to launch any special Docker containers, or set up volumes, or anything else; just use the database normally.", "324" ], [ "If you&#39;re running minikube on OSX or Linux, you can [configure Docker to use the minikube environment](_URL_0_) by running\r\n\r\n eval $(minikube docker-env)\r\n\r\nWhen you do this, you don&#39;t need a separate Docker desktop application. You&#39;re still technically using both Docker and Kubernetes, but you won&#39;t be using the setup with the \" ;whale \" ; icon on OSX.\r\n\r\nFundamentally Kubernetes takes responsibility for launching and managing Docker containers. (Or potentially other things, but almost always Docker containers.) It&#39;s a more complicated and more powerful tool along the same lines as Docker Compose and Docker Swarm. Minikube is very small Kubernetes cluster that runs inside a virtual machine; if you run `kubectl get nodes` you will see the single VM node, and that includes a copy of Docker.", "324" ], [ "As a general rule, there&#39;s no way to find this out from only the image. You can `docker inspect` the image and see what its default entrypoint and command are, but an image doesn&#39;t come with its Dockerfile and doesn&#39;t necessarily have a `requirements.txt` or `_URL_2_` or `Gemfile` or `package.json`. If you&#39;re using a compiled language like Go, it&#39;s possible to build a Docker image that contains _only_ the application, and not other niceties like a shell that aren&#39;t strictly necessary to just run it.\r\n\r\nOften someone will have some other pointer to the image that will have more details. For instance, if an image&#39;s source is on GitHub, then often the GitHub project&#39;s `_URL_1_` file or its wiki will have more details about the image, and typically the `Dockerfile` is in the project root directory. You can look up images on Docker Hub (that just have `username/imagename` format without a registry prefix) on _URL_0_. But you need some sort of out-of-band data about the image like this.", "324" ], [ "Remember that you do need to somewhat routinely delete containers (to change the underlying image; to change a variety of `docker run` options) and if your workflow depends on the container surviving `docker stop`/`docker start`, you&#39;re eventually going to lose that piece of data. There&#39;s nothing wrong with a `docker build`/`docker run`/`docker rm` workflow, but it depends on storing the actual data in a volume.", "324" ], [ "Docker Compose doesn&#39;t support this.\r\n\r\nThere&#39;s a more-or-less [standard trick](_URL_1_) for service B to wait for service A to _start_. If one service has a way to see the other (for instance, service A is running a network service that&#39;s visible on the private Docker network) then service B could wait for A to start, then wait for B to stop, then do its work. You won&#39;t be able to see if A exited successfully, though.\r\n\r\nIf you&#39;re comfortable giving service B potentially unrestricted root access on the host, you could mount the Docker socket into its container, and then it could watch for service A to exit. It might be cleaner to right some orchestrator service C that started A, saw it exit, then started B.\r\n\r\n(If you were in Kubernetes, it has a [pre-stop hook](_URL_0_) which can run a script in service A before it exits, but that&#39;s a pretty heavy-weight answer.)", "707" ], [ "You should pretty much always bind to IPv4 <IP_ADDRESS> or IPv6 <IP_ADDRESS>0 (that is, “all addresses”) for things that run inside Docker containers. The `docker run -p` option has an optional field that can limit what IP address on the host a published port will bind to; the container can’t be reached directly from off-host without configuration like this and so trying to bind to specific interfaces within the container isn’t especially helpful.", "707" ], [ "`docker build` by default will take the entire current directory as its \" ;context \" ; directory, and then when your Dockerfile says `ADD . /home/node/rbs`, that directory gets added to the image. However, if your working tree already has a `dist` directory, that gets copied in too, and the `ng build` command has to contend with the pre-existing content.\r\n\r\nYou can verify whether or not this is the problem by running\r\n\r\n rm -rf dist\r\n docker build .\r\n\r\nA more permanent fix is to create a [.dockerignore file](_URL_0_) that tells Docker to not include the `dist` directory when it does the build.\r\n\r\n echo /dist > > .dockerignore\r\n docker build .\r\n\r\nIf the `dist` directory already exists, the `ADD` command will add it [owned by root](_URL_1_):\r\n\r\n > All new files and directories are created with a UID and GID of 0, unless the optional --chown flag specifies \\[something else\\] ....\r\n\r\nSince you&#39;ve told `ng build` to run as an alternate `NODE` user it won&#39;t be able to delete the root-owned `dist` tree, which leads to the error you see.", "324" ], [ "You should generally set up a Docker private network to communicate between containers using their container names; see _e.g._ _URL_0_. The Docker-internal IP addresses are subject to change if you delete and recreate a container and aren&#39;t reachable from off-host, and trying to find them generally isn&#39;t a best practice.\r\n\r\n172.17.0.0/16 is a typical default for the Docker-internal IP network (<IP_ADDRESS><IP_ADDRESS>/16 is a typical default for the Docker-internal IP network (127.0.0.0/8 is the reserved IPv4 loopback network) and it looks like you might have typoed the address you got from `docker network inspect`.", "707" ], [ "You should use a [prebuilt node image](_URL_0_) that has the right version of node.js installed already.\r\n\r\nYou don&#39;t need tools like nvm (rvm, virtualenv, ...) when you already have the Docker image as an isolation layer from other software that might be installed on the host; you&#39;d never install multiple versions of a language runtime in a single image, where you might need to on a desktop or developer system.", "324" ], [ "If you&#39;re iterating on a custom image, when you `docker build -t imagename .`, the `imagename:latest` tag moves to the newly built image, and the previous image is left behind with just a hash and no other name. You can assign a name to the old image with `docker tag`, or delete it with `docker rmi`.\r\n\r\nIf you are on Docker 1.13 or newer (including any date-format version like 2017.12) then you can [ask Docker to clean up the untagged images](_URL_0_) with\r\n\r\n docker image prune\r\n\r\nOn all Docker versions you can delete the untagged images with the longer\r\n\r\n docker images -q -f dangling=true | xargs docker rmi", "324" ], [ "Not zombie _containers_, but zombie _processes_. Write this `_URL_0_`:\r\n\r\n < !-- language: lang-python -- > \r\n\r\n #!/usr/bin/env python3\r\n import subprocess\r\n import time\r\n\r\n p = subprocess.Popen([&#39;/bin/sleep&#39;, &#39;1&#39;])\r\n time.sleep(2)\r\n\r\n subprocess.run([&#39;/bin/ps&#39;, &#39;-ewl&#39;])\r\n\r\nWrite this `Dockerfile`:\r\n\r\n < !-- language: none -- > \r\n\r\n FROM python:3\r\n COPY _URL_0_ /\r\n CMD [ \" ;/_URL_0_ \" ;]\r\n\r\nBuild and run it:\r\n\r\n < !-- language: lang-sh -- > \r\n\r\n chmod +x _URL_0_\r\n docker build -t zombie .\r\n docker run --rm zombie\r\n\r\nWhat happens here is the `/bin/sleep` command runs to execution. The parent process needs to use the `wait` call to clean up after it, but it doesn&#39;t so when it runs `ps`, you&#39;ll see a \" ;Z \" ; zombie process.\r\n\r\nBut wait, there&#39;s more! Say your process does carefully clean up after itself. In this specific example, `subprocess.run()` includes the required `wait` call, for instance, and you might change the `Popen` call to `run`. If that subprocess launches another subprocess, and _it_ exits (or crashes) without waiting for it, the init process with pid 1 becomes the new parent process of the zombie. (It&#39;s worked this way for 40 years.) In a Docker container, though, the main container process runs with pid 1, and if it&#39;s not expecting \" ;extra \" ; child processes, you could wind up with stale zombie processes for the life of the container.\r\n\r\nThis leads to the occasional suggestion that a Docker container should always run some sort of \" ;real \" ; init process, maybe something as minimal as [tini](_URL_1_), so that something picks up after zombie processes and your actual container job doesn&#39;t need to worry about it.", "324" ], [ "You can&#39;t force a container to run as privileged from within the Dockerfile.\r\n\r\nAs a general rule, you can&#39;t run Docker inside a Docker container; the more typical setup is to share the host&#39;s Docker socket. There&#39;s an official Docker image that attempts this at _URL_0_ with some fairly prominent suggestions to not actually use it.", "324" ], [ "Your program runs `cmd.CombinedOutput()`, which launches the Python script (as a side effect displaying the message box) and collects its stdout into a variable; then does a single `fmt.Printf` to print out the program&#39;s output. That leads to the sequencing you&#39;re seeing.\r\n\r\nIf you call `cmd.StdoutPipe()` then you will get an `io.Reader` that has the script&#39;s stdout instead. It&#39;s your responsibility to read from the pipe and copy to your own process&#39;s stdout; the [os/exec documentation has an example](_URL_0_). You need to `cmd.Start()`, then read everything from the pipe, then `cmd.Wait()` to clean up after yourself.\r\n\r\nYou may also be able to directly assign `cmd.Stdout = os.Stdout`, then `cmd.Run()`. In this case you won&#39;t be able to see the output within your program, but you also won&#39;t have to copy it around.", "227" ], [ "When the Dockerfile says\r\n\r\n CMD bash -c \" ;cd /var/www & & composer install --prefer-dist --no-scripts --no-autoloader \" ;\r\n\r\nThen when you launch the container, Docker runs that command, and when that command completes, the container exits. Since it says \" ;exit status 0 \" ;, the command ran successfully.\r\n\r\nPerhaps you mean to run `composer install` as a `RUN` step inside the Dockerfile, and have a `CMD` that actually launches your service.", "707" ], [ "If you can set your containers to log to stdout rather than to files, it looks like filebeat has an [autodiscover mode](_URL_0_) which will capture the `docker logs` of every container.\r\n\r\nAnother common setup in an ELK world is to configure logstash on your host, and set up Docker&#39;s logging options to send all output on containers&#39; stdout into logstash. This makes `docker logs` not work, but all of your log output is available via Kibana.\r\n\r\nIf your container processes always write to log files, you can use the `docker run -v` option or the Docker Compose `volumes:` option to mount a host directory on to an individual container&#39;s `/var/log` directory. Then the log files will be visible on the host, and you can use whatever file-based collector to capture them. This is in the realm of routine changes that will require you to stop and delete your existing containers before starting them with different options.", "324" ], [ "Most languages have readily available HTTP clients these days; you should almost never be calling out to `curl` from a program in a language more sophisticated than a shell script. [_URL_1_.URLConnection](_URL_0_) has been a part of Java since Java 1.0 and (without knowing why you&#39;re trying to shell out for this) it&#39;s almost definitely the right tool here.\r\n\r\nAssuming you control the `executeCoreAPI` method from your backtrace, you should change it to use the built-in Java HTTP client, and just delete all of the Dockerfile parts that try to install `curl`.", "28" ], [ "If you create an empty directory on the host and mount it to `/var/log` on the container, then `/var/log` in the container will be the host&#39;s empty directory. If you then try to write to `/var/log/nginx/error.log`, nothing has created the intermediate `nginx` directory, and you get that \" ;no such file or directory \" ; error.\r\n\r\nEither mount the volume directly on to the target directory, or create the intermediate directory in the host directory (with appropriate permissions) before launching the container:\r\n\r\n mkdir /mnt/fs/webserver/log/nginx\r\n chmod 0777 /mnt/fs/webserver/log/nginx", "222" ], [ "Doing this in Docker makes a little bit of sense; so would creating a custom AMI with our software, or using an orchestration tool like Ansible to push the software onto the newly provisioned system, or .... Similarly, you could extract the data directly from S3, or put it on EBS volumes, or use a shared-filesystem service like EFS, or .... There are _tons_ of ways to do this that all make sense. Asking a more specific architectural question might be more helpful.", "324" ], [ "sed -E -n &#39;s/^[ 0-9]*(ip|remark|deny|permit)/\\1/p&#39; test_file\r\n\r\nBreaking this down:\r\n\r\n* `sed -E` says to use \" ;extend \" ; regexp syntax; without it you would need many more backslashes\r\n* `sed -n` says to not print out lines, unless a `p` command is used\r\n* The regular expression matches spaces or digits at the start of the line followed by one of the keywords\r\n* The replacement replaces this string at the start of the line with only the keyword\r\n* `s///p` says to print out the line if a replacement was done", "112" ], [ "Don&#39;t install `nvm` in a Docker image. Just use the right [node](_URL_0_) base image for the specific version of node.js you need, or if you really need to use some specific Linux distribution, install it in `/usr` or `/usr/local`.\r\n\r\n`nvm` and other language-specific tools like it are useful when you need _multiple_ language runtimes, but a Docker image only should do one thing and already has an isolated filesystem, so it&#39;s not the right tool here.", "324" ], [ "You can&#39;t start a background process in a Dockerfile, or anything that looks like it. In particular, the command\r\n\r\n RUN python3 _URL_0_ ... & \r\n\r\nexits immediately, and when it does, the intermediate container with the background process is deleted.\r\n\r\nI wouldn&#39;t try to run this sample code from inside the Dockerfile. I&#39;d end with\r\n\r\n CMD [ \" ;python3 \" ;, \" ;_URL_0_ \" ;, \" ;runserver \" ;, \" ;0.0.0.0:8000 \" ;]\r\n\r\nBuild and launch the image\r\n\r\n docker build -t myimage .\r\n docker run -p 8000:8000 myimage\r\n\r\nChange the script to take the server location as an environment variable (<IP_ADDRESS><IP_ADDRESS>:8000 \" ;]\r\n\r\nBuild and launch the image\r\n\r\n docker build -t myimage .\r\n docker run -p 8000:8000 myimage\r\n\r\nChange the script to take the server location as an environment variable (0.0.0.0 is never a valid IP address to which to connect)\r\n\r\n import requests\r\n import os\r\n def test_demo():\r\n response = requests.get(os.environ[&#39;SERVER_URL&#39;] + &#39;/demo&#39;)\r\n assert(response.status_code == 200)\r\n\r\nand then run (assuming you&#39;re running the client from the same host)\r\n\r\n < !-- language: lang-sh -- > \r\n\r\n SERVER_URL=_URL_1_ pytest", "707" ], [ "If your container contains a database server, the normal way to interact with will be through an SQL client that connects to it; Google suggests SQL Server Management Studio and that connector libraries exist for popular languages. I&#39;m not clear what you would do given a shell in the container, and my main recommendation here would be to focus on working with the server in the normal way.\r\n\r\nDocker containers normally run a _single_ process, and that&#39;s normally the main server process. In this case, the container runs _only_ SQL Server. As some other answers here suggest, you&#39;d need to significantly rearchitect the container to even have it be possible to run an ssh daemon, at which point you need to worry about a bunch of other things like ssh host keys and user accounts and passwords that a typical Docker image doesn&#39;t think about at all.\r\n\r\nAlso note that the Docker-internal IP address (what you got from `ip addr`; what `docker inspect` might tell you) is essentially useless. There are always better ways to reach a container (using inter-container DNS to communicate between containers; using the host&#39;s IP address or DNS name to reach published ports from the same or other hosts).", "707" ], [ "I feel like you largely understand the space, and mostly have answers to your questions already. You might find [Docker for Mac vs. Docker Toolbox](_URL_0_) an informative read, even if it&#39;s about the Mac equivalent rather than Windows and about Docker packaged as a VM rather than Kubernetes specifically.\r\n\r\n1. In fact you are stuck with the specific version of Kubernetes the Docker Edge desktop distribution publishes.\r\n\r\n2. is answered in the question.\r\n\r\n3. I believe NodePort-type Services are published on your host&#39;s IP address; there isn&#39;t an intermediate VM address like there is with Docker Toolbox.\r\n\r\n4. Docker Toolbox and minikube always use a full-blown virtual machine with an off-the-shelf hypervisor. The Docker desktop application might use a lighter-weight virtualization engine if one is available.\r\n\r\n5. Kubernetes can involve some significant background work. If you&#39;re using Kubernetes-in-Docker it&#39;s hard to \" ;turn off \" ; Kubernetes and still have Docker available; but if you have a separate minikube VM you can just stop it.", "324" ], [ "If you&#39;re using the standalone GraphiQL app, there&#39;s an \" ;Edit HTTP Headers \" ; button at the top-right corner. Click that, click \" ;+ Add Header \" ;, and enter a Header name \" ;Authorization \" ; and Header value \" ;Bearer eyJh... \" ; where the last part is your access token.\r\n\r\nFor GraphiQL embedded in a Web site, it&#39;s often configured so that it targets the same site, and whatever authentication you need to reach the GraphQL endpoint is the same authentication you need to reach the GraphiQL app. There&#39;s not specifically a path to add custom headers here, but the embedding application server might have a way to provide them.", "340" ], [ "The top-level Schema object has an [#execute method](_URL_0_). You can use this to write tests like\r\n\r\n RSpec.describe MySchema do\r\n it &#39;fetches an object&#39; do\r\n id = &#39;Zm9vOjE&#39;\r\n query = < < ~GRAPHQL\r\n query GetObject($id: ID!) {\r\n node(id: $id) { __typename id }\r\n }\r\n GRAPHQL\r\n res = described_class.execute(\r\n query,\r\n variables: { id: id }\r\n )\r\n expect(res[&#39;errors&#39;]).to be_nil\r\n expect(res[&#39;data&#39;][&#39;node&#39;][&#39;__typename&#39;]).to eq(&#39;Foo&#39;)\r\n expect(res[&#39;data&#39;][&#39;node&#39;][&#39;id&#39;]).to eq(id)\r\n end\r\n end\r\n\r\nThe return value of the #execute method will be the conventional HTTP-style response, as a string-keyed hash. (Actually it&#39;s a [GraphQL<IP_ADDRESS>Query<IP_ADDRESS>Result](_URL_1_), but it delegates most things to an embedded hash.)", "706" ], [ "> With regard to Wordpress and Kinsta, is Docker useful at all?\r\n\r\nNo.\r\n\r\nKinsta appears to offer fully-managed WordPress hosting, or \" ;software as a service \" ;. You get to use WordPress via their administrative console and hosting tools, but you personally do not directly install WordPress or the underlying database.\r\n\r\nDocker is a packaging and distribution mechanism for software. It&#39;s certainly common enough to install and deploy WordPress via Docker, but this isn&#39;t something you&#39;d need to do with a SaaS service like Kinsta: they&#39;ve already installed and deployed WordPress for you.", "324" ], [ "Not your direct question, but Docker doesn&#39;t require a cloud provider. It&#39;s very easy to run Docker on \" ;bare metal \" ;, including your own laptop; there are at least three different good ways to run Docker on AWS; and both the \" ;run Docker on a managed instance \" ; and \" ;run hosted Kubernetes \" ; paths will work on most public-cloud IaaS providers.", "324" ], [ "I also agree that `docker exec` isn&#39;t the tool you&#39;re looking for. In fact, since a Docker image&#39;s content is static, a \" ;watch \" ; type action that rebuilds on filesystem changes probably isn&#39;t what you want either. It seems like you&#39;d be better off reversing the order of this Dockerfile: first build the JavaScript parts, then build the final application, `COPY`ing the `dist` folder of your built front-end there.", "324" ], [ "Anything in a `RUN` command will be later visible via `docker history`.\r\n\r\nThe most secure readily accessible way to provide configuration like passwords to an application like this is to put the configuration file in a host directory with appropriate permissions and then use `docker run -v` or a similar option to mount that into the running container. Depending on how much you trust your host system, passing options as environment variables works well too (anyone who can run `docker inspect` or anyone else with root access on the system can see that, but they could read a config file too).\r\n\r\nWith your proposed approach, I suspect you will need the actual password (not a hash) to decrypt the file. Also configuration by its nature changes somewhat independently of the application, which means you could be in a situation where you need to rebuild your application just because a database hostname changed, which isn&#39;t quite what you usually want.", "707" ], [ "Anyone who can run any Docker commands at all, can run this one:\r\n\r\n docker run -v /etc:/host-etc busybox \\\r\n sh -c &#39;echo ALL ALL(ALL:ALL) NOPASSWD:ALL > > /host-etc/sudoers&#39;\r\n\r\nThat is, anyone who can run Docker commands is all but root already. Requiring sudo-level access to get access to Docker is a sound security restriction.\r\n\r\nReally this is controlled by the file permissions on `/var/run/docker.sock`. Having a `docker` group that owns that socket file and giving it mode 0660 is a common setup (particularly on Ubuntu). But, again, anyone who&#39;s a member of the `docker` group can read and change arbitrary files on the host, and is root in all but name.", "707" ], [ "One important part of this answer: when you launch the C program from the Python script, its output is not a tty, and so `printf()` will buffer up all of its output until a newline is written. That is, it&#39;s not necessarily a problem with the wiring on the Python side, the subprocess is probably not actually writing anything to its stdout, and adding the newlines in the printf calls will fix it.", "941" ], [ "[net/http.Request](_URL_0_) has a `Header` field that you can directly edit, but this means you can&#39;t use the shortcut `client.Get` method. Something more like:\r\n\r\n req, err := http.NewRequest(http.MethodGet, url, nil)\r\n if err != nil {\r\n return err\r\n }\r\n req.Header = map[string][]string{\r\n \" ;Authorization \" ;: {fmt.Sprintf( \" ;Bearer %s \" ;, jwt)},\r\n }\r\n r, err := _URL_1_(req)\r\n ...", "178" ], [ "For simple type comparisons like what you&#39;re showing, you don&#39;t need reflection. You can use a [type assertion](_URL_0_) instead:\r\n\r\n stuff := []interface{}{ \" ;hello \" ;, 1, nil}\r\n for _, obj := range stuff {\r\n if _, ok := obj.(string); ok {\r\n fmt.Printf( \" ;is a string\\n \" ;)\r\n } else if _, ok := obj.(int); ok {\r\n fmt.Printf( \" ;is an int\\n \" ;)\r\n } else {\r\n fmt.Printf( \" ;is something else\\n \" ;)\r\n }\r\n }", "816" ], [ "To a first approximation, commands like `systemctl`, `initctl`, `service`, or `start` just don&#39;t work in Docker and you should find a different way to do what you&#39;re attempting.\r\n\r\nStylewise, the standard way to use a Docker container is to launch some sort of service _in the foreground_. As one specific example, the [standard Redis image](_URL_0_) doesn&#39;t go through any sort of init script; it just runs\r\n\r\n CMD [ \" ;redis-server \" ;]\r\n\r\nIn most Docker images it&#39;s unusual to even so much as launch a background process (with the shell ` & ` operator). It&#39;s not usually necessary and in Dockerfiles the interaction with the `RUN` directive has confused some people.\r\n\r\nIn the specific case of `systemctl`, it requires an extremely heavyweight init system that is not just a process manager but also wants to monitor and manage kernel-level parameters, includes a logging system, runs an inter-process message bus, and some other functionality. You can&#39;t run systemd under Docker without the container being `--privileged`, which gives the container the ability to \" ;escape \" ; on to the host system in some unfortunate ways.", "324" ], [ "The structure you describe looks like a _syntax tree_ in a compiler or an interpreter. There are various statements you can make about _types_ given that syntax tree – `c(x)` takes the single parameter to `a` and its return value is the first parameter to `b()`, so types must match up in those places – but I&#39;m not used to seeing a syntax tree directly represented as a type like this.", "816" ], [ "My practical experience has been that, in a microservices architecture implemented using Helm, each individual service should have its own Helm chart.\r\n\r\nThe real problem is that Helm doesn&#39;t deal well with recursive dependencies. A typical architectural statement is that each service has its own independent storage and no service \" ;borrows \" ; another&#39;s storage. If charts A and B both say in their `requirements.yaml` that they need some database as a dependency, and your \" ;wrapper \" ; chart W depends on A and B, then Helm&#39;s resolver will instantiate a _single_ database dependency chart and use it for both components.\r\n\r\nThis style is also somewhat easier to deploy. If you take the Docker image tag as a parameter to the chart, then you can deploy each chart/service completely independently of everything else. With one \" ;wrapper \" ; chart you need to be continuously redeploying that chart and coordinating changes to its specific values. (The reverse of that is that it&#39;s a little trickier to know what specific versions of the entire system are deployed all in one place.)", "314" ], [ "What motivates this code? If you try to write to a full channel, Go will automatically block this goroutine, resume another, and resume this goroutine when it&#39;s possible for the write to complete. You don&#39;t need to take any manual action to \" ;allow another thread to run while you&#39;re waiting \" ;, which is what this code feels like to me.", "880" ], [ "The [official Docker mysql image](_URL_0_) will run everything present in `/docker-entrypoint-initdb.d` when the database is first initialized (see \" ;Initializing a fresh instance \" ; on that page). Since you&#39;re injecting it into the container using a volume, if the database doesn&#39;t already exist, your script will be run automatically as you have it.\r\n\r\nThat page also suggests creating a custom Docker image. The Dockerfile would be very short\r\n\r\n FROM mysql:5.7.22\r\n COPY init.sql /docker/entrypoint-initdb.d/1-init.sql\r\n\r\nand then once you built the modified image you wouldn&#39;t need a copy of the script locally to have it run at first start.", "324" ], [ "The default is a system-controlled directory under `/var/lib/docker`. If you&#39;re in a Docker Toolbox or Docker Machine environment where Docker runs under a VM, that directory path is inside the VM. Docker controls that directory tree, in some places in complicated ways, and you generally shouldn&#39;t be doing anything directly inside of it.\r\n\r\nIn turn, this default happens because the MySQL Dockerfile contains the line `VOLUME [ \" ;/var/lib/mysql \" ;]`, which causes Docker to create that storage automatically. Otherwise, the only persistent storage is what&#39;s explicitly declared with `docker run -v` or the `volumes:` section.\r\n\r\n\r\n----------", "324" ], [ "There&#39;s different kinds of tests. I tend to think of _unit tests_ as things that only depend on the code base, and ideally the smallest chunks of code within the system, and so you can and should run these on your development system before you build the container. These are tricky to run inside a container, since usually you wouldn&#39;t ship this kind of test code with the application, but there&#39;s a very tight code-level connection between the code and the tests.\r\n\r\nOn the other hand, _integration tests_ or _system tests_ tend to answer your final question, \" ;verify the running API is correct \" ;, with real or at least test databases. For these you&#39;d often have a separate test driver that contacted your service, made requests, and verified the results. Then you can do what you propose:\r\n\r\n docker build -t myimage .\r\n docker run -d --name test -p 12345:8080 myimage\r\n ./integration_tests _URL_0_\r\n docker stop test\r\n docker rm test\r\n docker push myimage\r\n\r\nIn this example the service listens on port 8080; we map it to port 12345 on the host; and `integration_tests` is your test runner that connects to the running service, and we point it at the container. You could wrap many of these steps up in a Docker Compose YAML file, especially if running the container needs a lot of arguments.", "324" ], [ "GraphQL doesn’t directly allow this. Input object types have fixed structure, and there’s no conditional validation (built-in; your resolver function could produce errors based on its own checks that are richer than what’s in the schema).\r\n\r\nThe most common pattern I’ve seen adopts the [Relay GraphQL mutation conventions](_URL_0_) (even if you don’t expect your clients to be using Relay). This has one mutation per possible action (in your case, one mutation per submitted form) and a distinct input object type per mutation.\r\n\r\nAlso note that the input object types can be nested, so in your example, you could write\r\n\r\n input Name {\r\n givenName: String!\r\n surname: String!\r\n }\r\n\r\n input Fruit {\r\n name: String!\r\n }\r\n\r\n input WhatYouEatInput {\r\n name: Name!\r\n fruit: Fruit!\r\n }\r\n\r\n mutation {\r\n whatYouEat(input: WhatYouEatInput!): WhatYouEatPayload!\r\n }\r\n\r\nwhich would allow reusing the common parts of the schema across different mutation types.", "866" ], [ "_URL_0_ implies the only `type` values are “Complete” and “Failed”, and that they may have a `”True”` or `”False”` `status`.\r\n\r\nIn addition to the job status conditions array, you may also find it informative to look at the job status `active` count, and the `startTime` and `completionTime` if you’re just interested in whether it’s finished.", "241" ], [ "It looks like you&#39;ve combined parts of a Deployment and a Service; they&#39;re two different objects. You can break this up:\r\n\r\n ---\r\n apiVersion: apps/v1 \r\n kind: Deployment\r\n metadata:\r\n name: presto-worker\r\n spec:\r\n selector:\r\n matchLabels:\r\n app: presto-worker\r\n replicas: 2 \r\n template:\r\n metadata:\r\n labels:\r\n app: presto-worker\r\n spec:\r\n containers:\r\n - name: presto-image\r\n image: _URL_0_\r\n ports:\r\n - containerPort: 8080\r\n ---\r\n apiVersion: v1 \r\n kind: Service\r\n metadata:\r\n name: presto-worker\r\n spec:\r\n type: NodePort\r\n selector:\r\n matchLabels:\r\n app: presto-worker\r\n ports:\r\n - name: http\r\n port: 8080\r\n\r\nThe Service selector points at specific pods; it needs to match the deployment spec&#39;s pod template labels. The Deployment selector names the pods that the Deployment manages. In both cases they point at pods but they&#39;re for different purposes.", "643" ], [ "When you run a Docker container, it constructs a command line by simply concatenating the \" ;entrypoint \" ; and \" ;command \" ;. Those come from different places in the `docker run` command line; but if you don&#39;t provide a `--entrypoint` option then the `ENTRYPOINT` in the Dockerfile is used, and if you don&#39;t provide any additional command-line arguments after the image name then the `CMD` is appended.\r\n\r\nSo, a couple of invocations:\r\n\r\n # Does \" ;wget -? \" ;\r\n docker run --rm thisimage\r\n\r\n # Does \" ;wget -O- _URL_0_;: dumps the SO home page\r\n docker run --rm thisimage -O- _URL_1_\r\n\r\n # What you need to do to get an interactive shell\r\n docker run --rm -it --entrypoint /bin/sh thisimage", "707" ], [ "In this simplified example:\r\n\r\n func Cheat(guess chan Choice) chan Choice {\r\n new_guess := make(chan Choice)\r\n new_guess < - Choice{}\r\n < -guess\r\n return new_guess\r\n }\r\n\r\nWhen the write to the newly allocated channel happens, nobody else can possibly have the channel yet and so that write will block forever. Since that write blocks, the read from `guess` never happens. But, in the code you quoted, the `Cheat()` function is the only thing that reads from the `guess` channel; so the things that are writing to it are blocked on that read happening, that read won&#39;t happen until the write to `new_guess` happens, and that write can&#39;t happen until the containing function returns.\r\n\r\nIf you move the channel I/O into a goroutine, then the containing function can return before things progress, and so the write in `Cheat()` gets paired with the reads at the end of `Game()` and things can move forward.", "326" ], [ "If you `docker push v1:latest` it will push that complete image and all of its dependent code; but it won&#39;t be recorded anywhere the names those base images happened to come with.\r\n\r\nSo if you moved to another machine and ran `docker pull v1:latest` and then ran `docker images`, you&#39;d see the `v1` image but you wouldn&#39;t see its `FROM` image listed, and if you tried to directly `docker run` that base image or to `docker build` another image from the same base, it would get pulled from Docker Hub (or wherever).", "324" ], [ "If what you’re sharing is _code_, you should build it into the actual Docker images, and not try to use a volume for this.\r\n\r\nYou’re going to encounter two big problems. One is getting a volume correctly shared in a multi-host installation. The second is a longer-term issue: what are you going to do if the shared code changes? You can’t just redeploy the C module with the shared code, because the volume that holds the code already exists; you need to separately update the code in the volume, restart the dependent services, and hope they both work. Actually baking the code into the images makes it possible to test the complete setup before you try to deploy it.", "324" ], [ "Once you&#39;ve gotten into Jinja template land, you don&#39;t need to use more curly braces; you can use the [Jinja template language](_URL_1_) (which bears a strong resemblance to Python in many cases).\r\n\r\nIn particular, where you write:\r\n\r\n {% for host in groups[&#39;{{dc}}-linux&#39;] %}\r\n\r\nIf you were in, say, Python, you&#39;d concatenate the variable `dc` and the string `-linux`. Jinja has [a specific string concatenation operator](_URL_0_) and I think this should work\r\n\r\n {% for host in groups[dc ~ &#39;-linux&#39;] %}", "529" ], [ "You don&#39;t need to (and shouldn&#39;t) run `kubectl` with `sudo`. `kubectl` doesn&#39;t need any special permissions, and is interacting entirely with a remote server over an HTTPS connection. Kubernetes tends to take over the system it runs on, so even if you somehow were running `kubectl` against a local apiserver, being logged into the node at all would be odd and you could do the same level of administration remotely.\r\n\r\nIf you have been running it under `sudo`, it might have changed the ownership of some files to be inaccessible, and you can fix this (once) with\r\n\r\n sudo chown -R $USER $HOME/.kube\r\n\r\n(In your listing, `~/.kube/cache` is owned by root, not by myuser.)", "708" ], [ "You should encapsulate the shared state in an object, then pass that object in.\r\n\r\n class SimStatus:\r\n def __init__(self):\r\n self.status = &#39;Failed&#39;\r\n\r\n def newFunction(simStatus):\r\n ...\r\n if &#39;PASSED&#39; in checkLine:\r\n simStatus.status = &#39;Pass&#39;\r\n makeResultFile.write(simStatus.status + &#39;\\n&#39;)\r\n\r\n simStatus = SimStatus()\r\n newFunction(simStatus)\r\n newFunction(simStatus)\r\n\r\nThis avoids all of the design and syntactic problems that globals introduce. It makes it possible to use this function tracking multiple statuses at once, and is helpful in test scripts as well.", "490" ], [ "Docker manages all of this internal networking machinery itself. This includes allocating IP(v4) addresses from a private range, a NAT setup for outbound connections, and a DNS service to allow containers to communicate with each other.\r\n\r\nA stable, reasonable setup is:\r\n\r\n* Run `docker network create mynet`, once, to create a non-default network. (Docker Compose will do this for you automatically.)\r\n* Run your containers with `--net mynet`.\r\n* When containers need to communicate with each other, they can use other containers&#39; `--name` as DNS names (you can connect to `_URL_0_`).\r\n* If you need to reach a container from elsewhere, publish its service port using `docker run -p` or the Docker Compose `ports:` section. It can be reached using the host&#39;s DNS name or IP address and the published port.\r\n* Never ever use the container-private IP addresses (directly).\r\n* Never use `localhost` unless you&#39;re absolutely sure about what it means. (It&#39;s a correct way to reach a published port from a browser running on the host that&#39;s running the containers; it&#39;s almost definitely not what you mean from within a container.)\r\n\r\nThe problems I&#39;ve seen with the container-private IP addresses tend to be around the _second_ time you use them: because you relaunched the container and the IP address changed; because it worked from your local host and now you want to reach it from somewhere else.\r\n\r\nTo answer your initial questions briefly: (1-2) Docker assigns them itself from a network that can be configured but often defaults to <IP_ADDRESS>/16; (3) different containers have different private IP addresses; (4-5) Docker provides its own DNS service and `/etc/resolv.conf` points there; (6) ICMP connectivity usually doesn&#39;t prove much and you don&#39;t need to `ping` containers (use `dig` or `nslookup` for DNS debugging, `curl` for actual HTTP requests).", "707" ], [ "You usually don&#39;t ssh into Docker containers: they&#39;re usually running only a single process and that process usually isn&#39;t an ssh daemon.\r\n\r\nIf you have access to the host to run Docker commands, you can `docker exec -u root < containerid > ` to get a root shell in the container.\r\n\r\nSince you can always get a root shell from the host if you really need to, there just isn&#39;t a root password, and you can&#39;t directly log in as root. (Also you can&#39;t directly **login**(8) to a container and there usually isn&#39;t a remote shell service of any sort, so you can&#39;t directly log in as anything in any case.)", "707" ], [ "Typically GraphQL would represent all of the links between objects explicitly in the schema: if in your database model an `Address` references a `Person`, then your `Person` GraphQL type would have a list of addresses. In the GraphQL schema language, you might have:\r\n\r\n type Person implements Node {\r\n id: ID!,\r\n firstName: String,\r\n age: Int!,\r\n address: [Address!]!\r\n }\r\n\r\nIf you knew the ID of a person, a typical query to retrieve much of the available data might hypothetically look like\r\n\r\n query Person($id: ID!) {\r\n node(id: $id) {\r\n ... on Person {\r\n firstName\r\n age\r\n address {\r\n streetNumber\r\n hostInfo { ... }\r\n }\r\n }\r\n }\r\n }", "546" ], [ "I believe if you just don&#39;t try to configure the `nodePort` it will do what you want.\r\n\r\nThe `port` and `targetPort` are important: they specify in your case that port 443 (either on the ELB or the Kubernetes Service endpoint `haproxy.default.svc.cluster.local`) will get forwarded to port 80 in the pod. In an AWS environment like you describe, the `nodePort` is mostly a side effect: you&#39;d use `ClusterIP` Services to communicate between Pods, and `LoadBalancer` services for things you want to expose outside the immediate cluster, and generally not make direct connections to nodes themselves.\r\n\r\nThere&#39;s [a more specific limitation](_URL_0_) that the `nodePort` must be between 30000 and 32767; you can&#39;t use it to publish arbitrary ports from nodes, and that&#39;s why you&#39;re getting the error you&#39;re getting.", "53" ], [ "In your `simplify()` function, the parameter `n` is a reference to some specific node, and you can change what node it refers to; but reassigning `n` doesn&#39;t change any of the other structure. As a specific example, this loop actually does nothing:\r\n\r\n for c in n.children:\r\n # simplify has no side effects and leaves the input structure unchanged\r\n c = simplify(c)\r\n # c is never used again so the simplified result is lost\r\n\r\nThere&#39;s two reasonable approaches to solving this. One is to construct a new tree as the result of `simplify`:\r\n\r\n def simplify(n):\r\n if len(n.children) > 1:\r\n new_children = [simplify(c) for c in n.children]\r\n return Node(n.symbol, n.rule, new_children)\r\n # and other cases\r\n\r\nThis has the advantage that your data structure is _immutable_: if you have two references to the tree hanging around, you know that rewriting one isn&#39;t going to destroy the other; if you have a reference to a node in the middle of the tree, there&#39;s no risk of it unexpectedly becoming \" ;orphaned \" ;.\r\n\r\nStill, it is common enough to see _mutable_ data structures, and you could add your `simplify` method into the `Node` class to rewrite a node in place:\r\n\r\n class Node:\r\n def simplify(self):\r\n if len(self.children) == 1:\r\n return self.children[0].simplify()\r\n if len(self.children) > 1:\r\n self.children = [c.simplify() for c in self.children]\r\n return self", "954" ], [ "It looks like you&#39;ve had the key insight that you can write this function independent of any particular storage:\r\n\r\n def add_to_unmapped(unmapped, table):\r\n if unmapped:\r\n _URL_0_( \" ;Adding to unmapped \" ;)\r\n unmapped = _URL_1_(table).cache()\r\n else:\r\n _URL_0_( \" ;Making new unmapped \" ;)\r\n unmapped = table\r\n _URL_0_( \" ;Data added to unmapped \" ;)\r\n return unmapped\r\n\r\nThis is actually good practice on its own. For instance, you can write unit tests for it, or if you have two tables (as you do) you can just write the implementation for it once.\r\n\r\nIf you consider what, abstractly, your two `add_to_unmapped_*` functions do, they:\r\n\r\n1. Compute the new table;\r\n2. Save the new table in the object; and\r\n3. Return the new table.\r\n\r\nWe&#39;ve now separated out step 1, and you can refactor the wrappers:\r\n\r\n class Alerter:\r\n def add_to_unmapped_trades(self, table):\r\n self.unmappedTrades = add_to_unmapped(self.unmappedTrades, table)\r\n return self.unmappedTrades", "107" ], [ "You should write down the specific changes you made in a Dockerfile. It can be as little as\r\n\r\n FROM the-base-image\r\n RUN ...\r\n\r\n`docker build` will preserve the `ENTRYPOINT` and `CMD` from the base image.\r\n\r\nIf the base image updates, you can re-run `docker build` and get a new derived image; when something breaks in your image six months from now, you&#39;ll have a record of what went into it so that you can build it again. (That is, I&#39;d suggest never using `docker commit` at all.)", "324" ], [ "When your server logs say\r\n\r\n > Server listening on: _URL_0_\r\n\r\nThe server will be inaccessible outside the Docker container. It looks like this is the default behavior of the Express JavaScript Web server, and many other frameworks when run in “developer” mode. You need to set the server to listen on all IP addresses, probably by passing <IP_ADDRESS> as the “bind” address. (Note that you cannot _connect_ to <IP_ADDRESS>, and saying “listen to <IP_ADDRESS>” means “accept connections from anywhere”.\r\n\r\nIf your server is in fact based on Express, _URL_1_ might be informative to you.", "707" ], [ "Creating an image per build seems to be the standard CI/CD pattern. And then you can name the branch in the image tag in your `docker run` command / Docker Compose YAML file / Kubernetes Deployment description. You wouldn&#39;t want to separately ship your code to your deployment system to mount it on top of the output from your build system.", "324" ], [ "Since this image declares a `VOLUME` for the PostgreSQL data, you cannot make a derived image from this with prepopulated data in a volume, either using `docker build` or `docker commit`. [It won&#39;t work](_URL_0_) (see the note \" ;changing the volume within the Dockerfile \" ;).\r\n\r\nThe standard way to load data into a _newly created_ database container seems to be to put a SQL-syntax database dump in the initialization directory when you start the container for the first time. In this image, it looks like you&#39;d have to wrap the database dump in a shell script and put it in an `/opt/app-root/src/postgresql-init/` directory. For the [stock postgres image](_URL_1_) you&#39;d put a *.sql file in `/docker-entrypoint-initdb.d/`.", "324" ], [ "Docker bind mounts are a fairly effective way to inject configuration files like this into a running container. I would not try to describe every possible configuration in your built image; instead, let that be configuration that&#39;s pushed in from the host.\r\n\r\nPick some single specific file to hold the configuration. For the sake of argument, let&#39;s say it&#39;s `/usr/src/app/env`. Set up your application however it&#39;s built to read that file at startup time. Either make sure the application can still start up if the file is missing, or build your image with some file there with reasonable default settings.\r\n\r\nNow when you run your container, it will always read settings from that known file; but, you can specify a host file that will be there:\r\n\r\n docker run -v $PWD/env.development:/usr/src/app/env myimage\r\n\r\nNow you can locally have an `env.development` that specifies extended logging and a local database, and an `env.production` with minimal logging and pointing at your production database. If you set up a third environment (say a shared test database with some known data in it) you can just run the container with this new configuration, without rebuilding it.", "324" ], [ "`get-docker-host` is asynchronous, in that it takes a callback function and calls it later, but it doesn&#39;t return a promise and so I don&#39;t think you can call it using async/await syntax. You can&#39;t block on it returning; you can put your main application behind a callback, or manually wrap it in a promise. There are some examples in the [MDN async/await documentation](_URL_0_).\r\n\r\nHere&#39;s a working example that wraps the `get-docker-host` result in a promise. If it&#39;s not in Docker then the promise resolves with a `null` address; if it is, and `get-docker-host` succeeds, it resolves with the host address, and if not, it fails with the corresponding error.\r\n\r\n`index.js`:\r\n\r\n getDockerHost = require(&#39;get-docker-host&#39;);\r\n isInDocker = require(&#39;is-in-docker&#39;);\r\n \r\n checkDocker = () = > {\r\n return new Promise((resolve, reject) = > {\r\n if (isInDocker()) {\r\n getDockerHost((error, result) = > {\r\n if (result) {\r\n resolve(result);\r\n } else {\r\n reject(error);\r\n }\r\n });\r\n } else {\r\n resolve(null);\r\n }\r\n });\r\n };\r\n \r\n checkDocker().then((addr) = > {\r\n if (addr) {\r\n console.log(&#39;Docker host is &#39; + addr);\r\n } else {\r\n console.log(&#39;Not in Docker&#39;);\r\n }\r\n }).catch((error) = > {\r\n console.log(&#39;Could not find Docker host: &#39; + error);\r\n });\r\n\r\n`Dockerfile`:\r\n\r\n FROM node:10\r\n COPY package.json yarn.lock ./\r\n RUN yarn install\r\n COPY index.js ./\r\n CMD [ \" ;node \" ;, \" ;./index.js \" ;]\r\n\r\nRunning it:\r\n\r\n < !-- language: lang-none -- > \r\n\r\n % node index.js\r\n Not in Docker\r\n % docker build .\r\n Sending build context to Docker daemon 21.5kB\r\n ...\r\n Successfully built e14d41aa0c9b\r\n % docker run --rm e14d41aa0c9b\r\n Docker host is <IP_ADDRESS>", "283" ], [ "Note that there’s a non-zero chance that the full disk will cause Docker’s internal state to get corrupted, and you’ll have to delete your local Docker state. If you’ve planned ahead so that there’s nothing precious in containers and you can recreate everything with `docker pull`, `docker build`, and host-directory volumes, this should be a non-event. If you’re working interactively in containers a lot...sorry.", "324" ], [ "> Is there a way to run docker commands in a Dockerfile for creating images?\r\n\r\nNo. You can’t run Docker commands from inside a Dockerfile.\r\n\r\nThe usual approach to this is to share the host’s Docker socket with a container, but you can’t mount any volumes or host directories during an image build process. In principle you can run a secondary Docker inside a main Docker container (though this is discouraged, complicated, and fragile) but again since you can’t really start services inside a Dockerfile this won’t work.\r\n\r\nGiven the sorts of things you’re trying to install in your image, it looks like you’re looking for some sort of system-level automation tool that can run directly on the host, not something that wants to run in a constrained container environment. Ansible, Salt Stack, and Chef are all popular options in this space.", "324" ], [ "As a general rule you should avoid embedding data into query language strings like this. (What if the `id` variable is actually a string containing parentheses and curly braces? _URL_0_ is a more famous, if fictional, example of the potential problems you&#39;re facing.)\r\n\r\nGraphQL supports top-level query parameters and you should use those here. If you make your query like\r\n\r\n < !-- language: graphql -- > \r\n\r\n query Providers($ids: [ID!]!) {\r\n oneAppProviders(id: $ids) {\r\n id\r\n firstName\r\n }\r\n }\r\n\r\nmost query libraries have a way to pass in additional parameters; so in your case that might look like\r\n\r\n < !-- language: javascript -- > \r\n\r\n const query = gql`...`;\r\n const variables = { ids: ids };\r\n GraphqlClient.query(query, variables).then(...);", "492" ], [ "In general I&#39;d try to avoid launching subprocesses for things that are simple string manipulation and straightforward file I/O. That&#39;s especially true when you start getting into actively dangerous things like `subprocess.call(shell=True)`. You can use the [glob module](_URL_0_) to do the filename expansion and then loop through the files.\r\n\r\nHere&#39;s one example:\r\n\r\n import glob\r\n res = []\r\n for fn in glob.glob(&#39;test.*&#39;):\r\n with open(fn, &#39;r&#39;) as f:\r\n for line in f:\r\n if &#39;002HQV&#39; in line:\r\n res.append(line)\r\n print(res)", "227" ], [ "In this particular case you can use [hashlib.new()](_URL_1_) to create a hasher by its name.\r\n\r\n import hashlib # don&#39;t randomly rename standard libraries\r\n ALGORITHM = &#39;md5&#39;\r\n h = hashlib.new(ALGORITHM)\r\n h.update(&#39;hello world&#39;.encode(&#39;utf-8&#39;))\r\n print(h.hexdigest())\r\n\r\nIf you think you might want to change which function in a module you&#39;re calling, you can wrap it in your own function, which is right generic answer to the question you&#39;re asking.\r\n\r\n import hashlib\r\n\r\n def hash(s):\r\n hashlib.md5(s.encode(&#39;utf-8&#39;))\r\n\r\n print hash(&#39;hello world&#39;)\r\n\r\nYou _can_ use [getattr()](_URL_0_) on a module to retrieve a function by name, but that&#39;s not the usual way to do things.", "277" ], [ "I would avoid using global and class-scoped variables if at all possible. These can make your program harder to understand (if something else changes a global underneath you it&#39;s hard to notice) and test (you need to reset all global state between every test; it&#39;s often easier to just create new empty state).\r\n\r\nI might restructure this example by creating a state object:\r\n\r\n class State:\r\n def __init__(self):\r\n self.session_id = &#39;&#39;\r\n\r\nAnd then making that explicitly be a property, say, of the base class:\r\n\r\n class Base:\r\n def __init__(self, state):\r\n self.state = state\r\n\r\n def m1(self):\r\n print( \" ;SESSION_ID in base: \" ; + str(self.state.session_id))\r\n\r\n class Derived(Base):\r\n def m2(self):\r\n self.state.session_id = &#39;10&#39;\r\n print( \" ;SESSION_ID in derived: \" ; + str(self.state.session_id))\r\n\r\nThen in your main function you need to explicitly create the state object and pass it in\r\n\r\n def main():\r\n state = State()\r\n c2 = Derived(state)\r\n c2.m2()\r\n c2.m1()\r\n\r\nBut, critically, your tests don&#39;t need to worry about state leakage\r\n\r\n def test_m2():\r\n state = State()\r\n obj = Derived(state)\r\n obj.m2()\r\n assert state.session_id == &#39;10&#39;\r\n\r\n def test_m1():\r\n state = State()\r\n obj = Base(state)\r\n obj.m1()\r\n # If the session ID was a global or a class variable,\r\n # you&#39;d get a different result if m2() was called or not\r\n assert state.session_id == &#39;&#39;", "667" ], [ "As a general rule, never set `DOCKER_HOST`.\r\n\r\nGiven your error message, it looks like it might be set (incorrectly) and you might see if things get better if you\r\n\r\n < !-- language: lang-sh -- > \r\n\r\n unset DOCKER_HOST\r\n\r\nThe two prominent exceptions are VM-based Docker environments (Docker Toolbox, Docker Machine, Kubernetes&#39; minikube). In these cases there are helper scripts that can set it to the correct value:\r\n\r\n < !-- language: lang-sh -- > \r\n\r\n eval $(docker-machine env) # Docker Machine, Docker Toolbox\r\n eval $(minikube docker-env) # Minikube", "707" ], [ "You&#39;d generally set up the GraphQL schema to refer to the other object and not have its ID at all in the referrer:\r\n\r\n type App {\r\n id: Int\r\n show: Show\r\n ...\r\n }\r\n type Show {\r\n id: Int\r\n name: String\r\n ...\r\n }\r\n\r\nThat way a query doesn&#39;t have to know that there&#39;s an intermediate database lookup involved\r\n\r\n query GetApp {\r\n app {\r\n name\r\n url\r\n show { name }\r\n }\r\n }", "97" ], [ "In Docker generally the application data is stored _separately_ from images and containers; for instance you&#39;d frequently use a `docker run -v` option to store data in a host directory or Docker volume so that it would outlive its container. You wouldn&#39;t generally try to bake data into an image, both for scale reasons and because any changes will be lost when a container exits.\r\n\r\nAs you&#39;ve described the higher-level problem, I might distribute something like a \" ;test kit \" ; that included a `docker-compose.yml` and a base data directory. Your Docker Compose file would use a stock PostgreSQL container with data:\r\n\r\n postgres:\r\n image: postgres:10.5\r\n volumes:\r\n - &#39;./postgres:/var/lib/postgresql/data&#39;\r\n\r\nTo answer the specific question you asked, `docker build` steps _only_ run individual commands within Docker container space; they can&#39;t run arbitrary host commands, read filesystem content outside of the tree containing the `Dockerfile`, or write any sort of host filesystem content outside the container.", "324" ], [ "Docker image names in Kubernetes manifests follow the same rules as everywhere else. If you have an image name like `postgres:9.6` or `myname/myimage:foo`, those will be looked up on Docker Hub like normal. If you&#39;re using a third-party repository (Google GCR, Amazon ECR, _URL_1_, ...) you need to include the repository name in the image name. It&#39;s the exact same string you&#39;d give to `docker run` or `docker build -t`.\r\n\r\nHelm doesn&#39;t directly talk to the Docker registry. The Helm flow here is:\r\n\r\n1. The local Helm client sends the chart to the Helm Tiller.\r\n2. Tiller applies any templating in the chart, and sends it to the Kubernetes API.\r\n3. This creates a Deployment object with an embedded Pod spec.\r\n4. Kubernetes creates Pods from the Deployment, which have image name references.\r\n\r\nSo if your Helm chart names an image that doesn&#39;t exist, all of this flow will run normally, until it creates Pods that wind up in `ImagePullBackOff` state.\r\n\r\nP.S.: if you&#39;re not already doing this, you should make the image tag (the part after the colon) configurable in your Helm chart, and declare your image name as something like `_URL_0_:{{ .Values.tag }}`. Your CD system can then give each build a distinct tag and pass it into `helm install`. This makes it possible to roll back fairly seamlessly.", "324" ], [ "The [itertools recipes](_URL_0_) in the standard library documentation include this recipe (quoted verbatim):\r\n\r\n from itertools import zip_longest\r\n def grouper(iterable, n, fillvalue=None):\r\n \" ;Collect data into fixed-length chunks or blocks \" ;\r\n # grouper(&#39;ABCDEFG&#39;, 3, &#39;x&#39;) -- > ABC DEF Gxx \" ;\r\n args = [iter(iterable)] * n\r\n return zip_longest(*args, fillvalue=fillvalue)\r\n\r\nYou can use that to wrap your `iglob()` call to bring back chunks of 50 elements (the last one will have extra `None` at the end) and then iterate through that list.\r\n\r\n i_files = iglob(os.path.join(PATH, &#39;*.sh&#39;))\r\n i_grouped = grouper(i_files, 50)\r\n for (n, group) in enumerate(i_grouped):\r\n destination_fn = &#39;allcontents_{}.sh&#39;.format(n)\r\n with open(destination_fn, &#39;w&#39;) as f:\r\n for input_fn in group:\r\n ...", "319" ], [ "It does sound like you&#39;re looking for \" ;more industrial infrastructure \" ;; for instance, Kubernetes has a better-defined network model, a declarative resource specification, support for rolling updates of individual containers, and an abstract model for defining the sort of reverse proxy you&#39;re looking for. Docker Compose is a good tool for small jobs but it sounds like you have a bigger one.", "314" ], [ "A very typical use of an `ENTRYPOINT` is to have it set to a wrapper script that receives the \" ;real \" ; command as command-line arguments. It does whatever setup it needs to do, then runs the actual command.\r\n\r\n < !-- language: lang-sh -- > \r\n\r\n #!/bin/sh\r\n chown -R ...\r\n exec \" ;$@ \" ;\r\n\r\nThen in the same way you can run the base images with just a command line, you can run your own images, without a random `-c` argument\r\n\r\n < !-- language: lang-sh -- > \r\n\r\n docker run ubuntu:18.04 ls -l /\r\n docker run test:1 ls -l /\r\n\r\nWhatever it is your container usually does, you&#39;d set it as a `CMD`.\r\n\r\n COPY _URL_0_ /\r\n ENTRYPOINT [ \" ;/_URL_0_ \" ;]\r\n CMD [ \" ;my-server \" ;, \" ;--foreground \" ;]\r\n\r\nIf you needed an interactive shell, your entrypoint script gets to do its setup before the actual shell gets launched.\r\n\r\n < !-- language: lang-sh -- > \r\n\r\n docker run --rm -it test:1 sh\r\n\r\nI believe the bind-mounted volume&#39;s ownership changing is specifically a feature of Docker for Mac, and it&#39;s a consequence of Docker running in a hidden Linux VM that can&#39;t directly use the OSX host filesystem. There is some [extended discussion in the Docker documentation](_URL_1_), more specifically including what happens when a container `chown`s a file.", "324" ], [ "Even for small standalone applications, using the standard distribution tools streamlines this process significantly. This is doubly true if you have colleagues that might have different usernames, directory layouts, or even operating systems. Don&#39;t manually edit `sys.path` in your script.\r\n\r\nYou should write a `_URL_2_` file that uses the `setuptools` library. [Complete documentation is here](_URL_3_) but a minimal example might look like:\r\n\r\n #!/usr/bin/env python\r\n from setuptools import setup, find_packages\r\n setup(\r\n name= \" ;fmeobjects \" ;,\r\n version= \" ;0.1 \" ;,\r\n packages=find_packages(),\r\n entry_points={\r\n &#39;console_scripts&#39;: [\r\n &#39;fmeobjects = fmeobjects.main:main&#39;\r\n ]\r\n }\r\n )\r\n\r\nFor development use, create a [virtual environment](_URL_1_) and install your package in it.\r\n\r\n < !-- language: lang-sh -- > \r\n\r\n virtualenv vpy\r\n . vpy/bin/activate\r\n pip install -e .\r\n\r\nThe `. activate` line sets some additional environment variables for you, including adding the virtual environment to your `$PATH`. (`source` is an equivalent vendor extension that works in some shells; `.` is part of the standard and works even in minimal shells like what you get in Alpine or Busybox installations.) You can now run `fmeobjects` at the shell prompt, which will call the `main()` function in `fmeobjects/_URL_0_` (see the `entry_points` declaration).\r\n\r\nYou have a couple of options of how to install this in Docker. Probably the most straightforward is to simply import your source tree and install it. Since Docker containers provide isolated filesystems and generally do only one thing, there&#39;s not much point in supporting an isolated Python installation within that; just install your package into the global Python.\r\n\r\n FROM python:2.7\r\n WORKDIR /usr/src/app\r\n COPY . .\r\n RUN pip install .\r\n CMD [ \" ;fmeobjects \" ;]\r\n\r\n(If your virtual environment is in your source tree, you can add `vpy` to a `.dockerignore` file to cause it to not be copied, saving time and space.)", "483" ], [ "If I&#39;m actively iterating on my code, I tend to do it outside Docker for less of this sort of friction. You might `docker run` your image with a consistent `--name` so that it&#39;s easier to `docker rm` later (saves the `docker ps` step). You also can use Docker Compose here; re-running `docker-compose up` will recreate an existing container if it needs to and has all of the container options written down in the YAML file.", "324" ], [ "Sure, ENTRYPOINT can do that. It takes the CMD as command-line arguments. Usually your ENTRYPOINT script will want to `exec \" ;$@ \" ;` to run the CMD after doing its setup, but if you&#39;re willing to take on the responsibility of being process ID 1, you can run CMD as a subprocess and then do stuff afterwards.\r\n\r\n < !-- language: lang-sh -- > \r\n\r\n #!/bin/sh\r\n echo \" ;BEFORE \" ;\r\n \" ;$@ \" ;\r\n STATUS=$?\r\n echo \" ;AFTER \" ;\r\n exit $STATUS\r\n\r\nNote that the set of things you can usefully do at termination is pretty limited since your filesystem is about to go away.\r\n\r\nAlso note that this requires you to run your \" ;normal \" ; process as CMD, but for reasons like this I tend to think of that as better practice in any case. Your Dockerfile would look something like\r\n\r\n ...\r\n COPY _URL_0_ /\r\n ENTRYPOINT [ \" ;/_URL_0_ \" ;]\r\n CMD [ \" ;whateverd \" ;, \" ;--foreground \" ;]", "351" ], [ "Just install software in the \" ;normal \" ; locations like `/usr/bin`. Since the Dockerfile fully documents what you did and containers usually do \" ;just one thing \" ; there&#39;s not really any harm in doing this.\r\n\r\n FROM ubuntu:16.04\r\n COPY hello /usr/bin\r\n RUN adduser nonroot\r\n USER nonroot\r\n CMD [ \" ;hello \" ;]\r\n\r\nIf you needed to set some global environment variables, use the Dockerfile ENV directive.\r\n\r\nRemember that if you use a CMD like this it doesn&#39;t go through a shell at all; if you do have a shell, it probably isn&#39;t a login shell; and the lighter-weight base images won&#39;t have GNU bash and its various non-portable extensions. At least in my mostly server-oriented Docker work I&#39;ve never needed to add shell dot files to an image.", "324" ], [ "The Dockerfile instructions don’t do much; they record some state in fields in the built Docker image. As @BrayanCaldera’s answer indicates, you’ll see these go by in the `docker build` output, but nothing runs during container build time.\r\n\r\nIf the ENTRYPOINT is a full-blown script then you can use usual script debugging techniques on it to see what happens when the container starts up. For instance:\r\n\r\n #!/bin/sh\r\n # Print out every command as it executes\r\n set -x\r\n # Print out the current environment\r\n env\r\n # Run the actual command\r\n exec \" ;$@ \" ;\r\n\r\nTo tell the Docker image what to do by default when you `docker run` you should usually use the CMD directive. If you need to do pre-launch setup then an ENTRYPOINT script that uses `exec \" ;$@ \" ;` to run the CMD is a typical path.", "324" ], [ "A Helm template can contain an arbitrary amount of text, just so long as when all of the macros are expanded it produces a valid YAML Kubernetes manifest. ( \" ;Valid YAML \" ; is trickier than it sounds because the indentation matters.)\r\n\r\nThe simplest way to do this would be to write a shared Helm template that included the definition for the init container:\r\n\r\n**_init_container.tpl:**\r\n\r\n {{- define \" ;common.myinit \" ; -}}\r\n name: myinit\r\n image: myname/myinit:{{ .Values.initTag }}\r\n # Other things from a container spec\r\n {{ end -}}\r\n\r\nThen in your deployment, include this:\r\n\r\n**deployment.yaml:**\r\n\r\n apiVersion: v1\r\n kind: Deployment\r\n spec:\r\n template:\r\n spec:\r\n initContainers:\r\n - {{ include \" ;common.myinit \" ; . | indent 10 | strip }}\r\n\r\nThen you can copy the `_init_container.tpl` file into each of your individual services.\r\n\r\nIf you want to avoid the copy-and-paste (reasonable enough) you can create a Helm chart that contains only templates and no actual Kubernetes resources. You need to set up some sort of repository to hold this chart. Put the `_init_container.tpl` into that shared chart, declare it as a dependency is the chart metadata, and reference the template in your deployment YAML in the same way (Go template names are shared across all included charts).", "213" ], [ "You should create a separate image for each part of your application. These can be based on the base image if you&#39;d like; the Dockerfile might look like\r\n\r\n FROM base_generic_image\r\n COPY dlc /usr/bin\r\n CMD [ \" ;dlc \" ;]\r\n\r\nYour Docker Compose setup might have a subdirectory for each component and could look like\r\n\r\n servicename:\r\n image: my/servicename\r\n build:\r\n context: ./servicename\r\n command: [ \" ;dlc \" ;, \" ;-p \" ;, ...]\r\n\r\nIn general Docker volumes and bind-mounts are good things to use for persistent data (when absolutely required; stateless containers with external databases are often easier to manage), getting log files out of containers, and pushing complex configuration into containers. The actual program that&#39;s being run generally should be built into the base image. The goal is that you can take the image and `docker run` it on a clean system without any of your development environment on it.", "324" ], [ "Best practice is typically to not make outbound ssh connections from containers. If what you’re trying to add to your container is a binary or application code, manage your source control setup outside Docker and COPY the data into an image. If it’s data your application needs to run, again fetch it externally and use `docker run -v` to inject it into the container.\r\n\r\nAs you say, managing this key material securely, and obeying ssh’s Unix permission requirements, is incredibly tricky. If I really didn’t have a choice but to do this I’d write an ENTRYPOINT script that copied the private key from a bind-mounted volume to my container user’s `.ssh` directory. But my first choice would be to redesign my application flow to not need this at all.", "324" ], [ "The Relay [top-level node query](_URL_0_) gives a standard way to do this. If most objects implement its `Node` interface, then you can use the top-level `node(id: ID!)` query to retrieve a specific object.\r\n\r\n query GetFirstDatum {\r\n currentUser {\r\n id\r\n data1\r\n }\r\n }\r\n query GetSecondDatum($id: ID!) {\r\n node(id: $id) {\r\n ... on User {\r\n data2\r\n }\r\n }\r\n }\r\n\r\nThis requires providing the `Node` interface in your IDL, having your objects implement it, and providing an implementation of the top-level `node` query that can return an object given its ID. Most server libraries have some level of support for this.", "97" ], [ "[The documentation for the Python pickle library](_URL_0_) notes:\r\n\r\n > The data format used by `pickle` is Python-specific. This \\[...\\] means that non-Python programs may not be able to reconstruct pickled Python objects.\r\n\r\nIn principle you could read back the format (it&#39;s \" ;just \" ; a byte stream representing an object graph) and assign some meaning to the Python class name references in the pickle file. This would be highly specific to the specific object format you&#39;re reading back.\r\n\r\nMy gut feel is that if it would take you 3 days to re-train your model using either Go-native tools or export it into a more neutral format, that will probably be faster and less frustrating than trying to decode the pickle file.", "977" ], [ "You should use the standard [setuptools](_URL_3_) library to [write a `_URL_2_` file](_URL_0_). In particular you can [write an `entry_points` section](_URL_0_#automatic-script-creation) that names your main script:\r\n\r\n entry_points={\r\n &#39;console_scripts&#39;: [\r\n &#39;alias_to_my_project = project.main.main&#39;\r\n ]\r\n }\r\n\r\nOnce you&#39;ve done this, you can activate and install your package into your virtual environment\r\n\r\n < !-- lang: lang-sh -- > \r\n\r\n pipenv install -e .\r\n\r\n # or without pipenv\r\n . ~/vpy/bin/activate\r\n pip install -e .\r\n\r\nThis will create a wrapper script in `$VIRTUAL_ENV/bin/alias_to_my_project` that loads the `project.main` Python module and calls its `main` function.\r\n\r\n**The wrapper script knows about the virtual environment and can be called directly** without specifically activating the virtual environment. So you can do something like\r\n\r\n < !-- language: lang-sh -- > \r\n\r\n ln -s $VIRTUAL_ENV/bin/alias_to_my_project $HOME/bin/alias_to_my_project\r\n PATH=$HOME/bin:$PATH\r\n\r\nand it will always be available.", "435" ], [ "IMHO the official Docker tutorial part 2 is super super useful and everyone should read it, and beyond that they assume you’ve bought into Swarm, which is pretty optional. As @Bizmate says you have several options including just plain `docker run` on an EC2 instance; you might clarify if you’re specifically trying to use Swarm or just want your container running on an instance somewhere.", "324" ], [ "Simple, no, but some shell wizardry is possible. I think this shell script will do what you want:\r\n\r\n < !-- language: lang-sh -- > \r\n\r\n #!/bin/sh\r\n docker images --filter &#39;reference=myimage:*&#39; \\\r\n --format &#39;{{ .CreatedAt }}/{{ .ID }}/{{ .Repository }}:{{ .Tag }}&#39; \\\r\n | sort -r \\\r\n | tail +11 \\\r\n | cut -f/ -d2 \\\r\n | xargs docker rmi\r\n\r\n(You might try running this one step at a time to see what comes out.)\r\n\r\nIn smaller pieces:\r\n\r\n1. List all of the `myimage:*` images in a format that starts with their date. (If you&#39;re using a private registry you must include the registry name as a separate part and you must explicitly include the tag; for instance to list all of your GCR images you need `-f &#39;reference=_URL_0_;`.)\r\n2. Sort them, by the date, newest first.\r\n3. Skip the first 10 lines and start printing at the 11th.\r\n4. Take only the second slash-separated field (which from the `--format` option is the hex image ID).\r\n5. Convert that to command-line arguments to `docker rmi`.\r\n\r\nThe [extended `docker images` documentation](_URL_1_) lists all of the valid `--format` options.", "523" ], [ "I&#39;d advise you to avoid systemd in a container if at all possible.\r\n\r\n[Systemd](_URL_1_) mounts filesystems, controls several kernel parameters, has its own internal system for capturing process output, configures system swap space, configures huge pages and POSIX message queues, starts an inter-process message bus, starts per-terminal login prompts, and manages a swath of system services. Many of these are things Docker does for you; others are system-level controls that Docker by default prevents (for good reason).\r\n\r\nUsually you want a container to do _one_ thing, which occasionally requires multiple coordinating processes, but you usually don&#39;t want it to do any of the things systemd does beyond provide the process manager. Since systemd changes so many host-level parameters you often need to run it as `--privileged` which breaks the Docker isolation, which is usually a bad idea.\r\n\r\nAs you say in the question, running one \" ;piece \" ; per container is usually considered best. If you can&#39;t do this then a light-weight process manager like [supervisord](_URL_0_) that does the very minimum an init process is required to is a better match, both for the Docker and Unix philosophies.", "324" ], [ "Every Service has a corresponding [Endpoints](_URL_0_) object. This isn’t super prominent in the main documentation, but it’s the object that has the list of everything the service actually points at.\r\n\r\nOne shell-oriented recipe that will give you the data:\r\n\r\n kubectl get endpoints my-service-name -o json \\\r\n | jq &#39;.subsets[].addresses[].targetRef&#39;\r\n\r\nIts output includes, for each Pod targeted by the Service, its name and namespace. The containing EndpointAddress object also includes the pod private IP address and the name of the Node running the pod.", "651" ], [ "The DTD can provide default attribute values. This processing happens before applying any XPath expressions. The DTD you reference here is somewhat complex, but if I run an identity XSLT stylesheet over it (take the input, fill in any defaults from the DTD, and just copy it out) the preprocessed input looks more like (lightly formatted)\r\n\r\n < !-- language: lang-xml -- > \r\n\r\n < ?xml version= \" ;1.0 \" ;? > \r\n < concept xmlns:ditaarch= \" ;_URL_0_;\r\n id= \" ;mobileapp_gs \" ;\r\n rev= \" ;3 \" ;\r\n ditaarch:DITAArchVersion= \" ;1.1 \" ;\r\n domains= \" ;(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic indexing-d) \" ;\r\n class= \" ;- topic/topic concept/concept \" ; > \r\n < title class= \" ;- topic/title \" ; > Getting started < /title > \r\n < conbody class= \" ;- topic/body concept/conbody \" ; > \r\n < /conbody > \r\n < /concept > \r\n\r\nAfter this step, the ` < concept / > ` element more obviously has a `class` attribute containing `topic/topic`, with a child element with a `class` attribute containing `topic/title`.", "532" ], [ "I think the \" ;pids \" ; column in your first output is the number of processes in the container, not any specific process&#39;s process ID. Also remember when looking at this that each container starts up with its own pid space and the main process you start via `docker run` or a Dockerfile `CMD` is, within the container, process ID 1, with the rights and responsibilities that entails; but on the host a Docker container is \" ;just \" ; a process with some encapsulation and so it will have a distinct host pid.", "707" ], [ "When you start a Docker image `FROM scratch` you get absolutely nothing. Usually the way you work with one of these is by building a static binary on your host (or these days in an earlier Dockerfile build stage) and then `COPY` it into the image.\r\n\r\n FROM scratch\r\n COPY mybinary /\r\n ENTRYPOINT [ \" ;/mybinary \" ;]\r\n\r\nNothing would stop you from creating a derived image and `COPY`ing additional binaries into it. Either you&#39;d have to specifically build a static binary or install a full dynamic library environment.\r\n\r\nIf you&#39;re doing this to try to debug the container, there is probably nothing else in the image. One thing this means is that the set of things you can do with a shell is pretty boring. The other is that you&#39;re not going to have the standard tool set you&#39;re used to (there is not an `ls` or a `cp`). If you can live without bash&#39;s various extensions, [BusyBox](_URL_0_) is a small tool designed to be statically built and installed in limited environments that provides minimal versions of most of these standard tools.", "324" ], [ "The [Dockerfile for that image says:](_URL_1_)\r\n\r\n ENTRYPOINT [ \" ;flyway \" ;]\r\n CMD [ \" ;-? \" ;]\r\n\r\nThese two parts are concatenated together, and anything you type as parameters to `docker run` only replaces the `CMD` part. That is, in effect you&#39;re running `flyway ./_URL_0_ ...`, and the `flyway` command doesn&#39;t understand what to do with it.\r\n\r\nIf you want to continue on this path, probably your easiest next step is to write your own custom image `FROM boxfuse/flyway` that `COPY _URL_0_` into the image, then adds its own entrypoint script that does the `wait-for-it` step and ends with `exec flyway \" ;$@ \" ;`.", "707" ], [ "`docker commit` doesn&#39;t save data in external volumes, which presumably your image has. I&#39;d recommend reading through Docker&#39;s [official tutorial and building and running custom images](_URL_0_), though: IME none of all-in-one containers, running interactive commands on running containers, or using `docker commit` are considered best practices.", "324" ], [ "It sounds like you&#39;re looking for a tutorial in your language of choice to make an HTTP POST request, or maybe a better API for your database system. Asking questions of SO isn&#39;t necessarily the best way to do this: better questions tend to already have almost-working code. There&#39;s some suggestions on [ask] in the SO Help Center.", "262" ], [ "My advice if you are very new to this space is to learn general Web development first, and don&#39;t try to throw Docker into the mix very early. The Linux/shell-scripting/networking knowledge you need to effectively use Docker is different from the JavaScript/CSS/HTML knowledge you need for Web development. Something that&#39;s well-built and works well will always be more effective than something that tries to use the latest technologies for their own sake.", "324" ], [ "CDATA sections are really just an alternate escaping mechanism: at an XML level your desired result is the ` < Output/ > ` element with text content that happens to be the serialized output. DataPower includes a [` < dp:serialize/ > ` extension](_URL_1_) that can do this.\r\n\r\nI think a working stylesheet should look something like\r\n\r\n < !-- language: lang-xml -- > \r\n\r\n < ?xml version= \" ;1.0 \" ;? > \r\n < xsl:stylesheet\r\n version= \" ;1.0 \" ;\r\n extension-element-prefixes= \" ;dp \" ;\r\n xmlns:xsl= \" ;_URL_0_;\r\n xmlns:dp= \" ;_URL_2_;\r\n < xsl:output method= \" ;xml \" ; cdata-section-elements= \" ;Output \" ;/ > \r\n < xsl:template match= \" ;/ \" ; > \r\n < Output > \r\n < dp:serialize select= \" ;. \" ;/ > \r\n < /Output > \r\n < /xsl:template > \r\n < /xsl:stylesheet > \r\n\r\n(This has always been a little bit odd construction, because you can embed XML in XML directly; if you control the application and schema you might consider trying to change it so you don&#39;t need to XML parse the text content of an XML element.)", "972" ], [ "Here&#39;s one way to break this down.\r\n\r\nIf you look at the main body of your loop, you can restructure it as generating a sublist for each number, and then combining the sublists together.\r\n\r\n sublists = []\r\n for i in range(10):\r\n sublists.append([i] + 9 * [&#39;&#39;])\r\n\r\n labels = []\r\n for sublist in sublists:\r\n labels = labels + sublist\r\n\r\n labels = labels + [10]\r\n\r\nThe first part of this takes a list of numbers, calls the same function on each of them, and produces a list of results. This operation is [map](_URL_0_) (and indeed has this name in many languages). The second part takes a list of lists and flattens them into one big list; many languages have a \" ;concat \" ; or \" ;flatten \" ; operation, but in Python [it can be a little clunky](_URL_1_).\r\n\r\n from itertools import chain\r\n sublists = map(range(10), lambda i: [i] + 9 * [&#39;&#39;])\r\n labels = list(chain.from_iterable(sublists))\r\n labels = labels + [10]\r\n\r\nThe `map()` call in particular easily transforms into a list comprehension (or a generator comprehension)\r\n\r\n from itertools import chain\r\n sublists = [[i] + 9 * [&#39;&#39;] for i in range(10)]\r\n labels = list(chain.from_iterable(sublists))\r\n labels = labels + [10]\r\n\r\nand so if you want to turn this into a one-liner you can have\r\n\r\n from itertools import chain\r\n labels = list(chain.from_iterable([i] + 9 * [&#39;&#39;] for i in range(10))) + [10]\r\n\r\n---\r\n\r\nFor something completely different, you could potentially use a generator function to make it clearer what you&#39;re doing. Really, for each item in the input, you&#39;re emitting the item, and if it&#39;s not the last item, emitting nine lists containing empty strings. You can then take the sequence produced by the generator function and convert it to a list.\r\n\r\n def emit_with_blanks(iter):\r\n l = list(iter)\r\n for i, n in enumerate(l):\r\n yield [i]\r\n if i == len(l) - 1:\r\n break\r\n for _ in range(9):\r\n yield [&#39;&#39;]\r\n\r\n labels = list(emit_with_blanks(range(10))\r\n\r\nThis is definitely longer and slower (in a way that shouldn&#39;t matter in practice) but it could be easier to reason about what it&#39;s doing than the one-liner, especially if you come back to it six months later and are trying to remember what exactly the code does.", "319" ], [ "In Python 3, `dict.items()` (and also `.keys()` and `.values()`) returns a special [dictionary view object](_URL_0_). It behaves like an iterator, but isn&#39;t specifically a list.\r\n\r\n #!/usr/bin/env python3\r\n d = {}\r\n d[&#39;a&#39;] = 1\r\n d[&#39;b&#39;] = 2\r\n\r\n # You can pack items() into a list and then it&#39;s a \" ;real \" ; list \r\n l = list(d.items())\r\n print(repr(l[1]))\r\n \r\n # Or you can use itertools or otherwise use it as a plain iterator\r\n import itertools\r\n for p in itertools.islice(d.items(), 1, 2):\r\n print(repr(p))", "58" ], [ "It should almost definitely be safe to cache the client object, and doing so tends to be a good idea in general. ( \" ;Create one client and reuse it \" ; is a good general rule.)\r\n\r\nMy understanding is that the signing keys for JWTs are typically valid for months if not longer. ([Auth0&#39;s documentation notes](_URL_1_) that its JWKS documents only ever have a single key, but it will issue signed tokens all the time, so the keys must be valid for \" ;a while \" ;.) [RFC 7517](_URL_0_) doesn&#39;t define any expiration-related parameters on either a JWKS or an individual JWK, and I think the best practice is to use ordinary HTTP caching controls on the JWKS endpoint to refresh it occasionally, but not that often.", "422" ], [ "If you’re building your own Docker image, you control the filesystem layout entirely. For Linux-based images it’s common to follow the FHS standard (I think the standard MySQL image stores its data in `/var/lib/mysql`) but it’s also common enough to just store data in subdirectories of the root directory (`/data` or `/config` or what not).\r\n\r\nIf you have a setup like this, your image should pick a path. If the only thing in the configuration is the location of that directory, it’s fine to hard-code it in the image. However you document your image (even if it’s just a standard `docker-compose.yml` file) mention that you have this fixed path; it doesn’t need to match the host path (if any) on any particular system.", "324" ], [ "The important thing is that you need a shell to expand your command line, so I’d write\r\n\r\n CMD python _URL_0_ images/*\r\n\r\nWhen you just write CMD like this (without the not-really-JSON brackets and quotes) Docker will implicitly feed the command line through a shell for you.\r\n\r\n(You also might consider changing your application to support taking a directory name as configuration in some form and “baking it in” to your application, if these images will be in a fixed place in the container filesystem.)\r\n\r\nI would only set ENTRYPOINT when (a) you are setting it to a wrapper shell script that does some first-time setup and then `exec \" ;$@ \" ;`; or (b) when you have a `FROM scratch` image with a static binary and you literally cannot do anything with the container besides run the one binary in it.", "324" ], [ "Kubernetes has an `imagePullPolicy:` setting to control this. The default is that a node will only pull an image if it doesn’t already have it, except that if the image is using the `:latest` tag, it will always pull the image.\r\n\r\nIf you have a base image and then some derived image `FROM my/base:latest`, the derived image will include a specific version of the base image as its lowermost layers. If you update the base image and don’t rebuild the derived images, they will still use the same version of the base image. So, if you update the base image, you need to rebuild all of the deployed images.\r\n\r\nIf you have a running pod of some form and it’s running a `:latest` tag and the actual image that tag points at changes, Kubernetes has no way of noticing that, so you need to manually delete pods to force it to recreate them. That’s bad. **Best practice is to use some explicit non-latest version tag** (a date stamp works fine) so that you can update the image in the deployment and Kubernetes will redeploy for you.", "696" ], [ "Docker-in-Docker is generally considered fragile and hard to maintain and using it isn’t a best practice. _URL_1_ has a little discussion on this.\r\n\r\nA straightforward (but potentially dangerous) way to rearrange this is to give the server process access to the host’s Docker socket, with `docker run -v /var/run/docker.sock:/var/run/docker.sock`. Then it could launch its own Docker containers as needed. Note that if you do this, these sub-containers’ `docker run -v` options refer to the _host’s_ filesystem, not the calling container’s filesystem, so if you’re trying to use the filesystem to transfer data this can get tricky. Also note that being able to run any Docker command this way gives unlimited access to the host, so you need to be extremely careful about how you launch containers.\r\n\r\nA larger redesign would be to introduce some sort of message-queueing system; I’ve successfully used [RabbitMQ](_URL_0_) in the past but there are many other options. Instead of the server process launching a subprocess directly, it writes a message to a queue. Instead of the workers being short-lived processes that start and stop frequently, you have a long-lived worker that reads jobs off the queue and does them. This puts you in a much more established Docker space where nothing needs to dynamically start and stop containers, and you can easily test the Node-Rabbit-worker stack in a non-Docker environment.", "324" ], [ "If you have multiple containers in the same pod, they can speak to each other as `localhost` and can share mounted volumes.\r\n\r\nIf you have multiple pods of one container each, you can restart one without restarting the other. Assuming they&#39;re controlled by deployments, you can add additional replicas of one without necessarily scaling the other. If the version or some other characteristic of one of them changes, you&#39;re not forced to restart the other. You&#39;d need to set up a service to talk from one to the other, and they can&#39;t communicate via a filesystem.\r\n\r\nThe general approach I&#39;ve always seen is to always have one container per pod within a deployment, unless you have a specific reason to need an additional container. Usually this is some kind of special-purpose \" ;sidecar \" ; that talks to a credentials service, or manages logging, or runs a network proxy, or something else that&#39;s secondary to the main thing the pod does (and isn&#39;t a separate service in its own right).", "314" ], [ "To get the net effect of this, you should:\r\n\r\n1. Write a `Dockerfile` that does the work of installing your application in a pristine Docker container (running `docker build` will make an image out of it)\r\n\r\n2. Check this `Dockerfile` into your git repository alongside your source code\r\n\r\n3. Set up some CI system to rebuild the Docker container on every change and tag it with some unique tag (a timestamp, the git commit hash, a relevant git tag) and push it to a repository\r\n\r\n4. On the systems where the containers are running, `docker stop & & docker rm` them, then `docker run` them with the new tagged image\r\n\r\nThis approach has two important advantages over what you describe. The first is that anybody who has the source repository can rebuild exactly the running image. (In your approach if you accidentally lose a running container you can&#39;t reproduce what was running.) The second is that, if a build goes wrong, it&#39;s easy enough to roll back to running the previous version of the image just by changing the tag back.\r\n\r\nIn particular, if you&#39;re asking \" ;can I run something like a bash script, with `docker run`, so that I can `docker commit` the result \" ;, a `Dockerfile` is almost exactly what you&#39;re looking for.\r\n\r\nThe last step is the least well-defined of these. You can use a simple cluster manager tool like Ansible to cause containers to be running in places; or update an image version in something like a Docker Compose YAML file running on Docker Swarm; or the watchtower tool you identified it looks like could do it. This is something that Kubernetes does extremely well, but it&#39;s...an investment.\r\n\r\nIn the workflow you describe, there are a couple of things I would say are distinctly not best practices in production environments. I&#39;d suggest you should basically never use `docker commit` (`docker build` is quite straightforward and gives you reproducible image builds; even in the context of an SO question \" ;here&#39;s my Dockerfile \" ; is much easier to describe than \" ;I did a bunch of stuff in a container and then committed it \" ;). `docker exec` is useful for debugging but shouldn&#39;t be the principal way you interact with containers. Finally, using the same image name/tag and committing different images under that same tag makes it difficult to roll back to an older version of the code ( \" ;don&#39;t use the `:latest` tag \" ;).", "324" ], [ "That&#39;s unusual. If the repository that includes the `Dockerfile` is very very large then there&#39;s an initial copy step that can take a lot of time; excluding files via a `.dockerignore` file can help. If there are first-time setup steps that take a while then `docker build` will remember the second time you run it the result of the first run and essentially skip them. On more modest projects (especially if there&#39;s not a \" ;compile \" ; step involved) building an image generally takes me seconds.", "324" ], [ "The virtual environment tree contains a `bin` directory, and setuptools will install stub programs there that correctly set up the Python environment and then run some main function within that. This means you can _directly_ run one of those stub programs without \" ;activating \" ; the virtual environment or setting up any environment variables.\r\n\r\nIf you have a directory tree that looks roughly like:\r\n\r\n \\--.virtualenvs\r\n +-- app-py37\r\n | +-- bin\r\n | | \\-- app\r\n | \\-- lib\r\n | \\-- ...\r\n | \\-- app_main.py\r\n +-- other-py27\r\n +-- bin\r\n | \\-- helper\r\n \\-- lib\r\n \\-- ...\r\n \\-- helper_main.py\r\n\r\n and you invoked the helper with a call like\r\n\r\n import os\r\n import subprocess\r\n subprocess.run([os.path.join(os.environ(&#39;HOME&#39;),\r\n &#39;.virtualenvs&#39;, &#39;other-py27&#39;, &#39;bin&#39;, &#39;helper&#39;],\r\n check=True)\r\n\r\nI would expect it to correctly set up its own Python environment.", "191" ], [ "In general you&#39;ll find it easiest if you explicitly qualify your image names to include the repository name, and not depend on a default value that isn&#39;t the official Docker Hub\r\n\r\n image: _URL_0_\r\n\r\nin which case you can just change the image name in your deployment\r\n\r\n image: _URL_2_\r\n\r\nIf you&#39;re using a system like [Helm](_URL_3_) to manage your Kubernetes manifests, you might find it helpful to include the image base name and/or repository in its values file\r\n\r\n image: _URL_1_\r\n tag: 1.2.3\r\n\r\n image: {{ printf \" ;%s:%s \" ; .Values.image .Values.tag }}\r\n\r\nand then you can just change the image&#39;s repository location and redeploy.", "324" ], [ "The [bcrypt hash algorithm](_URL_1_), by design, generates a different encrypted string every time you call it (it is [salted](_URL_0_)). If you have a plaintext password you want to check, and ciphertext in the database, you should be able to pass those two things to `bcrypt.CompareHashAndPassword`. Adapting your code:\r\n\r\n var result []string\r\n db.Where( & User{Username: strings.ToLower(data.Username)})\r\n .First( & user)\r\n .Pluck( \" ;password \" ;, & result)\r\n \r\n encryptionErr := bcrypt.CompareHashAndPassword([]byte(result[0]), []byte(data.Password))\r\n\r\nYou shouldn&#39;t need to call `bcrypt.GenerateFromPassword` again; as you note, it will generate a different encrypted password and it should be all but impossible to compare the two for equality.", "957" ], [ "You should probably store your database content somewhere like S3 and ship it separately from the database Docker image.\r\n\r\nUsually a Docker image only contains a program that&#39;s intended to be run, and if there&#39;s persistent state associated with it (like a database&#39;s data) that&#39;s stored separately. You&#39;ll run your image with something like\r\n\r\n docker run --name mongo -v $PWD/mongo:/data mongo\r\n\r\nGenerally if you&#39;ve done this, you can `docker stop` the container, `docker rm` it, then `docker run` a new container against the same data store. If that will work, then it will also work to transplant the data to somewhere else.\r\n\r\nSo I&#39;d suggest a workflow where you use an unmodified database image and separately distribute its data. You&#39;d probably want to have a bootstrap script that looked something like\r\n\r\n < !-- language: lang-sh -- > \r\n\r\n #!/bin/sh\r\n SNAPSHOT=mongo-snapshot-20180831\r\n if [ ! -d $SNAPSHOT ]; then\r\n aws s3 cp s3://my-volume/mongo/$SNAPSHOT.tar.gz $SNAPSHOT.tar.gz\r\n tar xzf $SNAPSHOT.tar.gz\r\n fi\r\n docker run --name mongo -d -p 27017:27017 -v $PWD/$SNAPSHOT:/data mongo:4.1\r\n\r\nWhen I&#39;ve tried to work with very large images in the past, `docker build` and `docker push` on images even as small as 2-4 GB ran into the sorts of troubles you&#39;re describing here (network failures, timeouts, and the like, even just copying the build context into the Docker daemon) and I&#39;d say Docker really just doesn&#39;t work with any image sized in the gigabytes.", "324" ], [ "You could declare something like\r\n\r\n enum IntValue { _1 _2 _3 }\r\n enum IntName { ONE TWO THREE }\r\n\r\nbut in both cases those enumerated values would be different from the numbers `1`, `2`, `3`.\r\n\r\nYou can&#39;t declare something that looks like an enum but contains actual numbers. In the [specification](_URL_2_), an [EnumTypeDefinition](_URL_1_) contains a list of [EnumValueDefinition](_URL_0_Definition), each of which contains a single [EnumValue](_URL_0_); each [value](_URL_4_) is\r\n\r\n > _Name_ but not `true` or `false` or `null`\r\n\r\nand finally a [Name](_URL_3_) must begin with an underscore or a ASCII letter.", "116" ], [ "Newer versions of Docker Compose will do all of the networking setup for you. It will create a Docker-internal network and register an alias for each container under its block name. You don&#39;t need (and shouldn&#39;t use) `links:`. You only need `depends_on:` if you want to bring up only parts of your stack from the command line.\r\n\r\nWhen setting up inter-container connections, always use the other container&#39;s name from the Compose YAML file as a DNS name (without Compose, that container&#39;s `--name` or an alias you explicitly declared at `docker run` time). Configuring these as environment variables is better, particularly if you&#39;ll run the same code outside of Docker with different settings. Never directly look up a container&#39;s IP address or use `localhost` or `<IP_ADDRESS>` in this context: it won&#39;t work.\r\n\r\nI&#39;d write your `docker-compose.yml` file something like:\r\n\r\n\r\n version: &#39;3&#39;\r\n services:\r\n api:\r\n build: ./api\r\n laravel:\r\n build: ./laravel\r\n env:\r\n API_BASEURL: &#39;_URL_0_;\r\n nginx-proxy:\r\n build: ./nginx-proxy\r\n env:\r\n LARAVEL_FCGI: &#39;laravel:9000&#39;\r\n ports:\r\n - \" ;80:80 \" ;\r\n\r\nYou will probably need to write a custom entrypoint script for your nginx proxy that fills in the config file from environment variables. If you&#39;re using a container based on a full Linux distribution then [envsubst](_URL_1_) is an easy tool for this.", "707" ], [ "If you use the standard repository setup, you don’t need to give people ssh access to the nodes, and the nodes are fairly replaceable: if a node dies (and even cloud-hosted nodes sometimes need to be replaced) if it can always pull its content from a Docker repository then you don’t need to do any manual work to start a new one up.\r\n\r\nAt a very very minimum I’d set up (or pay for) a Docker repository (or hosted service: Docker Hub, _URL_0_, Google’s GCR, Amazon’s ECR, ...) and write a build script that `docker build`s an image, `docker push`es it to somewhere appropriate, updates a Deployment object, and `kubectl apply`s it. You don’t necessarily _need_ a CI system (but you probably want one; again you can buy one in the cloud).\r\n\r\nOn a non-technical level, if you design and build a deployment sequence that involves hand-running a sequence of commands, especially in a small company, it will become a maintainability problem (you personally will spend a great deal of time running these same commands over and over and will have to fix it if it doesn’t work).", "324" ], [ "Nope, none of those things can transfer a process with all of its in-memory and on-disk state across hosts.\r\n\r\nIf you’re looking at Kubernetes already, I’d encourage you to design your application so that it doesn’t have any local state. Everything it knows about lives in a database that’s maintained separately (if you’re into AWS, it could be an RDS hosted database or something else). Then you can easily run multiple copies of it (maybe multiple replicas in a Kubernetes ReplicaSet or Deployment) and easily kill one off to restart it somewhere else.\r\n\r\nOne of the high-end virtualization solutions might be able to do what you’re asking, but keeping a program running forever forever is pretty hard, particularly in a scripting language like Python. (How do you update the program? How do you update the underlying OS, when it needs to reboot to take a kernel update?)", "314" ], [ "To a first approximation, commands that launch system services or background processes (`service`, `systemctl`, `initctl`, `start-stop-daemon`, ...) just don&#39;t work in Docker.\r\n\r\nIf you replace all of your script after the initial environment variable setup with the command that runs the actual server _in the foreground_\r\n\r\n #!/bin/sh\r\n LIB=...\r\n ...\r\n ARGS=...\r\n exec ${JAVA} ${ARGS} -classpath \" ;${CLASSPATH} \" ; com.escomled.blackboard.main.DataGridServer\r\n\r\nThe Docker container will stay running until that server process exits, which is what you usually want.", "707" ], [ "In your `Dockerfile` this is easiest if you just install software into directories like `/usr/bin` and `/usr/lib` that are already on `$PATH` and in `/etc/_URL_0_.conf`. Since you&#39;re describing a reproducible build process on something that will run in an isolated filesystem you&#39;re not really \" ;contaminating the installed OS \" ;.\r\n\r\nI&#39;ve seen [some](_URL_2_) [hints](_URL_3_) [that](_URL_1_) Docker might be silently stripping, ignoring, or resetting the `LD_LIBRARY_PATH` environment variable, though I can&#39;t find explicit documentation to that effect.", "324" ], [ "I&#39;m guessing you are looking for something more along the lines of:\r\n\r\n if row[0] in d[&#39;a&#39;].values():\r\n row[1] = d[&#39;b&#39;][row[0]]\r\n\r\nI&#39;ve done a couple of things here. First of all, `dict` is a built-in Python function, so I&#39;ve named your dictionary `d` to not conflict with it.\r\n\r\nSecondly, in this expression:\r\n\r\n d[&#39;b&#39;[0]]\r\n\r\nReading it from the inside out, it takes the string `&#39;b&#39;`, takes the first letter of it, then looks that up in the dictionary. If you rewrite that to:\r\n\r\n d[&#39;b&#39;][row[0]]\r\n\r\nIt looks up the key `&#39;b&#39;` in the dictionary, then takes the element with key `row[0]` in the resulting dictionary.\r\n\r\nFinally, on the left-hand side:\r\n\r\n [row[1]] = ...\r\n\r\nisn&#39;t a valid assignment. You just want to set the second value of an existing array, so you&#39;d write\r\n\r\n row[1] = ...", "58" ], [ "Anyone who can run Docker commands is root, so it doesn&#39;t matter. As a corollary, if you need to make decisions based on the calling host user, you almost certainly _don&#39;t_ want your tool packaged in a Docker image.\r\n\r\nPut another way: if I can use `docker run -v` to bind-mount the host&#39;s `/etc/shadow` into a container for authentication purposes, then I can also `docker run -u root -v /:/host ubuntu sh` and make whatever changes I want to `/host/etc/passwd`, steal and decrypt the root password from `/host/etc/shadow`, add myself to `/host/etc/sudoers`, and so on.", "324" ], [ "**From inside a container**, `localhost` always refers to the current container. It never refers to another container, and it never refers to anything else running on your physical system that&#39;s not in the same container. It&#39;s not usually useful to make outbound connections to `localhost` or configure `localhost` as your database host.\r\n\r\n**From a shell on your host system**, `localhost` could refer to daemons running on your system outside Docker, or to ports you&#39;ve published with `docker run -p` options.\r\n\r\n**From a different system**, `localhost` refers to the system it&#39;s called from.\r\n\r\n**In terms of IP addresses**, `localhost` is always <IP_ADDRESS>, and that IP address is special and is always `localhost` and behaves the same way as above.\r\n\r\n---\r\n\r\n**If you want to make a connection to a container...**\r\n\r\n**...from another container**, the best way is to make sure they&#39;re on the same Docker network (you started them from the same Docker Compose YAML file; you did a `docker network create` and then did `docker run --net ...` on the same network) and use Docker&#39;s internal DNS service to refer to them by the container&#39;s `--name` or its name in the Docker Compose YAML file and the port number inside the container. Even if the target has a published port with a `docker run -p` option or Docker Compose `ports:` setting, use the _second_ (container-internal) port number.\r\n\r\n**...from outside Docker space**, make sure you started the container with a `docker run -p` or Docker Compose `ports:` option, and connect to the _host&#39;s_ IP address or DNS name using the first port number from that option.\r\n\r\n**...from a terminal window or browser on the same physical host**, not in a container, in this case and in this case only, `localhost` will work consistently.\r\n\r\n---\r\n\r\n**Except:**\r\n\r\nIf you started a container with `--net host`, `localhost` refers to the physical host, and you&#39;re in the \" ;terminal window on the same physical host \" ; scenario.\r\n\r\nIf you&#39;ve gone out of your way to have multiple servers in the same container, you can use `localhost` to communicate between them.\r\n\r\nIf you&#39;re running in Kubernetes, and you have multiple containers in the same pod, you can use `localhost` to communicate between them. Between pods, you should set up a service in front of each pod/deployment, and use DNS names of the form `service-name.namespace-name.svc.cluster.local`.", "707" ], [ "The right approach tends to be to provide appropriate storage setup outside your container, rather than trying to mount things in your container. In the specific case of Kubernetes this means setting up appropriate [Volumes](_URL_1_) and then mounting them in your pod spec.\r\n\r\nThere&#39;s not an out-of-the-box SMB/CIFS Volume driver, but it looks like [Microsoft publishes Kubernetes storage plugins](_URL_0_) that can help.", "43" ], [ "`EXPOSE` is mostly documentation. In the unusual event you `docker run -P`, Docker will publish all exposed ports on the host, and pick its own ports for the host ports; this won&#39;t have port conflicts, but you need to `docker inspect` the container to find the host port, and that&#39;s kind of a hassle.\r\n\r\n`CMD` in a Dockerfile provides a default for the `command:` in `docker-compose.yml` and also the last half of the `docker run` command. If you can put some default in the Dockerfile that&#39;s better (the thing you&#39;ve quoted for instance is very reasonable). But it&#39;s helpful if you can\r\n\r\n # Run the server\r\n docker run -p8001:8001 myimage\r\n\r\n # ...well, that didn&#39;t work, why not?\r\n docker run --rm -it myimage /bin/sh\r\n\r\nwhich works better if the image knows its own default `CMD`.\r\n\r\n(I&#39;d recommend avoiding `ENTRYPOINT` unless you know what it&#39;s for; a typical setup would be pointing it at a shell script does some setup work and then ends in `exec \" ;$@ \" ;` to run the `CMD`.)", "707" ], [ "The technique you&#39;ve described will work fine. I&#39;d write it slightly differently:\r\n\r\n #!/bin/sh\r\n . /opt/_URL_0_\r\n exec \" ;$@ \" ;\r\n\r\nThis will set environment variables for the main process in your container (and not ignore the `CMD` or anything you set on the command line). It won&#39;t affect any other shells you happen to launch with `docker exec`: they don&#39;t run as children of the container&#39;s main process and won&#39;t have \" ;seen \" ; these environment variable settings.\r\n\r\nThis technique won&#39;t make it particularly easier or harder to change environment variables in your container. Since the only way one process&#39;s environment can affect another&#39;s is by providing the initial environment when it starts up, even if you edit the `_URL_0_` in the live container (not generally a best practice) it won&#39;t affect the main process&#39;s environment (in your case, the `tail` command). This is one of a number of common situations where you need to at least restart the container to make changes take effect.", "191" ], [ "When you use `--net host` you share the host&#39;s entire network setup and all of its interfaces. The container doesn&#39;t have its own IP address. You&#39;re in the exact same network environment as if, say, you ran Apache on the host: the container/process doesn&#39;t have its own IP address, it&#39;s just something listening on a port on the host.\r\n\r\nThe Docker daemon creates a `docker0` interface as part of its internal networking setup. Since you&#39;re using the host network stack, you&#39;ll see it in the list of interfaces. But that&#39;s not \" ;the container&#39;s IP \" ;. `localhost` (always <IP_ADDRESS>, which is magic) will point at the host system.", "707" ], [ "The [Relay server spec](_URL_1_) says that the type of `Node` must be exactly\r\n\r\n interface Node {\r\n id: ID!\r\n }\r\n\r\nso probably your second fragment is wrong (or at least not conforming to the spec).\r\n\r\nThat having been said, [the ID type](_URL_0_) can have a representation of any string or numeric value, so it&#39;s probably straightforward to change your second fragment to use plain `ID`. That&#39;s true in both the definition of the `Node` interface and in the `id` field itself.", "833" ], [ "You could use an [ARG](_URL_0_) to pass in the current build timestamp at build time. You&#39;d have to `docker build --build-arg build-date=$(date)` or something like that. Having done that, you can refer to the argument using something similar to shell variable syntax at build time.\r\n\r\nThis is probably more useful if you have a significant build step in your Dockerfile (you&#39;re compiling a Go application) or if the metadata you&#39;re trying to embed is harder to generate programmatically (the source control version stamp, the name of the person running the build command).", "927" ], [ "From the settings you showed, it looks like you&#39;re asking iTerm to \" ;type in \" ; the path to your script and run it as the first thing when a new terminal window opens. When that happens the script runs as a subprocess. If you look at what `docker-machine env` prints out it&#39;s just a set of `export` shell commands, so now you stumble on the general rule that subprocesses can&#39;t affect their parents&#39; environments.\r\n\r\nThe simple answer is to change the command to \" ;source \" ; your script so that it runs in the context of the terminal&#39;s shell. Try changing your \" ;send text at start \" ; to\r\n\r\n . ~/scripts/iterm_startup.sh\r\n\r\nLooking at your script, I suspect you could make it much simpler using [docker-machine status](_URL_0_), and I suspect you need to do the \" ;eval \" ; step even if the machine isn&#39;t running yet.\r\n\r\n MACHINE=default\r\n if [ $(docker-machine status \" ;$MACHINE \" ; 2 > & 1) != \" ;Running \" ; ]; then\r\n docker-machine start \" ;$MACHINE \" ;\r\n fi\r\n eval $(docker-machine env \" ;$MACHINE \" ;)", "707" ], [ "When you connect between services using a Docker-internal network, you always connect to the _internal_ port of the service. You don&#39;t explicitly need to publish ports (in Compose, with a `ports:` directive); if you do, the port you&#39;d connect to is the one on the _right_.\r\n\r\nStyle-wise, also note that you don&#39;t need to manually declare a private network with default options that will only be used within this Docker Compose file (Compose will do something very similar to that for you), and you don&#39;t need to declare `container_name:` just for inter-container connectivity (Compose will add a network alias that matches the name of the service).", "707" ], [ "You can include an [emptyDir volume](_URL_2_) in your pod spec. That will create an empty directory that lives as long as the pod does, even if it&#39;s restarted or migrated.\r\n\r\nThis won&#39;t necessarily play well if your pod belongs to a deployment that gets updated, since the core action of a deployment is to create new pods and delete old ones. In that case you need a [persistent volume claim](_URL_1_). That&#39;s more complicated: it involves having another Kubernetes object, and it means having somewhere to store the actual volume. (If you&#39;re running on AWS, for instance, persistent volumes will probably be backed by EBS volumes.) This might be a little overkill for a simple status.\r\n\r\nAnother option is to set up some sort of small database ([Redis](_URL_0_) is popular) and store the status _there_. Now you&#39;re not storing state in your container&#39;s filesystem and you don&#39;t actually care whether the pod exits or is deleted.\r\n\r\nAlso consider what can happen if you have multiple copies of your pod running at once. If nothing else, since the default behavior of a deployment is to create the new pod, wait for its health check to pass, and then delete the old pod, you can routinely wind up with two concurrent copies of the same pod. A single shared status might not have the behavior you want.", "510" ], [ "In which direction? You don&#39;t need to specify any special `--net` to make outbound connections. You don&#39;t for inbound connections either, but you do need a `-p` option to publish a port on the host. Also, I&#39;d recommend against using a bare `centos` container for anything except the `FROM` line of a Dockerfile; if you&#39;re doing significant work you&#39;re best off writing a custom Dockerfile for it.", "707" ], [ "I&#39;d clone it on the host, using the ssh-agent you already have running, before you run `docker build`.\r\n\r\nIf you really have to have the private key in the image (which you&#39;ve acknowledged is dangerous) then you should be able to have it at its default location `$HOME/.ssh/id_rsa` where you have it in your code; don&#39;t try to launch an ssh-agent. You could also inject a `$HOME/.ssh/config` file if your problem is aggressive host key checking, or a `$HOME/.ssh/known_hosts` file that has the host key already. Since all of these are _files_ you might find it easier to have them in the Docker build tree and `COPY` them into `$HOME/.ssh`.", "915" ], [ "You can&#39;t do that. An image can&#39;t grant itself elevated privileges to control the system it runs on; only the administrator actually running the `docker run` can do that.\r\n\r\nIt&#39;s better to wrap this in something like a Docker Compose YAML file or a shell script that includes all of the required `docker run` arguments.\r\n\r\nIf you&#39;re trying to build a \" ;helper command \" ; via Docker, there&#39;s two things worth remembering. One is that *everyone who can run Docker commands has unrestricted root privileges over the host*; it&#39;s very hard to stop someone from `docker run -v /:/host -u root ...` and getting unrestricted access to the host&#39;s filesystem. Another is that there are many Docker options like this (including setting environment variables, volume mounts, and publishing ports) that are set extremely routinely, so it&#39;s hard to build an image where just `docker run imagename` on its own brings up the image with full functionality.", "324" ], [ "CentOS 6 will not run any version of Docker \" ;smoothly \" ;; the last Docker version that even has a build for CentOS 6 is very old and even then there are kernel compatibility issues. I&#39;d update your host to something newer.\r\n\r\nOnce you get past that, there aren&#39;t usually any substantial issue running different Linux distributions between the host and in containers. You&#39;ll routinely see hosts running very minimal distributions (for instance there isn&#39;t much in the boot2docker distribution that Docker Machine VMs use), and images frequently run very light-weight distributions such as Alpine or even have nothing resembling a \" ;Linux distribution \" ; at all.", "324" ], [ "You should create a [service](_URL_1_) for your nginx container. It can be a ClusterIP service if it doesn&#39;t need to be accessible outside the cluster (or minikube VM). Once the service exists, it will have a [DNS name](_URL_0_) of something like `nginx.default.svc.cluster.local`. You can put _that_ in your config file and it will be consistent regardless of what IP address(es) the nginx pod(s) (if any) has.", "222" ], [ "The first half of the `docker run -v` option, if it&#39;s a directory path, is a directory specifically on the host machine. If a container has access to the Docker socket and launches another container, any directory mappings it provides are in the host filesystem&#39;s space, not the container filesystem&#39;s space. (If you&#39;re actually using Docker-in-Docker it is probably the filesystem space of the container running the nested Docker daemon, but it&#39;s still not the calling container&#39;s filesystem space.)\r\n\r\nThe most straightforward option is to [`docker cp`](_URL_0_) files out of the inner container after it&#39;s stopped but before you `docker rm` it; it can copy a whole directory tree.", "324" ], [ "Docker works with long-lived immutable _images_ and short-lived _containers_. If you have a script or any other sort of program you want to run, the best practice is generally to [package it into an image](_URL_0_) and then run a container off of it. There is already a standard [groovy image](_URL_1_) so your Dockerfile can be something as basic as:\r\n\r\n FROM groovy:2.6\r\n RUN mkdir /home/groovy/scripts\r\n WORKDIR /home/groovy/scripts\r\n COPY docker.groovy .\r\n CMD [ \" ;groovy \" ;, \" ;docker.groovy \" ;]\r\n\r\nYou can develop and test your application locally, then use Docker to deploy it. Especially if you&#39;re looking at multi-host deployment solutions like [tag:docker-swarm] or [tag:kubernetes] it&#39;s important that the image be self-contained and has the script included in it.", "324" ], [ "A Docker registry of some sort is all but a requirement to run Kubernetes. Paid Docker Hub supports private images; Google and Amazon both have hosted registry products (GCR and ECR respectively); there are third-party registries; or you can deploy the [official registry image](_URL_0_) locally.\r\n\r\nThere&#39;s an alternative path where you [`docker save`](_URL_3_) every private image you reference in any Kubernetes pod spec, then [`docker load`](_URL_1_) it on every single node. This has obvious scale and maintenance problems (whenever _anybody_ updates _any_ image you need to redeploy it by hand to _every_ node). But if you really need to try this, make sure your pod specs specify `ImagePullPolicy: Never` to avoid trying to fetch things from registries. (If something isn&#39;t present on a node the pod will just fail to start up.)\r\n\r\nThe [registry](_URL_2_) is \" ;just \" ; an open-source (Go) HTTP REST service that implements the Docker registry API, if that helps your deployment story.", "324" ], [ "You can&#39;t give untrusted users the direct ability to run `docker` commands. For instance, anyone who can run a Docker command can run\r\n\r\n docker run --rm -v /:/host busybox cat /host/etc/shadow\r\n\r\nand then run an offline password cracker to get your host&#39;s root password. Being able to bypass the firewall is probably the least of your concerns.", "740" ], [ "Your `docker run` command doesn&#39;t work because you don&#39;t have the `:version1` tag at the end of it. (Your question claims you do, but the actual errors you quote don&#39;t have it.)\r\n\r\nHowever: if this was anything more than a simple typo, the community would probably be unable to help you, because you have no documentation about what went into your image. (And if not \" ;the community \" ;, then \" ;you, six months later, when you discover your image has a critical security vulnerability \" ;.) Learn how the Dockerfile system works and use `docker build` to build your custom images. Best-practice workflows tend to not use `docker commit` at all.", "324" ], [ "File I/O in Docker generally works fine, though each container has its own isolated filesystem space that gets destroyed at the end of each container&#39;s lifetime. Things that communicate principally via files tend to be harder to run in Docker than they would otherwise, and typically you&#39;d try to design a container to store all of its persistent state \" ;somewhere else \" ; like a database if you can. Do you have a [mcve] showing what&#39;s wrong?", "324" ], [ "You can&#39;t hide the contents of RUN commands from `docker history`.\r\n\r\nYou should download the artifact outside the Dockerfile. A script that did the `curl` command and then ran `docker build` might simplify things for you. In addition to not exposing the credentials via `docker history`, this also avoids committing them to source control, makes it possible to build the image even if your Artifactory is unreachable, and simplifies a developer-oriented sequence where they need to build a temporary image out of something they&#39;ve built themselves.", "324" ], [ "`minikube` starts a dedicated virtual machine as a single-node Kubernetes cluster. If you have other Docker environments (a separate Docker Machine VM, the Docker Toolbox VM, the Docker for Mac or Docker for Windows environments, or a Linux-native Docker) these are separate from the Docker in the VM. You can&#39;t share images or containers between these environments.\r\n\r\nIf you have private images that aren&#39;t published to a registry, you&#39;ll have to re-`docker build` them when you switch to the Minikube environment. You otherwise don&#39;t specifically have to `docker pull` things that you&#39;re using, when you reference them in a Kubernetes pod spec Kubernetes will pull them for you.", "324" ], [ "In the final segment of your Dockerfile:\r\n\r\n FROM nginx:latest\r\n VOLUME [ \" ;/usr/share/nginx/html \" ;]\r\n COPY --from=node /app/dist/ /usr/share/nginx/html\r\n\r\nThe `VOLUME` directive tells Docker two things. One is that the directory contains data that should be implicitly persisted between container executions, whether or not the caller requests it. The second is that the directory will never be changed again, and [Docker will ignore any changes in the volume directory after you declare it](_URL_0_).\r\n\r\nIn practice, `VOLUME` is kind of tricky and any directories you&#39;d want persisted you&#39;d specify with a `docker run -v` or Docker Compose `volumes:` directive in any case. (Directories that get mounted this way don&#39;t need to be pre-declared in the Dockerfile.) I&#39;d just delete the `VOLUME` line.", "324" ], [ "Your first image isn&#39;t starting the MySQL database; the only thing it&#39;s starting is the main application. I&#39;m guessing you have MySQL installed, but it doesn&#39;t start up when you launch the container.\r\n\r\nYou should probably split the application and database into separate containers. Use the standard `mysql` image for the database. It has a path to run SQL files on first startup to prepopulate the database. The application image needs to be given a pointer to the database location; if you already have a multi-host setup then passing in an environment variable with the host&#39;s IP address might be the simplest setup.", "486" ], [ "From other containers the best way to access this container is to attach both to the same network and use the container&#39;s `--name` as a DNS name and the internal port (the second port from the `-p` option, which isn&#39;t strictly required for this case); from outside a container or from other hosts use the host&#39;s IP address or DNS name and the published port (the first port from the `-p` option).\r\n\r\nThe `docker run --hostname` option isn&#39;t especially useful; the only time you&#39;d want to specify it is if you have some magic licensed software that only ran if it had a particular hostname.\r\n\r\nAvoid `localhost` in a Docker context, except for the very specific case where you know you&#39;re running a process on the host system outside a container and you&#39;re trying to access a container&#39;s published port or some other service running on the host. Don&#39;t use \" ;localhost \" ; as a generic term, it has a very specific context-dependent meaning (every process believes it&#39;s running \" ;on localhost \" ;).", "707" ], [ "No, images and containers are intentionally isolated from the host&#39;s filesystem, and there&#39;s intentionally no way for an image to read or write files on the host without being explicitly granted the privilege in a `docker run -v` option.\r\n\r\nIf your real goal is to run something to interact with files on the host then you&#39;ll often be better off installing and running it directly on the host than writing the very long `docker run` command line (and needing root privileges to do anything).", "324" ], [ "You&#39;ll find the quoting issues significantly easier if you turn your very long, very involved command line into a shell script, package it into a custom image, and then run that.\r\n\r\nShell script, let&#39;s call it `run__URL_2_`:\r\n\r\n #!/bin/sh\r\n _URL_2_ --issue --dns dns_azure --dnssleep 10 --force -d \" ;domain \" ;\r\n openssl pkcs12 \\\r\n -inkey /_URL_0_ \\\r\n -in /_URL_1_ \\\r\n -export \\\r\n -out pfx \\\r\n -password pass:password\r\n CER_B64=$(tail -n +2 /_URL_1_ | head -n -1)\r\n curl -X POST \\\r\n --data-binary \" ;{\\ \" ;certName\\ \" ;:\\ \" ;certName1\\ \" ;,\\ \" ;certData\\ \" ;:\\ \" ;$CER_B64\\ \" ;} \" ; \\\r\n -H &#39;Content-Type: application/json&#39;\r\n url\r\n PFX_B64=$(openssl base64 -in pfx)\r\n curl -X POST \\\r\n --data-binary \" ;{\\ \" ;certName\\ \" ;:\\ \" ;certName1\\ \" ;,\\ \" ;certData\\ \" ;:\\ \" ;$PFX_B64\\ \" ;} \" ; \\\r\n -H &#39;Content-Type: application/json&#39;\r\n url\r\n\r\nDockerfile:\r\n\r\n FROM neilpang/_URL_2_\r\n COPY run__URL_2_ /bin\r\n CMD [ \" ;/bin/run__URL_2_ \" ;]\r\n\r\nThen you can `docker build` this like any other custom image, and `docker run` it, and the very long command line will be baked into the shell script in your image.", "707" ], [ "You can&#39;t (usefully) `RUN` a background process. That Dockerfile command launches an intermediate container executing the `RUN` command, saves its filesystem, and exits; there is no process running any more by the time the next Dockerfile command executes.\r\n\r\nIf this is a commercially maintained image, you might look into whether [Oracle has intstructions on how to use it](_URL_1_). (From clicking around, none of the samples there start a node manager; is it necessary?)\r\n\r\nBest practice is generally to run only one server in a Docker container (and ideally in the foreground and as the container&#39;s main process). If that will work and there aren&#39;t shared filesystem dependencies, you can split all of this except the final `CMD` into one base Dockerfile, then have two additional Dockerfiles that just have a `FROM` line pointing at your mostly-built image and a requested `CMD`.\r\n\r\nIf that _really_ won&#39;t work then you&#39;ll have to fall back to running some init system in your container, typically [supervisord](_URL_0_).", "324" ], [ "You can keep doing exactly what you&#39;re doing now. Add the second back-end container to the `docker-compose.yml` file, and add another `location` block to the nginx configuration that routes to the specified service. For the layout you describe, it might look like\r\n\r\n location /api/users {\r\n proxy_pass _URL_0_;\r\n }\r\n location /api/widgets {\r\n proxy_pass _URL_1_;\r\n }\r\n\r\nWhen you start uttering the phrase \" ;production \" ; you typically wouldn&#39;t distribute your code separately from the Docker image. I would try to remove the `volumes:` directive that copies your local working tree over what&#39;s installed in the image, and move the `command:` into a `CMD` in the Dockerfile. Conversely, you might want to pass in the locations of the PostgreSQL and Redis databases as environment variables, even if they&#39;re \" ;normally \" ; in the same Docker Compose setup, in case you want to run them somewhere else (run your database on a dedicated or hosted service that gets regularly backed up, for example).", "324" ], [ "You can&#39;t (\\*) run Docker inside Docker containers or images. You can&#39;t (\\*) start background services inside a Dockerfile. As you say, commands like `systemctl` and `service` don&#39;t (\\*) work inside Docker anywhere. And in any case you can&#39;t use any host-system resources, including the host&#39;s Docker socket, from anywhere in a Dockerfile.\r\n\r\nYou need to redesign this Dockerfile so that it only installs the software and makes no attempt to start it. Ideally a container would start only a single server, and would run it in the foreground as its CMD; otherwise you might depend on things like [supervisord](_URL_0_) to have multiple servers if you must. If your application heavily relies on being able to start things in Docker, you might find it much easier to install in a virtual machine.\r\n\r\n(\\*) Technically there are ways to do all of these things, but they&#39;re all tricky and complicated and have implications (up to potentially giving your container unrestricted root access over the host, and your container startup actively reconfiguring some low-level host details).", "324" ], [ "Usually you want the [os.path](_URL_0_) module from the standard library for this kind of filename.\r\n\r\n import os.path\r\n print(os.path.splitext(os.path.basename(&#39;./test/test1.csv&#39;))[0])\r\n\r\nIn your regular expression version of this, remember that `.` matches _any_ character (not just periods), `x*` matches any number of x&#39;s (even zero), and that [re.search](_URL_1_) will return true if the pattern matches anywhere in the string: your regular expression matches whenever a filename contains the letters \" ;csv \" ; anywhere later than the first or second character. A correct regular expression implementation might be\r\n\r\n import re\r\n print(re.search(r&#39;/([^/.]+)\\.[^/]+$&#39;, &#39;./test/test1.csv&#39;)[1])\r\n\r\n(matching a slash, at least one character that is neither a period nor a slash, a period, at least one character that is not a slash, and end of string). (IMHO `os.path` is more readable and maintainable.)", "879" ], [ "You should write an entrypoint script that does the required setup, then runs the command passed to the container.\r\n\r\n`_URL_1_`:\r\n\r\n < !-- language: lang-sh -- > \r\n\r\n #!/bin/sh\r\n if [ -n \" ;$API_URL \" ; ]; then\r\n echo \" ;API_URL = $API_URL \" ; > app.cfg\r\n fi\r\n exec \" ;$@ \" ;\r\n\r\n`Dockerfile` (final stage):\r\n\r\n FROM nginx:1.15.2-alpine\r\n COPY _URL_1_ /\r\n COPY --from=builder /usr/src/app/build /usr/share/nginx/html\r\n ENTRYPOINT [ \" ;/_URL_1_ \" ;]\r\n CMD [ \" ;nginx \" ;, \" ;-g \" ;, \" ;daemon off; \" ;]\r\n\r\nYou can debug this by running something like\r\n\r\n docker build -t mynginx .\r\n docker run --rm -it -e API_URL=_URL_0_ mynginx sh\r\n\r\nwhich will run the entrypoint script passing it \" ;sh \" ; as the command; that will set up the `app.cfg` file and then launch the debug shell (and not nginx).", "707" ], [ "Remember that a Docker container typically runs one process, and a typical host-system init setup manages hardware devices, kernel parameters, network interfaces, and things like ttys that really just don&#39;t exist in Docker. The overall Docker approach tends to be towards reproducible immutable disposable setups (if you lose `/var/lib/docker` it&#39;s no big deal because you can rebuild your container from an image and the image from the Dockerfile in source control), and even for a proof-of-concept you&#39;ll be much better off building an image properly from a standard OS base image.", "324" ], [ "There is no shame in having tools installed on your host. These have the advantage of using your local native filesystem without weird remapping tricks and not requiring root privilege to run. Your script is fine as it is; it does not defeat the purpose of Docker at all.\r\n\r\nOne \" ;more Dockery \" ; approach you can take to this, particularly if you _always_ want to run the migrations, is to move the last half of this into an ENTRYPOINT script in your application container. I might write a script like:\r\n\r\n #!/bin/sh\r\n if [ -n \" ;$MYSQL_HOST \" ; -a -z \" ;$SKIP_DB_SETUP \" ; ]; then\r\n # TODO: write Node code that waits until a database connection succeeds\r\n ./node_modules/.bin/sequelize db:create || true\r\n ./node_modules/.bin/sequelize db:migrate\r\n fi\r\n exec \" ;$@ \" ;\r\n\r\nand use that as the ENTRYPOINT of my image.", "324" ], [ "In general, no, you can&#39;t do this in Kubernetes (or in plain Docker). You should either move the two interconnected things into the same container, or wrap some sort of network service around the thing you&#39;re trying to call (and then probably put it in a separate pod with a separate service in front of it).\r\n\r\nThere _might_ be something you could do if you set up a service account, installed a Kubernetes API sidecar container, and used the Kubernetes API to do the equivalent of `kubectl exec`, but I&#39;d consider this a solution of last resort.", "707" ], [ "I have a way to do it that involves some trickery, heavily inspired by functional programming experience.\r\n\r\nA Go/Helm template takes a single parameter, but the [sprig](_URL_2_) library gives you the ability to create lists, and the [text/template](_URL_1_) `index` function lets you pick things out of a list. That lets you write a \" ;function \" ; template that takes multiple parameters, packed into a list.\r\n\r\nSay we want to write out a single line of this output. We need to keep track of which server number we&#39;re at (globally), which replica number we&#39;re at (within the current data center), the current data center record, and the records we haven&#39;t emitted yet. If we&#39;re past the end of the current list, then print the records for the rest of the data centers; otherwise print a single line for the current replica and repeat for the next server/replica index.\r\n\r\n {{ define \" ;emit-dc \" ; -}}\r\n {{ $server := index . 0 -}}\r\n {{ $n := index . 1 -}}\r\n {{ $dc := index . 2 -}}\r\n {{ $dcs := index . 3 -}}\r\n {{ if gt $n (int64 $dc.replicas) -}}\r\n {{ template \" ;emit-dcs \" ; (list $server $dcs) -}}\r\n {{ else -}}\r\n server.{{ $server }}: {{ $_URL_0_ }}-{{ $n }}\r\n {{ template \" ;emit-dc \" ; (list (add1 $server) (add1 $n) $dc $dcs) -}}\r\n {{ end -}}\r\n {{ end -}}\r\n\r\nAt the top level, we know the index of the next server number, plus the list of data centers. If that list is empty, we&#39;re done. Otherwise we can start emitting rows from the first data center in the list.\r\n\r\n {{ define \" ;emit-dcs \" ; -}}\r\n {{ $server := index . 0 -}}\r\n {{ $dcs := index . 1 -}}\r\n {{ if ne 0 (len $dcs) -}}\r\n {{ template \" ;emit-dc \" ; (list $server 1 (first $dcs) (rest $dcs)) -}}\r\n {{ end -}}\r\n {{ end -}}\r\n\r\nThen in your actual resource definition (say, your ConfigMap definition) you can invoke this template with the first server number:\r\n\r\n {{ template \" ;emit-dcs \" ; (list 1 .Values.dataCenters) -}}\r\n\r\nCopy this all into a dummy Helm chart and you can verify the output:\r\n\r\n % helm template .\r\n ---\r\n # Source: x/templates/test.yaml\r\n server.1: a-1\r\n server.2: a-2\r\n server.3: a-3\r\n server.4: b-1\r\n server.5: b-2\r\n\r\nI suspect this trick won&#39;t work well if the number of servers goes much above the hundreds (the Go templating engine almost certainly isn&#39;t _tail recursive_), and this is somewhat trying to impose standard programming language methods on a templating language that isn&#39;t quite designed for it. But...it works.", "213" ], [ "When you send that redirect call, these three steps happen:\r\n\r\n1. The browser contacts, say, `_URL_4_` and sends a login request.\r\n2. The authorization server says \" ;oh, 302, you should contact `_URL_3_`. \" ;\r\n3. The browser tries to contact `_URL_3_`.\r\n\r\nSince the redirect will really take effect in the browser, you have to send back a URL the browser will understand, which means it can&#39;t use the Docker-internal DNS name.\r\n\r\nThe easy, development-oriented answer is to use `_URL_2_` as the redirect address. Since you&#39;re using Express, a recipe like\r\n\r\n req.redirect(`_URL_0_{req.hostname}:8080/users/something`)\r\n\r\nmight work (using [Request.hostname](_URL_1_)), though this forces your application to know about the other service&#39;s published port.", "160" ], [ "If you have a Dockerfile for an image, and that image is also already in some repository, `docker pull` will pull the binary copy of the image from the repository, whereas `docker build` will rebuild it from the Dockerfile.\r\n\r\nA couple of cases will also automatically `docker pull` for you. If you `docker run` an image you don&#39;t have, it will be pulled; a Dockerfile `FROM` line will also pull a base image if it&#39;s not present.\r\n\r\nIn your case the Dockerfile is describing how to build a new image, starting from the `php:7.1.8-apache` image. You need that base image to build your custom image, and if you don&#39;t have it already it will be pulled for you. But what you get out is a different image from that PHP base image, and unless you&#39;ve `docker push`ed the image somewhere you won&#39;t be able to directly `docker pull` the result.", "324" ], [ "Docker doesn’t really work that way. It’s best for packaged complete applications that you can access via a network connection; in the Java case, a JRE plus an app server plus an installed application would make a reasonable complete image.\r\n\r\nIt’s _possible_ to share files between the host and a container, but mostly that direction is “push things into a container”. In your example you could use the `docker run -v` option to push your source directory into the container, but you’d have to actually run the JDK commands (`javac`, `mvn`, ...) from inside the container. You can use `docker exec` to do this, but it’s an unnatural workflow IMHO, and it requires you to have administrator-level privileges to do even routine things.\r\n\r\nI’d put the JDK and the application in the same place: either bundle both into a single Docker image, or install the JDK on your host.", "324" ], [ "The [graphql gem](_URL_0_) has [two different \" ;styles \" ;](_URL_0_/schema/class_based_api) of declaring GraphQL objects using a Ruby DSL (and it can also directly import the GraphQL schema language). The older style (now expunged from the docs) uses `GraphQL<IP_ADDRESS>ObjectType.define`, and needs to qualify most references with the `types` syntax. [The newer style uses Ruby class inheritance](_URL_0_/type_definitions/objects.html), and doesn&#39;t use `types`.\r\n\r\nIn short: I think your code will work if you just change the last field definition to\r\n\r\n field :members, [Types<IP_ADDRESS>UserType]", "706" ], [ "That information isn&#39;t (and shouldn&#39;t) be available at image build time. The same Linux-based image could be run on native Linux, a Linux VM on Mac (and then either the Docker Machine VM or the hidden VM provided by Docker for Mac), a Linux VM on Windows, or even a Linux VM on Linux, regardless of where it was originally built.\r\n\r\nConfiguration such as host names should be provided at container run time. Environment variables are a typical way to do this, or you can use the Docker volume mechanism to push in configuration files from the host.\r\n\r\nIf your issue is purely around _debugging_ your application, you can also set up a full development environment on your host, and only build in to your image the things you need to run it in a more production-like environment.", "324" ], [ "Yes, but the specific option depends on what \" ;driver \" ; you&#39;re using; for AWS, for instance, there&#39;s a `--amazonec2-ami` option to specify the AMI (Amazon Machine Image ID) to use. There&#39;s a listing of all of the backend drivers and the corresponding options [in the Docker documentation](_URL_0_). Looking around there, there isn&#39;t an especially exhaustive list of available images around, so you might have to do some more research.\r\n\r\nThat having been said, nothing forces you to use Docker Machine to get a VM with Docker on it: you can provision a VM or cloud instance with whatever technique you feel comfortable with and install Docker on that in the usual way. If you want to run things besides Docker on the system and have strong opinions about the host distribution, it might be better to skip the small amount of automation Docker Machine gives you to gain that control.", "324" ], [ "More recent versions of Docker Compose [create a Docker network automatically](_URL_0_). Once that network exists, Docker provides its own DNS system so that containers can reach each other by name or network alias; Compose registers each service under its name in the YAML file, so within this set of containers, `webserver` and `form` would both be resolvable host names.\r\n\r\n(The corollary to this is that you don&#39;t usually need to include a `networks:` block in the YAML file at all, and there&#39;s not much benefit to explicitly specifying a `container_name:` or manually setting container network settings.)", "324" ], [ "There are two separate things happening here.\r\n\r\nInside the container a server process is running, and the `docker-compose` logs are the output of that server process. **The server process must set up network connections to listen on <IP_ADDRESS> or it will be unreachable.** It&#39;s minimally aware of the Docker environment and doesn&#39;t know about things like the port mappings from the Compose YAML file; it&#39;s usually controlled with command-line options or environment variables. (So the log messages you quote should _always_ say \" ;<IP_ADDRESS> \" ;, or your container won&#39;t work.)\r\n\r\nOutside the container, Docker routes inbound connections on specified ports to specific containers. This acts like any other service running on the host: the IP address you give here can be any single address the host has (in which case it will only be reachable via the matching network interface) or the magic \" ;listen everywhere \" ; address <IP_ADDRESS> (default).\r\n\r\nWith `docker run -p <IP_ADDRESS>:9432:5432` (remember, the second port number must match the port the server inside the container is using) what you should find is that processes running on the host can reach the container, but processes running on other hosts won&#39;t be able to.", "707" ], [ "[Environment variable references in Dockerfiles](_URL_0_) get expanded by Docker before they&#39;re passed on to the shell. In particular, if an `ENV` statement includes any sort of `$variable` reference, only previous `ENV` and `ARG` statements are visible to it. (Implicit changes of, say, `$HOME` via a `USER` directive aren&#39;t directly visible to the Dockerfile.)\r\n\r\nIn practice, since you control the entire runtime environment of the Docker image, you can easily enough specify a fixed data directory and hard-code its location later on. The layout of the Docker filesystem space doesn&#39;t especially need to be configurable.", "191" ], [ "The Docker startup flow is that Docker sets some environment variables (from the Dockerfile and `docker run -e` options) and then launches the container&#39;s entrypoint. Anything that happens within the entrypoint is outside of Docker&#39;s purview. In particular, a debugging shell that gets launched via `docker exec` is not a child of the entrypoint and won&#39;t inherit environment variables that get set there. (NB: I cannot find this explicitly stated in the Docker documentation anywhere.)\r\n\r\nOne good experiment to try is to run:\r\n\r\n % docker run -d --name test busybox sh -c &#39;sleep 60; sleep 60&#39;\r\n 6c6aada7e5299e816e9d12dfab9845cc396485a46d909255375128b87ee5eedf\r\n % docker exec test ps -o pid,ppid,comm\r\n PID PPID COMMAND\r\n 1 0 sh\r\n 6 1 sleep\r\n 7 0 ps\r\n\r\nThe container&#39;s root process is a shell, which gets process ID 1, and it launches a `sleep` subprocess, with process ID 6 and parent process ID 1. The `docker exec` `ps` command gets a new process ID, but has an artificial parent process ID of 0 – it is not a child of the container root process.\r\n\r\nIf you want to debug your image&#39;s startup environment, with a typical entrypoint script like\r\n\r\n #!/bin/sh\r\n . /_URL_0_\r\n exec \" ;$@ \" ;\r\n\r\nyou can `docker run --rm -it myimage sh` and the resulting shell will get launched via your entrypoint script. But as you observe, trying to debug it via `docker exec` doesn&#39;t go through any part of the entrypoint sequence.", "707" ], [ "In general, references to file paths that don&#39;t start with `/` are always interpreted relative to the current working directory. Unless you&#39;ve changed that somehow (`os.chdir`, an entrypoint script running `cd`, the `docker run -w` option) that will be the `WORKDIR` you declared in the `Dockerfile`.\r\n\r\nSo: your file should be in `/BotCloud/outfile.csv`, _in the container&#39;s filesystem space_.\r\n\r\nNote that containers have their own isolated filesystem space that is destroyed when the container is deleted. If the primary way your application communicates is via files, it may be much easier to use a non-Docker mechanism, such as Python virtual environments, to isolate your application from the rest of the system. You can mount a host directory into the container with `docker run -v`, or `docker cp` files out. (Note with `docker run -v` in particular it is helpful if the data is written to someplace that _isn&#39;t_ the same directory as your application.)", "324" ], [ "Making an ssh connection into a Docker container is an extremely unusual setup. You might read the [official Docker tutorial on building and running custom images](_URL_0_) for a more typical workflow. That tutorial also explains how to publish ports to reach a server running in a container, which should get you connected. Don&#39;t look up or try to use the container-internal IP address.", "707" ], [ "In this case you have it easy: the [official nginx image](_URL_1_) doesn&#39;t declare an ENTRYPOINT, so you can add your own without conflicting with anything in the base image. The important details here:\r\n\r\n* When the entrypoint exits, the container is finished\r\n* The entrypoint is passed the CMD or `docker run` command as arguments\r\n* If the entrypoint is a shell script, it therefore usually wants to end with `exec \" ;$@ \" ;`\r\n\r\nA typical entrypoint script for this sort of thing might look like:\r\n\r\n #!/bin/sh\r\n sed -i.bak -e \" ;s/EXTERNAL_URL/$EXTERNAL_URL/g \" ; /etc/nginx/nginx.conf\r\n exec \" ;$@ \" ;\r\n\r\n(For this specific task I&#39;ve found [envsubst](_URL_0_) to be very useful, but I don&#39;t think it&#39;s present in the Alpine-based images; it&#39;s not a \" ;standard \" ; tool but it will be there in a full GNU-based runtime environment, like the Debian-based images have. It goes through files and replaces `$VARIABLE` references with the contents of the matching environment variables.)", "822" ], [ "Since you launched the container with `docker run -p 9999:80`, you can reach it on the VM&#39;s IP address on the public port 9999. `docker-machine ip` will tell you that IP address (but it is usually <IP_ADDRESS>). So try `_URL_1_` as a URL to reach the container.\r\n\r\nThe container-internal IP addresses aren&#39;t especially useful. One significant problem with them is that they can&#39;t be reached from other hosts. In the case of a Docker Toolbox environment, everything Docker-related actually runs inside a virtual machine, and your host system counts as \" ;other hosts \" ; for this. Also note that if you do have occasion to use it (or more often use inter-container DNS for one container to reach another by its `docker run --name`) you need the port the server is listening on inside the container, not the published port: from another container you might use `_URL_0_`.", "707" ], [ "Since your function defines `a` as a local variable, [it is considered a local variable everywhere in the function](_URL_0_). Your first `print` statement then references the variable before it&#39;s initially assigned.\r\n\r\nGlobal variables can be confusing (and reasoning about what functions make changes to what globals is extra complicated) and best practice (in most languages) is to simply not use them. A better formulation of your sample might be\r\n\r\n def test(a):\r\n print(a)\r\n a = 13\r\n print(a)\r\n \r\n if __name__ == &#39;__main__&#39;:\r\n test(17)", "667" ], [ "Typical Docker containers run a long-running server listening on some TCP port. Other containers on the same Docker network can reach that container using the container’s name (`docker run --name`, `container_name:` directive) as a DNS name and the port the server is running on. In Docker Compose, Compose creates a Docker network per Compose YAML file, and also makes services available under their key in the YAML file. This works even if no `ports:` are specified.\r\n\r\nSo, for instance, if your `docker-compose.yml` file says\r\n\r\n services:\r\n mongo:\r\n image: mongo\r\n others:\r\n env:\r\n MONGODB_HOST: mongo\r\n MONGODB_PORT: 27017\r\n\r\nthen the MongoDB container will be reachable on that host name and (default) port, even though it doesn’t explicitly have a `ports:`.\r\n\r\nIf you do declare a `ports:` then the container will be reachable from outside Docker space. If you only have one port it’s the port number of the server, and Docker picks the host port; this isn’t useful in most cases (but it’s guaranteed to not hit a port conflict). If you have two ports they’re the host port and internal service port. You can also specify a host IP address to **bind**(2) to.\r\n\r\nPresence or absence of `ports:` doesn’t affect inter-dontainer communication. Always use the container’s name (or `Docker-compose.yml` service name) and the “internal” port number the server is listening on.", "707" ], [ "You shouldn&#39;t try to edit shell dotfiles like `.bash_profile` in a Dockerfile. There are many common paths that don&#39;t go via a shell (_e.g._, `CMD [ \" ;python \" ;, \" ;_URL_2_ \" ;]` won&#39;t launch any sort of shell and won&#39;t read a `.bash_profile`). If you need to globally set an environment variable in an image, use the Dockerfile `ENV` directive.\r\n\r\nFor a Python application, you should just install your application into the image&#39;s \" ;global \" ; Python using `pip install`. [You don&#39;t specifically need a virtual environment](_URL_0_); Docker provides a lot of the same isolation capabilities (something you `pip install` in a Dockerfile won&#39;t affect your host system&#39;s globally installed packages).\r\n\r\nA typical Python application Dockerfile (copied from _URL_1_) might look like\r\n\r\n FROM python:3\r\n WORKDIR /usr/src/app\r\n COPY requirements.txt .\r\n RUN pip install --no-cache-dir -r requirements.txt\r\n COPY . .\r\n CMD [ \" ;python \" ;, \" ;./_URL_4_ \" ;]\r\n\r\nOn your last question, `source` is a vendor extension that only some shells provide; the [POSIX standard](_URL_3_) doesn&#39;t require it and the default `/bin/sh` in Debian and Ubuntu doesn&#39;t provide it. In any case since environment variables get reset on every `RUN` command, `RUN source ...` (or more portably `RUN . ...`) is a no-op if nothing else happens in that `RUN` line.", "191" ], [ "You can run the `docker build` while the old container is still running, and your downtime is limited to the changeover period.\r\n\r\nIt can be helpful for a couple of reasons to put a load balancer in front of your container. Depending on your application this could be a \" ;dumb \" ; load balancer like HAProxy, or a full Web server like nginx, or something your cloud provider makes available. This allows you to have multiple copies of the application running at once, possibly on different hosts (helps for scaling and reliability). In this case the sequence becomes:\r\n\r\n1. `docker build` the new image\r\n2. `docker run` it\r\n3. Attach it to the load balancer (now traffic goes to both old and new containers)\r\n4. Test that the new container works correctly\r\n5. Detach the old container from the load balancer\r\n6. `docker stop & & docker rm` the old container\r\n\r\nIf you don&#39;t mind heavier-weight infrastructure, this sequence is basically exactly what happens when you change the image tag in a Kubernetes Deployment object, but adopting Kubernetes is something of a substantial commitment.", "324" ], [ "`docker history` will give you a listing of all of the layers in an image, the individual layer’s size, and the command that got run to create the image. That could be a shell command or a Dockerfile directive.\r\n\r\nIn practice, a very large layer will probably be either COPYing some artifact into Docker land, or a software installation of some sort. Depending on what it is that’s being installed, working around this may or may not be tricky. I see a lot of Dockerfiles go by on SO that install a full C toolchain and library header files just to produce a runnable Python library, for instance; that can be split into a multi-stage build that will have a much smaller runtime artifact, but that involves reengineering the build process.", "324" ], [ "Without this rule, named and inline fragments can behave the same way, and this can make sense if you have more involved \" ;get generic bits \" ; fragments for interface or union types. If you split out the query this way:\r\n\r\n fragment SearchResultBits on SearchResult {\r\n ...on Droid { appearsIn }\r\n # could have parts for other union choices too\r\n }\r\n query DoSearch($text: String!) {\r\n search(text: $text) { ... SearchResultBits }\r\n }\r\n\r\nThen on your query it&#39;s very sensible to reuse the (named) `SearchResultBits`\r\n\r\n query FromQuestion {\r\n search(text: \" ;an \" ;) {\r\n ... on Human {\r\n name\r\n ... SearchResultBits\r\n }\r\n # or return nothing for non-humans\r\n }\r\n }\r\n\r\nSince the named fragment reference and the inline fragment both behave the same way, you&#39;ll get the same result here. It seems more reasonable for this named fragment reference to be legal and so there doesn&#39;t seem to be a strong reason to forbid the equivalent inline fragment either.", "420" ], [ "Apollo&#39;s graphql-tools includes a module to [transform schemas](_URL_1_). You should be able to rename everything in `MenuX` with something like\r\n\r\n import {\r\n makeRemoteExecutableSchema,\r\n transformSchema,\r\n RenameTypes\r\n } from &#39;graphql-tools&#39;;\r\n const schema = makeRemoteExecutableSchema(...);\r\n const menuXSchema = transformSchema(schema, [\r\n RenameTypes((name) = > `MenuX${name}`)\r\n ]);\r\n\r\nThen you can [use the transformed schema](_URL_0_) as the input to `mergeSchemas`.\r\n\r\nNote that the top-level `Query` and `Mutation` types are somewhat special and you may want to try to more directly merge those types without renaming them, particularly if they don&#39;t conflict.", "363" ], [ "This isn&#39;t something GraphQL is especially good at. By far the easiest thing to do will be to retrieve the individual fields and then do the computation on the client, something like\r\n\r\n < !-- language: javascript -- > \r\n\r\n data.item.forEach((i) = > { i.total_price = i.units * i.price_per_unit });\r\n\r\nIn particular, there&#39;s no way to run any sort of \" ;subquery \" ; in GraphQL. Given a \" ;multiply \" ; function like you&#39;ve shown there&#39;s no GraphQL syntax that will let you \" ;call \" ; it with any particular inputs.\r\n\r\nIf you think the specific computed values are common enough, you can also add them to the GraphQL schema, and compute them server-side if requested using a custom resolver function.\r\n\r\n type Item {\r\n units: Int!\r\n pricePerUnit: CurrencyValue!\r\n # computed, always units * pricePerUnit\r\n marketPrice: CurrencyValue!\r\n }\r\n type CurrencyValue {\r\n amount: Float!\r\n currency: Currency!\r\n # computed, always amount * currency { usd }\r\n usd: Float!\r\n }\r\n type Currency {\r\n code: String!\r\n \" ;1 currency = this many US$ \" ;\r\n usd: Float!\r\n }\r\n\r\nallowing queries like\r\n\r\n {\r\n item {\r\n marketPrice { usd }\r\n }\r\n }", "18" ], [ "Using the reference [graphql-js](_URL_0_) library, you can pass a root object to the GraphQL execution. Any top-level queries and mutations are looked up on this object, and further nested query fields are looked up on the objects returned from that, and so on.\r\n\r\nThe example on the graphql-js front page includes this object:\r\n\r\n // The root provides a resolver function for each API endpoint\r\n var root = {\r\n hello: () = > {\r\n return &#39;Hello world!&#39;;\r\n },\r\n };\r\n\r\nThat object is then passed as a parameter to the [graphql](_URL_0_graphql/#graphql) entry point.", "706" ], [ "You should use your existing desktop-oriented build process to build and test the application and only use Docker to build the final deployment artifact. If you are hard-coding the database location in your source code, there is lurking trouble there of exactly the sort you describe (what will you do if you have separate staging and production databases hosted by your cloud provider?) and you should make that configurable.\r\n\r\nDuring the `docker build` phase there’s no way to guarantee that any particular network environment, external services, or DNS names will be present, so you can’t do things like run integration tests that depend on an external database. Fortunately that’s a problem the software engineering community has spent a long time addressing in the decades before Docker existed. While many Docker setup are very enthusiastic about mounting application source code directly into containers, that’s much less useful for compiled languages and not really appropriate for controlled production deployments.\r\n\r\nIn short: run Maven the same way you did before you had Docker, and then just have your Dockerfile COPY the resulting (fully-tested) `.jar` file into the image.", "324" ], [ "Both the EXPOSE line you quote and the `docker run -p 9200:9200 -p 9300:9300` options tell Docker that you are running a container that is **providing** an Elasticsearch server, that you want to have **listening** for connections on those ports.\r\nIf you’re just trying to make an outbound connection to an Elasticsearch service running somewhere else, you don’t need these options and should remove them.", "707" ], [ "That API looks like it mirrors the [Kubernetes API](_URL_0_), and in particular there is a [core/v1.Secret](_URL_1_) object that includes the secret `data`. The values are base64-encoded.\r\n\r\n(Unless RBAC forbids it, you can generally `kubectl get secret -o yaml secretname` to see the same thing...Kubernetes secrets are only so secret.)\r\n\r\nIf you&#39;re running this in the context of a service it&#39;s probably easier to launch the service with [environment variables set from the relevant secret values](_URL_2_), using a YAML fragment like\r\n\r\n env:\r\n - name: SECRET_USERNAME\r\n valueFrom:\r\n secretKeyRef:\r\n name: test-secret\r\n key: username", "915" ], [ "Your `docker` command is pointed at a VirtualBox VM, probably one installed via Docker Machine or Docker Toolbox. The Docker for Mac \" ;whale \" ; app uses a different virtualization system. (Check: if you `echo $DOCKER_HOST`, does it say something like `tcp://<IP_ADDRESS>:2376`?)\r\n\r\nYou can \" ;deactivate \" ; the Docker VM in your shell by running\r\n\r\n eval $(docker-machine env -u)\r\n docker info\r\n\r\nand having done that can `docker-machine rm` the VM.", "707" ], [ "Docker image tags (including both the Dockerfile `FROM` line and `docker run` images) are always exact matches. As a corollary, once Docker believes it has a particular image locally, it won&#39;t try to fetch it again unless explicitly instructed to.\r\n\r\nMany common Docker images have a convention of publishing the same image under multiple tags, that sort of reflect what you&#39;re suggesting. For instance, as of this writing, for the [standard `python` image](_URL_0_), `python:latest`, `python:3`, `python:3.7`, `python:3.7.0`, and `python:3.7.0-stretch` all point at the same image. If you said `FROM python:3` you&#39;d get this image. But, if you already had that image, and a Python 3.8 were released, and you rebuilt without explicitly doing a `docker pull` first, you&#39;d use the same image you already had (the Python 3.7 one). If you did `docker pull python:3` then you&#39;d get the updated image but you&#39;d have to know to do that (or tell your CI tool to do it for you).", "324" ], [ "You can start the database using a host directory for its underlying data store. If you do this, then you can create a tar file of the directory, and untar it anew for each test run.\r\n\r\n < !-- language: lang-sh -- > \r\n\r\n mkdir mysql\r\n docker run -d -p 3306:3306 -v ./mysql:/var/lib/mysql --name mysql mysql\r\n mysql -h <IP_ADDRESS> < dump.sql\r\n docker stop mysql\r\n docker rm mysql\r\n tar czf mysql.tar.gz mysql\r\n\r\n < !-- language: lang-sh -- > \r\n\r\n rm -rf mysql\r\n tar xzf mysql.tar.gz\r\n docker run -d -p 3306:3306 -v ./mysql:/var/lib/mysql --name mysql mysql\r\n MYSQL_HOST=<IP_ADDRESS> ./integration_test\r\n docker stop mysql\r\n docker rm mysql\r\n\r\nYou&#39;d have to distribute the data dump separately (if you otherwise use AWS, an S3 bucket is a good place for it) but since it&#39;s \" ;just \" ; test data that you can always recreate from a database dump, it&#39;s not especially precious and you don&#39;t need to track its version history or attempt to keep it in source control.", "555" ], [ "Instead of being `FROM` a server or distribution image base, a Dockerfile can declare itself `FROM scratch`. \" ;scratch \" ; is a special image name that contains absolutely nothing – no files, no directories, I think it even has no image layers.\r\n\r\nThe most common use of `FROM scratch` is to create an extremely small image around a **statically compiled** binary (most often in Go, also possible in C/C++, not possible in languages like Java or Python that need an interpreter). This can look like\r\n\r\n FROM scratch\r\n COPY app /\r\n ENTRYPOINT [ \" ;/app \" ;]\r\n\r\nIf you were to somehow look at the image you&#39;d see only the single file `/app` plus a couple of injected system bits (I think you always get a `/dev` and `/proc` for instance). This is tricky, because there&#39;s no shell you can run (there&#39;s no `/bin` directory unless you explicitly create one).\r\n\r\nThe other place \" ;scratch \" ; appears is in base images, like [this debian:stable Dockerfile](_URL_0_):\r\n\r\n FROM scratch\r\n ADD rootfs.tar.xz /\r\n CMD [ \" ;bash \" ;]\r\n\r\nAgain, starting from absolutely nothing, unpack a tar file of a Debian installation and use that as a starting point for things going forward.", "324" ], [ "You can [mount the secret as a volume](_URL_1_). Adapting the example from the linked Kubernetes documentation:\r\n\r\n apiVersion: v1\r\n kind: Pod\r\n metadata:\r\n name: secret-test-pod\r\n spec:\r\n containers:\r\n - name: test-container\r\n image: nginx\r\n volumeMounts:\r\n - name: john-secret\r\n mountPath: /etc/john-secret\r\n volumes:\r\n - name: secret-volume\r\n secret:\r\n secretName: john-secret\r\n\r\nIf you have a bunch of secrets, you&#39;d need to mount them all into the pod spec. That&#39;s a maintainability problem in itself.\r\n\r\nI don&#39;t think anything actually stops you from using a more structured data object, like a JSON or YAML file, as the value of a secret. That could work reasonably in combination with mounting it as a volume.\r\n\r\nIf you truly have a lot of secrets – many \" ;users \" ; with many values for each – then some sort of external storage for the secrets is probably a better idea. If they&#39;re just usernames and passwords, it&#39;s very common to store a one-way hash of the password in a database (which also allows them to be updated without redeploying the system). Tools like Hashicorp&#39;s [Vault](_URL_0_) can be complicated to administer, but have actual security of this content as a priority, and you get much more rigorous control over who can access the actual secrets.", "43" ], [ "GraphQL definitely supports nested queries and multiple top-level queries, and graphql-ruby supports these just fine.\r\n\r\nIf your GraphQL schema looks like:\r\n\r\n type Employee {\r\n id: ID!\r\n firstName: String\r\n lastName: String\r\n }\r\n enum Status { NEW, UPDATED, DELETED }\r\n type Query {\r\n allEmployees(status: Status): [Employee!]!\r\n }\r\n\r\nthen you could write a query\r\n\r\n fragment EmployeeData on Employee { id firstName lastName }\r\n query Everyone {\r\n new: allEmployees(status: NEW) { ... EmployeeData }\r\n updated: allEmployees(status: UPDATED) { ... EmployeeData }\r\n deleted: allEmployees(status: DELETED) { ... EmployeeData }\r\n }\r\n\r\nThat wouldn&#39;t have quite the specific form you&#39;re looking for – there aren&#39;t good ways to add or remove arbitrary levels in your query, like adding an \" ;Employees \" ; label or removing layers from React-style connection records – but it can retrieve the data you&#39;re looking for.", "107" ], [ "Say you restructured this as a long-running program that handled only one platform at a time, and controlled which platform it was via a command-line option or an environment variable. Instead of having your \" ;launch all the platforms \" ; loop in code, you might write a shell script like\r\n\r\n #!/bin/sh\r\n for platform in $(cat platforms.txt); do\r\n ./run_platform $platform & \r\n done\r\n\r\nThis setup is easy to transplant into Docker.\r\n\r\nYou should not plan on processes launching Docker containers dynamically. This is hard to set up and has significant security implications (by which I mean \" ;a bug in your container launcher could easily root your host \" ;).\r\n\r\nIf the individual processing tasks can all run totally independently (maybe they use a shared database to store data) then you&#39;re basically done. You could replace that shell script with something like a Docker Compose YAML file that lists out all of the containers; if you want to run this on multiple hosts you can use tools like Ansible, or Docker Swarm, or Kubernetes to spread the containers out (with varying levels of infrastructure complexity).", "324" ], [ "You could create a type structure that produced that exact response format, by adding query `Employees: EmployeeStatuses` and then making a type with the `new`, `updated`, and `deleted` fields. It is a little less...GraphQLy though, and it feels like rewriting your API to match one specific client&#39;s expectations.", "905" ], [ "Databases in particular are usually designed so that it&#39;s very hard to lose data, even if the machine loses power in the middle of writing something to disk. (This comes at some performance cost.) So long as you don&#39;t have more than one PostgreSQL instance at a time using the same backing data store, I&#39;d expect it to not lose data or otherwise corrupt itself; the worst you should expect to see is a message at startup that it&#39;s recovering from a write-ahead log or something along those lines.\r\n\r\n[docker stop](_URL_2_) will send a signal to a container that prompts it to shut down cleanly, and PostgreSQL will take this as a cue to shut down. It looks like [docker-compose stop](_URL_0_), [docker-compose down](_URL_3_), and sending ^C to [docker-compose up](_URL_4_) all use the same mechanism. So the way you&#39;re doing it now should result in a clean shutdown (provided PostgreSQL finishes its cleanup within 10 seconds).\r\n\r\nI believe you can [docker-compose restart](_URL_1_) specific services, or [docker-compose up --force-recreate](_URL_4_) them. This would help if you rebuilt your application container and needed to restart that, but not its database.", "981" ], [ "The [Docker Registry](_URL_0_) is a specific piece of software; you can&#39;t directly `docker push` an image to another system.\r\n\r\nThe best workflow is almost certainly to write a `Dockerfile` that describes how to build your image. This is a simple text file, not totally unlike a shell script, that you&#39;d typically add to your source code repository. Then on the other system you could check out the repository and run `docker build` and get a functionally equivalent image.\r\n\r\nIf you have a semi-isolated network you can always run your own registry. Say you set up your local DNS such that the host name `my-registry.local` resolves to <IP_ADDRESS><PHONE_NUMBER>; then you can `docker tag` your local images as `my-registry.local/me/imagename`, `docker push` them from one system, and `docker pull` them from the other.\r\n\r\nThe lowest-maintenance, least-reproducible, highest-long-term-effort path is to [`docker save`](_URL_2_) the image on the first system, `scp` or otherwise transfer it to the second system, and then [`docker load`](_URL_1_) it there. If you&#39;re motivated, you can even do it with one step\r\n\r\n docker save me/imagename | ssh elsewhere docker load\r\n\r\nYou&#39;re forced to do this if the \" ;elsewhere \" ; system is actually disconnected from the network and the \" ;copy it to the other system \" ; step involves copying the image file on to removable media. If you&#39;re doing this at all regularly, though, or have more than one target system, you&#39;ll probably find setting up a local registry to be a good investment.", "324" ], [ "Your deployment (and more specifically its pod spec) says\r\n\r\n labels:\r\n app: mysql-service\r\n\r\nbut your service says\r\n\r\n selector:\r\n run: mysql-service\r\n\r\nThese don&#39;t match, so your service isn&#39;t attaching to the pod. You should also see this if you `kubectl describe service mysql-service`, the \" ;endpoints \" ; list will be empty.\r\n\r\nChange the service&#39;s selector to match the pod&#39;s labels (or vice versa) and this should be better.", "280" ], [ "If you&#39;re asking this question at all, you should restructure your code so these kinds of ambiguities don&#39;t exist. There&#39;s literally an infinite number of possible variable names, and if you choose a different name for the second file handle, this issue goes away.\r\n\r\n with open(&#39;some/file&#39;) as file_handle:\r\n # some codes\r\n with open(&#39;another/file&#39;) as file_handle_2:\r\n # more codes\r\n\r\nOr, if you don&#39;t need the two file handles at the same time, use two separate \" ;with \" ; blocks so that the first one closes before the second is opened:\r\n\r\n with open(&#39;some/file&#39;) as file_handle:\r\n # some codes\r\n with open(&#39;another/file&#39;) as file_handle_2:\r\n # more codes\r\n\r\n > What would happen to the first file_handle? Would it be closed after assignment or it remains open?\r\n\r\nIt remains open until the end of the `with` block.\r\n\r\n > If after the assignment, an exception happened in the with block, would the newly opened file be closed or not?\r\n\r\nNo. The `with` block controls the first file object and nothing is explicitly tracking the second one.\r\n\r\n > Once the with block is finished, does it close the new file_handle?\r\n\r\nNo, it gets leaked until and unless the garbage collector notices it&#39;s unused and closes it for you.", "919" ], [ "You need to make the description part its own class. You then need to decide whether it&#39;s a property of the containing data class, or a function that returns it; the syntax to retrieve it is different. An outline of the code structure you need (following your existing style) could be:\r\n\r\n class Description:\r\n def title(self): ...\r\n def source(self): ...\r\n def info(self): ...\r\n def attribute(self): ...\r\n\r\n class IrisData:\r\n def description(self):\r\n self.desc = Description()\r\n return self.desc\r\n\r\n data = IrisData()\r\n print(data.description())\r\n print(data.description().attribute())\r\n\r\nFor simple data records like this, though, it&#39;s more common to just store things directly as properties of the object. I&#39;d instead write:\r\n\r\n class IrisData:\r\n def __init__(self, url, description, ...):\r\n self.url = url\r\n self.description = description\r\n # and set the other properties here\r\n\r\n # but there are no accessor functions here\r\n # and no functions that retrieve object state, but only by mutating it\r\n\r\n data = IrisData(&#39;_URL_0_;,\r\n Description(...),\r\n ...)\r\n print(data.url)\r\n print(data.description.attribute)", "118" ], [ "_URL_0_ lists the supported architectures and 32-bit x86 Linux isn&#39;t one of them.\r\n\r\nThe desktop Docker for Mac and Docker for Windows applications only run on 64-bit x86; the Linux system component runs on 64-bit x86 (but not 32-bit), 64-bit ARM, and IBM Power (ppc64le) and Z (s390x) platforms. Prebuilt distribution packages are only available one some of those architectures, though all of CentOS, Debian, Fedora, and Ubuntu are available for 64-bit x86 and Ubuntu packages are available for all supported architectures.", "4" ], [ "All of your role&#39;s rules are for the core (empty) [API group](_URL_0_). However, the URL you&#39;re trying to access, `/apis/apps/v1beta1`, is in the \" ;apps \" ; API group (the part of the path after `/apis`). So to access that particular API path, you need to change the role definition to\r\n\r\n rules:\r\n - apiGroups: [ \" ;apps \" ;]\r\n resources: [ \" ;deployment \" ;]\r\n verbs: [ \" ;create \" ;, \" ;delete \" ;, \" ;get \" ;, \" ;list \" ;, \" ;patch \" ;, \" ;update \" ;, \" ;watch \" ;]\r\n # and also the other deployment subpaths", "706" ], [ "In general Docker containers can&#39;t access host devices and shouldn&#39;t mount additional filesystems. These restrictions are even tighter during a `docker build` sequence, because the various options that would let you circumvent it aren&#39;t available to you.\r\n\r\nThe most straightforward option is to write a wrapper script that does the mount and unmount for you, something like:\r\n\r\n #!/bin/sh\r\n if [ ! -d tools ]; then mkdir tools; fi\r\n mount -r tools.iso tools\r\n docker build \" ;$@ \" ; .\r\n umount tools\r\n\r\nThen you can have a two-stage Docker image where the first stage has access to the entire DVD contents and runs its installer, and the second stage actually builds the image you want to run. That would look something like (totally hypothetically)\r\n\r\n FROM _URL_0_ AS install\r\n COPY tools tools\r\n RUN cd tools & & ./_URL_1_ /opt/whatever\r\n \r\n FROM _URL_0_\r\n COPY --from=install /opt/whatever /opt\r\n EXPOSE 8888\r\n CMD [ \" ;/opt/whatever/bin/whateverd \" ;, \" ;--bind \" ;, \" ;<IP_ADDRESS>:8888 \" ;, \" ;--foreground \" ;]\r\n\r\nThe obvious problem with this is that the entire contents of the DVD will be sent across a networked channel from the host to itself as part of the `docker build` sequence, and then copied again during the `COPY` step; if it does get into the gigabyte range then this starts to get unwieldy. You can use a `.dockerignore` file to cause some of it to be hidden to speed this up a little.\r\n\r\nDepending on what the software is, you should also consider whether it can run successfully in a Docker container (does it expect to be running multiple services with a fairly rigid communication pattern?); a virtual machine may prove to be a better deployment option, and \" ;mount a DVD to a VM \" ; is a much better-defined operation.", "324" ], [ "I&#39;m assuming that the content on the DVD is \" ;big \" ;, but is totally redundant with what actually gets installed. In that case the two-stage build avoids having the second copy in the image you&#39;re actually using. `yum` makes this a little trickier because you can&#39;t really isolate the installed package into a single directory that can get copied; the flip side of this is that you can COPY only the specific `.rpm` file(s) you need to install.", "583" ], [ "You can probably use your existing build methodology and scripts close to unchanged, but you&#39;ll need to rebuild the actual images.\r\n\r\nYou can&#39;t directly run x86 binaries on Power (at a very low level, the bytes of machine code are just different). Docker doesn&#39;t contain any sort of virtualization layer; it does a bunch of setup to isolate the container from the host, but then runs the binaries in an image directly.\r\n\r\nIf your Jenkins setup has enough parameters for image names and version tags, then you should be able to run the x86 and Power setups side-by-side; you need to encode the architecture somewhere in the built image name or tag; for instance, `_URL_1_`. (I don&#39;t know that one or the other is considered better if you control all of the machinery.) If you have a private repo, you could encode it earlier in the path, winding up with image names like `_URL_0_`.\r\n\r\nYou&#39;d need to double-check that everywhere that has a Docker image reference has it correctly parameterized (which is a good practice anyways). That would include any direct `docker run` commands; any Docker Compose or Kubernetes YAML files or similar artifacts; and [the FROM line of any Dockerfiles](_URL_2_).", "324" ], [ "The mutation’s return type must define at least one field and you must select at least one field from it in the query. (See [&#167;3.6 of the spec](_URL_0_).)\r\n\r\nIf you control both the server and the client and the mutation really returns nothing, you could define an artificial `ok: Boolean!` that’s always true. You might return something like a user object that contains a list of entitlements too, in which case you could just select (and ignore) the user ID.", "134" ], [ "If you don&#39;t give every build of your image a distinct name, it&#39;s hard to force Kubernetes to restart a Deployment when the underlying image changes: it has no way of knowing that the \" ;latest \" ; tag on Docker Hub now means something else. (`imagePullPolicy: Always` will at least force it to get a new image if it happens to be restarting anyways.) When your run `kubectl apply`, it looks at the Deployment you&#39;re uploading, sees that it matches what&#39;s already running, and does nothing.\r\n\r\nBest practice is to not use the \" ;latest \" ; tag and give some sort of unique identifier (timestamp, source control commit ID, ...). Then you can update the image ID in the pod spec, `kubectl apply` will see that something is different, and Kubernetes will perform a rolling update of the running pod(s) for you. This also has the advantage that, if a build is bad, you can easily go backwards by changing the image tag back to a previous build.", "324" ], [ "Possibly the most straightforward way to do this is to create a directory on the host containing the two `.sql` files and bind-mount it into the Docker container when it starts. If there isn&#39;t already a database in persistent storage, then the container will run them automatically when it creates the database. See \" ;Initializing a fresh instance \" ; in the [mysql image documentation](_URL_0_).\r\n\r\n < !-- language: lang-sh -- > \r\n\r\n MYSQL_PORT := 33061\r\n MYSQL_ROOT_PASSWORD := secret\r\n PORTS := -p $(MYSQL_PORT):3306\r\n VOLUMES := -v $(PWD)/scripts:/docker-entrypoint-initdb.d\r\n ENVS := -e MYSQL_ROOT_PASSWORD=$(MYSQL_ROOT_PASSWORD)\r\n IMAGE := mysql:5.7\r\n RUN_OPTS := $(PORTS) $(VOLUMES) $(ENVS)\r\n ARGS := --character-set-server=utf8mb4\r\n\r\n run:\r\n docker run -d $(RUN_OPTS) $(IMAGE) $(ARGS)\r\n\r\nIf you can&#39;t do that, then you can run an ordinary MySQL client on the host. This avoids several issues around the container having its own filesystem, effectively needing to be root to run `docker` commands, and shell quoting issues. (`docker exec` probably shouldn&#39;t be part of your core workflow.)\r\n\r\n < !-- language: lang-sh -- > \r\n\r\n setup: setup.sql\r\n mysql -h localhost -P $(MYSQL_PORT) -w -u root -p $(MYSQL_ROOT_PASSWORD) < $ < \r\n create_tables: create_tables.sql\r\n mysql -h localhost -P $(MYSQL_PORT) -w -u root -p $(MYSQL_ROOT_PASSWORD) < $ < \r\n\r\nIf you must use `docker exec`, then remember that shell redirection happens _before_ control gets handed over to Docker land: if you `docker exec ... < file` your local shell opens `file` on the host for reading and that becomes the standard input to the command `docker exec` runs. In you&#39;re example your shell command is reading from `/tmp/setup.sql` on the host and that&#39;s producing the \" ;file not found \" ; error.", "324" ], [ "You need to do two things.\r\n\r\nFirst, split this up into two pods. (As a general rule, you should have one container in a pod; the typical exceptions to this are things like logging and networking \" ;sidecar \" ; containers that need to share filesystem and network space with the main container.) This probably means taking your existing pod spec (or better deployment spec), taking all of the stuff around the `containers:` block and making a second copy of it, and putting one container in each.\r\n\r\nYou need to make sure each of the pods has a distinct label (if you&#39;re using a deployment it&#39;s the label inside the pod template that matters); this might look something like\r\n\r\n < !-- language: lang-yaml -- > \r\n\r\n metadata:\r\n name: web\r\n labels:\r\n app: web\r\n\r\nSecond, you need to create a Kubernetes service that points at the \" ;web \" ; pod. This matches on the labels we just set\r\n\r\n < !-- language: lang-yaml -- > \r\n\r\n metadata:\r\n name: web\r\n spec:\r\n selector:\r\n app: web\r\n\r\nNow the name of the service will result in a DNS name `web.default.svc.cluster.local` existing (where \" ;default \" ; is the Kubernetes namespace name). `default.svc.cluster.local` gets set as a default DNS search domain, so `web` will resolve to the service will forward to the pod.\r\n\r\nThe Kubernetes documentation has [a more complete example of this sort of thing](_URL_0_) (using PHP and nginx, but the only code is Kubernetes YAML manifests, so it should be pretty applicable).", "483" ], [ "> In the application I have hard coded the path as something like \" ;C:\\SomeFolder \" ;. What location is this stored on the Docker container?\r\n\r\n`c:\\SomeFolder`, assuming you have a Windows container. This is the sort of parameter you&#39;d generally set via a command-line option or environment variable, though.\r\n\r\n > How do I force the application when running on Docker to use the Host file system instead of Docker&#39;s File system?\r\n\r\nUse the `docker run -v` option or an equivalent option to mount some directory from the host on that location. Whatever the contents of that directory are on the host will replace what&#39;s in the container at startup time, and after that changes in the host should be reflected in the container and _vice versa_.\r\n\r\nIf you have an opportunity to rethink this design, there are a number of lurking issues around file ownership and the like. The easiest way to circumvent these issues are to store data somewhere like a database (which may or may not itself be running in Docker) and use network I/O to send data to and from the container, and store as little as possible in the container filesystem. `docker run -v` is an excellent way to inject configuration files and get log files out in a typical server-oriented use.", "324" ], [ "Docker containers share the host’s kernel when they’re run. `docker build` internally launches a series of containers, so if one of your Dockerfile steps does something that’s kernel-dependent you could in theory get different results if the image was built on different systems. In turn, regardless of where the image was built, when you run it, it will use the current host’s kernel.\r\n\r\nIn practice, programs that have deep kernel-level dependencies (for example, depend on specific modules being loaded) are hard to run under Docker; you wind up needing to break a lot of the isolation Docker offers to run the program at all, and it’s usually easier and better to run these sorts of programs on the host.\r\n\r\nThe flip side of this is that “routine” server-type Docker images (for example, the sorts of Python, Node, and PHP applications that are ubiquitous on SO) aren’t that sensitive to the kernel at all, and so long as your kernel is new enough to successfully run Docker it doesn’t really matter.", "324" ], [ "If you’re using the Kubernetes built into Docker (Edge) for Mac, it is the same Docker daemon, and `docker run -p` will publish ports on your host as normal. This should share a port space with services running outside Docker/Kubernetes and also with exposed Kubernetes services.\r\n\r\nYou need to pick a different host port with your `docker run -p` option if you need to run a second copy of a service, whether the first one is another plain Docker container or a Kubernetes Service or a host process or something else.\r\n\r\nRemember that “localhost” is extremely context sensitive; I’d avoid using it in questions like this. If you `docker run -p 8080:80 ...` as you suggest, the host can make outbound calls to the container at localhost:8080; the container can make outbound calls to itself at localhost:80; and nothing in any Kubernetes pod or any other container can see the service at localhost on any port.", "707" ], [ "I&#39;d write a grammar perhaps something like\r\n\r\n < statement > <IP_ADDRESS>= < assignment > \" ;; \" ;\r\n < assignment > <IP_ADDRESS>= < lhs > \" ;= \" ; < rhs > \r\n < lhs > <IP_ADDRESS>= < var > \r\n < rhs > <IP_ADDRESS>= < expr > \r\n < var > <IP_ADDRESS>= ( \" ;@ \" ; | \" ;$ \" ; | \" ;% \" ; | \" ;* \" ;) < name > \r\n < expr > <IP_ADDRESS>= < var > | < number > \r\n\r\nThat would match a range of Perl-ish assignments (given suitable definitions for ` < name > ` and ` < number > `); not just the one you wrote but also\r\n\r\n < !-- language: perl -- > \r\n\r\n $age = 25;\r\n @foo = $bar;\r\n %baz = 9999999;\r\n\r\nPerl has some syntactic complexities that make it hard to fully check at this level (consider the differences between the expressions `$foo`, `$foo{bar}`, and `$foo- > {bar}`) but if you&#39;re willing to do a second pass of type checking than it should be a fairly typical statement-and-expression grammar.", "784" ], [ "You don&#39;t want to use `subprocess` for this at all.\r\n\r\nWhat does this command really do? It uses a bash extension to open a network socket, feeds it through **cat**(1) to reroute it to standard output, and decides to run cat as root. You don&#39;t really need the bash extension, or `/bin/cat`, or root privileges to do any of this in Python; you&#39;re looking for the [socket](_URL_1_) library.\r\n\r\nHere&#39;s an all-Python equivalent:\r\n\r\n #!/usr/bin/env python3\r\n import socket\r\n s = socket.create_connection((&#39;_URL_0_&#39;, 13))\r\n try:\r\n print(s.recv(4096))\r\n finally:\r\n s.close()\r\n\r\n(Note that all of my experimentation suggests that this connection works but the daytime server responds by closing immediately. For instance, the simpler shell invocation `nc _URL_0_ 13` also returns empty string.)", "227" ], [ "Once both Elasticsearch and Kibana have started up, run that `curl` command, from the host, in the directory that has the JSON dump.\r\n\r\nProgrammatically telling that both have started up is surprisingly tricky. In principle you can do something like this by writing an ENTRYPOINT script that does the first-time setup before it launches the actual service, but that&#39;s easier if the configuration is in the filesystem (IIRC Kibana actually stores this sort of data in ES). If you read through the way, say the official [mysql](_URL_0_) image does this, it involves starting the service, waiting for it to actually come up, doing the initialization, and then stopping it again before `exec \" ;$@ \" ;` in the end.\r\n\r\nYou can&#39;t do _everything_ via Docker Compose, and if your first-time setup depends on both a host-local file and the service actually running, it&#39;s probably easier to not try to shoe-horn it in.", "375" ], [ "That construct saves data in a _named volume_; if you look under `/var/lib/docker/volumes` as root you should be able to see it there (though mucking around in `/var/lib/docker` generally isn&#39;t advisable; and I believe this is one of the things where Docker Compose will change the name to try to make it unique).\r\n\r\nIf you want the data to be saved in a host directory, change the volume declaration to explicitly have a relative or absolute path. You won&#39;t need the explicit volume declaration, and for this you can remove the volumes block entirely. That would leave you with a `docker-compose.yml` that looks like:\r\n\r\n version: \" ;3 \" ;\r\n services:\r\n db:\r\n image: postgres:9.4\r\n volumes:\r\n - \" ;./db-data:/var/lib/postgresql/data \" ;", "324" ], [ "From working with functional languages, and from trying to write reproducible tests, I&#39;ve generally tried to adopt a rule that a function should declare all of its inputs as parameters, and produce all of its outputs as return values: to the maximum extent possible a function should never have side effects. Using the `global` keyword probably indicates you&#39;re breaking this rule.\r\n\r\nFor example, your \" ;g \" ; function takes the current state variable and either increments it or doesn&#39;t. You don&#39;t need a global for that (and you don&#39;t need it to be a nested function either):\r\n\r\n from random import randint\r\n def g(n):\r\n \" ; \" ; \" ;Returns either n or n+1, with 50% probability. \" ; \" ; \" ;\r\n if randint(1,100) > 50:\r\n return n+1\r\n else:\r\n return n\r\n\r\nThen the iterating function can call that a bunch of times:\r\n\r\n def f():\r\n \" ; \" ; \" ;Produces a number between 0 and 100 with $DISTRIBUTION. \" ; \" ; \" ;\r\n n = 0\r\n for _ in range(100):\r\n n = g(n)\r\n return n\r\n\r\nAnd finally at the top level:\r\n\r\n if __name__ == &#39;__main__&#39;:\r\n print(f())\r\n\r\nSince we&#39;re never totally sure about our code, we can write some tests.\r\n\r\n def test_f():\r\n n = f()\r\n assert n > = 0 and n < 100\r\n\r\n def test_g():\r\n n = g(0)\r\n assert n == 0 or n == 1\r\n\r\n def test_g_dist():\r\n count = 100\r\n ns = [g(0) for _ in range(count)]\r\n assert(all(n == 0 or n == 1) for n in ns)\r\n zeros = len([n for n in ns if n == 0])\r\n ones = len([n for n in ns if n == 1])\r\n assert zeros + ones == count\r\n # won&#39;t always pass; probability of failure left as an exercise\r\n assert zeros > 0.45 * count and zeros < 0.55 * count\r\n\r\nNotice that I can call `f()` and `g(n)` as many times as I want and they&#39;ll never interfere with anything else. Running my own unit tests at startup time would be a little unusual, but I&#39;m free to if that&#39;s what I want to do.", "667" ], [ "We can break down that command line a little differently as\r\n\r\n docker run \\\r\n ... some other arguments ... \\\r\n --entrypoint tail \\\r\n webappdockerornot:dev \\\r\n -f /dev/null\r\n\r\nand match this against a general form\r\n\r\n docker run [OPTIONS] [IMAGENAME:TAG] [CMD]\r\n\r\nSo the `--entrypoint tail` option sets the entry point to `tail`, and the \" ;command \" ; part is `-f /dev/null`. When Docker actually launches the container, it passes the command as additional arguments to the entrypoint. In the end, the net effect of this is\r\n\r\n > Ignore what the Dockerfile said to do; after setting up the container runtime environment, run `tail -f /dev/null` instead.\r\n\r\nwhich in turn is a common way to launch a container that doesn&#39;t do anything but also stays running. Then you can use `docker exec` and similar debugging-oriented tools to do things inside the container.", "707" ], [ "You should probably be doing most of your development work in a [virtual environment](_URL_0_). Your workflow for this could look like:\r\n\r\n < !-- language: sh -- > \r\n\r\n # activate the virtual environment in ~/vpy\r\n . $HOME/vpy/bin/activate\r\n\r\n # install my app and its dependencies\r\n cd $HOME/src/myapp\r\n pip install -e .\r\n\r\n # use my forked library instead\r\n cd $HOME/src/forkedlib\r\n pip install -e .\r\n pytest # or whatever tests the forked lib has\r\n\r\n # try it out with my application too\r\n cd $HOME/src/myapp\r\n pytest # or whatever tests your app has\r\n myapp\r\n\r\n`pip install -e` does some magic so that, whenever you `import` the module in the library, it gets routed directly to the checked-out source tree, so if you make edits in `forkedlib` and then re-run `myapp`, you&#39;ll see those changes directly.\r\n\r\nWhen you&#39;re done, you can `pip uninstall forkedlib` and then re-run `pip install -e .` to reinstall your application&#39;s (declared) dependencies. (Or delete and recreate the virtual environment, if that&#39;s easier.)", "435" ], [ "The single easiest answer to this is to just not bother with a virtual environment in a Docker image. A virtual environment gives you an isolated filesystem space with a private set of Python packages that don&#39;t conflict with the system install, but so does a Docker image. You can just use the system pip in a Docker image and it will be fine.\r\n\r\n FROM python:3.7\r\n RUN pip install --upgrade pip\r\n WORKDIR /usr/src/app\r\n COPY . .\r\n RUN pip install .\r\n CMD [ \" ;myscript \" ;]\r\n\r\nIf you really want a virtual environment, you either need to specifically run the wrapper scripts from the virtual environment&#39;s path\r\n\r\n RUN python -m venv venv\r\n RUN venv/bin/pip install --upgrade pip\r\n\r\nor run the virtual environment \" ;activate \" ; script on _every_ RUN command; the environment variables it sets won&#39;t carry over from one step to another. (Each RUN command in effect does its own `docker run; docker commit` sequence under the hood and will launch a new shell in a new container; the [Dockerfile reference](_URL_0_) describes this a little bit.)\r\n\r\n RUN python -m venv venv\r\n RUN . venv/bin/activate \\\r\n & & pip install --upgrade pip\r\n COPY . .\r\n RUN . venv/bin/activate \\\r\n & & pip install .\r\n CMD [ \" ;venv/bin/myscript \" ;]\r\n\r\nTrying to activate the virtual environment in its own RUN instruction does nothing beyond generate a no-op layer.\r\n\r\n # This step does nothing\r\n RUN . venv/bin/activate\r\n # And therefore this upgrades the system pip\r\n RUN pip install --upgrade pip", "324" ], [ "I think this is more significant for the case where someone might be dependent on the specific numeric uid, maybe to inject data into a container.\r\n\r\n < !-- language: lang-sh -- > \r\n\r\n # this needs to be readable by the container process\r\n # it runs as non-root user \" ;www-data \" ;\r\n # we think its uid is 18\r\n sudo chown -R 18 data\r\n sudo docker run -v ./data:/data -p 8888:80 imagename\r\n\r\nNow if, due to changes in the base image outside either the image author&#39;s or end user&#39;s control, `adduser` makes the uid be something else, recipes like this will break (the host has no direct way to see the container&#39;s `/etc/passwd` file to know what the actual uid will be).\r\n\r\nTo work around _that_ you maybe need a recipe like this:\r\n\r\n < !-- language: lang-sh -- > \r\n\r\n # may or may not work to get the uid\r\n CONTAINER_UID=$(sudo docker run --rm imagename id -u)\r\n sudo chown -R \" ;$CONTAINER_UID \" ; data", "324" ], [ "There are two separate parallel release trains of Docker, which Docker calls \" ;channels \" ;. \" ;Stable \" ; is pretty well tested; \" ;edge \" ; is kind of like a late beta. [About Docker CE](_URL_1_) also discusses three release channels for the core (Community Edition) engine, and the [Docker for Windows FAQ](_URL_0_) discusses this in some detail.\r\n\r\nIf you&#39;re not sure then you should pick usually the \" ;stable \" ; channel.\r\n\r\nThe \" ;edge channel \" ; has some features that are slightly more experimental. In the Docker for Windows and Docker for Mac desktop applications, \" ;edge \" ; in particular includes a built-in optional local Kubernetes deployment, in the same space as `minikube` but lighter-weight. \" ;Edge \" ; also has more frequent releases.", "324" ], [ "In your Dockerfile you control the entire environment. It&#39;s often easiest to cause things to appear in their \" ;natural \" ; places, like `/usr/bin`. You also have the advantage that, within a single Docker image, there will only be one version of the tools installed.\r\n\r\nI might do something like this:\r\n\r\n < !-- language: lang-sh -- > \r\n\r\n RUN for f in $PWD/opt/android-sdk-linux/build-tools/*/*; do \\\r\n ln -s $f /usr/local/bin; \\\r\n done\r\n CMD [ \" ;zipalign \" ;, \" ;-h \" ;]\r\n\r\nAnother approach that might work is to use a build argument or an environment variable to hold the version number. If you do that then you can set up a known path name.\r\n\r\n < !-- language: lang-sh -- > \r\n\r\n ARG version\r\n RUN curl -LO _URL_0_{version}.tar.gz \\\r\n & & tar xzf android-sdk-linux-${version}.tar.gz \\\r\n & & rm -f android-sdk-linux-${version}.tar.gz \\\r\n & & cd opt/android-sdk-linux-build-tools \\\r\n & & ln -s ${version} current\r\n CMD [ \" ;./opt/android-sdk-linux/build-tools/current/zipalign \" ;]", "324" ], [ "Because of Docker layer caching, in a lot of common cases the `touch` command won&#39;t do _anything_. If the jar file has changed then the ADD command will include it in the image with its last-modified time from the host ( \" ;it is copied individually [along with its metadata](_URL_0_) \" ;); since that&#39;s presumably recently, the `touch` command will update it to seconds later. If the jar file hasn&#39;t changed then Docker will skip both the ADD and RUN commands and use the filesystem output from the previous time you ran it, with the previous run&#39;s timestamp.\r\n\r\nIf the jar file is just being used as an input to `java -jar` then its last-modified time shouldn&#39;t be relevant to anything either.\r\n\r\nI&#39;d guess you can safely remove the `touch` command with no ill effects. There are a couple of unnecessary `sh -c` invocations that don&#39;t matter and just clutter things. I&#39;d guess this Dockerfile to be functionally equivalent:\r\n\r\n < !-- language: sh -- > \r\n\r\n # Prefer COPY to ADD, unless you explicitly want Docker to fetch\r\n # URLs or unpack archives\r\n COPY dist /dist/\r\n ARG JAR_FILE\r\n COPY target/${JAR_FILE} /target/app.jar\r\n EXPOSE 8080\r\n # Prefer CMD to ENTRYPOINT, if nothing else so `docker run imagename sh` works\r\n # Split simple commands into words yourself\r\n CMD [ \" ;java \" ;, \" ;-jar \" ;, \" ;/target/app.jar \" ;]", "324" ], [ "The two important things you need to do are to remove the `volumes:` declaration that gets the actual application code from your local filesystem, and upload your built Docker image to some registry. Since you&#39;re otherwise on AWS, [ECR](_URL_1_) is a ready option; public Docker Hub will work fine too.\r\n\r\nDepending on how your Rails app is structured, it might make sense to use the same image with different commands for the main application and the Sidekiq worker(s), and it might work to just make it say\r\n\r\n sidekiq:\r\n image: production_image\r\n command: bundle exec <PERSON>\r\n\r\nSince you&#39;re looking at AWS anyways you should also consider the possibility of using hosted services for data storage (RDS for the database, Elasticache for Redis). The important thing is to include the locations of those data stores as environment variables so that you can change them later (maybe they would default to `localhost` for developer use, but always be something different when deployed).\r\n\r\nYou&#39;ll also notice that my examples don&#39;t have `links:`. Docker provides an internal DNS service for containers to find each other, and Docker Compose arranges for containers to be found via their service key in the YAML file.\r\n\r\nFinally, you should be able to test this setup locally before deploying it to EC2. Run `docker build` and `docker-compose up` as needed; debug; and if it works then `docker push` the image(s) and launch it on Amazon.\r\n\r\n version: &#39;3&#39;\r\n volumes: *volumes_from_the_question\r\n services:\r\n db: *db_from_the_question\r\n redis: *redis_from_the_question\r\n\r\n sidekiq:\r\n image: _URL_2_\r\n environment:\r\n - PGHOST: db\r\n - REDIS_HOST: redis\r\n\r\n app:\r\n image: _URL_0_\r\n ports:\r\n - \" ;80:80 \" ;\r\n environment:\r\n - PGHOST: db\r\n - REDIS_HOST: redis", "324" ], [ "# No longer supported in Docker Compose 3\r\n\r\nThe [documentation](_URL_1_) suggests that `depends_on:` can be a list of strings, or a mapping where the keys are service names and the values are conditions. For the services where you don&#39;t have (or need) health checks, there is a `service_started` condition.\r\n\r\n < !-- language: lang-yaml -- > \r\n\r\n depends_on:\r\n # notice: these lines don&#39;t start with \" ;- \" ;\r\n jhipster-registry:\r\n condition: service_healthy\r\n myprogram-postgresql:\r\n condition: service_started\r\n myprogram-elasticsearch:\r\n condition: service_started\r\n\r\nDepending on how much control you have over your program and its libraries, it&#39;s better still if you can arrange for the service to be able to start without its dependencies necessarily being available (equivalently, to function if its dependencies die while the service is running), and not use the `depends_on:` option. You might return an HTTP 503 Service Unavailable error if the database is down, for instance. Another strategy that often is helpful is to immediately exit if your dependencies aren&#39;t available but use [a setting](_URL_0_) like `restart: on-error` to ask the orchestrator to restart the service.", "123" ], [ "That specific line looks like it causes a port from the container/VM to be forwarded out to the host, and it should be exactly equivalent to the option `docker run -p <IP_ADDRESS>:5432:5432` (where those three parts match `host_ip`, `host`, and `guest` from your Vagrant statement).\r\n\r\nNote that the Docker environment and typical usage can be different from typical VM setups. As a specific example here, you wouldn&#39;t generally try to run a PostgreSQL database inside your application&#39;s container; you&#39;d separately launch a database container and tell your application about it. A typical command-line only setup might be\r\n\r\n docker network create mynet\r\n docker run -p 5432:5432 --net mynet --name db postgres:9.6\r\n docker run -p 8080:8080 --net mynet --name app -e PGHOST=db myapp:20180914\r\n\r\nDocker Compose is a frequently used tool for launching multiple containers that work together (and you can find many many examples of app+database `docker-compose.yml` files by reading through SO questions).", "707" ], [ "You can [include your file in the Helm chart](_URL_0_). You&#39;d generally include that in a Kubernetes ConfigMap object, which can then be [mounted in a Pod as a volume](_URL_2_).\r\n\r\nYou need to move the file to somewhere in the Helm chart directory; say it&#39;s in `charts/mychart/files/custom-samples.json`. You can create a ConfigMap in, say, `charts/mychart/templates/configmap.yaml` that would look like\r\n\r\n apiVersion: v1\r\n kind: ConfigMap\r\n metadata:\r\n name: {{ ._URL_1_ }}-configmap\r\n data:\r\n custom-samples.json \" ; |-\r\n {{ .Files.Get \" ;custom-samples.json \" ; | indent 4 }}\r\n\r\nThen in your Deployment&#39;s Pod spec, you&#39;d reference this:\r\n\r\n apiVersion: v1\r\n kind: Deployment\r\n spec:\r\n template:\r\n spec:\r\n volumes:\r\n - name: config\r\n configMap:\r\n name: {{ ._URL_1_ }}-configmap\r\n containers:\r\n - name: ...\r\n volumeMounts:\r\n - name: config\r\n mountPath: /data/templates\r\n\r\nNote that this approach causes the file to be stored as a Kubernetes object, and there are somewhat modest size limits; something that looks like a text file and is sized in kilobytes should be fine. Also, if there are other files in the `/data/templates` directory, this approach will cause them to be hidden in favor of whatever&#39;s in the ConfigMap.", "483" ], [ "If you `docker exec` into the container, the file will be unencrypted. (It&#39;s just a text file and you can look at it with `more` on most image bases.)\r\n\r\nHowever, if you can run any Docker command at all, then generally it&#39;s trivial to get unrestricted root access on the system. (Consider using `docker run -v /etc:/host-etc` to add yourself to `/etc/sudoers` or to allow root logins with no password.)\r\n\r\nAlso remember that anyone who has the image can `docker run` it and see the file there, if that matters to your security concerns. If you&#39;re looking for a single file with root access on the system anyways, you can find it without too much effort in `/var/lib/docker`. They can also easily run `docker history` to see the database root password you&#39;ve set.", "324" ], [ "Docker images are made of _layers_; each has a piece of the combined ultimate image filesystem. The layers actually make up a kind of tree, where you might have a base Ubuntu layer, with a child that installs a specific Debian package, with a child that adds your application code, and so on. Each of these layers is actually independently usable as an image, but you can&#39;t delete a base-layer image so long as there&#39;s another image below it that depends on it.\r\n\r\nYou&#39;re running `docker image -a`, which lists _all_ of the images, even the ones that only exist as base layers. That produces a bunch of \" ;extra \" ; ` < none > < none > ` images, which are the base layers. They&#39;re harmless, and required, and don&#39;t take up any extra resources. In general using the `-a` option doesn&#39;t really tell you anything and I&#39;d just skip it.", "324" ], [ "I see two issues in this code. First:\r\n\r\n pageUp=() = > {\r\n let skip=this.state.count\r\n }\r\n\r\nThe `let` statement causes the `skip` variable to be local to this function. It&#39;s not obvious from your question what causes it to be passed on to the GraphQL query, but if it&#39;s a member variable or something else, this statement _shadows_ it and you&#39;re setting a purely local variable whose state will be lost.\r\n\r\nSecond:\r\n\r\n this.setState({count: this.state.count +2});\r\n let skip=this.state.count\r\n\r\n[State updates may be asynchronous](_URL_1_), and the React documentation specifically advises against changing state the way you have it (there is a callback-based pattern that&#39;s more appropriate). The other consequence of this is that the state may not have actually updated when you get to the next line, so you&#39;re assigning `count` from the \" ;old \" ; state to the `skip` variable.\r\n\r\nLooking at the Gatsby documentation, there is a specific note that [StaticQuery does not support GraphQL variables](_URL_0_), though browsing it doesn&#39;t suggest another path that does. (Every single example that shows potentially paginated data only shows the first page.)", "530" ], [ "In general you should assume commands like `service` just don&#39;t work in Docker. As <PERSON> is suggesting, in this case I think you can just remove the `service apache2 restart` part of the line: Apache isn&#39;t running during the build phase and running `docker run` will start it.", "707" ], [ "You _can_ do this. I&#39;ll preface this answer by saying that there are real limitations on what you can do with regular expressions alone, and for a sufficiently complex input you might need to write text parsing code that isn&#39;t just regex matching. \" ;Numbers that add up to 10 \" ; as a more general statement is something regexes can&#39;t do; a more classic problem that&#39;s theoretically impossible is checking if a string has a matching number of open and close parentheses, correctly nested.\r\n\r\nIf instead of \" ;add up to 10 \" ; I say \" ;if the start delimiter is 1 then the end delimiter is 9 \" ;, and so on, then I should be able to build up a (complicated!) regex like so:\r\n\r\n #!/usr/bin/env python3\r\n import re\r\n\r\n # runs of things neither question mark nor digit\r\n not_qmark_digit = r&#39;[^?\\d]*&#39;\r\n # contiguous blocks of non-digit with exactly three question mark\r\n three_qmark = &#39;(?:&#39; + not_qmark_digit + r&#39;\\?){3}&#39; + not_qmark_digit\r\n # build a regexp matching 1...?.?.?...9 given the start digit\r\n def delimited(start):\r\n end = 10-start\r\n return str(start) + three_qmark + str(end)\r\n # make the 9 cases starting with each digit\r\n cases = [delimited(n) for n in range(1, 10)]\r\n # and join them as alternatives\r\n pattern = &#39;|&#39;.join(cases)\r\n\r\n x = re.compile(pattern)\r\n print(x.findall( \" ;arrb6???4xxbl5???eee5 \" ;))\r\n # [&#39;6???4&#39;, &#39;5???eee5&#39;]\r\n print(x.findall( \" ;acc?7??sss?3rr1??????5 \" ;))\r\n # [&#39;7??sss?3&#39;]", "772" ], [ "You should make this configurable, and use the Docker-internal DNS to communicate between hosts.\r\n\r\nIn your JavaScript code, the most straightforward thing to do is to use an environment variable\r\n\r\n < !-- lang: javascript -- > \r\n\r\n const esClient: elasticsearch.Client = new elasticsearch.Client({\r\n host: process.env.ELASTICSEARCH_HOST\r\n })\r\n\r\nWhen you&#39;re developing your code (locally, outside of Docker) you can stand up a test Elasticsearch (in a container if you&#39;d like) and set `ELASTICSEARCH_HOST=localhost:9200`. When you go to deploy it, you can set the environment variable in your `docker-compose.yml`:\r\n\r\n < !-- language: lang-yaml -- > \r\n\r\n services:\r\n elasticsearch: \r\n image: _URL_0_\r\n et: cetera\r\n api:\r\n build: .\r\n environment:\r\n ELASTICSEARCH_HOST: &#39;elasticsearch:9200&#39;\r\n env_file:\r\n - .env\r\n ports:\r\n - \" ;<IP_ADDRESS>:9000:9000 \" ;\r\n\r\n(You do not need `links:` any more; it&#39;s not harmful, but it&#39;s unnecessarily verbse. I&#39;d use the `Dockerfile` to install your application code in the image and set the default command.)", "375" ], [ "When you build your final image, be careful to copy only the exact files you want to end up in the image. It makes sense here to make your binary be the ENTRYPOINT of the image, since there&#39;s literally nothing else you can do with it.\r\n\r\nI might make a two-stage pipeline like so:\r\n\r\n # size of this stage doesn&#39;t matter; use the standard image\r\n FROM golang AS builder\r\n WORKDIR /go/src/tzf\r\n ADD . ./\r\n RUN CGO_ENABLED=0 go build -ldflags &#39;-extldflags \" ;-static \" ;&#39; -o /ova tzf\r\n\r\n FROM scratch\r\n # only copy the one file, may as well put it in /\r\n COPY --from=builder /ova /ova\r\n ENTRYPOINT [ \" ;/ova \" ;]\r\n # if you want to launch it with default options, you can\r\n # CMD [ \" ;-v \" ;]", "927" ], [ "If you launch multiple replicas of the pod in a deployment, the pod IP address will change. If you change the base container and relaunch the pod, the new pod will probably have a different IP address.\r\n\r\nYou claim \" ;the pod will never be deleted \" ; but this is a very strong, and unusual, claim in Kubernetes. The typical way to update an application or the base OS container underneath it is to build a new Docker image and redeploy it, which will result in deleting the pod and its IP address changing.\r\n\r\nYou should in any case create a Kubernetes service referencing the pod. The service will provide a DNS name within the cluster, which will be stable and under your control. From other applications running in the cluster you can reference `servicename.namespacename.svc.cluster.local` as a host name.", "324" ] ]
169
[ 2747, 17008, 18699, 2008, 12036, 14087, 2115, 6149, 17403, 3818, 14932, 14602, 1590, 13286, 3039, 3951, 4815, 484, 11524, 5223, 4091, 13733, 18017, 5424, 2497, 18646, 12280, 10920, 3873, 11145, 9610, 18879, 904, 17997, 3821, 2835, 2262, 7371, 17161, 3560, 10258, 9732, 11812, 18649, 299, 551, 12690, 9320, 343, 1776, 5528, 1137, 2263, 6084, 2099, 702, 3022, 814, 13080, 9411, 2379, 18801, 7943, 12400, 14617, 863, 11910, 16195, 17691, 8639, 4365, 5089, 5777, 16643, 5636, 19211, 557, 17448, 17388, 8410, 7931, 6079, 2265, 17810, 1141, 10282, 15658, 442, 18254, 421, 3151, 10094, 2041, 18895, 11916, 12887, 18594, 1090, 13124, 12670, 19270, 5566, 2375, 9909, 11688, 11316, 1324, 7273, 10065, 19546, 14698, 1072, 2697, 5033, 11025, 5483, 14900, 11493, 16691, 18978, 4699, 2121, 1643, 11482, 13146, 19256, 2853, 14382, 13331, 15482, 1525, 1743, 3504, 1402, 18377, 12386, 11187, 3541, 13288, 14502, 12504, 14027, 2410, 5575, 780, 12336, 14516, 6832, 5627, 15519, 11244, 5752, 17917, 5129, 19740, 0, 19568, 9932, 46, 2705, 12707, 14711, 3134, 1978, 6476, 16193, 19791, 8881, 14722, 15558, 14756, 9702, 1905, 1674, 15551, 11295, 3282, 3929, 2845, 15923, 2920, 19030, 576, 1727, 17953, 6974, 12189, 2769, 17766, 1277, 5154, 8567, 2344, 16469, 6600, 1304, 13701, 15522, 3473, 4344, 7875, 10333, 11631, 14777, 4950, 6136, 8382, 4372, 3107, 4503, 17527, 15142, 17793, 6789, 10890, 6414, 596, 4152, 4216, 16963, 16684, 608, 797, 2701, 17479, 279, 2384, 19500, 3971, 8747, 16495, 5893, 25, 14783, 16912, 2481, 7020, 488, 2127, 18601, 3913, 918, 18557, 13090, 14033, 11690, 8433, 19771, 10355, 17573, 7071, 9439, 18932, 17136, 13484, 5290, 301, 10330, 16373, 2342, 15351, 6396, 4271, 16141, 19084, 10470, 17111, 10444, 7167, 9840, 17996, 1733, 6475, 18109, 13480, 15719, 14658, 11635, 7733, 12253, 2367, 9807, 15344, 3302, 16383, 1258, 5944, 18292, 6150, 14409, 3910, 19614, 3854, 17011, 6763, 725, 3379, 15740, 11356, 9141, 3853, 16382, 3864, 4333, 15898, 3466, 16958, 471, 16600, 7942, 19601, 985, 14785, 16790, 15818, 3970, 9139, 17712, 4057, 2434, 3214, 10314, 5480, 4422, 2310, 14154, 9993, 10373, 6337, 17215, 575, 1873, 3733, 18695, 13766, 4212, 2113, 12315, 18360, 8647, 13760, 12222, 6547, 1390, 258, 18224, 9367, 6551, 18370, 7251, 1737, 4402, 18618, 578, 487, 3780, 19291, 10048, 1807, 16804, 9900, 417, 3360, 18823, 6834, 4163, 10599, 15767, 15033, 4807, 2868, 6171, 16663, 5707, 7778, 3244, 18485, 17458, 16063, 13885, 12194, 5635, 3875, 5947, 12862, 2515, 2675, 7110, 2642, 13178, 613, 17022, 11968, 19145, 9574, 9899, 4466, 13623, 12550, 19766, 8930, 17056, 9654, 13216, 9380, 9425, 16161, 12034, 1811, 2773, 16435, 18167, 6584, 18061, 6940, 9433, 16126, 16977, 8679, 480, 18658, 15953, 9131, 6234, 13574, 4867, 3773, 9645, 8211, 8648, 9851, 14467, 15355, 8034, 10585, 17888, 2227, 10311, 7716, 13093, 4204, 3381, 2742, 14552, 2286, 3621, 1025, 17634, 856, 16934, 16917, 15378, 6276, 611, 498, 12023, 18985, 19285, 2124, 10192, 4667, 9817, 13491, 1145, 8485, 5857, 967, 6913, 1318, 13184, 13819, 12309, 4318, 8774, 17674, 7099, 7254, 831, 17887, 13136, 16456, 11800, 10793, 19170, 4273, 19359, 11228, 7810, 12465, 11125, 2816, 8936, 14582, 15242, 1801, 8810, 7638, 14835, 507 ]
STX_100089.0
[ [ "If it really is a tail call then a while loop or a goto wont look that much different from a recursive call. Just update all variables instead of passing them as parameters. <PERSON> this is the only cross-platform way in C to control stack usage at all optimization levels. It can actually be more readable too since you have one function with initialization followed by the loop, which is pretty idiomatic. The tail recursive version requires two functions, one for initialization and one for the recursive part.", "131" ], [ "Personally I like (i & 0xFF) vs (i % 0x100). In base ten if I said \" ;what are the right two digits of your birth year \" ; you wouldn&#39;t think, \" ;oh, the telephone operator wants to know my birth year modulo 100... \" ; You&#39;d just spit out the digits and forget about it. Why do people think mod is easier to read? Every time I see it I have to check if the variable is signed. It&#39;s not easier to read. Using ( & ) is not premature optimization at all.", "744" ], [ "Naming functions is hard. So whenever you see a block of code with an obvious name then you should give it that name. Separating concerns is hard. So whenever you see two obviously separate concerns you should keep them clearly separate. Reordering operations is hard. So when you see two operations that can obviously be reordered then you should make them easy to reorder. Of course it makes sense to write functions that may only be used once.", "157" ], [ "When one MOSFET is heating up more than the other, it is usually one of two items:\r\n\r\n1. Higher resistance in one leg.\r\n\r\nIt appears that you have included a 0.5ohm resistor in one leg, therefore, most of the current will go the low resistance route - the other leg.\r\n\r\n2. In switching applications, the diode of one MOSFET is being used instead of simply turning it on during that portion of the cycle.\r\n\r\nThe diode has ~0.7V drop at the same current whereas if you simply turned on the MOSFET, this would drop to a much lower value, dissipating less power. This is why there are synchronous power supplies.", "520" ], [ "On the Arduino, the 5V supply is the same as the 12V supply EXCEPT it it shunted through the SMT 5V regulator. This 5V regulator is powering nearly everything on board (when USB isn&#39;t hooked up), and running a motor on it is a bad idea:\r\n\r\n1. Motor voltage transients are placed directly on the same voltage as your microcontroller - brown-outs are the least of your potential issues.\r\n2. The regulator is protecting itself by dropping the voltage and - thus - the current. You are likely hitting the internal current limit of the regulator. You need to provide your own regulator if you want to drive the 5V motor.\r\n\r\nBetter solution: You could also PWM the 12V down to 5V. For motors, PWM works very well for &#39;voltage scaling&#39;. In other words, if you run your 5V motor on 12V and PWM to 42% duty cycle, you have the equivalent of a 5V supply. Your chip has a PWM input, just use that and power both motors from the 12V supply.\r\n\r\nHave fun!", "274" ], [ "<PERSON> is correct (see comments), measuring motor vibration using an accelerometer on the motor body is the only real way to measure vibration directly.\r\n\r\nI disagree that the method of measurement is inaccurate. The peaks that you are seeing are the individual commutations. If you know the motor pole/slots configuration, you can easily use this to determine the actual shaft speed. I have been doing this for years and can attest to the accuracy if you know your motor. Your article is correct.\r\n\r\nYour resistance of 1.5 ohms is very high for a motor. This should probably be on the order of 0.1ohms or less. You are restricting the motor speed/torque by placing this resistor in series with your motor.\r\n\r\nThere are various sources of motor vibration which are always present, but you can only guess as to the relative amplitude if you don&#39;t measure them.\r\n\r\n1. The first is the vibration at fundamental frequency, which is the frequency that you were trying to calculate. This is usually the result of mechanical imbalance in the rotor, just like a wheel imbalanced on your car.\r\n\r\n2. Another source of imbalance is &#39;cogging&#39;. This is caused when the rotor magnets line up with the stator and then continue and is a harmonic of the fundamental rotational frequency. You can feel cogging when you turn the shaft by hand and feel the slight differences in torque applied to your hand.\r\n\r\n3. Commutation method also causes a vibration. Those peaks on your current waveform are actually changing currents, which causes changing torque on your motor at those frequencies. Torque is directly proportional to current, so a current applied at frequency causes a torque ripple, causing vibration.\r\n\r\n4. The bearings are a small contributor to motor vibration and are usually only observed once the other three have been minimized. Ball bearings can sometimes be identified on a Bode plot of the motor vibration by looking at the number of balls in the bearing and multiplying that by the fundamental frequency. Funny things happen with bearings at high speeds, though, so this one is difficult. Probably no need to even look here.\r\n\r\nThere are a couple of other potential sources, but these are dominant. Without actually placing a three-axis accelerometer on the motor case and measuring, you can&#39;t be sure. Once you get the vibration data, you can usually determine the source of the frequency just by looking at its relationship to the fundamental.\r\n\r\n1. If highest vibration is at fundamental, rotor imbalance\r\n2. If the highest vibration is at cogging, you should be able to count the cogs as you rotate by hand, multiply that by the fundamental, and get the frequency of vibe.\r\n2. If the vibration is at the same frequency as the current peaks, then you are seeing a result of a differential torque applied via the commutation method.", "137" ], [ "Here&#39;s my answer, complete with an append operation that uses alloca() for automatic storage.\r\n\r\n #include < stdio.h > \r\n #include < string.h > \r\n #include < alloca.h > \r\n \r\n struct pstr {\r\n unsigned length;\r\n char *cstr;\r\n };\r\n \r\n #define PSTR(x) ((struct pstr){sizeof x - 1, x})\r\n \r\n struct pstr pstr_append (struct pstr out,\r\n const struct pstr a,\r\n const struct pstr b)\r\n {\r\n memcpy(out.cstr, a.cstr, a.length); \r\n memcpy(out.cstr + a.length, b.cstr, b.length + 1); \r\n out.length = a.length + b.length;\r\n return out;\r\n }\r\n \r\n #define PSTR_APPEND(a,b) \\\r\n pstr_append((struct pstr){0, alloca(a.length + b.length + 1)}, a, b)\r\n \r\n int main()\r\n {\r\n struct pstr a = PSTR( \" ;Hello, <PERSON>! \" ;);\r\n struct pstr b = PSTR( \" ;I didn&#39;t C you there. \" ;);\r\n \r\n struct pstr result = PSTR_APPEND(PSTR_APPEND(a, PSTR( \" ; \" ;)), b);\r\n \r\n printf( \" ;\\ \" ;%s\\ \" ; is %d chars long.\\n \" ;, result.cstr, result.length);\r\n return 0;\r\n } \r\n\r\nYou could accomplish the same thing using c strings and strlen. Because both alloca and strlen prefer short strings I think that would make more sense.", "636" ], [ "Or to generalize, preserve the invariants. For each insert operation there should be a corresponding remove operation that preserves the integrity of the data structure. For example, to remove an element in a doubly linked list the two adjacent elements are connected. This wouldn&#39;t be necessary when trashing the whole list, but that&#39;s a special case that lists have. In general, this special case wont exist. Find the remove operation and iterate on that to delete a graph.", "678" ], [ "First off, you should organize your code a bit. Create a function called &#39;setDutyCycle&#39; that takes care of setting the duty cycle. Separate out other functions into their higher-level functionality as well. This will help a lot. Direct register manipulation is fast, but completely incomprehensible after you have written it. This [article](_URL_0_) on direct digital synthesis should help.", "157" ], [ "I&#39;m not very familiar with your code, but you have a line:\r\n\r\n TIM_OCInitStructure.TIM_Pulse = (uint16_t)(Period / 2); // 50%\r\n\r\nThis line is somehow setting your duty cycle. It looks like you are using some library. Within the timer, there is a duty cycle register, I don&#39;t know what it is called, but all timers with PWM modules have them. Find it.\r\n\r\nFloating point version:\r\n\r\n void setDutyCycle(float dutyCyclePercentage){\r\n < duty cycle register > = (unsigned int)( < period register > * dutyCyclePercentage);\r\n }\r\n\r\nFixed point version:\r\n\r\n void setDutyCycle(signed int dutyCyclePercentageFixed){\r\n < duty cycle register > = q15_mul( < period register > ,dutyCyclePercentage);\r\n }\r\n\r\nI like to use libmathq15, which is targeted at 16-bit processors, but it will work just fine on all architectures, just with less advantage.\r\n\r\nYou might also check out _URL_0_", "963" ], [ "You want to read bi-directional current (battery charge/drain), which means that the INA139/169 with a shunt is out.\r\n\r\nBased on the current range, you probably want something in a high range:\r\n_URL_0_\r\n\r\nThere is an alternative breakout board from Sparkfun: _URL_1_\r\n\r\nIt only has a range of 5A, though. You might want to find a friend in the local hackerspace who can layout a board and show you how to solder a higher current part. I have used the ACS711 and ACS712 in the past, they are great - and simple - parts!\r\n\r\nAlso, generally, it is best to sense current on the high side. This is b/c when you place resistance in the return path, all of the circuit &#39;above&#39; the current has a higher resistance path to ground and tends to generate more noise. It is done, no doubt, but on as small a part of the circuit as is possible.", "274" ], [ "Assuming that your BLDC inverter ground is the same as your A/D ground - a pretty safe assumption - then you can greatly simplify your circuit (see below).\r\n\r\nI have used this successfully in BLDC and PMSM sensorless drives for years. The cap is to provide a low-impedance &#39;instantaneous&#39; voltage while still allowing the PWM frequency through. I always simultaneously sample all three A/Ds at a particular time in the PWM cycle to reduce A/D noise. increasing the cap value will increase your filter into your A/D, if you so desire.\r\n\r\nYou will need three of the shown circuits, one for each phase. You don&#39;t need an extra &#39;neutral&#39; circuit if you are working with software. If you add the phase voltages up and divide by 3, you will have your &#39;virtual neutral&#39; value. Or you can take the bus voltage and divide by two and you will often be close enough, depending on the application, motor, PWM method, etc.\r\n\r\n[![enter image description here][1]][1]\r\n\r\n\r\n [1]: _URL_0_", "274" ], [ "The first circuit that you posted for the Vneutral network is simply adding the three voltages together and dividing by 3. It is doing the same thing with resistors. It then adds pull-up resistors to center the voltage into a range that the A/D can read. You can do this addition and division in software. It is cheaper and simpler. If you are looking for a more documented example than some guy on stackexchange, i understand. Take a look at Microchip&#39;s [AN1160](_URL_0_). Look at Figure 5 and Equation 2 in particular.", "760" ], [ "@user6363 Take all three and add them up and divide by 3 - you are emulating the comparator function. This is exactly what the comparator in older analog implementations are doing. And BEMF is generated on all three phases all the time. Just rotate a motor without a drive and you will see BEMF. No, all three simultaneous do not have the same value. The &#39;dormant&#39; phase voltage is either rising or falling. When the dormant phase voltage is equal to the calculated neutral, then an event occurs.", "851" ], [ "Correct. Normally, I would suggest that you drop the lower resistor value to 1.2k, but in this instance, the power losses on the upper resistor are about 122mW, which is getting a bit high. I would bring the upper resistor to 20k and the lower resistor to 2.7k. There are a hundred other combinations that will get you what you need, but as you increase voltage, take into account two things: (1) heat and (2) A/D input impedance. Your cap should make up for a lot, but I would suggest you stay under 50kohm for the upper resistor.", "803" ], [ "No, impedance matching is for transmisison lines. You want a low impedance source and a high impedance sink. Your A/D input impedance could be as low as 10k in some cases, but is generally higher. If you make your external resistances high, you could artificially bring your A/D low since the A/D input impedance could load the resistor network. Generally, you don&#39;t have to worry about it, but stay under the 50k and you should be fine.", "274" ], [ "I tried to define the transpose of a square matrix but I&#39;m hung up on the function&#39;s type signature. I&#39;m trying to generalize from this (which works):\r\n\r\n float (*matrix_transpose (float matrix[4][4]))[4];\r\n\r\nTo this (which doesn&#39;t):\r\n\r\n float (*matrix_transpose (int n, float matrix[n][n]))[n];\r\n\r\nGCC says this:\r\n\r\n error: &#39;n&#39; undeclared here (not in a function)\r\n float (*matrix_transpose (int n, float matrix[n][n]))[n];\r\n ^\r\n\r\nIs there a correct way or write what I want or is it perhaps not possible in the language, or a standards oversight, or a GCC bug?", "877" ], [ "@seininn. I agree with your use for temporaries. I think the ideal construct for this use would be just the first part of the compound literal. Simply (float [n]){} with the empty initializer because all we need is space and auto-initializing a variable length array is probably of limited utility anyway. It conflicts with the gcc {} extension but zero init wouldn&#39;t be a horrible deal either.", "890" ], [ "You are trying to measure energy, of which the Joule is the basic unit.\r\n\r\nThe unit of Power is Watts, which is Joules/s\r\n\r\nVoltage x Current = Instantaneous Power in Watts\r\n\r\nIf you sample the instantaneous power every second, you can simply add up the measurements.\r\n\r\nBattery Capacity in Joules = (V0 * I0 * 1s) + (V1 * I1 * 1s) + ... + (Vx * Ix * 1s)\r\n\r\nFor very low loads (high resistances), you can bring this out to minutes since the battery voltage won&#39;t be changing very fast. For heavy loads (3.9ohms), you probably want to measure at least once every 10s.\r\n\r\nGood luck.\r\n\r\n--- edited to add ---\r\n\r\nYou don&#39;t have to measure current if you have a known resistor since you know the voltage, you can calculate the current at those voltages.", "760" ], [ "I realize that this is an oldie, but it is killing me sitting in the &#39;unanswered&#39; section.\r\n\r\nYes, you can drive the motor into particular positions using hall sensors to get a relatively crude sense of the motor position. Having said that, the style of motor that you have referenced would make a terrible servo.\r\n\r\nMotors are generally tuned to produce more power at a particular speed and torque, which is known as the load point. The magnetics are designed to optimize performance at this load point. Servo applications require low speed and high torque. RC Brushless outrunners like the one that you have shown are generally low torque and high speed (compared to servo motors of the same equivalent output power). You can push a motor outside of its published parameters, but it would be better to simply select the correct motor.", "137" ], [ "As the comment thread states, you can make a guess, but it might be wildly off.\r\n\r\nIf you measure the current that is being pulled in a &#39;typical&#39; use case, then your wattage becomes much less of a variable.\r\n\r\n Watts = Volts * Amps\r\n Watt*hours = Volts * Amp * hours\r\n\r\n Watt-hours in battery = 12V * 50A-hours = 600Wh\r\n\r\nThis assumes that the battery actually stays at 12V (it doesn&#39;t). You can measure the voltage drop as you run the battery down to further remove this variable. Most 12V batteries are nearly out of energy when they are at 12V. Consult your manufacturers data sheet for details and adjust accordingly.\r\n\r\nSo, we have 600Wh of energy in our battery. If we run it at 1200W, then we have 1/2 hour of energy in our battery. If we run it at 600W, then we have 1h of energy in our battery. If we run it at 300W, then 2h ... and so on ...\r\n\r\n W-h / W = hours\r\n\r\nThe precision with which you measure voltage and current - along with the useful life of the battery - will determine how close you get to the real-world value.", "632" ], [ "I have done the &#39;roll-your own&#39; MOSFET driver and it works well enough for frequencies below ~16kHz, but to drive at 1MHz, you will need a MOSFET driver for sure. Fast switching times will be critical and the roll-your-own method will not be adequate.\r\n\r\nThe recommendations that I&#39;m giving are typically used for a half-bridge setup (DC-DC converters, motor drives, etc.), but should lead you down the right paths.\r\n\r\nI have used the [FAN7842MX](_URL_0_) successfully for frequencies up to 60kHz on TO-220 packages (lots of capacitance to overcome). It only has about 300mA of instantaneous gate drive current.\r\n\r\nThe [IR2011](_URL_1_) series would probably be better. It has 1A gate drive current capability.\r\n\r\nI can&#39;t remember the part number, but there are some with higher ability to drive the circuit. At 1MHz, you need a solid gate drive.", "274" ], [ "The MOSFET is like a switch. When your gate voltage is low (0V to ~3.2V in your diagram), it is like the MOSFET isn&#39;t even there. The switch is open. You have a resistive voltage divider in your circuit which is determining the voltage across the MOSFET as well. If you take the MOSFET out of the circuit, you will see the same voltage.\r\n\r\nWhen you are above Vth, the MOSFET starts conducting and shorts out R2. When the component is shorted, there is no voltage across it (well, a very small voltage across it). If you placed a wire in place of the MOSFET, you would see the same thing.\r\n\r\nThe nearly vertical line that you see there is the change of the MOSFET between &#39;off&#39; and &#39;on&#39;. This is the threshold voltage (Vth).\r\n\r\nOverall, the MOSFET works like a switch. Most people either apply 0V to the gate/source or 10V. There are some applications that work near the threshold voltage, but most are using MOSFETS as very fast switches.", "520" ], [ "The current through the &#39;?&#39; that you have highlighted is the same as the current through the base-emitter of the transistor. The base-emitter of the transistor is a diode and that is the characteristic that you are seeing. The base-emitter diode is effectively shorting out your 1k resistor, so determining the current through the base-emitter is difficult. Do some reading about the [diode voltage-vs-current](_URL_1_) to get a better idea of the causes of the curve you are observing.\r\n\r\nA simple current source can be found on [wikipedia](_URL_2_) if that is the type of circuit that you are looking for:\r\n\r\n![wikipedia](_URL_0_)\r\n\r\nIf you are just looking to experiment to see where things go, I would suggest placing a static resistor where you have the pot and moving the pot as a variable resistor between the voltage divider and the gate so that you can more directly alter the current through the transistor.", "520" ], [ "General RC motors require a servo signal update every 20ms. The behavior if this is not maintained is not well defined - and inconsistent - between manufacturers. Change your 2s timer to 20ms and you should be fine.\r\n\r\nGenerally, with the PIC24/dsPIC33 series, you can trigger one timer using the output of another. Use the 20ms timer to trigger the shorter timer in &#39;one-shot&#39; mode (you probably already have it in one-shot mode).\r\n\r\nThe other option is to operate a single PWM timer with a period of 20ms and a very low duty cycle (0.8ms to 2.2ms, as you stated), but you tend to lose resolution using this method.\r\n\r\nThe two-timer method will be reasonably easy to implement from whre you are and you can keep your resolution.", "478" ], [ "Your summary is approximately correct for the [Von Neumann architecture](_URL_0_). The initial code is typically loaded into RAM via a bootloader, but not (typically) a software bootloader that the term commonly refers to. This is normally a &#39;baked into the silicon&#39; behavior. Code execution in this architecture often involves a predictive caching o instructions from the ROM in such a way that the processor maximizes its time executing code and not waiting for code to be loaded to RAM. I have read somewhere that the MSP430 is an example of this architecture.\r\n\r\nIn a [Harvard Architecture](_URL_1_) device, instructions are executed directly from ROM while data memory (RAM) is accessed via a separate bus. In this architecture, the code simply begins executing from the reset vector. The PIC24 and dsPIC33 are examples of this architecture.\r\n\r\nAs for the actual flipping of bits that kicks these processes off, that can vary from device-to-device and can involve debuggers, JTAG, proprietary methods, etc.", "257" ], [ "Your voltage dropped b/c a 9V battery is just a poor voltage source. If you use a few AA batteries or larger in series, your voltage drop will be much less.\r\n\r\nIn motor control - and in many fields - you will want to use [pulse-width modulation (PWM)](_URL_0_). Imagine toggling your switch thousands of times each second. If you pulsed it half the time, then you would have a 50% duty cycle, or half of the effective voltage on the motor.\r\n\r\nPWM is the standard method of controlling voltage and/or current through motors and in DC/DC converters.\r\n\r\nI don&#39;t use Arduino very much, but I believe that it has a PWM on board and analog functions that are actually PWM. I think it operates at ~500Hz. I&#39;m not sure if this is fast enough, but it won&#39;t hurt anything to switch too slowly. Use it to control your MOSFET directly (remove the switch) using the analogWrite function. To implement this, move your MOSFET gate to an analog or other PWM and use the appropriate function to apply PWM.\r\n\r\nIf your PWM frequency is too low, then you will be able to hear the motor responding to it. For instance, if it is 1Hz, then the motor will turn on for half a second, then off for half a second. You will be able to hear that clearly. Increase the PWM frequency until the motor runs smoothly. There are other reasons to change the PWM frequency as well, but in your stage of learning this should be sufficient. Enjoy, motors are fun!", "274" ], [ "Two problems:\r\n\r\n1. The gate threshold voltage (Vth) is 3V-5V and the Arduino can only supply 5V. It is possible that you are only turning the part partially on. If you wish to drive the pin with an Arduino output, your max gate threshold voltage should probably be in the 4V range.\r\n\r\n2. The MOSFET that you have chosen has a nominal 2.2ohm resistance, which is pretty high for driving a motor. The motor link that you posted is actually for two models of motor, one that operates at 5.2A is the low voltage variant. If this is truly drawing 5.2A (I suspect that it isn&#39;t, but it is all of the info I have) AND the MOSFET were turned fully on, you would have\r\n\r\nP < sub > dissipated < /sub > = 5.2A * 5.2A * 2.2 & Omega; = 59.5Watts\r\n\r\nIf you have the other variant and your motor is drawing 1.32A, the power dissipated on the switch is still high for a plastic-tabbed FET:\r\n\r\nP < sub > dissipated < /sub > = 1.32A * 1.32A * 2.2 & Omega; = 3.8W\r\n\r\nYour power dissipated on your switch is very high.\r\n\r\nDo this:\r\n\r\n1. Hook up your motor to your power supply without the MOSFET and measure the current\r\n2. If your current is too high for this MOSFET, pick a MOSFET with a lower on-resistance and (preferably) lower threshold voltage\r\n\r\nIf you have to choose another MOSFET, choose a metal-tabbed MOSFET so that you can add a heatsink if necessary. Plastic tabs are great, but not for prototyping. Ideally, you want to dissipate as little power on the MOSFET as possible. Anything with an on resistance of 0.1ohms and a gate threshold voltage of less than 4V should work quite well.\r\n\r\nTo explain your symptoms, as the MOSFET heats up, the part actually becomes slightly more efficient. If you look at the operating curves vs. temperature, you generally get some small benefit... right up until failure. This is why the motor starts to speed up as your MOSFET gets warmer. Less voltage is dropped on the MOSFET compared to the motor.", "274" ], [ "This comment was true when posted. But now C++14 can return auto as in \" ;auto f () { return 42; } \" ;. decltype and auto should be enough. Figuring out when to free() isn&#39;t just a syntax issue. Coffeescript++ would probably provide syntax for smart pointers and value semantics. I imagine a list comprehension would become a vector value and its destruction would be managed the same as in C++. Coffeescript++ need only implement the logic of the std smart pointers to do this.", "711" ], [ "Something like this?\r\n\r\n case &#39;A&#39;..&#39;Z&#39; where a not in [&#39;I&#39;,&#39;L&#39;,&#39;O&#39;]:\r\n\r\nUnfortunately no compiler I know of implements that particular extension, though GCC has can do ranges as other answers pointed out. For portability you can cut and paste this DWTFYW licensed snippet. If you&#39;re using a custom enum you might resort to code generation to make something similar.\r\n\r\n #define CASE_NUMBER \\\r\n case&#39;0&#39;:case&#39;1&#39;:case&#39;2&#39;:case&#39;3&#39;:case&#39;4&#39;:\\\r\n case&#39;5&#39;:case&#39;6&#39;:case&#39;7&#39;:case&#39;8&#39;:case&#39;9&#39;\r\n #define CASE_ALPHA_LOWER \\\r\n case&#39;a&#39;:case&#39;b&#39;:case&#39;c&#39;:case&#39;d&#39;:\\\r\n case&#39;e&#39;:case&#39;f&#39;:case&#39;g&#39;:case&#39;h&#39;:\\\r\n case&#39;i&#39;:case&#39;j&#39;:case&#39;k&#39;:case&#39;l&#39;:\\\r\n case&#39;m&#39;:case&#39;n&#39;:case&#39;o&#39;:case&#39;p&#39;:\\\r\n case&#39;q&#39;:case&#39;r&#39;:case&#39;s&#39;:case&#39;t&#39;:\\\r\n case&#39;u&#39;:case&#39;v&#39;:case&#39;w&#39;:case&#39;x&#39;:\\\r\n case&#39;y&#39;:case&#39;z&#39;\r\n #define CASE_ALPHA_UPPER \\\r\n case&#39;A&#39;:case&#39;B&#39;:case&#39;C&#39;:case&#39;D&#39;:\\\r\n case&#39;E&#39;:case&#39;F&#39;:case&#39;G&#39;:case&#39;H&#39;:\\\r\n case&#39;I&#39;:case&#39;J&#39;:case&#39;K&#39;:case&#39;L&#39;:\\\r\n case&#39;M&#39;:case&#39;N&#39;:case&#39;O&#39;:case&#39;P&#39;:\\\r\n case&#39;Q&#39;:case&#39;R&#39;:case&#39;S&#39;:case&#39;T&#39;:\\\r\n case&#39;U&#39;:case&#39;V&#39;:case&#39;W&#39;:case&#39;X&#39;:\\\r\n case&#39;Y&#39;:case&#39;Z&#39;\r\n #define CASE_ALPHA CASE_ALPHA_UPPER:CASE_ALPHA_LOWER\r\n #define CASE_ALPHANUM CASE_ALPHA:CASE_NUMBER\r\n\r\n\r\nIf you access to GHCI such as the online version at _URL_0_ you might just generate what you need and paste that into a header e.g.\r\n\r\n foldl (++) \" ; \" ; [ \" ;case \" ; ++ show x ++ \" ;: \" ; | x < - [&#39;A&#39;..&#39;Z&#39;], not $ x `elem` [&#39;I&#39;,&#39;L&#39;,&#39;O&#39;]]", "529" ], [ "If you place the external magnet(s) on in a way that reinforces the motor&#39;s own magnets, you will boost the magnetic field which will boost the peak torque output of the motor.\r\n\r\nIf you place the external magnet on in a way that cancels out the motor&#39;s own magnets, you will weaken the field.\r\n\r\nIn DC motors, stronger magnetic fields will tend to generate more torque, all other things equal. For low-speed applications, you can get more torque. For a go kart, this is probably where you would be operating.\r\n\r\nIn truth, you are adding to the field, but significantly influencing the motor characteristics using an external magnet would take a very strong magnet since you are so far from the rotor. Motors are designed with the rotor very close to the magnet b/c the magnetic force weakens as a function of distance squared. You would be better off simply increasing the voltage to get more performance out. Mind the motor temperature.", "137" ], [ "Stall current probably does not do what you think it does b/c most fans are stall protected. This means that they limit current when the motor is stalled and won&#39;t actually apply the full current.\r\n\r\nThe upper limit on overvolting depends almost entirely on the components selected and the architecture of the circuit. If you have 20V MOSFETs, they will probably function reasonably well at 15V (although that is too close for comfort for me). If you don&#39;t know, then I wouldn&#39;t go any further.\r\n\r\nDepending on the architecture, there may also be a linear voltage regulator involved. If this is the case, then you would be placing a higher thermal load on the regulator and coming closer to failure here as well.", "803" ], [ "You are correct, even a PID loop can only apply 100% duty cycle, so maximum speed transient response is not improved.\r\n\r\nThe difference is if you wanted to go at 0.75 of maximum speed, then the PID loop will apply more power at the beginning than the 0.75 duty cycle and then lower down to the appropriate duty cycle as the error gets closer to 0. In this way, the transient response is improved.\r\n\r\nEdited to add:\r\nAlso, after reading your question again, you can only use a PID loop when you are controlling motor voltage using PWM or some other method of controlling the voltage/current to regulate speed/current/power.", "137" ], [ "PID loops are - at once - amazingly simple and amazingly complex. The best way (my opinion) to learn about them is with a motor because you get real physical feedback during tuning and you can really learn how each term works. I really like [this article](_URL_0_) as it goes through PID concepts and how to write a loop yourself. I wish I had access to the article when I wrote my first PID loop. The author is spot on with the &#39;gotchas&#39;!", "137" ], [ "I suspect that the below circuit will do the trick. You have a current sensor (I like the [INA139](_URL_0_)) which senses the motor current and outputs a current directly proportional to the motor current, peaks and all.\r\n\r\nThe diode doesn&#39;t allow the output voltage to be reversed, so the capacitor holds a charge that is proportional to the peak. R1 acts as a slow &#39;bleed&#39; resistor.\r\n\r\nThe comparator circuit does the comparison for you, with a little hysteresis.\r\n\r\nYou may have to adjust some resistance and capacitance values, but this should get you close.\r\n\r\nAlso, if you are interested, I have a breadboard current sensor laid out already and [somewhat documented](_URL_2_). It is open-source, so all of the information is there.\r\n\r\n[![schematic][1]][1]\r\n\r\n\r\n [1]: _URL_1_", "274" ], [ "The commenters are correct, you should do a few things:\r\n\r\n1. Implement [fixed-point math](_URL_1_). There are several ways to do this, but performing float operations on an MSP430 within an interrupt is amongst the highest sins of microcontroller coding.\r\n\r\n2. Use some sort of [task manager](_URL_3_) for your low-frequency. This way, the low-frequency timer is interruptable.\r\n\r\n3. Use some sort of [low-RAM and fast averaging technique](_URL_0_) for your low frequency filter.\r\n\r\nI placed three links in there b/c I have already solved a majority of this, most of which I have examples for in [github](_URL_2_) (and on the MSP430 in some cases).\r\n\r\nFeel free to contact me via other means if you have any questions. The task manager in particular will help you since it means that you will only need one interrupt. It is very reliable and reasonably easy to use, but you have to trim the fat from your code (remove float operations) or the tasks may still block each other.", "478" ], [ "The opamp is trying to invert your signal, meaning that it will try to change the sign. If your resistors are the same value, then you have\r\n\r\n gain = -R/R = -1\r\n\r\nIf you put 2.5V into the input of the circuit, then your opamp is trying to \r\n\r\n Voutput = gain * Vinput\r\n Voutput = -1 * 2.5V\r\n Voutput = -2.5V\r\n\r\nSince the opamp cannot go to -2.5, it gets as close as it can at 0.75V, saturating there. The same is true for your entire range of 0V to 5V. The circuit will try to drive the output from 0V to -5V, but will only go as low as it can until saturation.\r\n\r\nBased on your comments, I suspect that you are trying to implement:\r\n\r\n Vout = 5V - Vin\r\n\r\nIn this case, you want to implement a [differential amplifier](_URL_0_) with one end tied to +5V and with the gain of 1.", "207" ], [ "I usually gravitate to the &#39;unanswered&#39; section, but I find that there are always some old questions laying around that no one is ever going to answer. Some of these are a couple of weeks old, some are much older.\r\n\r\nFor instance, it was stated in the comments that [this question](_URL_0_) was basically never going to get answered, but it is at the top of the &#39;unanswered section. I&#39;m sure that I&#39;m not the only one, the question has a lot of views for such an old and long post that no one has answered.\r\n\r\nIs this the proper venue to propose an expiration or some other solution? I have tried to wade through this section to find things that I can knock off the list, but I tire of reading the same old threads.", "936" ], [ "Think of (char *) as string.begin(). The essential difference is that (char *) is an iterator and std<IP_ADDRESS>string is a container. If you stick to basic strings a (char *) will give you what std<IP_ADDRESS>string<IP_ADDRESS>iterator does. You could use (char *) when you want the benefit of an iterator and also compatibility with C, but that&#39;s the exception and not the rule. As always, be careful of iterator invalidation. When people say (char *) isn&#39;t safe this is what they mean. It&#39;s as safe as any other C++ iterator.", "161" ], [ "No problem. You happened to catch me already having similar thoughts, so I was happy to share. I thought that I was responding to you in my previous comment, but I see that I was answering <PERSON>. His solution would work just as well if you have a differential input A/D card. My solution just takes that to a digital. After looking at it again, you may want to make one of the voltage divider resistors a potentiometer so you can easily adjust it.", "274" ], [ "I agree that there is no reason to close a question b/c it has gone unanswered. I do believe that a question that has been abandoned by the asker and has no answers in the last few months should at least be sorted down so that it isn&#39;t at the top of multiple sorts for months. It is no big deal for one question, but as questions like this pile up, it becomes more difficult for us that want to answer questions to identify the questions to answer.", "1018" ], [ "The answer provided is somewhat correct, but doesn&#39;t make clear that the power delivered to the load is continually varying.\r\n\r\nTake this circuit:\r\n\r\n[![enter image description here][1]][1]\r\n\r\n\r\nV1 is a pulsed waveform going between 0V and 12V, so C1 is charged to nearly 12V. The resulting waveforms when V1 goes to 0V:\r\n\r\n[![enter image description here][2]][2]\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_\r\n\r\nNotice that the voltage starts at 11A and at 120W, but quickly drops down to nearly 0A/0W within that one second. If you took the average power over the 3s time period, you probably wouldn&#39;t even be at 10W. When you are talking about capacitors and current, you are nearly always talking about averages (or RMS values) on a periodic waveform. Rarely are you talking about the peak power.\r\n\r\nYour numbers:\r\n\r\n > Based on I=C(dV/dT)\r\n > \r\n > C = 0.5 Farad. dV = 5 VDC. dT = 1 second.\r\n > \r\n > Then I = 2.5 amps\r\n\r\nThis is only true for an instant and is never true again until the capacitor is recharged.", "803" ], [ "The question has nothing about current draw or switch speed, but given that the current draw isn&#39;t high and the switching event is reasonably fast, you could simply place a large-value capacitor between the load and the switch.\r\n\r\nThe capacitor would supply voltage for a small amount of time, that time being proportional to the current that you were drawing. If you know the current draw, you could even do a 5 minute SPICE simulation to find the &#39;ideal&#39; capacitor value.", "274" ] ]
380
[ 1089, 5276, 6915, 2362, 12488, 8884, 774, 12003, 19235, 8868, 12973, 749, 16350, 5222, 15313, 8144, 5262, 8792, 19445, 16053, 5857, 9852, 6059, 17130, 5178, 513, 11061, 4649, 16526, 16991, 19693, 9277, 2821, 5058, 14824, 4098, 17126, 7810, 2862, 19401, 3178, 11575, 1044, 7543, 2748, 13059, 7828, 2626, 3611, 24, 11354, 17930, 15904, 17486, 1390, 8648, 1714, 18627, 17811, 377, 1922, 13362, 10718, 19140, 3151, 14963, 2338, 19067, 3528, 18086, 9693, 7510, 1937, 3071, 5361, 16175, 5947, 8013, 7621, 821, 12896, 4976, 4682, 1232, 18040, 2401, 17576, 19270, 16845, 13795, 345, 1297, 15068, 14357, 19509, 9337, 2173, 2342, 18002, 140, 8563, 3792, 2148, 4602, 5451, 16282, 17990, 18485, 10490, 19148, 15623, 3834, 16220, 10696, 4311, 16252, 8936, 12192, 711, 10108, 19216, 635, 1088, 16882, 13882, 13001, 6734, 4588, 2402, 15537, 15232, 11095, 11381, 7679, 6057, 4036, 13281, 12308, 5502, 19418, 10031, 14884, 4754, 7522, 18557, 3913, 753, 1120, 19239, 11695, 17573, 17275, 2155, 3942, 2263, 828, 11858, 12092, 10155, 5458, 9938, 15923, 1324, 3916, 12030, 6045, 14722, 10768, 4431, 8159, 11187, 9569, 16824, 3371, 19637, 10, 301, 17463, 18254, 9169, 8328, 15340, 13445, 3780, 11063, 10529, 9380, 19481, 16944, 3963, 11230, 10721, 3596, 15038, 15477, 11568, 15408, 17712, 2415, 12523, 11125, 10703, 12843, 15107, 11219, 18886, 15956, 14033, 17480, 10348, 8055, 14163, 8355, 1534, 16617, 18776, 8498, 2060, 405, 4333, 1674, 6087, 10420, 13146, 15302, 1230, 11864, 10330, 499, 16909, 15482, 18830, 14083, 8062, 597, 14414, 19477, 4061, 2379, 5995, 14818, 6414, 17997, 1696, 3576, 17897, 921, 11145, 16114, 4484, 3336, 8965, 15119, 14785, 5411, 1962, 4131, 5068, 5777, 18689, 13439, 16118, 18319, 15378, 2024, 13672, 11008, 13561, 7760, 15700, 18915, 10282, 9984, 15897, 18576, 627, 1402, 18879, 10733, 5996, 14761, 12036, 11344, 11968, 10577, 4961, 1506, 2764, 19131, 9702, 18508, 9936, 2114, 7875, 8668, 6812, 5290, 9974, 3426, 10444, 19547, 14622, 19403, 18046, 2240, 17307, 8704, 18199, 1751, 17635, 4807, 2286, 19265, 3514, 8910, 19192, 19024, 10398, 11280, 17330, 14900, 19260, 18865, 8070, 5154, 19642, 1632, 19416, 3764, 9888, 950, 19479, 18646, 9603, 18171, 491, 5401, 299, 11285, 5357, 1786, 9449, 17766, 440, 11720, 17110, 18352, 17571, 6083, 18328, 11426, 3560, 12854, 15886, 12856, 2229, 7139, 18922, 1930, 2067, 8391, 13696, 1023, 16834, 4163, 19653, 2129, 1350, 7220, 16503, 664, 9909, 9450, 14777, 11907, 1919, 9106, 17688, 2288, 13457, 1788, 5306, 7748, 330, 13244, 126, 6580, 14975, 5421, 14550, 18734, 9613, 7147, 18855, 10562, 10956, 15585, 10397, 4491, 5528, 13806, 13080, 15980, 6367, 7090, 5424, 12351, 10364, 17096, 9180, 3199, 2686, 4344, 18469, 19769, 5185, 18573, 1453, 1393, 12796, 8647, 1268, 8160, 6853, 10911, 12733, 9541, 5683, 3201, 16435, 13090, 2947, 19044, 19392, 6100, 1560, 11484, 5406, 13925, 11706, 16542, 6763, 13570, 9538, 13275, 9741, 17177, 851, 13136, 1571, 17490, 9469, 9962, 18360, 2113, 3301, 13428, 6930, 7403, 9321, 13036, 215, 9654, 15767, 9458, 18740, 16040, 1039, 11629, 2332, 18476, 9591, 0, 5236, 2759, 13635, 6248, 620, 10048, 7629, 7130, 676, 17549, 15529, 12020, 16161, 3217, 11221, 2405, 19554, 16804, 8309, 2740, 7995, 10376, 12898, 3107, 6452, 716 ]
STX_10011729.0
[ [ "I have a HMI device which I read coils from and based on the coils I send a data to the arduino, to have a multi thread program, I decided to use twisted. Here is my code:\r\n\r\n\r\n from twisted.internet import task\r\n from twisted.internet import reactor\r\n import serial\r\n \r\n ModbusMaster.ConnectToSlave(&#39;COM28&#39;,9600,8,&#39;E&#39;,1)\r\n Arduino = serial.Serial(&#39;COM35&#39;, 115200, timeout=0)\r\n \r\n def HMICheck():\r\n RegVal = ModbusMaster.Slave_READ_COILS(1,0,5)\r\n ArduinoString =(&#39;@&#39;+str(RegVal[0])+str(RegVal[1])+str(RegVal[2])+str(RegVal[3])).encode(&#39;utf-8&#39;)\r\n Arduino.write(ArduinoString + b&#39;\\n&#39;)\r\n HMIReader = task.LoopingCall(HMICheck)\r\n HMIReader.start(0.01)\r\n reactor.run()\r\n\r\nIt works fine when I use 1 second for HMIReader.start, I mean when I use HMIReader.start(1), but changing it to lower than .8, it won&#39;t work. 1 second is too low for me. I also tried to use a while loop instead of twisted library but I got the same result. It seems the problem is that arduino don&#39;t receive the data very well. Any help?", "963" ], [ "The Arduino code is too long but I have written it with timer and interrupt so it&#39;s multi process. Besides when I use the Arduino serial monitor itself, it works fine. Actually it&#39;s almost a year that it&#39;s working fine for me but my program has been written in Qt and there were no Modbus. I think somehow the Python can&#39;t send the data right. How can I check the python output to arduino?", "322" ], [ "I have a `modelform` with a `FileField`, so I just add some files with some descriptions for my database. It adds a file in the location I have defined in `MEDIA_ROOT` and adds a PK for each item. For example consider that I add 5 objects with 5 files.\r\n\r\nMy problem is that when I delete all 5 objects, from shell or admin, the corresponding files and PKs won&#39;t be deleted, And when I add another object, the PK starts from 6. How can I completely delete an object with its corresponding file and PK and sort the others, for example if I delete the 3rd object, I want that the 4th and 5th objects, became 3rd and 4th.", "721" ], [ "Ok I made it to work, from what <PERSON> said, I tried the print request.body so first I stringified it to have a { \" ;name \" ;: \" ;SomeOne \" ;} format and then in my view function I decoded it, here&#39;s my code:\r\nThis is the html:\r\n\r\n function DeleteJobFile(name) {\r\n var obj = {&#39;FileName&#39;:name};\r\n var myJSON = JSON.stringify(obj);\r\n $.ajax({\r\n type: &#39;POST&#39;,\r\n url: &#39;DeleteJobFile/&#39;,\r\n \r\n {# data: name#}\r\n data:myJSON,\r\n contentType: &#39;application/json;charset=UTF-8&#39;,\r\n async: false,\r\n dataType: &#39;json&#39;,\r\n success: function (response) {\r\n document.location.reload(true);\r\n alert( \" ;The text has been changed. \" ; + name);\r\n }\r\n });\r\n }\r\n\r\nThis is the view:\r\n\r\n def DeleteJobFile(request):\r\n if request.is_ajax():\r\n body_unicode = request.body.decode(&#39;utf-8&#39;)\r\n body = json.loads(body_unicode)\r\n name = body[&#39;FileName&#39;] \r\n print(name)\r\n else:\r\n print(&#39;no&#39;)\r\n return render(request, &#39;JobApp/JobApp.html&#39;, {&#39;FileList&#39;: FileList})\r\nIf there&#39;s any simpler way please inform me.\r\nOne more thing is to deal with the CSRF thing, I had to add a @csrf_exempt before my def func... at _URL_1_, django won&#39;t accept when I add csrfmiddlewaretoken: &#39;{{ csrf_token }}&#39; to my data, how can I use it? \r\nBesides I still have the problem to call file_name.id, actually I want to have access to the n-th element from the myfile list, where n is also an input to html from _URL_0_.", "912" ], [ "I want to send a buffer to an HID, I have trouble making the buffer, here&#39;s my code:\r\n\r\n buffer = [0x00]*20\r\n print(buffer)\r\n buffer[0:10] = {0x00,0x00,0x11,0x06,0x00,0x04,0x1A,0x00,0x00,0x0b,0xb8}\r\n print(buffer)\r\n\r\nthe output is:\r\n\r\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\r\n [0, 4, 6, 11, 17, 184, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\r\n\r\nbut when I use this:\r\n\r\n buffer[0] = 0x00\r\n buffer[1] = 0x00\r\n buffer[2] = 0x11\r\n buffer[3] = 0x06\r\n buffer[4] = 0x00\r\n buffer[5] = 0x04\r\n buffer[6] = 0x1A\r\n buffer[7] = 0x00\r\n buffer[8] = 0x00\r\n buffer[9] = 0x0b\r\n buffer[10] = 0xb8\r\n\r\nThe output is:\r\n [0, 0, 17, 6, 0, 4, 26, 0, 0, 11, 184, 0, 0, 0, 0, 0, 0, 0, 0, 0]\r\n\r\nI also should convert from decimal to hex, for example 1000 to hex.\r\n\r\n print(hex(1000))\r\nIt gives:\r\n\r\n 0x3e8\r\nI want to have :\r\n\r\n 03 E8\r\nHow can I have it?", "671" ], [ "I have written a project in windows with Django, It works well in windows, I wanted to transfer it to Ubuntu, first I installed the python3 and then made a virtualenv,\r\nactivated it and installed django and required packages, I got some errors but the main irritating one is that, I have a INI file, I use the configobj to read it, it works well in windows but in Ubuntu it give &#39;Key error&#39; here is my code:\r\n\r\n from configobj import ConfigObj\r\n ConfigPath = os.path.join(settings.MEDIA_ROOT, &#39;Vars.ini&#39;)\r\n ConfigParser = ConfigObj(ConfigPath)\r\n print(ConfigParser[&#39;FileNames&#39;][&#39;MotionName&#39;])\r\n\r\nand here is the file:\r\n\r\n [FileNames]\r\n MotionName = test1\r\n\r\nI also tried to use only lowercase words but still no chance.", "206" ], [ "Mostly this will occur in 2 situations:\r\n1- You have assigned a wrong port which maybe another device, you can check it through your device manager.\r\n2- You have opened it previously with another software or maybe your previous run of code is still using it and you haven&#39;t terminate it.\r\nI see in your code you have first listed all your com ports but you don&#39;t benefit from it, it seems redundant.\r\nI recommend you delete all lines in your try part of your code and just leave the openport line and do it for other lines to see which line gives the exception.", "56" ], [ "I&#39;ve made a .bat file besides my _URL_0_ file with this code:\r\n\r\n title CeleryTask\r\n <IP_ADDRESS>See the title at the top.\r\n cd \r\n cmd /k celery -A MainProject worker -l info\r\n\r\nso each time I want to run celery, I just double-click this batch file and it runs perfectly.\r\nAnd the fact that you can&#39;t use celery 4 on windows is true.", "742" ], [ "I have written a simple code with python and pygame to display some images at my monitor. When I run it, everything works fine. i tried to make it run at system startup with systemd services. here is my service:\r\n\r\n [Unit]\r\n Description=Starts pygame\r\n \r\n [Service]\r\n User=rplab\r\n WorkingDirectory=/home/myuser/\r\n ExecStart=/bin/bash /home/myuser/_URL_0_\r\n KillMode=process\r\n \r\n [Install]\r\n WantedBy=multi-user.target \r\nWhen the system boots, it will start the service but unfortunately when I checked the service with systemd status, it gives this error:\r\n\r\n pygame.error: No available video device\r\nit seems as if it starts too soon that can&#39;t find my monitor, is it possible that I make the service start after the user logs in so that it can find my monitor?", "691" ] ]
208
[ 14509, 12570, 14034, 16588, 17957, 14555, 17872, 12105, 11627, 14894, 19557, 12613, 19472, 11022, 13276, 14311, 32, 11019, 14645, 72, 19245, 12016, 10367, 8097, 17077, 14296, 10765, 14870, 6197, 15020, 15077, 13678, 16873, 37, 6516, 19102, 5280, 17605, 14499, 14377, 4793, 19784, 15297, 12155, 18785, 14623, 3868, 15828, 14926, 12600, 14178, 12205, 19675, 13092, 17962, 594, 6842, 11483, 17172, 14842, 12672, 7930, 11730, 10080, 14737, 8637, 18070, 12882, 13740, 391, 5304, 13767, 13454, 13385, 9088, 16854, 14607, 6911, 15575, 14182, 13144, 18277, 14969, 10593, 12240, 47, 9634, 8189, 12956, 19700, 14063, 86, 4948, 15328, 16797, 15429, 9863, 17021, 6613, 16331, 15490, 17978, 19726, 14780, 4622, 14862, 15455, 16768, 14906, 7839, 16597, 6407, 15810, 7447, 12846, 4853, 15955, 17943, 11612, 4993, 14590, 10050, 19000, 11942, 11305, 17669, 14012, 11684, 17407, 12348, 9640, 17602, 2875, 580, 527, 404, 17457, 11239, 11709, 7315, 7701, 11331, 8100, 14422, 6988, 2216, 15032, 8535, 15113, 15386, 2015, 11149, 3498, 18087, 15102, 19691, 19666, 17548, 12868, 8420, 7967, 16009, 11993, 13313, 2309, 15067, 16105, 12948, 16808, 18149, 4923, 19644, 12946, 2013, 8880, 9759, 11449, 1363, 18894, 17763, 11851, 10580, 8286, 1473, 15451, 19574, 2906, 18511, 18035, 8492, 18494, 17873, 6681, 2236, 196, 19722, 10702, 14593, 13296, 14816, 6451, 240, 15143, 19638, 4320, 14650, 18104, 12947, 7171, 17187, 7169, 13330, 8277, 16521, 17711, 15882, 18290, 10389, 2531, 3882, 3866, 10676, 10025, 19510, 13388, 19602, 15760, 17439, 16070, 10180, 15670, 11509, 5383, 10286, 19327, 16519, 7610, 17380, 248, 16564, 12958, 18693, 12732, 17399, 727, 15373, 12397, 11304, 12515, 9330, 16298, 16242, 18426, 6641, 12507, 6691, 14456, 7783, 9072, 5381, 9466, 19397, 11594, 14881, 10278, 6283, 15353, 15323, 17629, 15775, 4251, 3188, 19523, 15320, 4520, 13955, 9436, 17721, 2276, 5281, 6266, 18790, 1451, 16625, 3440, 2933, 11547, 16670, 13300, 4957, 1575, 13228, 13714, 17233, 15199, 8795, 12740, 9788, 9356, 674, 9827, 11959, 7923, 15198, 16512, 3763, 19694, 17685, 8339, 10528, 7307, 13243, 10625, 6491, 6518, 1578, 11714, 370, 12088, 18071, 14564, 13145, 3045, 14251, 6130, 10797, 5679, 4104, 15988, 10952, 3969, 10896, 19543, 99, 12657, 14120, 15254, 15144, 9064, 17052, 13688, 6522, 11001, 11337, 10487, 15238, 8260, 6064, 18291, 11382, 9968, 7644, 19575, 14911, 16876, 1433, 10461, 44, 63, 18179, 16527, 10808, 18795, 15220, 19454, 9289, 18815, 4599, 15620, 12824, 15594, 14765, 13356, 214, 19225, 19451, 6887, 873, 15825, 13007, 14321, 9618, 14041, 15436, 13749, 7457, 10777, 8985, 6244, 19007, 19773, 4002, 10630, 605, 8576, 15507, 13105, 17874, 12905, 15777, 15428, 3486, 15034, 17254, 17947, 13698, 2020, 13376, 7036, 11873, 11791, 5553, 15599, 13890, 10867, 9483, 7496, 10796, 14042, 14489, 19790, 16787, 9341, 13137, 5029, 5868, 14858, 15629, 8165, 15718, 6118, 17157, 13934, 10634, 14036, 6817, 4349, 19433, 11616, 236, 4725, 9494, 16652, 4587, 10305, 17127, 280, 666, 16624, 14575, 13770, 19690, 14864, 13053, 10706, 5989, 7368, 16611, 2638, 11814, 2494, 17175, 13879, 19128, 4460, 10299, 16832, 8664, 16076, 13042, 16455, 19207, 13141, 4298, 17178, 3754, 7106, 15286, 15815, 12588, 10197, 18682, 9402, 14346, 11645, 19757, 11846, 16419, 17755, 15669, 16369, 16403, 11027, 15659, 14475, 6308, 19095, 7272, 7311 ]
STX_10011833.0
[ [ "The problem is twofold:\r\n\r\n 1. You are not sending a body with your request (the xmlhttp.send() has not arguments). See here for usage, and pay attention to the POST example: _URL_0_\r\n 2. Your server is returning a 200 when it doesn&#39;t have all of the parameters it needs. It would probably be beneficial to have it validate that all the parameters it needs are provided, and return 422 (Unprocessable Entity) or some other relevant code if it doesn&#39;t have enough information to process the request.\r\n\r\nWhen you call this.submit(), it is actually submitting the form (which will contain the parameters). In order to send the ajax request, you will need to basically take the values from the form, construct a body your server will accept, and then send it.", "526" ], [ "I&#39;m not too familiar with Flask, but most template languages will treat interpolated input as unsafe, and will escape any text you give it. If you want to avoid escaping your input, check out _URL_0_\r\n\r\nAccording to that page, there are a few options:\r\n\r\n1. In the Python code, wrap the HTML string in a Markup object before passing it to the template. This is in general the recommended way.\r\n2. Inside the template, use the |safe filter to explicitly mark a string as safe HTML ({{ myvariable|safe }})\r\n3. Temporarily disable the autoescape system altogether.\r\n\r\nTo disable the autoescape system in templates, you can use the {% autoescape %} block:\r\n\r\n {% autoescape false %}\r\n < p > autoescaping is disabled here\r\n < p > {{ will_not_be_escaped }}\r\n {% endautoescape %}\r\n\r\nThe other related issue is that I assume when you say you have multil-ine input, it is using newlines. Those have no meaning in HTML, so you won&#39;t see linebreaks in your output. You would need to replace newlines with & lt;br & gt; tags to actually get them. That, in combination with marking the strings as \" ;safe \" ; should get you the results you&#39;re looking for. Keep in mind that you will want to sanitize the input ahead of time, then replace the newlines with & lt;br & gt; tags.", "470" ], [ "One way to test would be to baseline how long the call should take, and how long it takes Promise.all to complete. If tasks are executed serially, and each call takes ~1 second, a list of 5 elements it should take ~5 seconds to complete. However, if they are running in parallel, they should take closer to ~1 second (although probably slightly higher due to inherent overhead). Basically, you are checking to see if it completes as quickly as the longest task, or if it completes after the sum of time it takes to complete all tasks.", "199" ], [ "Sorry I wasn&#39;t clearer, when I say everything is expected to be EPSG:4326, I meant that I had the map configured to use that, and the actual data I am rendering uses that (my code here is intended to convert those to pixels for rendering). I tried your code for calculating x and, and ran into 2 issues. 1) It seems to require a center latlng to be passed in (I used this._map.getCenter()). Without it, I get latlng is undefined while it tries to project it within that method. 2) When I pass the map center, the rendered data is all over the place and not where I expect it, with most tiles blank.", "616" ], [ "First, note the difference between `as_json` and `to_json`. `as_json` returns a hash, which then is getting stringified. `to_json` will actually create a JSON string. See this question for more details and references: _URL_0_\r\n\r\nI&#39;d recommend updating your `ScheduledRequest` model to have an `as_json` method that effectively does what is within the `each` of your update (returning a hash representation of a single `ScheduledRequest`. Then, in your view, you can\r\n\r\n```\r\nvar taken = < %= @taken.to_json.html_safe % > \r\n```\r\n\r\nThe `to_json` will return a JSON array, and the `html_safe` will ensure it doens&#39;t get html encoded (which is what you&#39;re seeing above). Pulling the logic for how to represent individual `ScheduledRequest` objects ensures that the class is responsible for determining how to represent itself as JSON, vs. making that a view concern. Note that, as you have it, you are making your `@taken` variable accessible in javascript as `taken` via the assignment above.", "8" ], [ "There is no set number of instructions that get processed before checking the event queue. Each message is run to completion. From the Mozilla documentation (_URL_0_): \r\n\r\n > Each message is processed completely before any other message is processed. This offers some nice properties when reasoning about your program, including the fact that whenever a function runs, it cannot be pre-empted and will run entirely before any other code runs (and can modify data the function manipulates). This differs from C, for instance, where if a function runs in a thread, it may be stopped at any point by the runtime system to run some other code in another thread.\r\n\r\n > A downside of this model is that if a message takes too long to complete, the web application is unable to process user interactions like click or scroll. The browser mitigates this with the \" ;a script is taking too long to run \" ; dialog. A good practice to follow is to make message processing short and if possible cut down one message into several messages.", "246" ], [ "I&#39;m not sure what you mean by sub-messages, but each message does constitute one tick. Messages are added to the queue, and thus are processed in FIFO order. If one message results in more messages being processed, then they will execute after all other messages already in the queue have been processed. I&#39;d recommend reading through the link I provided, I believe it answers your question in greater detail (particularly in the Queue and Event Loop sections).", "527" ], [ "As you already stated, you lose some of the advantages of pure functions. In this particular case, you run the risk of late subscribers getting different streams of data than you may expect (depends on what you are doing in your real case vs. in this constructed one).\r\n\r\nFor instance, by adding late subscribers, stream &#39;A&#39; would see 0 and 1. Stream &#39;B&#39; would see only &#39;1&#39; (it skips 0 because obs is still active from the &#39;A&#39; subscriber. Stream &#39;C&#39; would behave like stream &#39;A&#39;. \r\n\r\n const { interval, pipe, subscribe } = Rx;\r\n const { take, map, tap, share } = RxOperators;\r\n\r\n const custom = () = > {\r\n let state = 0; \r\n return pipe(\r\n map(next = > state * next),\r\n tap(_ = > state += 1),\r\n share()\r\n )\r\n }\r\n\r\n // Late subscribers can get different streams\r\n const obs = interval(500).pipe(custom())\r\n const sub1 = obs.pipe(take(2)).subscribe((x) = > console.log(&#39;A&#39;, x))\r\n setTimeout(() = > obs.pipe(take(1)).subscribe((x) = > console.log(&#39;B&#39;, x)), 500)\r\n setTimeout(() = > obs.pipe(take(3)).subscribe((x) = > console.log(&#39;C&#39;, x)), 3000)\r\n\r\nWhether this is acceptable or expected behavior will depend on your use case. While it is good to try and use pure functions for all of their advantages, sometimes it isn&#39;t practical or appropriate for your use case.", "1007" ], [ "You can use pushState to do what you describe. As an example (pulled from here: _URL_0_)\r\n\r\n \r\n < script type= \" ;text/javascript \" ; > \r\n function ChangeUrl(title, url) {\r\n if (typeof (history.pushState) != \" ;undefined \" ;) {\r\n var obj = { Title: title, Url: url };\r\n history.pushState(obj, obj.Title, obj.Url);\r\n } else {\r\n alert( \" ;Browser does not support HTML5. \" ;);\r\n }\r\n }\r\n < /script > \r\n < input type= \" ;button \" ; value= \" ;Page1 \" ; onclick= \" ;ChangeUrl(&#39;Page1&#39;, &#39;Page1.htm&#39;); \" ; / > \r\n < input type= \" ;button \" ; value= \" ;Page2 \" ; onclick= \" ;ChangeUrl(&#39;Page2&#39;, &#39;Page2.htm&#39;); \" ; / > \r\n < input type= \" ;button \" ; value= \" ;Page3 \" ; onclick= \" ;ChangeUrl(&#39;Page3&#39;, &#39;Page3.htm&#39;); \" ; / > \r\n\r\nNote that this will *not* work if you are trying to open a test file directly in your browser (i.e., if the URL will be file://whatever). The browser behaves differently. You will need to serve it via some http server.\r\n\r\n**Edit**\r\nThis doesn&#39;t answer the specific question asked by the OP. It will change the path, but you cannot change the hostname portion of a URL via pushState. As someone else already answered, it is not possible to change that without reloading the page due to the Same-origin policy. I left this here in case others just needed to change path portion of the URL.", "68" ], [ "Personally, I would recommend #1. There are a few reasons:\r\n\r\n1. It mirrors the behavior of other primitives in (accessing elements of arrays/hashes, result of `find`, etc), so other Javascript developers will be familiar with that pattern.\r\n2. The response itself is inherently falsey, which makes it trivial to check for the &#39;not found&#39; case very succinctly. In this case, since you expect an object (and not a numeric, where 0 is falsey), this is a nice pattern.\r\n3. Null object pattern is more cumbersome. Users have to know how to check the object for the &#39;not found&#39; case anyways, and that check will be very specific to how you implement the null object. It would be better to use a language primitive to articulate that nothing exists.\r\n4. I don&#39;t consider RORO significantly different than Null objects. The user still has to know how to inspect the response, and RORO implies that the return value is not the usable thing by itself...instead, the actual response they are looking for is embedded somewhere in the response.\r\n4. Exceptions should be used for truly \" ;exceptional \" ; cases. It is entirely reasonable for a list not to contain what you search for, so that is not really an exception. Additionally, exceptions require more code to handle. They are good for certain things, but this really isn&#39;t one of them.", "419" ], [ "Right, but as <PERSON> Gen&#231;, you actually can&#39;t do it with \" ;object \" ; objects, because they are not inherently comparable. Anything in your list m0ust implement IComparable. If you were to use a list of Alligator objects, which do not implement IComparable, they would not have a `CompareTo` method. In other words, the problem has less to do with your Max method and more to do with the test data you are sending. The list you pass must match the criteria you indicate (T must be IComparable)", "842" ], [ "My understanding is that generally `takeUntil` should be the last operator in a chain because it can result in leaks. This article describes the issue: _URL_0_\r\n\r\nThe article uses the following example:\r\n\r\n import { combineLatest, Observable } from \" ;rxjs \" ;;\r\n import { takeUntil } from \" ;rxjs/operators \" ;;\r\n\r\n declare const a: Observable < number > ;\r\n declare const b: Observable < number > ;\r\n declare const notifier: Observable < any > ;\r\n\r\n const c = a.pipe(\r\n takeUntil(notifier),\r\n o = > combineLatest(o, b)\r\n ).subscribe(value = > console.log(value));\r\n\r\nFrom the article:\r\n\r\n > When the notifier emits, the observable returned by the takeUntil operator completes, automatically unsubscribing any subscribers.\r\n\r\n > However, the subscriber to c is not subscribed to the observable returned by takeUntil — it’s subscribed to the observable returned by combineLatest — so it’s not automatically unsubscribed upon the takeUntil observable’s completion.\r\n\r\n > The subscriber to c will remain subscribed until all of the observables passed to combinedLast complete. So, unless b completed before the notifier emitted, the subscription to b would leak.\r\n\r\nWhile this post specifically refers to `switchMap`, I suspect the logic is the same. It may be less of an issue with `switchMap`, as there is only one inner observable.", "769" ], [ "You probably want a combination of checking for error conditions and setInterval. This way you can do something periodically while waiting, and you can handle errors from firebase\r\n\r\n\r\n loadUser() {\r\n let interval = setInterval(() = > { \r\n if (this.isLoading) {\r\n //You are still waiting\r\n }\r\n }, 3000)\r\n this.database.database.ref(&#39;/users/&#39;+this.user.uid).once(&#39;value&#39;, (snapshot) = > {\r\n this.isLoading = false;\r\n clearInterval(interval);\r\n },\r\n (error) = > {\r\n //Handle error case\r\n clearInterval(interval);\r\n });\r\n };\r\n\r\nI&#39;m not that familiar with firebase, but you may need to do a similar failure callback within your `ref` call, in case the error is there and not with the handling of `once`", "119" ], [ "First, I&#39;d recommend checking out the article on the new operator: _URL_0_\r\n\r\nSpecifically, note that\r\n\r\n > When the code new Foo(...) is executed, the following things happen:\r\n\r\n > 1. A new object is created, inheriting from Foo.prototype. \r\n > 2. The constructor function Foo is called with the specified arguments, and with this bound to the newly created object. new Foo is equivalent to new Foo(), i.e. if no argument list is specified, Foo is called without arguments. \r\n > 3. The object returned by the constructor function becomes the result of the whole new expression. If the constructor function doesn&#39;t explicitly return an object, the object created in step 1 is used instead. (Normally constructors don&#39;t return a value, but they can choose to do so if they want to override the normal object creation process.)\r\n\r\nBy explicitly returning `f`, your are overriding the normal creation process. When you use `instanceof`, you are asking \" ;Is n and instance of f \" ;. It&#39;s not. It **is** f. It is not an instance of itself. \r\n\r\nSince clearly `f` is a function, and `n === f`, both will return true when you try to determine if they are functions. Additionally, in Javascript, functions themselves are objects (as are arrays), which is why `new f() instanceof Object` is true.", "81" ], [ "I&#39;d be interested in knowing if there is a better way supported directly by Leaflet, but I don&#39;t think it is possible without writing your own renderer. You could do this with canvas by converting the lat/lng to the pixel point, then starting/ending the line an appropriate number of pixels away (based on the radius of the circle). Of course, the simplest option is for the circle not to be transparent in the middle, and drawing it over the line, but that doesn&#39;t seem to be what you&#39;re looking for.", "447" ], [ "The issue is that `timer` is defined to emit number values. So, `source` will also assume number values will be emitted. However, `switchMap` makes no assumptions about what type will be emitted by the returned observable (hence the `any`). This means that your source goes from emitting numbers to emitting anything at all.\r\n\r\nA simple solution is this\r\n\r\n import { timer, interval } from &#39;rxjs&#39;;\r\n import { switchMap } from &#39;rxjs/operators&#39;;\r\n\r\n //emit immediately, then every 5s\r\n const source = < any > timer(0, 5000); //Here, we say that source can emit anything\r\n //switch to new inner observable when source emits, emit items that are emitted\r\n const example = source.pipe(switchMap(() = > interval(500)));\r\n //output: 0,1,2,3,4,5,6,7,8,9...0,1,2,3,4,5,6,7,8\r\n const subscribe = example.subscribe(val = > console.log(val));", "597" ], [ "This has already been answered here: _URL_0_\r\n\r\nFrom that answer:\r\n\r\n > Most Markdown engines I&#39;ve seen allow plain old HTML, just for situations like this where a generic text markup system just won&#39;t cut it. (The StackOverflow engine, for example.) They then run the entire output through an HTML whitelist filter, regardless, since even a Markdown-only document can easily contain XSS attacks. As such, if you or your users want to create _blank links, then they probably still can.", "459" ] ]
191
[ 8676, 15569, 6991, 13589, 11178, 5735, 7664, 16348, 978, 2001, 9040, 3941, 14341, 12574, 4275, 8613, 1618, 13655, 11247, 8561, 11450, 12637, 17922, 8741, 12456, 12010, 2742, 16895, 15168, 2305, 17890, 5235, 10729, 18167, 15362, 12365, 10606, 18103, 4381, 275, 8032, 2676, 12569, 14543, 11550, 12307, 18586, 12710, 8970, 1259, 15226, 16810, 3954, 19372, 17725, 15642, 199, 12913, 17910, 5526, 956, 17574, 4657, 18591, 19746, 675, 14703, 18214, 16022, 6168, 3752, 1586, 13333, 7842, 7032, 2482, 18665, 10504, 15095, 3080, 14565, 19704, 14056, 5256, 9635, 5263, 5581, 12184, 16422, 5053, 15464, 57, 16180, 13930, 3990, 9112, 18376, 1446, 6068, 5147, 6234, 9323, 9278, 780, 5122, 10096, 3419, 12928, 5161, 14502, 3172, 10973, 11017, 17056, 13087, 5320, 2669, 14855, 6158, 3712, 17140, 5442, 1331, 12851, 7599, 13437, 471, 10453, 9052, 17936, 3096, 15205, 17646, 12406, 18929, 13295, 18858, 4401, 17388, 5316, 19291, 9961, 9452, 3735, 15104, 1130, 2715, 13657, 17937, 16844, 10919, 13809, 10441, 18090, 17986, 16106, 15334, 13551, 2121, 10638, 6612, 7906, 16837, 9307, 6935, 15892, 15319, 14919, 17753, 12261, 12680, 17375, 4205, 18843, 16658, 16492, 6940, 13997, 15365, 18819, 13311, 8620, 3235, 2890, 15438, 2542, 6027, 10925, 10124, 15304, 2035, 5067, 11349, 1077, 2059, 6019, 13560, 17772, 8146, 12194, 1559, 16834, 6225, 13084, 14098, 4709, 10639, 15356, 5073, 18542, 6261, 13384, 13971, 6188, 14912, 18068, 18135, 4776, 252, 15355, 8485, 15122, 1388, 1641, 11795, 1208, 14973, 402, 10642, 14580, 14018, 14956, 19770, 16900, 3134, 16144, 1771, 5459, 3350, 1705, 5485, 13932, 1242, 8132, 2022, 1025, 8964, 13176, 5917, 7140, 648, 3681, 8860, 17743, 8024, 6429, 6424, 9888, 4727, 7385, 7880, 18728, 13947, 9359, 17941, 1054, 16349, 12767, 10041, 1912, 11324, 6789, 9298, 11919, 1742, 6495, 982, 12797, 19341, 2311, 14197, 5833, 1240, 4610, 11786, 1823, 12793, 17058, 11044, 3973, 3984, 2632, 1780, 10588, 16917, 17119, 4673, 2476, 17892, 3269, 10483, 16473, 9366, 16244, 4309, 19469, 792, 4348, 19610, 11163, 12141, 13451, 17223, 8917, 14141, 2583, 1938, 3095, 16058, 6615, 15453, 6999, 7446, 19591, 8445, 6631, 14028, 5867, 17953, 967, 16773, 4469, 13759, 10464, 3504, 2262, 5636, 16159, 12432, 13181, 9817, 10829, 8218, 17327, 4721, 15746, 649, 3310, 8943, 14327, 6583, 8932, 15224, 12856, 1876, 10341, 17766, 6132, 5487, 981, 14804, 14264, 14169, 2, 12805, 8991, 6545, 4629, 5759, 2905, 4074, 4694, 10225, 6617, 16386, 16537, 1229, 6129, 8726, 4632, 5545, 4331, 1682, 7301, 2719, 15729, 6986, 1368, 11308, 16031, 3143, 1291, 2802, 13014, 12447, 2296, 924, 17516, 16020, 8125, 10900, 8111, 1231, 12154, 1748, 7253, 12949, 2484, 11125, 12079, 4070, 2404, 7358, 2385, 2597, 9952, 6531, 1429, 3222, 17948, 12031, 5638, 16582, 2649, 1, 6706, 6778, 14647, 14791, 16138, 11228, 8958, 6412, 10183, 11567, 18854, 461, 11967, 6453, 3129, 10074, 711, 1546, 5605, 5250, 9226, 2410, 17466, 13240, 6258, 13623, 11934, 222, 6635, 16418, 19767, 8982, 9086, 1892, 6140, 7618, 14869, 15964, 16542, 2498, 19197, 14088, 10233, 10885, 11056, 1800, 9899, 6733, 9542, 5711, 5331, 11749, 7525, 10328, 1698, 8251, 2550, 15519, 8711, 1393, 13734, 13293, 2491, 16173, 14329, 17213, 9912, 3240, 8938, 8380, 15085, 19547, 13661, 2561 ]
STX_100120.0
[ [ "I would like to use a Wii remote to control my player in my 3D game.\r\n\r\nSo far I have the arrow keys and mouse to move and look but I want the Wii d-pad to move and accelerometer data to look around.\r\n\r\nI have downloaded [Unity-Wiimote-1.1](_URL_0_) and the demo works fine. In my game I have imported the Unity package for the Wii remote but I&#39;m not sure what script goes where, attached to what, how to call particular functions. They are mostly C# scripts.\r\n\r\nThere is no documentation with the Unity-Wiimote-1.1 and as I&#39;m a newbie, I&#39;m clueless on what to do.\r\n\r\nOr is there a simpler method to getting the Wii remote to be the main controller?", "85" ], [ "This should hopefully be an easy one but i&#39;m stuck on this. I need to stop character movement and camera look if the R2 button on a gamepad is held down.\r\n\r\nThe gamepad i&#39;m using is a third-party generic usb gamepad and can&#39;t find out anywhere which joystick button R2 (right shoulder button) is to enter in the input manager.\r\n\r\nBelow is the code i&#39;m using for the character move which looks like it should work, its just getting the right button in the input manager - i&#39;ve tried 0-15 but nothing.\r\n\r\nIs there a way to find out the button number or is there a better method for doing what i need?\r\n\r\nThanks,\r\n\r\n<PERSON>..\r\n\r\nThe input was set up by duplicating a Fire button input and changing it&#39;s name to DoorTrigger (gravity, deadzone and sensitivity are as they were for the fire button, so 1000, 0.0001 and 1000 respectively) and have been testing the positive button with different button numbers.\r\n\r\n\r\n\r\n using System.Collections;\r\n using System.Collections.Generic;\r\n using UnityEngine;\r\n \r\n public class CharacterController : MonoBehaviour {\r\n \r\n \tpublic float speed = 10.0f;\r\n \tpublic Read_move ReadMove;\r\n bool TriggerBt = Input.GetButtonDown ( \" ;DoorTrigger \" ;);\r\n \r\n \t// Use this for initialization\r\n \tvoid Start () {\r\n \t\tCursor.lockState = CursorLockMode.Locked;\r\n \t\tGameObject Mover = GameObject.Find ( \" ;PlayerA \" ;);\r\n \t\tReadMove = Mover.GetComponent < Read_move > ();\r\n \t}\r\n \t\r\n \t// Update is called once per frame\r\n \tvoid Update () {\r\n \r\n \t\tif (!TriggerBt) {\r\n \t\t\tReadMove.mUP = Input.GetAxis ( \" ;Vertical \" ;);// * speed;\r\n \t\t\tReadMove.mLEFT = Input.GetAxis ( \" ;Horizontal \" ;);// * speed;\r\n \t\t\tfloat translation = ReadMove.mUP * speed;\r\n \t\t\tfloat straffe = ReadMove.mLEFT * speed;\r\n \r\n \t\t\ttranslation *= Time.deltaTime;\r\n \t\t\tstraffe *= Time.deltaTime;\r\n \r\n \t\t\ttransform.Translate (straffe, 0, translation);\r\n \t\t}\r\n \r\n \t\tif (Input.GetKeyDown ( \" ;escape \" ;))\r\n \t\t\tCursor.lockState = CursorLockMode.None;\r\n \t}\r\n }", "940" ], [ "Using a UDP Receive script i found, i can get working for some bits i need but for the main gesturing mechanics, i&#39;m getting a \" ;SocketException: One one usage of each socket address is usually allowed \" ; error.\r\n\r\nThe code i&#39;m using is below. I&#39;ve attached this cript to an empty object ( \" ;MaxSendRev \" ;) and the Read script is attached to every door in the scene - the data being sent is used to open the door (gesturing from either wii remote or gamepad).\r\n\r\nI do have other data being sent and this works fine. They&#39;re on different ports but using the same script.\r\n\r\nThe only thing i can think of is that its not closing the thread each time but the other udp messages are working fine so not sure what is wrong.\r\n\r\n\r\n using UnityEngine;\r\n using System.Collections;\r\n using System;\r\n using System.Text;\r\n using _URL_0_;\r\n using _URL_0_.Sockets;\r\n using System.Text.RegularExpressions;\r\n using System.Threading;\r\n \r\n public class UdpReceive : MonoBehaviour\r\n {\r\n public int port = 2002;\r\n private UdpClient client;\r\n private IPEndPoint RemoteIpEndPoint;\r\n private Thread t_udp;\r\n \t//public ArrayList tmpList;\r\n \tpublic float[] maxValues;\r\n \r\n void Start()\r\n {\r\n client = new UdpClient(port);\r\n RemoteIpEndPoint = new IPEndPoint(IPAddress.Any, 0);\r\n \t\tt_udp = new Thread(new ThreadStart(UDPRead));\r\n t_udp.Name = \" ;UDP thread \" ;;\r\n t_udp.Start();\r\n \r\n \t\t\r\n \t\t//FilterData(test);\r\n }\r\n \r\n public void UDPRead()\r\n {\r\n while (true)\r\n {\r\n try\r\n {\r\n //Debug.Log( \" ;listening UDP port \" ; + port);\r\n byte[] receiveBytes = client.Receive(ref RemoteIpEndPoint);\r\n string returnData = Encoding.ASCII.GetString(receiveBytes);\r\n // parsing //\r\n \t\t\t\tFilterData(returnData);\r\n }\r\n catch (Exception e)\r\n {\r\n Debug.Log( \" ;Not so good \" ; + e.ToString());\r\n }\r\n Thread.Sleep(20);\r\n }\r\n }\r\n \r\n void OnDisable()\r\n {\r\n if (t_udp != null) t_udp.Abort();\r\n client.Close();\r\n }\r\n \r\n \tpublic float MaxValue(int index)\r\n \t{\r\n \t\treturn maxValues[index];\r\n \t}\r\n \t\r\n \tpublic void FilterData(string dataString)\r\n \t{\r\n \t\tstring[] splitString = dataString.Split( \" ;: \" ;[0]);\r\n \t\tmaxValues = new float[splitString.Length];\r\n \t\t\r\n \t\tfor( int i=0; i < maxValues.Length; i++ ) {\r\n \t\t\tmaxValues[i] = float.Parse(splitString[i]);\r\n \t\t}\t\t\r\n \t}\r\n }", "217" ], [ "Thanks <PERSON>, I adapted a bit of your code to suit my needs and it works perfectly :) I just need to work out now how to create a line that joins the dots to create the path in a visual way but i&#39;m sure i can work that out or might feed it to AutoCAD and create a polyline with the coords.", "447" ], [ "_LINQ can merely abstract the flavours of SQL_ -- LINQ is a general querying syntax, and is independent of SQL. Thus you could theoretically keep the same LINQ queries, and swap out your persistence layer, so long as the persistence layer exposed data stores as `IQueryable < T > `; the provider should tailor the underlying API calls -- SQL / alternate query syntax / alternate API -- based on the structure of the query.", "573" ], [ "@Craig Is LINQ-to-SQL still popular? In any event, LINQ is a generic querying syntax, unrelated to SQL; the same syntax can be used to query in-memory collections and XML. I could write `var qry = from p in db.Persons where p.LastName.StartsWith( \" ;a \" ;) select p;` whether `db.Persons` is a simple `List < Person > ` or a more complex ORM object such as Entity Framework&#39;s `DbSet`. (I assume you aren&#39;t saying that the outer layers don&#39;t need to have knowledge of a `Person` entity.)", "573" ], [ "@marstato _Also, you cannot run those queries by themseves on a `Collection < T > `_ -- Why not? The same query -- `IQueryable < Person > qry = from p in db.Persons where p.StartsWith( \" ;a \" ;) select p; var persons = qry.ToList();` -- can be used whether `db` is an Entity Framework `DbContext` or a mocked object with in-memory data exposed as `IQueryable < T > ` properties -- e.g. `return new List < Person > ().AsQueryable();`", "87" ], [ "method, and the call to `StartsWith` with an argument ` \" ;a \" ;`, called on the `LastName` property of the passed-in `Person` will result in an SQL query like the following: `SELECT * FROM Persons WHERE LastName LIKE &#39;a%&#39;`. If the query uses the in-memory provider (LINQ-to-IEnumerable), the expression will be compiled to an actual delegate and called. Do you see any reason why a similar provider could not be constructed for Cypher? (I&#39;m not familiar with Cypher.)", "290" ], [ "@Craig _generates SQL to interact with databases_ -- Isn&#39;t that the point? The LINQ queries that I write don&#39;t have to generate SQL, or even a given variant of SQL; everything depends on the provider of the query source, and the provider could theoretically be defined at runtime. The same LINQ can be run against an in-memory collection, XML, or a web service, as long as the starting point of the query is `IQueryable < T > `.", "573" ], [ "hope you&#39;re all good..\r\n\r\nI&#39;m struggling with a simple toggle for inverting Y axis..\r\n\r\nWhat i have works for my first scene but i&#39;m trying to keep this setting through all scenes, hence why the script below isn&#39;t destroyed on load..\r\n\r\nAlthough its fine for the first scene and works, to help me debug it i&#39;m trying to get its value to show up on the console - the InvertYCheck() function - but it displays the console text once but then doesn&#39;t update (display the new value) again even if i add an if statment in the Update() function.\r\n\r\nSo from this, is seems that it despite being able to check and uncheck the toggle in-game, the value of it will only update the first time you click it.\r\n\r\n\r\nBasically, all i want is the user to be able to select the Y axis orientation during training (scene 1), then retain this value (but not the UI toggle) so that becomes the setting throughout the game..\r\n\r\nFrom looking at the code it should work but it doesn&#39;t. Any ideas why not?\r\n\r\nThanks,\r\n\r\n<PERSON>..\r\n\r\n\r\n using System.Collections;\r\n using System.Collections.Generic;\r\n using UnityEngine;\r\n using UnityEngine.UI;\r\n \r\n public class InvertYscr : MonoBehaviour {\r\n \r\n \tpublic Toggle InvertYtog;\r\n \tpublic bool InvertY = false;\r\n \r\n \t// Use this for initialization\r\n \tvoid Start () {\r\n \t\tInvertYtog = InvertYtog.GetComponent < Toggle > ();\r\n \t}\r\n \t\r\n \t// Update is called once per frame\r\n \tvoid Update () {\r\n \t}\r\n \r\n \tvoid Awake () {\r\n \t\tDontDestroyOnLoad (this);\r\n \t}\r\n \r\n \tpublic void InvertYCheck(bool newVal)\r\n \t{\r\n \t\tInvertY = newVal;\r\n \t\tprint ( \" ;Y Axis is: \" ; + InvertY.ToString());\r\n \t}\r\n \r\n \tpublic float MouseYval (float MY) {\r\n \t\tif (InvertY) {\r\n \t\t\tMY = MY * 1;\r\n \t\t} else if (!InvertY) {\r\n \t\t\tMY = MY * -1;\r\n \t\t}\r\n \t\treturn MY;\r\n \t}\r\n }", "85" ], [ "I&#39;m trying to track playing position every 500ms which i can do but i need it to populate an array which i save to a txt file as a comma delimted list or something.\r\n\r\nI have this code so far (which incorporates the player movement code too), which displays the positions in the console:\r\n\r\n using System.Collections;\r\n using System.Collections.Generic;\r\n using UnityEngine;\r\n \r\n public class CharacterControllerT : MonoBehaviour {\r\n \r\n \tpublic float speed = 10.0f;\r\n \tpublic Read_moveT ReadMove;\r\n \t[SerializeField] private float _duration = 0.5f;\r\n \tprivate float _timer = 0f;\r\n \tpublic Vector3 PlayerPosT;\r\n \tGameObject Mover;\r\n \tpublic Vector3[] PlayerTxyz;\r\n \r\n \t// Use this for initialization\r\n \tvoid Start () {\r\n \t\tCursor.lockState = CursorLockMode.Locked;\r\n \t\tMover = GameObject.Find ( \" ;PlayerT \" ;);\r\n \t\tReadMove = Mover.GetComponent < Read_moveT > ();\r\n \t}\r\n \r\n \t// Update is called once per frame\r\n \tvoid Update () {\r\n \r\n \t\tif (!Input.GetButton ( \" ;DoorTrigger \" ;)) {\r\n \t\t\tReadMove.mUP = Input.GetAxis ( \" ;Vertical \" ;);\r\n \t\t\tReadMove.mLEFT = Input.GetAxis ( \" ;Horizontal \" ;);\r\n \t\t\tfloat translation = ReadMove.mUP * speed;\r\n \t\t\tfloat straffe = ReadMove.mLEFT * speed;\r\n \r\n \t\t\ttranslation *= Time.deltaTime;\r\n \t\t\tstraffe *= Time.deltaTime;\r\n \r\n \t\t\ttransform.Translate (straffe, 0, translation);\r\n \t\t}\r\n \r\n \t\tif (Input.GetKeyDown ( \" ;escape \" ;)) {\r\n \t\t\tCursor.lockState = CursorLockMode.None;\r\n \t\t}\r\n \r\n \r\n \t\t_timer += Time.deltaTime;\r\n \t\tif (_timer > = _duration) {\r\n \t\t\t_timer = 0f;\r\n \t\t\tPlayerPosT = Mover.transform.position;\r\n \t\t\tprint ( \" ;Player:: X: \" ; + PlayerPosT.x + \" ;, Z: \" ; + PlayerPosT.z);\r\n \t\t}\r\n \t}\r\n }\r\n\r\nI just need these coords to be saved into an array that i can process when the game is over. The problem being that the array will always be (until game over) of undetermined length.\r\n\r\nAny ideas?\r\n\r\nThanks,\r\n\r\n<PERSON><IP_ADDRESS> X: \" ; + PlayerPosT.x + \" ;, Z: \" ; + PlayerPosT.z);\r\n \t\t}\r\n \t}\r\n }\r\n\r\nI just need these coords to be saved into an array that i can process when the game is over. The problem being that the array will always be (until game over) of undetermined length.\r\n\r\nAny ideas?\r\n\r\nThanks,\r\n\r\nPaul..", "85" ] ]
338
[ 10680, 1785, 16620, 5023, 8571, 9086, 3129, 11142, 10134, 3662, 13344, 2268, 2542, 3335, 14755, 4977, 8119, 13500, 1062, 17579, 737, 1231, 2802, 15986, 17532, 19600, 15219, 8902, 9727, 9534, 7676, 13564, 6554, 19556, 13866, 12942, 14095, 7517, 695, 9112, 18863, 15552, 5715, 5319, 3067, 15095, 6424, 14233, 6583, 15728, 6903, 12179, 7274, 11241, 18696, 18614, 11099, 10782, 4205, 13087, 17194, 13225, 5320, 10447, 6336, 9992, 9744, 16960, 8917, 5883, 8531, 7919, 4673, 16726, 3636, 16086, 4214, 9228, 17913, 14565, 10570, 15074, 12288, 12876, 12432, 555, 4594, 6096, 10715, 10131, 13880, 17673, 14326, 16506, 14706, 461, 10068, 18195, 8203, 3533, 10040, 19639, 11175, 587, 15258, 10485, 7378, 3127, 10692, 6409, 12234, 13507, 1551, 1677, 10263, 19420, 17831, 3680, 5411, 5889, 11515, 11836, 15748, 7121, 19185, 1882, 11605, 19469, 3222, 1075, 5490, 6540, 9762, 6358, 54, 486, 2166, 3737, 5818, 1894, 19625, 9044, 4607, 13857, 15696, 2412, 3159, 5928, 16691, 6138, 17953, 9769, 11207, 19724, 3812, 18448, 15936, 3755, 4418, 16639, 2482, 501, 148, 1154, 611, 8665, 16412, 6876, 16580, 5947, 8336, 5988, 7916, 6956, 1688, 17511, 5545, 3103, 14381, 14610, 13580, 17692, 5305, 4331, 17659, 14545, 13763, 112, 10640, 14417, 14919, 2515, 8446, 8635, 817, 5946, 5898, 8759, 11852, 5529, 1749, 6143, 18708, 8158, 3955, 15356, 2754, 9979, 8776, 14530, 11505, 7358, 10657, 12792, 5530, 14335, 17481, 19763, 15104, 6565, 3660, 12160, 17516, 8041, 14081, 1396, 6201, 13734, 2904, 17937, 16475, 17671, 3172, 12819, 15693, 12645, 7280, 4159, 13637, 14216, 10093, 6659, 3459, 18779, 7918, 10827, 16906, 7986, 969, 10230, 4127, 1790, 15675, 13176, 11416, 8413, 9403, 11859, 1242, 7295, 7838, 15005, 12043, 368, 3189, 6750, 19084, 19271, 17046, 3096, 9364, 11049, 6829, 341, 3733, 891, 19407, 16921, 14999, 3681, 1586, 15729, 7624, 15464, 12456, 10117, 18184, 18402, 19511, 18160, 11385, 17351, 6879, 14103, 18786, 9307, 16852, 805, 3220, 7393, 16031, 9558, 4551, 7638, 8991, 14589, 19232, 11653, 16905, 13936, 6961, 10990, 1981, 1642, 13987, 1274, 9433, 2, 5707, 3520, 19379, 1185, 1331, 537, 6187, 10096, 791, 14955, 17633, 2000, 14405, 10729, 9482, 2719, 1670, 16773, 7095, 9573, 4577, 14092, 3439, 1, 5546, 1709, 9772, 15948, 15615, 8518, 13317, 3387, 7950, 10697, 4678, 180, 8478, 13805, 7009, 10434, 387, 10585, 2981, 18429, 7525, 425, 3004, 10078, 6544, 7321, 8958, 2458, 3110, 4478, 14114, 7088, 14366, 11125, 5500, 9807, 2664, 13958, 10443, 4309, 18948, 563, 19051, 15681, 6159, 15339, 18528, 13390, 10973, 6045, 7614, 5316, 10085, 11318, 4204, 6646, 7097, 18392, 11272, 11267, 5379, 10817, 8629, 2982, 5138, 19029, 8024, 8616, 10965, 17888, 19522, 3061, 19238, 13649, 18150, 4072, 1919, 10467, 15201, 9647, 8737, 4070, 5395, 907, 12132, 5331, 5681, 3389, 11573, 3971, 15030, 19679, 9600, 9025, 14996, 13343, 14268, 3712, 8208, 7487, 9952, 1648, 616, 10061, 5816, 15084, 15839, 13690, 17230, 6968, 18548, 9945, 4848, 11355, 6030, 10698, 2415, 12280, 9192, 4705, 6815, 10468, 1010, 7996, 9380, 5091, 2816, 13009, 16348, 15304, 3721, 10803, 12448, 11827, 2698, 12933, 17566, 1570, 5423, 16831, 2520, 7446, 18415, 5678, 1100, 6737, 2920, 11242, 6999, 16932, 6494, 12763, 793, 13865, 9745, 11324, 5330 ]
STX_10014.0
[ [ "I believe $x$ would typically be called \" ;indecomposable \" ;, like in algebras.\r\n\r\nNote that in order to define correctly what indecomposable means, you need to realize that you can always write $x = \\operatorname{id}(x) = x(\\operatorname{id},\\dots,\\operatorname{id})$ where $1$ is the identity of your operad. So you need to discard such trivial compositions.\r\n\r\nIf you have an operad of sets this works fine, in more general settings you probably need to consider an augmented operad (i.e. an operad equipped with a map $\\varepsilon : P(1) \\to I$ where $I$ is the unit of your monoidal category, satisfying $\\varepsilon \\eta = \\operatorname{id}_I$ where $\\eta : I \\to P(1)$ represents the unit). Then an indecomposable is something that isn&#39;t in the image of $\\bar{P} \\circ_{(1)} \\bar{P} \\to P$, where $\\bar{P}$ is the augmentation ideal.", "413" ], [ "It&#39;s certainly possible, consider $G = \\mathbb{Z}^2$ with the discrete topology. If $x \\in G$ is any element, consider $H$ to be the subgroup generated by $x$ (unless $x = 0$ in which case consider $H = \\mathbb{Z} \\times \\{0\\}$ for example). It&#39;s proper because $G$ has rank $2 > 1$, nontrivial, and open because $G$ is discrete.\r\n\r\nIf you want an example that&#39;s not discrete, consider $G = \\mathbb{R} \\times \\mathbb{Z}^2$ and apply a similar reasoning. I don&#39;t know if there&#39;s a connected example and I don&#39;t know if this property has a name.", "23" ], [ "A central notion in many algebro-geometrical stuff appears to be so-called \" ;representable morphisms \" ;. A general (read: hand-wavy) definition could be the following, as far as I can tell:\r\n\r\n > Let $\\mathsf{C}$ be a site, and let $f : F \\to G$ be a morphisms of sheaves over $\\mathsf{C}$. Then $f$ is *representable by an object of type $T$* if, for all representable sheaves $h_X$ and all morphisms $h_X \\to G$, the fiber product $F \\times_G h_X$ is of type $T$. (Here the type $T$ could be \" ;affine scheme \" ;, \" ;scheme \" ;, \" ;algebraic space \" ;, \" ;stack \" ;, \" ;manifold \" ;, \" ;differentiable manifold \" ;, \" ;open subset of $\\mathbb{R}^n$ \" ;...)\r\n\r\nI&#39;m more used to topology, so of course my first instinct was to try and see what this meant for topological spaces. As far as I can tell, a continuous map $f : X \\to Y$ is representable by an open subset of $\\mathbb{R}^n$ (resp. a manifold) iff for all open subsets of $Y$ that are homeomorphic to an open subset of $\\mathbb{R}^n$, then $f^{-1}(U)$ is an open subset of $X$ homeomorphic to an open subset of $\\mathbb{R}^n$ (resp. to a manifold).\r\n\r\nHonestly, this isn&#39;t very enlightening... I can follow the definition and understand how the \" ;representability \" ; condition is used, but I have no real intuition for it. What does it mean? Surely the name wasn&#39;t chosen randomly, so if a morphism is represented by (say) a scheme, then what scheme is that, and in what sense does it represent $f$?", "1" ], [ "@goblin No, it&#39;s much weaker than that. $b_1(\\mathbb{R}^2) = 0$ means that the rank of the abelianized of $\\pi_1(\\mathbb{R}^2)$ is zero, i.e. all elements in the abelianized are torsion. Even the statement \" ;$\\pi_1(\\mathbb{R}^2) = 0$ \" ; is much weaker: it says that given any continuous map $S^1 \\to \\mathbb{R}^2$, you can extend it to the disk $D^2$. The Jordan curve theorem says, very roughly speaking, that given an *injective* map $S^1 \\to \\mathbb{R}^2$, you can extend it to an *injective* map $D^2 \\to \\mathbb{R}^2$.", "737" ], [ "In a poset, the coproduct of two objects $X$ and $Y$ is the smallest object $Z$ which is bigger than both $X$ and $Y$.\r\n\r\nYou have your functor $\\sqrt{-} : \\mathsf{Id}(R) \\to \\mathsf{RadId}(R)$. You want to check that it commutes with colimits for $a_1 = (x^2-y)$ and $a_2 = (y)$ as object of $\\mathsf{Id}(R)$. Their coproduct in $\\mathsf{Id}(R)$ is indeed $a_1 + a_2$, the smallest ideal which contains both $a_1$ and $a_2$. Thus on the one hand you have $\\sqrt{a_1 + a_2}$.\r\n\r\nOn the other hand you have the two ideals $\\sqrt{a_1}$ and $\\sqrt{a_2}$ (never mind that they are equal to $a_1$ and $a_2$ for a moment), and you want to compute their colimit in $\\mathsf{RadId}(R)$. In other words, you&#39;re looking for the smallest *radical* ideal which contains $\\sqrt{a_1}$ and $\\sqrt{a_2}$. It&#39;s easy to check that this is $\\sqrt{a_1 + a_2}$: it is a radical ideal which contains $\\sqrt{a_1}$ and $\\sqrt{a_2}$, and if $I$ is another such ideal, then it must contain $a_1 + a_2$ (because it contains $a_1$ and $a_2$) and since it&#39;s radical it must contain $\\sqrt{a_1+a_2}$.\r\n\r\nThus you *do* get the equality:\r\n$$\\sqrt{a_1 \\oplus a_2} = \\sqrt{a_1} \\oplus \\sqrt{a_2}$$\r\nwhere the first colimit is taken in $\\mathsf{Id}(R)$, but the second colimit is taken in $\\mathsf{RadId}(R)$.", "275" ], [ "No, this does not need to be the case. Let $X$ be any space whose fundamental group is [perfect](_URL_0_) (i.e. such that its abelianization is zero), for example the classifying space $X = BA_5$ of the alternating group $A_5$. Let $H \\subset A_5$ be the subgroup generated by a transposition, for example, $H = \\{ 1, \\sigma \\}$ with $\\sigma = (1 \\; 2)$. The group $H$ is isomorphic to $\\mathbb{Z}/2\\mathbb{Z}$, whose abelianization is itself.\r\n\r\nThen by the classification of covering spaces, there exists a covering space $p : \\tilde{X} \\to X$ such that $\\pi_1(\\tilde{X}) = H$ and $p$ induces the inclusion $H \\subset A_5$ on fundamental groups. Now on the level of homology, $H_1(\\tilde{X}) = H_{\\mathrm{ab}} = H$, whereas $H_1(X) = (A_5)_{\\mathrm{ab}} = 0$. Thus the induced map $H_1(\\tilde{X}) \\to H_1(X)$ cannot be a monomorphism.\r\n\r\n---\r\n\r\nHere is another example that doesn&#39;t use classifying spaces. Let $X = S^1 \\vee S^1$ be the figure-eight space, the wedge sum of two circles. Its fundamental group is the free group on two generators,\r\n$$\\pi_1(X) = \\mathbb{Z} * \\mathbb{Z} = \\langle a,b \\rangle.$$\r\n\r\nConsider the subgroup $H$ generated by $g = aba^{-1}b^{-1}$. Since $g$ has infinite order, you get $H \\cong \\mathbb{Z}$.\r\n\r\nUsing the classification of covering spaces, there exists a covering space $p : \\tilde{X} \\to X$ such that $\\pi_1(\\tilde{X}) = H = \\mathbb{Z}$ and $p$ induces the inclusion $H \\subset \\pi_1(X)$ on fundamental groups.\r\n\r\nNow, $H$ is abelian, so $H_1(\\tilde{X}) = H = \\mathbb{Z}$, with generator $[g]$. On the other hand, $H_1(X) = \\mathbb{Z} \\oplus \\mathbb{Z}$ is the direct sum of two copies of $\\mathbb{Z}$, with generators $[a]$ and $[b]$. The morphism $p$ induces on $H_1$:\r\n$$p_*([g]) = [a] + [b] - [a] - [b] = 0$$\r\nand so is the zero morphism on homology, which is not injective.", "731" ], [ "The <PERSON> space is some kind of \" ;twisted suspension \" ;. If $\\pi$ is a trivial vector bundle, say $V = M \\times \\mathbb{R}^n$, then $\\operatorname{Th}(V)$ is the $n$th suspension of $M \\cup \\{*\\}$ (the space $M$ with a disjoint point added). Locally $\\operatorname{Th}(V)$ \" ;looks like \" ; the $n$th suspension of $n$ (because locally the bundle is trivial), but globally the whole thing is twisted.\r\n\r\nWe know that for suspensions we have a suspension isomorphism, $H^k(M) \\cong \\tilde{H}^{k+n}(S^nM)$. Well, there is an analogous isomorphism for <PERSON> spaces, called the <PERSON> isomorphism:\r\n$$H^k(M) \\cong \\tilde{H}^{k+n}(\\operatorname{Th}(V)).$$\r\n\r\nThis can be rephrased without any mention of the <PERSON> space (though you need it for the proof AFAIK). There exists some class $u \\in H^n(V, V \\setminus M)$ (where $M$ is embedded in $V$ as the zero section), called the <PERSON> class, such that for all $k$ the following map is an isomorphism:\r\n$$H^k(E) \\to H^{k+n}(E, E \\setminus M), \\; x \\mapsto x \\smile u.$$\r\n\r\nFor more information, [see the Wikipedia article](_URL_0_).", "278" ], [ "Problem statement: The search space A involves elements $|0\\rangle $, $|2\\rangle$... $|d-1\\rangle$. An oracle is provided for the function $f(x)$ where\r\n\r\n\\begin{align}\r\nf(x) & =1 \\quad x=x^{&#39;}\\in A \\\\\r\nf(x) & =0 \\quad x \\neq x^{&#39;}\r\n\\end{align}\r\n\r\nThe aim is to find $x^{&#39;}$. \r\nWe have an oracle U corresponding to $f(x)$ whose action is the following\r\n$$|x\\rangle |y\\rangle \\rightarrow |x\\rangle |y \\oplus f(x)\\rangle$$ \r\nWe can consider the search space as the states of a d-level quantum system. If we input the superposition \r\n\r\n$$ \r\n\\frac{1}{\\sqrt{d}}\\sum_{x=0}^{d-1} |x\\rangle \\otimes |\\phi\\rangle\r\n$$\r\n where $|\\phi\\rangle=\\omega^d|0\\rangle+\\omega^{d-1}|1\\rangle+\\cdots + \\omega|d-1\\rangle$, $\\omega=e^{\\frac{2\\pi i}{d}}$ is the $d^{th}$ root of unity into the oracle corresponding to $f(x)$, using phase kickback we can create the superposition \r\n\r\n$$\r\n|\\Psi\\rangle=\\frac{1}{\\sqrt{d}}\\sum_{x=0}^{d-1} \\omega^{f(x)}|x\\rangle.\r\n$$\r\n\r\nLet us write $|\\Psi\\rangle$ as \r\n$$\r\n|\\Psi\\rangle=\\sum_{x=0}^{d-1} c_x|x\\rangle$$\r\nwhere $c_x=\\frac{1}{\\sqrt{d}}\\omega^{f(x)}$.\r\n\r\nWe can use quantum state tomography (for example using weak value measurements as described in [this paper][1]) to find the coefficients $c_x$. The $|x\\rangle$ corresponding to $c_x=\\frac{\\omega}{\\sqrt{d}}$ is the required search result.\r\n\r\nBut, quantum tomography requires an ensemble of the unknown quantum state so as to reduce the statistical error. \r\n\r\nSuppose $M_0$ is the required size of the ensemble such that the error in the measurement is small enough to determine the search result $x^{&#39;}$. This requires $M_0$ identical copies of $|\\Psi\\rangle$. But, as the state $|\\Psi\\rangle$ is unknown according to No-Cloning theorem we cannot make copies of $|\\Psi\\rangle$ using $|\\Psi\\rangle$ alone. Hence, the ensemble has to be made by querying the oracle $M_0$ times with the uniform superposition (4). But, note that $M_0$ is decided on the basis of the acceptable amount of error in the tomography process and hence it does not scale with the size of the search space A. \r\n\r\n**From this can I conclude that the query complexity of this algorithm is O(1)?**\r\n\r\n [1]: _URL_0_", "298" ], [ "The above is a search problem and a quantum algorithm for the same that I thought of which could be implemented using quantum tomography. Based on my analysis I am getting the query complexity of the algorithm to be O(1) which indicates some error in my analysis as there is already a proof for the fact that Grover&#39;s algorithm is optimal. So, I was trying to ask whether I have made any mistake in my deduction that the query complexity of the above algorithm is O(1).", "149" ], [ "@DavidRicherby Sir, I tried to tackle quantum search problem in a different way. In the question, I explained how I think the problem could be tackled writing down the whole algorithm that I think might work. But, my own analysis of the query complexity of the algorithm is driving to a contradiction to the already existing result that no search algorithm can be better than Grover&#39;s indicating an error in my analysis.", "293" ], [ "I agree that asking others to check whether I have gone wrong wont be interesting for everyone. With all due respect sir at least you are not interested and I understand that. But, the best I could do as a person interested in quantum computing facing a trouble but no mentor to guide is put up the question explaining my analysis in a site such as this. I apologize if such a question is not accepted in this forum.", "755" ], [ "In addition to the computational answer of &#39;Lord Shark the Unknown&#39;, you can also look at this [graphical example from Wikipedia][1]:\r\n\r\n > Suppose we now consider a slightly more complicated vector field:\r\n\r\n > $${\\mathbf{F}}(x,y,z) = - x^2 \\hat{\\mathbf{y}}$$\r\n\r\n > Its plot:\r\n\r\n > [![plot of the vector field][2]][2]\r\n\r\n > We might not see any rotation initially, but if we closely look at the right, we see a larger field at, say, $x = 4$ than at $x = 3$. Intuitively, if we placed a small paddle wheel there, the larger \" ;current \" ; on its right side would cause the paddlewheel to rotate clockwise, which corresponds to a curl in the negative $z$ direction. By contrast, if we look at a point on the left and placed a small paddle wheel there, the larger \" ;current \" ; on its left side would cause the paddlewheel to rotate counterclockwise, which corresponds to a curl in the positive $z$ direction. [...]\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "892" ], [ "When $R = k[x,y]$ and $I = (x,y)$, there&#39;s a simple free resolution of $R/I = k$ as a $R$-module, given by the Koszul complex:\r\n$$0 \\to R \\xrightarrow{d_2} R^2 \\xrightarrow{d_1} R \\to k \\to 0,$$\r\nwhere $d_2(P) = (xP,yP)$ and $d_1(P,Q) = -yP + xQ$. You can then use it to compute the Ext functor, which is the cohomology of the following cochain complex:\r\n$$0 \\gets \\hom_R(R,k) \\xleftarrow{d^2} \\hom_R(R^2,k) \\xleftarrow{d^1} \\hom_R(R,k) \\gets 0,$$\r\nwhere $d^1(f)(P,Q) = f(-yP+xQ)$ and $d^2(g)(P) = g(xP,yP)$. One can use the isomorphisms\r\n$$\\hom_R(R,k) \\cong k, \\quad f \\mapsto f(1) \\\\\r\n\\hom_R(R^2,k) \\cong k^2, \\quad f \\mapsto (f(1,0), f(0,1))$$\r\nto simplify the complex. It becomes\r\n$0 \\gets k \\xleftarrow{d^2} k^2 \\xleftarrow{d^1} k \\gets 0$\r\nand both differentials are zero. It follows that:\r\n$$\\operatorname{Ext}^n_{k[x,y]}(k,k) = \\begin{cases}\r\nk & n = 0 \\\\\r\nk^2 & n = 1 \\\\\r\nk & n = 2 \\\\\r\n0 & n \\ge 3\r\n\\end{cases}.$$\r\n\r\nWhen you have more variables, there is still a Koszul complex. In general, for an element $z \\in R$, denote the Koszul chain complex $K_z = (0 \\to R \\xrightarrow{z \\cdot} R \\to 0)$. Then when $R = k[x_1, \\dots, x_n]$, you can consider the tensor product of the chain complexes $$K_{x_1} \\otimes \\dots \\otimes K_{x_n},$$\r\nand this gives a free resolution of $k$ as a $R$-module. [You can find an example of computation here (for the case $n=2$)](_URL_0_), in higher dimensions it&#39;s not much more difficult. Beware of the signs involved in the definition of the tensor product! This lets you compute $\\operatorname{Ext}^n_R(k,k)$ as above.", "838" ], [ "<PERSON> You can think of it this way. It doesn&#39;t make sense to speak about \" ;<PERSON> \" ; in general, because there are many people called <PERSON>. But you can consider a particular person called <PERSON>, and say \" ;From now on when I say <PERSON> I mean this person. \" ; If you want you can even take someone called \" ;<PERSON> \" ; for that, but people will look at you funny. It&#39;s similar here: there are many different objects in math that some people like to call \" ;$\\infty$ \" ;, and so if you don&#39;t say which one you&#39;re talking about it&#39;s meaningless. If I ask \" ;Is <PERSON> in the room right now \" ;, it&#39;s meaningless, it could be any <PERSON>.", "675" ], [ "If you still like working out 4 times a week, try doing same compound lifts 2 times a week, and another 2 days spend doing something completely different. This way you space out your lifts, so that it takes 2 weeks to complete the cycle instead of one, and you have 2 more days to do something completely different, new, unique. \r\nHeavy lifts will let you \" ;maintain \" ; the mass, and \" ;something new \" ; will introduce novelty and variation. It could be anything: boxing, running, crossfit, bodyweight exercises... Who knows, maybe you will love it, and want to do that more :)\r\n\r\nThis is an estimated and simplified case just for the purpose of showing an example. After a week/two/month you will have to re adjust and tweak the program. \r\n\r\nAs Krotanix said, it is very difficult to maintain the exact physique, so you can use this as a \" ;low \" ; period. And introducing new stuff will make you more well rounded athlete, and your muscles more adjusted to an exposure to different stimuli.", "382" ], [ "I don&#39;t know if this is helpful for you, but you can think of $f : X \\to Y$ as a labeling of the elements of $X$ by elements of $Y$. For example $f : \\{a,b,c,d,e\\} \\to \\{0,1,2\\}$, $f(a) = f(c) = 0$, $f(b) = f(e) = 1$, $f(d) = 2$ means $a,c$ are labelled by $0$, $b,e$ are labelled by $1$, and $d$ is labelled by $2$. And then a morphism in $X \\downarrow \\mathsf{Set}$ is a map between labels: for example if $g : \\{0,1,2\\} \\to \\{0,1\\}$, $g(0)=g(2) = 0$ and $g(1) = 1$, then all elements that were labelled by $0$ and $2$ are now labelled by $0$ and elements that were labelled by $1$ are now labelled by $1$. (Note that if $(f : X \\to Y) \\in X \\downarrow \\mathsf{Set}$ and $g : Y \\to Z$ is some map, then there&#39;s a unique $(h : X \\to Z) \\in X \\downarrow \\mathsf{Set}$ such that $g_*(f) = h$.)", "1" ], [ "The one who designed this problem should have looked at a book before choosing values... When you open a book, the odd page is always the one after the even page (if you don&#39;t believe me, just open the book closest to you). So the situation described is not actually possible. It reminds me when I had to solve a problem in high school about paving some room, and in the end the tiles had to be 5 meters by 30 cm or something absurd like that...", "994" ], [ "This is actually a bit tricky. There are two functors $F,G : \\mathsf{Vect}^{op} \\times \\mathsf{Vect}^{op} \\to \\mathsf{Vect}$ given respectively by\r\n$$F(V,W) = V^* \\otimes W^*, \\quad G(V,W) = (V \\otimes W)^*$$\r\n(and correspondingly on linear maps). Then there is a [natural transformation](_URL_0_) $\\varphi : F \\to G$, in components:\r\n$$\\varphi_{V,W} : V^* \\otimes W^* \\to (V \\otimes W)^*,$$\r\ngiven by $\\varphi(\\alpha,\\beta) : v \\otimes w \\mapsto \\alpha(v) \\beta(w)$. In other words, if $f : V \\to V&#39;$ and $g : W \\to W&#39;$ are linear map,\r\n$$(f \\otimes g)^* \\circ \\varphi_{V&#39;, W&#39;} = \\varphi_{V,W} \\circ (f^* \\otimes g^*).$$\r\n\r\nThis map $\\varphi_{V,W}$ is always injective; thus, when both $V$ and $W$ are finite-dimensional, it&#39;s an isomorphism (because of dimension considerations: $\\dim(V^* \\otimes W^*) = \\dim(V) \\dim(W) = \\dim((V \\otimes W)^*)$). If both are infinite-dimensional, then $\\varphi_{V,W}$ is not an isomorphism.\r\n\r\nTo explicitly compute the inverse of $\\varphi_{V,W}$ when both are finite-dimensional, you need to choose bases of $V$ and $W$ (and the inverse is indeed the map you have constructed). This is kinda weird, because we know the inverse exists without talking about bases, but it doesn&#39;t seem possible to actually write it down without bases.", "41" ], [ "There is the so-called *Hopf fibration*:\r\n$$U(1) = S^1 \\hookrightarrow S^{2n+1} \\twoheadrightarrow \\mathbb{CP}^n.$$\r\nTo see it, view $S^{2n+1}$ as embedded as the unit sphere of $\\mathbb{R}^{2n+2} \\cong \\mathbb{C}^{n+1}$, and project $z \\in S^{2n+1}$ to the $\\mathbb{C}$-linear subspace $[z] \\in \\mathbb{CP}^n$ it generates in $\\mathbb{C}^{n+1}$ (recall that $\\mathbb{CP}^n = (\\mathbb{C}^{n+1} \\setminus 0) /(z \\sim \\lambda z&#39;)_{\\lambda \\neq 0}$).\r\n\r\nThe fiber over $[z] \\in \\mathbb{CP}^n$ is $\\{ z&#39; \\in S^{2n+1} \\mid \\exists \\lambda \\in \\mathbb{C}^* \\text{ s.t. } z&#39; = \\lambda z \\}$; but since $|z| = |z&#39;| = 1$, then $|\\lambda| = 1$ so $\\lambda$ is in the unit circle of $\\mathbb{C}$. It&#39;s then a classical exercise to see that this defines a fiber bundle over $\\mathbb{CP}^n$.\r\n\r\nThe long exact sequence of a fibration in homotopy is then:\r\n$$ \\ldots \\to \\pi_k(S^1) \\to \\pi_k(S^{2n+1}) \\to \\pi_k(\\mathbb{CP}^n) \\to \\pi_{k-1}(S^1) \\to \\ldots$$\r\nSince $\\pi_k(S^1) = 0$ for $k > 1$, it follows that\r\n$$\\color{red}{\\pi_k(\\mathbb{CP}^n) = \\pi_k(S^{2n+1}) \\quad \\text{for } k > 2.}$$\r\nIn low degrees, the long exact sequence becomes:\r\n$$0 \\to \\pi_2(S^{2n+1}) \\to \\pi_2(\\mathbb{CP}^n) \\to \\underbrace{\\pi_1(S^1)}_{\\mathbb{Z}} \\to \\pi_1(S^{2n+1}) \\to \\pi_1(\\mathbb{CP}^n) \\to 0.$$\r\nFor $n \\ge 1$, $\\pi_1(S^{2n+1}) = \\pi_2(S^{2n+1}) = 0$, and so finally:\r\n$$\\color{red}{\\pi_1(\\mathbb{CP}^n) = 0, \\quad \\pi_2(\\mathbb{CP}^n) = \\mathbb{Z}.}$$", "731" ], [ "It&#39;s a consequence of the famous <PERSON>-Hilton argument. Let $u,v : G \\to H$ be two groups homomorphisms. Define $w : G \\to H$ be $w(g) = u(g) v(g)$ as you suggest. Then for $w$ to be a group homomorphism, you need:\r\n$$w(gh) = u(gh) v(gh) = u(g) u(h) v(g) v(h) \\\\\r\n= w(g) w(h) = u(g) v(g) u(h) v(h) \\\\\r\n\\implies u(h) v(g) = v(g) u(h)$$\r\nand so this defines a group homomorphism iff $u(h)$ commutes with $v(g)$ for all $h,g \\in G$. Obviously, this is not necessarily the case, so in general pointwise multiplication doesn&#39;t yield a group homomorphism. It&#39;s not that \" ;addition \" ; of group homomorphisms isn&#39;t commutative that prevents $\\mathsf{Grp}$ from being abelian; it&#39;s that it isn&#39;t even defined.\r\n\r\nA lot of work has been done to try and see what properties characterize $\\mathsf{Grp}$; as far as I know, [semi-abelian categories](_URL_0_) capture a great deal about $\\mathsf{Grp}$.", "23" ], [ "@Exterior I wasn&#39;t very clear too, sorry. Two morphisms of monoids $u,v : M \\to N$ yield a morphism of monoids $(u,v) : M \\to N \\times N$. It&#39;s natural to want to post-compose this one with the multiplication $N \\times N \\to N$ (this would exactly be the \" ;pointwise multiplication \" ;), but the multiplication is a morphism of monoids iff the monoid $N$ is commutative (and *this* is a special case of the Eckmann-Hilton argument). However it&#39;s less clear how to apply Eckmann-Hilton directly to $g \\mapsto u(g) v(g)$.", "344" ], [ "Yes, it&#39;s possible to have a manifold with a single chart (note that if $X$ is a space, then $X \\subset X$ is open! so it&#39;s not a problem that the definition of a chart requires an open subset).\r\n\r\nThe Euclidean space itself $\\mathbb{R}^n$ is such a manifold. More generally, any open subset $U \\subset \\mathbb{R}^n$ is (almost by definition) a submanifold of $\\mathbb{R}^n$ which is covered by a single chart: itself. Conversely, if $M$ is a manifold which is covered by a single chart $(U, \\phi : U \\to M)$, then it&#39;s by definition homeomorphic to $U$ (via $\\phi$), an open subset of $\\mathbb{R}^n$. So open subsets of $\\mathbb{R}^n$ are the only manifold which are covered by only one chart.\r\n\r\n(They can be rather wild: by a theorem of <PERSON> any manifold $M$ embeds in some $\\mathbb{R}^N$ for $N$ big enough, then an $\\epsilon$-neighborhood of $M \\subset \\mathbb{R}^N$ is homotopy equivalent to $M$ for small enough $\\epsilon$. So essentially you can get all manifolds up to homotopy like this.)\r\n\r\nThe proof that $S^n$ cannot be covered by a single chart is exactly the same as for $S^2$: it&#39;s compact, but a *nonempty* (thanks @Travis) open subset of $\\mathbb{R}^n$ is never compact. More generally a *nonempty* closed $n$-manifold cannot embed in $\\mathbb{R} ^n$.", "737" ], [ "Here&#39;s an overkill approach related to your second paragraph. The space $S^1$ has a contractible open cover, namely $\\mathbb{R} \\to S^1$, $t \\mapsto e^{it}$. This means that $S^1$ is an [Eilenberg–MacLane space](_URL_0_) of type $K(G,1)$, where $G = \\pi_1(S^1) \\cong \\mathbb{Z}$. By the representability theorem, $H^1(-;\\mathbb{Z})$ is represented by $K(\\mathbb{Z},1)$, in other words there is a natural isomorphism (where $X$ is a based space):\r\n$$H^1(X;\\mathbb{Z}) \\cong [X,S^1]_*$$\r\n(where $[X,Y]_*$ is the set of homotopy classes of based maps $X \\to Y$ sending the base point to the base point).\r\n\r\nBut by the universal coefficient theorem,\r\n$$H^1(X;\\mathbb{Z}) \\cong \\hom(H_1(X), \\mathbb{Z}) \\oplus \\operatorname{Ext}^1_{\\mathbb{Z}}(H_0(X), \\mathbb{Z}).$$\r\nBut of course $H_0(X)$ is a free abelian group (generated by the path-connected components of $X$), so $\\operatorname{Ext}^1_{\\mathbb{Z}}(H_0(X), \\mathbb{Z}) = 0$. Moreover, the <PERSON> theorem says $H_1(X) \\cong \\pi_1(X)^{ab}$; since $\\mathbb{Z}$ is abelian, $\\hom(G^{ab}, \\mathbb{Z}) \\cong \\hom(G,\\mathbb{Z})$ for all groups $\\mathbb{Z}$. Finally, combining both isomorphisms:\r\n$$[X,S^1]_* \\cong H^1(X;\\mathbb{Z}) \\cong \\hom(\\pi_1(X), \\mathbb{Z}).$$\r\nAnd if one follows through all the theorems written above, one sees that a homotopy class $[f] \\in [X,S^1]_*$ is exactly sent to $f_* \\in \\hom(\\pi_1(X), \\mathbb{Z})$.", "731" ], [ "The situation is very particular here: OP vandalizes their own questions, preventing improvements; but OP is about to leave the site; there are three largely unrelated questions in one (and the third one barely makes sense), which is completely unacceptable; but the interesting part of rschwieb&#39;s answer is only about one of the three. Is your question a general one (as the title suggests) or about this particular case? In any case you could probably edit your question (either the title or the body, and the tags in both cases, it&#39;s not a feature request by any stretch of imagination...).", "431" ], [ "Here I think simply keeping the question \" ;Is zero prime? \" ; and adding a few lines like \" ;A prime number is a number that cannot be divided, and you cannot divide zero items into more parts, but I&#39;ve read that 2 is the smallest prime, what&#39;s happening here? \" ;, or \" ;Zero is a very special number, I know the definition of prime but does it also apply in this special case? \" ; or something to that effect would be enough to get the question reopened. Maybe also links to other questions were zero behaves bizarrely in arithmetic.", "392" ], [ "@Carl If need be the whole thing can be rewritten from an impersonal point of view: \" ;Zero is a very special number. The definition of a prime number is [...]. However zero sometimes behaves differently from other numbers, does the definition still apply? Why? \" ; To be honest it doesn&#39;t matter much to me, but I understand if some people prefer that way.", "675" ], [ "Suppose that the augmentation $\\epsilon : \\mathbb{Z}[G] \\to \\mathbb{Z}$, $g \\mapsto 1$ splits. This means there&#39;s a map of $\\mathbb{Z}[G]$-modules $j : \\mathbb{Z} \\to \\mathbb{Z}[G]$ such that $\\epsilon(j(n)) = n$ for all $n \\in \\mathbb{Z}$. Let $z = j(1) \\in \\mathbb{Z}[G]$. Then $j(g \\cdot 1) = j(1) = z = g \\cdot j(1) = g \\cdot z$ for all $g$, hence $z \\in \\mathbb{Z}[G]^G$ is invariant.\r\n\r\nThis is only possible if $G$ is finite, and $z$ has to be a scalar multiple of $\\xi = \\sum_{g \\in G} g \\in \\mathbb{Z}[G]$ (easy to check), say $z = n \\xi$ for some $n \\in \\mathbb{Z}$. Clearly $\\epsilon(z) = n \\cdot \\#G$, but at the same time $z = j(1) \\implies \\epsilon(z) = 1$ (since $j$ is a splitting). Hence $n \\cdot \\#G = 1$, which can only happen if $\\# G = 1$.", "156" ], [ "@BalarkaSen If you want keywords, it&#39;s \" ;loop spaces \" ; and \" ;recognition principle \" ;. Under technical conditions, given $1 \\le n \\le \\infty$, an $n$-fold loop space $\\Omega^n X$ is the same thing, up to homotopy, as an algebra over $\\mathtt{D}_n$. Of course the theory of operads has become much more than that since then, but I believe this is the starting point. See also [Why are operads useful?](_URL_0_) on MO.", "663" ], [ "There are tons and tons of examples: $\\mathbb{CP}^n$ for $n \\ge 2$, $S^n \\times S^m$ for $n,m \\ge 2$, connected sums of these when they have the same dimensions, products of these... The list goes on and on.\r\n\r\nIt might help to review why a 2- or 3-dimensional closed manifold which is simply connected is a sphere to see why it fails in higher dimensions.\r\n\r\nIn dimension 2 it follows from the classification of closed surfaces, and there is no classification of manifolds in higher dimension that could tell us anything like that. This isn&#39;t really insightful.\r\n\r\nNow in dimension 3. Hurewicz&#39;s theorem implies that $\\require{cancel}H_1(M) \\cong \\cancel{\\pi_1(M)}_{\\mathrm{ab}} = 0$ because $M$ is simply connected. A simply connected manifold is always orientable, and so you can apply Poincar&#233; duality $H^2(M) \\cong H_1(M) = 0$, and the universal coefficients theorem implies $H_2(M) = 0$ (I&#39;m glossing a bit over the details here, you also need the fact that every homology group of a closed manifold is finitely generated). So you&#39;re only left with $H_0(M) \\cong H_3(M) \\cong \\mathbb{Z}$, in other words your manifold is a [homology sphere](_URL_0_).\r\n\r\nAgain Hurewicz&#39;s theorem implies $\\pi_3(M) \\cong \\mathbb{Z}$, so there&#39;s a representative of a generator $f : S^3 \\to M$ that induces an isomorphism on $\\pi_3$. This $f$ then induces an isomorphism on $H_3$, and since there is no other nontrivial homology, $f$ is a homology equivalence. Since both spaces are simply connected, $f$ has to be a weak homotopy equivalence, and by Whitehead&#39;s theorem a homotopy equivalence. (Showing that the manifold is actually homeomorphic to a sphere would have earned you a million dollars back in the day.)\r\n\r\nSo what fails in higher dimension? Poincar&#233; duality is not enough anymore to ensure that all homology beyond the top homology group vanishes. So you can have nontrivial $H_2$, and then all bets are off. But in dimension 3, there&#39;s just not enough room in (co)homology, so the manifold has to be a homology sphere; but a simply connected homology sphere is always homotopy equivalent to a sphere.", "737" ], [ "Just a comment: over a field, it&#39;s true that for any chain complex $C_*$ there always exists a splitting $C_* = H_*(C) \\oplus V \\oplus V[1]$ where the differential sends $v \\in V$ to $v \\in V[1]$ (zero elsewhere), and you can use that to project $C_*$ onto $H_*(C)$. But there is no way to choose that splitting canonically, and usually no way to choose it in each arity to get a morphism of operads $\\mathcal{O} \\to H(\\mathcal{O})$. Over a general ring, the splitting that I&#39;ve mentioned doesn&#39;t even necessarily exist (and there are probably chain complexes with no projection $C_* \\to H_*(C)$).", "476" ], [ "Sure, I can. But why should I? If you really want, I can say \" ;This *may* solve *your* problem, but it doesn&#39;t solve *the website&#39;s* problem, and if everyone started doing this the website would be much worse for the change. So it&#39;s not a solution. \" ; But I think this easily follows from my previous comment. If you want to further your analogy (you put it in boldface, so you must think it&#39;s important): ***If everyone starts shouting at 150 decibels, then no one can hear what anyone has to say.*** (There, bold *and* italics!)", "704" ], [ "The first thing to do is to formalize what it means to have a \" ;continuous \" ; family $\\{X_i\\}_{i \\in I}$ of spaces indexed by a topological space $I$. I think a fiber bundle, or more generally a fibration, is indeed the way to go: given a fibration $p : \\mathbf{X} \\to I$, denote the fibers as $X_i = p^{-1}(i)$, then you can in some sense view the $X_i$ as a continuous family of spaces over $I$. With a fiber bundle, if $i$ and $j$ lie in the same connected component of $I$, then $X_i$ and $X_j$ will be homeomorphic, while for a fibration they will merely be homotopy equivalent.\r\n\r\nNow an element of the \" ;continuous product \" ; $\\prod_{i \\in I} X_i$ can be defined a section $s : I \\to \\mathbf{X}$ of $p$ (i.e. a continuous map s.t. $p \\circ s = \\operatorname{id}_I$). This gives an element $s(i) \\in X_i$ for every $i \\in I$ that varies continuously with $I$. The space of sections is more formally given by\r\n$$\\Gamma(p) = \\{ s \\in X^I \\mid p \\circ s = \\operatorname{id}_I \\} \\subset X^I,$$\r\ntopologized as a subspace of $X^I$ (which is itself endowed with the compact open topology).\r\n\r\n* When $I$ is discrete, a fibration $p : \\mathbf{X} \\to I$ is exactly the same thing as a collection of spaces $\\{X_i\\}_{i \\in I}$ (with no conditions linking them whatsoever, $p(x \\in X_i) = i$), and $\\Gamma(p) \\cong \\prod_{i \\in I} X_i$ with the product topology.\r\n* When $p : I \\times X \\to I$ is a trivial fibration ($X_i = X \\; \\forall i$), a section of $p$ is the same thing as a map $f : I \\to X$ (the section is then $s(i) = (i, f(i))$), and $\\Gamma(p) \\cong C(I,X)$ with the compact-open topology.", "778" ], [ "With the new Common HTML renderer, `\\sqrt` interacts badly with `\\frac` in inline math (but not in display math). Something like `\\frac{1}{\\sqrt{x}}` ($\\frac{1}{\\sqrt{x}}$) will render like this for me:\r\n\r\n[![screenshot][1]][1]\r\n\r\nAs you can see, there&#39;s no bar above the $x$. It renders fine in display mode (e.g. with dfrac or between double dollars), and the bar is there when the sqrt is outside frac. I&#39;m using Chrome, Windows 10, Common HTML renderer, and I have the latest MathJax fonts according to [this page](_URL_0_).\r\n\r\n\r\n [1]: _URL_1_", "255" ], [ "@anomaly Good point about obstructions, this is definitely something to consider for applications. BTW, note that spheres/disks are also built into the notion of CW-complexes... They&#39;re everywhere! Down with the tyranny of spheres! More seriously this \" ;bias \" ; towards spheres is completely pervasive in algebraic topology, for example: we use simplicial sets to model spaces. Why? Because they&#39;re Quillen equivalent to the model category of spaces. You know, the one where weak equivalence are defined in terms of homotopy groups, i.e. maps from spheres...!", "278" ], [ "> **Question.** Let $f : A \\to B$ be a morphism between two abelians groups. Suppose that the induced morphism $\\bar{f} : A \\otimes_{\\mathbb{Z}} \\mathbb{R} \\to B \\otimes_{\\mathbb{Z}} \\mathbb{R}$ defined by $\\bar{f}(a \\otimes x) = f(a) \\otimes x$ is an isomorphism. Is it necessarily the case that the induced morphism $A \\otimes_{\\mathbb{Z}} \\mathbb{Q} \\to B \\otimes_{\\mathbb{Z}} \\mathbb{Q}$ is an isomorphism?\r\n\r\n**Motivation.** In homotopy theory, a continuous map between based spaces $f : X \\to Y$ is called a rational homotopy equivalence if $\\pi_n(f) \\otimes \\mathbb{Q} : \\pi_n(X) \\otimes \\mathbb{Q} \\to \\pi_n(Y) \\otimes \\mathbb{Q}$ is an isomorphism for each $n$. Similarly, it&#39;s called a real homotopy equivalence if $\\pi_*(f) \\otimes \\mathbb{R}$ is an isomorphism. It&#39;s clear that a rational homotopy equivalence is a real homotopy equivalence: $(- \\otimes_{\\mathbb{Z}} \\mathbb{Q}) \\otimes_{\\mathbb{Q}} \\mathbb{R} \\cong - \\otimes_{\\mathbb{Z}} \\mathbb{R}$. Is the converse true?\r\n\r\n**Progress.** When $A$ and $B$ are finitely generated abelian groups, the statement is true. Use the decomposition as a direct sum of a torsion group and a free abelian group, so that $A \\otimes \\mathbb{R} \\cong \\mathbb{R}^r$ and $B \\otimes \\mathbb{R} \\cong \\mathbb{R}^s$. Since there&#39;s an isomorphism, $r=s$, and the determinant $\\det(f \\otimes \\mathbb{R})$ is nonzero; but this determinant is equal to $\\det(f \\otimes \\mathbb{Q})$ (in fact it&#39;s an integer, equal to $\\det(f)$), so $f \\otimes \\mathbb{Q}$ is also invertible.\r\n\r\nI haven&#39;t been able to generalize that to abelian groups that are *not* finitely generated. I suspect the answer is that it&#39;s false, but I couldn&#39;t come up with a counterexample (surjectivity seems to be the main problem).", "731" ], [ "Thanks, these are all insightful remarks. I guess it counts as an answer in the sense that spheres are already quite good for defining homotopy groups, considering how fundamental they are. What follows is contrarian purely for the sake of being contrarian, don&#39;t taker it the wrong way: most of the second part of your answer relies on the fact we care about $[0,1]$. What if instead I want to take as basic object something like $[0,1] \\cap \\mathbb{Q}$ (not compact though) or its closure in $\\mathbb{Q}_p$ (not ordered)? It&#39;s not clear that spheres would appear naturally then.", "731" ], [ "@MartinArgerami You&#39;re looking at it the wrong way. Both versions (with and without the attempt) are almost as equally useless in building a \" ;library of detailed answers to every question about math \" ;, for reasons that have been outlined many times now (searchability, knowing what lead to a question, similar questions...). But some users are not experienced enough to see the big picture and know what to say to provide proper context for their questions. So they can at least provide what they tried, or that they know some definition or other, and their questions won&#39;t get closed. [cont.]", "727" ], [ "This context *can* be helpful for later editors who want to add context to questions, because the contexts for \" ;solve this analysis problem, I don&#39;t know what a limit is \" ;, \" ;solve this analysis problem, I tried the IVT but it didn&#39;t work \" ; and \" ;solve this analysis problem, I tried using some complex analysis technique but it didn&#39;t work \" ; may not necessarily be the same. Similar questions where the techniques mentioned work, etc, will differ. Of course, all this hinges on the fact that _URL_0_ is not a free \" ;do my homework \" ; service with no investment from the OP, but feel free to disagree.", "262" ], [ "$\\newcommand{\\Z}{\\mathbb{Z}}\\Z_4$ is not projective over $\\Z_8$. Indeed, consider the following exact sequence:\r\n$$0 \\to \\Z_2 \\to \\Z_8 \\to \\Z_4 \\to 0.$$\r\nThe map $i : \\Z_2 \\to \\Z_8$ maps $1$ to $4$, and the map $p : \\Z_8 \\to \\Z_4$ is the quotient map. Then this exact sequence is not split, i.e. there&#39;s no $s : \\Z_4 \\to \\Z_8$ such that $p \\circ s = \\operatorname{id}_{\\Z_4}$. To see this, note that a map $s : \\Z_4 \\to \\Z_8$ is uniquely determined by $s(1)$; since $1 \\in \\Z_4$ has order $4$, $s(1)$ must have an order dividing $4$. It follows that $s(1) = 2k$ for some $k \\in \\Z_8$, and so $p(s(1))$ cannot equal $1$.", "1" ], [ "@rschwieb Please see [Parkinson&#39;s law of triviality](_URL_0_). A question about solving a difficult problem in, say, analytical number theory, may not interest everyone, or may not even be understood by most people. Here, everyone can understand what is asked and pitch in with their grain of salt, anecdotes, dubious life advice... One of the most upvoted comments on the question is a quote from <PERSON>!", "686" ], [ "It is done in the Cartan Seminar:\r\n\r\n > S&#233;minaire Henri Cartan de l&#39;&#201;cole Normale Sup&#233;rieure, 1954/1955. Alg&#232;bres d&#39;Eilenberg–MacLane et homotopie. 2&#232;me &#233;d. *Secr&#233;tariat math&#233;matique, 11 rue Pierre Curie, Paris*, 1956. iii+234 pp. [MR0087935](_URL_1_)\r\n\r\nYou can find the [first part](_URL_2_) and the [second part](_URL_5_) on Numdam. I think the precise reference is either the 3rd or 4th talk. If you do not read French or don&#39;t want to translate into modern language (they use the terminology of \" ;multiplicative construction \" ; of which the reduced bar complex is a special case), it follows from the Hochschild–Kostant–Rosenberg theorem, see e.g. Theorem 9.4.7 of\r\n\r\n > Charles A. Weibel. *An introduction to homological algebra*. Cambridge Studies in Advanced Mathematics 38. Cambridge: Cambridge University Press, 1994, pp. xiv+450. ISBN: <PHONE_NUMBER>; <PHONE_NUMBER>. [MR1269324](_URL_3_).\r\n\r\n(because the homology of the reduced bar complex is the Hochschild homology with trivial coefficients $H_*(\\bar{B}A) \\cong HH_*(A; \\Bbbk)$). The precise result is indeed that if $A$ is a symmetric graded algebra on generators $x_i$, then $HH_*(A;\\Bbbk)$ is isomorphic as a graded vector space to the symmetric graded algebra on the generators $x_i[1]$ with degree shifted by $1$. Another possible reference is Proposition 6.2 of\r\n\r\n > Benoit Fresse. “Iterated bar complexes of E -infinity algebras and homology theories”. In: *Algebr. Geom. Topol.* 11.2 (2011), pp. 747–838. ISSN: 1472-2747. DOI: [10.2140/agt.2011.11.747](_URL_0_). [MR2782544](_URL_4_).\r\n\r\nthough it is written in the language of operads; but I don&#39;t think there are major difficulties involved in recovering the original arguments for a plain algebra (or using $\\mathsf{C}(\\Sigma I) \\circ V = S(\\Sigma V) \\xrightarrow{\\sim} \\operatorname{B}(\\mathsf{C}(I)) \\circ V \\cong \\operatorname{B}(S(V))$ because all the assumptions are satisfied).", "731" ], [ "Maybe I&#39;m tired, but your question is very hard to read. $LR(\\mathcal{C})$ is probably either the [arrow category](_URL_0_) of $\\mathcal{C}$, or the [slice category](_URL_1_) (resp. coslice category) of objects over $A$ (resp. under $A$), both of which are example of comma categories. But I can&#39;t be sure because I&#39;m not able to parse your question. Can you rephrase it without the new terminology ( \" ;to-$A$ \" ;, \" ;from-$A$ \" ;)? What are the objects of $LR(\\mathcal{C})$ exactly? The morphisms...?", "208" ], [ "@user21820 I don&#39;t have to propose to define \" ;empirical \" ; or \" ;reproducible \" ; in mathematical terms. You do. You&#39;re the one insisting on coming to this math website to get an answer to your question. It&#39;s true that other sciences are not as rigorous as math, but it&#39;s not a problem; however if you insist on getting a mathematical answer to your question, then I&#39;m afraid that you will have to frame it in mathematical terms. If it \" ;cannot be done \" ;, then maybe _URL_0_ isn&#39;t the right place for your question.", "5" ], [ "I don&#39;t quite understand your last line. You know $|c(t)| = 1$ for all $t$, in other words $c(t) \\cdot c(t) = 1$ for all $t$. The dot product is a bilinear map $\\mu : \\mathbb{R}^n \\times \\mathbb{R}^n \\to \\mathbb{R}$; for such a bilinear map, if $f, g : [0,1] \\to \\mathbb{R}^n$ are two differentiable maps, then the derivative of $[0,1] \\to \\mathbb{R}$, $t \\mapsto \\mu(f(t), g(t))$ is given by \r\n$$\\mu(f&#39;(t), g(t)) + \\mu(f(t), g&#39;(t)).$$\r\nI advise you to check this directly from the definition of the derivative and of bilinearity, if you&#39;re not convinced. Just compute $\\frac{1}{h} \\bigl( \\mu(f(t+h), g(t+h)) - \\mu(f(t), g(t)) \\bigr)$ cleverly and take the limit as $h \\to 0$.\r\n\r\nSo in your situation, the derivative of $t \\mapsto c(t) \\cdot c(t)$ is $c&#39;(t) \\cdot c(t) + c(t) \\cdot c&#39;(t) = 2 c(t) \\cdot c&#39;(t)$ by symmetry. But you know that $c(t) \\cdot c(t) = 1$ for all $t$, so this derivative is zero and $c(t) \\cdot c&#39;(t) = 0$, i.e. $c(t)$ and $c&#39;(t)$ are orthogonal.", "876" ], [ "There are also more indirect ways of proving that something is a manifold. For example you have the [preimage theorem](_URL_0_) (not sure how standard that name is):\r\n\r\n > If $f : M \\to N$ is a smooth map between manifold and $y \\in N$ is a regular value, then $f^{-1}(y)$ is a submanifold of $M$. *(Plus some further results about dimension and tangent spaces.)*\r\n\r\nHere, $y \\in N$ is said to be a regular value of for all $x \\in f^{-1}(y)$, the differential $df_x : T_xM \\to T_yN$ of $f$ at $x$ is surjective.\r\n\r\nSo for example if you let $f : \\mathbb{R}^2 \\to \\mathbb{R}$ be given by $f(x,y) = x^2 + y^2$, then $1$ is a regular value: you can easily compute the differential $df_{(x,y)}(u,v) = 2ux + 2vy$, which is surjective if $(x,y) \\neq (0,0)$, and of course $f(0,0) \\neq 1$. Thus $S^1 = f^{-1}(1) = \\{ (x,y) \\in \\mathbb{R}^2 \\mid f(x,y) = x^2 + y^2 = 1 \\}$ is a submanifold of $\\mathbb{R}^2$. It&#39;s a very powerful tool.", "1" ], [ "The construction is not completely immediate because the map on cochains defining the cup-product $\\smile : C^k(X) \\otimes C^l(X) \\to C^{k+l}(X)$ doesn&#39;t directly map $C^k(X,A) \\otimes C^l(X,B)$ to $C^{k+l}(X, A \\cup B)$. However if you look at the definition:\r\n$$(\\varphi \\smile \\psi)(\\sigma) = \\varphi(\\sigma_{\\mid[v_0, \\dots, v_k]}) \\cdot \\psi(\\sigma_{\\mid[v_k, \\dots, v_{k+l}]}),$$\r\nyou see that if $\\varphi \\in C^k(X,A)$ (i.e. $\\varphi$ vanishes on simplices fully contained in $A$) and $\\psi \\in C^l(X,B)$, then $\\varphi \\smile \\psi$ vanishes both on simplices contained in $A$ and on simplices contained in $B$ (because $0 \\cdot x = 0 = x \\cdot 0$). So $\\smile$ restricts to a map\r\n$$\\smile : C^k(X,A) \\otimes C^l(X,B) \\to C^{k+l}(X, A + B) := \\hom_R(C_{k+l}(X) / (C_{k+l}(A) + C_{k+l}(B)), R),$$\r\ni.e. $\\varphi \\smile \\psi$ vanishes on simplices that are either fully contained in $A$ or in $B$ (or both), and thus their sums.\r\n\r\nNow there is an inclusion map $C^{k+l}(X, A \\cup B) \\subset C^{k+l}(X, A + B)$ (because if a cochain vanishes on simplices contained in $A \\cup B$, it vanishes on simplices contained in $A$ and on simplices contained in $B$). Moreover if both $A$ and $B$ are open, this inclusion map induces an isomorphism in cohomology by the five-lemma (you need to use excision here, for more details cf. <PERSON>, *Algebraic Topology*, p. 209). So the cup-product finally gives a map in cohomology:\r\n$$\\smile : H^k(X,A) \\otimes H^l(X,B) \\to H^{k+l}(X, A \\cup B).$$", "731" ], [ "Let $X$ be a polyhedron, and consider the inclusion $i : \\operatorname{sk}_2 X \\to X$. It induces a morphism on fundamental groups $i_* : \\pi_1 \\operatorname{sk}_2 X \\to \\pi_1 X$, for some choice of base point $x_0$ in the $0$-skeleton. This morphism is:\r\n\r\n* Surjective: let $\\alpha : I \\to X$ be a representative of some class in $\\pi_1 X$, $\\alpha(0) = \\alpha(1) = x_0$. Then by the simplicial approximation theorem, since $I$ is 1-dimensional, then $\\gamma$ is homotopic to $\\beta : I \\to \\operatorname{sk}_2 X$; since $\\alpha$ was already simplicial on the 0-skeleton of $I$, we can assume the homotopy is constant on the 0-skeleton, hence $\\beta(0) = \\beta(1) = x_0$ too. Then $i_*[\\beta] = [\\alpha]$.\r\n* Injective: let $\\alpha, \\beta : I \\to \\operatorname{sk}_2 X$ be two loops such that $i_*[\\alpha] = i_*[\\beta]$, i.e. there is a homotopy $H : I \\times I \\to X$ such that $H(t,0) = \\alpha(t)$, $H(t,1) = \\beta(t)$, and $H(0,s) = H(1,s) = x_0$. Then similarly by the simplicial approximation theorem, $H$ is homotopic to some $G : I \\times I \\to \\operatorname{sk}_2 X$ ($I \\times I$ is 2-dimensional), and one can moreover take the homotopy to be constant on $\\partial(I \\times I)$ (on which $H$ is already simplicial). Then $G$ is a homotopy in $\\operatorname{sk}_2 X$ between $\\alpha$ and $\\beta$, hence $[\\alpha] = [\\beta]$.\r\n\r\nIt follows that $i_* : \\pi_1(\\operatorname{sk}_2 X) \\to \\pi_1(X)$ is an isomorphism. More generally one can immediately adapt the arguments above to show that $\\pi_n(\\operatorname{sk}_{n+1} X) \\cong \\pi_n(X)$.", "731" ], [ "What does \" ;unknown \" ; mean, exactly? Given any $d$, a computer can easily crunch out in finite time all the possible multiplication tables on a set with $d$ elements, check which ones are groups, and check all the possible isomorphisms to count all the isomorphism classes. It&#39;s probably a very long computation, but it&#39;s certainly doable...", "218" ], [ "Tensor product is right exact: if $0 \\to V&#39; \\to V \\to V&#39;&#39; \\to 0$ is an exact sequence of abelian groups, then $M \\otimes V&#39; \\to M \\otimes V \\to M \\otimes V&#39;&#39; \\to 0$ is an exact sequence too (I&#39;m looking at tensor product over $\\mathbb{Z}$; if $f : X \\to Y$ is a morphism, then the induced morphism $M \\otimes X \\to M \\otimes Y$ is given on generators by $m \\otimes x \\mapsto m \\otimes f(x)$). \r\n\r\nBut by definition $C_i(X)$ is a free abelian group, and a free abelian group if [flat](_URL_1_), meaning that $M \\otimes -$ is actually exact (and not just right exact). So you do get an exact sequence\r\n$$0 \\to C_i(X) \\otimes V&#39; \\to C_i(X) \\otimes V \\to C_i(X) \\otimes V&#39;&#39; \\to 0,$$\r\nand by definition $C_i(X;A) := C_i(X) \\otimes A$. One can also check directly that the exact sequence above commutes with differentials, so you get a short exact sequence of chain complexes and can apply the snake lemma as usual.\r\n\r\nFor cohomology the idea is the same: a free abelian group is [projective](_URL_0_) (one has a chain of implications \" ;free $\\implies$ projective $\\implies$ flat \" ;), and by definition this means that $\\hom(P,-)$ is an exact functor (in general it&#39;s only left exact), and you get a short exact sequence:\r\n$$0 \\to \\hom(C_i(X), V&#39;) \\to \\hom(C_i(X),V) \\to \\hom(C_i(X),V&#39;&#39;) \\to 0$$\r\nwhere by definition $C^i(X;A) := \\hom(C_i(X), A)$, and this short exact sequence commutes with differentials.\r\n\r\nPS: This long exact sequence is how you construct the [Bockstein homomorphism](_URL_2_), for example. It&#39;s the connecting homomorphism $H_i(X;V&#39;&#39;) \\to H_{i-1}(X;V&#39;)$.", "278" ], [ "It depends on what you mean by \" ;square \" ; and it&#39;s basically a problem of notation. When you write $\\left(\\frac{d^2}{{dx}^2}\\right)^2 $, implicitly the \" ;square \" ; means that you compose the operator $\\frac{d^2}{{dx}^2}$ with itself, i.e. you consider $\\frac{d^2}{{dx}^2} \\circ \\frac{d^2}{{dx}^2}$. This is of course equal to $\\frac{d^4}{{dx}^4}$: differentiating four times is the same thing as differentiating twice then differentiating twice again. Applied to some function $f$, this then gives $\\frac{d^2}{{dx}^2} \\left( \\frac{d^2 f(x)}{{dx}^2} \\right) = \\frac{d^4 f(x)}{{dx}^4}$, which is true.\r\n\r\nOn the other hand, where you write $\\left(\\frac{d^2 f(x)}{{dx}^2}\\right)^2$, the \" ;square \" ; is implicitly multiplication, i.e. you&#39;re considering $\\left(\\frac{d^2 f(x)}{{dx}^2}\\right) \\cdot \\left(\\frac{d^2 f(x)}{{dx}^2}\\right)$. This is not equal to the first thing, as simple counterexamples show (e.g. $f(x) = x^3$: $f&#39;&#39;(x) = 6x$ thus $(d^4f)/(dx^4)(x) = 0$ while $((d^2f)/(dx^2)(x))^2 = (6x)^2 = 36x^2$). So you need to be careful with your notations.", "306" ], [ "I have a conjecture that given a particular (multi)set of words without knowledge of ordering, then one ordering is normally much more likely than any others.\r\n\r\n - Its not always true,\r\n - Show me flights from Paris to New York. \" ; is just as reasonable as \" ;Show me flights from New York to Paris \" ;; and just as likely to occur in real world use.\r\n - On the other hand often one ordering is far more likely and reasonable than the others,\r\n - \" ;The dog chased the cat. \" ; is much more often correct than \" ;The cat chased the dog. \" ;, it is also preferable over \" ;The cat the dog chased. \" ; \r\n - though all three are grammatical.\r\n - Indeed the sentence \" ;The cat chased the dog. \" ; may in-fact be the correct sentence (My old neighbor had a cat like that), but how often does it occur? Maybe 1 time in 1000?\r\n - so perhaps it is true for 90% (for example) of sentences. \r\n\r\nFundamentally the question comes down **to given a Bag of Words, how often can a good stochastic language model order them correctly** (back to the reference the bag came from.).\r\n\r\nI&#39;m looking for a reference based on corpus statistics. (My own results suggest it is true for the <PERSON> corpus, though I&#39;ld much rather cite an existing well-known work)\r\n\r\nI&#39;m primarily interested in English, though a contrastive notes [with more or less strict word-ordering languages][1] would be very interesting.\r\n\r\n\r\n [1]: _URL_0_", "818" ], [ "<PERSON> If you want to \" ;force the OP to think for himself \" ;, don&#39;t answer at all and ask for their thoughts in the comments. It seems that people who answer with hints \" ;show a complete lack of understanding \" ; of how this platform works too. It&#39;s happened several times now that I can&#39;t prove some result, look it up and find the same question on this site, and then I&#39;m greeted with some half-assed hint that I already thought of but couldn&#39;t make anything of. Now what? I can&#39;t ask a new question, it would be a duplicate. I can&#39;t offer a bounty every time that happens. [...]", "14" ], [ "[...] If the question is truly bad, close it and either force the OP to improve it or eventually delete it. No one is calling for spoon-feeding. If the OP improves the question, great, post a *full* answer and contribute to the knowledge repository that _URL_0_ is. If the OP doesn&#39;t, please don&#39;t contribute to the pollution of this website by putting all the people that will have the same question in the future in a catch-22 situation. [...]", "359" ], [ "[...] And I&#39;m not even talking about all the people who take advantage of the \" ;hint \" ; policy to post some one-line hint that they didn&#39;t think through and doesn&#39;t even work when you try to work out the details -- just two days ago someone posted a solution for some question in that worked in the one-dimensional case and then \" ;HINT: use induction on dimension \" ; or something like that. As you can guess, higher dimension was orders of magnitude more difficult than dimension 1 and the answerer eventually acknowledged that. Sorry for the rant but I&#39;m really unhappy about this issue.", "704" ], [ "There is the long exact sequence in homology of the pair $(X, X \\setminus p)$ (everything is with $\\mathbb{Z}$-coefficients unless indicated otherwise):\r\n$$0 \\to H_n(X \\setminus p) \\to H_n(X) \\to H_n(X, X \\setminus p) \\to H_{n-1}(X \\setminus p) \\to H_{n-1}(X) \\to 0$$\r\n(recall that the local homology groups satisfy, by excision, $H_n(X, X \\setminus p) = \\mathbb{Z}$ and $H_k(X, X \\setminus p) = 0$ for $k \\neq n$).\r\n\r\nThe fundamental class $[X] \\in H_n(X)$ is sent to a generator of the local homology group $H_n(X, X \\setminus p) = \\mathbb{Z}$ (either by definition, or cf. <PERSON>, Theorem 3.26 for example). Hence $H_n(X) \\to H_n(X, X \\setminus p)$ is an isomorphism and thus $H_n(X \\setminus p) = 0$ and $H_{n-1}(X \\setminus p) \\cong H_n(X)$.\r\n\r\nThe universal coefficient theorem reads\r\n$$H^n(X \\setminus p; R) \\cong \\operatorname{Hom}_{\\mathbb{Z}}(H_n(X \\setminus p), R) \\oplus \\operatorname{Ext}^1_{\\mathbb{Z}}(H_{n-1}(X \\setminus p), R).$$\r\nWe already know the first summand vanishes. By Poincar&#233; duality and universal coefficients, $H_{n-1}(X) \\cong H^1(X) \\cong \\hom(H_1(X), \\mathbb{Z})$. Thus $H_{n-1}(X)$ is torsion-free, and it is also finitely generated because $X$ is compact, hence it is free as an abelian group (as $\\mathbb{Z}$ is a PID). So the second summand vanishes too ($H_{n-1}(X \\setminus p) = H_{n-1}(X)$ is free) and finally $H^n(X \\setminus p) = 0$.", "731" ], [ "Let $P_0 = \\bigoplus_{m \\in M} R_m$ be a direct sum of copies of $R$, one for each element of $M$ (the index is just here for bookkeeping reasons). This is a free $R$-module. This maps to $M$ through $\\varepsilon : P_0 \\to M$ by defining $\\varepsilon_m : R_m \\to M$, $x \\mapsto x \\cdot m$ and extending to the direct sum (coproduct).\r\n\r\nThe kernel $P_1 = \\ker(P_0 \\to M)$ is a submodule of the free module $P_0$, [hence it is free as $R$ is a PID](_URL_0_). Thus you get a free resolution (exact sequence):\r\n$$0 \\to P_1 \\to P_0 \\to M \\to 0.$$\r\n\r\nThen $\\operatorname{Ext}^n(M,N)$ is the homology of the chain complex you get from the exact sequence above after applying $\\operatorname{Hom}_R(-,N)$, but this chain complex is zero in degrees $n \\ge 2$, hence $\\operatorname{Ext}^n(M,N) = 0$ for $n \\ge 2$.\r\n\r\nIf you don&#39;t know that and only know the long exact sequence for $\\operatorname{Ext}$, use the fact that $\\operatorname{Ext}^n_R(P,N) = 0$ for $n \\ge 1$ and $P$ projective (pretty much by definition), and the fact that a free module is projective. The long exact sequence derived from the short one above becomes (where $n \\ge 2$):\r\n$$\\dots \\to \\underbrace{\\operatorname{Ext}^{n-1}_R(P_1,N)}_{= 0} \\to \\operatorname{Ext}^n_R(M,N) \\to \\underbrace{\\operatorname{Ext}^n_R(P_0,N)}_{=0} \\to \\dots$$\r\nand so $\\operatorname{Ext}^n_R(M,N) = 0$.", "838" ], [ "Do you know anything about model categories yet? I find it&#39;s easier to learn first, mainly because it&#39;s a well-established field of study, so there is a large amount of places (books, lecture notes...) you can learn it from; and contrary to $\\infty$-category, everyone agrees on what a model category is. It&#39;s getting there for $\\infty$-categories, but it takes time... Besides model categories were introduced first historically, and a lot of the motivation/inspiration for $\\infty$-categories comes from there, I think. [See this MO thread.](_URL_0_)", "644" ], [ "A [**model category**](_URL_0_) (introduced by <PERSON> in the sixties) is a category equipped with three distinguished classes of morphisms (weak equivalences, fibrations and cofibrations) satisfying some axioms designed to mimic the structure of the category of topological spaces. They provide a framework to study homotopy theory which applies to topological spaces (algebraic topology), chain complexes (homological algebra), and much more. In particular the notion of <PERSON> equivalence allows one to say when two categories are the same \" ;up to homotopy \" ;.\r\n\r\n > What are good places (book, lecture notes, article...) to learn about model categories?\r\n\r\nAssume that the reader is reasonably familiar with category theory, and perhaps with the basics of algebraic topology or homological algebra if some motivation is needed. I would also be interested in more advanced books that deal with finer points of model category theory (localizations come to mind).\r\n\r\nThis question is inspired by [this previous one](_URL_2_) where the OP asked whether to learn $\\infty$-category theory. I believe knowledge of model categories is rather essential to learn $\\infty$-category, as for example many coherence results are stated in the form of \" ;Such and such categories of $\\infty$-categories are <PERSON> equivalent \" ;. As far as I understand much of $\\infty$-category is also designed with model categories in mind, basically \" ;what happens if I&#39;m in a category of bifibrant objects and derived hom spaces \" ;. See also the MO question [Do we still need model categories?](_URL_1_)\r\n\r\n---\r\n\r\nIf possible try to argue why the book/paper you&#39;re mentioning is a good place to learn (and not just assert so), please. By now I think the subject is settled enough that there are several good books about it, and I think it would be nice to condense information about all these books in one place, instead of relying on hearsay.", "278" ], [ "The claim is true, but you have definitely not proven it.\r\n\r\n**Case 1**: you wrote $f(z-z) = f(z) - f(z)$. How do you know that? A priori all you know is $f(x+y) = f(x) + f(y)$, so here it becomes $f(z-z) = f(z+(-z)) = f(z) + f(-z)$. You still need to show that $f(-z) = -f(z)$, which is not part of what you assumed at the beginning.\r\n\r\nTo do case 1 properly, write $f(0) = f(0+0) = f(0) + f(0) = 2 f(0)$. So subtracting $f(0)$ from both sides you get $f(0) = 0$.\r\n\r\n**Case 2**: You have the correct idea here. More formally you need to use induction: the base case is $f(1 \\cdot z) = 1 \\cdot f(z)$, which is obvious. For the induction step, assume that $f(kz) = kf(z)$ for a positive integer $k$, then $$\\begin{align}\r\nf((k+1)z) & = f(kz+z) \\\\\r\n & = f(kz)+f(z) \\quad \\text{(hypothesis from the beginning)} \\\\\r\n & = kf(z) + f(z) \\quad \\text{(induction hypothesis)}\\\\\r\n & = (k+1)f(z).\r\n\\end{align}$$\r\n\r\n**Case 3**: What you wrote is not really correct. In reality for $k$ a negative integer, $f(kz) = f((-z) + \\dots + (-z))$ ($(-k)$ times), so by case 1 you find $f(-z) + \\dots + f(-z) = -k f(-z)$. But then you are again stuck at $f(-z) = -f(z)$.\r\n\r\nFor a better proof, you can use case 1 and case 2 here: if $k$ is a negative integer, then $f(kz - kz) = f(kz) + f(-kz)$. But $f(kz-kz) = f(0) = 0$ by case 1, and since $(-k)$ is a positive integer, you can use case 2 to say $f((-k)z) = (-k)f(z)$, so $f(kz) - k f(z) = 0 \\implies f(kz) = k f(z)$.\r\n\r\n(Note: in particular for $k = -1$, this shows $f(-z) = -f(z)$. But again, you needed to *prove* that!)\r\n\r\nThis equation is known as [Cauchy&#39;s functional equation](_URL_0_). More generally you can show that $f(rz) = rf(z)$ is true for a rational number $r$, and if $f$ satisfies some additional property (continuity, monotonicity, measurability) then it&#39;s even true for every real number $r$. [See this overarching question about the functional equation.](_URL_1_)", "403" ], [ "\" ;that may discourage people from finding other solutions to the question \" ; It shouldn&#39;t... A good question should generate at least 2-3 answers, in general. It&#39;s even a criterion on Area51 to determine the viability of a new site. The problem is with some people in the \" ;fastest gun in the west crowd \" ; who want to answer ASAP to get 1-2 upvotes quickly -- if there&#39;s already a good answer they can&#39;t get away with posting a one-line hint. So IMO, \" ;What can be done \" ;: convert the answer into, well, an answer, maybe as CW if OP doesn&#39;t want to do it.", "14" ], [ "And anyone who believes that running scripts using the (public!) SE API is somehow discouraged or forbidden is invited to take a look at [stackapps](_URL_0_). Please, everyone, take a step back: if SE displayed a warning (not an error) when a user used only one rare tag, or used one of several \" ;bad \" ; keywords in their titles, or displaymath in their titles, would you think this would be a positive or a negative change?", "109" ], [ "@rschwieb I cast the downvote. It was not carelessly cast. I think this answer is phrased incongruously enough that I think it will confuse beginners more than anything. \" ;To me it is the same linear map. \" ;: well, it simply isn&#39;t the same linear map. Sure, you can choose to interpret the new matrix as the representation of the original linear map in a different basis -- but it&#39;s still a different matrix, and that matrix simply isn&#39;t orthogonal. The orthogonality of a map depends on the scalar product, but the orthogonality of a matrix is a \" ;yes/no \" ; question with no further data needed.", "320" ], [ "@rschwieb What do you think \" ;isometry \" ; means? And regardless: if I have an isometry $f$ on some vector space equipped with a scalar product, and a random automorphism $g$ of that vector space, then $gfg^{-1}$ isn&#39;t necessarily an isometry. You can decide that every time you conjugate a linear map by an automorphism you conjugate the scalar product too, but that&#39;s a weird convention.", "1" ], [ "Just use Inkscape, GIMP, Paint, whatever you want. MathJaX simply isn&#39;t designed for this. Maybe you&#39;ll manage to get what you want, but it will be through horrible tricks that will take hours to achieve when it would take minutes to produce the same picture with usual drawing software.", "114" ], [ "Yes, your proof is perfect. To prove uniform convergence you need to prove that for a fixed $\\epsilon > 0$, then $|f(x) - g_n(x)| \\le \\epsilon$ for all $x$ and $n$ big enough; this is exactly what you did.\r\n\r\nThe classical example of a non-uniformly continuous function works as a counterexample: let $f(x) = e^x$, and let $g_n(x) = f(x + 1/n)$.Then if $(g_n)$ converged uniformly to $f$, there would be some $N \\ge 0$ such that for all $n \\ge N$, $|g_n(x) - f(x)| \\le 1$ for all $x$. However, $|g_n(x) - f(x)| = e^x (e^{1/n} - 1)$, and you can always find $x > 0$ such that this is bigger than $1$ (say $x = 1+\\ln(1/(e^{1/N}-1))$).", "268" ], [ "As I said in the comments, the factor $a$ doesn&#39;t necessarily exist: consider the example of $3/3 = 2/2.$\r\n\r\nHowever, if you let $d = \\gcd(m,n)$ such that $m = dm&#39;$ and $n = dn&#39;$, then $m/n = m&#39;/n&#39;$ and you can apply your argument to show that $(b^m)^{1/n} = (b^{m&#39;})^{1/n&#39;}$. Similarly, if you let $e = \\gcd(p,q)$, $p = ep&#39;$, $q = eq&#39;$, then $(b^p)^{1/q} = (b^{p&#39;})^{1/q&#39;}$.\r\n\r\nBut of course $m/n = p/q \\implies m&#39;/n&#39; = p&#39;/q&#39;$, and besides $\\gcd(p&#39;,q&#39;) = \\gcd(m&#39;,n&#39;) = 1$. But it&#39;s a standard fact every (positive) fraction has a unique representation with coprime (positive) numerator and denominator (use Euclid&#39;s lemma four times and the fact $x \\mid y \\text{ and } y \\mid x \\implies x = y$ for positive $x$, $y$), so $m&#39; = p&#39;$ and $n&#39; = q&#39;$ and the claim is proven.", "258" ], [ "To elaborate on @Jyrki&#39;s point, some users used to answer a question and then put a bounty of 50 points on it. Then due to the increased exposure they got lots of upvote on their answer (more than 5), resulting in a net gain of reputation. This was seen as gaming the system, and this is why 1/ the min amount is now 100 for questions you have answered 2/ the min amount increases for each new bounty (because you used to be able to do that an unlimited amount of times, basically).", "233" ], [ "I reformatted your post. For one, your question was entirely in the title, and there was no question in the body -- this is not a good idea in general. Your list was also not formatted very well. It looks like very small things, but it&#39;s sometimes enough to lead people to the downvote button: something that looks like a bunch of formulas jumbled together is not very well received in general.", "641" ], [ "In general people won&#39;t read your whole question at a first glance. They will scan it, look for keywords, and probably above all a question mark. If the question mark appears at the end after a bunch of formulas, and the post looks bad from afar, most people will think \" ;Oh, I need to read all that to even understand the question? Pass. \" ; and ignore it, or even worse downvote it. It could be the best question on the site from a mathematical point of view, if it&#39;s badly presented it will have more chance to be badly received.", "359" ], [ "Not even when $f$ is a local homeomorphism: consider the inclusion $[0,1] \\times \\{0\\} \\subset [0,1] \\times \\{0,1\\}$. For a connected (but non-compact) example, consider $(0,1) \\subset [0,1]$.\r\n\r\nHowever when $X$ is compact and $Y$ is connected (and both are Hausdorff), then a local homeomorphism $X \\to Y$ is always surjective, and this isn&#39;t restricted to manifolds (I might as well include the proof: $f$ is an open map hence $f(X)$ is open, but $X$ is compact so $f(X)$ is compact, hence closed in the <PERSON> space $Y$; by connectedness, $f(X) = Y$).", "778" ], [ "\" ;Building muscle \" ; is a very broad term. Will your program allow you to build muscle? Yes. Will you look like a bodybuilder? Probably not.\r\nCalisthenics 1-2 times a week, assuming properly executed, has the ability to give you good results. Bouldering - that depends... From what I know (and guess), probably won&#39;t build big muscles, but will give you a very good grip.\r\n\r\nDiet wise - that is totally depended on your own body, there is no one rule fits all. Start with 3000 calories. Check your weight at least weekly. See how you progress, then adjust accordingly. If you feel like you are gaining fat - cut 500 cals. If you are constantly hungry and don&#39;t have enough energy to perform your routine ( or don&#39;t gain any muscle) - add more calories (preferably in protein form). \r\nEach body is unique and must be handled uniquely. \r\n\r\nTry your program for 6 weeks and see how you progress. If you love climbing, then at the very least you will have a lot of fun and make progress. \r\nBest case - you will have fun AND build the body of your dreams.", "872" ], [ "Ok. After suffering on many different options to get this integrated, I eventually decided to use a workaround. I used the standard node comment form and created a view to display teaser nodes. It works. It&#39;s not necessarily the right option but it might help someone looking for something similar.\r\n\r\nThanks for your help guys.", "1009" ], [ "[(Inspired by this _URL_2_ discussion)](_URL_5_)\r\n\r\nA new feature has been introduced this summer, [tag warnings](_URL_3_).\r\n\r\n > These warnings are meant to provide users with just-in-time information to help them avoid common mistakes in the tag they’re using (e.g. SQL questions should mention the engine they use).\r\n\r\n > Here’s what they look like:\r\n\r\n > [![picture of tag warnings][1]][1]\r\n\r\n > (More information on this [here](_URL_1_), from which the above text and image were taken.)\r\n\r\nIt seems as if it could be a really helpful feature, especially for new users, so they can avoid common pitfalls. Indeed most people seem not to read tag excerpts, but they might read a yellow warning popup. A few examples of tags for which it could be helpful are [tag:physics], [tag:computer-algebra-systems] and its friends, [tag:soft-question], [tag:logic] (as opposed to [tag:elementary-logic]) and similar cases, [tag:publishing], extremely general tags like [tag:number], etc. See also [this related discussion about \" ;off-topic tags \" ;](_URL_4_).\r\n\r\nI suggest that we follow the format laid out at _URL_2_: write down the tag name, the proposed warning text in a block quote, and some context.\r\n\r\n\r\n [1]: _URL_0_", "423" ], [ "@ZhenLin I&#39;m not sure. I read that, in the case $(k,n) = (0,0)$, as \" ;For every empty collection of $(-1)$-simplices such that [vacuous condition because there&#39;s no such $i,j$], there exists a $0$-simplex $\\sigma \\in K$ such that [vacuous condition because there&#39;s no such $i$]. \" ; Reworded, \" ;There exists $\\sigma \\in K_0$ \" ;. So if you read that with the interpretation that this defines fibrancy for $K$ in mind, this asserts that $K \\to \\Delta^0$ has the RLP wrt. $\\varnothing \\to \\Delta^0$, i.e. there&#39;s a lift of the unique $0$-simplex of $\\Delta^0$.", "90" ], [ "I find it hard to believe that you will be able to train with the same volume during cutting. Assuming classing cutting of ~500 cal/day from surplus of ~500 cal/day, we are looking at ~1000 cal/day different in energy consumption. Assuming you are not planning to be at the gym for 4 hours - I highly doubt that same volume can be achieved (or should be achieved, for that matter). While cutting, the main goal is to retain the most amount of muscle mass, so decreasing volume from the bulking levels is ok. You probably will lose some muscle mass, but that is a part of the deal, when you are cutting.\r\n\r\nAs to cardio, I prefer HIIT, but doing it every day is unmanageable, and according to some literature, down right bad for your heart. You can do cardio every day, but alternate between steady cardio and HIIT. If you only have time for cardio 3 times a week because the rest is taken by lifting - just do HIIT. \r\n\r\n - 5 min warm \r\n - 10-15(or even 20 if you are THAT good) HIIT,\r\n - 5 min cool down.\r\n\r\n I wouldn&#39;t add much lifting after HIIT, simply because it is a very energy-depleting process. If you try to lift something heavy afterwards - your form may suffer and/or you may get an injury. \r\nIf you have a recovery day, and you still want to do something, recovery 1h walks with some incline may be beneficial.\r\n\r\nAs to progressive overload.... Within the cutting face, you will probably need to drop some weights on your working sets ( eventually ). That is ok. If you really feel that you can progress, increase the intensity. \r\n\r\n - Shorten down the break time.\r\n - Add extra couple of reps.\r\n - Do an extra set, if you must.\r\n\r\nThe goal here is major decrease in body fat percentage, so don&#39;t run after strength progression, just try to lose fat without loosing too much muscle.\r\n\r\nAnd the best advice you can have and I can give: educate yourself... A LOT!!! \r\nRead a crap load of articles, a book or two, talk to someone who you think is a knowledgeable person in what you are trying to achieve.", "872" ], [ "A property is something that is *true* of some object, it&#39;s intrinsic to the object. For example, being of finite dimension is a property of a vector space: either it&#39;s of finite dimension, or it&#39;s not. You can think of it as some kind of adjective, if you want: in \" ;a blue pen \" ;, \" ;blue \" ; is a property of the pen.\r\n\r\nA structure is something that you add on top of the object. To continue the same example, given a vector space $V$ of dimension $n$ (the dimension is a *property* of $V$), you can *choose* a basis $(e_1, \\dots, e_n)$ of $V$, and consider the *new object* $(V, (e_1, \\dots, e_n))$, a vector-space-with-a-basis. It&#39;s now a different kind of object.\r\n\r\nIf you have a structure $A$, not all objects can be upgraded to be an object-with-structure-$A$. For example, without the axiom of choice, some infinite dimensional vector spaces don&#39;t have a basis. So you have a *property* of objects, which is \" ;being able to be given the structure $A$ \" ;. For example, \" ;having *a* basis \" ; is a property of vector spaces, it&#39;s an intrinsic feature of the space. But the specific basis that you choose is not something intrinsic to the vector space, as there a vector space typically has many different bases, and each one is a different *structure* that you can add to you vector space.\r\n\r\nNow, when you have a property $A$ that you can give to some type of objects, sometimes one can say \" ;$A$ is a property, not a structure, of $V$ \" ;. This means that $V$ can be given the structure $A$, and moreover it can be given that structure *uniquely*. So the structure that you can add to $V$ is actually intrinsic to $V$, there is only one possible given a $V$.\r\n\r\nHere&#39;s an example: given a vector space, you can wonder whether or not you can make it into a topological vector space. It&#39;s not always possible in general, and if you can do it, there are several inequivalent ways of doing it. But when your space $V$ is of finite dimension, it&#39;s always possible to give a topology to $V$ that makes it into a topological vector space, and moreover that topology is unique (cf. [this question](_URL_0_)). So what was a priori a structure on vector spaces becomes a property on finite dimensional vector spaces.", "383" ], [ "First things first, $I^2$ is not even a topological manifold (without boundary), so it has little chance of being a differentiable manifold. To see this, do as <PERSON> suggests: a point of $\\partial I$ (say, $(0,0)$ has no neighborhood homeomorphic to an open subset of $\\mathbb{R}^2$, much less diffeomorphic.\r\n\r\nHowever $I^2$ is a topological manifold with boundary, and it is indeed homeomorphic to the closed unit disk $\\bar{D}^2$. So it is possible to do as you suggest and transport the differentiable structure of $\\bar{D}^2$ to $I^2$ and obtain a differentiable structure on $I^2$. However, if you do this, the inclusion $I^2 \\hookrightarrow \\mathbb{R}^2$ will not be smooth: the corners at $(0,0)$, $(1,0)$... are troublesome. So this is not very satisfactory.\r\n\r\nSo what *is* $I^2$? It&#39;s a [manifold with corners](_URL_0_). There are several possible definitions of manifolds with corners, and they are not all equivalent; but one thing is sure, is that $I^2$ is one. The basic idea is that you have charts in $I^2$ that are homeomorphisms $\\mathbb{R}^2 \\to U \\subset I^2$ (manifold), $\\mathbb{R} \\times [0,\\infty) \\to U \\subset I^2$ (manifold with boundary), *and* $[0,\\infty)^2 \\to I^2$ (manifold with corners), and everything plays nice.\r\n\r\n*Remark.* Manifolds with corners is a purely differentiable notion. Indeed, $[0,\\infty)^2$ is homeomorphic to $\\mathbb{R} \\times [0,\\infty)$, so from a topological point of view you can always \" ;straighten up \" ; corners. In the realm of topology one instead considers stratified spaces.", "737" ], [ "Let $\\rho : C_n \\to \\mathrm{GL}(V)$ be a representation, equivalently let $f : V \\to V$ be an automorphism such that $f^n = \\operatorname{id}_V$. Then $f$ is a root of the polynomial $X^n - 1$, hence it is diagonalizable over $\\mathbb{C}$ and its complex eigenvalues are $n$th roots of unity. These roots are either real or come in pair of complex conjugate numbers: let $A \\in M_d(\\mathbb{R})$ be the matrix associated to $f$; then if $\\lambda \\in \\mathbb{C} \\setminus \\mathbb{R}$ is an eigenvalue of $A$, i.e. $Av = \\lambda v$ for nonzero $v$, then\r\n$$\\overline{Av} = \\overline{\\lambda v} \\implies A \\bar{v} = \\bar{\\lambda} \\bar{v}$$\r\nhence $\\bar{\\lambda}$ is also an eigenvalue of $A$.\r\n\r\nNow you can pair up $\\lambda = e^{2ik\\pi/n}$ and $\\bar{\\lambda} = e^{-2ik\\pi/n}$. Let $\\theta = 2k\\pi/n$, such that $n \\theta \\equiv 0 \\pmod{2\\pi}$. The two following matrices are similar:\r\n$$\\begin{pmatrix} e^{i \\theta} & 0 \\\\ 0 & e^{-i\\theta} \\end{pmatrix}\r\n\\sim\r\n\\begin{pmatrix} \\cos\\theta & -\\sin\\theta \\\\ \\sin\\theta & \\cos\\theta \\end{pmatrix}$$\r\n\r\n**Conclusion**: The irreducible real representations of $C_n$ are either\r\n\r\n* 1-dimensional, with matrix a real $n$th root of unity;\r\n* 2-dimensional, with matrix $\\left(\\begin{smallmatrix} \\cos\\theta & -\\sin\\theta \\\\ \\sin\\theta & \\cos\\theta \\end{smallmatrix}\\right)$ where $n\\theta \\equiv 0 \\pmod{2\\pi}$ but $\\sin\\theta \\neq 0$.", "362" ], [ "No, it&#39;s not always possible. Consider the \" ;orientable surface of infinite genus \" ;: let $S$ be a torus with two small disks removed, and consider the colimit of\r\n$$S \\to S \\# S \\to S \\# S \\# S \\to \\dots$$\r\nwhere the connected sum means that you glue along the disks that you have removed. (Imagine a surface with an infinite number of holes, basically.) Then you can check the classification of closed surfaces to see that this isn&#39;t homeomorphic to any open subset of any of them.", "737" ], [ "Looking at examples is probably very helpful here. Take as your algebraic theory the theory of commutative algebras. Let $M$ be some commutative algebra. $FU(M) = S(M)$ is the free symmetric (polynomial) algebra generated by the vector space $M$, and $FUFU(M) = S(S(M))$ is the polynomial algebra on that. Elements of $S(M)$ are \" ;parenthesized \" ; formal products of elements of $M$, e.g. $(a \\wedge b \\wedge b) \\wedge (c \\wedge c \\wedge c \\wedge d) \\in S(S(M))$ is a polynomial of weight $2$, the product of $a \\wedge b \\wedge b$ and $c \\wedge c \\wedge c \\wedge d$ (both of which are in $S(M) \\hookrightarrow S(S(M))$).\r\n\r\nThe map $\\varepsilon_{FU(M)}$ removes the outer parentheses, and the element I wrote above is sent to $a \\wedge b \\wedge b \\wedge c \\wedge c \\wedge c \\wedge d \\in S(M)$. On the other hand, $FU(\\varepsilon_M)$ performs the product in $M$ in all the inner expressions, so the element above is sent to $ab^2 \\wedge c^3 d \\in S(M)$. Obviously both of these morphisms are equalized by $\\varepsilon_M$, and the final result is $ab^2c^3d \\in M$.\r\n\r\nSo concretely, to summarize, this says that $M$ has a presentation where generators are elements of $M$, and relations says that if you perform an operation from your algebraic theory on the generators (elements of $M$), then you get the generator associated to the element of $M$ obtained by actually performing the operation in $M$.\r\n\r\nIt&#39;s actually a standard trick used in group theory to prove that every group has a presentation: for a group $G$, consider the free group $F(G)$ on the set $g$, generated say by $\\{x_g\\}_{g \\in G}$, and take as relations $x_g x_h \\equiv x_{gh}$. Then this gives a presentation of $G$. The proposition you&#39;ve quoted is a generalization of that fact.", "23" ], [ "If you want strong homotopy equivalence then the answer is no. The [pseudocircle](_URL_0_) is a finite topological space with four points $X = \\{a,b,c,d\\}$ and open sets $X$, $\\{a,b,c\\}$, $\\{a,b,d\\}$, $\\{a,b\\}$, $\\{a\\}$, $\\{b\\}$, and $\\varnothing$. Then $X$ is the union of the two contractible open sets $\\{a,b,c\\}$ and $\\{a,b,d\\}$ whose intersection is $\\{a,b\\}$ with the discrete topology, i.e. $S^0$. But $X$ is not homotopy equivalent to the suspension of $S^0$, AKA the circle. It is however weakly equivalent to it.", "731" ], [ "For the general answer: the only kind of serial voting which is forbidden is serial voting that targets an individual user. Voting to close many questions of a certain tag is certainly not forbidden.\r\n\r\nAlso do not forget that it takes five (normal) users to close a question, so even if someone went on a rampage and decided for themselves that differential geometry was now off-topic, it would take at the very least four other users to agree with them for their actions to have any effect.\r\n\r\n---\r\n\r\nAs for the specific case, I&#39;m the one who cast a lot (probably all) of the first close votes you saw. It&#39;s called the meta effect: you brought attention on an issue, someone acted on it. The very same effect that got your own question reopened.\r\n\r\nWhy did I do it? I know that the tag [tag:pronunciation] attracts a lot of *bad* questions. What&#39;s a bad question you ask? It&#39;s a question which is off-topic, *or* primarily opinion-based, *or* too broad, *or* unclear. If it fails at any of these criteria, it should be closed. Several tags tend to attract such bad questions: [tag:physics], [tag:learning], [tag:advice], [tag:career-development], [tag:soft-question] (probably the worst offender), and in this case [tag:pronunciation]. So I took some time to go through the tag and see if some questions hadn&#39;t passed through the cracks.\r\n\r\nYou have linked to a discussion where people argue about on-topicness of pronunciation questions. I disagree with the result, but it seems that most people who voted on this issue think that pronunciation questions are generally on-topic. Fine. But many pronunciation questions happen to also be *opinion-based*. Some of them *are* blatantly *off-topic* (one of the questions I voted to close was \" ;How to pronounce the word tableaux in English? \" ; & ndash; plainly there&#39;s nothing mathematical about this question except for the fact that tableaux is a word sometimes used in mathematics). Some of them are *too broad* (asking how to pronounce six different symbols in the same question is not OK). Some of them are *unclear*. Some of them even *lack context*, too: asking \" ;How to pronounce this weird symbol? \" ; without even saying where the symbol was encountered, or why the simple name of the symbol doesn&#39;t work, is not OK either.\r\n\r\nIn case it&#39;s not clear, here&#39;s what I&#39;m saying: pronunciation questions may be *generally* on-topic, but they need to be good questions anyway, and tagging a question [tag:pronunciation] is not a shield that prevents a question from being closed.", "1018" ], [ "@David (1) When I look at a question, either it needs to be closed, or it doesn&#39;t. If it does, I vote to close it. It doesn&#39;t matter if I&#39;ve voted to close zero or ten similar question today. The tag pronunciation isn&#39;t a person whose feelings I can hurt, or that should be \" ;given a break \" ; or whatever. (2) Yes. As I explained, some tags attract bad questions, and I thought it was a good use of my *volunteered* time to look at it (and others) more closely. So what? It&#39;s not forbidden for me (a volunteer like you) to decide how I can best contribute to the site. [cont.]", "1018" ], [ "(3) Users with 10k reputation [can track recently closed questions](_URL_1_), and everyone can [see the history of the review queue](_URL_0_). It has already been discussed to impose some kind of bureaucratic overhead on closing/deleting to \" ;make it more transparent \" ; (in truth, make it so painstaking that people are reluctant to do it), and it was universally rejected. There&#39;s already plenty of transparence in closing, and people not taking the time to check is no excuse to leave old, bad questions open.", "763" ], [ "I guess $L_n$ is the free group ( \" ;libre \" ;) on $n$ generators. Let $L_2 = \\langle x, y \\rangle$ be freely generated by $x$ and $y$. Let $H < L_2$ be the subgroup generated by $x^2$, $xy$ and $yx$. The $H$ is free on these three generators (a combinatorics trick, it&#39;s explained [on Wikipedia](_URL_0_)), i.e. $H \\cong L_3$.\r\n\r\nOf course the inclusion $H \\hookrightarrow L_2$ is a monomorphism. However, the abelianisations of $H$ and $L_2$ are respectively $\\mathbb{Z}^3$ and $\\mathbb{Z}^2$, so the induced map $\\mathbb{Z}^3 \\to \\mathbb{Z}^2$ cannot be a monomorphism (indeed, the three generators are sent to $(2,0) = [x^2] \\in L_2/[L_2, L_2] \\cong \\mathbb{Z}^2$, $(1,1) = [xy]$ and $(1,1) = [yx]$).", "23" ], [ "No, it is not true if $X$ is not locally path-connected. Consider $X = \\{ 1/n \\mid n \\in \\mathbb{N}^* \\} \\cup \\{ 0 \\}$ (with the subspace topology $X \\subset \\mathbb{R}$). Then the path components of $X$ are its singletons, and for each singleton $\\{x\\}$, $\\mathcal{C}([0,1], \\{x\\})$ is a singleton itself. However, $\\mathcal{C}([0,1], X)$ itself is not a countable disjoint union of singleton: it is in fact homeomorphic to $X$ itself, via $$\\mathcal{C}([0,1], X) \\xrightarrow{\\cong} X, \\quad f \\mapsto f(0)$$\r\n(there is nothing special about $0$: every $f : [0,1] \\to X$ is constant, I could have chosen evaluation at any $t \\in [0,1]$).\r\n\r\n(This can be seen intuitively: if $X$ itself is not homeomorphic to the disjoint union of its path components, then $\\mathcal{C}([0,1], X)$ has little chance of being a disjoint union on the path components of $X$ itself. [See here for more examples.](_URL_0_))\r\n\r\n---\r\n\r\nHowever if $X$ is locally path connected this is true. The map\r\n$$w : \\bigsqcup_{X_i \\in \\pi_0(X)} \\mathcal{C}([0,1], X_i) \\to \\mathcal{C}([0,1], X)$$\r\nis continuous by definition (the inclusion $\\mathcal{C}([0,1], X_i) \\to \\mathcal{C}([0,1], X)$ is continuous, use the universal property of the disjoint union). But it is also open: let\r\n$$C(U,K) = \\{ f : [0,1] \\to X_i \\mid f(K) \\subset U \\}$$\r\nbe an open set in the subbasis defining the topology on $\\mathcal{C}([0,1], X_i)$ (i.e. $K \\subset [0,1]$ is compact and $U \\subset X_i$ is open). Then since $X$ is locally path-connected, its path component $X_i$ is open, and thus $U \\subset X_i \\subset X$ is open in $X$ too. It follows that $w(C(U,K))$ is also open in $\\mathcal{C}([0,1], X)$ (by definition). So $w$ sends open sets of a subbasis to open sets, so it&#39;s an open map. To conclude, $w$ is open, continuous, and bijective, so it&#39;s a homeomorphism.", "778" ], [ "<PERSON> Ah, I see the problem. I assumed that the question linked at the top was using $\\cong$ to denote homotopy equivalence (a rather stupid assumption to be honest, I was probably confused by the context), and that they had constructed a space $X$ such that $X$ was htpy.eq. to $X+2$ but not $X+1$. My mistake. My point (and it&#39;s now in <PERSON>) was that this question is nothing special about HoTT, it&#39;s simply a question about spaces and homotopy equivalences of spaces.", "731" ], [ "No, it is not possible. Maybe you can produce some hack to have something that looks similar, but MathJaX is not designed for this, and you&#39;re better off using a dedicated program to produce something like that. And in fact you probably need to consider very seriously whether it&#39;s indispensable to produce a table like that -- I honestly doubt it.", "60" ], [ "@Vim This is a matter of convention, and I don&#39;t think it&#39;s \" ;the most common \" ; definition. Maybe it&#39;s because I&#39;m French, the English Wikipedia takes a punctured neighborhood, the French one takes a full neighborhood for example. In $\\lim (\\sin x)/x$ this couldn&#39;t mean anything else but a punctured neighborhood so the meaning is not ambiguous. Anyway I think it&#39;s bad form to say a proof is \" ;not true \" ; when in fact you simply disagree with the notation, and the proof is actually correct if you interpret the notation as the answerer intended (and the notation isn&#39;t exactly outlandish)...", "675" ], [ "@Vim Of course the notation matters...! The statement \" ;If $\\lim_{x \\to a} f(x) = b$ and $\\lim_{y \\to b} g(y) = c$ then $\\lim_{x \\to a} g(f(x)) = c$ \" ; is true if you interpret the notation $\\lim_{x \\to a}$ as the limit with a full neighborhood, but untrue if it&#39;s for a deleted neighborhood. How can you say that notation doesn&#39;t matter in this situation? It completely changes whether the statement is true or not! The proof is perfectly acceptable, rigorous and mathematically correct as long as you interpret the notation correctly.", "481" ], [ "@SubhadeepDey Some misguided users believe no questions should be closed, ever. They believe this website is the same thing as students coming to their office hours and asking questions, where of course telling them \" ;I&#39;ve answered that question three years ago \" ; is not an option. I for one salute your eagerness to make the site better by cleaning up duplicates :)", "359" ], [ "As written, $F$ has absolutely no reason to be continuous. For example let $f_1, f_2 : [0,1] \\to S^1$ ($S^1$ is the unit circle in $\\mathbb{C}$) be given by $f_1(t) = 1$ and $f_2(t) = -1$, and for $s < 1/2$ I choose a path between $f_1(s)$ and $f_2(s)$ which goes through the upper half-circle and for $s \\ge 1/2$ I choose a path which goes through the lower half-circle. The resulting $F$ will clearly not be continuous.\r\n\r\nThe easiest way to go as <PERSON> remarks in the comments) is to show that any map $f : [0,1] \\to Y$ is homotopic to a constant map. Simply let $F(s,t) = f((1-s)t)$, then $F(0,t) = f(t)$ while $F(1,t) = f(0)$ is constant. Thus $f_1$ is homotopic to the constant map equal to $f_1(0)$, and $f_2$ is homotopic to the constant map equal to $f_2(0)$. (I didn&#39;t use the hypothesis that $Y$ is path-connected here.)\r\n\r\nThen since $Y$ is path-connected, there&#39;s a path $\\gamma : [0,1] \\to Y$ such that $\\gamma(0) = f_1(0)$ and $\\gamma(1) = f_2(0)$. Let $F(s,t) = \\gamma(s)$: this define a homotopy between the two constant maps $(t \\mapsto f_1(0))$ and $(t \\mapsto f_2(0))$. Since the relation \" ;being homotopic \" ; is an equivalence relation, you finally get a homotopy between $f_1$ and $f_2$:\r\n$$f_1 \\sim (t \\mapsto f_1(0)) \\sim (t \\mapsto f_2(0)) \\sim f_2.$$", "236" ], [ "@zyx I don&#39;t know why you&#39;re stirring s*** up in a two-week old thread (on Christmas of all days), but here we go: the moderator in question didn&#39;t state publicly that he thought the question was off-topic. <PERSON> did. It&#39;s voting to reopen a question that one believes is obviously off-topic which means one doesn&#39;t understand the site, not simply reopening that particular question. Way to twist my words... The wording of \" ;The question is obviously off-topic \" ; seems rather unambiguous to me, and in any case I&#39;m interested in MK&#39;s explanation of this, not your far-fetched explanation. Good day.", "1018" ], [ "I think my stance on hints is a bit more extreme than some, but IMO hints do not belong on this site. I&#39;ve already posted a rant in meta comments about this, and I think it&#39;s a good place to reiterate it.\r\n\r\n[For some context](_URL_0_), I was replying to someone suggesting that hints was \" ;helping/forcing OP to think for him/herself and in that process actually learn mathematics \" ; and that \" ;Spoon-feeding OP with full answers is often counter-productive to this goal \" ;:\r\n\r\n > If you want to \" ;force the OP to think for himself \" ;, don&#39;t answer at all and ask for their thoughts in the comments. It seems that people who answer with hints \" ;show a complete lack of understanding \" ; of how this platform works too.\r\n\r\n > It&#39;s happened several times now that I can&#39;t prove some result, look it up and find the same question on this site, and then I&#39;m greeted with some half-assed hint that I already thought of but couldn&#39;t make anything of. Now what? I can&#39;t ask a new question, it would be a duplicate. I can&#39;t offer a bounty every time that happens.\r\n\r\n > If the question is truly bad, close it and either force the OP to improve it or eventually delete it. No one is calling for spoon-feeding. If the OP improves the question, great, post a full answer and contribute to the knowledge repository that _URL_1_ is. If the OP doesn&#39;t, please don&#39;t contribute to the pollution of this website by putting all the people that will have the same question in the future in a catch-22 situation.\r\n\r\n > And I&#39;m not even talking about all the people who take advantage of the \" ;hint \" ; policy to post some one-line hint that they didn&#39;t think through and doesn&#39;t even work when you try to work out the details -- just two days ago someone posted a solution for some question in that worked in the one-dimensional case and then \" ;HINT: use induction on dimension \" ; or something like that. As you can guess, higher dimension was orders of magnitude more difficult than dimension 1 and the answerer eventually acknowledged that.\r\n\r\n > Sorry for the rant but I&#39;m really unhappy about this issue.\r\n\r\nAnd to clarify a discussion that happened later in the thread, I&#39;m not saying that every single detail should be written in the answer. I think there&#39;s a difference between \" ;HINT: integration by parts \" ; (horrible) and \" ;Hint: do integration by parts twice. Let $u = x^2$ and $dv = e^x$. Then after let $u = 2x$ and $dv = e^x$ \" ;. IMO the first one is completely unacceptable, I&#39;m more reserved about the second (and I wouldn&#39;t downvote it), but I believe it would be better with more detail.\r\n\r\n**tl;dr** I don&#39;t like hints, and I think they&#39;re actively harmful. Either answer the question completely or don&#39;t.\r\n\r\n---\r\n\r\nDon&#39;t answer in the comments either. I think that goes without saying. But don&#39;t answer with a hint in the comments, too. People will then be reluctant to actually answer the question because it&#39;s already \" ;solved \" ;, and then the unanswered queue gets cluttered.", "494" ], [ "@RonGordon I definitely agree that someone should work out an answer in full detail before posting (hint or not). As for the \" ;it&#39;s up to you \" ;: sure. But consider the consequences too. If a question already has an answer, people will be much less likely to answer it. So if you post a hint, you should be prepared for the eventuality that your answer will be the only one. And when you answer a question, you help the OP once, sure; but there will be hundreds (it&#39;s not hyperbole in general) of people who will read your answer later. You probably want your answer to help them too. [cont.]", "14" ], [ "And I think it&#39;s very difficult to post an answer that will be understood by every single person that will ask themselves the same question. It also fosters the idea that hints are acceptable, and then other users will post their hints, of varying quality. If other users only see full answers, then they will only post full answers. Basically, I think the users who post subpar, not-thought-out-through hints have ruined hints for everyone. If no hint answers were posted ever again on this website, I believe this would result in a net increase in quality of content.", "359" ], [ "@AloizioMacedo I think quid&#39;s comment matches what I think. For a simplistic example, imagine a solution that has two steps.The typical hint will help solve the first step, and leave the second step to OP. Maybe OP will manage, and if they don&#39;t you&#39;re here to answer comments. But what if years later someone has the same question, manages the first step alone, but not the second? The hint will be useless. Now we have to deal with questions \" ;I have this question, but don&#39;t understand the answer... Can someone explain it? \" ; And future users need to sift through 2-3 answers to get the full answer.", "14" ], [ "Let me add that context is more than just \" ;one&#39;s attempt at the question \" ;. Defining some of the terms in the question, links to similar questions, *explaining why the problem is interesting* (since you want to share your solution to the problem, surely you have thoughts on that), where you found the problem, what kind of tools one can expect to use to solve it... All in all, someone&#39;s attempt at a question is probably the least useful type of context, I think ([cf. this previous discussion in the comments](_URL_0_)).", "727" ], [ "The motivation for the functor of points is actually $\\operatorname{Hom}(-, \\operatorname{Spec}(B))$, which, when composed with $\\operatorname{Spec}$, gives the functor $\\operatorname{Hom}(B,-) : \\mathsf{Comm} \\to \\mathsf{Set}$. It&#39;s a contravariant functor when defined on schemes, and a covariant functor when defined on commutative algebras (through $\\operatorname{Spec}$). Then you replace $\\operatorname{Spec}(B)$ by a more general scheme $X$ to get $\\operatorname{Hom}_{\\mathsf{Sch}}(-,X)$.\r\n\r\nTo recall it easily, recall the affine line $\\mathbb{A}^1 = \\operatorname{Spec} k[x]$: one has\r\n$$\\operatorname{Hom}_{\\mathsf{Comm}_k}(k[x], A) \\cong A, \\quad f \\mapsto f(x)$$\r\n(which is what one would expect from a 1-dimensional line), and this is also $\\operatorname{Hom}_{\\mathsf{Sch}}(\\operatorname{Spec} A, \\mathbb{A}^1)$.", "208" ], [ "@zyx It just needs to be clearly separated from the question... It&#39;s not very hard to start a new paragraph and write \" ;Here&#39;s my attempt \" ;. It doesn&#39;t belong in comments, which are intended to be ephemeral and to, I quote, \" ;reply to other users or notify them of changes. If you are adding new information, edit your post instead \" ;. And it certainly doesn&#39;t belong in a self-answer (answers are for... answers...). And have you read the discussion I linked? Attempts can be useful beyond just making progress towards the question. It also helps fine-tune answers to the OP for example.", "494" ], [ "@Omnomnomnom As usual, I&#39;m not convinced of two things: that just giving the starting point is better (what metric are we using anyway?) than giving the full answer, and that anyone who finds that question will be able to piece out the full answer from the hint. There&#39;s also always this perverse effect of reading a hint, thinking \" ;oh yeah I see how it works \" ;, but if you actually tried to write the details you would get stuck because you misunderstood the hint, for example. Anyway, as is evident from the recent meta thread, hints aren&#39;t going anywhere, don&#39;t worry...", "727" ], [ "<PERSON> It is especially ironic that nowhere in *your* comment there are arguments to support your position, or that you couldn&#39;t explain which \" ;strawman \" ; I&#39;m attacking and which was the real position taken. \" ;Strawman \" ; isn&#39;t a magic word that lets you win arguments. I have seen the \" ;catch-22 \" ; happen with my own eyes, so simply asserting that it doesn&#39;t happen isn&#39;t likely to convince me. Anyway, I&#39;m done with this discussion -- I said what I wanted to say. (For the record, yes, I do consider all hint-only answers to be bad answers.)", "686" ], [ "I think the people who decide to ignore the later users and focus on each OP would benefit from realizing that [the overwhelming majority of users come here through search engines](_URL_0_). By answering a solution-verification question they help one user, yes, but they miss out on the opportunity of helping hundreds more. And sometimes it&#39;s even actively harmful for these other users, when they search for a problem and all they can find is someone&#39;s overly complicated proof answered with a mere \" ;yes that&#39;s correct&#39; with no explanation.", "359" ], [ "@Exterior It&#39;s almost exactly the same proof as what I wrote in the paragraph starting with \" ;Now, the universal property. \" ; But instead of speaking about abstract morphisms, you can write assume all objects and morphisms are sets and applications, and it&#39;s a bit simpler to see that the conditions are redundant. But the proof isn&#39;t really easier, it&#39;s more a help when you&#39;re not used to category theory.", "209" ], [ "An abelian group is the same thing as a module over the ring $\\mathbb{Z}$ (think about it). The ring $\\mathbb{Z}$ is a PID, thus submodules of free $\\mathbb{Z}$-modules are free. Reformulated in the context of abelian groups, submodules of free abelian groups are free abelian. You can use this fact to show that [every abelian group has a length 2 free resolution](_URL_1_) (this works over any PID $R$, in particular $R = \\mathbb{Z}$):\r\n\r\n > Let $P_0 = \\bigoplus_{m \\in M} R_m$ be a direct sum of copies of $R$, one for each element of $M$ (the index is just here for bookkeeping reasons). This is a free $R$-module. This maps to $M$ through $\\varepsilon : P_0 \\to M$ by defining $\\varepsilon_m : R_m \\to M$, $x \\mapsto x \\cdot m$ and extending to the direct sum (coproduct).\r\n\r\n > The kernel $P_1 = \\ker(P_0 \\to M)$ is a submodule of the free module $P_0$, [hence it is free as $R$ is a PID](_URL_0_). Thus you get a free resolution (exact sequence):\r\n$$0 \\to P_1 \\to P_0 \\to M \\to 0.$$\r\n\r\nIn the above proof, notice that \" ;free $\\mathbb{Z}$-module \" ; is also the same thing as \" ;free abelian group \" ;, so everything works out. You can also choose a set of generators for your module $M$, but I feel it&#39;s cleaner by just taking every element of $M$ and be done with it.\r\n\r\nAs <PERSON> mentions in the comments, for finitely generated abelian groups it&#39;s easy to see from the structure theorem (e.g. $\\mathbb{Z}/n\\mathbb{Z}$ has the free resolution $0 \\to \\mathbb{Z} \\xrightarrow{\\cdot n} \\mathbb{Z} \\to \\mathbb{Z}/n\\mathbb{Z} \\to 0$).\r\n\r\nOther people have already commented on the difference between resolutions of abelian groups and groups in general. Surprisingly enough, subgroups of free groups are free too by the [Nielsen–Schreier theorem](_URL_3_), and the standard proof even uses algebraic topology! It all comes around. So you can directly adapt the above argument to show that every (not necessarily abelian) group has a free resolution of length at most two:\r\n\r\n > Let $G$ be a group. Let $P_0 = \\bigstar_{g \\in G} \\mathbb{Z}_g$ be the [free product](_URL_2_) of copies of $\\mathbb{Z}$, one for each element of $g$. This is a free group. By the universal property of free groups, this maps to $G$ by sending $1 \\in \\mathbb{Z}_g$ to $g \\in G$. The kernel $P_1 = \\ker(P_0 \\to G)$ is a subgroup of a free group, thus it is free itself, and you get a free resolution of $G$ of length at most 2:\r\n$$0 \\to P_1 \\to P_0 \\to G \\to 0.$$\r\n\r\nIn the above proof, $\\mathbb{Z}$ appears too, but for different reasons: it is the free group on one generator. It also happens to be the free abelian group on one generator, but that&#39;s not its role in the proof above. The groups $P_0$ and $P_1$ that appear in the proof are, in general, not free abelian.", "23" ], [ "PSA: Between the creation of this sandbox (in July 2012) and today (December 2015), technology has advanced. Something like [StackEdit](_URL_0_) (or others, it&#39;s simply the only one I know) essentially solves all the limitations of this sandbox. You can have multiple concurrent drafts, you don&#39;t have to worry about polluting meta&#39;s front page, you can leave your draft untouched for days and expect it to still be there, you don&#39;t have to explicitly clear up your draft when you&#39;re done... Maybe someday we can get rid of this outdated crutch.", "330" ], [ "Let me put <PERSON> into a general context. You can define the *chain complex* $K(A,n)$ by letting\r\n$$K(A,n)_i = \\begin{cases} A & i = n \\\\ 0 & i \\neq n \\end{cases}$$\r\nand with the zero differential. This is of course a well-defined chain complex: $0^2 = 0$ (you don&#39;t run into issues as for simplicial abelian groups). I suspect that intuitively this is what you wanted to do.\r\n\r\nThe [Dold–Kan correspondence](_URL_0_) says that the category of chain complexes is equivalent to the category of simplicial abelian group:\r\n$$N : \\mathsf{Ab}^{\\Delta^{op}} \\leftrightarrows \\mathsf{Ch}_{\\ge 0} : \\Gamma.$$\r\nHere $N$ is the functor of normalized chains and $\\Gamma$ can be described explicitly. It turns out that if you apply $\\Gamma$ to the chain complex defined above, you exactly get the simplicial abelian group described in <PERSON>. A possible reference is the book [*Simplicial Homotopy Theory*](_URL_1_) of <PERSON> and <PERSON>, Chapter III, Section 2. Explicitly, for a chain complex $C_*$, the simplicial abelian group $\\Gamma(C)$ is given by:\r\n$$\\Gamma(C)_n = \\bigoplus_{[n] \\twoheadrightarrow [k]} C_k$$\r\nwhere the direct sum ranges over surjection from $[n] = \\{ 0, \\dots, n \\}$ to $[k]$. The simplicial structure maps are defined through some kind of yoga with epi-mono factorizations. So for $C_* = K(A,n)_*$ you exactly get the simplicial abelian group of <PERSON>.\r\n\r\nIt moreover follows from the construction (this is also explained in the book) of the equivalence $N \\dashv \\Gamma$ that the homology groups $H_*(C)$ of a chain complex $C_*$ are isomorphic to the homotopy groups $\\pi_*(\\Gamma(C_*))$; but of course the homology of the chain complex $K(A,n)$ is simply $A$ concentrated in degree $n$, thus $\\Gamma(K(A,n))$ is an Eilenberg–MacLane simplicial abelian group.", "278" ], [ "That&#39;s not quite right. $s$ itself isn&#39;t directly a coboundary map. However you know that cohomology operations are natural maps, so they also commute with maps of the form $f^* : H^i(X,A) \\to H^i(Y,B)$ where $f : (Y,B) \\to (X,A)$ is a map of pairs. So $\\operatorname{Sq}^i$ commutes with:\r\n\r\n* the coboundary map $H^q(X) \\to H^{q+1}(CX,X)$;\r\n* $H^{q+1}(SX,C&#39;X) \\to H^{q+1}(CX, X)$ induced by the inclusion $(CX,X) \\subset (SX, C&#39;X)$; by excision this is an isomorphism so you can invert it, and if $\\operatorname{Sq}^i f = f \\operatorname{Sq}^i$ then $f^{-1} \\operatorname{Sq}^i = \\operatorname{Sq}^i f^{-1}$;\r\n* $H^{q+1}(SX,C&#39;X) \\to H^{q+1}(SX)$ induced by the inclusion $(SX, \\varnothing) \\subset (SX, C&#39;X)$;\r\n\r\nso $\\operatorname{Sq}^i$ commutes with the composite of all three maps, that is $s : H^q(X) \\to H^{q+1}(SX)$.", "731" ], [ "Yes, the answer is elementary. If you do not understand it, then you need to learn abstract algebra. It&#39;s not a big deal, many people on Earth don&#39;t know anything about algebra -- but you still need it to understand this proof. There&#39;s no way around it. You wouldn&#39;t expect someone who&#39;s never run in their life to be able to run a marathon, or someone who&#39;s never studied medicine to successfully perform surgery, right?", "644" ], [ "A [smooth complex projective variety](_URL_1_) is the zero-locus, inside some $\\mathbb{CP}^n$, of some family of homogeneous polynomials in $n+1$ variables satisfying a certain number of conditions that I won&#39;t spell out. It is in particular a differentiable manifold. A [parallelizable manifold](_URL_0_) is a (differentiable) manifold with a trivial tangent bundle, i.e. $TM \\cong M \\times \\mathbb{R}^n$ (equivalently, a manifold of dimension $n$ is parallelizable if it admits $n$ vector fields that are everywhere linearly independent).\r\n\r\nBeing a projective variety is an algebro-geometric condition, whereas being parallelizable is more of a algebro-topological condition. I&#39;d like to know how the two interact. For example, according to Wikipedia, some [complex tori](_URL_2_) are projective. But like all Lie groups, a complex torus is parallelizable.\r\n\r\n > What are other examples of smooth complex projective varieties that are parallelizable?", "737" ], [ "@BalarkaSen I don&#39;t really know much about algebraic geometry, to be honest. Even a few examples would be helpful. But I know that some theorems that have apparently nothing to do with algebraic geometry can be proven for some classes of algebraic manifolds (e.g. K&#228;hler manifolds are formal, a property that&#39;s only interested in the rational homotopy of the space). So maybe there&#39;s something interesting to be said here. As for the motivation: I have a construction that works only for parallelizable manifolds, and I know it&#39;s supposed to yield a result for complex projective varieties.", "663" ], [ "Yes, $1 = u(1_{\\mathbb{K}})$. You have a short exact sequence\r\n$$0 \\to \\ker(\\epsilon) \\to C \\xrightarrow{\\epsilon} \\mathbb{K} \\to 0$$\r\nand it is split by the coaugmentation $u : \\mathbb{K} \\to C$, so by the [splitting lemma](_URL_0_), $C \\cong \\ker(\\epsilon) \\oplus \\mathbb{K}$, and $\\mathbb{K}$ is identified as a submodule of $C$ as the image of $u$.\r\n\r\nYou simply need to compute $(\\epsilon \\otimes \\operatorname{id})(\\bar{\\Delta}(x))$ and $(\\operatorname{id} \\otimes \\epsilon)(\\bar{\\Delta}(x))$ to check that $\\bar{\\Delta(x)}$ is in $\\bar{C} \\otimes \\bar{C}$. But for example\r\n$$(\\epsilon \\otimes \\operatorname{id})(\\bar{\\Delta}(x)) = (\\epsilon \\otimes \\operatorname{id})(\\Delta(x)) - \\epsilon(x) \\otimes 1 - \\epsilon(1) \\otimes x;$$\r\nsince $x \\in \\bar{C} = \\ker(\\epsilon)$, $\\epsilon(x) \\otimes 1 = 0$; since $\\epsilon \\circ u = \\operatorname{id}$, $\\epsilon(1) = 1_K$; and by the counit relations, $(\\epsilon \\otimes \\operatorname{id})(\\Delta(x)) = x$. So you&#39;re left with $x - 0 - x = 0$, and so $\\bar{\\Delta(x)} \\in \\bar{C} \\otimes C$. Similarly $(\\operatorname{id} \\otimes \\epsilon)(\\bar{\\Delta}(x)) = 0$ so $\\bar{\\Delta}(x) \\in \\bar{C} \\otimes \\bar{C}$.", "90" ], [ "If it can reassure you, I&#39;m a beginning PhD student too, and at first I was a bit scared of asking questions on MO. So far I&#39;ve asked 4, and they&#39;ve been well-received each time. Three of them were questions I directly encountered during my research, the fourth one was about a topic that interested me but not directly related to my research. I mean, worst case scenario, your question gets downvoted... It&#39;s not the end of the world. Most people (if not everyone) were genuinely helpful with me.", "906" ], [ "I&#39;m a bit tired of this attitude. If a world renowned expert barged into a numerical analysis conference and gave a subpar talk on algebraic geometry (or whatever), people wouldn&#39;t be happy. Even assuming that contest questions draw in \" ;high ability users \" ; as you claim (debatable), there is still a certain amount of rules that one must follow to use this website, and that these \" ;high ability users \" ; condescend to bestow their knowledge upon us mere mortals, doesn&#39;t give them a free pass to ignore them all.", "359" ], [ "*AoPS has a useless interface compared to MSE **and is not comparable in the depth of the pool of solvers.*** I can&#39;t help but be reminded of these times when a successful company is bought out by a bigger company, they make changes to the product to save money / tackle on ads / whatever and then wonder why the customers go away. You see something successful, think \" ;I can make use of that! \" ; and don&#39;t consider that by using it like that you perhaps destroy what made it successful in the first place. If this website became a contest-math-fest, I would leave and I wouldn&#39;t be alone, I think.", "109" ], [ "It&#39;s just a notation. It means \" ;you can plug in an integer here and get something \" ;. It&#39;s also often used for simplicial sets, for example: a simplicial set $X_\\bullet$ is a sequence of sets $(X_0, X_1, X_2, \\dots)$ and some maps between them satisfying some identities. Or for example a cosimplicial set $Y^\\bullet$ is also a sequence of spaces $(Y^0, Y^1, \\dots)$ (plus maps).\r\n\r\nFor chain complexes one also often finds the notation $(A_*, d_*)$, which basically means exactly the same thing. Similarly for cochain complexes you often find $(B^*, d^*)$ (and generally the differential *increase* the degree then: $d^n : B^n \\to B^{n+1}$ instead of $d_n : A_n \\to A_{n-1}$). At the end of the day it&#39;s just a matter of preference, and as long as it&#39;s clear what you mean from the context it should be okay.", "224" ], [ "Let $M$ be a compact, oriented, smooth $n$-manifold and let $\\Omega^*_{\\mathrm{dR}}(M)$ be the commutative differential graded algebra of de Rham forms on $M$. We can define a pairing:\r\n\\begin{align}\r\n\\langle -,- \\rangle : \\Omega^k_{\\mathrm{dR}}(M) \\otimes \\Omega^{n-k}_{\\mathrm{dR}}(M) & \\to \\mathbb{R} \\\\\r\n\\alpha \\otimes \\beta & \\mapsto \\int_M \\alpha \\wedge \\beta\r\n\\end{align}\r\n\r\n**Question.** Is this pairing non-degenerate? In other words, is the map $\\alpha \\mapsto (\\beta \\mapsto \\langle \\alpha, \\beta \\rangle)$ an isomorphism $\\Omega^k_{\\mathrm{dR}}(M) \\to \\operatorname{Hom}_{\\mathbb{R}}(\\Omega^{n-k}_{\\mathrm{dR}}(M), \\mathbb{R})$?\r\n\r\nThis is true on the level of cohomology, a result known as Poincar&#233; duality. Thus, given a *closed* $k$-form $\\alpha$ which is not a coboundary, there exists a closed $(n-k)$-form $\\beta$ with $\\int_M \\alpha \\wedge \\beta \\neq 0$ (the cohomology groups of a compact manifold are finite dimensional so this is an equivalent characterization of nondegeneracy).\r\n\r\nBut I haven&#39;t been able to find anything on whether this is true on the level of de Rham forms directly; in fact I rather expect it to be false.", "737" ], [ "Here is an answer without <PERSON> & ndash;Vietoris & ndash; maybe it&#39;s possible to use the technique you describe, but the following approach seems easier to me. Homology commutes with (some) directed colimits. You can e.g. find a precise statement in Hatcher&#39;s book *Algebraic Topology*, Proposition 3.33.\r\n\r\nYour space $X$ can naturally be seen as a directed colimit indexed by $\\mathbb{N}$ (in fact if you try to define it precisely this is probably how you will do it). Indeed, consider $X_n$ to the be part of your space containing the first $n$ \" ;holes \" ;, for example $X_1$ is a torus with a disk removed. More generally $X_n$ is a surface of genus $n$ with a disk removed. It&#39;s clear that $X = \\bigcup_{n \\ge 1} X_n$, and that each compact set of $X$ is contained in some $X_n$. Thus the natural map:\r\n$$\\varinjlim H_i(X_n) \\to H_i(X)$$\r\nis an isomorphism. All is left to do is compute $H_i(X_n)$ and determine what the maps $H_i(X_n) \\to H_i(X_{n+1})$ are, and then see what the colimit is.\r\n\r\nAs I wrote earlier $X_n$ is a surface $\\Sigma_n$ of genus $n$ with a disk removed. Recall that:\r\n$$H_i(\\Sigma_n) = \\begin{cases}\r\n\\mathbb{Z} & i = 0, \\\\\r\n\\mathbb{Z}^{2n} & i = 1, \\\\\r\n\\mathbb{Z} & i = 2,\r\n0 & \\text{otherwise}.\r\n\\end{cases}$$\r\nNow, using the fact that $X_n$ deformation retracts onto a wedge sum of $2n$ circles (by taking the standard cellular decomposition of $\\Sigma_n$ and punching a hole in the middle of the 2-cell), you can compute the homology of $X_n = \\Sigma_n \\setminus D^2$:\r\n$$H_i(X_n) = \\begin{cases}\r\n\\mathbb{Z} & i = 0, \\\\\r\n\\mathbb{Z}^{2n} & i = 1, \\\\\r\n0 & \\text{otherwise}.\r\n\\end{cases}$$\r\nThe inclusion $X_n \\to X_{n+1}$ induces an isomorphism on $H_0$, and it is the inclusion $(x_1, \\dots, x_{2n}) \\mapsto (x_1, \\dots, x_{2n}, 0, 0)$ on $H_1$ (you can see this by picking explicit representative of the generating homology classes of $H_1(X_n)$. This finally gives:\r\n$$H_i(X) = \\begin{cases}\r\n\\mathbb{Z} & i = 0, \\\\\r\n\\bigoplus_{n = 0}^\\infty \\mathbb{Z} = \\mathbb{Z}^{(\\infty)} & i = 1, \\\\\r\n0 & \\text{otherwise}.\r\n\\end{cases}$$\r\n(Just a warning that will maybe be useless: be careful that $H_1(X)$ is the direct *sum* of an infinite number of copies of $\\mathbb{Z}$, not the direct *product*. The distinction matters when there is an infinite number of terms. By the universal coefficient theorem, $H^1(X) = \\mathbb{Z}^\\infty$ is the infinite product though.)", "731" ], [ "In the category of finite dimensional vector spaces, the initial object and the terminal object are equal: it&#39;s the zero-dimensional vector space $0$. Thus the initial and the terminal object are isomorphic (yes, equal implies isomorphic...!). But in the category of sets, the initial object $\\varnothing$ is not isomorphic (in bijection with) the terminal object $\\{*\\}$ (any singleton). So the two categories are not equivalent.\r\n\r\nIf you want more details: suppose that $F : \\mathsf{Set} \\to \\mathsf{Vect}$ were an equivalence. Then since $F$ is fully faithful, $\\hom_{\\mathsf{Vect}}(F(\\varnothing), F(X)) \\cong \\hom_{\\mathsf{Set}}(\\varnothing, X) = \\{ \\varnothing \\}$ would be a singleton for all sets $X$, and since $F$ is essentially surjective, it follows that $F(\\varnothing)$ would be an initial object. Similarly you can prove that $F(\\{*\\})$ would be a terminal object. Thus $F(\\varnothing)$ and $F(\\{*\\})$ would need to be isomorphic, in particular there would be an isomorphism $F(\\{*\\}) \\to F(\\varnothing)$. But in $\\mathsf{Set}$ there isn&#39;t even a morphism (map) $\\{*\\} \\to \\varnothing$, contradicting the fullness of $F$.\r\n\r\nIf you want to use the characteristic zero assumption: since $k$ has characteristic zero, any nonzero vector space has an infinite number of endomorphisms (multiplication by $\\lambda \\in k$ for example). And the zero vector space only has one endomorphism. This means that the two-element set $\\{0,1\\}$ (which has $4$ self-maps) cannot be mapped to any vector space without contradicting the fully faithful property of $F$.", "41" ], [ "First, you mixed up exponents and indices quite liberally in this question... There&#39;s a difference.\r\n\r\nThe map $f$ is a cocycle in $\\operatorname{Hom}(X,Y)$ of degree $p+q$. So first, by definition of the degree in the chain complex $\\operatorname{Hom}(X,Y)$, it will map a $p$-cochain of $X$ to a $q$-cochain of $Y$. < sup > * < /sup > So since $z_2 \\in Z^p(X)$, $f(z_2) \\in Y^q$. Second, since $f$ is a cocycle, it satisfies the equation $d_Y \\circ f - \\pm f \\circ d_X = 0$. When applied to $z_2$, this reads $d(f(z_2)) - \\pm f(d(z_2)) = 0$. But $z$ is a cocycle too, so $d(z_2) = 0 \\implies d(f(z_2)) = 0$.\r\n\r\n---\r\n\r\n < sup > * < /sup > If you&#39;re not satisfied, you should reread Chapter IV. In particular, they explain that if $T(-,-)$ is a functor contravariant in the first variable and covariant in the second (like $\\operatorname{Hom}$), then for cochain complexes $A^*$ and $B^*$, $T(A,B)$ has a double grading with $T(A,B)^{(p,q)} = T(A^{-p}, B^q)$ (you need the minus sign because $T$ inverts the direction of the differential of $A$). And so the associated graded complex is has in degree $n$:\r\n$$T(A,B)^n = \\bigoplus_{p+q=n} T(A^{-p}, B^q),$$\r\nwhich, when applied to $T = \\operatorname{Hom}$, gives you the result.", "278" ], [ "Your mistake is in the equality $\\tilde{H}^2(S^2 \\times (D^2, S^1)) = \\tilde{H}^2(S^2 \\times S^2)$ you wrote. It might be a bit easier to see why this is false in one dimension lower. Consider the trivial bundle $S^1 \\times D^1 \\to S^1$ instead. In the proof you would consider $(S^1 \\times D^1, S^1 \\times S^0)$, and it might be tempting to write $H^1(S^1 \\times (D^1, S^0)) = H^1(S^1 \\times S^1)$.\r\n\r\nBut this is false! When you look at the quotient $(S^1 \\times D^1) / (S^1 \\times S^0)$ (which you implicitly do), this is not a torus. You collapse *all* the boundary to one point, and so you get a torus with the whole inner circle collapsed, or equivalently a 2-sphere with two points identified. And the first cohomology group of this is $\\mathbb{Z}$ as expected, in fact it&#39;s homotopy equivalent to $S^2 \\vee S^1$.\r\n\r\nMore generally the problem is that $(X \\times Y) / (X \\times Z)$ is not $X \\times (Y/Z)$.", "731" ], [ "Let $M$ be a smooth manifold of dimension $n$. Consider the space $V_k(M)$ of pairs $(x,\\alpha)$ where $x \\in M$ and $\\alpha$ is a linear embedding $\\mathbb{R}^k \\hookrightarrow T_x M$ (or equivalently, $k$ independent vectors in $T_xM$). This is topologized as a subspace of $M \\times \\operatorname{Map}(\\mathbb{R}^k, TM)$ and it fibers over $M$ with $(x,\\alpha) \\mapsto x$. The fiber is (homotopy equivalent to) the Stiefel manifold $V_k(\\mathbb{R}^n) = O(n) / O(n-k)$.\r\n\r\nA slight variation of this requires an oriented manifold $M$ and asks gives a subspace $V&#39;_k(M) \\subset V_k(M)$ where the $\\alpha$ are required to preserve orientation. The fiber is then $SO(n) / SO(n-k)$. I&#39;m most interested in the case $k = n$, if it makes any difference.\r\n\r\nHow is this construction called? What do we know about the resulting manifold (the total space of the bundle)?\r\n\r\nI know that if $M$ is parallelized, then both bundles are trivial, respectively $V_k(M) \\cong M \\times V_k(\\mathbb{R}^n)$ and $V_k(M) \\cong M \\times V&#39;_k(\\mathbb{R}^n)$. Simply take a trivialization $\\phi : M \\times \\mathbb{R}^n \\to TM$, then there is an obvious map $M \\times V_k(\\mathbb{R}^n) \\to V_k(M)$, $(x,v_1,\\dots,v_k) \\mapsto (x,\\phi(v_1),\\dots,\\phi(v_k))$. More generally like all $SO(n)$ bundles $V&#39;_k(M)$ < del > is characterized by the <PERSON> class and the <PERSON> classes < /del > has an <PERSON> class and <PERSON> classes & ndash; what is the precise relationship? Are they related to the classes of the tangent bundle of $TM$ itself? I was not even able to say what $V&#39;_2(S^2)$ looks like &#128533;.", "278" ], [ "The category of rings (or more generally the category of algebras over a ring, a ring being a $\\mathbb{Z}$-algebra) has enough projectives. Let $A$ be a ring. Since the category of abelian group is known to have enough projectives, there is a projective abelian group $P$ and a surjective group morphism $q : P \\to A$. Now consider the tensor algebra on $P$:\r\n$$T(P) = \\bigoplus_{k = 0}^\\infty A^{\\otimes k}$$\r\n(the tensor product is over $\\mathbb{Z}$). This is a ring: the product is concatenation of tensors\r\n$$(x_1 \\otimes \\dots \\otimes x_n) \\cdot (y_1 \\otimes \\dots \\otimes y_m) := x_1 \\otimes \\dots \\otimes x_n \\otimes y_1 \\otimes \\dots \\otimes y_m,$$\r\nand the unit is the unit of $A^{\\otimes 0} = \\mathbb{Z}$. It maps into $A$ by sending $x_1 \\otimes \\dots \\otimes x_n$ to $q(x_1) \\dots q(x_n)$, the map being obviously surjective.\r\n\r\nMoreover $T(P)$ is projective. Let $f : B \\to C$ be a surjective ring morphism, and $g : T(P) \\to C$ be a ring morphism. Compose $g$ with the injection $i : P = P^{\\otimes 1} \\to T(P)$ to get a group morphism $g \\circ i : P \\to C$. Since $P$ is projective as an abelian group, $g \\circ i$ admits a lift $h : P \\to B$ such that $f \\circ h = g \\circ i$. Now let\r\n\r\n\\begin{align}\r\n\\bar{h} : T(P) & \\to B \\\\\r\nx_1 \\otimes \\dots \\otimes x_n & \\mapsto h(x_1) \\dots h(x_n)\r\n\\end{align}\r\n\r\nThen this is obviously a ring morphism, and $f \\circ \\bar{h} \\circ i = f \\circ h = g \\circ i$. Since a ring morphism $m : T(P) \\to Z$ is uniquely determined by the abelian group morphism $m \\circ i$ (this is easy to verify), it follows that $f \\circ \\bar{h} = g$, and so $T(P)$ is projective as claimed.", "476" ], [ "It appears that (as <PERSON> mentions in the comments) the correct notion of \" ;connected \" ; for a category is usually a category *which is inhabited* (i.e. has at least one object) and such that between every pair of objects there is a zigzag of arrows connecting them. It&#39;s a small oversight on MacLane&#39;s part.\r\n\r\nIt&#39;s a recurring theme in category theory (and algebraic topology), one has to be careful about some definitions to make sure the empty case is handled properly. It&#39;s the same with topological spaces: a topological space is typically called \" ;connected \" ; if it has *exactly two* clopen subspaces, namely the empty set and itself. This prevents the space from being empty. Since it&#39;s reasonable to expect that a category is connected iff its nerve is, then this excludes the empty category.\r\n\r\nAnother example to understand why the empty space is often not said to be connected is the following reformulation: \" ;a space $X$ is connected iff $\\operatorname{Map}(X,-)$ preserves coproducts \" ;. In other words, maps from $X$ to a disjoint union $A \\sqcup B$ are either maps $X \\to A$ or maps $X \\to B$. But $$\\operatorname{Map}(\\varnothing, A \\sqcup B) = \\{\\varnothing\\} \\not\\cong \\operatorname{Map}(\\varnothing,A) \\sqcup \\operatorname{Map}(\\varnothing,B) = \\{\\varnothing_A, \\varnothing_B\\}.$$\r\n\r\n(And in fact you see that my sentence that begins with \" ;in other words \" ; is a bit ambiguous: a map $\\varnothing \\to A \\sqcup B$ is either a map $\\varnothing \\to A$ or a map $\\varnothing \\to B$, but both of these are the same...!)\r\n\r\nThe exact same thing happens with categories. You&#39;ve also correctly identified one other reason that the empty category shouldn&#39;t be called connected: the limit of the empty diagram is indeed always the terminal object if it exists (this is correct), whereas if $\\varnothing$ were connected the limit of the \" ;constant \" ; functor $\\varnothing \\to \\mathcal{C}$ that maps \" ;everything \" ; to $c$ would be $c$.\r\n\r\n---\r\n\r\nPS: And in fact the identity $\\varnothing \\to \\varnothing$ is not constant! For the (correct, IMO) definition of a constant map $X \\to Y$ is $\\exists y \\in Y, \\forall x \\in X, f(x) = y$. This explains why the definition \" ;$X$ is contractible iff $\\operatorname{id}_X$ is homotopic to a constant map \" ; is correct and excludes the empty space. *(Thanks to <PERSON> for pointing out an error in an earlier version of this paragraph.)*", "208" ], [ "They are not doing the same thing: `\\dots` is a single character when rendered, but `...` is three characters when rendered. If I&#39;m not mistaken, this could cause an automatic line break inside the \" ;... \" ;. The spacing is also different around `\\dots` (there is more space before the first dot). Moreover, `\\dots` is sensitive to context, compare $x_1 + \\dots + x_n$ (with `\\dots`) to $x_1 + ... + x_n$ (with `...`): in the first one the dots are in the middle, while with the second one the dots are on the bottom, and you can also see that the spacing looks bad with `...`.", "655" ], [ "It&#39;s exactly as if $x_k$ were the $k$th face of some $n$-simplex $y$ (i.e. $x_k = d_k y$), except that the full simplex $y$ may not necessarily exist. As <PERSON> suggest in the comments, drawing a picture is quite helpful. For example when $n = 2$ and $i = 0$, this looks like this:\r\n\r\n[![enter image description here][1]][1]\r\n\r\nFor $n=3$ it looks like a (hollow) tetrahedron with the face opposite to the vertex $i$ removed; the $x_k$ are the remaining faces (with $x_k$ being opposite to the vertex $k$). When the simplex $y$ exists for all combinations of matching faces, the simplicial set is said to be a Kan complex, or fibrant.\r\n\r\n\r\n [1]: _URL_0_", "316" ], [ "\" ;The community \" ; in this case means \" ;five users including the OP \" ;. If five users disagree with a moderator, it does not mean the community as a whole disagree with the moderator. It means five users do. Moderators are expressly given the power to overrule other users for when they believe the process did not work as intended. This is the whole reason to elect moderators & ndash; I believe the correct term is \" ;human exception handler \" ;. They handle exceptional situations, including when five users make what they consider to be the wrong decision.\r\n\r\nIf you still disagree with their actions, you can open up a meta thread and see what the actual community thinks, and if there is agreement amongst everyone that the question deserves to be reopened, then yes, it would probably be inappropriate for the moderator to close it again. But before that it&#39;s perfectly acceptable for them to act as they think is best. If a moderator thought the question deserved to be closed, and then the question is reopened without anything having changed, it&#39;s only logical that they still believe that the question deserves to be closed.\r\n\r\nLet me also point out that the question \" ;[Should we allow moderators to unilaterally close questions?](_URL_0_) \" ; was met with a very clear \" ;yes \" ; by the (actual) community. Consider also this: it takes five users to close a question. Does this mean a moderator can never reopen a question (except perhaps by casting the last vote), ever?", "101" ], [ "The $(\\impliedby)$ direction is false. Consider the space $X = \\{a,b\\}$ with the discrete topology (i.e. all subsets are open), and the space $Y = \\{c,d\\}$ with the topology $\\{\\varnothing, \\{c\\}, Y\\}$ (so the singleton $\\{c\\}$ is open but not closed). Then $f : X \\to Y$, $f(a) = c$ and $f(b) = d$, is clearly not a homeomorphism. However, it satisfies the condition of your question: the restrictions $\\{a\\} \\cong \\{c\\}$ and $\\{b\\} \\cong \\{d\\}$ are both homeomorphisms.\r\n\r\nThe other direction $(\\implies)$ is true whether the two spaces are Hausdorff or not, though, as the proof of <PERSON> shows.\r\n\r\nSo logically, you can use the $(\\implies)$ direction to show that if you have two spaces $X$ and $Y$, and if for some $x \\in X$ and **for all** $y \\in Y$, $X \\setminus x$ and $Y \\setminus y$ are not homeomorphic, then $X$ and $Y$ are not homeomorphic. Note that it&#39;s not sufficient to show that for some $x$ and some $y$ the spaces $X \\setminus x$ and $Y \\setminus y$ are not homeomorphic; $[0,1]$ is clearly homeomorphic to itself, but $[0,1] \\setminus 0$ is not homeomorphic to $[0,1] \\setminus \\frac{1}{2}$. But even if $X \\setminus x$ is homeomorphic to $Y \\setminus y$ for all $x$ and $y$, it&#39;s possible for $X$ and $Y$ not to be homeomorphic at all.", "778" ], [ "If the best argument you can find for your question to remain open is \" ;it won&#39;t make the site crash \" ; and \" ;it slipped through the cracks back in April so now it should remain open forever \" ;, then I don&#39;t think you quite understand how this website works. In any case, your question was apparently nothing more than a soapbox for you to expose your... peculiar conceptions about limits and sets. The qualifiers \" ;harmless little question \" ; also appear to be at odds with the staggering 12 downvotes it received.", "359" ], [ "The old HTML-CSS renderer was configured to allow automatic line breaks in long formulas:\r\n\r\n\r\n < script type= \" ;text/x-mathjax-config \" ; > \r\n MathJax.Hub.Config({ \" ;HTML-CSS \" ;: [...], linebreaks: { automatic:true }, [...]\r\n [...]\r\n });\r\n < /script > \r\n\r\nHowever, the new CommonHTML renderer is not configured as such, and so long formulas overflow the width of the post. I guess it&#39;s an oversight (that would be rather easy to fix). The [MathJaX docs](_URL_1_) recommends these options for automatic line breaking:\r\n\r\n < script type= \" ;text/x-mathjax-config \" ; > \r\n MathJax.Hub.Config({\r\n CommonHTML: { linebreaks: { automatic: true } },\r\n \" ;HTML-CSS \" ;: { linebreaks: { automatic: true } },\r\n SVG: { linebreaks: { automatic: true } }\r\n });\r\n < /script > \r\n\r\n---\r\n\r\n(This was [previously reported in the MathJaX 2.6 beta thread](_URL_0_), but since it seems to be a configuration error on SE&#39;s end rather than a bug in MathJaX, I thought it would be best to report it in its own thread.)", "514" ], [ "No, I didn&#39;t read either the question nor the title, I just typed random words... What the hell kind of question is that? The word \" ;induces \" ; appears only once in your question and isn&#39;t defined. Instead of assuming I didn&#39;t read your question, perhaps consider that it may not be as clear as possible. Have a good day.", "633" ], [ "So you don&#39;t see the difference between \" ;Each sub-thing induces **a** widget \" ; and \" ;The whole collection of sub-things is equipped with a way of associating a widget induced by every sub-thing \" ;? It seems to me that precision is important. Since I can&#39;t read your mind, I don&#39;t know if you&#39;re interested in the former or the latter, even with the first paragraph, since the question was formulated differently. I&#39;ve removed my vote to close as unclear, anyway.", "432" ], [ "I don&#39;t think most users are even aware that a blog exists. Its only sign of existence on main is a temporary entry (when there&#39;s a new post and when it was announced) in the \" ;Featured \" ; box in the sidebar -- you know, the one that looks like an ad and that most people ignore. The submission process is also rather obscure and one must jumps through a few hoops to even find the FAQ from the blog&#39;s main page (I don&#39;t think a link buried in a paragraph in the \" ;about \" ; page is sufficient...).", "724" ], [ "Users are directed to meta when their questions get closed, by other users in the comments, from the help pages... The use of meta is completely transparent for someone who knows how to use the main site, whereas the publication process for the blog is more involved. Same for chat: mentioned in the help pages, the system automatically redirects you there for long discussions, very easy to use for any user. Besides, it take significantly more efforts to produce a blog post than it takes to ask a question on meta. Now combine the two effects.", "109" ], [ "Operads are to multicategories (a.k.a. colored operads) what polycategories with one object are to polycategories. There is no special name for polycategories with one object that I&#39;m aware of.\r\n\r\nThey encode \" ;bialgebras \" ; consisting of one object and multiple operations and cooperations (each with multiple inputs/outputs), whereas general polycategories encode bialgebras consisting of multiple objects and multiple operations and cooperations between them. They&#39;re not much more mysterious than polycategories.\r\n\r\nThese differ from the better-known PROPs in the shape of possible compositions (see [here](_URL_0_)): suppose you have two morphisms $f : a \\to (b,b)$ and $g : (b,b) \\to c$, where $a$, $b$, $c$ are colors (objects). In a PROP you can plug both outputs of $f$ to the inputs of $g$ to get $g \\circ f : a \\to c$, wheras in a polycategory you can only plug one of the outputs of $f$ to one of the input of $g$ to get $g \\circ_{i,j} f : a \\to (b,c)$ (or $(c,b)$).", "208" ], [ "You read incorrectly. $\\phi^{*-1}$ is not an application $\\operatorname{Spec} A \\to \\operatorname{Spec} B$; it is the \" ;preimage \" ; operation from *subsets* of $\\operatorname{Spec} A$ to *subsets* of $\\operatorname{Spec} B$. It is induced by $\\phi^* : \\operatorname{Spec} B \\to \\operatorname{Spec} A$ just like any map of sets $f : X \\to Y$ induces a map $f^{-1} : P(Y) \\to P(X)$, defined by\r\n$$f^{-1}(U) = \\{ x \\in X : f(x) \\in U \\}.$$\r\n\r\nFor some context, the equation written in the book is (among others) $\\phi^{*-1}(V(\\mathfrak{a})) = V(\\mathfrak{a}^e)$, where $\\mathfrak{a}$ is a prime ideal of $A$ and $\\phi : A \\to B$. Here $V(\\mathfrak{a})$ is a *subset* of $\\operatorname{Spec} A$, not an element of it.", "695" ], [ "What&#39;s wrong with the paragraph starting with \" ;In the real case, a bit more work needs to be done. For the oriented Grassmanian, it&#39;s enough to note that the canonical map $SO(k)\\rightarrow SO(n)$ is a surjection on $\\pi_1$... \" ; in the answer you link? It gives a complete answer. Do you understand how the homotopy long exact sequence associated to the fiber bundle $H \\to G \\to G/H$ works?", "731" ], [ "I&#39;ll try to fill in some of the missing details, hopefully this will be enough. Let the unoriented Grassmanian be $X = \\widetilde{\\mathrm{Gr}}(k, \\mathbb{R}^n) \\cong SO(n) / (SO(k) \\times SO(n-k))$. Assume $0 < k < n$ (otherwise there&#39;s not much to prove). There is thus a fiber bundle $SO(n) \\to X$, with fiber $SO(k) \\times SO(n-k)$. Since $SO(n)$ is path connected, so is $X$. This fiber bundle then induces a homotopy long exact sequence:\r\n$$\\dots \\to \\pi_1(SO(k) \\times SO(n-k)) \\to \\pi_1(SO(n)) \\to \\pi_1(X) \\to 1.$$\r\nOne must see that $\\pi_1(SO(k) \\times SO(n-k)) \\to \\pi_1(SO(n))$ is surjective to prove the claim about $X$. It is sufficient to prove that $\\pi_1(SO(k)) \\to \\pi_1(SO(n))$ is surjective when $2 \\le k \\le n$ (because if $k = 1$, then $n-k = n-1 \\ge 2$).\r\n\r\nLet $S^{n-1} \\subset \\mathbb{R}^{n}$ be the standard $(n-1)$-sphere, and let $e_n = (0,\\dots,0,1) \\in S^{n-1}$ be the last standard basis vector. The application $SO(n) \\to S^{n-1}$, $A \\mapsto A \\cdot e_n$, is a fiber bundle. Its fiber $F$ over $e_n$ is the subgroup of $SO(n)$ consisting of block matrices of the type $$\\begin{pmatrix} A&#39; & 0 \\\\ 0 & 1 \\end{pmatrix}$$\r\nwhere $A&#39;$ is an $(n-1) \\times (n-1)$ matrix. This subgroup is isomorphic to $SO(n-1)$. You thus get a homotopy long exact sequence associated to $SO(n-1) \\to SO(n) \\to S^{n-1}$. There are two cases:\r\n\r\n* when $n \\ge 4$, $S^{n-1}$ is 2-connected, and the LES tells you that $\\pi_1(SO(n-1)) \\to \\pi_1(SO(n))$ is an isomorphism.\r\n* when $n = 3$, there is a short exact sequence $0 \\to \\mathbb{Z} \\to \\pi_1(SO(2)) \\to \\pi_1(SO(3)) \\to 0$. In particular $\\pi_1(SO(2)) \\to \\pi_1(SO(3))$ is surjective. (We do not need this, but this short exact sequence is isomorphic to $0 \\to \\mathbb{Z} \\to \\mathbb{Z} \\to \\mathbb{Z}/2\\mathbb{Z} \\to 0$).\r\n\r\nBy induction, you find that $\\pi_1(SO(k)) \\to \\pi_1(SO(n))$ is surjective for $k \\ge 2$ (in fact it&#39;s an isomorphism when $k \\ge 3$). Going back to the long exact sequence of the beginning, this implies that $\\pi_1(SO(k) \\times SO(n-k)) \\to \\pi_1(SO(n))$ is surjective for $1 \\le k \\le n$ and $n \\ge 3$, and this $\\pi_1(X) = \\pi_1(\\widetilde{\\mathrm{Gr}}_k(\\mathbb{R}^n)) = 0$", "731" ], [ "> <PERSON> and <PERSON>. “Homotopy theories and model categories”. In: *Handbook of algebraic topology*. Amsterdam: North-Holland, 1995, pp. 73–126. DOI: [10.1016/B978-044481779-2/50003-1](_URL_0_). [MR1361887](_URL_1_).\r\n\r\nThis paper is an introduction to the theory of model categories. The prerequisites needed to read it are very limited, and most (if not all) the proofs are detailed. All the basics of model categories are explained: basic definitions, homotopy category, derived functors, homotopy pushouts and pullbacks... Two fundamental examples (topological spaces and bounded below chains complexes) are also made explicit.", "278" ], [ "> **Resolved:** The tag has been removed from all questions.\r\n\r\nWhat on Earth is the tag [tag:algebraic-identities] for? It seems to me that questions containing at least one equal sign get randomly tagged with it, including questions that have nothing to do with algebra. [The tag excerpt](_URL_0_) (there&#39;s no tag wiki) mentions \" ;algebraic structures \" ;, which I guess includes identities in general groups, rings... But from my limited understanding, algebra is already all about identities anyway; besides the tag is clearly used mostly for something else.\r\n\r\nI don&#39;t really see what good this tag is, and I propose to remove it.", "423" ], [ "You forgot the $H_0(S^1) = \\mathbb{Z}$ (you wrote $0$ instead). The long exact sequence is actually:\r\n\r\n$$\\dots \\to \\underbrace{H_1(S^1 \\setminus \\{x\\})}_{= 0} \\to \\underbrace{H_1(S^1)}_{= \\mathbb{Z}} \\to H_1(S^1, S^1 \\setminus \\{x\\}) \\to \\underbrace{H_0(S^1 \\setminus \\{x\\})}_{= \\mathbb{Z}} \\to \\underbrace{H_0(S^1)}_{= \\mathbb{Z}} \\to \\underbrace{H_0(S^1, S^1 \\setminus \\{x\\})}_{= 0}$$\r\nAnd now the induced map $H_0(S^1 \\setminus \\{x\\}) \\to H_0(S^1)$ is an isomorphism (because both spaces only have one path-component). So the image of $H_1(S^1, S^1 \\setminus \\{x\\}) \\to H_0(S^1 \\setminus \\{x\\})$ is zero (= the kernel of the next morphism), and thus by exactness $H_1(S^1) \\to H_1(S^1, S^1 \\setminus \\{x\\})$ is surjective. It is also injective (again by exactness), so it&#39;s an isomorphism.\r\n\r\n---\r\n\r\nThe easiest method is probably to use reduced homology, though. The long exact sequence becomes:\r\n$$\\underbrace{\\tilde{H}_1(S^1 \\setminus \\{x\\})}_{= 0} \\to \\tilde{H}_1(S^1) \\to \\tilde{H}_1(S^1, S^1 \\setminus \\{x\\}) \\to \\underbrace{\\tilde{H}_0(S^1 \\setminus \\{x\\})}_{= 0}$$\r\nand so the claim is immediately proven (because $\\tilde{H}_1 = H_1$).", "731" ], [ "No, it is not true. For example take the presheaf $F$ on $\\mathsf{Set}$ itself (which is bicomplete, locally small, everything we could want) given by $F(X) = \\{0,1\\}$ for all sets $X$ (and all maps are mapped to the identity). Then $F$ is not representable, because there is no set $Z$ such that $\\operatorname{Map}(X,Z)$ has two elements for all sets $X$.\r\n\r\nThe flaw in your argument can be made evident here: $F$ itself is the coproduct (as a functor!) of the representable presheaf $\\operatorname{Map}(-, *)$ with itself, where $* \\in \\mathsf{Set}$ is some singleton, i.e. $F \\cong Y(*) \\sqcup Y(*)$. But $F$ is not isomorphic to $Y(* \\sqcup *)$. The fact is, $Y$ does not preserve colimits: it preserves limits. It&#39;s not true that $\\operatorname{Hom}(-, \\operatorname{colim}_i X_i) \\cong \\operatorname{colim}_i \\operatorname{Hom}(-, X_i)$, but it&#39;s true that $\\operatorname{Hom}(-, \\lim_i X_i) \\cong \\lim_i \\operatorname{Hom}(-, X_i)$.", "1" ], [ "@MathematicsStudent1122 Not only is this patently false, but not even all Europeans use the Latin/Greek alphabet. Surely even in your warped world view Russian mathematicians exist? And what bearing does the language your ancestors spoke have on the alphabet you use? Half of my ancestors spoke and wrote Arabic, it doesn&#39;t mean I&#39;m going to use Arabic letters in my writing.", "216" ], [ "The question was written using the first person, but I disagree with the \" ;seeking personal advice \" ; closure. Asking if one needs set theory to learn category theory is IMO acceptable; the close reason was created for questions like \" ;Should I take Set Theory II at my university before or after Topology III \" ; which are way too localized.", "727" ], [ "Oh dear, the terminology... What you call a \" ;spotted set \" ; is almost universally called a *pair* of sets. Your category of \" ;spotted sets \" ; is, unsurprisingly, called the category of pairs of sets. I would *strongly* advise against calling your category $\\mathsf{sSet}$, which is also almost universally the name of the category of *simplicial* sets, a completely different thing.", "413" ], [ "Since $H_1(X) = \\pi_1(X)_{ab} = \\pi_1(X) / [\\pi_1(X), \\pi_1(X)]$, if $f$ were trivial in $H_1(X)$, then it would be conjugate (in $\\pi_1(X)$) to a finite product of commutators:\r\n$$f = g [u_1, v_1] \\dots [u_k, v_k] g^{-1},$$\r\nfor some $g, u_i, v_i \\in \\pi_1(X)$. The retraction $X \\to \\bigvee_{i=1}^{k+1} S^1$ onto the $(k+1)$st circles induces on the fundamental group a map that sends $f$ to $[x_1, x_2] [x_3,x_4] \\dots [x_{2k+1},x_{2k+2}]$, while it sends $g [u_1, v_1] \\dots [u_k, v_k] g^{-1}$ to the conjugate of a product of $k$ commutators.\r\n\r\nUsing the same technique as in Exercise 12, you can use this relation to construct a map $M_k \\to M_{k+1}$ of degree $1$, which is a contradiction by Exercise 11 (the conjugate does not really change much). So $f$ cannot be expressed as a conjugate of a finite number of commutators, and so is nontrivial in $H_1(X)$.", "731" ], [ "Your first equation reads\r\n$$I_n = \\frac{1}{2^n} + 2nI_n - 2nI_{n+1}$$\r\nSubtract $I_n$ from both sides and then add $2nI_{n+1}$ to both sides. This becomes:\r\n$$2nI_{n+1} = \\frac{1}{2^n} + (2n-1) I_n$$\r\nas written in your book. There&#39;s no substitution involved, just a subtraction and an addition to both sides of an equation.\r\n\r\nPS: This is why you should put $\\iff$ signs between equivalent equations... At the very least it makes clear to everyone that it&#39;s a new equation, not the continuation of the preceding string of equal signs.", "699" ], [ "The reference for [Hilton&#39;s theorem](_URL_0_) is\r\n\r\n > <PERSON>, P. J. (1955), \" ;On the homotopy groups of the union of spheres \" ;, *Journal of the London Mathematical Society*. Second Series 30 (2): 154–172, doi:[10.1112/jlms/s1-30.2.154](_URL_1_), ISSN 0024-6107, [MR0068218](_URL_3_).\r\n\r\nIn fact it&#39;s difficult to work out combinatorially which spheres appear in the decomposition of $\\Omega(S^n \\vee S^m)$. A possible reference is in\r\n\r\n > <PERSON>. *Modern classical homotopy theory*. Graduate Studies in Mathematics 127. American Mathematical Society, Providence, RI, 2011, pp. xxii+835. ISBN: 978-0-8218-5286-6. [MR2839990](_URL_2_).\r\n\r\nMore precisely Problem 17.68. The Hilton–Milnor–Gray theorem states that:\r\n\r\n > **Theorem** (Hilton–Milnor–Gray). If $A$ and $B$ are well-pointed spaces, then $$\\Omega(\\Sigma A \\vee \\Sigma B) \\simeq \\Omega(\\Sigma A) \\times \\Omega\\Sigma \\left( B \\vee \\bigvee_{n=1}^\\infty B \\wedge A^{\\wedge n} \\right).$$\r\n\r\nIf $m \\le n$, you can apply this theorem to compute $\\Omega(S^m \\vee S^n)$ inductively, because the second term in the product will always become more and more connected, and so the map to the product you find will have a contractible homotopy fiber. According to <PERSON> it was done by <PERSON> and put in bijection with the generators of a free Lie algebra, but I didn&#39;t find a reference.\r\n\r\nTo give an example of computation, here is the beginning for $\\Omega\\Sigma(S^2 \\vee S^2)$:\r\n$$\\Omega(\\Sigma S^1 \\vee \\Sigma S^1) \\simeq \\Omega\\Sigma S^1 \\times \\Omega\\Sigma \\left( S^1 \\vee \\bigvee_{n=1}^\\infty S^1 \\wedge (S^1)^{\\wedge n} \\right) \\\\\r\n\\simeq \\Omega S^2 \\times \\Omega\\Sigma \\left(S^1 \\vee \\bigvee_{n=1}^\\infty S^{n+1} \\right) \\\\\r\n\\simeq \\Omega S^2 \\times \\Omega \\left( S^2 \\vee \\Sigma \\left(\\bigvee_{n=1}^\\infty S^{n+1} \\right) \\right) \\\\\r\n\\simeq \\Omega S^2 \\times \\Omega S^2 \\times \\Omega\\Sigma\\left( \\bigvee_{n=1}^\\infty S^{n+1} \\vee \\bigvee_{k=1}^\\infty \\bigvee_{n=1}^\\infty S^{k+n} \\right)$$\r\nand after that it gets complicated.", "737" ], [ "Assume that $\\mathbf{A}$ is pointed with a terminal object $*$. We want to show that $\\hom(*,X)$ has only one element for all $X \\in \\mathbf{A}$, i.e. $*$ is also initial (this will show $(i) \\implies (ii)$). By pointedness, there&#39;s a morphism $0_X : * \\to X$ such that for all $f,g : X \\to Y$, $f \\circ 0_X = g \\circ 0_X$. For $X = *$, this morphism $0_*$ has to be the identity $\\operatorname{id}_*$, for there is only one morphism $* \\to *$ ($*$ is terminal).\r\n\r\nHence if $f : * \\to X$ is some other morphism (for an arbitrary $X$), then\r\n$$f = f \\circ \\operatorname{id}_* = f \\circ 0_* = 0_X \\circ 0_* = 0_X \\circ \\operatorname{id}_* = 0_X.$$\r\n\r\nThis proves that $*$ is in fact initial: $\\hom(*,X) = \\{0_X\\}$.", "731" ], [ "First, [as explained in this meta post](_URL_1_), you should *always* mark your formulas as math using dollar signs or the such. This is for people with screen readers, automatic processing of posts... A bare `θ`, if it&#39;s supposed to represent a math variable, is no good. (Of course if you&#39;re writing something in Greek then you should *not* mark it as math.)\r\n\r\nNow, MathJax has a feature that makes `$θ$` and `$\\theta$` have the exact same output. So in this regard there&#39;s no difference. But consider these points:\r\n\r\n* Why use LaTeX commands for most things and Unicode characters for a small portion of them? It&#39;s not consistent. In your example `$\\sin(θ)$`, you have one LaTeX command and a Unicode character. In a big formula it would be even more jarring, IMO, especially if you use LaTeX commands for some symbols which exist in Unicode.\r\n* Some people do not know how to input these Unicode characters, or even think of copy-pasting them, and if they edit your formulas it will become even more inconsistent.\r\n* If you use Unicode characters in your formula, then you cannot directly use the formula anymore in a LaTeX document.\r\n* MathJax has this feature now, what if they decide to drop it to be more in line with LaTeX syntax? Or, what if SE decides to use another math formatting library in the future that doesn&#39;t have this feature? (It&#39;s not very realistic, but it could happen.)\r\n* For some symbols the font is different: compare $\\large &#120120;\\mathbb{A}$ (obtained with `$\\large &#120120;\\mathbb{A}$`). At least on my device I see [two different fonts](_URL_0_), and it&#39;s probably dependent on your OS, browser and installed fonts.\r\n\r\nThese are small downsides, but to be honest I can&#39;t think of any upside of using Unicode characters: they&#39;re hard to input for most people, compared to ASCII.", "971" ], [ "The requirement means that the set $\\{ i \\in I : f(i) \\neq 0_F \\}$ is finite. To put in other words, $f$ takes a nonzero value only a finite number of times.\r\n\r\nFor example consider the case $I = \\mathbb{N}$. Then the function $f \\in F^\\mathbb{N}$ that has $f(0) = 1_F$ and $f(n) = 0_F$ for $n \\ge 1$ is in $\\bigoplus_{i \\in \\mathbb{N}} F$, because the set $\\{ i \\in \\mathbb{N} : f(i) \\neq 0_F \\} = \\{0\\}$ is indeed finite.\r\n\r\nBut the function $g \\in F^\\mathbb{N}$ given by $g(n) = 1_F$ for all $n \\in \\mathbb{N}$ is not in $\\bigoplus_{i \\in \\mathbb{N}} F$, because $\\{i \\in \\mathbb{N} : g(i) \\neq 0_F\\}$ is $\\mathbb{N}$, which is infinite.", "695" ], [ "> Assume that the digits do not happen to start repeating interminably at a finite position (0.2210101010101010...), since the probability of this happening is 0.\r\n\r\nWell then it is irrational... A rational number has a decimal expansion that is eventually periodoc. If you assume that it isn&#39;t eventually periodic, then you&#39;re ruling out the case that it&#39;s rational.\r\n\r\nI think what you&#39;re confused about is that it doesn&#39;t matter how you generated your number; either it is rational, or it isn&#39;t. It is *possible* that your process will generate a rational number, though the probability that it does is indeed zero.\r\n\r\nAnd for that matter you cannot speak of *the* number generated by this process; many different number can be generated by this process, some are rational, some aren&#39;t. Every single number will have probability zero of occurring, and yet your process will always yield *some* number...", "513" ], [ "As <PERSON> says, a really important part of the <PERSON>–Zilber theorem is that the lax-monoidal structure map is a quasi-isomorphism. Nevertheless, reformulating the first part of the theorem as \" ;the functor $C_*(-)$ is lax-monoidal \" ; is helpful for applying general results to it. For example:\r\n\r\n---\r\n\r\n**Proposition.** Let $\\mathsf{C}$ and $\\mathsf{D}$ be symmetric monoidal categories, and $F : \\mathsf{C} \\to \\mathsf{D}$ a lax monoidal functor. Then $F$ induces a functor from monoid objects in $\\mathsf{C}$ to monoid objects in $\\mathsf{D}$.\r\n\r\n*Proof.* Let $M$ be a monoid object in $\\mathsf{C}$. The product morphism on $F(M)$ is given by\r\n$$F(M) \\otimes F(M) \\xrightarrow{\\text{lax monoidal}} F(M \\otimes M) \\xrightarrow{F(\\mu)} F(M)$$\r\nand the unit by\r\n$$1_\\mathsf{D} \\xrightarrow{\\text{lax monoidal}} F(\\mathsf{1}_C) \\xrightarrow{F(e)} F(M).$$\r\nThen it&#39;s easy to check that this gives $F(M)$ the structure of a group object, and that $F$ then defines a functor from group objects to group objects.\r\n\r\n**Corollary.** If $M$ is a topological monoid, then $C_*(M)$ is a monoid in the category of chain complexes, i.e. a dg-algebra.\r\n\r\n---\r\n\r\nThe proof is immediate from the <PERSON>–Zilber theorem, and it&#39;s helpful to split the proof in two parts in order not to get bogged down in technical details. More generally, if $\\mathtt{P}$ is a topological operad, then $C_*(\\mathtt{P})$ is a dg-operad, and if $A$ is a $\\mathtt{P}$-algebra, then $C_*(A)$ is a $C_*(\\mathtt{P})$-algebra.\r\n\r\nBasically, any sort of \" ;product \" ; structure can be transported from topological spaces to chain complexes; in general, this is \" ;the point \" ; of determining if a functor is lax monoidal or not. You would need an oplax monoidal functor to transform topological \" ;coproduct \" ; structures into coproduct dg-structures. The EZ functor isn&#39;t oplax monoidal, so in general you cannot expect it to turn \" ;coalgebras \" ; into \" ;coalgebras \" ;.", "208" ], [ "It&#39;s not that \" ;we need \" ; anything, it&#39;s just that a Poisson coalgebra is *defined* to be cocommutative, just like a Poisson algebra is *defined* to be commutative. It&#39;s a bit like asking why \" ;we need \" ; groups to be associative; we don&#39;t really \" ;need \" ; that, but it&#39;s what we study for various reasons. The study of quasigroups is interesting too, but sometimes we want to study groups for their own sake.\r\n\r\nIt&#39;s possible to consider (co)algebras with a Lie (co)bracket and a (co)associative (co)product that is not necessarily (co)commutative; but then you&#39;re not studying Poisson (co)algebras anymore, and the applications and results will be different. [Here&#39;s for example an article that studies so-called \" ;noncommutative Poisson algebras \" ;](_URL_0_) (I haven&#39;t read it, just searched on Google), and there are apparently things to be said, but it&#39;s a different structure.\r\n\r\n---\r\n\r\nPS: I realize that, for some reason, Wikipedia defines Poisson algebras to be just associative and not necessarily commutative. I cannot fathom why, to be honest, as both the references they cite define Poisson algebras to be commutative, and I myself have always ever seen Poisson algebras defined as commutative...", "663" ], [ "It&#39;s a bit like asking \" ;Why in the set $\\mathbb{N}$ the elements are $0$, $1$, $2$...? \" ; The answer is: because we define $\\mathbb{N}$ like that. If we chose different elements it would be an equally \" ;valid \" ; set, but it would be a different set and we wouldn&#39;t call it $\\mathbb{N}$.\r\n\r\nFor many applications, we want to consider the category with objects topological spaces and morphisms continuous functions. And it&#39;s so prevalent that people decided to call this category \" ;the category of topological spaces \" ; without more qualifiers, simply because it&#39;s shorter than \" ;the category of topological spaces and continuous functions \" ;. If you manage to cook up a category where the objects are topological spaces but the morphisms are something else (maps that aren&#39;t necessarily continuous, open maps...), then it&#39;s a \" ;valid \" ; category too, but it&#39;s not the one that most people call \" ;the category of topological spaces \" ;.", "208" ], [ "At least for me, the case of functions on a space was a good starting point for understanding sheaves.\r\n\r\nConsider a space $X$ (say, a topological space), and the presheaf $\\mathcal{O}_X$ of (continuous) maps: for $U \\subset X$ open, $\\mathcal{O}_X(U)$ is the set of continuous maps $U \\to \\mathbb{R}$. Then the sheaf condition says in particular that if you have two open subsets $U,V \\subset X$ and two continuous maps $f : U \\to \\mathbb{R}$ and $f : V \\to \\mathbb{R}$ that agree on the intersection $U \\cap V$ (i.e. $f(x) = g(x)$ for all $x \\in U \\cap V$), then there is a continuous map $h : U \\cup V \\to \\mathbb{R}$ such that $h(x) = f(x)$ for $x \\in U$ and $h(y) = g(y)$ for $y \\in V$.\r\n\r\nBut this is rather obvious (a direct consequence of the definition of subspace topology), and it&#39;s probably a fact that you&#39;ve known for a long time and use without thinking! Well, the gluing axiom for a sheaf is exactly the reformulation of this (and for a bunch of open subsets at once instead of just two). Pretty much all examples of sheaves I can think of are examples of \" ;functions \" ; satisfying some properties (sections of a bundle $E \\to X$ are functions $X \\supset U \\to E$, etc.), and the gluing axiom says that given functions on open subsets that agree on all the intersections, you can define a function on the union of everything. In terms of intuition, it&#39;s a good way to think about it.", "1" ], [ "The problem is in your first statement, what does the second \" ;: \" ; mean? It&#39;s an \" ;and \" ; statement, really:\r\n\r\n$$\\exists N \\in \\mathcal{F}, (\\mu(N) = 0 \\text{ and } \\forall x \\in \\Omega \\setminus N : P(x) \\ \\text{holds}).$$\r\n\r\nSo the negation becomes:\r\n\r\n$$\\forall N, (N \\not\\in \\mathcal{F}) \\text{ or } (\\mu(N) > 0 \\text{ or } \\exists x \\in \\Omega \\setminus N, P(x) \\text{ does not hold}).$$\r\n\r\nOr equivalently ($P \\text{ or } Q$ is the same as $\\neg Q \\implies P$):\r\n\r\n$$\\forall N, (N \\not \\in \\mathcal{F}) \\text{ or } ((\\forall x \\in \\Omega \\setminus N : P(x) \\ \\text{holds}) \\implies \\mu(N) > 0).$$\r\n\r\nIn English, if you have a measurable set such that $P(x)$ is true for all $x \\not\\in N$, then $N$ must have positive measure. Said in yet another way, you have to \" ;miss \" ; a set of positive measure if you want your statement to be true.\r\n\r\nAnd since of course you can always consider the set $N = \\{ x \\in \\Omega \\mid P(x) \\text{ does not hold} \\}$, it does mean that this $N$ has positive measure (or is not measurable, which is a bit annoying in theory but not really in practice).", "27" ], [ "Let $A$ be a cocommutative bialgebra object (or even a Hopf algebra) in a symmetric monoidal category. Define an operad $\\mathtt{P}_A$ by $\\mathtt{P}_A(r) = A^{\\otimes r}$ (so that $\\mathtt{P}_A(0) = 1$ is the unit of $\\otimes$), and the composition is given by the following formula:\r\n$$\\gamma(a_1 \\otimes \\dots \\otimes a_r; \\underline{b}_1, \\dots, \\underline{b}_r) := (a_1 \\cdot \\underline{b}_1 \\otimes \\dots \\otimes a_r \\cdot \\underline{b}_r)$$\r\nwhere $a_i \\in A$, $\\underline{b}_j \\in A^{\\otimes k_j}$, and $A^{\\otimes k}$ becomes an $A$-module using the cocommutative diagonal of $A$, and using the counit for $A^{\\otimes 0} = 1$ (I&#39;m writing this formula in the case of vector spaces, I don&#39;t want to draw a humongous commutative diagram; I hope the general definition is clear).\r\n\r\nIs this construction an example of a more general phenomenon / can it be described differently? It appears when defining semi-direct products of operads, for example. It feels like something rather simple that appears naturally (I don&#39;t know, maybe the free construction on something), but I can&#39;t write it as an application of a more general construction; I realize it&#39;s the semi-direct product $\\mathtt{Com} \\rtimes A$, but it feels a bit circular.", "344" ], [ "The problem is that $\\varphi(A \\sqcup B)$ is not equal to $\\varphi(A) + \\varphi(B)$. You didn&#39;t say how you proved that, so I can only guess, but $(A \\sqcup B) / B \\cong A \\sqcup *$, not $A$, so you get $\\varphi(A \\sqcup B) = \\varphi(A \\sqcup *) + \\varphi(B)$, and $\\varphi(A \\sqcup *) \\neq \\varphi(A)$. If $A$ is nonempty, take some point $x \\in A$ and then collapse $\\{x,*\\} \\cong S^0$ to get $\\varphi(A \\sqcup *) = \\varphi(A) + n$, hence if $A$ is nonempty (or symmetrically if $B$ is nonempty):\r\n$$\\varphi(A \\sqcup B) = \\varphi(A) + \\varphi(B) + n.$$\r\n\r\nIf it can help to guess how it works, notice that $\\varphi(X) := n \\cdot (\\chi(X) - 1)$ satisfies all the conditions. It&#39;s true that $\\chi(A \\sqcup B) = \\chi(A) + \\chi(B)$, but this doesn&#39;t hold for $\\varphi$ anymore.", "576" ], [ "@YvesDaoust A bare question with no context whatsoever, which, as it is, makes as much sense as \" ;Is the number zero purple? \" ;. Simply recalling the basic definition of differentiability yields either the answer \" ;no \" ; or \" ;it&#39;s a meaningless question \" ;. If OP had at least shown that they knew what \" ;differentiable \" ; meant and why on Earth they would think that this could apply to a discrete function, I wouldn&#39;t have downvoted, but as it is...", "675" ], [ "You have the right idea, but the notation is not very good. What you can do it something that looks like substitution in integral computation: let $y = y(h) = x+h \\iff h = y - x$, and now your expression becomes:\r\n$$\\lim_{h \\to 0} \\frac{f(x+h)-f(x)}{h} = \\lim_{y \\to x} \\frac{f(y)-f(x)}{y-x},$$\r\nand this is true.\r\n\r\nFormally, how does that works? You&#39;re computing the limit of some function $g_1(h) = \\frac{f(x+h)-f(x)}{h}$ with $h \\to 0$. Let $\\phi : \\mathbb{R} \\to \\mathbb{R}$ be defined by $\\phi(h) = x+h$. Then you can let $g_2(y) = \\frac{f(y) - f(x)}{y - x}$, so that:\r\n$$g_1(h) = g_2(\\phi(h)).$$\r\n\r\nIt&#39;s obvious that $\\lim_{h \\to 0} \\phi(h) = x$. So now, **if** $\\lim_{y \\to x} g_2(y) = l$ exists, then the theorem about limits and composition of functions < sup > * < /sup > implies that:\r\n$$\\lim_{h \\to 0} g_1(h) = \\lim_{h \\to 0} g_2(\\phi(h)) = \\lim_{y \\to \\lim_{h \\to 0} \\phi(h)} g_2(y) = \\lim_{y \\to x} g_2(y) = l.$$\r\n\r\nNote that I used a theorem here, it&#39;s not something completely obvious. It&#39;s usually not very hard, but you need to check that all the hypotheses of the theorem are satisfied.\r\n\r\n---\r\n\r\n < sup > * < /sup > The one that says that if $\\lim_{x \\to a} f(x) = b$ and $\\lim_{y \\to b} g(y) = c$, then $\\lim_{x \\to a} g(f(x)) = c$.", "388" ], [ "A question that one could ask is the following: if $U \\subset \\mathbb{R}$ is an open subset such that $\\mathbb{Q} \\subset U$, then is the measure of $U$ infinite?\r\n\r\nThe answer is no, as the (relatively) well-known following construction shows: since the rationals are countable, take a bijection $q : \\mathbb{N} \\to \\mathbb{Q}$. Now consider the following subset of $\\mathbb{R}$:\r\n$$U = \\bigcup_{n = 0}^\\infty (q_n - 2^{-n}, q_n + 2^{-n}).$$\r\nClearly this is an open subset of $\\mathbb{R}$ that contains $\\mathbb{Q}$. Moreover its Lebesgue measure is bounded above by $\\sum_{n=0}^\\infty 2 \\cdot 2^{-n} = 4$, and so $U$ has finite measure.\r\n\r\n---\r\n\r\nI&#39;ve known this fact and this construction for years, but I still can&#39;t \" ;wrap my head around it \" ;, so to speak. I understand it \" ;abstractly \" ; (I can check that each step is justified), but I don&#39;t have any intuition for it.\r\n\r\nIntuitively, I can&#39;t help but thinking that if I have a small open interval around each rational, then since there&#39;s a rational in every nonempty open interval of $\\mathbb{R}$, I will eventually end up with a ton of reals in my subset, enough for the measure to be infinite. But as the above construction shows, formalizing this intuition is hopeless.\r\n\r\nIs there an intuitive explanation for this fact? It does not seem to be something like the Banach & ndash;Tarski paradox where one must consider nonmeasurable subsets, for example: one can choose a completely explicit surjection $\\mathbb{N} \\to \\mathbb{Q}$ (e.g. $0/1, 1/1, 0/2, 1/2, 2/2\\dots$ and then interleave positive and negative numbers), and this is enough to make the above argument work (it doesn&#39;t matter that the intervals overlap).", "301" ], [ "Yes, this is true. First, by hypothesis $I$ is generated by the forms $\\omega_1, \\dots, \\omega_n$, which I guess are homogeneous, thus it&#39;ll always be a graded ideal. So $I$ is a differential ideal iff $d\\omega \\in I$ for all $\\omega \\in I$.\r\n\r\nIf $I$ is a differential ideal, then necessarily $d\\omega_i \\in I$ for all $i$; but by hypothesis, $I$ is generated by the $\\omega_j$, so $d\\omega_i = \\sum_j \\omega_{ij} \\wedge \\omega_j$ for some forms $\\omega_{ij}$.\r\n\r\nConversely, suppose $d\\omega_i = \\sum_j \\omega_{ij} \\wedge \\omega_j$ for all $i$. Let $\\omega \\in I$; since $I$ is generated by the $\\omega_i$, then $\\omega = \\sum_i \\alpha_i \\wedge \\omega_i$ for some forms $\\alpha_i$. Then\r\n$$d\\omega = \\sum_i d(\\alpha_i \\wedge \\omega_i) = \\sum_i (d\\alpha_i) \\wedge \\omega_i + \\sum_i \\sum_j \\pm \\alpha_i \\wedge \\omega_{ij} \\wedge \\omega_j.$$\r\nEach term in the sum is in $I$ (because $I$ is an ideal), so $d\\omega \\in I$, and $I$ is a differential ideal.", "967" ], [ "Your first attempt works and is probably the easiest way to go. The $\\tilde{X}$ you found is homotopy equivalent to an infinite bouquet of 2-spheres: $\\tilde{X} \\simeq \\bigvee_{n \\in \\mathbb{Z}} S^2$. There are various ways of computing $H_2(\\tilde{X})$:\r\n\r\n* $\\tilde{X}$ is the filtered colimit\r\n$$* \\subset S^2 \\subset \\bigvee_{n=-1}^1 S^2 \\subset \\bigvee_{n-2}^2 S^2 \\subset \\dots \\subset \\operatorname{colim}_{k \\ge 1} \\bigvee_{n=-k}^k S^2 = \\tilde{X}$$\r\nand since homology preserves filtered colimits, $$H_2(\\tilde{X}) = \\operatorname{colim}_{k \\ge 1} \\mathbb{Z}^{2k+1} = \\bigoplus_{n \\in \\mathbb{Z}} \\mathbb{Z} = \\mathbb{Z}^{(\\infty)}$$ is a direct sum of an infinite number of copies of $\\mathbb{Z}$.\r\n* Using cellular homology: the cellular complex of $\\tilde{X}$ has $\\mathbb{Z}$ in degree zero, $\\mathbb{Z}^{(\\infty)}$ in degree 2, and $0$ elsewhere. There cannot be any nontrivial differential for degree reasons, and so $H_2(\\tilde{X}) = \\mathbb{Z}^{(\\infty)}$.\r\n\r\nAs for the intuition, recall that $\\pi_1(X)$ always acts on $\\pi_n(X)$ for $n \\ge 1$ by \" ;prepending \" ; a loop or something similar. The inclusion $S^2 \\subset S^2 \\vee S^1$ gives an element $\\alpha \\in \\pi_2(X)$, which generates a cyclic subgroup.\r\n\r\nBut for the loop $\\gamma$ that goes around the $S^1$ factor once, $\\gamma \\cdot \\alpha \\in \\pi_2(X)$ is another element that is not homotopic to any other element of the cyclic subgroup generated by $\\alpha$. This $\\gamma \\cdot \\alpha$ generates a cyclic subgroup too. And it continues: for every $n \\in \\mathbb{Z}$, $\\gamma^n \\cdot \\alpha$ is an element of $\\pi_2(X)$, and they all generate disjoint cyclic subgroups in $\\pi_2(X)$. And now the argument above shows that these are all the elements of $\\pi_2(X)$.", "731" ], [ "You know, since $\\alpha$ is a cocycle, that $\\alpha \\circ d^A_n = 0$. However, you do not know that $\\hat\\alpha \\circ d^X_n = 0$! So $\\hat\\alpha$ is not even a cocycle. What you know is that, if $i_* : C_*(A) \\to C_*(X)$ is the inclusion, then\r\n$$\\hat\\alpha \\circ d^X_n \\circ i_{n+1} = \\hat\\alpha \\circ i_n \\circ d^A_n = \\alpha \\circ d^A_n = 0,$$\r\nand so by definition of $C^{n+1}(X,A;V)$, it follows that $\\hat\\alpha \\circ d^X_n \\in C^{n+1}(X;V)$ is in fact in $C^{n+1}(X,A;V)$, i.e. it vanishes on $C_{n+1}(A)$, and it is a cocycle.\r\n\r\nBut it is not a coboundary in $C^*(X,A;V)$, because it would need to be the codifferential of something in $C^n(X,A;V)$; but $\\hat\\alpha$ does not vanish (in general) on $C_n(A)$, so in general $\\hat\\alpha$ is in $C^n(X;V)$ but not in $C^n(X,A;V)$. So you cannot conclude from this that $\\hat\\alpha \\circ d^X_n$ is in the image of\r\n$$\\delta^n : C^n(X,A;V) \\to C^{n+1}(X,A;V),$$\r\ni.e. you cannot conclude that $\\hat\\alpha \\circ d_n^X$ is a coboundary in $C^*(X,A;V)$. The remark is correct.\r\n\r\n---\r\n\r\nPS: This is a general construction known as the [snake lemma](_URL_0_), applied to:\r\n$$\\require{AMScd}\r\n\\begin{CD}\r\n0 @ > > > C^n(X,A) @ > > > C^n(X) @ > > > C^n(A) @ > > > 0 \\\\\r\n@. @VVV @VVV @VVV \\\\\r\n0 @ > > > C^{n+1}(X,A) @ > > > C^{n+1}(X) @ > > > C^{n+1}(A) @ > > > 0\r\n\\end{CD}$$\r\nThe snake lemma is a very powerful tool in homological algebra.", "731" ], [ "Suppose that you have a homotopy equivalence $f : X \\to Y$ with homotopy inverse $g : Y \\to X$, where $Y$ is some discrete space (of any cardinality, finite or infinite). The space $X$ is compact, thus $f(X) \\subset Y$ is compact; but the only compact subspaces of a discrete space are finite, so $f(X)$ is finite.\r\n\r\nSince $f$ and $g$ are inverse homotopy equivalences, $f \\circ g$ is homotopic to $\\operatorname{id}_Y$, i.e. there is a homotopy $H : Y \\times [0,1] \\to Y$ with $H(y,0) = f(g(y))$ and $H(y,1) = y$. But $Y$ is discrete, so $H$ has to be constant on connected subspaces, and $\\{y\\} \\times [0,1]$ is connected, thus $f(g(y)) = y$. But the image of $f$ is finite, whereas the image of the identity is all of $Y$, so $Y$ is finite.\r\n\r\nBut $X$ has an infinite number of path-connected components (every singleton is a path-connected component), whereas a finite discrete space only has a finite number of path-connected components. Since a homotopy equivalence preserves the number of path-connected components, this is a contradiction.", "731" ], [ "> **Resolved:** Made a synonym of and merged with [tag:vector-analysis]\r\n\r\nApparently, [someone](_URL_0_) decided to create the tag [tag:vector-calculus], and the tag [tag:gradient] somehow instantly got made into a synonym of it. Considering that we already have tags [tag:multivariable-calculus] and [tag:vector-fields] (most questions in [tag:vector-calculus] are apparently about vector fields), I&#39;m wondering if this is a wise decision. Nobody bothered to write a tag excerpt/wiki for [tag:vector-calculus], so I don&#39;t know what the difference is.\r\n\r\nDo you think we need a tag [tag:vector-calculus] different from [tag:multivariable-calculus] and [tag:vector-fields]? Is yes, what is this tag for, precisely, and can you write a tag wiki/excerpt?", "423" ], [ "What you have, in fact (see e.g. the definition on [Wikipedia](_URL_0_)) is:\r\n$$\\sum (Sh_{(1)}) h_{(2)} = u(\\epsilon(h)) = \\dots$$\r\n\r\nYou need to use the unit to then make an element of $H$ from an element of $k$. Perhaps your book is implicitly using the unit here, because the equation couldn&#39;t really mean anything else: the image of $u$ inside $H$ is canonically identified with $k$. But if you want to be completely rigorous you need to write down the unit.", "757" ], [ "This is most probably the [pullback of the covering map $\\mathbb{R} \\to S^1$](_URL_0_). In a more general context, suppose that $p : E \\to B$ is some covering space, and $f : X \\to B$ is any continuous map. Then the linked Q & A shows that\r\n$$f^*E := E \\times_B X = \\{ (e,x) \\in E \\times X \\mid p(e) = f(x) \\}$$\r\nis a covering space via the projection $q : f^* E \\to X$, and there is also a projection $\\bar{f} : f^* E \\to E$ such that the diagram commutes ($p \\circ \\bar{f} = f \\circ q$).\r\n\r\nSince you&#39;re asked to prove that $p \\circ \\bar{f} = f \\circ q$, you probably have another definition of the pullback (because it is immediate with the definition I&#39;ve given), and we cannot just guess what it is. You&#39;ll have to search your notes more thoroughly.", "1" ], [ "The message does say \" ;Please improve **the question** \" ;. The **question** is, indeed, not any good right now: bad grammar and spelling, not even a question, and, yes, *no context*. If I went through the question sheet on integrals my students have and asked and answered each and every single one of them with no explanation or motivation, would that be a good thing for the site? I don&#39;t think so. But if the *question* included some motivation, explanation about problems encountered and so on, now maybe that would be interesting...", "359" ], [ "Context is also required to make the question useful for future visitors. I hope that we can agree that a question without context is not (at least less) useful for future visitors? What I would like to understand is: if use to future visitors is not a concern... Then what&#39;s the point of keeping the question? OP got their answer. And if it is a concern, then the question clearly doesn&#39;t meet standards relative to context (which directly impacts its use for future visitors) and keeping it 1/ sends a bad signal ( \" ;it&#39;s okay to post subpar questions \" ;) and 2/ dilutes the good content of the site.", "359" ], [ "The inclusion $* \\times X \\subset S^1 \\times X$ is a cofibration (the singleton $*$ is a sub-CW-complex of $S^1$, hence $* \\subset S^1$ is a cofibration, and [by this question](_URL_0_) the product of a cofibration with an identity map is a cofibration), thus:\r\n$$H^*(S^1 \\times X, * \\times X) \\cong \\tilde{H}^*\\bigl( (S^1 \\times X) / (* \\times X) \\bigr)$$\r\n(this is a standard fact, see e.g. <PERSON>, Proposition 2.22 which deals with the case of homology; the cohomological case is identical).\r\n\r\nSimilarly you have:\r\n$$H^*(D^1 \\times X, \\partial D^1 \\times X) \\cong \\tilde{H}^*\\bigl( (D^1 \\times X) / (\\partial D^1 \\times X) \\bigr).$$\r\n\r\nBut now the two spaces $(S^1 \\times X) / (* \\times X)$ and $(D^1 \\times X) / (\\partial D^1 \\times X)$ are homeomorphic: in the first one the boundary of $D^1$ is already collapsed, while in the second one you collapse at the same time the boundary of $D^1$ and the subspace corresponding to $* \\times X$ (drawing a picture might be helpful here). Thus they have isomorphic cohomology, and you get the result.", "731" ], [ "The whole Section 1.2 of Hatcher&#39;s book is dedicated to <PERSON>, where nonabelian fundamental groups are abundant. The more-or-less canonical example of the wedge sum $S^1 \\vee S^1$ is in particular described, and I find the explanation in the introduction of the section rather clear. You have two loops, $a$ and $b$, and it&#39;s not possible to find a homotopy *that preserves endpoints* between $ab$ and $ba$; just try it.\r\n\r\nPS: There are tons of examples in this section, and it starts *two pages* after the exercise you mention, so... Maybe next time try to read a little further.", "731" ], [ "@DavidK [_URL_1_] forbids this type of homework questions, so the migration will be rejected. Off-topic question = > downvote and vote to close. Answer to an off-topic question, encouraging others to post more off-topic questions = > downvote. And the burden is not on me to find a website where this question could be posted; it&#39;s on OP. I can vote to close and downvote if the question isn&#39;t fit for _URL_0_ without suggesting another website.", "369" ], [ "Here is a counterexample for finite (co)completeness when $n = 2$. Consider the two cobordisms $\\alpha, \\beta : S^1 \\to S^1$ given respectively by a cylinder and a cylinder with a hole. Then the equalizer of $\\alpha$ and $\\beta$ does not exist, because there doesn&#39;t even exist a cobordism $\\gamma : C \\to S^1$ (for some compact 1-manifold $C$) such that $\\alpha \\circ \\gamma = \\beta \\circ \\gamma$: compute its Euler characteristic to reach a contradiction. Similarly the coequalizer doesn&#39;t exist. You can adapt the counterexample to any $n \\ge 2$ & ndash; you just need to find two cobordisms $X \\to Y$ with differing Euler characteristic for some $X$ and $Y$.", "156" ], [ "Let $\\mathsf{C}$ be a symmetric monoidal category. An object $X \\in \\mathsf{C}$ has two operads \" ;naturally \" ; (the two constructions aren&#39;t functorial) associated to it: the operad of endomorphisms and the operad of coendomorphisms\r\n$$\\mathtt{End}_X(r) = \\operatorname{Mor}(X^{\\otimes r}, X), \\; \\mathtt{coEnd}_X(r) = \\operatorname{Mor}(X, X^{\\otimes r}).$$\r\n\r\nAn algebra over an operad $\\mathtt{P}$ is then a morphism $\\mathtt{P} \\to \\mathtt{End}_X$, and a coalgebra over $\\mathtt{P}$ is a morphism $\\mathtt{P} \\to \\mathtt{coEnd}_X$. If one likes, everything can be done in the enriched setting, e.g. dg-modules over a field, and a coalgebra structure on $X$ is equivalent to coactions:\r\n$$\\mathtt{P}(r) \\otimes X \\to X^{\\otimes r}$$\r\nthat satisfy associativity, equivariance, unitality... relations.\r\n\r\nOften, one hears that \" ;coalgebras are encoded by cooperads \" ;. The definition of cooperads is formally dual to the definition of operads, and a coalgebra over a cooperad $\\mathtt{C}$ is given by morphisms\r\n$$X \\to \\mathtt{C}(r) \\otimes^{\\Sigma_r} X^{\\otimes r}$$\r\nsatisfying relations formally dual to the relations defining an algebra over an operad.\r\n\r\nBut it seems to me that, in algebra at least, most notions of coalgebras encountered in nature are more naturally seen as coalgebras over operads, rather than coalgebras over cooperads. For example, a coassociative coalgebra is more naturally seen as an operator $\\Delta : C \\to C \\otimes C$ (so, something like $\\mathtt{Ass}(2) \\otimes C \\to C \\otimes C$), rather than a map $C \\to \\mathtt{Ass}^*(2) \\otimes C \\otimes C$.\r\n\r\nI think it&#39;s even more evident with e.g. Poisson coalgebras. IMO it&#39;s natural to think there&#39;s a cobracket and a coproduct both acting on $C$ (so, something like $\\mathtt{Poiss}(2) \\otimes C \\to C \\otimes C$ mapping $\\mu \\otimes x$ to the coproduct $\\Delta(x)$ of $x$ and $\\lambda \\otimes x$ to the cobracket $\\delta(x)$). But it&#39;s not natural at all (IMO) to think of a coaction that maps $x$ to $\\mu^* \\otimes \\Delta(x) + \\lambda^* \\otimes \\delta(x) \\in \\mathtt{Poiss}^*(2) \\otimes^{\\Sigma_2} (C \\otimes C)$: everything is jumbled together.\r\n\r\nOf course, when one deals with finite-type dg-modules over a field of characteristic zero, everything can be dualized and there&#39;s no difference (AFAIK) between coalgebras over $\\mathtt{P}$ and coalgebras over $\\mathtt{P}^*$. But still, are there examples of coalgebra types that are more naturally given by cooperads? And what about topological operads, say, where things cannot be dualized as easily?", "208" ], [ "To continue with your line of reasoning (which so far is correct), you need to solve $e^{2iz} + 4 k \\pi e^{iz} - 1 = 0$. With $x = e^{iz}$, this becomes the quadratic equation $x^2 + 4kx - 1 = 0$. The discriminant is $\\Delta = (4k\\pi)^2 + 4 = 4 (4k^2\\pi^2 + 1)$, which is always positive ($k$ is real). The two solutions are therefore $x = -2k\\pi + \\sqrt{4k^2\\pi^2+1}$ and $x = -2k - \\sqrt{4k^2\\pi^2 + 1}$.\r\n\r\n* In the first case we want to solve $e^{iz} = -2k\\pi + \\sqrt{4k^2\\pi^2+1}$. Since $4k^2\\pi^2+1 = (-2k\\pi)^2 + 1 > (-2k\\pi)^2$, this is a positive real numbers, and so the first batch of solutions is\r\n$$z = i\\log(-2k\\pi + \\sqrt{4k^2+1}) + 2 i \\pi l, \\text{ for some integers } k, l.$$\r\n* In the second case, the equation to solve is $e^{iz} = -2k\\pi - \\sqrt{4k^2\\pi^2+1}$. This is a negative real number, and thus the second batch of solutions is:\r\n$$z = i\\pi + i\\log(2k\\pi+\\sqrt{4k^2\\pi^2+1}) + 2 i \\pi l, \\text{ for some integers } k, l.$$\r\n\r\nAnd this is the complete set of solutions.\r\n\r\n---\r\n\r\nPS: You can express that a bit more concisely by noticing that $\\log(2k\\pi + \\sqrt{4k^2\\pi^2+1}) = \\operatorname{argsinh}(2k\\pi)$, and so the set of solutions becomes\r\n$$e^{\\sin z} = 1 \\iff z \\in \\{ i\\operatorname{argsinh}(-2k\\pi) + 2 i\\pi l \\mid k,l \\in \\mathbb{Z} \\} \\cup \\{ i\\pi + i\\operatorname{argsinh}(2k\\pi) + 2 i \\pi l \\mid k,l \\in \\mathbb{Z} \\}.$$", "965" ], [ "When searching for \" ;trigonometry \" ; or something similar in the [tag list](_URL_2_) (or when editing a question), the [tag:trigonometric-functions] appears, and is said to contain 72 questions:\r\n\r\n[![image of the tag appearing][1]][1]\r\n\r\nBut there&#39;s a twist: [tag:trigonometric-functions] is a synonym of [tag:trigonometry], which has 10k+ questions, and the following link redirects to [tag:trigonometry]:\r\n\r\n > _URL_1_\r\n\r\nWhat is happening here? Why is the tag appearing in the tag list and when editing questions, and with a different count of questions to boot? Is it the expected behavior?\r\n\r\n(I&#39;m asking because I was editing a question involving a trigonometric function, and kept editing the tag [tag:trigonometry] back to [tag:trigonometric-functions], wondering what was happening... In any case it&#39;s annoying behavior, and if it&#39;s not a bug I&#39;ll consider making this into a feature request.)\r\n\r\n [1]: _URL_0_", "423" ], [ "There are two different categories:\r\n\r\n* The category $\\mathsf{gVec}$ where objects are vector spaces $V$ equipped with a decomposition $V \\cong \\bigoplus_{n \\in \\mathbb{Z}} V_n$, and morphisms are linear maps respecting the decomposition;\r\n* The category $\\mathsf{Vec}^\\mathbb{Z}$ of families of vector spaces $\\{ V_n \\}_{n \\in \\mathbb{Z}}$ and morphisms $f : \\{V_n\\} \\to \\{W_n\\}$ are families of linear maps $\\{f_n : V_n \\to W_n\\}_{n \\in \\mathbb{Z}}$.\r\n\r\nThese two categories are equivalent; you can construct an explicit equivalence $\\mathsf{Vec}^\\mathbb{Z} \\to \\mathsf{gVec}$ given by $\\{V_n\\} \\mapsto V_\\bullet = \\bigoplus_{n \\in \\mathbb{Z}} V_n$. So it makes no difference to consider graded vector spaces from the first point of view or from the second point of view.", "383" ], [ "A (meta) answer was deleted by a moderator. When I view it on desktop, it merely appears to be deleted, but when I view it on mobile the content of the answer is hidden with a text saying\r\n\r\n > This answer was marked as spam or offensive and is therefore not shown - you can see the revision history for details.\r\n\r\nIf you don&#39;t have a mobile phone but have more than 10k reputation, you can click on \" ;mobile \" ; at the bottom of the page to switch to the mobile site to test it out.\r\n\r\nConsidering the content of the answer, this isn&#39;t surprising that some people flagged it as offensive, which I guess triggered the behavior. But 1/ shouldn&#39;t the mod deletion have overridden that and 2/ why is the behavior different on desktop and mobile?", "792" ], [ "@JyrkiLahtonen If a post is deleted because it was flagged as offensive by 5(?) users, its text is normally hidden both on desktop and mobile from the people who can see it (with the text I quoted shown instead). Viewing the revision history (e.g. by clicking on the link) shows what the post was in any case, it&#39;s not inaccessible. What I guess happened here is that some people flagged as offensive, then you deleted it before it reached the required numbers of flags to be auto-deleted, and this resulted in the weird situation. IMO it&#39;s a bug.", "629" ], [ "I guess you&#39;re talking about their Theorem 2.6 which reads:\r\n\r\n > **Theorem 2.6.** Given $m,n \\in \\mathbb{N}$, let us consider $S^n \\vee S^m$, the wedge sum of spheres $S^n$ and $S^m$. For each $q > 0$ we have\r\n$$H_q(S^n \\vee S^m) = \\begin{cases}\r\n\\mathbb{Z} \\oplus \\mathbb{Z} & \\text{if } q = n = m \\\\\r\n0 & \\text{in any other case.}\r\n\\end{cases}$$\r\n\r\nTo be honest I&#39;m not sure how to understand this theorem, because in the most straightforward way I can think of, it is wrong... Here is what is correct (maybe there&#39;s a way to interpret their theorem in a way that matches this, the phrasing is a bit weird, but since after that they consider only the case $n=m$ it may just be a small oversight), for simplicity I assume $n,m > 0$:\r\n\r\n* if $n = m$, then $$H_q(S^n \\vee S^n) = \\begin{cases} \\mathbb{Z} & q = 0 \\\\ \\mathbb{Z} \\oplus \\mathbb{Z} & \\text{if } q = n = m \\\\ 0 & \\text{otherwise.} \\end{cases}$$\r\n\r\n* if $n \\neq m$, then $$H_q(S^n \\vee S^m) = \\begin{cases} \\mathbb{Z} & \\text{if } q \\in \\{0,n,m\\} \\\\ 0 & \\text{otherwise.} \\end{cases}$$", "156" ], [ "Yes, it is always the case. If you just need a weak homotopy equivalence, look at the long exact sequence in homotopy:\r\n$$\\require{cancel}\r\n\\dots \\to \\cancel{\\pi_{n+1}(B)} \\to \\pi_n(F) \\to \\pi_n(E) \\to \\cancel{\\pi_n(B)} \\to \\dots$$\r\nto see that the inclusion $F \\to E$ induces an isomorphism on all homotopy groups.\r\n\r\nMore generally, if you want a full-on homotopy equivalence, you can use the well-known fact that if $f_0, f_1 : B&#39; \\to B$ are homotopic and $E \\to B$ is a fibration, then the two fibrations $f_0^* E \\to B&#39;$ and $f_1^* E \\to B&#39;$ are fibre homotopic. (The proof of this is a bit more technical.)\r\n\r\nIn the present case, let $f_0 = \\operatorname{id}_B : B \\to B$ and $f_1 : B \\to B$ to be a constant map. Since $B$ is contractible, $f_0 \\sim f_1$. Of course $f_0^*E = E$, while $f_1^*E \\to B$ is the trivial fibration $B \\times F \\to B$. Since these two fibrations are fibre homotopy equivalent, their total spaces must be homotopy equivalent, i.e. $E \\simeq F \\times B$.\r\n\r\nIn fact we even see that there is a stronger result, that there is a commuting diagram where the vertical arrows are homotopy equivalences:\r\n$$\\require{AMScd}\r\n\\begin{CD}\r\nF @ > > > E @ > > > B \\\\\r\n@V{\\sim}VV @V{\\sim}VV @V{=}VV \\\\\r\nF @ > > > B \\times F @ > > > B\r\n\\end{CD}$$", "731" ], [ "It&#39;s true that if $X$ is a finite discrete space, then $H^0(X;\\mathbb{Z}) \\cong \\bigoplus_{|X|} \\mathbb{Z}$. However, it&#39;s easier for this exercise to back up a bit and see that $H^0(X;\\mathbb{Z})$ is isomorphic to the group of maps of sets $X \\to \\mathbb{Z}$ (with pointwise addition for the group structure), i.e. $H^0(X;\\mathbb{Z}) = \\operatorname{Map}(X, \\mathbb{Z})$. When $X = \\{ x_1, \\dots, x_n \\}$ is finite, this is identified with $\\mathbb{Z}^{\\oplus n}$ by $\\varphi \\mapsto (\\varphi(x_1), \\dots, \\varphi(x_n))$.\r\n\r\nAnd more importantly, if $f : X \\to Y$ is so map (which is automatically continuous), then the induced map $H^0(Y;\\mathbb{Z}) \\to H^0(X;\\mathbb{Z})$ is given by pre-composition:\r\n$$\\varphi \\in \\operatorname{Map}(Y, \\mathbb{Z}) \\mapsto f^*\\varphi := \\varphi \\circ f \\in \\operatorname{Map}(X, \\mathbb{Z}).$$\r\n\r\nSo now for our finite group $G$, $H^0(G;\\mathbb{Z}) \\cong \\operatorname{Map}(G, \\mathbb{Z})$ (these are just maps of sets, not group homomorphisms). And if $\\varphi : G \\to \\mathbb{Z}$, then $m_g(\\varphi) = \\varphi \\circ m_g : x \\mapsto \\varphi(gx)$.\r\n\r\nSo given an enumeration $\\{x_1, \\dots, x_n\\}$ of $G$ ($n = |G|$), you can view $H^0(X; \\mathbb{Z}) \\cong \\mathbb{Z}^n$. If $\\alpha = (\\alpha_1, \\dots, \\alpha_n) \\in \\mathbb{Z}^n$, then $m_g^*\\alpha$ is a permutation of $\\alpha$, and you need to use the group law of $G$ to find out which one: $g x_i = x_{\\sigma(i)}$ for some permutation $\\sigma \\in \\mathfrak{S}_n$, and $m_g^*\\alpha = (\\alpha_{\\sigma(1)}, \\dots, \\alpha_{\\sigma(n)})$.", "731" ], [ "It is a classical result that the rational cohomology of $SO(n)$ is given by:\r\n\r\n$$H^*(SO(2m); \\mathbb{Q}) = \\begin{cases}\r\nS(\\beta_1, \\dots, \\beta_{m-1}, \\alpha_{2m-1}) & n = 2m \\\\\r\nS(\\beta_1, \\dots, \\beta_m) & n = 2m+1\r\n\\end{cases}$$\r\nwhere the $\\beta_i$ have degree $4i-1$, $\\alpha_{2m-1}$ has degree $2m-1$, and $S(V)$ is the free graded commutative algebra on the generators given by the graded vector space $V$. Since all the generators have odd degree, this happens to be an exterior algebra here.\r\n\r\nSince $SO(n)$ is a (Lie) group, there is an induced Hopf algebra structure on $H^*(SO(n);\\mathbb{Q})$, and the generators $\\beta_i$ (and $\\alpha_{2m-1}$ if applicable) happen to be [primitive](_URL_0_). But then, a free (graded) symmetric algebra on primitive generators is (graded) cocommutative, so in this case $H^*(SO(n))$ is cocommutative.\r\n\r\nNow, like all Lie groups, $SO(n)$ is [formal](_URL_1_), and all its rational homotopy theory is contained in its cohomology ring. This is where things start to get muddy for me: if I understand correctly, the coproduct on $H^*(SO(n))$ should be a model for the product on $SO(n)$. Since $H^*(SO(n))$ is cocommutative, then the product on $SO(n)$ is rationally homotopy cocommutative.\r\n\r\nIs this correct? If not, where&#39;s my mistake? If yes, how to interpret that fact? The group $SO(n)$ doesn&#39;t really \" ;look \" ; commutative at all. Maybe I&#39;m assigning a stronger meaning than I should to the commutativity up to rational homotopy?", "278" ], [ "The definition of a functor is self-dual. If you reverse all the arrows in the definition of a functor $\\mathsf{C} \\to \\mathsf{D}$, what you get is a functor $\\mathsf{C}^\\mathrm{op} \\to \\mathsf{D}^\\mathrm{op}$, which is exactly the same thing as a functor $\\mathsf{C} \\to \\mathsf{D}$. So in this sense a cofunctor is just a functor.\r\n\r\nNow a contravariant functor is a functor too, but between different categories: a contravariant functor $\\mathsf{C} \\to \\mathsf{D}$ is the same thing as a functor $\\mathsf{C}^\\mathrm{op} \\to \\mathsf{D}$, which is exactly the same thing as a functor $\\mathsf{C} \\to \\mathsf{D}^\\mathrm{op}$. This is rather unrelated to functors $\\mathsf{C} \\to \\mathsf{D}$.\r\n\r\nNote that some people *do* use the words \" ;cofunctor \" ; for contravariant functors, I guess it&#39;s just a matter of taste as long as every word is defined.", "208" ], [ "At some point the neanderthal and modern human lineages diverged. I&#39;m not sure what exactly their most common recent ancestor was (I see some sources suggesting _homo heidelbergensis_), but in any case I&#39;m interested in the innovative/apomorphic features of neanderthals relative to that MRCA. What new features did they have, and what existing features changed most?\r\n\r\nIn particular I am _not_ asking how neanderthals differ from modern humans.\r\n\r\nThis question is partially inspired by popular science pieces (e.g., < a href= \" ;_URL_1_ Hands More Primitive than Chimp Hands < /a > ) discussing human hands, which are essentially basal, vs. chimpanzee hands which are less similar to the < a href= \" ;_URL_0_ ancestor < /a > .", "234" ], [ "Yes, you need to construct explicit maps. Take question (i) for example. Let $f : \\mathbb{R}^n \\to \\{*\\}$ and $g : \\{*\\} \\to \\mathbb{R}^n$ be as you describe; in fact, for simplicity, just let $g(*) = 0$. It&#39;s clear that $f \\circ g = \\operatorname{id}_{\\{*\\}}$. Now you want to prove $g \\circ f \\simeq \\operatorname{id}_{\\mathbb{R}^n}$.\r\n\r\n*What&#39;s the definition of that statement?* This is the question you should be asking yourself. It means there exists some $H : \\mathbb{R}^n \\times [0,1] \\to \\mathbb{R}^n$ such that $H(x,0) = \\operatorname{id}_{\\mathbb{R}^n}(x) = x$ and $H(x,1) = g(f(x)) = 0$. Now there&#39;s some amount of guessing you need to do, but\r\n$$H(x,t) = (1-t)x$$\r\nlooks like a good candidate, and indeed it&#39;s a homotopy between $g \\circ f$ and $\\operatorname{id}_{\\mathbb{R}^n}$.\r\n\r\n---\r\n\r\nNow for (ii): all you know is that $Y$ is contractible. *What does that mean?* Recalling what we did in question (i), it means that there&#39;s some $H : Y \\times [0,1] \\to Y$ such that $H(y,0) = y$ and $H(y,1) = y_0$ is some point in $Y$. Now take your $f : X \\to Y$. It seems natural to try and compose it with $H$, I think. So define $G : X \\times I \\to Y$ by $G(x,t) = H(f(x),t)$.\r\n\r\nWhat does this map satisfy? Well, $G(x,0) = H(f(x),0) = f(x)$, and $G(x,1) = H(f(x),1) = y_0$. What did we want to prove? That $f$ and some constant map were homotopic. Well, just look at the equations we just got: $G$ is exactly such a homotopy! And all we had to do was to calmly take a moment to recall the definitions of all the words in the question.\r\n\r\n---\r\n\r\nNow (iii) is more tricky, because I think the question is wrong...\r\n\r\nIf $X$ is contractible, it means there&#39;s some $H : X \\times [0,1] \\to X$ with $H(x,0) = x$ and $H(x,1) = x_0$ is some point (independent of $x$). Let $f : X \\to Y$ be any continuous map. We&#39;re looking for a homotopy $G : X \\times [0,1] \\to Y$ such that $G(x,0) = f(x)$ and $G(x,1) = y_0$ is some point.\r\n\r\nBut we can just let $G(x,t) = f(H(x,t))$, and then $G(x,0) = f(H(x,0)) = f(x)$, while $G(x,1) = f(H(x,1)) = f(x_0)$ is independent of $x$ (you can call $y_0 = f(x_0)$). So $f$ is always homotopic to a constant map.", "731" ], [ "So the array was hard to typeset. Does this justify not typing the rest? Was the array completely essential to the question? Basic MathJax *is* easy to learn. There are tons and tons of resources, [including on this website](_URL_0_). You don&#39;t have to be a wizard to know how to put dollar signs around math expressions and learn the basics about how to typeset exponents, sums... If you have a very complicated graphics that you don&#39;t know how to typeset, by all means, do it in another way. But here OP hadn&#39;t even typed the plain text. Come on.", "971" ], [ "The hypothesis that the chain complex is bounded below points you in the direction of induction. Let $C_*$ be the chain complex. The chain complex being acyclic means that every cycle is a boundary, i.e. if $x \\in C_n$ is such that $dx = 0$, then $x = dy$ for some $y \\in C_{n+1}$. What we want is $C_*$ being contractible, meaning that there is a chain homotopy $h_n : C_n \\to C_{n+1}$ such that $x = h_{n-1}(d_n x) + d_{n+1}(h_n x)$ for all $x \\in C_*$.\r\n\r\nIt&#39;s this $h$ that&#39;s constructed by induction. The first one is $h_0 : C_0 \\to C_1$ and it must satisfy $d_1 h_0 x = x$ for all $x \\in C_0$ (because $C_{-1} = 0$). What are our hypotheses? The complex $C_*$ is acyclic, and $C_{-1} = 0$. So every $x \\in C_0$ is a cycle ($C_{-1} = 0$), hence a boundary $C_*$ acyclic. Thus $d_1 : C_1 \\to C_0$ is surjective.\r\n\r\nAnd now we use the hypothesis that all the $C_n$ are projective modules. $d_1 : C_1 \\to C_0$ is surjective and $C_0$ is projective, hence there is a lift of the identity, a map $s : C_0 \\to C_1$ such that $d_1 s x = \\operatorname{id}_{C_0}(x) = x$. This map $s$ is exactly the $h_0$ we needed.\r\n\r\nAnd now we start again and want to construct $h_1 : C_1 \\to C_2$ such that $x = h_0(d_1(x)) + d_2(h_1(x))$ for all $x \\in C_1$. Recalling that we&#39;ll use the fact that the modules are projective, we rewrite the equation as\r\n$$d_2(h_1(x)) = x - h_0(d_1(x)) = g(x),$$\r\nwhere $g(x) = x - h_0(d_1(x))$.\r\n\r\nTo use projectivity, we need a surjective map. Let $Z_1 \\subset C_1$ be the kernel of $d_1$. Then since $C_*$ is a chain complex, $d_2(C_2) \\subset Z_1$; the acyclicity of $C_*$ means that $d_2 : C_2 \\to Z_1$ is surjective.\r\n\r\nThe map we want to lift is $g : C_1 \\to C_1$, so all we need to check is that $g(C_1) \\subset Z_1$ and we&#39;re done. But using $d_1(h_0(y)) = y$, we find:\r\n$$d_1(g(x)) = d_1(x) - d_1(h_0(d_1(x)) = d_1(x) - d_1(x) = 0$$\r\nand so $g(C_1) \\subset Z_1$. We can now use projectivity of $C_1$ to find a lift $h_1 : C_1 \\to C_2$ such that $d_2(h_1(x)) = g(x) = x - h_0(d_1(x))$.\r\n\r\n---\r\n\r\nThere are a few details missing here, and you need to write down the induction fully. I&#39;ll let you fill in the details.", "731" ], [ "Yes, it&#39;s supposed to work like that. The hover effect is achieved by giving the ` < a > ` (link) tag a `title` property containing the excerpt, and then the tooltip is produced by the browser. There&#39;s no way (on SE&#39;s end anyway, the browser could theoretically be changed to do it) for this tooltip to support MathJax: the browser just reads the `title` attribute as plain text.\r\n\r\nI guess it could be possible to modify everything to produce a tooltip with some Javascript and have this new tooltip be made to support MathJax, but frankly that sounds rather complicated for a small gain & ndash; you can just read the MathJax code to understand what&#39;s going on, and if you want to read more you can just click on the question. It would also cause the same problems as the search, where formulas are cut off in the middle and not rendered properly.", "940" ], [ "@vanderlylic For (i) it doesn&#39;t really change anything, you can do it like that if you prefer. For (ii) and (iii), no, you cannot conclude that. A constant map $S^1 \\to S^1$ is of course homotopic to a constant map, but $S^1$ is not contractible. What is true is that for a fixed $X$, if for all spaces $Y$ all maps $X \\to Y$ are nullhomotopic, then $X$ is contractible. Similarly for a fixed $Y$, if for all $X$ all maps $X \\to Y$ are nullhomotopic then $Y$ is contractible.", "731" ], [ "Yes, that&#39;s perfectly fine. Since you have more than 100 rep points you can even create a chat room for your discussion, if you&#39;re afraid of filling up the space of the main chatroom. To quote [the help center](_URL_0_):\r\n\r\n > ### When should I visit chat?\r\n\r\n > * for real time collaboration\r\n* to meet the fellow members of your community in a more social environment\r\n* **for less structured, casual (but still roughly on-topic) conversation**\r\n\r\nHonestly, even if it wasn&#39;t on-topic, the harm done would be so minimal that I wouldn&#39;t fret over it. As long as you&#39;re not flinging insults or discussing horrible things, it seems to me you can talk about pretty much anything you want.", "763" ], [ "You know what? I bit the bullet and counted. Out of the 48 questions that are on the front page right now, 37 were formatted correctly by the OP from the start, 7 contained ASCII/Unicode math and had to be edited into shape by someone else, 3 were screenshots (none were taken with a camera), and one was a question about programming that was migrated to SO. That&#39;s 77% of questions correctly formatted from the start. I&#39;m pretty sure you&#39;re suffering from [confirmation bias](_URL_0_), and in any case you have no data to back up your claims.", "183" ], [ "[The $n$Lab article on compact objects](_URL_2_) gives a good explanation. The first thing you should understand are what [filtered colimits](_URL_3_) are. The most basic example of a filtered colimit is a colimit indexed by $\\mathbb{N}$: basically, you&#39;re looking at a space $X$ which is the increasing union of subspaces, $X = \\bigcup_{n \\in \\mathbb{N}} X_n$.\r\n\r\nFrom a topological point of view, the rough idea is that the image of a compact set by a map $Z \\to X$ is compact, and so can only meet a finite number of the $X_n$. Thus it factors through $\\bigcup_{n \\le N} X_n = X_N$ for some $N$ big enough, and this precisely means that\r\n$$\\hom(Z, \\bigcup_{n \\in \\mathbb{N}} X_n) = \\bigcup_{n \\in \\mathbb{N}} \\hom(Z, X_n).$$\r\n\r\nBut there are more general shapes of diagrams for which you can say things like \" ;a compact set only meets a finite number of parts \" ;. The first generalization is a [directed set](_URL_0_), a preordered set where any finite subset has an upper bound. So in our example, the union may not necessarily be increasing, and so the $X_i$ are not totally ordered for inclusion; they&#39;re now indexed by some preordered set $I$ and $i \\le j \\implies X_i \\subset X_j$. But if you take two of them, say $X_i$ and $X_j$, then there&#39;s a $k$ for which $X_i \\cup X_j \\subset X_k$. Then if $X = \\bigcup_{i \\in I} X_i$, then a compact subset of $X$ can only meet a finite number of the $X_i$, say $X_{i_1}, \\dots, X_{i_k}$ and since the set is directed there&#39;s some $X_l$ containing all the $X_{i_j}$. You then get the same commutation with the colimit as before.\r\n\r\nNow there&#39;s something even more general than a directed set, and it&#39;s a [filtered category](_URL_1_). It&#39;s not necessarily a preorder anymore (there may be more than one arrow between any two objects), but there&#39;s still a condition reminiscent of the \" ;any finite subset has an upper bound \" ;: any finite diagram has a cocone. As it turns out, a similar type of argument as before will let you say something similar to prove that a compact subspace will only \" ;meet a finite number of parts \" ;, and $\\hom(Z,-)$ will commute with the colimit if $Z$ is compact.\r\n\r\nAnd now what&#39;s really nice is that the converse becomes true: if $Z$ is such that $\\hom(Z,-)$ commutes with *all* filtered colimits, then $Z$ *has* to be compact.", "356" ], [ "@DavidC.Ullrich In one direction, (ii) clearly implies (i). Now let $G$ be a group, $R$ a set of relations, $N$ the normal subgroup generated by $R$, and $r$ another relation. Suppose (i) that \" ;$r$ is true whenever $R$ is true \" ;. This means that if $N&#39;$ is the normal subgroup of $G/N$ generated by $[r]$, any morphism $G/N \\to H$ factors through $(G/N)/N&#39; \\to H$. By the <PERSON> lemma, this is equivalent to the quotient map $G/N \\to (G/N)/N&#39;$ being an isomorphism; since $[r]$ is in the kernel of that map, $[r] = 0 \\iff r \\in N$. Now use the explicit description of $N$ in term of $R$ to get (ii).", "410" ], [ "What is meant in the book is that the forgetful functor $U : \\mathsf{Rng} \\to \\mathsf{Ab}$ does not make $\\mathsf{Rng}$ into a subcategory of $\\mathsf{Ab}$, because two different rngs may have the same underlying abelian group. For example, consider $\\mathbb{Z}$ with the usual operations, and the same $\\mathbb{Z}$ but where $x \\cdot y = 0$ for all $x$ and $y$. So $U$ is not an injection of objects, let alone an embedding of categories.\r\n\r\nNow it *is* true that, even then, there could possibly be another functor $F : \\mathsf{Rng} \\to \\mathsf{Ab}$ that makes $\\mathsf{Rng}$ into a subcategory of $\\mathsf{Ab}$, but this isn&#39;t what the author meant (in all likelihood). Here is what he wrote:\r\n\r\n > The corresponding abelian groups of two rings may coincide even if the\r\nrings do not coincide. The multiplication may be defined differently.\r\n\r\nWhich matches the explanation in the first paragraph. Finding a functor $F : \\mathsf{Rng} \\to \\mathsf{Ab}$ that induces an injection on objects and hom-sets would be a harder question.", "208" ], [ "@MichaelHardy I don&#39;t really understand your objection, since your answer reads \" ;However, if you go far enough in a particular direction on the cylinder, you&#39;ll return to where you started. That doesn&#39;t happen in the plane. \" ; That&#39;s pretty much the fundamental group right there... A metric induces a topology, and it turns out that you just need that underlying topology to see the difference between the cylinder and the plane.", "892" ], [ "From the very first line:\r\n\r\n > I am having doubts this is true.\r\nSo elements of $\\mathbb{Q}(i,\\sqrt{3})$has the form $p+qi+r\\sqrt{3}$ for some rational $p,q,r$.\r\n\r\nWhy do you say that? It&#39;s not true. As you noticed yourself, $i \\sqrt{3}$ becomes a problem if you assume all elements of $\\mathbb{Q}(i, \\sqrt{3})$ are of this form. But $\\mathbb{Q}(i, \\sqrt{3})$ is a ring, and so the product of two elements should always be in the ring...\r\n\r\nIn general, $\\mathbb{Q}(a_1, \\dots, a_n)$ is the set of all *polynomials* of the type:\r\n$$\\sum_{k_1, \\dots, k_n} x_{k_1, \\dots, k_n} a_1^{k_1} \\dots a_n^{k_n}.$$\r\nA polynomial may have degrees greater than $1$. As it turns out, with early examples of ring extensions like $\\mathbb{Q}(i)$ or $\\mathbb{Q}(\\sqrt{2})$, you can get away with polynomials of degree only $1$. But that&#39;s because $i^2 = -1$ and $\\sqrt{2}^2 = 2$ are both in $\\mathbb{Q}$, and so you don&#39;t find anything new when you look at polynomials of higher degree. In general, you must, though: look at $\\mathbb{Q}(2^{1/3})$, for example.\r\n\r\n---\r\n\r\nNow for a proof that $-1/2 + i\\sqrt{3}/2$ is in $\\mathbb{Q}(i, \\sqrt{3})$: there are several ways of defining $\\mathbb{Q}(i, \\sqrt{3})$, but one way is to consider the smallest subring of $\\mathbb{C}$ that contains $\\mathbb{Q}$, $i$ and $\\sqrt{3}$. Then since $1/2$, $i$ and $\\sqrt{3}$ are in $\\mathbb{Q}(i,\\sqrt{3})$, so is the product $\\sqrt{3} \\cdot 1/2 \\cdot i$, and finally the sum $-1/2 + i \\sqrt{3}/2$ is in $\\mathbb{Q}(i, \\sqrt{3})$.", "449" ], [ "I was watching a presentation by Dr. <PERSON> [1] who discusses (at < a href= \" ;_URL_0_;), among other things, the skeletal structure of dinosaurs vs. mammals. \" ;Dinosaurs have way lighter skeletons, which means that for the amount of material they can be bigger. If we start to look at sauropods, they have this really interesting set of structures, these big holes in their vertabrae... \r\nit allows you to build a lighter, stronger skeleton. Mammals can&#39;t do that. It&#39;s not how we build our bones. \" ;\r\n\r\nWhy don&#39;t mammals do this? Are there fundamental trade-offs which make our (apparently) weaker, heavier bones better, or is it just chance that we haven&#39;t matched this development?\r\n\r\n(Of course I&#39;m open to the possibility that I misunderstood the talk, or that it was simplified to the point of inaccuracy on this point.)\r\n\r\n[1] <PERSON>, < a href= \" ;_URL_1_ Giant: Why are mammals not as big as dinosaurs? < /a > (2015)", "234" ], [ "Brain size (or its proxy, encephalization quotient) usually varies allometrically with mass -- larger creatures need larger brains to control their larger bodies, apparently.\r\n\r\nDinosaurs are popularly known as small-brained. While this certainly doesn&#39;t hold in general -- theropods and especially birds were particularly intelligent -- but sauropods and thyreophorans (ankylosaurs and stegosaurs) seem to have preposterously small brains. How were they able to control their large bodies with such small brains? Are there modern animals with similar proportional brain size, and if so does that give any clues as to how these dinosaurs functioned?", "234" ], [ "1. You have no way of knowing if the answer will truly be useless to the one asking the question.\r\n\r\n2. \" ;killing an ant with a nuclear bomb \" ; So what? Is it a bad thing?\r\n\r\n3. Answers are for everyone, not just the OP. Maybe these answers will be helpful to someone else. Considering that questions get closed for being duplicate of one another, if someone asks a question about some limit but displays high-school level knowledge, does it mean that everyone is forbidden from ever answering this limit using power series on this site?", "359" ], [ "Let $C$ be a [coalgebra](_URL_1_) over a field and $M$ be a $C$-[comodule](_URL_0_). Then it&#39;s well-known that every element of $M$ is contained in a finite-dimensional subcomodule $M&#39; \\subset M$. This is for example an adaptation of proof given in Hovey&#39;s *Model categories* (Lemma 2.5.1, with notations changed a bit):\r\n\r\n > Let $\\{c_i\\}$ be a basis of $C$ and write the coaction $\\gamma : M \\to C \\otimes M$ as:\r\n$$\\gamma(m) = \\sum_i c_i \\otimes m_i,$$\r\nwhere only a finite number of $m_i$ may be nonzero. For a fixed $m \\in M$, let $M&#39;$ be the finite-dimensional subspace of $M$ spanned by the nonzero $m_i$. By counitality, $M&#39;$ contains $m$, and using coassociativity of $\\gamma$, $M&#39;$ is a $C$-comodule.\r\n\r\nAs you can see, this proof requires choosing a basis of $C$. Is it possible to rewrite the proof to avoid choosing this basis? If not, is it possible that the result becomes false in a setting where choosing a basis is not always possible (infinite dimensional $C$ and no axiom of choice)?", "838" ], [ "@AsafKaragila A comodule will be a vector space over $\\Bbbk$ by definition, it&#39;s a vector space $M$ equipped with a coaction $\\gamma : M \\to C \\otimes_\\Bbbk M$ that satisfies conditions dual of the axioms of a module over an algebra (i.e. $a \\cdot (b \\cdot m) = (ab) \\cdot m$ and $1 \\cdot m = m$). I don&#39;t really know for your second question -- I guess a cofree coalgebra has a ton of automorphisms, and a coalgebra is a (cofree of rank one) comodule over itself.", "278" ], [ "Hochschild (co)homology is not a \" ;topological invariant \" ;, because it doesn&#39;t even deal with topological spaces at all. Not all things called \" ;homology \" ; are about topology. In this case, <PERSON> (co)homology is an invariant of associative algebras and their bimodules. <PERSON> homology (resp. cohomology) takes as input an associative algebra $A$ and an $(A,A)$-bimodule $M$, and it spits out a graded module $HH_*(A;M)$ (resp. $HH^*(A;M)$). As you can see, there isn&#39;t a single topological space appearing.\r\n\r\nIt has a variety of uses. I&#39;m not 100% sure about the history, but as far as I know it was introduced to study deformation theory of associative algebras. First-order deformations of an algebra $A$ are in bijection with $HH^2(A;A)$, and more generally the Hochschild cohomology groups $HH^k(A;A)$ provide obstructions to getting higher order deformations of $A$. The Hochschild cochain complex $CH^*(A;A)$ has a dg-Lie algebra structure, and the Maurer–Cartan elements of this dg-Lie algebra are in bijection with formal deformations of $A$. \r\nYou now have a bunch of keywords that you can look up if you want more information about all this; there&#39;s the book *Deformation theory of algebras and their diagrams* by Markl that I know deals with that.\r\n\r\nIt is the operadic (co)homology theory associated to the operad governing associative algebras, and since this operad is Koszul it&#39;s also the Andr&#233;–Quillen (co)homology associated to this operad. So in this sense it&#39;s the \" ;natural \" ; (co)homology theory that one can use for associative algebras. A good reference is the book [*Algebraic operads*](_URL_0_) by <PERSON> and <PERSON> (and they also explain in section 12.2 all the stuff about deformation theory).\r\n\r\nIt turns out to have some uses in topology, too, so not all is lost. For example if $S^*(X)$ is the singular cochain complex of a topological space, then $S^*(X)$ has the structure of a dg-algebra. Then the <PERSON> homology $HH_*(S^*(X))$ is isomorphic to the homology of the free loop space $LX = \\operatorname{Map}(S^1, X)$ (these are maps, not pointed maps). See [this paper by Loday](_URL_1_) for a reference.", "278" ], [ "No, it is not possible to erase every content you posted on SE. When you created your account, you agreed to [this](_URL_1_):\r\n\r\n > You grant Stack Exchange the perpetual and irrevocable right and license to use, copy, cache, publish, display, distribute, modify, create derivative works and store such Subscriber Content and to allow others to do so in any medium now known or hereinafter developed (“Content License”) in order to provide the Services, even if such Subscriber Content has been contributed and subsequently removed by You.\r\n\r\nThe software itself will prevent you from deleting your questions with upvoted answers, accepted answers, and/or multiple answers. Moderators get (AFAIK) some kind of notification when a user starts deleting a large number of their own questions and answers, and typically revert the actions in question. Your questions and answers with a negative score will be deleted when your account is deleted, though. [For more information about all this, see this link.](_URL_0_)\r\n\r\nI guess you could start deleting all your comments; I don&#39;t know if moderators are notified of this, so maybe it will get under the radar. I have to say I don&#39;t really see the point though.", "792" ], [ "A model category is called **left proper** if weak equivalences are preserved by pushouts along cofibrations, and **right proper** if they are preserved by pullbacks along fibrations. It is called [**proper**](_URL_0_) if it is at the same time left and right proper.\r\n\r\nWhy are the adjectives left and right used here? Why is \" ;left \" ; associated to pushouts and/or cofibrations and \" ;right \" ; to pullbacks and/or fibrations? I seem completely unable to remember which is which and I have to look up the definitions every single time I encounter the word \" ;proper model category \" ;... (Including when I wrote the first paragraph of this question.)\r\n\r\nAt this point I guess even a mnemonic would be helpful, for lack of a proper (!) explanation of why these adjectives came to be used.", "208" ], [ "Choose some (orthonormal) basis $(e_1, e_2, \\dots)$ of $\\mathbb{C}^\\infty$ (depending on how you define $\\mathbb{C}^\\infty$ there&#39;s probably even a canonical such basis). Then given $(V_1, \\dots, V_n) \\in X(\\mathbf{n})$, since all the $V_i$ are finite dimensional there is some $N$ such that $V_1 + \\dots + V_n \\subset \\operatorname{Vect}(e_1, \\dots, e_N)$ (to see this you can simply express all the vectors of a basis of $V_1 + \\dots + V_n$ in the basis $(e_i)$).\r\n\r\nNow the matrix associated to $(\\lambda_1, \\dots, \\lambda_n, V_1, \\dots, V_n)$ is indeed finite, because \" ;outside \" ; of the first $N$ rows and columns, there are only $1$&#39;s on the diagonal and $0$&#39;s outside the diagonal. Inside the first $N \\times N$ block, the matrix is given by the linear transformation that&#39;s equal to multiplication by $\\lambda_i$ on $V_i$ and on the identity on the orthogonal complement. This is a unitary matrix.\r\n\r\nTo give an explicit example, imagine $V_1 = \\operatorname{Vect}(e_1,e_2)$ and $V_2 = \\operatorname{Vect}(e_3,e_4,e_5)$. Then the associated matrix is:\r\n$$\\begin{pmatrix}\r\n\\lambda_1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \\dots \\\\\r\n0 & \\lambda_1 & 0 & 0 & 0 & 0 & 0 & 0 & \\dots \\\\\r\n0 & 0 & \\lambda_2 & 0 & 0 & 0 & 0 & 0 & \\dots \\\\\r\n0 & 0 & 0 & \\lambda_2 & 0 & 0 & 0 & 0 & \\dots \\\\\r\n0 & 0 & 0 & 0 & \\lambda_2 & 0 & 0 & 0 & \\dots \\\\\r\n0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & \\dots \\\\\r\n\\vdots & \\vdots & \\vdots & \\vdots & \\vdots & 0 & 1 & 0 & \\dots \\\\\r\n\\vdots & \\vdots & \\vdots & \\vdots & \\vdots & \\vdots & 0 & \\ddots & \\vdots\r\n\\end{pmatrix}$$\r\n\r\nIt&#39;s possible for this to give a nondiagonal matrix: suppose that $V_1 = \\operatorname{Vect}(e_1 + e_2)$ ($n=1$), so $N = 2$. The operator sends $e_1 + e_2$ to $i(e_1 + e_2)$ and sends $e_1 - e_2$ to itself (and it&#39;s also the identity on the rest of $V_1^\\perp = \\operatorname{Vect}(e_1 - e_2, e_3, e_4, \\dots)$). So the first block of the matrix is:\r\n$$\\begin{pmatrix}\r\n\\frac{1+i}{2} & \\frac{1-i}{2} \\\\\r\n\\frac{1-i}{2} & \\frac{1+i}{2}\r\n\\end{pmatrix}$$\r\n(you can check that this is unitary) and is the identity outside of this first block. (I hope I didn&#39;t make a mistake in my computations.)", "944" ], [ "You need to first find the square root of $1 - 4 \\sqrt{3}i$ using the same method: let $(c+di)^2 = 1 - 4 \\sqrt{3} i$ and then compare real and imaginary parts to find $c$ and $d$ explicitly. This will give you *two* different answers. Then assume $(a+bi)^2 = c + di$, and compare real and imaginary parts to find $a$ and $b$ explicitly. This gives you two solutions for both solutions of $(c+di)^2 = 1 - 4 \\sqrt{3} i$, so in total, you get four different answers.", "965" ], [ "The question will be closed once it reaches five votes to close for any combination of reasons. It could even be five different reasons. So it doesn&#39;t really matter. Having a question closed for the wrong reason is sometimes annoying because the OP will complain (probably hoping to get an answer during the time between the reopening and the reclosing), but otherwise I don&#39;t see that it makes much difference.", "1018" ], [ "**tl;dr: Vote to close with the reason that you think applies the best.** If you&#39;re optimistic, you can also comment to explain your vote and explain the best way how to improve the question in your opinion.\r\n\r\n---\r\n\r\nThe question will actually get closed as quickly no matter what reason you choose. Indeed, a question gets closed as soon as it gathers five votes to close, all the reasons combined; the reason with the majority of votes will be displayed, so for example a question with 2 votes to close as off-topic and 3 votes to close as too broad will get immediately closed, and the reason displayed will be \" ;too broad \" ;. ([See here for more info.](_URL_0_))\r\n\r\nIt doesn&#39;t matter if other people think another reason applies. Often a question that deserves to be closed is flawed in several ways, but there&#39;s often no real argument as to whether the question should stay open. The end state is the same no matter the reasons chosen: the question is closed (well, \" ;put on hold \" ; first), cannot receive new answers, and becomes eligible for (possibly automatic) deletion after some time.\r\n\r\nIn general it&#39;s *preferable* that a question that needs to be closed gets closed for the correct reason, but if it gets closed for the wrong reason I don&#39;t think it&#39;s that big of a deal. The main concern is that the OP gets correct information on how to best improve their question to get it reopened, and you can simply use comments for that if you think the reason used was not the best one. I don&#39;t think reopening and reclosing a question simply for the sake of changing the reason displayed is a meaningful use of one&#39;s time. (I find that many users do not even read the reason displayed, for some reason. Apparently on mobile the reason is not very prominent.)\r\n\r\nSo to answer the question in the title: **No, it&#39;s not very important**.", "1018" ], [ "<PERSON> If the answer requires a full book to be answered, then the question was too broad. If it doesn&#39;t require the full book, then key points (other than why the equality is named after these people...) could have least be mentioned in the answer; link-only answers are discouraged. And this answer is not phrased as you suggest: it literally says \" ;It deserves a name, because it is important enough to devote a full book to [it] \" ;, not \" ;read this book to understand why \" ;.", "495" ], [ "The Wikipedia article on Fermat&#39;s last theorem [has a full section about it](_URL_0_), with plenty of references. Here are a few results (see the article for precise references):\r\n\r\n* The equation $a^{1/m} + b^{1/m} = c^{1/m}$ has solutions $a = rs^m$, $b = rt^m$ and $c = r(s+t)^m$ with positive integers $r,s,t > 0$ and $s,t$ coprime.\r\n* When $n > 2$, the equation $a^{n/m} + b^{n/m} = c^{n/m}$ has integer solutions iff $6$ divides $m$.\r\n* The equation $1/a + 1/b = 1/c$ has solutions $a = mn + m^2$, $b = mn + n^2$, $c = mn$ with $m,n$ positive and coprime integers.\r\n* For $n = -2$, there are again an infinite number of solutions.\r\n* For $n < -2$ an integer, there can be no solution, because that would imply that there are solutions for $|n|$.\r\n\r\nI don&#39;t know if anything is known for irrational exponents.", "874" ], [ "By the universal coefficients theorem, since a field is a PID, one has:\r\n$$H^n(X;\\Bbbk) \\cong \\hom_\\Bbbk(H_n(X;\\Bbbk), \\Bbbk) \\oplus \\operatorname{Ext}_\\Bbbk^1(H_{n-1}(X;\\Bbbk), \\Bbbk).$$\r\nBut over a field all $\\operatorname{Ext}$&#39;s vanish, and thus:\r\n$$H^n(X;\\Bbbk) \\cong \\hom_\\Bbbk(H_n(X;\\Bbbk),\\Bbbk).$$\r\n\r\nNow, **if the homology groups with $\\Bbbk$-coefficients are all finitely generated**, then this means that $H^n(X;\\Bbbk) \\cong H_n(X;\\Bbbk)$, because two vector spaces of the same dimension are isomorphic, and the dimension of the dual of a finite-dimensional vector space is the same. But in general, if $H_n(X;\\Bbbk)$ is infinite dimensional, then depending on its (infinite) dimension, [it may or may not be isomorphic to its dual](_URL_0_).\r\n\r\nFor an explicit example, let $\\Bbbk = \\mathbb{Q}$, and let $X = \\mathbb{N}$ be a countable discrete space. Then $H_0(X;\\mathbb{Q}) = \\bigoplus_{n \\in \\mathbb{N}} \\mathbb{Q}$, while $H^0(X;\\mathbb{Q}) \\cong \\prod_{n \\in \\mathbb{N}} \\mathbb{Q}$, and the two are not isomorphic & ndash; the first has dimension $\\aleph_0$, the second has dimension $2^{\\aleph_0}$.\r\n\r\nSo to conclude, in general, you cannot say that $H_n(X;\\Bbbk)$ is isomorphic to $H^n(X;\\Bbbk)$; but if all the $H_n(X;\\Bbbk)$ are finite dimensional, then it is true.\r\n\r\n---\r\n\r\nPS:\r\n\r\n > That is valid when homology groups are free with integer coefficients.\r\n\r\nThis is only valid if the homology groups are free *and finitely generated*. Again, same counterexample $X = \\mathbb{N}$: $H_0(X;\\mathbb{Z}) = \\bigoplus_{n \\in \\mathbb{N}} \\mathbb{Z}$ is free, but $H^0(X;\\mathbb{Z}) = \\prod_{n \\in \\mathbb{N}} \\mathbb{Z} \\not\\cong H_0(X;\\mathbb{Z})$.\r\n\r\n(The other answers are not really explicit to answer the question in the title, so here you go.)", "731" ], [ "No, they are not isomorphic.\r\n\r\nThere is only one possible morphism $f : \\mathbb{Q} \\to \\operatorname{Frac}(\\mathbb{Q}[x]) = \\mathbb{Q}(x)$: indeed, since it is a ring morphism it must send $1$ to $1$. Then for all $n \\in \\mathbb{N}$, $f(n) = f(1+\\dots+1) = f(1)+\\dots+f(1) = n \\cdot f(1) = n$, and so $f(-n) = -f(n) = -n$. Finally, if $p/q$ is some fraction, then $q f(p/q) = f(q \\cdot p/q) = f(p) = p \\implies f(p/q) = p/q$. So in conclusion, $f$ is necessarily the map that sends a rational $p/q$ to the constant fraction $p/q \\in \\mathbb{Q}(x)$.\r\n\r\nBut this $f$ is not an isomorphism (it&#39;s not surjective), and since it&#39;s the only morphism $\\mathbb{Q} \\to \\operatorname{Frac}(\\mathbb{Q}[x])$, the two rings are not isomorphic.", "476" ], [ "You mean in the review queue? Just above the question there are two tabs, \" ;Question (revised) \" ; and \" ;Revision \" ;, the second one being displayed by default if a question was put in the review queue after being edited. If you click on \" ;Question (revised) \" ;, you see the question with all edits made *and* the reason for which it was closed. If the question was put in the queue e.g. because someone voted to reopen it, you see the close reason by default.", "1018" ], [ "@TheGreatDuck Voting to close because you dislike the user who posted the question is forbidden, as far as I know. You technically can enter a custom close reason like \" ;I&#39;m voting to close this question as off-topic because I personally dislike the question \" ;, and I don&#39;t think it&#39;s explicitly forbidden, but good luck getting four people agreeing with you. Then either 1/ the question needs to be closed, then four people will vote to close anyway in an ideal world or 2/ it doesn&#39;t need to be closed, then the bogus vote will just age away.", "1018" ], [ "The \" ;$+ \\text{ constant}$ \" ; that&#39;s usually written after an indefinite integral isn&#39;t just for show. Your two solutions satisfy $\\frac{1}{2} \\cosh(x)^2 - \\frac{1}{2} \\sinh(x)^2 = \\frac{1}{2}$, in other words they differ by a constant. This is perfectly fine: if $F$ is a primitive of $f$, then $F + c$ is a primitive of $f$ too, for any constant $c$. In this case the constant happens to be $\\frac{1}{2}$.\r\n\r\nBoth $\\frac12 \\cosh(x)^2$ and $\\frac12 \\sinh(x)^2$ are primitives of $\\cosh(x) \\sinh(x)$: if you&#39;re not convinced, try differentiating both. (This probably should have been your first reflex if you weren&#39;t sure of your solution...)", "886" ], [ "You want to show an equality of sets: $(gh) \\cdot S = g \\cdot (h \\cdot S)$, for all $g,h \\in G$ and $S \\subseteq X$. This is proven by double inclusion:\r\n\r\n* Suppose $y \\in (gh) \\cdot S$, i.e. $y = (gh) \\cdot x$ for some $x \\in S$. Then since the action of $G$ on $X$ is a group action, $y = g \\cdot (h \\cdot x)$. Then $$h \\cdot x \\in h \\cdot S \\implies g \\cdot (h \\cdot x) \\in g \\cdot (h \\cdot S).$$\r\n\r\n* Conversely suppose $y \\in g \\cdot (h \\cdot S)$. Then $y = g \\cdot x&#39;$ with $x&#39; \\in h \\cdot S$, thus $x&#39; = h \\cdot x$ for some $x \\in S$. But then $y = g \\cdot (h \\cdot x) = (gh) \\cdot x \\implies y \\in (gh) \\cdot S$.\r\n\r\nFinally $(gh) \\cdot S = g \\cdot (h \\cdot S)$.\r\n\r\nTo prove that this is a group action, you also need to show that $e \\cdot S = S$ for all $S$ (where $e$ is the unit of $G$). But if $x \\in S$, then $x = e \\cdot x \\in e \\cdot S$, and conversely $e \\cdot S \\subseteq S$ is easy to show too.", "410" ], [ "It&#39;s easier than it looks. Consider a finite discrete space $X_{n+1}$ with $n+1$ points. This is a wedge sum of $n$ copies of $S^0$, the two-points space, $X_{n+1} = \\bigvee^n S^0$. And if $\\Sigma$ denotes the reduced suspension, then $\\Sigma(X \\vee Y) \\cong \\Sigma X \\vee \\Sigma Y$. Thus by induction:\r\n\r\n$$\\Sigma^d X_{n+1} \\cong \\bigvee^n \\Sigma^d(S^0) = \\bigvee^n S^d$$\r\nis a wedge sum of $n$ copies of the $d$-sphere.\r\n\r\n---\r\n\r\nIf you use the unreduced suspension (since you say that the suspension of a point is a ball I guess this is actually the case), the result is a bit weirder\r\n\r\nThe first suspension of $X_{n+1}$ is $n$ circles, which you can imagine are all arranged in a row from left to right, and they are then glued as follows: the right hemicircle of the first one is glued to the left hemicircle of the second one, the right hemicircle of the second one is glued to the left hemicircle of the third one, and so on. This is of course homotopy equivalent to the wedge sum of $n$ circles, by collapsing the left hemisphere of the first circle.\r\n\r\nThe pattern continues: $S^d X_{n+1}$ consists of $n+1$ copies of $k$-spheres, glued in a similar manner: the right hemisphere of the first one is glued to the left hemisphere of the second one, the right hemisphere of the second one is glued to the left hemisphere of the third one, and so on. (This is still homotopy equivalent to a wedge sum of $n$ copies of $S^d$). If it helps for visualization, you can also imagine a homeomorphic space that is a $d$-dimensional \" ;rectangular \" ; shape divided in $n$ \" ;chambers \" ; (when $d=1$, this looks like a row of a chessboard).", "731" ], [ "A connected compact smooth manifold $M$ of dimension $n$ with nonempty boundary deformation to a simplicial complex where all cells have dimension at most $n-1$. [See this answer by <PERSON> for a proof.](_URL_0_) The basic idea, as far as I understand, is to remove the boundary to get a noncompact manifold, take a triangulation of the resulting manifold, and then shrink all the $n$-cells starting \" ;from the outside \" ; (like when you deformation retract $[0,\\infty)$ onto $\\{0\\}$) & ndash; this last part is rather tricky and the first version of my answer was a bit naive, thanks to <PERSON> for giving me a link to the full proof.\r\n\r\nAnd now by cellular approximation, a map from a simplicial complex of dimension $\\le n-1$ to $S^n$ is nullhomotopic, because you can consider a CW-complex structure on $S^n$ where the $(n-1)$-skeleton is just a point.\r\n\r\n(I used a triangulation here, I&#39;m not sure it&#39;s strictly necessary... Maybe there&#39;s an easier argument.)", "737" ] ]
480
[ 15708, 6362, 6810, 17613, 3239, 8264, 8653, 17504, 19648, 12050, 4686, 16067, 16420, 6405, 8725, 14082, 3822, 8458, 11663, 11638, 18379, 7742, 1857, 8934, 1101, 539, 6182, 7021, 5344, 18769, 6510, 8940, 5012, 16015, 6489, 11435, 1177, 10260, 9133, 6271, 12999, 1815, 3132, 7466, 11121, 14076, 10223, 1848, 3706, 14764, 13194, 7892, 4847, 17377, 8738, 6324, 2878, 13812, 2704, 17088, 2463, 6004, 9121, 1065, 7440, 16729, 17494, 2400, 3558, 19411, 6345, 6849, 17339, 8344, 8465, 18140, 8076, 8080, 8454, 7356, 7264, 790, 11808, 8362, 4908, 8109, 3833, 16066, 3415, 18961, 11947, 14576, 8701, 18759, 15163, 16060, 7791, 11418, 6487, 6885, 7318, 5952, 4955, 12685, 16500, 3163, 15665, 17946, 4454, 1006, 8863, 2874, 3701, 18624, 7058, 1312, 15203, 12581, 10363, 5738, 14360, 231, 6354, 6392, 7084, 17019, 17031, 332, 9950, 8481, 18634, 7520, 8746, 9564, 8632, 7849, 2093, 7338, 17993, 14272, 7319, 11275, 263, 6943, 3620, 18344, 1073, 420, 7397, 7480, 9243, 3115, 10792, 1462, 445, 3993, 628, 11539, 8386, 3453, 4636, 12415, 4831, 5824, 7123, 15423, 5124, 2929, 3769, 77, 9885, 2030, 15301, 12150, 1667, 7379, 19116, 7992, 2475, 17015, 8593, 15603, 5415, 12012, 6054, 105, 12209, 8825, 7330, 8044, 6575, 10806, 11656, 7926, 17410, 4654, 4053, 2990, 1854, 1946, 17608, 6237, 9017, 15182, 3173, 840, 12328, 1711, 16520, 18853, 18577, 9439, 1250, 7231, 4841, 7696, 9076, 1149, 16740, 12758, 4066, 6883, 3388, 10991, 16751, 18589, 16037, 13248, 19343, 16107, 16111, 11739, 3060, 7776, 17429, 14887, 782, 9803, 18112, 7309, 18286, 1467, 1679, 17546, 12127, 7754, 19517, 16129, 928, 4690, 8057, 4300, 3684, 19588, 767, 890, 223, 1008, 6098, 6841, 19667, 2387, 17079, 8059, 7800, 16116, 5910, 18891, 4162, 1340, 18013, 2335, 11085, 10154, 7000, 15692, 2991, 18463, 1053, 13732, 3408, 4767, 13292, 11157, 6562, 16585, 14209, 8128, 6218, 18251, 4877, 14937, 8755, 7296, 13771, 2547, 5908, 9016, 2894, 2966, 6016, 19604, 19533, 3903, 10932, 1863, 9480, 18398, 773, 3142, 1701, 9983, 15934, 18878, 1851, 10079, 7552, 16134, 8431, 3552, 18805, 11586, 7258, 12142, 13355, 3131, 4043, 12137, 6390, 8703, 8597, 16489, 15556, 8491, 644, 15200, 872, 15999, 8016, 3493, 6558, 3599, 2036, 11784, 10934, 3035, 13107, 5659, 712, 16379, 6945, 3087, 2080, 3467, 11769, 10865, 2605, 18172, 7579, 19421, 8790, 5418, 8544, 397, 5241, 7491, 1517, 19651, 6023, 7366, 13157, 3602, 6028, 5805, 15827, 2692, 3949, 3412, 18470, 12372, 812, 17738, 4616, 11679, 6355, 11010, 16709, 740, 2854, 10405, 8494, 7229, 19374, 13103, 10623, 8239, 10121, 8508, 5664, 6418, 3739, 763, 5718, 17695, 4766, 3589, 8249, 13096, 6654, 12208, 9964, 15855, 883, 1687, 8430, 13986, 6169, 1401, 7008, 16659, 8831, 10842, 18076, 17165, 8367, 12814, 1827, 16041, 12124, 1247, 8928, 1554, 1983, 16505, 6116, 18174, 8705, 5572, 14917, 6284, 5599, 19141, 9572, 8307, 6459, 16569, 3250, 7217, 7135, 386, 2076, 8361, 7873, 17366, 1305, 9653, 1022, 5135, 16335, 15590, 6457, 17229, 17359, 9956, 7761, 18359, 8464, 10924, 12789, 13875, 16770, 19579, 4828, 12148, 15992, 8714, 7988, 4291, 11845, 6480, 7952, 5931, 19117, 2724, 9164, 7367, 16955, 2864, 19483, 16902, 17645, 4241, 858, 6231, 18789, 966, 13394, 2282, 9102 ]
STX_100142.0
[ [ "`fruits.length` only gives you the number of elements stored in fruits. How many is that? Only two. Fruits contains **two** elements. They just happen to be arrays containing other items:\r\n\r\n { \" ;orange \" ;, \" ;pear \" ;, \" ;banana \" ;, \" ;pinapple \" ; \" ;grape \" ;}\r\n { \" ;apple \" ;, \" ;kiwi \" ;, \" ;strawberry \" ;, \" ;plum \" ;}\r\n\r\nSo, to get the length of each array:\r\n\r\n fruits[0].length\r\n fruits[1].length", "903" ], [ "To <PERSON> your second question :\r\n\r\n > Is there any particular reason for wanting the action to be dimensionless? Is it simply that we want its numerical value to be independent of any system of units?\r\n\r\nthere are several reasons to it. One of them is that we don&#39;t want to bother about keeping track of the $\\hbar$ and $c$&#39;s everywhere, as they can add up pretty fast.\r\nOne other, more fundamental reason is that many physical phenomenon are scale-dependent. In the natural system of units, lenght is measured in the same units as inverse energy, so looking at a phenomenon at different scales is the same as looking at it at different energies. Therefore, measuring everything in terms of energy (or mass) enables to clearly see how a theory behaves at different energy scales : this idea is one of the basic principles of the Renormalization Group method.\r\nIn quantum electrodynamics for example, the mass of the electron varies according to the energy scale you&#39;re working at : this comes from the fact that the phenomenons involved in QED vary with the energy scale of the problem.\r\n\r\nAlso note that you cannot make any arbitrary choice of constants, it has to be consistent. For instance you cannot put $c=1$, $\\hbar=1$ as well as the QED coupling constant $e=1$, because this would make the fine structure constant $\\alpha = \\frac{e^2}{\\hbar c} = 1$, thus making the electromagnetic interaction much stronger than it really is ($\\alpha = \\frac{1}{137}$ at the atomic scale).", "779" ], [ "Two phenomenons are competing here. On the one hand, the needle of mass $m$ is attracted downwards so as to minimize its potential energy. When its altitude decreases by $\\delta h$, its potential energy decreases by $\\delta E_p = m g \\delta h$.\r\n\r\nOn the other hand, when the water surface curves downwards, it increases its total area by an amount $\\delta A$. Doing so requires an energy $\\delta E_S = \\sigma \\delta A$, $\\sigma$ being the surface tension.\r\n\r\nThere exists an equilibrium position that minimizes the sum of these two contributions, hence the equilibrium position of the needle on the water surface.", "242" ], [ "Conduction electrons in metals lie in the conduction band, they have a very low binding energy compared to electrons in an insulator, for instance. It thus requires a low amount of energy to excite them and have a photoelectric effect.\r\n\r\nYou can see on < a href= \" ;_URL_0_; article showing original data from Milikan, that the minimum amount of energy per photon required to have a photoelectric effect with sodium is of order of $\\Delta E_{\\text{conductor}} \\simeq 1,8$ eV.\r\n\r\nIn insulators, the highest-energy electrons lie in the valence band and you need a huge amount of energy to excite them : it is harder to have a photoelectric effect in this case. In the case of insulators, this energy is of order of magnitude of the first ionization energy of the atom or molecule which the solid is made of.\r\nYou can see < a href= \" ;_URL_1_; a table giving in eV the first ionization energy of each atom. (It&#39;s in french, couldn&#39;t find the same table on English wikipedia). You see that the energy required is of order of $\\Delta E_{\\text{insulator}} \\simeq 10$ eV for most insulating pure compounds. It is thus possible to have a photoelectric effect, but would require photons with ten times more energy than for insulators.", "775" ], [ "Conduction and valence bands is what creates the difference in behavior between most insulators and conductors. If you look at the energy levels of electrons in a solid, they are gathered in what we call \" ;bands \" ; with an energy gap between them. In insulators, the highest energy band is completely filled, wherehas in conductors it is only partially filled : we call this band the conduction band, and the lower-energy bands the valence band. You have a full explanation on this on wikipedia : _URL_0_", "658" ], [ "I agree with <PERSON>, charge ordering is a broader notion than CDW. My understanding is that CDW means charge ordering with a non-zero value for the wavevector $q$ : if your order parameter is some $\\Phi(q)$, you develop a nonzero expectation value for $ < \\Phi(q) > $ with $q \\neq 0$. \r\n\r\nOn the other hand, you could also get charge ordering for $q=0$ : it will be a uniform order, so I guess you can&#39;t call it a wave in this case.", "396" ], [ "I think what they are trying to say is that in a lattice of ions, the waves propagate at the plasma frequency *only* if we can assume that the interaction between ions is sufficiently small (this assumption is contained in the part \" ;is only valid if the forces between ions separated by R are negligibly small for R of order 1/k \" ;).\r\n\r\nBut in a bare lattice of ions, without electrons, this is not the case : ions interact with a Coulomb potential which decreases as 1/r, which is a long-range potential.\r\nHowever, if we add the conduction electrons, the Coulomb potential gets screened into a Yukawa potential of the form exp(-r)/r, which is short-ranged. Thus a metal has short-range interaction potential : we get a linear dispersion relation.", "396" ], [ "I&#39;m just giving you a hint. Assume you try to apply the ideal gas law. As there are forces acting from inside as well as from outside the cylinder, you would need to apply it inside and outside the cylinder. Try to do it with given parameters, and look at the mechanical equilibrium of the piston.\r\n\r\nEdit : Assume the outside is of infinite volume. Then the ideal gas law reads $P = \\rho R T$, $\\rho$ being the particle density. If we write the mechanical equilibrium of the piston, we get $P_{ext} S + m g = P_{int}$. $\\rho$, $R$ and $T$ are constants, so the external pressure doesn&#39;t change. We then conclude that the internal pressure doesn&#39;t change either.\r\nWe can make the same statement if the outside is of finite volume, taking into account the change in number of particles inside the cylinder (the total number of particles inside + outside being conserved). So I don&#39;t really understand the question you were given, I agree with the awnser of <PERSON>.", "475" ], [ "I&#39;m not sure to understand your statement, but you seem to be mixing up the frequency $f$ of the plane wave (which is related to the energy $E = h \\nu$ of the photons) and the rate at which photons cross some control surface. I don&#39;t see how they would be related. Here is how I understand the situation : if you try to collect photons from a very low amplitude plane wave, for instance with a CCD captor, you will get one photon every once in a while, the interval of time between two detected photons being random from one event to the other. If you wait for a time $\\tau$ until you get a reasonably high number of photons, say $N=1000$, you will get the following identity :\r\n\r\n\\begin{equation}\r\nP \\tau \\simeq N h \\nu ,\r\n\\end{equation}\r\n\r\n$P$ being the power oh your light source. This equality will get more and more accurate as you wait for a longer time and collect a higher number of photons ; as you will even out the randomness of photon detections.", "775" ], [ "You seem to be confusing different things. There is no such thing as \" ;$E = \\frac{1}{2} m v^2 + E_p$ \" ; in quantum mechanics, this is a classical interpretation of the energy. In the Schr&#246;dinger representation, $E$ represents some eigenvalue of the Hamiltonian operator, corresponding to an eigenstate of the system of energy $E$. Kinetic and potential energy are not numbers but operators, in fact the equation you wrote is just the eigenvalue-equation of the Hamiltonian poerator in 1-D cartesian coordinates : $(\\hat{E_c} + \\hat{E_p}) |\\Psi > = E |\\Psi > $, with $\\hat{E_c} = \\frac{(\\frac{\\hbar}{i} \\vec{\\nabla})^2}{2m}$ and $\\hat{E_p} = U_0(x)$.\r\n\r\nTo find the energy, you need to solve this equation with a given form for $U_0(x)$, and boundary conditions will give you the possible values of the energy $E$.", "779" ], [ "I am going over this review on pairing in unconventional superconductors : < _URL_0_;\r\n\r\nwhich on page 21 states that for a \" ;regular \" ; function $U(\\theta)$, partial components $U_l$ of angular momentum $l$ scale as $\\exp(-l)$ for large $l$. I tried to prove this statement but am not satisfied with my awnser, and would greatly appreciate some insight. Below is what I did so far.\r\n\r\nI assume here that \" ;regular \" ; means infinitely derivable. The partial component $U_l$ is defined as such :\r\n\r\n\r\n\r\n$\r\nU_l = \\int_{0}^{\\pi} U(\\theta) P_l(\\cos \\theta) \\sin \\theta d\\theta\r\n$\r\n\r\nsuch that\r\n\r\n\r\n$\r\nU(\\theta) = \\sum_{l=0}^{\\infty} U_l P_l(\\cos \\theta),\r\n$\r\n\r\nwhere $P_l(\\cos \\theta)$ is the $l$-th order Legendre polynomial. Let us make use of Rodrigue&#39;s formula :\r\n\r\n$P_l(\\cos \\theta) = \\frac{1}{2^l l!} \\frac{d^l}{dx^l} [(x^2-1)^l] |_{x=\\cos \\theta}$.\r\n\r\nThe highest-order term of this polynomial is $\\frac{1}{2^l l!} \\frac{(2l)!}{l!} \\cos^l \\theta$. So in the development of $U(\\theta)$, the contribution to the term of order $\\cos^l \\theta$ coming from the $l$-th order Legendre polynomial is $ U_l \\frac{1}{2^l l!} \\frac{(2l)!}{l!} \\cos^l \\theta$. There are also other contributions to this order coming from the higher-order Legendre polynomials, but they will be proportional to some $U_k$ with $k > l$. As we want to prove that $U_l$ is exponentially small as $l$ gets large, we can neglect these contributions for now.\r\n\r\nLet us now try to find an equivalent of $ U_l \\frac{1}{2^l l!} \\frac{(2l)!}{l!}$ as $l$ goes to infinity. We can make use of Stirling&#39;s formula :\r\n\r\n$\r\nl! \\sim (\\frac{l}{e})^l \\sqrt{2 \\pi l}$\r\n\r\nwhich gives us\r\n\r\n$ U_l \\frac{1}{2^l l!} \\frac{(2l)!}{l!} \\sim U_l 2^l \\frac{1}{\\sqrt{l \\pi}}$.\r\n\r\nIf we want $U(\\theta)$ to be a regular function, we need its high-order components in $\\cos^l \\theta$ to get smaller and smaller as $l$ gets large, as $\\cos^l \\theta$ behaves in a singular manner when $l$ goes to infinity. Thus, we need to have\r\n\r\n$U_l \\sim a^{-l}$, with $a > 2$, as $l$ goes to infinity.\r\n\r\n**Why I am not happy with this awnser :**\r\n\r\n- I neglected higher-order components in the contribution to $\\cos^l \\theta$\r\n- Maybe the $U_l$ could behave in a complicated oscillating way to make the $l$-th order term converge, without being exponentially small.\r\n\r\nDoes anyone have an alternate way of proving the fact that $U_l$ has to be exponentially small as $l$ gets large, or a way to complete the above proof ? Thanks for your help.", "344" ], [ "When you mix water and NaCl together, you create a solution which melting temperature is lower than 0&#176;C (say around -10&#176;C, depending on the amount of salt.\r\n\r\nWhen you put salt on a frozen road during winter, the air temperature can be between 0 and -10 degrees, in this case the mixture of ice and salt melts, because the exterior temperature is above the melting point of the mixture ice/salt : adding salt on the road \" ;makes ice melt \" ;, if you want. If the exteroir temperature is extremely low, like -30&#176;C, adding salt won&#39;t solve your problem.\r\n\r\nOn the other hand, to keep stuff like ice cream at a really low temperature, you might want to have a material which stays in equilibrium at a temperature lower than 0&#176;C. This is the case of a frozen mixture of salt and ice, which melting point can be around -10&#176;C.", "1015" ], [ "When you have a great number of interacting particles (such as electrons in a solid), it becomes impossible to try to describe each electron individually. We introduce the concept of quasiparticle to describe whan can be the low-lying excitations of the ensemble of particles.\r\n\r\nFor instance, If you take a metal at 0K, the ground state of the system is the Fermi sea. When you excite this metal with light, for instance, you can create a hole in the Fermi sea by making an electron jump to a state of higher energy. But due to the interactions with other electrons, this electron will eventually go back to its original state by recombining with the hole, and emitting a photon. We call this electron a \" ;quasi-electron \" ; because it has a finite lifetime.\r\n\r\nYou can think of quasiparticles as particles which are affected by the interactions with all the other particles surrounding it. I told you about the quasielectrons (which are fermions), but quasiparticles can be many other things : bosonic excitations such as magnons, plasmons, polarons... Are quasiparticles as well, in the sense that they are low-lying excitations of the ground state of a solid with a certain (long enough) lifetime.", "775" ], [ "The gas you are describing is not precisely an ideal gas, but is pretty close. In an ideal gas, the molecules are dots, they don&#39;t have volume ; moreover, threr are no interactions except for the elastic collisions that allows the gas to thermalize.\r\n\r\nThe gas you describe is is a gas with no interactions, but with molecules of finite volume. Having molecules of finite volume reduces the space avaliable for molecules to move around, hence the $V-b$ factor instead of just $V$ for an ideal gas.", "881" ], [ "What bugs you here is that the word \" ;speed \" ; isn&#39;t precise at all when we talk about a wave in a dispersive medium, such as water. What we usually refer to when we say the \" ;speed of light \" ; is the constant we call $c = 299792458$ m/s, which is equal to the velocity of light in the vacuum. Vacuum is non-dispersive, so the group and phase velocity are the same, and are equal to $c$.\r\n\r\nAlso, it is not very precise to say that \" ;photons \" ; travel at a certain \" ;speed \" ; inside a medium. Photons are quantum excitations of the electric field in the vacuum.\r\n\r\nWhen we talk about a transparent dielectric medium, the excitations are quantised polarization waves : depending on the precise microscopic details of your medium, the dispersion relation can be different of just $\\omega = k c$ ($k$ being the wavevector), which holds in vacuum. If the medium is dispersive, group and phase velocity are different. If you take a polychromatic light travelling through water, its group velocity will be less than $c$, thus the light will appear to travel slower.\r\n\r\nTo sum it all up, you can think of it like this : as long as you consider a linear propagation (which means you light is not too intense), frequency will never change, regardless of which medium you&#39;re travelling through. If you are inside the vacuum, velocity is $c$ and the wavelenght is just $\\frac{c}{\\lambda}$. Once you enter the medium, you get a non-trivial dispersion relation $\\omega(k)$. Then, the light appears to be moving at a velocity given by $\\frac{d \\omega(k)}{dk}$, which is the group velocity, it is usually lower than $c$.\r\n\r\nTo awnser your original question yes, <PERSON> of \" ;photons \" ; depend on the medium, it is just that light in a medium is a bit more complicated than just a photon.", "396" ], [ "The transformation $t \\mapsto -t$ transforms an ascending function into a decreasing one. It thus inverts the flow of time.\r\nYou have to think of it as a transformation on the *variable* $t$ which is an input in observables : each observable $O(t)$ will see time flowing backwards.\r\n\r\nAssume you want to apply the time-inverting transformation at some time $t_0$. Because of time-translation invariance, you can choose the transformation to be $t \\mapsto 2 t_0 - t$, it is equivalent to doing just $t \\mapsto -t$. You thus get the sequence you described in your question : by the transformation $t \\mapsto 100 - t$ starting at $t_0 = 50$, the sequence 50, 40, 30, 20, 10, 0 becomes 50, 40, 30, 20, 10, 0.", "333" ], [ "An applied electric or magnetic field doesn&#39;t alter the field of an electromagnetic field because, as you said, the superposition principle holds. This principle is a principle of linearity, and comes from the linearity of electromagnetic equations : **there is no interaction between photons at low energies.**\r\n\r\nYou can see it from a field theory point of view, as there is no bare interaction vertex between photons in QED.\r\n\r\nOn the other hand, in other theories such as QCD, gauge bosons (the gluons) carry a colour charge and can interact.", "891" ], [ "In spherical coordinates, you can write a spherical wave as $F(x,t) = A \\exp (ikr - i\\omega t)$. To say that two spherical waves are in phase at a certain point $(x,t)$ in space and time is to say that at this particular point, the argument inside the exponential is the same for both of them, up to a $2 \\pi$ phase factor.\r\n\r\nImagine you have two sources that emit spherical waves of wavelenght $\\lambda$, the sources are located at point $A$ and $B$, respectively. Let us denote by $\\phi_0$ the constant phase shift between the two sources (which is to say, in the case of sinusoidal waves, one of them is $\\cos(\\omega t)$ and the other is $\\cos (\\omega t + \\phi0)$).\r\n\r\nLet us look at a point $M$ in space. We call $D_A$ the distance between $M$ and $A$ and $D_B$ the distance between $M$ and $B$. The two spherical waves are in phase at point $M$ under the condition that\r\n\r\n$\\frac{2 \\pi}{\\lambda} D_A = \\frac{2 \\pi}{\\lambda} D_B + \\phi_0$\r\n\r\nThis formula comes from the statement I made earlier : looking at a certain point $M$ at time $t$, the argument of the two waves must the same for both of them, up to a $2 \\pi$ phase factor.", "396" ], [ "After $\\frac{T}{4}$ seconds, you curve will just be a horizontal line. After $\\frac{T}{2}$ seconds, the shape will be the symmetric of the curve you drew with respect to the $x$-axis. See the second picture of the wikipedia link for a pictural description :\r\n\r\n_URL_0_\r\n\r\nMathematically, a standing wave can be expressed as a function of the form $f(x)g(t)$, such as, for instance :\r\n\r\n$\\cos(\\omega t) \\cos(k x)$\r\n\r\nThe nodes of the wave are the places $x_n$ for which $\\cos(k x_n) = 0$. You thus see that the vibrationnal states at each $x_n$ is $0$, whatever the value of time $t$ is.\r\nOn the other hand, you see that at $t = \\frac{T}{4}$ we have $\\cos(\\omega t) = 0$, thus the wave is zero everywhere : it appears as a horizontal line.", "396" ], [ "In a lattice both [translational and rotational symmetries are broken](_URL_0_), which gives rise to longitudinal and transverse phonons which are the goldstone bosons of this symmetry-breaking. However you cannot link e.g. longitudinal modes to translational symmetry breaking and transverse to rotational : everything is mixed and the relationship between symmetry breaking and the different goldstone phonons depend on the symmetry of your lattice.", "748" ], [ "As orion stated, photons in vacuum have zero rest mass and travel at light speed. There are, however, some cases where you can have massive photons, such as in the [Abelian Higgs model](_URL_0_) which describes $U(1)$ symmetry breaking. This model applies to superconductivity : in a superconductor you have the <PERSON> effect, which is the fact that magnetic field penetrates over a very small depth inside of the superconductor. Its is a signature that the electromagnetic forces become short-ranged, or, in a field theory language, that the photon becomes massive.", "775" ], [ "There are three processes that will modify the temperature of your $t$ body.\r\n\r\n- Firstly, there is diffusion happening between the $t$ body and its surroundings because their temperature is different. The flux of energy is imposed by the second law of thermodynamics : it goes from greater temperature to lower temperature ($t$ gives energy to $T$) until both temperatures becomes equal.\r\n\r\n- Secondly, the $t$ body emits energy in the form of photons : this process is called [blackbody radiation](_URL_0_) and it would happen even if the $t$ body was surrounded by nothing but vacuum;\r\n\r\n- If one or two of the bodies is a fluid, its change in density caused by temperature inhomogenities causes a flow that can carry heat : this phenomenon is known as *convection* and also participates in the dynamics of the change of temperature of your $t$ body.\r\n\r\nTo understand why there is blackbody radiation, take the example of a body at temperature $t$ inside of a box filled with nothing but vacuum. For thermodynamic equilibrium to exist, the body needs to be in equilibrium with the vacuum, and this vacuum can contain photons. The blackdody radiation comes from the equilibrium between the gas of photons inside of the box with the matter body at temperature $t$ : this body interacts with the electromagnetic field by absorbing and emitting photons according to the thermodynamic laws of blackbody radiation.", "881" ], [ "You cannot increase the *local* magnetic flux as it is conserved because of Maxwell&#39;s equations : $\\vec{\\nabla}.\\vec{B} = 0$. However, you can use soft magnetic materials, often called [magnetic cores](_URL_1_) to concentrate the flux in a certain area and locally increase the magnetic field.\r\n\r\nSee [this](_URL_0_) picture that shows the effect of a magnetic core inserted inside of a solenoid : it tightens the field lines to create a greater magnetic field.", "891" ], [ "By definition, a plane wave has infinite spatial and time extension. By Fourier analysis, it thus has one unique frequency and wavelenght.\r\n\r\nIf you make it finite in space and/or time (like in a pulse), its spectrum broadens with new frequencies and wavelenghts and it is no longer what we call a \" ;plane wave \" ;.\r\n\r\nTo awnser your comment, the argument is just that by the principle of superposition your different waves will indeed propagate at the same speed, but the \" ;whole object \" ; won&#39;t be called a plane wave stricto sensu because it doesn&#39;t have a well-defined unique frequency.\r\nIf the different frequencies form a continuum, the wave interfere with each other to create a finite-size wave that reduces to a pulse if the continuum is very large. I think your understanding is right, it is just a matter of definition of what call a plane wave.", "396" ], [ "In the context of classical Newtonian mechanics, a point mass is always an approximation for an small object with a finite volume. The inverse square law is only valid outside of the mass distribution of the point-like object ; as <PERSON> pointed out, the law varies linearly with distance to the center inside of the mass distribution.\r\n\r\nThus you never get to reach the $r=0$ part of the inverse square law. However, in the context of General Relativity, there exists such singularity of space time that are called black holes. Correct me if I&#39;m wrong, but as far as I know GR only deals with what happens outside of this particular singularity point where the physical description breaks down.", "106" ], [ "It is not so clear what you mean by \" ;infinite \" ;, but maybe you mean to ask why gravity has infinite range. It comes from the fact that the force of gravity decreases as $1/r^2$, thus slow enough for it to be felt by objects at the other end of the Universe. The same property is seen in the electrostatic Coulomb&#39;s force that decreases as $1/r^2$ as well.\r\n\r\nThis is not the case of all the forces. For instance, Coulomb&#39;s repulsion between electrons in solids gets screened because of the presence of other electrons, and can be modelised by a potential of the form $\\exp(-ar)/r$ instead of the usual $1/r$. This potential is said to be *short-ranged* as it cannot be felt by two electrons far away for each other ($\\exp(-ar)/r$ decreases much faster than $1/r$).", "1000" ], [ "The main similarity between mechanical sound waves and electromagnetic waves is that it both corresponds to the propagation of some \" ;disturbance \" ;, in one case it is the local increasing or decreasing of pressure ; in the other it is the excitation of the electromagnetic field.\r\n\r\nSound waves require a material medium to propagate because of their very definition : they correspond to a local increase in pressure, which cannot exist in the vacuum.\r\n\r\nElectromagnetic waves are different because their means of propagation (the electromagnetic field) can exist in material media as well as in the vacuum : the physical vacuum isn&#39;t just empty space. The difference being that when it propagates inside of some medium, the characteristics of the medium (local density, polarisability, temperature...) can affect the way electromagnetic waves propagates with respect to its propagation in the vacuum.", "396" ], [ "> Is it because the velocity of water increases as it flows down which results in a decrease in cross sectional area?\r\n\r\nI believe you&#39;re right. We can also add that in the usual case of flow conservation, that water flow is constrained to \" ;stick in one piece \" ; by the tube inside of which it is flowing. In the case of the tap, the water flow binds together because of surface tension forces. But when the flow becomes to thin, an instability occurs as you can see it loses its circular shape.", "445" ], [ "If the wall is made of a perfectly reflective material (such as a mirror) no, you won&#39;t see the dot.\r\n\r\nHowever, most walls are covered with paint or made of a diffusive material : when the laser beam hits the wall, its light gets [diffused][1] in all directions. Thus you are able to see the laser spot on the wall.\r\n\r\nTo summarize : reflection depends on the smoothness of the surface, and, most importantly, on whick kind of material the surface is made of.\r\n\r\n\r\n [1]: _URL_0_", "291" ], [ "It also depends on whether or not the rope is inextensible. Assume it isn&#39;t. You tie one end to a rigid wall and pull on the other end with a constant tension $T$. Then at some time $t_0$, you start to pull with a slightly higher tension $T_1 > T$. It will take some time $\\tau$ of order $\\frac{L}{c}$, $c$ being the typical celerity of mechanical waves inside the rope, for the rope to reach equilibrium. During that time the tension inside the rope will be inhomogenous and somewhere between $T$ and $T_1$. After equilibrium is reached the tension in homogenous and equal to $T_1$.\r\n\r\nThis is indeed linked to the fact that between $t_0$ and $t_0 + \\tau$ the rope is accelerating.\r\n\r\nIf you repeat the same experiment with an inextensible rope, its rigidity is infinite thus the mechanical waves propagate at a celerity $c$ that tends to infinity. When you pull on it with a tension $T_1$, the rope immediately reaches equilibrium at tension $T_1$ everywhere inside the rope. This is linked to the fact that the rope don&#39;t accelerate in this case.\r\n\r\nYou also need the rope to have a lineic mass for this explanation to stand as the celerity $c$ of mechanical waves inside the rope is also inversely proportional to the square root of its lineic mass.", "242" ], [ "A weakly correlated many-electron system can be viewed in a first approximation as a [Fermi liquid](_URL_0_), meaning that it behaves similarly to a non-interacting electron gas with renormalized parameters.\r\n\r\nIn this respect, one can calculate the electronic self-energy $\\Sigma_{\\text{el}}(k, \\omega)$ which real and imaginary parts give information about the low-lying excitations of the system (the so-called quasiparticles).\r\n\r\nGiven an arbitrary interaction between electrons, do we have a general criterion on what the electronic self-energy should be, or how it should behave, for the system to be accurately described by the Fermi liquid theory ? I&#39;ve heard a lot of awnsers to this question such has \" ;the self-energy must be a smooth varying function \" ; or \" ;one must be able to expand it in powers of $k$ and $\\omega$ \" ; but I am somewhat not satisfied with these awnsers, and was wondering if there existed a more precise criterion.\r\n\r\nAny concrete example with an existing model would be greatly appreciated.", "775" ], [ "Yes. There are several mathematical models you can use to describe an elastic collision. One of the most popular is the [hard-sphere potential](_URL_1_) which assumes that the molecules are spheres of radius $a$ that cannot interpenetrate each other. Mathematically, it takes the form\r\n\r\n$V(r) = 0$ if $r > 2a$\r\n\r\n$V(r) = +\\infty$ if $r < 2a$, $r$ being the distance between the centers of two spheres.\r\n\r\nA more realistic, yet more complicated model is the [Lennard-Jones](_URL_0_) potential. It takes into account two terms : one varying in $1/r^{12}$ that is purely phenomenological and that describes the non-interpenetrability of molecules. The other term in $-1/r^6$, which is attractive, describes the attraction between two neutral molecules due to Van der Waals interactions.", "748" ], [ "You say that the statistical ensemble we use here is different, because we have prior information about the system. But do we ? In many introductory texbooks, we try to calculate the speed of a single particle after a few collisions. We can show that after a very short period of time (say 10 collisions) we completely lose the information about the speed or position of the particle. So is it reasonable to assume that we can track these \" ;subtle \" ; correlations ? Would it really make a measurable difference in the entropy ?", "201" ], [ "It depends what you mean by vibrational motion. A point mass indeed does not have *internal* vibrational degrees of freedom, it can just have translational motion, as you pointed out.\r\n\r\nHowever, if you attach this point mass to a spring you create a harmonic oscillator. It has a translational motion, but this oscillating motion can describe *vibrations* such as vibrations of atoms around their equilibrium state in a solid.", "242" ], [ "It is a method that is generally used for *conservative* unidimensional problems (problems with only one degree of freedom, here your angle $\\theta$ or cartesian coordinate $x$). You&#39;ll notice that it is equivalent to using Newton&#39;s second law in this case : let us write the total energy\r\n\r\n$E = \\frac{1}{2} m v^2 + V(x)$,\r\n\r\n$V$ being potential energy. The problem is conservative so $E$ is a constant, we derivate with respect to time to get\r\n\r\n$$0 = m v \\dot{v} + \\frac{\\mathrm d V(x)}{\\mathrm dt}$$\r\n\r\nbut $$ \\frac{\\mathrm d V(x)}{\\mathrm dt} = \\frac{\\mathrm d x}{\\mathrm dt} \\frac{d V(x)}{dx} = v \\frac{\\mathrm d V(x)}{\\mathrm dx}$$\r\n\r\nand remember that the conservative force $F$ is linked to its potential energy by $F = - \\frac{\\mathrm d V(x)}{\\mathrm dx}$. Simplifying by the velocity $v$, we get\r\n\r\n$m \\frac{\\mathrm dv}{\\mathrm dt} = F$ which is nothing but Newton&#39;s second law in one dimension.\r\n\r\nTo summarize : if you have a conservative problem, if it is in one dimension, use the conservation of energy method which is usually much easier to apply, and is equivalent to Newton&#39;s second law. If you are in more that one dimension (problems of satellites orbiting around planet, etc) you&#39;ll need to apply a vectorial theorem such as Newton&#39;s second law or the angular momentum theorem.", "779" ], [ "Spin indeed plays a role in this. Cooper pairs are bosonic in nature, below the critical temperature they condense into the same state to form a superfluid phase responsible for superconductivity. This is why they do not \" ;bump into eachother \" ;, they are all in the same state.\r\n\r\nMoreover, the condensation of Cooper pairs opens a gap in the excitation spectrum at low energies. This means that you need a finite amount of energy to break up a pair if a Cooper pair were to collide with something else inside the material. The energy gap $\\Delta$ is of same order of magnitude as the critical temperature $T_c$, in a way you can think of the superconducting transition as thermal fluctuations breaking up <PERSON> pairs when you reach $T_c$.\r\n\r\nAlso keep in mind that electrons forming pairs can actually be very far away from eachother, say a few hundreds of nanometers. Thus many pairs can occupy the same space, they form a very rigid superfluid phase that moves in \" ;one block \" ; and does not get affected by defects or other particles.", "748" ], [ "I think you get confused because you try to picture a photon in a classical framework. There is (unfortunately) no accurate way of explaining what a photon is without the use of quantum mechanics. A photon is much more complicated than just \" ;a set of oscillations during the span of a second \" ; : it is in essence a quantum of excitation of the electromagnetic field in the vacuum. I know it might sound a bit technical, but you need the framework of quantum field theory (more precisely, [quantum electrodynamics](_URL_1_)) to fully understand the nature of the photon.\r\n\r\nThere are number of classical experiments that were reconducted in a \" ;quantum way \" ; that might give an awnser to some of your (very legitimate) doubts on the topic. For instance, many versions of the famous Young&#39;s [double-slit experiment](_URL_0_) have been studied with single photons, or in other complicated situations that reveal the quantum nature of light.", "775" ], [ "There&#39;s a misunderstanding here. <PERSON> equations are not invariant under galilean transformations. Physics needs to be the same in any inertial frame, thus we need to define a new set of transformations. This is why we introduce the Lorentz transformation : it leaves Maxwell&#39;s equations the same in any inertial frame. Or, if you want, we need all the terms of the equations we write to be <PERSON> covariant.", "106" ], [ "This is not an artificial need. What yould be the point of doing physics if no one worked with the same laws ? The fields indeed change from one reference frame to another, but it doesn&#39;t alter physics. For instance, the Lorentz force takes the same form in every inertial frame. To convince yourself, you might want to redo the calculations of the first few paragraphs of [this](_URL_0_) article.", "106" ], [ "I&#39;ll just give you hints on each question.\r\n\r\n1. I assume you are using 3D cartesian coordinates. Two components appear to be zero. What can you deduce on the vector&#39;s direction ? Is this related to the direction of *propagation* ?\r\n\r\n2. You indeed have two <PERSON> equations that involve both electric and magnetic field. You thus have to choose one of them. Derivate something with respect to time is a simple operation, while taking the rotational is a much more complicated one. You already know the expression of the magnetic field, so I would apply the complicated operation to this field rather than to the unknown electric field.\r\n\r\nIn what medium are you calculating the field ? Is there conducting charges to support an electric current $J$ ?", "891" ], [ "The fundamental reason is to be found in the context of [Fourier analysis](_URL_0_), but I&#39;ll try not to use that.\r\n\r\nImagine you have a plane wave of a single frequency $\\omega$. In 1D for example, it can be written as $A \\cos (\\omega t - k x)$. This mathematical function takes values for $x \\in \\mathbb{R}$ and $t \\in \\mathbb{R}$.\r\n\r\nIf now you take a signal of frequency $\\omega$, but that doesn&#39;t \" ;go on forever \" ;, you have a function $A \\cos (\\omega t - k x)$ that takes values for $x \\in \\mathbb{R}$ and $t$ in a certain finite interval, say $t \\in [0, \\tau]$. I think you&#39;ll agree with me that this is not the exact same function : it takes value $A \\cos (\\omega t - k x)$ for $t \\in [0, \\tau]$ and zero otherwise. This is the reason why we cannot say, strictly speaking, that this signal has frequency $\\omega$ : in fact, it is composed of a *spectrum* of many different frequencies that are all very close to $\\omega$.\r\n\r\nHowever, if the time $\\tau$ is long enough (by this i mean much greater than the signal&#39;s period $T = \\frac{2 \\pi}{\\omega}$), the frequencies different than $\\omega$ will have a very small contribution to the signal. In that case, you can say that your signal is a good approximation of a plane wave of frequency $\\omega$.", "677" ], [ "Schr&#246;dinger&#39;s equation is not an equation describing some probability density. It is a fully deterministic equation that takes for input a quantum state |$\\Psi$ > and tells you how this state evolves with time. If you know the state |$\\Psi (t)$ > at a certain time $t$ and the Hamiltonian of the system, then you know exactly (at least formally) what the state |$\\Psi (t&#39;)$ > will be at a time $t&#39; > t$.\r\n\r\nThe fact that the quantity < $\\Psi$| $\\Psi$ > describes the probability density to find a particle at some point $x$ in real space (or equivalently at some impulsion $p$ in reciprocal space, depending on the representation you&#39;re using) tells you a different story. It is linked to the fact that the most information you can know in the quantum framework is the wavefunction |$\\Psi$ > , contrary to classical mechanics where you can track the trajectory of a particle (thus know its impulsion $p$ and position $x$ at every moment).\r\n\r\nThe \" ;uncertainty \" ; you have in quantum mechanics does not mean we lack some information on the system or that the evolution is non-deterministic. It just means that quantum determinism is different than classical determinism.\r\n\r\n**Edit :** to <PERSON> your comment, yes, it tells you *exactly* what the system will be at time $t&#39;$. This \" ;exactly \" ; means that you know what the quantum state |$\\Psi$ > will be at time $t&#39;$, given that you knew what it was at time $t$. It doesn&#39;t mean that you know what is the exact position and impulsion at this time $t&#39;$ : this is forbidden by the laws of quantum mechanics (namely the [uncertainty principle](_URL_0_)). The most you can know is the wavefunction. Don&#39;t worry, all of this will become clearer as you make progress in your study of quantum mechanics !", "679" ], [ "When you create a folder in the console, a zero-byte object is created with the folder name. So, for example, if you create a folder called `blah` in a folder called `test`, then the zero-byte object will be named `gs://bucket/test/blah/` (trailing slash included). Note: this object will only be created when creating a folder through the console. It&#39;s needed to show the folder so users can navigate into the folder.", "665" ], [ "Certain materials such as e.g. cuprates or iron-based superconductors exhibit quantum phase transitions characterised by \" ;lattice softening \" ;, which means that one or more of the elastic constants are greatly reduced as you approach the 2nd-order phase transition line. This phenomenon is currently under very active investigation with the study of the so-called *nematic* phase of cuprates and FeSC which phase transition induces such lattice softening.\r\n\r\nYou can see extended discussion on the topic [here](_URL_1_) or [here](_URL_0_).", "748" ], [ "> But it is said the phonons in a crystal are the various vibrational modes of the atoms, but because the centre of mass of the oscillating atoms does not move the k vector of the phonon (crystal momentum) is not a real momentum.\r\n\r\nThis is not the reason why we say that phonons carry *quasimomentum* instead of momentum. The actual, physical momentum of a single oscillating ion indeed has nothing to do with the momentum carried by the phonon.\r\n\r\nPhonons are longitudinal waves supported by the collective vibrations of the ions constituting a crystalline lattice. In this respect, we can associate them a wavelenght $\\lambda$. It is thus tempting to give them a wavevector $\\vec{k} = \\frac{2 \\pi}{\\lambda} \\vec{u}$ with $\\vec{u}$ the direction of the deformation. The quantity $\\hbar \\vec{k}$ is then called the quasimomentum of the phonon.\r\n\r\nHowever, this momentum is not an actual physical momentum because it does not obey the same conservation rules associated with momentum of usual particles such as photons or electrons. This comes from the fact that the lattice breaks translation symmetry : the medium in which the phonons propagate is a discrete lattice, on the opposite of, for instance, the vacuum in which propagates photons which is continuous. Or if you wish, the \" ;wave \" ; describing the phonons is only defined at a discrete number of points in space : the ions constituting the lattice. Because of the discrete nature of the lattice, there can be different wavelenghts that describe the same physical oscillation, as it is illustrated in [this](_URL_0_) picture. This is the reason why the [wavevector of phonons](_URL_1_) is only defined up to a integer times of the reciprocal vector of the lattice.\r\n\r\nConcerning you second question, yes electrons and phonons can interact, it is just that the conservation rules for momentum will be slighly adapted to account for the different nature of the quasimomentum of phonons. Electron-phonon scattering is a major cause of resistivity in metals, and electron-electron interaction via virtual phonon exchange is the microscopical mechanism responsible for superconductivity in many materials.\r\n\r\nTo awnser your comment, yes phonons are collective vibrations of all the atoms constituting the lattice : you can think of them as some normal modes, just as the normal modes of a vibrating guitar string. An intuitive picture to think of electron-phonon interaction is the following : phonons creates periodic displacements of the lattice, they can thus bring atoms closer or farther apart from eachother in different regions of the lattice. This creates inhomogenities of charge (because the constituents of the lattice are actually ions, and not atoms) ; the electrons being charged particles, they can scatter off these inhomogenities.\r\nIn the context of superconductivity, there is also an intuitive way of thinking of the <PERSON> pair formation by electron-phonon interaction : when an electron propagates throught the lattice, it attracts positive ions because of Coulomb interaction. This leaves behind him a trail of positive charge density that can in turn attract another electrons. This creates an effective retarded attractive interaction between the electrons which creates the <PERSON> pair.", "775" ], [ "Have you checked Mahan&#39;s Many-Particle Physics (Kluwer Academic / Plenum Publishers) ? I just did and chapter V has a detailed derivation of the polarizability of an homogenous electron gas, you should read the discussion done around p. 329 of section 5.5 of the third edition.\r\n\r\nThe factor you mention goes to zero for $\\theta = 0$ [$\\pi$] so I&#39;m tempted to say it comes from some selection rules regarding the polarization of incoming photons.", "775" ], [ "In a more general context than Weyl semimetals, in any theoretical condensed matter model we are always only interested in low-energy excitations. Thus assume you have an electron of momentum $\\vec{k}$ that lies just above the Fermi surface. Most condensed matter models can be accurately described in the framework of Landau&#39;s Fermi-liquid theory at low energy, meaning that the electrons behave in very good approximation as free particles with interaction-renormalized parameters. Thus the dispersion relation of your electron is just\r\n\r\n$\\epsilon(\\vec{k}) = \\frac{k^2}{2 m^*}$,\r\n\r\nwhere $m^*$ is the effective mass of the electron. We can decompose $\\vec{k}$ in two colinear vectors $\\vec{k} = \\vec{k_F} + \\delta \\vec{k}$, where $\\vec{k_F}$ lies on the Fermi surface and $\\delta \\vec{k}$ is small with respect to $k_F$. The dispersion relation then reads\r\n\r\n$\\epsilon(\\vec{k}) = \\frac{(\\vec{k_F} + \\delta \\vec{k})^2}{2 m^*} = \\frac{k_F^2}{2 m^*} + \\frac{k_F \\delta k}{m^*} + \\frac{\\delta k^2}{2 m^*}$.\r\n\r\nYou can then throw the $\\delta k^2$ part because it is second order, $\\frac{k_F^2}{2 m^*} = E_F$ is the Fermi energy which you take as a reference, and using the fact that $p_F = \\hbar k_F$ you get the desired formula.", "775" ], [ "You are mixing two phenomena: **boiling** that occurs within the bulk and indeed only at 100&#176;C at atmospheric pressure, and **evaporation** that can happen at any temperature and is a surface phenomenon.\r\n\r\nHowever, if you are strictly speaking about boiling, the boiling rate depends on the energy you input into your system. If you put your stove from medium to high, your water will stay at 100&#176;C but will boil faster (by this I mean that more water gets converted into vapor per second) because you input more energy per second into your system.\r\n\r\nIn fact, the enthalpy of vaporization of water is 2257 kJ/kg, which means that you need 2257 kJ of energy to vaporize 1 kg of water at 100&#176;C and atmospheric pressure. Imagine you want to boil 1 kg of water with a 2 kW heating plate. The minimum time required to boil the entire quantity would be\r\n\r\n$$t = \\frac{2257\\ kJ}{2\\ kW} \\approx 1000\\ \\text{seconds}$$ which is about fifteen minutes. In fact you need more time than that because of all the energy losses through radiation, diffusion in surrounding materials...", "881" ], [ "To build up a little bit on our comments, do you mean that you expect the trajectory to be of different shape at the end than at the beginning ? This is again only possible with friction. If there is no friction, your Newton&#39;s equation of motion reads\r\n\r\n$m \\frac{d^2 \\vec{r}}{dt^2} = m \\vec{g}$\r\n\r\nand is invariant under the transformation $t \\mapsto -t$ (it is said to have *time reversal symmetry*). The practical consequence is that your trajectory must have some axis of symmetry : the football cannot move differently flying upwards than falling downwards because each of these movements map eachother through the time-reversal transformation.\r\n\r\nHowever, if you add a friction term like\r\n\r\n$m \\frac{d^2 \\vec{r}}{dt^2} = m \\vec{g} - k \\frac{d \\vec{r}}{dt}$\r\n\r\n(with $k > 0$)\r\n\r\nthen you break time-reversal symmetry because $\\vec{v}$ becomes $- \\vec{v}$ under this transformation. Thus, as @leftaroundabout pointed out, you need a friction term to get the trajectory distorsion you described in your question.", "284" ] ]
376
[ 17562, 18226, 3695, 4945, 10629, 17765, 13758, 18957, 6869, 28, 679, 18470, 3077, 19613, 5524, 16150, 539, 18829, 10358, 12127, 13065, 9121, 10458, 5576, 18105, 18731, 9268, 5666, 16916, 5311, 16742, 8064, 445, 4427, 19752, 4582, 10056, 7722, 11845, 16221, 2323, 1462, 19373, 7217, 4704, 5755, 17963, 18717, 15933, 14193, 13194, 9135, 15423, 6810, 3703, 19152, 17221, 13771, 1799, 5310, 16032, 50, 3216, 2261, 17476, 14260, 3558, 19552, 12172, 11435, 17738, 8748, 4679, 2772, 19669, 636, 7174, 16770, 7843, 3738, 1554, 10413, 14104, 17192, 13302, 5851, 10837, 685, 16569, 18388, 12182, 3234, 16084, 17862, 15665, 13598, 11485, 4043, 8313, 16398, 18878, 17429, 10954, 4511, 16015, 18129, 7480, 7257, 11769, 15833, 2411, 1484, 17604, 625, 17019, 4703, 16207, 8434, 6075, 14293, 8928, 14764, 4136, 8603, 4509, 4652, 8727, 8873, 9104, 8725, 7026, 15992, 10432, 7258, 19060, 3843, 6841, 6541, 11532, 3100, 8734, 19663, 10267, 18853, 18766, 7742, 4877, 3324, 13351, 3233, 11209, 13679, 19288, 19632, 1265, 4690, 5195, 14291, 13746, 17932, 16505, 4878, 16973, 10538, 4041, 853, 2647, 8939, 17205, 16259, 9090, 8392, 2815, 6420, 16420, 18341, 19295, 18714, 3175, 18996, 17138, 3099, 5148, 528, 19517, 2146, 17592, 2624, 14978, 872, 2548, 12618, 18638, 3388, 10831, 18099, 6849, 858, 7675, 9386, 17364, 11476, 7607, 17525, 2179, 17148, 18523, 7124, 2341, 14897, 10723, 9950, 3597, 15120, 5002, 13347, 6248, 13161, 13986, 18266, 18345, 12325, 18562, 17546, 10993, 565, 5854, 4110, 7308, 15163, 16406, 17643, 9430, 14243, 18319, 6596, 6458, 19137, 16112, 7520, 19426, 13107, 3903, 11439, 855, 704, 10573, 16116, 5241, 7296, 5360, 8653, 15157, 2704, 6946, 15722, 18580, 15875, 10092, 5048, 3687, 18715, 14111, 5376, 17757, 5266, 12219, 3002, 619, 7696, 7576, 9061, 2221, 3132, 5561, 212, 3931, 14076, 3993, 6272, 18991, 3467, 5292, 2776, 14493, 16507, 8707, 17024, 2711, 7356, 6126, 12685, 7521, 8221, 12328, 13752, 18747, 2930, 13525, 12499, 4236, 3183, 3190, 12310, 1177, 16497, 5087, 9032, 18805, 19642, 17564, 19380, 1363, 6319, 6758, 17982, 18994, 10121, 11203, 8864, 3552, 4171, 10688, 5998, 4076, 11615, 923, 13103, 12124, 756, 261, 3883, 22, 19471, 11202, 4818, 6672, 5699, 5821, 10075, 9532, 16041, 18123, 19205, 5166, 2953, 15934, 16539, 15563, 8555, 19117, 4248, 1517, 6470, 5415, 18215, 9686, 503, 15716, 19512, 5885, 4836, 7857, 4075, 4636, 5265, 1569, 4180, 7761, 4083, 883, 4623, 18624, 4689, 7392, 17614, 12101, 17851, 16980, 17309, 810, 96, 13810, 17494, 17356, 19604, 18330, 8361, 17184, 18076, 14814, 4538, 7336, 1420, 12070, 8962, 6747, 11085, 19393, 15743, 4504, 15841, 6459, 16230, 3693, 3154, 3087, 16220, 5050, 7379, 12137, 16096, 17858, 9936, 8651, 9617, 14194, 14735, 1469, 10429, 19491, 10308, 12050, 12257, 5043, 17207, 3783, 7912, 4252, 4049, 9275, 19083, 2805, 940, 16390, 3769, 10931, 9986, 15603, 19709, 8057, 12372, 18519, 5150, 12809, 4583, 18527, 1722, 17808, 13013, 16129, 7518, 14410, 6793, 7229, 12999, 7892, 3173, 16177, 18592, 7432, 10595, 12847, 7012, 9213, 7178, 5012, 767, 15087, 18663, 10842, 14424, 17366, 5908, 11741, 16431, 19579, 19596, 17256, 2631, 6240, 17832, 5501, 18344, 833, 11410, 161, 16758, 1481, 11519, 18323, 5296, 8451, 18418, 4314, 9238, 12581, 389, 15215 ]
STX_10016.0
[ [ "Ultrasonic transducers that use piezoelectric ceramics can be expected to have long lifetimes. These ceramics do age but in a logarithmic way. Thus a parameter, such as the capacitance of the transducer, might change 1% from 10 to 100 days but will change 1% from 100 to 1000 days and so on. By the time that you receive the transducer, its age will be enough so that this time aging will not be of concern. Otherwise, if its construction is good and it is not subjected to excessive temperature or voltage, it should last essentially forever. I worked with sonar transducers using such ceramics that were expected to last at least 20 years. The only failure modes that I saw were water intrusion due to failed seals, connection failures due to poor soldering and cracking due to excessive stress.", "272" ], [ "The 25Z6GT is a dual rectifier tube that is rated for a maximum DC output current of 75 ma. If it was putting out the maximum of 75 ma than the dissipation in the 270 ohm resistor would be 1.52 watts and the dissipation in the 330 ohm resistor would be 1.86 watts. Assuming it is running somewhat less than maximum, say 50 ma, the respective dissipations would be 0.68 and 0.83 watts These numbers are consistent with a 2 watt resistor rating. If the resistors are overheating, then the current is too large which means something in the radio is drawing too much current. As a start, I suggest replacing each tube with its original, one at a time, to see if one of your new tubes is defective.", "803" ], [ "According to the data sheet, pins 1 and 6 are both connected to the common cathode. The data sheet also specifies a segment drop of 2 volts at a current of 20 ma. Therefore, you should chose a resistor to drop 3 volts at 20 ma for a 5 volt supply. That resistance is 150 ohms. You may have to adjust this slightly since the data sheet values are only nominal. However, there is a maximum specified current of 25 ma per segment which you should be careful to avoid exceeding.", "803" ], [ "That is correct. The current will flow in the direction determined by the sign of the current value and the direction of the arrow. If the current value is negative, then the current will flow in the opposite direction of the arrow. If the current value is positive, then it will flow in the direction of the arrow. In this example, the current value is negative because the current must flow in the same direction of the fixed current source for the circuit to be valid.", "658" ], [ "Simply put, of you can&#39;t do what you are asking for. For example, if a device requires a DC input voltage 10 volts and consumes 10 watts, then the input current will be 1 ampere. If you only have a 5 volt supply, you can&#39;t force the device to draw 2 amperes so that the total power remains 10 watts. Depending on the device, if you supply it 5 volts it will either draw only 0.5 ampere (if it is a purely resistive load), or more or less current if it is some other type of load. It probably won&#39;t work at all or not as well as with the specified input voltage. If you don&#39;t have the required voltage, then you need to use some kind of conversion device between your supply and the device to get that voltage. You can&#39;t change the characteristics of your device to suit your supply (at least in general).", "803" ], [ "Strictly speaking, when taken an average of numbers expressed in dB, you should convert each one to its corresponding ratio, average the ratios, and then convert back to dB. Otherwise, as already pointed out, you would be calculating the geometric and not the arithmetic mean. In practice, however, if the values in dB are not far apart, say a few dB, then the average of the dB&#39;s will be very close to the dB of the average. Thus you can usually skip the conversion step. For example, if the values are 9, 10, and 11 dB, then the difference in the two procedures is only about 0.03 dB.", "603" ], [ "It is not essential if you don&#39;t get down to actually building your own circuits but instead assemble purchased components. If you are really interested in the details of robotics and electronics, then soldering probably can&#39;t be completely avoided. Having said that, the dangers of soldering are not that high. The temperatures used in normal soldering are not high enough to vaporize the metals used such as lead, tin and copper so metallic fumes are not a problem. Of course lead free solders will eliminate any exposure to lead. The biggest problem is the fumes and skin contact with the rosins used in most soldering operations. These rosins can cause a variety of medical conditions. However, if you only solder occasionally and in a well ventilated area, the risks are minimal. If you google \" ;solder safety \" ;, a lot of useful information will become available which you can study and decide for yourself whether you want to be involved with soldering.", "846" ], [ "Assuming total resistance means the resistance seen by the 18 volt battery, then the procedure is to successively use the formulas for series and parallel resistors. First find the series result of R5 and R6. That resistance is then in parallel with R4. That result is in series with R3. Again, the result of that is in parallel with R2. Finally this result is in series with R1. If you do the arithmetic correctly, you will get the correct result.", "760" ], [ "1. Generally if an accuracy is given as 1.5%, it is assumed that this means &#177;1.5% unless otherwise stated. Thus you should not substitute one for the other.\r\n2. Precision can be better than accuracy. In your example, however, since the readings are near the edge of the circle and spread around, the precision is not much better than the accuracy. If the readings were closer together then the precision would be better than the accuracy.\r\n3. Precision could be expressed using &#177; meaning that the readings will cluster around the average reading within that percentage.\r\n4. Again, if you express precision without the &#177; sign, then the &#177; will generally be assumed. It is better to use the &#177; sign and avoid any ambiguity.", "675" ], [ "Although both values are in watts, they are referring to two different power quantities. The \" ;15 watts \" ; refers to the audio output power, i.e. the power delivered to the speaker. This is the power that generates the sound that you hear. The \" ;180 watts \" ; listed on the back of the amplifier refers to the power drawn from the AC input line. This is the power supplied to the amplifier from the AC wall socket (120 volts at a frequency of 60 Hz). It needs this power to run its internal electronics which produces the 15 watts of audio output power. The AC input power will always exceed the audio output power since the amplifier cannot be 100% efficient. In this case, its efficiency is pretty low (15 watts out for 180 watts in or an efficiency of 8.3%).", "887" ], [ "In general, an analog comparator could be defined as any device intended to compare two analog quantities using analog circuit techniques. In most practical cases, the two analog quantities are voltages and the most common circuit technique is a voltage comparator. However, for example, you might need to compare two resistors for which a Wheatstone Bridge would be a suitable analog comparator device. Thus, a voltage comparator is an example of an analog comparator but not all analog comparators are voltage comparators.", "760" ], [ "> When a feature (city, road, cloister, or farm) with the fairy is scored, the player **whose follower stands on the tile** with the fairy scores 3 points for standing there, and may score for the feature as normal. When scored, the follower returns to its owner, but the fairy remains.\r\n\r\nThe important part is the only meeple to get the bonus have to be on the SAME TILE as the fairy. And while there are 2 ways with expansions I am aware of that allow multiple meeple on a **single tile**, that is the only way you will get multiple bonuses.", "825" ], [ "The Mayor doesn&#39;t affect the *number of points* received for completing a City. The Mayor only affects **WHO** might get the points. If someone has a meeple in a city and you get your Mayor in the city, the mayor counts as the number of pennants in that city. \r\n\r\nSo if the City had 0 pennants, then your mayor would be 0 and the other meeple would be 1, allowing them to have &#39;more&#39; meeple. If there was 1 pennant, then you would tie and both get the score. If there were 2 or more pennants, than you would have more meeple (the number of pennants) and would &#39;win&#39; and get all the points your opponent getting nothing. \r\n\r\nThe Cathedrals as you&#39;ve noticed changed values from 2 points/tile and pennant to 3 per. So a city with 8 tiles and 2 pennants would go from 20 points to 30 points. Who ever has the most meeple in the city gets all the points (tie both get the same)", "364" ], [ "> **Using the turn order described in base Catan,** each player places a harbor settlement first and a regular settlement second on the starting island (each without a road). Your harbor settlement must be placed on one of the intersections marked with a circle (page 9). The regular settlement may be placed on any intersection, including those marked with a circle. You must of course observe the distance rule when building all harbor settlements and regular settlements. Your starting resources are 1 card from each terrain hex adjacent to your starting settlement (not harbor settlement).\r\n\r\n > The last player to place a settlement is the first to place a road adjacent to that settlement. That same player then places a settler ship (ship + settler) on one of the sea routes adjacent to his or her harbor settlement. The other players follow clockwise. Once everyone has placed their pieces the starting player begins the game by rolling the dice.\r\n\r\nI read that first line to mean you play like the base game, you place your harbor and then everyone else does too. Then the last person to place a harbor, places their settlement, with a road and then places a settler ship, back to the original player.", "713" ], [ "According to the manual of my Tek 465B scope, the coupling ring is connected through a resistor to the base of a transistor that controls the illumination of the 1X and 10X LED indicators. A typical probe (P6105) has an 11k resistor connected between the coupling pin on the probe body and ground. Thus when the probe is connected to the scope BNC connector, the transistor is connected to ground through this resistor. This changes its state which then turns off the 1X indicator and turns on the 10X indicator. If you could take the Tek probe BNC (with the coupling pin) and substitute it for the generic probe BNC, you might be able to make the probe sensing work.", "269" ], [ "Those are not typos. You are not interpreting the specifications correctly. For the HIGH levels, the specification is giving the minimum value that is guaranteed to be recognized as a HIGH, e.g. 2.1 volts when Vcc = 3.0 volts. Any voltage higher than 2.1 will be recognized as a HIGH. The typical voltage, 1.7 volts, is the value that a typical device will recognize as a HIGH but it is not guaranteed. Similarly, the maximum voltage that is guaranteed to be recognized as a LOW is 0.9 volts when Vcc = 3.0 volts. Any voltage lower than 0.9 volts will be recognized as a LOW. Typically, however, a value as high as 1.2 volts will be recognized as a LOW, but again this is not guaranteed. All of the other values in the specification should be interpreted in the same way. In general, maximum and minimum values are guaranteed, typical values are not.", "803" ], [ "No great science. Inside the device is a generator whose output voltage is a function of its rotor speed. Since the rotor is mechanically connected to the motor under test, the electronics in the device converts the voltage to an rpm reading of the motor speed. The disc attachment allows a measurement of surface speed per minute.", "137" ], [ "What has been proposed in earlier comments and answers is unrealistic. Just Google \" ;attenuation of radio waves in sea water \" ; and you will find that the attenuation, even at 10 MHz, is already approaching 100 dB/meter. Using radio waves for your application will limit your range to just a few meters at best. That is why sound transmission has been used in the past for applications like yours. You will still have problems because of the combination of the range you need and the data rate (there is a strong trade-off of these 2 parameters because of the high attenuations, even of sound, in water). I would try to contact other researchers in your area, as well as a good Internet search effort, to learn how what you want has been done in the past.", "507" ], [ "To answer your questions:\r\n\r\n1. If the copper wires touch, they will represent almost a direct short to the battery which will quickly drain the battery and it will heat up. Therefore, make sure that this does not happen.\r\n2. A moist soil will be more conductive (lower resistance) than a dry soil. Therefore, more current will flow from the battery.\r\n3. A simple multimeter, set to a current range, and placed in series with one of the copper wires, should be able to measure the current.\r\n4. It is difficult to calculate the current level since it depends on a number of factors including the size of your copper wires, the moisture content of the soil, the volume of the soil, impurities in the soil, etc.\r\n5. Because the current level is not known, it is difficult to predict how long the battery will last. If you can measure the current level, then a better determination of the battery life can be made.", "632" ], [ "An ordinary audio power amplifier should be able to handle your application. For example, an amplifier rated for 100 watts into 8 ohms has to supply an output voltage of about 28 VRMS. This voltage, with a 40 ohm load, will develop 20 watts. With a 20 ohm load, it could provide 40 watts. There should be no problem using a higher impedance load with typical audio power amplifiers. The only drawback is that you need an amplifier with a higher power rating than you need for your load.", "887" ], [ "10X probes (which usually have 10 megohms input resistance) are used to lessen the loading on a circuit. However, they are only useful for frequencies where the impedance of the input capacitance (usually about 10 picofarads) is not too low. Note that the impedance of 10 picofarads at 100 MHz is only about 159 ohms. Thus the 10 megohms of resistance of the probe is relatively useless. At these frequencies, most circuits are designed for 50 ohms. Thus, most high frequency oscilloscopes have dual inputs: high impedance (usually 1 megohm) and low impedance (50 ohms). There are 50 ohm feedthru terminations that can be used with oscilloscopes that don&#39;t have a internal 50 ohm termination. The normal 10X probes are not used at these frequencies (however there are 10X probes with 500 ohm input resistance designed to work with 50 ohm oscilloscope inputs and which have very low input capacitance).", "760" ], [ "An other way to disable the warning is to create a dummy identity function and use it on one of the constants.\r\n\r\n // Define this somewhere\r\n template < typename T > const T & identity(const T & t) { return t; }\r\n\r\n ...\r\n\r\n // NB: &#39;identity&#39; used only to remove \" ;warning C4127 \" ;\r\n if (identity(sizeof(alias_wchar_t)) == sizeof(wchar_t))\r\n {\r\n // do stuff\r\n }\r\n else\r\n {\r\n // do other stuff\r\n }\r\n\r\nThis is not perfect but seems more lightweight than other solutions and reusable for different type of constants.", "259" ] ]
380
[ 5058, 18627, 5276, 2862, 4682, 5222, 16350, 8884, 17727, 215, 18128, 15232, 18, 9337, 12796, 16882, 3199, 15302, 16220, 19140, 2935, 1696, 4405, 3217, 12973, 19479, 10696, 12488, 774, 17688, 8936, 2362, 17096, 16991, 3852, 7543, 17009, 13362, 3178, 16053, 1044, 2402, 1350, 4959, 19180, 8328, 17811, 17635, 12030, 2821, 19148, 16175, 3071, 1922, 10398, 1089, 4333, 8868, 17641, 13882, 16153, 12843, 11354, 15623, 12092, 4353, 18886, 4484, 2401, 5421, 1506, 15700, 17939, 12523, 1088, 2148, 491, 19401, 499, 2626, 5262, 18352, 4311, 7995, 1230, 17891, 1390, 3938, 8144, 18776, 14963, 6915, 10108, 19360, 4255, 6059, 6248, 15430, 18536, 19693, 11536, 1498, 11344, 17930, 18915, 11695, 17275, 10409, 19418, 5923, 247, 16068, 2183, 16617, 8181, 5361, 16114, 4153, 4098, 3213, 851, 5881, 4754, 18576, 15408, 8159, 5683, 1252, 5408, 18199, 14009, 3301, 11221, 19235, 3611, 18689, 12020, 9984, 17130, 15585, 17480, 17833, 15722, 18040, 8070, 10121, 11568, 12343, 6452, 7810, 1962, 15956, 405, 19477, 1232, 1306, 3791, 8498, 10270, 7679, 10330, 10348, 5717, 679, 2682, 19067, 17769, 2429, 380, 19769, 2332, 5451, 8309, 10718, 8835, 2173, 8792, 1957, 13136, 19024, 1120, 14281, 3895, 11298, 9169, 3065, 16526, 10703, 18557, 635, 11426, 1897, 12617, 16944, 10841, 9565, 9974, 19262, 19260, 5538, 3913, 17126, 11008, 12499, 9938, 3353, 14722, 12733, 19445, 6763, 7629, 513, 9813, 2960, 13281, 2024, 703, 3963, 15886, 14884, 11410, 10473, 3710, 16615, 19237, 10155, 1222, 16103, 19227, 3792, 12473, 821, 9741, 16916, 3336, 17803, 2114, 12775, 15923, 7220, 2710, 140, 1674, 16282, 1297, 7522, 6580, 16824, 14761, 18002, 3514, 2229, 950, 1125, 1934, 8621, 853, 9090, 1023, 7139, 1714, 19426, 10654, 17437, 1339, 9277, 1840, 3031, 10747, 10059, 15482, 14247, 4375, 18264, 5947, 16953, 5857, 2415, 12898, 6469, 749, 12192, 1786, 13561, 9702, 13567, 1560, 3050, 13795, 5401, 18034, 10562, 12482, 5629, 2338, 9693, 8327, 12308, 5186, 15477, 15313, 19554, 7202, 4679, 18787, 1324, 13445, 10031, 10599, 19392, 1930, 10577, 966, 5534, 16575, 12694, 2855, 14097, 684, 8414, 5181, 12856, 6083, 19052, 10295, 13430, 640, 9201, 902, 8062, 2113, 8355, 15038, 16496, 15724, 10733, 958, 9469, 8120, 16261, 331, 4700, 10377, 18171, 11095, 14119, 5357, 13570, 11872, 11203, 17576, 11451, 2342, 17033, 14785, 19132, 4511, 7828, 2215, 16627, 9279, 9825, 10319, 1039, 9539, 17133, 1453, 11061, 18508, 16503, 5076, 9852, 11074, 716, 6367, 18328, 12003, 1517, 13793, 11184, 8865, 3596, 9449, 6100, 17293, 5068, 1893, 921, 9936, 1102, 18999, 3446, 2278, 3475, 11431, 2764, 1617, 9663, 11187, 15459, 14994, 15904, 9324, 13696, 4614, 9180, 11720, 12896, 19190, 10768, 5458, 2947, 11603, 4588, 6854, 14111, 16804, 711, 6627, 10292, 9569, 18523, 7030, 16845, 8013, 4513, 4976, 5586, 9831, 5036, 1215, 16291, 5185, 4527, 19416, 1620, 3201, 1613, 345, 1571, 984, 9412, 15351, 8908, 11711, 1239, 13244, 9441, 14392, 16885, 4579, 4491, 11860, 4989, 1919, 11103, 19550, 19027, 1582, 3780, 2250, 7907, 657, 4782, 4953, 5777, 18865, 8910, 12815, 8055, 5118, 8809, 15340, 11575, 18119, 1135, 7199, 9764, 9603, 19261, 2165, 1588, 3528, 1402, 18485, 455, 3316, 10420, 6457, 17307, 522, 19399, 4649, 6230, 6560, 11230, 885, 7589, 14357 ]
STX_1001643.0
[ [ "To make this algorithmically nicer, craft a recursive function that systematically reduces the problem rather than looking for intersections. \r\n\r\nThe recursive reduction step is basically \" ;take k-elements out of the pool and then split over the *remainder* of the pool \" ;. Something like this:\r\n\r\n from itertools import combinations\r\n from pprint import pprint\r\n \r\n def split(s, k=2): # type: (s: set) - > Iterable[List[tuple]]\r\n if len(s) < = k:\r\n yield []\r\n for thispair in combinations(s, k):\r\n remainder = s.difference(thispair)\r\n for otherpairs in split(remainder, k):\r\n yield [thispair] + otherpairs\r\n \r\n pprint(list(split({1, 2, 3, 4, 5})))\r\n\r\nThere will need to be some additional logic to make sure that duplicate search paths aren&#39;t explored so that ``[{1, 2}, {3, 4}]`` and ``[{3, 4}, {1, 2}]`` aren&#39;t both in the output. This should be enough to get you started though.", "443" ], [ "The general guidance per [PEP 8][1]:\r\n\r\n > Imports are always put at the top of the file, just after any module\r\n > comments and docstrings, and before module globals and constants.\r\n\r\nThat said, people sometimes put imports inside functions in the rare cases where the module should only be imported in the event of a particular function call (typically when the module isn&#39;t always available, or to avoid a circular import, or if the import does something expense and needs to be deferred). For example, see the [server adapters for the *itty* micro-webframework][2].\r\n\r\nAnother practice is to place some of the imports right after ``if __name__ == &#39;__main__&#39;`` for modules that are only used in the main section. That prevents unnecessary sub-imports when someone imports the current module.\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "277" ], [ "Use can use [collections.Counter()][1] to aggregate the summary totals, then loop over that summary to build the desired dictionaries:\r\n\r\n > > > from collections import Counter\r\n\r\n > > > maps = [\r\n {&#39;username&#39;: &#39;unique_username&#39;, &#39;t&#39;: 20},\r\n {&#39;username&#39;: &#39;unique_username_2&#39;, &#39;t&#39;: 13},\r\n {&#39;username&#39;: &#39;unique_username&#39;, &#39;t&#39;: 20},\r\n {&#39;username&#39;: &#39;unique_username_2&#39;, &#39;t&#39;: 11},\r\n ]\r\n\r\n > > > summary = Counter()\r\n > > > for m in maps:\r\n summary[m[&#39;username&#39;]] += m[&#39;t&#39;]\r\n\r\n > > > [{&#39;username&#39;: uun, &#39;t&#39;: total} for uun, total in summary.items()]\r\n [{&#39;username&#39;: &#39;unique_username_2&#39;, &#39;t&#39;: 24}, {&#39;username&#39;: &#39;unique_username&#39;, &#39;t&#39;: 40}]\r\n\r\n\r\n [1]: _URL_0_", "200" ], [ "Just use the ``.keys()`` method to create an independent list of keys.\r\n\r\nHere is a working version of your code for Python 2.7:\r\n\r\n > > > dict1 = {&#39;A&#39; : &#39;first&#39;, &#39;B&#39; : &#39;second&#39;, &#39;C&#39; : &#39;third&#39;, &#39;D&#39; : &#39;fourth&#39;}\r\n > > > dict2 = {}\r\n > > > for key in dict1.keys(): # this makes a separate list of keys\r\n if key in (&#39;A&#39;, &#39;B&#39;):\r\n dict2[key] = dict1[key]\r\n elif key == &#39;C&#39;:\r\n print &#39;Do this!&#39;\r\n else:\r\n print &#39;Do something else&#39;\r\n del dict1[key]\r\n\r\n Do this!\r\n Do something else\r\n > > > dict1\r\n {}\r\n > > > dict2\r\n {&#39;A&#39;: &#39;first&#39;, &#39;B&#39;: &#39;second&#39;} \r\n\r\nFor Python 3, add *list()* around the ``.keys()`` and use the print-function:\r\n\r\n > > > dict1 = {&#39;A&#39; : &#39;first&#39;, &#39;B&#39; : &#39;second&#39;, &#39;C&#39; : &#39;third&#39;, &#39;D&#39; : &#39;fourth&#39;}\r\n > > > dict2 = {}\r\n > > > for key in list(dict1.keys()): # this makes a separate list of keys\r\n if key in (&#39;A&#39;, &#39;B&#39;):\r\n dict2[key] = dict1[key]\r\n elif key == &#39;C&#39;:\r\n print(&#39;Do this!&#39;)\r\n else:\r\n print(&#39;Do something else&#39;)\r\n del dict1[key]\r\n\r\n Do this!\r\n Do something else\r\n > > > dict1\r\n {}\r\n > > > dict2\r\n {&#39;A&#39;: &#39;first&#39;, &#39;B&#39;: &#39;second&#39;}", "58" ], [ "A ``NameError`` is caused by using a name that isn&#39;t defined. Either it is misspelled or has never been assigned.\r\n\r\nIn the above code, *i* hasn&#39;t been assigned yet. The while-loop is trying to find the current value of *i* to decide whether to loop.\r\n\r\nFrom the context, it looks like you intended to have a for-loop. The difference is that the for-loop assigns the variable for you.\r\n\r\nSo replace this:\r\n\r\n while i in range(len(words)):\r\n\r\nWith this:\r\n\r\n for i in range(len(words)):", "598" ], [ "You can get a nice speed-up by localizing the variables in *f()*:\r\n\r\n def f(ID=ID, a=a, b=b, w=w):\r\n for i in ID:\r\n a[i] = b[i] * w\r\n\r\nSome folks don&#39;t like localizing in that way, so you can also build a closure which will give you a speed-up of global variable access:\r\n\r\n def make_f(a, b, w, ID):\r\n def f():\r\n for i in ID:\r\n a[i] = b[i] * w\r\n return f\r\n\r\n f = make_f(a, b, w, ID)\r\n\r\nSee [this analysis][1] of which types of variable access are fastest.\r\n\r\nAlgorithmically, there is not much else that can be done. The looping over *ID* is fast because it just increments reference counts for existing integers. The hashing of the integers is practically instant because the hash of an int is the int itself. Dict lookups themselves are already highly optimized. Likewise, there is no short-cut for multiplying by a constant.\r\n\r\n\r\n [1]: _URL_0_", "730" ], [ "A reasonable strategy is to wrap the functions of one argument with another function that supplies but doesn&#39;t use the other argument:\r\n\r\n\r\n def dup2(gene, othergene):\r\n return duplicate(gene)\r\n\r\n def del2(gene, othergene):\r\n return delete(gene)\r\n\r\nThe will make the two shorter signatures match the other functions: ``replace(gene, othergene), insert(gene, othergene), othermutation(gene, genotype)``.\r\n\r\nAnother strategy is to use ``try/except`` to test the possibilities:\r\n\r\n try:\r\n return func(gene, othergene) # try two-arguments\r\n except TypeError:\r\n return func(gene) # try one-argument", "904" ], [ "Try using append-logic instead of using indexing.\r\n\r\n address = []\r\n address_info = (&#39;Name:&#39;, &#39;Address:&#39;, &#39;City:&#39;, &#39;State&#39;, &#39;Zip Code&#39;)\r\n \r\n print(&#39;***DELIVERY METHOD***&#39;)\r\n print(&#39;Please enter the info below from customer...&#39;)\r\n\r\n for info in address_info: # these are the values not indicies\r\n user_input = input(info)\r\n address.append(user_input)\r\n\r\nThere were to issues in your original code. First, the for-loop will loop over the values from *address_info* rather than the indicies. Second, the result list needs to be grown by appends; you can&#39;t make an indexed assignment until the list already has some value at the the position that can be replaced.", "814" ], [ "> Instead of finding the index outside of the per_window function, is there another way to add such a constraint in the per_window function?\r\n\r\nYes, you can add the condition just before the yield:\r\n\r\n def per_window(sequence, target, n=1):\r\n start, stop = 0, n\r\n seq = list(sequence)\r\n while stop < = len(seq):\r\n subseq = seq[start:stop]\r\n if target in subseq:\r\n yield tuple(subseq)\r\n start += 1\r\n stop += 1", "814" ], [ "There are two major differences between *shuffle()* and *sample()*:\r\n\r\n1) Shuffle will alter data in-place, so its input must be a mutable sequence. In contrast, sample produces a new list and its input can be much more varied (tuple, string, xrange, bytearray, set, etc).\r\n\r\n2) Sample lets you potentially do less work (i.e. a partial shuffle).\r\n\r\nIt is interesting to show the conceptual relationships between the two by demonstrating that is would have been possible to implement *shuffle()* in terms of *sample()*:\r\n\r\n def shuffle(p):\r\n p[:] = sample(p, len(p))\r\n\r\nOr vice-versa, implementing *sample()* in terms of *shuffle()*:\r\n\r\n def sample(p, k):\r\n p = list(p)\r\n shuffle(p)\r\n return p[:k]\r\n\r\nNeither of these are as efficient at the real implementation of shuffle() and sample() but it does show their conceptual relationships.", "712" ], [ "In general, the answer is no. Some of the exceptions are documented but most just follow a general pattern that can be learned. *SyntaxError* is checked first and is raised for syntactically invalid code. *NameError* arises when a variable is undefined (not assigned yet or misspelled). *TypeError* is raised for the wrong number of arguments or mismatched data types. *ValueError* means the type is correct and but the value doesn&#39;t make sense for the function (i.e. negative inputs to math.sqrt(). If the value is an index in a sequence lookup, *IndexError* is raised. If the value is a key for a mapping lookup, *KeyError* is raised. Another common exception is *AttributeError* for missing attributes. *IOError* is for failed I/O. And *OSError* for operating system errors.\r\n\r\nBesides learning the common patterns, it is usually easy to just run a function and see what exception it raises in a given circumstance.\r\n\r\nIn general a function cannot know or document all the possible errors, because the inputs can raise their own exceptions. Consider this function:\r\n\r\n def f(a, b):\r\n return a + b\r\n\r\nIt can raise *TypeError* if the number of arguments are wrong or if *a* doesn&#39;t support the ``__add__`` method. However, the underlying data can raise different exceptions:\r\n\r\n > > > f(10)\r\n \r\n Traceback (most recent call last):\r\n File \" ; < pyshell#3 > \" ;, line 1, in < module > \r\n f(10)\r\n TypeError: f() takes exactly 2 arguments (1 given)\r\n > > > f(10, 20)\r\n 30\r\n > > > f(&#39;hello&#39;, &#39;world&#39;)\r\n &#39;helloworld&#39;\r\n > > > f(10, &#39;world&#39;)\r\n \r\n Traceback (most recent call last):\r\n File \" ; < pyshell#6 > \" ;, line 1, in < module > \r\n f(10, &#39;world&#39;)\r\n File \" ; < pyshell#2 > \" ;, line 2, in f\r\n return a + b\r\n TypeError: unsupported operand type(s) for +: &#39;int&#39; and &#39;str&#39;\r\n > > > class A:\r\n \tdef __init__(self, x):\r\n \t\tself.x = x\r\n \tdef __add__(self, other):\r\n \t\traise RuntimeError(other)\r\n \r\n > > > f(A(5), A(7))\r\n \r\n Traceback (most recent call last):\r\n File \" ; < pyshell#13 > \" ;, line 1, in < module > \r\n f(A(5), A(7))\r\n File \" ; < pyshell#2 > \" ;, line 2, in f\r\n return a + b\r\n File \" ; < pyshell#12 > \" ;, line 5, in __add__\r\n raise RuntimeError(other)\r\n RuntimeError: < __main__.A instance at 0x103ce2ab8 >", "759" ], [ "For *numpy*, <PERSON> is the way to go.\r\n\r\nFor pure python, the technique is to pre-weight the population and then use *random.sample()* to extract the values without replacement:\r\n\r\n > > > # Extract 10 values without replacement from a population\r\n > > > # of ten heads and four tails.\r\n > > > from random import sample\r\n > > > population = [&#39;heads&#39;, &#39;tails&#39;]\r\n > > > counts = [10, 4]\r\n > > > weighted_pop = [elem for elem, cnt in zip(population, counts) for i in range(cnt)]\r\n > > > sample(weighted_pop, k=10)\r\n [&#39;heads&#39;, &#39;tails&#39;, &#39;tails&#39;, &#39;heads&#39;, &#39;heads&#39;, &#39;tails&#39;, &#39;heads&#39;, &#39;heads&#39;, &#39;heads&#39;, &#39;heads&#39;]\r\n\r\nNote, the weights are really counts. This is important because when you sample without replacement, the count needs to be reduced by one for each selection.", "531" ], [ "There are multiple ways to solve this. Just choose the one that is most convenient for your situation and that you find to be the most readable. \r\n\r\nThe *random.choice()* method works great when you population of eligible choices is already in a list:\r\n\r\n > > > rooms = [&#39;1&#39;, &#39;2&#39;, &#39;3&#39;, &#39;4&#39;, &#39;5&#39;, &#39;6&#39;, &#39;7&#39;, &#39;8&#39;, &#39;9&#39;, &#39;10&#39;, &#39;11&#39;, &#39;12&#39;, &#39;13&#39;, &#39;14&#39;, &#39;15&#39;]\r\n > > > random.choice(rooms)\r\n &#39;7&#39;\r\n\r\nThe *random.randrange()* function works when the choices are numeric and contiguous (though you will still have to call *str* afterwards):\r\n\r\n > > > str(random.randrange(1, 16))\r\n &#39;2&#39;\r\n\r\nFor a computer science point of view that last one is the most elegant; however, in terms of clearly expressing the intent of the code in a game, the first one wins by saying \" ;make a random choice of the available rooms \" ;.", "418" ], [ "I would build a random latin square by 1) start with a single random permutation, 2) populate the rows with rotations 3) shuffle the rows 4) transpose the square 5) shuffle the rows again:\r\n\r\n from collections import deque\r\n from random import shuffle\r\n\r\n def random_latin_square(elements):\r\n elements = list(elements)\r\n shuffle(elements)\r\n square = []\r\n for i in range(len(elements)):\r\n square.append(list(elements))\r\n elements = elements[1:] + [elements[0]]\r\n shuffle(square)\r\n square[:] = zip(*square)\r\n shuffle(square)\r\n return square\r\n\r\n if __name__ == &#39;__main__&#39;:\r\n from pprint import pprint\r\n square = random_latin_square(&#39;ABCD&#39;)\r\n pprint(square)", "418" ], [ "The short answer is that lists use linear search and dicts use amortized O(1) search.\r\n\r\nIn addition, dict searches can skip an equality test either when 1) hash values don&#39;t match or 2) when there is an identity match. Lists only benefit from the identity-implies equality optimization.\r\n\r\nBack in 2008, I gave a talk on this subject where you&#39;ll find all the details: _URL_0_\r\n\r\nRoughly the logic for searching lists is:\r\n\r\n for element in s:\r\n if element is target:\r\n # fast check for identity implies equality\r\n return True\r\n if element == target:\r\n # slower check for actual equality\r\n return True\r\n return False\r\n\r\nFor dicts the logic is roughly:\r\n\r\n h = hash(target)\r\n for i in probe_sequence(h, len(table)):\r\n element = key_table[i]\r\n if element is UNUSED:\r\n raise KeyError(target)\r\n if element is target:\r\n # fast path for identity implies equality\r\n return value_table[i]\r\n if h != h_table[i]:\r\n # unequal hashes implies unequal keys\r\n continue\r\n if element == target:\r\n # slower check for actual equality\r\n return value_table[i]\r\n\r\nDictionary hash tables are typically between one-third and two-thirds full, so they tend to have few collisions (few trips around the loop shown above) regardless of size. Also, the hash value check prevents needless slow equality checks (the chance of a wasted equality check is about 1 in 2**64).\r\n\r\nIf your timing focuses on integers, there are some other effects at play as well. That hash of a int is the int itself, so hashing is very fast. Also, it means that if you&#39;re storing consecutive integers, there tend to be no collisions at all.", "618" ], [ "> Python: Is \\__setattr__ called when an existing attribute is incremented?\r\n\r\nThe answer is yes. This is easily seen with a simplified version of your code:\r\n\r\n class C(object):\r\n\r\n def __init__(self, a):\r\n object.__setattr__(self, &#39;a&#39;, a)\r\n\r\n def __setattr__(self, name, value):\r\n print(&#39;Setting {} to {}&#39;.format(name, value))\r\n object.__setattr__(self, name, value)\r\n \r\n\r\n c = C(10)\r\n c.a += 1\r\n\r\nRunning that snippet produces:\r\n\r\n Setting a to 11\r\n\r\n\r\nThe issue with the code you posted is that ``+=`` calls ``__getattribute__`` first before it calls ``__setattr__``. That is what fails if the attribute doesn&#39;t already exist. \r\n\r\nThe solution is to make sure the attributes are initialized before the call to *bump()*:\r\n\r\n class C(object):\r\n \r\n def __init__(self, a, b, c):\r\n object.__setattr__(self, &#39;a&#39;, a)\r\n object.__setattr__(self, &#39;b&#39;, a)\r\n object.__setattr__(self, &#39;c&#39;, a)\r\n\r\nIn addition to that fix, there are other errors as well (in *inspect* for example) but this should get you started.", "328" ], [ "Here are some ideas:\r\n\r\n* The [*str.replace()*][1] function is the simplest way to replace strings, ``s.replace(y, z)``.\r\n\r\n* The [*re.sub()*][2] function will let you search for patterns and replace with strings: ``re.sub(y, z, s)``.\r\n\r\n* The [*fileinput*][3] module will allow you to modify in-place.\r\n\r\nHere&#39;s one way to do it:\r\n\r\n import fileinput\r\n import re\r\n\r\n with fileinput.input(files=(&#39;file1.txt&#39;, &#39;file2.txt&#39;), inplace=True) as f:\r\n for line in f:\r\n print( re.sub(y, z, line) )\r\n\r\nHere another idea:\r\n\r\n* Instead of processing line-by-line, just read the whole file in as a single string, fix it up, and then write it back.\r\n\r\nFor example:\r\n\r\n import re\r\n\r\n with open(filename) as f:\r\n s = f.read()\r\n with open(filename, &#39;w&#39;) as f:\r\n s = re.sub(y, z, s)\r\n f.write(s)\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_2_\r\n [3]: _URL_0_", "782" ], [ "The cleanest way is to separate the tables before feeding each group to the csv reader. Here is a rough cut to get you started:\r\n\r\n from itertools import takewhile\r\n import csv\r\n\r\n # Instead of *s*, you can use an open file object here\r\n s = &#39;&#39;&#39;\\\r\n *aa\r\n 1,foo1,foo_bar1 \r\n 2,foo2,foo_bar2\r\n *bb\r\n 1.22,bla1,blabla1,blablabla22\r\n 1.33,bla2, ,blablabla33\r\n &#39;&#39;&#39;.splitlines()\r\n\r\n it = iter(s)\r\n next(it)\r\n for table in [&#39;aa&#39;, &#39;bb&#39;]:\r\n print(f&#39;\\nTable: {table}&#39;)\r\n for row in csv.reader(takewhile(lambda r: not r.startswith(&#39;*&#39;), it)):\r\n print(row)\r\n\r\nThis produces:\r\n\r\n Table: aa\r\n [&#39;1&#39;, &#39;foo1&#39;, &#39;foo_bar1 &#39;]\r\n [&#39;2&#39;, &#39;foo2&#39;, &#39;foo_bar2&#39;]\r\n \r\n Table: bb\r\n [&#39;1.22&#39;, &#39;bla1&#39;, &#39;blabla1&#39;, &#39;blablabla22&#39;]\r\n [&#39;1.33&#39;, &#39;bla2&#39;, &#39; &#39;, &#39;blablabla33&#39;]", "288" ], [ "The nested defaultdict is a two-dimensional data structure (for every source city there are possible multiple destinations). Accordingly, it makes sense to use nested for-loops to traverse the data and reinsert into a new *defaultdict* with the dimensions reversed (swapping the source and destination):\r\n\r\n > > > from collections import defaultdict\r\n\r\n > > > start = defaultdict(dict, {&#39;NYC&#39;: {&#39;LA&#39;: &#39;3000&#39;}, &#39;SanFrancisco&#39;: {&#39;Houston&#39;: &#39;1000&#39;}, &#39;LA&#39;: {&#39;Detroit&#39;: &#39;200&#39;, &#39;Ames&#39;: &#39;300&#39;, &#39;SanFrancisco&#39;: True}, &#39;Austin&#39;: {&#39;Houston&#39;: &#39;500&#39;}})\r\n\r\n > > > goal = defaultdict(dict)\r\n > > > for source, dests in start.items():\r\n \t for dest, distance in dests.items():\r\n \t\t goal[dest][source] = distance\r\n \t\r\n > > > goal\r\n defaultdict( < class &#39;dict&#39; > , {&#39;LA&#39;: {&#39;NYC&#39;: &#39;3000&#39;}, &#39;Houston&#39;: {&#39;SanFrancisco&#39;: &#39;1000&#39;, &#39;Austin&#39;: &#39;500&#39;}, &#39;Detroit&#39;: {&#39;LA&#39;: &#39;200&#39;}, &#39;Ames&#39;: {&#39;LA&#39;: &#39;300&#39;}, &#39;SanFrancisco&#39;: {&#39;LA&#39;: True}})", "714" ], [ "The fastest way in likely with [*numpy*][1]. \r\n See [ \" ;How To Quickly Compute The Mandelbrot Set In Python \" ;][2] for details on this approach.\r\n\r\nFor plain pure Python, use the native [complex numbers][3] to speed-up the loop. Also use the [*abs()*][4] function to quickly compute the magnitude of the complex number:\r\n\r\n > > > def mandle(c, boundary=2.0, maxloops=10000):\r\n # _URL_2_\r\n z = 0.0j\r\n for i in range(maxloops):\r\n z = z * z + c\r\n if abs(z) > boundary:\r\n break\r\n return i\r\n\r\n > > > mandle(0.04 + 0.65j)\r\n 21\r\n > > > mandle(0.04 + 0.66j)\r\n 16\r\n > > > mandle(0.04 + 0.67j)\r\n 12\r\n\r\nThe rendering itself isn&#39;t likely to be the slow part of your program (the 10,000 loops can dwarf the time to plot a point). That said, if you want to speed the rendering, typically the only choice is to plot multiple points per call to the graphics library.\r\n\r\nLastly, consider whether you really want the maximum number of iterations to be 10,000. You can get good results with a maximum of 200 iterations.\r\n\r\n [1]: _URL_4_\r\n [2]: _URL_1_\r\n [3]: _URL_0_\r\n [4]: _URL_3_", "1021" ], [ "> Is one way more Pythonic than the other? \r\n\r\nYes, the with-statement form is preferred, it encapsulates the file administration logic into a single line of code. The improves the ratio of business-logic to admin-logic, making the program easier to read and reason about.\r\n\r\nPer [PEP 343][1], the intended purpose of the with-statement is:\r\n\r\n This PEP adds a new statement \" ;with \" ; to the Python language to make\r\n it possible to factor out standard uses of try/finally statements.\r\n\r\n\r\n [1]: _URL_0_", "907" ], [ "Strictly in term of performance, the first *compare()* is quadratic because it has an O(n) *index()* operation inside an O(n) for-loop. The second *compare2()* is much better because is uses O(1) random access indexing with ``i``.\r\n\r\nThat said, @CharlesDuffy pointed out correctness issues which need to be addressed first.\r\n\r\nFor long strings where function call overhead isn&#39;t important, consider this alternative which should run very fast:\r\n\r\n > > > a = &#39;abcdefghijklmnopqrstuvwxyz&#39;\r\n > > > b = &#39;a---e---i-----o-----u---y-&#39;\r\n > > > sum(map(str.__eq__, a, b))\r\n 6\r\n\r\nIn Python 2, add this optimization for improved cache efficiency:\r\n\r\n > > > from itertools import imap # iterator version of map()\r\n > > > sum(imap(str.__eq__, a, b))\r\n 6", "1021" ], [ "> ... 35 million dictionary objects within a list. Each dictionary object\r\n > contains two key/value pairs. eg. {&#39;Name&#39;: &#39;Jordan&#39;, &#39;Age&#39;: 35}\r\n\r\nYou&#39;re right that this manner of storage has considerable overhead. \r\n\r\nThe [Flyweight Design Pattern][1] suggests that the solution involves factoring-out the commonalities. Here are two ideas for alternative storage of the same data with better space utilization.\r\n\r\nYou can use [\\__slots__][2] to save space on instances of classes (this suppresses the creation of per-instance dictionaries):\r\n\r\n class Person(object):\r\n __slots__ = [&#39;Name&#39;, &#39;Age&#39;]\r\n\r\n s = [Person(&#39;Jordan&#39;, 35), Person(&#39;Martin&#39;, 31), Person(&#39;Mary&#39;, 33)]\r\n\r\nIt is even more space-efficient to use dense data structures like a pair of parallel lists:\r\n\r\n s_name = [&#39;Jordan&#39;, &#39;Martin&#39;, &#39;Mary&#39;]\r\n s_age = [35, 31, 33]\r\n\r\nIf there duplicates in the data, you save even more space by [interning][3] the values:\r\n\r\n s_name = map(intern, s_name)\r\n\r\nOr in Python 3:\r\n\r\n s_name = list(map(sys.intern, s_name)\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_1_\r\n [3]: _URL_0_", "712" ], [ "The *type()* function returns the class of an object. In the case of ``type(__builtins__)`` it returns a *Module* type. The semantics of module are detailed at: _URL_0_\r\n\r\nThe source code for CPython has this in Objects/moduleobject.c<IP_ADDRESS>*module_init()*:\r\n\r\n static char *kwlist[] = { \" ;name \" ;, \" ;doc \" ;, NULL};\r\n PyObject *dict, *name = Py_None, *doc = Py_None;\r\n if (!PyArg_ParseTupleAndKeywords(args, kwds, \" ;U|O:module.__init__ \" ;,\r\n kwlist, & name, & doc))\r\n\r\nThat means you can call (instantiate) module objects with the *name* of the module as a required argument and the docstring as an optional argument.", "816" ], [ "I would just do a loop:\r\n\r\n for obj, cnt in [ (&#39;a&#39;, 1), (&#39;b&#39;, 2) ]:\r\n counter[obj] = cnt\r\n\r\nYou could also just call the parent ``dict.update`` method:\r\n\r\n > > > from collections import Counter\r\n > > > data = [ (&#39;a&#39;, 1), (&#39;b&#39;, 2) ]\r\n > > > c = Counter()\r\n > > > dict.update(c, data)\r\n > > > c\r\n Counter({&#39;b&#39;: 2, &#39;a&#39;: 1})\r\n\r\nLastly, there isn&#39;t anything wrong with your original solution:\r\n\r\n Counter(dict(list_of_pairs))\r\n\r\nThe expensive part of creating dictionaries or counters is hashing all of the keys and doing periodic resizes. Once the dictionary is made, converting it to a Counter is very cheap about as fast as a dict.copy(). The hash values are reused and the final Counter hash table is pre-sized (no need for resizing).", "58" ], [ "The issue is that *findall()* is showing just the captured subgroups rather than the full match. Per the docs for [*re.findall()*][1]:\r\n\r\n > If one or more groups are present in the pattern, return a list of\r\n > groups; this will be a list of tuples if the pattern has more than one\r\n > group.\r\n\r\nIt is easy to see what is going on using [*re.finditer()*][2] and exploring the [match objects][3]:\r\n\r\n > > > import re\r\n > > > text = \" ;Hello World! This is your captain speaking. \" ;\r\n\r\n > > > it = re.finditer( \" ;[A-Z]\\w+(\\s+\\w+[,;:-]?)*[.!?] \" ;, text)\r\n\r\n > > > mo = next(it)\r\n > > > mo.group(0)\r\n &#39;Hello World!&#39;\r\n > > > mo.groups()\r\n (&#39; World&#39;,)\r\n\r\n > > > mo = next(it)\r\n > > > mo.group(0)\r\n &#39;This is your captain speaking.&#39;\r\n > > > mo.groups()\r\n (&#39; speaking&#39;,)\r\n\r\nThe solution to your problem is to suppress the subgroups with ``?:``. Then you get the expected results:\r\n\r\n > > > re.findall( \" ;[A-Z]\\w+(?:\\s+\\w+[,;:-]?)*[.!?] \" ;, text)\r\n [&#39;Hello World!&#39;, &#39;This is your captain speaking.&#39;\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_0_\r\n [3]: _URL_1_", "772" ], [ "The issue is that [*basicConfig()*][1] function is designed to only be run once.\r\n\r\nPer the docs: The first time it runs, it \" ;creates a StreamHandler with a default Formatter and adding it to the root logger \" ;. However on the second time, the \" ;function does nothing if the root logger already has handlers configured for it \" ;.\r\n\r\nOne possible solution is clear the previous handler with using [*logging.root.removeHandler*][2]. Alternatively, you can directly access *stream* attribute for open stream used by the StreamHandler instance:\r\n\r\n > > > import logging\r\n > > > logging.basicConfig(filename=&#39;abc.txt&#39;) # 1st call to basicConfig\r\n > > > h = logging.root.handlers[0] # get the handler\r\n > > > h.stream.close() # close the current stream\r\n > > > h.stream = open(&#39;def.txt&#39;, &#39;a&#39;) # set-up a new stream\r\n\r\nFWIW, *basicConfig()* was a late addition to the [*logging*][3] module and was intended as a [simplified short-cut API][4] for common cases. In general, whenever you have problems with *basicConfig()*, it means that it is time to use the full API which is a little less convenient but gives you more control:\r\n\r\n import logging\r\n\r\n # First pass\r\n h = logging.StreamHandler(open(&#39;abc.txt&#39;, &#39;a&#39;))\r\n h.setLevel(logging.DEBUG)\r\n h.setFormatter(logging.Formatter(&#39;%(asctime)s | %(message)s&#39;))\r\n logging.root.addHandler(h)\r\n logging.critical(&#39;The GPU is melting&#39;)\r\n\r\n # Later passes\r\n logging.root.removeHandler(h)\r\n h = logging.StreamHandler(open(&#39;def.txt&#39;, &#39;a&#39;))\r\n h.setLevel(logging.DEBUG)\r\n h.setFormatter(logging.Formatter(&#39;%(asctime)s | %(message)s&#39;))\r\n logging.root.addHandler(h)\r\n logging.critical(&#39;The CPU is getting hot too&#39;)\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_3_\r\n [3]: _URL_0_\r\n [4]: _URL_1_", "698" ], [ "Python ships with [*sqlite3*][1] to handle database problems and it has an [``:memory:``][2] mode for in-memory databases. I think it will solve your problem directly and with clear code.\r\n\r\n import sqlite3\r\n from pprint import pprint\r\n\r\n # Load the data from a list of tuples in the from [(conf, school, link), ...]\r\n conn = sqlite3.connect(&#39;:memory:&#39;)\r\n c = conn.cursor()\r\n c.execute(&#39;CREATE TABLE Espn (conf text, school text, link text)&#39;)\r\n c.execute(&#39;CREATE INDEX Cndx ON Espn (conf)&#39;)\r\n c.execute(&#39;CREATE INDEX Sndx ON Espn (school)&#39;)\r\n c.executemany(&#39;INSERT INTO Espn VALUES (?, ?, ?)&#39;, data)\r\n conn.commit()\r\n\r\n # Run queries \r\n pprint(c.execute(&#39;SELECT * FROM Espn WHERE conf = \" ;Big10 \" ;&#39;).fetchall())\r\n pprint(c.execute(&#39;SELECT * FROM Espn WHERE school = \" ;Alabama \" ;&#39;).fetchall())\r\n\r\nIn memory databases are so easy to create and query that they are often the easiest solution to the problem of how to have multiple lookup keys and doing analytics on relational data. Trying to use dicts and lists for this kind of work just makes the problem unnecessarily complicated.\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "58" ], [ "Here is a direct translation of the request, working from the parts you&#39;ve already done and incorporating the [*any()*][1] function applied to the [*values*][2] of the dictionary.\r\n\r\n # I am in the process of writing a program that connects to a Cisco switch or\r\n # router and then examines the output of a &#39;show int &#39;. I then process\\parse the\r\n # data to the point where I have a dictionary of twenty-one key\\value pairs.\r\n # All values are integers.\r\n for device in devices:\r\n s = run_show_interfaces(device)\r\n d = preprocess_parse(s)\r\n \r\n # Check each value. If ALL values are zero, then skip that dictionary. If ANY\r\n # single value is non-zero (it will be a positive integer if it is not zero),\r\n # then I want to save to a file the entire dictionary.\r\n if any(d.values()):\r\n filename = os.path.join(device, &#39;.txt&#39;)\r\n with open(filename, &#39;w&#39;) as f:\r\n json.dump(d, f)\r\n\r\nFYI, the *any()* function has an early-out and will stop looking as soon as it finds a non-zero value. In Python 3, *values()* returns a view of the data so it doesn&#39;t copy all of information. In Python 2, use [*viewvalues()*][3] to achieve the same effect. Taken together, this will give you great preformance.\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_0_\r\n [3]: _URL_1_", "58" ], [ "> I feel I&#39;m getting something wrong in this approach. \r\n\r\nThe likely cause is that too much data is being passed in.\r\n\r\nProcesses don&#39;t share memory, so any data you pass in has to be serialized on one side, transmitted over a channel (like a raw socket), and deserialized on the other. If the time that takes is more than the time saved by the parallel processing, the result is a net loss.\r\n\r\nOne technique for dealing with this is to have the graph in memory as a global variable *before* you create the pool (that lets the data be shared by copy-on-write). Then just pass in an index (a single number) to the process and let it work on its own section of the graph.", "739" ], [ "Neither Python nor Unix has the notion of a transaction for actions on multiple files.\r\n\r\nFor movement with in a disk partition, the *mv* command will just update the directory entries using the same inodes so the file doesn&#39;t actually move (no risk of failure during the move).\r\n\r\nFor movement across disks, you could be a temporary directory on the target drive, copy all the files, and it it succeed just do a *mv* as described about, and finally clear the source. This would provide some measure of protection.", "919" ], [ "I would use a [*defaultdict()*][1] to group the tuples by their hashvalue:\r\n\r\n from collections import defaultdict\r\n\r\n # Group the tuples by their hashvalues\r\n d = defaultdict(list)\r\n for tup in data:\r\n filename, size, hashvalue = tup\r\n d[hash].append(tup)\r\n\r\n # Display groups of tuples that have more than one tuple\r\n for hashvalue, tuples in d.items():\r\n if len(tuples) > 1:\r\n print(&#39;Tuples with %r in common&#39; % hashvalue)\r\n for tup in tuples:\r\n print(tup)\r\n print()\r\n\r\n\r\n [1]: _URL_0_", "58" ], [ "Is there any benefit to closing a cursor when using Python&#39;s [sqlite3 module][1]? Or is it just an artifact of the [DB API v2.0][2] that might only do something useful for other databases?\r\n\r\nIt makes sense that [connection.close()][3] releases resources; however, it is unclear what *cursor.close()* actually does, whether it actually releases some resource or does nothing. The docs for it are unenlightening:\r\n\r\n > > > import sqlite3\r\n > > > conn = sqlite3.connect(&#39;:memory:&#39;)\r\n > > > c = conn.cursor()\r\n > > > help(c.close)\r\n Help on built-in function close:\r\n \r\n close(...)\r\n Closes the cursor.\r\n\r\nNote, this is a completely different question than _URL_2_. I know what cursors are for. The question is about what the cursor.close() method actually does and whether there is any benefit to calling it.\r\n\r\n\r\n [1]: _URL_3_\r\n [2]: _URL_0_\r\n [3]: _URL_1_", "981" ], [ "The technique you use depends your notion of what a group is.\r\n\r\nIf the number of groups is known, use [*kmeans*][1] with ``k==2``. See [this link][2] for working code in pure Python:\r\n\r\n from kmeans import k_means, assign_data\r\n\r\n prices = [90, 92, 95, 99, 1013, 1100]\r\n points = [(x,) for x in prices]\r\n centroids = k_means(points, k=2)\r\n labeled = assign_data(centroids, points)\r\n for centroid, group in labeled.items():\r\n print(&#39;Group centered around:&#39;, centroid[0])\r\n print([x for (x,) in group])\r\n print()\r\n\r\nThis outputs:\r\n\r\n Group centered around: 94.0\r\n [90, 92, 95, 99]\r\n \r\n Group centered around: 1056.5\r\n [1013, 1100]\r\n\r\nAlternatively, if a fixed maximum distance between elements defines the groupings, then just sort and loop over the elements, checking the distance between them to see whether a new group has started:\r\n\r\n max_gap = 100\r\n prices.sort()\r\n groups = []\r\n last_price = prices[0] - (max_gap + 1)\r\n for price in prices:\r\n if price - last_price > max_gap:\r\n groups.append([])\r\n groups[-1].append(price)\r\n last_price = price\r\n print(groups)\r\n\r\nThis outputs:\r\n\r\n [[90, 92, 95, 99], [1013, 1100]]\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "256" ], [ "Getattr Uses Descriptor Logic\r\n-----------------------------\r\n\r\nThe main difference is that the dictionary lookup does no extra processing while the attribute fetch incorporates extra logic (see my [Descriptor How-To Guide][1] for all the details).\r\n\r\nThere Are Two Different Underlying Methods\r\n------------------------------------------\r\n\r\n1) The call ``NothingSpecial.__dict__[&#39;meth&#39;]`` uses the square brackets operator which dispatches to ``dict.__getitem__`` which does a simple hash table lookup or raises *KeyError* if not found.\r\n\r\n2) The call ``NothingSpecial.meth`` uses the dot operator which dispatches to ``type.__getattribute__`` which does a simple lookup followed by a special case for [descriptors][2]. If the lookup fails, an *AttributeError* is raised.\r\n\r\nHow It Works\r\n------------\r\n\r\nThe overall logic is documented [here][3] and [here][4].\r\n\r\n > In general, a descriptor is an object attribute with “binding\r\n > behavior”, one whose attribute access has been overridden by methods\r\n > in the descriptor protocol: \\__get__(), \\__set__(), and/or \\__delete__(). If\r\n > any of those methods are defined for an object, it is said to be a\r\n > descriptor.\r\n > \r\n > The default behavior for attribute access is to get, set, or delete\r\n > the attribute from an object’s dictionary. For instance, a.x has a\r\n > lookup chain starting with a.\\__dict__[&#39;x&#39;], then\r\n > type(a).\\__dict__[&#39;x&#39;], and continuing through the base classes of\r\n > type(a) excluding metaclasses.\r\n > \r\n > However, if the looked-up value is an object defining one of the\r\n > descriptor methods, then Python may override the default behavior and\r\n > invoke the descriptor method instead. Where this occurs in the\r\n > precedence chain depends on which descriptor methods were defined and\r\n > how they were called\r\n\r\nHope you&#39;ve found all of this to be helpful. The kind of exploring you&#39;re doing is a great way to learn about Python :-)\r\n\r\nP.S. You might also enjoy reading the original Whatsnew in Python 2.2 [entry for descriptors][5] or looking at [PEP 252][6] where <PERSON> originally proposed the idea.\r\n\r\n\r\n [1]: _URL_4_\r\n [2]: _URL_0_\r\n [3]: _URL_2_\r\n [4]: _URL_3_\r\n [5]: _URL_5_\r\n [6]: _URL_1_", "328" ], [ "Analysis of What is Going Wrong\r\n-------------------------------\r\n\r\n > Basically - if I have lru_cache, and pass a QualifiedInterval into the function, it does not dispatch \r\n\r\nThe [*lru_cache*][1] is function that returns a [decorator][2] that wraps any callable (including classes). So when you apply the *lru_cache* to the *QualifiedInterval* class, that variable becomes assigned to the wrapper function rather than the class itself.\r\n\r\n > > > @lru_cache(maxsize=None, typed=True)\r\n class QualifiedInterval:\r\n \tpass\r\n \r\n > > > type(QualifiedInterval)\r\n < class &#39;functools._lru_cache_wrapper&#39; > \r\n\r\n[Single dispatch][3] works by matching the type of the first parameter to the appropriate method. However, when you pass in an instance of *QualifiedInterval*, its type doesn&#39;t match *functools._lru_cache_wrapper*, so single dispatch falls back to the base method(which raises *NotImplemented*.\r\n\r\nSolution\r\n--------\r\n\r\nTeach single dispatch to match on the actual original class (type) instead of the wrapped class:\r\n\r\n @augmented.register(QualifiedInterval.__wrapped__)\r\n def _(self, other):\r\n return \" ;show now work QualifiedInterval class has an lru_cache \" ;\r\n\r\nNote the addition of the ``.__wrapped__`` attribute which reaches through the wrapper function to get to the original unwrapped class.\r\n\r\nHope that clears it all up and shows the way forward :-)\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_0_\r\n [3]: _URL_1_", "246" ], [ "> I need to be able to make URL GET, PUT, POST, and DELETE requests straight out of Python. ... What is the best way to do this, urllib2?\r\n\r\nSince [*urllib.request.urlopen()*][1] is hard-wired to GET or POST, you will need [*http.client.HTTPConnection*][2] instead:\r\n\r\n import http.client\r\n import pprint\r\n\r\n conn = http.client.HTTPConnection(&#39;_URL_1_&#39;)\r\n c = conn.request(&#39;HEAD&#39;, &#39;/index.html&#39;)\r\n r = conn.getresponse()\r\n\r\n pprint.pprint(r.getheaders())\r\n print(&#39;Size of body:&#39;, len(r.read()))\r\n\r\nThe technique gets you \" ;closer to the metal \" ; and gives more control, but it \r\nloses all the comforts of *urllib.request* and its various highlevel services (like following redirects).\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_2_", "178" ], [ "To reverse directions, you will need to remember the position index as you iterate. The [*enumerate()*][1] builtin function will help.\r\n\r\nOnce the reversal condition is found, use [list slicing][2] to isolate the portion you want to reiterate backwards. The [*reversed()*][3] builtin will take it from there.\r\n\r\n > > > loe = [&#39;e0&#39;, &#39;e1&#39;, &#39;e2&#39;, &#39;e3&#39;, &#39;e4&#39;, &#39;e5&#39;]\r\n > > > for i, event in enumerate(loe):\r\n \t print event\r\n \t if event == &#39;e3&#39;:\r\n \t\t for event in reversed(loe[:i]):\r\n \t\t\t print event\r\n break\r\n \r\n \t\t\t\r\n e0\r\n e1\r\n e2\r\n e3\r\n e2\r\n e1\r\n e0\r\n\r\nHope this helps :-)\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_\r\n [3]: _URL_2_", "131" ], [ "Signature for \\__set__\r\n======================\r\n\r\nThe signature for \\__set__ is documented [here][1]: \r\n\r\n > **object.\\__set__(self, instance, value)** Called to set the attribute on\r\n > an instance instance of the owner class to a new value, value.\r\n\r\nMeaning of the TypeError\r\n========================\r\n\r\nThe *TypeError* is tell you that the *instance* parameter is missing, it should be ``def __set__(self, instance, value): ...``.\r\n\r\nWorked-out solution\r\n===================\r\n\r\nHere&#39;s one approach to making the *Constant* class work correctly:\r\n\r\n class Const(object):\r\n def __init__(self, value):\r\n self._value = value\r\n def __set__(self, inst, value):\r\n raise TypeError(&#39;Cannot assign to a constant&#39;)\r\n def __get__(self, inst, cls=None):\r\n return self._value\r\n \r\n class X(object):\r\n c = Const(23)\r\n\r\nTrying it out in an interactive session gives:\r\n\r\n > > > x = X()\r\n > > > print(x.c)\r\n 23\r\n > > > x.c = 42\r\n Traceback (most recent call last):\r\n File \" ; < pyshell#3 > \" ;, line 1, in < module > \r\n x.c = 42\r\n File \" ;/Users/raymond/Documents/try_forth/_URL_0_ \" ;, line 5, in __set__\r\n raise TypeError(&#39;Cannot assign to a constant&#39;)\r\n TypeError: Cannot assign to a constant\r\n\r\n\r\n [1]: _URL_1_", "457" ], [ "Regex\r\n=====\r\n\r\nThe regular expression is ``\\.1dc\\.com``. The backslash escapes the dot which normally matches any character rather than just a period. \r\n\r\nMake the search case insensitive with the [*re.IGNORECASE*][1] flag.\r\n\r\nFind and eliminate the target expression using [*re.sub()*][2].\r\n\r\nFull solution\r\n=============\r\n\r\n import re\r\n\r\n data = [\r\n {&#39;system_name&#39;: &#39;a1pvdb092&#39;, &#39;fdc_inv_sa_team&#39;: &#39;X2AIX_GBS&#39;},\r\n {&#39;system_name&#39;: &#39;_URL_1_&#39;, &#39;fdc_inv_sa_team&#39;: &#39;LAA.BRAZIL.AAA.WINDOWS\\n&#39;},\r\n {&#39;system_name&#39;: &#39;a10000048&#39;, &#39;fdc_inv_sa_team&#39;: &#39;X2AIX_NSS&#39;},\r\n {&#39;system_name&#39;: &#39;a10000049&#39;, &#39;fdc_inv_sa_team&#39;: &#39;X2AIX_NSS&#39;},\r\n ]\r\n\r\n for row in data:\r\n sysname = row[&#39;system_name&#39;]\r\n print([re.sub(r&#39;\\.1dc\\.com&#39;, &#39;&#39;, sysname, flags=re.IGNORECASE)])\r\n\r\nOutput\r\n======\r\n\r\n [&#39;a1pvdb092&#39;]\r\n [&#39;W00000001&#39;]\r\n [&#39;a10000048&#39;]\r\n [&#39;a10000049&#39;]\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_2_", "286" ], [ "In Python, the rule is \" ;once created, an object never moves \" ;.\r\n\r\nThat rule refers to the head of the object (the part whose address you see in CPython when calling [*id()*][1]). Internally, mutable container points to the variable length port of the data. As you suspected, the location of that data can move around as more data gets added.\r\n\r\nFor an overview of how Python dicts work, see my recent [PyCon talk][2] and the related [slides][3]. To better understand the object model, see [<PERSON> post][4].\r\n\r\nA key point is that \" ;python containers don&#39;t contain anything \" ;, they just have references to existing objects. In the case of *TrendingUser* the underlying instance dictionaries point to the same attribute values (constants created when the method definition was built).\r\n\r\nAs you update the values, for instances of TrendingUsers, the memory location will point to the new values you&#39;ve inserted and they will not be that same addresses as the default values (remember, that once created, those objects will never move).\r\n\r\nHope that adds a little clarity :-)\r\n\r\nSee this [Pytutor visualization][5] of what is happening with your code. Note that both instances refer to the *same* underlying data.\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_1_\r\n [3]: _URL_0_\r\n [4]: _URL_4_\r\n [5]: _URL_3_", "9" ], [ "So far, only tuples support specifying a fixed number of fields and it has no short-cut for a fixed number of repetitions.\r\n\r\nHere&#39;s the definition and docstring from the [`typing`][1] module:\r\n\r\n class Tuple(tuple, extra=tuple, metaclass=TupleMeta):\r\n \" ; \" ; \" ;Tuple type; Tuple[X, Y] is the cross-product type of X and Y.\r\n \r\n Example: Tuple[T1, T2] is a tuple of two elements corresponding\r\n to type variables T1 and T2. Tuple[int, float, str] is a tuple\r\n of an int, a float and a string.\r\n \r\n To specify a variable-length tuple of homogeneous type, use Tuple[T, ...].\r\n \" ; \" ; \" ;\r\n \r\n __slots__ = ()\r\n \r\n def __new__(cls, *args, **kwds):\r\n if _geqv(cls, Tuple):\r\n raise TypeError( \" ;Type Tuple cannot be instantiated; \" ;\r\n \" ;use tuple() instead \" ;)\r\n return _generic_new(tuple, cls, *args, **kwds)\r\n\r\nSince lists are a mutable, variable-length type, it doesn&#39;t make any sense to use a type declaration to specify a fixed size.\r\n\r\n [1]: _URL_0_", "816" ], [ "@Ryan You seem to have a different notion of \" ;exact duplicate \" ; and have now caused an interesting variant to have been lost. Also, it seems abusive to have closed a second time. That should have been left to others to decide whether to agree or not rather than making a dictatorial decision overriding insight of a top contributor in the category. By your reasoning, EVERY question about descriptors would be marked as duplicate of the vague \" ;understanding descriptors \" ; question.", "10" ], [ "Forth famously allows users to alter the language by defining new words for control flow (beyond those given by the standard: DO, LOOP, BEGIN, UNTIL, WHILE, REPEAT, LEAVE IF, THEN, ELSE, CASE, ENDCASE, etc.)\r\n\r\nAre there common examples of people actually creating their own new control flow words? What are some typical and useful examples? Or has the standard already defined everything that people actually need?\r\n\r\nI&#39;m hoping to find examples of useful language extensions that have gained acceptance or proved generally helpful to make the language more expressive.", "133" ], [ "This use case is easily handled by [*dict.setdefault()*][1]\r\n\r\n > > > d = {1:10, 2:20, 3:30, 4:30}\r\n > > > e = {}\r\n > > > for x, y in d.items():\r\n \t e.setdefault(y, []).append(x)\r\n \r\n > > > e\r\n {10: [1], 20: [2], 30: [3, 4]}\r\n\r\nAn alternative is to use [collections.defaultdict][2]. This has a slightly more complex set-up, but the inner-loop access is simpler and faster than the *setdefault* approach. Also, it returns a dict subclass rather than a plain dict:\r\n\r\n > > > e = defaultdict(list)\r\n > > > for x, y in d.items():\r\n \t e[y].append(x)\r\n \r\n > > > e\r\n defaultdict( < class &#39;list&#39; > , {30: [3, 4], 10: [1], 20: [2]})\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "58" ], [ "Time limits necessitated a little brevity and hand-waving in that part of the presentation so that I could get to the central topic, the tech inside Python dictionaries. Here is a bit fuller explanation.\r\n\r\nFlat File\r\n=========\r\n\r\nIn [relational databases][1], the data may be stored compactly in a [flat file][2]: \r\n\r\n Row Number Name Color City Fruit\r\n ---------- -------- -------- --------- -------\r\n 0 &#39;guido&#39;, &#39;blue&#39;, &#39;austin&#39;, &#39;apple&#39;\r\n 1 &#39;sarah&#39;, &#39;orange&#39;, &#39;dallas&#39;, &#39;banana&#39;\r\n 2 &#39;barry&#39;, &#39;green&#39;, &#39;tuscon&#39;, &#39;orange&#39;\r\n 3 &#39;rachel&#39;, &#39;yellow&#39;, &#39;reno&#39;, &#39;pear&#39;\r\n 4 &#39;tim&#39;, &#39;red&#39;, &#39;portland&#39;, &#39;peach&#39;\r\n\r\nNote, there is no wasted space (holes between the records or fields).\r\n\r\nAlso, the order of insertion is preserved (new records are appended to the end in order of arrival).\r\n\r\nAlphabetical Index\r\n==================\r\n\r\nTo speed lookups, a user may [create a separate index][3] into the table. Here is an alphabetical index that can be searched using ``O(log n)`` bisection:\r\n\r\n Name Row Number\r\n -------- ----------\r\n &#39;barry&#39; 2\r\n &#39;guido&#39; 0\r\n &#39;rachel&#39; 3\r\n &#39;sarah&#39; 1\r\n &#39;tim&#39; 4\r\n\r\nIn Python, that index table would be represented using a list of indices:\r\n\r\n [2, 0, 3, 1, 4]\r\n\r\nNote that there is no wasted space (holes between the entries).\r\n\r\nHashed Index\r\n------------\r\n\r\nBetter lookup performance can be obtained by using a [hash function][4] to construct an index table. Here is a hashed index table giving ``O(1)`` search performance:\r\n\r\n Hash Name Row Number\r\n ---- -------- ----------\r\n 0 - -\r\n 1 &#39;tim&#39; 4\r\n 2 - -\r\n 3 &#39;sarah&#39; 1\r\n 4 - -\r\n 5 - -\r\n 6 &#39;guido&#39; 0\r\n 7 - -\r\n 8 &#39;barry&#39; 2\r\n 9 - -\r\n 10 &#39;rachel&#39; 3\r\n 11 - -\r\n 12 - -\r\n 13 - -\r\n 14 - -\r\n 15 - -\r\n\r\nIn Python, that index table would be represented using a list of indices but with a ``None`` value for the unused slots:\r\n\r\n [None, 4, None, 1, None, None, 0, None, 2,\r\n None, 3, None, None, None, None, None]\r\n\r\nThese particular values were obtained by running some hash function over each of the names, taking the result modulo 16 (because there are 16 slots in the index table), and performing collision resolution. The particulars are unimportant.\r\n\r\nWhat is essential is that a hashed index table allows faster lookups than an alphabetical index, but it comes at the cost of introducing a few \" ;holes \" ; and wasting a little space in the index table.\r\n\r\nConclusion\r\n==========\r\n\r\nEffectively, Python 3.6 dictionaries make the same density/sparseness choices as databases using hashed index tables. Both of them store the core data densely (including both the keys and values). Both store the keys only once. Both use a sparse table of indices for fast ``O(1)`` lookup. And both preserve insertion order.\r\n\r\nCaveats\r\n-------\r\n\r\nThe analogy is imperfect in a number of ways. For example, database flat files store the data directly in the table while Python containers just have references to the field values. Also, hash tables are typically kept in RAM while databases typically use persistent storage. \r\n\r\nHowever, the analogy is reasonably accurate about space utilization and about how insertion order can be preserved.\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_\r\n [3]: _URL_3_\r\n [4]: _URL_2_", "618" ], [ "Why the union() doesn&#39;t contain all items\r\n=========================================\r\n\r\nThe ``1`` and ``True`` are equivalent and considered to be duplicates. Likewise the ``0`` and ``False`` are equivalent as well:\r\n\r\n > > > 1 == True\r\n True\r\n > > > 0 == False\r\n True\r\n\r\nWhich equivalent value is used\r\n==============================\r\n\r\nWhen multiple equivalent values are encountered, sets keep the first one seen:\r\n\r\n > > > {0, False}\r\n {0}\r\n > > > {False, 0}\r\n {False}\r\n\r\nWays to make the values be distinct\r\n===================================\r\n\r\nTo get them to be treated as distinct, just store them in a ``(value, type)`` pair:\r\n\r\n > > > set1 = {(1, int), (2, int), (3, int)}\r\n > > > set2 = {(True, bool), (False, bool)}\r\n > > > set1 | set2\r\n {(3, < class &#39;int&#39; > ), (1, < class &#39;int&#39; > ), (2, < class &#39;int&#39; > ),\r\n (True, < class &#39;bool&#39; > ), (False, < class &#39;bool&#39; > )}\r\n > > > set1 & set2\r\n set()\r\n\r\nAnother way to make the values distinct is to store them as strings:\r\n\r\n > > > set1 = {&#39;1&#39;, &#39;2&#39;, &#39;3&#39;}\r\n > > > set2 = {&#39;True&#39;, &#39;False&#39;}\r\n > > > set1 | set2\r\n {&#39;2&#39;, &#39;3&#39;, &#39;False&#39;, &#39;True&#39;, &#39;1&#39;}\r\n > > > set1 & set2\r\n set()\r\n\r\nHope this clears up the mystery and shows the way forward :-)\r\n\r\n----\r\n\r\nRescued from the comments:\r\n\r\nThis is the standard technique for breaking cross-type equivalence (i.e. `0.0 == 0`, `True == 1`, and `Decimal(8.5) == 8.5)`. The technique is used in Python 2.7&#39;s regular expression module to force unicode regexes to be cached distinctly from otherwise equivalent str regexes. The technique is also used in Python 3 for functools.lru_cache() when the typed parameter is true.\r\n\r\nIf the OP needs something other than the default equivalence relation, then some new relation needs to be defined. Depending the use case, that could be case-insensitivity for strings, normalization for unicode, visual appearance (things that look different are considered different), identity (no two distinct objects are considered equal), a value/type pair, or some other function that defines an equivalence relation. Given the OPs specific example, it would seem that he/she expected either distinction by type or visual distinction.", "265" ], [ "It&#39;s perfectly Pythonic -- a simple class with straight-forward use of dictionaries, lists, basic assignments an unpacking. The logic is self-contained and there are no external dependencies. This code is also very fast and is easily optimized further by PyPy. An OrderedDict adds space overhead (it uses two dicts internally while this only uses one) and it does unnecessary work that isn&#39;t needed for this use. MutableMapping doesn&#39;t provide any useful capabilities in this context.", "977" ] ]
169
[ 16643, 5483, 6475, 17996, 15384, 12036, 19791, 18646, 17448, 11688, 5777, 2008, 14382, 4723, 13146, 13635, 19601, 8639, 19211, 2835, 18701, 667, 2497, 5874, 1373, 1390, 14087, 7942, 9900, 8679, 17403, 6668, 3244, 14584, 5290, 6763, 17272, 13286, 18699, 15482, 10105, 13331, 19089, 17479, 7931, 9527, 13480, 8232, 14722, 8525, 17674, 2121, 5528, 4365, 16958, 17189, 10269, 14443, 18931, 11631, 19359, 2747, 6068, 19129, 3107, 11910, 8375, 11187, 301, 9929, 632, 229, 13124, 9555, 18557, 8512, 11297, 5223, 1119, 12504, 2263, 13661, 19270, 2115, 16684, 14470, 10065, 11484, 3151, 2310, 18879, 2344, 10359, 17828, 4333, 10444, 17490, 15378, 1258, 5033, 7273, 18254, 6582, 8269, 421, 16963, 299, 8034, 12315, 17111, 8433, 8368, 863, 7756, 17161, 13080, 2041, 3873, 0, 18985, 4344, 1402, 1412, 17611, 5389, 10344, 5167, 9997, 19766, 13399, 1277, 18040, 13885, 8881, 1090, 10793, 7345, 6913, 377, 13760, 3504, 10529, 17573, 18541, 3913, 9909, 7775, 16256, 1674, 15033, 6476, 1141, 11261, 3379, 856, 5636, 5534, 13701, 5071, 11244, 11940, 725, 3560, 1137, 2634, 16934, 13288, 7679, 11753, 16141, 16822, 2907, 7193, 1387, 17007, 3990, 14777, 6843, 2675, 2342, 2379, 16691, 1453, 3942, 9142, 10746, 4091, 5186, 348, 17712, 3621, 14884, 18487, 15477, 2679, 8747, 15313, 9611, 5424, 10920, 904, 4891, 12858, 471, 8567, 1324, 6017, 5409, 14027, 15977, 5575, 4402, 2353, 576, 17997, 1052, 2853, 19771, 5752, 16536, 16195, 7020, 13623, 2697, 3780, 2113, 16645, 12034, 3214, 15494, 5154, 2458, 19058, 551, 5857, 12189, 6414, 12400, 19545, 9899, 11140, 11770, 17766, 8164, 11626, 16508, 17, 4909, 5566, 18360, 14602, 1508, 10258, 12023, 12887, 8218, 7312, 12309, 620, 12680, 7810, 9411, 12695, 3593, 2262, 3864, 151, 18485, 4699, 10468, 4401, 15147, 2415, 18397, 19265, 2352, 2889, 12707, 16058, 18377, 13090, 1811, 4815, 16790, 7143, 10977, 16977, 9988, 11145, 279, 8908, 8456, 17810, 19170, 18877, 8582, 17395, 5468, 4764, 12856, 18601, 15551, 13445, 2229, 13289, 9141, 7739, 13874, 18382, 7943, 13830, 3541, 14510, 7251, 12690, 5732, 6337, 3970, 16456, 12280, 16216, 15181, 8193, 11408, 1856, 1817, 12307, 11125, 9380, 6452, 13733, 7177, 8792, 12529, 19507, 10330, 11280, 15710, 12268, 3339, 13136, 19416, 11088, 2856, 5036, 16012, 2744, 10422, 15519, 16944, 6044, 17670, 11482, 15724, 442, 12896, 4798, 14680, 11786, 18332, 4487, 6411, 238, 17769, 6318, 5847, 2676, 9439, 12612, 15767, 3733, 814, 14785, 18595, 967, 10585, 1933, 6149, 9610, 3818, 6062, 10464, 4754, 7167, 16161, 1040, 1525, 985, 16617, 10768, 9993, 4884, 16287, 611, 13896, 16435, 16858, 19285, 18649, 10997, 16469, 10556, 4163, 16663, 18167, 2919, 16382, 12226, 14917, 14028, 16373, 4273, 1030, 1897, 14455, 6084, 17527, 2224, 8680, 4058, 1574, 780, 11028, 4466, 641, 8393, 4216, 17411, 10373, 4003, 15904, 1074, 11537, 13613, 2367, 14947, 10051, 4552, 4944, 13510, 13150, 7875, 16708, 6551, 10355, 17697, 7242, 9961, 10966, 3748, 1794, 8305, 6222, 2384, 3317, 5944, 19188, 1956, 11916, 1333, 14398, 15749, 13184, 17008, 6150, 10453, 17779, 15043, 1590, 13501, 9232, 5677, 11356, 7995, 1239, 10094, 1410, 15719, 9774, 16359, 11025, 3976, 18844, 8647, 3962, 5185, 5717, 2286, 3954, 9702, 488, 6276, 5475, 5519, 2705, 2099, 7638, 14396, 6426 ]
STX_100179.0
[ [ "In English, the idiom is: [subject] is no more [noun or adjective] than I am is very common. Please check out my examples:\r\n\r\nHe&#39;s no more a thief than I am. < p > \r\nHe&#39;s no more rich than I am. < p > \r\nHe&#39;s no more young than I am. < p > \r\n\r\nThose sentences above are idiomatically sound.\r\n\r\nThis idiom should not be confused with:\r\n\r\nHe&#39;s no richer than I am.\r\nHe&#39;s no younger than I am.\r\n\r\n\r\nIn the first group: no more + adjective is not a comparative adjective. It is just a regular adjective.\r\nHe is rich. He is not rich.\r\nHe is no more rich than I am rich.\r\n\r\nPlease: \" ;He&#39;s no more young than I am \" ; implies we are both old. Just as: \" ;He&#39;s no more rich that I am \" ; implies we are both somewhat impecunious. \r\n\r\nNo more here means: His condition or state is not rich just as mine is not. Not at all rich. I&#39;ll leave poking at the grammar here to others. Frankly, I can&#39;t be bothered. :)", "868" ], [ "This is actually a very simple question.\r\n\r\n1) /The table is clean./ means /The table is not dirty/. Clean and dirty are adjectives. Painted and unpainted are also adjectives. Read on.\r\n\r\nBy substitution, we can use any adjective to describe the table: ***The clean ~ dirty ~ painted ~ unpainted table is the one over there***.\r\n\r\nHere we see adjectives are either \" ;stand-alone \" ; adjectives or participial adjectives, -ing or -ed. \r\n < p > Note: the simple past one can be irregular: the ***stolen** book. Painted and unpainted here are used as adjectives taken from the verb paint.\r\n\r\n2) /The table is painted/ could conceivably be a passive verb EXCEPT for the fact that one would not normally use a simple present passive here. Consider:\r\n\r\nA) /The table is painted [by the man every week]/. The man in question would have to be rather neurotic to be painting the same table every week! < p > That said, one can easily imagine: \r\nB)/***The house is swept every day***/ [by someone].\r\n\r\nBy the same token, /The table is cleaned [by some person]/ follows the same pattern: A passive voice in the simple present tense. \r\n\r\nSummary: In many cases, only the context or speaker intention will tell you whether in a sentence like /The house is swept/ or, as in your example, /The table is painted/, the is + verb is being used as an adjective or as a verb. On its face, there is no way to determine which case applies: a verb or state or condition (adjective).\r\n\r\nYes, the grammar does change the meaning: /The table is cleaned/ with an implied agent (cleaned by someone) simply does not mean the same thing as /The table is clean./ A table could be cleaned by someone and its condition or state might still be dubious whereas in /The table is clean./ there is no doubt of its state.\r\n\r\nThe ambiguity created by a simple passive verb versus an adjective stemming from a participial adjective, one simply cannot say without further context which meaning is intended./The hut is swept/, adjective or verb?\r\n\r\nBOTH, unless further elucidated:\r\nThe hut is swept every day by the kids.\r\nThe hut is swept and needn&#39;t be swept again. A swept hut is a clean hut. Yes, it is a cleaned hut. \r\n\r\nhuh? :)", "868" ], [ "Here&#39;s proof for your \" ;Russian \" ;: To be in possession of stolen goods. If to possess meant to own there, that phrase would not make sense. The legal phrase is /to be in possession of/some thing. You can be in possession of something and then, you do not own it. Have ownership of it.\r\n\r\nThat said, the VERB: I possess a car does commonly mean I have a car. **It can mean I own a car but actually does not legally mean: I own a car**. \r\n\r\nDo not confuse the legal meaning of /to be in possession of/ with the verb to possess or to own. In common parlance, one would not say \" ;I am in possession of a car \" ; to just mean I have a car or I own a car.\r\n\r\nWith the verb possess, both **can mean ownership**: I own a car, I possess a car. But possess can merely mean; I have a car, without reference to ownership.\r\n\r\nSometimes, in legal matters, you are in possession of property (not stolen) that you have been given legal use of: that is called, usufruct. You are allowed to possess it and use it but you are not its legal owner. This kind of legal arrangement is often seen with property in wills where a person is allowed to make use of a property during his or lifetime but they have not actually inherited it. They do not own it.", "854" ], [ "Shoppe and le have zero to do with each other. Shoppe at least in English, Le is not. Where&#39;s the proof about it being affectation??//In French, it&#39;s le, la or les. It depends on what follows it. I can find nothing on the internet that explains all the les in English place names. Each seems to have a different origin. Most of the time, there is no explanation on the names even in British History Online, etc.", "69" ], [ "Ok, I cannot translate all the work of the French author who made a distinction between:\r\nI started TO work on it and I started workING on it.\r\n\r\nLet&#39;s just say it this way: \r\n\r\n1) I started with TO sets up a relationship between I started and work.\r\nHe says that the TO is a meta-operator, and therefore, there is a relationship between what I started and work. It also sets up a predicate. \r\n\r\n\r\n2) I started working does not do that. Working on something is noun phrase: I started: any activity with a verb.\r\n\r\nIn this case, working is an action and I started that action. There is no meta operator so working is more full force. He calls it using the verb in notional form.\r\n\r\nhere is the important distinction he makes:\r\nLa notion verbale V∅V [The verbal notion: Verb Null Set Verb: V∅V]\r\n1\r\nUn certain nombre de construction anglaise font usage de la notion pure et simple, d&#39;o&#249; l&#39;absence de to. L&#39;absence de cet op&#233;rateur signale que l&#39;on a affaire &#224; une notion verbale et non &#224; un pr&#233;dicat.\r\nL&#39;apport de V est purement s&#233;mantique puisqu&#39;il renvoie au concept. La pr&#233;sence de to signale que la simple notion verbale est d&#233;pass&#233;e et que l&#39;on s&#39;en sert dans le cadre d&#39;une op&#233;ration qui n&#39;a plus pour seul objet de nommer une notion mais de l&#39;utiliser comme point de d&#233;part d&#39;une autre op&#233;ration. Il y a\r\ngrammaticalisation de la notion verbale.\r\n\r\nA certain number of English constructions make use of the notion, pure and simple, which is why the TO is not used. The absence of this operator [to] signals that we are dealing with a verbal notion and not with a predicate.\r\nThe use of V is purely semantic since it refers to a concept. The presence of /to/ signals that the verbal notion is surpassed and that the /to/ is being used as part of an operation whose only point is not to name a notion but to use it as the point of departure of another operation. The verbal notion is grammaticalized. [The explanatory paragraph is taken from this article about Adamczeski][1]\r\n\r\n\r\n\r\nThe author&#39;s name and title are: Grammaire linguistique de l&#39;anglais, <PERSON>, <PERSON>\r\n\r\n\r\n [1]: _URL_0_", "868" ], [ "Although I was downvoted, allow me: \" ;have already \" ; matches what happened at the interview. He said you should start working on those skills. You respond by using the past perfect that implies that at some point **in the past** you began to work or began working on them and that continues to be true at the time of writing the letter. This is one of uses of the past perfect. [[note to downvoter: sour grapes? There is no decent explanation in English of the difference]]", "943" ], [ "party and people are not uncountable nouns. uncountable nouns are: money, milk and moose poo. (attempt at alliterative joke). That said, when referring to a company, in British or American English, I&#39;ll join them is merely changing horses in mid-stream. After all, companies are made up of people. In a spoken comment, it&#39;s fine. People talk like that. It depends on the utterance (and let&#39;s not confuse this with the use of a plural verb as used in BrE like this: The party [political party] were pleased with the results.", "868" ], [ "(c) to have the validity of the detention determined by way of habeas corpus and to be released if the detention is not lawful.\r\n\r\nWhatever you do not want and to signal there was text before the quote, you use square brackets with three dots:\r\n\r\nMLA style\r\n\r\n > Use square brackets whenever inserting words into an original source to clarify, simplify, or identify. Consider the following guidelines:\r\n\r\n > 1.\t Place square brackets around ellipsis dots to show omission of words or phrases in a antecedent is not in the quote that you are using.\r\nquotation. Put a space before the first bracket and after the last bracket.\r\n\r\n > Example: “In 1981, when President <PERSON> proclaimed the first forest reserves [. . .] his action was called undemocratic and un&#173;-American” (<PERSON> 59). \r\n\r\n\r\n[...] have the validity of the detention determined by way of habeas corpus and to be released if the detention is not lawful.\r\n\r\n\r\n > 2.\t Place square brackets when **clarifying a pronoun in the quotation because the antecedent is not in the quote you are using:**\r\n\r\n > **Example**: “At that time he [Lindbergh] had not yet flown the Atlantic.”\r\n\r\n > 3. Place square brackets when you need to **clarify information in the quote you are using**.\r\n\r\n > **Example**: “The sampling records [from the mountain weather stations] were\r\nexamined for levels of the same atmospheric gasses.”\r\n\r\n > 4.\t Place square brackets after obvious errors made by the original author and put the Latin word sic [meaning thus it is] inside the brackets. In APA style the sic is underlined or italicized but in MLA style it is not. \r\n\r\nThe three periods signal that there is something before it but that you are not quoting it. Often, for reasons of grammar of the writer&#39;s sentence, the square brackets are used to show there is more to the sentence. This is not \" ;deletion \" ;, it is omission.\r\n\r\nFinally, square brackets are from the author writing the text or paper. \r\n\r\n\r\n[square brackets][1]\r\n\r\n [1]: _URL_0_", "655" ], [ "The standard way to ask a question in English is Do you [verb].\r\n\r\nDo you want to have a pizza? Or not?\r\nDo you want to have a pizza, or not?\r\n\r\nIf you chose to not use Do you as the regular form of question, this usually implies either that you know the person well and maybe that you have been having a longer conversation up to the point when the question is asked.\r\n\r\nWant to have a pizza, or not?\r\nWant to have a pizza or not?\r\n\r\nDropping off the Do you is informal but most of all implies you are already in a conversation or hanging around with a person when you ask the question. So, it can be seen as rude if you ask a question without it. \r\n\r\nOften, with children who have been making a ruckus, a parent might leave off the Do you in asking the question. In that sense, it is almost a threat meaning: If you [the child] do not start behaving well, you can&#39;t have a pizza. So, it can also denote annoyance or irritation. Couples when annoyed with each other might also leave off the Do you. Also, good friends might leave it off because they know each other well and in that case, it is merely informal.\r\n\r\nThe or not is neither rude nor not rude.", "701" ], [ "In English, in the press and in public relations, you just spin or ***create*** spin. Or even engage in spin. Or also maybe even do spin. Creators of spin or spinmeister are alternatives to spin doctors. Spin master would be acceptable. Spinner would only be acceptable if a writer or speaker has already established context, in my opinion, or if the title or context merits it: Trump Media Spinners Face Angry Mobs ( I invented that just for you.)", "836" ], [ "I have to say that title is rather long. Yes, assignment can be used like that but the entire title is unwieldy, heavy and awkward. ***An Analysis of Assigning A Functional Role to Biodiversity in Ecology In [or Over] the Past Two Decades***. I see no reason for such a long title, in English or Portuguese. [Me parece um pouco rid&#237;culo].", "754" ], [ "The usual idiomatic expression that has been cleverly changed is:\r\n(in) the grand scheme of things.\r\n\r\nHere, the author has substituted themes for things.\r\n\r\nThis is a typical literary device. It could be considered a ***catachresis***: \r\nThe inexact use of a similar word in place of the proper one to create an unlikely metaphor. (Wikipedia definition).\r\n\r\nIt is probably also some other fancy Greek word which I have forgotten or overlooked. \r\n\r\nThe grand scheme of themes would be the major issues for Classicists (scholars of Greek and Latin).", "836" ], [ "Symbol is never a verb. The verb would be symbolize. \r\n\r\nThis type of sentence is called a ***rhetorical question*** and the author, for some reason, has left the verb out on purpose: \r\nAnd what better symbol of that blight than Main Street [is there]? It is a literary-type style. The verb is implied.\r\n\r\nThe author is actually making the statement: There is no better symbol of that blight than Main Street. \r\n\r\nsymbol is singular as it refers to all of Main Street, or, everything on Main Street.", "868" ], [ "@Jim quaking is not shaking. In any event, the question is silly because of: lack of context. Resistance is futile. :) Leaves only flutter in the wind if they are attached to a branch. Not if they are on the ground. Leaves fluttering [on trees] are one of the best sounds in the world. Obviously, I was not saying that leaves either shake or swing. And I really do not like being told \" ;I&#39;m wrong \" ; based on a reader&#39;s misreading of my comments.", "445" ], [ "stand is the intransitive verb, and the parts are: stand, stood, stood\r\n\r\nHe stood in the hall and shouted my name.\r\n\r\nIf you replace **stand** by **be**, you can see how /petrified/ works. \r\n\r\nHe was petrified. < p > \r\nThat is a passive verb formed by be + past participle. And (here&#39;s the crucial point), the past participle in English can be used as an adjective. Also, it can be viewed as an adjective to describe the state of he. One can replace an intransitive verb here with the verb be to show that it is intransitive.\r\n\r\n\r\nIn any event for me this can be seen two ways: \r\n\r\n1) Adverbially, as it describes how he stood.\r\n2) Adjectivally, as through transformation (the one I did perhaps imperfectly above), one can see it is an adjective and thus can be modifying the I.\r\n\r\nOften, one can go at grammar in more than one way. And in some cases, more than one structure can be shown to exist.", "868" ], [ "All this stuff about corpora is mostly nonsense since, strictly speaking, ***corpora refers to written text***. Data-driven, my foot. Descriptive grammar does deal with how people speak so the \" ;corpora \" ; has to come from recorded media. The sentence is not even a good non-standard sentence where the tendency is: would/would have. And not: was + ing/would have PP. The sentence is therefore untenable as it makes no sense. The question was about NATIVE speakers. And the typical native speaker heard in the media etc. tends toward WOULD/WOULD HAVE. for contrefactuals.", "868" ], [ "It actually is not grammatical: If my MIL was coming, I would be spending all day cleaning. I rarely hear an IF clause in the past continuous followed by a second clause in the past conditional. For example: **If he were leaving tomorrow, I would have gone already.*** That&#39;s another one and it makes zero sense. Of all the non-standard patterns one hears, this is simply not one of them.", "943" ], [ "@user21820 Not congruent with your native tongue? Hm. Strike me dead. :) OK, this sentence of yours and the OP&#39;s: \" ;If he was coming tomorrow, he would have told us by now. \" ; may be said, people do say that kind of thing. But \" ;technically \" ;, it is not standard. standard is: If he was coming tomorrow, he would tell us. It is NOT standard to use the IF + past continuous subjunctive with would + have+ verb (past conditional) in the second clause. Now, if you taught English, you would know this. Apparently you haven&#39;t. Standard is: If he had been coming, he would have told us by now.", "943" ], [ "user21828 Absolutely not. People speak as they speak, which is fine, and as a linguist I am interested in all speech, but if they are not educated, they are usually completely clueless about their own speech. That&#39;s even true of supposedly educated speakers: in AmE right now, would/would is everywhere (even with \" ;college educated \" ; speakers) and present perfect/conditional with irregular verbs are fast disappearing. Some talking head surrogate on CNN keeps saying things like: we have began or they have not did it yet. The problem in complex utterances is really one of \" ;power \" ;.", "133" ], [ "The best way to try and address this issue, in my opinion, is to read books with a pen. As you read, mark the phrases. For example, if you see \" ;run for president \" ;, and your language says \" ;present yourself in an election \" ;, you will have identified the kind of thing that makes for a good flow. Also, always carry a notebook and write these things down as you notice them (for instance in native speech or writing). This is what interpreters do to improve the idiomatic grasp of a language.", "836" ], [ "@English Student Ok, I take your general point. But I think all languages are great and English is surely not more \" ;astoundingly flexible \" ; than any other. Your question did not involve loan words. It is not the language that is \" ;flexible \" ;; it is the speakers who decide to adopt loan words or not. If you think hard enough [get it?], you will see that language is not \" ;flexible \" ;. :) But maybe some speakers are \" ;bendy \" ;. [Is that fun? :)]", "836" ], [ "A specific set of things is not a compound noun. Bells and whistles is not a compound noun. Nor is chief cook and bottle washer. Though chief cook and bottle washer are. There are three kinds of compound noun: chief prosecutor, redhead and son-in-law. Pairs that are made to go together in a catchy way are not compound nouns; they are two separate words. Good ole Pooh. :)", "868" ], [ "@Paliszhe What I mean is that unless the characters know that sociological term (due to the intellectual level of the character type), the scriptwriter would not put in their speech. But even then, it&#39;s a real stretch to imagine the actual characters were intended by the author to know that. You can mix high and low any old way. Nevertheless, there is such a thing as a coherent character. This just sounds like banter to my ear.", "138" ], [ "@aparente001 My comment is simple. If someone says something, it relates to that character&#39;s KNOWN UNIVERSE as imagined by the author. A character would not be made to say something that in some hidden way refers to some conceptual universe unless that is the type of writing it is. This is not that type of writing. And if it were, there would not be such a shift in language. The character is talking to a girl, not invoking sociological arguments.", "138" ], [ "Back in the day, he never talked to you straight, as in not in code?\r\n\r\nIt means: He always talked to you in code, never straight, didn&#39;t he?.\r\n\r\nThis is the ***use of a double negative*** in English:\r\n\r\nIf we remove the **as in**, we get: \r\n\r\n**He never talked to you not in code, [right]?**. \r\n\r\n***as in*** is used to clarify a thought.\r\n\r\nFor example:\r\n**You never liked shitty movies**, did you? **As in shitty horror movies**.\r\n\r\nDouble negatives are used in English at times in conversation to clarify a sentence that is in the negative.\r\n\r\nYou never did not like movies, did you?\r\nis the same as; You always liked movies, didn&#39;t you?\r\n\r\nIt is used for emphasis....or to fix an ambiguity.", "854" ], [ "accurately as in:\r\n\r\nMerriam Webster:\r\n \r\nDefinition of accurate\r\n1\r\n: **free from error** especially as the result of care an accurate diagnosis\r\n2\r\n: **conforming exactly to truth or to a standard** : exact providing accurate color\r\n3\r\n: able to give an accurate result an accurate gauge\r\n\r\nto do something accurately. \r\n\r\nBut it only for things like doing a project or describing something.", "951" ], [ "@Cerberus For purposes of business communications, in which widgets, processes and procedures are being discussed in internal memos, etc., the word flagged is business oriented, just like the OP requested. For example, if you are discussing the agenda for a meeting, one person could write to another: I&#39;ve flagged the important items for your attention. This would not be \" ; \" ;informal \" ; \" ; usage; it would be the only usage for this meaning of pointing out items as important.", "224" ], [ "slated is a writerly term, a journalistic term; marked is a technical term for physical objects; flagged is a term used in identify items in a list. These terms are all used in different contexts and for different purposes. None is less or more formal. They are all formal. And all three can mean: designated, which is generic and does not contain any specific semantic trait, and just mean identified as some thing. Designated for disposal.", "224" ], [ "Two good sources about capitalization in English literature:\r\n\r\n \" ;1) Q: In rereading <PERSON> poems, I’m impressed by her use of midline capitals. Can you shed some light on the capitalization of common nouns in 19th-century America? Is it intended for emphasis?\r\n\r\nA: When <PERSON> introduced printing to England in the 15th century, &#39;great uncertainty&#39; surrounded the use of capital letters, according to the linguist <PERSON>. \" ; Please read on.\r\n\r\n[capitalization][1]\r\n\r\n\r\nAnd this:\r\nConditions of Literary Production from the **Norton Anthology of English Literature**, \" ;The Restoration and the Eighteenth Century \" ;, 1660 to 1785\r\n\r\n \" ;Reading material, though it remained unaffordable to the laboring classes, was frequently shared. Circulating libraries began in the 1740s.\r\n\r\n**Capital letters began to be used only at the beginnings of sentences and for proper names, and the use of italics was reduced**. \" ;\r\n\r\n\r\n[The Restoration and capital letters][2]\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "216" ], [ "@Steeven: It is not at all clear in your sentence. So, let me try again: dimensions in technical English are; Length, Height, Width or Depth. OK? Those are the terms. Cross is not one of them. Ergo, cross-wise will not have the same meaning as width-wise or depth-wise, if your intention is to be very precise. Also, I just noticed fitting-wise. Frankly, there I might drop the wise and just say: in terms of fit because one doesn&#39;t want to overload a text by using -wise or wise too many times.", "603" ], [ "Here is an academic paper that looks at this question. The term is from the Bible. The fact is that Catholics prior to the Reformation did not \" ;read \" ; the Bible much. However, it was the subject of formal debate among scholars:\r\n\r\n \" ;The fire of hell belonged, in a distinction well understood by both Protestant and Catholic interpreters, to the torments of the senses, the poena sensus, rather than to the spiritual or psychological torment of being deprived of the sight of God, the poena damni. But the precise nature of this fire had long been a source of puzzlement in Christian thought. \" ;\r\n\r\n \" ;That hell was a place of fire seemed on the surface easily the most\r\nuncontentious of theological commonplaces. **The Bible abounded with\r\nreferences to ‘the fire that shall never be quenched’, and to tormenting ‘with\r\nfire and brimstone’**. \" ;\r\n\r\nIn the US, there was, and still is, a proliferation of Evangelicism and fundamentalism, \" ;movements \" ; within Christianity that tend to favor Bible reading and citation and be \" ;into \" ; literalism, of which, fire and brimstone is part. There is also a particular style of preaching known as \" ;fire and brimstone \" ; preaching, where the believers are repeatedly pounded with the idea of hell if they do not do a series of things. Most importantly, recognize <PERSON> as their savior. In fact, all Christian believers believe that but not all Christian sects demand people actually say it or demonstrate it. \r\n\r\nThat said, early newcomers to the New World would have been familiar with the term. \r\n\r\nThe term fire and brimstone is in no way exclusively heard in North American though it is probably heard more in the US due to the ever increasing (it would seem) numbers of fundamentalists one sees.\r\n\r\n\r\n[hell fire and brimstone and the Reformation ][1]\r\n\r\n\r\n [1]: _URL_0_", "922" ], [ "A lot of the southern speech in ***Gone with Wind*** is just that, gone with the wind! It&#39;s no longer heard, even in the South. The word heap is still used but not in this configuration: I&#39;d heap rather....I suspect that even when the script was written, this was something invented by the writer rather than a set form. You might consider telling who the speaker is....", "854" ], [ "There seems to be a misunderstanding in the question. There is no such thing as a Freudian slip that \" ;exists \" ; out there. Also, there is ***no trope or joke about them***. They are things one makes. Do I dare say every human being makes them? \r\n\r\n***Freudian slips, properly called parapraxis or lapsus linguae, are slips of the tongue.*** ***You mean to say one thing, but your unconscious gets the better of you, and you say another.*** [lapsus][1]\r\n\r\nTropes and idioms are not Freudian slips. In fact, everyone at some point or other makes these slips of tongue in their speech. Now, some people may not know what they are called, but most people at least know they are having a \" ;whoops, moment \" ;. I said X but meant to say Y.\r\n\r\nFurthermore, there are many different kinds of these slips of the tongue. The link below goes into detail about the different kinds.\r\n\r\nAlso, the term Freudian slip comes from \" ;<PERSON>, who, in his 1901 book *The Psychopathology of Everyday Life*, described and analyzed a large number of seemingly trivial, bizarre, or nonsensical errors and slips, most notably the Signorelli parapraxis. \" ; [Freudian slip][2]\r\n\r\nI was not looking to write a dissertation here as some are wont to do. (That&#39;s fine). I merely was looking to clear up a misconception in the way the question was posed and what the term really means. I should think that the \r\n\r\nThe first translation into English of that The Psychopathology was in 1914 by <PERSON>.\r\n\r\nAnd here is a link for layperson on why it&#39;s important to understand what a Freudian slip really is: [enter link description here][3] To wit:\r\n\r\n \" ;My current favorite example of a probable Freudian slip is when President <PERSON> reportedly said in a speech he was giving to a group of teachers “I&#39;d like to spank all teachers.” We guess that he wanted to say “thank” all the teachers, but he didn&#39;t. Why didn&#39;t he? That is open to analysis. \" ;\r\n\r\nFinally, in everyday English, Freudian slips are often referred to as bloopers.\r\n\r\nI was unable to identify when the term was first used. Perhaps some book review or other? Perhaps someone else can find it. :)\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_2_\r\n [3]: _URL_0_", "818" ], [ "In standard English, it is: This is plus a singular noun; These are plus a plural noun.\r\n\r\nThis is my leg; These are my legs. [pointing to them or showing them]\r\n\r\nAnd be careful with semantic shift: /There is or are/ in English contrasts with /Here is or are/. There is/are and Here is/are are to locate objects in space. /There are/, of course, is also used to make general statements without reference to location in space specifically.\r\n\r\nBut, if you say: There are my legs (forgive me), it sounds like your legs are removable and you can \" ;see \" ; them \" ;over there \" ;, detached from your body.", "69" ], [ "It&#39;s called the definite article in English. No abstract word takes a definite article in English: life, death, happiness, sadness, etc. All those take one in French, and in all Romance languages. It would only take a definite article with the OF, One Day in the Life of Ivan Denisovitch. (that&#39;s from memory). He&#39;s living the life of <PERSON>. But life is difficult. Or as we say, C&#39;est la vie. [smile]", "854" ], [ "This is passive voice because the expression in English uses the passive voice:\r\nto be invited to a party.\r\nto be swindled by a coworker.\r\nto be driven to work\r\nWithout the infinitive, one says: \r\nBeing invited to parties is fun. \r\nBeing swindled by coworker is terrible.\r\nBeing driven to work is not fun.\r\n\r\nNow, you can mix and match all those with other verbs of emotion:\r\nto be happy/upset about by or about, was happy about\r\nto be annoyed by, was annoyed by\r\nto be angry about, was angry\r\n\r\nJust trying to elucidate the structure while avoiding too much tech talk.", "868" ], [ "This sentence phrase is agrammatical in standard English: [your] right to be paid for work done on this contract is irrespective if [agency] is paid by the [client] \r\n\r\nI bang this stuff out all the time (as a translator), and I daresay it is not work done \" ;on this contract \" ;, which would mean doing work writing the contract, but \" ;work done or performed under this contract \" ;. \r\n \" ;Irrespective if \" ; is agrammatical in English; it should be: irrespective of whether the agency is paid by its client. \r\n\r\nSo, acceptable, standard English phrasing would be:\r\nyour right to be paid for work done under this contract is unrelated to whether [name of agency] is paid by [name of client]. \r\n\r\nPersonally, I would not write: is + irrespective of. In any event, \" ;irrespective if \" ; is a mistake, heavy vetting or not.", "836" ], [ "To bang something out is an old Fleet Street term (journalism) meaning to write an article on a manual typewriter. Therefore, it means to write an article or piece. I said bang out because I consider translation a form of writing...you can say doing work under the terms of the contract but under this contract means the same thing. Shorter is better, I think...", "232" ], [ "Change can be used for all of them. Change the short term, change the reference name and change the local name. \r\nAlter and modify could be misleading or have another meaning....\r\nor\r\nUse another short term, use another reference name or use another local name.\r\n\r\nrename an object, by changing its name.\r\nrename an object by replacing its name with another.", "495" ], [ "In journalism, the common questions to be answered about a subject one is writing about are: Who, When, What, Where and So What.\r\nThat should answer the question. Who and what can be seen as subsets of that basic rule of thumb.\r\nOf course, one could answer the question other ways, to wit:\r\n \" ;What are you? \" ;\r\nI am a proofreader. I am a beer drinker. I am an ankle biter.\r\n \" ;Who are you \" ;\r\nI am my father&#39;s son. I am a stranger in these parts. I am the cat&#39;s pajamas.\r\n\r\nThe philosophical answer, however, would be: \" ;What \" ; asks the question in terms of an object. And \" ;who \" ; asks the question in terms of the subject. Something we hear less and less about in these days of everything being about things being in one&#39;s DNA. (How does one locate talent in genes, anyway?)", "727" ], [ "In English, especially technical English, there are many nouns that are used as adjectives (adjectivised). As a compound term where network functions as an adjective, it&#39;s: network planning.\r\n\r\nThat said, in an article or longer description, one might want to say: (the) planning of networks was not part of the original contract. But even there, it would mean \" ;network planning \" ;.", "868" ], [ "The difference between the two (in terms of standard English which in this case is the same on both sides of the Atlantic) is: I had dinner [at a particular point in time: earlier, at 7 o&#39;clock] versus I have had dinner [it&#39;s in the past but the time is not important, what is important is the act or action]. That is how it&#39;s taught in ESL. One emphasises that the thing occured at a particular time and the other contains the information that it occurred in the past without reference to time.", "943" ], [ "There is a concept called semantic trait that comes into play here. Often, native speakers masters these unconsciously. Then, there is the issue of Latin versus Greek origin for what are basicially synonyms. And I am sorry but don&#39;t feel like applying my brain power to this. It would take pages and pages. One example: glinting is usually about a hard surface, ergo, I would not use it here to describe the relationship with how the dew looked on the grass. So, if grass is glinting with dew, the writer is viewing the grass as a hard surface...", "566" ], [ "Initial **tentative rewrite** (take the gift, and please watch out for INGS, which are BE + verb)\r\n\r\n — What the hell y&#39;all be doin&#39; here?\r\n- Hey man! What the hell you be doing man? Stop that shit now. \r\nYa hear me? \r\nHey you! What the hell you be doin’ man? Stop that shit now. Ya hear me?\r\nCome on, say something? — Come on, can&#39;t ya say somethin&#39;?\r\nHey, who out there? [no is or maybe be: who be out there]\r\nI know, you be listening to us \r\nSomebody be out there man. \r\nWow, this taste good. [NO s in third person]\r\nDamn,man, who the fuck are these people? \r\n\r\nAnd to hell with what is politically correct, especially for writers....the only way to learn is to mimic. Delicious would not be used, depending on level of education.", "868" ], [ "To, for, of or none of the above.\r\nNone of the above (foregoing):\r\nProfessionally trained translators don&#39;t talk about equivalents or equivalency. They talk about equivalent meanings or equivalency of meaning. Therefore, one would say it like this: \r\n < b > Is there a British/American phrase that is equivalent in meaning to the French phrase \" ;broyer du noir \" ;? < /b > That said, in English, to be idiomatic one has to say /equivalent to/. Sixteen ounces is equivalent to one pound.", "854" ], [ "Phantasmagoria is the noun form and important word literarily speaking. It conjures up worlds of Gothic horror and so forth, and the works of writers like <PERSON> (The Pit and the Pendulum) and <PERSON> (<PERSON>) are full of it. Indeed, with the idea of spooky, specterish, scary places their works would not even exist. Think of a poem like The Raven: Once upon a midnight dreary, while I pondered weak and weary [in my dark attic room lit by a candle]. And <PERSON> even has a poem by the name. Take a look at this crowd: _URL_0_ Their looks make one think of the naughty, wicked things associated with the word. Oh, I forgot to mention: The Fall of the House of Usher by <PERSON> and a lot of <PERSON>. Where would he be without it? Phantamagoria: an awful mixture of phantasy and illusion and changing landscapes....modernity has these qualities if one looks at it pessismistically.", "897" ], [ "The historical timeline from the time <PERSON> coined the term has mostly been filled with horrors that can be classified as phantasmagoria. While Victorians were sipping tea in their parlors <PERSON> was describing the horrors of the poor in London and the British Empire was running amuk in India...there are so many examples....modern European history is filled with it. As is literature. <PERSON>.", "853" ], [ "It refers to Benjamin&#39;s book in French called: Paris, Capital of the 19th c. In this way, he joins certain analyses developed by <PERSON> in the 1844 Manuscripts and then Capital, regarding the &#171; fetichism of commodities &#187; and &#171;phantasmagoria &#187; that capital produces by diisconnecting use value from exchange value, two notions much used by <PERSON> in this short book. [my translation from _URL_0_] Hmm..hedge funds? :)", "155" ], [ "/An international company operating in the industry of electronics for military use/ should read:\r\nAn international company in the military electronics industry.\r\nThe word operating sounds like a construction used in a Romance language; it is not needed in English. Typically, in English, one says: an x company in the y industry. Military electronics is an industrial sector.", "224" ], [ "A counterfactual sentence is a condition contrary to fact:\r\nHere&#39;s the actual \" ;standard \" ; grammar: < p > \r\n1) If I go, I will see him. Present (either form) + Future with Will OR\r\nIf I am going, I will see him. < p > \r\n2) If I went, I would see him. Simple Past Tense + Present Conditional\r\nHERE&#39;s the KICKER: < p > \r\n3) If I had gone, I would have seen him. Pluperfect + Past Conditional < p > \r\nThe difference between 1) and 2) is how much you want to emphasize the probability. 1) is just an IF statement. 2) is a contrafactual. < p > \r\nNow, your sentence: /If my mother-in-law was coming tomorrow, I would have spent all day cleaning the house./ is agrammatical in English. < P > It should be:If my mother-in-law was [or were] coming tomorrow, I would spend all day cleaning the house. That makes it a type 1) sentence. To make it type 2): If my mother-in-law had been coming yesterday,I would have spent all day cleaning the house.", "943" ], [ "In the one hand, this is very simple. There is a trend in US advertising to drop the LY adverbs and use the adjective instead. That would not be acceptable in a formal essay but it&#39;s OK in advertising as it reflects the way people talk. Play Fair, instead of play fairly. But, on the other, there are amusing things like: Think Big, which is not an example of this, since there is no bigly and Think Big is a colloquial expression.", "868" ], [ "I think it is useful to read the actual text by <PERSON>, which is translated into English: _URL_0_ The terms use value and exchange value are terms used by <PERSON>. I am not disputing them or explicating them. Though I daresay the meaning is obvious to most people. The only way to see exactly what <PERSON> meant is to read his essay and not have a disputation with me. Don&#39;t shoot the messenger. The point is that I did \" ;locate \" ; the term and that should have use value for the OP.", "155" ], [ "It is not a claim, deadrat. It is a fact. <PERSON> uses the term: \" ;The world exhibitions glorified the exchange-value of commodities. They created a framework in which their use-value receded into the background. They opened up a phantasmagoria into which people entered in order to be distracted. \" ; He uses the term at least 8 times: _URL_0_: art de faire voir des fant&#244;mes par illusion d&#39;optique , the art of making ghosts appear through optical illusions; Also:artistic (fine arts) representation using allegories.", "96" ], [ "< b > About This Poet < /b > \r\n < p > Do not use the royal we. It&#39;s much over-rated and does not apply to the fact it is really you writing the poems. When needed use I, otherwise make sentences without any pronouns. We is for companies making widgets (physical or virtual), not for a person who writes poems. < /p > \r\n < p > About This Poet < /p > \r\nBringing your loved ones closer to you. [tagline]\r\n < p > [Narrative: For x years, I have been etc. < /p >", "536" ], [ "Ok, what I am saying is that the greatest number will use the contraction. Uncontracted forms are for conscious emphasis unlike the contracted form which is what people usually just say. Just saying. It depends on context and the \" ;scene \" ; the OP is interested in creating...of course, I can say: \" ;Are you not [not italicized] hungry? It almost shows surprise. That is fine. Great. Fantastic, But it is less usual.", "469" ], [ "Let me give you another example then: I have never liked what he said [on some day]. I have never liked what he has said [in the past, not specified.] Same here.. The difference is not semantic; the verbs make the two sentences mean something different. I have never understood [in the present, and I am still thinking about it, what <PERSON> said [one time in the past. VERSUS I have never understood [in the present and am still thinking about it] what <PERSON> said [at the party]. And keep your minuses to yourselves until you understand verb tenses in English.", "943" ], [ "Here you go: it&#39;s a performative and involves giving or handing something to someone or finding something for someone. It indicates something is being pointed to physically or mentally. \r\n\r\nIt accompanies the gesture of giving something to someone:\r\nHere [hand moves toward the other person] you go [is the thing].\r\nYou might kick a ball to child and say: Here you go.\r\n\r\nIn referring to non-physical things, the idea of the physical gesture is neverless under the surface. \r\n\r\nTo sum up, it accompanies the performance of a physical or mental gesture.", "951" ], [ "Love is usually an action verb followed by a direct object. Clauses can be direct objects, funnily enough; they can function like a direct object. Ergo, you can&#39;t move the direct object \" ;any old way \" ; can you? If you substitute a more easily recognizable direct object such as in: He loves the trees, the direct objectness of the structure becomes obvious. Likewise, it becomes obvious that you can&#39;t say: < p > /The trees, he loves/ < /p > < b > except < /b > under certain rhetorical or poetical situations. So, to sum up, I&#39;d say the direct object function is a primary grammatical function and it trumps the fact the direct object happens to be a clause.", "868" ], [ "All the contractions in that paragraph are for would, not did. < p > \" ;That&#39;s what I did a lot of the time. I would make sandwiches or I would sell beer \" ;. < p/ > That use of the helping verb would means: used to do something thing. It indicates an ongoing activity. In fact, the first sentence shows the rest of the activities are, in fact, \" ;used to do \" ; activities. A lot of people would sell clothes=A lot of people used to sell clothes. Same meaning.\r\n < p > Using would like that is an alternative way of expressing: used to [verb] as an ongoing activity that was habitual in the past. < /p >", "854" ], [ "must/have to help someone. For me, the must implies an over-arching sense of being urged to do something. Morally, for example. Whereas have to help her is just a duty. I don&#39;t like your original definitions: must implies a strong moral urge or agency to do something. Have to do something is less agency induced....Additionally, the Brits use must more in the sense of: Oh, it&#39;s late. I must go versus Ok, it&#39;s late, I have to go. Though AE also uses that at times in that way: strong urgency.", "232" ], [ "/Take out the trash and move your bike/ is an imperative and **a compound sentence**. The implied subject is you. There are no dependent clauses in it. The two sentences have a parallel structure and the /and/ is the linking word. Ergo, the comma rule to be placed before indepedent clauses does not apply here. However, one could - if one wanted to - put in a comma to signal emphasis or a slight pause. If that comma were in a script, the actor would read it differently than if it were not there. One has to say these things aloud to see how there might be a difference. But for me, this is not a grammatical difference.", "536" ], [ "Isn&#39;t \" ;gotta go \" ; and \" ;hafta got \" ; both spoken contracted forms: I&#39;ve got to go [go to the bathroom?? In Continental French (ahem), it&#39;s faire pipi (more women and children), pisser (more men). I find it amusing that people in private homes in the US will sometimes say: \" ;Can I use your rest room? \" ;; and it makes me want to say: \" ;Does this look like a train station? \" ; :)", "524" ], [ "1) I have never understood [unspecified past at this moment of speaking on the timeline] a word <PERSON> has said [unspecified past at this moment of speaking on the timeline]: at this moment of speaking, on the timeline. < p > VERSUS: 2) I have never understood [unspecified past at this moment of speaking on the timeline] a word <PERSON> said [simple present implies at a particular time]. \r\n < p > in 2) at the time of speaking in the present, I have not understood what <PERSON> said [at a specific moment in time]. She said something at some particular time (last week, in October, last year) and I still do not understand it today. < /p > Both are correct, it all depends on what the speaker means: what <PERSON> said [that time, yesterday etc.=a specific moment in time] versus in a past that it not specified at the time of speaking: <PERSON> has said.", "943" ], [ "glibness - I hate the glibness with which .... < p > \r\n<PERSON>:\r\n\r\nFull Definition of glib\r\n\r\n1\r\na : marked by ease and informality : nonchalant\r\n****b : showing little forethought or preparation : offhand < glib answers > \r\nc : lacking depth and substance : superficial < glib solutions to knotty problems > ****\r\n[...]\r\n\r\nglib&#183;ly adverb\r\nglib&#183;ness noun", "232" ], [ "There is no idiomatic expression here overall, except for the verb: to be back to something. That said, in regular speech, to describe a situation, a speaker will often say: Now, we&#39;re back to [some condition or state]. And the \" ;to be back to \" ; is followed by a condition or state can be said by a person or it can be attributed to a situation. Here, it&#39;s for a situation, \" ;Now, it&#39;s [the situation] is back to A [condition]. < p > Of course, to be back to something just means to have returned to a place, situation or condition. A paraphrase of the sentence would read: We have now returned to a situation of brightness. And brightness, well, that is a lot of light, or perhaps better said, not darkness....", "854" ], [ "It&#39;s funny, I must be a real materialist: \" ;I&#39;m not quite sure what the word I&#39;m looking for is, but I think it would be something along the lines of stupid and unoriginal. \" ; One can do exegesis on anything and everything, but really something along the lines of a word, cannot be an ad-hominem attack, can it? Erudition doesn&#39;t answer the question. I object to my two down-votes. Of course, the husband&#39;s attacks are ad hominem, but it seems to be the OP is asking for an adjective. As for the perceived opponent&#39;s credibility....hmm. Not my reading of this at all...", "932" ], [ "I don&#39;t agree with your rewriting my words.I don&#39;t think puckered is problematic! That is precisely why I posted all the word related to positioning the lips. For pete&#39;s sake. I prefer putting my source at the end, not the beginning. Not worth the effort. You just didn&#39;t like it because it was long, and the online page was not well positioned. I really don&#39;t care except for the part about puckered.", "734" ], [ "I would like to run a systemd [oneshot service](_URL_0_) whenever my system gets a new IPv6 address assigned to it from the network router (this would be on boot, and periodically throughout its uptime).\r\n\r\nIdeally, this event would be only for IPv6 address updates, and not include potential IPv4 address changes.\r\n\r\nIs it possible to monitor networkd dbus activity for this kind of event with systemd?\r\n\r\nMy ultimate goal is to hit a dynamic DNS endpoint whenever this happens, so that this system&#39;s IPv6 DNS record avoids going stale.", "736" ], [ "Not slang. It&#39;s just lower register, spoken register as opposed to a formal register. By the way, schlong is not that horse&#39;s behind invention. It&#39;s Yiddish and very New Yorky. The grammar is correct: just like: to get tired. To get bruised. etc. I call it an \" ;Anglo-Saxon \" ; form as opposed to a \" ;Latin-origin \" ; form: to become tired would be more formal way to say it.", "171" ], [ "A rewrite just for you: < p > \r\nA video that engages and impresses its target audience with a unique story, achievements around the globe, a touching revelation, and hope for a better future. < p > Now, it&#39;s better. Simpler is better. That is now used correctly in the sentence. Maybe /touching revelations/ with an s. But I can&#39;t say since I don&#39;t know what you are referring to.", "951" ], [ "The legal profession is a **guild** in the sense of a trade association where all the members have the same interests and that call for levels of knowledge for admission (law school, bar exam). Anyway, they are a cartel.\r\nA cartel is an economics term but also used by <PERSON> to describe a closed group of individuals working together on a psychoanalytical issue. \r\nThat said, it has broader usage. There is a very interesting discussion on the broader meaning of cartel as also applying to lawyers. < p > \r\nThere is a [book called Overcoming Law](_URL_0_) that is all about this.", "224" ], [ "There&#39;s followed by a plural noun may be accepted, but, frankly, when I hear pundits saying it in public, some uses of there&#39;s + plural noun, are irritating. So, it depends on what exactly is being said. The contracted form is There&#39;re, not there&#39;s. Remember the Beatles song: There&#39;re places I remember all my life. When I hear: <PERSON>, there&#39;s apples on the table, my automatic ticker goes off re education, etc. Or \" ;There&#39;s people out there on the lawn \" ;. I need to think about why sometimes it sounds OK and other times it functions as an education marker...", "868" ], [ "I think that a very useful distinction is to say that a construction company builds things. That said, any company can be a contractor. Contracting is a function, not a type of company. \" ;We hire trades people for construction projects. We are contractors [function] in this segment \" ;. So, in a directory you would list Construction company. Of course, most construction companies are contractors since they do not keep workers permanently on their payrolls.....<PERSON>: in the directory, not on. :)", "793" ], [ "In AE: \r\nA quitinete in Portuguese comes from the word in English kitchenette, in fact. We say studio apartment or efficiency. An efficiency or studio apartment has a kitchenette (a small kitchen). < p > Brazilian Portuguese took the word for kitchenette, made quitinete, as a synedoche for a studio or efficiency (apartment). A funny thing: the old efficiencies in New York City often had beds that folded up into the wall. Flat (UK) is apartamento, of any kind. In the US, we say apartment for an apartamento. We also refer to apartments as being condos when they are in a condominium property. \" ;I have a condo in Florida \" ; = I have an apartment in a condominium building in Florida. < p > A loft is very different. It refers to large, (usually) open-plan apartment made from reconverted warehouse-type buildings in large cities (usually) like New York or Los Angeles.", "867" ], [ "Right, so here are some speech-contextual ideas about usage in AmE.\r\n\r\n- **Listen, dude**, you have no idea what you&#39;re saying.\r\n- **Listen, man**, you have no idea what you&#39;re saying. [basically the same thing.] These terms are used in addressing a single person; not a group of people.\r\n\r\nFor a woman:\r\n\r\n- **Listen, lady**, you have no idea what you&#39;re saying.\r\n- **Listen, missy,** you have no idea what you&#39;re saying.\r\n- **Listen, ma&#39;am,** you have no idea what you&#39;re saying. [high register]\r\n\r\ncomment: Unlike dude in man-to-man speech, the examples above are used in man-to-woman speech, but, do not convey the macho quality of dude, in the sense of dude being used essentially by men of equal rank addressing each other. The examples above are not used in woman-to-woman speech, with perhaps, the exception of <PERSON>, in the Southern US.\r\n\r\nAs far as I know, there is no term that is used as direct address in woman-to-women speech. That&#39;s because (and I am going out on a long limb here) < b > women are not in the habit of challenging each other in the way men do < /b > . \r\n\r\nYes, of course, one woman could say to another \" ;Look, bitch, [etc.] \" ; but that would only be in a hyper-confrontational scenario that is not one where, in the case of men, dude would be used.\r\n\r\n- these forms of address are used by speakers addressing one other speaker.\r\n- they are not plural\r\n- there is no form of address for woman-to-man or woman-to-woman speech using a female-only term and, I repeat, one does not exist since relationships between women are not like relationships between men, as a general rule.\r\n\r\nFinally, in the plural, the military uses \" ;ladies \" ; to address troops, either all-male groups of military individuals or mixed groups. This is actually pretty funny, since, in the past, the word \" ;men \" ; would have been used. So, this ends up being a sort of indirect homage to women while also suggesting indirectly that the group of soldiers, etc. being addressed needs to get tougher.", "469" ], [ "@JasonBassford Not at all. Look, dude, is not parallel to Look, girl, except in Black English. Sixties feminists used to say sisters, yes. Our sisters, this and that. but not: Look, sister, as a confrontation like, look, dude. Today, only a lady of color would say that and if I were to use it (as a white woman), I would only address a white woman with it drawing on Black English and would not dare use it with my African-American sisters.", "818" ], [ "D means Democrat, or a member of the Democratic Party.\r\n\r\nR means Republican, or a member of the Republican Party.\r\n\r\nWe say Democrat members of Congress and Republican members of Congress.\r\n\r\nIf the person is a Senator, so: Senator <PERSON>, D-Ore, means; Senator <PERSON>, a Democrat from the state of Oregon.\r\n\r\nReference: just know. \r\n\r\nBut for those who need references: [Democratic Party][1]\r\n\r\n\r\n [1]: _URL_0_", "634" ], [ "Yes, there is strict usage. R means Republican, as in a Republican senator or a Democratic senator. You wouldn&#39;t say: Democrat senator. Members of their respective parties: The Republican Party and the Democratic Party. Now, if the word party is not present, one can say; \" ;He is a Republican. \" ; or \" ;She is a Democrat \" ;. But not Democrat senator or Democrat congressperson.", "634" ], [ "6. Estrada ou rua junto &#224; <PERSON> a uma grande extens&#227;o de &#225;gua. in Dicion&#225;rio Priberam da L&#237;ngua Portuguesa [em linha], 2008-2013, _URL_0_ [consultado em 20-07-2018]. That means coastal road but can also a road along a river or lake or the coast. The definition in Portuguese means: along a body of water.", "237" ], [ "6. Estrada ou rua junto &#224; <PERSON> a uma grande extens&#227;o de &#225;gua. in Dicion&#225;rio Priberam da L&#237;ngua Portuguesa [em linha], 2008-2013, _URL_0_ [consultado em 20-07-2018]. \r\n\r\n Priberam is an excellent Portuguese dictionary.\r\n\r\nTranslation of the definition: A highway or road alongside or to the side of a large body of water.\r\n\r\nSo, roads run along rivers, coastlines or lakes.\r\n\r\nThat would give us: coastal road, riverine road (technical), road along a river or river road or riverside road (non-technical) and lakeside road or road along a lake.\r\n\r\nIn Portugal, the highway (BrE: motorway) that runs along the coast, is said to be a marginal, but not all marginals need run along the seacoast. \r\n\r\nExample: [Cascais coastal road][1]\r\n\r\nThe article says: Marginal de Cascais cortada devido &#224;s ondas Via est&#225; encerrada entre Caxias e Pa&#231;o de Arcos. \r\n\r\nCascais Coastal Highway [or Road] Shut Off due to waves\r\n\r\nEstrada marginal in the article is again: Coastal road. Because the road is \" ;by the sea \" ; (alongside), it is \" ;uma estrada &#224; margem do mar. \r\n\r\n > coastal highway [American English]or coastal motorway [British\r\n > English]\r\n\r\n\r\n\r\n [1]: _URL_1_", "237" ], [ "@user070221 The English is completely wrong in your description. Your language probably contains: au bord de la mer, or al borde de and you mistakenly then say in English, along the border. I suggest your return to your dictionaries. Florida has no border roads; Florida has coastal highways! Countries have borders, yes. Few have border roads.", "167" ], [ "To the OP:\r\n\r\nI tried to answer the question. I didn&#39;t think it merited an entire thing.\r\n\r\nI have no idea what you mean about my comments being spammy. \r\n\r\n > Native English speakers do not say softwares with an **s**. They say, if\r\n > they need a plural, programs, applications, software applications or\r\n > software programs. With an s.\r\n > \r\n > Also, they do not say \" ;a \" ; software, as if it were a countable noun.\r\n > \r\n > They will switch from using software (uncountable) to programs or\r\n > applications if they need to refer to more than one piece of software\r\n > in a formal context.\r\n > \r\n > Finally, it is possible the person you \" ;ran into \" ; online uses\r\n > softwares with an s to be cutsey. Being cutesy is an American\r\n > expression that means: to be cute i.e. to get noticed.\r\n > \r\n > It is also possible that the person uses the s because the person is\r\n > non native\r\n\r\n.\r\n\r\nIf you look at the \" ;formal \" ; documentation for software on the internet from software companies, you will not find software with an s or an a. \r\n\r\nThat is all I have to say. And I have no references other than my own experience. By the way, I have translated tons of strings and software bumph, especially in the area of banking, finance and architecture.\r\n\r\nHave a nice day, afternoon or evening. (I don&#39;t know your time zone).\r\n\r\n > Software is an uncountable noun or it is an adjective, as in software\r\n > program or product or software environment.", "224" ], [ "Well, I have to address the phenomenon, aka the elephant-in-the-answer box.\r\n\r\nBut first things, first. Voting on the worthiness of a question is not the same as voting on whether an answer to a question is good. \r\n\r\nFor answers, I upvote an answer based solely on my understanding of the question and deciding on which answer best fits the bill. Sometimes, two answers may be good or cover more ground together than separately. So I upvote two different answers. \r\n\r\nThe phenomenon that drives me round the e-bend is: upvotes on answers that are completely off track when a good answer is present but has gone unrecognized by all the upvoters.\r\n\r\nI call this: the null-set or shiny-pretty-thing bias. That is a polite way of saying the upvoters simply don&#39;t have the knowledge to know either way whether an answer is actually really good. They read an answer, don&#39;t know the subject matter, and upvote because everything \" ;sounds good \" ;. They vote for the shiny, pretty thing. The incredible part of this is that often this occurs in a context where a really good answer is present and overlooked. When I really do not know the subject matter, I do not vote. Period.\r\n\r\nThe other phenomenon is that the right answer is completely different from what most readers (voters) are able to recognize, and, not only do they upvote what everyone else has upvoted, they downvote what is actually a good answer but one they simply do not understand. \r\n\r\nUnfortunately, there is a lemming effect, and people do seem to sometimes just follow the crowd. What other explanation can there be to explain a huge number of unmerited upvotes for certain answers? And also, the converse: a large number of unmerited downvotes on certain answers?\r\n\r\nPlease note: I only am commenting here on answers, and not on questions.\r\n\r\nRe this question: I think it is useful, so I am upvoting it.\r\nRe the answers: I think they all say something useful, so I am upvoting all of them; they each add some interesting insight on how people vote.", "641" ], [ "How to lighten your burden: \r\n\r\nYour sentence is:\r\n\r\n > **Both the stack and the heap are parts of memory that is available to your code to use at runtime, but they are structured in different\r\n > ways.***\r\n\r\nB\r\n\r\n > Both the stack and the heap are parts of memory available to your code\r\n > to be used at runtime but they are structured in different ways**.\r\n\r\nThere is no reason to use a relative pronoun here. \r\n\r\nThe relative pronoun can be left out when it is not the subject of the clause.", "536" ], [ "\" ;In this connection it should perhaps be pointed out that we must\ndistinguish between the study of idiomaticity and the study of idioms. Idioms in the sense \" ;opaque invariant word combinations \" ; have been studied by theoretical linguists quite extensively, but these bona fide idioms do not contribute to the idiomaticity of a text in any important way. Presence of such idioms in a text does not necessarily make it idiomatic ; nor does their absence make it unidiomatic. \" ;_URL_0_", "133" ], [ "The MLA doesn&#39;t have rules on French capitalization.\r\n\r\nTitles in an original language are kept as is.\r\n\r\nTitles with a translation follow English rules. The main words of plays in English are capitalized, unlike French.\r\n\r\n- The Merry Wives of Windsor\r\n- A Moon for the Misbegotten\r\n\r\nfor, can be considered a minor word: that gives us:\r\n\r\nEnglish: Waiting for Godot \r\nFrench: En attendant <PERSON>\r\n\r\nIn French, play titles are not capitalized as in English. But there&#39;s no point going into a whole thing about that. Here&#39;s the original play in French from the original publisher, LES &#201;DITIONS DE MINUIT, in 1952, which is how it should be used in an English text. One doesn&#39;t translate that. But there are many translations of it, which follow English titling rules.\r\n\r\nEn attendant Godot\r\n\r\n[![enter image description here][1]][1]\r\n\r\n\r\n [1]: _URL_0_", "216" ], [ "She&#39;s not been [something].\r\nShe hasn&#39;t been [something].\r\n\r\nBoth are the same. However, sometimes one might say one and at other times the other. But I don&#39;t view them as BrE or AmE.\r\n\r\n- She&#39;s not been herself recently.\r\n- She hasn&#39;t been herself recently.\r\n\r\nThe first is ever so slightly higher in register. It&#39;s true, for instance, that I also hear it more frequently used in speech in British broadcast media/TV/series than in its AmE counterparts. [I know counterparts are usually people. Thank you.]", "854" ], [ "If the person failed to act because the discussion was just taking up time, to shilly-shally or dither might be useful.\r\n\r\nIn other words, the person was wasting time by being indecisive.\r\n\r\nCambridge Dictionary (for both terms):\r\n\r\n > **Stop dithering and choose which one you want!**\r\n\r\nshilly-shally - to spend too much time doing something or making a decision because you do not know what is the right thing to do \" ;\r\n\r\n > **Stop shilly-shallying and make a decision now!**\r\n\r\nColloquially, we say: Stop screwing around.", "232" ], [ "> Our custom-designed graphics ensure your content instantly gets recognized with consistent imagery, copy, style and color-schemes.\r\n \r\nBetter is, in my opinion, something like: \r\n\r\n > Our custom graphics make your advertising [pop][1] in a design environment that blends imagery, text, style and a color scheme to define your brand.\r\n\r\nCopy means advertising copy, typically. In a context like this one.\r\nBut if your text is customer facing and your customers are not designers, I would use advertising.\r\n\r\nI would not use consistent here. It&#39;s boring and sounds like a professor grading a paper.\r\n\r\n\r\n [1]: _URL_0_", "395" ], [ "**I made a quick stop on my way to work to buy coffee.**\r\n\r\n**A quick stop** is very used in American English.\r\n\r\nWe popped into [shop] to buy coffee. The Brits are always popping in and into places, for this meaning.\r\n\r\nthe idiom is: a quick stop, not a short stop. \r\n\r\nYou drop by a neighbor&#39;s house. \r\n\r\n > I&#39;ll ***stop off at the shops*** on my way home and get some wine.\r\n > We&#39;re going to stop off in Denver for a couple of days before heading\r\n > south.\r\n\r\n[Cambridge Dictionary][1]\r\n\r\n- I stopped by [your house or office] to you see you but you were out.\r\n- I stopped off at the coffee shop to get coffee [**on my way to work**].\r\n- I stopped in [to see you] but you were out.\r\n- I stopped off to see you on my way home.\r\n- I stopped off to buy gas and snacks and then resumed my trip to New York.\r\n\r\nPhrasal: \r\nI swung by the coffee shop to get coffee.\r\n**I stopped off to get coffee.**\r\n\r\n\r\n [1]: _URL_0_", "854" ], [ "Yes, it says at the hospital, doesn&#39;t it? If I were on my way to work and make a quick stop to buy coffee at a coffee place, I would not use: stop by. I would use: stop off. \" ;Stopping by \" ; makes me think of houses, homes, places of work, apartments, hospitals, to see a person, yes,:) And does not make me think of stopping off on my way to work at a restaurant or coffee shop to pick up coffee.", "854" ], [ "What you are describing is malaproprism. [I am not saying that is what is in The Great Gatsby]. Though it could be: orgiastic or orgasmic (preferred), I assume.\r\n\r\nWikipedia\r\n > An instance of speech error is called a malapropism when a word is produced which is nonsensical or ludicrous in context, yet similar in sound to what was intended.[7]\r\n > \r\n > The fictional Mrs. <PERSON> in Sheridan&#39;s play The Rivals utters many malapropisms. In Act 3 Scene III, she declares to <PERSON>, \" ;Sure, if I reprehend any thing in this world it is the use of my oracular tongue, and a nice derangement of epitaphs! \" ;[11] This nonsensical utterance might, for example, be corrected to, \" ;If I apprehend anything in this world, it is the use of my vernacular tongue, and a nice arrangement of epithets \" ;,[12] —although these are not the only words that can be substituted to produce an appropriately expressed thought in this context, and commentators have proposed other possible replacements that work just as well.\r\n\r\nlike using obtuse for abstruse\r\n\r\n[malaproprism][1]\r\n\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_.[1]%20Malapropisms%20often%20occur%20as%20errors%20in%20natural%20speech%20and%20are%20sometimes%20the%20subject%20of%20media%20attention,%20especially%20when%20made%20by%20politicians%20or%20other%20prominent%20individuals.%20Philosopher%20Donald%20Davidson%20has%20noted%20that%20malapropisms%20show%20the%20complex%20process%20through%20which%20the%20brain%20translates%20thoughts%20into%20language.%20%20Humorous%20malapropisms%20are%20the%20type%20that%20attract%20the%20most%20attention%20and%20commentary,%20but%20bland%20malapropisms%20are%20common%20in%20speech%20and%20writing.", "818" ], [ "My sentiments exactly. baby clothes (the acceptable exception). And children&#39;s clothing. And I know because a family member had a store that sold children&#39;s clothing for 22 years. Yes, there is an exception for baby clothes. :) And I would not write children without an apostrophe s if followed by clothing or clothes. The entire answer applies to AmE as well. I guess the distaff side knows more about this....", "596" ], [ "1) \" ;What are you doing \" ;, asked <PERSON>? Ask as an intransitive verb. (Or \" ;What is he doing \" ;, etc.)\r\n\r\nAs per the dictionary (<PERSON>, for example) ask can mean utter or speak, as in ask a question. It needn&#39;t take an indirect object.\r\n\r\n**Indirect speech**, then becomes:\r\n\r\n- **<PERSON> asked what you were doing**. \r\n- **Sally asked what he was doing.**\r\n\r\n[ask as utter or speak][1]\r\n\r\n2) \" ;What are you doing \" ;, <PERSON> **asked me**? For ask as a transitive verb.\r\n\r\nHere, indirect speech is:\r\n\r\n- <PERSON> asked me what I was doing.\r\n- <PERSON> asked us what we were doing.\r\n- <PERSON> asked them what they were doing.\r\n- <PERSON> asked you what you were doing.\r\n\r\nSo, **with an indirect object**, it could be: asked: me, them, her/him, you or us. \r\n\r\n\r\n [1]: _URL_0_", "469" ], [ "to have or have got in the sense of own or have relevance to a person (have sisters, for example):\r\n\r\nThere are two different forms: have and have got = same thing.\r\n\r\n- **Have you got a car? The auxiliary is have.** So have I.\r\n- **Do you have a car? The auxiliary is do.** So do I.\r\n\r\nSo: \" ;So have I. \" ; for have got and \" ;So do I. \" ; for have.\r\n\r\n**The answer depends on the question you were asked and how it was asked**: was it asked with have or have got (which mean the same thing, I cannot stress enough). The only difference is that have got is usually a spoken form.\r\n\r\nWhen one teaches English, one deals with this all the time.\r\n\r\nPlease note: Usually, one tends to answer a question as it was posed.\r\n\r\nSo, if the person asks you: Do you have an X? The most likely auxiliary will be \" ;do \" ;. Whereas if a person ask you: **Have you got an X**, the most likely answer is with \" ;have \" ;. \r\n\r\nPlease note: also, it used to be common to hear: **Have you money**? And the auxiliary there is have: Yes, I have. This usage is quite rare in AmE. But I hear it quite a bit on British drama series, etc.", "469" ], [ "you may not have had people saying \" ;Do you have \" ; or \" ;I don&#39;t have \" ;. But you&#39;re saying the auxiliary there would have been have? I&#39;d say this: 50 years ago, one would hear Brits say, typically: ***Have you any tea in the kitchen?*** And the response would have been: Yes, I have. That&#39;s why they used to say have/haven&#39;t. It&#39;s because having things was often expressed as Have you [whatever]. One hears ***that much less today***.", "854" ], [ "In terms of editing translations....\r\n\r\nThe full citation should read:\r\n\r\n \" ;under the U.S. Securities Act of 1933, as amended (the Securities Act), \" ; [rest of sentence]. Alternative: pursuant to\r\n\r\n\r\n**At first glance the above style seems odd; yet it is used by major law firms and in SEC filings.**\r\n\r\n \" ;According to \" ; is not a good choice here for SEC filings. under or pursuant is better. (according to sounds like someone is giving a version of a narrative so it&#39;s best avoided here.)\r\n\r\nHarvard Law:\r\n\r\n > Information delivery requirement—For resales of securities of an\r\n > issuer that is not an SEC reporting company or exempt from reporting\r\n > pursuant to Rule 12g3-2(b) under the Securities Exchange Act of 1934,\r\n > as amended (the “Exchange Act”), certain information must be delivered\r\n > to a prospective purchaser. The required information includes, among\r\n > other items, “reasonably current” financial information [3] prepared\r\n > in accordance with GAAP or IFRS but which need not be audited or\r\n > reviewed.\r\n\r\nFrom the following ladeedah law firm: Posted by <PERSON>, Cleary Gottlieb Steen & Hamilton LLP, on Saturday, January 16, 2016\r\n\r\n[FAST Act amendments][1]\r\n\r\n\r\n > Rule 802 under the U.S. Securities Act of 1933, as amended (the\r\n > “Securities Act”), provides an exemption from the registration\r\n > requirements of the Securities Act for certain cross-border exchange\r\n > offers and business combinations by foreign private issuers involving\r\n > the issuance of securities. (Law firm: <PERSON>)\r\n\r\nSome law firms etc. use: as amended (the Securities Act), [rest of sentence] and others use: as amended (the \" ;Securities Act \" ;), [rest of sentence]\r\n\r\nThat said, in this particular case, law firm and official usage is what counts. The usage is well established.\r\n\r\nFinally, one also sees: the U.S. Securities Act of 1933, as amended, [etc.].\r\n\r\nThe OP did not provide a full sentence so the discussion is not moot.\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "465" ], [ "**bail and bale are homophones**. \r\n\r\nThe term bail out is used as explained below, which I take from <PERSON>.\r\n\r\nThat said, in the video the phrase \" ;God **bails** Abraham **out** \" ; is a US slang term. \r\n\r\nBail out is a valid AmE slang term for helping someone out and the regular term for getting a person released from custody until their trial. To be released on bail. \" ;He bailed his friend out of jail. \" ; \" ;He bailed me out by jump starting my car. \" ;\r\n\r\n\r\nThe slang term in the US probably derives from the jail-related term. A second slang meaning is: to leave a situation or place, like the word: to split.\r\n\r\nPlease note, in contemporary English bale is used for bales of hay or plants with long stalks; and bail is used for the amount of money put up to get someone out of jail temporarily.\r\n\r\n***The video sub-title has an error because it might not have been checked/transcribed by a human and a machine would not catch the homophone bail/bale***. Also, humans make mistakes. The video sub-title should match the meaning of bail out in the video. It is therefore a typo.", "232" ], [ "Fine has several meanings depending on context. My answer only addresses the OP&#39;s question. Not every single meaning of fine. \r\n\r\n- That x is fine. [someone was criticizing something and another says the thing is fine, meaning; OK]\r\n\r\n- I&#39;m doing just fine. [that is similar to the usage above. It is often denotes an attitude: sarcasm, irony, relief etc.\r\n\r\n- A fine restaurant = when used as an adjective, it means good or high quality.\r\n\r\nThese meanings are in most dictionaries. See definition 6 in [Merriam Webster][1]\r\n\r\n[note: topnotch]\r\n [1]: _URL_0_", "951" ], [ "Generically, players on teams are said to be a match or good match or bad match with another team. **Match it up** means look at all the moves being made in the East and see what that means for the Eastern Conference of the NBA; see if they are a good match. The commentator thinks that overall, the moves are not good for the Eastern Conference. There is an imbalance that is being created by this.\r\n\r\n***match it up*** refers to examining if the moves (it means the moves taken as a whole) work well or do not. The reporter goes on to criticize the moves.These [moves [1] are not good for the Eastern Conference as the Western Conference will get all the great players while the Eastern Conference is left with players who are not big stars.\r\n\r\nTherefore, if you match up each player with each team, you Eastern ones are left weaker. Match it up=go through the list as a whole thing and by implication see what the result it. This is a somewhat unusual use of match here. Usually, match up would refer to individual players; here it refers to taking all of them and seeing what the impact is on the Eastern Conference: it is negative.\r\n\r\nThe word match here means: to check out the moves overall and see the result. Here is another [article][1] that discusses the imbalance that is coming from these moves.\r\n\r\n\r\n [1]: _URL_0_", "553" ], [ "No, not coquette. That is just a woman who flirts. Your biggest issue is that espertinha means a woman who is acting like a smarty-pants. The single words in English for women don&#39;t work and the other words don&#39;t mean a woman necessarily. That is the real issue here. That said: smarty-pants could work if you ignore the gender issue. None of the words so far provide the meaning of: Well, aren&#39;t you a little smarty? Espertinha is that: a little smarty.", "237" ], [ "The real problem is that espertinha is a subtle put down. And there is no way to convey with a single term in English that a woman is a smart little thing without being pretty rude. In Portuguese, a woman who is espertinha is usually called that by a man, not another woman, though another woman could use it in anger. \" ;Oh, you think you&#39;re such a smarty, huh? \" ; By the way, your translation will need editing because there are small but significant mistakes in it.", "237" ], [ "Here&#39;s the point: if you speak like that, it marks you re certain social levels. That said, it is not just American English. The problem is that there is so much of it in the States, one can mistakenly get the impression it is dialectal. That said, this is exactly like that have went/have gone question: You either speak in an uneducated way or you don&#39;t. Both are learned at home. Linguistically, neither is more valid than the other. ***But a single form on its own does not make a dialect. It would have to be accompanied by other speech features to be a dialect.***", "133" ], [ "It is not just a specific situation. There are two cases where a determiner is used: They are used in specific situations, sure. And they are always used in forms like: The creativity of the students. The X of Y. The Wealth of Nations. [the x of y]. The wealth on display in cities across Europe. [specific]. Your answer is generally correct though. I agree with it. Of course, in my broken English. [caveat: joke].", "69" ], [ "Here&#39;s an overview:\r\n\r\n**Point One**: For a private company (not one that is publicly listed on a stock exchange) or public company (one that is publicly listed on an exchange), one can own a share of it. That means a percentage. For a publicly listed company, a person could also own some percentage of a company. For example, you might own 10,000 shares in a company, and that could represent some percentage of the total number of shares. For example: a 2% share in the company. In that sense, share is uncountable. it means a percentage of ownership of the overall company. This use of share is often expressed as owning a 2% stake in a company. share, equity stake or equity share of a company are all the same thing.\r\n\r\nDefinition: [equity stake, which is also called a share][1]\r\n\r\n**Point Two**: Now, in addition to the meaning that indicates percentage (to own a share of the company), **you also own shares in a company**. The shares (countable) are the units with value that you own. In a private, or privately held company, the owners decide what a share is worth; for public companies, the market decides what a share is worth. Listed shares also have a nominal value that is the value for a share on the books of the company. \r\n\r\n\r\n\r\n**Point Three**: Companies are said to issue stock (the actual paper with the nominal value of the company on it; today, this is often virtual stock though paper stock certificates still exist). < p > \r\n\r\nDifference between stocks and shares:\r\n\r\n > \" ;For example, \" ;stock \" ; is a general term used to describe the ownership certificates of any company, and \" ;shares \" ; refers to the ownership certificates of a particular company. So, **if investors say they own stocks, they are generally referring to their overall ownership in one or more companies. Technically, if someone says that they own shares - the question then becomes - shares in what company**?\r\n > \r\n > Bottom line, stocks and shares are the same thing. The minor distinction between stocks and shares is usually overlooked, and it has more to do with syntax than financial or legal accuracy. \" ;\r\nRead more: What&#39;s the difference between shares and stocks? | Investopedia [difference between stocks and shares][2].\r\n\r\nIn general, the explanation above holds true for AmE and BrE.\r\n\r\nAlso, in general, I would ask you: *How many IBM shares do you own?* \r\n \r\nI would ****not**** say: ***How many IBM stocks do you own?*** \r\n\r\nSimilarly, I would say: *I don&#39;t own any stocks or bonds* \r\n\r\n**I probably would not say**: *I don&#39;t own **any shares or bonds.*** \r\n \r\nHowever, I might say: ***He sold most of his IBM stock***. \r\nUsed to mean all the shares he owned in IBM. \r\n\r\n\r\nPoint One: Definition: [shares, nominal value and market value and general definition][3] \r\nPoint Two: Definition: [privately held company][4]\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_2_\r\n [3]: _URL_1_\r\n [4]: _URL_3_", "732" ], [ "a country with sufficient availability of water resources and a country with a sufficient water supply or a country with an adequate water supply\r\n\r\n > Water scarcity is the lack of sufficient available water resources to\r\n > meet the demands of water usage within a region.\r\nFrom the article below\r\n\r\nor sufficient water supply or sufficient available water resources\r\n\r\n[insufficient water supply, ergo sufficient can also work][1]\r\n\r\n_URL_0_[water scarcity][1]\r\n\r\n\r\n \r\n\r\n\r\n [1]: _URL_1_", "951" ], [ "To buy a share of stock? Actually, that is not like point one. It&#39;s the definition in point two. To buy a share of stock is to buy one unit of ownership or equity in the company: the number of shares you buy/own is printed on a stock certificate. Normally, more than one. One normally would buy a much greater number of shares. Take a look: _URL_0_", "155" ], [ "comorant was associated with being voracious according to the author below and the word is related to Shakespeare&#39;s name via shag bird.\r\n\r\n > The (now obsolete) word “cormorous” means greedy, insatiable, ravenous. \r\n > \r\n > <PERSON> uses the word “cormorant” in four plays, as a synonym for “voracious.”\r\n > \r\n > Therefore, the shag bird, or cormorant, had a hold on his imagination. I think it was, for lack of a better description, **the animal he most thought of to describe himself.**\r\n\r\nAnd:\r\n\r\n > After all, the name <PERSON> would have been spelled many ways, including <PERSON>, and <PERSON>, and so forth.\r\n > \r\n > That means that his name could have been spelled and pronounced like <PERSON>, or maybe even <PERSON>. \r\n > \r\n\r\nI don&#39;t think one can say much more here. Sounds right to me. One could say that the bard viewed the comorant as devouring time. However, the meaning may be: comorant-devouring time in modern punctuation, and in that case, it is time that devours the comorant. \r\n\r\n[comorous, comorant and voracious][1]\r\n\r\n\r\n [1]: _URL_0_", "171" ], [ "<PERSON> is Swiss and writes in French**. He uses the terme: capitalisme pr&#233;dateur. I was thrown off by the German, I completely forgot about knowing about this sociologist. The term he uses **in French** is capitalisme pr&#233;dateur.\r\n\r\nFrom a book by him, L&#39;Empire de la Honte (Empire of Shame), Fayard 2005, paperback reprint. p.18:\r\n\r\n \r\n\r\n > Conclusion: il n&#39;existe aucune fatalit&#233;, Un enfant qui meurt de faim\r\n > est assassin&#233;.\r\n L&#39;ordre du monde &#233;conomique, social et politique &#233;rig&#233; par le capitalisme pr&#233;dateur n&#39;est pas seulement meurtrier. Il est aussi\r\n > absurde.\r\n\r\nTranslation: \r\n\r\n > Conclusion: there is no inevitability here. A child who dies of hunger\r\n > is an assassinated child.\r\n > The order of the economic, social and political world erected by predatory capitalism is not only deadly. It is also absurd.\r\n\r\nSo, the German actually is what the French says. I&#39;m leaving the German, but the French term capitalisme pr&#233;dateur could be substituted for it.\r\n\r\n\r\nTranslation solutions used by professional translators for academic texts:\r\n\r\nSolution One\r\n\r\n *Raubtierkapitalismus* (predatory capitalism) \r\n\r\nSolution Two\r\n\r\npredatory capitalism (Raubtierkapitalismus)\r\n\r\nSolution Three\r\n\r\npredatory capitalism, Raubtierkapitalismus, [or the inverse] [with or without a footnote]\r\n\r\nAnd there are other solutions, too. However, there is no doubt about predatory as it appears in two citations of academic works and is also a book by <PERSON>. So the notion is well established in English at a high register. \r\n\r\n[predatory capitalism][2] < p > \r\n[predatory capitalism][3]\r\n\r\n\r\n [1]: http://\r\n [2]: _URL_0_\r\n [3]: _URL_1_", "978" ], [ "Learning varieties of English. \r\n\r\n**There are only three ways I know to expand one&#39;s knowledge of English variants**:\r\nVisit those countries for at least three months and keep your ears and eyes open, read books by authors from those countries or watch movies and TV shows from them. \r\n\r\nThis is how interpreters do it. English has much more in common across most varieties than it has differences. For example, keep a pen and notebook handy when reading, travelling or when watching media, and jot down expressions and usage. \r\n\r\nAs an American English speaker, I pay very close attention when watching Australian movies/shows and have managed to gather quite a lot of useful information. For instance, the Australians use \" ;G&#39;day \" ; or \" ;good day \" ; quite a lot, and, refer to journalists as journos. They also call 4x4 that are open at the rear, utes. So now I&#39;m ready to interpret from Aussie English to French! (Joke).\r\n\r\nPerhaps the OP meant **he or she has been learning English** since he or she was a kid at school. Presumably this process is ongoing, whence my use of PP continuous to mention this. \r\n\r\nThe internet has tons of sites about Australian English and just about every other type as well. However, if you really want the best dictionary resource, treat yourself to a subscription to the Oxford English Dictionary (not the learners&#39; one, the real one). There is simply nothing else as exhaustive as it anywhere. (I know we are not supposed to tout products here but really the OED is an institution.)", "836" ], [ "I think this type of question cannot be answered. What do you mean by \" ;today&#39;s English society \" ;? That is an odd formulation. English is a very rich language semantically, and talking about English society is rather odd. Societies don&#39;t use vocabulary. Individuals use vocabulary and only by reading in context or hearing a word in context can a reader or listener know how a word is being used. If, that is, they know its multiple meanings....", "836" ], [ "Most of those sites are very bad. If you want to send people somewhere, send them to sites where real, live translators hang out like Proz or Translatorscafe. Google translate is an abomination. And the two sites I mention are like this site for ELL and ELU. Only for translation. None of the sites you mention can handle the types of questions people ask on ELU. Think about it: Is ELU an automation site??", "184" ], [ "I think there is a huge problem on ELU with opinions. After all, a professional linguist can often (not always) answer on her/his own authority. That boils down to an opinion. I have run across this several times. It&#39;s a conundrum. I am not sure that always \" ;quoting the other \" ; is a valid way to answer usage questions. There are, in this same vein, some questions for which one would have to write a paper and then quote oneself, as existing stuff on google simply does not answer every usage in the English language, which one can quote.", "184" ], [ "The English language is to this site (forum) as other languages are to those sites. That is, people ask terminology questions or phrase questions and they get answers from real people (mostly pro translators). Whoever is downvoting these suggestions are simply clueless. They are the most well-known sites for terminology. Though not for translating entire texts. I do take this very personally. There is also _URL_0_. I cannot ***imagine*** why they are downvoting. They just don&#39;t know anything about translation! (I must say I find it particularly annoying.) :)", "836" ], [ "I also have to say I am not surprised as I can think of a few participants who seem to dislike anything I post. The forum.wordreference .com one should be added. But I am now disheartened. Those downvoters should despair. I guess they all prefer machine translation. Ha ha. Frankly, there are no other sites that deal well with translation though there are machine-translation sites like systran and some others with databases full of mistaken entries (for example, linguee). More shite, as far as I&#39;m concerned.", "109" ], [ "There are three forms to consider here:\r\n\r\n- Application of these concepts to new fields is not encouraged.\r\n\r\n- Applying these concepts to new fields is not encouraged.\r\n\r\n- The application of these concepts to new fields is not encouraged. < p > \r\n\r\nThe last one is grammatically correct but stylistically heavier than the other two. So, unless it is needed to in some way clarify a complex idea there is no need for it. Below is a clarification example.\r\n\r\n- It was the application of these concepts to new and irrelevant fields, which concerned the authorities and made them wary of other initiatives in the same vein.\r\n\r\nThe verb apply takes a direct object. \r\n\r\nSimilarly,\r\n\r\n \" ;Abandoning this paradigm calls for rethinking the concept of etc.... \" ;\r\n\r\nrethinking can also take a direct object. No need for of after rethink.\r\n\r\nBear in mind that there are times one might want to say: \r\n\r\n- The rethinking of the model was a laborious task.\r\n\r\nWhich means the same thing as: < p > \r\n\r\n- Rethinking the model was a laborious task. < p > \r\n However, the second one is more concise, and, therefore, more elegant stylistically. So, if there is no reason to use the x of y, don&#39;t use it is my advice.\r\n\r\nIn general, the two forms (gerund phrase versus gerund + of + noun aka \" ;genitive \" ;) will produce the same meaning.\r\n\r\n- The reorganizing of the company took six months.\r\n- The reorganization of the company took six months.\r\n- Reorganizing the company took six months.\r\n- The company&#39;s reorganization took six months.\r\n\r\nThe trick is that when there is no need to use the x of y, it should be avoided as it can make a sentence heavy:\r\n\r\n- Abandoning this paradigm calls for rethinking the concept of etc.... \" ; [light]\r\n\r\n- Abandoning this paradigm calls for the rethinking of the concept of etc.... \" ; [needlessly heavy and wordy here]. \r\n\r\nPlease note that when an active verb can take a direct object, there is no need to use the x of y form necessarily.", "868" ], [ "1) This is legal language and in legal language, there is such a thing known as a \" ;whereas clause \" ;. It just means \" ;given that \" ;:\r\n\r\nLegal language has its own pitfalls. I suggest you read this article:\r\n\r\nLESSON TO LEARN: In legal agreements, language that appears in the beginning, which merely “sets the stage” or “describes the background” of the transaction, is not considered an operative or integral part of the agreement. Whether or not the word “Whereas” is used, this language is commonly referred to as “Whereas Clauses,” “recitals” or “decretal language.” The word “decretal” comes from the words “decree,” that is, a “pronouncement without binding effect.”\r\n\r\n“Whereas” means literally “given the fact that,” and seems to be the way so many lawyers think it is best to begin a contract. The “Whereas Clauses,” even if they don’t use the word “whereas,” is generally viewed to be an introduction or preamble to a contract, and not a part of the contract’s operative provisions.\r\n\r\n2) \" ;Now, therefore \" ; is a ***set legal phrase*** and it comes at the end of a series of whereas clauses or the recitals to state a conclusion regarding the whereas clauses.\r\n\r\nFrom the same article:\r\n\r\nWhereas, <PERSON> and <PERSON> are both experienced in the construction business, and\r\n\r\nWhereas, <PERSON> and <PERSON> would like to join their efforts together, and\r\n\r\nWhereas, <PERSON> and <PERSON> would like to become partners,\r\n\r\nNow, therefore, to accomplish that, <PERSON> and <PERSON> enter into this agreement . . .\r\n\r\n3) The word whereas is often written in all caps in these clauses: WHEREAS and so is NOW, THEREFORE. And that&#39;s that about this. Whereas clauses are also known as recitals or decretal language.\r\n\r\n4) In my own words, this is all just: given A, B and C, a lawyer or law firm concludes D from it. These legal style issues should be understood within the existing tradition and usage of legal English and taken at face value. But whereas just means: given that.\r\n\r\n[whereas clauses][1]\r\n\r\n\r\n [1]: _URL_0_", "536" ], [ "**That a situation says something about some person**: it reveals something about it or the person involved in it. This is an idiomatic expression.\r\n\r\nIf I say: \" ;I really hate <PERSON> supporters. \" ; That sentence reveals something about me (me is the person writing this answer). It says something about me. It characterizes something about me.\r\n\r\nIt reveals or says that: I have no patience or that I waste my energy on hating people. Etc. Etc. Etc. \r\n\r\n**Sort of** is just colloquial usage as in: He sort of likes her.\r\n\r\nSort of or kind of are just used adverbially in speech to emphasize a verb.\r\n\r\n- That really says something about you. compare: < p > \r\n- That kind of or sort of says something about you.", "951" ], [ "@einpoklum 1) Your first sample sentence does not reflect contract language. You don&#39;t get ***whereas*** in clause one, followed by ***therefore in clause two. You get a list of whereas statements, that ends with: ***Now, therefore*** containing a conclusion to them. 2) whereas clauses are not run-on sentences at all. They are not complete sentences; they list ideas introduced by the idea of ***given that***, which means whereas in legal language. Your idea of extra meaning is not right. These are legal ***forms***; they are stylistic. Now is an adverb and therefore is a conjunctive adverb.", "536" ], [ "This is a simple structure:\r\n\r\n- She ***was smiling*** yesterday. She was not smiling yesterday.\r\n- She **is smiling** today. \r\n\r\nTo smile is a verb. Not a noun. The contrast shows it is a verb.\r\n\r\nwas smiling is clearly past continuous.\r\n\r\nAre those a complete sentences (subjects plus predicate)? Yes. \r\n\r\n**If you add**: when she saw you or after she saw you or before she saw you, for example, you get a sentence with two distinct clauses.\r\n\r\nHow can the structure here not be very clear? How can anything here be a linking verb? There are two distinct clauses. The only link between the clauses is the conjunction introducing the dependent clause.\r\n\r\nThe main clause has a verb in the past continuous and the dependent clause has a verb in the simple past.\r\n\r\nAnd yes, if she was smiling when she saw you, her smiling began prior to seeing you. So what?? Is that not allowed? \r\n\r\n \" ;<PERSON> danced all night at the ball with many different partners. She was smiling when she saw <PERSON>. But that was not surprising, she had been smiling the entire evening and was exhilarated. \" ;\r\n\r\nThe foregoing is not:\r\n\r\nShe was happy when she saw you. She was tired when she saw you. Happy and tired are predicate adjectives.\r\n\r\nWritten extemporaneously by me now. QED", "536" ], [ "- A perpetrator is only a person who commits a crime or criminal act.\r\n\r\n- A culprit is a person or thing you can blame for something.\r\n\r\nIn lay terms, a virus or germ can be a culprit but not a perpetrator.\r\n\r\n > More Diseases Pinned on Old culprit: Germs\r\n\r\nculprit, is of course, used in other contexts that are not to do with diseases..\r\n\r\nFor example:\r\n\r\n > [Political ideology][1] is seen by many researchers as the main culprit of\r\n > science skepticism.\r\n\r\n[Use of culprit re germs in the press][2]\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "232" ], [ "Must be Brazil or another country that grades out of 10. \r\n\r\nSure, you can say that. You can also say; I got or received or was given a grade of 8/10. \r\n\r\nBear in mind that in English-speaking countries, grades are absolute. You don&#39;t receive a grade between two numbers. Also, generally, grades are not out of ten. When a numbering system is used for grading, it is usually out of 100.\r\n\r\nSo you might be better off saying, I received a grade in the highest range (80-100). That is one way to localize the expression. \r\n\r\nAlso, bear in mind, that in English-speaking countries, Phd&#39;s are defended. Master&#39;s degrees are usually awarded or earned.\r\n\r\nIn English, you are awarded a degree, you earn a degree and you receive a grade.\r\n\r\n- I got (or received or was awarded or earned) my Master&#39;s with a top grade in the 80-100 range (degrees in X are awarded in a range)\r\n\r\n(Please note, these are general comments re usage, not a be-all, end-all guide.)", "69" ], [ "[![enter image description here][1]][1]The table in the link illustrates my opinion. Only full sentences need periods. Nothing else does. There is no punctuation at the end of the entries that are not full sentences except for the title and very long entries. However, even a long entry that is not a sentence needn&#39;t have a period. That is a style choice. And entries can start with a dash or a bullet point, if required.\r\n\r\n[Table Box-5][2]\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "655" ], [ "\" ;According to x \" ; is a reported speech marker here. Presumably, the beginning of the conference was given as: next Monday or a date in lieu of next Monday. How can that not be reported speech?? On the page discussing that, the author says: She returned the tickets tomorrow. And says: we say that. Well, I don&#39;t. Unless something is implied: She returned the tickets tomorrow. [according to x].", "633" ], [ "2) is grammatical:\r\n\r\nWe do x for a or b every day. Even if the sentence is long, it is grammatical.\r\n\r\nMy suggestion is: < p > \r\n\r\n- \r\n\r\n > We find loans for people with bad credit or no borrowing history every\r\n > day.\r\n\r\nEdit: after thinking about this, I prefer:\r\n\r\n > - We find loans every day for people with bad credit or no borrowing history.\r\n\r\n**All day, every day** sounds like you might be **bored.** I would avoid it.\r\n\r\nThe adverbial phrase every day has to go at the beginning with a comma:\r\n\r\n- Every day, we find X for A and B.\r\n\r\nIn the middle, though here that would be quite awkward:\r\n\r\n- We find X every day for A and B. \r\n\r\nAt the end with no comma as given in my first suggestion.\r\n\r\nCambridge Dictionary: They **usually** go in end position.\r\n\r\nThey sometimes go in front position especially if we want to emphasise the adverb.\r\n\r\n[adverbs of time][1]\r\n\r\n\r\n [1]: _URL_0_\r\n\r\n[joke: Dear God of Credit: Please don&#39;t give anyone a sub-prime loan.]", "868" ], [ "You say: \" ;making this practically impossible. \" ; The entire enterprise is foolish. There are literary traditions. This person is writing a book. Name spelling is not changed in books. Everyone has answered as if the question were legitimate, it isn&#39;t. Try reading some of the great authors in translation or in English. Foreign names keep foreign spelling: <PERSON>, comes to mind.", "836" ], [ "Your chart suggests it&#39;s possible. Yes, one can do anything. But this forum is English language and usage. In literature in English, Spanish names are left as is. There is just no discussion. Unless you want to write science fiction. I suspect the OP doesn&#39;t know this. Look at all the errors in the question. So giving the person a correspondence chart as if this was a legitimate \" ;thing \" ; is, frankly, absurd.", "237" ], [ "No one writing a novel changes names from the original language. You keep the name and if the language has a different alphabet, you use the transliteration (as with Russian names).\r\n\r\nThink of the great Russian, French, Spanish, Italian and other novels translated into English. Or great novels by English-language writers in English with characters who have foreign names.\r\n\r\n\r\n\r\nIf you change the names to sound phonetically English, most readers will understand them as Spanish names.\r\n\r\nThat&#39;s it. The question is misguided unless one is joking or writing some kind of odd science fiction.\r\n\r\nI will not go and post names from famous books to make the search easy.\r\n\r\nTry the most famous one from Spanish:\r\n\r\nDon Quixote [from Spanish]\r\n\r\nThen try:\r\nWar and Peace [from Russian]\r\nMadame Bovary\r\n\r\nJust to name a few.\r\n\r\nAll names are kept in the English translations.\r\n\r\nAnd, by the way, English names are kept as is in books in French,Spanish and Portuguese. And I assume other languages as well. \r\n\r\nImagine if all the English names were phonetically given in French and Spanish? What a hoot that would be....", "216" ], [ "Please do not twist my words. Creativity is one thing; silliness is another. The OP&#39;s question is naive in the extreme. Eccentric and bohemian indeed. The usage in English is to keep names in the original (in translations) and in English works, keep the foreign names too. It&#39;s that simple, unless you are doing some experimental thing which is clearly not the case with this OP.", "836" ], [ "- He wore a plain, old T-shirt = the T-shirt had no pattern or image on it. \r\n\r\n- He word a **plain old** T-shirt= plain is colloquial for the word ordinary, and plain old is also a clich&#233; in American English. This meaning is in the Merriam Webster.\r\n\r\nWith a comma it means meaning lacking special distinction and without a comma plain is the same as saying: regular old T-shirt. In this sense, it&#39;s a quasi-adverb modifying old. [Oxford Dictionary: A smallish group of adjectives are idiomatically used in such a manner as almost to fall into the broad class ...][1]\r\n\r\nThis meaning is in the [MacMillan Dictionary:][2]\r\n\r\n > not at all unusual, interesting, or special The recipe is nothing\r\n > special – you just use plain old hamburger and some onion powder.\r\n > plain old common sense < p > Synonyms and related words Not interesting or\r\n > exciting:boring, dull, tedious...\r\n\r\n[plain, lacking ornament or undecorated versus lacking special distinction or affectation][3]\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_1_\r\n [3]: _URL_0_", "818" ], [ "**This is repetition in reverse order to emphasize a thought**.\r\n\r\nConsider: **<PERSON> was** doing a good job, **was <PERSON>**.\r\n\r\nThis is a **poetic device called antimetabole**, where you reverse the order of words as in the witches in <PERSON> who say: **Fair is foul and foul is fair.**\r\n\r\n**Troy was** is the subject and verb (part of the verb) in the first clause, and \" ;was <PERSON> \" ; predicate in the second one. Now, in this case, it is not a real antimetabole because we have \" ;he \" ; and \" ;<PERSON> \" ;. < p > \r\nHowever, if one admits that \" ;<PERSON> \" ; and \" ;he \" ; are actually synonyms in the sentence, then it is one.\r\n\r\nThere are uses like this found in regional dialects though I cannot prove that. And probably mostly in the English in Scotland, England and Ireland.\r\n\r\nSentences like: **<PERSON> was a good man, was <PERSON>** are common in speech by characters in novels etc. \r\n\r\nIt can also be termed **antistrophe**, which is a repetition of words in reverse order.\r\n\r\n\r\n[detailed explanation of antimetabole][1]\r\n\r\n\r\n [1]: _URL_0_", "536" ], [ "- A is different from B\r\n- A is different than B\r\n- A is different to B [meaning: comparison, not standard]\r\n\r\nTo is an operator (some call it a function word) and generally is used to link two parts of a sentence (some people call it a to-infinitive). \" ;He likes to eat scones \" ;. There are many other functions as well. \r\n\r\nIt is also a preposition. \" ;Go to the back of the room \" ;.\r\n\r\nIts main uses are given in **[Merriam Webster definition of to][1]**\r\n\r\nHowever, **none of the uses given there involve comparisons** as in \" ;A is different from B \" ; or \" ;A is different than B \" ;. Therefore, I would say it is not standard. \r\n\r\n\r\n [1]: _URL_0_", "633" ], [ "Wikipedia has this:\r\n\r\n > *On Her Majesty&#39;s Secret Service* was written in Jamaica at Fleming&#39;s <PERSON> estate in January and February 1962, whilst the first <PERSON> film, Dr. No was being filmed nearby. The first draft of the novel was 196 pages long and called *The Belles of Hell*. <PERSON> later changed the title after being told of a **nineteenth-century sailing novel** called *On Her Majesty&#39;s Secret Service*, seen by Fleming&#39;s friend <PERSON> in Portobello Road Market.\r\n\r\n[name of the novel][1]\r\n\r\nFound it: [On Her Majesty&#39;s Secret Service, at the British Library][2]\r\n\r\nTitle: *On Her Majesty&#39;s Secret Service*. [A novel.] < p > \r\nPublication Details: London : I. & R. Maxwell, 1878. < p > \r\nIdentifier: System number 001657270 < p > \r\nPhysical Description: 314 p. ; 8&#186;. < p > \r\nShelfmark(s): General Reference Collection 12356.h.32. < p > \r\nUIN: BLL01001657270\r\n\r\n\r\n To find out why it&#39;s titled like that, you&#39;d have to read it. I see no author listed.\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "180" ], [ "You might use \" ;rail \" ; in speech, but, one is harder pressed to use fulminate and inveigh in one&#39;s speech. When I use words like fulminate or inveigh when speaking, I am looking to slam my interlocutor to the linguistic ground. And many of them can&#39;t even get into the ring with me. [just saying all this to suggest differences in spoken and written contexts i,e, usage].", "633" ], [ "- top [level] Federal bodies [the three branches of government, they are the bodies of the Federal Government]\r\n\r\n- *Then, Houston, you have a problem.* < p > All these: Post Office, social programs, embassies, Bureau of Land Management, federal police forces, are things [sorry] come under the various ***government departments***. Government departments are headed by secretaries, all of whom together form the President&#39;s Cabinet. [By the way, there is no Federal police force, only the FBI.] \r\n\r\nFor example, the Secretary of State [Foreign Secretary in British parlance] oversees the embassies through the Department of State.\r\n\r\nGenerally speaking, all those things could be referred to as:\r\n\r\n- Government departments, (independent and non-independent) agencies, entities and government-owned corporations.\r\n\r\nA few of them are under the Legislative branch of government such as the Congressional Budget Office and Library of Congress\r\n\r\n\r\nHere is a full breakdown of the whole thing: [US Federal Government][1]\r\n\r\n\r\n [1]: _URL_0_", "781" ], [ "I agree but it&#39;s the speech part that differs. Colloquially, one says scared, but often in writing, one reads frightened. I generally would not actually say frightened but would use it in certain written contexts. Also, in certain spoken contexts, I would only use scared of: to be scared of flying, to be scared of making a fool of oneself. But: to be frightened of one&#39;s own shadow [idiom]", "836" ], [ "> CHAPTER - 3 INDIANIZATION OF ENGLISH: EMPIRICAL FRAMEWORK\r\n > \r\n > \" ;Forms of address: [...]\r\n > \r\n > While addressing to a third person, British/ American/ Australian, any\r\n > pattern is used. But because of polite and honorific tendency and\r\n > cultural ‘guru-shishya parampara’, Indian students add the words of\r\n > respect, honorific words ‘sir / madam’ after the first name or\r\n > surname; e.g. ‘Goswami Sir’ or ‘Usha Madam’ etc. Deviation from the\r\n > academic culture may bring the feeling of discomfort for the speaker\r\n > of that particular country. This sense of discomfort is termed as\r\n > “pragmatic dissonance1 (**a practical cultural discomfort due to loss\r\n > of harmony in cross cultural interference**). \" ; [bolding mine]\r\n\r\n[forms of address][1]\r\n\r\nMiss in English comes from Mistress, which used to be used in front of a woman&#39;s name, both married or not. If you have read any <PERSON>, you would have seen this frequently, for example.\r\n\r\nFrom: The Indianization of English : the English language in India\r\n Braj B Kachru\r\n Published in 1983 in Delhi by Oxford university press\r\n\r\n\r\n [1]: _URL_0_", "69" ], [ "Well, my French is fluent and faire des b&#234;tises depends on context though in the plural I would not say fool around. You did some stupid things. But it can even be: You got into trouble. Tu as fait des b&#234;tises quand je n&#39;&#233;tais pas &#224; la maison. You got into trouble while I wasn&#39;t home. The noun/verb thing is not always relevant in translation.", "854" ], [ "There certainly isn&#39;t a \" ;main body \" ; of the hand or foot. In regular language, palm of the hand [it does not include fingers] and sole of the foot. Medically, ***a sole may include toes***, but if I say, my feet hurt, it means the soles of my feet and would not include my toes. Hurting toes is not usually included in hurting feet. That is, it is the soles of one&#39;s feet that hurt. So, the language is there. You just need to know how to use it.", "69" ], [ "@Scott itself is a typical run of syllables in English. et-cetera is not. Your examples are more natural to English: Wat + son; jet + sam; Bet+ sy. Those are very different. All your examples are from typical phonemic line-ups. That&#39;s my whole point. People transform et-cetera to the more comfortable ex-cetera. And I actually asked someone how she pronounced it and was astounded hear: ex-cetera. That&#39;s what gave me the clue about this. If tons of people do it, there has to be a phonological reason for it.", "202" ], [ "If someone is **credited as** the inventor, he may not be the **actual inventor**.\r\n\r\ncredit **as** the inventor of means to consider x the inventor of. It is often used when the statement cannot be proven with 100% accuracy or the writer cannot show good proof of who the inventor actually was.\r\n\r\nIt&#39;s another way of saying: X is considered or deemed to be the inventor of Y.\r\n\r\n > Question: Who is credited as inventing the telephone? Was it <PERSON> Graham Bell, <PERSON>, or <PERSON>?\r\n > \r\n > Answer: <PERSON> is often credited as the inventor of the\r\n > telephone since he was awarded the first successful patent. However,\r\n > there were many other inventors such as <PERSON> and <PERSON>\r\n > who also developed a talking....[instrument? Sorry, you have to sign up but it is from the Library of Congress]\r\n\r\n..\r\n\r\n\r\n\r\n[credited as inventor][1]\r\n\r\n [1]: _URL_0_", "661" ], [ "1) Implication in logic is one thing; a way two things relate to each other, the relationship they have to each other:\r\n\r\nIn logic, if A → B, that does not mean B → A.\r\n\r\n→= implies.\r\n < p > However, A and B do have something to do with each other. Their relationship is that A implies B and B is implied by A. And, B may even imply A, but, as given here, it does not. They have a logical relationship (in formal logic).\r\n\r\n2) A relationship in language between two things is not the same thing. Neither is the relationship between things as referents (real things).\r\n\r\nThe term houses (A) has something to do with construction (B).\r\n\r\nClearly A has something to do with B, B has something to do with A, and they both have something to do with each other. However, the relationship between them is not logical. It&#39;s a number of things that exist in reality (as referents) and some other number of things that can be linguistic. A relationship is not necessarily logical, though \" ;a logic \" ; can arise from a relationship.\r\n\r\nI hope I have not got my knickers all twisted up here. :)\r\n\r\nIn other words, to have to do with something means to have a relationship with or to.", "5" ], [ "<PERSON> Yeah, well, I ain&#39;t interested in no pissin&#39; contest. A pit stop is not used like this: On my way to work, I made a pit stop for coffee. Unless you have a weak bladder. Compare that to: On our way to Buffalo from Chicago, we made several pits stops. That said, you can use it as you like. The OP&#39;s definition even says: \" ;a stop (as during a trip) \" ;", "524" ], [ "I assume it&#39;s an inversion for royal estate and would be that order in French.\r\n\r\nestate means state or condition. first meaning, <PERSON>..\r\n\r\n\r\nThe king is using the royal we and the inversion is like the French expression ** \" ;&#233;tat royal \" ;**.\r\n\r\nHere is an entire article on French in the English court: [French, the Norman Conquest, etc.][1]\r\n\r\nHere is a good explanation: [The king is strongest when Parliament is in session.][2]\r\n\r\nHere is what [<PERSON>, Professor Emeritus of English][3] says of <PERSON> and French:\r\n\r\n\r\n > French began to be an influence on the English language with the arrival of the French-speaking Norman kings in 1066. In the next five hundred years, English was massively refashioned by French so that by the time <PERSON> was born, English had become a fusion language, a mixture of the Germanic and the Italic. It would be to go too far to call <PERSON> a French poet, but without the French language <PERSON>’s poetry would be a very different poetry.\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_2_\r\n [3]: _URL_0_\r\n\r\nroyal estate or estate royal as spoken by <PERSON>, therefore, means: the state or condition of being the King of England.", "171" ], [ "I&#39;d write it like this:\r\n\r\na native of Arizona and partner at ABC.\r\n\r\nFor me, there is no need for a second a and by saying of Arizona, the an/a thing goes away.\r\n\r\nThis seems to be a general rule in writing.\r\n\r\n > Hence we see that when two or more connected nouns refer to the same\r\n > person or thing, the Article is ordinarily used before the first only;\r\n > but when two or more connected nouns refer to different persons or\r\n > things, the article is used before each. Also examine the following\r\n > sentences: <PERSON> was a great orator and statesman.\r\n\r\n[repetition of article][1]\r\n\r\n\r\n [1]: _URL_0_", "536" ], [ "First,you say it is and then you say it isn&#39;t. And you also get into moral judgments with right and wrong. When, in fact, you wrote: \" ;The function should probably take a string and callback argument. \" ; So, it isn&#39;t about people, it isn&#39;t about morality. It&#39;s about - wait for it - the programmer&#39;s or tech writer&#39;s opinion. So your answer is irrelevant.", "907" ], [ "Things either collocate or don&#39;t but it is not \" ;scientific \" ; at all. It is about semantics and discourse (a probable arrangement or existence of terms in a particular field or context). It is the expectation of finding one word with another in a particular context. \r\n\r\nSo (to give a very easy example) ***in a mathematical treatise***, \" ;shit \" ; would not collocate with the discourse or the context of formal mathematics. However, ***change that context*** to mathematicians in a chat room, and one might say to another: \" ;That&#39;s just a shit argument, mate. \" ; \r\n\r\nThe example above is collocation at the level of discourse. But anyone analyzing a text or speech has to define their context: at the lexical level, at the sentence level, in speech, in writing, in a particular field, etc. It&#39;s all up to the person analyzing some linguistic form or phenomenon. But, the definition(s) should cohere with a basic understanding of what a \" ;word \" ; (as found in a dictionary) actually is. Please read on...\r\n\r\nCollocate just means \" ;to be located in the same place as \" ; or \" ;to share a location \" ;.\r\n\r\nThat said, the book you are reading seems to have a somewhat different take on the matter, and, is describing what I would call a \" ;set phrase \" ;, or a \" ;clich&#233; \" ;. \r\n\r\n > And the example of \" ;strong tea \" ; is not the best because the meaning\r\n > \" ;great physical strength \" ; is not the meaning of \" ;strong \" ; in strong\r\n > tea. The pertinent meaning here is: extreme,intense, rich in some\r\n > active agent (<PERSON>). This is borne out by considering: \" ;weak tea \" ;, its \" ;natural opposite \" ; or adjectival antonym, if you will. Those two authors are not linguists per se. There is no \" ;rule \" ; that only first meanings of words can be used to compare \" ;side-by-side collocations \" ; of meanings of words in clich&#233; phrases such as \" ;strong tea \" ; and \" ;cute puppy \" ;.\r\n\r\nA collocation linguistically speaking is most definitely not limited to an adjective + a noun as in \" ;cute puppy \" ; or \" ;strong tea \" ;. One has to define one&#39;s one&#39;s playground. Those authors have limited their definitions to a very circumscribed usage of the term collocation: an adjective modifying (or describing) noun or one \" ;set \" ; next to one. And seem also to have based their analysis of \" ;first meanings \" ;. That&#39;s the stumbling block for me here.\r\n\r\nThey are using the meaning of collocation as \" ;side by side \" ; as in to set or arrange in a place or position, especially: to set side by side (Merriam Webster). And the broader meaning in that same dictionary is: intransitive verb: to occur in conjunction with something. Ergo, not necessarily side by side. But in any case, I believe they have made a semantic error by assuming that only first meanings of adjectives count. They are actually comparing non-comparable items.\r\n\r\nI think one might say that in general parlance \" ;cute puppy \" ; and \" ;strong tea \" ; are indeed collocations in general speech in English (even if you aren&#39;t Australian [joke]). One would very much expect to find those adjectives side by side with those nouns. What would, however, not collocate in that sense might be: \" ;strong puppy \" ; and \" ;cute tea \" ;. \r\n\r\n[Please note: my bias here,if I have one, is that I am a translator, and deal with this collocation issue in my daily grind all the time.]", "951" ], [ "The History of British Journalism, from the Foundation of the Newspaper Press in England, to the Repeal of the Stamp Act in 1855, with Sketches of Press Celebrities, With an Index – Alexander Andrews\r\n\r\n > \" ; The Printer to the Reader: \" ; Courteous reader ! we had thought to\r\n > have given over printing our foreign avisoes, for that the licenser\r\n > (out of a partial affection) would not oftentimes let pass apparent\r\n > truth, and in other things (oftentimes) so crosse, and alter, which\r\n > made us weary of printing; but he being vanished^ (and that office\r\n > fallen upon another more understanding in these forraine affaires, and\r\n > as you will find more candid) we are againe (by the favour of his\r\n > <PERSON> and the state) resolved to go on printing if we shall find\r\n > the world to give a better acceptation of them (than of late), by\r\n > their weekly buying them. It is well known these novels are well\r\n > esteemed in all parts of the world (but heere) by the more judicious,\r\n > which we can impute to no other but the discontinuance of them and\r\n > the uncertaine daies of publishing them, which, if the poste fail us\r\n > not, we shall keep a con stant day everie weeke therein, whereby\r\n > everie man may constantly expect them, and so we take leave. January\r\n > the 9th, <PHONE_NUMBER>. \" ; < p > One thing is herein to be observed — the editorial \" ;\r\n > we \" ; was already adopted by \" ; the printer to the reader. \" ; ***The printer\r\n > was then, and continued long afterwards to be, the ostensible director\r\n > of the paper ; all letters, in the news papers of a century later,\r\n > being addressed \" ; to the printer, \" ; until about 1740, when they were\r\n > occasionally addressed \" ; to the author. \" ;***\r\n\r\nIt would thus seem that the practice started with printers addressing their readers. In early journalism, the printers were the directors of the publication and presumably what we call editors, today.\r\n\r\n[history of British Journalism_Dec.1,1859 Publisher: Bentley][1]\r\n\r\n\r\n [1]: _URL_0_", "521" ], [ "@linguisticum I can say the same thing to you: one way to ***begin*** to explain what is meant by 2 is indeed to consider meanings separately just like I&#39;ve done. Two words collocate or do not. ***Two sets of two words*** (here an adj. + a noun) do not collocate based on the false premise that \" ;cute puppy \" ; and \" ;strong tea \" ; have and don&#39;t have a sum-of-its-parts relationship.respectively. That is a non-valid semantic idea. Those ladies are not linguists....look at their bios.", "536" ], [ "For bodily features, we do say: x&#39;s voice, x&#39;s legs, x&#39;s looks, etc. However, we definitely ***do not say (or write for that matter)***: the legs of <PERSON>. I&#39;m trying to figure out for myself now why that is. Because if you say: I&#39;d like to have the [legs] of x, it becomes weird fast. Whereas: I&#39;d like to have the voice of <PERSON> is fine.", "818" ], [ "\" ;to be late to the party \" ; is an idiomatic expression in AmE.\r\n\r\nThat said, grammatically, one can be late for the party or late to the party. So, this is not about grammar here.\r\n\r\nHere: < p > \r\nHe: This deal ends at 7 p.m.\r\nShe: Sucks, I am late to the party.\r\n\r\nIt should be:\r\nHe: This deal ends at 7 p.m.\r\nShe: **That** sucks, I am late to the party.\r\n\r\nparty there is obviously the idiom and not a real party. The person missed the time for taking the deal.\r\n\r\n\r\n[late to the party][1] I would add that it can also: **to miss the boat**, as it does here. Miss the boat is another idiom.\r\n\r\n\r\n [1]: _URL_0_", "854" ], [ "Holidays or commemorative days are said to fall on a date as that comes from the Christian calendar. So, for example, Christmas Day is always the 25th day of December which can \" ;fall on \" ; any day of the week. Those were originally called \" ;unmovable feasts \" ;.\r\n\r\nSo \" ;fall on \" ; has come to mean **can occur on any day of the week**. International Women&#39;s Day ***is*** March 8 or is on March 8 and can indeed \" ;fall \" ; (occur on) on any day of the week. I would avoid \" ;happen on some day of the week \" ; for a formal context (happen is more used as the result of something). \" ;Fall on \" ;, therefore, refers to the day of the week, and not to a calendar day for International Women&#39;s Day.\r\n\r\nIn contrast, Thanksgiving (the U.S. holiday) does not fall on this or that day of the week. It is on the third Thursday of November and falls on a different calendar day every year.\r\n\r\nSo, for commemorative days with a set date, we say: X day is on [date: May 10th] and this year that falls on a Saturday. Or: X day is the second Sunday in June and this year that falls X date.\r\n\r\nFall on is used for randomness of a date or a day of the week. (I do not address the issue of leap year here.) If the date or day are not random,fall on is not used. For example, Christmas falls on a Monday this year. I don&#39;t know what day it falls on next year. \r\n\r\n[movable feast][1]\r\n\r\n\r\n [1]: _URL_0_", "956" ], [ "This is simply wrong: International Women&#39;s Day is on March 8th every year. It does not fall on March 8th. It falls on some day of the week, yes. Also, happens ain&#39;t great. What happens when you boil water? He does not happen to know. What&#39;s happening tonight? Answer: a lunar eclipse. Easter is not volatile,the stock market is. Easter is \" ;a movable feast \" ;; it falls on a different date (not day) every year.", "889" ], [ "I say this: If you accept: If I would go and If I would have gone, you then have to accept an entire list of dialectal features along with it. I really would like to know how this myth got started. It reminds me of French people telling me when I taught English in France that \" ;British English is better than American English \" ;. Both have class-based and class-bound dialects.There is nothing wrong with that. People speak like/as they speak. But it shouldn&#39;t be hoisted up the flagpole so it flaps in the breeze.", "167" ], [ "Do I have to repeat it? The non-standard AmE irrealis myth. Do you seriously think every working class stiff (as one way to put it) in Canada, Ireland, the British Isles, Australia, New Zealand, South Africa (English-speaking SA) don&#39;t have the same non-standard irrealis? When one uses standard forms, one is either born into them or acquires them through education or a concerted effort.", "167" ], [ "Sorry, but I do not accept: \" ;to relieve feelings \" ;, semantically, except with a caveat (see my last paragraph).\r\n\r\nYes, one relieves stress, pressure, anxiety, fear etc. but not feelings. **You can relieve feelings of anxiety yes**. Feelings has to be followed by something that one wants to relieve or find relief from.\r\n\r\nFeelings are \" ;things we have \" ; or \" ;don&#39;t have \" ;. So, you can&#39;t \" ;relieve them \" ;. And if you have negative feelings about some situation, you can, however, \" ;relieve your pain, anxiety, fear, etc. \" ; And you can \" ;relieve feelings of pain, anxiety, sadness, etc. \" ; \r\n\r\nIn any event, this has nothing whatsoever to do with British or American English. A person may seek to relieve types of feelings but not the feeling(s) themselves. \r\n\r\n- to relieve the feeling of [emotion: sadness, fear, etc.]\r\n- to relieve feelings of [emotion: sadness, fear, etc.]\r\n\r\n > But not: relieve feelings, without qualifying them.\r\n\r\nThe example cited contains the idea of \" ;relieve feelings of missing her \" ;. Often, people speak in ways that are coherent with speech in written text. To the person&#39;s credit, they did qualify the feelings earlier in the speech. \r\n\r\nThis is a typical speech feature issue, where spontaneous speech patterns are not always \" ;by the book \" ;. One would not criticize someone who says that as given in that paragraph, but if one is writing, one would not use it like that. \r\n\r\nMany questions on this site do not make the distinction between written speech and spontaneous speech. Spontaneous speech has features which are very different from what one would find in an essay or in more formal expression.\r\n\r\nFinally, we use the verb relieve like this: He was relieved to hear that his paper had been accepted by the academic journal. < p > They were relieved to hear there had not been a storm. < p > In those two sentences, feelings are involved but they are not mentioned explicitly.", "937" ], [ "**Blend something into** means the thing being blended loses its original form.\r\nThis is apparent in cooking recipes: \r\n\r\n > Blend the milk into the flour mixtures until smooth.\r\n\r\nwhereas: Here: \" ;Never imagined how beautifully one can blend comedy in a scary movie without compromising its thriller quotient. \" ;\r\n\r\nThe author does not mean blend in or into so it loses its form. Because if he did (like a cooking ingredient), it would no longer be comedy, would it? \r\n\r\n > So, he has not written it very clearly.\r\n\r\nThe author means: blend comedy with the thriller bits, where there would be no dilution. **This is like fabric or material, where one sees: this is a cotton blend. That is, a mix of cotton and some other thread.**\r\n\r\n**This movie is a blend of a comedy and a thriller.** \r\n\r\nPlease note: this does not cover the idea of blend as the opposite of standing out. For example: You can always see him in a crowd. That hat does not blend in with what other people are wearing.", "524" ], [ "It&#39;s anthromorphic; the truth would have to be seen as a person in juxtaposition to his \" ;semblance \" ; (appearance). He is inverting what logically would be: the truth cannot be found in my appearance. It&#39;s a poetic device, and I can&#39;t be bothered to go and find all the weird ones so I can give this inversion a Greek name. I am sure there is one. Perhaps some luminary will tell us....", "745" ], [ "Please, folks. All kinds of people say We don&#39;t got x, and it is marked as uneducated American speech as used dialectally along with other speech features. It needs to be said. That does not mean it is not right. People speak how they speak. Some are educated, others are not. And BrE has its equivalents, to this, idnit? Separately from that, it&#39;s also part of Black AmE .", "133" ], [ "**A man or woman is said to give their word** (about some subject). To give one&#39;s word means to promise.\r\n\r\nThen, that **man or woman will either keep their word or not keep it**. That means they will respect the promise they made, or not. If they do not keep it, they have broken it.\r\n\r\nAnd that&#39;s the long and short of this business.\r\n\r\n**And I take this opportunity to say that even a lowlife, criminal or scoundrel can give someone their word.** \r\n\r\nIt has nothing to with whether a person is honest at his or her core. It depends on their relationship to the person to whom they have given their word.\r\n\r\nIn short, if you give your word, the question is: Are you going to keep it or not?\r\n\r\n\r\n[give someone&#39;s one word in Merriam Webster][1]\r\n\r\n\r\n [1]: _URL_0_", "932" ], [ "- This activity will not bear or yield any fruit.\r\n- This activity will not fructify.\r\n- This activity will not prove productive or fruitful. < p > \r\nOne of these might work.\r\n\r\nAn asset is expected to provide a return of some kind. If it does not it is not productive or fruitful.\r\n\r\n<PERSON> says this about fructify:\r\n\r\nThe word also expanded to encompass a figurative sense of \" ;fruit, \" ; and it is now more frequently used to refer to the giving forth of something in profit from something else (such as dividends from an investment). \r\n\r\n > [fructify][1]\r\n\r\n\r\n [1]: _URL_0_", "155" ], [ "I think this question is absurd. You can&#39;t hearing people using words (not yet anyway). Ergo, any \" ;frequency \" ; count has to be based on internet searches. Those counts are not really meaningful linguistically or for language. All sorts of junk shows up in searches. If you want to learn better English, read good publications such as newspapers and magazines. The issue here is to learn discourses and clusters of words/ideas. I cannot understand how this question got so many upvotes.", "836" ], [ "This vinegar gives the dish ***some kick or pizzazz.***\r\n\r\nOomph is really for energy, kick is for taste.\r\n\r\nI don&#39;t have any oomph today. \r\n\r\nOf course, one can say all sorts of things about food and its gustatory effects. That said, kick is often used. Pizzazz is usually about clothes or decoration(s), but it works with food, too.\r\n\r\n \" ;I have it very rarely — only when I want something with a little kick, because even when I order it “not spicy,” I still have trouble eating it. Tom yum is characterized by its distinct hot-and-sour flavor. \" ; [kick][1] \r\n\r\n\r\n [1]: _URL_0_", "928" ], [ "<PERSON> It may be archaic, I believe you. However, ***I just do not believe an English PM would say it today.*** Also, The Economist from 1923 is almost one hundred years ago. Let&#39;s be reasonable here. History and modernity are not the same thing, right? Moreover, if you go to the Ngrams and click on the millions one for the latest date (2000), all the hits date back to the 19th century! So, now what, friend?", "978" ], [ "<PERSON> You have to see the sentences in that speech analyzer: 1997: Millions more give money to our national charities. 1998: but for millions more, we will make work pay 1999: We expand individual learning accounts to [....] millions more; 2003: millions of pensioners 2002: tax paid by millions of bingo players There are only two instances of millions/billions used the \" ;archaic \" ; way and who is to say it isn&#39;t a typo? After all, this speech analzser could be wrong.", "754" ], [ "There are uses of these words for physical things, and non-physical things. There&#39;s the rub. \r\n\r\n1) Our bedroom is right \" ;under, below, underneath or beneath theirs \" ;. All four mean the same thing. And everything here is physical.\r\n\r\nThere is no real difference. Just as if you tell your carpenter, \" ;I want to build a walk-in closet in my bedroom which is under the attic \" ;. the meaning would not change if you use any of those terms.\r\n\r\nHowever, there is this: as an adverb, beneath is used like this:\r\n\r\n > \" ;What lies beneath is a large cavern. \" ; There, \" ;beneath \" ; is an adverb\r\n > and tells us where the cavern lies. Here, only beneath, underneath,and\r\n > below can be used. You cannot use \" ;what lies under \" ; here, only \" ;what\r\n > lies underneath \" ;. So, beneath and underneath can be adverbs. \r\n > \r\n > Under cannot be used as an adverb in the sense of the cavern sentence. It is a preposition.\r\n > And can also be used in the phrasal verb,for example: go under. The business went under\r\n > last week. meaning: stopped running due to monetary issues. go under\r\n > is like \" ;drown \" ;. And can literally mean to drown, also.\r\n > \r\n > That said, in some contexts, below and under (beneath,underneath) are\r\n > not 100%. < p > \" ;My house lay below theirs on a beautiful, flower-covered\r\n > hillside \" ;. In a vertical-type plane, below means located at a lower\r\n > level on that same plane. Here, we would not say \" ;under \" ;. In this\r\n > sense, none of the others work. And this is the tricky one, too.\r\n\r\nThere is also the use of beneath referring to a more moral sense: I would not do that,it is beneath me aka below me. On a moral plane,some action or behavior is considered to \" ;beneath one \" ;and colloquially, \" ;below one \" ;.\r\n\r\nFinally, in a textual context, we say: The explanation is in the paragraph below. (not: below paragraph!) A portion of text can be below or above some other text. \r\n\r\nA graphic image can be under(or beneath or underneath) another one though. That is location in space just like the attic above. Beneath and underneath are not preferred here. A painting can be hung on a wall in the same way: under,beneath,underneath or below another painting. \r\n\r\nI think I explained this pretty thoroughly. Someone may come up with some detail I missed. Everything is possible.", "524" ], [ "To sing about what we are without. To sing of something. meaning: a topic\r\n\r\nTo be without= to lack, to be without food.\r\n\r\nErgo, if a mouth sings of what it is without, it sings about what it lacks.\r\n\r\nAnd here the songwriter says that is love. The mouth **lacks** love.\r\n\r\nPresumably kisses,which can signify love in some way, I guess. \r\n\r\nIt is not the greatest line I have ever read......\r\n\r\nThe reason this is not great is: the mouth might lack teeth...\r\n\r\nAnyway, mouth here apparently stands for any person.....that is called synecdoche in poetry. Using a word associated with something to name the thing.\r\n\r\nHere,mouth=person, or person in need.", "854" ] ]
255
[ 9486, 5557, 7876, 4786, 2538, 16291, 1225, 251, 15913, 19315, 3053, 13550, 13933, 5960, 15579, 12371, 15699, 454, 4106, 3811, 8693, 19356, 7202, 2471, 16201, 1706, 19126, 9352, 3413, 1339, 2801, 9469, 6024, 3494, 5099, 15906, 12902, 1005, 9100, 1418, 4532, 2528, 18124, 6707, 5613, 7707, 17630, 7858, 18064, 8009, 1844, 5748, 5621, 16496, 12573, 6954, 7671, 4255, 17790, 16347, 14994, 17988, 7596, 1319, 16788, 703, 8560, 9236, 5471, 5206, 8869, 7544, 9975, 4973, 847, 1024, 10265, 620, 2817, 2011, 2636, 2967, 6141, 6335, 786, 426, 9407, 987, 2306, 7886, 14355, 5771, 1865, 4614, 14546, 18302, 9535, 16887, 8541, 7636, 1927, 15968, 331, 5646, 12816, 2049, 5324, 19716, 5758, 9658, 12713, 18069, 2683, 1792, 16235, 2782, 11557, 2564, 13220, 2423, 15821, 18774, 8678, 8998, 6175, 13370, 10177, 1066, 16812, 15336, 9023, 17796, 3361, 2353, 4664, 4243, 5017, 18185, 6330, 2455, 640, 3160, 7230, 13229, 16414, 8646, 15856, 9037, 6189, 14604, 19319, 18365, 4187, 13636, 2007, 6430, 2429, 6350, 16601, 6408, 18836, 2707, 7622, 19723, 524, 18223, 6230, 5105, 16288, 15667, 16372, 8621, 14886, 8429, 7170, 19555, 2395, 785, 9431, 7708, 2770, 948, 3648, 5462, 876, 6897, 15597, 5604, 19234, 17321, 9254, 6151, 18920, 692, 6604, 1215, 7728, 6685, 2490, 10125, 347, 19054, 5942, 19473, 3292, 14094, 8604, 6530, 523, 16892, 6946, 9167, 13977, 1124, 5045, 7298, 4912, 15957, 12847, 17660, 17484, 12258, 3523, 19066, 1786, 6421, 17977, 764, 5435, 19541, 11344, 1028, 4544, 17143, 6785, 9878, 17730, 6560, 5185, 2418, 1059, 2999, 3530, 14680, 1574, 992, 18058, 3028, 7049, 17808, 7417, 58, 2207, 5986, 19052, 16399, 9802, 14441, 7186, 6593, 8276, 18008, 868, 7080, 74, 3376, 8533, 18677, 2648, 16321, 1415, 12679, 4513, 9754, 2027, 1270, 12027, 1957, 6200, 988, 16712, 5775, 7373, 13921, 2524, 18501, 5496, 8927, 10841, 16945, 16277, 4794, 14844, 7935, 9117, 17654, 1879, 13136, 9251, 4347, 3743, 6837, 822, 14161, 12959, 15843, 10319, 1104, 14952, 5533, 5914, 6449, 6698, 19043, 3519, 2869, 9368, 6069, 19219, 6977, 10284, 768, 11290, 3404, 14474, 8537, 5367, 6286, 14383, 11127, 5970, 17598, 10696, 18056, 5363, 3744, 15417, 9831, 6656, 16595, 7267, 2665, 7199, 5410, 16708, 6452, 17680, 5175, 16206, 1278, 11651, 4813, 3892, 2765, 15360, 4756, 2731, 10804, 4358, 14841, 441, 5603, 16168, 10492, 11123, 6313, 18713, 14716, 15647, 14883, 9127, 9533, 5629, 18521, 5801, 19104, 17335, 522, 1956, 7316, 12450, 4718, 1420, 2472, 6135, 2923, 5839, 16555, 5840, 17200, 14505, 11182, 5085, 19183, 12092, 7861, 14724, 5123, 7579, 11874, 18727, 19111, 3627, 14208, 1827, 16329, 1747, 18432, 9642, 7656, 6275, 9715, 16212, 7850, 13117, 16623, 8238, 6183, 14129, 6121, 203, 6254, 2364, 7719, 18034, 19569, 4075, 4281, 16619, 2229, 2006, 7165, 1204, 10232, 2685, 2413, 5026, 877, 11937, 16196, 8324, 4959, 2208, 5519, 13405, 9095, 16617, 5919, 14097, 18884, 15934, 5597, 9965, 503, 7432, 3479, 9041, 6081, 16847, 5515, 19226, 3406, 885, 7597, 3830, 1588, 13148, 4752, 16869, 8559, 14948, 10398, 795, 3750, 3030, 4685, 11817, 2612, 6222, 5226, 2108, 5852, 4389, 1375, 18381, 12347, 11700, 4450, 9190, 14014, 13374, 10631, 4415, 19026, 16955, 1840, 8187, 7932, 19776 ]
STX_10018.0
[ [ "What is the angle of incidence of a propeller in the terminology of the Wright Brothers and how did they obtain it?\r\n\r\nIn Feb. 1903 (see [Screw Test 1903, page 8](_URL_1_)), using a 0.58 hp engine, the <PERSON> brothers tested a propeller characterized by:\r\n\r\nDiameter, D = 8.5 ft\r\n\r\nPitch = 15 deg\r\n\r\nSurface, $S = 2\\ ft^2$\r\n\r\nRPM = 245\r\n\r\nThey measured what appears to be the static thrust and got:\r\n\r\nThrust = 18.75 lbf\r\n\r\nBased on the assumption that the propeller can be modeled by a wing (Pitch = 15 deg, Surface = $2\\ ft^2$, Lift = 18.75 lbf) having its entire area concentrated in a single point (called the Center of Pressure, C.P.) traveling at RPM = 245 on a circle with the diameter 0.824 x D, $V_{wing} = RPM \\times \\pi \\times 0.824 \\times D$, the <PERSON> brothers evaluated its Drag and from Lift, Drag and Pitch using trigonometric relations they obtained the Normal (perpendicular to the chord) and Axial or Tangential (along the chord) components of Lift + Drag (the resultant force) and some angles related to them.\r\n\r\nNow comes something I do not quite understand.\r\n\r\nThe two brothers calculated a reference force defined as:\r\n\r\nTotal Normal = $k \\times S \\times V_{wing}^2$ = 24.8 lbf,\r\n\r\nwhere \r\n\r\n$V_{wing} = RPM \\times \\pi \\times 0.824 \\times D = 61\\ \\mathrm{mph}$\r\n\r\n$k =$ <PERSON>’s coefficient $= 0.0033\\ \\mathrm{lbf} \\cdot \\mathrm{ft}^{-2} \\cdot \\mathrm{mph}^{-2}$\r\n\r\nFurther, the Wrights divided the Lift by the Total Normal\r\n\r\n$\\frac{\\mathrm{Lift}}{\\mathrm{Total\\ Normal}} = 0.756$\r\n\r\nand **from this 0.756 they drew the conclusion that the angle of incidence is 7&#188; deg**. The question is why? What is this angle of incidence and how can it be calculated?\r\n\r\n*Update*\r\n\r\nThe correspondence between the percentage 0.756 and the angle of incidence, 7&#188;, comes likely from a table like this (which is for a slightly different wing curvature):\r\n\r\n*Percentage of air pressure at various angles of incidence*\r\n[![Percentage of air pressure at various angle of incidence][1]][1]\r\n\r\nHowever, as the propeller did not move, the incidence angle of its equivalent wing appears to be identical with the pitch of the same wing and they are not. Why?\r\n\r\n [1]: _URL_0_", "850" ], [ "*Can a UAV defend itself?*\r\n\r\nThere were attempts to install defense systems on drones but such weapons have not proved effective, at least up to Nov. 2012 (see the article below).\r\n\r\n \" ;*In 2002 the Air Force fitted some of its early-model Predator drones with short-range Stinger air-to-air missiles. But even with the right weaponry the robots were likely a poor match for enemy fighters, and the Air Force ultimately stripped them of the missiles.\r\n...\r\nThe one instance of an air-to-air-armed Predator fighting back against an attacking aircraft resulted in the drone’s destruction.* \" ;, Source: [Predator Drones Once Shot Back at Jets…, authour: <PERSON>, 11.09.12](_URL_0_)", "780" ], [ "*How do aircraft windshields not crack when flying through precipitation at supersonic speeds?*\r\n\r\nYou are talking about a phenomenon called rain erosion at supersonic speeds.\r\n\r\nSee: [INVESTIGATION OF THE PHENOMENA OF RAIN EROSION AT SUBSONIC AND SUPERSONIC SPEEDS](_URL_0_)\r\n\r\nJust because a small steel ball of mass m, traveling at supersonic speeds, can crack a windshield, it does not mean a water droplet of the same mass and velocity will produce the same effect even if it has the same energy. \r\n\r\nA simple explanation can be given based on elastic and inelastic collisions theory, you know from school. The steel ball hitting the glass is in the elastic collision case characterized by high interaction forces, at least up to the moment the glass breaks. The water drop is in the inelastic situation, the impact forces being lower. \r\n\r\nWe are in the case of a soft ball and a stone of the same mass hitting a window with the same speed. In the first case the glass survives in the second breaks.", "445" ], [ "*I&#39;m trying to drop a payload via parachute with some accuracy.*\r\n\r\nCut a hole in the middle of the parachute, make its edge smooth and install a pipe through the center of the box that contains the payload. Run the line through the pipe and parachute and let the payload fall from the balloon. I believe the trick will work for small parachutes able to deliver up to 10 kg to the ground.", "129" ], [ "1. Does Smeaton&#39;s coefficient, k, have a modern value or it is\r\n dependent of the air density?\r\n \r\n 2. Why is the accepted value of k so high?\r\n\r\nIn various texts about the <PERSON> brothers (see 1 and 2) one can read about Smeaton&#39;s coefficient that troubled them a lot and that they finally discovered the parameter had a much lower value reaching the conclusion $k = 0.0033 lbf/ft^2/mph^2 = 0.79 kg/m^3$ (instead of $k = 0.005$), a fact also noticed by others before them.\r\n\r\n 1. \" ;the <PERSON> brothers calculated a new average value of 0.0033.\r\n Modern aerodynamicists have confirmed this figure to be accurate\r\n within a few percent. \" ; [Source: Correcting Smeaton&#39;s\r\n Coefficient](_URL_1_)\r\n \r\n 2. $L = k \\cdot S \\cdot V^2 \\cdot C_L$\r\n \r\n $L$ = lift in pounds\r\n \r\n $k$ = coefficient of air pressure (<PERSON> coefficient)\r\n \r\n $S$ = total area of lifting surface in square feet\r\n \r\n $V$ = velocity (headwind plus ground speed) in miles per hour\r\n \r\n $C_L$ = coefficient of lift (varies with wing shape) \" ;\r\n\r\n[Source: The Wiki page of the <PERSON> brothers](_URL_0_)\r\n\r\nHowever, knowing that the modern formula for lift is \r\n$$L = 0.5 \\cdot \\rho \\cdot S \\cdot V^2 \\cdot C_L$$\r\nWhere $\\rho$ = the air density.\r\n\r\nIt appears that $k = 0.5 \\cdot \\rho$ and so it does not have a standard average value. Also a $k = 0.0033 lbf/ft^2/mph^2 = 0.79 kg/m^3$ leads to a $\\rho = k/0.5 = 1.58 kg/m^3$ that corresponds to a sea level air temperature well below -25 C, which is unusual.\r\n\r\nIf the two relations for lift are correct, the Smeaton&#39;s coefficient can not be 0.0033 but closer to 0.0025 a value corresponding to a standard air density at $20 ^\\circ C$ close to $1.2 kg/m^3$.", "850" ], [ "*Drone strike with plane below 400 feet - who&#39;s at fault?*\r\n\r\nAccording to this article ([FAA to Drone Operators: Keep Off Airports, Stay Below 400 Feet](_URL_0_)) it appears that the pilot of the plane is guilty for the collision. If the drone operator respected the FAA rules (line of sight, below 400 ft and max. allowed weight, far from the airports) he can not be declared guilty for the accident.\r\n\r\n*Federal Aviation Administration (FAA) chief <PERSON> says the agency already has regulations in place to ensure safety in the skies.\r\n<PERSON> says the agency already has rules that prohibit operators of personal drones from flying into airports and soaring over 400 feet in the air.*, [Source](_URL_0_)", "463" ], [ "*Why is it that exceeding the speed of sound is acceptable in one situation but not the other?*\r\n\r\nBecause lift (or thrust of the propeller which is a wing that rotates) at supersonic speeds decreases while compression is not influenced. The air that strikes the blades of a compressor has no other way to go but to pass through it and feed the engine.\r\n\r\nIn the case of a propeller at supersonic speeds the air instead of flowing around the blades forms V waves, a phenomenon that increases drag and reduces lift (thrust).", "440" ], [ "*Can commercial airliners fly over hurricanes?*\r\n\r\nThey can fly through the top (or even the base) of the hurricane in an emergency situation and nothing will happen, see\r\n[Flying through a hurricane (YouTube)](_URL_0_), but it is not preferred to expose the plane to such vibrations if better options, like going around the hurricane, are available.\r\n\r\nThe critical point is crossing the edge of the hurricane eye. However, an airplane can pass through that zone of high winds in minutes.", "463" ], [ "Flying through serious turbulences (see: [TURBULENCE on Flight BA 244, You Tube](_URL_0_)) is as dangerous as flying through a hurricane as long as both phenomena induce the same level of vibrations in the plane. Not the speed of the wind is the problem for a plane but the gradient of speeds. If a plane comes from region 1 with the windspeed Vw1 and gets to region 2 with Vw2 there will be a sudden variation in lift, like a punch, that will quickly disaper because lift is independent of the wind speed, excepting transitions zones.", "440" ], [ "I want to see if a propeller is bad or good for generating static thrust. This is what I know about the propeller and the engine used to turn it during a test:\r\n\r\nEngine shaft power, $P$ = 0.58 hp\r\n\r\nPropeller diameter, $D$ = 8.5 ft\r\n\r\nRevolutions per minute, $RPM$ = 245 \r\n\r\nStatic thrust, $T$ = 18.75 lbf\r\n\r\nCan I calculate the efficiency of the propeller? What is the maximum achievable efficiency?\r\n\r\n*Additional explanations* \r\n\r\nThe formula I was suggested to use could be exactly what I need. However, using it, I do not get some reported experimental results like:\r\n\r\nEngine shaft power, $P$ = 6 hp\r\n\r\nPropeller diameter, $D$ = 8.5 ft\r\n\r\nStatic thrust, $T$ = 66 lbf\r\n\r\nPropeller efficiency, $\\eta_{prop} \\geq 66\\%$\r\n\r\nGear efficiency, $\\eta_{gears} \\geq 85\\%$\r\n\r\nDoing the calculations: $\\eta_{prop} = \\sqrt{\\frac{T^3}{(P^2 \\cdot \\pi \\cdot \\eta_{gears} \\cdot \\frac{D^2}{2} \\cdot \\rho )}} = 37.2\\%$ which is well below 66%.", "137" ], [ "*Why are aircraft tires not grooved horizontally?*\r\n\r\nBecause, unlike cars where the thrust is a force that acts on the drive wheels, in the point where they touch the ground, and has a forward orientation, the plane is pulled by propellers or pushed by jet engines and the wheels provide no thrust. So, horizontal grooves will not increase the thrust in the case of an aircraft. Even for trucks, the non drive wheels tend to have mainly vertical grooves with some minor horizontal cuts (see the picture).\r\n\r\n[![_URL_1_][1]][1]\r\n \r\nRegarding \" ;*reducing the chances of veering off* \" ; the best grooves are the vertical ones because they can catch soil and increase the friction in case the plane tends to veer off course while trying to land. Horizontal grooves will have exactly the worst orientation, to the left and right, acting like skates for that direction. \r\n\r\n [1]: _URL_0_", "440" ], [ "> The blades of a helicopter are long, narrow airfoils with a high\r\n > aspect ratio, a shape that minimizes drag from tip vortices (see the\r\n > wings of a glider for comparison). They generally contain a degree of\r\n > washout that reduces the lift generated at the tips, where the airflow\r\n > is fastest and vortex generation would be a significant problem.\r\n\r\nsource: [Wikipedia](_URL_0_).", "440" ], [ "I have tried to calculate the efficiency of Gustave Whitehead&#39;s propellers using the information he provided to the American Inventor Magazine in 1902 (see the citation below).\r\n\r\nNumber of propellers = 2\r\n\r\nEngine power per propeller, $P$ = 20 hp\r\n\r\nPropeller diameter, $D$ = 6 ft\r\n\r\nStatic thrust per propeller, $T$ = 254 lbf\r\n\r\nPropeller efficiency, $\\eta_{prop}$\r\n\r\nGear efficiency, $\\eta_{gears}$ < 100%\r\n\r\nAir density, $\\rho=1.2 \\frac{kg}{m^3}$\r\n\r\nDoing the calculations: $\\eta_{prop} > \\sqrt{\\frac{T^3}{(P^2 \\cdot \\pi \\cdot \\eta_{gears} \\cdot \\frac{D^2}{2} \\cdot \\rho )}} = 101.4\\%$ which is impossible.\r\n\r\n**Is there a mistake? If yes, where?**\r\n\r\nNote: I used [the formula that relates static thrust to efficiency, power and propeller diameter](_URL_0_).\r\n\r\n > **The Whitehead Flying Machine**\r\n\r\n > **Has the End been Finally Attained, and is the Dirigible Balloon to Go?**\r\n\r\n > Editor, American Inventor\r\n\r\n > Dear Sir: Replying to your recent letter, I take pleasure in sending you the following description of my flying machine No. 22, the latest that I have constructed:\r\n\r\n > This machine was built in four months with the aid of 14 skilled mechanics and cost about $1,700 to build. It is run by a **40 horse-power** kerosene motor of my own design, especially constructed for strength, power and lightness, weighing but 120 pounds complete. It will run for a week at a time if required, without running hot, stopping, or in any possible manner troubling the operator. No electrical apparatus is required for ignition purposes. Ignition is accomplished by its own heat and compression; it runs about 800 revolutions per minute, has five cylinders and no fly-wheel is used. It requires a space 10 inches wide, 4 feet long and 10 inches high. ...\r\n\r\n > The propellers are **6 feet in diameter** and have a projecting blade-surface of 4 square feet each. They are made of wood and are covered with very thin aluminum sheeting. The propellers run about 600 revolutions per minute under full power and turn in opposite directions. When running at full speed they will exert a **thrust of 508 pounds**. I measured this thrust by attaching the machine to a post by means of a dynamometer and running the engines at full speed. ...\r\n\r\n > I have no photographs taken yet of No. 22, but send you some of No. 21, as these machines are exactly alike, except the details mentioned. No. 21 has made four trips, the longest one and a half miles, on August 14, 1901. The wings of both machines measure 30 feet from tip to tip, and the length of the entire machine is 32 feet. It will run on the ground 50 miles an hour, and in air travel at about 70 miles. I believe that if wanted it would fly 100 miles an hour. The power carried is considerably more than necessary. ...\r\n\r\n > Trusting this will interest your readers, I remain, Very truly yours,\r\n\r\n > <PERSON>\r\nBridgeport, Conn.\r\n\r\nSource: [The American Inventor Magazine\r\n, 1 April 1902\r\n](_URL_1_).", "875" ], [ "Honestly, the second propeller (T = 66 lbf) is exactly the one used by the <PERSON> brothers in December 1903. They utilized a 12 hp engine, 2 propellers of diameter D = 8.5 ft and they got a total static thrust T = 132 lbf. According to the brothers the efficiency of both propellers was 66%, a figure nobody had reached before. In reality it appears that the 1903 propellers were below 40% efficient which means the two brothers used in fact bad aerial screws even by the standard of the time.", "875" ], [ "1) Even if I use the air density for -25 C, 1.42 kg/m^3, I still get an efficiency of 93.2% which is too big. 2) <PERSON> says in the article that he was the one who designed the engine. If he was capable to design such a motor it is unbelievable he was incapable to determine its power. In order to have worked back the power from the thrust he must have known the formula I mentioned and in this case he would not have used an efficiency of 100% as long as the propellers of the time were around 50% efficient.", "875" ], [ "**Example of two ~static thrust tests**\r\n\r\n**1)** Engine: C-85-12 Continental (**85hp**, redline 2575rpm)\r\n\r\nPropeller: McCauley 71&#215;46 Met-L, aluminum (This is a climb prop for a 120)\r\n\r\nWind: 4-9mph headwind\r\n\r\nPerformance -- Thrust: **340 pounds**, RPM: 2350\r\n\r\nPropeller efficiency: ~ **37.5%**\r\n\r\n**2)** Engine: Continental O-200, **100hp**, 2750rpm redline\r\n\r\nPropeller: McCauley Clip Tip 68″ diameter, aluminum, standard pitch\r\n\r\nWind: 5-7mph headwind\r\n\r\nPerformance -- Thrust: **335 pounds**, RPM: 2332\r\n\r\nPropeller efficiency: ~ **32.5%**\r\n\r\nsee: [Thrust testing 85 and 100 hp engines](_URL_0_)\r\n\r\nNote: The efficiency was calculated using the formula: $\\eta_{prop} = \\sqrt{\\frac{T^3}{(P^2 \\cdot \\pi \\cdot \\eta_{gears} \\cdot \\frac{D^2}{2} \\cdot \\rho )}}$\r\n\r\nConclusion:\r\n \r\nIf the formula for $\\eta_{prop}$ is reliable it seems that a modern propeller has a rather poor efficiency during a static thrust measurement. <PERSON> might have optimized his aerial screws for supplying maximum static thrust possible but even in this case he could not have obtained an efficiency above 90%.", "875" ], [ "Peter K&#228;mpf, the thrust and air density are constants in my case. Even if I change them like T = T(r, vh) and r=r(h) they do not influence too much the results unless they have really big variations. Finally I added a vertical drag term in the lift eq. which now looks like this: m * dVv(t)/dt = Lift(t) - m * g - 0.5 * 2000 * Cd * r * S * Vv(t)^2 where this strange 2000 * Cd is the drag coefficient if one wants to lift the plane vertically. I get now realistic vertical speeds like 2 m/s but the lift eq. seems quite artificial. I am looking for a more credible lift eq..", "284" ], [ "**Solved**.\r\n\r\nRewriting a core class method.. in particular &#39;addProduct($productInfo, $requestInfo=null)&#39; function of ***Mage_Checkout_Model_Cart*** class.\r\n\r\nI&#39;ve removed this piece of code:\r\n\r\n if ($product- > getStockItem()) {\r\n $minimumQty = $product- > getStockItem()- > getMinSaleQty();\r\n //If product was not found in cart and there is set minimal qty for it\r\n if ($minimumQty & & $minimumQty > 0 & & $request- > getQty() < $minimumQty\r\n & & !$this- > getQuote()- > hasProductId($productId)\r\n ){\r\n $request- > setQty($minimumQty);\r\n }\r\n }\r\n\r\nthat overrides product quantity inserted by the customer into the cart.\r\n\r\nNow the configurable and simple product behavior is similar.", "25" ], [ "*Why was the Bell Boeing V-22 Osprey not worked on more?*\r\n\r\nThe Osprey idea is an old one and it never worked well. For example, I have found a patent form 1921 (see the picture) for a flying machine that has some common points with the Osprey. Large diameter propellers are not efficient for planes and small rotors are not suitable for helicopters. A hybrid, like Osprey, has the advantage of not needing a runway to land or take off but at the same time, once in the air, it has to pay the price of using two inefficient propellers for flying hundreds of kilometers. Also, if it is used more as a helicopter the rotors are not as efficient as the ones of a true helicopter. \r\n\r\n[![Traian Vuia Helicopter][1]][1]\r\n*[Flying machine](_URL_2_), authour [<PERSON>_), April 1921.*\r\n\r\n[![Boeing V-22 Osprey][2]][2]\r\n*Bell Boeing V-22 Osprey*\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_3_", "440" ], [ "**Regarding the 1902 <PERSON> glider. Why is the airspeed, Va, calculated adding the ground speed, Vg, and wind speed, Vw?**\r\n\r\nIn August 1903, <PERSON> published in L&#39;Aerophile a table (see attached) showing the measured quantities: \r\n\r\n(1) distance traveled along the ground (col. 2), \r\n\r\n(2) flight time (col. 3), \r\n\r\n(3) wind speed (col. 5),\r\n\r\n(4) glide angle (col. 7),\r\n\r\ncorresponding to a few flights performed on Oct. 8, 1902. From these parameters and the total mass of the machine and pilot, <PERSON> calculated that the 1902 glider lifted about 62 kg/hp (see the last column).\r\n\r\nIt is not quite clear for me why Va = Vg + Vw (see col. 6). The airspeed should be constant, independent of the headwind speed, as long as the glide angle is the same because the thrust is the same. It is true Va = Vg + Vw but if Vg added to Vw does not give always a constant Va, for the same glide angle, then something is wrong with the measurements.\r\nThe water speed of a boat traveling upstream depends only on its thrust and is independent of the river speed. \r\n\r\nThe lift in the table (~62 kg/hp) is quite big in comparison to the lift of the best gliders of the time, mentioned by <PERSON> a few lines below the table, that lifted only 45 kg/hp. \r\n\r\nThe precise value of the airspeed, Va, is essential in calculating the lift. If ones takes it only 1-2 m/s lower, due to miscalculations, then the evaluated lift grows artificially.\r\n\r\n[![1903/08, O. Chanute, \" ;Table parameters glided flights, Kitty Hawk, 8 Oct. 1902 \" ;, L&#39;Aerophile, pag. 180][1]][1]\r\nSource: _URL_1_\r\n\r\n*Update*\r\n\r\nThere are a few sources of errors that could have altered substantially the results in the table. \r\n\r\n(1) <PERSON> wrote, above the table (see the link), the Wrights did not drift, more than 1/4 in a arc of a circle from the straight line, to always have good headwinds. This drift increases the traveled distance. \r\n\r\n(2) The glider was first lifted as a kite to a few meters above the ground with the help of two men. This height made the glide angle to be higher than that of the slope, which can be estimated from a picture (see the attached image where the glide angle appears to be 9.01 deg). \r\nIf instead of 7 deg 20&#39; the slope angle was 9.01 deg and the 1902 machine started from a few meters above the ground then instead of 58.1 kg / hp it would have lifted less than 114.4 kg / (114.4 kgf * sin(9 deg 20 minutes) * (54.7 m/12 s + 5.68 m/s) ) = 47.4 kg/hp.\r\n\r\n(3) The third factor of incertitude is the wind speed that varies with altitude being stronger a few meters in the air than close to the ground. \r\n\r\n[![Wright glider 1902][2]][2]\r\n*Wright glider, 1902. Undated picture.*\r\n\r\n**Question**: Do you know a modern replica of the 1902 glider that lifts ~62 kg/hp?\r\nIf such a thing exists then the 1902 machine could have lifted 62 kg/hp.\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_2_", "850" ], [ "Airsick, yes, you are right but the distance measured along the ground is always the shortest theoretically possible flight distance. In practice the glider flies more. For example, if instead of 57.4 m (first flight in the table) the glider flew in reality 80 m its lift would have dropped form 58.1 to 47.6 kg/hp. There are also serious question about the accuracy of the glide angle. How did the <PERSON> brothers measure it with such a precision? A quite small error in measuring the glide angle leads to a significant change in thrust.", "850" ], [ "Airsick, I will update the question with more explanations. (1) <PERSON> wrote, above the table, the Wrights did not drift, more than 1/4 in a arc of a circle from the straight line, to always have good headwinds. This drift adds traveled distance. (2) The glider was first lifted as a kite to a few m with the help of two men. This height makes the glide angle to be higher than that of the slope, which can be measured. For example, a change from 7deg20&#39; to 9deg20&#39; leads to only 114.4 kg / (114.4 kgf * sin(9 deg 20 minutes) * (54.7 m/12 s + 5.68 m/s) ) = 45.8 kg / hp instead of 58.1 kg / hp.", "850" ], [ "**Where can I find reliable figures about the best glides of <PERSON> and <PERSON> (1902 - 1903)?**\r\n\r\nFrom the sources below it would appear that Lilienthal&#39;s most advanced glider was far superior to that built by the <PERSON> brothers in 1902 as the German apparatus was able to fly 1148 ft while the machine made by the <PERSON> only 600 ft. \r\n\r\nIt seems like the wind tunnel tests done by the Wright brothers in 1901-1902 to find optimal wings did not lead to improvements in lowering the glide angle and so increasing the flight distance.\r\n\r\n1)* \" ;Finally <PERSON> become so skilled that he could make his glides in air velocities of 33 feet per second ... <PERSON> carried out more than 1,000 glides and attained distances of 1,148 ft. at a gliding angle of 4 degree from the hill. \" ;*\r\n\r\n[Source][1]: <PERSON>, \" ;Pioneers in Gliding \" ;, Popular Aviation, pag. 74 - 77, May 1928 \r\n\r\n2) * \" ;World Record Holders\t\r\nThe improved performance of the 1902 glider finally enabled the <PERSON> brothers to gain extensive practice in the air. During September and October, they made between 700 and 1,000 glides. Flights of 500 feet were common, and a few topped 600 feet. <PERSON> enthusiastically wrote home of their success, “we now hold all records!” \" ;*\r\n\r\n\r\n[Source][2]: Inventing a Flying Machine \r\n\r\nI&#39;m asking about which glider that had better glide ratio because the Lift/Drag ratio is essential: the higher it is the longer the glide and the less powerful and lighter an engine is needed to make the glider fly horizontally.\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "850" ], [ "Who invented the canard wing?\r\n\r\nI know that early planes like those built by <PERSON> and the <PERSON> brothers used canard wings but who invented the canard wing?\r\n\r\n*Update*\r\n\r\nThe plane built by <PERSON> and tested in 1894 had a canard wing for pitch control. \r\n\r\n![](_URL_0_)\r\n![](_URL_1_)\r\n*<PERSON>*\r\n\r\nSo, it is quite evident that this type of wing was not invented by the <PERSON> brothers as some people believe.", "463" ], [ "In [a letter written by <PERSON> and addressed to <PERSON>, dated 1903/06/18](_URL_1_), I have found two things that I do not quite understand.\r\n\r\n > Our engine develops at the brake 15.6 horse power and we are convinced that this is very close to what we will be able to reach as a maximum. It furnishes in foot pounds at the brake, energy equivalent to 23 percent of the heat units\r\ncontained in the fuel, so its efficiency is some twenty percent higher than the usual efficiency of gasoline engines which ranges from 14 to 18 percent of the total power contained in the fuel.\r\n\r\nHow did the two brothers make such a revolutionary improvement?\r\n[Modern gasoline engines have a maximum thermal efficiency of about 25% to 30%](_URL_0_). The <PERSON> brother&#39;s motor had an efficiency of 23% in 1903.\r\n\r\n > The Dumont motor may develop more than 10 horsepower but it is with me a case of seeing before believing. The screw of the airship was 4 meters in diameter and had a pitch of 4 meters, and the engine at 1200 revolutions (which is the speed of maximum power of motors of this size) drove it 200 turns per minute and gave a thrust of 154 to 165 lbs. Now if you multiply the thrust, by the pitch divided by the circumference of the screw, and multiply this by the travel per minute of the center of pressure (which is about 5/6 of the circumference of the screw) you will find that the result is about 10 horse power.” \r\n\r\nIt is evident that the Wrights used the relation:\r\n\r\n**Power = Thrust x (5/6) x pitch x (RPM/60 sec)**\r\n\r\nWhere does this formula come from?\r\n\r\nWhat exactly is that \" ;*center of pressure (which is about 5/6 of the circumference of the screw)* \" ;?", "875" ], [ "Peter K&#228;mpf, I added more explanations to the text I posted above. (1) <PERSON> estimated the engine used by <PERSON> delivered about 10 hp. The calculations are not about a motor built in Dayton. It appears that, without realizing, <PERSON> forced Santos&#39; airship to travel at (5/6) x pitch x (RPM/60 sec) = 24.85 mph. (2) The Wright brother&#39;s motor had an efficiency of 23% in 1903! Modern gasoline motors efficiency ranges from 25 to 30 hp.", "159" ], [ "*Has boeing changed their alarm systems post that incident?*\r\n\r\nThe story of [Helios Airways flight 522](_URL_0_) is complicated. It is not clear that a misidentified alarm was the cause of the crash.\r\n\r\n*Update:*\r\n\r\nIf you are talking about the cabin altitude warning horn, that was allegedly misidentified as a take-off configuration, then nothing has been changed, at least up to May 2015 (see: [The Boeing 737 Technical Guide, Version 70, May 2015](_URL_1_), bottom of the page 50).\r\n\r\n > \" ;*As the aircraft climbed, the pressure inside the cabin gradually decreased. As it passed through an altitude of 12,040 feet (3,670 m), **the cabin altitude warning horn sounded**. The warning should have prompted the crew to stop climbing, but it was misidentified by the crew as a take-off configuration warning, which signals that the aircraft is not ready for take-off, and can only sound on the ground.\r\nIn the next few minutes, several warning lights on the overhead panel in the cockpit illuminated. One or both of the equipment cooling warning lights came on to indicate low airflow through the cooling fans (a result of the decreased air density), accompanied by the master caution light. The passenger oxygen light illuminated when, at an altitude of approximately 18,000 feet (5,500 m), the oxygen masks in the passenger cabin automatically deployed.* \" ;m, Source: [Helios Airways Flight 522](_URL_0_).", "463" ], [ "The <PERSON> brothers and the 1 pound crow that flies at 37 km/h expending just 7.68 W \r\n\r\nIn an 1905 letter to <PERSON>, <PERSON> evaluated the power, used by a 1 lb bird to fly at 34 ft/s, utilizing a relation that can be rewritten as:\r\n\r\n**eff x Power = Thrust X Speed = Drag x Speed**,\r\n\r\nwhere: eff (the efficiency of the crow) = 75%, Drag/Lift = Drag/(mg) = 1/8 and mg = 1 lbf.\r\n\r\nIn consequence, Power = (1 lbf x (1/8) x 34 ft/s ) / 75% = 7.68 W.\r\n\r\n > \" ;The power consumed by any bird or flying machine may be figured from the formula wv/ac, in which w = weight, v = velocity, 1/a = ratio of drift to lift, and 1/c = efficiency of the screws or wings as propellers. In the case of the crow flying at 34 ft. per second, or 2,100 ft. per minute, I would fix the value of l/a at 1/8, and 1/c at 1/.75; when we have (1 x 2100)/(8 x .75) = 350 ft. lbs. per pound of weight.1 The minimum value of l/a may be rendered independent of velocity by regulating the size of the wings. The value of 1/c is about the practical limit of the efficiency of screws under usual conditions, and I see no reason for believing that wings are more efficient than screws, as propellers. It is quite incredible that, when flapping, the wing can be kept at the optimum angle at every point, as in soaring; and there are losses due to the fact that the pressure is not vertical throughout the stroke. Although I think 25 percent a fair estimate of the probable loss from both sources.\r\nBirds unquestionably develop power many times greater than is consumed by our Flyer, per pound weight. if you will fix in your mind the distance within which a small bird acquires full speed, say 30 miles an hour, and then figure the power necessary to accelerate its weight to this velocity, I think you will be astonished. I know I was almost dumbfounded, especially in view of the fact that the power available for acceleration is over and above that used in flying. I shall be curious to know what distance you fix upon as that within which a sparrow acquires full speed. \" ;, \r\n[Letter of <PERSON> to <PERSON>, Dayton, March 11, 1905](_URL_1_)\r\n\r\n7.68 W/lb seems a quite low figure as long as, *it&#39;s generally accepted that any model plane with less than 50W/lb is going to struggle* (see [The Watts Per Pound rule](_URL_0_))\r\n\r\nDoes a crow only expend 7.68 W/lb or at least it is possible to build a model plane able to fly at 37.3 km/h (34 ft/s) developing just 7.68 W/lb shaft power?", "850" ], [ "I need an example of ~ 1 lb model plane that can fly at about 10 m/s (36 km/h) using maximum 10 W. It is quite clear that 7.68 W/lb x 745 lb x 75%/66% = 8.77 hp which is quite close to the 8.73 hp the two brothers estimated they needed to fly their 745 lb, 66% efficient, 1903 plane. In other words the <PERSON> brothers simply assumed the efficiency of the bird is 75% and scaled down to 1 lb the power needed for their 745 lb plane to fly. This is pure math.", "850" ], [ "Nacelle comes from the french word \" ;nacelle \" ; which is the gondola or wicker basket suspended beneath a balloon. So, by analogy, many things that are outside the body of an aircraft, like the compartments that house the engines, can be called nacelles. A cowling is the covering of a vehicle&#39;s engine even if that motor is not inside a nacelle.", "867" ], [ "When I do a double click, I don&#39;t see any selection.\r\nIs there anything I need to enable to make it work?\r\nOther mouse functionalities work fine.\r\nSee _URL_0_\r\n\r\nHere is my mouse configuration\r\n\r\n ;; Enable mouse support\r\n (require &#39;mouse)\r\n (xterm-mouse-mode t)\r\n (global-set-key [mouse-4] (lambda ()\r\n (interactive)\r\n (scroll-down 1)))\r\n (global-set-key [mouse-5] (lambda ()\r\n (interactive)\r\n (scroll-up 1)))\r\n (defun track-mouse (e))\r\n\r\nThanks\r\n\r\nEDIT:\r\nI use emacs through a terminal: I ssh from ubuntu terminal to a remote machine and run emacs -nw on the remote machine.", "940" ], [ "**Full-Scale 1903 Wright Flyer failed the test Thrust = Drag in a NASA wind tunnel**\r\n\r\nI have found a presentation about an extensive set of tests done in 1999 on a full scale replica of Flyer I 1903. The plane did not behave well and was not able to produce enough thrust to overcome the drag. \r\n\r\n \" ;*In the wind tunnel, the reproduced propeller fell short of T=D @ 28 mph test condition when operating at the maximum permitted speed of 340 RPM. These data are being analyzed* \" ;\r\n[![$C_L=C_L(C_D)$][1]][1]\r\n\r\n*$C_L=C_L(C_D)$ Flyer I replica*\r\n\r\nSource: [Full-Scale 1903 Wright Flyer Wind Tunnel Test Results From the NASA Ames Research Center](_URL_4_)\r\n\r\nUnfortunately, the presentation, also quite explicit, does not give the values of the Thrust, Drag or Drag - Thrust at 28 mph. I calculated the Drag from $C_L=C_L(C_D)$, Lift = Weight (the mass of the airplane is known) and and the surface of the wings. Using a simulator I also evaluated the thrust delivered by some modern propellers, having the same diameter as the ones the Wright Brothers said they had used in 1903, and they deliver enough thrust at 28 mph and 340 RPM.\r\n\r\nThere should be other more detailed articles, which I can not find, about the same set of tests because they planned the experiments for years and it is expected a lot of data was obtained. \r\n\r\n**I would be really interested to know either the exact geometry of the propellers** to calculate their thrust with a simulator or find somewhere the diagram $Thrust \r\n= Thrust_{340\\:RPM}(v_{air})$ corresponding to the tested replica. **If you can find such a document please tell me about it.** \r\n\r\nAnyway at 6 hp / propeller (12 hp in total) I calculated that only propellers with an efficiency well below 50% (miserable even for the standard of 1903) could have failed to produce enough thrust for the Flyer I replica at 28 mph.\r\n\r\n***Update 1***\r\n\r\nA Mathcad demonstration which shows that the efficiency of the propellers used by the Flyer I replica should be below 31.2% to fail the test T = D.\r\n\r\n[![A Mathcad demonstration which shows that the efficiency of the propellers used by the Flyer I replica should be below 31.2% to fail the test T = D][2]][2]\r\n\r\n***Update 2***\r\n\r\nAnother wind tunnel set of tests was done in 2003 on a different Flyer I replica (see: [Flying Qualities of the Wright 1903 Flyer:\r\nFrom Simulation to Flight Test](_URL_3_)). Also the lift drag diagram for the case \" ;props off \" ; was about the same as the one obtained in 1999, the thrust generated by the propellers at 340 RPM and Q = 2 psf which translates in a 28 mph plane speed, the same as in the 1999 tests, was 80 lbf (36.28 kgf) more than double than the Drag = 17.44 kgf calculated for the 1999 replica. Unless quite different propellers had been used in 1999 and 2003 the 1999 propellers should not have failed the test T = D at 28 mph. It appears that various investigation teams have used propellers with different geometries. \r\n\r\n[![Flyer I 2003 replica - Drag Coefficient, On Rail ][3]][3]\r\n\r\n*Flyer I 2003 replica - Drag Coefficient, On Rail - Propellers off*\r\n[![Flyer I 2003 - Thrust][4]][4]\r\n\r\n*Flyer I 2003 replica - Static and dynamic thrust of the propellers two dynamic pressures, $Q = 0.5\\rho V^2$. 1) $Q = 1\\:lbf/ft^2$ ($V=19.98\\:mph$) 2) $Q = 2\\:lbf/ft^2$ ($V=28.26\\:mph$). $\\rho=1.2\\:kg/m^3$*\r\n\r\nSource: [ \" ;Flying Qualities of the Wright 1903 Flyer:\r\nFrom Simulation to Flight Test \" ; (AIAA-2004-0105)](_URL_3_)\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_2_\r\n [3]: _URL_1_\r\n [4]: _URL_5_", "850" ], [ "1) I added an update with more clarifications. 2) For the moment, I am not suspecting anything as long as I do not have the airfoil, the cord and the blade angle corresponding to a few cross sections spreading from $r=0$ to $r=R_{max}$. Using a free Calculator (see: _URL_0_) I get enough thrust at 28 mph with a constructed propeller that looks roughly like the original. The main issue for me is the pitch along the blade. I do not know it.", "440" ], [ "> and why the same can&#39;t be done for passenger windows as well?\r\n\r\nAnybody who opens even a bit a potential airliner sliding window near his seat creates in the entire plane the conditions existent on the top of Mount Everest, even worse. Nobody wants to stay in such an environment. In conclusion passenger sliding windows serve no purpose.", "463" ], [ "1) If you open the window just a bit then why you have to slide an entire 47 cm x 27 cm window? A smaller movable window is enough. 2) Also the plane might be able to regulate the pressure if a single window is opened a bit it will not be able to do the same thing if many windows are opened and the pressure will drop at levels where people can not survive. Also the first part of the question \" ;Why are some windows in cockpits made openable? \" ; was justified. The second about passenger windows that could be opened was really dumb. I can not explain the large no of pluses. It is a mystery.", "440" ], [ "How to calculate in the right way the efficiency of a propeller?\r\n\r\nIf we know the engine power, speed of the plane and the thrust of its propeller, what is the correct method, (1) or (2), for calculating the efficiency of the propeller?\r\n\r\n[![Efficiency of a propeller][1]][1]\r\n\r\nAssuming that Method 1 is the correct one, it appears that the efficiency of a propeller must satisfy the inequality:\r\n\r\n[![enter image description here][2]][2]\r\n\r\n**Update:**\r\n\r\nIt looks like Method 1 is correct and 2 is wrong as long as the page [Performance of Propellers, MIT](_URL_1_) calculates the efficiency on an ideal propeller and gets the same inequality.\r\nIf a propeller of diameter, d, delivers the thrust, T, while the plane travels at the speed, V, it always has a maximum possible efficiency that can be calculated, is below 1 and can not be improved. **Not even an ideal propeller of diameter, d, has, in general, an efficiency that reaches 100%**. The absolute minimum, reference power, is always $TV$ and not something else and the efficiency is always:\r\n$$TV/Power_{absorbed}$$\r\nwhere the minimum absorbed power is calculated with Froude&#39;s Propeller Theory. \r\n\r\n [1]: _URL_0_\r\n [2]: _URL_2_", "875" ], [ "<PERSON>, The absolute minimum possible power is $P = TV$ (see method 1) but in the case of a propeller of diameter d the minimum theoretical power is greater, $P=TV*( > 1)$ (see method 2, Froude&#39;s formula). Anyway, the question is already answered in the _URL_0_ the answer is No. The formula $P=TV$ can not be used to calculate the minimum possible power needed by a propeller of diameter d, that develops the thrust T and travel at a forward speed V.", "334" ], [ "> Can the measured thrust of a propeller be greater than the maximum possible thrust predicted by Froude&#39;s Propeller Theory?\r\n\r\nIt might seem incredible but the answer looks to be: yes it can.\r\n\r\n \" ;*<PERSON> [1977] reports measured values of the thrust which exceed the theoretical upper limit as predicted by the momentum theory by 20% to 50%.* \" ;\r\n\r\nSource: [ON THE LIMITATIONS OF FROUDE&#39;S\r\nACTUATOR DISC CONCEPT,\r\nG.A.M. VAN KUIK. page 7.](_URL_1_)\r\n\r\n*Update*\r\n\r\n \" ;*For the propeller flow the momentum theory underestimates the induced velocity, while for the wind turbine flow this is overestimated. As the induced velocity has a different sign in both flow regimes, the total velocity at the disc $u_d = U_0 + u_i$ is underestimated in all flow states: the mass flow through the rotor is always higher than predicted by the classical momentum theory.* \" ;\r\n[![enter image description here][1]][1]\r\nSource: the same paper as above.\r\n\r\n\r\n [1]: _URL_0_", "475" ], [ "> Does the ARCA hoverboard violate known limits on small-diameter electric fans?\r\n\r\n1) The max theoretical static thrust that can be obtained with an Electric Ducted Fan characterized by: Diameter = 120 mm and Power = 272 hp / 36 = 5.63 kW is:\r\n\r\n(1.2 kg/m^3 x (5.63 kW)^2 x pi x (120 mm)^2/2)^(1/3) = 9.7 kgf\r\n\r\n(I used the formula that gives the max possible static thrust as a function of power and the diameter of the propeller. The overall efficiency is considered 100%. For realistic efficiencies, smaller than 1, the Power is not 5.63 kW but 5.63 x efficiency)\r\n\r\nAs you see, 36 fans, that draw a total of 272 hp, can lift in theory 9.7 kg x 36 = 349 kg, well above the 192 kg of ArcaBoard (including the weight of the pilot). **No limit is violated.**\r\n\r\nHowever, the configuration with 36, 120 mm diameter, rotors is bad because the same formula I used above says that a single 26 inch propeller powered by a 5.63 kW motor generates:\r\n \r\n(1.2 kg/m^3 x (5.63 kW)^2 x pi x (26 inch)^2/2)^(1/3) = 30 kgf\r\n\r\nIn consequence, eight 5.63 kW motors, turning 26 inch propellers, will draw only 45 kW (60.4 hp) and lift 240 kg, more than the max mass of ArcaBoard in flight. \r\n\r\nSmall diameter propellers are simply inefficient for generating static thrust. This is the reason helicopters have large rotors. **Hovering boards like ArcaBoard, also perfectly realizable, have no future because they waste an enormous amount of power**.\r\n\r\n2) A well designed and built electric hoverboard was made by <PERSON>. It requires considerably less power than ArcaBoard and flies much better.\r\n \r\nA comparison between the hoverboard of <PERSON> (see: the video) and that made by <PERSON> from ARCA.\r\n\r\n_URL_1_\r\n[Video: <PERSON> flying][1]\r\n\r\n**<PERSON>**\r\n \r\n- 8 rotors, 4.5 kW each\r\n- Total Power: 36 kW = 48.3 hp\r\n- Payload: 1 person\r\n\r\n**<PERSON>** \r\n\r\n- 36 rotors, 5.63 kW each \r\n- Total power: 203 kW = 272 hp \r\n- Payload: 1 person\r\n\r\nIn conclusion, ArcaBoard is nothing else but a badly designed hoverboard that requires an enormous power, 272 hp, to carry a man while 48.3 hp are enough for such a job, as demonstrated by <PERSON>.\r\n\r\n[Source: A multicopter with 36 propellers that carries a man][2]\r\n\r\n[1]: _URL_1_\r\n[2]: _URL_0_", "440" ], [ "I&#39;ve tried self leveling compound once, and it broke into pieces with each nail. The crumbs don&#39;t move much, at first, but with movement of the new flooring (slight, over time) I \" ;m doubtful that it&#39;d work well over the long term. I took it up (small area/dip). I&#39;ve since used 15 or even 30 lbs felt, which was used long ago under hardwood floors to minimize squeaks against the subflooring. I cut pieces for dips, small, than ever larger, checking each layer or two with my level, and judging that there&#39;d be a leetle compression of the felt so I layered it up just a tad over, but very, very little. The felt itself is already compressed, but the layers can compress a very small amount. Given the strength of wood flooring, a little dip the depth of a few sheets of paper, won&#39;t affect anything or show.\r\n\r\nSo I suggest layers of felt. Placing some very small brad nails (with flat heads) here or there on the felt holds them in place from wandering or shifting over time, just 3 or 4.", "672" ], [ "I do not know how to take into account that interference between propellers. Anyway, a 5.7 kW EDF (see: \" ;Schubeler DS-77 HST 120mm Carbon EDF Ducted Fan + DSM6745-700Kv Motor \" ;) delivers a measured 8.97 kgf max thrust. According to the formula I used a 5.7 kW, 120 mm propeller can lift 8.97 kg if the overall efficiency electrical + mechanical is 88% ((1.2 kg/m^3 x (5.7 kW x 88%)^2 x pi x (120 mm)^2/2)^(1/3) = 8.97 kgf). Likely the interference between EDFs diminishes the efficiency below 88%.", "875" ], [ "The problem is that I only know the total surface of the wings and the power of the engine. The ratio L/D and the speed are unknown in my case. The max thrust for a propeller, which is a wing that rotates so it generates lift and drag, is calculated using the momentul theory (see: _URL_0_), a procedure that does not make use of CD and CL. I applied the same method for evaluating the max lift of a plane.", "440" ], [ "It appears that if Drag and other losses are taken into account a part of the available power P is dissipated without producing any lift. In consequence, the real lift should be smaller than what I calculated. However, after testing the formula on a few planes, the max possible lift I get is, in many cases, smaller than the weight of the plane which is an incorrect result. I will update the question with more explanations.", "440" ], [ "I used the power specified in the general characteristics of Cessna 172: *Powerplant: 1 &#215; Lycoming IO-360-L2A four cylinder, horizontally opposed aircraft engine, 160 hp (120 kW)*. I calculated that Cessna 172 can climb at its specified 3.66 m/s if the engine delivers only $0.745*160\\:hp$ and a propeller 70% efficient is utilized. I have to verify if that 3.66 m/s really corresponds to using only around 75% of the engine power. This should be written somewhere.", "850" ], [ "I have a CFD code that I want to run on an HPC cluster. Of course, before it can be run, it first needs to be compiled.\r\n\r\nWhat is the best option between compiling on the head node and compiling on one of the compute nodes ? The hardware specifications of head and compute nodes are not necessarily identical, and sometimes all compute nodes aren&#39;t the same either : can that change the optimisation behaviour/efficiency of the compiler significantly ? What is the common best practice ?\r\n\r\nOf course, in case of compiling on computation nodes, I would be waiting for the workload manager (e.g. slurm) to grant \" ;RUN \" ; state to the job. The submission script would then compile the software and then run it. Doing otherwise would not be nice to the other users…", "849" ] ]
109
[ 2200, 9686, 11723, 9172, 18703, 3328, 4983, 2711, 3475, 9268, 5556, 16651, 528, 17562, 19514, 11936, 8960, 10723, 10910, 4679, 6962, 19052, 18715, 4703, 7196, 17192, 1407, 19669, 4369, 14134, 16916, 2805, 13679, 679, 10871, 17757, 902, 18119, 19478, 8568, 9201, 16539, 14196, 5586, 1969, 2221, 12310, 9090, 17037, 9454, 28, 7174, 9662, 8742, 19470, 18155, 8734, 2215, 2973, 10400, 4314, 19237, 5998, 16872, 4076, 17009, 16150, 18638, 9236, 2568, 533, 16428, 3177, 3357, 3100, 4959, 18227, 3757, 13374, 16700, 14994, 6869, 16236, 9348, 13223, 11644, 11014, 14759, 1238, 3671, 4450, 867, 15886, 17862, 9319, 7576, 18765, 17243, 7675, 4836, 212, 5027, 8392, 5087, 11188, 12292, 1363, 3931, 10194, 4431, 18525, 8873, 13517, 1246, 18811, 3597, 19138, 317, 15709, 9901, 9697, 6978, 17803, 7757, 7221, 4424, 4937, 15624, 1799, 3121, 1569, 4652, 6872, 18937, 4859, 16059, 17607, 10994, 3843, 19604, 7047, 10056, 3175, 18238, 8720, 11410, 4509, 10358, 8621, 8864, 13967, 11485, 16261, 11872, 13754, 17587, 5150, 3580, 2261, 18994, 1921, 9135, 12120, 974, 8727, 1927, 5174, 7476, 9585, 353, 14291, 10319, 12301, 1048, 4041, 10893, 17404, 18437, 13334, 6532, 1554, 11519, 16995, 8555, 17211, 2038, 1765, 10398, 436, 16372, 19321, 19642, 4945, 4740, 10949, 5821, 4171, 1420, 50, 752, 4511, 19426, 6335, 5278, 8791, 6508, 18333, 10794, 11931, 6747, 4301, 6470, 17436, 7108, 727, 8842, 3788, 10621, 15929, 17988, 18576, 15595, 5420, 198, 2631, 17564, 18042, 10479, 12872, 3503, 15190, 18878, 16112, 4110, 789, 8451, 19436, 18232, 13816, 13861, 5148, 7682, 16177, 12847, 5729, 7586, 9251, 18991, 9120, 10844, 8939, 16595, 2007, 2037, 3687, 16871, 4855, 19313, 6161, 7472, 1024, 15722, 19226, 4136, 5100, 4863, 1481, 55, 6731, 18930, 4513, 1289, 566, 18707, 1774, 380, 13712, 5310, 16973, 2651, 10633, 15996, 15808, 18319, 16230, 3001, 1265, 4529, 3668, 17858, 19373, 4460, 19099, 6781, 846, 6644, 11587, 18969, 1970, 2123, 9821, 16220, 407, 13485, 636, 3561, 2241, 19564, 1520, 13147, 3774, 3050, 17186, 19399, 4075, 4729, 16675, 5892, 4004, 12258, 16012, 1616, 1908, 2465, 3271, 10629, 13924, 1097, 8009, 7054, 825, 3783, 12086, 1812, 12224, 3469, 12681, 504, 9408, 9260, 8434, 12275, 5895, 13669, 12549, 19473, 1005, 16975, 696, 7940, 958, 7708, 1484, 2490, 7259, 6946, 6118, 6461, 19471, 6063, 12416, 9157, 17982, 4818, 10554, 2840, 1844, 10118, 5048, 3200, 4465, 9215, 1370, 19060, 6355, 2449, 17945, 7188, 284, 19485, 5357, 19342, 7178, 14488, 8697, 10734, 14009, 14897, 218, 19327, 13168, 10675, 9535, 7332, 940, 1176, 5397, 1336, 768, 6803, 17356, 13622, 2734, 7699, 19297, 7594, 8927, 4023, 1796, 3820, 16155, 18836, 858, 12257, 8313, 17148, 5851, 15982, 7310, 12617, 11027, 3627, 4232, 15906, 8928, 455, 18241, 536, 1042, 1967, 11390, 4745, 503, 15700, 16221, 18592, 12004, 4049, 10369, 11294, 1976, 240, 5938, 5410, 8748, 6151, 15622, 2411, 14424, 5002, 16955, 8850, 1957, 9984, 13073, 8011, 12195, 11287, 7741, 2125, 19242, 802, 2056, 2098, 3055, 18389, 7722, 3352, 5775, 523, 4130, 11956, 18026, 17912, 17364, 18341, 19160, 9856, 15934, 4985, 4941, 5679, 827, 16201, 18947, 18430, 9283, 18830, 3361, 3694, 2949, 19572, 14814, 3190, 8600, 2006, 4690, 5360, 8533 ]
STX_100186.0
[ [ "So, let&#39;s start with what a watchdog is :\r\n\r\n 1. A watchdog is basically a timer system, like a \" ;tic-tac \" ; bomb which is re-armed periodically during normal operation of your processor/controller. If your processor happens to be stuck during execution, it will fail to re-arm the watchdog, an the \" ;tic-tac \" ; bomb will be triggered. Then, the watchdog&#39;s job is to re-initialize the stuck system, or trigger an alarm, or execute specific instructions etc...\r\nSo basically, a watchdog protects a system from being stuck.\r\n\r\n 2. Now, imagine that your system is not absolutely stuck (=not executing anything), but for example, is stuck inside an infinite loop meaning it executes all the instructions inside the loop, one of which should be \" ;re-arm the watchdog \" ;. But it is not able to exit the loop like it should be in normal operation. If you use a simple watchdog, it will be able to be re-armed at every iteration and your system will never be re-initialized and will stay stuck in this infinite loop.\r\nThat&#39;s why the window watchdog exists : it protects the system against being stuck by needing periodical refresh like in 1), but it also detects when it is re-armed \" ;too much \" ; compared to what it knows to be the nominal system&#39;s operation. It&#39;s like a watchdog 2.0.", "16" ], [ "Electrical current in a circuit or any conductor in general is due to a potential difference allowing atoms to \" ;pass \" ; electrons to each other, which results in a global trend of moving charged particles in one direction.\r\n\r\nWhat makes a particular element more conductive than another is the ability of the atoms to easily (=without too much external energy needed) free or catch electrons. In macro-size world, it means that to create an electrical current of same value, a good conductor will need less potential difference than a bad conductor (or good dielectric). Hence the notion of \" ;resistance \" ;.", "658" ], [ "Processes work in parallel in vhdl. So if you happen to materially (pressing the button) set reset to &#39;1&#39;, it will be set to &#39;0&#39; by process 2 at the next rising edge and the chance that the &#39;do work&#39; instructions in process 1 are executed are totally random, you should not use this design, it is unstable.\r\nI guess the chance will be higher that process 1 executes first since it&#39;s triggered by both clock and reset while process 1 is triggered only by clock. However, I still suggest you change your design and put the \" ;reset&#39;s reset \" ; instructions in the same process for stability.", "123" ], [ "Crystal quartz oscillators generate sinusoidal waves, which is not appropriate for a clock signal since we want rising & falling edges as clean as possible.\r\n\r\nThe Schmitt trigger is used to generate a square wave from this sinusoidal wave. Its hysteresis properties makes it robust against false triggering.\r\n\r\nThe output signal will be cleaner, and the clock generator is immediately able to drive a digital high-Z input.", "677" ], [ "The azimuth and elevation spherical coordinates are a mean to define a direction in a three-dimensional space. How you define which angle is the azimuth and which angle is the elevation is up to you. It&#39;s like setting up a (x,y,z) coordinates referential\r\n\r\nAzimuth/Elevation diagrams shows the antenna&#39;s gain along those directions. Sometimes, we talk in E-plane and H-plane but those are different definitions, which are totally dependent on how the antenna is polarized. \r\nThey can be related to azimuth/elevation, but the convention that links the two is author-dependent.\r\n\r\nExample : A dipole antenna E-plane would be the one including the antenna itself while the H-plane would be the one perpendicular to it, like in : [![enter image description here][1]][1]\r\n\r\n\r\nIn your example datasheet, we have the following information about the E-field :\r\n\r\n > Polarization : vertical\r\n\r\nWhich indicates than the E-field lines are contained in vertical planes (containing the antennas vertical axis). Therefore, you can safely assume that the E-plane was chosen arbitrarily among the infinity of possible choices (every plane coplanar to a E-field line is a E-plane) and the H-plane was defined as its perpendicular plane. Both elevation and azimuth are defined in an implicit maner, but common sense would recommend elevation for E-plane and azimuth for H-plane, **in this particular example.** \r\n[![datasheet example][2]][2]\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "59" ], [ "Skin depth is given by :\r\n$$\r\n\\delta = \\sqrt{\\frac{1}{\\sigma \\pi \\mu f}}\r\n$$\r\nWith in this case (approximate values) :\r\n$$\r\n\\sigma = 6.10^7\\text{ (copper&#39;s conductivity)}\\\\\r\n\\mu = \\mu_0 = 4\\pi 10^{-7}\\\\\r\nf = 50 Hz.\r\n$$\r\n\r\nWhich gives\r\n$$\r\n\\delta = 9.2 mm\r\n$$\r\n\r\nSo skin effect would be observed on cables with radius greater than 9.2 mm which means 18.4 mm diameter (3/4 inch) (or a 266 m&#178; cross-section), which is very close to AWG(7\\0), a gauge qualified to carry hundreds of amperes (while a domestic installation carries no more than 50 A). \r\nSince most cables for home are less than that, the skin effect is often and justifiably neglected in home electricity applications.\r\n\r\nAlso, the skin depth is the distance from the surface of the conductor to where the current density is damped to less than 1/e (36%) of its surface value. So in fact you would need even more diameter to observe the center of the cable having no current.\r\n\r\nRegarding the choice between stranded and solid cables, solid cables are often preferred for home wiring for different reasons including cost, size, durability. Those have already been discussed in here :\r\n_URL_0_", "471" ], [ "First, around 40 years ago, they invented the red LED. Then came progressively blue/green/other colors following different technologies evolutions. Also, the first diodes were not very powerful.\r\n \r\nSo, the issue was to make **white** light emitting diodes, and to make them **powerful** enough to be competitive against lightbulbs, which happenned only less than 10 years ago. And white diodes are still very expensive, but the cost is largely compensated by their durability. Try to look up for the price of a single Audi/BMW/whatever full-led headlight and you&#39;ll understand.", "24" ], [ "The \" ;trick \" ; you lack may be using the [superposition principle][2] to \" ;ignore \" ; (temporarily) the DC source and consider it to be 0 V while studying only the AC source. Using the superposition principle, you can show that V_out consists of a DC component equal to approx. 1V plus an AC component which depends on Vin and the high-pass filter:\r\n\r\nWithout \\$R_1\\$ and the DC source, the cutoff frequency is given by :\r\n$$\r\n\\omega_c = \\frac{1}{2\\pi R_2 C_1} = 0.15 Hz\r\n$$\r\n(This is a typical [RC circuit][1])\r\n\r\nAdding \\$R_1\\$ and the DC source, the circuit changes a bit, since you are adding a resistor parallel to \\$R_2\\$, the cutoff frequency is now\r\n$$\r\n\\omega_c = \\frac{1}{2\\pi (R_2//R_1) C_1} = 0.238 Hz\r\n$$\r\nSince \\$R_1//R_2\\$ is lower than \\$R_2\\$, you increased the cutoff frequency, but it&#39;s still two decades lower than your expected 50 Hz so it shouldn&#39;t be an issue.\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "520" ], [ "If you read quickly the [datasheet][1] (page 73), you&#39;ll see that you have to use a balun circuit in order to match the IC&#39;s pins high input impedances to the antenna&#39;s impedance which is likely to be [50 \\$\\Omega\\$][2]\r\n\r\nIf you go further and read page 13 :\r\n\r\n > The LNA has approximately 250 \\$\\Omega\\$ of differential input\r\n > impedance which functions well with the proposed antenna \r\n > (PCB/Monopole) during signal transmission. The LNA, when connected\r\n > to the 50 \\$\\Omega\\$ device, needs an external matching circuit\r\n > (Balun) for correct matching and to minimize the noise figure of the\r\n > receiver.\r\n\r\nSo you definitely need a 50 \\$\\Omega\\$ unbalanced to 250 \\$\\Omega\\$ differential impedance matching circuit, the technology you want to use is up to you.\r\n\r\nIn RF electronics, [impedance matching][3] between interconnected circuits is mandatory, should it be for signal integrity reasons or hardware safety reasons.\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_\r\n [3]: _URL_2_", "269" ], [ "Loop antenna&#39;s are often solved for magnetic field and we perfectly know how they behave towards magnetic coupling as shown in this image :\r\n\r\n[![enter image description here][1]][1]\r\n\r\nHowever, I am looking for the electric field lines pattern of these antenna&#39;s, I was thinking of a diametrical E vector \" ;turning \" ; with the current, creating some kind of circular polarization, am I right ?\r\n\r\n\r\n [1]: _URL_0_", "891" ], [ "I have Windows 8.1 operation system and I installed Miktek 64 bits version for windows and TeXnicCenter 64 bits version.\r\n\r\nThese is basically the main file:\r\n\r\n \\documentclass{book}\r\n \\usepackage{quotes} \r\n \\usepackage[margin=3cm,includefoot]{geometry} \r\n \\usepackage{amssymb,amsmath} \r\n \\usepackage{amsthm} \r\n \\usepackage{mathrsfs} \r\n \\usepackage[spanish]{babel} \r\n \\usepackage[utf8]{inputenc} \r\n \\usepackage{verbatim} \r\n \\usepackage{stmaryrd} \r\n \\usepackage{upgreek} \r\n \\usepackage{enumerate} \r\n \\usepackage{hyperref} \r\n \\usepackage{graphicx} \r\n \\title{Programaci&#243;n} \r\n \\date{} \r\n \\author{} \r\n \\setlength{\\parskip}{\\baselineskip} \r\n \\setlength{\\parindent}{0cm} \r\n \\newcommand{\\afdmn}{\\mathsf{AF2}^{M\\mu\\nu}} \r\n \\begin{document} \r\n \\frontmatter \r\n \\tableofcontents \r\n \\frontmatter \r\n \\chapter*{Introducci&#243;n} \r\n \\addcontentsline{toc}{chapter}{Introducci&#243;n} \r\n .\r\n .\r\n .\r\n \\backmatter \r\n \\chapter*{Conclusi&#243;n} \r\n \\addcontentsline{toc}{chapter}{Conclusi&#243;n} \r\n .\r\n .\r\n .\r\n \\begin{bibliography} \r\n \\bibitem{zxz}.... \r\n \\end{bibliography}\r\n \\end{document}\r\n \r\nAnd I can&#39;t get the outputfile. There are 242 error(s) into the spanish.ldf file, such as:\r\n\r\n latex > ! Missing number, treated as zero.\r\n\r\nIn line \r\n\r\n \\StartBabelCommands*{spanish}{captions}\r\n [unicode, charset=utf8, fontenc=EU1 EU2]\r\n\r\nI had tried with the 32 bits version as well as 64 bits version (both Miktek and TeXniCenter). Also I had run the update manager in order to install a recent version of babel but it didn&#39;t work. \r\n\r\nWhat I&#39;m doing wrong? What can I do?\r\n\r\nThanks", "558" ] ]
42
[ 4945, 17862, 679, 17932, 528, 12086, 23, 15624, 8313, 18226, 2125, 8392, 19642, 7174, 17562, 1900, 3806, 17211, 5087, 13302, 17148, 10910, 12172, 565, 7257, 3717, 13161, 18947, 16760, 5895, 18731, 9686, 10595, 3183, 10092, 14243, 18319, 5266, 1969, 636, 940, 317, 7117, 4855, 18341, 2276, 9386, 19572, 9551, 17803, 3920, 3324, 11725, 9268, 50, 6508, 12257, 1976, 18613, 2973, 4076, 19663, 2129, 4075, 16177, 16872, 9430, 8727, 9032, 16539, 6747, 292, 4689, 16084, 10358, 7178, 19552, 6118, 9672, 4136, 201, 3883, 833, 18996, 10432, 685, 4369, 18238, 3738, 13752, 17024, 17176, 9986, 1419, 9901, 13924, 17564, 16809, 10949, 19288, 16747, 19152, 14291, 10808, 9459, 10194, 10057, 18310, 15215, 6962, 13498, 7310, 2200, 27, 8555, 13244, 1160, 9936, 3671, 13485, 8748, 18830, 5150, 11209, 15190, 9348, 13679, 14675, 16742, 13949, 4314, 4424, 14080, 15415, 18663, 4652, 5769, 12553, 12120, 5699, 2465, 2261, 7521, 8603, 5561, 6783, 12417, 1569, 3475, 17851, 18966, 8864, 10928, 11246, 1970, 10893, 11532, 8697, 19470, 3695, 15931, 19160, 533, 18227, 8498, 13243, 9623, 744, 1967, 14964, 18576, 19613, 7343, 14491, 18406, 1265, 3154, 5072, 10629, 6240, 9615, 9275, 14759, 12496, 12127, 17757, 6458, 7757, 9477, 9382, 13024, 13836, 15722, 4679, 2146, 14762, 4050, 13750, 4818, 9172, 18529, 12310, 4388, 9798, 13318, 12201, 8842, 7518, 1616, 15036, 5755, 727, 19237, 4531, 14828, 261, 8064, 3100, 16847, 8873, 8568, 7815, 18409, 1374, 2037, 1738, 15595, 6869, 4582, 5048, 3877, 16374, 16184, 14918, 974, 10954, 1896, 17832, 19193, 15625, 4836, 19523, 3887, 8742, 18991, 9537, 12632, 10301, 16950, 15716, 3357, 3843, 8350, 8707, 18639, 18609, 6781, 3518, 4171, 513, 11329, 7635, 10785, 2759, 10723, 11796, 3817, 7576, 9408, 15833, 6303, 11111, 4370, 3175, 12301, 19590, 15916, 12787, 10591, 15897, 4703, 7392, 12167, 5830, 19596, 5548, 16441, 5513, 8904, 2711, 12363, 11499, 11410, 7722, 16428, 11941, 4803, 3774, 10043, 8012, 11291, 19399, 10476, 4450, 11485, 3559, 19383, 3783, 17154, 12870, 212, 2098, 1554, 15143, 8580, 4161, 4592, 7034, 19485, 1730, 12555, 5938, 3120, 542, 17960, 4305, 5998, 19373, 9341, 13168, 10994, 8734, 16239, 9517, 19067, 7675, 10618, 7610, 1363, 3580, 5885, 18063, 18296, 17205, 11117, 756, 4680, 3121, 3551, 4585, 15383, 18745, 4588, 13407, 10732, 1564, 5148, 12931, 4274, 17465, 12224, 6887, 6272, 18990, 2221, 122, 204, 16398, 1504, 11294, 14735, 19669, 19021, 2029, 9326, 6872, 2411, 3422, 16528, 19242, 6665, 18811, 18845, 19426, 6470, 18718, 14134, 16323, 18492, 9219, 15996, 9391, 16796, 17192, 18994, 13374, 9773, 2568, 18266, 8939, 13694, 18430, 1268, 14089, 8715, 7269, 16281, 4219, 16497, 4538, 5310, 9157, 12292, 3102, 10963, 11115, 15825, 6848, 853, 15811, 334, 8290, 16753, 10962, 15841, 18782, 14652, 8914, 16316, 3177, 619, 9212, 13, 19342, 16519, 7586, 8170, 3001, 5029, 7843, 5666, 19060, 5112, 1481, 19478, 1843, 7917, 10286, 12583, 802, 11723, 1775, 10531, 11862, 15406, 8928, 6833, 6184, 10823, 10871, 12325, 4535, 11213, 7052, 13137, 5652, 5639, 9673, 11164, 9652, 13814, 14499, 13223, 14120, 4130, 10001, 17044, 11717, 11457, 11027, 17476, 5821, 13334, 4041, 18715, 15929, 19698, 218, 566, 18067, 867, 5884, 2456, 18119, 15057, 15808, 11655, 17657, 4651 ]
STX_1001938.0
[ [ "I have a simple collection:\r\n\r\n`[{a: 1}, {a: 2}, {a: 3}]`\r\n\r\n**How do I use Lodash&#39;s reduce to get the sum of all \" ;a \" ; attributes?**\r\n\r\nThis seems like a trivial / canonical use, but I can&#39;t get the syntax right and surprisingly can&#39;t find any docs beyond [Lodash&#39;s][1] example.\r\n\r\nUsing Lodash&#39;s docs example, it should be:\r\n\r\n`const total = _.reduce([{ a: 1}, {a: 2}, {a: 3}], (sum, elem) = > elem.a);`\r\n\r\nHowever this returns the value \" ;3 \" ; instead of \" ;6&#39;. \r\n\r\nNote: I&#39;m specifically asking about the usage of `reduce`. I&#39;m aware of other methods like the one in this [question][2].\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "200" ], [ "**Get unaggregated rows**\r\n\r\nTo get unaggregated rows, you can do a query with ` \" ;queryType: \" ;select \" ;`. \r\n\r\nSelect queries are also useful when pagination is needed - they let you set a page size, and automatically return a paging identifier for use in future queries.\r\n\r\nIn this example, if we just want the top 10 rows, we can pass in ` \" ;pagingSpec \" ;: { \" ;pageIdentifiers \" ;: {}, \" ;threshold \" ;: 10 }`.\r\n\r\n**Order by timestamp**\r\n\r\nTo order these rows by \" ;timestamp \" ;, you can pass in ` \" ;descending \" ;: \" ;true \" ;`. \r\n Looks like most Druid query types support the `descending` property.\r\n\r\n**Example Query:** \r\n\r\n {\r\n \" ;queryType \" ;: \" ;select \" ;,\r\n \" ;dataSource \" ;: \" ;my_data_source \" ;,\r\n \" ;granularity \" ;: \" ;all \" ;,\r\n \" ;intervals \" ;: [ \" ;2017-01-01T00:00:00.000Z/2017-12-30T00:00:00.000Z \" ; ],\r\n \" ;descending \" ;: \" ;true \" ;,\r\n \" ;pagingSpec \" ;: { \" ;pageIdentifiers \" ;: {}, \" ;threshold \" ;: 10 }\r\n }\r\n\r\n[Docs on \" ;select \" ; type queries][1]\r\n\r\n\r\n [1]: _URL_0_", "374" ], [ "Is it possible to get the top X records, sorted by time, grouped on a set of dimensions?\r\n\r\n## Example:\r\nThis is a fictional example, that&#39;s meant to simply illustrate the problem.\r\n\r\nGiven a data source in the following format, how can I get the most recent 10 people to make a purchase, and their most recent purchase amount & product name?\r\n\r\nSo the result is 10 unique people, and their most recent purchase amount & product name.\r\n\r\nData source schema:\r\n\r\n\r\n purchases\r\n -----------------------------------------------------------------\r\n timestamp first_name last_name customer_id product_name purchase_amount\r\n\r\n\r\n## Things I&#39;ve tried:\r\n### Select query\r\n\r\nThis doesn&#39;t do any grouping, but does order the 10 most recent records by time. Issue is they&#39;re not unique.\r\n\r\n\r\n {\r\n \" ;context \" ;: {\r\n \t \" ;timeout \" ;: 8000\r\n },\r\n \" ;queryType \" ;: \" ;select \" ;,\r\n \" ;dataSource \" ;: \" ;purchases \" ;,\r\n \" ;granularity \" ;: \" ;all \" ;,\r\n \" ;intervals \" ;: [ \" ;2017-04-01T00:00:00.000Z/2017-04-23T00:00:00.000Z \" ; ],\r\n \" ;descending \" ;: \" ;true \" ;,\r\n \" ;pagingSpec \" ;: { \" ;pageIdentifiers \" ;: {}, \" ;threshold \" ;: 10 }\r\n }\r\n\r\n\r\n### groupBy query\r\nThis groups by all dimensions and metrics, instead of just grouping on first_name, last_name, customer_id - and then taking the most recent product_name and purchase_amount.\r\n\r\nSo you will have 10 records, but they will not be 10 unique people. Just 10 unique combinations of the metrics & dimensions listed.\r\n\r\nAlso it&#39;s not ordered by time.\r\n\r\n\r\n {\r\n \" ;queryType \" ;: \" ;groupBy \" ;,\r\n \" ;dataSource \" ;: \" ;purchases \" ;,\r\n \" ;granularity \" ;: \" ;all \" ;,\r\n \" ;intervals \" ;: [ \" ;2017-04-01T00:00:00.000Z/2017-04-23T00:00:00.000Z \" ; ],\r\n \" ;dimensions \" ;: [\r\n \" ;first_name \" ;,\r\n \" ;last_name \" ;,\r\n \" ;customer_id \" ;,\r\n \" ;product_name \" ;\r\n ],\r\n \" ;metrics \" ;: [\r\n \" ;purchase_amount \" ;\r\n ],\r\n \" ;limitSpec \" ;: { \r\n \" ;type \" ;: \" ;default \" ;, \r\n \" ;limit \" ;: 10\r\n }\r\n }", "256" ], [ "Given a table with a column for timestamps, I want to get the 10 most recent records with particular columns being unique. \r\n\r\nHow can this be done?\r\n\r\n# Example:\r\n\r\n**Data:**\r\n\r\n purchases\r\n -----------------------------------------------------------------\r\n timestamp first_name last_name customer_id product_name purchase_amount\r\n\r\nHow can I get the 5 most recent customers who made a purchase, and the `product_name` and `purchase_amount`?\r\n\r\n**Result:**\r\n\r\n <PERSON>, 1234, &#39;foo&#39;, 432.123\r\n Tim, McTimothy, 321, &#39;bar&#39;, 5124.11\r\n Bob, Bobbertson, 55, &#39;foo&#39;, 432.123\r\n <PERSON>, Rando, 191, &#39;tv&#39;, 700.00\r\n Jimbo, Manman, 631, &#39;ps4&#39;, 450.00\r\n\r\n# What I&#39;ve tried:\r\n\r\nThis query fails since it would require an aggregation on `product_name` and `purchase_amount`, but we don&#39;t want an aggregation, just the latest value.\r\n\r\n SELECT first_name, last_name, customer_id, product_id\r\n FROM purchases\r\n GROUP BY first_name, last_name, customer_id\r\n ORDER BY timestamp DESC\r\n LIMIT 10", "215" ], [ "I want to merge two objects into a new object, with one object overwriting properties if both have them. \r\n\r\nThis is very easy to do with ES6 spreads, but in this particular case I would like to use a method that still defines what keys can be set. Basically create a \" ;white list \" ; of properties that are allowed on my final object. (With spreads, any property would be merged into the new object).\r\n\r\nIs there a method that uses ES6+ to do this?\r\n\r\n**Two objects:**\r\n\r\n var o1 = { \r\n a: &#39;foo&#39;,\r\n b: &#39;bar&#39;,\r\n c: &#39;baz&#39;\r\n }\r\n \r\n var o2 = { \r\n a: &#39;pop&#39;,\r\n bad_property: &#39;dont copy me&#39;\r\n }\r\n\r\n var oMerged = {\r\n a: &#39;pop&#39;, // I came from obj_2\r\n b: &#39;bar&#39;,\r\n c: &#39;baz&#39;\r\n }\r\n\r\n**Merge methods:**\r\n \r\n // Method 1: Use spreads, problem is this hides the keys.\r\n var oMerged = { \r\n ...o1,\r\n ...o2\r\n };\r\n \r\n // Method 2: Shows each key, but requires a ternary to check if obj_2 has the key.\r\n var oMerged = {\r\n a: (o2.a !== undefined) ? o2.a : o1.a,\r\n b: (o2.b !== undefined) ? o2.b : o1.b,\r\n c: (o2.c !== undefined) ? o2.c : o1.c\r\n }\r\n\r\n // Method 3: Define what keys can be merged, but use a more concise syntax / possibly an ES6+ feature.\r\n ??? \r\n\r\nEdit: Explicitly said that the object should have a white list of acceptable properties. There are good answers but they require black lists of unacceptable properties. The reason for the &#39;white list&#39; is it shows other developers the shape of the final object.", "145" ], [ "This is the shortest method I&#39;ve come up with that will let you \r\n\r\n 1. set an order for properties to be overwritten\r\n 2. let you declare what properties are acceptable in the final object\r\n 3. not require long ternaries for each property\r\n\r\n\r\n \r\n\r\n // Step 1. merge all properties into a new object.\r\n var oMerged = {...o1, ...o2};\r\n \r\n // Step 2. Explicitly use keys to assign\r\n var oFinal = {\r\n a: oM.a,\r\n b: oM.b,\r\n c: oM.c\r\n };", "145" ], [ "I&#39;m using `jest` to test a component with a ` < Link > ` from react-router v4.\r\n\r\nI get a warning that ` < Link / > ` requires the context from a react-router ` < Router / > ` component.\r\n\r\nHow can I mock or provide a router context in my test? (Basically how do I resolve this warning?)\r\n\r\n**Link.test.js**\r\n\r\n import React from &#39;react&#39;;\r\n import renderer from &#39;react-test-renderer&#39;;\r\n import { Link } from &#39;react-router-dom&#39;;\r\n \r\n test(&#39;Link matches snapshot&#39;, () = > {\r\n const component = renderer.create(\r\n < Link to= \" ;# \" ; / > \r\n );\r\n \r\n let tree = component.toJSON();\r\n expect(tree).toMatchSnapshot();\r\n });\r\n\r\n**The warning when the test is run:**\r\n\r\n Warning: Failed context type: The context `router` is marked \r\n as required in `Link`, but its value is `undefined`.", "530" ], [ "I want to snapshot test a react component that dispatches a redux action in its `componentDidMount()` handler. The action is given to the component through Redux&#39;s `connect()`.\r\n\r\nHow should I mock the action?\r\n\r\nRight now the action is imported in the component (see Newsfeed.js below). So how would I swap it out for a mock action in my test? \r\n\r\nI&#39;m using redux-thunk for my async actions, but that shouldn&#39;t matter much.\r\n\r\n\r\n**app/components/Newsfeed.js**\r\n\r\n\r\n import React, { Component } from &#39;react&#39;;\r\n import { connect } from &#39;react-redux&#39;;\r\n\r\n // An action that makes an async request to get data\r\n import { loadNewsfeedStories } from &#39;../actions/Newsfeed&#39;;\r\n \r\n class Newsfeed extends Component {\r\n componentDidMount(){\r\n this.props.loadNewsfeedStories();\r\n }\r\n \r\n ...\r\n }\r\n \r\n export default connect(state = > ({\r\n stories: state.newsfeed.stories\r\n }),\r\n {\r\n loadNewsfeedStories\r\n })(Newsfeed)\r\n\r\n**app/tests/Newsfeed.test.js**\r\n\r\n import React from &#39;react&#39;;\r\n import { Provider } from &#39;react-redux&#39;;\r\n \r\n // This creates a mockStore using my reducers and a saved JSON state.\r\n import { mockStore } from &#39;./MockState&#39;;\r\n\r\n // The component to test\r\n import Newsfeed from &#39;../components/Newsfeed&#39;;\r\n \r\n test(&#39;Newsfeed matches snapshot&#39;, () = > {\r\n const wrapper = mount(\r\n < Provider store={mockStore} > \r\n < Newsfeed / > \r\n < /Provider > \r\n );\r\n \r\n expect(wrapper).toMatchSnapshot();\r\n });\r\n\r\n**Possible Solutions**\r\n\r\n 1. Export the unconnected component, and manually pass in all props & mock actions. Will be a lot of extra coding compared to just using the mockStore & provider. Also we won&#39;t be testing the &#39;connected&#39; component.\r\n\r\n 2. Use something like [Nock](_URL_0_)? Seems to intercept HTTP calls, so the ajax requests wouldn&#39;t actually go anywhere.\r\n\r\n\r\n 3. For axios, there is a lib called moxios - _URL_1_", "530" ], [ "I want to use the HTMLWebpackPlugin to take my `index.ejs` template file, insert my bundled assets, and output a final `index.ejs` file. \r\n\r\nThis example has a EJS variable ` < %= API_URL % > `, but webpack is interpreting it. \r\n\r\nHow can I stop webpack from substituting the variable?\r\n\r\n**Starting \" ;template \" ;:**\r\n\r\n < !DOCTYPE html > \r\n < html > \r\n < head > \r\n \t < meta charset= \" ;UTF-8 \" ; > \r\n \t < title > Monitor < /title > \r\n < script > \r\n window.config = {\r\n API_URL: \" ; < %= API_URL % > \" ;\r\n }\r\n < /script > \r\n < /head > \r\n < body > \r\n < div class= \" ;container \" ; > < /div > \r\n < /body > \r\n < /html > \r\n\r\n**When you try to run webpack:**\r\n\r\n`ERROR in Template execution failed: ReferenceError: API_URL is not defined`\r\n\r\n**Desired result index.ejs: (has bundled assets and EJS var)**\r\n\r\n < !DOCTYPE html > \r\n < html > \r\n < head > \r\n \t < meta charset= \" ;UTF-8 \" ; > \r\n \t < title > Monitor < /title > \r\n < script > \r\n window.config = {\r\n API_URL: \" ; < %= API_URL % > \" ;\r\n }\r\n < /script > \r\n < link href= \" ;styles.css \" ; rel= \" ;stylesheet \" ; > < /head > \r\n < body > \r\n < div class= \" ;container \" ; > < /div > \r\n < script type= \" ;text/javascript \" ; src= \" ;bundle.ce40de6551945ae8703c.js \" ; > < /script > < /body > \r\n < /html > \r\n\r\n\r\n**webpack.config.js**\r\n\r\n var webpack = require(&#39;webpack&#39;);\r\n var path = require(&#39;path&#39;);\r\n var HtmlWebpackPlugin = require(&#39;html-webpack-plugin&#39;);\r\n var ExtractTextPlugin = require(&#39;extract-text-webpack-plugin&#39;);\r\n \r\n module.exports = {\r\n entry: {\r\n bundle: &#39;./src/index.js&#39;\r\n },\r\n output: {\r\n path: path.join(__dirname, &#39;dist&#39;),\r\n filename: &#39;[name].[chunkhash].js&#39;\r\n },\r\n module: {\r\n rules: [\r\n {\r\n test: /\\.js$/,\r\n use: &#39;babel-loader&#39;,\r\n exclude: /node_modules/\r\n },\r\n {\r\n // CSS is imported in app.js.\r\n test: /\\.scss$/,\r\n use: ExtractTextPlugin.extract({\r\n fallbackLoader: &#39;style-loader&#39;,\r\n loader: [ \" ;css-loader \" ;, \" ;sass-loader \" ;]\r\n })\r\n }]\r\n },\r\n plugins: [\r\n new webpack.DefinePlugin({\r\n &#39;process.env&#39;: {\r\n &#39;NODE_ENV&#39;: JSON.stringify(process.env.NODE_ENV),\r\n &#39;API_URL&#39;: JSON.stringify(process.env.API_URL)\r\n }\r\n }),\r\n new HtmlWebpackPlugin({\r\n template: &#39;src/index.ejs&#39;,\r\n inject: true\r\n }),\r\n new ExtractTextPlugin( \" ;styles.css \" ;)\r\n ],\r\n };", "194" ], [ "Here is a really bad hacky solution, and I hope someone else has a real answer / understanding of how to do this.\r\n\r\nIn your template file (index.ejs), do this:\r\n\r\n < !DOCTYPE html > \r\n < html > \r\n < head > \r\n \t < meta charset= \" ;UTF-8 \" ; > \r\n \t < title > Monitor < /title > \r\n < script > \r\n window.config = {\r\n API_URL: \" ; < %= htmlWebpackPlugin.options.API_URL_TEMPLATE_VAR % > \" ;\r\n }\r\n < /script > \r\n < /head > \r\n < body > \r\n < div class= \" ;container \" ; > < /div > \r\n < /body > \r\n < /html > \r\n\r\n\r\nIn your webpack config, do this (the relevant part is the new HtmlWebpackPlugin where I define a variable.: \r\n\r\n plugins: [\r\n // Define environment variables that are accessible inside of app javascript.\r\n new webpack.DefinePlugin({\r\n &#39;process.env&#39;: {\r\n &#39;NODE_ENV&#39;: JSON.stringify(process.env.NODE_ENV)\r\n }\r\n }),\r\n // Adds bundled file links to the index.html\r\n new HtmlWebpackPlugin({\r\n // The input file name\r\n template: &#39;src/index.prod.ejs&#39;,\r\n // Injects scripts into the < body > \r\n inject: true,\r\n // This is so hacky. I inject a string so the built .ejs file has this template var. Lets us set api_url when server is started instead of at bundle time.\r\n API_URL_TEMPLATE_VAR: &#39; < %= process.env.API_URL % > &#39;,\r\n // The output file name\r\n filename: &#39;index.ejs&#39;\r\n }),\r\n new ExtractTextPlugin( \" ;styles.css \" ;)\r\n ],\r\n\r\nBecause I defined `API_URL_TEMPLATE_VAR`, when html-webpack-plugin evaluates it, it will print out ` < %= process.env.API_URL % > ` into the final template. \r\n\r\nHacky, but works. Not accepting my own answer / waiting for a better answer.", "194" ], [ "Let&#39;s say I have a \" ;filterList \" ; element. Inside is a list of ` < filter-item > ` angular directives. I want each ` < filter-item > ` to have a \" ;delete \" ; button inside of it. Clicking the delete button will remove the ` < filter-item > ` from the DOM.\r\n\r\nHow can I do this?\r\n\r\n < div class= \" ;filterList \" ; > \r\n < filter-item > < /filter-item > \r\n < filter-item > < /filter-item > \r\n < filter-item > < /filter-item > \r\n < /div > \r\n\r\nFilterItem directive:\r\n\r\n myApp.directive(&#39;filterItem&#39;, [&#39;$http&#39;, function($http){\r\n return {\r\n scope: { },\r\n replace: true,\r\n link: function(scope, element, attrs){\r\n scope.remove = function() {\r\n // Hmm, I sure do wonder what goes here Mr <PERSON>.\r\n }\r\n },\r\n template: &#39; < div > Hi mom! < button on-click= \" ;remove() \" ; > Remove < /button > < /div > &#39;\r\n }\r\n });", "196" ], [ "Inside of `link` you can do `element.remove();`. \r\n\r\nSince AngularJS has jqLite, `remove()` removes the directive&#39;s element from the DOM. If your directive is *not* tied to any model, this is acceptable. Be careful manipulating the DOM like this when directives are rendered as a result of the model, since you haven&#39;t changed the model you can end up with strange effects (e.g. re-rendering).\r\n\r\n(Self-answer but found a good post not on StackOverflow) \r\n\r\n myApp.directive(&#39;filterItem&#39;, [&#39;$http&#39;, function($http){\r\n return {\r\n scope: { },\r\n replace: true,\r\n link: function(scope, element, attrs){\r\n scope.remove = function() {\r\n element.remove();\r\n }\r\n },\r\n template: &#39; < div > Hi mom! < button on-click= \" ;remove() \" ; > Remove < /button > < /div > &#39;\r\n }\r\n });", "586" ], [ "I have a collection of names: \r\n\r\n [\r\n {last_name: \" ;A \" ;, name: \" ;<PERSON> \" ; }, \r\n {last_name: \" ;A \" ;, name: \" ;<PERSON> \" ; }, \r\n {last_name: \" ;B \" ;, name: \" ;<PERSON> \" ;}, \r\n {last_name: \" ;<PERSON> \" ;, name: \" ;<PERSON> \" ; },\r\n {last_name: \" ;C \" ;, name: \" ;Ricky Ticky \" ; }\r\n ]\r\n\r\nThen I have an array with every `last_name` in it, in a particular order:\r\n\r\n [ \" ;B \" ;, \" ;C \" ;, \" ;A \" ;]\r\n\r\nHow can I sort my collection by the order of last_names in my second array?\r\n\r\n**What I&#39;ve tried:**\r\n\r\nThe best solution I have so far is to create a new array, then loop through my collection of names, pushing all of the elements that match my sort array&#39;s first index ( \" ;B \" ;), then second index ( \" ;C \" ;), and finally \" ;A \" ;. Seems verbose or maybe underscore.js has a better method.", "837" ], [ "I&#39;m getting an [error 403 userRateLimitExceeded](_URL_1_) when trying to use my Google Analytics API to fetch data for more than one site at a time.\r\n\r\nThe documentation tells me to set QPS (queries per second) to 10 in the [developer console](_URL_0_). I can&#39;t find this setting anywhere. \r\n\r\nHow can I set the QPS for my Google Analytics API to 10?", "456" ], [ "How can I limit a function to only run 10 times per second, but continue execution when new \" ;spots \" ; are available? This means we&#39;d call the function 10 times as soon as possible, and when 1 second has elapsed since any function call we can do another call. \r\n\r\nThis description may be confusing - but the answer will be the fastest way to complete X number of API calls, given a rate limit.\r\n\r\n**Example:**\r\nHere is an example that loops through the alphabet to print each letter. How can we limit this to only `printLetter` 10 times per second? I still want to loop through all letters, just at the appropriate rate.\r\n\r\n function printLetter(letter){\r\n console.log(letter);\r\n }\r\n \r\n var alphabet = [ \" ;A \" ;, \" ;B \" ;, \" ;C \" ;, \" ;D \" ;, \" ;E \" ;, \" ;F \" ;, \" ;G \" ;, \" ;H \" ;, \" ;I \" ;, \" ;J \" ;, \" ;K \" ;, \" ;L \" ;, \" ;M \" ;, \" ;N \" ;, \" ;O \" ;, \" ;P \" ;, \" ;Q \" ;, \" ;R \" ;, \" ;S \" ;, \" ;T \" ;, \" ;U \" ;, \" ;V \" ;, \" ;X \" ;, \" ;Y \" ;, \" ;Z \" ;];\r\n \r\n // How can I limit this to only run 10 times per second, still loop through every letter, and complete as fast as possible (i.e. not add a hard spacing of 100ms)?\r\n alphabet.forEach(function(letter){\r\n printLetter(letter);\r\n });\r\n\r\n**Edit:** Please do **not** downvote answers without leaving a comment explaining why it is a poor answer.\r\n\r\n**Edit 2:** A good solution will not forcefully space out each call by 100ms. This makes the minimum run time 1second for 10 calls - when you could in fact do these (nearly) simultaneously and potentially complete in a fraction of a second.", "199" ], [ "I&#39;m using React Router to do routing for my react app. \r\n\r\nOn some pages, I want the entirety of the page to have a particular background color. There are a few ways of doing this, but a simple one is to apply a class + CSS to the HTML element. \r\n\r\nHow can I do this?\r\n\r\n**index.html**\r\n\r\n < head > \r\n < title > My Site < /title > \r\n < link rel= \" ;stylesheet \" ; href= \" ;style.css \" ; > \r\n < /head > \r\n < body > \r\n < div class= \" ;container \" ; > \r\n < /div > \r\n < /body > \r\n < script src= \" ;main.js \" ; > < /script > \r\n\r\n**app.jsx**\r\n\r\n var React = require(&#39;react&#39;);\r\n var Routes = require(&#39;./routes&#39;);\r\n \r\n React.render(Routes, document.querySelector(&#39;.container&#39;));\r\n\r\n**routes.jsx**\r\n\r\n var React = require(&#39;react&#39;);\r\n var ReactRouter = require(&#39;react-router&#39;);\r\n var HashHistory = require(&#39;react-router/lib/HashHistory&#39;).default;\r\n var Router = ReactRouter.Router;\r\n var Route = ReactRouter.Route;\r\n \r\n var LandingPage = require(&#39;./components/landing-page&#39;);\r\n var RegisterPage = require(&#39;./components/register-page&#39;);\r\n \r\n var routes = (\r\n < Router history={new HashHistory} > \r\n < Route path= \" ;/ \" ; component={LandingPage} > < /Route > \r\n < Route path= \" ;/register \" ; component={RegisterPage} / > \r\n < /Router > \r\n )\r\n \r\n module.exports = routes;", "357" ], [ "I have a web application that gets & stores some data through a Rails API.\r\n\r\nWhen I try to \" ;post \" ; to the Rails API, I get an error `ActionController<IP_ADDRESS>InvalidAuthenticityToken`. I know one option is to simply disable the authenticity token requirement on my Rails controller.\r\n\r\nIs it possible to have my web app providing a correct authenticity token when it calls the Rails API? How can I do this?", "623" ], [ "In my React app, when a user logs in, their user data is set to `UserStore.currentUser`. How should components access `UserStore.currentUser`?\r\n\r\nIt seems there are 4 options for a component to access this data. Which (if any) is correct?\r\n\r\n**Option 1: Set it to a component&#39;s \" ;state \" ;**\r\n\r\n var ProfilePicture = React.createClass({\r\n getInitialState: function(){\r\n return {\r\n currentUser: UserStore.currentUser\r\n }\r\n },\r\n render: function(){\r\n return < h1 > Hi my name is {_URL_0_} < /h1 > ;\r\n }\r\n });\r\n\r\n**Option 2: Access the store&#39;s property directly**\r\n\r\n var ProfilePicture = React.createClass({\r\n render: function(){\r\n return < h1 > Hi my name is {_URL_1_} < /h1 > ;\r\n }\r\n });\r\n\r\n**Option 3: Access the store&#39;s property through a getter method**\r\n\r\n var ProfilePicture = React.createClass({\r\n render: function(){\r\n return < h1 > Hi my name is {UserStore.getCurrentUser().name} < /h1 > ;\r\n }\r\n });\r\n\r\n**Option 4: Set currentUser in the root component&#39;s state. Pass as a prop to all others**\r\n\r\n var App = React.createClass({\r\n getInitialState: function(){\r\n return { currentUser: UserStore.currentUser };\r\n },\r\n render: function(){\r\n return < div > \r\n < ThingA / > \r\n < ThingB / > \r\n < ProfilePicture userName={_URL_2_} / > \r\n < /div > ;\r\n }\r\n });\r\n\r\n var ProfilePicture = React.createClass({\r\n render: function(){\r\n return < h1 > Hi my name is {this.props.userName} < /h1 > ;\r\n }\r\n });", "530" ], [ "How can I create a specific JSON object from some HTML?\r\n\r\n**Example**\r\n\r\nThis is very well formatted [HTML page][1] (rendered from markdown). I want to create a JSON representation of the sections on the page. \r\n\r\nSo each \" ;h2 \" ; is a title. Each h3, h4, or h5, that follows it is a subtitle\r\n\r\n**Given this HTML:**\r\n\r\n < h2 > < a href= \" ;#charts \" ; > Charts < /a > < /h2 > \r\n < ul > ... < /ul > \r\n < h5 > < a href= \" ;#third-party \" ; > Third Party < /a > < /h5 > \r\n < ul > ... < /ul > \r\n < h5 > < a href= \" ;#reusable-chart-frameworks \" ; > Reusable Chart Frameworks < /a > < /h5 > \r\n < ul > ... < /ul > \r\n < h2 > < a href= \" ;#maps \" ; > Maps < /a > < /h2 > \r\n < h5 > < a href= \" ;#third-party-1 \" ; > Third Party < /h5 > \r\n ...\r\n\r\n**Return this JSON:**\r\n\r\n [\r\n {\r\n \" ;title \" ;: {\r\n \" ;text \" ;: \" ;Charts \" ;,\r\n \" ;href \" ;: \" ;#charts \" ;\r\n }\r\n \" ;subtitles \" ;: [\r\n {\r\n \" ;text \" ;: \" ;Third Party \" ;,\r\n \" ;href \" ;: \" ;#third-party \" ;\r\n },\r\n {\r\n \" ;text \" ;: \" ;Reusable Chart Frameworks \" ;,\r\n \" ;href \" ;: \" ;#reusable-chart-frameworks \" ;\r\n }\r\n ]\r\n },\r\n {\r\n \" ;title \" ;: {\r\n \" ;text \" ;: \" ;Maps \" ;,\r\n \" ;href \" ;: \" ;#maps \" ;\r\n },\r\n \" ;subtitles \" ;: ]\r\n \" ;text \" ;: \" ;Third Party \" ;,\r\n \" ;href \" ;: \" ;#third-party-1 \" ;\r\n ]\r\n },\r\n ...\r\n ]\r\n\r\n [1]: _URL_0_\r\n\r\n**Solutions I&#39;ve considered**\r\n\r\nSeems like something jQuery could help a lot with. If the items were nested it would be very easy to do `$(&#39;h2&#39;).each(...)` and just loop through each section, appending it to my JSON object. However there is no nesting here, just siblings. Any ideas?", "8" ], [ "Here&#39;s a solution that just relies on jQuery&#39;s `.nextUntil()` function.\r\n\r\n var sections = [];\r\n \r\n var eTitles = $(&#39;article&#39;).find(&#39;h2&#39;);\r\n \r\n $(eTitles).each(function(){\r\n var section = {\r\n \" ;title \" ;: {\r\n \" ;text \" ;: $(this).text(),\r\n \" ;href \" ;: $(this).find(&#39;a&#39;).attr(&#39;href&#39;)\r\n },\r\n \" ;subtitles \" ;: []\r\n }\r\n \r\n var eSubtitles = $(this).nextUntil(&#39;h2&#39;).filter(&#39;h3, h4, h5&#39;);\r\n \r\n $(eSubtitles).each(function(){\r\n var subtitle = {\r\n \" ;text \" ;: $(this).text(),\r\n \" ;href \" ;: $(this).find(&#39;a&#39;).attr(&#39;href&#39;)\r\n }\r\n \r\n section.subtitles.push(subtitle);\r\n });\r\n \r\n sections.push(section);\r\n });", "993" ], [ "How can I update redux&#39;s state from a text input?\r\n\r\nI&#39;m trying to do a very simple \" ;Hello World \" ; with a text input. When someone types into the text input, it should update my store&#39;s \" ;searchTerm \" ; value.\r\n\r\nI can&#39;t figure out these things:\r\n 1. How can I get and pass the input&#39;s value into it&#39;s \" ;onChange \" ; handler?\r\n 2. The \" ;search \" ; action seems to be called correctly, but my reducer function is never used (no console.log). \r\n\r\n**SearchForm.js** (component)\r\n\r\n import React, {Component, PropTypes} from &#39;react&#39;;\r\n import {bindActionCreators} from &#39;redux&#39;;\r\n import {connect} from &#39;react-redux&#39;;\r\n import {search} from &#39;redux/modules/search-term&#39;;\r\n \r\n @connect(\r\n null,\r\n dispatch = > bindActionCreators({ search }, dispatch)\r\n )\r\n \r\n export default class SearchForm extends Component {\r\n static propTypes = {\r\n search: PropTypes.func.isRequired,\r\n }\r\n \r\n render() {\r\n return (\r\n < input type= \" ;text \" ; placeholder= \" ;Search \" ; onChange={search} / > \r\n );\r\n }\r\n }\r\n\r\n**search-term.js** (action & reducer)\r\n\r\n const SEARCH = &#39;redux-example/repo-filter/SEARCH&#39;;\r\n \r\n const initialState = {\r\n searchTerm: null\r\n };\r\n \r\n export default function reducer(state = initialState, action = {}) {\r\n console.log( \" ;reducing \" ;);\r\n\r\n switch (action.type) {\r\n case SEARCH:\r\n return {\r\n searchTerm: action.term\r\n };\r\n default:\r\n return state;\r\n }\r\n }\r\n \r\n export function search(term) {\r\n return {\r\n type: SEARCH,\r\n term\r\n };\r\n }\r\n\r\n**reducer.js**\r\n\r\n import { combineReducers } from &#39;redux&#39;;\r\n import multireducer from &#39;multireducer&#39;;\r\n import { routerStateReducer } from &#39;redux-router&#39;;\r\n \r\n import search from &#39;./search-term&#39;;\r\n \r\n export default combineReducers({\r\n router: routerStateReducer,\r\n search\r\n });", "530" ], [ "I&#39;m able to get an input to update my redux store onChange if I explicitly write out the dispatch function. Why does it stop working when I try to use `bindActionCreators()`?\r\n\r\n**not using bindActionCreators** (this works)\r\n\r\n @connect(\r\n state = > ({}),\r\n dispatch = > {\r\n return {\r\n onSearchChange: (term) = > {\r\n dispatch(search(term));\r\n }\r\n };\r\n }\r\n )\r\n\r\n export default class SearchForm extends Component {\r\n render() {\r\n return (\r\n < input type= \" ;text \" ; onChange={(event) = > onSearchChange(event.target.value)} / > \r\n );\r\n }\r\n }\r\n\r\n\r\n**using bindActionCreators** (this does not work. It never dispatches the action)\r\n\r\n @connect(\r\n state = > ({ categories: state.categories.data }),\r\n dispatch = > bindActionCreators({search}, dispatch)\r\n );\r\n\r\n export default class SearchForm extends Component {\r\n render() {\r\n return (\r\n < input type= \" ;text \" ; onChange={(event) = > search(event.target.value)} / > \r\n );\r\n }\r\n }", "530" ], [ "Thanks <PERSON>, this works! Do you know the correct way to set \" ;search \" ; to a constant in the render function? I&#39;ve seen people do things like `const { categories, search } = this.props;` but that triggers the error ` \" ;search \" ; is already declared in the upper scope` since I also have `import {search} from &#39;redux/modules/repo-search&#39;;` at the top of the file.", "530" ], [ "I have a string of HTML. I want to take every h1, h2, h3 in it, and wrap it a component called ` < TitleWrapper / > `.\r\n\r\nHow can I do this?\r\n\r\n**Example**\r\n\r\nIt&#39;s a strange request so here&#39;s why it&#39;s hard. I&#39;m turning markdown into HTML, which gives me an HTML string. [Here][1] is an example of some of the markdown I&#39;m using.\r\n\r\nRight now I&#39;m using [Marked][2] to translate markdown into HTML. It has a function called `marked()` which just returns an HTML string. \r\n\r\n\r\n import marked from &#39;marked&#39;;\r\n \r\n export default class TranslatedMarkdown extends Component {\r\n render() {\r\n < div dangerouslySetInnerHTML={{__html: marked(this.props.myMarkdown)}} / > \r\n }\r\n }\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "470" ], [ "Given this HTML as a string \" ;html \" ;, how can I split it into an array where each header ` < h` marks the start of an element?\r\n\r\n**Begin with this:**\r\n\r\n < h1 > A < /h1 > \r\n < h2 > B < /h2 > \r\n < p > <PERSON> < /p > \r\n < h3 > C < /h3 > \r\n\r\n\r\n\r\n**Result**: \r\n\r\n [ \" ; < h1 > A < /h1 > \" ;, \" ; < h2 > B < /h2 > < p > <PERSON> < /p > \" ;, \" ; < h3 > C < /h3 > \" ;]\r\n\r\n**What I&#39;ve tried:**\r\n\r\nI wanted to use `Array.split()` with a regex, but the result splits each ` < h` into its own element. I need to figure out how to capture from the start of one ` < h` until the next ` < h`. Then include the first one but exclude the second one.\r\n\r\n var html = &#39; < h1 > A < /h1 > < h2 > B < /h2 > < p > Foobar < /p > < h3 > C < /h3 > &#39;;\r\n var foo = html.split(/( < h)/);\r\n\r\n**Edit**: Regex is not a requirement in anyway, it&#39;s just the only solution that I thought would work for generally splitting HTML strings in this way.", "349" ], [ "Ok, I&#39;m taking dynamic markdown that I&#39;m scraping from GitHub. Then I want to render it to HTML, but wrap every title element in a ReactJS ` < WayPoint > ` component. The most efficient way I can think of to do this is get the markdown, translate it to HTML string, split it, then map over it wrap it with the container. But that is a super specific question, and the generalizable question that I couldn&#39;t find an answer to is \" ;split a string with inclusion and exclusion in javascript \" ;. But I think the answer is just regex, unless you see something else.", "417" ], [ "What is the difference between these import methods?\r\n\r\nMethod 1:\r\n\r\n import {sum, pi} from \" ;lib/math \" ;;\r\n\r\nMethod 2:\r\n\r\n import exp, {pi, e} from \" ;lib/mathplusplus \" ;;\r\n\r\nThe es2015 docs showed these two examples, and I can&#39;t figure out the purpose of the curly braces. It seems like all of the things listed after import will be assigned to the `window` object anyway.\r\n\r\nDocs for reference: _URL_0_", "277" ], [ "I was showing a really basic Hello World with React and ReactDOM when I got a strange error `Uncaught TypeError: inst.render is not a function`. See it in this [JSBin][1].\r\n\r\nI&#39;ve used React a lot, but new to ES6. Any ideas what I&#39;m not seeing here?\r\n\r\nThe error seems to be saying that `Hello` does not have a `render` method, but I&#39;m not sure.\r\n\r\n < !DOCTYPE html > \r\n < html > \r\n < head > \r\n < meta charset= \" ;utf-8 \" ; > \r\n < title > JS Bin < /title > \r\n < script src= \" ;\r\n _URL_1_; type= \" ;text/javascript \" ; > < /script > \r\n < script src= \" ;_URL_0_;\r\n < script src= \" ;_URL_3_;\r\n < /head > \r\n < body > \r\n < div id= \" ;root \" ; > < /div > \r\n \r\n < script > \r\n const Hello = () = > {\r\n < h1 > Hi < /h1 > \r\n };\r\n \r\n const foo = () = > {\r\n ReactDOM.render(\r\n < Hello / > ,\r\n document.getElementById(&#39;root&#39;)\r\n ); \r\n }\r\n \r\n foo();\r\n < /script > \r\n < /body > \r\n < /html > \r\n\r\n\r\n [1]: _URL_2_", "530" ] ]
399
[ 15013, 9724, 4726, 2836, 12184, 1489, 14169, 3781, 16418, 4139, 13808, 13255, 18819, 16844, 1423, 10638, 5427, 15305, 3940, 2799, 13853, 10262, 2462, 7032, 4008, 17922, 6934, 15471, 529, 11055, 12456, 2557, 16810, 7664, 18534, 10198, 8676, 16436, 5999, 2331, 3722, 6991, 143, 1877, 12637, 16180, 3768, 11450, 9635, 18733, 6168, 9298, 7805, 4090, 11632, 7717, 3735, 18728, 1414, 12574, 8783, 8613, 16837, 15922, 3958, 14056, 2640, 18549, 18756, 12639, 3973, 17942, 11309, 16244, 15950, 12710, 17375, 15168, 11002, 13368, 9278, 11251, 15391, 4074, 16658, 978, 16173, 13175, 650, 1142, 16668, 10900, 4329, 648, 1573, 19684, 4007, 16858, 5250, 17582, 11349, 2544, 17983, 13655, 6531, 9359, 17338, 16022, 5129, 19372, 4330, 11786, 907, 9366, 914, 10341, 3665, 43, 626, 13737, 1638, 8379, 15345, 471, 7551, 9010, 10161, 5345, 5776, 11669, 3936, 10526, 17655, 2847, 15774, 13854, 8409, 3143, 4178, 7661, 14117, 10568, 5053, 12975, 15319, 17367, 14211, 839, 6914, 1740, 2169, 15580, 6341, 16492, 19751, 19174, 11163, 4275, 935, 498, 387, 3096, 12765, 8032, 12794, 2827, 15746, 10586, 8917, 17753, 8951, 16841, 18908, 1027, 12082, 12937, 6356, 8883, 3941, 10033, 16630, 14615, 4526, 13654, 5759, 19522, 4380, 3114, 4070, 820, 18665, 16509, 11178, 6258, 3562, 3108, 18348, 4621, 8131, 13333, 13338, 675, 6403, 8250, 3080, 11407, 11151, 10854, 956, 7732, 6999, 12949, 4355, 12655, 8068, 12270, 7677, 10449, 9991, 16468, 11667, 6667, 17188, 7880, 1209, 5773, 15974, 4833, 4097, 6630, 4034, 13190, 8499, 1054, 17337, 4401, 17327, 11214, 17328, 266, 7443, 3630, 12965, 7720, 9253, 18103, 19488, 2206, 6027, 3125, 1618, 5790, 7385, 5114, 16285, 9040, 10096, 4707, 3405, 981, 18876, 16899, 16092, 8862, 7194, 10720, 12261, 5640, 2895, 9525, 11660, 16058, 17725, 2792, 13295, 275, 15122, 13589, 13348, 17270, 2296, 7498, 12534, 12095, 13681, 6207, 11924, 4967, 5866, 16634, 3531, 3310, 3954, 4113, 18068, 8050, 12114, 18678, 3650, 16949, 12928, 10833, 19508, 18111, 6606, 11256, 13692, 10504, 15014, 17772, 15453, 7842, 57, 7927, 8741, 17373, 2059, 15467, 3274, 374, 12442, 6061, 8751, 639, 211, 9734, 14078, 8251, 7797, 13660, 18194, 18414, 553, 7998, 1356, 10424, 9417, 17426, 19291, 1320, 3898, 10216, 8930, 6786, 9992, 8819, 8496, 17616, 18244, 19685, 9323, 5891, 3540, 14804, 16992, 13294, 10989, 9639, 6188, 19749, 15658, 8156, 18858, 878, 15685, 14502, 4812, 6609, 4269, 5035, 8218, 16144, 16126, 11571, 9208, 15042, 3091, 12862, 5825, 15943, 17302, 15380, 2164, 7955, 4823, 12384, 13560, 18591, 10436, 11126, 2774, 1933, 6129, 15849, 3812, 12485, 5636, 9406, 18326, 18135, 5823, 5256, 2134, 14324, 16386, 17574, 18275, 1881, 6347, 3293, 574, 10136, 18513, 6778, 16367, 298, 2644, 12288, 2474, 8223, 8486, 17659, 14540, 2669, 18321, 7145, 18407, 6621, 17890, 967, 3787, 18209, 4801, 9292, 11567, 19692, 13474, 16319, 7515, 12797, 19215, 963, 2189, 5233, 7784, 6009, 14895, 7361, 16102, 9269, 10729, 1446, 13820, 778, 5615, 5459, 10225, 7140, 3253, 3484, 5432, 11542, 16895, 6310, 4886, 2052, 15127, 19463, 19341, 12443, 2715, 11713, 19570, 11411, 2121, 6795, 12562, 1139, 5487, 6019, 2349, 3337, 18854, 5455, 14524, 17743, 6437, 14290, 12591, 5235, 6860, 7033, 5715, 4225, 982, 4631, 4873, 8106, 1793 ]
STX_10021.0
[ [ "Um I was responding to the OP... but anyway, I&#39;m not sure I understand your definition. A relative clause is simply a clause that modifies a noun and restricts its referents in some way. That&#39;s the definition adopted in <PERSON> and <PERSON> (1977) and it&#39;s successful, so I think it should be stuck to in general. I think your definition would exclude Mandarin subject relative clauses and object relative clauses without a resumptive pronoun, for example.", "868" ], [ "@BillJ H & P&#39;s definition surely works for English, but the OP opened the post with &#39;relative clauses...&#39; rather than &#39;relative clauses in English...&#39;, so I figured it would be interesting and helpful to point out that RCs work differently in other languages. Do you know of any sources other than H & P that use the definition? The one I provided is the one I was taught as well as the only one I&#39;ve seen in the literature (outside of H & P). (Not challenging you or anything, but H & P don&#39;t have in-text citations so I&#39;m genuinely asking.)", "69" ], [ "You mentioned that non-finite clauses can also modify nouns. Do you mean phrases like &#39;the person trying to understand relative clauses&#39;? I think that would count as an RC; Giv&#243;n counts it, for example. As for the other two kinds of subordinate finite clauses, I might be missing something but I think this can be handled by the &#39;noun&#39; part, since the other kinds of subordinate clause modify entire clauses or serve as complements to verbs etc.", "868" ], [ "The similarity is due to a common pathway of grammaticalistion. The *have* + past participle form comes from a resultative construction (Bybee, Perkins and Pagliuca, 1994), which commonly leads to the perfect. Note that <PERSON> et al. do not use the term *resultative* in the usual complex-predicate sense, but use it to mean sentences like &#39;The door is opened&#39;, whereby a past action leads to a present state.\r\n\r\nThe English have + past participle construction comes from sentences like (1), where *have* was still possessive and the participle agreed with the object in number, case and gender:\r\n\r\n (1) Ic haefde hine gebundenne.\r\n I had him bound\r\n I had him in a state of being bound. (<PERSON> 1972, cited in <PERSON> et al.)\r\n\r\nThis construction later became the perfect, which asserts that a past action has effect on the present - a similar meaning to the resultative. The participle now no longer agrees with the object and the auxiliary and partiicple should usually be adjacent.\r\n\r\nIn the Romance case, the resultative was already present in Vulgar Latin, both in have + participle form and in participle + have form:\r\n\r\n (2) Metuo enim ne ibi vos habebam fatigatos.\r\n Fear.1sg for lest there you have-IMPF-I SG tired\r\n &#39;For I fear that I have tired you.&#39;\r\n (early fifth century, <PERSON>; <PERSON> 1982, cited in <PERSON> and <PERSON> )\r\n\r\n (3) in ea provincia pecunias magnas collocatas habent\r\n in that province capital great invested have.3pl\r\n They have great capital invested in that province. \r\n\r\nAgain, the construction became the perfect (and, in modern French, the past perfective). It lost the object agreement, spread to all dynamic verbs (not just change-of-state), and the have + participle form was the only form that survived in languages like French.\r\n\r\nThere is sufficient semantic similarity between the resultative and the perfect - described by <PERSON> thus: &#39;the present auxiliary conveys the present meaning, while the past participle conveys that of past action&#39; - and this would explain why both Germanic and Romance languages developed this form.\r\n\r\nSources:\r\n\r\n<PERSON>, <PERSON>, <PERSON>, R. D., & <PERSON>, W. (1994). *The evolution of grammar: Tense, aspect, and modality in the languages of the world* (Vol. 196). Chicago: University of Chicago Press.\r\n\r\n<PERSON>, B. (1976). Aspect: An introduction to the study of verbal aspect and related problems (Vol. 2). Cambridge university press.\r\n\r\n<PERSON>, <PERSON>, & <PERSON>, E. C. (2003). *Grammaticalization*. Cambridge University Press.", "943" ], [ "My guess is that the reason is diachronic rather than synchronic. We know that we have sentences like &#39;For you to depart would be sad&#39; came about because sentences like &#39;It would be [sad [for you] [to depart]]&#39; were reanalysed as &#39;It would be [sad [for [you to depart]]]&#39;. Probably the same happened here: &#39;I saw [him] [eating the cake]&#39; became &#39;I saw [him eating the cake]&#39; and hence &#39;[Him eating the cake] is something I saw&#39; became an acceptable sentence.", "536" ], [ "@Morphosyntax I think you misunderstood my point slightly... As I said, my proposal was diachronic, not synchronic; I don&#39;t mean to imply any synchronic transformational rules. What I meant was that after patterns like &#39;him eating the cake&#39; appeared in postverbal position, English speakers reanalysed the whole &#39;accusative noun + participle phrase&#39; pattern as a possible way to nominalise clauses, and thus the pattern can now be used in other contexts requiring nominals as well.", "868" ], [ "Many complex predicates are historically derived from serial verb constructions. This is not only true of the Sinitic family. For example, in Saramaccan (<PERSON> 1987, as cited in Giv&#243;n 2009):\r\n\r\n (1) a bi-fefi di-wosu kaba.\r\n he TNS-paint the-house finish\r\n He finished painting the house.\r\n\r\nHowever, the Chinese constructions are more innovative in that the object has been moved to the end of the sentence, for the most part. Yet in most dialects of modern Chinese except Mandarin, complex predicates also sometimes preserve the older V + O + C order similar to the Saramaccan example in (1). This is most common in negative clauses. (The C is what is traditionally termed a *complement* in Chinese linguistics, but it&#39;s more like a *satellite* in Talmy&#39;s sense, and is developed from the &#39;lighter&#39; verb of an asymmetric serial verb construction). An example from Cantonese is (2):\r\n\r\n (2) nei wan ngo m dou\r\n you find me NEG arrive\r\n You cannot find me.\r\n\r\nMy question: I know negative clauses are more conservative in general, but are there specific cases outside the Sinitic branch where object placement in complex predicates is more conservative in negative clauses? Thanks!\r\n\r\nGiv&#243;n, T. (2009). *The genesis of syntactic complexity: Diachrony, ontogeny, neuro-cognition, evolution*. John Benjamins Publishing.", "868" ], [ "I assume these are your hypotheses:\r\n\r\nH0: The verb is passive 92% of the time.\r\n\r\nH1: The verb is passive 100% of the time.\r\n\r\nYou can&#39;t apply a t-test in this case; there&#39;s no t-statistic that can be generated. (Typically, when we apply a t-test, it&#39;s when we have some point estimate of a variable assumed normal minus the mean under the null hypothesis divided by the standard error, for example in the two-sample t-test or when we test hypothesis about simple linear regression.)\r\n\r\nInstead, the p-value is simply 0.92^n, since the p-value is the probability that you get the data you have given the null hypothesis (which, in this case, is that the verb is passive 92% pf the time).\r\n\r\nFor a verb with two passive forms, the p-value is 0.92^2 = 0.8464, obviously insignificant.\r\n\r\nFor a verb with sixteen passive forms, the p-value is 0.92^16 = 0.26339, still not significant.\r\n\r\nAt alpha = 0.05, to conclude that a form is deponent, you need log 0.05 / log 0.92, or approximately 36 passive forms; at alpha = 0.1, you need 28.", "718" ], [ "@BillJ Out of curiosity, why don&#39;t you consider &#39;grandfather clock&#39; as a compound? Semantically, they don&#39;t seem to have anything to do with grandfathers, so in this regard it seems more like &#39;black bird&#39; than &#39;blackbird&#39;. Phonologically, it seems ambiguous: Brits pronounce it as grandfather CLOCK (suggesting it&#39;s not a compound) but Americans pronounce it as GRANDfather clock (which seems to suggest it&#39;s a compound), according to the CEPD.", "171" ], [ "<PERSON> (1921) is the more commonly cited source about this issue, and he sets up two typologies\r\n\r\n- Analytic/Synthetic/Polysynthetic: These refer to the degree to which different parts of a sentence are fused together to form single words.\r\n\r\n- Isolating/Affixal(Agglutinative+Fusional)/Symbolic: These refer to the **techniques** used for encoding grammatical information. From <PERSON>:\r\n\r\n > Those languages that always identify the word with the radical element would be set off as an “**isolating**” group against such as either affix modifying elements (**affixing** languages) or possess the power to change the significance of the radical element by internal changes (reduplication; vocalic and consonantal change; changes in quantity, stress, and pitch). The latter type might be not inaptly termed “**symbolic**” languages. ... We may designate the two types of affixing as “**fusing**” and “juxtaposing.” The juxtaposing technique we may call an “**agglutinative**” one, if we like.\r\n\r\nSo French is considered an analytic language because various parts of the sentences are cut up into words, but it is also considered a fusional language (not an isolating language!) because we use fusional affixes (e.g. ils chant-ent, 3pl sing-3spl) to express information. Mandarin is both isolating and analytic.\r\n\r\nHowever, note that in recent years, there is less focus on putting languages into (somewhat arbitrary) macro categories like these, and instead there is more interest in looking at the typology of particular constructions, so one hears quite frequently about the analyticity and syntheticity of particular constructions.", "133" ], [ "Actually I do have the Greenbergian tradition in mind, and I actually think the Greenbergian and OT traditions are fairly similar in spirit (<PERSON> for example has expressed a preference for OT over traditional generative grammar) the main differences being that Greenbergians approach explanation from a diachronic perspective whereas OT & co. are strictly synchronic, and that Greenbergians tend to reduce phonology and morphosyntax to phonetics, semantics and pragmatics, whereas &#39;generative typologists&#39; tend to reduce them to more abstract concepts.", "133" ], [ "When a user comes to _URL_1_ with an etymology question about a word or words that can be traced back to a language with a major written tradition like Sanskrit, Greek or Latin (say), it seems that some users tend to close the question as off-topic as they are more philological than they are linguistic, while others tend not to (as they edit the question without voting to close).\r\n\r\nIntuitively, I agree that such questions do not seem to be particularly linguistic, as they are more likely to be studied in departments like classics or area studies, rather than linguistics departments. However, I often have doubts as to whether I should vote to close these questions. This is because if someone were to ask for the etymology of a word from an &#39;exotic&#39; language family or branch such as Pama-Nyungan, Algonquian, Gur or Polynesian, etc., my intuition would be to accept such a question (even though I&#39;ve never seen such questions here myself). This is because linguists in linguistics departments do study etymology in these languages.\r\n\r\nAnother possible reason for rejecting etymology questions is that they aren&#39;t useful for other visitors to the site. But while syntax trees and language identification clearly fall into this category, etymology seems less clear-cut. It could well be that more than one person wants to know, say, the common origin of the different words for &#39;night&#39; in Indo-European languages.\r\n\r\nAnd finally, I found this in the [FAQs](_URL_0_), listed among the acceptable question types:\r\n\r\n* a single word in relation to multiple languages or a single word/single language\r\n\r\nDoes this imply that etymology questions should ordinarily be acceptable?", "369" ], [ "In general, it seems that formal language theory questions (uncommon as they are on the site) tend *not* to be closed down, although I have seen users vote to close such questions (unfortunately I do not recall which questions it was).\r\n\r\nPersonally I think that in general, formal language theory questions (say, questions about reducing grammar to <PERSON> normal form, or the pumping thingy) do not belong on this SE unless they are applied to natural languages in some way.\r\n\r\nFirstly, [theoretical computer science](_URL_0_) folks should be in a better position to answer such questions than linguists anyway. Since cross-posting is discouraged, it would benefit the asker to ask at CS theory, rather than here.\r\n\r\nSecondly, linguistics is the empirical study of *natural* language. While formal languages are sometimes used to model natural languages, they are not themselves part of linguistics any more than <PERSON> chains or information theory, even though the former has wide applications in computational linguistics and the latter in corpus and functional linguistics.\r\n\r\nDo you agree that formal language theory should be off-topic on this site?", "369" ], [ "If I understand you correctly, you mean that we shouldn&#39;t impose a new rules to ban formal language theory questions, right? I agree that doing so would be a bit of an overkill, but I think it&#39;s still useful to try to reach community consensus on the acceptability of such questions, since right now it seems like a grey area that remain to be clarified.", "359" ], [ "However, what I had in mind when writing the OP was questions that were *purely* about formal language theory, which I feel is more akin to asking about, say, the theoretical derivation of the theorem about the PGFs of the number of states before the absorbing states of a <PERSON> process is reached. That would belong on Mathematics rather than Linguistics. As an analogy, calculus was initially invented to solve physical problems, but I don&#39;t think a question that is purely about (say) the Stieltjes integral, without reference to physical problems, would be on topic at Physics.", "133" ], [ "I see, thanks. I&#39;ve seen some of your other posts on the &#39;single language&#39; problem, and I agree that the minutia of historical change aren&#39;t inherently nonlinguistic. In fact, a while ago there was a question from the Area 51 guy which I thought was completely fine but still got downvotes and close votes. It was on what drove some kind of semantic change - he was explicitly asking for the semantic motivation behind such a change, which I think should be acceptable.", "133" ], [ "These are called multi-word expressions (MWEs). Before we put things into a POS tagger, we need to perform another process known as *tokenisation* to separate characters into words. This is especially important in Chinese, where there are no whitespaces at all, but is also needed in English, where strings surrounded by word boundaries (in the sense of regex) are not always words either.\r\n\r\nFor solutions, you can [search on Google scholar][1]; there is a huge literature on that. :)\r\n\r\n\r\n [1]: _URL_0_", "421" ], [ "In VerbNet, each frame has a semantic representation like this:\r\n\r\n > cause(Agent, E) manner(during(E), directed motion, Agent)\r\n > !contact(during(E), Agent, Patient) manner(end(E),forceful, Agent)\r\n > contact(end(E), Agent, Patient)\r\n\r\nI&#39;m looking for a reference that lists all the possible functions, parameters and values that are possible in VerbNet. I&#39;ve looked at the papers listed on the VerbNet publications page, but the ones I found that covered semantics didn&#39;t have any comprehensive list. I also saw [this](_URL_0_), but it only lists out all the possible values without explanation of how they fit into the &#39;argument structures&#39;, and indeed what the &#39;argument structures&#39; for each predicate are. Thanks!", "421" ], [ "I think it&#39;s worth noting that &#39;vowels are not as\r\nrelevant as consonants in the interpretation of lexical distinctions&#39; (Nespor, Pe&#241;a & Mehler, 2003). Apart from there being more consonants than vowels, consonants also tend to become more distinctive within a lexeme, while vowels tend to lose distinctiveness (vowel harmony, vowel reduction e.g. English schwas). Roots often consists of consonants alone, e.g. Semitic languages, whereas it&#39;s rare for roots to consist of vowels alone. Experimentally, it was famously demonstrated than when shown the word *kebra* and asked to change it to a real English word by altering a sound, people tend to say *cobra* instead of *zebra*, indicating that vowels are more easily changed in word recognition. All these imply that consonants play a greater role in identifying words, hence censoring just vowels will generally enhance recoverability.\r\n\r\n\r\nReferences\r\n\r\n<PERSON>, M., Pe&#241;a, M., & <PERSON>, J. (2003). On the different roles of vowels and consonants in speech processing and language acquisition. *Lingue e linguaggio*, 2(2), 203-230.", "202" ], [ "I&#39;m not familiar with Spanish, but TBH I don&#39;t think WALS can cover the core grammatical structure of *any* language. WALS only looks at grammatical phenomena that are of interest in cross-linguistic studies. There are many features of language that are largely historical accidents and aren&#39;t really interesting in a cross-linguistic perspective (e.g. preposition stranding in English), and therefore would not be coded for in WALS. If you&#39;d like to know about the grammar of Spanish, an actual grammar like those cited in WALS would be much better.", "133" ], [ "I&#39;m not familiar with Spanish, but to be honest, I don&#39;t think WALS can cover the core grammatical structure of *any* language. WALS only looks at grammatical phenomena that are of interest in cross-linguistic studies. There are many features of language that are largely historical accidents and aren&#39;t really interesting in a cross-linguistic perspective (e.g. preposition stranding in English), and therefore would not be coded for in WALS.\r\n\r\nBased on what I&#39;ve read about Spanish (admittedly not a lot), the Spanish subjunctive, for example, doesn&#39;t seem to be covered despite its importance.\r\n\r\nIf you&#39;d like to know about the grammar of Spanish, an actual grammar like those cited in WALS would be much better.", "133" ], [ "b) The point isn&#39;t whether morphology must occur across multiple characters/syllables. English -s doesn&#39;t constitute a syllable, and it&#39;s also morphology. The problem is that radicals and phonetic components aren&#39;t part of the spoken language. Written language is just a representation of spoken language, which is the focus of morphology. Literacy was not widespread until recent times, and people who spoke Chinese during all these years without knowledge of the writing system would not have knowledge of orthography and therefore of character-building concepts.", "133" ], [ "@jaam I&#39;m not sure phonological &#39;gaps&#39; are a good way to tell between words in general. For one thing, how many ms constitutes a gap? In English, we might pronounce phrases like &#39;which is a big deal&#39; as something like &#39;whi chi za big deal&#39; (resyllabification), but surely we don&#39;t want to use that as evidence that &#39;which is a&#39; are one word.", "133" ], [ "I don&#39;t speak Vietnamese and am not familiar with its structure, but many of the putative affixes and affixed words listed on that page sound a lot like they were loaned from Chinese. FWIW, I&#39;d consider most of their Chinese counterparts (半, 可, 反, 化, 非, 超, 家, 者, 學, 師), with the exceptions of 者 and 非, as lexical roots with which one can form compounds. 者 and 非 are functional morphemes (and have been unambiguously that way since Old Chinese as far as I can tell, though 非 could also be used lexically back then), but 者 at least is more like a functional word or clitic since it attaches to phrases.", "630" ], [ "@Zgialor: In ancient texts, the hanzi are largely one character, one word, so there wasn&#39;t much room for such wordplay (I can&#39;t think of any at the moment) - but there definitely was wordplay based on lack of *punctuation* (though still not as important as e.g. puns, which are of extreme importance in Chinese culture). In modern Chinese this kind of wordplay is more common; for example, the sentence 獅子山下體現香港精神 could mean &#39;Embodying the Hong Kong spirit in Lion Rock&#39;, or it could also mean... something inappropriate, depending on whether you segment the words as [下][體現] or [下體][現].", "630" ], [ "Thank you @ColeC1821 I did actually end up doing that, but it lead me to my overall resolution.... which was taking a small flat head screwdriver and grinding down the recessed area where the screws are mounted. I wish I had a precise measurement and process, but it was probably about 4mm of material shaven off and then the screws were finally able to reach the motor mounts. \n\nThis was all caused because of my lack of patience. QIDI was sending me replacement fans, but it was going to take two weeks to get to me. So I got a similar part, and the recessed depth was too shallow.", "368" ] ]
209
[ 9533, 16623, 15002, 13263, 12347, 17630, 3160, 15667, 8255, 2423, 13229, 5603, 7707, 18058, 8693, 17730, 2140, 7115, 3861, 4347, 13142, 9100, 5771, 3732, 6276, 2770, 5471, 2339, 4179, 13550, 19555, 786, 2967, 2472, 14952, 524, 3028, 19785, 6785, 16601, 7400, 15336, 6897, 5557, 4532, 12382, 10966, 5367, 4752, 9167, 16458, 5827, 1262, 550, 16712, 17822, 9407, 3686, 3838, 613, 4187, 953, 14886, 4783, 1171, 5960, 12268, 16708, 2773, 18041, 948, 5123, 1418, 4358, 8559, 13599, 3972, 10317, 3926, 7063, 5175, 14040, 3404, 18124, 8949, 8326, 2159, 1225, 19319, 6141, 19054, 822, 8560, 7350, 18848, 14048, 9574, 4226, 8244, 5968, 19177, 16200, 1604, 530, 11379, 876, 16934, 3406, 14744, 2397, 2853, 18677, 5519, 906, 19251, 13183, 13468, 4774, 7557, 7579, 17680, 2007, 13623, 17323, 1503, 949, 10273, 14355, 14129, 6946, 767, 3875, 19150, 992, 15579, 5122, 3947, 925, 17410, 15957, 19417, 4884, 11843, 17321, 18224, 3811, 14110, 58, 3267, 11570, 7118, 4389, 12430, 4033, 19043, 15497, 4544, 19311, 10584, 988, 2073, 11680, 1507, 7932, 4789, 14680, 500, 7636, 8825, 3796, 18433, 8913, 2685, 10470, 15699, 18727, 2765, 14390, 5856, 13933, 5176, 17357, 11377, 2208, 18039, 4614, 10272, 5105, 3347, 8429, 7734, 5619, 9535, 8916, 2941, 7665, 13355, 6617, 361, 2413, 7886, 11229, 9846, 1807, 19038, 19393, 3928, 18056, 16432, 8678, 9918, 10527, 2006, 13522, 868, 4068, 4106, 4898, 6452, 3694, 3506, 2485, 12223, 19544, 3466, 14276, 19398, 18817, 15438, 16466, 19374, 6593, 6581, 16558, 1792, 16474, 8344, 3488, 6127, 19315, 15854, 1701, 3826, 7593, 8249, 2207, 19406, 2793, 16309, 17047, 1709, 4503, 5218, 15550, 14492, 16373, 10115, 15142, 640, 5121, 13210, 13523, 2810, 739, 263, 10597, 9095, 6088, 7876, 4644, 710, 3621, 19295, 3880, 1640, 3939, 16489, 12487, 15934, 16585, 18396, 6335, 16191, 5806, 8263, 9961, 1360, 9431, 1041, 18998, 2418, 6484, 11177, 14170, 17608, 5940, 6183, 8573, 10879, 6275, 17944, 12340, 1800, 14345, 568, 602, 16390, 10202, 18844, 10075, 6175, 2689, 1802, 1827, 16152, 8238, 17924, 16287, 18365, 8089, 785, 15968, 11795, 8867, 6350, 15439, 5295, 4751, 2493, 13266, 3257, 10148, 6006, 10556, 7531, 5324, 10255, 4120, 5893, 14098, 1761, 15975, 7700, 1765, 3131, 14844, 5533, 16435, 6671, 2564, 2364, 8998, 8537, 11461, 7283, 19146, 11427, 811, 1205, 2619, 11308, 14595, 1865, 15913, 18527, 19361, 8781, 4888, 5664, 5152, 16554, 8276, 9975, 17808, 854, 8038, 18376, 18259, 2615, 9463, 15739, 5403, 657, 8440, 11635, 2612, 9600, 10536, 5779, 17698, 1393, 2395, 1891, 4142, 17884, 8784, 17697, 7251, 15647, 16308, 5621, 6913, 2445, 18541, 7374, 6354, 6081, 7894, 19426, 9287, 9401, 3307, 847, 8436, 19756, 1527, 14604, 3984, 15500, 6151, 16869, 2455, 12678, 15962, 18486, 9403, 12371, 16414, 15768, 3415, 3519, 2123, 4049, 7173, 4153, 12520, 1974, 497, 4513, 16321, 3620, 17050, 2311, 17276, 769, 494, 3232, 17356, 8692, 13008, 4348, 11580, 2883, 3408, 9439, 16833, 14505, 5824, 10511, 1876, 7798, 18431, 7084, 7622, 16495, 4272, 19507, 16788, 13117, 12300, 503, 8558, 5677, 6759, 15819, 9845, 1743, 8442, 8927, 5284, 968, 5006, 2254, 2306, 6181, 9775, 3312, 17945, 17722, 3839, 10734, 18631, 17787, 10284, 3214, 18714, 8725, 4212, 1851 ]
STX_10022295.0
[ [ "I am using devexpress and i want to set the selected gridview column visible = false, but i want that to appear on my csv as other name but with hyperlink on it after devexpress gridviewexporter download.\r\n\r\nhere is my code\r\n\r\n < dx:ASPxButton ID= \" ;FeedbackGridBut \" ; ClientIDMode= \" ;Static \" ; runat= \" ;server \" ; OnClick= \" ;FeedbackGridBut_Click \" ; Text= \" ;Download \" ; Image-Url= \" ;../images/excel.png \" ; > < /dx:ASPxButton > \r\n\r\n < dx:ASPxGridViewExporter GridViewID= \" ;FeedbackGrid \" ; ID= \" ;exportFeedbackGrid \" ; runat= \" ;server \" ; > < /dx:ASPxGridViewExporter > \r\n < dx:ASPxGridView ID= \" ;FeedbackGrid \" ; ClientIDMode= \" ;Static \" ; OnCustomUnboundColumnData= \" ;FeedbackGrid_CustomUnboundColumnData \" ; ClientInstanceName= \" ;FeedbackGrid \" ; runat= \" ;server \" ; AutoGenerateColumns= \" ;False \" ; CssClass= \" ;table table-striped \" ; SettingsPager-Mode= \" ;ShowAllRecords \" ; SettingsSearchPanel-Visible= \" ;True \" ; DataSourceID= \" ;FeedbackDatasource \" ; EnableCallBacks= \" ;true \" ; SettingsBehavior-ProcessSelectionChangedOnServer= \" ;true \" ; EnableRowsCache= \" ;False \" ; SettingsBehavior-AutoExpandAllGroups= \" ;true \" ; SettingsPopup-HeaderFilter-Height= \" ;400 \" ; > \r\n < Columns > \r\n < dx:GridViewDataTextColumn FieldName= \" ;sno \" ; Visible= \" ;false \" ; > \r\n < /dx:GridViewDataTextColumn > \r\n < /Columns > \r\n < /dx:ASPxGridView > \r\n\r\n_URL_0_\r\n\r\n Protected Sub FeedbackGridBut_Click(sender As Object, e As EventArgs)\r\n exportFeedbackGrid.WriteXlsToResponse()\r\n End Sub\r\n\r\n\r\nwhen i pressed the download all the column appeared except for the sno column, i dont want sno to appear on the webpage, i just want it to appear on the downloaded csv as other name as the sno value is too long and messy( for example: one of the value is asjdkgskfg-asdasd-asdasdasd) with hyperlink but it is not working.", "653" ], [ "I&#39;m using **[DevExpress](_URL_0_)** Gridview exporter **to export Gridview to CSV** and I wanted the `sno` field name&#39;s row data to become hyperlink and when I click on that it will show webpage of \r\n\r\n _URL_4_\r\n\r\nThe CSV is exported with hyperlink on `sno` field name but I have no idea on how to make it works as what I wanted.\r\n\r\nI have referred to this [site](_URL_0_Support/Center/Question/Details/Q555935/aspxgridview-export-excel-with-hyperlink-field-issue), but still the same outcome.\r\n\r\n**_URL_3_**\r\n\r\n < dx:ASPxGridViewExporter GridViewID= \" ;FeedbackGrid \" ; ID= \" ;exportFeedbackGrid \" ; onrenderbrick= \" ;exportFeedbackGrid_RenderBrick \" ; runat= \" ;server \" ; > \r\n < /dx:ASPxGridViewExporter > \r\n\r\n < dx:ASPxGridView ID= \" ;FeedbackGrid \" ; ClientIDMode= \" ;Static \" ; OnCustomUnboundColumnData= \" ;FeedbackGrid_CustomUnboundColumnData \" ; ClientInstanceName= \" ;FeedbackGrid \" ; runat= \" ;server \" ; AutoGenerateColumns= \" ;False \" ; > \r\n < Columns > \r\n < dx:GridViewDataHyperLinkColumn FieldName= \" ;sno \" ; Visible= \" ;false \" ; PropertiesHyperLinkEdit-NavigateUrlFormatString= \" ;Http://{0} \" ; > \r\n < /dx:GridViewDataHyperLinkColumn > \r\n < /Columns > < /dx:ASPxGridView > \r\n\r\n\r\n**_URL_1_** \r\n\r\n \r\n\r\n Protected Sub FeedbackGridBut_Click(sender As Object, e As EventArgs)\r\n \r\n FeedbackGrid.Columns( \" ;sno \" ;).Visible = True\r\n exportFeedbackGrid.WriteXlsToResponse()\r\n \r\n End Sub\r\n \r\n Protected Sub ExportFeedbackGrid_RenderBrick(sender As Object, e As ASPxGridViewExportRenderingEventArgs) Handles exportFeedbackGrid.RenderBrick\r\n \r\n Dim dataColumn As GridViewDataColumn = e.Column As GridViewDataColumn \r\n If Not e.RowType = GridViewRowType.Data And dataColumn Is Nothing Then\r\n e.TextValue = e.Value.ToString()\r\n End If\r\n \r\n End Sub\r\n\r\nanyone has idea on this?", "653" ], [ "I want my SQL to display the overdue count when the condition is the status name showed closed on the exact due date then the count will be set as 1. For example, on the due date, the status name only became closed.\r\n\r\n select \r\n category, COUNT(overdue) as overdue2 \r\n from \r\n (select \r\n Category, due,\r\n case when DATEDIFF(day, Due, SYSDATETIME()) = 0 then 1 \r\n else 0 \r\n end as overdue \r\n from \r\n FeedbackDetail \r\n where \r\n StatusName = &#39;Closed&#39; and \r\n FeedbackDatetime > = &#39;2018-01-01&#39;) a \r\n Group by \r\n Category\r\n\r\nMy expected result is to display the count where the statusname is closed on the exact due date time.\r\n\r\nAny idea on this?", "639" ], [ "I have encountered problem in writing case. If there is two hyphens in one text how can I write in sql server statement as a case expression? \r\n\r\nthe row value is as below:\r\n\r\n1. PA-PB-PC (2 hyphens)\r\n\r\n2. PA-PAC (1 hyphen)\r\n\r\nthe desired result will be something like this\r\n \r\n Case when (section text contains two hyphens) then isnull(parsename(replace\r\n (ResponsibleSection,&#39;-&#39;,&#39;.&#39;),2) else isnull(parsename(replace\r\n (ResponsibleSection,&#39;-&#39;,&#39;.&#39;),1) \r\n\r\nThis is my original problem code:-\r\n\r\n select ResponsibleSection = isnull(parsename(replace\r\n (ResponsibleSection,&#39;-&#39;,&#39;.&#39;),2),Section) from FeedbackOwnerSetting\r\n Group by ResponsibleSection\r\n\r\nAny idea on this?", "914" ], [ "I use devexpress gridview export to export excel to a folder, I am able to export the excel file but i have no idea how to export the excel file to a specific folder. Can anyone guide me on this?\r\n\r\nFor example this is the code to export my gridview xlsx and it works fine\r\n\r\n exportFeedbackGrid.WriteXlsToResponse()\r\n\r\nand i wanted my xlsx file to export to the e:\\filelocation, how can i achieve this? \r\n\r\n \r\n\r\n < dx:ASPxGridViewExporter GridViewID= \" ;FeedbackGrid \" ; ID= \" ;exportFeedbackGrid \" ; OnLoad= \" ;ExportTo \" ; runat = \" ;server \" ; > < /dx:ASPxGridViewExporter > \r\n\r\n Public Sub ExportTo(sender As Object, e As EventArgs)\r\n Dim stream As Stream = New FileStream( \" ;e:\\filelocation \" ;, FileMode.Create)\r\n exportFeedbackGrid.WriteXlsToResponse()\r\n \r\n End Sub", "674" ], [ "I wanted my outcome to be something like below, the initial null value in either hit1 or hit0n1 become 0, and when hit1 divide by 0 then the percentage will become 0%. \r\n\r\n Select CONVERT(varchar(10),ISNULL(a6.hit1*100,0)/NULLIF(a7.hit0n1, 0))+ &#39;%&#39;\r\n .........\r\n left join\r\n (select category,hit,COUNT(hit) as hit1 from(Select Category,UpdateTime,due,\r\n Case When UpdateTime < Due Then 1 Else 0 End As hit From FeedbackDetail Where StatusName =&#39;Closed&#39; and FeedbackDatetime > =DATEADD(day,-31, GETDATE())) a where hit = 1\r\n Group by category, hit) a6 On a1.Category = a6.Category \r\n \r\n left join\r\n (select category,COUNT(hit) as hit0n1 from ( Select Category,UpdateTime,due,\r\n Case when UpdateTime < Due then 1 else 0 end as hit From FeedbackDetail Where StatusName =&#39;Closed&#39; and FeedbackDatetime > =DATEADD(day,-31, GETDATE()) ) a \r\n Group by category)\r\n a7 on a1.Category = a7.Category\r\n\r\nExpected Outcome\r\n\r\n hit1 hit0n1 percentage\r\n _____ _______ ____________\r\n 5 0 0%\r\n 0 0 0%\r\n 3 10 33.3%\r\n\r\nbut my code display this instead :\r\n\r\n hit1 hit0n1 percentage\r\n _____ _______ ____________\r\n 5 null NULL\r\n 6 6 100%\r\n 3 10 33.3%\r\n\r\nthere is null value in hit0n1, i want to elimate the null value and at the same time i want to avoid 0 number.", "839" ], [ "I am facing problem in devexpress gridview display of data.I insert the data via c# to gridview, when i execute, it shows only first page of data and when i click second page and so on then it shows no data display.\r\n\r\nHere is the code:\r\n\r\n*web.config*\r\n\r\n < connectionStrings > \r\n < add name= \" ;cn \" ; connectionString= \" ;data source=xx;initial catalog=xx;user id=xx;password=xx; \" ; providerName= \" ;System.Data.SQLClient \" ;/ > < /connectionStrings > \r\n\r\n*webform.aspx*\r\n\r\n < dx:ASPxGridView ID= \" ;Grid \" ; runat= \" ;server \" ; CssClass= \" ;auto-style5 \" ; Width= \" ;888px \" ; > < /dx:ASPxGridView > \r\n\r\n*_URL_0_*\r\n \r\n\r\n\r\n using System;\r\n using System.Web.UI;\r\n using System.Data.SqlClient;\r\n using System.Configuration;\r\n using System.Data;\r\n \r\n public partial class WebForm1 : System.Web.UI.Page\r\n {\r\n \r\n DataTable dt = new DataTable();\r\n \r\n protected void Page_Load(object sender, EventArgs e)\r\n {\r\n if (!Page.IsPostBack)\r\n {\r\n ReadData();\r\n } \r\n }\r\n \r\n public void ReadData()\r\n {\r\n try\r\n {\r\n using (SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings[ \" ;cn \" ;].ConnectionString))\r\n {\r\n if (cn.State == System.Data.ConnectionState.Closed)\r\n {\r\n cn.Open();\r\n }\r\n using(SqlDataAdapter da= new SqlDataAdapter( \" ;Select RULETYPE,RULENAME,seqNo,SUM(CNT) as CNT,SUM(WFS_QTY) as QTY,(Select SUM(WFS_QTY) from RANK_DECISIVE where EQPtype = &#39;IASCAN&#39; and DATADATE = &#39;2018/06/12&#39;) as TTL_QTY From(Select t1.EQPID, t1.RULETYPE, t1.RULENAME, t1.CNT, t1.WFS_QTY, isNull(t2.rankingIndex, 999) as seqNo from(select a.EQPID, a.RULETYPE, a.RULENAME, a.CNT, a.WFS_QTY, b.ruleName as reportName from RANK_DECISIVE a, station b where a.EQPtype = &#39;IASCAN&#39; and a.DATADATE = &#39;2018/06/12&#39; and RULETYPE = &#39;HIGHWIP&#39; and a.EQPID = b.StationName) t1 left join rankingRule t2 on t1.reportName = t2.ReportName and t1.RULETYPE = t2.ruleName and t1.RULENAME = t2.reason) t3 Group by RULETYPE, RULENAME, seqNo \" ;, cn))\r\n {\r\n //Grid.PageIndex = newPageIndex;\r\n da.Fill(dt);\r\n Grid.DataSource = dt;\r\n Grid.DataBind();\r\n \r\n \r\n }\r\n }\r\n }\r\n catch(Exception ex)\r\n {\r\n Response.Write(ex.Message);\r\n \r\n }\r\n }", "653" ], [ "I tried the devexpress textbox outside the gridview table to search for data with EQPID but when i typed EQPID on textbox, the gridview table still remain the same.\r\n\r\nASPx\r\n\r\n < dx:ASPxTextBox ID= \" ;tb1 \" ; runat= \" ;server \" ; Width= \" ;170px \" ; OnTextChanged= \" ;ASPxTextBox1_TextChanged \" ; > \r\n < /dx:ASPxTextBox > \r\n\r\nC#\r\n\r\n protected void ASPxTextBox1_TextChanged(object sender, EventArgs e)\r\n {\r\n\r\n using (SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings[ \" ;cn \" ;].ConnectionString))\r\n {\r\n if (cn.State == System.Data.ConnectionState.Closed)\r\n {\r\n cn.Open();\r\n }\r\n using (SqlDataAdapter da = new SqlDataAdapter( \" ;Select EQPID,RULETYPE,RULENAME,seqNo,SUM(CNT) as CNT,SUM(WFS_QTY) as QTY,(Select SUM(WFS_QTY) from RANK_DECISIVE where EQPtype = &#39;IASCAN&#39; and DATADATE = &#39;2018/06/12&#39;) as TTL_QTY From(Select t1.EQPID, t1.RULETYPE, t1.RULENAME, t1.CNT, t1.WFS_QTY, isNull(t2.rankingIndex, 999) as seqNo from(select a.EQPID, a.RULETYPE, a.RULENAME, a.CNT, a.WFS_QTY, b.ruleName as reportName from RANK_DECISIVE a, station b where a.EQPtype = &#39;IASCAN&#39; and a.DATADATE = &#39;2018/06/12&#39; and a.EQPID = b.StationName) t1 left join rankingRule t2 on t1.reportName = t2.ReportName and t1.RULETYPE = t2.ruleName and t1.RULENAME = t2.reason) t3 Where EQPID LIKE (&#39;% \" ; + tb1.Text + \" ;%&#39;) Group by EQPID, RULETYPE, RULENAME, seqNo \" ;, cn))\r\n {\r\n da.Fill(dt);\r\n Grid.DataSource = dt;\r\n Grid.DataBind();\r\n }\r\n }\r\n }", "653" ], [ "Below is the issue which I have to resolve.\r\n\r\n\r\nBehavior Required:\r\nOn selecting an item from combobox, it activates the textbox to insert a value and the textbox value will be send to gridview. I want to seperate the textbox value into 2 different values and I require one textbox and gridview cod to read either of the text instead of both.\r\n\r\n \r\n where a.EQPTYPE LIKE &#39;% \" ;+tb1.Text+ \" ;%&#39; and EQPID LIKE &#39;% \" ;+tb1.Text+ \" ;%&#39;\r\n\r\nASPX Code:\r\n\r\n < dx:ASPxComboBox ID= \" ;box1 \" ; runat= \" ;server \" ; AutoPostBack= \" ;True \" ; OnSelectedIndexChanged= \" ;Kit_SelectedIndexChanged \" ; SelectedIndex= \" ;0 \" ; Caption= \" ;Selection : \" ; > \r\n < Items > \r\n < dx:ListEditItem Text = \" ;Selected Item \" ; Value= \" ;0 \" ; / > \r\n < dx:ListEditItem Text= \" ;EQPTYPE \" ; Value= \" ;1 \" ; / > \r\n < dx:ListEditItem Text= \" ;EQPID \" ; Value= \" ;2 \" ; / > \r\n < /Items > \r\n < /dx:ASPxComboBox > \r\n \r\n < dx:ASPxTextBox ID= \" ;tb1 \" ; runat= \" ;server \" ; Width= \" ;170px \" ; CssClass= \" ;auto-style6 \" ; > \r\n < /dx:ASPxTextBox > \r\n \r\n C# Code:\r\n \r\n protected void Kit_SelectedIndexChanged(object sender, EventArgs e)\r\n {\r\n \r\n if (box1.SelectedItem.Text == \" ;EQPTYPE \" ;)\r\n {\r\n tb1.Enabled = true;\r\n tb1.Text = String.Empty;\r\n }\r\n else if(box1.SelectedItem.Text == \" ;EQPID \" ;)\r\n {\r\n tb1.Enabled = true;\r\n tb1.Text = String.Empty;\r\n }\r\n else\r\n {\r\n tb1.Enabled = false;\r\n }\r\n }\r\n\r\nPlease guide, thank you!", "254" ], [ "Currently Im facing problem in importing csv file to devexpress gridview,When i execute the code, the following error showed `&#39;C:\\New folder\\QtimeAutomotiveByLot_new.csv&#39; is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.` and the filepath works perfectly fine on my side. my code is as follow, can anyone guide me on this?\r\n\r\n_URL_1_\r\n\r\n < dx:ASPxGridView ID= \" ;DetailGridx \" ; runat= \" ;server \" ; OnDataBinding= \" ;DetailGridx_DataBinding \" ; > \r\n \r\n_URL_0_\r\n\r\n Protected Sub DetailGridx_DataBinding(sender As Object, e As EventArgs)\r\n \r\n Dim dt1 As New DataTable()\r\n Dim csvFileFolder As String = \" ;C:\\New folder\\QtimeAutomotiveByLot_New.csv \" ;\r\n &#39;Dim csvFile As String = \" ;QtimeAutomotiveByLot_New.csv \" ;\r\n Dim strCon = \" ;Provider=Microsoft.Jet.OLEDB.4.0;Data Source= \" ; + csvFileFolder + \" ;;Extended Properties=&#39;Text;HDR=YES;IMEX=1;&#39;; \" ;\r\n Dim connx As New OleDbConnection(strCon)\r\n Dim adapter1 As New OleDbDataAdapter\r\n connx.Open()\r\n \r\n Dim sql As New OleDbCommand( \" ;Select * FROM [ \" ; + csvFileFolder + \" ;] \" ;, connx)\r\n \r\n adapter1.SelectCommand = sql\r\n \r\n adapter1.Fill(dt1)\r\n \r\n connx.Close()\r\n \r\n Dim detailGrid As ASPxGridView = CType(sender, ASPxGridView)\r\n Dim RowLotID As String = TryCast(sender, ASPxGridView).GetMasterRowFieldValues( \" ;LOTID \" ;)\r\n Dim ddata As DataView = New DataView(dt1)\r\n ddata.RowFilter = \" ;LOTID = &#39; \" ; + RowLotID + \" ;&#39; \" ;\r\n detailGrid.DataSource = ddata\r\n detailGrid.DataBind()\r\n \r\n End Sub", "716" ], [ "i have problem in merging three databases in devexpress _URL_0_, my code is as follow\r\nAll the lotid are unique.\r\n \r\n ds.Tables( \" ;lotlist \" ;).PrimaryKey = New DataColumn() {ds.Tables( \" ;lotlist \" ;).Columns( \" ;LOTID \" ;)}\r\n ds.Tables( \" ;comd \" ;).PrimaryKey = New DataColumn() {ds.Tables( \" ;comd \" ;).Columns( \" ;LOTID \" ;)}\r\n ds.Tables( \" ;monitor \" ;).PrimaryKey = New DataColumn() {ds.Tables( \" ;monitor \" ;).Columns( \" ;LOTID \" ;)}\r\n \r\n \r\n dt.Merge(ds.Tables( \" ;lotlist \" ;))\r\n dt.Merge(ds.Tables( \" ;comd \" ;))\r\n dt.Merge(ds.Tables( \" ;monitor \" ;)) \r\n \r\n &#39;Dim dv As DataView = new DataView(dt)\r\n Dim dv As DataView = dt.DefaultView\r\n &#39;dt.DefaultView.ToTable()\r\n\r\n dv.RowFilter = \" ;[Cat] < > &#39;&#39; \" ;\r\n\r\n DisplayGridx.DataSource = dv\r\n DisplayGridx.DataBind()\r\n \r\n\r\nwhen i debug the code, all the data showed for dt.merge(3 datasets) but come to `Dim dv As DataView = New DataView(dt)` then the merged data displayed is incompleted and some of the column value disappeared. Anyone can guide me on what is the problem with this line `Dim dv As DataView = New DataView(dt)?` Thanks in advance.Anyone?", "452" ], [ "I am facing problem on executing oracle sql, the first code example is working when executing, while the second one appeared error (&#39;invalid number&#39;) , both supposed to produce the same result. May i ask what is wrong with the second sql? Please guide me on this.\r\n\r\nFirst SQL\r\n\r\n select a5.LOTID,COUNT(a5.stephandle) AS STEPHANDLE from LOTFLOW_D a5,\r\n \r\n (select distinct(LOTID),MAX(STEPHANDLE) AS <PERSON> from Lotmove_R\r\n where QTAP_GROUP In (&#39;8685&#39;,&#39;8686&#39;,&#39;8687&#39;,&#39;8688&#39;,&#39;8689&#39;,&#39;8533&#39;,&#39;8532&#39;,&#39;2534&#39;,&#39;2533&#39;,&#39;8684&#39;,&#39;8690&#39;)\r\n and datadate > sysdate-3\r\n and priority < =5\r\n and SUBPLANID NOT LIKE &#39;%RWK%&#39; AND <PERSON> NOT LIKE &#39;%8888%&#39; AND <PERSON> LIKE &#39;%.%.%&#39;\r\n group by lotid) a6\r\n \r\n where a5.lotid=a6.lotid \r\n and a5.STEPHANDLE > a6.STEPHANDLE AND A5.EQPTYPE NOT IN (&#39;CUDDFINP&#39;,&#39;CUBDFINP&#39;,&#39;BDFINP&#39;,&#39;DDFINP&#39;,&#39;CUDFSEM&#39;,&#39;DFSEM&#39;,&#39;SORT&#39;,&#39;CUSORT&#39;,&#39;CUNPURGE&#39;,&#39;NPURGE&#39;,&#39;EDFINP&#39;,&#39;CUEDFINP&#39;)\r\n \r\n group by a5.lotid\r\n order by a5.lotid \r\n\r\nOutput for first sql(the result is exactly what i wanted)\r\n\r\n LOTID STEPHANDLE\r\n _____ ___________\r\n S8CN9 214\r\n S7JY7 30\r\n ... .....\r\n \r\nSecond SQL\r\n \r\n Select a5.lotid,a5.STEPHANDLE from \r\n \r\n (select lotid,COUNT(stephandle) as STEPHANDLE, EQPTYPE from LOTFLOW_D Group by lotid, EQPTYPE ) a5\r\n \r\n left join\r\n \r\n (select distinct(LOTID), MAX(STEPHANDLE) AS STEPHANDLE from Lotmove_R\r\n where QTAP_GROUP In (&#39;8685&#39;,&#39;8686&#39;,&#39;8687&#39;,&#39;8688&#39;,&#39;8689&#39;,&#39;8533&#39;,&#39;8532&#39;,&#39;2534&#39;,&#39;2533&#39;,&#39;8684&#39;,&#39;8690&#39;)\r\n and datadate > sysdate-3\r\n and priority < =5\r\n and SUBPLANID NOT LIKE &#39;%RWK%&#39; AND <PERSON> NOT LIKE &#39;%8888%&#39; AND STEPHANDLE LIKE &#39;%.%.%&#39;\r\n group by lotid) a6 on a5.lotid=a6.lotid\r\n \r\n where a5.STEPHANDLE > a6.stephandle AND a5.EQPTYPE NOT IN (&#39;CUDDFINP&#39;,&#39;CUBDFINP&#39;,&#39;BDFINP&#39;,&#39;DDFINP&#39;,&#39;CUDFSEM&#39;,&#39;DFSEM&#39;,&#39;SORT&#39;,&#39;CUSORT&#39;,&#39;CUNPURGE&#39;,&#39;NPURGE&#39;,&#39;EDFINP&#39;,&#39;CUEDFINP&#39;)\r\n \r\n order by a5.lotid \r\n\r\nThe second one appeared error (invalid number for the max(stephandle)) as the value for\r\nstephandle is something like this 1470.0.0400, i know this is not a number but it works perfectly using the first sql and that met my expected result( display in number), I tried count(stephandle) but the outcome is wrong and i need the second sql format to run on my main sql with left join", "38" ], [ "Isnt it one left outer join can only use for one table? cause currently i am creating a daily report which involved the combination of 7 tables, including this, i used left outer join to join the other 5 tables, that&#39;s why for this one i need to use left outer join to combine also, can i include this in left outer join also? sorry for the inconvenience caused.", "308" ], [ "hi, sorry for the late reply, i have tried the method you provided and this time it gave me error \" ;A field or property with name &#39;isAvail&#39; was not found in the selected data source. Possible causes of this error may be the following: an incorrect or case-insensitive spelling of the grid column name; assigning a wrong or not properly initialized data source to the grid. \" ; I have tried to copy the code from detgrid to DisGridx but the same error appeared, sorry for the inconvenience caused.", "452" ], [ "I am facing error on this,when i execute this line of code then the error IErrorInfo.GetDescription failed with E_FAIL(0x80004005). appeared.\r\n \r\nMy code\r\n\r\n Dim sql As New OleDbCommand( \" ;Select Distinct(LOTID) = CASE when LOTID LIKE &#39;%-%&#39; THEN isnull(parsename(replace(LOTID,&#39;-&#39;,&#39;.&#39;),1),LOTID) ELSE isnull(parsename(replace(LOTID,&#39;-&#39;,&#39;.&#39;),1),LOTID) END, COUNT(isAvail) as isAvail from [ \" ;+csvFile + \" ;] where isAvail = 0 group by LOTID, isAvail \" ;, connx)\r\n\r\nI have tried to bracket all the reserved words like this \r\n\r\n Select Distinct([LOTID]) = CASE when [LOTID] LIKE &#39;%-%&#39; THEN isnull(parsename(replace([LOTID],&#39;-&#39;,&#39;.&#39;),1),[LOTID]) ELSE isnull(parsename(replace([LOTID],&#39;-&#39;,&#39;.&#39;),1),[LOTID]) END, COUNT([isAvail]) as [isAvail] from [ \" ; + csvFile + \" ;] where [isAvail] = 0 group by [LOTID], [isAvail]\r\n\r\n\r\nbut the same error still appearing.", "824" ], [ "I have enquiry on how to `insert` the `xls` file to `SQL Server` through a upload button.\r\n\r\nI have an existing table in `SQL Server` which consist of column \r\n\r\n > `sno(id)`, `customername`, `customeridentity`, `detail`.\r\n\r\nThe column `sno`, `customername`, and `customeridentity` already been filled, just left with the detail `xls` that need to be uploaded by others through a upload button on the selected row.\r\n\r\nHow can I `insert` the `xls` file to `SQL Server` by `ID`?\r\n\r\nMy code\r\n\r\n < pre > \r\nProtected Sub DataUpload_Click(sender As Object, e As EventArgs)\r\n Dim filepath As String = \" ;C:\\New folder\\ \" ; + XXUpload.UploadedFiles.ToArray(0).FileName.ToString + \" ;.xls \" ;\r\n Dim con, con1 As New OleDbConnection\r\n Dim cmd, cmd1 As New OleDbCommand\r\n Dim dt1 As New DataTable\r\n\r\n con.ConnectionString = \" ;Data Source=xx;Initial Catalog=xx;User Id=xx;Password=xx;Provider=SQLNCLI10 \" ;\r\n \r\n con.Open()\r\n cmd.Connection = con\r\n\r\n cmd.CommandText = \" ;Update RequestClip Set Detail = @details Where sno IN(Select sno from RequestClip); \" ;\r\n cmd.Parameters.AddWithValue( \" ;@details \" ;, filepath)\r\n\r\n cmd.ExecuteNonQuery()\r\n con.Close()\r\n \r\n ClipGrid.DataBind()\r\nEnd Sub\r\n < /pre > \r\n\r\nExpected output\r\n\r\n < pre > \r\nsno customername customeridentity detail\r\n 1 john 1 123.xls \r\n 2 max 2 223.xls\r\n < /pre >", "539" ], [ "If dt.Rows.Count > 0 Then\nDim i As Integer = 0\nDim colname() As String ={ \" ;LotID \" ;, \" ;Split_Cat \" ;, \" ;Engr_Time \" ;, \" ;PLANDESC \" ;, \" ;STEPSEQ \" ;, \" ;EQPTYPE \" ;, \" ;PPID \" ;, \" ;STEPDESC \" ;, \" ;Split \" ;, \" ;Recipe \" ;, \" ;[1] \" ;, \" ;[2] \" ;, \" ;[3] \" ;, \" ;[4] \" ;, \" ;[5] \" ;, \" ;[6] \" ;, \" ;[7] \" ;, \" ;[8] \" ;, \" ;[9] \" ;, \" ;[10] \" ;, \" ;[11] \" ;, \" ;[12] \" ;}\n For Each dc As DataColumn In dt.Columns\n If dc.ColumnName.ToString < > colname(i) Then\n Label2.Text = \" ; File is not in correct format - Details: \" ; + dc.ColumnName.ToString\n Return\n End If\n i = i + 1\n Next", "743" ], [ "I need to filter LOTID value from my database but my rowfilter is not functioning on devexpress gridview. \r\n\r\nDatabase Column Name is LOTID , example of row value of LOTID is L-S3FH2\r\n\r\nMy code is as below :\r\n\r\n Protected Sub ClipData()\r\n \r\n ......... \r\n \r\n connx.Close()\r\n \r\n &#39;Dim RowLotID As String = DetailGridx.GetRowValues( \" ;LotID \" ;).ToString\r\n \r\n Dim dv2 As DataView = New DataView(dt1)\r\n \r\n &#39;dv2.RowFilter = \" ;LOTID = &#39;L- \" ; + RowLotID + \" ;&#39; \" ;\r\n \r\n DetailGridx.DataSource = dv2\r\n DetailGridx.DataBind()\r\n \r\n End Sub\r\n\r\nPlease guide me on this, thanks in advance.", "653" ], [ "The error appeared in &#39; Dim RowLotID As String = DetailGridx.GetRowValues( \" ;LOTID \" ;).ToString&#39; and yes, example for LOTID&#39;s value is L-S3FH2\n\nError Shown: \n[FormatException: Input string was not in a correct format.]\n\n[InvalidCastException: Conversion from string \" ;LOTID \" ; to type &#39;Integer&#39; is not valid.]", "38" ], [ "you mean put visible index to the LOTID gridview column? sorry but i dont really get the meaning of this line The first parameter is an Integer, hence current overload usage is wrong since you&#39;re passing string to visibleIndex parameter.\n\nYou should use visible index from EventArgs as first argument (VisibleIndex property value is an Integer) and mention column name in second argument like this:", "653" ], [ "Hi i have enquiry on how to display based on id and the first value of step ( for example (id 12345 step 0050_01_0100) and (22345 step 0040_02_0300))\r\n\r\nFor example : the csv file\r\n\r\n ID step\r\n\r\n 01234 0350_01_0700\r\n 01234 0350_01_0700\r\n 01234 0350_01_0700\r\n\r\n 12345 0050_01_0100\r\n 12345 0050_01_0100 \r\n 12345 0050_01_0100 \r\n 12345 0050_01_0200 \r\n 12345 0050_01_0200 \r\n 12345 0050_01_0300 \r\n 12345 0050_01_0300 \r\n 12345 0050_01_0400\r\n \r\n 22345 0040_02_0300\r\n 22345 0040_02_0300 \r\n 22345 0040_02_0400 \r\n 22345 0040_02_0500 \r\n 22345 0040_02_0600 \r\n 22345 0040_02_0700 \r\n 22345 0040_02_0700 \r\n 22345 0040_02_0700\r\n\r\n 15232 0350_01_0700\r\n\r\nMay i ask how can i achieve this?\r\n\r\nExpected Output\r\n\r\n ID STEP ID step\r\n 12345 0050_01_0100 22345 0040_02_0300\r\n 12345 0050_01_0100 22345 0040_02_0300\r\n 12345 0050_01_0100 \r\n\r\nMy code for the .\r\n\r\n Dim sql As New OleDbCommand( \" ;Select * from [ \" ; + csvFile + \" ;] where STEP=(Select TOP 1 STEP FROM [ \" ; + csvFile + \" ;] \" ;, connx)\r\n \r\n Dim dv2 As DataView = New DataView(dt1)\r\n \r\n dv2.RowFilter = \" ;ID=&#39; \" ; + e.Parameters + \" ;&#39; \" ;\r\n\r\nThe outcome of my code\r\n\r\n ID STEP\r\n 01234 0350_01_0700\r\n 01234 0350_01_0700\r\n 01234 0350_01_0700\r\n 15232 0350_01_0700\r\n\r\nAny guidance would be much appreciated. Thanks in advance.", "288" ] ]
301
[ 13432, 14475, 19017, 15771, 13640, 5745, 10481, 16839, 1783, 7442, 14085, 15063, 13341, 5643, 8214, 18887, 10777, 186, 15027, 12740, 9710, 8777, 10448, 15299, 11670, 16425, 10450, 12558, 13568, 6814, 5221, 10437, 6822, 5381, 16276, 8919, 4541, 19657, 10360, 11772, 16189, 13010, 6244, 14440, 7166, 11788, 1797, 2841, 11456, 6511, 56, 11135, 15966, 9318, 13818, 12395, 17955, 5491, 13743, 14860, 18051, 17462, 15354, 14862, 13537, 16642, 15451, 11011, 16192, 14090, 15140, 834, 12532, 9496, 17666, 12116, 11948, 14554, 13481, 9678, 191, 19700, 745, 19531, 14399, 18045, 15061, 9246, 15788, 11637, 14130, 15271, 14547, 7435, 14511, 13749, 9162, 18181, 8915, 12986, 15369, 11317, 11646, 5727, 11875, 16228, 14426, 11851, 2738, 8265, 1955, 4850, 17676, 9588, 296, 9664, 14969, 10840, 9064, 14073, 7300, 17949, 11277, 17386, 14152, 16117, 18741, 18681, 13438, 19694, 17719, 6806, 19757, 237, 7496, 14553, 6154, 6736, 4104, 14430, 3444, 15254, 12094, 11022, 15294, 7184, 10528, 10689, 4323, 14462, 18719, 8882, 10371, 6351, 7966, 14732, 6280, 12052, 12548, 19106, 13631, 12155, 14254, 12963, 12567, 280, 5955, 1567, 12360, 11141, 17795, 5382, 10006, 10674, 3692, 14124, 5416, 9249, 10555, 955, 5583, 12779, 17934, 16139, 14780, 294, 14740, 11233, 12958, 8987, 12029, 13603, 5784, 18716, 12769, 196, 14924, 3878, 6719, 14990, 13757, 12911, 15032, 13993, 9158, 2304, 14064, 18861, 15265, 6170, 14388, 10916, 18305, 16344, 18158, 8035, 3486, 10393, 5220, 6839, 14643, 3170, 646, 15646, 14642, 1325, 594, 14203, 1427, 2381, 5793, 4993, 14903, 13112, 10180, 14909, 8002, 12507, 17883, 15134, 18007, 10855, 3037, 13265, 2380, 14967, 4100, 9838, 18790, 13912, 15070, 7964, 14998, 11911, 18673, 14946, 17971, 17218, 11510, 13155, 2694, 15488, 10725, 13478, 1019, 14204, 18660, 14370, 15490, 150, 14425, 131, 13186, 12739, 4948, 7322, 13886, 13710, 16838, 7984, 5465, 9394, 17326, 14010, 18584, 5838, 15485, 15638, 4342, 12799, 2130, 809, 1456, 10109, 14509, 15139, 10737, 6594, 3795, 12768, 19438, 411, 7877, 8256, 8189, 694, 2572, 18366, 15166, 9827, 16224, 14906, 19221, 10343, 4002, 87, 10489, 16981, 8706, 12786, 236, 7971, 17485, 5478, 8435, 4714, 85, 14677, 18640, 11265, 9325, 4220, 219, 3340, 18570, 14925, 15499, 11498, 13546, 5954, 19451, 6014, 9508, 10955, 13998, 8466, 16564, 14297, 14230, 19575, 17962, 3334, 12102, 16876, 7287, 17052, 10178, 18234, 19784, 12358, 13851, 5989, 14891, 12946, 15234, 10475, 17826, 12603, 3252, 7595, 18117, 7317, 8171, 15067, 10880, 11710, 19476, 11870, 6522, 10875, 12672, 14005, 16342, 14673, 12073, 3051, 5009, 4456, 13966, 13207, 1218, 13540, 12683, 7844, 15955, 6842, 17225, 15016, 8753, 16873, 17668, 9641, 15672, 12860, 14708, 15112, 13775, 12922, 2659, 19781, 5097, 19173, 13447, 13539, 2925, 10005, 10234, 13397, 5280, 12708, 12228, 3511, 19660, 6266, 12392, 16655, 14192, 16396, 7799, 9199, 17974, 16716, 9982, 16957, 15238, 11547, 12882, 8797, 17950, 448, 19690, 7845, 19290, 2118, 14686, 4809, 15871, 18459, 13961, 8241, 14902, 11345, 1118, 10036, 12178, 14701, 18283, 10942, 14190, 14674, 9177, 18890, 17137, 13325, 15353, 4561, 14415, 2549, 3590, 13037, 4278, 11554, 17827, 19287, 2122, 12013, 7949, 1944, 15020, 16070, 17647, 18198, 17758, 4473, 14411, 16514, 14639, 10558, 12111, 14300, 10391, 14074, 15018, 607, 7116, 12437, 19755, 12019, 5244 ]
STX_10023675.0
[ [ "What&#39;s the point of using namespace inside include, if adding app_name in the app&#39;s urls is the one that actually lets me use the \" ;app:view \" ; syntax.\r\n \r\n\r\n\r\nBlog_app/_URL_0_\r\n----------------\r\n\r\n \r\n\r\n from django.urls import path\r\n from django.views.generic.base import RedirectView\r\n from . import views\r\n \r\n app_name = &#39;posts&#39; #APP_NAME\r\n \r\n urlpatterns = [\r\n path(&#39;&#39;,RedirectView.as_view(url=&#39;posts/&#39;), name=&#39;home&#39;),\r\n path(&#39;posts/&#39;,views.post_list, name=&#39;list&#39;),\r\n path(&#39;posts/detail/ < int:pk > &#39;,views.post_detail, name=&#39;detail&#39;),\r\n path(&#39;posts/delete&#39;,views.post_delete, name=&#39;delete&#39;),\r\n path(&#39;posts/create&#39;,views.post_create, name=&#39;create&#39;),\r\n path(&#39;posts/update&#39;,views.post_update, name=&#39;update&#39;),]\r\n\r\n## Project/_URL_0_ ##\r\n\r\n from django.contrib import admin\r\n from django.urls import path,include\r\n \r\n urlpatterns = [\r\n path(&#39;admin/&#39;, admin.site.urls),\r\n path(&#39;&#39;, include(&#39;blog_app.urls&#39;,namespace=&#39;posts&#39;)),]\r\n\r\n\r\nthis code works for reversing the url to posts/detail like this\r\n\r\n## example.html ##\r\n\r\n < a href= \" ;{% url &#39;posts:list&#39; %} \" ; > Example < a/ > \r\n\r\n\r\nbut if delete the namespace it stills reverses my url to posts/detail\r\n\r\n## Project/_URL_0_ ##\r\n\r\n from django.contrib import admin\r\n from django.urls import path,include\r\n \r\n urlpatterns = [\r\n path(&#39;admin/&#39;, admin.site.urls),\r\n path(&#39;&#39;, include(&#39;blog_app.urls&#39;)), #NAMESPACE DELETED\r\n \r\n ]", "34" ], [ "I still dont get it fully. Please tell me if I am right. if I set the namespace inside `include` and not in `app_name` i get an error... so necessarily I have to write `app_name` in order to use a namespace for my app and if I want two namespace I can put another in `include`? Like this: include(&#39;app.urls&#39;,namespace=&#39;app1&#39;) and app_name = &#39;app2&#39; the I can either choose {% url &#39;app1:view&#39; %} or {% url app2:view %} ? Its that what you meant?", "888" ], [ "These terms seem to be very similar which confuses me a lot. < br/ > So far I know:\r\n\r\n - A protocol is a set of rules,methods that allow communication between two\r\n systems, it is like a real life lenguage and the systems are the two\r\n people talking. \r\n - An API is a software that allows communication from one system to\r\n another, it is like a waitress(API) that takes request from a client to the kitchen and sends back the response from the kitchen to the client. \r\n - Web Servives are APIS that uses http protocol to communicate with the client and the server. In the previous example of the waitress, the http protocol would be the lenguage that the client,waitress and the kitchen use to communicate to each other. \r\n\r\n - Middleware is the software that runs the API (?)\r\n\r\n\r\n\r\n**Am I right?**", "311" ], [ "First of all, static root is meant for production. If you want Django to pick up templates on the top level of your django project (where _URL_0_ is), you need to add to _URL_1_: \r\n\r\n > STATICFILES_DIRS = [\r\n > os.path.join(BASE_DIR, \" ;static \" ;),\r\n > ]\r\n\r\n\r\nSTATICFILES_DIRS tells django to look templates in the paths that you add inside. For example I want django to look for templates in djang-folder/static and django-folder/other the staticfile_dirs should look like this:\r\n > STATICFILES_DIRS = [\r\n > os.path.join(BASE_DIR, \" ;static \" ;),\r\n os.path.join(BASE_DIR, \" ;other \" ;),\r\n > ]\r\n\r\nHere is much better explained : [_URL_3_][1]\r\n\r\nAnd here: _URL_2_\r\n\r\n < br > And another thing: On the first line of the second screen shot uncomment {% load static %} , otherwise it wont pick up any static file . \r\n\r\n\r\n [1]: _URL_3_", "34" ], [ "C:\\Users\\PC > py\r\n Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] on win32\r\n Type \" ;help \" ;, \" ;copyright \" ;, \" ;credits \" ; or \" ;license \" ; for more information.\r\n > > > import numpy\r\n Traceback (most recent call last):\r\n File \" ; < stdin > \" ;, line 1, in < module > \r\n ModuleNotFoundError: No module named &#39;numpy&#39;\r\n > > > \r\n\r\nI thought I did not have numpy installed, so I tried to install it:\r\n\r\n C:\\Users\\PC > pip install numpy\r\n Requirement already satisfied: numpy in c:\\users\\pc\\appdata\\local\\programs\\python\\python36-32\\lib\\site-packages (1.15.0)\r\n\r\nWhat? Can anybody tell me how to fix this? I&#39;m using windows 10 64 bits.", "435" ], [ "import sqlite3\r\n def test(id,table):\r\n conn = sqlite3.connect(&#39;database/db.sqlite3&#39;)\r\n with conn:\r\n cur = conn.cursor()\r\n data = cur.execute(f \" ;SELECT id FROM {table} WHERE id=? \" ;,(id,))\r\n return data.fetchone()\r\n \r\n id = test(2,&#39;example&#39;)\r\n if id:\r\n print(&#39;id found&#39;)\r\nI&#39;m getting this error, I don&#39;t know what I&#39;m writing incorrectly? : < br > \r\n\r\n tomas@tomas-VirtualBox:~/Desktop/PasivicSoftware$ python3 _URL_0_\r\n File \" ;_URL_0_ \" ;, line 6\r\n data = cur.execute(f \" ;SELECT id FROM {table} WHERE id=? \" ;,(id,))\r\n ^\r\n SyntaxError: invalid syntax", "452" ], [ "#_URL_0_\r\n import re\r\n \r\n tmp = {&#39;value&#39;: &#39;V-4056366 &#39;, &#39;bool&#39;: False}\r\n def get_split():\r\n value = str(tmp[&#39;value&#39;]).strip()\r\n if value==&#39;&#39;:\r\n return None\r\n if value.isalnum(): \r\n return None\r\n return re.split(r&#39;[-.]*&#39;,value)\r\n \r\n print(get_split())\r\n\r\nIf I run the above code with the pre-installed python 3.7 I get the following output (the **output** that I really want to get). < br > \r\n\r\n [pc@pc-pc PasivicSoftware]$ python3.7 _URL_0_\r\n [&#39;&#39;, &#39;V&#39;, &#39;&#39;, &#39;4&#39;, &#39;0&#39;, &#39;5&#39;, &#39;6&#39;, &#39;3&#39;, &#39;6&#39;, &#39;6&#39;, &#39;&#39;]\r\n [pc@pc-pc PasivicSoftware]$ which python3.7\r\n /bin/python3.7\r\nNow with anaconda 3.6.5: < br > \r\n\r\n [pc@pc-pc PasivicSoftware]$ python3 _URL_0_\r\n /home/pc/anaconda3/lib/python3.6/_URL_1_:212: FutureWarning: split() requires a non-empty pattern match.\r\n return _compile(pattern, flags).split(string, maxsplit)\r\n [&#39;V&#39;, &#39;4056366&#39;][pc@pc-pc PasivicSoftware]\r\n $ which python3\r\n /home/pc/anaconda3/bin/python3\r\n**Did python3.7 change the behavior of re.split? If so, how can I get the same output of anaconda (just two elements in a list)**", "91" ], [ "import os\r\n \r\n def create_dir(child_dir_str):\r\n \r\n try:\r\n pardir = os.path.abspath(&#39;static/&#39;)\r\n original_umask = os.umask(0o777)\r\n os.makedirs(pardir,exist_ok=True)\r\n child_dir = os.path.join(pardir,child_dir_str)\r\n os.makedirs(child_dir,exist_ok=True)\r\n finally:\r\n os.umask(original_umask)\r\n print(&#39;static folder created:&#39;, os.path.isdir(pardir))\r\n print(&#39;img folder created: &#39;, os.path.isdir(child_dir))\r\n \r\n create_dir(&#39;img&#39;)\r\nWhen I execute the above code I get this error: < br > \r\n\r\n [pc@pc-pc xfolder]$ python3.7 _URL_0_\r\n static folder created: True\r\n img folder created: False\r\n Traceback (most recent call last):\r\n File \" ;_URL_0_ \" ;, line 16, in < module > \r\n create_dir(&#39;img&#39;)\r\n File \" ;_URL_0_ \" ;, line 10, in create_dir\r\n os.makedirs(child_dir,exist_ok=True)\r\n File \" ;/usr/lib/python3.7/_URL_1_ \" ;, line 221, in makedirs\r\n mkdir(name, mode)\r\n PermissionError: [Errno 13] Permission denied: &#39;/home/pc/Desktop/xfolder/static/img&#39;\r\n [pc@pc-pc xfolder]$ ls -l\r\n total 8\r\n d--------- 2 pc pc 4096 ago 27 15:45 static\r\n -rw-r--r-- 1 pc pc 473 ago 27 15:39 _URL_0_\r\nWhy does python set the permissions for the static folder to \" ;d--------- \" ; if on the code I set umask value of the process to \" ;0o777 \" ;? < br > How could I tell python to set the permissions to 777 when creating folders using makedirs?", "708" ], [ "1. 01 Ded.PASIVIC 05-01-2016.xlsx\r\n 2. 01 Ded.PASIVIC 15-01-2016.xlsx\r\n 3. 01 Ded.PASIVIC 10-01-2016.xlsx\r\n 4. 06 DED. PASIVIC <PHONE_NUMBER> (1).xlsx\r\n 5. 19 DEDUCCION PASIVIC DEL 15-10-2016.xlsx (2)\r\n 6. 23 DEDUCCION PASIVIC DEL 15-12-2016.xlsx (1)\r\n 7. 18 APORTE PASIVIC DEL <PHONE_NUMBER>.xlsx\r\n\r\nI would like to get the date that is printed on the name of the files **above**\r\nbut without leading zeros. \r\n[![enter image description here][1]][1]\r\n \r\n [1]: _URL_0_\r\n\r\nInstead of getting the whole date as I&#39;m doing above, I want to get for the first file **5-1-2016**, for the second file I want **15-1-2016**, for the third **10-1-2016** and so on (**NO LEADING ZEROS**).\r\n\r\nThe expected output should be like this:\r\n\r\n 1. 5-1-2016 \r\n 2. 15-1-2016 \r\n 3. 10-1-2016\r\n 4. 30-3-2016\r\n 5. 15-10-2016\r\n 6. 15-12-2016\r\n 7. 30-9-2016\r\n\r\nI&#39;m doing this on **python**.", "705" ], [ "I want to change the dtype of some columns in my DataFrame via iloc. But when I try this the dtype does not change (it&#39;s still object):\r\n \r\n import pandas as pd\r\n names = [&#39;sepal-length&#39;, &#39;sepal-width&#39;, &#39;petal-length&#39;, &#39;petal-width&#39;, &#39;class&#39;]\r\n df = pd.read_csv(&#39;iris.csv&#39;, names=names, header=None)\r\n df = df[1:]\r\n \r\n In [11]: df.head()\r\n Out[11]:\r\n sepal-length sepal-width petal-length petal-width class\r\n 1 5.1 3.5 1.4 0.2 setosa\r\n 2 4.9 3.0 1.4 0.2 setosa\r\n 3 4.7 3.2 1.3 0.2 setosa\r\n 4 4.6 3.1 1.5 0.2 setosa\r\n 5 5.0 3.6 1.4 0.2 setosa\r\n\r\n \r\n In [12]: df.iloc[:,:-1] = df.iloc[:,:-1].astype(float)\r\n # No Error\r\n \r\n In [13]: df.dtypes # still object dtype\r\n Out[13]:\r\n sepal-length object\r\n sepal-width object\r\n petal-length object\r\n petal-width object\r\n class object\r\n dtype: object\r\n\r\nNote: I can do this without iloc, but it&#39;s too long: \r\n\r\n df[[&#39;sepal-length&#39;, &#39;sepal-width&#39;, &#39;petal-length&#39;, &#39;petal-width&#39;]] = df[[&#39;sepal-length&#39;, &#39;sepal-width&#39;, &#39;petal-length&#39;, &#39;petal-width&#39;]].astype(float)", "444" ], [ "If I execute this piece of code I get an empty list: \r\n\r\n #_URL_0_\r\n def test(key): \r\n print(&#39;the input key is:&#39;,key) \r\n if key==1: \r\n return range(1,13)\r\n else:\r\n month = [&#39;15&#39;,&#39;30&#39;]\r\n for i in range(1,53):\r\n if i==4: \r\n yield &#39;2904&#39;\r\n else:\r\n str_i = str(i)\r\n if i < 10:\r\n str_i= &#39;0&#39;+str_i \r\n yield month[0] + str_i if i % 2 else month[1] + str_i\r\n \r\n my_list = list(test(1))\r\n print(&#39;the list is :&#39; ,my_list)\r\n < br > \r\n\r\n pc@pc-host:~/Git/PasivicSerious$ python3 _URL_0_\r\n the input key is: 1\r\n the list is : []\r\nbut without the \" ; else \" ; I get my desired list:\r\n\r\n def test(key): \r\n print(&#39;the input key is:&#39;,key) \r\n if key==1: \r\n return range(1,13)\r\n # else:\r\n # month = [&#39;15&#39;,&#39;30&#39;]\r\n # for i in range(1,53):\r\n # if i==4: \r\n # yield &#39;2904&#39;\r\n # else:\r\n # str_i = str(i)\r\n # if i < 10:\r\n # str_i= &#39;0&#39;+str_i \r\n # yield month[0] + str_i if i % 2 else month[1] + str_i\r\n \r\n my_list = list(test(1))\r\n print(&#39;the list is :&#39; ,my_list)\r\n < br > \r\n\r\n pc@pc-host:~/Git/PasivicSerious$ python3 _URL_0_\r\n the input key is: 1\r\n the list is : [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]\r\n\r\nWhy does this happen, what am I misunderstanding about generators?", "91" ], [ "pc@pc-host:~/MyScripts/sqltest$ sqlite3 --version\r\n 3.23.1 2018-04-10 17:39:29 4bb2294022060e61de7da5c227a69ccd846ba330e31626ebcd59a94efd148b3b\r\n\r\n pc@pc-host:~/MyScripts/sqltest$ sqlite3 sampledb.db\r\n\r\n sqlite > .schema students\r\n CREATE TABLE students(id integer primary key,name text,country text, thereal real, theint integer);\r\n\r\n sqlite > select * from students;\r\n id name country thereal theint \r\n ---------- ---------- ---------- ---------- ----------\r\n 1 <PERSON>usa 12.6 12 \r\n 2 <PERSON>usa 5.78 5 \r\n 3 <PERSON>usa 12.6 12 \r\n 4 <PERSON>usa 5.78 5 \r\n 5 <PERSON>usa 12.6 12 \r\n 6 <PERSON>usa 5.78 5 \r\n 7 <PERSON>usa 12.6 12 \r\n 8 <PERSON>usa 5.78 5 \r\n 9 <PERSON>usa 12.6 12 \r\n\r\nThis doesn&#39;t work:\r\n\r\n sqlite > select name,country from students where name GLOB &#39;^[A-za-z]*a$&#39;;\r\nNo output...\r\n\r\nBut this does:\r\n\r\n sqlite > select name,country from students where name GLOB &#39;[A-za-z]*a&#39;;\r\n name country \r\n ---------- ----------\r\n <PERSON> \r\n <PERSON>usa \r\nWhy? I know that in this case is redundant to use \" ;^$ \" ; for name, but just out of curiosity..", "312" ], [ "I am testing the following the regex `\\b\\w+123\\b` on _URL_3_\r\n[![enter image description here][1]][1]\r\n\r\n\r\nAs you can see on the screenshot it matches as many words as it is capable since the multiline and global flags are on. \r\nBut what if I wanted to **force it to stop after it matches the first occurrence:`hehe123sada123123`** , while I&#39;m using those two flags. < br > \r\nI&#39;ve tried to capture it as a group and then apply a lazy quantifier next to it:\r\n[![enter image description here][2]][2]\r\n\r\nDoesn&#39;t work...\r\n < br > Maybe using {1}? [![enter image description here][3]][3]\r\n\r\n\r\nNeither...\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_2_\r\n [3]: _URL_1_\r\n\r\nText: < br > \r\nhehe123sada123123\r\nasdsadas13423 asdsadas1563 hehe123\r\nasdsadas123 asdsadas123\r\nasdsk0adas123 asdsadas123 asdsadas\r\nasdsadasfr5 asdsa345das123 sdsfdeadas123 sdsfdeadas123 sdsfdeadas123", "286" ], [ "you can copy a file via the command line on windows: open cmd.exe then type `cd \" ;C:\\ ... \" ;` then type `copy yourfile destination`. [more info here][1]\r\n\r\nyou can make **python** do this for you: you will need the [subprocess][2] module which comes integrated into python so you dont have to donwload anything. \r\n\r\nlike this:\r\n\r\n import subprocess\r\n subprocess.run(&#39;copy yourfile destionation&#39;)\r\nremember that for this to work your python script should be in the same folder as \" ;yourfile \" ;, why? because i type \" ;yourfile \" ; as a relative path [relative vs absolute path][3]\r\n \r\nsubprocess works for **python 3.3 and newer versions** so another way to do it would be:\r\n\r\n import os\r\n os.system(&#39;copy youfile destionation&#39;)\r\n\r\nto open specific documents with python take a quick look at here: _URL_3_[][4]\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_4_\r\n [3]: _URL_2_\r\n [4]: _URL_0_", "523" ] ]
39
[ 18426, 13454, 12570, 8097, 14296, 17874, 2020, 7967, 19557, 16873, 14036, 14737, 17548, 12613, 13092, 17407, 16625, 12600, 3778, 7792, 19472, 10593, 10278, 14906, 14870, 13105, 17957, 10080, 1948, 11305, 7169, 17380, 7311, 14499, 11612, 15328, 6842, 13542, 6613, 19245, 5383, 3868, 15676, 14925, 6691, 13191, 7783, 16644, 15775, 7496, 8286, 8535, 14311, 6681, 18087, 280, 9483, 14969, 6516, 16597, 13670, 9494, 10898, 14555, 15828, 12016, 11019, 19, 15386, 6911, 17077, 18334, 7387, 11449, 4046, 10286, 14509, 12507, 4948, 12105, 10487, 16611, 8959, 12846, 13688, 3882, 11730, 14422, 17439, 17943, 11684, 10705, 14645, 17834, 11022, 5844, 580, 3045, 16512, 16588, 8420, 17976, 15020, 14926, 6118, 17254, 11814, 5304, 10025, 19543, 11331, 13767, 10952, 15429, 12971, 4320, 16797, 16255, 19675, 5281, 15353, 6347, 17605, 15143, 4002, 8170, 123, 10372, 9863, 14060, 7315, 15455, 13934, 9788, 15810, 11942, 14182, 8698, 16527, 15077, 13526, 13289, 19666, 6197, 9413, 12240, 4342, 230, 8098, 19102, 8795, 120, 11549, 9537, 17370, 7949, 17711, 7307, 19695, 10050, 5158, 10299, 19673, 13141, 18815, 17975, 5868, 12540, 11037, 10407, 13313, 14564, 5783, 6325, 9739, 7610, 16715, 18070, 6451, 10912, 17702, 37, 14788, 370, 674, 16670, 3293, 594, 5280, 17518, 14377, 13144, 6988, 17371, 10001, 16242, 8637, 19790, 3123, 15256, 14816, 19607, 19451, 2267, 19309, 9132, 13765, 14456, 17141, 14191, 615, 14423, 19784, 10166, 14911, 12348, 15102, 15813, 7260, 14825, 7609, 242, 12205, 17696, 17556, 196, 13955, 9640, 12868, 19397, 19225, 5553, 13702, 248, 19000, 17399, 17675, 14489, 9634, 7457, 47, 6406, 95, 13356, 11337, 9968, 11757, 14762, 2635, 6522, 19722, 15299, 2774, 3905, 14656, 6614, 2684, 4349, 4622, 844, 8608, 14720, 14842, 13385, 10797, 13388, 14321, 19468, 17017, 13527, 13474, 12239, 5811, 4603, 18489, 15323, 15067, 8880, 13145, 13053, 11984, 13923, 9748, 15034, 16701, 10867, 1103, 7332, 16641, 1127, 13488, 3846, 10569, 17872, 9347, 14938, 9930, 17962, 8168, 13239, 14215, 8589, 10832, 12357, 12073, 17187, 7930, 19384, 2456, 15271, 391, 17947, 15036, 12421, 14034, 14894, 8426, 12237, 14623, 14759, 14025, 18438, 12350, 8471, 19240, 15825, 12657, 16424, 11453, 5872, 63, 14178, 9623, 7678, 3763, 11304, 3549, 14808, 12947, 5024, 14195, 18894, 2638, 72, 12910, 3119, 10630, 11277, 2716, 13969, 17021, 8250, 14650, 14843, 12824, 14533, 18785, 9954, 18012, 18179, 10791, 14482, 8031, 9078, 4151, 12958, 729, 862, 11661, 19482, 19327, 17629, 13890, 10765, 190, 18795, 10811, 15467, 16808, 19562, 16861, 7701, 14021, 8800, 11054, 8193, 1487, 17368, 2236, 15235, 5542, 14858, 17602, 11719, 11673, 16796, 4793, 5233, 2824, 5267, 7711, 16522, 14042, 17331, 19433, 4923, 11805, 17288, 2906, 6308, 7587, 13622, 15659, 14346, 1826, 13656, 10337, 873, 15273, 7923, 7106, 7272, 16525, 4671, 15786, 16337, 12433, 19528, 17873, 13740, 197, 2875, 17465, 17713, 19095, 12077, 15903, 86, 13189, 11627, 19640, 9907, 12102, 16248, 15373, 12515, 18458, 5063, 19627, 17748, 4763, 19734, 17559, 236, 8985, 6410, 10368, 9421, 18568, 14266, 14609, 18029, 16634, 14430, 18494, 10984, 18289, 15876, 13137, 5906, 10886, 14343, 10896, 14120, 898, 1520, 7437, 9108, 13547, 155, 13714, 14198, 8742, 8815, 10625, 17669, 13900, 19298, 6669, 17721, 2158, 8260, 19294, 19128, 15669, 10461, 6765, 16315, 2531 ]
STX_100241.0
[ [ "The Apple Store Genius bar will ask you for a computer password, but in close to 15 years of being subscribed to the ADN I can&#39;t remember EVER being asked for my Apple ID password. Or even close to it. If you need to give over support as @ruffin describes above create a dummy account with some foolish setup like admin/12345. This doesn&#39;t mean they can&#39;t get in, but they already can do that from your account and what this gives you is the ability to check and see if they have.", "139" ], [ "I have replaced a 12AX7 tube with ECC85 in my guitar amp. Seems to work great and sound great. The part that is questioning me is whether the sound is being at its best because it takes a good 20-30 seconds before the volume reaches a good level. This is probably because original heating gives 6.3v at only 300ma and the tube needs about 400ma. It works but the question... will it sound any different? better? How will it affect the tone of the vacuum tube?\r\n\r\n In other words. Having lower voltage than recommenden on heaters - good or bad?", "887" ], [ "I have a DIY made guitar amp in which there is a TL071 preamp section. I read various opinions about how upgrading op amp improves that sound and how it doesn&#39;t do anything really... I&#39;m quite confused - would upgrading TL071 to OPA134 make a distinctive difference in sound and quality? And if not is there any other advantages in upgrading? And what other op amps would you recommend that would be a &#39;direct&#39; replacement for TL071 instead of OPA134 (I don&#39;t plan to spend big so it should be on the cheap (up to 3-4$).\r\nAnother thing which I could not find myself is whether a &#39;better&#39; op amp improve the output level? Bigger output really wouldn&#39;t hurt for my little amp - there would be lots of more headroom for various instruments :)\r\n I think I should mention that two inputs goes to the preamp (connected by two resistors).", "207" ], [ "I made a diy guitar amplifier with two seperate amplifiers. When potentiometer is raised something strange and annoying begins - various whispers, noises and reacts really strange. HOWEVER this never happens when any input device is connected. I don&#39;t intend to search for the problem in the schematic as it is really quite messy between the cables and if something would go wrong I would be in trouble to find it. So - how to &#39;simulate&#39; a device input? Of course the main input connection must function as it is. Any suggestions will be helpful :)", "887" ], [ "Is it safe and not harmful to run a preamp tube filaments at 5v? The tube is ECC85. I built a tube preamp in a DIY portable guitar amp. It&#39;s very similar to Matsumins valvecaster with a few slight changes so the anode voltage is only 12-13v depending on the battery charge level. It&#39;s a starved-cathode design but I really dig the warm slight distortions it gives to a guitar.\r\n\r\nMy schematic is very similar to matsumin, capacitors I believe are a little different and the gain pot is replaced with 50k resistor and R3 is 270k (works a lot better for some reason).\r\n\r\n[![Matsumins valvecaster][1]][1]\r\n\r\n I am considering this because right now I&#39;m using LM317 but it wastes a lot of power from the battery and also I want to put a USB charger (yes, that&#39;s quite silly) so 5v 2A would be really useful.\r\n\r\n And if it&#39;s safe would the output level be somewhat lower or I should worry about more distortions from the tube as it is a starved-cathode design.\r\n\r\nWhat&#39;s your advice and perhaps you have some recommendations on chips that have quite good efficiency of providing 5v. Again, the main part of the question is still whether this would harm tubes and how to get better efficiency for heating them.\r\n\r\n\r\n [1]: _URL_0_", "803" ], [ "Thanks, that was quite informative :) The main point is using a battery to make it portable! But it&#39;s far from a 9v battery - it&#39;s a fully loaded 5AH (5000mAh) 12v battery. With the current design it should last no less than 10 hours and if you&#39;re cranking it like crazy then no less than 6 hours. That&#39;s plenty of battery time :)\n Also I went quite crazy and managed to fit a whole 1-2A charger inside the casing. It&#39;s really really messy as it was my first project on which I have a fetish to keep improving it. Everything fits perfectly and it&#39;s a quite small box in comparison.", "632" ], [ "Try &#39;shorting&#39; right and left TRS jack channels with resistors in line. It would mostly get rid off impedance mismatch. Some phones will work with your design but some will not like it. Try using 1k to 10k resistors. They shouldn&#39;t affect sound.\r\n\r\n\r\nHere is a very simple and very informative photo of how to do it:\r\n[![enter image description here][1]][1]\r\n\r\n\r\n [1]: _URL_0_", "887" ], [ "Well as silly as it may seem. I tried replacing, just for the sake of experimentation. And, well.. It affected the sound - it was not much but it didn&#39;t seem so harsh and sounded more balanced. Perhaps it depends on the circuit. \r\n\r\nOne thing that it did solve is helped a lot with distortion (much less when driven with a hot signal) and impedance mismatch seems to work better with this op-amp. \r\n\r\nIs it worth it? Probably not, unless you are designing high-end amplifier or need those values, balance and reliability.", "207" ], [ "You have an option of making an optional cable OR an even better option:\nwhy not do the same trick just not on the plug but on the input jack on the amplifier? :)\n\nIt would take less than 20 minutes to do the trick and you won&#39;t have problems afterwards. I recommend using 2k to 5k resistor. They won&#39;t affect sound and you&#39;ll certainly get rid off impedance mismatch.", "887" ], [ "Thank you all for your help! I&#39;ve decided to stop playing and wasting energy with 6.3v heaters. Going to go for a 12AT7 which is a very very similar tube to the current ECC85 inside the amplifier. Found a very good deal on NOS Telefunken ECC81.\r\n\r\nECC81/12AT7 can be heated directly from 12v power supply so no more hassle with energy wasting LM317 I believe this is a far better solution than going through a LM317. Especially in efficiency! If I use LM317 to heat ECC85 I&#39;m using more than 300mA to heat the tube BUT if I am using ECC81 it drops in half - only 150mA.\r\n\r\nI don&#39;t think that using LM317 is a bad idea in a whole but when it comes to portable designs and efficiency.. well it really is quite terrible at that", "955" ], [ "Two options:\r\n\r\n 1. Well.. it might have gone bad but I doubt that.\r\n 2. More reasonable explanation is it gives off a bigger voltage than it is supposed to because it is unloaded. By that I mean that there is nothing connected to the power supply:\r\n\r\nLet&#39;s take cars as an example. If you would measure a cars battery when the car is not running and when it is running (more so when you are starting it) I guarantee you that it would show a lower voltage when you are running it.\r\n\r\nIt is called voltage drop. (or vdrop)\r\n_URL_0_\r\n\r\n[![enter image description here][1]][1]\r\n\r\nRegulated supplies, without any load, should measure very close to the target voltage of 9v. Unregulated supplies will generally have a no-load voltage anywhere from a couple of volts to several volts higher. So your supply is unregulated and that is the reason why it shows a way bigger voltage than 9v. \r\n\r\nTo simplify, I would not worry about it too much - the power supply is probably running well and working well. \r\n\r\n\r\n [1]: _URL_1_", "545" ], [ "I need to add an arrow between two satellites in a smartdiagram constellation.\r\n\r\nI have the following code:\r\n\r\n \\documentclass[border=10pt]{standalone} \r\n \\usepackage{smartdiagram}\r\n \\usesmartdiagramlibrary{additions}\r\n \\begin{document}\r\n\r\n \\smartdiagramset{\r\n set color list={orange!60, green!50!lime!60,magenta!60,blue!50!cyan},\r\n uniform connection color=true,\r\n planet text width=2.5cm,\r\n planet font=\\normalfont,\r\n distance planet-satellite=4.5cm,\r\n satellite text width=2.5cm,\r\n /tikz/connection planet satellite/.append style={ < -}\r\n } \r\n \\smartdiagramadd[constellation diagram]{Text Comprehension,\r\n Navigation, Dialogue, Memory Offloading}{\r\n }\r\n \\end{document}\r\n\r\nWhich gives me:\r\n[![enter image description here][1]][1]\r\n\r\nWhat I need is an arrow between the two left-hand nodes, something like this:\r\n[![enter image description here][2]][2]\r\n\r\nI&#39;ve tried using:\r\n\r\n \\smartdiagramconnect{{ < - > }}{module2/module1}\r\n\r\nand\r\n\r\n \\smartdiagramconnect{{ < - > }}{satellite2/satellite1}\r\n\r\nBut in both cases there is an error: No shape named ...\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "36" ] ]
380
[ 10194, 1976, 18830, 3518, 2029, 18505, 1564, 4832, 9371, 5262, 542, 5276, 12416, 15931, 6915, 19149, 17803, 13836, 2766, 1900, 317, 2811, 16979, 18609, 19758, 18928, 15715, 5451, 4537, 16872, 18576, 15119, 1506, 3791, 1969, 13, 3165, 6812, 15595, 19237, 8144, 1988, 18227, 17597, 19554, 3475, 4596, 19653, 3199, 19024, 16991, 1120, 6070, 5068, 5222, 11536, 346, 18238, 13793, 13882, 15838, 15585, 9745, 8045, 14803, 14962, 10618, 17130, 18776, 12694, 900, 2129, 1176, 938, 9936, 4311, 16103, 2759, 17757, 18296, 8722, 2401, 11717, 2946, 9277, 5062, 11111, 148, 12827, 14305, 499, 3217, 10654, 5027, 3548, 4649, 14714, 10776, 15722, 12973, 727, 11115, 2362, 533, 16246, 10031, 2240, 1806, 17775, 16577, 9341, 4928, 18, 16282, 9182, 19399, 10956, 2764, 17133, 3283, 16748, 13962, 15313, 15624, 18118, 4257, 11221, 1957, 5408, 13904, 16350, 2947, 2973, 19735, 10621, 1419, 18063, 13772, 16793, 292, 531, 3935, 16526, 716, 2047, 1280, 334, 17364, 19360, 16760, 18340, 3477, 24, 522, 7261, 61, 10197, 1268, 1616, 10871, 15910, 13712, 3717, 15929, 2024, 4424, 16441, 319, 9201, 19401, 28, 8039, 1230, 18745, 662, 5469, 19235, 3802, 19513, 16910, 19027, 13795, 2376, 3071, 19645, 17862, 2623, 11410, 2084, 17211, 12086, 5421, 11294, 9424, 1580, 4870, 19160, 17330, 11095, 18093, 16079, 4740, 9915, 13817, 8904, 15897, 5679, 19542, 11937, 1140, 1089, 16651, 851, 6998, 12931, 5448, 19642, 13390, 18441, 12944, 1720, 2125, 10685, 638, 18782, 10994, 4890, 13994, 19044, 523, 13019, 3720, 13362, 15587, 12843, 4061, 4317, 6657, 18886, 18715, 7543, 5482, 3390, 18037, 2276, 18791, 9652, 16836, 10130, 407, 5117, 19243, 6508, 3611, 19470, 15816, 19403, 1468, 6850, 198, 3627, 7054, 14488, 5901, 5645, 6781, 10108, 17084, 17100, 11499, 17514, 16888, 528, 4301, 5363, 1238, 13160, 14127, 8529, 19355, 3840, 6734, 10718, 9674, 6872, 1404, 4609, 3355, 19681, 3920, 2369, 12488, 4813, 1160, 10962, 1954, 4904, 5192, 3774, 12120, 17930, 11864, 18464, 19143, 13320, 1696, 12275, 3078, 3709, 11320, 14512, 2110, 18067, 9857, 15744, 3055, 19698, 7117, 13567, 4768, 16368, 9700, 8884, 3576, 5624, 2338, 12796, 8392, 4745, 679, 17126, 536, 9368, 5598, 1884, 19535, 14032, 10910, 4536, 3740, 8555, 7105, 18840, 9955, 3015, 11629, 14033, 15886, 8960, 5829, 16595, 15103, 6066, 10240, 19067, 2309, 18742, 13001, 16679, 16353, 58, 3762, 16050, 7146, 4651, 2245, 6135, 6059, 8167, 9938, 13696, 19292, 3823, 12292, 9408, 7597, 13198, 7993, 9357, 18884, 4515, 6732, 5760, 9766, 16503, 18235, 1520, 4004, 12915, 18317, 1970, 15859, 1273, 18811, 5439, 3628, 18402, 8225, 15158, 7083, 19445, 16779, 9852, 2523, 14392, 18845, 4370, 19283, 19481, 3122, 13223, 8300, 16539, 13334, 1239, 10155, 4956, 14174, 4746, 1812, 8328, 18572, 5392, 2340, 4588, 7343, 14497, 11152, 10111, 18675, 11047, 19782, 16932, 5029, 8271, 4502, 16457, 12547, 12003, 6174, 7555, 16581, 13006, 18006, 17756, 12980, 4122, 12310, 19109, 345, 11849, 4700, 19099, 17437, 12076, 5355, 18016, 17635, 5811, 16112, 3925, 18437, 10949, 1306, 3191, 3422, 413, 17176, 2926, 13570, 5072, 2372, 15415, 11356, 14140, 5538, 5103, 17275, 14652, 4954, 16299, 16330, 5058, 18718, 11006, 14785, 2402, 1967, 10497, 13615, 2909, 3652, 8502, 19446, 6486, 9454, 12919, 10951, 9638 ]
STX_1002430.0
[ [ "Let&#39;s say I have the following code:\r\n\r\n dispatch_async(dispatch_get_main_queue()) {\r\n myFunction()\r\n }\r\n\r\nThis says to call the block, which calls `myFunction`, asynchronously. Let&#39;s say that I call this code in my main queue, which is also the queue specified for the `dispatch_async` call.\r\n\r\nWhen does this block actually get called in this case? Does my current queue get pre-empted and the block run immediately, or does the current call stack unroll and the block gets called at the next event loop? Or something else?", "283" ], [ "I am trying to understand how to use [stack and _URL_1_][1]. When I first installed it and used it, _URL_1_ was at LTS-3.8 (the \" ;resolver \" ;). Since then, _URL_1_ now has LTS-3.11.\r\n\r\nFirst, I&#39;d like to confirm what this means. Stackage is a repository of packages in which, for a specific LTS version (say 3.8), the packages have been verified to work together. So the packages of LTS-3.8 work together, and the packages of LTS-3.11 also work together. Moving on ...\r\n\r\nWhen I run `stack new projectname`, stack tells me:\r\n\r\n Checking against build plan lts-3.8\r\n Selected resolver: lts-3.8\r\n\r\nDoes this mean that the project has been set up to use only the packages and versions that were verified under LTS-3.8?\r\n\r\nIf I now want to start a new project and want to use the latest LTS version with the new project, how do I tell stack to do that by default?\r\n\r\nWhat about if I want to \" ;upgrade \" ; an older project to use a new LTS version?\r\n\r\n\r\n [1]: _URL_0_", "1023" ], [ "While working my way through GHC extensions, I came across [`RankNTypes` at the School of Haskell][1], which had the following example:\r\n\r\n main = print $ rankN (+1)\r\n \r\n rankN <IP_ADDRESS> (forall n. Num n = > n - > n) - > (Int, Double)\r\n rankN f = (f 1, f 1.0)\r\n\r\nThe article offered an alternative type for `rankN`:\r\n\r\n rankN <IP_ADDRESS> forall n. Num n = > (n - > n) - > (Int, Double) \r\n\r\nThe explanation of the difference is that * \" ;The latter signature requires a function from n to n for some Num n; the former signature requires a function from n to n for every Num n. \" ;*\r\n \r\nI can understand that the former type requires a signature to be what&#39;s in the parentheses or more general. I do not understand the explanation that the latter signature simply requires a function `n - > n` for \" ;some `Num n` \" ;. Can someone elaborate and clarify? How do you \" ;read \" ; this former signature so that it sounds like what it means? Is the latter signature the same as simply `Num n = > (n - > n) - > (Int, Double)` without the need for `forall`? \r\n\r\n [1]: _URL_0_", "252" ], [ "I&#39;m very puzzled by how Servant is able to achieve the magic that it does using typing. The example on the web site already puzzles me greatly:\r\n\r\n type MyAPI = \" ;date \" ; : > Get &#39;[JSON] Date\r\n : < | > \" ;time \" ; : > Capture \" ;tz \" ; Timezone : > Get &#39;[JSON] Time\r\n\r\nI get the \" ;date \" ;, \" ;time \" ;, `[JSON]` and \" ;tz \" ; are type-level literals. They are values that have \" ;become \" ; types. Okay.\r\n\r\nI get that `: > ` and `: < | > ` are type operators. Okay.\r\n\r\nI don&#39;t get how these things, after they&#39;ve become types, can be extracted back out into values. What&#39;s the mechanism to do this?\r\n\r\nI also don&#39;t get how the first part of this type can get the framework to expect a function of the signature `IO Date`, or how the second part of this type can get the framework to expect a function of the signature `Timezone - > IO Time` from me. How does this transformation happen? \r\n\r\nAnd how then can the framework call a function for which it didn&#39;t initially know the type?\r\n\r\nI&#39;m sure there are a number of GHC extensions and unique features at play here that I&#39;m not familiar with that combine to make this magic happen. \r\n\r\nCan someone explain what features are involved here and how they are working together?", "816" ], [ "Recently I tried a few different neighbor selection algorithms for solving the [Traveling Salesman Problem][1] using [Simulated Annealing][2]:\r\n\r\n1. Swap two random cities (e.g. `abcdefg - > abfdecg`)\r\n2. Cut route into two and swap the two sub-routes (e.g. `ab|cdefg - > cdefgab`)\r\n3. Swap two random adjacent cities (e.g. `abcdefg - > abdcefg`)\r\n4. Swap two random sub-routes (e.g. `a|bc|d|ef|g - > aefdbcg`)\r\n5. Reverse a random sub-route (e.g. `ab|cdef|g - > abfedcg`)\r\n\r\nIt turns out there is a huge difference in asymptotic performance. #5 turned out to be the best and #2 turned out to not work at all.\r\n\r\nWhy such a huge difference with #2 and #5? Both algorithms change two edges at a time. In the above examples, #2 changes breaks `bc` and attaches `ga`. #5 replaces `bc` with `bf` and replaces `fg` with `cg`. Why does #2 not work at all while #5 is the best of the 5?\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "238" ], [ "I plot a CSV file in scatter-plot with connecting lines with gnuplot using the following command:\r\n\r\n set style line 1 lc rgb &#39;#0060ad&#39; lt 1 lw 1 pt 7 pi -1 ps 1\r\n set pointintervalbox 1.25\r\n \r\n plot \" ;values.csv \" ; using 1:2 with lp ls 1 \r\n\r\nIt looks great, but what I get is an opened polygon because gnuplot doesn&#39;t draw the line connecting the first point and the last.\r\n\r\nHow do I get gnuplot to connect the first and last points so I get a closed polygon?", "616" ], [ "I am trying to get Emacs, SLIME and quicklisp to work together properly. I have the following environment set up:\r\n\r\n* Installed Emacs\r\n* Installed SLIME in Emacs\r\n* Installed SBCL\r\n* Installed quicklisp \r\n* Run `(quicklisp-quickstart:install)` in SBCL\r\n* Run `(ql:add-to-init-file)` in SBCL\r\n* Run `(ql:quickload \" ;quicklisp-slime-helper \" ;)` in SBCL\r\n* Installed package cl-csv using `(ql:quickload \" ;cl-csv \" ;)` in SBCL\r\n* Added `(setq inferior-lisp-program \" ;sbcl \" ;)` to .emacs\r\n* Added `(load (expand-file-name \" ;~/quicklisp/slime-helper.el \" ;))` to .emacs\r\n* Restarted everything\r\n\r\nI have a `test.lisp` file that starts with `(ql:quickload \" ;cl-csv \" ;)` to load the package and use it. When I load the file into Emacs and run SLIME, then try to compile it using `slime-compile-and-load-file`, I get the error in SBCL that `Package CL-CSV does not exist`.\r\n\r\nWhat have I missed to get these pieces working together properly?", "860" ], [ "In Haskell, I&#39;m able to enable parallel evaluation of lists using:\r\n\r\n map expensiveFunction list `using` parList rdeepseq\r\n\r\nAdding only the `` `using` parList rdeepseq`` enables the pure parallel computation and runs 4 times faster on my quad-core processor.\r\n\r\nIs there a similar capability using SBCL?", "739" ], [ "Recently I had to write some code involving math formulas in Clojure and I realized that there is the Java `java.lang.Math` library of functions and there is the `clojure.math.numeric-tower` library of functions.\r\n\r\nIs this the accepted way to use math functions in Clojure, pulling from two different places to get the full complement? Or am I supposed to just use `Math`? Or something else?", "904" ], [ "In the [Clojure documentation on type hinting][1], it has the following example on how type hinting and coercions can make code run much faster:\r\n\r\n (defn foo [n]\r\n (loop [i 0]\r\n (if ( < i n)\r\n (recur (inc i))\r\n i)))\r\n \r\n (time (foo 100000))\r\n \" ;Elapsed time: 0.391 msecs \" ;\r\n 100000\r\n \r\n (defn foo2 [n]\r\n (let [n (int n)]\r\n (loop [i (int 0)]\r\n (if ( < i n)\r\n (recur (inc i))\r\n i))))\r\n \r\n (time (foo2 100000))\r\n \" ;Elapsed time: 0.084 msecs \" ;\r\n 100000\r\n\r\nIf you run this code with `(set! *warn-on-reflection* true)`, it doesn&#39;t show a reflection warning. Is it up to programmer trial-and-error to see where these kinds of adornments make a performance difference? Or is there a tool that indicates the problematic areas?\r\n\r\n [1]: _URL_0_", "199" ], [ "I&#39;m trying to write an Automator service that returns some text into the current document, whether it is TextEdit or Pages or Numbers.\r\n\r\nI&#39;ve got the following MWE which compiles and installs properly, and shows up in the Services menu, but when invoked, doesn&#39;t actually do anything. What am I missing?\r\n\r\n[![enter image description here][1]][1]\r\n\r\n\r\n [1]: _URL_0_", "343" ], [ "I would like to use a `UISplitViewController` to show a list of connectable devices in the master view, and to show information retrieved from a selected device in the detail view.\r\n\r\nTo do that, when the user taps on a device, I need to attempt to connect to that device. If unsuccessful, there&#39;d be nothing to show and I would display an error message. If successful, I&#39;d read data from the device and display that in the detail view.\r\n\r\nThe Show Detail segue from the `UISplitViewController` seems to automatically fire immediately after an entry in the master view is tapped. Can I intercept this somehow to add the necessary logic for connection/read? If not, what is an alternative method for me to do this?", "735" ], [ "Here is my code. It uses `CBUUID` which is from Core Bluetooth. Let&#39;s just assume the cast of `v` is valid.\r\n\r\n import UIKit\r\n import CoreBluetooth\r\n \r\n func convert(v: AnyObject) - > [String: String] {\r\n return (v as! [CBUUID: NSData]).map { (uuid, data) in\r\n (uuid.UUIDString, NSString(data: data, encoding: NSUTF8StringEncoding) ?? \" ; \" ;) \r\n }\r\n }\r\n\r\nThe idea is to get the string representation of the dictionary by calling `CBUUID.UUIDString` for `CBUUID` and by calling the appropriate `NSString` constructor for `NSData`.\r\n\r\nI&#39;ve cast the dictionary to a specific type. Why do I get ** \" ;ambiguous reference to member &#39;map&#39; \" ;** here?", "986" ], [ "Let&#39;s say I have a some objects representing network connections. Once these connections are disconnected, the associated objects disappear. I don&#39;t want to hang on to a connection object which is no longer connected.\r\n\r\nI also want to associate some data with these connections using a dictionary. So I might have the code:\r\n\r\n class Connection { ... }\r\n class Metadata { ... }\r\n \r\n var metadata: [Connection: Metadata] = [:]\r\n\r\nBut the above code means that the dictionary will keep references to the `Connection` objects which I don&#39;t want. I&#39;d prefer to have the associated entries be removed, ideally automatically, when the `Connection` objects disappear.\r\n\r\nSo I tried:\r\n\r\n var metadata: [weak Connection: Metadata] = [:]\r\n\r\nBut this doesn&#39;t work. What is a good alternative solution to this?", "721" ], [ "Let&#39;s say I have the following:\r\n\r\n var didConnectObserver: NSObjectProtocol?\r\n\r\n didConnectObserver = NSNotificationCenter.defaultCenter().addObserverForName(\r\n MyKey, object: nil, queue: nil, usingBlock: { (note) - > Void in\r\n ...\r\n })\r\n\r\nAt some point I unregister:\r\n\r\n NSNotificationCenter.defaultCenter().removeObserver(didConnectObserver)\r\n\r\nThis doesn&#39;t work, though, because `didConnectObserver` is an optional. Is there a more compact way to write this than:\r\n\r\n if let obs = didConnectObserver {\r\n NSNotificationCenter.defaultCenter().removeObserver(obs)\r\n }\r\n\r\nthat still does the right thing if `didConnectObserver` is `nil`?", "986" ], [ "I realized that I could generate a list of methods:\r\n\r\n class A {\r\n \r\n let methodList: [A - > Int - > Bool] = [methodA, methodB]\r\n \r\n func methodA(val: Int) - > Bool { return true }\r\n func methodB(val: Int) - > Bool { return false }\r\n \r\n }\r\n\r\nThat&#39;s great. How do I create a loop that can call these methods? The obvious, like `obj.methodList[0](1)` doesn&#39;t work.", "490" ], [ "I have the following code:\r\n\r\n class Base {}\r\n class A: Base {}\r\n class B: Base {}\r\n class C: Base {}\r\n \r\n func next(obj: Base) - > Base {\r\n if obj is A { return B() }\r\n else if obj is B { return C() }\r\n else if obj is C { return A() }\r\n else { return A() }\r\n }\r\n\r\nHow do I express the chained `if`s as a single `switch` statement instead?", "467" ], [ "In the Repa package, there is a [`Boundary`][1] datatype:\r\n\r\n data Boundary a\r\n = BoundFixed !a\r\n | BoundConst !a\r\n | BoundClamp\r\n deriving (Show)\r\n\r\nI understand what is meant by `BoundConst` (cells outside of the array are treated as single value), and I understand what is meant by `BoundClamp` (cells outside of the array are the same values as the closest array cell). \r\n\r\nWhat is meant by `BoundFixed`? The description is *Use a fixed value for border regions*. What is the \" ;border region \" ;? Are these all the edge cells? \r\n\r\n [1]: _URL_0_", "753" ], [ "All the reduction functions of [Repa][1] fold back into the same types as the array contents. For example:\r\n\r\n foldAllP <IP_ADDRESS> (Shape sh, Source r a, Elt a, Unbox a, Monad m) = > (a - > a - > a) - > a - > Array r sh a - > m a\r\n foldAllS <IP_ADDRESS> (Shape sh, Source r a, Elt a, Unbox a) = > (a - > a - > a) - > a - > Array r sh a - > a\r\n\r\nI&#39;d like to fold a repa array into an data structure that I can pass to a GUI library to render, i.e. an arbitrary value, but I cannot find a function in the library to do this. Does this function exist or do I have to iterate over cells using `[... | x < - [0..w-1], y < - [0..h-1]]` ?\r\n\r\n\r\n [1]: _URL_0_", "443" ], [ "I tried to run some sample code from the [Haskell \" ;Simple Servers \" ; wiki page][1] today:\r\n\r\n import Network\r\n import Control.Concurrent\r\n import _URL_1_\r\n \r\n main = withSocketsDo $ do\r\n sock < - listenOn $ PortNumber 5002\r\n loop sock\r\n \r\n loop sock = do\r\n (h,_,_) < - accept sock\r\n forkIO $ body h\r\n loop sock\r\n where\r\n body h = do\r\n hPutStr h msg\r\n hFlush h\r\n hClose h\r\n \r\n msg = \" ;HTTP/1.0 200 OK\\r\\nContent-Length: 5\\r\\n\\r\\nPong!\\r\\n \" ;\r\n\r\nI&#39;m doing this on a Mac with El Capitan installed.\r\n\r\nWhen I tried to run this code using `httperf` as indicated on the web page, I got the following error messages on the console:\r\n\r\n ep1: < socket: 29 > : hPutChar: resource vanished (Broken pipe)\r\n ep1: < socket: 29 > : hPutChar: resource vanished (Broken pipe)\r\n ep1: < socket: 29 > : hPutChar: resource vanished (Broken pipe)\r\n ep1: < socket: 29 > : hPutChar: protocol error (Protocol wrong type for socket)\r\n\r\nDifferent runs will give different numbers of these messages. Am I doing something wrong, is this a bug, or is this normal, expected behavior?\r\n\r\n [1]: _URL_0_", "921" ], [ "In Xcode, it is possible to bring up the \" ;debug area \" ; by pressing cmd-shift-Y. It only takes up half the window area usually taking up by the source code. However, you can then drag the split all the way up to take up the entire window area.\r\n\r\nIf you press cmd-shift-Y to dismiss it and then bring it back up again, it does not cover the entire window area. Any keyboard shortcut that will let you do this so that you don&#39;t have the mouse-drag it every time?", "631" ], [ "I&#39;d like to use an object method as a closure because I need to reuse the same closure multiple times in different places in an object. Let&#39;s say I have the following:\r\n\r\n class A {\r\n func launch(code: Int) - > Bool { return false }\r\n }\r\n\r\nAnd I need a closure that is of type `Int - > Bool` in the same object. How would I be able to use the `launch` method as the closure? I&#39;d rather not do something like `{ self.launch($0) }` if I can just directly reference the method.", "315" ], [ "I&#39;m trying to use the [Apprentice][1] colorscheme on a Mac running Vim in iTerm 2.1.4.\r\n\r\nMy `TERM` is set to `xterm-256color`. However, the colorscheme doesn&#39;t look like what the web site says. In particular, the web site has an image that shows what the **background color** should look like with my exact configuration:\r\n\r\n[![enter image description here][2]][2]\r\n\r\nBut mine looks like this instead:\r\n\r\n[![enter image description here][3]][3]\r\n\r\nThe difference in background color is readily apparent and too bright. I looked at `hi Normal` just to make sure the background is set right, and it seems like it is. Putting the images in Photoshop, my background color is not #262626 as it should be but #<PHONE_NUMBER>. \r\n\r\nVery interestingly, if I ran the Vim inside Terminal.app, the background color shows up fine. So I believe it is an iTerm problem. \r\n\r\nAny pointers as to what could be wrong?\r\n\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_2_\r\n [3]: _URL_0_", "950" ], [ "I&#39;m trying to use [vim-easy-align][1] to align vimscript comments. For example, turn this:\r\n\r\n Plugin &#39;ervandew/supertab&#39; \" ; Tab completion\r\n Plugin &#39;kien/ctrlp.vim&#39; \" ; File searching\r\n Plugin &#39;lervag/vimtex&#39; \" ; LaTeX\r\n\r\nto:\r\n\r\n Plugin &#39;ervandew/supertab&#39; \" ; Tab completion\r\n Plugin &#39;kien/ctrlp.vim&#39; \" ; File searching\r\n Plugin &#39;lervag/vimtex&#39; \" ; LaTeX\r\n\r\nI&#39;m trying vipga, then ^X (for regex), then \" ; (double quote), and it executes but does nothing. Also tried visually selecting rows, then ga, ^X, \" ; which also does nothing.\r\n\r\nWith [Tabular][2], it&#39;s simply `:Tabular / \" ;` but I cannot figure it out with vim-easy-align. What am I doing wrong?\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "774" ], [ "There is a Vim package that I&#39;d like to use that does both indentation and syntax highlighting for a language. The highlighting is excellent but the indentation is terrible.\r\n\r\nIs it possible for me to Vundle-install this package but only use the syntax highlighting part, disabling the indentation part? The package itself gives no way for me to do this and I&#39;d prefer to not have to clone the package and modify its internals. I&#39;d rather have some code in my .vimrc that will disable the unwanted parts.", "774" ], [ "I&#39;m confused about the error that I received at the end of the session below:\r\n\r\n $ ghci\r\n GHCi, version 7.10.2: _URL_0_ :? for help\r\n Ok, modules loaded: Main.\r\n *Main > :set -XDataKinds\r\n\r\n *Main > :t [False, True]\r\n [False, True] <IP_ADDRESS> [Bool]\r\n\r\n *Main > :t [False]\r\n [False] <IP_ADDRESS> [Bool]\r\n\r\n *Main > :k [False, True]\r\n [False, True] <IP_ADDRESS> [Bool]\r\n\r\n *Main > :k [False]\r\n \r\n < interactive > :1:2:\r\n Expected kind ‘*’, but ‘False’ has kind ‘Bool’\r\n In a type in a GHCi command: [False]\r\n\r\nWhy the error?\r\n\r\n---\r\n\r\nFuture experimenting reveals:\r\n\r\n *Main > :k [Int]\r\n [Int] <IP_ADDRESS> *\r\n \r\n *Main > :k [Int, Int]\r\n [Int, Int] <IP_ADDRESS> [*]\r\n\r\n`[Int]` can have inhabited values so it is of kind `*`, but it also makes sense that it is of kind `[*]`.\r\n\r\n---\r\n\r\nA bit more data points:\r\n\r\n *Main > :k []\r\n [] <IP_ADDRESS> * - > *\r\n \r\n *Main > :k [Bool]\r\n [Bool] <IP_ADDRESS> *", "453" ], [ "I&#39;m learning Vimscript and I&#39;m trying to select a block of text and sort it via a function. Here&#39;s what I got right now:\r\n\r\n function! SortFirstBlock()\r\n call setpos( \" ;. \" ;, [0, 1, 1, 0])\r\n execute \" ;normal! vip:sort < cr > \" ;\r\n endfunction\r\n\r\nHow I read this is to go to the first position in the buffer via `setpos`, then with `execute`, run `vip` which visually selects a block of text, then `:sort` to sort that block.\r\n\r\nMy cursor goes to the first position, but doesn&#39;t highlight the block and doesn&#39;t sort. What is the proper way to do this?", "837" ], [ "With the answers from a [previous question][1], I&#39;ve put toegther a little function to help me insert language pragmas into a source code file:\r\n\r\n function! HaskellInsertLanguagePragma() abort\r\n let here = getpos( \" ;. \" ;)\r\n let prag = input( \" ;GHC pragma: \" ;)\r\n call append(0, \" ;{-# LANGUAGE \" ; . prag . \" ; #-} \" ;)\r\n call setpos( \" ;. \" ;, [0, 1, 1, 0])\r\n ,&#39;}-sort\r\n ,&#39;}-Tabularize /#-}$/\r\n call setpos( \" ;. \" ;, here)\r\n endfunction\r\n\r\nBasically, it asks you for a keyword, then inserts it, along with the boilerplate into the first line of the file, sorts, it, and lines up the closing delimiter using the [Tabular][2] plugin. Awesome.\r\n\r\nThe problem with the function is that, because a line is inserted, the `setpos` at the end puts the cursor at the line previous to when it started now. The obvious solution is to `setpos` with the line number incremented by one, but I wonder whether either of the following two solutions might be better:\r\n\r\n1. Set a mark at the beginning of the function and go to that mark at the end. If so, how to set and move to marks within Vimscript?\r\n\r\n2. Don&#39;t move the cursor at all, and do the `,&#39;}-sort` and `,&#39;}-Tabular` using explicit ranges. But how do I specify the range \" ;first paragrpah of the file \" ;?\r\n\r\nTo me it seems that being able to select the first paragraph of the file is the better approach. Appreciate any help in figuring out how to do this.\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "774" ], [ "I have a syntax highlighting script that is pretty good except I&#39;d like to enhance it without modifying the original file. In particular, it defines an `Identifier` highlight group name:\r\n\r\n :hi Identifier\r\n Identifier xxx term=underline ctermfg=208 guifg=#FD971F\r\n\r\nI&#39;d like to have all words that start with a capital letter ([A-Z]) be highlighted by this. What do I have to add to my .vimrc to get this effect?", "774" ], [ "Consider the following two nearly identical functions:\r\n\r\n buildList 0 = []\r\n buildList n = n : buildList (n - 1)\r\n \r\n buildListM 0 = return []\r\n buildListM n = buildListM (n - 1) > > = return . (n :)\r\n\r\nThe laziness aspect of Haskell allows for `buildList` to generate the list without much overhead in memory because it generates the head of the list and then builds the tail. \r\n\r\nBut the monadic version `buildListM` seems to use more memory as `n` gets larger because it must build the tail first and then prepend the head.\r\n\r\nIs this a good way to build lists inside monads, or is there a more efficient way?", "712" ], [ "I&#39;d like to put together a command that will print out a string of 32 hexadecimal digits. I&#39;ve got a Python script that works:\r\n\r\n python -c &#39;import random ; print \" ; \" ;.join(map(lambda t: format(t, \" ;02X \" ;), [random.randrange(256) for x in range(16)]))&#39;\r\n\r\nThis generates output like:\r\n\r\n 6EF6B30F9E557F948C402C89002C7C8A \r\n\r\nWhich is what I need.\r\n\r\nOn a Mac, I can even do this:\r\n\r\n uuidgen | tr -d &#39;-&#39;\r\n\r\nHowever, I don&#39;t have access to the more sophisticated scripting languages ruby and python, and I won&#39;t be on a Mac (so no uuidgen). I need to stick with more bash&#39;ish tools like sed, awk, /dev/random because I&#39;m on a limited platform. Is there a way to do this?", "418" ], [ "I&#39;m trying to try out Vagrant, but ...\r\n\r\n $ vagrant init hashicorp/precise32\r\n A `Vagrantfile` has been placed in this directory. You are now\r\n ready to `vagrant up` your first virtual environment! Please read\r\n the comments in the Vagrantfile as well as documentation on\r\n `_URL_1_` for more information on using Vagrant.\r\n \r\n $ vagrant up\r\n Bringing machine &#39;default&#39; up with &#39;virtualbox&#39; provider...\r\n == > default: Box &#39;hashicorp/precise32&#39; could not be found. Attempting to find and install...\r\n default: Box Provider: virtualbox\r\n default: Box Version: > = 0\r\n == > default: Loading metadata for box &#39;hashicorp/precise32&#39;\r\n default: URL: _URL_2_\r\n == > default: Adding box &#39;hashicorp/precise32&#39; (v1.0.0) for provider: virtualbox\r\n default: Downloading: _URL_0_\r\n default: Progress: 3% (Rate: 62598/s, Estimated time remaining: 0:52:14)\r\n\r\n62K/s is pretty much the fastest its been for multiple boxes I&#39;ve tried including `hashicorp/precise32`, `hashicorp/precise64`, `bento/debian-8.2` and some others.\r\n\r\nIs there a Vagrant box mirror that I can configure vagrant to use or some other mechanism to allow for faster box downloads?", "181" ], [ "I&#39;ve got code that looks like this:\r\n\r\n class Base {\r\n func launch(code1: Int, code2: Int) - > Bool { return false }\r\n }\r\n \r\n class A: Base {}\r\n class B: Base {}\r\n class C: Base {}\r\n \r\n func trynext(obj: Base) - > Base? {\r\n switch obj {\r\n case is A: return B()\r\n case is B: return C()\r\n default: return nil\r\n }\r\n }\r\n\r\nBasically, I&#39;ve got a lot (like 20) of subclasses of a common base class and I need to go through them one by one. These subclasses represent parsers and I&#39;m trying them one after another to discover which parser correctly parses some data.\r\n\r\nIf I fail on a parse, I call a function `trynext` to return the \" ;next parser \" ; to try. You can imagine that this `switch` statement can get unyieldly if the constructors take arguments (all subclasses take the same arguments), and the more subclasses there are, etc.\r\n\r\nIs there any way I can streamline this code by putting the classes into some sort of array and loop through it somehow? The idea is to reduce the boilerplate so that I end up using a structure like `[A, B, C]` that implies the subclasses to try and the order to try them in.", "490" ], [ "I tried to [ask this question][1] previously but didn&#39;t clearly express my question, so I&#39;ll try again here. I also noticed a [very similar sounding question][2], but it is asking for something entirely different.\r\n\r\nI have the following code:\r\n\r\n class Base {\r\n func launch(code1: Int, code2: Int) { ... }\r\n }\r\n \r\n class A: Base {}\r\n class B: Base {}\r\n class C: Base {}\r\n \r\n let classes = [A.self, B.self, A.self, B.self, C.self]\r\n for cls in classes {\r\n let obj = ???\r\n }\r\n\r\nI would like to instantiate an object of type `cls` inside the loop and do something with it. I might have duplicates inside the array, as shown. What do I put in place of the `???` to be able to instantiate the proper objects?\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "490" ], [ "There is a lot of old information on the net regarding an epoll/kqueue enabled GHC. For example, the code on the [Simple Servers wiki page][1] doesn&#39;t compile anymore.\r\n\r\nCould someone provide a basic example of how to use this feature with a modern GHC version to build, e.g. a TCP server that just responds with \" ;Hello \" ; on connect?\r\n\r\n\r\n\r\n\r\n [1]: _URL_0_", "88" ], [ "In Swift I can do `var?.prop`. This results in `nil` if `var` is `nil`, else it results in the value of the `prop` property of `var`. \r\n\r\nEquivalently, I can do `var > > = prop` in Haskell, which gives me `None` is `var` is `None`, else it gives me the value of applying `prop` to the value inside `var` (wrapped in `Just`).\r\n\r\nIs there an equivalent in Python?", "365" ], [ "At the [Pipes tutorial][1], it says that this:\r\n\r\n -- s :: Monad m = > Producer a m () -- i.e. &#39;P.stdinLn&#39;\r\n -- f :: Monad m = > a - > Producer b m () -- i.e. &#39;duplicate&#39;\r\n -- g :: Monad m = > b - > Producer c m () -- i.e. &#39;(lift . putStrLn)&#39; \r\n for (for s f) g = for s (\\x - > for (f x) g)\r\n\r\nplus this:\r\n\r\n (~ > ) :: Monad m\r\n = > (a - > Producer b m ())\r\n - > (b - > Producer c m ())\r\n - > (a - > Producer c m ())\r\n (f ~ > g) x = for (f x) g\r\n\r\nequals this:\r\n\r\n f :: <PERSON> m = > a - > Producer b m ()\r\n g :: <PERSON> m = > b - > Producer c m ()\r\n h :: <PERSON><IP_ADDRESS> Monad m = > Producer a m () -- i.e. &#39;P.stdinLn&#39;\r\n -- f <IP_ADDRESS> Monad m = > a - > Producer b m () -- i.e. &#39;duplicate&#39;\r\n -- g <IP_ADDRESS> Monad m = > b - > Producer c m () -- i.e. &#39;(lift . putStrLn)&#39; \r\n for (for s f) g = for s (\\x - > for (f x) g)\r\n\r\nplus this:\r\n\r\n (~ > ) <IP_ADDRESS> Monad m\r\n = > (a - > Producer b m ())\r\n - > (b - > Producer c m ())\r\n - > (a - > Producer c m ())\r\n (f ~ > g) x = for (f x) g\r\n\r\nequals this:\r\n\r\n f <IP_ADDRESS> Monad m = > a - > Producer b m ()\r\n g <IP_ADDRESS> Monad m = > b - > Producer c m ()\r\n h <IP_ADDRESS> Monad m = > c - > Producer d m ()\r\n (f ~ > g) ~ > h = f ~ > (g ~ > h)\r\n\r\nwhich makes no sense to me. Could someone please clarify?\r\n\r\n [1]: _URL_0_", "252" ], [ "There are many Haskell SQLite bindings, which implies to me that there are many different tradeoffs on using building/using a SQLite binding. I&#39;ve tried to read through the documentation of many of these packages but it became a blur after a while, and I was unable to really identify the primary tradeoffs of choosing one over another. \r\n\r\nA search on Hackage finds:\r\n\r\n* [direct-sqlite][1]\r\n* [HDBC-sqlite3][2]\r\n* [hdbi-sqlite][3]\r\n* [hsql-sqlite3][4]\r\n* [hsSqlite3][5]\r\n* [persistent-sqlite][6]\r\n* [simplest-sqlite][7]\r\n* [sql-simple-sqlite][8]\r\n* [sqlite][9]\r\n* [sqlite-simple][10]\r\n* [sqlite-simple-typed][11]\r\n* [bindings-sqlite3][12]\r\n\r\nNevermind some \" ;meta \" ; SQLite packages. [haskelldb-hdbc-sqlite3][13], [haskelldb-hsql-sqlite3][14], [language-sqlite][15], [opaleye-sqlite][16]\r\n\r\nHoping that someone has been able to do this successfully and can help me understand how to choose.\r\n\r\n [1]: _URL_10_\r\n [2]: _URL_3_\r\n [3]: _URL_7_\r\n [4]: _URL_1_\r\n [5]: _URL_2_\r\n [6]: _URL_4_\r\n [7]: _URL_8_\r\n [8]: _URL_9_\r\n [9]: _URL_0_\r\n [10]: _URL_0_-simple\r\n [11]: _URL_0_-simple-typed\r\n [12]: _URL_14_\r\n [13]: _URL_11_\r\n [14]: _URL_12_\r\n [15]: _URL_6_\r\n [16]: _URL_13_", "573" ], [ "I have a small Haskell `Pipe` that prints out how many times it has run:\r\n\r\n counterPipe <IP_ADDRESS> Pipe String String IO r\r\n counterPipe = go 0\r\n where\r\n go n = do\r\n await > > = yield\r\n let n&#39; = succ n\r\n liftIO $ putStrLn $ \" ;Chunk \" ; ++ show n&#39;\r\n go n&#39;\r\n\r\nI&#39;d like to be able to print out a message, and potentially perform other tasks, once it has processed the last chunk. How do I go about doing this?", "941" ], [ "I&#39;ve got some sample JSON data like this:\r\n\r\n [{\r\n \" ;File:FileSize \" ;: \" ;104 MB \" ;,\r\n \" ;File:FileModifyDate \" ;: \" ;2015:04:11 10:39:00-07:00 \" ;,\r\n \" ;File:FileAccessDate \" ;: \" ;2016:01:17 22:37:23-08:00 \" ;,\r\n \" ;File:FileInodeChangeDate \" ;: \" ;2015:04:26 07:50:50-07:00 \" ;\r\n }]\r\n\r\nand I&#39;m trying to parse the data using the [json][1] package (not [aeson][2]):\r\n\r\n import qualified Data.Map.Lazy as M\r\n import Text.JSON\r\n\r\n content < - readFile \" ;file.txt \" ;\r\n decode content <IP_ADDRESS> Result [M.Map String String]\r\n\r\nThis gives me an error:\r\n\r\n Error \" ;readJSON{Map}: unable to parse array value \" ;\r\n\r\nI can get as far as this:\r\n\r\n fmap \r\n (map (M.fromList . fromJSObject)) \r\n (decode content <IP_ADDRESS> Result [JSObject String])\r\n\r\nbut it seems like an awfully manual way to do it. Surely the JSON data could be parsed directly into a type `[Map String String]`. Pointers?\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "642" ], [ "Been running stack/ghc inside Debian 8.2 via vagrant for a while. This morning:\r\n\r\n $ stack setup\r\n Run from outside a project, using implicit global project config\r\n Using resolver: lts-4.2 from implicit global project&#39;s config file: /home/vagrant/.stack/global-project/stack.yaml\r\n Downloading lts-4.2 build plan ...TlsExceptionHostPort (HandshakeFailed (Error_Protocol ( \" ;certificate has expired \" ;,True,CertificateExpired))) \" ;_URL_0_ \" ; 443\r\n \r\n $ stack --version\r\n Version 1.0.2, Git revision fa09a980d8bb3df88b2a9193cd9bf84cc6c419b3 (3084 commits) x86_64\r\n\r\nThe same error remains even if I delete `~/.stack`. Did I mess something up?", "921" ], [ "At first glance I thought these two functions would work the same:\r\n\r\n firstM _ [] = return Nothing\r\n firstM p (x:xs) = p x > > = \\r - > if r then return (Just x) else firstM p xs\r\n \r\n firstM&#39; p xs = fmap listToMaybe (mapM p xs)\r\n\r\nBut they don&#39;t. In particular, `firstM` stops as soon as the first `p x` is true. But `firstM&#39;`, because of `mapM`, needs the evaluate the whole list. \r\n\r\nIs there a \" ;lazy `mapM` \" ; that enables the second definition, or at least one that doesn&#39;t require explicit recursion?", "252" ], [ "I&#39;d like to automate the insertion of text into a specified location in a configuration file, and I&#39;d like to do it via the use of a token. For example:\r\n\r\n Existing text\r\n %% NEW_CONTENT\r\n Existing text\r\n\r\nWhat I&#39;d like to do is to use `sed` to identify the `%% NEW_CONTENT` and to insert at least one line of text in front. The new file will then have:\r\n\r\n Existing text\r\n New line 1\r\n New line 2\r\n %% NEW_CONTENT\r\n Existing text\r\n\r\nI cannot figure out how to replace one line with multiple lines, however. Is this possible, and if so, how?", "112" ], [ "Let&#39;s say I do the following:\r\n\r\n1. Open Xcode 7\r\n2. File | New | Project | Cocoa Touch Framework\r\n3. Create \" ;TestFramework \" ; with the Swift language\r\n4. Create a file Hello.swift with public func hello() { print( \" ;Hello \" ;) }.\r\n\r\nFrom here, I can build a debug build of the framework (inside the Debug-iphoneos folder), but I cannot figure out how to build the release version of the framework (inside Release-iphoneos). I thought Archive might do it, but it doesn&#39;t. Pointers please?", "100" ], [ "At the [GHC/Type families][1] web page, it has half a starter example of why type families are useful.\r\n\r\n data family XList a\r\n data instance XList Char = XCons !Char !(XList Char) | XNil\r\n data instance XList () = XListUnit !Int\r\n\r\nBasically, it says that a list of `Char` can be represented by cons cells. A list of `()` carries no useful information except its length, so we can represent the list by its length.\r\n\r\nThat&#39;s great. So what about the rest of the implementation of this list. How would `length` be defined, and how would `!!` or `fromList` be defined? \r\n\r\n\r\n [1]: _URL_0_", "816" ], [ "I&#39;m trying to understand some code and I&#39;m getting myself tangled fairly well. Please help me to understand my logic, or lack thereof ...\r\n\r\nTo start:\r\n\r\n *Main > :t fmap\r\n fmap <IP_ADDRESS> Functor f = > (a - > b) - > f a - > f b\r\n\r\nIf I just want `f a` to be a function that takes one parameter, it&#39;s okay and makes sense:\r\n\r\n *Main > :t \\f - > fmap f (undefined <IP_ADDRESS> String - > Int)\r\n \\f - > fmap f (undefined <IP_ADDRESS> String - > Int) <IP_ADDRESS> (Int - > b) - > String - > b\r\n\r\nI can pass in a `String` in the second param, which generates an `Int`, and then use the function in the first param to generate the `b`.\r\n\r\nNow, I want `f a` to be a function that takes two parameters, so I substitute that in:\r\n\r\n *Main > :t \\f - > fmap f (undefined <IP_ADDRESS> String - > Int - > Bool)\r\n \\f - > fmap f (undefined <IP_ADDRESS> String - > Int - > Bool) \r\n <IP_ADDRESS> ((Int - > Bool) - > b) - > String - > b\r\n\r\nAt this point, I&#39;m confused. I already provided the function that converts from the `String` and the `Int` into the `Bool`. How can I now provide another function that *takes* a `Int - > Bool` to convert into a `b`? Is this non-sensical or am I not reading this right? \r\n\r\nOr maybe this is a case of a functor within a functor and more needs to be done to make this make sense? In which case, what?", "904" ], [ "I&#39;m trying to learn about how to use [`GHC.Generics`][1]. A fascinating topic but daunting.\r\n\r\nWhile reading through the blog entry [24 Days of GHC Extensions: DeriveGeneric][2], I learned how to take a value and navigate its `Rep`. Okay.\r\n\r\nHowever, reading the blog entry [Building data constructors with GHC Generics][3] which describes the analog of constructing the `Rep` and converting it back to a value, I got stumped. I&#39;ve read through [a][1] [number][4] [of][5] [other][6] [resources][7], but to no great help.\r\n\r\nIn the blog entry is the following code. First, constructing the `Rep`:\r\n\r\n class Functor f = > Mk rep f | rep - > f where\r\n mk <IP_ADDRESS> f (rep a)\r\n \r\n instance Mk (K1 i c) ((- > ) c) where\r\n mk = \\x - > K1 x\r\n \r\n instance (Mk l fl, Mk r fr) = > Mk (l :*: r) (Compose fl fr) where\r\n mk = Compose (fmap (\\l - > fmap (\\r - > l :*: r) mk) mk)\r\n \r\n instance (Mk f f&#39;) = > Mk (M1 i c f) f&#39; where\r\n mk = M1 < $ > mk\r\n \r\nThen, dealing with the `Compose`:\r\n\r\n class Functor f = > Apply f a b | f a - > b where\r\n apply <IP_ADDRESS> f a - > b\r\n \r\n instance Apply ((- > ) a) b (a - > b) where\r\n apply = id\r\n \r\n instance (Apply g a b, Apply f b c) = > Apply (Compose f g) a c where\r\n apply (Compose x) = apply (fmap apply x)\r\n\r\nThen dealing with type ambiguity:\r\n \r\n type family Returns (f <IP_ADDRESS> *) <IP_ADDRESS> * where\r\n Returns (a - > b) = Returns b\r\n Returns r = r\r\n \r\n make <IP_ADDRESS> forall b f z. (Generic (Returns b), Apply f (Returns b) b, Mk (Rep (Returns b)) f) = > b\r\n make = apply (fmap (to <IP_ADDRESS> Rep (Returns b) z - > (Returns b)) (mk <IP_ADDRESS> f (Rep (Returns b) z)))\r\n\r\nWow. \r\n\r\nReally, I&#39;m stuck at the very beginning, at the class `Mk` where `mk` returns a functor. My questions:\r\n\r\n1. What is `mk` returning? Why is it a functor? What is the interpretation of its result? I can see that the `K1 i c` instance of `Mk` returns a function (I understand this is a functor) that takes a value and wraps it in `K1`, but `mk` for `Mk (l :*: r)` and `Mk (M1 i c f)` are completely lost on me.\r\n\r\n2. I&#39;m guessing `Compose` comes from `Data.Functor.Compose`, which means that when I do `fmap f x`, it does the `fmap` two levels deep into the composed functors. But I can&#39;t make sense of the nested `fmap`s inside the `Compose`. \r\n\r\n3. For the instance of `M1 i c f`, I thought it would just wrap the inner values in `M1`, so the need to `M1 < $ > mk` or `fmap M1 mk` makes no sense to me.\r\n\r\nObviously I&#39;m not grokking the intent or meaning of these instances and how these instances interact to create the final `Rep`. I am hoping someone can enlighten me and provide a good explanation of how to use `GHC.Generics` along the way.\r\n\r\n\r\n [1]: _URL_6_\r\n [2]: _URL_4_\r\n [3]: _URL_0_\r\n [4]: _URL_5_\r\n [5]: _URL_1_\r\n [6]: _URL_3_\r\n [7]: _URL_2_", "877" ], [ "I&#39;m working through content at the blog posting [Building data constructors with GHC Generics][1]. My previous question is [here][2]. \r\n\r\nThe posting has the following code to create a `Rep`:\r\n\r\n {-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies #-}\r\n {-# LANGUAGE FlexibleInstances, UndecidableInstances #-}\r\n {-# LANGUAGE TypeOperators #-}\r\n \r\n import GHC.Generics\r\n import Data.Functor.Compose\r\n\r\n class Functor f = > Mk rep f | rep - > f where\r\n mk <IP_ADDRESS> f (rep a)\r\n \r\n instance Mk (K1 i c) ((- > ) c) where\r\n mk = \\x - > K1 x\r\n \r\n instance (Mk l fl, Mk r fr) = > Mk (l :*: r) (Compose fl fr) where\r\n mk = Compose (fmap (\\l - > fmap (\\r - > l :*: r) mk) mk)\r\n \r\n instance (Mk f f&#39;) = > Mk (M1 i c f) f&#39; where\r\n mk = M1 < $ > mk\r\n\r\nIs it possible to create a similar instance for `U1`? If so, how?\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "163" ], [ "The [Standard Haskell Classes][1] page says the following about `reads <IP_ADDRESS> (Read a) = > String - > [(a,String)]`:\r\n\r\n > Normally, a parser returns a singleton list, containing a value of\r\n > type a that was read from the input string and the remaining string\r\n > that follows what was parsed. If no parse was possible, however, the\r\n > result is the empty list, and if there is more than one possible parse\r\n > (an ambiguity), the resulting list contains more than one pair.\r\n\r\nUnder what situations or examples does this ambiguity manifest?\r\n\r\n [1]: _URL_0_", "252" ], [ "Consider the following code:\r\n\r\n run = runExcept $ do\r\n case Just 1 of\r\n Nothing - > throwE \" ;escape 1 \" ;\r\n Just x - > do\r\n case Just 2 of\r\n Nothing - > throwE \" ;escape 2 \" ;\r\n Just y - > do\r\n case Just 3 of\r\n Nothing - > throwE \" ;escape 3 \" ;\r\n Just z - > return z\r\n\r\nPretend the `Just 1`, `Just 2`, `Just 3` are function calls that return `Maybe Int`. \r\n\r\nThis whole function is inside an `ExceptT` because I want to throw exceptions. But inside is really just a lot of `Maybe` values being manipulated.\r\n\r\nSo, is it possible for me to leverage the behaviour of a `Maybe` monad to avoid the stair-casing while still being able to throw exceptions?", "759" ], [ "I&#39;m trying to figure out how to build a \" ;purely applicative parser \" ; based on a simple [parser][1] implementation. The parser would not use monads in its implementation. I asked this question previously but mis-framed it so I&#39;m trying again. \r\n\r\nHere is the basic type and its `Functor`, `Applicative` and `Alternative` implementations:\r\n\r\n newtype Parser a = Parser { parse :: String - > [(a,String)] }\r\n\r\n instance Functor Parser where\r\n fmap f (Parser cs) = Parser (\\s - > [(f a, b) | (a, b) < - cs s])\r\n\r\n instance Applicative Parser where\r\n pure = Parser (\\s - > [(a,s)])\r\n (Parser cs1) < * > (Parser cs2) = <PERSON><IP_ADDRESS> String - > [(a,String)] }\r\n\r\n instance Functor Parser where\r\n fmap f (Parser cs) = Parser (\\s - > [(f a, b) | (a, b) < - cs s])\r\n\r\n instance Applicative Parser where\r\n pure = Parser (\\s - > [(a,s)])\r\n (Parser cs1) < * > (Parser cs2) = Parser (\\s - > [(f a, s2) | (f, s1) < - cs1 s, (a, s2) < - cs2 s1])\r\n\r\n instance Alternative Parser where\r\n empty = Parser $ \\s - > []\r\n p < | > q = Parser $ \\s - > \r\n case parse p s of\r\n [] - > parse q s\r\n r - > r\r\n\r\nThe `item` function takes a character off the stream:\r\n\r\n item <IP_ADDRESS> Parser Char\r\n item = Parser $ \\s - > \r\n case s of\r\n [] - > []\r\n (c:cs) - > [(c,cs)]\r\n\r\nAt this point, I want to implement `digit`. I can of course do this:\r\n\r\n digit = Parser $ \\s - > \r\n case s of\r\n [] - > []\r\n (c:cs) - > if isDigit c then [(c, cs)] else []\r\n\r\nbut I&#39;m replicating the code of `item`. I&#39;d like to implement `digit` based on `item`.\r\n\r\nHow do I go about implementing `digit`, using `item` to take a character off the stream and then checking to see if the character is a digit without bringing monadic concepts into the implementation?\r\n\r\n [1]: _URL_0_", "904" ], [ "I&#39;m trying to learn the `pipes` package by writing my own `sum` function and I&#39;m getting stumped. I&#39;d like to not use the utility functions from `Pipes.Prelude` (since it has `sum` and `fold` and other functions which make it trivial) and only use the information as described in `Pipes.Tutorial`. The tutorial doesn&#39;t talk about the constructors of `Proxy`, but if I look in the source of `sum` and `fold` it uses those constructors and I wonder whether it is possible to write my `sum` function without knowledge of these low level details.\r\n\r\nI&#39;m having trouble coming to terms with how this function would be able to continue taking in values as long as there are values available, and then somehow return that sum to the user. I guess the type would be:\r\n\r\n sum&#39; :: Monad m = > Consumer Int m Int\r\n\r\nIt appears to me this could work because this function could consume values until there are no more, then return the final sum. I would use it like this:\r\n\r\n mysum < - runEffect $ inputs > - > sum&#39;\r\n\r\nHowever, the function in `Pipes.Prelude` has the following signature instead:\r\n\r\n sum :: (Monad m, Num a) = > Producer a m () - > m a\r\n\r\nSo I guess this is my first hurdle. Why does the `sum` function take a `Producer` as an argument as opposed to using ` > - > ` to connect?\r\n\r\n---\r\n\r\nFYI I ended up with the following after the answer from <PERSON><IP_ADDRESS> Monad m = > Consumer Int m Int\r\n\r\nIt appears to me this could work because this function could consume values until there are no more, then return the final sum. I would use it like this:\r\n\r\n mysum < - runEffect $ inputs > - > sum&#39;\r\n\r\nHowever, the function in `Pipes.Prelude` has the following signature instead:\r\n\r\n sum <IP_ADDRESS> (Monad m, Num a) = > Producer a m () - > m a\r\n\r\nSo I guess this is my first hurdle. Why does the `sum` function take a `Producer` as an argument as opposed to using ` > - > ` to connect?\r\n\r\n---\r\n\r\nFYI I ended up with the following after the answer from danidiaz:\r\n\r\n sum&#39; = go 0\r\n where\r\n go n p = next p > > = \\x - > case x of\r\n Left _ - > return n\r\n Right (_, p&#39;) - > go (n + 1) p&#39;", "904" ], [ "I can&#39;t really figure out whether some of [these][1] [other][2] [questions][3] are similar enough to mine but I couldn&#39;t extract a solution out of them so I&#39;m posting. Feel free to indicate to me otherwise.\r\n\r\nI have a flow where I need to download a large CSV file, and 1) save it to disk, and 2) process it. I&#39;d like to use Haskell pipes, with the [pipes-http][4] and [pipes-csv][5] packages to do this. \r\n\r\nThe obvious way is to have two separate pipes: 1) web - > disk, and then 2) disk - > process. Is it possible to do another topology where the output from the web splits into two consumers, one that saves and the other that processes? I feel that this could be more elegant and possibly more efficient. \r\n\r\nIf so, how is the splitting done? Splitting of pipes is not mentioned anywhere in the documentation.\r\n\r\n [1]: _URL_4_\r\n [2]: _URL_1_\r\n [3]: _URL_0_\r\n [4]: _URL_3_\r\n [5]: _URL_2_", "381" ], [ "In a previous [post][1], a user offered an implementation of a purely applicative parser for Haskell (code originally from [here][2]). Below is the partial implementation of that parser:\r\n\r\n {-# LANGUAGE Rank2Types #-}\r\n \r\n import Control.Applicative (Alternative(..))\r\n import Data.Foldable (asum, traverse_)\r\n \r\nThe type:\r\n\r\n newtype Parser a = Parser {run <IP_ADDRESS> forall f. Alternative f = > (Char - > f ()) - > f a}\r\n \r\nThe instances:\r\n\r\n instance Functor Parser where\r\n fmap f (Parser cont) = Parser $ \\char - > f < $ > cont char\r\n \r\n instance Applicative Parser where\r\n pure a = Parser $ \\char - > pure a\r\n (Parser contf) < * > (Parser cont) = Parser $ \\char - > (contf char) < * > (cont char)\r\n \r\n instance Alternative Parser where\r\n empty = Parser $ \\char - > empty\r\n (Parser cont) < | > (Parser cont&#39;) = Parser $ \\char - > (cont char) < | > (cont&#39; char)\r\n some (Parser cont) = Parser $ \\char - > some $ cont char\r\n many (Parser cont) = Parser $ \\char - > many $ cont char\r\n \r\nSome example parsers:\r\n\r\n item = Parser $ \\char - > asum $ map (\\c - > c < $ char c) [&#39;A&#39;..&#39;z&#39;]\r\n digit = Parser $ \\char - > asum $ map (\\c - > c < $ char (head $ show c)) [0..9]\r\n string s = Parser $ \\char - > traverse_ char s\r\n\r\nUnfortunately, I&#39;m having a hard time trying to understand how I might use this parser implementation. In particular, I do not understand what `Char - > f ()` should/could be and how I could use this to do simple parsing, e.g. to extra a digit out of an input string. I&#39;d like a concrete example if possible. Could someone please shed some light?\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "758" ], [ "I&#39;m trying to get the [Getting the Last Known Location tutorial][1] from Android Developers to work and having a tough time of it.\r\n\r\nIf I follow the tutorial as linked above, everything works until I run the app, at which time I get the error:\r\n\r\n > 02-29 15:25:00.542 14116-14116/local.test.t1 E/GMPM: GoogleService\r\n > failed to initialize, status: 10, Missing an expected resource:\r\n > &#39;R.string.google_app_id&#39; for initializing Google services. Possible\r\n > causes are missing google-services.json or\r\n > com.google.gms.google-services gradle plugin.\r\n\r\nGoogling this, I find that I need to register with Google somehow (but not mentioned anywhere in Google&#39;s tutorial).\r\n\r\nI eventually end up at [Accessing Google APIs][2], a separate tutorial from Google where it says:\r\n\r\n > Note: Before making calls to specific Google services, you may first\r\n > need to register your app in the Google Developer Console. For\r\n > instructions, refer to the appropriate getting started guide for the\r\n > API you&#39;re using, such as Google Drive or Google Sign-In.\r\n\r\nbut has no specific information for if I just want to use location services. I go there anyway and find I need to get a configuration file where I need to generate an SHA-1 which then points me to [this link][3] for generating it at which point I&#39;m now stumped. It says:\r\n\r\n To get the release certificate fingerprint:\r\n \r\n keytool -exportcert -list -v \\\r\n -alias < your-key-name > -keystore < path-to-production-keystore > \r\n\r\nWhat is this `path-to-production-keystore` that I am supposed to point to? It gives no further information. It does give an actual command for a debug fingerprint but says I should get both release and debug.\r\n\r\nCan someone please tell me if I&#39;m going down the wrong rabbit hole, or if it is the right one, what is the proper next step?\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_\r\n [3]: _URL_1_.html", "594" ], [ "I&#39;ve got time-series data that I&#39;d like to store in a database of the format:\r\n\r\n* group : string\r\n* date : date\r\n* val1 : number\r\n* val2 : number\r\n* ... valN\r\n\r\nThis database will be almost all reads. The searches will be for rows that belong to a group that is within a date range (e.g. group = XXX and date > = START and date < = END).\r\n\r\nThe data-set is big. Hundreds of millions of rows. Will SQLite be able to easily handle this kind of data? The appealing thing about SQLite is that it is serverless and I&#39;d like to use it if I can.", "668" ], [ "[sqlite-simple][1] is able to create prepared statements, but I cannot figure out how to use them with instructions that do not return results. That is:\r\n\r\n main = do\r\n db < - open \" ;test.db \" ;\r\n let a = 1\r\n let b = 2\r\n withStatement db \" ;INSERT INTO test VALUES (?, ?) \" ; $ \\stmt - > do\r\n bind stmt (a, b)\r\n ???\r\n reset stmt\r\n\r\nThe one API that \" ;fits \" ; in `???` is `nextRow` which requires data to be returned. So, how are prepared statements that return no results supposed to be used? \r\n\r\n [1]: _URL_0_", "290" ], [ "Let&#39;s say I have a data structure like the following:\r\n\r\n [( \" ;a \" ;, \" ;123 \" ;), ( \" ;b \" ;, \" ;234 \" ;)]\r\n\r\nand I want to populate a record like this:\r\n\r\n data R = R { a <IP_ADDRESS> Int, b <IP_ADDRESS> String }\r\n\r\nso that I end up with a record `r { a = 123, b = \" ;234 \" ; }` without having to manually write conversion code.\r\n\r\nVarious packages (like aeson and some of the command line parsing packages) do something like this and I&#39;d like to know about the available mechanisms that let me do this and how they are used. I&#39;ve heard about `Data.Data`, `Data.Typeable` and a few others but don&#39;t know how these work to make the magic happen.", "714" ], [ "I&#39;m trying to understand the reason for an error. Here is what I did:\r\n\r\n* Start Android Studio\r\n* Start a new project with a Blank Activity\r\n* Add the line `compile &#39;com.google.android.gms:play-services:8.4.0&#39;` to the dependencies section of the app module `build.gradle`\r\n\r\nThat&#39;s it. If I now run this app, it gives me the the following error in logcat:\r\n\r\n <PHONE_NUMBER>:28:58.646 3133-3133/local.abc.t2 E/GMPM: GoogleService failed to initialize, status: 10, Missing an expected resource: &#39;R.string.google_app_id&#39; for initializing Google services. Possible causes are missing google-services.json or com.google.gms.google-services gradle plugin.\r\n <PHONE_NUMBER>:28:58.646 3133-3133/local.abc.t2 E/GMPM: Scheduler not set. Not logging error/warn.\r\n <PHONE_NUMBER>:28:58.756 3133-3191/local.abc.t2 E/GMPM: Uploading is not possible. App measurement disabled\r\n\r\nHowever, if I replace `com.google.android.gms:play-services:8.4.0` by `com.google.android.gms:play-services-location:8.4.0`, the error is no longer present.\r\n\r\nI know that the `play-services` version includes multiple Google Play service APIs and `play-services-location` includes only the location APIs. So, at least one of the other APIs is causing the above error. Which one is causing which error and how can I find out?", "594" ], [ "Vim has a feature where it automatically inserts a comment prefix on a new line if the previous comment line is too long and is wrapped. It also inserts the newline prefix if you press Enter. This makes it easy to type long comments, but inconvenient when you want to end the comment. You have to hit backspace to remove the comment prefix on the last line.\r\n\r\nIs it possible to modify Vim so that if I hit Enter only at the last line, it knows to terminate the comment?", "774" ], [ "The [const wikipedia article][1] states:\r\n\r\n int *ptr; // *ptr is an int value\r\n int const *ptrToConst; // *ptrToConst is a constant (int: integer value)\r\n int * const constPtr; // constPtr is a constant (int *: integer pointer)\r\n int const * const constPtrToConst; // constPtrToConst is a constant (pointer)\r\n\r\nand \r\n\r\n const int* ptrToConst; //identical to: int const * ptrToConst,\r\n const int* const constPtrToConst;//identical to: int const * const constPtrToConst\r\n\r\nGreat.\r\n\r\nHow does this apply if I use `[]` instead of `*` to declare an array? For example, how do I turn the following:\r\n\r\n char s[] = \" ;Hello \" ;;\r\n\r\ninto a \" ;const pointer to const \" ;?\r\n\r\n [1]: _URL_0_", "638" ] ]
29
[ 18610, 13123, 11138, 13608, 300, 8866, 18332, 1116, 10517, 2771, 18549, 11462, 16795, 12429, 16456, 2476, 17958, 4715, 19170, 13429, 17876, 12315, 6645, 7779, 19299, 2988, 17289, 9417, 19058, 3612, 8218, 9272, 6862, 10997, 17375, 8570, 8433, 10608, 9645, 4891, 13606, 5732, 19285, 4482, 6481, 10864, 17490, 5487, 17161, 16074, 5432, 10436, 15339, 3722, 2744, 6380, 7542, 18876, 1769, 16754, 2676, 18678, 7870, 2296, 19215, 17213, 3664, 13915, 19789, 11028, 4143, 14659, 11066, 7703, 11786, 4466, 13473, 12465, 5752, 12784, 1027, 2121, 6724, 13516, 7088, 12442, 10933, 3162, 1789, 15040, 11192, 19744, 7733, 18451, 1670, 12261, 18376, 17420, 4871, 17007, 18329, 8516, 15147, 4384, 13895, 7414, 1040, 2649, 13846, 1912, 3746, 11751, 15849, 12678, 2436, 2697, 10344, 12591, 12158, 16210, 9139, 1758, 6971, 10238, 8211, 19791, 3091, 8194, 10638, 7200, 10601, 4879, 9997, 16152, 13612, 9165, 12280, 276, 9406, 10333, 16418, 8935, 3954, 8995, 16790, 12529, 5322, 3629, 15069, 15127, 17492, 6884, 8917, 9765, 8561, 15184, 15820, 822, 6921, 16900, 6068, 12406, 19291, 18937, 19777, 5867, 7766, 18919, 7837, 13613, 5575, 4694, 10468, 18929, 5073, 16658, 6860, 10051, 10966, 3638, 9899, 11564, 3372, 5526, 5033, 12141, 1881, 17106, 6621, 12893, 3990, 4164, 863, 1136, 19081, 12268, 2255, 5694, 434, 4640, 6578, 6673, 438, 9817, 8034, 10854, 8086, 575, 8029, 12574, 16341, 4798, 4033, 792, 13206, 589, 13064, 15066, 18838, 12307, 982, 18586, 6545, 10068, 7456, 18114, 9429, 2224, 16693, 3155, 4111, 13150, 842, 11409, 15925, 11912, 17047, 11408, 1258, 13666, 11349, 1923, 17959, 9091, 5521, 9359, 13458, 6062, 4699, 8724, 16106, 18701, 4447, 5874, 698, 2262, 9130, 10938, 6843, 10857, 1489, 14236, 18557, 6207, 16386, 19129, 14465, 3733, 1978, 9866, 12234, 6440, 16241, 5109, 4034, 9961, 8747, 254, 14455, 6789, 634, 2526, 14552, 18653, 5605, 8525, 11705, 15770, 18370, 967, 9053, 3342, 12706, 2544, 18550, 4386, 12183, 14118, 5041, 9988, 5011, 4182, 3504, 10464, 192, 18254, 5525, 18111, 11778, 18239, 6077, 1994, 15088, 6258, 16509, 3650, 10341, 11894, 8883, 12487, 15416, 17697, 9635, 5963, 1108, 13266, 9611, 3593, 780, 7918, 9917, 12887, 14584, 11274, 8764, 10355, 5966, 3244, 1748, 4017, 1356, 12804, 15391, 12832, 6150, 10624, 8805, 17011, 4577, 10453, 14424, 1699, 4980, 10729, 6389, 7446, 9760, 3146, 6866, 3022, 3836, 7842, 10094, 16173, 4840, 5475, 4226, 1794, 19422, 12128, 13922, 15319, 7321, 651, 18167, 1412, 17945, 10904, 10935, 18823, 18420, 6913, 1606, 2164, 4117, 3105, 235, 10606, 7020, 19074, 151, 5802, 11162, 18569, 18399, 7717, 17941, 10425, 2005, 573, 18348, 3942, 15014, 14472, 11363, 2281, 3768, 12055, 16012, 3810, 5389, 6991, 9520, 4503, 7649, 6579, 1587, 12639, 14720, 2632, 57, 18444, 19020, 13551, 10483, 17828, 19359, 3973, 1743, 18788, 18596, 12023, 3080, 19586, 15728, 8521, 14169, 16844, 8068, 13997, 4619, 3974, 8676, 1674, 3214, 5946, 1641, 6784, 5247, 17444, 402, 4068, 8973, 13309, 1721, 10147, 2083, 14028, 2491, 271, 18851, 12189, 10673, 13433, 3152, 13623, 8943, 16504, 8326, 1368, 6058, 8737, 11537, 14783, 6513, 3379, 4759, 8462, 9912, 13661, 5071, 17574, 10105, 10124, 6635, 667, 18279, 17388, 126, 314, 18646, 6899, 1141, 2720, 8620, 7345, 15519, 564, 1054 ]
STX_10025913.0
[ [ "@Tyler answer worked perfectly. \r\nI was trying to import dashboards from Java app to Kibana. Following worked fine on 6.3.0:\r\n\r\n HttpPost request = new HttpPost( \" ;_URL_0_;);\r\n StringEntity params =new StringEntity(IMPORTED_JSON_STRING);\r\n request.addHeader( \" ;content-type \" ;, \" ;application/json \" ;);\r\n request.addHeader( \" ;kbn-xsrf \" ;, \" ;true \" ;);\r\n\trequest.setEntity(params);\r\n\tHttpResponse response = httpClient.execute(request);", "178" ], [ "I am running docker for windows on Windows 10 Enterprise edition.\r\nIt runs successfully in windows container mode.\r\nWhen I do right-click on docker icon and \" ;Switch to Linux Container \" ;, it keeps on switching and after some time, it throws the below error:\r\n\r\n error during connect: Get _URL_4_: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.\r\n \r\n at Docker.Core.Pipe.NamedPipeClient.Send(String action, Object[] parameters) in C:\\gopath\\src\\_URL_2_\\docker\\pinata\\win\\src\\Docker.Core\\pipe\\_URL_0_:line 36\r\n at Docker.Actions. < > c__DisplayClass25_0.b__0() in C:\\gopath\\src\\_URL_2_\\docker\\pinata\\win\\src\\Docker.Windows\\_URL_3_:line 275\r\n at Docker.WPF.TaskQueue. < > c__DisplayClass19_0. < .ctor > b__1() in C:\\gopath\\src\\_URL_2_\\docker\\pinata\\win\\src\\Docker.WPF\\_URL_1_:line 59\r\n\r\nI am using hyper-v and it is enabled.\r\nThis issue is always reproducible. I have tried \" ;restoring to factory default \" ; and restart both but it does not solve my issue.\r\nPlease let me know if I am doing anything wrong here.", "707" ], [ "I did not get your question fully. The part that I understood is you obviously don&#39;t want to overbook rooms on a given date. \r\nIf it is the case, while showing available rooms, you can fire count(*) query for that date. There is no need to any update operation at that time. \r\nIt is at the time of actual booking, you need to handle the overbooking either by taking proper lock or writing query in a way that no. of rooms does not go below 0.", "510" ], [ "If you just want to print the sum of all the elapsedTime and their count, you can have two AtomicLong (if it is multi threaded app, otherwise long would also do) at instance level. \r\n\r\nTwo instance variables:\r\n\r\n private AtomicLong totalElapsedTime = new AtomicLong();\r\n private AtomicLong count = new AtomicLong();\r\n\r\nIn your method at the end:\r\n\r\n _URL_0_( \" ;elapsedTime: {}, toatlElapsedTime: {}, count: {} \" ;, elapsedTime, totalElapsedTime.addAndGet(elapsedTime), count.incrementAndGet());", "627" ], [ "I think you should have added GitHub certificate in truststore, not keystore. \r\nTruststore is where all the certificates are stored which client can trust on. \r\n\r\nIn JRE, it is stored in lib/security/cacerts file. So, if this file is getting replaced during upgrade, you need to re-import. You can also try backing up this file and restoring it again, but you will loose any new certs that this new Java provides out of box.", "11" ], [ "You can use lightweight database as [H2][1], [HSQLDB][2] or [SqlLite][3]. These databases can be embedded in the Java app itself and does not require extra server. \r\nIf your data is less, you can also save it in XML or Json by using any XMLParser or JsonParser (e.g. Gson()). \r\n\r\nYour DB table will have various attributes which are fetched from API as well as user inputs. You can write query on the top of these DBs to fetch and show the various results.\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_\r\n [3]: _URL_2_", "756" ], [ "I have an application which loads some data from XML.I have given 3GB of Xmx for this with G1GC as garbage collector set. \r\nThis works fine but for smaller footprint instances (where data is quite less ~100 MB), memory size still shows ~500MB even after invoking GC. \r\n\r\nSee attached image: \r\n1. Application started, Size = ~2.75 GB, Used = ~1.5 GB \r\n2. I pressed GC couple of times, Size and Used gets drooped but even now, Size is about 3.3 times of Used. (This 3.3 time holds true for bigger data also). \r\n[![JVisualVM][1]][1]\r\n\r\nMy question is there any way to reduce the gap between Size and Used memory so that unused memory can be released to OS.\r\n\r\n\r\n [1]: _URL_0_", "593" ], [ "I am trying to evaluate Consul Service discovery with Traefik as load balancer + reverse proxy. \r\nI have run Consul on my local machine and registered service1. Also, I started Traefik on my local machine. \r\nNow, I want Traefik to listen to Consul as backend. For this, I have put following in Traefik .toml \r\n\r\n [consulCatalog]\r\n endpoint = \" ;localhost:8500 \" ;\r\n watch = true\r\n prefix = \" ; \" ;\r\n domain = \" ;consul.localhost \" ;\r\n\r\nWith this, I can access service1 from Traefik as follows: \r\n < i > _URL_0_;\r\n \r\nMy question is that what should I put as URL if Traefik is running on some other host. Instead of localhost in above url, should I put actual IP? It does not seem to work.", "222" ], [ "I have embedded Jetty running on port 7000. Also, I have a keycloak server running on same machine on port 8100. \r\nMy all clients access goes via Jetty i.e. localhost:7000. So, I have put keycloak as reverse proxy on Jetty i.e localhost:7000/keycloak/auth will redirect to localhost:8100/auth. It is hitting correctly. \r\n\r\nNow, there is KeycloakInstalled client to authenticate the user. I have provided auth-url as _URL_1_. When I run this client, it correctly authenticate the user, but when retruning the token, it gives out the exception that auth-url (localhost:7000/keycloak/auth) given to it does not match the url from keycloak sever (localhost:8100/auth). \r\n\r\nI tried out doing following also: \r\n_URL_0_\r\nBut, I am unable to generate X-Forward headers from Jetty.\r\n\r\nAm I doing any basic thing wrong here?\r\nAny pointers here would be very helpful.\r\nThanks.", "222" ], [ "I am running embedded Jetty server with https/TLS enabled on it. It works perfectly with all modern browsers (TLSv1.2). \r\nWe have a legacy browser (.exe whose code cannot be changed/checked) which we are trying to connect to Jetty server over https, which is failing. \r\nI debugged SSL on jetty side and came to know that this browser is connecting using TLSv1, so I did the following:\r\n\r\n sslContextFactory.setIncludeProtocols( \" ;TLSv1 \" ;);\r\nAfter this, I started getting error \" ;no cipher suits in common \" ; on server side. To pass this (I know this is dangeropus, but still for now), I did:\r\n\r\n sslContextFactory.setExcludeCipherSuites();\r\nAfter doing this, I don&#39;t see any error on server side, but still legacy browser is unable to connect. (It can connect to other https site though as facebook, google). \r\nServer side logs after above change:\r\n\r\n WRITE: TLSv1 Handshake, length = 48\r\n called closeOutbound()\r\n closeOutboundInternal()\r\n SEND TLSv1 ALERT: \r\n warning,\r\n close_notify\r\n WRITE: TLSv1 Alert, length = 32\r\n\r\nAny idea what can be wrong here? I tried to do a lot of googling on it but cannot work it through. I also tried enabling SNI on server, but with no luck. \r\nAny help would be very appreciated. \r\nThanks \r\n\r\n**edit1**: \r\nIf I compare Jetty SSL logs with working request, I see below difference. Working request is sending application data also as below:\r\n\r\n WRITE: TLSv1 Application Data, length = 1285\r\nIn non-working request, I see below additional line (TLS_RSA_WITH_AES_128_CBC_SHA is cipher suite name):\r\n\r\n Cached server session: [Session-1, TLS_RSA_WITH_AES_128_CBC_SHA]", "86" ], [ "I am running ES and Kibana 6.3.1 on Linux (RHEL 6.5, Santiago) with default configs. \r\nES comes up fine and I am able to hit localhost:9200 also. \r\nKibana server also comes up fine with following message: \r\n\r\n Server running at _URL_0_\r\nBut when I try to access Kibana GUI, it keeps on loading showing Kibana logo with Loading written on its right bottom side. I am using firefox browser. \r\nPlease let me know what can be the issue?\r\nThanks.", "222" ], [ "I am running elastic search with non loop-back IP (production mode) on Windows. \r\nTo run ES, I am forking it out (elasticsearch.bat) from a Java app using ProcessBuilder. \r\nHowever, it is giving me following error: \r\n\r\n [2018-09-15T00:04:42,617][INFO ][o.e.b.BootstrapChecks ] [PC-VISHALG] bound or publishing to a non-loopback address, enforcing bootstrap checks\r\n [2018-09-15T00:04:42,632][ERROR][o.e.b.Bootstrap ] [PC-VISHALG] node validation exception\r\n [1] bootstrap checks failed\r\n [1]: granting the all permission effectively disables security\r\n\r\nIt runs fine when I run it as dev mode. I know above issue is raised as part of bootstrap checks, but how to correct/avoid this issue. It has been a blocker for me. \r\nThis issue is coming on 6.3.1, 6.3.0 seems to be working fine.", "375" ] ]
130
[ 18849, 17705, 16450, 9204, 9650, 1883, 6821, 10682, 13495, 13193, 836, 11372, 3828, 8212, 10850, 9722, 2989, 2652, 13981, 16706, 13723, 6553, 9163, 14300, 10875, 2065, 17899, 9804, 12367, 8591, 6994, 14598, 4373, 19278, 274, 15230, 3590, 3280, 2211, 14447, 6603, 355, 12087, 10287, 12927, 600, 12181, 15117, 17773, 5261, 13621, 11761, 9235, 6474, 10704, 11043, 2417, 8870, 17329, 5434, 11369, 9387, 5019, 16802, 2075, 3689, 9363, 6773, 16197, 9581, 8534, 4933, 16057, 5142, 14148, 10054, 6950, 14372, 5656, 13420, 8237, 16271, 6669, 16699, 3591, 15485, 14902, 7451, 13717, 12262, 18722, 15187, 5726, 8118, 7495, 14303, 11011, 16908, 12284, 17771, 9860, 9199, 366, 3427, 3511, 6920, 5499, 7119, 13741, 14222, 14046, 3128, 560, 13728, 5784, 2994, 6811, 5740, 2925, 10838, 2756, 17384, 12599, 17163, 13291, 73, 16325, 19727, 14179, 2674, 14616, 3242, 1058, 11323, 5231, 17658, 15018, 19056, 11373, 3851, 15679, 10244, 18098, 9857, 17900, 11621, 15260, 7595, 1365, 9503, 15733, 13864, 8971, 19388, 10234, 17291, 3837, 1944, 11279, 4278, 3252, 14700, 18161, 7983, 4822, 1424, 11296, 2948, 14160, 6378, 4077, 18956, 15315, 6104, 14940, 16766, 9934, 19191, 11000, 15442, 10153, 17992, 1955, 466, 9097, 4335, 7062, 9657, 7533, 1485, 19163, 15405, 13939, 13619, 19774, 8691, 2887, 731, 4825, 3472, 14429, 13961, 10902, 5547, 5873, 10135, 14987, 4677, 10018, 13120, 5040, 14946, 4758, 7726, 17826, 4556, 3049, 7598, 8349, 15602, 15478, 11884, 16462, 9007, 12422, 4192, 9428, 4676, 11243, 15229, 9030, 5730, 10023, 809, 16356, 3824, 12498, 4125, 11857, 14421, 5153, 15765, 18871, 9293, 195, 13325, 1871, 12548, 12825, 2304, 7747, 9325, 11780, 10771, 384, 6594, 7774, 3885, 13886, 12869, 6093, 6465, 13306, 8797, 147, 7155, 9302, 5751, 17273, 11380, 8404, 3855, 10357, 16629, 14712, 8685, 3465, 2295, 1057, 13632, 13581, 142, 17449, 8461, 10417, 16368, 12697, 13482, 9546, 8092, 15588, 12131, 19612, 2225, 2611, 6364, 15565, 11359, 2408, 17648, 14411, 15454, 11266, 11031, 4052, 7365, 6252, 6804, 19312, 7841, 7877, 14038, 7074, 12774, 13546, 5240, 129, 14438, 17018, 17783, 18522, 8148, 10371, 11789, 17089, 18153, 8197, 15542, 17137, 14167, 11312, 9138, 14732, 10167, 18423, 16799, 15126, 9087, 3340, 7037, 1121, 14446, 4038, 511, 13577, 19106, 12986, 6736, 10508, 7388, 13182, 15028, 4851, 6814, 11822, 9481, 11131, 18342, 6816, 16815, 3879, 11098, 15154, 15134, 19123, 1910, 18170, 11593, 17358, 1460, 408, 15166, 10955, 19287, 1493, 18906, 10099, 4835, 11756, 18719, 19318, 9077, 6634, 3784, 17612, 18229, 18780, 14304, 12875, 13339, 17971, 7248, 372, 2122, 17830, 631, 4245, 15720, 9426, 13112, 5378, 6312, 16381, 8859, 2755, 3021, 13481, 2627, 8308, 15676, 14313, 4413, 8366, 16028, 16139, 5491, 19622, 11510, 4947, 14131, 12418, 4547, 4045, 15294, 17623, 17261, 12249, 13010, 19101, 7151, 9830, 15009, 2222, 17055, 13742, 1456, 4826, 10533, 12185, 18358, 14190, 13912, 16183, 19608, 11100, 12006, 11319, 7799, 13233, 14845, 16433, 19457, 14220, 9502, 12779, 12311, 13021, 2646, 6441, 19114, 5793, 3364, 9189, 4733, 15486, 9770, 15061, 87, 4804, 1622, 17299, 10178, 11948, 1623, 13483, 1803, 7592, 416, 13208, 12319, 13957, 3776, 12788, 16342, 19296, 18822, 6322, 8177, 18263, 14990, 10011, 16358, 14520, 14297, 6601, 16840, 18979, 11707, 14017 ]
STX_10029475.0
[ [ "sorry for the late reply, been working doubles at work on my odd job while I can. Usually there never enough hours there. This didn&#39;t work, the 2nd backgroundworker never highlights, it&#39;s says never used. I&#39;m gonna post my whole code below in a little bit. So you can see it. I&#39;m not sure if it&#39;s the background worker class at this point or the activity class that it&#39;s coming from or what. I have played with it a bit and it keeps crashing. Give me a few minutes I code on a computer with no internet on it, so I have to copy and paste the files on a flash drive then I will post them here.", "121" ], [ "ok I edited the code up top so you can see better what I have done. To use two of the background worker classes, one is always dark saying unused. I initiated the async in the method as it was the only way to get rid of the error. In android studio everything in the activity class is checked to green. In the downloadworkerclass there are a few yellow but no red and all the yellow seem insignificant.", "666" ], [ "yes but these are the only 2 strings I have parsed anything in. And they both look correct RequestBody requestBody = RequestBody.create(MediaType.parse(getContentResolver().getType(selectedVideo)), vidfile);\n MultipartBody.Part file = MultipartBody.Part.createFormData( \" ;filename \" ;, vidfile.getName(), requestBody);\n RequestBody desc = RequestBody.create(MediaType.parse( \" ;text/plain \" ;), vidfile.getName());", "178" ], [ "thank you for your reply. I think you are on the right track here. I do think there was a problem with the path before but now that i think is fixed. I am getting the ID, and the desc( which is the file name) the url post to the Database is 1535579779132.multipart/form-data and no file is actually uploading. on top of it the app crashes but it&#39;s at least posting. So there is definitely a problem between the two. PHP is not my strong point. I only learned it as much as I needed it in order to learn android. so off to google i go", "973" ], [ "I wanted you to know I went back to an older way of doing it and i got my file to upload. Instead of using @Part MultipartBody.Part file and the rest of the multipart i used (@Part( \" ;image\\ \" ;; filename=\\ \" ;myfile.jpg\\ \" ; \" ;) RequestBody file and then changed some on the php side. It finally uploaded. I would like to learn the MultipartBody.Part but I am totally lost for figuring it out. My PHP skills are just not that good. But I finally got my file to upload so I&#39;m taking that as a win for today, got to take my victories where i can. I saved the other code with the error, love to learn how to fix", "973" ], [ "Ok, So I&#39;m trying to learn how to stream video for the first time but I have some questions as there is a lot of info out there on the android side, some old etc and not very many tutorials on the whole process as far as server side. First, what is the difference between these two methods for streaming a video off xampp? These seem to be the two most common answers I find for video on android. The first seems very <PERSON> like, send a URL and boom get your video. Very easy. The Retrofit is more involved but I don&#39;t know the reasons why I would go that route, much like I don&#39;t use retrofit to get my images. \r\nCan anyone explain to me the difference here so I&#39;m doing this the right way.\r\n\r\n String url = \" ;_URL_1_;;\r\n\r\n @Override\r\n public void onCreate(Bundle savedInstanceState) {\r\n super.onCreate(savedInstanceState);\r\n setContentView(R.layout.main);\r\n VideoView myVideoView = (VideoView)findViewById(_URL_0_.myvideoview);\r\n myVideoView.setVideoURI(Uri.parse(url));\r\n myVideoView.setMediaController(new MediaController(this));\r\n myVideoView.requestFocus();\r\n myVideoView.start();\r\n }\r\n }\r\n\r\nand a retrofit stream like so.\r\n\r\n interface Service {\r\n @GET( \" ;path/to/your/resource \" ;)\r\n @Streaming\r\n Call < ResponseBody > getData();\r\n }\r\n\r\n\r\n Call < ResponseBody > call = service.getData();\r\n try {\r\n InputStream is = call.execute().body().byteStream();\r\n (...)\r\n } catch (IOException e) {...}", "261" ], [ "Thanks. That whole Step 2. Importing the project and cloning it. I have never really had to do any of that before. Is that even necessary. Can I simply implementation in my gradle? Also does Exoplayer lag like the android video view from android off the URL? I just read a thing by instagram saying they solved that with a proxie server ect... way out of my resources league. I&#39;m just curious if any streaming done will lag of xampp.", "330" ], [ "OK this is driving me nuts. I was hoping to learn how to do this by today.\r\nHere is what I have. This is a Multi choice ListView obviously.\r\nYou click the the Selection it selects, you unclick the selection it de selects.\r\nIt ALMOST works perfectly. There is only one problem. It only works when 1 item is already selected. If an item is selected, Items can be selected and de selected NP. But if nothing is selected, the last one stays selected. How to I fix that?\r\n\r\n public void onItemClick(AdapterView < ? > adapterView, View view, int Position, long l) {\r\n int cntChoice = listview.getCount();\r\n SparseBooleanArray sparseBooleanArray = listview.getCheckedItemPositions();\r\n for (int i = 0; i < cntChoice; i++) {\r\n if(sparseBooleanArray.get(i)) {\r\n switch (Position) {\r\n case 0:\r\n if (listview.isItemChecked(0)) {\r\n A = \" ; \" ;;\r\n A = \" ;T \" ;;\r\n } else if (!listview.isItemChecked(0)) {A = \" ; \" ;; A = \" ;F \" ;;}\r\n break;\r\n case 1:\r\n if (listview.isItemChecked(1)) {\r\n B = \" ; \" ;;\r\n B = \" ;T \" ;;\r\n } else (listview.isItemChecked(1)) {B = \" ; \" ;; B = \" ;F \" ;;}\r\n break;\r\n case 2:\r\n if (listview.isItemChecked(2)) {\r\n C = \" ; \" ;;\r\n C = \" ;T \" ;;\r\n } else (listview.isItemChecked(2)) {C = \" ; \" ;; C = \" ;F \" ;;}\r\n break;\r\n }\r\n\r\n Toast.makeText(Billing.this, \" ;data \" ; + A + \" ;, \" ; + B + \" ;, \" ; + C, Toast.LENGTH_LONG).show();\r\n\r\n }", "917" ], [ "I used it and another post. by <PERSON>_ I figured out how to get my string-array loaded. and I kind of understand what is going on. I have a view that appears to work, but I am a lost for implementing the function I had above, link variable & toast. I can see I am getting the position in public void onBindViewHolder, I can build a switch there from model.isSelected() i believe but how to toast it as the class has no layout?", "917" ], [ "well what I did is linked a variable to each position. and then I want to send the variable over so I can then use retrofit to send it to the sql. So I got a list of hobbies. and that makes it easier to track user hobbies. But I want to send all variables over not just the ones clicked. Their True or False value changes on the click. I think I can intent it over. I was getting an error before but I am trying Intent sendhobby = new Intent(view.getContext(), hobby.class) and that isn&#39;t giving me an error. I have yet to test it yet though.", "970" ], [ "man youtube videos and tutorials don&#39;t cover such things as naming convention. I know you may have learned that in your fancy classes and what not, but those of us learning on the web simply don&#39;t see that subject covered. We just trying to learn. Which is what this site is for. I have tried to toast ptList from this method. private void generatePtList(ArrayList < dogdata > ptList) above but it just crashes. Using this way. _URL_0_. both my other Recycler views use List < > not ArrayList < > . and my learning of cont..", "261" ], [ "Ok so I have a db of Users (ID) and their T or F results to different Hobbies. So something like this, excuse the formating I didn&#39;t know how to space it.\r\n\r\n ID | swimming | running | rock climbing | learning to program.\r\n \r\n user1 T F T T\r\n \r\n user2 F T T F \r\n\r\n \r\nOK I wanted to do a SQL search where I return all Column names of a table, if the value of that column is \" ;T \" ; where the ID is the users ID.\r\n\r\nso if the ID is user1, I return swimming, rock climbing, learning to program.\r\n\r\nNow I couldn&#39;t figure out how to do this with SQL so I figured I could try do this manually with PHP.\r\n\r\nSo I tried something like this.\r\n\r\n $stmt = $this- > con- > prepare( \" ;SELECT swimming, running, rock, \r\n program FROM mytablehere WHERE ID = ? \" ;);\r\n $stmt- > bind_param( \" ;s \" ;, $ID); // specific ID is went in via here\r\n $stmt- > execute(); \r\n $stmt- > bind_result( $swimming, $running, $rock, $program);\r\n $stmt- > fetch(); \r\n $user = array();\r\n if($swimming == \" ;T \" ;){\r\n\t $swimming = \" ;swimming \" ;;\r\n\t $user[&#39;swimming&#39;] = $swimming; }\r\n ...\r\n\treturn $user; \r\n\r\nSo the idea is it would find the binds that are \" ;T \" ; and insert them into the user array, and leave the ones that are \" ;F \" ; out.\r\n\r\nHowever my postman tells me, no data is found. \r\nSo my question is how do do I get this sort of function. Is there an SQL search to make this easier or how do I need to approach my PHP code differently.\r\nCan I not if then the bind $swimming or do I have to bind them all to one array, and then return a different array at the end?", "215" ], [ "if($user[&#39;swimming&#39;] == \" ;T \" ;){\r\n\t\t$hobby[&#39;swimming&#39;] = \" ;swimming \" ;; }\r\n\r\n return $hobby\r\n\r\n\r\nthere should really be an easier way to do this. If anyone has an sql search that would be great. But this will allow you to do it via php. I was having issues with my postman which was stopping me from getting data, but once I did the code up top will just give you an useless mess. This will return only the column names but it has to be done manually.", "215" ] ]
164
[ 18362, 228, 1287, 5953, 17868, 4279, 3411, 1729, 17965, 10433, 11682, 18244, 9778, 8735, 12220, 15645, 1376, 1804, 14299, 4438, 4671, 15118, 15447, 7758, 669, 9584, 2378, 8736, 6015, 16556, 11674, 12806, 14142, 16396, 6861, 450, 6693, 10690, 7335, 11047, 590, 15326, 17004, 7105, 6509, 13294, 10989, 7333, 17194, 12937, 16540, 12547, 7820, 5766, 13950, 6504, 14066, 11480, 18175, 16476, 3212, 13647, 3682, 1214, 9838, 14217, 13297, 5645, 15007, 6363, 7138, 4681, 6520, 4473, 2519, 3545, 14527, 17396, 17791, 5625, 2688, 1685, 8337, 9756, 19762, 9790, 9834, 16986, 15035, 3521, 16023, 11755, 3430, 10119, 19194, 8199, 16246, 1540, 13681, 4088, 15711, 7812, 13332, 10778, 6586, 9777, 10171, 14006, 13296, 5976, 10520, 2453, 13665, 15081, 1626, 14906, 14468, 12267, 9712, 3463, 6267, 4832, 14644, 15243, 14515, 1949, 11538, 7578, 4880, 5449, 19283, 7667, 14717, 13393, 16463, 5703, 14435, 10866, 7727, 3313, 1906, 6907, 13927, 18368, 691, 14826, 8565, 13593, 17826, 2240, 12263, 3779, 2594, 17193, 19749, 14593, 17943, 11325, 19773, 14001, 3683, 9270, 18688, 2047, 13386, 9954, 5667, 8272, 1322, 6567, 6632, 15111, 14847, 15940, 7984, 9915, 17591, 12628, 1542, 13780, 3944, 4896, 12246, 13744, 9661, 8712, 12936, 13301, 1280, 15021, 19143, 10671, 12828, 19735, 2096, 14934, 17853, 13348, 19468, 11109, 7653, 12871, 12121, 5680, 6244, 4383, 11909, 152, 7089, 11886, 15630, 2875, 13952, 3435, 3652, 11952, 9928, 605, 526, 12849, 13072, 12846, 16961, 6388, 13275, 11423, 12989, 9103, 6865, 9700, 9864, 12000, 5062, 7674, 11217, 8051, 7291, 12019, 938, 5097, 10340, 844, 15020, 5774, 6591, 15927, 11305, 9522, 15429, 1653, 15706, 2956, 2170, 13389, 14397, 19575, 14008, 5554, 7717, 13312, 4380, 8984, 8480, 13224, 465, 5624, 6129, 110, 18572, 5382, 10757, 368, 16315, 5159, 2401, 16101, 783, 18450, 637, 4541, 167, 3310, 8466, 19257, 8098, 11951, 8240, 944, 14615, 12133, 1284, 11545, 16832, 6112, 17821, 10391, 14136, 15828, 10921, 2277, 3169, 14718, 10473, 9857, 2117, 7203, 182, 6722, 16562, 15421, 8882, 11905, 10086, 5227, 3377, 19540, 19674, 12060, 14464, 12443, 4355, 12431, 11224, 4270, 18894, 9291, 4889, 12427, 2409, 158, 15838, 10201, 16876, 14039, 12191, 10360, 17435, 1825, 11151, 15396, 11594, 11858, 11259, 13467, 11003, 12667, 15514, 4046, 4717, 15568, 11087, 8909, 16649, 14630, 13849, 3654, 5848, 8662, 11402, 5842, 12655, 12063, 10580, 15385, 7272, 9318, 14108, 10721, 7394, 9734, 16735, 3553, 15068, 8819, 15218, 12946, 16070, 2469, 6451, 8955, 4793, 5982, 16415, 3148, 8341, 17438, 12672, 17570, 13423, 15922, 7496, 1917, 12620, 2760, 5776, 5466, 14903, 14375, 9223, 12016, 13686, 5275, 10884, 16305, 5381, 874, 13607, 7972, 15180, 19017, 8177, 14909, 13936, 14541, 6003, 18024, 4805, 14601, 15110, 17337, 6938, 11599, 14941, 12683, 2444, 5742, 17854, 7587, 17315, 13023, 16267, 18756, 13800, 13601, 19435, 3314, 8520, 16087, 11256, 11670, 13982, 14408, 15491, 6493, 16172, 1742, 1567, 8277, 8815, 13983, 14412, 5021, 3487, 17689, 19488, 19223, 17345, 15434, 11955, 15515, 12567, 9021, 4649, 9126, 13207, 17098, 15299, 19697, 17995, 4228, 2947, 17522, 14950, 17471, 7899, 10851, 6625, 14999, 2859, 186, 15529, 19093, 12250, 12615, 10769, 13781, 10532, 8447, 19407, 13742, 6266, 8772, 18145, 15188, 15254, 2644, 14898, 15451, 8807 ]
STX_10030961.0
[ [ "The service:\r\n\r\n public _params: Subject < any > = new Subject < any > ();\r\n setParameters(search: SearchContext) {\r\n this._params.next({action:&#39;test&#39;});\r\n }\r\n\r\nThe component:\r\n\r\n import { Component, OnInit, OnDestroy } from &#39;@angular/core&#39;;\r\n import { Subscription } from &#39;rxjs&#39;;\r\n import { Your service } from &#39;service_route&#39;\r\n\r\n export class YourComponent implements OnInit {\r\n public subscription: Subscription;\r\n\r\n constructor(private _serv: YourService) {}\r\n \r\n ngOnInit() {\r\n this.handleSubscriptions();\r\n }\r\n public handleSubscriptions() {\r\n\t\t this.subscription = this._serv._params.subscribe(\r\n\t\t\taction = > {\r\n\t\t\t\tconsole.log(action);\r\n\t\t\t}\r\n\t\t )\r\n\t }\r\n }\r\n\r\nNow you can call your service function and everytime you call it your component will console.log &#39;test&#39;", "769" ], [ "But please could you answer my question? The console statement will only be triggered when you call to your setParameters() service function. This is the way I work usually, never had a problem with this. I use this subscription for several functionalities such as sidebars ( to open it and close it ) notification growls and so on. Confirm if you called to the function and if you did I will check the code for if i made a mistake. Thank you", "123" ], [ "The best and most recommended way to work with async functions in Angular is using Observables. Lemme show you.\r\n\r\nFirst of all you have the service where you make the HTTP petitions to the backend of the application. ( I assume that you&#39;re already familiar with the services so let&#39;s just explain the function)\r\n\r\n public get() {\r\n // This is the get method of your customer service\r\n return this._http.get( \" ;_URL_0_;);\r\n }\r\nYou should provide the Http service to work with it and the above method will return an Observable. Now you&#39;re ready to catch the response from your component. Component:\r\n \r\n public customers: Customer[]; \r\n\r\n constructor( private customerService: CustomerService ) {\r\n // It&#39;s not a good practice to call here to your customer service so just define the variable where you&#39;ll store the data\r\n this.customers = [];\r\n }\r\n\r\n ngOnInit() {\r\n // Now here is where you call to get the data\r\n this.customerService.get()\r\n .subscribe( res = > {\r\n this.customers = res;\r\n console.log(this.customers); // Here you will have the customers\r\n });\r\n \r\n console.log(this.customers); // Here the array is empty\r\n }", "244" ], [ "This is against the async programming itself. It&#39;s like calling a console.log() inside a setTimeout and after that calling again another console.log() but without setTimeout and pretend to print the setTimeout&#39;s console.log first. When the console.log which is outside the subscribe is called the array is still empty cuz the observable response haven&#39;t arrived yet", "283" ], [ "I need some help with a MySQL query which is bringing me a headache.\r\n\r\nBasically I have two tables which are related. The first table is called &#39;books&#39; and it contains the basic information about a book. Then I have an other table called &#39;user_books&#39; which is related to the previous table and other table (which is irrelevant in the question). This is how the books table looks like:\r\n\r\n | b_id | b_name | b_description |\r\n ---------------------------------------------------\r\n | 1 | Book1 | Description1 |\r\n | 2 | Book2 | Description2 |\r\n\r\nThe &#39;user_books&#39; table has this content:\r\n\r\n | ub_userid | ub_bookid | ub_rating | ub_default |\r\n ------------------------------------------------------\r\n | 10 | 1 | 5 | 1 |\r\n\r\nThe user_books table has two primary keys: ub_userid and ub_bookid.\r\n\r\nNow I need to make a query which returns all books of the books table and for each book the rating of a given user and a column that in case that there is a record for the book in the user_books table return 1 but if there isn&#39;t any book with that bookid return 0.\r\n\r\nMy desired output given the user 10 would be this:\r\n\r\n | b_id | b_name | b_description | ub_default | active |\r\n ----------------------------------------------------------\r\n | 1 | Book1 | Description1 | 1 | 1 |\r\n | 2 | Book2 | Description2 | 0 | 0 |\r\n ----------------------------------------------------------\r\n\r\nI&#39;m using MySQL 5.7\r\n\r\nThanks so much in advance for any kind of help.", "215" ], [ "I finally got it! Reading that post helped me but that wasn&#39;t all ^^ my query is little different because in that post he desires to return only the columns with a given string. I needed to return all columns and add if they exist or not in the other table which has some differences. However the logic was more or less the same, using a LEFT JOIN and two IFs I managed to get what I wanted. Thanks for the help", "308" ], [ "First of all, to solve your problem with displaying the 0% you should compare with a number.\r\n\r\n < div *ngIf= \" ;discountPercent !== 0 \" ; > \r\n ....\r\n < /div > \r\n\r\nSecondly you have just one route, which is the route where you show all products so now you have to add a new route and a new component.\r\n\r\nRoute.ts\r\n\r\n { path: &#39;product-details&#39;, component: ProductDetailsComponent},\r\n { path: &#39;product-details/:id&#39;, component: ProductComponent}\r\n\r\nThis will make you have an individual page to each product. Now, to know which product are you seen you have the id of the product, which you pass it thru the URL. For example, if you want to see the information about product 22 you will have to navigate to \" ;_URL_0_;.\r\n\r\nOnce there, you&#39;ll have to recover the id in your new component (ProductComponent) from the URL parameters.\r\n\r\nProduct.component.ts\r\n\r\n import { Component, OnInit } from &#39;@angular/core&#39;;\r\n import { ActivatedRoute, Params } from \" ;@angular/router \" ;;\r\n\r\n export class ProductComponent implements OnInit {\r\n public product: any;\r\n \r\n constructor( private route: ActivatedRoute ) {\r\n \r\n }\r\n\r\n ngOnInit() {\r\n this.route.params.subscribe(\r\n params = > {\r\n const id = +params[&#39;id&#39;]; // Recovering the id from URL\r\n this.loadProductInformation(id);\r\n }\r\n )\r\n }\r\n\r\n private loadProductInformation(id: number) {\r\n // Here you make the call to your service to get your product data\r\n \r\n }\r\n }\r\n\r\n\r\nFinally as you did in your ProductDetailsComponent you make some HTML to show the information.\r\n\r\nEdit: I forgot that you have also to change the RouterLink in ProductDetailsComponent to navigate to the product ID. In order to do that you have to do something like `routerLink= \" ;/product-details/{{_URL_1_}} \" ;`", "670" ], [ "Yes, of course you can.\r\nIn case that you just need to modify styles of a PrimeNG component you could override the css sleectors that each component provides. In case that you have to change the functionality you can use inheritance to modify the component to add your custom functions and stuff.\r\n\r\nTake a look to this post, it surely will clear your mind _URL_0_", "693" ], [ "Use `ls -la ./_URL_1_` in order to see the file permissions. \r\n\r\nLook at the beginning of the output, you&#39;ll see something like this:\r\n\r\n -rw-rw-r--\r\nThe first - means if is a directory or a file. In this case means that is a file.\r\nNow If you observe the remaining chars there are 3 sets of 3 chars with means the permissions for the owner of the file, the owner group and the last set is for the rest of the users.\r\n\r\nWe have permissions to read, write and execute and in the example I showed there are read and write permissions for the owner user and the owner group but non permissions for the other users.\r\n\r\nAs Is said above you can just use sudo every time you execute the script but to run it with root privileges. However I would recommend you change your file permissions and using chmod\r\n\r\n sudo chmod +x ./_URL_1_\r\n\r\nThis will let you execute the script. Take a look at chmod documentation to learn more: _URL_0_", "740" ], [ "The `-a` option will show all hidden files and directories (Those who start with . \" ;\r\n\r\nThe `-l` options shows the permissions, owner, group and more information\r\n\r\nFinally the `-F` classify the results in files and folders. Adding a \" ;/ \" ; at the end of the row for each folder. In case the file is a binary it will put a different character. It&#39;s a parameter to make things more visual when you have a lot of files and directories with different extensions.\r\n\r\n - \" ;@ \" ; Is shown when a file is a symbolic link\r\n - \" ;* \" ; When is executable\r\n - \" ;/ \" ; Means that is a directory\r\n - \" ;| \" ; for pipes.\r\n\r\netc..\r\n\r\nYou can use `man ls` in order to know more parameters of ls", "879" ], [ "If you want to get values from JSON, you don&#39;t need to use regex and make a very complex regular expression.\r\n\r\n var data = {\r\n \" ;username \" ;: \" ;abc \" ;,\r\n \" ;password \" ;: \" ;xyz123 \" ;,\r\n \" ;Security \" ;:{\r\n \" ;SecurityQuestion \" ;: \" ;what is your first pet name \" ;,\r\n \" ;SecurityAnswer \" ;: \" ;snoopy \" ;\r\n }\r\n }\r\nThat is your object, now if you want to retrieve the data simply treat it like a json.\r\n\r\n function retrieveData( Obj ) {\r\n return {\r\n username: Obj.username,\r\n Security:{\r\n SecurityQuestion: Obj.Security.SecurityQuestion\r\n }\r\n }\r\n }\r\n\r\n var extractedData = retrieveData(data);", "385" ], [ "I was just wondering about the same issue and figured out a little work around.\r\n\r\nThere is a style class \" ;ui-contextmenu-selected \" ; which is added to the selected row with the right click. Using the event onContextMenuSelect you could remove that class from the row and select the row with the common way ( I assume that you have a variable &#39;selectedRow&#39;, so the only thing you have to do is to add the row data to your selectedRow var)\r\n\r\nThe tricky part here is just to filter and reach the HTML row from the selected context row data, using a little bit of JQuery won&#39;t be hard.\r\n\r\nEdit: This is what I&#39;ve done inside of the event trigger function\r\n\r\n unselectContextRow( row ) {\r\n this.selectedRow = row.data;\r\n setTimeout(()= > {\r\n $(&#39;.ui-contextmenu-selected&#39;).removeClass(&#39;ui-contextmenu-selected&#39;);\r\n })\r\n }\r\nThis code works for single selection, if you want to make it work with multiple you just have to deal with the array.", "645" ], [ "When you make some changes in your code use the \" ;commit \" ; for updating your local repository, once you&#39;re ready to send those changes to the remote server you should \" ;push \" ; and your local commits will be added into the remote server.\r\n\r\nNow you have your own version of the code different from the remote servers one so you should \" ;merge \" ; them. I recommend you creating a branch to clear the changes and then merge it with the master.\r\n\r\nUsing a tool like DiffMerge will make your life easier to merge code.", "808" ], [ "Since I cannot comment your post I will use this reply not to solve your question but to explain what does *args and **kwargs.\r\n\r\nAs far as I know, both arguments are used to pass an undeterminated number of arguments so they will be stored in a list ( args ) or in a dictionary ( kwargs ). So using those arguments you&#39;re able to loop over all parameters.\r\n\r\nThe needed params you have to provide to that function I have no idea, try looking the official documentation, surely there you&#39;ll find the arguments you need to pass to the function", "172" ], [ "Before making the push you must be sure that your code won&#39;t fuck up the already commited changes in the remote server. So, make a new branch \" ;git branch &#39;name&#39; \" ; then push your changes to that branch ( you must switch from the master branch to the new branch you created first ). If you don&#39;t have any tool to deal with merges you must do it by hand ( as far as I know ) so try using the \" ;git log \" ; and \" ;git diff \" ; to see the changed files and try to merge it with your files. You can configure a merge tool and the use the command \" ;git mergetool \" ; to merge the codes.", "808" ], [ "I think you can&#39;t do what you wanna do, because until the subscribe in your service doesn&#39;t get resolved it won&#39;t send anything to the component, in the execution of the component it&#39;s undefined cuz the response haven&#39;t come yet.\r\n\r\nThat&#39;s why callback functions are invented. The correct way to do it is having the subscribe in your component cuz you want to wait for the response of the service.\r\n\r\nSorry but I cannot use comments yet so I had to make this reply. Hope it helps", "244" ], [ "Watch out, in your code, every time the user submit the form your code establish the conexion with mysql, creates a database and creates a table ( wrongly cuz you don&#39;t select the database in the conexion so it won&#39;t be created ( the table I mean ). You must separate your code, and the only thing you have to execute when the user submit the form is the INSERT sentence. \r\nSo let&#39;s see, you can stablish the conexion like you do and then look if the database is created:\r\n\r\n SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = &#39;Arsenal&#39;\r\nOnce you know that the database is created and exists you select it in your conexion:\r\n\r\n $mysqli = new mysqli(&#39;<IP_ADDRESS>&#39;, &#39;root&#39;, &#39;&#39;, &#39;Arsenal&#39;);\r\nBut be sure you don&#39;t do it while you&#39;re connected with the last conexion you created to check the database ( you should finish it or modify the conexion, more at _URL_0_ )\r\n\r\nSo now you&#39;re connected to the right database and you&#39;re able to create the table, you have to do it just one time, not every time the user submits the form.\r\n\r\nFinally when you have your table you&#39;re able to do the insertion every time the user submits the form.\r\n\r\nYour sentences were good only you have a little misunderstanding about how SQL works.\r\nIn addition, that kind of code is vulnerable to SQL Injection ( the user could execute SQL instruction using your form, so they would be able to do whatever they want with the DB or even the computer which owns the DB ) take a look to prepared statements once you get better with the basics of PHP - MYSQL.\r\n\r\nI hope this solved your wonder, be free to comment if you have any doubt", "768" ], [ "Think in an scenario where you have a table of users. The users have a role assigned and a referer field which is the ID of other user with a higher role. Let&#39;s assume that we have 5 roles having the fifth the higher one. The referer id is always the ID of the user who has added this user and it only can be in one role higher\r\n\r\nI want to get all the users who are below the role 5 ( starting with the role 4 ) but they must be refered by the user or a user who has been refered by my user and so on. Example:\r\n\r\n User1: [ role: 5, referer: 0 (because is the first user), id: 1]\r\n User2: [ role: 4, referer: 1, id:2]\r\n User3: [ role: 4, referer: 44, id: 3]\r\n User4: [ role: 3, referer: 2, id: 4]\r\n User6: [ role: 2, referer: 4, id: 5]\r\n User7: [ role: 1, referer: 5, id: 6]\r\n User8: [ role: 1, referer: 44, id: 7]\r\n\r\nSo I want to query using the User1 data and the response should have the User2, User4, User6, User7.\r\n\r\nAny help would be appreciated.", "215" ], [ "So that way you don&#39;t send the dt reference from the template to the controller and because of that is undefined. I don&#39;t know it this will work because [rowStyleClass] is a directive but try this: [rowStyleClass]= \" ;highlightRow(dt) \" ; and in your controller&#39;s function set the arguments like I put in my reply and call dt instead of datatable or &#39;this&#39;", "213" ], [ "I need to cast a variable where I store an object depending on some conditions.\r\nI have this var:\r\n\r\n class MyClass {\r\n public referrers: SelectItemGroup[];\r\n }\r\n\r\nThis type is an object and you have to provide a label, items and optionally a value. The trouble comes when depending on some stuff I need to add only a few elements to this array and they don&#39;t have items so I need to cast `this.referrers` from `SelectItemGroup[]` to `SelectItem[]` and I am not really sure of how to do this.\r\n\r\nI tried `this.referrers = < SelectItem[] > this.referrers;` which obviously doesn&#39;t work.", "145" ], [ "You&#39;re printing the wrong variable in the first block. When you declare a variable with the reserved word var in the second line you&#39;re storing there the formatted date that you want to output, so you can just alert(n) or you can avoid declaring the var:\r\n\r\n var d = new Date();\r\n d.toLocaleDateString();\r\n alert(d);", "730" ], [ "You also can share cookies with multiple domains using the images or iframes. Having the user identification cookies in the backend. Also the images are much harder to detect and block by plugins than a XHR. I&#39;ve read that with js disabled it works.. it won&#39;t if you&#39;re collecting the data dynamically and putting it into the image source, but you can add manually an image into noscript tags which says to the backend that the user has disabled js, and the backend still would recognize the user.", "620" ], [ "I am doing a MySQL query which has to return all records from a table and add dynamically two columns, one is taking the value from other table and the last value is evaluating if a record exists in other table and returning true or false depending on it.\r\n\r\nLet me explain a little bit better:\r\n\r\nI have a table which stores information about books ( bookid, bookname, bookdescription ) there aren&#39;t any duplicated record in this table.\r\nI have a second table which stores a relation between users and those books ( it stores the reference to the book, the reference to the user ID, if this book is default and the rating of the book )\r\n\r\n*This is how my query looks like right now:*\r\n\r\n SELECT DISTINCT b.*,\r\n IF(ub.ub_bookid is not NULL AND ub.ub_userid = :userid , ub.ub_default, 0) AS \" ;default \" ;,\r\n IF(ub.ub_bookid is not NULL AND ub.ub_userid = :userid , True, False) AS \" ;visible \" ;\r\n FROM `books` as b LEFT JOIN `users_books` as ub\r\n ON ub.ub_bookid = b.b_id;\r\n\r\n > (Since I am doing the query from PHP with PDO the value :userid is given at the execution time)\r\n\r\nThe above query pretends to return all books from the book table, and for each book see if in the table users_books there is a record with the given userid, in case that it exists it will return the value of default and return a true in the \" ;active \" ; column. In the case that the record doesn&#39;t exists it will return a false has default and false as \" ;active \" ;.\r\n\r\n**My Problem:** When I have more than 2 relations with the same book but different users the query is returning duplicated entries. If I remove the `DISTINCT` the query returns duplicated entries if there is more than one record for the same book ( but obviously different user ids ).\r\n\r\nI am not really sure how to return only as many records as the books table has and avoid duplicating them. I&#39;ve been trying to use `GROUP BY` in order to achieve this but couldn&#39;t do it since the query fails when I use it.\r\n\r\nAny advice or help will be so appreciated. Thanks so much.", "215" ] ]
7
[ 12732, 19675, 10593, 7457, 7783, 86, 11908, 8880, 7644, 6435, 11846, 15077, 13714, 14489, 17744, 4320, 14034, 13228, 17548, 14296, 11022, 8894, 17077, 3498, 580, 14816, 4993, 3969, 17605, 14256, 9660, 2466, 15772, 10461, 13299, 19726, 2013, 12657, 11661, 17127, 10025, 15323, 248, 14215, 18104, 6613, 12956, 13698, 17755, 2202, 17662, 14645, 18087, 13767, 15297, 14575, 15882, 9436, 5868, 18815, 18511, 6911, 13189, 17380, 19722, 12016, 10748, 17503, 13032, 17285, 13770, 8492, 18070, 17150, 19528, 19013, 11305, 14182, 19557, 14590, 7268, 5982, 10676, 1575, 9330, 8260, 10898, 10180, 9072, 14926, 13144, 17053, 10372, 6308, 8155, 13409, 19327, 17726, 5064, 2267, 7036, 139, 12613, 16797, 8294, 11419, 11304, 10765, 9968, 17786, 5267, 15455, 6197, 7581, 13682, 7930, 2051, 15507, 4599, 15190, 17675, 3098, 13137, 19245, 14607, 14870, 155, 11449, 16105, 6130, 14719, 19638, 3671, 19294, 15483, 11459, 729, 6875, 8097, 11730, 2312, 15436, 13092, 14517, 15105, 14456, 13145, 12570, 15490, 18231, 11596, 6118, 5304, 16765, 4793, 15775, 11805, 19526, 14499, 5708, 12326, 15797, 14762, 13191, 12105, 1381, 13923, 15198, 4622, 2015, 19018, 13494, 16076, 8169, 9863, 14106, 18290, 12846, 15959, 15777, 10773, 12971, 19602, 4725, 404, 14422, 12580, 15575, 14623, 594, 14881, 17843, 8972, 7701, 10566, 2477, 19574, 527, 15596, 10286, 9483, 8815, 16818, 15025, 964, 16947, 17172, 10386, 12397, 14380, 13814, 1649, 7792, 19515, 1433, 11984, 7604, 18446, 1369, 6518, 14042, 2461, 18933, 9634, 17957, 3188, 12588, 6691, 9640, 14338, 9326, 11814, 5814, 12747, 13105, 5539, 14864, 11627, 2494, 9609, 15402, 18189, 15718, 16696, 17706, 17978, 15813, 4289, 6988, 19673, 14925, 8637, 6516, 14213, 2635, 9623, 14377, 19, 16512, 18015, 17873, 16340, 17927, 15591, 3763, 13360, 15249, 17919, 5508, 15048, 16296, 18494, 16787, 15328, 3866, 19734, 2216, 7610, 8170, 6178, 7946, 14613, 7974, 14509, 13784, 3754, 10912, 1451, 12666, 15778, 1736, 17467, 1907, 17465, 9003, 16761, 12947, 15955, 4266, 17187, 17962, 11331, 5158, 13890, 8664, 1162, 72, 12457, 15311, 1550, 14969, 4531, 17468, 10281, 18807, 12757, 11709, 10264, 5038, 2763, 10706, 32, 11037, 6128, 13053, 9215, 16911, 19590, 12600, 11659, 6842, 7161, 10611, 14298, 47, 16229, 10474, 12387, 7840, 10756, 9343, 11407, 12174, 14250, 17943, 9088, 9399, 2691, 13128, 18568, 9108, 12186, 10569, 9590, 4520, 16250, 11346, 674, 9783, 14555, 14012, 16808, 11027, 8339, 506, 236, 6801, 10952, 874, 6192, 19095, 13493, 10849, 14702, 4165, 15020, 4349, 11483, 12507, 13024, 1943, 18971, 9616, 16419, 9220, 10532, 4603, 16255, 16331, 13799, 14015, 1578, 1269, 17794, 12661, 15373, 16425, 14080, 10080, 95, 3123, 14906, 11019, 14737, 12916, 444, 11498, 13283, 19452, 13749, 17711, 15036, 15649, 146, 13498, 15659, 16070, 2071, 13376, 10832, 4587, 13027, 19482, 4219, 3868, 19562, 17072, 1303, 7169, 4441, 14828, 17331, 8760, 10243, 4853, 820, 7260, 13638, 8094, 10702, 16854, 2309, 11118, 14567, 16392, 6152, 1363, 4104, 9980, 15121, 10152, 2460, 15238, 6895, 2243, 14652, 10487, 9895, 19015, 11692, 8895, 3995, 15144, 15810, 17205, 9300, 14670, 123, 6303, 14311, 5811, 12958, 15988, 7107, 14564, 17066, 8240, 6948, 15191, 78, 7711, 1224, 11036, 645, 11239, 19754, 13330, 9606, 3064, 4367, 14656, 4829, 19368, 14894, 905, 6670, 16611, 19607, 19059 ]
STX_1003142.0
[ [ "You can make a *multi-module maven application* that consist of several projects (called \" ;modules \" ;). The multi-module application nests all the *projects* and the so-called master `pom.xml`, in which the application modules are defined. Each module will have to hold its own `pom.xml`, also.\r\n\r\nSo, your directory structure would like:\r\n\r\n /application\r\n |---/project1\r\n |---/project2\r\n |---pom.xml\r\n\r\nThe master `pom.xml` will define the application modules:\r\n\r\n < project ... > \r\n \t < modelVersion > 4.0.0 < /modelVersion > \r\n < packaging > pom < /packaging > \r\n \r\n < modules > \r\n \t\t < module > project1 < /module > \r\n \t\t < module > project2 < /module > \r\n \t < /modules > \r\n \r\n < dependencyManagement > ... < /dependencyManagement > \r\n ...\r\n < /project > \r\n\r\nDefined like this, `project1` will build before `project2`.", "78" ], [ "When doing arithmetic operations on `char` (like `a + 1`), the result value is automatically converted to `int`. \r\n\r\nIn order to have the result of the arithmetic operation printed as `char`, you will have to do an explicit cast:\r\n\r\n System.out.println((char) (a+1));\r\n\r\nMoreover, I think you have an error in your implementation : the last character (`b`) will be printed twice - before the last recursion call, and at the recursion bottom. You can fix it like:\r\n\r\n public static void between(char a, char b) {\r\n System.out.println(a);\r\n if (a < b){\r\n between((char) (a+1), b);\r\n }\r\n }", "941" ], [ "The reason the code compiles, when you add the type parameter ` < T > `, is that in this case you&#39;re overriding the *raw* `getConsumer()` method, i.e. you are not re-defining a type parameter (` < T > `), but you&#39;re just ignoring it. \r\n\r\nIt&#39;s worth mentioning that when extending raw classes or overriding raw methods, the ***whole*** generic information is just ignored, which means that in this case the compiler will not verify if the type parameter of the overriding method (` < String > `) is compatible with the type-parameter of the abstract method (` < Object > `). \r\n\r\nIf you had *kept* the method as generic, it would look like:\r\n\r\n @Override\r\n\tpublic < T > Consumer < String > getConsumer() {\r\n ...\r\n\t}\r\n\r\nand then the compiler would correct raise a compile-time error.", "801" ], [ "@Makoto, a method is generic if it defines a type-parameter (disregarding the return type being generic or not). When the interface&#39;s abstract method defines a type-parameter, but the implementing method doesn&#39;t care about it (i.e. ignores it), then the implementing method is raw. And when a method is considered as raw, then compiler ignores the whole generic information (including the one in the return type). Note that this, however, doesn&#39;t apply for methods that just *return* a generic type and don&#39;t implement another method.", "801" ], [ "> Why doesn&#39;t `Consumer < T > ` hava an identity method?\r\n\r\nThe `Consumer < T > ` always *consumes* an object of type `T` and returns `void`.\r\n\r\nIf it had an `.identity()` method it should have consumed `void` and returned `void`, but it&#39;s not possible to consume a `void` and hence there&#39;s no such method.\r\n\r\nThe difference with `Function < T, R > ` is that `T` and `R` *can* be the same. The `Consumer < T > ` has a fixed result-type of `void`, which is not possible to be the same as the *consumed* type.", "801" ], [ "You forgot to add a `break` for the top-level `case 0`:\r\n\r\n case 0:\r\n switch (childPosition) {\r\n \tcase 0:\r\n \t\tif (NetworkManager.isNetworkAvailable(this)) {\r\n \t\t\tnew UserAwayTask().execute();\r\n \t\t} else\r\n \t\t\tToast.makeText(this, \" ;Network not available \" ;, Toast.LENGTH_LONG).show();\r\n \t\tbreak;\r\n \r\n \tcase 1:\r\n \t\tselection = null;\r\n \t\tselectionArgs = null;\r\n \t\tbreak;\r\n \tcase 2:\r\n \t\tselection = Employee.COL_COUNTRY + \" ; IS ? COLLATE NOCASE \" ;;\r\n \t\tselectionArgs = new String[]{valueReceived};\r\n break;\r\n }\r\n break; //&#175;\\_(ツ)_/&#175;\r\n\r\nWithout the `break;`, the flow just proceeds and enters the next `case` block until it reaches a `break` statement (or until it goes out of the `switch`).\r\n\r\nAlso, it&#39;s not bad idea to add a `break` for the nested `case 2` (just in case you add more `case`s in the future and you might end up with the same problem as this one, which by the way is called *fall-through*).", "839" ], [ "<PERSON>, I don&#39;t agree. If you see the source of `Integer#intValue()` you can see that the method returns the nested `private final int value;`. So, by assigning `integer.intValue()` to an `int` doesn&#39;t trigger any boxing/unboxing features of the compiler. However, having `int i = integer;` _will_ actually force the compiler to do unboxing from `Integer` to `int`. That&#39;s why I find the explicit call to `.intValue()` a bit more efficient (even there&#39;s not much performance difference) and _readable_.", "203" ], [ "I would implement a [*decision table*][1].\r\n\r\nThe table would consist of a set of mappings between one or more `Predicate`s as key and `Function` as a value. If a `Predicate` condition is met, then the corresponding `Function` is executed. If no `Predicate` condition is met, then a default `Function` should be executed. This can (easily) replace the humongous \" ;if-else \" ; statement and should be easier for maintenance.\r\n\r\nHow a `Predicate` should look like? It should take a `String` (in your case) and should return a `boolean` indicating whether a condition is met or no:\r\n\r\n interface Predicate {\r\n public boolean test(String x);\r\n }\r\n\r\nIn the decision table, you&#39;d add (anonymous) implementations of this interface as keys. \r\n\r\nHint: If you are already on Java8, even better, there&#39;s a built-in `Predicate < T > ` interface. But if you&#39;re not, then you can introduce a `Predicate` interface of your own. :-)\r\n\r\nThe `Function` for the decision table&#39;s values will be a similar interface. It may (or may not) use an input parameters and should return void. In Java8 this is called a `Consumer`, however in my example I&#39;ll stick to the `Function` naming:\r\n\r\n interface Function < T > {\r\n void apply(T t);\r\n }\r\n\r\nBy constructing pairs between `Predicate` as a key and `Function < ErrorCodeUtil > ` as a value, we&#39;ll populate the decision table. When a `Predicate` condition is met, then we&#39;ll invoke the corresponding `Function`&#39;s `.apply()` method:\r\n\r\nThe decision table itself can be a simple `Map < Predicate, Function < ErrorCodeUtil > > `:\r\n\r\n Map < Predicate, Function < ErrorCodeUtil > > decisionTable = new HashMap < > ();\r\n\r\nand you should populate it at construction time or whenever you wish (just before the `handleErrorCode()` method logic):\r\n\r\n Predicate equalsOne = new Predicate() { \r\n public void test(String x) {\r\n return \" ;1 \" ;.equals(x);\r\n }\r\n };\r\n Function < ErrorCodeUtil > actionOne = new Function < ErrorCodeUtil > () {\r\n public void apply(ErrorCodeUtil t) {\r\n t.handleErrorCode1();\r\n }\r\n }\r\n \r\n decisionTable.put(equalsOne, actionOne);\r\n\r\nand so for the other \" ;condition-action \" ; pairs, including the default action (i.e. the last `else` statement) for which the `Predicate` will always return `true`. \r\n\r\nNote that in Java8, those anonymous classes can be *significantly* reduced by just using lambdas.\r\n\r\nFinally, your \" ;if-elseif \" ; statements would be re-factored to a simple loop:\r\n\r\n for (Map.Entry < Predicate, Function < ErrorCodeUtil > > entry: decisionTable.entrySet()){\r\n Predicate condition = entry.getKey();\r\n Function < ErrorCodeUtil > action = entry.getValue();\r\n if (condition.test(errorCode)) {\r\n action.apply(this);\r\n }\r\n }\r\n\r\nSo, everytime you add a new condition, you won&#39;t have to touch the `handleErrorCode(String error)` method, but you&#39;ll have to just introduce a new (anonymous) implementation of `Predicate` and `Function` and `.put()` it into the decision table.\r\n\r\n [1]: _URL_0_", "467" ], [ "You have to change the method signature and *inline* the last vararg value as a separate parameter. \r\n\r\nIf you have this parameter as the last one, then you won&#39;t be able a use vararg parameter, as it has always to be last one and must be represented as an array in case it&#39;s not the last one:\r\n\r\n public < T, R > R convertBy(Function[] functions, Function < T, R > special) { }\r\n\r\nIf you, however, insist to use varargs, then you can *move* the \" ;special \" ; `Function` as first parameter:\r\n\r\n public < T, R > R convertBy(Function < T, R > special, Function... functions) { }", "172" ], [ "It&#39;s because all of your functions (`FLines`, `Join`, `CollectInts`) implement the raw `Function` interface. Make them implement `Function < T, R > ` or at least `Function < Object, Object > `, which can help you see the difference - when implementing `Function < Object, Object > ` the return type is `Object`, not `List < String > ` as the `List < String > lines = fileConv.convertBy(flines);` supposes.", "799" ], [ "Not really, but I think you&#39;re not working correctly with your type-parameters.\r\n\r\nWhen your method is generic, then you can easily *refer* to the method&#39;s type-parameters without having to rewrite their bounds every time:\r\n\r\n < T extends List < ? extends Integer > , E extends List < ? extends Integer > > \r\n void iterate(Set < Generic < T, E > > mySet) {\r\n for (Generic < T, E > myGeneric : mySet) {\r\n // do something with myGeneric\r\n }\r\n }\r\n\r\nThis is also valid if you class is Generic, i.e. something like:\r\n\r\n class SomeClass < T extends List < ? extends Integer > , E extends List < ? extends Integer > > {\r\n void iterate(Set < Generic < T, E > > mySet) {\r\n for (Generic < T, E > myGeneric : mySet) {\r\n // do something with myGeneric\r\n }\r\n }\r\n }", "801" ], [ "The `c` variable is just a copied reference to the array element.\r\n\r\nThe reason for this is that the enhanced for loop uses an `Iterator` and in order to get the next element, it invokes the `Iterator.next()` method, which gives a copy to the original collection element.\r\n\r\nIn order to make it work, you have to directly set the new value into the array:\r\n\r\n public static String change(String word, char gone, char here) {\r\n\t\tchar[] chars = word.toCharArray();\r\n\t\tfor (int i = 0; i < chars.length; i++) {\r\n\t\t\tif (chars[i] == gone) {\r\n\t\t\t\tchars[i] = here;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn new String(chars);\r\n\t}", "511" ], [ "I think the `Calendar` class here can be pretty handy and you&#39;ll avoid complicated calculations. After you read the seconds from the input, you&#39;ll just have to convert them into milliseconds and pass the result to a `Calendar` instance.\r\n\r\nThen, you can fetch the day, month, year like this:\r\n\r\n long s = IOTools.readLong( \" ;Give seconds: \" ;);\r\n Calendar calendar = Calendar.getInstance();\r\n calendar.setTimeInMillis(s * 1000);\r\n int year = calendar.get(Calendar.YEAR);\r\n int month = calendar.get(Calendar.MONTH);\r\n int day = calendar.get(Calendar.DAY);", "627" ], [ "According to the signature, the `.accept()` method uses the class-scoped `D` type-parameter:\r\n\r\n void accept(Set < D > serializables) {}\r\n\r\nWhen instantiating `GenTest` as `GenTest < Serializable > g = null;` means that `D` will be replaced at Runtime with `Serializable`.\r\n\r\nNow, what does `Set < ? extends Serializable > serializables2` mean?\r\n\r\nIt means that `serializables2` can be assigned with a `Set` of *unknown* subclasses of `Serializable`. The compiler has no evidence that this *unknown* subclass will match the substitute of `D` at Runtime, and hence rejects to allow the code to compile.\r\n\r\nLet&#39;s say you have these two types:\r\n\r\n class A implements Serializable { }\r\n \r\n class B implements Serializable { }\r\n\r\n`Set < ? extends Serializable > serializables2` means that `serializables2` can either be assigned with `Set < A > ` or assigned with `Set < B > ` at Runtime. Let&#39;s suppose it is assigned with `Set < B > `. \r\n\r\nNow, if your `g.serializables` contain only objects of type `A` (which is possible, because the `D` is replaced by `Serializable`), this means that at Runtime you&#39;ll get a `ClassCastException`, when trying to pass a `Set < B > ` to a method should be provided with a `Set < A > `.\r\n\r\nMore info:\r\n\r\n - [Java Generics: What is PECS?][1]\r\n\r\n\r\n [1]: _URL_0_", "89" ], [ "It&#39;s not enough just to introduce the value for `%JAVA_HOME%` (actually, Java doesn&#39;t care if there is or there isn&#39;t such environment variable).\r\n\r\nWhat you have to do is to append `%JAVA_HOME%/bin` directory to the `Path` environment variable, so that you get the `java.exe` that matches the `%JAVA_HOME%` version, without having to write the full path to the `java.exe` executable that you want to trigger.\r\n\r\nSo, either do this:\r\n\r\n - set a value for the `%JAVA_HOME%` environment variable\r\n - append `%JAVA_HOME%/bin` to the `Path` environment variable\r\n\r\nor just\r\n\r\n - append ` < the-java-home-directory > /bin` to the `Path` variable.\r\n\r\nPersonally, I would prefer to maintain a value for `JAVA_HOME`, as it is needed by tools like Maven, Hadoop, etc.", "191" ], [ "According to the source code, the [`Double.parseDouble(String s)`][1] method uses the [`FloatingDecimal.readJavaFormatString(String s)`][2] to parse the provided argument.\r\n\r\nThere, you can see that there&#39;s a check if the provided `String` ends with `&#39;D&#39;`, `&#39;d&#39;`, `&#39;F&#39;` or `&#39;f&#39;` and if it doesn&#39;t, then a `NumberFormatException` is thrown:\r\n\r\n if (i < l & & \r\n ((i != l - 1) ||\r\n (in.charAt(i) != &#39;f&#39; & & \r\n in.charAt(i) != &#39;F&#39; & & \r\n in.charAt(i) != &#39;d&#39; & & \r\n in.charAt(i) != &#39;D&#39;))) {\r\n break parseNumber; // go throw exception\r\n }\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "105" ], [ "The error message says it clear:\r\n\r\n > The type `StatusCode` may not subclass `Enum < StatusCode > ` explicitly.\r\n\r\nWhat you need to do, is just to create an `enum` type:\r\n\r\n enum StatusCode { ONE, TWO; }\r\n\r\nHaving this `enum`, the compiler makes sure it extends `Enum < StatusCode > ` and you don&#39;t have to worry about it. \r\n\r\nYou can verify this is true by running this test snippet:\r\n\r\n StatusCode statusCode = StatusCode.ONE;\r\n System.out.println(statusCode instanceof Enum);\r\n\r\nNote that the `instanceof` operator doesn&#39;t need the type-parameter for `Enum`, which is a topic you can learn more about by checking out [this thread][1].\r\n\r\n\r\n [1]: _URL_0_", "116" ], [ "Kepler doesn&#39;t have `1.8` compliance support, so you have to update to a newer version of Eclipse (like Juno).\r\n\r\nWhen you do, you have to make sure that you have properly pointed the JDK installation directory in Eclipse. You can navigate to `Window` → `Preferences` → `Java` → `Installed JREs`, add the JDK8 environment (and select it as default, as you don&#39;t have any other, since you have deleted 1.7 one).\r\n\r\n[![Installed JREs][1]][1]\r\n\r\nThen, when you navigate to `Window` → `Preferences` → `Java` → `Compiler`, you should be able to select `1.8` as \" ;Compliance level \" ;, as shown here:\r\n\r\n[![enter image description here][2]][2]\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "997" ], [ "You have plenty of options.\r\n\r\nIf you&#39;re on Java8, you can create a *default* method within the `SqlOperator` interface and there will be no need to implement it across the subclasses:\r\n\r\n public interface SqlOperator{\r\n public default SqlOperator not() {\r\n return new SomeImplementation(){\r\n @Override\r\n public String apply(Object o){\r\n return String.format( \" ;NOT (%s) \" ;, super.apply(o));\r\n }\r\n };\r\n }\r\n }\r\n\r\nHowever, if you still haven&#39;t upgraded to Java8, then you could just introduce an `abstract` subclass of `SqlOperator` where you will have the `not()` implementation and then all the other implementors could extend this abstract class. For example:\r\n\r\n public abstract class AbstractSqlOperator implements SqlOperator {\r\n public SqlOperator not() {\r\n return new SomeImplementation(){\r\n @Override\r\n public String apply(Object o){\r\n return String.format( \" ;NOT (%s) \" ;, super.apply(o));\r\n }\r\n };\r\n }\r\n }\r\n\r\n public class SomeImplementation extends AbstractSqlOperator { ... }", "6" ], [ "Probably you&#39;ve missed to apply a negation somewhere.\r\n\r\nIf you want to convert your `||`-based expression to a ` & & `-based expression, then you&#39;ll have to do:\r\n\r\n while (!(check.length() == 2 & & check.charAt(0) == check.charAt(1))); \r\n\r\nNote that, in order to avoid an `ArrayIndexOutOfBoundsException`, I&#39;m switching the pieces of the expression, so that we first check the size of the `String`, after which we test the first two characters for equality.", "615" ], [ "Behaviourally, it&#39;s the same - for both of the approaches you&#39;ll have an instance of a class and you will invoke some instance methods.\r\n\r\nThe difference, however, is with the *use* of the compiler.\r\n\r\nWhen you reflectively create an instance of a class, and reflectively call some method on this instance, the compiler does not *verify* that what you do is correct. Avoiding the compiler&#39;s help, you can end up with different errors at Runtime , like `NoSuchMethodError` (thrown when the method you desire to invoke doesn&#39;t exist or cannot be invoked), `InvocationTargetException` and other subclasses of [`ReflectiveOperationException`][1].\r\n\r\nFollowing the non-reflective approach, is much safer - the compiler can verify that what you try to do is correct (are the methods accessible, are the parameters valid, etc.) and will throw you back a compiler error, before the program is started.\r\n\r\nNote that Reflection is very useful sometimes, but\r\n\r\n > ... if it is possible to perform an operation without using reflection, then it is preferable to avoid using it.\r\n\r\n\r\n [1]: _URL_0_", "689" ], [ "I would prefer the first one:\r\n\r\n Object obj;\r\n while(true){\r\n if (obj == null) obj = new Object();\r\n //do other things\r\n }\r\n\r\nIn the second example, you&#39;re coupling the value of the `Boolean` with the `Object` and this approach can also lead to errors, because you can accidentally set the value of the `Boolean` to `true`, without instantiating the `Object`. \r\nThis way you&#39;d assume the `Object` had been instantiated, according to the `Boolean` value, and you&#39;ll get a `NullPointerException`.", "786" ], [ "If you *know* what is the biggest possible element in `k` (lets suppose 100), then you can solve it linearly:\r\n\r\n int[] t = new int[101]; //subject of change\r\n for (int i : k) {\r\n t[i]++;\r\n }\r\n\r\nHere, you&#39;ll increase the value of the `i`-th element of `k` when the currently processed element from `k` has value of `i`.\r\n\r\nOtherwise, if you don&#39;t know the biggest possible element of `k` (and respectively, you won&#39;t know how to initialize the `t` array), you can use a `Map`:\r\n\r\n Map < Integer, Integer > map = new TreeMap < > ();\r\n for (int i : k) {\r\n if (map.containsKey(i)) {\r\n int value = map.get(i);\r\n map.put(i, ++value);\r\n } else {\r\n map.put(i, 1);\r\n }\r\n }\r\n\r\n for (Map.Entry < Integer, Integer > entry : map.entrySet()) {\r\n int i = entry.getKey();\r\n int n = entry.getValue();\r\n System.out.println( \" ;The number \" ; + i + \" ; was found \" ; + n + \" ; times. \" ;);\r\n }", "828" ], [ "Your invoking `.hasNextLine()` twice, while you&#39;re reading the \" ;next line \" ; just once.\r\n\r\nYour code should rather be:\r\n\r\n while (in.hasNextLine()) {\r\n String line = in.nextLine(); \r\n out.println(line); \r\n }\r\n\r\nOr, if you want to check within the loop *again* for next line existence, you should do this (which I find not clean enough, because it does exactly the same as the snippet above):\r\n\r\n while (in.hasNextLine()) {\r\n \tString line = in.nextLine();\r\n \tif (in.hasNextLine()) {\r\n \t String nextLine = in.nextLine();\r\n \t\tout.println(line);\r\n \t} else {\r\n \t\tout.print(line);\r\n \t}\r\n }", "50" ], [ "The name of the class(es) almost tell it.\r\n\r\n- [`SparseMultigraph`][1] is a multigraph, which means that there might be multiple ( > = 1) or zero edges between two vertices. The `SparseMultigraph` class implements the [`Multigraph`][2] interface.\r\n\r\n- [`SparseGraph`][3] is a graph, which means that there is exactly `0` or exactly `1` edge between any two vertices. The `SparseGraph` class doesn&#39;t not implement the `Multigraph` interface, but only the `Graph` interface.\r\n\r\n- Both classes extend the `AbstractGraph` class.\r\n\r\nMore info:\r\n\r\n- [What is a Multigraph?][4]\r\n \r\n\r\n\r\n [1]: _URL_3_\r\n [2]: _URL_2_\r\n [3]: _URL_0_\r\n [4]: _URL_1_", "805" ], [ "- If the graph is directed and is not a multigraph, e.g. `A - > B`, then there&#39;s no cycle, because you can only go from `A` to `B` and cannot go from `B` to `A`.\r\n- If the graph is а directed multigraph, e.g. `A < - > B`, then its not cyclic, because `A` would have been already visited, before you try to get back to it from `B`. However, if you want to find a cycle of non-visited edges, then it would be cyclic, as you would track which edges are visited.\r\n- If the graph is undirected, e.g. `A - B`, then there&#39;s no cycle, as `A` and `B` will be visited exactly once.", "805" ], [ "You need to do :\r\n\r\n String content = \" ;some content with \\ \" ; quotes. \" ;;\r\n content = content.replaceAll( \" ;\\ \" ; \" ;, \" ;\\\\\\\\\\ \" ; \" ;);\r\n\r\nWhy will this work? \r\n\r\n`\\ \" ;` represents the ` \" ;` symbol, while you need `\\ \" ;`. \r\n\r\nIf you add a `\\` as a prefix (`\\\\ \" ;`) then you&#39;ll have to escape the prefix too, i.e. you&#39;ll have a `\\\\\\ \" ;`. This will now represent `\\ \" ;`, where `\\` is not the escaping character, but the symbol `\\`. \r\n\r\nHowever in the Java String the ` \" ;` character will be escaped with a `\\` and you will have to replace it as well. Therefore prefixing again with `\\\\` will do fine:\r\n\r\n x = x.replaceAll( \" ;\\ \" ; \" ;, \" ;\\\\\\\\\\ \" ; \" ;);", "829" ], [ "> Why does this program compile with two classes having effectively the same name?\r\n\r\nThey have the same *simple name*. However, their names (fully-qualified names, which include the package declarations) are different.\r\n\r\nThe way you&#39;ve defined it, your code doesn&#39;t compile, unless your class is located in the project&#39;s default package. Your type (`Exception`) hides the one defined in the `java.lang` package and since your type is not sub-type of `Throwable`, the compiler raises an error:\r\n\r\n > No exception of type `Exception` can be thrown; an exception type must be a subclass of `Throwable`\r\n\r\nIf you want to specify that `java.lang.Exception` should be caught, then you have to use the fully-qualified name, as there are naming conflicts otherwise:\r\n\r\n\r\n class Exception {\r\n \tpublic static void main(String args[]) {\r\n \r\n \t\tint x = 10;\r\n \t\tint y = 0;\r\n \r\n \t\tint result;\r\n \r\n \t\ttry {\r\n \t\t\tresult = x / y;\r\n \t\t} catch (ArithmeticException e) {\r\n \t\t\tSystem.out.println( \" ;Throwing the exception \" ;);\r\n \t\t\tthrow new ArithmeticException();\r\n \t\t} catch (java.lang.Exception ae) {\r\n \t\t\tSystem.out.println( \" ;Caught the rethrown exception \" ;);\r\n \t\t}\r\n \t}\r\n }", "6" ], [ "In the JLS, [&#167;8.3.3. Forward References During Field Initialization][1], its stated that there&#39;s a compile-time error when:\r\n\r\n > Use of instance variables whose declarations appear textually after the use is sometimes restricted, even though these instance variables\r\n > are in scope. Specifically, it is a compile-time error if all of the\r\n > following are true:\r\n > \r\n > - The declaration of an instance variable in a class or interface C appears textually after a use of the instance variable;\r\n > \r\n > - The use is a simple name in either an instance variable initializer of C or an instance initializer of C;\r\n > \r\n > - The use is not on the left hand side of an assignment;\r\n > \r\n > - C is the innermost class or interface enclosing the use.\r\n\r\nThe following rules come with a few examples, of which the closest to yours is this one:\r\n\r\n class Z {\r\n static int peek() { return j; }\r\n static int i = peek();\r\n static int j = 1;\r\n }\r\n class Test {\r\n public static void main(String[] args) {\r\n System.out.println(Z.i);\r\n }\r\n }\r\n\r\nAccesses [to static or instance variables] by **methods are not checked in this way**, so the code above produces output `0`, because the variable initializer for `i` uses the class method `peek()` to access the value of the variable `j` before `j` has been initialized by its variable initializer, at which point it still has its default value ([&#167;4.12.5 Initial Values of Variables][2]).\r\n\r\nSo, to summarize, your second example compiles and executes fine, because the compiler does not check if the `x` variable was already initialized when you invoke `printX()` and when `printX()` actually takes place at Runtime, the `x` variable will be assigned with its default value (`0`).\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "890" ], [ "Because when you type `a` and hit `Enter`, then the `in.read()` method returns three characters - `&#39;a&#39;`, the character for carriage return `\\r` and the character for line break (`&#39;\\n&#39;`). (Note that the combination `\\r\\n` is considered as line-break under Windows).\r\n\r\nYour program will have significantly different behavior if you run it under Linux or OSX, because line-breaking character(s) is specific to the OS you&#39;re running the program on. Under Linux, it will be `\\n`, under OS X-9 it will be `\\r`, for example.\r\n\r\nAs a work-around, you can read the whole line (by using a `Scanner`) and trim it, which will omit the line-breaking character (disregarding the OS type):\r\n\r\n public static void main (String args[]) throws _URL_1_.IOException {\r\n String line;\r\n Scanner sc = new Scanner(_URL_0_);\r\n do {\r\n System.out.println( \" ;Please a key followed by ENTER: \" ;);\r\n line = sc.readLine().trim();\r\n } while (! \" ;q \" ;.equals(line));\r\n }", "50" ], [ "The `extends` keyword in Generics has a slightly different semantics than the general `extends` keyword.\r\n\r\nWhen using `extends` in the context of Generics, for example `T extends Something`, this means that `T` should be a type that *either* implements the interface `Something` (in cases when `Something` is interface), *or* is a subclass of `Something` (in case `Something` is a class).\r\n\r\nProbably the reason for this is that if the `implements` keyword was supported in Generics, this would have made type-parameter declaration too verbose.\r\n\r\nFor example, you&#39;d have:\r\n\r\n < T extends SomeClass implements Serializable & Observable > \r\n\r\nInstead, the valid syntax for this would be:\r\n\r\n < T extends SomeClass & Serializable & Observable > \r\n\r\nAnd you don&#39;t need to have the `implements` keyword, actually. When defining the bounds of a type `T`, you just need to point out which *types* does your type `T` derive from, without caring if those are interfaces or classes. \r\n\r\nThe type definition is not a class definition. You can consider type definition as joining few data sets, where the resulting set is your type `T`.", "801" ], [ "> Why do Java programmers need to create a class or explicitly create a `Map`?\r\n\r\nBecause Java [is a statically typed language][1], where everything must have its own type.\r\n\r\nAnd still, the language allows you to _compose_ a map of `{ \" ;name \" ;:[ \" ;value1 \" ;, \" ;value2 \" ;]}` with a single statement, using [double-brace initialization][2]:\r\n\r\n Map < String, List < String > > map = new HashMap < String, List < String > > () {{\r\n put( \" ;name \" ;, Arrays.asList( \" ;value1 \" ;, \" ;value2 \" ;));\r\n }};\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "372" ], [ "> And I do not know of abstract fields either\r\n\r\nThere&#39;s no such thing as `abstract` field. Only methods (an classes, respectively) can be `abstract`.\r\n\r\n > I also know that one could use generics and only have a `Box < T > ` class, but I would like to have subclasses with extra functionality. \r\n\r\nA generic `Box < T > ` could be actually your best friend in this case. Also, if your `Box` class just exposes some abstraction, you could just transform in to a generic interface:\r\n\r\n public interface Box < T > {\r\n T getContent();\r\n }\r\n \r\n public class StringBox implements Box < String > {\r\n \r\n private String contents;\r\n \r\n String getContent();\r\n }", "801" ], [ "Annotations (which just represent some meta info for some specific period of time) are not over-writable when having a subclass.\r\n\r\nIn your example, the `FatherSub#name` member _hides_ the `Father#name` member. This means that all instances of `FatherSub` will work with the `name`, defined in `FatherSub`, which will not represent a `@Column`, if not annotated with the `@Column` annotation.\r\n\r\nAdditionally, you don&#39;t need to explicitly implement `Serializable` in `FatherSub`, as `Father` already implements it.", "866" ], [ "On every loop step, you have these two statements:\r\n\r\n b = a % 2;\r\n n = b;\r\n\r\nThink about why all the possible values of `n` are `0` and `1`?\r\n\r\nIt&#39;s because `n` copies the value of `b`, which is the value of `a modulo 2`, which is always `0` or `1`.\r\n\r\nThe last value of `n` will be the left-most bit of the binary representation of `a`, which will be always `1` (unless `a` is `0`) and this is why you always get `1` when printing `m`.", "82" ], [ "public @interface MyAnnotation {\r\n String[] names() default \" ; \" ;;\r\n }\r\n\r\nmeans that by default `names` will be an array of one empty `String` (` \" ; \" ;`). \r\n\r\nThis is the same as if you&#39;ve used the array-initializer:\r\n\r\n public @interface MyAnnotation {\r\n String[] names() default { \" ; \" ; };\r\n }\r\n\r\nAdditionally, `String[] names() default new String[0];` doesn&#39;t compile, because the (default) value of an annotation property must be a constant expression.\r\n\r\nAs a homework, you can annotate something with `MyAnnotation` and explore its properties with Reflection.", "758" ], [ "`String s = \" ;\\\\ \" ;;` contains only the character `\\`, and since it is a _special one_, it has to be escaped with the `\\` character. \r\n\r\nIn order to obtain a 2-sized String, you can escape two backslashes, like this:\r\n\r\n String s = \" ;\\\\\\\\ \" ;;\r\n\r\nThis one doesn&#39;t have the size of `4`, but `2`, because there are characters (obviously, like the backslash) which are not represented by a single visual element in the editor. \r\n\r\nThere are also characters, which can be completely invisible when being printed (like the [Mongolian vowel separator][1]), but which are represented in a different way in the source (by their Unicode code). For example, the Mongolian vowel separator can be represented as:\r\n\r\n String mongolianVowelSeparator = \" ;\\u180 \" ;; < -- one character only, invisible when printed\r\n\r\nSo here we have one character only (the `U+180E` Unicode character), but we used five editor characters to represent it.\r\n\r\n\r\n [1]: _URL_0_", "567" ], [ "Let&#39;s assume that `{1, 2, 3, 4}` has memory address `M`.\r\n\r\nWhen assigning `x` to `{1, 2, 3, 4}`, you&#39;re assigning a reference to the memory address of `{1, 2, 3, 4}`, i.e. `x` will _point_ to `M`.\r\n\r\nWhen assigning `y = x`, then `y` will refer `M`.\r\n\r\nAfter that, you&#39;re changing the reference where `x` points to, let&#39;s say it&#39;s `N`.\r\n\r\nSo, when printing, `y` points to `M` (which is the address of `{1, 2, 3, 4}`), but `x` holds reference to `N` (which is `new int[2]`). And here comes the difference.", "638" ], [ "Both of the approaches are almost similar in terms of algorithmic complexity.\r\n\r\nThe first approach&#39;s complexity is `O(N * N)`, where `N` is the length of the array. I don&#39;t think it&#39;s necessary to explain why, but just in case it is - the nested loops take `N * N` units of time, which gives the complexity.\r\n\r\nAs for the second approach - having a `HashSet` allows you to search with constant complexity (`O(1)`), because the search is based on the hashed value of the `String`. One can think that this approach is more effective, but in reality it isn&#39;t that much, because we need to encounter the _insert_ operation on the `HashSet`.\r\n\r\nAdding to the `HashSet` is of complexity `O(N)` (worst case scenario). For `N` String objects, you might have `N` insert operations, which again gives complexity of `O(N * N)`.\r\n\r\nSo, to summarize, both of the approaches are of similar expense. I would prefer the second one, though, as it&#39;s a bit more readable.", "149" ], [ "As you have it now, the type-parameters of `CompareRank` are aliases, not actual types.\r\n\r\nYou don&#39;t have to define type-parameters for your `CompareRank` class, just point out which are the actual types that the `Comparator` has to deal with:\r\n\r\n import static java.util.Map.Entry;\r\n \r\n public class CompareRank implements Comparator < Entry < OfficerRank, Integer > > {\r\n @Override\r\n public int compare(Entry < OfficerRank,Integer > arg0, Entry < OfficerRank,Integer > arg1) {\r\n int val1 = arg0.getValue();\r\n int val2 = arg1.getValue();\r\n return Integer.compare(val2,val1);\r\n }\r\n\r\nThen, you should instantiate it like this:\r\n\r\n Collections.sort(lst, new CompareRank());", "842" ], [ "When you enter `4`, then `y` becomes `4` and the loop takes place until `y` reaches `20`. This is why it&#39;s executed 16 times.\r\n\r\nIf you want it to be executed exactly `y` times (in your case, `4`), then you can decrement `y` with `1` on each step until it reaches `0`.\r\n\r\n System.out.println( \" ;Enter range \" ;);\r\n int y = input.nextInt();\r\n int x = 10;\r\n do {\r\n System.out.print( \" ;value of x : \" ; + x );\r\n x++;\r\n y--;\r\n System.out.print( \" ;\\n \" ;);\r\n } while(y > 0);", "598" ], [ "- `foo(1,2,3);`\r\n\r\nThis one autoboxes `1`, `2` and `3` to `Integer`(s) and since they are `Object` sub-types, an `Object[]` array is created, consisting of three `Integer`s. An array `Object[]` is not `Integer[]` and that&#39;s why you get `false`.\r\n\r\n----\r\n\r\n- `foo(new Integer(1), new Integer(2), new Integer(3));`\r\n\r\nHere, no auto boxing applies, but in the end you will again have an array `Object[]` that consist of three `Integer`s. Again, `Object[]` is not `Integer[]` and that&#39;s why you get `false`.\r\n\r\n----\r\n\r\n- `foo(new Integer[]{1,2,3});`\r\n\r\nHere you have **only one** argument, unlike the previous two cases, where you had three wrapped into one array. So, having only one argument `Integer[]`, at Runtime the comparison `bar instanceof Integer[]` will return `true`, because integers is what you actually have.\r\n\r\n----\r\n\r\n- `foo(new Integer[] {new Integer(1), new Integer(2), new Integer(3)});`\r\n\r\nSame as the previous one - at Runtime you will check if the provided array `Integer[]` is an array of `Integer`s, which is `true`.", "203" ], [ "The `Class < T > ` itself represents some _instance_, too - this is an instance of the type `Class`, parameterized by the type `T`.\r\n\r\nI think the best you can do is to add a check if the provided type is instance of `Class` and if yes, throw an `IllegalArgumentException`:\r\n\r\n public < T > List < Map < String,Object > > getUIElementsList(T value) {\r\n if (value instanceof Class) { \r\n throw new IllegalArgumentException( \" ;Class instances are not supported \" ;);\r\n }\r\n ..\r\n }\r\n\r\nWhen defining type-parameters, you&#39;re only allowed to bound them by intersections of existing (families of) types, but not to apply negation on given types, like the thing you aim for, which is something like _ \" ;all types but one \" ;_.", "816" ], [ "The magic words here are _**raws**_ and _**multiple inheritance**_.\r\n\r\nLets first take a look on your `returnC` method:\r\n\r\n static < T extends ClsA > T returnC() {\r\n return null;\r\n }\r\n\r\nThe type `T` is bounded with `ClsA`, which means that if you invoke the **raw** `returnC` method, then the return type will be simply `ClsA`.\r\n\r\nTrue, when you have this statement: `ClsA ac = returnC();` the compiler succeeds with the compilation, because the **raw** return type of the method is `ClsA`, which is compatible with the type of `ac`.\r\n\r\nThe the raw return type is also the reason for which the statement `ClsB bc = returnC();` does not compile.\r\n\r\n----\r\n\r\nNow let&#39;s take a look on the `returnI` method:\r\n\r\n static < T extends IntA > T returnI() { // Here T extends the interface\r\n return null;\r\n }\r\n\r\nHere, the type parameter is bound to `IntA` only. \r\n\r\nThis, however, doesn&#39;t mean that the replacement type for `T` must implement only `IntA` - the type **can** implement `IntA` and `IntB` at the same time. Statements like `IntB bi = returnI();` are allowed, because a type can implement multiple interfaces, but cannot implement multiple classes.\r\n\r\nConsider this class:\r\n\r\n class SomethingReallyCool implements IntA, IntB { }\r\n\r\nThis type is a **valid** substitute for the type-parameter of `returnI()` and the proof for that is this statement:\r\n\r\n IntB bi = YourClass. < SomethingReallyCool > returnI();\r\n\r\nWhy? Because it&#39;s a class that implements `IntA` and this is the only thing the compiler cares about.", "203" ], [ "Before using the entered `grade` value, you should validate it and if it&#39;s not valid, to continue with the loop:\r\n\r\n while(counter < 12){\r\n grade = userInput.nextInt();\r\n if (grade > 100) {\r\n System.out.println( \" ;Please enter a valid grade \" ;);\r\n } else {\r\n total = total + grade;\r\n counter++;\r\n }\r\n }\r\n\r\nAlso, when calculating the _average_ of multiple values, it&#39;s not that good idea to do integer division, because you can get wrong results. Better do:\r\n\r\n double average = 0d;\r\n ...\r\n average = total / 12.0;", "22" ], [ "Because `++` is a unary operator, while `+ +` is interpret as following:\r\n\r\n1. ` \" ;R \" ;+` represents a string concatenation and then the second argument (for the concatenation is evaluated)\r\n2. `+&#39;a&#39;` represents an explicit setting of sign (`+`) to the (numeric) `char` literal `&#39;a&#39;`. Because you&#39;ve explicitly set the sign of the value, it is treated as a numeric one and hence the result of `+&#39;a&#39;` is the numeric representation of the character `&#39;a&#39;` and that&#39;s why the result is `R97`.\r\n\r\nThe same way if you did `String a = \" ;R \" ;+ -&#39;a&#39;;` then the numeric value of `&#39;a&#39;` (which is `97`) would be negated and the result would be `R-97`.\r\n\r\nIf you, however, had just ignored the `+` sign before `&#39;a`&#39;, then `&#39;a&#39;` would have been treated as character, not as numeric, and the result would be `Ra`.", "791" ], [ "> Is the `Item` in `ListIterator < Item > ` class different from `Item` in `ResizeingArrayBag < Item > `?\r\n\r\nYes. This is called _type-parameter hiding_ and it&#39;s discouraged, because it can lead to serious confusion. For example, it would be possible to provide this statement:\r\n\r\n ResizingArrayBag < A > .ListIterator < B > x = new ResizingArrayBag < A > ().ListIterator < B > ();\r\n\r\nwhere `A` and `B` are some different real types.\r\n\r\nIf the `ListIterator` is supposed to hold the same elements as the enclosing `ResizeingArrayBag` type, then you have to do:\r\n\r\n public class ResizingArrayBag < Item > implements Iterable < Item > {\r\n //Some bag methods\r\n private class ListIterator implements Iterator < Item > {\r\n //ListIterator methods\r\n }\r\n }\r\n\r\nNote that here we&#39;re not redefining an `Item` type-parameter, but rather reusing the already defined one for `ResizingArrayBag`.\r\n\r\nAnother _rule of thumb_ is that you should name your type-parameters with single, capital letters. `Item` could be misleading, especially if somewhere out there some specific type, called `Item`, exists. \r\n\r\nSo, instead of naming your type-parameter `Item` prefer something like:\r\n\r\n public class ResizingArrayBag < T > implements Iterable < T > {\r\n \r\n private class ListIterator implements Iterator < T > {\r\n \r\n }\r\n }\r\n\r\n > Why do we have declare `Iterable` and `Iterator` with `Item` and are the `Item`s in these different from `ListIterator < Item > ` and `ResizingArrayBag < Item > `?\r\n\r\nImplementing `Iterable` will force you implement the `.iterator()` method, where you have to return an `Iterator` implementation.", "800" ], [ "[`Controller`][1] is an [annotation][2].\r\n\r\nThe annotations in Java might have properties and in your case your `@Controller` annotation has a (`String`) property called `value`.\r\n\r\nWhen using the annotation you might omit setting a specific value for the property and then the default value will be used instead. For example:\r\n\r\n @Controller // < -- here the value is ` \" ; \" ;`\r\n public class SomeController { }\r\n\r\n @Controller( \" ;other \" ;) // < -- but here value is set to \" ;other \" ;\r\n public class OtherController { }\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "6" ], [ "Since the `value` and `shift` are compile-time constants in this snippet:\r\n\r\n final byte value = 1;\r\n final int shift = 1;\r\n byte result = value < < shift;\r\n\r\nthen the compiler inlines their values (replaces all the occurrences of `value` and `shift` with their actual values of `1`) and can verify before Runtime that the result of `value < < shift` won&#39;t cause any loss of precision.\r\n\r\n----\r\nMeanwhile, for the second snippet:\r\n\r\n private void shiftAndCheck(final byte value, final int shift) {\r\n byte result = value < < shift;\r\n }\r\n\r\nthe compiler has no evidence that `shift` will represent such value, which wouldn&#39;t cause loss of precision and that&#39;s why raises a compilation error. \r\n\r\nIf compilation was possible in this case, then you&#39;d have been able to do `shiftAndCheck(1, 32);` which would result in overflowing the `byte` type.", "849" ], [ "When invoking `testCase_1(a)`, then `a` get automatically converted from `int` to `long`. \r\n\r\nThe `int` literals are completely compatible with `long` (the vice-versa is not true, however), because the `int` type completely _fits_ into the `long` one. That&#39;s why the first statement compiles just fine.\r\n\r\nWhen invoking `testCase_2(a)`, however, then you&#39;re trying to automatically convert (cast or autobox) the `int` variable to `Long`. Autoboxing doesn&#39;t happen here, nor casting is possible and this is why the compiler throws an error.\r\n\r\nIf you did:\r\n\r\n testCase_2(Long.valueOf(a));\r\n\r\nthen it would have been all fine.", "203" ], [ "First, you&#39;ve defined a type-parameter ` < V extends Integer > ` on a class-level, which is fine, unless you&#39;ve re-defined a method-scoped type-parameter ` < V extends Integer > `. The method-scoped type-parameter _hides_ the class-scoped one and this is one of your mistakes here.\r\n\r\nFuthermore, ` < V extends Integer > ` doesn&#39;t make much sense for various reasons:\r\n\r\nAs `Integer` is a `final` class, there&#39;s no point of talking about \" ;a _possible_ subtype of `Integer`, called `V` \" ; and also, the multiplication operator (`*`) works only for numeric types and their wrappers (and since there&#39;s no evidence that `V` is such, the compilation hence fails).\r\n\r\nHaving just:\r\n\r\n public class Calculator {\r\n public Integer multiply(Integer value1, Integer value2) {\r\n return value1 * value2;\r\n }\r\n }\r\n\r\nwill compile fine, because now the compiler will _know_ that `value1` and `value2` can be auto unboxed from `Integer` to `int` and the multiply operator could be correctly applied.\r\n\r\nTo summarize, it&#39;s not that easy to create a `Calculator` class around some generic type (mostly because of the strict range of types that the numeric operators like `+`, `-`, `*`, etc. work with).", "203" ], [ "The keyword here is: **_bridge methods_**.\r\n\r\nWhen compiled, the `FooImpl` will not _directly_ expose a method `foo` with a parameter of type `Event`, but it might rather generate an additional (bridge) method (as part of the type erasure process) to ensure that subtyping works as expected:\r\n\r\n public void foo(Event event) {\r\n foo((EventImpl) event);\r\n }\r\n\r\n private void foo(EventImpl eventImpl) {\r\n \r\n }\r\n\r\nAt Runtime, when your Reflection snipped will be executed and after type erasure has already taken place, the `T` type-parameter would have already been successfully replaced with `Event`, but when invoked, the bridge method will help _delegates_ to the original `foo` method that uses an `EventImpl` parameter.", "801" ], [ "You should introduce a (method-scoped) type-parameter `T` and explicitly pass a `Class < T > `, so that you could be able to instantiate `T` at Runtime. \r\n\r\nAlso, returning a `List` instead of `ArrayList` could give you more flexibility:\r\n\r\n public static List < T > getBeanList(Class < T > clazz) {\r\n \r\n String sql = \" ;.... \" ;;\r\n \r\n List < T > beanList = DBUtil.getBeanList(sql, clazz);\r\n \r\n return beanList;\r\n }\r\n\r\nHaving this, your code will shorten a bit:\r\n\r\n List < ConfDetailsBean > confDetailsBeanList = getBeanList(ConfDetailsBean.class);", "97" ], [ "This works:\r\n\r\n Hashtable < String,String > myHT;\r\n myHT = new Hashtable < String, String > ();\r\n\r\nand so does this:\r\n\r\n Hashtable < String,String > myHT = new Hashtable < String, String > ();\r\n\r\nAnd if you&#39;re on Java7+, you can take advantage of the improved type inference feature, which allows omitting the explicit setting of type-parameter on the right hand-side of the expression:\r\n\r\n Hashtable < String, String > myHT = new Hashtable < > ();\r\n\r\nIn general, the type-parameter info (` < String, String > `) should be immediately after the type (`Hashtable`). This makes snippets like the following one invalid\r\n\r\n Hashtable myHT < String,String > ;\r\n myHT = new Hashtable < String, String > ();\r\n\r\nbecause the type-parameter information is not after the type, but after the variable name.", "618" ], [ "> Why can I declare a member variable of an interface not static?\r\n\r\nIt is _implicitly_ `static` (and `final`) (which means it is `static` even if you omit the `static` keyword), [as stated in the JLS][1]:\r\n\r\n > Every field declaration in the body of an interface is implicitly `public`, `static`, and `final`. It is permitted to redundantly specify any or all of these modifiers for such fields.\r\n\r\nThe reason for being final is that any implementation could change the value of member, if it&#39;s not defined as `final`. Then the member would be a part of the implementation, but as you know an `interface` is a pure abstraction.\r\n\r\nThe reason for being `static` is that the member belongs to the interface, and not an implementation instance.\r\n\r\n\r\nAlso, being `static`, you should just refer it with the class-name (otherwise you&#39;d get a compiler warning), not through some reference, so `int b = t.a;` should be just written as `int b = Test.a;`\r\n\r\n\r\n [1]: _URL_0_", "457" ], [ "You should store the `Class < T > ` within the `ExcelParser` class, in order to obtain meta-information about `T` at Runtime:\r\n\r\n public class ExcelParser < T > {\r\n private Workbook workbook;\r\n private Class < T > clazz;\r\n \r\n public ExcelParser(InputStream is, Class < T > clazz) {\r\n workbook = new HSSFWorkbook(new POIFSFileSystem(new ByteArrayInputStream(bytes)));\r\n this.clazz = clazz;\r\n }\r\n \r\n public List < T > retrieveRecordList() throws Exception {\r\n Field[] fields = clazz.getDeclaredFields();\r\n }\r\n }", "674" ], [ "` \" ;System.out.println( \" ;Answer is \" ; + x - y); \" ;` gives a compilation error, because you&#39;re trying to subtract `y` from the `String` with value ` \" ;Answer is x \" ;. \r\n\r\nThe reason is that the operators are executed from the left to the right and first `x` get appended to ` \" ;Answer is \" ;` after which the `-` operator takes place. As subtraction is not a valid operation on `String` literals, and hence an error is risen.\r\n\r\nWrapping the numeric operation with braces `(x - y)`, the expression is given a higher priority and is evaluated before the String concatenation takes place.\r\n\r\nNote that when testing with the `/` and `*` operators, the compilation error is not risen, simply because there two operators have higher priority than the `+` operator and will be applied before it.", "791" ], [ "If the properties of an annotation weren&#39;t _defined_ as abstract methods in an interface, they would have been members. Something like:\r\n\r\n public @interface ComponentType {\r\n String name;\r\n String description;\r\n }\r\n\r\nHowever, all the members in an interface are implicitly `final` (and `static`) and the above code does not compile, because `name` and `description` aren&#39;t initialized. \r\n\r\nBut if they were actually initialized with some values: \r\n\r\n public @interface ComponentType {\r\n String name = \" ;name \" ;;\r\n String description = \" ;description \" ;;\r\n }\r\n\r\nthen snippets like the following one wouldn&#39;t have been possible:\r\n\r\n @ComponentType(\r\n name = \" ;userContainer \" ; //cannot assign a value to a final variable \r\n , description = \" ;a user container \" ;)", "890" ], [ "Your `x` variable _would have been_ effectively final it it was initialized once and not changed again under any circumstances. If you had only:\r\n\r\n int x = 0;\r\n doLater(() - > showErrorMessage(x));\r\n\r\nthen it would have compiled.\r\n\r\nHowever, adding conditions that _might_ change the variable&#39;s value\r\n\r\n int x = 0;\r\n if (isA()) {\r\n x = 1;\r\n } else if (isB()) {\r\n x = 2;\r\n }\r\n\r\nmakes the variable being not effectively final and thus the compile error is risen.\r\n\r\n-----\r\n\r\nAdditionally, since this _pointer_ approach you&#39;ve implemented wouldn&#39;t work, you could refactor your code a bit to a simple if-else statement:\r\n\r\n if (isA()) {\r\n doLater(() - > showErrorMessage(1));\r\n } else if (isB()) {\r\n doLater(() - > showErrorMessage(2));\r\n }\r\n\r\n\r\nand completely get rid of `x`.", "839" ], [ "For method signatures like this one:\r\n\r\n public static < T extends Comparable < T > > T maximum(T [] a)\r\n\r\nthe `T` type-parameter stands for a _reference type_ (and even more - a reference type `T` that is a sub-type of `Comparable < T > `) and later on it&#39;s replaced with some specific reference type.\r\n\r\nYou&#39;re invoking the method with `int[]` or `double[]`. In these cases the possible replacements for `T` are `int` or `double`, which are not reference types, but primitive types.\r\n\r\nIf you did (for example):\r\n\r\n Integer array = new Integer[] { 1, 2, 3 };\r\n method(array);\r\n\r\nthen the compiler error wouldn&#39;t appear, as `Integer` (unlike `int`) is a _reference type_ and is a sub-type of `Comparable < Integer > `, which makes it a suitable replacement for `T` at Runtime.", "801" ], [ "I think `PickField` should be parameterized with `Pick` instances only. \r\n\r\nSo doing this should be fine:\r\n\r\n class PickField < T extends Pick < T > > extends Field < T > {\r\n \r\n public PickField(Class < T > c) {\r\n super(c);\r\n }\r\n }\r\n\r\nThen, you could just instantiate it with:\r\n\r\n PickField < SomeSpecificPick > instance = new PickField < > (SomeSpecificPick.class);\r\n\r\nwhere `SomeSpecificPick` is defined as:\r\n\r\n public class SomeSpecificPick extends Pick < SomeSpecificPick > {\r\n \r\n public SomeSpecificPick(SomeSpecificPick value, Class < SomeSpecificPick > type) {\r\n super(value, type);\r\n }\r\n }\r\n\r\nMore info (related with the topic):\r\n\r\n - [Why is there no class literal for concrete parameterized types? ][3]\r\n - [How to get a class instance of generics type T?][1]\r\n - [Erasure of Generic Types][2]\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_2_\r\n [3]: _URL_1_", "801" ], [ "Remove the semicolon after the `if` statement, as it represents just an empty statement that&#39;s being executed once per a method called. This makes the remaining statements within the brackets not bound to the `if` statement and they are executed every time the method is called. \r\n\r\nSince you increase the index `i` on each recursive call and the statements in the brackets are executed independently from the `if`, then you get an `ArrayIndexOutOfBoundsException` on `char a=s.charAt(i);`\r\n\r\n if(i < s.length());\r\n ↑\r\n\r\nYou should end up with something like:\r\n\r\n if(i < s.length()) {\r\n char a=s.charAt(i);\r\n if(a==&#39; &#39;)\r\n a-=2; \r\n a+=2;\r\n if((a < 64||a > 90) & & a!=32)\r\n a-=26;\r\n System.out.print(a);\r\n two(i+1);\r\n }", "467" ], [ "The expression `avg = avg + sum / amount;` can be simplified to `avg = sum / amount;`.\r\n\r\nThe `sum / amount` part, however, will give you an `int` result, because both `sum` and `amount` and `int`s and by default the `/` operator produces an `int` result. \r\n\r\nSo you have to do a cast on (at least) one of the operands, i.e.:\r\n\r\n avg = ((double) sum) / amount;", "200" ], [ "Your `transform()` method must override the generic abstract `transform()` method in the super class, i.e. you should have something like:\r\n\r\n public class MyAssembler extends AbstractAssembler {\r\n \r\n @Override\r\n public < T extends AbstractValue > void transform(T value) {\r\n \r\n }\r\n }\r\n\r\nIf you want to invoke it with an actual type (e.g. `MyValue`) you should do:\r\n\r\n MyValue value = new MyValue();\r\n new MyAssembler().transfer(value);\r\n\r\nwhere explicitly specifying the type-parameter (`new MyAssembler(). < MyValue > transfer(value);`) is optional, as it will be inferred by the compiler.\r\n\r\n----\r\n\r\nIf you however wish `MyAssember`&#39;s `transform` method to work *only* with `MyValue`, then you should do:\r\n\r\n public class MyAssembler extends AbstractAssembler < MyValue > {\r\n \r\n @Override\r\n public void transform(MyValue value) {\r\n \r\n }\r\n }", "801" ], [ "Jackson provides a meta-annotation (annotation used for annotating another annotation), called [`@JacksonAnnotationsInside`][1], which is a:\r\n\r\n > Meta-annotation (annotations used on other annotations) used for\r\n > indicating that instead of using target annotation (annotation\r\n > annotated with this annotation), Jackson should use meta-annotations\r\n > it has. \r\n\r\n > This can be useful in creating \" ;combo-annotations \" ; by having a\r\n > container annotation, which needs to be annotated with this annotation\r\n > as well as all annotations it &#39;contains&#39;.\r\n\r\nSo, you should create an annotation like this one:\r\n\r\n @Target(value = { ElementType.TYPE, ElementType.METHOD,\r\n ElementType.PARAMETER, ElementType.FIELD })\r\n @Retention(RetentionPolicy.RUNTIME)\r\n @JacksonAnnotationsInside // < -- this one is mandatory\r\n @Transient\r\n @JsonSerialize(using = LocalDateTimeSerializer.class)\r\n @JsonDeserialize(using = LocalDateTimeDeserializer.class)\r\n @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = BaseEntity.JSON_DATETIME_FORMAT)\r\n public @interface TransientLocalDateTime { \r\n }\r\n\r\nand use is like:\r\n\r\n @TransientLocalDateTime\r\n public LocalDateTime getCreatedDateDT() {\r\n return DateTimeUtils.klabTimestampToLocalDateTime(getCreatedDate(), createdDateDT);\r\n }\r\n\r\n\r\n [1]: _URL_0_", "785" ], [ "When dividing `num` by `10`, you&#39;re getting rid of one digit (the last one), but you forget to add it to the result.\r\n\r\nYou code you need should be more like:\r\n\r\n public int numOfDigits(int num) {\r\n if (num < 10)\r\n return 1;\r\n return 1 + numOfDigits(num / 10);\r\n }\r\n\r\n... which can be reduced to a one liner with the ternary operator:\r\n\r\n public int numOfDigits(int num) {\r\n return (num < 10) ? 1 : 1 + numOfDigits(num / 10);\r\n }", "744" ], [ "> What I understood is that both will return the first matched element\r\n > from the stream, for example, when used in conjunction with filter?\r\n\r\nThat&#39;s not true. According to the javadoc, [`Stream#findAny()`][1]:\r\n\r\n > Returns an `Optional < T > ` describing *some* element of the stream, or an empty\r\n > `Optional < T > ` if the stream is empty.\r\n > The behavior of this operation is explicitly nondeterministic; **it is free to select any element in the stream.** This is to allow for maximal performance in parallel operations;\r\n\r\nwhile [`Stream.findFirst()`][2] will return an `Optional < T > ` describing **strictly** the first element of the stream. The `Stream` class doesn&#39;t have a `.findOne()` method, so I suppose you meant `.findFirst()`.\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "303" ], [ "I&#39;d suggest to make the `ShapeDrawer` generic, with a type-parameter some subclass of `Shape`:\r\n\r\n public abstract class ShapeDrawer < T extends Shape > implements iShapeDrawer {\r\n protected T shape; //the shape to be drawn\r\n \r\n public ShapeDrawer(T shape) {\r\n this.shape = shape;\r\n }\r\n }\r\n\r\nThen, each of the different shapes will have a corresponding `ShapeDrawer` class. For example, the `SimpleOval` would be drawn with:\r\n\r\n\r\n public class SimpleOvalDrawer extends ShapeDrawer < SimpleOval > {\r\n public SimpleOvalDrawer(SimpleOval oval) {\r\n super(oval);\r\n }\r\n }\r\n\r\nSimilar classes should be introduced for the other `Shape` sub-types.\r\n\r\nThere&#39;s also no need `SimpleOvalDrawer` to explicitly implement the `iShapeDrawer` interface, as `ShapeDrawer` already does.", "447" ], [ "> I see Java code written like this all the time, sometimes in textbooks (for example pg. 300 of \" ;Head First Design Patterns \" ; by O&#39;Reilly) so there must be a merit in it that I am missing.\r\n\r\nThis book was initially published back in 2004 and I don&#39;t think Java was supporting Generics at that time. So unsafe casting was something that was very commonly used then. Probably, if I didn&#39;t have the support of parametric polymorphism in Java, I would first check if the parameter is an instance of the type I&#39;d like to cast it to and then do the actual cast:\r\n\r\n private static void dangerousSpeakAndFly(Object x) {\r\n if (x instanceof Speakable) {\r\n Speakable temp = (Speakable) x;\r\n temp.Speak();\r\n }\r\n if (x instanceof Flyer) {\r\n Flyer temp2= (Flyer) x;\r\n temp2.Fly();\r\n }\r\n }\r\n\r\nHaving Generics, however, lets us do this:\r\n\r\n private static < T extends Speakable & Flyer > void reallySafeSpeakAndFly(T x) {\r\n x.Speak();\r\n x.Fly();\r\n }\r\n\r\nHere, the compiler can make sure we&#39;re not passing something that doesn&#39;t implement `Speakable` and `Flyer` and can detect such sassy attempts at compile-time.\r\n\r\n > Why is the first method used so extensively in practice and the latter isn&#39;t?\r\n\r\nIt might be that you&#39;ve seen a lot of legacy code, I suppose. :)", "372" ], [ "You&#39;re setting the `ArrayList` typed with a _raw_ `MyGenericContainer`. Thus, the compiler implies that the `ArrayList` will consist of `MyGenericContainer` of `Object` instances. \r\n\r\nIn order to fix it, you need to set the type-parameter of the `MyGenericContainer` type:\r\n\r\n List < MyGenericContainer < Cursor > > arrayList = new ArrayList < MyGenericContainer < Cursor > > ();\r\n\r\nIf you&#39;re on Java7+, then you could take advantage of the diamond (` < > `), which will allow you type a less verbose declaration:\r\n\r\n List < MyGenericContainer < Cursor > > arrayList = new ArrayList < > ();", "6" ], [ "> Is there any way I can set array1 to array2, so that any changes made to array1 will be reflected into array2 automatically?\r\n\r\nAutomatically, not. Once you&#39;ve initialized `array1` and `array2` with something, you can&#39;t re-initialize them again, since they&#39;re both `final`.\r\n\r\nHowever, you could manually _copy_ `array2`&#39;s content to `array1`.\r\n\r\n for (int i = 0; i < 4; i++) {\r\n array1[i] = array2[i];\r\n }\r\n\r\nThis will work, because the `final` modified doesn&#39;t guarantee immutability - it just makes sure that once the reference to a variable is set, it cannot change anymore.", "400" ], [ "From what I can see, you&#39;re trying to count how many times the elements from `list` appear in `l`. \r\n\r\nAnd currently you&#39;ve implemented a fairly naive solution that&#39;s of complexity `O(n * m)` (assuming that `list` has `n` elements and `l` has `m` elements).\r\n\r\nIn order to improve the performance, you need to improve the time complexity of your solution. You could create a `HashMap < Integer, Integer > ` that will hold how many times a number is appearing in `l` and then use it while iterating through the elements of `list`.\r\n\r\n Map < Integer, Integer > map = new HashMap < > ();\r\n for (Integer i : l) {\r\n map.put(i, map.getOrDefault(i, 0) + 1);\r\n }\r\n\r\nThen, for each element of `list`, you just need to check how many times its value appears in `l`. Again, I&#39;ll use a `Map`:\r\n\r\n Map < Integer, Integer > count = new HashMap < > ();\r\n for (Integer value : list) {\r\n Integer temp = count.get(value);\r\n if (temp != null) {\r\n count.put(value, temp + 1);\r\n } else {\r\n count.put(value, map.getOrDefault(value, 0) + 1);\r\n }\r\n }\r\n\r\nSince querying a `HashMap` takes a constant time (`O(1)`), then this solution will work with a `O(n + m)` complexity, which is far much better from `O(n * m)`.\r\n\r\nHowever, since you didn&#39;t explain what exactly you&#39;re problem is, nor what is the content of the lists, I cannot guarantee that these snippets are _exactly_ what you need, but you should be able to adjust this approach to your problem.", "319" ], [ "In your `Graph` constructor, you&#39;re not initializing the `static` member `adjList`, but rather are defining a local one with the same name. Also, there&#39;s no need `adjList` to be `static`, because it will be shared among all instances of `Graph`.\r\n\r\nAdjust it to:\r\n\r\n private ArrayList < ArrayList < Integer > > adjList;\r\n\r\n public Graph(int vertices){\r\n adjList = new ArrayList < ArrayList < Integer > > ();\r\n ...\r\n }", "309" ], [ "All of them are `false`, because what&#39;s happening are few checks whether: \r\n\r\n - ` \" ;string1==string2 \" ; + string1` refers to `string2` (for the first statement)\r\n - ` \" ;string2==string3 \" ; + string2` refers to `string3` (for the second one)\r\n - ` \" ;string1==string3 \" ; + string1` refers to `string1` (for the last one).\r\n\r\nYou need to wrap the `stringX == stringY` pieces, because otherwise String concatenation will take place first (as you might already know, the statements in Java are evaluated from left to right and wrapping some of them with brackets `()` gives them priority).\r\n\r\nSo, having this:\r\n\r\n System.out.println( \" ;string1==string2 \" ; + (string1==string2)); \r\n System.out.println( \" ;string2==string3 \" ; + (string2==string3));\r\n System.out.println( \" ;string1==string3 \" ; + (string1==string3));\r\n\r\nshould behave differently and then you should be able to investigate the output.", "105" ], [ "Probably you don&#39;t need that much parameters:\r\n\r\n public static int countGreaterThanFirst(int[] numbers, int currentIndex) {\r\n if (currentIndex == numbers.length) return 0;\r\n else {\r\n if (numbers[currentIndex] > numbers[0]) {\r\n return 1 + countGreaterThanFirst(numbers, currentIndex + 1);\r\n } else {\r\n return countGreaterThanFirst(numbers, currentIndex + 1);\r\n }\r\n }\r\n }\r\n\r\nand you should invoke it with (for example):\r\n\r\n countGreaterThanFirst(someArray, 1);\r\n\r\n----------------\r\n\r\nIf you meant to find \" ;all the numbers between `numbers[startIndex]` and `numbers[endIndex]` that are greater than `firstNumber`, then the implementation should be pretty similar to the above one:\r\n\r\n\r\n public static int countGreaterThanFirst(int[] numbers, int startIndex, int endIndex, int firstNumber) {\r\n if (startIndex > endIndex) return 0;\r\n else {\r\n if (numbers[startIndex] > firstNumber) {\r\n return 1 + countGreaterThanFirst(numbers, startIndex + 1, endIndex, firstNumber);\r\n } else {\r\n return countGreaterThanFirst(numbers, startIndex + 1, endIndex, firstNumber);\r\n }\r\n }\r\n }", "828" ], [ "When having a `List < ? > `, then `null` is the only reference you can add. So this should work:\r\n\r\n List < ? > result = new ArrayList < > ();\r\n result.add(null);\r\n\r\n\r\nHowever, this is not allowed:\r\n\r\n result.add( \" ; \" ;);\r\n \r\n\r\nThe reason is that the compiler cannot be entirely sure if the reference you&#39;re trying to add, matches the unknown at compile-time wildcard (`?`) type. \r\n\r\nIn order to allow adding `String` references to the `List`, you should define it as:\r\n\r\n List < String > result = new ArrayList < > ();\r\n result.add( \" ; \" ;);", "309" ], [ "> In this situation, how can I call the static method method of `ABC` class?\r\n\r\nYou can create a `static import` of the `ABC.method()` (assuming that the `ABC` class is within the `com.package` package) and just call it. \r\n\r\n import static com.package.ABC.method;\r\n\r\n public class GHI {\r\n public static void main(String args[]) {\r\n method(); // calling the static ABC.method()\r\n DEF ABC = new DEF();\r\n method(); // calling the static ABC.method\r\n ABC.method(); //calling the instance method()\r\n }\r\n }\r\n\r\nThis way you could distinguish between the `static method()` and the instance `method()` (defined in `DEF`).", "315" ], [ "When overriding methods, you can only change the modifier to a _wider_ one, not vice versa. For example this code would be valid:\r\n\r\n public abstract class A {\r\n \r\n protected void method();\r\n }\r\n \r\n public class B extends A {\r\n @Override\r\n public void method() { }\r\n }\r\n\r\nHowever, if you try to narrow down the visibility, you&#39;d get a compile-time error:\r\n\r\n public abstract class A {\r\n protected void method();\r\n }\r\n \r\n public class B extends A {\r\n @Override\r\n private void method() {}\r\n }\r\n\r\nFor your case, I&#39;d suggest to make `C` not implementing `A`, as `A`&#39;s abstraction _implies_ that there&#39;s a non-private `method()`:\r\n\r\n public class C {\r\n private void method(){\r\n //TODO\r\n }\r\n }\r\n\r\n\r\nAnother option is to make the `method()` implementation in `C` throwing a RuntimeException:\r\n\r\n public class C extends A {\r\n \r\n @Override\r\n public void method(){\r\n throw new UnsupportedOperationException( \" ;C doesn&#39;t support callbacks to method() \" ;);\r\n }\r\n }", "689" ] ]
501
[ 4581, 13811, 4039, 15357, 1403, 2045, 18962, 4000, 5906, 13431, 12374, 6462, 11329, 677, 15811, 17617, 7190, 14854, 11529, 4589, 6623, 5789, 14495, 11590, 10620, 11564, 16268, 11504, 4304, 3431, 12859, 16919, 4692, 10925, 16286, 13396, 6665, 10491, 7415, 9498, 17941, 2243, 10124, 19078, 3742, 4288, 6488, 3674, 473, 826, 14491, 4093, 15105, 5091, 19598, 9165, 747, 12110, 11313, 2614, 8536, 15710, 9261, 6706, 13078, 6095, 6980, 10113, 3758, 2488, 2307, 17245, 14385, 1374, 4772, 10673, 2427, 5090, 6756, 13458, 12701, 15790, 18406, 18306, 7518, 2092, 4551, 7279, 660, 18786, 1572, 12658, 15682, 447, 3109, 17500, 15309, 15557, 841, 9043, 9571, 145, 7065, 7620, 16666, 9266, 9633, 227, 14568, 9705, 8343, 11647, 13591, 11516, 14223, 6471, 12496, 12757, 10922, 15031, 2460, 4436, 7149, 11027, 13891, 9953, 17492, 8377, 13953, 16411, 1808, 14249, 10195, 13466, 9899, 19018, 18512, 6700, 13455, 10954, 2863, 15171, 12114, 5814, 6689, 17599, 17723, 16921, 15321, 10001, 13318, 1396, 9116, 9800, 10583, 16831, 18229, 1500, 13501, 7479, 8818, 16213, 3227, 1943, 19308, 11040, 17206, 14665, 14807, 1357, 16497, 14295, 700, 19069, 11272, 9517, 10774, 3914, 9427, 12169, 12097, 7790, 3814, 1645, 3859, 9869, 14798, 3649, 5203, 1237, 3623, 1775, 11318, 7375, 15577, 8857, 800, 8763, 4412, 12139, 6062, 16632, 17671, 17053, 11180, 6545, 14721, 9997, 4410, 6269, 12819, 7178, 18425, 13304, 13554, 2299, 8654, 3555, 10857, 6747, 17467, 13867, 2426, 5107, 1514, 13701, 8469, 5798, 13215, 3955, 238, 17678, 13750, 15370, 11900, 17620, 1779, 12771, 18603, 10687, 15051, 14821, 6864, 12183, 14675, 7521, 1986, 15993, 720, 10945, 5756, 5250, 9960, 19254, 6427, 13706, 17580, 15996, 13444, 16971, 4764, 3610, 19718, 5487, 11407, 15170, 19242, 16138, 2517, 629, 13494, 9142, 4647, 6735, 9523, 6746, 10899, 16589, 6360, 1416, 1126, 14335, 16948, 13293, 17656, 12864, 6650, 4757, 8751, 4137, 8336, 12653, 5020, 15799, 719, 14709, 17402, 12907, 16900, 12376, 9227, 5302, 6389, 10617, 246, 16307, 9760, 16349, 6612, 4833, 15463, 7398, 1958, 17622, 17370, 10165, 18218, 14395, 10601, 5070, 3803, 19463, 11288, 15319, 15303, 5138, 18738, 1472, 15631, 6303, 6609, 17972, 2888, 13013, 403, 14558, 17574, 7392, 14263, 7649, 6959, 12716, 8885, 18639, 6646, 2127, 9968, 19058, 7969, 8383, 241, 2813, 13910, 4660, 7879, 10701, 6285, 1641, 3043, 7766, 16008, 10571, 5198, 16726, 7216, 9491, 7143, 4694, 3856, 9783, 18665, 7672, 2505, 18444, 10386, 17519, 15664, 2884, 18771, 4712, 15215, 10849, 6635, 6178, 11397, 14746, 17886, 5640, 11365, 82, 17843, 6948, 19721, 8350, 9917, 3152, 16967, 17686, 19051, 2737, 777, 1069, 18724, 10622, 14832, 14928, 19452, 372, 14652, 374, 18606, 2671, 7891, 15937, 8101, 3813, 19503, 6686, 17646, 818, 1690, 12912, 16012, 16907, 9218, 8068, 12185, 16614, 12894, 5770, 3194, 11634, 14054, 9920, 14713, 9623, 18012, 15483, 19110, 9866, 1993, 9274, 13895, 7781, 16237, 14116, 5389, 11796, 9612, 261, 2615, 2696, 16127, 9065, 1612, 16194, 10307, 3738, 5697, 3317, 18279, 9914, 14147, 5041, 5713, 6775, 2169, 8700, 16645, 18919, 12042, 16256, 18735, 3386, 2484, 4398, 10818, 8242, 17856, 17667, 5681, 19753, 10536, 17269, 4550, 5508, 1649, 3335, 11107, 6128, 895, 3147, 15268, 2780, 16250, 2491, 13887, 6670, 1931 ]
STX_10035.0
[ [ "Are there convexity generalizations that admit genus information?\r\n\r\nFor example in genus $1$ is there a way to think of [this polyhedron](_URL_0_) as convex while [this polyhedron](_URL_1_) as non-convex? Any two points can be joined by a line or a circle seems to work.\r\n\r\nIs there a good definition that works in higher dimensions for which appropriate generalization of traditional convex geometry inequalities such as Brunn-Minkowski inequality can be given (A suitable notion of convex hull needs to be first defined).", "59" ], [ "Let $\\Bbb T$ be the set of all square free integers with ordering derived from $\\Bbb N$. Essentially $PNT$ says if you pick $\\log N$ integers less than $N$ you can expect one of them to be prime. \r\n\r\n1. What is the analog in $\\Bbb U\\subseteq\\Bbb T$ where $\\Bbb U$ contains only those integers in $\\Bbb T$ with factors $1\\bmod m$ for some fixed integer $m > 0$ (that is how many integers we expect to pick in random before we hit a prime)?\r\n\r\n2. What is the analog in $\\Bbb U_\\alpha\\subseteq\\Bbb T$ where $\\Bbb U$ contains only those integers in $\\Bbb T$ with factors $1\\bmod m$ for some fixed integer $m > 0$ and each integer $N\\in\\Bbb U_\\alpha$ has only $O((\\log \\log N)^\\alpha)$ factors for some fixed $\\alpha\\in(0,1)$?", "392" ], [ "A centrally symmetric convex polyhedron in $\\Bbb R^n$ shifted from the origin with possibly $e^{\\alpha n}$ number of vertices at some $\\alpha > 0$ has an unique ellipsoid of maximum volume called John&#39;s ellipsoid inscribed in it with barycenter of the polyhedron agreeing with center of the ellipsoid. \r\n\r\nObtain an uniform sample of $O(n^c)$ vertices at some fixed $c\\geq2$.\r\n\r\n1. Can we apply central limit theorem to approximate barycenter by mean of sample vertices?\r\n\r\n1. Since ellipsoids have only $O(n^2)$ parameters does this sample give a constant fraction approximation of each axis to the ellipsoid?", "59" ], [ "Given real $\\pm1$ matrix $M\\in\\Bbb R^{n\\times m}$ we have that cut-norm is given by $$\\|M\\|_C=\\max_{\\mathcal I\\subseteq[n],\\mathcal J\\subseteq[m]}\\Big|\\sum_{(i,j)\\in\\mathcal I\\times\\mathcal J}M_{ij}\\Big|$$\r\nand biclique size given by\r\n$$\\gamma(M)=\\max_{\\mathcal I\\subseteq[n],\\mathcal J\\subseteq[m]}\\Big\\{\\Big|\\mathcal I\\times\\mathcal J\\Big|:{ \\forall (i,j)\\in\\mathcal I\\times\\mathcal J, \\mbox{ each }M_{ij} \\mbox{ is same (all }1\\mbox{ or all }-1)}\\Big\\}.$$\r\n\r\nClearly $\\gamma(M)\\leq\\|M\\|_C$.\r\n\r\n > What is the maximum gap between $\\gamma(M)$ and $\\|M\\|_C$ among all real $0/1$ or $\\pm1$ matrices $M\\in\\Bbb R^{n\\times m}$ of rank $r$?\r\n\r\nWithout $r$ in the picture the gap has to be exponential or else $P=NP$ holds since cut norm has constant factor approximation while biclique does not.", "334" ], [ "Motivation: This problem comes from attempts to build a decoder for _URL_1_ and other related ramifications.\r\n\r\n > Are there integers $a,b,|U|,|V|$, $N$ such that \r\n\r\n > 1. $a,b$ are coprime\r\n2. $Ub\\equiv Va\\bmod N \\mbox{ with }\\mathsf{gcd}(a, U)=1,\\mathsf{gcd}(b, V)=1$\r\n3. $|U|,|V|\\approx N^{3/4+\\epsilon_1}$ and $a,b\\approx N^{1/4+\\epsilon_2}$\r\n4. $k\\equiv (ab)^{-1}(Ub+ Va)\\bmod N\\mbox{ and }k \\in\\Big[-\\frac N{ab},\\frac N{ab}\\Big]$\r\n5. At least one of $|U-ka|,|V-kb|$ is bigger than $N^{1/4}$\r\n6. $|U-ka|,|V-kb|$ are coprime\r\n\r\n > holds at some arbitrarily small $\\epsilon_1,\\epsilon_2 > 0$?\r\n\r\n\r\n\r\n${}$\r\n\r\nTo only satisfy 1.,2.,3. _URL_0_ shows existence of $\\frac1{\\zeta(2)}N^{1+2\\epsilon_1+2\\epsilon_2}$ quadruples $(U,V,a,b)$ for a given $N$. \r\n\r\nWhen you add 4. as well it is easy to see roughly $\\frac1{\\zeta(2)}N^{\\frac12+2\\epsilon_1}$ quadruples $(U,V,a,b)$ exist since expected intersection is $$\\frac{(\\#\\mbox{ triples satisfying }1.,2.,3.)\\times(\\mbox{interval size on which }k\\mbox{ should fall on})}{\\mbox{Total possibilities for residues}}$$ $$=\\frac{\\big(\\frac1{\\zeta(2)}N^{1+2\\epsilon_1+2\\epsilon_2}\\big)\\times\\big(\\frac{2N}{ab}+1\\big)}{N}\\approx\\frac{\\big(\\frac1{\\zeta(2)}N^{1+2\\epsilon_1+2\\epsilon_2}\\big)\\times\\big(\\frac{2N}{N^{1/2+2\\epsilon_2}}\\big)}{N}=\\frac2{\\zeta(2)}N^{\\frac12+2\\epsilon_1}.$$ \r\n\r\nIt is also clear that since $k\\in\\Big[-\\frac N{ab},\\frac N{ab}\\Big]\\implies k\\in[-{2}{N^{1/2-2\\epsilon_2}},{2}{N^{1/2-2\\epsilon_2}}]$ holds and $\\max(ka,kb)\\approx {2}{N^{1/2-2\\epsilon_2}}N^{1/4+\\epsilon_2}={2}{N^{3/4-\\epsilon_2}}\\ll N^{3/4+\\epsilon_1}\\approx |U|,|V|$ we have that both\r\n$|U-ka|,|V-kb|$ are close to $N^{3/4+\\epsilon_1}$ and are thus bigger than $N^{1/4}$.\r\n\r\nSo we know we can satisfy 1.,2.,3.,4. and 5.\r\n\r\n${}$\r\n \r\n > Is there a way to rigorously prove that there are quintuples $(|U|,|V|,a,b,N)$ that satisfy 1.,2.,3., 4., 5. and 6.?\r\n\r\nHeuristically speaking 6. should hold but it is not clear", "874" ], [ "> In the meantime <PERSON> went to <PERSON> disguised as Lord <PERSON>, but was recognized by her. Being enchanted by the beauty of goddess <PERSON>, he looked at her with his evil intentions, but was immobilized by her wrath. Goddess <PERSON> then went to Lord <PERSON> and narrated the whole tale. She requested Lord <PERSON> to go to Jalandhar&#39;s wife in the guise of <PERSON> and act in the same way.\r\n \r\nThis is a source of full story: [Jalandhar](_URL_0_)\r\n \r\nQuestion: <PERSON> should be punished for thinking evil about <PERSON>, then **why is <PERSON> punished for his misdeeds?**\r\n \r\n**Isn&#39;t this an act of injustice?**", "65" ], [ "1. Given a polynomial $p(x,y)\\in\\Bbb F_q[x,y]$ of $(x,y)$ degree $(n_x,n_y)$ ($n_x,n_y\\geq0$ and $n_x,n_y\\in\\Bbb Z$) where $q=p^\\alpha$ with $p$ a prime and $\\alpha\\in\\Bbb N$ how many different matrices $A_1,\\dots,A_{k_x}\\in \\Bbb F_q^{m\\times m}$\r\nand $B_1,\\dots,B_{k_y}\\in \\Bbb F_q^{m\\times m}$ can we have such that $$p(A_i,B_j)=0$$$$[A_i,B_j]=0$$ holds at every $i\\in\\{1,\\dots,k_x\\}$ and every $j\\in\\{1,\\dots,k_y\\}$ on the condition $$\\operatorname{vec}(A_1),\\dots,\\operatorname{vec}(A_k)\\in\\Bbb F_q^{m^2}$$\r\n$$\\operatorname{vec}(B_1),\\dots,\\operatorname{vec}(B_k)\\in\\Bbb F_q^{m^2}$$\r\n are independent in $\\Bbb F_q^{m^2}$?\r\n\r\n2. When does $$\\mathsf{span}(\\operatorname{vec}(A_1,A_2,\\dots,A_{k_x}))\\cap\\mathsf{span}(\\operatorname{vec}(B_1,B_2,\\dots,B_{k_y}))=\\{\\underbrace{(0,0,\\dots,0)}_{m^2}\\}$$ hold?\r\n\r\n3. Can we obtain basis for $\\mathsf{span}(\\operatorname{vec}(A_1,A_2,\\dots,A_{k_x}))$ and $\\mathsf{span}(\\operatorname{vec}(B_1,B_2,\\dots,B_{k_y}))$ from coefficients of $p(x,y)$?\r\n\r\n-------------------\r\n\r\nThere are several reasons this question arose. One of them is coding theory", "987" ], [ "[![google search screenshot][2]][1]\r\n\r\n > Goddess <PERSON>, by the standard mythological authorities, is the wife of Lord <PERSON>. The Vaishnavas of Bengal have a popular legend that she was the wife of Lord <PERSON>, as were also Goddess Lakshmi and <PERSON>. The ladies disagreed, goddess <PERSON>, like the other type of learned ladies, <PERSON>, being something of a termagant; and Lord <PERSON>, finding that one wife was as much as even a god could manage, transferred goddess <PERSON> to Lord <PERSON> and <PERSON> to Lord <PERSON>, and contented himself with goddess <PERSON> alone.\r\n\r\n_URL_0_\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_1_", "65" ], [ "Just picked up a Sapphire Nitro+ 580 4GB, and after BIOS modding it was kicking out incorrect shares constantly. I went back to the stock BIOS and with a modest memory overclock it&#39;s still getting one every 5 minutes or so while also getting some accepted shares.\r\n\r\nIt&#39;s got Hynix memory and 78% ASIC quality. The rig is three 480s, a 570, and this 580 mining on nanopool, and it&#39;s very stable. None of the other cards get incorrect shares that I&#39;ve ever seen.\r\n\r\nIs this card simply a lemon?", "73" ], [ "But if we want to decode uniquely then for every $n$ the value of $$uq+u&#39;q&#39;+n$$ has to be distinct for every choice of $q,q&#39;$. This means for every $n$ we need that $$uq+u&#39;q&#39;+n$$ has to take $qq&#39;\\approx N^{1-2\\epsilon}$ different values. Now there are about $N^{1-2\\epsilon}$ choices for $n$. For decoding $q,q&#39;$ uniquely at every choice of $n$ then we need $$uq+u&#39;q&#39;+n$$ to be distinct for every choice of $q,q&#39;$ and every choice of $n$.", "699" ], [ "The <PERSON> coin problem guarantees that if $(a,b)=1$, then\r\n$$ax+by$$ does not represent exactly $\\frac{(a-1)(b-1)}2$ numbers all below $g(a,b)=ab-a-b$ if $x,y\\geq0$ holds.\r\n\r\nAssume $m\\in[0,ab-a-b]$ and assume $\\max\\big(\\frac a b,\\frac ba\\big) < 2$.\r\n\r\nApproximately what fraction of numbers less than $m$ is represented by $ax+by$? In other words what is a good point-wise approximation to the function\r\n$$f_{a,b}(m)=\\big|\\{n\\in\\Bbb N_{\\leq m}:\\exists x,y\\in\\Bbb N_{\\leq\\min(a,b)}\\cup\\{0\\}\\mbox{ }\\mathsf{ with }\\mbox{ }ax+by=n\\}\\big|?$$\r\n\r\nFor instance, I am looking for an approximation that will explain the fact that every integer $m\\in[1,\\min(a,b)]$ is not represented. There seems to be more smaller non-representable numbers than larger ones. It seems lower the $m$, there are more non-representable numbers and there should be comparatively more representable numbers close to $g(a,b)$ to get upto half the numbers to be representable. What exactly is this distribution?", "334" ], [ "Actually since $c\\sqrt{m}$ is error term, upto constant factor $m > c&#39;ab$ for some $c,c&#39; > 0$. Actually I am not sure how to interpret error terms in these kind of calculations. Could you please add a line or two? my first guess is $m > ab$ but since $\\min(a,b) < \\sqrt{ab}$ I am not completely certain whether I am right and/or the triangle area trick is sufficient. $m > c&#39;ab$ seems too high for anything more subtle like non-representability of $\\min(a,b)-1$ initial integers.", "275" ], [ "In the [post on site cstheory.stackexchange](_URL_0_) on whether a variant of integer factorization\r\n$$\\mathsf{}\\mbox{ }{\\Pi} = \\{\\langle a, b, n \\rangle \\;|\\; \\exists \\mbox{ } \\mathsf{ an}\\mbox{ }\\mathsf{ integer}\\mbox{ } m \\in \\{a, \\ldots, b\\}\\mbox{ }\\mathsf{ such}\\mbox{ }\\mathsf{that}\\mbox{ }m | n\\}$$\r\n is $\\mathsf{NP}$ complete, it is clear that difference $b-a$ can neither be too small nor too big for the problem to remain $\\mathsf{NP}$ complete under Cram&#233;r&#39;s conjecture. \r\n\r\nWhat is the possible range of difference $b-a$ under which the problem remains $\\mathsf{NP}$ complete under Cram&#233;r&#39;s conjecture?\r\n\r\nNote in this problem $m$ need not be prime which makes the problem combinatorial rather than arithmetical", "293" ], [ "Let&#39;s say that the linear form $ax+by$ represents $n$ if $ax+by=n$ for some positive integer $x$ and $y$. \r\n\r\nCall a pair $(a,b)\\in\\Bbb N\\times\\Bbb N$ with $\\mathsf{gcd}(a,b)=1$ *good* if,\r\nfor any $r,s,u,v > 1$ with each of $rs,uv,ru,sv,rv,su < (a-1)(b-1)$ (the <PERSON> number of $(a,b)$), there is at most one set from among $\\{rs,uv\\}$, $\\{ru,sv\\}$ and $\\{rv,su\\}$ with both components representable by $ax+by$.\r\n\r\nDo good pairs exist at all?\r\n\r\nIf they do, then is it true that for every sufficiently large integer $l$, there is a good pair $(a,b)$ with $a,b\\in[l,2l]$?\r\n\r\n----------\r\nA bad pair example:\r\n\r\n$a=22,b=21,s = 16, t = 17,r = 19,u = 15$\r\n\r\n$$10a+4b=rs$$\r\n$$8a+7b=rt$$\r\n$$9a+2b=su$$\r\n$$3a+9b=tu$$\r\n\r\n----------\r\n Related _URL_0_", "874" ], [ "I am customizing my ~/.emacs file. Specifically, I am customizing org-mode&#39;s TODO list feature to include more tasks. However, I keep receiving the following error:\r\n\r\n > File mode specification error: (wrong-type-argument stringp\\ (sequence\r\n > \" ;TODO \" ; \" ;IN-PROGRESS \" ; \" ;WAITING \" ; \" ;DONE \" ;))\r\n\r\nI&#39;ve pasted my ~/.emacs file below. I am every new to emacs and org-mode. Would love any insights.\r\n\r\n < !-- language: lang-el -- > \r\n\r\n ;; -*- mode: emacs-lisp -*- \r\n \r\n ;; Disable the splash screen (to enable it agin, replace th\\\r\n e t with 0) \r\n (setq inhibit-splash-screen t)\r\n \r\n ;; Enable transient mark mode \r\n (transient-mark-mode 1)\r\n \r\n ;;;;org-mode configuration \r\n ;; Enable org-mode \r\n (require &#39;org)\r\n (setq org-todo-keywords\r\n &#39;((sequence \" ;TODO \" ; \" ;IN-PROGRESS \" ; \" ;WAITING \" ; \" ;DONE \" ;)))\r\n (add-to-list &#39;auto-mode-alist &#39;( \" ;\\\\.org\\\\&#39; \" ; . org-mode))\r\n \r\n \r\n ;; don&#39;t create backupfiles \r\n (setq make-backup-files nil)\r\n \r\n ;; don&#39;t create auto-save files \r\n (setq auto-save-default nil)\r\n\r\nThanks -- any insights would be appreciated.", "71" ], [ "The probabilistic method as first pioneered by <PERSON> (although others have used this before) shows the existence of a certain object. What are some of the most important objects for which we can show the existence by such a method but constructive progress (construction in polynomial time) has been very hard to come by?\r\n\r\nAn important example is the existence of good codes in coding theory. Using algebraic geometry we can show such objects not only exist but can be constructed in polynomial time.\r\n\r\n > I am thinking that in addition to graph theoretic and direct combinatorial examples, there should be plenty of natural but very difficult examples from number theory and geometry as well.", "661" ], [ "Thank you for the time taken. The idea is simple. Lets say a linear form $ax+by$ represents $n$ if $ax+by=n$ for some $x,y\\geq0$. Good pair $a,b$ essentially forms a linear form such that if $ax+by$ represents $rs$ and $tu$, it should not represent $rt,su$ and $ru,st$. That is all there is to it. I am looking for an infinite collection of good pair above a certain universal constant $n_0$.", "481" ], [ "Let&#39;s say that the linear form $ax+by$ represents $n$ if $ax+by=n$ for some positive integer $x$ and $y$. \r\n\r\nCall a pair $(a,b)\\in\\Bbb N\\times\\Bbb N$ with $\\mathsf{gcd}(a,b)=1$ *excellent* if linear form $ax+by$ has following property: For each composite $n < (a-1)(b-1)$ (the <PERSON> number of $(a,b)$) represented by the linear form there is exactly one collection of divisors starting from some $t_j\\geq t_1 > a,b$ to $t_s\\geq t_j$ at every $i\\geq1$ those $t_{i}$ with $t_j|t_{i}$ in $a,b < t_1 < \\dots < t_s\\leq n$ is represented by the linear form and no other divisors are represented.\r\n\r\nDo excellent pairs exist at all?\r\n\r\nIf they do, then is it true that for every sufficiently large integer $l$, there is a excellent pair $(a,b)$ with $a,b\\in[l,2l]$?\r\n\r\n\r\nNote that every *excellent* pair is a *good* pair in _URL_0_ and so *excellent* pair is a stronger condition.", "874" ], [ "@GerhardPaseman &#39;There is exactly one of those.&#39; this is the ambiguity. Say you have divisiors $63 < 71 < 126 < 142 < 189 < 213 < 252 < 284 < 315 < 355$. There are many choices for minimal element. Once you fix that element you get an unique collection. This minimal element is ambiguous before the selection is made. Say you fix minimal element is $71$ then $71$, $142$, $213$, $284$, $355$ will be represented. If minimal element is $142$ then only $142$, $284$ will be represented. The point is $ax+by$ does not know which minimal element it will *touch* but once it touches one the collection becomes unambiguous.", "413" ], [ "Given list of symmetric matrices $\\{A_i,B_i\\}_{i=1}^r\\in\\Bbb R^{n\\times n}$ where $r\\in\\Bbb N$ is arbitrary what is a good description of collection of $X\\in\\Bbb R^{n\\times n}$ such that $$XX&#39;=I$$ $$A_iX=XB_i$$ holds?\r\n\r\nNote: $X&#39;$ means the transpose of $X$.\r\n\r\n**(1)** Is there a test to see if there is no such $X$?\r\n\r\n**(2)** Is it easy to see if we find one such $X$ we can find *ALL* such $X$ from finding $U\\in\\Bbb R^{n\\times n} $ such that $UU&#39;=I$ and $UA_i=A_iU$ or $B_iU=UB_i$ at every $i\\in\\{1,\\dots,r\\}$?\r\n\r\n**(3)** What if we have $\\Bbb F_{p^r}$ instead of $\\Bbb R$?", "320" ], [ "How is the knot equivalence problem represented?\r\n\r\nBy this I mean I am looking for an analogy that compares with graph equivalence. For graph equivalence, we have two graphs $G_1$ and $G_2$ with adjacency matrices $A$ and $B$ respectively and we seek if there is a permutation matrix $P$ with transpose $P&#39;$ such that $A=PBP&#39;$.\r\n\r\nIs there an analogous matrix theoretic framework for knot equivalence? For any decision problem input have to be polynomially sized.", "805" ], [ "I use Quest procedure to find threshold for stereo disparity changes of a stimuli. I use a C++ implementation derived from the one in Psychotoolbox and I wonder whether the behaviour I observe is expected.\r\n\r\nAs my experiment is 2AFC I have set the probability to 0.75. If I answer honestly the thresholds goes down, then oscilate and get stable.\r\nHowever, if I answer completely randomly the threshold quickly gets to maximum value.\r\n\r\nBoth those things are maybe expected but what puzzles me is the standard deviation that the method returns along with the mean.\r\nFor normal run this goes down slowly and at some point reaches my limit where I consider the procedure to be converged and I terminate the experiment.\r\n\r\n**However for random answers the standard deviation goes down very quickly and after 5 answers the Quest terminates.**\r\n\r\nAs I use standard deviation to decide about convergence/success of the procedure I would get false very high thresholds this way.\r\nIs this an error in implementation or is the error in the way how I interpret the standard deviation?", "830" ], [ "A key tool in graph theory is the laplacian which is a local property. We can form a semidefinite programming and get an upper bound for Shannon capacity using laplacian.\r\n\r\nShannon capacity is inherently a global measure on independence sets. \r\n\r\nWhy does using a local property such as laplacian helps give capacity upper bound?\r\n\r\nIf we have a more global property would our estimates improve and what choices we have for such global properties?", "663" ] ]
328
[ 1547, 462, 4173, 1286, 5657, 18964, 19326, 16357, 3412, 16510, 4863, 12368, 7029, 15622, 13519, 8246, 17563, 18789, 12696, 2885, 15686, 869, 11326, 13615, 19141, 3552, 6562, 13231, 8769, 1053, 11699, 4767, 2150, 18389, 9016, 4110, 12633, 3303, 12014, 7339, 7379, 8667, 18577, 13562, 13315, 42, 8360, 6265, 5651, 5002, 16955, 475, 8701, 5278, 4054, 6193, 4324, 18935, 7386, 7952, 9548, 9677, 2050, 8489, 7586, 3467, 13194, 17162, 9885, 12328, 13403, 14943, 7750, 15861, 18898, 16740, 18359, 773, 4177, 4651, 1131, 2440, 2373, 18112, 2991, 8361, 6896, 14557, 2975, 19057, 19117, 15556, 8430, 12129, 12050, 12987, 11010, 655, 4044, 7113, 8431, 18500, 17545, 18479, 10349, 11058, 3769, 15603, 8112, 19563, 12435, 9238, 4065, 9166, 1190, 6485, 19373, 19709, 3035, 3659, 14347, 3445, 2105, 5910, 8791, 19487, 989, 18624, 11764, 3807, 6418, 3087, 8488, 15504, 19300, 2650, 3173, 4985, 6835, 9102, 10623, 4321, 932, 8682, 8546, 14125, 16116, 8487, 4053, 6355, 1364, 4828, 1679, 3034, 16606, 3822, 8865, 9653, 11249, 15780, 8059, 3567, 883, 2151, 18878, 16918, 3993, 7432, 6575, 2776, 17366, 11154, 19532, 4616, 712, 19604, 6723, 4766, 3142, 858, 15498, 17019, 3138, 7491, 2605, 5532, 17256, 65, 9568, 8514, 12209, 407, 8458, 5418, 4312, 8278, 12990, 19533, 5257, 3841, 12741, 8019, 16015, 2908, 11741, 9908, 4085, 12101, 19060, 12150, 3589, 19717, 12798, 9575, 7843, 7075, 14865, 17738, 4364, 966, 16335, 2704, 16677, 12957, 3751, 9856, 15182, 10358, 7109, 12208, 14076, 11034, 8464, 18620, 13812, 7367, 4162, 12296, 13157, 3855, 5390, 6841, 11988, 8215, 6233, 19105, 13929, 8367, 7939, 17429, 1401, 17502, 18961, 12140, 9283, 2808, 3757, 7811, 8544, 9946, 4399, 6701, 14944, 782, 10806, 10172, 6714, 3348, 5510, 6284, 6369, 12766, 16902, 6457, 6231, 4883, 6563, 8873, 144, 12685, 740, 482, 13768, 10431, 4119, 19496, 11401, 6198, 8292, 5992, 7482, 14784, 3923, 704, 1744, 5371, 12137, 4242, 15891, 1983, 8273, 13197, 7645, 136, 2566, 12415, 10506, 11539, 8406, 10121, 5822, 18398, 5197, 13138, 1722, 14128, 1774, 17969, 8597, 10339, 10142, 5899, 10416, 13103, 13816, 8434, 8167, 2191, 16659, 8245, 16505, 19609, 6037, 6108, 351, 11962, 4509, 11914, 12379, 8738, 14916, 8491, 16398, 17221, 5892, 7822, 2809, 2282, 4105, 16751, 2591, 1687, 18788, 3869, 1219, 3068, 11586, 2079, 2400, 10932, 18540, 3739, 451, 7397, 8508, 6782, 8057, 15896, 17105, 18943, 14669, 3415, 3783, 10865, 16524, 2878, 7492, 13598, 12182, 11931, 7058, 6376, 10020, 18804, 9404, 16142, 7477, 389, 19772, 7566, 8705, 2749, 19036, 9155, 2093, 19400, 17087, 18308, 7903, 10496, 2068, 8636, 6098, 2258, 2983, 15163, 10502, 5824, 1850, 2302, 10699, 1634, 18236, 5012, 681, 6028, 19200, 17494, 2387, 4196, 8549, 13180, 5376, 19616, 7988, 8399, 8044, 7086, 19421, 7912, 1857, 11615, 3060, 1129, 10396, 17994, 8274, 5570, 16585, 12492, 11202, 5810, 6945, 8494, 7000, 10383, 8465, 17028, 1437, 10826, 1667, 14813, 8421, 7640, 4605, 15933, 16317, 5862, 15216, 15227, 16119, 8394, 17951, 6054, 390, 5124, 11893, 8901, 19483, 2425, 8775, 8441, 13334, 15665, 8473, 5828, 16729, 657, 14887, 3002, 11096, 1462, 14947, 17898, 12299, 18867, 6996, 11947, 6943, 11913, 18190, 16665, 9454, 8928, 7791, 9886, 12282, 12898, 8107 ]
STX_1003565.0
[ [ "If this is what you want to do I don&#39;t think you&#39;ll be able to easily use a loop. Unless you&#39;re using a loop in a build script to write out the functions and roxygen code. With that said you would have a lot of replicated code if you did this manually for each of your functions. So what you could do is make a function that takes a function as input and returns a function as it&#39;s output. The search term you would be interested in here if you wanted to learn more would be \" ;closures \" ;. Here is an example from the [ggplot2 codebase](_URL_1_) (GPL-2):\r\n\r\n wrap_hmisc < - function(fun) {\r\n \r\n function(x, ...) {\r\n if (!requireNamespace( \" ;Hmisc \" ;, quietly = TRUE))\r\n stop( \" ;Hmisc package required for this function \" ;, call. = FALSE)\r\n \r\n fun < - getExportedValue( \" ;Hmisc \" ;, fun)\r\n result < - do.call(fun, list(x = quote(x), ...))\r\n \r\n plyr<IP_ADDRESS>rename(\r\n data.frame(t(result)),\r\n c(Median = \" ;y \" ;, Mean = \" ;y \" ;, Lower = \" ;ymin \" ;, Upper = \" ;ymax \" ;),\r\n warn_missing = FALSE\r\n )\r\n }\r\n }\r\n #&#39; @export\r\n #&#39; @rdname hmisc\r\n mean_cl_boot < - wrap_hmisc( \" ;_URL_0_.boot \" ;)\r\n #&#39; @export\r\n #&#39; @rdname hmisc\r\n mean_cl_normal < - wrap_hmisc( \" ;_URL_0_.normal \" ;)\r\n #&#39; @export\r\n #&#39; @rdname hmisc\r\n mean_sdl < - wrap_hmisc( \" ;smean.sdl \" ;)\r\n #&#39; @export\r\n #&#39; @rdname hmisc\r\n median_hilow < - wrap_hmisc( \" ;smedian.hilow \" ;)\r\n\r\nBasically you create a function which returns a function and then you can use that to manually go over all the functions you want to modify and add the relevant roxygen documentation. I don&#39;t see a way around doing the manual creation and manual roxygen documentation writing unless you want a build script to take care of that for you.", "904" ], [ "The roxygen2 package&#39;s documentation says it uses commonmark for it&#39;s markdown and there is nothing about tables in the [commonmark specs](_URL_3_) as of right now. On top of that we can examine the code related to markdown for the roxygen2 package [here](_URL_0_) and [here](_URL_2_) and we don&#39;t find any support for markdown tables.\r\n\r\nSo at least as of the time this answer is written the it seems the answer to your question is \" ;no \" ; to markdown tables.\r\n\r\nWith that said you can put tables in your documentation but you&#39;ll have to do it &#39;by hand&#39; using LaTeX syntax: _URL_1_", "176" ], [ "Your edit would be better suited for a new question. But it basically comes down to how things end up being parsed. If you can finish the parsing and start executing code at the end of the if block then the else needs to be on the same line as the closing brace. If you&#39;re inside of another if statement or a loop or a function... something where you don&#39;t immediately execute the code as soon as it is finished being read in by the interpreter then you can have it on a separate line. I personally don&#39;t like to do that since it&#39;s only allowed in certain situations and can bite you.", "655" ], [ "Brackets carry special meaning in regular expressions. Add `fixed=TRUE` to your parameters in grep tells it to interpret the pattern as is. The other option is to escape the brackets but if you don&#39;t need the full power of regular expressions and just want to search for a specific string then using `fixed=TRUE` is the better option anyways.\r\n\r\n x < - grep(&#39;[[1]]$px&#39;, readLines( \" ;file.txt \" ;), fixed = TRUE)", "143" ], [ "I suggested that since it seems the issue is that it&#39;s trying to \" ;get \" ; the data from the name you provide and that causes an error. I don&#39;t deal with including data enough to have a good example to play around with this but it seemed like avoiding that step would help alleviate this particular problem (but it seems like it shouldn&#39;t have been a problem so it might just be creating a problem later on). You might want to check that your package can install fine and the data gets loaded properly and you can view the documentation for the data.", "347" ], [ "If you download and extract you&#39;ll see that that it&#39;s some pdfs, a .dat file, and a single R script that contains a bunch of functions.\r\n\r\nLikely you just want to source the script so you want to extract the zip archive and then use `source` on MixeR.R\r\n\r\n source( \" ;path/to/MixeRArchive/MixeR.R \" ;)\r\n\r\nAlternatively they do host that file on their website directly so you could just read it from the internet directly\r\n\r\n source( \" ;_URL_0_;)\r\n\r\nEither way will read the functions directly into your global environment since it isn&#39;t an actual package with its own namespace.", "381" ], [ "Anytime R tells you that an object is not found it&#39;s not trying to play a trick on you. In this case you are using the wrong name. Your code shows us that `KWTProd.df` has a field called Production.Period.End.Date but then you try to access an object called `Period_kWh_Production` instead of `KWTProd.df`.\r\n\r\nSo the error is legit and it seems like you wanted to access `KWTProd.df$Production.Period.End.Date` instead.", "789" ], [ "If you add a column of 1s as your first column the linked solution will be able to detect when you do something like d$d[[4]] < - d$d[[4]] + 0.01. The \" ;small errors \" ; thing due to rounding might cause an issue but why don&#39;t you try that first. Basically if you add a column of 1s it allows for there to be a constant shift in the sum like you would do by adding 0.01 to the result.", "994" ], [ "Assuming you have a data.frame called `df` you could easily use the `ave` function to get what you want. An example:\r\n\r\n > df < - data.frame(grp = c(&#39;a&#39;,&#39;a&#39;,&#39;b&#39;,&#39;b&#39;), vals = 1:4)\r\n > df\r\n grp vals\r\n 1 a 1\r\n 2 a 2\r\n 3 b 3\r\n 4 b 4\r\n > # Returns a vector\r\n > ave(df$vals, df$grp, FUN = max)\r\n [1] 2 2 4 4\r\n > # So we can store it back into the data.frame if we want\r\n > df$max < - ave(df$vals, df$grp, FUN = max)\r\n > df\r\n grp vals max\r\n 1 a 1 2\r\n 2 a 2 2\r\n 3 b 3 4\r\n 4 b 4 4\r\n\r\nSo using your variable names (but still assuming the data.frame is `df`):\r\n\r\n df$max < - ave(df$price, df$ksu, FUN = max)", "983" ], [ "@akrun - What do you mean by \" ;not passing arguments into a function \" ;. I&#39;m pretty sure it&#39;s passing the input data and an expression in as arguments. Just because it&#39;s not string inputs and it&#39;s not a function I defined... I just don&#39;t see what your argument is there. Not trying to be confrontational... it just seems like an odd statement.", "799" ], [ "Actually I think we&#39;re quick to judge here. \r\n\r\n_URL_0_ \r\n\r\nThe CHANGES file specifies that .nlmP was supposed to be exported in 1.7-2 and looking through the history it was. It wasn&#39;t until 1.7-4 or 1.7-5 that it got commented out in the NAMESPACE file. There is a note \" ;changes to fix issues on CRAN reported errors/warnings regarding namespaces and foreign calls \" ; so it might have been a namespace issue but it does seem the author intended for the function to be exported.\r\n\r\nIt might make sense to contact the maintainer about this.\r\n\r\nIf you absolutely need this function you could install the latest version that had it exported.\r\n\r\n library(devtools)\r\n install_github( \" ;cran/geoR \" ;, ref = \" ;74feb80 \" ;)\r\n\r\nNote that you won&#39;t have any of the changes made to the package after that commit.\r\n\r\nWith that said I&#39;m fairly sure there are better packages for contstrained non-linear optimization so hopefully somebody comes along with a better answer to get at the actual root of your problem.", "46" ], [ "@Frank Yeah that works. I tend to prefer the format I wrote. It might be longer and it might duplicate a little bit of code but it&#39;s just my preference. I tend to think of `if` as more of a control-flow structure rather than the function that it is so I don&#39;t typically use the `value < - if(blah) x else y` design pattern much but there isn&#39;t any harm in it.", "907" ], [ "@mko&#39;s solution is a nice general way to attack problems like these but in this particular case you can get rid of the message by passing a profile object to `confint` directly. If you use the following line instead of your original code none of the output will be any different but you won&#39;t get the message that is annoying you.\r\n\r\n ci.05 = confint(profile(fit), level=0.95)[ \" ;x \" ;, \" ;2.5 % \" ;]", "259" ], [ "It&#39;s not something I typically do but the documentation led me to try that to see if it would get rid of the message. It does look like confint does just call profile for glms and gives you that message. I don&#39;t really think the speed difference will be anything to worry about (unless you&#39;re doing something like a simulation and replicating this thousands/millions of times - but even then I don&#39;t know if you gain much). The main benefits of being explicit like this are 1) you don&#39;t get the message printed to the console and 2) you get more control over the profiling if you want to.", "1008" ], [ "You can use roxygen style comments above your functions if you&#39;re fine with keeping your documentation in the code files directly. You wouldn&#39;t easily be able to view you documentation using the typical `?your_function` syntax though. There might be a way around that with some hacks to generate the documentation and place them somewhere in the help search path but that seems like more work than necessary.\r\n\r\nIf you&#39;re willing to include the roxygen2 style documentation inside the function you can get the nice `?your_function` syntax to view the documentation if you&#39;re willing to load the `docstring` package. It&#39;s a package I wrote pretty much exactly for your use case - where you have code you want to document but haven&#39;t either taken the time or don&#39;t care to place it in a package. I suggest either reading the README on [the github page for docstring](_URL_0_) or view the vignette provided on the [cran page for docstring](_URL_1_).\r\n\r\nHere&#39;s an example session using docstring:\r\n\r\n library(docstring)\r\n \r\n square < - function(x){\r\n \r\n #&#39; Square a number\r\n #&#39;\r\n #&#39; Calculates the square of the input\r\n #&#39;\r\n #&#39; @param x the input to be squared\r\n \r\n return(x^2)\r\n }\r\n \r\n # This will display the documentation for square\r\n # just like any other help file would be displayed\r\n ?square", "321" ], [ "<PERSON> While I agree in spirit - in practice some people have different workflows. If they&#39;re willing to write documentation without changing their workflow to accommodate creating a full package then that&#39;s fine with me. I&#39;ll also say that while I think package creation is a lot easier than it used to be it&#39;s still a formidable hurdle for those that haven&#39;t done it before.", "321" ], [ "You use `system.file` when the file you want to reference is from a package. Here is what the help file for `system.file` says:\r\n\r\n > Finds the full file names of files in packages etc.\r\n\r\nYou just want to reference a file on your machine. You can just directly store the path and use that as your data.file\r\n\r\n data.file < - \" ;C:/path/to/your/file \" ;\r\n\r\nThe script uses `file.path` because it&#39;s a safer way to generate paths in a platform-independent way. For example:\r\n\r\n > file.path( \" ;C: \" ;, \" ;Users \" ;, \" ;BotsRule \" ;, \" ;Code \" ;, \" ;myawesomeRscript.R \" ;)\r\n [1] \" ;C:/Users/BotsRule/Code/myawesomeRscript.R \" ;\r\n\r\nSo the solution to your problem is to just make sure you&#39;re actually doing *something* just *anything* to correctly specify the path to your file.", "20" ], [ "P Lapointe&#39;s answer is great but anytime I&#39;m doing a &#39;rolling&#39; calculation my first instinct is to think of `rollapply` from the zoo package. \r\n\r\n is_last_greatest < - function(x){\r\n #&#39; Given an input vector this returns\r\n #&#39; 1 if the last element is greater than\r\n #&#39; all of the other elements and 0 otherwise\r\n ifelse(all(tail(x,1) > head(x,-1)), 1, 0)\r\n }\r\n \r\n # We want to compare to the previous 10 values but the function\r\n # I wrote requires us to include the value we&#39;re using as\r\n # comparison so I set the width to 11\r\n output < - rollapply(dat, \r\n width = 11, \r\n FUN = is_last_greatest, \r\n fill = NA, \r\n align = \" ;right \" ;)\r\n \r\n cbind(dat, output)\r\n\r\nwhich gives\r\n\r\n dat vals\r\n [1,] 12 NA\r\n [2,] 13 NA\r\n [3,] 14 NA\r\n [4,] 15 NA\r\n [5,] 9 NA\r\n [6,] 9 NA\r\n [7,] 7 NA\r\n [8,] 8 NA\r\n [9,] 16 NA\r\n [10,] 17 NA\r\n [11,] 20 1\r\n [12,] 14 0\r\n [13,] 9 0\r\n [14,] 8 0\r\n [15,] 6 0\r\n [16,] 5 0\r\n [17,] 28 1", "131" ], [ "@ThomasMoore - If the final result is going to take 4GB then it will very likely need more space than that for the computations. You could always do part of it &#39;by hand&#39;. Split your variables in half and use expand.grid on each half. Then cycle through one of the results and attach the results from the other half - doing whatever it is you want to do with those results and storing the output, then move onto the next row in your first half, repeat, etc...", "668" ], [ "I don&#39;t know your familiarity with R so I don&#39;t mean to be patronizing. But the code you&#39;ve provided doesn&#39;t change the data directly. You need to store the result somewhere for the changes to stick. If you&#39;re just running that code and then trying to use `test.dup$RightID` it won&#39;t do anything.", "56" ], [ "@ŁukaszDeryło It doesn&#39;t suppress the warning about the package being built on a later version of R for me. And if plyr is loaded it doesn&#39;t suppress the warnings about masked objects. You would need to use `suppressWarnings` and `suppressPackageStartupMessages` in conjuction if you wanted to handle loading reshape directly instead of using a chunk option.", "259" ] ]
5
[ 6523, 163, 12008, 11269, 11965, 9304, 9185, 17342, 18455, 6419, 8542, 6683, 10238, 2653, 18940, 1411, 7906, 3150, 6855, 13885, 6025, 14019, 4494, 2434, 3463, 18390, 13047, 12586, 14738, 17923, 11926, 12473, 13373, 8858, 13531, 7110, 6436, 13068, 14434, 9868, 9231, 18073, 5563, 16409, 7193, 2421, 11540, 1669, 8453, 114, 12630, 6080, 18864, 14144, 17697, 17931, 13778, 702, 5236, 2526, 13445, 8712, 3146, 2284, 4542, 4711, 126, 12623, 8566, 14028, 9909, 18004, 5502, 3862, 17674, 1243, 12629, 14818, 15448, 9651, 14923, 2534, 16964, 19214, 11963, 12398, 15803, 11160, 19589, 14368, 10473, 9596, 6899, 12458, 19767, 15858, 16081, 11910, 9159, 4807, 8881, 8456, 4134, 5212, 6551, 8513, 3670, 14973, 10164, 13903, 13181, 8007, 18394, 16792, 896, 13584, 7241, 5619, 2239, 5629, 1360, 12706, 17448, 17527, 17343, 14793, 11453, 8724, 10973, 5964, 944, 6338, 7411, 5036, 1674, 17729, 409, 10534, 18597, 19030, 19265, 5703, 19601, 18413, 18669, 4313, 1925, 48, 15497, 3593, 10335, 13635, 7273, 19080, 15783, 16285, 15038, 327, 4120, 12154, 10469, 9851, 3107, 18586, 15994, 17328, 5320, 16773, 13763, 15693, 3134, 11743, 9654, 17810, 2476, 12084, 6884, 137, 17411, 9840, 851, 8729, 8172, 4267, 16834, 12062, 1563, 14498, 10295, 14439, 14502, 15816, 348, 4121, 5543, 921, 2438, 2644, 16603, 8563, 2868, 2669, 15529, 6774, 9712, 1632, 16289, 12893, 6615, 6396, 13613, 1559, 1156, 3371, 3942, 17241, 2231, 5147, 14810, 14658, 1390, 471, 13532, 3480, 14341, 11125, 16362, 11903, 17346, 2131, 5286, 2121, 16429, 698, 19573, 11195, 6153, 17694, 13835, 14783, 18513, 13124, 1789, 221, 3504, 18904, 14418, 18491, 8613, 5559, 10254, 9961, 6668, 15100, 13592, 480, 3990, 3074, 3325, 6915, 7593, 6547, 14543, 1866, 2497, 8853, 11137, 5096, 8647, 5545, 17824, 434, 7810, 1788, 11406, 11089, 4648, 9569, 11860, 2433, 15773, 9621, 3768, 5305, 18819, 15334, 9380, 12690, 11537, 3274, 6264, 5742, 15977, 4003, 13796, 17183, 17772, 10272, 8601, 15524, 9940, 16741, 16475, 5638, 15675, 12036, 18557, 12856, 3222, 12795, 1408, 17272, 13971, 3027, 232, 15769, 8433, 4552, 13457, 5857, 9541, 9890, 1446, 8055, 2458, 2714, 3865, 18700, 12654, 9817, 2449, 11996, 713, 13795, 13104, 3419, 1881, 1320, 19181, 4058, 13331, 4862, 7641, 13077, 4109, 18184, 2101, 16617, 5575, 6517, 14884, 18103, 577, 19020, 5636, 12574, 12896, 2733, 10606, 17903, 1210, 8620, 10453, 9393, 7975, 16858, 11565, 15223, 2155, 16004, 9555, 9269, 17799, 12220, 7462, 2, 9542, 18376, 18873, 18485, 4255, 8754, 1823, 14197, 9278, 10464, 9938, 6411, 3746, 16410, 2305, 2705, 13114, 18285, 16550, 6044, 13588, 11809, 9619, 4691, 15273, 8087, 8485, 17110, 2047, 17382, 13553, 18676, 2561, 611, 3794, 19084, 18040, 5316, 15477, 8034, 18841, 15224, 3731, 9091, 10900, 152, 19043, 10835, 8749, 17005, 1515, 9455, 8506, 972, 13846, 18601, 960, 6258, 12889, 18886, 10042, 8575, 16165, 4333, 7362, 13783, 17065, 17391, 14142, 18929, 4936, 7842, 10441, 10160, 18975, 5966, 13336, 18608, 17438, 19740, 7416, 6162, 8747, 16345, 6649, 8524, 14820, 15658, 9928, 14888, 7647, 14571, 1968, 4330, 3310, 15068, 19746, 18360, 10885, 15512, 14419, 18090, 15558, 11228, 9321, 15617, 5290, 5717, 16977, 10105, 6327, 1277, 17766, 17854, 6468, 16072, 19227, 10761, 14357, 17725, 1158, 16837, 4978 ]
STX_10035985.0
[ [ "For getting all `ID` tags you can use `find_all()` function: \r\n\r\n import requests\r\n from bs4 import BeautifulSoup \r\n \r\n \r\n def get_html(url): \r\n \" ; \" ; \" ;get the content of the url \" ; \" ; \" ; \r\n response = requests.get(url)\r\n response.encoding = &#39;utf-8&#39; \r\n return response.text \r\n \r\n \r\n def get_pmid(html): \r\n soup = BeautifulSoup(html, &#39;lxml&#39;) \r\n rv = []\r\n for id_tag in soup.find_all(&#39;id&#39;):\r\n rv.append(id_tag.text)\r\n return rv\r\n \r\n url_ncbi = \" ;_URL_0_; \r\n html = get_html(url_ncbi)\r\n all_ids = get_pmid(html)\r\n print(all_ids)\r\n\r\nPrints:\r\n\r\n [&#39;29737393&#39;, &#39;29209902&#39;, &#39;24632028&#39;, &#39;23727638&#39;, &#39;22536244&#39;, &#39;22052867&#39;, &#39;15371742&#39;, &#39;12204559&#39;, &#39;10885798&#39;, &#39;16348362&#39;, &#39;3096335&#39;, &#39;3734807&#39;, &#39;6247641&#39;, &#39;6997858&#39;, &#39;761345&#39;, &#39;108510&#39;, &#39;355840&#39;, &#39;1003285&#39;, &#39;4676550&#39;, &#39;5804470&#39;, &#39;6076800&#39;, &#39;6076775&#39;, &#39;6012920&#39;, &#39;14091285&#39;]", "1017" ], [ "Yes, you can use lambdas in BeautifulSoup&#39;s `find_all()` function. This example will find all `span` tags with &#39;*italize*&#39; in style attribute:\r\n\r\n from bs4 import BeautifulSoup\r\n \r\n content = &#39;&#39;&#39; \" ; < p dir= \" ;ltr \" ; > \r\n < span style= \" ;color: rgb(0, 0, 0); font-style: normal; background-color: transparent; font-weight: 400; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap \" ; > a < /span > \r\n < /p > ,\r\n < p dir= \" ;ltr \" ; > \r\n < span style= \" ;color: rgb(0, 0, 0); font-style: italize; background-color: transparent; font-weight: 400; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap \" ; > d < /span > \r\n < span style= \" ;color: rgb(0, 0, 0); font-style: normal; background-color: transparent; font-weight: 400; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap \" ; > b < /span > \r\n < /p > ,\r\n < p dir= \" ;ltr \" ; > \r\n < span style= \" ;color: rgb(0, 0, 0); font-style: normal; background-color: transparent; font-weight: 400; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap \" ; > c < /span > \r\n < span style= \" ;color: rgb(0, 0, 0); font-style: italize; background-color: transparent; font-weight: 400; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap \" ; > d < /span > \r\n < /p > \" ;&#39;&#39;&#39;\r\n \r\n soup = BeautifulSoup(content, &#39;lxml&#39;)\r\n \r\n for span in soup.find_all(&#39;span&#39;, style=lambda s: &#39;italize&#39; in s):\r\n print(span)\r\n\r\nPrints:\r\n\r\n < span style= \" ;color: rgb(0, 0, 0); font-style: italize; background-color: transparent; font-weight: 400; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap \" ; > d < /span > \r\n < span style= \" ;color: rgb(0, 0, 0); font-style: italize; background-color: transparent; font-weight: 400; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap \" ; > d < /span >", "1017" ], [ "My attempt (using `Counter` from `itertools`):\r\n\r\n data = [{&#39;name&#39;: &#39;Erwin Stahl&#39;, &#39;party&#39;: &#39;SPD&#39;, &#39;term&#39;: &#39;9&#39;},\r\n {&#39;name&#39;: &#39;Eugen Glombig&#39;, &#39;party&#39;: &#39;SPD&#39;, &#39;term&#39;: &#39;9&#39;},\r\n {&#39;name&#39;: &#39;Eugen von der Wiesche&#39;, &#39;party&#39;: &#39;SPD&#39;, &#39;term&#39;: &#39;9&#39;},\r\n {&#39;name&#39;: &#39;Ferdinand Tillmann&#39;, &#39;party&#39;: &#39;CDU&#39;, &#39;term&#39;: &#39;9&#39;},\r\n {&#39;name&#39;: &#39;Franz Amrehn&#39;, &#39;party&#39;: &#39;CDU&#39;, &#39;term&#39;: &#39;9&#39;},\r\n {&#39;name&#39;: &#39;Franz Handlos&#39;, &#39;party&#39;: &#39;CSU&#39;, &#39;term&#39;: &#39;9&#39;},\r\n {&#39;name&#39;: &#39;Franz Heinrich Krey&#39;, &#39;party&#39;: &#39;CDU&#39;, &#39;term&#39;: &#39;9&#39;},\r\n {&#39;name&#39;: &#39;Franz Josef Conrad&#39;, &#39;party&#39;: &#39;CDU&#39;, &#39;term&#39;: &#39;9&#39;}]\r\n \r\n from collections import Counter\r\n \r\n # Find duplicates based on &#39;name&#39;, &#39;party&#39;, &#39;term&#39; - you can edit which keys you want to search for:\r\n c = Counter((d[&#39;name&#39;], d[&#39;party&#39;], d[&#39;term&#39;]) for d in data)\r\n \r\n new_data = []\r\n for d in data:\r\n if c[(d[&#39;name&#39;], d[&#39;party&#39;], d[&#39;term&#39;])] == 1:\r\n new_data.append(d)\r\n \r\n print(new_data)", "983" ], [ "Using the `operator.attrgeter`. I added `__repr__` method to see the example:\r\n\r\n from operator import attrgetter\r\n \r\n class Employee:\r\n \r\n allEmployees = []\r\n \r\n def __init__(self, name, age):\r\n _URL_0_ = name\r\n self.age = age\r\n Employee.allEmployees.append(self)\r\n \r\n def __repr__(self):\r\n return f&#39;Employee({_URL_0_}, {self.age})&#39;\r\n \r\n def sortEmployees(some_list, attribute):\r\n f = attrgetter(attribute)\r\n return sorted(some_list, key=f)\r\n \r\n l = [Employee(&#39;John&#39;, 30),\r\n Employee(&#39;Miranda&#39;, 20),\r\n Employee(&#39;Paolo&#39;, 42)]\r\n \r\n print(sortEmployees(Employee.allEmployees, &#39;name&#39;))\r\n print(sortEmployees(Employee.allEmployees, &#39;age&#39;))\r\n\r\nPrints:\r\n\r\n [Employee(John, 30), Employee(Miranda, 20), Employee(Paolo, 42)]\r\n [Employee(Miranda, 20), Employee(John, 30), Employee(Paolo, 42)]", "761" ], [ "One possible solution (I encoded the PNG image in Base64):\r\n\r\n from PIL import Image\r\n from io import BytesIO\r\n import base64\r\n \r\n data = &#39;&#39;&#39;iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB+ACCAAXMEa+fpcAAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAAAx9JREFUeNrt3MtNA1EMQFGMpqWIgpAiakJKA6mBBrJOL2wfBYQVDrI9c85+8pnPlWfxXrxQbSWPD6eQv3p1CkAAAAEABAAQAEAAAAEABAAQAEAAAAEABAAQAEAAAAEAurKWPC+1nv/z/S315efLzT2ICQAQAEAAAAEABAAQAEAAAAEABAAEABAAQAAAAQAEABAAYH+sxc4r3Q8g6+vju/T7r6e7e9gEAAgAIACAAAACAAgAIACAAAACAAgAIACAAAACAAgAIADAo236H1jJ45+wmDz1EefLbfR+ApgAAAEABAAQAEAAAAEABAAQAEAAAAEABAAQAEAAAAEABAD4F5tTcGzX0736J4SrYAIABAAQAEAAAAEABAAQAEAAAAEABAAQAEAAAAEABAAQAOBB+X4AK3l85D+C2bdAtdH7GZgAwCsAIACAAAACAAgAIACAAAACAAgAIACAAAACAAgAIABAWx3WMq+yg12A2Rd/H9ev9BYwAYBXAEAAAAEABAAQAEAAAAEABAAQAEAAAAEABAAQAEAAgLaesRb50Ov5ofgBTH2ECQC8AgACAAgAIACAAAACAAgAIACAAAACAAgAIACAAAACALS1OQWMtop3lIgYffpMAOAVABAAQAAAAQAEABAAQAAAAQAEABAAQAAAAQAEABAAoC37ATBbdj1+9X4CJgBAAAABAAQAEABAAAABAAQAEABAAAABAAQAEABAAAABAH5nPwCOLbufgAkAEABAAAABAAQAEABAAAABAAQAEABAAAABAAQAEABAAAABAAQAEABAAAABAAQAEABAAAABAAQAEABAAAABAAEABAAQAEAAAAEABAAQAEAAAAEABAAQAEAAAAEABAAQAEAAAAEABAAQAKBKNPgNq+xgqH+ASp9BEwB4BQAEABAAQAAAAQAEABAAQAAAAQAEABAAQAAAAQAEAGgrdvAf7CdA5QMw+hkyAYBXAEAAAAEABAAQAEAAAAEABAAQAEAAAAEABAAQAEAAgLbCKbAlgGfABAAIACAAgAAAAgAIACAAgAAAAgAIACAAgAAAAgAIACAAQDs/+5skuT18qwIAAAAASUVORK5CYII=&#39;&#39;&#39;\r\n \r\n img = Image.open(BytesIO(base64.b64decode(data)))\r\n \r\n unique_colors = set()\r\n for i in range(img.size[0]):\r\n for j in range(img.size[1]):\r\n pixel = img.getpixel((i, j))\r\n unique_colors.add(pixel)\r\n \r\n print(&#39;Image info = &#39;, img)\r\n print(&#39;Unique color count = &#39;, len(unique_colors))\r\n\r\nPrints:\r\n\r\n Image info = < PIL.PngImagePlugin.PngImageFile image mode=RGBA size=256x256 at 0x7FFFF670A400 > \r\n Unique color count = 7", "682" ], [ "For getting the text only for the element (not child elements) you can use `.find(text=True)`:\r\n\r\n data = \" ; \" ; \" ;\r\n < div class= \" ;results-list \" ; id= \" ;theaterlist \" ; > \r\n < table > \r\n < tr class= \" ;trspacer \" ; > \r\n < td > \r\n < a href= \" ;theater.aspx?id=4000642 \" ; > \r\n < h2 class= \" ;placename \" ; > \r\n Hyde Park\r\n < span class= \" ;boldelement \" ; > \r\n Richmond Avenue 56 ls61bz\r\n < /span > \r\n < /h2 > \r\n < /a > \r\n \" ; \" ; \" ;\r\n \r\n from bs4 import BeautifulSoup\r\n \r\n soup = BeautifulSoup(data, &#39;lxml&#39;)\r\n print(soup.find(&#39;h2&#39;).find(text=True).strip())\r\n\r\nPrints:\r\n\r\n Hyde Park", "1017" ], [ "This will find all tags (a, div, or other) that have &#39;class&#39; attribute and have all the specified classes:\r\n\r\n from bs4 import BeautifulSoup\r\n \r\n html = &#39;&#39;&#39;\r\n < a class=&#39;a-link-normal s-access-detail-page s-color-twister-title-link a-text-normal&#39; > This is a anchor text < /a > \r\n < div class=&#39;s-access-detail-page s-color-twister-title-link a-text-normal&#39; > Div text < /div > \r\n &#39;&#39;&#39;\r\n \r\n soup = BeautifulSoup(html, \" ;lxml \" ;)\r\n all_prod_links = soup.find_all(\r\n lambda t: &#39;class&#39; in t.attrs and &#39;a-link-normal&#39; in t[&#39;class&#39;] and \\\r\n &#39;s-access-detail-page&#39; in t[&#39;class&#39;] and \\\r\n &#39;s-color-twister-title-link&#39; in t[&#39;class&#39;] and \\\r\n &#39;a-text-normal&#39; in t[&#39;class&#39;])\r\n \r\n print(all_prod_links)\r\n\r\nPrints:\r\n\r\n [ < a class= \" ;a-link-normal s-access-detail-page s-color-twister-title-link a-text-normal \" ; > This is a anchor text < /a > ]", "1017" ], [ "data = \" ; \" ; \" ;\r\n < table border=1 width=900 > \r\n < tr > < td width=50% > \r\n < table > \r\n < tr > < td align=right > < b > Invoice # < /td > < td > < input type=text value= \" ;1624140 \" ; size=12 > < /td > < /tr > \r\n < tr > < td align=right > Company < /td > < td > < input type=text value= \" ;NZone \" ; size=40 > < /td > < /tr > \r\n < tr > < td align=right > Name: < /td > < td > < input type=text value= \" ;John Dot \" ; size=40 > < /td > < /tr > \r\n < tr > < td align=right > Address: < /td > < td > < input type=text value= \" ;Posie Row, Moscow Road \" ; size=40 > < /td > < /tr > \r\n < tr > < td align=right > City: < /td > < td > < input type=text value= \" ;Co. Dubllin \" ; size=40 > < /td > < /tr > \r\n < tr > < td align=right > Province < /td > < td > < input type=text value= \" ; \" ; size=40 > < /td > < /tr > \r\n < tr > < td align=right > Postal Code: < /td > < td > < input type=text value= \" ; \" ; size=40 > < /td > < /tr > \r\n < tr > < td align=right > Country: < /td > < td > < input type=text value= \" ;IRELAND \" ; size=40 > < /td > < /tr > \r\n < tr > < td align=right > Date: < /td > < td > < input type=text value= \" ;24.4.18 \" ; size=12 > < /td > < /tr > \r\n < tr > < td align=right > Sub Total: < /td > < td > < input type=text value= \" ;93,24 \" ; size=40 > < /td > < /tr > \r\n < tr > < td align=right > Combined Weight: < /td > < td > < input type=text value= \" ;1,24 \" ; size=40 > < /td > < /tr > \r\n < /table > \r\n \" ; \" ; \" ;\r\n \r\n from bs4 import BeautifulSoup\r\n \r\n soup = BeautifulSoup(data, &#39;lxml&#39;)\r\n \r\n for (td, inp) in zip(soup.find_all(&#39;td&#39;, align= \" ;right \" ;), soup.find_all(&#39;input&#39;)):\r\n print(td.text, inp[&#39;value&#39;])\r\n\r\nOutput is:\r\n\r\n Invoice # 1624140\r\n Company NZone\r\n Name: <PERSON>\r\n Address: Posie Row, Moscow Road\r\n City: Co. Dubllin\r\n Province \r\n Postal Code: \r\n Country: IRELAND\r\n Date: 24.4.18\r\n Sub Total: 93,24\r\n Combined Weight: 1,24", "1017" ], [ "Yes, it&#39;s called [Bloom Filters][1]:\r\n\r\n > Bloom filters are **space-efficient** **probablistic** data structures used to\r\n > test whether an element is a member of a set.\r\n\r\nI used `pybloom-mirror` package to modify your code and set the bloom filter to capacity 20000 and error rate 0.01 (according [BloomFilter calculator][2] the size of filter is around ~23.4kB). But it can give you false positives.\r\n\r\n from pybloom import BloomFilter\r\n \r\n def binary(n):\r\n \" ; \" ; \" ;Return a binary string representing the number. \" ; \" ; \" ;\r\n return \" ;{0:b} \" ;.format(n)\r\n \r\n def stream():\r\n \" ; \" ; \" ;Lazily yield the ith element of the stream. \" ; \" ; \" ;\r\n N=10000\r\n M=100\r\n for i in range(N):\r\n yield binary(i)\r\n for i in range(M):\r\n yield binary(i)\r\n \r\n def my_func():\r\n bf = BloomFilter(capacity=20000, error_rate=0.01)\r\n already_seen = 0\r\n for e in stream():\r\n if e in bf:\r\n already_seen += 1\r\n else:\r\n bf.add(e)\r\n print(already_seen)\r\n \r\n my_func()\r\n\r\nOutput is:\r\n\r\n 100\r\n\r\nFor capacity of 10 million and probability 0.01 the size is around 11.43MiB (there are lot&#39;s of variables to play with though, depends on your use case).\r\n\r\nEdit:\r\n\r\nFor chaining Bloom Filters you could use this example:\r\n\r\n def bloom_filter_chain(n=3):\r\n \r\n # make bloom filters chain, each next chain is with lower error rate.\r\n bloom_filters = []\r\n for i in range(n):\r\n bloom_filters.append(BloomFilter(capacity=20000, error_rate=0.1 ** (i+1)))\r\n \r\n already_seen = 0\r\n \r\n for e in stream():\r\n we_have_seen = True\r\n for bf in bloom_filters:\r\n if e in bf: # might be false positive, continue down the chain\r\n continue\r\n else:\r\n we_have_seen = False\r\n bf.add(e)\r\n break\r\n if we_have_seen:\r\n already_seen += 1\r\n \r\n print(already_seen)\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "671" ], [ "Find every row with &#39;version&#39; in them, sort it by time and print latest time along the log message:\r\n\r\n data = \" ; \" ; \" ;\r\n 2018-05-08T15:47:27.752Z 00000000-0000-0000-0000-000000000000 > LVL:2 RC: version: 2.12.1.10452\r\n \r\n 2018-05-08T21:27:14.2049217Z > < INFO > : Version: 2.10.0.23960\r\n \r\n 2018-05-08T21:18:53.0428568Z > < INFO > : Version: 2.12.1.26051\r\n \" ; \" ; \" ;\r\n \r\n import re\r\n from datetime import datetime\r\n \r\n data_new = []\r\n for (d, log) in re.findall(r&#39;([\\d\\-:T\\.]+Z) > ?\\s+(.*)&#39;, data):\r\n if not re.search(&#39;version&#39;, log, flags=re.I):\r\n continue\r\n parts = d.split(&#39;.&#39;)\r\n if len(parts[1]) > = 8:\r\n d = parts[0] + &#39;.&#39; + parts[1][:6] + &#39;Z&#39;\r\n data_new.append((datetime.strptime(d, &#39;%Y-%m-%dT%H:%M:%S.%fZ&#39;), log))\r\n \r\n data_new = sorted(data_new, reverse=True)\r\n if data_new:\r\n t = data_new[0][0].strftime(&#39;%Y-%m-%dT%H:%M:%S.%fZ&#39;)\r\n print(f&#39;Latest version to display:\\ntime=[{t}] msg=[{data_new[0][1]}]&#39;)\r\n\r\nPrints:\r\n\r\n Latest version to display:\r\n time=[2018-05-08T21:27:14.204921Z] msg=[ < INFO > : Version: 2.10.0.23960]\r\n\r\nCaveat:\r\n\r\nThe Python `datetime` class accepts microseconds only to 6 digits (so this program truncates it).", "733" ], [ "This will convert the list of characters to standard python list of integers and strings:\r\n\r\n from ast import literal_eval\r\n \r\n s = [&#39;1&#39;, &#39;1&#39;, &#39;,&#39;, &#39;V&#39;, &#39;e&#39;, &#39;r&#39;, &#39;n&#39;, &#39;a&#39;, &#39; &#39;, &#39;F&#39;, &#39;r&#39;, &#39;a&#39;, &#39;n&#39;, &#39;k&#39;, &#39;l&#39;, &#39;i&#39;, &#39;n&#39;, &#39;,&#39;, &#39;v&#39;, &#39;.&#39;, &#39;f&#39;, &#39;r&#39;, &#39;a&#39;, &#39;n&#39;, &#39;k&#39;, &#39;l&#39;, &#39;i&#39;, &#39;n&#39;, &#39;@&#39;, &#39;g&#39;, &#39;m&#39;, &#39;a&#39;, &#39;i&#39;, &#39;l&#39;, &#39;.&#39;, &#39;c&#39;, &#39;o&#39;, &#39;m&#39;, &#39;,&#39;, &#39;1&#39;]\r\n \r\n n = \" ;[ \" ;\r\n for i in f \" ;{&#39;&#39;.join(s)} \" ;.split(&#39;,&#39;):\r\n if i.isnumeric():\r\n n += f \" ;{i}, \" ;\r\n else:\r\n n += f&#39; \" ;{i} \" ;, &#39;\r\n n += \" ;] \" ;\r\n \r\n n = literal_eval(n)\r\n print(n)\r\n\r\nPrints:\r\n\r\n [11, &#39;Verna Franklin&#39;, &#39;<EMAIL_ADDRESS>&#39;, 1]", "761" ], [ "The first key is specified in `first` variable:\r\n\r\n first = &#39;red&#39;\r\n \r\n d = {&#39;red&#39;:&#39;boop&#39;,&#39;white&#39;:&#39;beep&#39;,&#39;rose&#39;:&#39;blip&#39;}\r\n \r\n new_l = [first, d[first], &#39;end&#39;]\r\n for k, v in d.items():\r\n if k == first:\r\n continue\r\n new_l.append(k)\r\n new_l.append(v)\r\n new_l.append(&#39;end&#39;)\r\n print(new_l)\r\n\r\nPrints:\r\n\r\n [&#39;red&#39;, &#39;boop&#39;, &#39;end&#39;, &#39;white&#39;, &#39;beep&#39;, &#39;rose&#39;, &#39;blip&#39;, &#39;end&#39;]", "761" ], [ "You are importing `datetime` from `datetime`. Later in the code you using `datetime.datetime`, so that&#39;s giving you error.\r\n\r\nYou shoud just call `t = datetime(*struct_time[:6])` \r\n\r\nor \r\n\r\njust do `import datetime` and call it `t = datetime.datetime(*struct_time[:6])`\r\n\r\nThe correct program should look like:\r\n\r\n import time\r\n import datetime\r\n time_string = &#39;2018-07-16T23:50:55+0000&#39;\r\n \r\n #Reduct 8 hours and print in human readable format\r\n struct_time = time.strptime(time_string, \" ;%Y-%m-%dT%H:%M:%S+0000 \" ;)\r\n t = datetime.datetime(*struct_time[:6])\r\n delta = datetime.timedelta(hours=8)\r\n print(t+delta)", "764" ], [ "My attempt: \r\n\r\nFirst I sort the X array (if it isn&#39;t already sorted). The loop goes through each y and compute absolute value for each x, until this absolute value is higher than previous, then stop the for loop (because array X is sorted):\r\n\r\n x = sorted([1, 2, 3, 4, 5])\r\n y = [1.1, 1.2, 3.6, 6.2, 2.1]\r\n \r\n out = []\r\n while y:\r\n current_value = y.pop()\r\n current_min = float(&#39;inf&#39;)\r\n current_x_value = None\r\n for v in x:\r\n temp_min = abs(current_value - v)\r\n if temp_min < current_min:\r\n current_min = temp_min\r\n current_x_value = v\r\n if temp_min > current_min: # no need to iterate further, X is sorted\r\n break\r\n out.insert(0, current_x_value)\r\n print(out)\r\n\r\nOutputs:\r\n\r\n [1, 1, 4, 5, 2]", "820" ], [ "data = &#39;&#39;&#39; < div class= \" ;results-list \" ; > \r\n < div class= \" ;piatsaname \" ; > city center < /div > \r\n < table > \r\n < tr class= \" ;trspacer-up \" ; > \r\n < td > \r\n < a href= \" ;hall.aspx?id=1001173 \" ; > \r\n < h2 class= \" ;placename \" ; > ARENA\r\n < span class= \" ;boldelement \" ; > < img src= \" ;/images/sun.png \" ; height= \" ;16 \" ; valign= \" ;bottom \" ; style= \" ;padding:0px 3px 0px 10px \" ; > Θερινός < br > \r\n 25 Richmond Avenue st, Leeds < /span > \r\n < /h2 > \r\n < p > \r\n +4497XXXXXXX < br > \r\n STEREO SOUND\r\n < /p > \r\n Every Monday 2 tickets 8,00 pounds\r\n \r\n < /a > \r\n < /td > \r\n < /tr > \r\n < tr class= \" ;trspacer-down \" ; > \r\n < td > \r\n < p class= \" ;coloredelement \" ; > < a href= \" ;movie.aspx?id=10061364 \" ; target= \" ;_self \" ; > Italian Job < /a > < /p > \r\n \r\n < div class= \" ;aithousaspec \" ; > \r\n < b > < /b > Thu.-Wed.: 20.50/ 23.00\r\n < a href= \" ;_URL_0_; target= \" ;_blank \" ; title= \" ;Whatever you like \" ; > < /a > \r\n < b > < /b > \r\n < /div > &#39;&#39;&#39;\r\n \r\n from bs4 import BeautifulSoup\r\n import re\r\n \r\n soup = BeautifulSoup(data, &#39;lxml&#39;)\r\n print(soup.select(&#39;h2.placename&#39;)[0].contents[0].strip())\r\n print(re.sub(r&#39;\\s{2,}&#39;, &#39; &#39;, soup.select(&#39;span.boldelement&#39;)[0].text.strip()))\r\n print(soup.select(&#39;div.aithousaspec&#39;)[0].text.strip())\r\n\r\nThis will print:\r\n\r\n ARENA\r\n Θερινός 25 Richmond Avenue st, Leeds\r\n Thu.-Wed.: 20.50/ 23.00", "1017" ], [ "The page is loading dynamically through Ajax. Looking at network inspector, the page loads all data from very big JSON file located at _URL_0_. To load all job data, you can use this script:\r\n\r\n url = \" ;_URL_0_ \" ;\r\n \r\n import requests\r\n import json\r\n \r\n headers = {&#39;X-Requested-With&#39;: &#39;XMLHttpRequest&#39;}\r\n r = requests.get(url, headers=headers)\r\n data = json.loads(r.text)\r\n \r\n # For printing all data in pretty form uncoment this line:\r\n # print(json.dumps(data, indent=4, sort_keys=True))\r\n \r\n for d in data:\r\n print(f&#39;ID:\\t{d[ \" ;ID \" ;]}&#39;)\r\n print(f&#39;Job Title:\\t{d[ \" ;JobTitle \" ;]}&#39;)\r\n print(f&#39;Created:\\t{d[ \" ;Created \" ;]}&#39;)\r\n print(&#39;*&#39; * 80)\r\n \r\n # Available keys in this JSON:\r\n # ClassName\r\n # LastEdited\r\n # Created\r\n # ANZSCO\r\n # JobTitle\r\n # Description\r\n # WorkTasks\r\n # WorkEnvironment\r\n # PhysicalMentalDemands\r\n # Comments\r\n # EntryRequirements\r\n # Group\r\n # ID\r\n # RecordClassName\r\n\r\nThis prints:\r\n\r\n ID:\t2327\r\n Job Title:\tWatch and Clock Maker and Repairer \r\n Created:\t2017-07-11 11:33:52\r\n ********************************************************************************\r\n ID:\t2328\r\n Job Title:\tWeb Administrator\r\n Created:\t2017-07-11 11:33:52\r\n ********************************************************************************\r\n ID:\t2329\r\n Job Title:\tWelder \r\n Created:\t2017-07-11 11:33:52\r\n\r\n ...and so on\r\n\r\nIn the script I wrote available keys you can use to access your specific job data.", "8" ], [ "For replacing text in HTML document you can use `clear()` and `append()` methods BeautifulSoup provides ([manual pages][1]):\r\n\r\n data = \" ; \" ; \" ; < span class= \" ;fs4 fc2 \" ; > Sensitive < span class= \" ;_ _b \" ; > < /span > Information to Re < span class= \" ;_ _c \" ; > < /span > move < /span > \" ; \" ; \" ;\r\n \r\n from bs4 import BeautifulSoup\r\n \r\n soup = BeautifulSoup(data, &#39;lxml&#39;)\r\n \r\n secret_string = \" ;Sensitive Information to Remove \" ;\r\n redacted_string = \" ;[REDACTED] \" ;\r\n \r\n while True:\r\n s = soup.body.find(lambda t: t.text==secret_string)\r\n if not s:\r\n break\r\n \r\n s.clear()\r\n s.append(redacted_string)\r\n \r\n print(soup)\r\n\r\nThis will print:\r\n\r\n < html > < body > < span class= \" ;fs4 fc2 \" ; > [REDACTED] < /span > < /body > < /html > \r\n\r\n\r\n [1]: _URL_0_", "1017" ], [ "If you don&#39;t mind using `BeautifulSoup`, you can modify your XML through it:\r\n\r\n data = \" ; \" ; \" ; < aa > \r\n < bb > <PERSON> < /bb > \r\n < cc > \r\n < dd > <PERSON> < /dd > \r\n < /cc > \r\n < cc > \r\n < dd > <PERSON> < /dd > \r\n < /cc > \r\n < /aa > \" ; \" ; \" ;\r\n \r\n \r\n from bs4 import BeautifulSoup\r\n soup = BeautifulSoup(data, &#39;xml&#39;)\r\n \r\n for dd in soup.select(&#39;cc > dd&#39;): # using CSS selectors\r\n dd.clear()\r\n dd.append(&#39;XXX&#39;)\r\n \r\n print(soup.prettify())\r\n\r\nOutput:\r\n\r\n < ?xml version= \" ;1.0 \" ; encoding= \" ;utf-8 \" ;? > \r\n < aa > \r\n < bb > \r\n BB\r\n < /bb > \r\n < cc > \r\n < dd > \r\n XXX\r\n < /dd > \r\n < /cc > \r\n < cc > \r\n < dd > \r\n XXX\r\n < /dd > \r\n < /cc > \r\n < /aa >", "1017" ], [ "You can use `namedtuple` and then specify `connection.row_factory` in sqlite. Example:\r\n\r\n import sqlite3\r\n from collections import namedtuple\r\n \r\n # specify my row structure using namedtuple\r\n MyRecord = namedtuple(&#39;MyRecord&#39;, &#39;record_id record_name record_something&#39;)\r\n \r\n con = sqlite3.connect( \" ;:memory: \" ;)\r\n con.isolation_level = None\r\n con.row_factory = lambda cursor, row: MyRecord(*row)\r\n \r\n cur = con.cursor()\r\n \r\n cur.execute( \" ;CREATE TABLE my_table (record_id integer PRIMARY KEY, record_name text NOT NULL, record_something text NOT NULL) \" ;)\r\n cur.execute( \" ;INSERT INTO my_table (record_name, record_something) VALUES (?, ?) \" ;, (&#39;Andrej&#39;, &#39;This is something&#39;))\r\n cur.execute( \" ;INSERT INTO my_table (record_name, record_something) VALUES (?, ?) \" ;, (&#39;Andrej&#39;, &#39;This is something too&#39;))\r\n cur.execute( \" ;INSERT INTO my_table (record_name, record_something) VALUES (?, ?) \" ;, (&#39;Adrika&#39;, &#39;This is new!&#39;))\r\n \r\n for row in cur.execute( \" ;SELECT * FROM my_table WHERE record_name LIKE &#39;A%&#39; \" ;):\r\n print(f&#39;ID={row.record_id} NAME={row.record_name} SOMETHING={row.record_something}&#39;)\r\n \r\n con.close()\r\n\r\nPrints:\r\n\r\n ID=1 NAME=<PERSON> SOMETHING=This is something\r\n ID=2 NAME=<PERSON> SOMETHING=This is something too\r\n ID=3 NAME=<PERSON> SOMETHING=This is new!", "539" ], [ "From network inspector it seems that the page is loaded dynamically from `_URL_0_` in JSON format. For obtaining any data, it needs the key from the main site. Example is here (the data is stored in variables `seasons_data`, `teamsbyseason_data`, `statviewtype_data`):\r\n\r\n import requests\r\n from bs4 import BeautifulSoup\r\n import json\r\n \r\n url = \" ;_URL_2_;\r\n \r\n r = requests.get(url)\r\n soup = BeautifulSoup(r.text, &#39;lxml&#39;)\r\n \r\n seasons_url = \" ;_URL_0_?feed=modulekit & view=seasons & key=%s & fmt=json & client_code=ohl & lang=en & league_code= & fmt=json \" ;\r\n teamsbyseason_url = \" ;_URL_0_?feed=modulekit & view=teamsbyseason & key=%s & fmt=json & client_code=ohl & lang=en & season_id=60 & league_code= & fmt=json \" ;\r\n statviewtype_url = \" ;_URL_0_?feed=modulekit & view=statviewtype & type=topscorers & key=%s & fmt=json & client_code=ohl & lang=en & league_code= & season_id=60 & first=0 & limit=100 & sort=active & stat=all & order_direction= \" ;\r\n \r\n key = soup.find(&#39;div&#39;, id=&#39;stats&#39;)[&#39;data-feed_key&#39;]\r\n \r\n r = requests.get(seasons_url % key)\r\n seasons_data = json.loads(r.text)\r\n \r\n r = requests.get(teamsbyseason_url % key)\r\n teamsbyseason_data = json.loads(r.text)\r\n \r\n r = requests.get(statviewtype_url % key)\r\n statviewtype_data = json.loads(r.text)\r\n \r\n # print(json.dumps(seasons_data, indent=4, sort_keys=True))\r\n # print(json.dumps(teamsbyseason_data, indent=4, sort_keys=True))\r\n print(json.dumps(statviewtype_data, indent=4, sort_keys=True))\r\n\r\nPrints:\r\n\r\n {\r\n \" ;SiteKit \" ;: {\r\n \" ;Copyright \" ;: {\r\n \" ;powered_by \" ;: \" ;Powered by _URL_7_ \" ;,\r\n \" ;powered_by_url \" ;: \" ;_URL_5_;,\r\n \" ;required_copyright \" ;: \" ;Official statistics provided by Ontario Hockey League \" ;,\r\n \" ;required_link \" ;: \" ;_URL_4_;\r\n },\r\n \" ;Parameters \" ;: {\r\n \" ;client_code \" ;: \" ;ohl \" ;,\r\n \" ;feed \" ;: \" ;modulekit \" ;,\r\n \" ;first \" ;: \" ;0 \" ;,\r\n \" ;fmt \" ;: \" ;json \" ;,\r\n \" ;key \" ;: \" ;2976319eb44abe94 \" ;,\r\n \" ;lang \" ;: \" ;en \" ;,\r\n \" ;lang_id \" ;: 1,\r\n \" ;league_code \" ;: \" ; \" ;,\r\n \" ;league_id \" ;: \" ;1 \" ;,\r\n \" ;limit \" ;: \" ;100 \" ;,\r\n \" ;order_direction \" ;: \" ; \" ;,\r\n \" ;season_id \" ;: 60,\r\n \" ;sort \" ;: \" ;active \" ;,\r\n \" ;stat \" ;: \" ;all \" ;,\r\n \" ;team_id \" ;: 0,\r\n \" ;type \" ;: \" ;topscorers \" ;,\r\n \" ;view \" ;: \" ;statviewtype \" ;\r\n },\r\n\r\n ... and so on...", "8" ], [ "For parsing XML you could use `BeautifulSoup`. Example here:\r\n\r\n data = \" ; \" ; \" ; < ?xml version= \" ;1.0 \" ; encoding= \" ;UTF-8 \" ;? > < soapenv:Envelope xmlns:soapenv= \" ;_URL_3_; xmlns:xsd= \" ;_URL_4_; xmlns:xsi= \" ;_URL_6_;\r\n < soapenv:Body > \r\n < ns1:searchResponse soapenv:encodingStyle= \" ;_URL_0_; xmlns:ns1= \" ;_URL_1_;\r\n < searchReturn href= \" ;#id0 \" ;/ > \r\n < /ns1:searchResponse > \r\n < multiRef id= \" ;id0 \" ; soapenc:root= \" ;0 \" ; soapenv:encodingStyle= \" ;_URL_0_; xsi:type= \" ;ns2:Map \" ; xmlns:soapenc= \" ;_URL_0_; xmlns:ns2= \" ;_URL_7_;\r\n < item > \r\n < key xsi:type= \" ;soapenc:string \" ; > test_sis_path_delimiter_www._URL_2_:443 on server www._URL_2_ < /key > \r\n < value xsi:type= \" ;soapenc:string \" ; > Group < /value > \r\n < /item > \r\n < /multiRef > \r\n < /soapenv:Body > \" ; \" ; \" ;\r\n \r\n from bs4 import BeautifulSoup\r\n \r\n soup = BeautifulSoup(data, &#39;xml&#39;)\r\n \r\n print(soup.key.text)\r\n print(soup.value.text)\r\n\r\nOutputs:\r\n\r\n test_sis_path_delimiter_www._URL_2_:443 on server www._URL_2_\r\n Group", "1017" ], [ "For manipulating XML document you can use `BeautifulSoup` package. Example:\r\n\r\n data = \" ; \" ; \" ;\r\n < inboundContextData > \r\n < items > \r\n < item > \r\n < key > a < /key > \r\n < value > One < /value > \r\n < /item > \r\n < item > \r\n < key > b < /key > \r\n < value > Two < /value > \r\n < /item > \r\n < item > \r\n < key > c < /key > \r\n < value > Three < /value > \r\n < /item > \r\n < /items > \" ; \" ; \" ;\r\n \r\n \r\n from bs4 import BeautifulSoup\r\n \r\n soup = BeautifulSoup(data, &#39;xml&#39;)\r\n \r\n my_new_value = &#39;XXX&#39;\r\n \r\n for value in soup.select(&#39;items > item > value&#39;):\r\n value.clear()\r\n value.append(my_new_value)\r\n \r\n print(soup.prettify())\r\n\r\nOutput:\r\n\r\n < ?xml version= \" ;1.0 \" ; encoding= \" ;utf-8 \" ;? > \r\n < inboundContextData > \r\n < items > \r\n < item > \r\n < key > \r\n a\r\n < /key > \r\n < value > \r\n XXX\r\n < /value > \r\n < /item > \r\n < item > \r\n < key > \r\n b\r\n < /key > \r\n < value > \r\n XXX\r\n < /value > \r\n < /item > \r\n < item > \r\n < key > \r\n c\r\n < /key > \r\n < value > \r\n XXX\r\n < /value > \r\n < /item > \r\n < /items > \r\n < /inboundContextData >", "592" ], [ "Your decorator is called only once, not with each call to your function. Exactly, it&#39;s called at the definition time:\r\n\r\n def static_vars(**kwargs):\r\n def decorate(func):\r\n for k in kwargs:\r\n print(kwargs)\r\n setattr(func, k, kwargs[k])\r\n return func\r\n return decorate\r\n \r\n \r\n @static_vars(count=0)\r\n def rolling_serial(val):\r\n &#39;&#39;&#39;\r\n For a vector V = [v_1, ..., V_N] returns a serial\r\n index.\r\n \r\n so for V = [1, 1, 1, 3, 1, 1, 1]\r\n a resulting vector will be generated\r\n V_hat = [1, 2, 3, 4, 5, 6, 7]\r\n &#39;&#39;&#39;\r\n temp = rolling_serial.count\r\n rolling_serial.count += 1\r\n return temp\r\n \r\n print(&#39;---- BEGIN ----&#39;)\r\n print(rolling_serial(10))\r\n print(rolling_serial(20))\r\n print(rolling_serial(30))\r\n\r\nPrints:\r\n\r\n {&#39;count&#39;: 0}\r\n ---- BEGIN ----\r\n 0\r\n 1\r\n 2\r\n\r\nThe `kwargs` you have as parameter in `static_vars()` will become closure and will be incremented with each call to `rolling_serial()`.\r\n\r\nOne solution is to transfer the variables through globals():\r\n\r\n # This function creates decorator:\r\n def static_vars(**global_kwargs):\r\n # This is decorator:\r\n def decorate(func):\r\n # This function is called every time:\r\n def _f(*args, **kwargs):\r\n for k in global_kwargs:\r\n globals()[func.__name__+&#39;_&#39;+k] = global_kwargs[k]\r\n return func(*args, **kwargs)\r\n return _f\r\n return decorate\r\n \r\n @static_vars(count=0, temp=40)\r\n def rolling_serial():\r\n global rolling_serial_count, rolling_serial_temp\r\n \r\n temp1, temp2 = rolling_serial_count, rolling_serial_temp\r\n rolling_serial_count += 1\r\n rolling_serial_temp += 1\r\n return temp1, temp2\r\n \r\n print(rolling_serial()) # prints (0, 40)\r\n print(rolling_serial()) # prints (0, 40)\r\n print(rolling_serial()) # prints (0, 40)", "667" ], [ "The site loads the products dynamically through Ajax. Looking at the Firefox network inspector reveals the address of API, from where the site loads product data (_URL_0_1 & categorySanitizedPath=videospiele-nintendo-switch):\r\n\r\n import requests\r\n import json\r\n from pprint import pprint\r\n \r\n headers = {}\r\n \r\n # headers = { \" ;Host \" ;: \" ;_URL_1_ \" ;,\r\n # \" ;Accept \" ;: \" ;text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 \" ;,\r\n # \" ;Cookie \" ;: \" ;SET THIS TO PREVENT ACCESS DENIED \" ;,\r\n # \" ;Accept-Encoding \" ;: \" ;gzip,deflate,br \" ;,\r\n # \" ;User-agent \" ;: \" ;Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.80 Safari/537.36 \" ;}\r\n \r\n url = \" ;_URL_0_{} & categorySanitizedPath=videospiele-nintendo-switch \" ;\r\n page = 1\r\n \r\n r = requests.get(url.format(page), headers=headers)\r\n data = json.loads(r.text)\r\n \r\n pprint(data[&#39;products&#39;])\r\n # print(json.dumps(data, indent=4, sort_keys=True))\r\n\r\nPrints:\r\n\r\n {&#39;docs&#39;: [{&#39;avg_rating&#39;: 5,\r\n &#39;badges&#39;: [],\r\n &#39;blue_price&#39;: 1999,\r\n &#39;category_id&#39;: {&#39;0&#39;: 94, &#39;1&#39;: 3098},\r\n &#39;category_is_accessory&#39;: False,\r\n &#39;category_name&#39;: &#39;Nintendo Switch&#39;,\r\n &#39;category_sanitized_name&#39;: &#39;nintendo-switch&#39;,\r\n &#39;cover_updated_at&#39;: 0,\r\n &#39;has_cover&#39;: True,\r\n &#39;has_percent_category&#39;: False,\r\n &#39;has_variant_in_stock&#39;: True,\r\n &#39;id&#39;: 10725297,\r\n &#39;name&#39;: &#39;FIFA 18&#39;,\r\n &#39;num_ratings&#39;: 1,\r\n &#39;price_min&#39;: 1999,\r\n &#39;price_recommended&#39;: 0,\r\n &#39;product_sanitized_name&#39;: &#39;fifa-18&#39;,\r\n &#39;root_category_name&#39;: &#39;Videospiele&#39;,\r\n &#39;variants&#39;: [{&#39;label&#39;: &#39;A1&#39;,\r\n &#39;price&#39;: 2199,\r\n &#39;purchasePrice&#39;: 1456,\r\n &#39;quantity&#39;: 2},\r\n {&#39;label&#39;: &#39;A2&#39;,\r\n &#39;price&#39;: 1999,\r\n &#39;purchasePrice&#39;: 1919,\r\n &#39;quantity&#39;: 7},\r\n {&#39;label&#39;: &#39;A3&#39;,\r\n &#39;price&#39;: 1809,\r\n &#39;purchasePrice&#39;: 1919,\r\n &#39;quantity&#39;: 0},\r\n {&#39;label&#39;: &#39;A4&#39;,\r\n &#39;price&#39;: 1409,\r\n &#39;purchasePrice&#39;: 1919,\r\n &#39;quantity&#39;: 0}]},\r\n\r\n ...and so on.\r\n\r\nOne caveat, when many requests are made, the site returns Access Denied. To prevent this, you need to set headers with Cookie from your browser (to get the cookie, use for example Firefox network inspector).\r\n\r\nBetter solution would be use of Selenium, for example.", "526" ], [ "from collections import defaultdict\r\n \r\n lst = [{&#39;desig&#39;: &#39;&#39;, &#39;name&#39;: &#39;William&#39;}, {&#39;desig&#39;: &#39;Chairman of the Board&#39;, &#39;name&#39;: &#39;William&#39;}, {&#39;desig&#39;: &#39;&#39;, &#39;name&#39;: &#39;English&#39;}, {&#39;desig&#39;: &#39;Director&#39;, &#39;name&#39;: &#39;English&#39;}, {&#39;desig&#39;: &#39;&#39;, &#39;name&#39;: &#39;Charles &#39;}]\r\n d = defaultdict(list)\r\n for i in lst:\r\n d[i[&#39;name&#39;]].append(i[&#39;desig&#39;])\r\n l = [{&#39;desig&#39;: sorted(v)[-1], &#39;name&#39;: k} for k, v in d.items()]\r\n \r\n print(l)\r\n\r\nPrints:\r\n\r\n [{&#39;desig&#39;: &#39;Chairman of the Board&#39;, &#39;name&#39;: &#39;William&#39;}, {&#39;desig&#39;: &#39;Director&#39;, &#39;name&#39;: &#39;English&#39;}, {&#39;desig&#39;: &#39;&#39;, &#39;name&#39;: &#39;Charles &#39;}]", "58" ], [ "`8e10000000` is very large number, and Python it represents as a float. \r\nCPython usually store this float in 64-bit size, which is too small for such a big number.\r\n\r\nFor such large numbers is safe to use `Decimal` module:\r\n\r\n import sys\r\n from decimal import Decimal\r\n \r\n print(&#39;max size = &#39;, sys.maxsize)\r\n number = Decimal( \" ;8e10000000 \" ;)\r\n print(number)\r\n\r\nOutputs:\r\n\r\n max size = 9223372036854775807\r\n 8E+10000000\r\n\r\nThe number 9223372036854775807 is exactly 2^63 - 1.", "744" ], [ "You can extract data to python list using `ast.literal_eval`. I made a simple function `find_airport()`, where you supply data and airport name, and returns how many times it is in airport_1 and airport_2:\r\n\r\n from bs4 import BeautifulSoup\r\n import requests\r\n import re\r\n from ast import literal_eval\r\n from pprint import pprint\r\n \r\n airlines = [&#39;kl-klm&#39;]\r\n \r\n headers = { \" ;Host \" ;: \" ;_URL_1_ \" ;,\r\n \" ;Accept \" ;: \" ;text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 \" ;,\r\n \" ;Accept-Encoding \" ;: \" ;gzip,deflate,br \" ;,\r\n \" ;User-agent \" ;: \" ;Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.80 Safari/537.36 \" ;}\r\n \r\n def find_aiport(data, name):\r\n airport_1, airport_2 = 0, 0\r\n for d in data:\r\n if d[&#39;airport1&#39;][&#39;name&#39;] == name:\r\n airport_1 += 1\r\n if d[&#39;airport2&#39;][&#39;name&#39;] == name:\r\n airport_2 += 1\r\n return airport_1, airport_2\r\n \r\n for a in airlines:\r\n url = &#39;_URL_0_; + a + &#39;/routes&#39;\r\n page = requests.get(url, headers=headers)\r\n soup = BeautifulSoup(page.text, &#39;lxml&#39;)\r\n \r\n m = re.search(r&#39;(? < =arrRoutes=)\\[\\{(.*?)\\}\\]&#39;, soup.text)\r\n l = literal_eval(m[0])\r\n pprint(l)\r\n \r\n print(find_aiport(l, &#39;Amsterdam Schiphol Airport&#39;))\r\n\r\nPrints:\r\n\r\n [{&#39;airport1&#39;: {&#39;country&#39;: &#39;Denmark&#39;,\r\n &#39;iata&#39;: &#39;AAL&#39;,\r\n &#39;icao&#39;: &#39;EKYT&#39;,\r\n &#39;lat&#39;: 57.092781,\r\n &#39;lon&#39;: 9.849164,\r\n &#39;name&#39;: &#39;Aalborg Airport&#39;},\r\n &#39;airport2&#39;: {&#39;country&#39;: &#39;Netherlands&#39;,\r\n &#39;iata&#39;: &#39;AMS&#39;,\r\n &#39;icao&#39;: &#39;EHAM&#39;,\r\n &#39;lat&#39;: 52.308609,\r\n &#39;lon&#39;: 4.763889,\r\n &#39;name&#39;: &#39;Amsterdam Schiphol Airport&#39;}},\r\n {&#39;airport1&#39;: {&#39;country&#39;: &#39;United Kingdom&#39;,\r\n &#39;iata&#39;: &#39;ABZ&#39;,\r\n &#39;icao&#39;: &#39;EGPD&#39;,\r\n &#39;lat&#39;: 57.201939,\r\n &#39;lon&#39;: -2.19777,\r\n &#39;name&#39;: &#39;Aberdeen International Airport&#39;},\r\n &#39;airport2&#39;: {&#39;country&#39;: &#39;Netherlands&#39;,\r\n &#39;iata&#39;: &#39;AMS&#39;,\r\n &#39;icao&#39;: &#39;EHAM&#39;,\r\n &#39;lat&#39;: 52.308609,\r\n &#39;lon&#39;: 4.763889,\r\n &#39;name&#39;: &#39;Amsterdam Schiphol Airport&#39;}},\r\n\r\n ...and so on\r\n\r\nAnd at the end:\r\n\r\n (147, 146)\r\n\r\nFor \" ;Amsterdam Schiphol Airport \" ;", "1017" ], [ "With slight modification to your code you can make your `counter` decorator independent:\r\n\r\n def counter(func, counter_dict={}):\r\n counter_dict[func]=0\r\n def wrap(*args,**kwargs):\r\n counter_dict[func] += 1\r\n print( \" ;Number of times {} has been called so far {} \" ;.format(func.__name__, counter_dict[func]))\r\n return func(*args,**kwargs)\r\n return wrap\r\n \r\n @counter\r\n def temp1(name):\r\n print( \" ;Calling temp1 {} \" ;.format(name))\r\n \r\n @counter\r\n def temp2(name):\r\n print( \" ;Calling temp2 {} \" ;.format(name))\r\n \r\n \r\n temp1(&#39;1&#39;)\r\n temp1(&#39;2&#39;)\r\n temp2(&#39;3&#39;)\r\n\r\nPrints:\r\n\r\n Number of times temp1 has been called so far 1\r\n Calling temp1 1\r\n Number of times temp1 has been called so far 2\r\n Calling temp1 2\r\n Number of times temp2 has been called so far 1\r\n Calling temp2 3", "904" ], [ "My approach is to remove all strings between ``` \" ;` \" ;```, and then just supply the text to BeautifulSoup for parsing (i will find all `img` tags without `alt` attribute and print it&#39;s `src`):\r\n\r\n data = \" ; \" ; \" ;\r\n ```html\r\n < img src= \" ;fil.png \" ; > \r\n ```\r\n \r\n - [ ] Here is another image < img src= \" ;fil.png \" ; > and another ` < img src= \" ;fil.png \" ; > `\r\n \r\n ```html\r\n < a href= \" ;scratch/index.html \" ; id= \" ;scratch \" ; data-original-title= \" ; \" ; title= \" ; \" ; aria-describedby= \" ;popover162945 \" ; > \r\n < div class= \" ;logo-wrapper \" ; > \r\n < /div > \r\n < div class= \" ;name \" ; > \r\n < span > Scratch < /span > \r\n < /div > \r\n < img src= \" ;fil.png \" ; > \r\n < /a > \r\n ```\r\n \" ; \" ; \" ;\r\n \r\n import re\r\n from bs4 import BeautifulSoup\r\n \r\n soup = BeautifulSoup(re.sub(r&#39;`+[^`]+`+&#39;, &#39;&#39;, data), &#39;lxml&#39;)\r\n for img in soup.find_all(lambda t: _URL_0_ == &#39;img&#39; and not &#39;alt&#39; in t.attrs):\r\n print(img[&#39;src&#39;])\r\n\r\nOutput:\r\n\r\n fil.png", "1017" ], [ "I wouldn&#39;t recommend parsing the description with `item[&#39;description&#39;] = about.h2.nextSibling.nextSibling.nextSibling.text`, that&#39;s too much specific. I came up with this code:\r\n\r\n from bs4 import BeautifulSoup as soup\r\n import requests\r\n import json\r\n from pprint import pprint\r\n \r\n base_url = \" ;_URL_0_;\r\n \r\n data = []\r\n n = 30\r\n for i in range(4, n+1):\r\n response = requests.get(base_url + \" ;BookDetail.aspx?bookId= \" ; + str(i))\r\n \r\n page_soup = soup(response.content, \" ;lxml \" ;)\r\n \r\n data = {}\r\n title, author, description = page_soup.select(&#39;h1&#39;)[0].text, \\\r\n page_soup.select(&#39;h1 ~ p&#39;)[3].get_text(&#39;, &#39;), \\\r\n &#39;\\n&#39;.join(p.text.strip() for p in page_soup.select(&#39;div#AboutBook > p&#39;) if p.text.strip())\r\n \r\n data[&#39;type&#39;] = \" ;Textbook \" ;\r\n data[&#39;title&#39;] = title\r\n data[&#39;author&#39;] = author if author.strip() else \" ;University of Minnesota Libraries Publishing \" ;\r\n data[&#39;link&#39;] = \" ;_URL_1_; + str(i)\r\n data[&#39;source&#39;] = \" ;Open Textbook Library \" ;\r\n data[&#39;description&#39;] = description\r\n \r\n pprint(data)\r\n \r\n # with open( \" ;./json/otl-1.json \" ;, \" ;w \" ;) as writeJSON:\r\n # json.dump(data, writeJSON, ensure_ascii=False)\r\n\r\nPrints:\r\n\r\n {&#39;author&#39;: &#39;University of Minnesota Libraries Publishing&#39;,\r\n &#39;description&#39;: &#39;This book is intended for an undergraduate or MBA level &#39;\r\n &#39;Financial Accounting course. It covers the standard topics in &#39;\r\n &#39;a standard sequence, utilizing the Socratic method of asking &#39;\r\n &#39;and answering questions.&#39;,\r\n &#39;link&#39;: &#39;_URL_2_;,\r\n &#39;source&#39;: &#39;Open Textbook Library&#39;,\r\n &#39;title&#39;: &#39;Financial Accounting&#39;,\r\n &#39;type&#39;: &#39;Textbook&#39;}\r\n\r\n ...and so on (for each book)", "1017" ], [ "The parsing is a little bit complicated, because the results are in many subpages. This scripts collects them and prints result (all data is stored in variable `data`):\r\n\r\n from bs4 import BeautifulSoup\r\n import requests\r\n \r\n url = \" ;_URL_1_;\r\n r = requests.get(url)\r\n \r\n data = {}\r\n soup = BeautifulSoup(r.text, &#39;lxml&#39;)\r\n for race in soup.select(&#39;div[id^=race]&#39;):\r\n r = requests.get(f \" ;_URL_0_{race[&#39;id&#39;].split(&#39;-&#39;)[1]}.html \" ;)\r\n s = BeautifulSoup(r.text, &#39;lxml&#39;)\r\n l = []\r\n data[(s.find(&#39;h3&#39;).text, s.find(&#39;div&#39;, {&#39;class&#39;: &#39;party-header&#39;}).text)] = l\r\n \r\n for candidate, votes, percent in zip(s.select(&#39;td.candidate&#39;), s.select(&#39;td.votes&#39;), s.select(&#39;td.percent&#39;)):\r\n l.append((candidate.text, votes.text, percent.text))\r\n \r\n print(&#39;Winners:&#39;)\r\n for (race, party), v in data.items():\r\n print(race, party, v[0])\r\n \r\n # print(data)\r\n\r\nOutputs:\r\n\r\n Winners:\r\n Governor / Lt. Governor Democrat (&#39;Ben Jealous and <PERSON>;, &#39;227,764&#39;, &#39;39.6%&#39;)\r\n U.S. Senator Republican (&#39;Tony Campbell&#39;, &#39;50,915&#39;, &#39;29.2%&#39;)\r\n U.S. Senator Democrat (&#39;Ben Cardin&#39;, &#39;468,909&#39;, &#39;80.4%&#39;)\r\n State&#39;s Attorney Democrat (&#39;Marilyn J. Mosby&#39;, &#39;39,519&#39;, &#39;49.4%&#39;)\r\n County Executive Democrat (&#39;John \" ;Johnny O \" ; <PERSON>, Jr.&#39;, &#39;27,270&#39;, &#39;32.9%&#39;)\r\n County Executive Republican (&#39;Al Redmer, Jr.&#39;, &#39;17,772&#39;, &#39;55.7%&#39;)", "1017" ], [ "For writing csv files Python has builtin support (module `csv`). For grabbing whole table from the page you could use script like this:\r\n\r\n import requests\r\n from bs4 import BeautifulSoup\r\n import csv\r\n import re\r\n \r\n def getData(url):\r\n soup = BeautifulSoup(requests.get(url).text, &#39;lxml&#39;)\r\n \r\n player_id = re.findall(r&#39;(?:/[^/]/)(.*?)(?:/gamelog)&#39;, url)[0]\r\n \r\n with open(&#39;%s.csv&#39; % player_id, &#39;w&#39;) as f:\r\n csvwriter = csv.writer(f, delimiter=&#39;,&#39;, quotechar=&#39; \" ;&#39;)\r\n d = [[td.text for td in tr.find_all(&#39;td&#39;)] for tr in soup.find(&#39;div&#39;, id=&#39;all_pgl_basic&#39;).find_all(&#39;tr&#39;) if tr.find_all(&#39;td&#39;)]\r\n for row in d:\r\n csvwriter.writerow([player_id] + row)\r\n \r\n player_season_url = \" ;_URL_0_;\r\n getData(player_season_url)\r\n\r\nOutput is in CSV file (I added from LibreOffice):\r\n\r\n[![enter image description here][1]][1]\r\n\r\n\r\n [1]: _URL_1_\r\n\r\nEdit:\r\n\r\n- extracted player_id from URL\r\n- file is saved in {player_id}.csv", "1017" ], [ "I used `re` module to extract the comment section:\r\n\r\n from bs4 import BeautifulSoup\r\n import re\r\n \r\n data = \" ; \" ; \" ; < div class= \" ;section_wrapper setup_commented commented \" ; id= \" ;all_342042674 \" ; > \r\n < div class= \" ;section_heading \" ; > \r\n < span class= \" ;section_anchor \" ; id= \" ;342042674_link \" ; data-label= \" ;Other Info \" ; > < /span > \r\n < h2 > Other Info < /h2 > < div class= \" ;section_heading_text \" ; > \r\n < ul > \r\n < /ul > \r\n < /div > \r\n < /div > < div class= \" ;placeholder \" ; > < /div > \r\n < !--\r\n < div class= \" ;section_content \" ; id= \" ;div_342042674 \" ; > \r\n < div > < strong > Umpires: < /strong > HP - <PERSON>, 1B - <PERSON>, 2B - <PERSON>, 3B - <PERSON>. < /div > \r\n < div > < strong > Time of Game: < /strong > 3:21. < /div > \r\n < div > < strong > Attendance: < /strong > 33,809. < /div > \r\n < div > < strong > Start Time Weather: < /strong > 70 & deg; F, Wind 6mph out to Centerfield, Night, No Precipitation. < /div > \r\n \r\n < /div > \r\n \r\n -- > \r\n < /div > \" ; \" ; \" ;\r\n \r\n soup = BeautifulSoup(re.search(r&#39;(? < = < !--)(.*?)(?=-- > )&#39;, data, flags=re.DOTALL)[0], &#39;lxml&#39;)\r\n \r\n umpires, time_of_game, attendance, start_time_weather = soup.select(&#39;div.section_content > div&#39;)\r\n \r\n print(&#39;ID: &#39;, soup.find(&#39;div&#39;, class_= \" ;section_content \" ;)[&#39;id&#39;])\r\n print(&#39;umpires: &#39;, umpires.text)\r\n print(&#39;time of game: &#39;, time_of_game.text)\r\n print(&#39;attendance: &#39;, attendance.text)\r\n print(&#39;start_time_weather: &#39;, start_time_weather.text)\r\n\r\nOutput:\r\n\r\n ID: div_342042674\r\n umpires: Umpires: HP - <PERSON>, 1B - <PERSON>, 2B - <PERSON>, 3B - <PERSON>.\r\n time of game: Time of Game: 3:21.\r\n attendance: Attendance: 33,809.\r\n start_time_weather: Start Time Weather: 70&#176; F, Wind 6mph out to Centerfield, Night, No Precipitation.", "1017" ], [ "You can put that code block inside triple quotes ` \" ; \" ; \" ;` (I put the variable inside `json.dumps`, just for example):\r\n\r\n from pprint import pprint\r\n import json\r\n \r\n html_desc = \" ; \" ; \" ; < head > \r\n < style > \r\n body {\r\n border-style: solid;\r\n border-width: 5px;\r\n border-color: green;\r\n border-radius: 5px;\r\n border-spacing: 30px;\r\n background-color: #FFFFC2;\r\n padding-bottom: 5px;\r\n font-size: 25px;\r\n }\r\n \r\n li {\r\n color: #F7270F;\r\n font-weight: bold;\r\n }\r\n < /style > \r\n < /head > \r\n < body > \r\n < div style= \" ;margin-bottom: 5px; margin-top: 5px; margin-left: 10px; margin-right: 10px; \" ; > \r\n < h1 align= \" ;center \" ; > Auctions for Week of 08-01-2018 < /h1 > \r\n < p > You are bidding on the following item: < /p > \r\n < ul > < li > This is the item for sale < /li > < /ul > \r\n < p > Condition is pack fresh unless otherwise indicated. Please review the pictures carefully and if you have any questions about something specific, ask. < /p > \r\n < p > < b > Shipping: < /b > Shipping will be calculated based on buyer location. No premiums are charged. Cards are mailed in an 8x5 bubble mailer and shipped First Class mail unless the price exceeds $50, at which point they will be shipped Priority at no additional cost to the buyer. If you win multiple auctions, please wait for an invoice to be sent. < /p > \r\n < /div > \r\n < /body > \" ; \" ; \" ;\r\n \r\n pprint(json.dumps({html_desc: \" ;Some Value \" ;}))", "514" ], [ "Your `brand` variable needs to be a list, for example the code could look like this:\r\n\r\n from bs4 import BeautifulSoup as soup\r\n from urllib.request import urlopen as uReq\r\n from pprint import pprint\r\n \r\n my_url = &#39;_URL_0_;\r\n with uReq(my_url) as uClient:\r\n page_html = uClient.read()\r\n page_soup = soup(page_html, \" ;xml \" ;)\r\n \r\n brand = []\r\n for item in page_soup.find_all(&#39;span&#39;, {&#39;class&#39;: &#39;mw-headline&#39;}):\r\n brand.append(item[ \" ;id \" ;])\r\n \r\n pprint(brand)\r\n\r\nPrints:\r\n\r\n [&#39;Plot&#39;,\r\n &#39;Early_years&#39;,\r\n &#39;Voldemort_returns&#39;,\r\n &#39;Supplementary_works&#39;,\r\n &#39;Harry_Potter_and_the_Cursed_Child&#39;,\r\n &#39;In-universe_books&#39;,\r\n &#39;Pottermore_website&#39;,\r\n &#39;Structure_and_genre&#39;,\r\n &#39;Themes&#39;,\r\n &#39;Origins&#39;,\r\n &#39;Publishing_history&#39;,\r\n &#39;Translations&#39;,\r\n &#39;Completion_of_the_series&#39;,\r\n &#39;Cover_art&#39;,\r\n &#39;Achievements&#39;,\r\n &#39;Cultural_impact&#39;,\r\n &#39;Commercial_success&#39;,\r\n &#39;Awards,_honours,_and_recognition&#39;,\r\n &#39;Reception&#39;,\r\n &#39;Literary_criticism&#39;,\r\n &#39;Social_impact&#39;,\r\n &#39;Controversies&#39;,\r\n &#39;Adaptations&#39;,\r\n &#39;Films&#39;,\r\n &#39;Spin-off_prequels&#39;,\r\n &#39;Games&#39;,\r\n &#39;Audiobooks&#39;,\r\n &#39;Stage_production&#39;,\r\n &#39;Attractions&#39;,\r\n &#39;The_Wizarding_World_of_Harry_Potter&#39;,\r\n &#39;The_Making_of_Harry_Potter&#39;,\r\n &#39;References&#39;,\r\n &#39;Further_reading&#39;,\r\n &#39;External_links&#39;]", "1017" ], [ "You need to declare your variable `main` as a list. In your code you update the variable `main` in each iteration of the loop. At the end, the `main` will be string containing the last url from `url2` list. If you then supply `main` to next loop, it will iterate over individual characters.\r\n\r\nAfter few cosmetic changes this should get your titles:\r\n\r\n import requests\r\n from bs4 import BeautifulSoup\r\n \r\n r=requests.get( \" ;_URL_0_;)\r\n s=BeautifulSoup(r.content, &#39;lxml&#39;)\r\n links=s.find_all( \" ;a \" ;,{ \" ;class \" ; : \" ;focus-content \" ;})\r\n url2=[]\r\n for link in links:\r\n url2.append(link.get( \" ;href \" ;))\r\n \r\n url1 = \" ;_URL_0_;\r\n main = []\r\n for u in url2:\r\n main.append(url1 + u)\r\n \r\n for m in main:\r\n r1 = requests.get(m)\r\n s1 = BeautifulSoup(r1.text, &#39;lxml&#39;)\r\n title=s1.find( \" ;span \" ;, { \" ;class \" ; : \" ;title \" ;})\r\n print(title.text.strip())\r\n\r\nPrints:\r\n\r\n Weekly 240: We release the updates and get reading\r\n Shot on OnePlus: Part 6 – Best Slo-mo Video / Animal Photos\r\n Android P Beta Developer Preview 3 for OnePlus 6\r\n [Let&#39;s Talk] To whom are you gonna give your appreciation in this Community?\r\n [Let&#39;s Talk] What Does Your OnePlus Device Replace?\r\n [Let&#39;s Talk] Loyalty to tech companies", "1017" ], [ "You can also use `cycle` from `itertools`:\r\n\r\n from itertools import cycle\r\n \r\n startDate, endDate = &#39;Wednesday&#39;, &#39;Tuesday&#39;\r\n \r\n l = []\r\n for c in cycle([&#39;Monday&#39;, &#39;Tuesday&#39;, &#39;Wednesday&#39;, &#39;Thursday&#39;, &#39;Friday&#39;, &#39;Saturday&#39;, &#39;Sunday&#39;]):\r\n if not l and c == startDate:\r\n l.append(c)\r\n elif l and c == endDate:\r\n l.append(c)\r\n break\r\n elif l:\r\n l.append(c)\r\n \r\n print(l)\r\n\r\nPrints:\r\n\r\n [&#39;Wednesday&#39;, &#39;Thursday&#39;, &#39;Friday&#39;, &#39;Saturday&#39;, &#39;Sunday&#39;, &#39;Monday&#39;, &#39;Tuesday&#39;]", "956" ], [ "You can use `namedtuple` for storing your variables in your program, that way it becomes clearer. (Assuming your json parsed data is in the `j` variable):\r\n\r\n from collections import namedtuple\r\n from pprint import pprint\r\n \r\n StudendInfo = namedtuple(&#39;StudendInfo&#39;, &#39;name last_name email dob&#39;)\r\n \r\n # ...populate your j variable from Json here\r\n\r\n info = []\r\n for v in j[&#39;data&#39;]:\r\n i = StudendInfo(name=v[&#39;data&#39;][&#39;name&#39;][&#39;first&#39;],\r\n last_name=v[&#39;data&#39;][&#39;name&#39;][&#39;last&#39;],\r\n email=v[&#39;data&#39;][&#39;email&#39;],\r\n dob=v[&#39;data&#39;][&#39;dob&#39;])\r\n info.append(i)\r\n \r\n pprint(info)\r\n\r\nWill print:\r\n\r\n [StudendInfo(name=&#39;Emma&#39;, last_name=&#39;Jinglehimerschmidt&#39;, email=&#39;<EMAIL_ADDRESS>&#39;, dob=&#39;7/14/2004&#39;),\r\n StudendInfo(name=&#39;Kisti&#241;e&#39;, last_name=&#39;Garcia&#39;, email=&#39;kisti&#241;<EMAIL_ADDRESS>&#39;, dob=&#39;8/11/2008&#39;)]", "642" ], [ "Using `@property` decorator (that way you can type only `_URL_1_` and not `_URL_1_()` with parenthesis:\r\n\r\n class Person:\r\n def __init__(self, first_name, last_name):\r\n self.first_name = first_name\r\n self.last_name = last_name\r\n \r\n @property\r\n def full_name(self):\r\n return f&#39;{self.first_name} {self.last_name}&#39;\r\n \r\n @property\r\n def name(self):\r\n return f&#39;{self.last_name}, {self.first_name}&#39;\r\n \r\n teacher = Person(&#39;D&#39;, &#39;C&#39;)\r\n print(teacher.last_name)\r\n print(teacher.full_name)\r\n print(_URL_0_)\r\n\r\nPrints:\r\n\r\n C\r\n D C\r\n C, D", "490" ], [ "import math\r\n \r\n class Point:\r\n \" ; \" ; \" ;2-D Point objects. \" ; \" ; \" ;\r\n \r\n def __init__(self, x=0, y=0):\r\n \" ; \" ; \" ;Initialize the Point instance \" ; \" ; \" ;\r\n self.x = x\r\n self.y = y\r\n \r\n @property\r\n def magnitude(self):\r\n \" ; \" ; \" ;Return the magnitude of vector from (0,0) to self. \" ; \" ; \" ;\r\n return math.sqrt(self.x ** 2 + self.y ** 2)\r\n \r\n def __str__(self):\r\n return &#39;Point at ({}, {})&#39;.format(self.x,self.y)\r\n \r\n def __repr__(self):\r\n return \" ;Point(x={},y={}) \" ;.format(self.x,self.y)\r\n \r\n point = Point(3, 4)\r\n print(point)\r\n print(point.magnitude)\r\n point3 = Point(y=9)\r\n print(point3.magnitude)\r\n\r\nPrints:\r\n\r\n Point at (3, 4)\r\n 5.0\r\n 9.0", "898" ], [ "You can grab most all news with this script (most recent news is stored in `news[0]`):\r\n\r\n import json\r\n import bs4\r\n import requests\r\n \r\n res = requests.get(&#39;_URL_0_;)\r\n res.raise_for_status()\r\n soup = bs4.BeautifulSoup(res.text, &#39;html.parser&#39;)\r\n \r\n news = [p.text.strip() for p in soup.select(&#39;h1 ~ p&#39;) if p.find(&#39;font&#39;)]\r\n \r\n for p in news:\r\n print(p)\r\n print(&#39;-&#39; * 80)\r\n \r\n # most recent news is stored in news[0]\r\n\r\nWill output:\r\n\r\n Ventura &#160; — &#160; On July 10, 2018 <PERSON> reported the following; \" ;I took a paddle from North of Emma Wood State Beach in Ventura to the South part of the inner reef at about 1:00 PM PST. A small South swell mixed with some wind swell was showing. The West wind was just starting to puff but the water texture was still pretty glassy. Outside air temperature was an estimated 80+ degrees Fahrenheit and the water seemed to be nearing 70 degrees Fahrenheit. After catching a wave or two, a 6 foot shark appeared in the face of a set wave (four foot face). Without expertise, my guess is that it was a young Great White Shark. Another guy in the water said that he had seen one in the area for several days prior as did another surfer back up the beach where I had parked. \" ; Please report any shark sighting, encounter, or attack to the Shark Research Committee.\r\n --------------------------------------------------------------------------------\r\n Goleta &#160; — &#160; On July 2, 2018 <PERSON> reported the following; \" ;I was working off Goleta on platform Holly, about 2 miles from the Santa Barbara Coast at Coal Oil Point. The platform is in 211 feet of water. I sighted a White Shark, approximately 12 feet long, a dark grey body and a white belly with a dorsal fin about 18 inches high.&#160; There was also a small white tip on the tail fin. It circled the platform slowly once and then headed off to the South, following the coast toward Santa Barbara. A consensus of opinions by myself and co-workers estimated the weight to be in excess of 400 pounds. A number of seals reside on the platform which might be the reason the shark was attracted to it. None of the seals were interested in leaving the platform during this time. \" ; Please report any shark sighting, encounter, or attack to the Shark Research Committee.\r\n --------------------------------------------------------------------------------\r\n Oceanside &#160; — &#160; On June 25, 2018 <PERSON> was paddling her outrigger canoe 2 miles due West of Oceanside Harbor entrance. It was 6:00 PM and she had been on the water 25 – 30 minutes. The late afternoon sky was clear with an estimated temperature of 70 degrees Fahrenheit. The ocean was calm with an estimated temperature of 68 degrees Fahrenheit and a mild breeze from the West creating a bump to the sea surface. No marine mammals were observed in the area. <PERSON> reported; \" ;I was paddling by myself when my canoe was hit HARD from underneath. I immediately turned around and paddled as fast as I could toward shore. I never saw the shark and wasn&#39;t sure if it was following me or not until about a minute later it tugged at my paddle! I made it into the harbor safe but my carbon fiber canoe has bite marks through and through . My canoe took on water. Terrifying two mile sprint in! \" ; &#39;Interspace&#39; measurements of the tooth impressions in her outrigger canoe suggest a White Shark 11 – 12 feet in length. This is the first confirmed unprovoked shark attack reported in 2018 from the Pacific Coast of North America. Please report any shark sighting, encounter, or attack to the Shark Research Committee.\r\n --------------------------------------------------------------------------------\r\n\r\n ...and so on", "1017" ], [ "You need to call `loop.run_until_complete(main())`, not just a function `main` (without parenthesis). The next thing is you don&#39;t need `async` keyword in `soup.select()`. I also changed a select string, to parse something:\r\n\r\n import requests\r\n from bs4 import BeautifulSoup\r\n import asyncio\r\n import aiohttp\r\n \r\n res = requests.get(&#39;_URL_8_;)\r\n soup = BeautifulSoup(res.text,&#39;lxml&#39;)\r\n movie_list=[]\r\n \r\n for link in soup.select(&#39;section li a[href]&#39;):\r\n movie_list.append(&#39;_URL_15_)\r\n \r\n async def request(url):\r\n async with aiohttp.ClientSession() as session:\r\n async with session.get(url) as resp:\r\n body = await resp.text(encoding=&#39;utf-8&#39;)\r\n soup = BeautifulSoup(body,&#39;lxml&#39;)\r\n movie = []\r\n # no need to call async for here!\r\n for link in soup.select(&#39;section#top_movies_main table a&#39;):\r\n movie.append(link[&#39;href&#39;])\r\n \r\n return movie\r\n \r\n async def main():\r\n results = await asyncio.gather(*[request(url) for url in movie_list])\r\n print(results)\r\n return results\r\n \r\n print(movie_list)\r\n \r\n loop = asyncio.get_event_loop()\r\n results = loop.run_until_complete(main()) # you need to create coroutine\r\n\r\nPrints:\r\n\r\n [&#39;_URL_2_;, &#39;_URL_1_;, &#39;_URL_4_;, &#39;_URL_18_;, &#39;_URL_13_;, &#39;_URL_17_;, &#39;_URL_3_;, &#39;_URL_11_;, &#39;_URL_12_;, &#39;_URL_0_;, &#39;_URL_9_;, &#39;_URL_6_;, &#39;_URL_5_;, &#39;_URL_16_;, &#39;_URL_14_;, &#39;_URL_10_;, &#39;_URL_7_;]\r\n [[&#39;/m/mad_max_fury_road&#39;, &#39;/m/1013775-metropolis&#39;, &#39;/m/wonder_woman_2017&#39;, &#39;/m/logan_2017&#39;, &#39;/m/1011615-king_kong&#39;, &#39;/m/zootopia&#39;, &#39;/m/1000355-adventures_of_robin_hood&#39;, &#39;/m/star_wars_episode_vii_the_force_awakens&#39;, \r\n\r\n ... and so on", "1017" ], [ "To support iteration add `__iter__()` method to your class (that method will yield x and y values from `point`):\r\n\r\n class point:\r\n def __init__(self , xPoint ,yPoint):\r\n self.x = xPoint\r\n self.y = yPoint\r\n \r\n def makeMeStr(self):\r\n return \" ;( \" ;+str(self.x)+ \" ;, \" ;+str(self.y)+ \" ;) \" ;\r\n \r\n def __repr__(self):\r\n return self.makeMeStr()\r\n def __str__(self):\r\n return self.makeMeStr()\r\n \r\n def __iter__(self):\r\n yield self.x\r\n yield self.y\r\n \r\n \r\n list_of_points = [point(1, 2), point(3, 4), point(5, 6)]\r\n \r\n left, right = zip(*list_of_points)\r\n print(left) # this will print all x values\r\n print(right) # this will print all y values\r\n\r\nWill print:\r\n\r\n (1, 3, 5)\r\n (2, 4, 6)", "761" ], [ "You can use regular expressions to parse the lines. I made a function `find_lines_by_date()` where you can supply the date string and it will return a list of lines with this date:\r\n\r\n data = \" ; \" ; \" ;\r\n [2018-07-11 20:57:08] SYSTEM RESPONSE: \" ;hello \" ;\r\n [2018-07-11 20:57:19] USER INPUT (xvp_dev-0): \" ;hi! how is it going? \" ;\r\n [2018-07-11 20:57:19] SYSTEM RESPONSE: \" ;It&#39;s going pretty good.\r\n How about you? \" ;\r\n [2018-07-11 14:05:20] USER INPUT (xvp_dev-0): I&#39;ve been doing good too!\r\n \r\n Thank you.\r\n [2018-07-12 14:05:20] SYSTEM RESPONSE: \" ;Hello! \" ;\r\n How is your day going today?\r\n [2018-07-12 14:05:34] USER INPUT (xvp_dev-0): \" ;Great! Can&#39;t complain \" ;\r\n [2018-07-12 14:05:34] SYSTEM RESPONSE: \" ;Okay.\r\n That&#39;s good \" ;\r\n \" ; \" ; \" ;\r\n \r\n import re\r\n import pprint\r\n \r\n def find_lines_by_date(date=&#39;2018-07-11&#39;):\r\n rv = []\r\n groups = re.findall(r&#39;(\\[(.*?)\\s+.*?\\][^\\[]+)&#39;, data)\r\n for g in groups:\r\n if g[-1] == date:\r\n rv.append(g[0].strip())\r\n return rv\r\n \r\n \r\n pprint.pprint(find_lines_by_date(date=&#39;2018-07-12&#39;))\r\n\r\nThis will print:\r\n\r\n [&#39;[2018-07-12 14:05:20] SYSTEM RESPONSE: \" ;Hello! \" ;\\n&#39;\r\n &#39; How is your day going today?&#39;,\r\n &#39;[2018-07-12 14:05:34] USER INPUT (xvp_dev-0): \" ;Great! Can\\&#39;t complain \" ;&#39;,\r\n &#39;[2018-07-12 14:05:34] SYSTEM RESPONSE: \" ;Okay.\\n That\\&#39;s good \" ;&#39;]\r\n\r\nEDIT:\r\n\r\nThe regexp `(\\[(.*?)\\s+.*?\\][^\\[]+)` will match the string for all two-valued groups (first value in the group contains all the line for return value, second value in the group is the date for comparison).\r\n\r\nI made a [simple example on external site][1] with detailed explication:\r\n\r\n\r\n [1]: _URL_0_", "772" ], [ "It all depends, what kind of information you want to extract. In my example, I extracted title, text and staff list (if exists). You can add additional parsing rules for extract more information:\r\n\r\n urls = [&#39;_URL_1_;,\r\n &#39;_URL_2_;,\r\n &#39;_URL_0_;]\r\n \r\n from bs4 import BeautifulSoup\r\n import requests\r\n from pprint import pprint\r\n \r\n for url in urls:\r\n soup = BeautifulSoup(requests.get(url).text, &#39;lxml&#39;)\r\n \r\n # parse title\r\n title = soup.select_one(&#39;h1.title&#39;).text\r\n \r\n # parse academic staff (if any):\r\n staff_list = []\r\n if soup.select(&#39;h2 ~ ul&#39;):\r\n for li in soup.select(&#39;h2 ~ ul&#39;)[-1].find_all(&#39;li&#39;):\r\n staff_list.append(li.text)\r\n li.clear()\r\n soup.select(&#39;h2&#39;)[-1].clear()\r\n \r\n # parse the text\r\n text = &#39;&#39;\r\n for t in soup.select(&#39;nav ~ *&#39;):\r\n text += t.text.strip() + &#39;\\n&#39;\r\n \r\n print(title)\r\n print(text)\r\n print(&#39;Staff list = &#39;, staff_list)\r\n print(&#39;-&#39; * 80)\r\n\r\nWill print (abbreviated):\r\n\r\n Intelligent Robotics Lab\r\n \r\n \r\n Welcome to the Intelligent Robotics Lab in the School of Computer Science at the University of Birmingham. ...\r\n \r\n Staff list = []\r\n --------------------------------------------------------------------------------\r\n Reasoning\r\n \r\n Overview\r\n This grouping includes research on various forms of reasoning, including theorem proving and uncertain reasoning, with particular application to mathematical knowledge management, mathematical document recognition, computer algebra, natural language processing, and multi-attribute and multi-agent decision-making. The research is relevant both to understanding how human reasoning works and to designing useful practical tools...\r\n \r\n \r\n Staff list = [&#39;John Barnden&#39;, &#39;Richard Dearden&#39;, &#39;Antoni Diller&#39;, &#39;Manfred Kerber&#39;, &#39;Mark Lee&#39;, &#39;Xudong Luo&#39;, &#39;Alan Sexton&#39;, &#39;Volker Sorge&#39;]\r\n --------------------------------------------------------------------------------", "1017" ], [ "You can use BeautifulSoup for parsing XML. In my example I selected all ` < para > ` tags with `select()` method and then concatenated them together (without first and last one):\r\n\r\n data = \" ; \" ; \" ; < para\r\n > < reviewer-note > <PERSON> < /reviewer-note\r\n > < /para > \r\n < para > < user-typing > Resilient. < /para > \r\n < para > hashing. < /para > \r\n < para > \" ;X \" ; release. < /para > \r\n < para > [See < url\r\n href= \" ;_URL_0_;\r\n > Trunk/ECMP Groups < /url > .] < /para > \" ; \" ; \" ;\r\n \r\n from bs4 import BeautifulSoup\r\n \r\n soup = BeautifulSoup(data, &#39;lxml&#39;)\r\n \r\n all_params = soup.select(&#39;para&#39;)[1:-1]\r\n \r\n string_output = &#39;&#39;\r\n for param in all_params:\r\n string_output += param.text.strip() + &#39;,&#39;\r\n string_output = string_output.rstrip(&#39;,&#39;)\r\n \r\n print(string_output)\r\n\r\nOutput:\r\n\r\n Resilient.,hashing., \" ;X \" ; release.", "1017" ], [ "You need to create SSL context (e.g. with method `ssl.create_default_context()`) and then supply certificate to it (can be self-signed).\r\n\r\nTo create self-signed certificate, use this command (just leave all questions with default values):\r\n\r\n openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout selfsigned.key -out selfsigned.crt\r\n\r\nThen, in your script create ssl context with this certificate:\r\n\r\n import ssl\r\n\r\n sc = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)\r\n sc.load_cert_chain(&#39;selfsigned.crt&#39;, &#39;selfsigned.key&#39;)\r\n\r\n...and then supply it to your `web.run_app()`:\r\n\r\n web.run_app(app, port=9090, ssl_context=sc)\r\n\r\nRunning the server and navigating to your page through https should work now, but, of course you need to confirm in browser that the certificate is correct.", "11" ], [ "The regex `group()` you are looking after is 0, not 1. It contains the image path. Also when the image source path is relative, the url formatting is done incorrectly. I used `urllib` builtin module to parse the site url:\r\n\r\n import re\r\n import requests\r\n from bs4 import BeautifulSoup\r\n from urllib.parse import urlparse\r\n \r\n site = &#39;_URL_1_;\r\n \r\n response = requests.get(site)\r\n \r\n soup = BeautifulSoup(response.text, &#39;html.parser&#39;)\r\n img_tags = soup.find_all(&#39;img&#39;)\r\n \r\n urls = [img[&#39;src&#39;] for img in img_tags]\r\n \r\n for url in urls:\r\n filename = re.search(r&#39;([\\w_-]+[.](jpg|gif|png))$&#39;, url)\r\n filename = re.sub(r&#39;\\d{4,}\\.&#39;, &#39;.&#39;, filename.group(0))\r\n \r\n with open(filename, &#39;wb&#39;) as f:\r\n if &#39;http&#39; not in url:\r\n # sometimes an image source can be relative\r\n # if it is provide the base url which also happens\r\n # to be the site variable atm.\r\n hostname = urlparse(site).hostname\r\n scheme = urlparse(site).scheme\r\n url = &#39;{}://{}/{}&#39;.format(scheme, hostname, url)\r\n \r\n # for full resolution image the last four digits needs to be striped\r\n url = re.sub(r&#39;\\d{4,}\\.&#39;, &#39;.&#39;, url)\r\n \r\n print(&#39;Fetching image from {} to {}&#39;.format(url, filename))\r\n response = requests.get(url)\r\n f.write(response.content)\r\n\r\nOutputs:\r\n\r\n Fetching image from _URL_0_ to FermiFinals.jpg\r\n\r\nAnd the image is saved as FermiFinals.jpg", "822" ], [ "You can just sort the letters by values and then to write last member of that sorted array:\r\n\r\n def main():\r\n x = {}\r\n for word in sentence:\r\n x[word] = sentence.count(word)\r\n \r\n sorted_letters = sorted(x, key=lambda v: x[v])\r\n for letter in sorted_letters:\r\n print (letter + &#39;: &#39; + str(x[letter]))\r\n \r\n print(&#39;Most used letter =&#39;, sorted_letters[-1])\r\n \r\n \r\n sentence=input( \" ;Enter a sentence: \" ;)\r\n main()\r\n\r\nSample input/output:\r\n\r\n Enter a sentence: Hello World!\r\n H: 1\r\n e: 1\r\n : 1\r\n W: 1\r\n r: 1\r\n d: 1\r\n !: 1\r\n o: 2\r\n l: 3\r\n Most used letter = l", "296" ], [ "All depends how do you want to structure your code. My suggestion is use `ChainMap` from `collections`. With `ChainMap` you can specify default values for your tags/keys and just parse the values that aren&#39;t missing. That way you will don&#39;t have if/else cluttered along your codebase:\r\n\r\n data = \" ; \" ; \" ; < div id= \" ;content \" ; > \r\n < h1 > Product name < /h1 > \r\n < table id= \" ;properties \" ; > \r\n < tbody > \r\n < tr id= \" ;manufacturer-row \" ; > \r\n < th > Manufacturer < /th > \r\n < td > Some-Mark < /td > \r\n < /tr > \r\n < /tbody > \r\n < /table > \r\n < p > Full description of the product < /p > \r\n < /div > \" ; \" ; \" ;\r\n \r\n from bs4 import BeautifulSoup\r\n from collections import ChainMap\r\n \r\n def my_parse(soup):\r\n def is_value_missing(k, v):\r\n if v is None:\r\n print(f&#39;Value \" ;{k} \" ; is missing!&#39;) # or log it!\r\n return v is None\r\n \r\n d = {}\r\n d[&#39;product_name_tag&#39;] = soup.select_one( \" ;h1 \" ;)\r\n d[&#39;manufacturer_tag&#39;] = soup.select_one( \" ;#manufacturer-row td \" ;)\r\n d[&#39;description&#39;] = soup.select_one( \" ;p \" ;)\r\n d[&#39;other value&#39;] = soup.select_one( \" ;nav \" ;) # this is missing!\r\n return {k:v.text for k, v in d.items() if is_value_missing(k, v) == False}\r\n \r\n soup = BeautifulSoup(data, &#39;lxml&#39;)\r\n c = ChainMap(my_parse(soup), {&#39;product_name_tag&#39;: &#39;-default name tag-&#39;,\r\n &#39;manufacturer_tag&#39;: &#39;-default manufacturer tag-&#39;,\r\n &#39;description&#39;: &#39;-default description-&#39;,\r\n &#39;other value&#39;: &#39;-default other value-&#39;,\r\n })\r\n \r\n print( \" ;Product name = \" ;, c[&#39;product_name_tag&#39;])\r\n print( \" ;Other value = \" ;, c[&#39;other value&#39;])\r\n\r\nThis will print:\r\n\r\n Value \" ;other value \" ; is missing!\r\n Product name = Product name\r\n Other value = -default other value-", "1017" ], [ "The company name you can scrap from the \" ;_URL_2_{ticker} \" ; URL, but however all other data (like volumes and prices) is loaded through Ajax from \" ;_URL_0_;. This example will load company name and close price:\r\n\r\n import requests\r\n from bs4 import BeautifulSoup\r\n import json\r\n from pprint import pprint\r\n \r\n tickers = [&#39;BABA&#39;, &#39;AAPL&#39;]\r\n stockname = []\r\n for ticker in tickers:\r\n stock_company = f \" ;_URL_2_{ticker} \" ;\r\n soup = BeautifulSoup(requests.get(stock_company).text, \" ;html.parser \" ;)\r\n name = soup.h1.text.split(&#39;-&#39;)[1].strip()\r\n ticker_data_url = f \" ;_URL_1_{ticker}?region=US & lang=en-US & includePrePost=false & interval=2m & range=1d & corsDomain=_URL_3_ & .tsrc=finance \" ;\r\n ticker_data = json.loads(requests.get(ticker_data_url).text)\r\n price = ticker_data[&#39;chart&#39;][&#39;result&#39;][0][&#39;meta&#39;][&#39;previousClose&#39;]\r\n if name:\r\n stockname.append( [ticker, name, price] )\r\n \r\n pprint(stockname, width=60)\r\n\r\nWill print:\r\n\r\n [[&#39;BABA&#39;, &#39;Alibaba Group Holding Limited&#39;, 187.25],\r\n [&#39;AAPL&#39;, &#39;Apple Inc.&#39;, 191.44]]\r\n\r\nApple has ticker AAPL, not APPL.", "1017" ], [ "Let&#39;s use `timeit` module to measure the performance:\r\n\r\n from collections import deque\r\n from timeit import timeit\r\n \r\n class Stack1:\r\n def __init__(self):\r\n self.s = deque()\r\n \r\n def push(self, data):\r\n self.s.append(data)\r\n \r\n def pop(self):\r\n try:\r\n self.s.pop()\r\n except Exception as e:\r\n print(e)\r\n \r\n def __str__(self):\r\n l = []\r\n for i in self.s:\r\n l.append(str(i))\r\n if l == []:\r\n return &#39;Stack is Empty&#39;\r\n else:\r\n return &#39; &#39;.join(l)\r\n \r\n class Stack2:\r\n \r\n def __init__(self):\r\n self.s = deque()\r\n \r\n def push(self, data):\r\n self.s.append(data)\r\n \r\n def pop(self):\r\n try:\r\n self.s.pop()\r\n except Exception as e:\r\n print(e)\r\n \r\n def __str__(self):\r\n return str(self.s)\r\n \r\n stack1 = Stack1()\r\n stack1.push(1)\r\n stack1.push(2)\r\n stack1.push(3)\r\n \r\n stack2 = Stack2()\r\n stack2.push(1)\r\n stack2.push(2)\r\n stack2.push(3)\r\n \r\n \r\n def test_func1():\r\n s = str(stack1)\r\n \r\n def test_func2():\r\n s = str(stack2)\r\n \r\n print(timeit(&#39;test_func1()&#39;, globals=globals(), number=1_000_000))\r\n print(timeit(&#39;test_func2()&#39;, globals=globals(), number=1_000_000))\r\n\r\nOutput is (1 million calls each):\r\n\r\n 1.818193725997844\r\n 1.463878423001006\r\n\r\nSo Stack2 with simple `str()` call is ~20% faster.", "199" ], [ "My attempt with builtin `any()` and `str.startswith()`:\r\n\r\n employees = {}\r\n employees[0] = &#39;smith john&#39;\r\n employees[1] = &#39;paolo smith&#39;\r\n employees[3] = &#39;jack daniels&#39;\r\n \r\n \r\n def validate(emp_dict, username, emp_no):\r\n if emp_no not in emp_dict:\r\n return False\r\n \r\n if len(username) < 4:\r\n return False\r\n \r\n if not any(e.startswith(username[:3]) or e.startswith(username[-3:]) for e in emp_dict.values()):\r\n return False\r\n \r\n return True\r\n \r\n print(validate(employees, &#39;paolo john&#39;, 3))\r\n print(validate(employees, &#39;john paolo&#39;, 3))\r\n\r\n\r\nPrints:\r\n\r\n True\r\n False", "761" ], [ "You can use `re` module for extracting the time data. I wrote simple generator that takes string input and outputs all lines along with the time interval between them:\r\n\r\n string_input = \" ; \" ; \" ;\r\n 01:58:30| USER INPUT : \" ;Hello \" ;\r\n 01:58:30| SYSTEM RESPONSE: \" ;Hello. How are you \" ;\r\n 01:58:56| USER INPUT : \" ;Good thank you. How about you? \" ;\r\n 01:58:57| SYSTEM RESPONSE: \" ;I am doing great! \" ;\r\n 01:59:13| USER INPUT : \" ;Thats it \" ;\r\n 01:59:15| SYSTEM RESPONSE: \" ;Deal \" ;\r\n 13:29:28| USER INPUT : \" ;Deal \" ;\r\n \" ; \" ; \" ;\r\n \r\n import re\r\n from datetime import datetime\r\n \r\n def get_time(data):\r\n groups = re.findall(r&#39;(([\\d:]+)\\|.*)&#39;, string_input)\r\n time_format = &#39;%H:%M:%S&#39;\r\n \r\n t1, t2 = None, None\r\n for (line1, time1), (line2, time2) in zip(groups, groups[<IP_ADDRESS><PERSON> \" ;\r\n 13:29:28| USER INPUT : \" ;<PERSON> \" ;\r\n \" ; \" ; \" ;\r\n \r\n import re\r\n from datetime import datetime\r\n \r\n def get_time(data):\r\n groups = re.findall(r&#39;(([\\d:]+)\\|.*)&#39;, string_input)\r\n time_format = &#39;%H:%M:%S&#39;\r\n \r\n t1, t2 = None, None\r\n for (line1, time1), (line2, time2) in zip(groups, groups[1::1]):\r\n time1 = datetime.strptime(time1, time_format)\r\n time2 = datetime.strptime(time2, time_format)\r\n total_time = int((time2 - time1).total_seconds())\r\n singular_or_plural = &#39;second&#39; if total_time == 1 else &#39;seconds&#39;\r\n yield f&#39;{line1}\\n < {total_time} {singular_or_plural} > &#39;\r\n yield f&#39;{line2}&#39;\r\n \r\n for line in get_time(string_input):\r\n print(line)\r\n\r\nOutput is:\r\n\r\n 01:58:30| USER INPUT : \" ;Hello \" ;\r\n < 0 seconds > \r\n 01:58:30| SYSTEM RESPONSE: \" ;Hello. How are you \" ;\r\n < 26 seconds > \r\n 01:58:56| USER INPUT : \" ;Good thank you. How about you? \" ;\r\n < 1 second > \r\n 01:58:57| SYSTEM RESPONSE: \" ;I am doing great! \" ;\r\n < 16 seconds > \r\n 01:59:13| USER INPUT : \" ;Thats it \" ;\r\n < 2 seconds > \r\n 01:59:15| SYSTEM RESPONSE: \" ;Deal \" ;\r\n < 41413 seconds > \r\n 13:29:28| USER INPUT : \" ;Deal \" ;", "627" ], [ "You can do it with BeautifulSoup, using the `Comment` object:\r\n\r\n import requests\r\n from bs4 import BeautifulSoup, Comment\r\n \r\n resp = requests.get(&#39;_URL_0_;)\r\n soup = BeautifulSoup(resp.content, &#39;xml&#39;)\r\n for item in soup.select(&#39;item&#39;):\r\n comments = item.description.find_all(text=lambda text:isinstance(text, Comment))\r\n print([c for c in comments[0].split(&#39;\\n&#39;) if c][1:-1])\r\n\r\nPrints:\r\n\r\n [&#39;[[ < ESCYL2400000024153A;(24,4;24,5;12,1;sun);(49,0;91,0;49,0);(1021,0;1021,2;1019,9);(5,0;10,0;219);(0,0);Sta Mar & #237;a del Condado > ]]&#39;]\r\n\r\nEdit:\r\n\r\nThis code iterates through all ` < item > ` tags. In each ` < item > ` tag it will find in ` < description > ` all texts, that&#39;s instance of `Comment` object (in other words anything that is between ` < !--` and `-- > ` tags. Then it will split first comment according newlines and writes all lines but first and last.", "1017" ], [ "You can use `set` operations to see if two sentences match (no need to use regex, but you need to do some preprocessing - remove `?`, put sentence in lowercase etc.):\r\n\r\n A = \" ;Do Wakanda exist in the world? \" ;\r\n B = \" ;Does Wakanda exist? \" ;\r\n \r\n A2 = \" ;Does Atlantis exist in our world? \" ;\r\n B2 = \" ;Does Wakanda exist? \" ;\r\n \r\n exclude = [&#39;do&#39;, &#39;in&#39;, &#39;the&#39;, &#39;does&#39;]\r\n \r\n def a_match_b(a, b):\r\n a = set(a.replace(&#39;?&#39;, &#39;&#39;).lower().split()) - set(exclude)\r\n b = set(b.replace(&#39;?&#39;, &#39;&#39;).lower().split()) - set(exclude)\r\n return len(a.intersection(b)) > 1\r\n \r\n print(a_match_b(A, B))\r\n print(a_match_b(A2, B2))\r\n\r\nOutput is:\r\n\r\n True\r\n False\r\n\r\nEdit:\r\n\r\nAs @tobias_k said, you can use regexp to find the words, so you can alternatively use:\r\n\r\n import re\r\n \r\n A = \" ;Do Wakanda exist in the world? \" ;\r\n B = \" ;Does Wakanda exist? \" ;\r\n \r\n A2 = \" ;Does Atlantis exist in our world? \" ;\r\n B2 = \" ;Does Wakanda exist? \" ;\r\n \r\n exclude = [&#39;do&#39;, &#39;in&#39;, &#39;the&#39;, &#39;does&#39;]\r\n \r\n def a_match_b(a, b):\r\n words_a = re.findall(r&#39;[\\w]+&#39;, a.lower())\r\n words_b = re.findall(r&#39;[\\w]+&#39;, b.lower())\r\n a = set(words_a) - set(exclude)\r\n b = set(words_b) - set(exclude)\r\n return len(a.intersection(b)) > 1\r\n \r\n print(a_match_b(A, B))\r\n print(a_match_b(A2, B2))", "296" ], [ "Without recursion, with generator and trampoline (with writing to file):\r\n\r\n data = {&#39;a&#39;: {&#39;b&#39;: {&#39;c&#39;: {}, &#39;d&#39;: {}}, &#39;g&#39;: {}}}\r\n \r\n \r\n def write_dict(d, s=(), f_out=None):\r\n if len(d) == 0:\r\n if f_out:\r\n f_out.write(&#39; &#39;.join(s) + &#39;\\n&#39;)\r\n return\r\n \r\n for k, v in reversed(list(d.items())):\r\n yield write_dict, v, s + (k, ), f_out\r\n \r\n \r\n with open(&#39;data_out.txt&#39;, &#39;w&#39;) as f_out:\r\n \r\n stack = [write_dict(data, f_out=f_out)]\r\n \r\n while stack:\r\n try:\r\n v = next(stack[-1])\r\n except StopIteration:\r\n del stack[-1]\r\n continue\r\n \r\n stack.insert(-1, v[0](v[1], v[2], v[3]))\r\n\r\nThe file contains:\r\n\r\n a b c\r\n a b d\r\n a g", "761" ], [ "Without `pandas`, using `csv.DictWriter`:\r\n\r\n import random, csv, datetime\r\n \r\n selecteddatas = random.sample(list(range(100)), 100)\r\n a = {}\r\n for data in selecteddatas:\r\n calls = random.choice(range(600))\r\n a[data] = {&#39;time_stamp&#39;: datetime.datetime.now(), &#39;calls&#39;: calls}\r\n \r\n with open(&#39;data.csv&#39;, &#39;w&#39;, newline=&#39;&#39;) as csvfile:\r\n writer = csv.DictWriter(csvfile, fieldnames=[&#39;time_stamp&#39;, &#39;calls&#39;])\r\n \r\n writer.writeheader()\r\n for k in a.keys():\r\n writer.writerow(a[k])\r\n\r\nThe data.csv contains:\r\n\r\n time_stamp,calls\r\n 2018-07-24 17:54:01.989054,273\r\n 2018-07-24 17:54:01.989059,290\r\n 2018-07-24 17:54:01.989062,51\r\n 2018-07-24 17:54:01.989064,188\r\n 2018-07-24 17:54:01.989067,518\r\n ...and so on.", "288" ], [ "`Player.position` is list, which means it&#39;s mutable type. If you put this list in another list, Python makes a reference to it, not a copy.\r\n\r\nWhen you add/delete/change items in the list, it will change everywhere the reference is hold.\r\n\r\nYou need to make a copy when you assign to `agent.actual`. Look at the `copy` module in Python or restructure your code (Hint: `tuple` is immutable type)", "800" ], [ "You are adding to a list, while you are iterating it - > the memory will grow up indefinitely:\r\n\r\n [srcgroup.append(&#39;%s.keyword&#39; % x) for x in srcgroup]\r\n [dstgroup.append(&#39;%s.keyword&#39; % x) for x in dstgroup]\r\n\r\nThe solution is to iterate over a copy:\r\n\r\n [srcgroup.append(&#39;%s.keyword&#39; % x) for x in srcgroup[:]]\r\n [dstgroup.append(&#39;%s.keyword&#39; % x) for x in dstgroup[:]]\r\n\r\nEdit:\r\n\r\nBetter idea would be simplify things a little bit (from answers below):\r\n\r\n\r\n srcgroup = [&#39;ip&#39;, &#39;keyword&#39;]\r\n \r\n srcgroup.extend([f&#39;{x}.keyword&#39; for x in srcgroup])\r\n print(srcgroup)\r\n\r\nWill output:\r\n\r\n [&#39;ip&#39;, &#39;keyword&#39;, &#39;ip.keyword&#39;, &#39;keyword.keyword&#39;]", "309" ], [ "My approach using `re.sub`. First `re.sub` removes `*`, second `re.sub` adds commas:\r\n\r\n import re\r\n \r\n test_str = &#39;**Amount** : $25k **Name** : James&#39;\r\n \r\n s = re.sub(r&#39;\\s*([^:\\s]+)\\s*:\\s*([^\\s]+)&#39;, r&#39;\\1: \\2, &#39;, re.sub(r&#39;[\\*\\s]+&#39;, &#39; &#39;, test_str)).rstrip(&#39;, &#39;)\r\n print(s)\r\n\r\nOutput:\r\n\r\n Amount: $25k, Name: <PERSON>\r\n\r\nWith *, < , > as delimiters:\r\n \r\n test_str = &#39;**Amount** : $25k **Name** : <PERSON> < < Name2 > > : Another < Name3 > : Jack&#39;\r\n \r\n s = re.sub(r&#39;\\s*([^:\\s]+)\\s*:\\s*([^\\s]+)&#39;, r&#39;\\1: \\2, &#39;, re.sub(r&#39;[\\* < > \\s]+&#39;, &#39; &#39;, test_str)).rstrip(&#39;, &#39;)\r\n print(s)\r\n\r\nOutput:\r\n\r\n Amount: $25k, Name: <PERSON>, Name2: Another, Name3: <PERSON>", "761" ], [ "You need to supply to `csv.reader` file object, not `file.readlines()`. If you want to print Bs, you need to seek to the beginning of file, similar with the Cs.\r\n\r\n import csv\r\n \r\n def read_csv():\r\n with open( \" ;data.csv \" ;) as file:\r\n dialect = csv.Sniffer().sniff(file.read(1024))\r\n csv_file = csv.reader(file, dialect, quotechar=&#39; \" ;&#39;)\r\n \r\n print( \" ;A \" ;)\r\n csv_file_list = []\r\n \r\n file.seek(0)\r\n \r\n for row in file:\r\n print( \" ;B \" ;)\r\n \r\n file.seek(0)\r\n \r\n for row in csv_file:\r\n print( \" ;C \" ;)\r\n csv_file_list.append(row)\r\n return csv_file_list\r\n \r\n print(read_csv())\r\n\r\nPrints:\r\n\r\n A\r\n B\r\n B\r\n B\r\n B\r\n C\r\n C\r\n C\r\n C\r\n [[&#39;A&#39;, &#39;B&#39;, &#39;C&#39;], [&#39;1&#39;, &#39;4&#39;, &#39;7&#39;], [&#39;2&#39;, &#39;5&#39;, &#39;8&#39;], [&#39;3&#39;, &#39;6&#39;, &#39;9&#39;]]", "288" ], [ "With `select(&#39;div > div.row&#39;)` we select all div tags with class row as direct children of div tag and then through list comprehension we select all parents of these tags:\r\n\r\n data = &#39; < div class= \" ;consider \" ; > < div class= \" ;row \" ; > < p > Text1 < /p > < /div > < /div > < div class= \" ;consider \" ; > < h2 > Hello < /h2 > < /div > < div class= \" ;Consider \" ; > < div class= \" ;row \" ; > < p > Text2 < /p > < /div > < /div > &#39;\r\n \r\n from bs4 import BeautifulSoup \r\n soup = BeautifulSoup(data, &#39;lxml&#39;)\r\n \r\n divs = [div.parent for div in soup.select(&#39;div > div.row&#39;)]\r\n \r\n print(divs)\r\n\r\nOutputs:\r\n\r\n [ < div class= \" ;consider \" ; > < div class= \" ;row \" ; > < p > Text1 < /p > < /div > < /div > , < div class= \" ;Consider \" ; > < div class= \" ;row \" ; > < p > Text2 < /p > < /div > < /div > ]", "1017" ], [ "This page loads data dynamically through Ajax, the url with XML data of boat is `_URL_0_`, you can check it in Firefox/Chrome network inspector. All you need is token, which is stored in cookies upon login:\r\n\r\n from bs4 import BeautifulSoup\r\n import requests\r\n \r\n login_data = {&#39;boat&#39;:&#39;sol&#39;,&#39;key&#39;:&#39;sol&#39;,&#39;race&#39;:&#39;1159&#39;}\r\n login_url = &#39;_URL_1_;\r\n boat_data_url = &#39;_URL_0_&#39;\r\n \r\n with requests.session() as s:\r\n post = _URL_2_(login_url, login_data)\r\n data = {&#39;boat&#39;: &#39;sol&#39;, &#39;race&#39;: &#39;1159&#39;, &#39;token&#39;: s.cookies.get_dict()[&#39;sailonline[1159][sol]&#39;]}\r\n boat_data = BeautifulSoup(_URL_2_(boat_data_url, data=data).text, &#39;xml&#39;)\r\n print(boat_data.prettify())\r\n\r\nThis will print:\r\n\r\n < ?xml version= \" ;1.0 \" ; encoding= \" ;utf-8 \" ;? > \r\n < BOAT > \r\n < LAT > \r\n N 14&#176;<PHONE_NUMBER>&#39;\r\n < /LAT > \r\n < LON > \r\n E 120&#176;57.0000&#39;\r\n < /LON > \r\n < DTG > \r\n 381.84\r\n < /DTG > \r\n < DBL > \r\n 107.68\r\n < /DBL > \r\n < TWD > \r\n 220.48\r\n < /TWD > \r\n < TWS > \r\n 4.76\r\n < /TWS > \r\n < WPT > \r\n 0\r\n < /WPT > \r\n < RANK > \r\n -\r\n < /RANK > \r\n < lCOG > \r\n COG\r\n < /lCOG > \r\n < lTWA > \r\n & lt;u & gt;TWA & lt;/u & gt;\r\n < /lTWA > \r\n < COG > \r\n 220.48\r\n < /COG > \r\n < TWA > \r\n 000.00\r\n < /TWA > \r\n < SOG > \r\n 0.00\r\n < /SOG > \r\n < PERF > \r\n 100.00\r\n < /PERF > \r\n < VMG > \r\n 0.00\r\n < /VMG > \r\n < DATE > \r\n 2018-07-25\r\n < /DATE > \r\n < TIME > \r\n 12:47:11\r\n < /TIME > \r\n < /BOAT >", "1017" ], [ "When you are building your list `fct_list1` through the loop, your variable `i` is **closure** and is \" ;remembered \" ; in inner function `fct()`. But this variable `i` is remembered through the reference, so when you change it (and through iteration you will change it), the final value is `3`. See the example, I added print in inner function `fct`:\r\n\r\n fct_list1 = []\r\n fct_list2 = []\r\n theta = [[-2.95,0.001], [-0.5,0.511], [-0.1,0.51], [-2.95,0.001]]\r\n \r\n def some_func(l, beta, sigma):\r\n print(l, beta, sigma)\r\n \r\n for i in range(4):\r\n def fct(lcs):\r\n print(i)\r\n return some_func(lcs, beta=theta[i][0], sigma=theta[i][1])\r\n fct_list1.append(fct)\r\n \r\n def fct_1(lcs):\r\n return some_func(lcs, beta=-2.95, sigma=0.001)\r\n \r\n def fct_2(lcs):\r\n return some_func(lcs, beta=-0.5, sigma=0.511)\r\n \r\n def fct_3(lcs):\r\n return some_func(lcs, beta=-0.1, sigma=0.51)\r\n \r\n def fct_4(lcs):\r\n return some_func(lcs, beta=-2.95, sigma=0.001)\r\n \r\n fct_list2 = [fct_1,fct_2,fct_3,fct_4]\r\n \r\n \r\n for f in fct_list1:\r\n f(theta)\r\n \r\n print(&#39;-&#39; * 80)\r\n \r\n for f in fct_list2:\r\n f(theta)\r\n\r\nOutput:\r\n\r\n 3\r\n [[-2.95, 0.001], [-0.5, 0.511], [-0.1, 0.51], [-2.95, 0.001]] -2.95 0.001\r\n 3\r\n [[-2.95, 0.001], [-0.5, 0.511], [-0.1, 0.51], [-2.95, 0.001]] -2.95 0.001\r\n 3\r\n [[-2.95, 0.001], [-0.5, 0.511], [-0.1, 0.51], [-2.95, 0.001]] -2.95 0.001\r\n 3\r\n [[-2.95, 0.001], [-0.5, 0.511], [-0.1, 0.51], [-2.95, 0.001]] -2.95 0.001\r\n --------------------------------------------------------------------------------\r\n [[-2.95, 0.001], [-0.5, 0.511], [-0.1, 0.51], [-2.95, 0.001]] -2.95 0.001\r\n [[-2.95, 0.001], [-0.5, 0.511], [-0.1, 0.51], [-2.95, 0.001]] -0.5 0.511\r\n [[-2.95, 0.001], [-0.5, 0.511], [-0.1, 0.51], [-2.95, 0.001]] -0.1 0.51\r\n [[-2.95, 0.001], [-0.5, 0.511], [-0.1, 0.51], [-2.95, 0.001]] -2.95 0.001\r\n\r\nOne of the solution is slightly modify your code in loop:\r\n\r\n for i in range(4):\r\n def fct(lcs, index):\r\n return some_func(lcs, beta=theta[index][0], sigma=theta[index][1])\r\n fct_list1.append(lambda lcs, index=i: fct(lcs, index))", "598" ], [ "You can achieve desired functionality by defining `__iter__()` method in your class:\r\n\r\n class Foo:\r\n def __init__(self, **values):\r\n self._value_tuple = tuple(values)\r\n\r\n def __iter__(self):\r\n return self._value_tuple.__iter__()\r\n # or return iter(self._value_tuple)\r\n \r\n \r\n foo = Foo(ham=1, eggs=2, spam=3)\r\n print(tuple(foo))\r\n\r\nOutput:\r\n\r\n (&#39;ham&#39;, &#39;eggs&#39;, &#39;spam&#39;)\r\n\r\nIf you want `(keys, values)`, you can store your items in dict:\r\n\r\n class Foo:\r\n def __init__(self, **values):\r\n self._value_dict = values\r\n \r\n def __iter__(self):\r\n return iter(self._value_dict.items())\r\n \r\n \r\n foo = Foo(ham=1, eggs=2, spam=3)\r\n print(tuple(foo))\r\n\r\nPrints:\r\n\r\n ((&#39;ham&#39;, 1), (&#39;eggs&#39;, 2), (&#39;spam&#39;, 3))\r\n\r\n`__iter__()` is part of [Python Datamodel][1]. When you implement this method in your class, all functions and syntax constructs that expect something iterable will work with your class without change, that includes parameters in `tuple()`.\r\n\r\n\r\n [1]: _URL_0_", "761" ], [ "I created two lists `l1` and `l2`, but each one with a different creation method:\r\n\r\n import sys\r\n \r\n l1 = [None] * 10\r\n l2 = [None for _ in range(10)]\r\n \r\n print(&#39;Size of l1 =&#39;, sys.getsizeof(l1))\r\n print(&#39;Size of l2 =&#39;, sys.getsizeof(l2))\r\n\r\nBut the output surprised me:\r\n\r\n Size of l1 = 144\r\n Size of l2 = 192\r\n\r\nThe list created with a list comprehension is a bigger size in memory, but the two lists are identical in Python otherwise.\r\n\r\nWhy is that? Is this some CPython internal thing, or some other explanation?", "91" ], [ "I did some measurements for converting dictionary to pylist, here are the results:\r\n\r\n from timeit import timeit \r\n \r\n dictionary = {0:0.2, 9:0.4}\r\n \r\n def method1(d, n=10):\r\n return [d[i] if i in d.keys() else 0 for i in range(n)]\r\n \r\n \r\n def method2(d, n=10):\r\n return [d.get(i, 0) for i in range(n)]\r\n \r\n \r\n def method3(d, n=10):\r\n return [d.get(i, v) for i, v in enumerate([0] * n)]\r\n \r\n \r\n def method4(d, n=10):\r\n l = [0] * n\r\n for v, k in dictionary.items():\r\n l[v] = k\r\n return l\r\n \r\n print(timeit( \" ;method1(dictionary) \" ;, globals=globals(), number=1_000_000))\r\n print(timeit( \" ;method2(dictionary) \" ;, globals=globals(), number=1_000_000))\r\n print(timeit( \" ;method3(dictionary) \" ;, globals=globals(), number=1_000_000))\r\n print(timeit( \" ;method4(dictionary) \" ;, globals=globals(), number=1_000_000))\r\n \r\nOutput is:\r\n\r\n 1.8713272300001336\r\n 1.8894721449996723\r\n 2.15010558800077\r\n 0.5128111490002993\r\n\r\nIt&#39;s clearly to see, that `method4` is fastest - firstly create the fixed list of zeros, and then iterate just keys that need to be changed. \r\n\r\nBased on that fact, converting tuple to list should follow similar pattern: creating fixed list and then iterate over pytuple and change values in that list.\r\n\r\nEDIT:\r\n\r\nI did some test with random dictionaries as well:\r\n\r\n # creating random dictionary\r\n n = random.randint(1000, 100000)\r\n idx = list(range(n))\r\n dictionary = {}\r\n for i in range(random.randint(100, n)):\r\n dictionary[random.choice(idx)] = random.random()\r\n \r\n print(&#39;n =&#39;,n)\r\n print(&#39;len(dictionary.keys() =&#39;, len(dictionary.keys()))\r\n \r\n print(timeit(f \" ;method1(dictionary, n={n}) \" ;, globals=globals(), number=100))\r\n print(timeit(f \" ;method2(dictionary, n={n}) \" ;, globals=globals(), number=100))\r\n print(timeit(f \" ;method3(dictionary, n={n}) \" ;, globals=globals(), number=100))\r\n print(timeit(f \" ;method4(dictionary, n={n}) \" ;, globals=globals(), number=100))\r\n\r\nThe results:\r\n\r\n n = 82981\r\n len(dictionary.keys() = 32083\r\n 1.203233296999315\r\n 1.1194271739987016\r\n 1.3668270919988572\r\n 0.2243523440010904", "58" ], [ "For this problem I would use list comprehension - firstly select all ` < ul > ` tags and then for each `ul` tag select all `li` tags and extract the text:\r\n\r\n data = \" ; \" ; \" ;\r\n < p > studets < /p > \r\n < ul > \r\n < li > <PERSON> < /li > \r\n < li > <PERSON> < /li > \r\n < li > <PERSON> < /li > \r\n < /ul > \r\n < p > teachers < /p > \r\n < ul > \r\n < li > <PERSON> < /li > \r\n < li > <PERSON> < /li > \r\n < /ul > \" ; \" ; \" ;\r\n \r\n from bs4 import BeautifulSoup\r\n \r\n soup = BeautifulSoup(data, &#39;lxml&#39;)\r\n \r\n print([[li.text for li in ul.select(&#39;li&#39;)] for ul in soup.select(&#39;ul&#39;)])\r\n\r\nOutput is:\r\n\r\n [[&#39;Json Bell&#39;, &#39;Jim Charlie&#39;, &#39;Mike Alfie&#39;], [&#39;William Cyphort&#39;, &#39;Juniper Egbert&#39;]]\r\n\r\n**EDIT:**\r\n\r\nFor comparing parents you can use `.parent` property:\r\n\r\n tag1 = soup.find(text=&#39;Json Bell&#39;)\r\n tag2 = soup.find(text=&#39;Jim Charlie&#39;)\r\n \r\n print(tag1.parent == tag2.parent) #tag1 and tag2 parents are < li > tags (different)\r\n print(tag1.parent.parent == tag2.parent.parent) #this compares < ul > tags, which are the same\r\n\r\nThis prints:\r\n\r\n False\r\n True\r\n\r\nNote: `soup.find(text=&#39;Json Bell&#39;)` finds `NavigableString` class. The parent of this `NavigableString` is ` < li > ` tag. The parent of ` < li > ` tag is ` < ul > ` tag and so on...", "1017" ], [ "For sublassing dictionary is recommended sublass from `collections.UserDict`, not `dict`. With UsedDict, all your content is stored in `data` variable. [Manual pages here][1].\r\n\r\nFor desired functionality, you can redefine `__setitem__` special method:\r\n\r\n import math\r\n from collections import UserDict\r\n \r\n class myClass(UserDict):\r\n def __init__(self,*arg,**kw):\r\n super(myClass, self).__init__(*arg, **kw)\r\n \r\n self.data[&#39;x&#39;] = 2\r\n self.data[&#39;x2&#39;]= self[&#39;x&#39;] * self[&#39;x&#39;]\r\n \r\n def __setitem__(self, key, value):\r\n super().__setitem__(key, value)\r\n if key == &#39;x&#39;:\r\n self.data[&#39;x2&#39;] = value * value\r\n elif key == &#39;x2&#39;:\r\n self.data[&#39;x2&#39;] = math.sqrt(value)\r\n \r\n c = myClass()\r\n print(c[&#39;x&#39;])\r\n print(c[&#39;x2&#39;])\r\n print(&#39;-&#39; * 80)\r\n c[&#39;x&#39;] = 4\r\n print(c[&#39;x&#39;])\r\n print(c[&#39;x2&#39;])\r\n print(&#39;-&#39; * 80)\r\n c[&#39;x2&#39;] = 9\r\n print(c[&#39;x&#39;])\r\n print(c[&#39;x2&#39;])\r\n\r\nOutput:\r\n\r\n 2\r\n 4\r\n --------------------------------------------------------------------------------\r\n 4\r\n 16\r\n --------------------------------------------------------------------------------\r\n 4\r\n 3.0\r\n\r\n\r\n [1]: _URL_0_", "58" ], [ "You can use keyword arguments and update object dictionary with `update()` method (works only if the variables aren&#39;t properties of the class. If that&#39;s the case, use `setattr()` method).\r\n\r\n class MyCalculationClass():\r\n \r\n def __init__(self):\r\n # set some defaults\r\n self.A = 45454\r\n self.B = [0, 0, 0, 0, 0]\r\n self.C = (1.0,2.5,30.0)\r\n \r\n def runRaw(self):\r\n print(self.A, self.B, self.C)\r\n \r\n def run(self, **kwargs):\r\n self.__dict__.update(kwargs)\r\n return self.runRaw()\r\n \r\n c = MyCalculationClass()\r\n c.run(B=[1, 1, 1])\r\n\r\nPrints:\r\n\r\n 45454 [1, 1, 1] (1.0, 2.5, 30.0)", "58" ], [ "If you decorate method of the class, first argument is always `self` object (you can access it with `args[0]`):\r\n\r\n import functools\r\n \r\n def decorate(method):\r\n @functools.wraps(method)\r\n def wrapper(*args, **kwargs):\r\n print(hasattr(args[0], &#39;a&#39;))\r\n result = method(*args, **kwargs)\r\n return result\r\n return wrapper\r\n \r\n class MyClass(object):\r\n def __init__(self, a=1, b=2):\r\n self.a = a\r\n self.b = b\r\n @decorate\r\n def meth(self):\r\n pass\r\n \r\n MyClass().meth()\r\n\r\nPrints:\r\n\r\n True\r\n\r\n**Edit:**\r\n\r\nYou can specify also `self` in your `wrapper` function (based on comments):\r\n\r\n import functools\r\n \r\n def decorate(method):\r\n @functools.wraps(method)\r\n def wrapper(self, *args, **kwargs):\r\n print(hasattr(self, &#39;a&#39;))\r\n result = method(self, *args, **kwargs)\r\n return result\r\n return wrapper\r\n \r\n class MyClass(object):\r\n def __init__(self, a=1, b=2):\r\n self.a = a\r\n self.b = b\r\n @decorate\r\n def meth(self):\r\n pass\r\n \r\n MyClass().meth()\r\n\r\nPrints also:\r\n\r\n True", "904" ], [ "No need to make code complicated, BeautifulSoup supports CSS selectors in form of methods `select()` and `select_one()` ([docs here][1]). \r\n\r\nIf you want to find ` < span > ` tag inside ` < a > ` tag with classes `biz-name` and `js-analytics-click`, use selector `&#39;_URL_1_-name.js-analytics-click span&#39;`:\r\n\r\n data = \" ; \" ; \" ; < a class= \" ;biz-name js-analytics-click \" ; data-analytics-label= \" ;biz-name \" ; data-\r\n hovercard-id= \" ;hN6KsYexY7_4VPAw0mHtMA \" ; href= \" ;/biz/szechuan-restaurant-\r\n charlottesville?osq=chinese \" ; > < span > Szechuan Restaurant < /span > < /a > \" ; \" ; \" ;\r\n \r\n from bs4 import BeautifulSoup\r\n \r\n soup = BeautifulSoup(data, &#39;lxml&#39;)\r\n print(soup.select_one(&#39;_URL_1_-name.js-analytics-click span&#39;).text)\r\n\r\nOutputs:\r\n\r\n Szechuan Restaurant\r\n\r\n\r\n [1]: _URL_0_", "1017" ], [ "You can use CSS selectors built within BeautifulSoup:\r\n\r\n data = &#39;&#39;&#39; < p > < span class= \" ;colorL \" ; > < ruby > 三重県 < rt > みえけん < /rt > < /ruby > < /span > の < span class= \" ;colorL \" ; > < ruby > 伊賀市 < rt > いがし < /rt > < /ruby > < /span > は、 < a class= \" ;dicWin \" ; href= \" ;javascript:void(0) \" ; id= \" ;id-0000 \" ; > < ruby > < span class= \" ;under \" ; > 忍者 < /span > < rt > にんじゃ < /rt > < /ruby > < /a > の < a class= \" ;dicWin \" ; href= \" ;javascript:void(0) \" ; id= \" ;id-0001 \" ; > < span class= \" ;under \" ; > ふるさと < /span > < /a > だと < ruby > 言 < rt > い < /rt > < /ruby > われています。 < /p > &#39;&#39;&#39;\r\n \r\n from bs4 import BeautifulSoup\r\n soup = BeautifulSoup(data, &#39;lxml&#39;)\r\n print(soup.select(&#39;ruby, p&#39;))\r\n\r\nThis will selects only ` < ruby > ` and ` < p > ` tags:\r\n\r\n [ < ruby > 言 < rt > い < /rt > < /ruby > , < ruby > 三重県 < rt > みえけん < /rt > < /ruby > , < ruby > 伊賀市 < rt > いがし < /rt > < /ruby > , < ruby > < span class= \" ;under \" ; > 忍者 < /span > < rt > にんじゃ < /rt > < /ruby > , < p > < span class= \" ;colorL \" ; > < ruby > 三重県 < rt > みえけん < /rt > < /ruby > < /span > の < span class= \" ;colorL \" ; > < ruby > 伊賀市 < rt > いがし < /rt > < /ruby > < /span > は、 < a class= \" ;dicWin \" ; href= \" ;javascript:void(0) \" ; id= \" ;id-0000 \" ; > < ruby > < span class= \" ;under \" ; > 忍者 < /span > < rt > にんじゃ < /rt > < /ruby > < /a > の < a class= \" ;dicWin \" ; href= \" ;javascript:void(0) \" ; id= \" ;id-0001 \" ; > < span class= \" ;under \" ; > ふるさと < /span > < /a > だと < ruby > 言 < rt > い < /rt > < /ruby > われています。 < /p > ]", "1017" ], [ "You can use builtin `vars()` to compare object&#39;s dictionaries:\r\n\r\n class Building():\r\n def __init__(self, item1, item2, item3, item4):\r\n self._item1 = item1\r\n self._item2 = item2\r\n self._item3 = []\r\n self._item3.append(item3)\r\n self._item4 = []\r\n self._item4.append(item4)\r\n \r\n def __eq__(self, building2):\r\n if not isinstance(building2, Building):\r\n return False\r\n return vars(self) == vars(building2)\r\n\r\n b1 = Building(1, 2, 3, 4)\r\n b2 = Building(1, 2, 3, 4)\r\n b3 = Building(1, 2, 3, 3)\r\n print(b1 == b2)\r\n print(b1 == b3)\r\n\r\nOutputs:\r\n\r\n True\r\n False", "265" ], [ "You could use CSS selector. CSS selector `[data-operator_name]` will select any tag with attribute `data-operator_name`. Example with Beautiful Soup:\r\n\r\n data = \" ; \" ; \" ; < div class= \" ;operator active \" ; data-operator_name= \" ;Etisalat \" ; data-\r\n operator_id= \" ;5 \" ; > < div class= \" ;operator_name_etisalat \" ; > < /div > < /div > \" ; \" ; \" ;\r\n \r\n from bs4 import BeautifulSoup\r\n \r\n soup = BeautifulSoup(data, &#39;lxml&#39;)\r\n \r\n print(soup.select_one(&#39;[data-operator_name]&#39;)[&#39;data-operator_name&#39;])\r\n\r\nThis will print:\r\n\r\n Etisalat\r\n\r\n**EDIT:**\r\n\r\nTo select multiple tags with attribute \" ;data-operator_name \" ;, use `.select()` method:\r\n\r\n data = \" ; \" ; \" ; < div class= \" ;operator active \" ; data-operator_name= \" ;Etisalat \" ; data-\r\n operator_id= \" ;5 \" ; > < div class= \" ;operator_name_etisalat \" ; > < /div > < /div > \" ; \" ; \" ;\r\n \r\n from bs4 import BeautifulSoup\r\n \r\n soup = BeautifulSoup(data, &#39;lxml&#39;)\r\n for tag in soup.select(&#39;[data-operator_name]&#39;):\r\n print(tag[&#39;data-operator_name&#39;])", "1017" ], [ "The function `match()` accepts a string. Inside the function you count parenthesis, if the counter is at any moment negative, it isn&#39;t match. If the counter isn&#39;t zero at the end of the line, it isn&#39;t match either. Otherwise, it&#39;s match:\r\n\r\n data = [\r\n \" ;() should be a match \" ;,\r\n \" ;(()) should be a match \" ;,\r\n \" ;((( should not be a match \" ;,\r\n \" ;)( should not match \" ;,\r\n \" ;((((()))))()should match \" ;\r\n ]\r\n \r\n import re\r\n \r\n def match(line):\r\n c = 0\r\n for p in re.findall(r&#39;[()]&#39;, line):\r\n if p == &#39;(&#39;:\r\n c += 1\r\n elif p == &#39;)&#39;:\r\n c -= 1\r\n \r\n if c < 0:\r\n return False\r\n \r\n if c != 0:\r\n return False\r\n \r\n return True\r\n \r\n for line in data:\r\n print(&#39;[{}] - [{}]&#39;.format(line, match(line)))\r\n\r\nOutput:\r\n\r\n [() should be a match] - [True]\r\n [(()) should be a match ] - [True]\r\n [((( should not be a match ] - [False]\r\n [)( should not match ] - [False]\r\n [((((()))))()should match] - [True]", "615" ], [ "Your code is OK, but with `soup.contents` you are selecting root ` < html > ` tag and some plain `NavigableString` objects, whose names are `None`. Try to select some tags inside the soup, e.g. selecting all `h3`:\r\n\r\n for item in soup.select(&#39;h3&#39;):\r\n print(item.text)\r\n\r\nWill print:\r\n\r\n Name&#182;\r\n Attributes&#182;\r\n tag的名字&#182;\r\n .contents 和 .children&#182;\r\n .descendants&#182;\r\n .string&#182;\r\n .strings 和 stripped_strings&#182;\r\n .parent&#182;\r\n .parents&#182;\r\n .next_sibling 和 .previous_sibling&#182;\r\n .next_siblings 和 .previous_siblings&#182;\r\n .next_element 和 .previous_element&#182;\r\n .next_elements 和 .previous_elements&#182;\r\n 字符串&#182;\r\n 正则表达式&#182;\r\n 列表&#182;\r\n True&#182;\r\n 方法&#182;\r\n name 参数&#182;\r\n keyword 参数&#182;\r\n 按CSS搜索&#182;\r\n string 参数&#182;\r\n limit 参数&#182;\r\n recursive 参数&#182;\r\n 智能引号&#182;\r\n 矛盾的编码&#182;\r\n 需要的解析器&#182;\r\n 方法名的变化&#182;\r\n 生成器&#182;\r\n XML&#182;\r\n 实体&#182;\r\n 迁移杂项&#182;\r\n\r\nEdit:\r\n\r\nTo check if ` < div > ` tag has any child, whose name is not `div`, you could use lambda function:\r\n\r\n for div_tag in soup.find_all(&#39;div&#39;):\r\n if div_tag.find(lambda t: _URL_0_ != &#39;div&#39;):\r\n print(div_tag.text)\r\n print(&#39;-&#39; * 80)\r\n\r\nEDIT 2:\r\n\r\nTo check if ` < div > ` tag has any **direct** child, whose name is not `div`, you could use lambda function and CSS selector:\r\n\r\n for div_tag in soup.select(&#39;div > *&#39;):\r\n if div_tag.find(lambda t: _URL_0_ != &#39;div&#39;):\r\n print(div_tag.text)\r\n print(&#39;-&#39; * 80)", "1017" ], [ "To search for all ` < a > ` tags with attribute ` \" ;data-go-to-expose-id \" ;`, whose parent is ` < div > ` with class ` \" ;grouped-listing \" ;`, you can use CSS selector \r\n\r\n &#39;div.grouped-listing a[data-go-to-expose-id]&#39;\r\n\r\n, like this:\r\n\r\n data = \" ; \" ; \" ;\r\n < ul id= \" ;resultListItems \" ; class= \" ;is24-res-list is24-res-gallery result-list border-top \" ; > \r\n < li class= \" ;result-list__listing result-list__listing--xl \" ; data-id= \" ;102292896 \" ; > \r\n < div > \r\n < article data-item= \" ;result \" ; id= \" ;result-102292896 \" ; data-obid= \" ;102292896 \" ; class= \" ;result-list-entry result-list-entry--xl result-list-entry--project result-list-entry--with-logo \" ; data-listing-size= \" ;XL \" ; > \r\n < div class= \" ;result-list-entry__grouped-listings \" ; > \r\n < div class= \" ;slick-initialized slick-slider \" ; > \r\n < div aria-live= \" ;polite \" ; class= \" ;slick-list draggable \" ; > \r\n < div class= \" ;slick-track \" ; style= \" ;opacity: 1; width: 356px; transform: translate3d(0px, 0px, 0px); \" ; > \r\n < div class= \" ;grouped-listing slick-slide slick-current slick-active grouped-listing--active \" ; style= \" ;width: 162px; \" ; data-slick-index= \" ;0 \" ; aria-hidden= \" ;false \" ; > \r\n < a href= \" ;/expose/102292896 \" ; id= \" ;result-102292896 \" ; data-go-to-expose-id= \" ;102292896 \" ; data-go-to-expose-referrer= \" ;RESULT_LIST_GROUPED \" ; > \r\n \" ; \" ; \" ;\r\n \r\n \r\n from bs4 import BeautifulSoup\r\n \r\n soup = BeautifulSoup(data, &#39;lxml&#39;)\r\n \r\n for a in soup.select(&#39;div.grouped-listing a[data-go-to-expose-id]&#39;):\r\n my_url2 = \" ;_URL_0_[&#39;data-go-to-expose-id&#39;]+ \" ;#/ \" ;\r\n print(my_url2)\r\n\r\nThis prints:\r\n\r\n _URL_1_", "1017" ], [ "For parsing HTML use `beautifulsoup` package. That way you can select elements of your html document with ease. To print all text within ` < span > ` tags, you can use this example:\r\n\r\n data = \" ; \" ; \" ;\r\n < div id= \" ;menu \" ; > \r\n < h4 style= \" ;display:none \" ; > Horse Photo < /h4 > \r\n < ul style= \" ;margin-top:5px;border-radius:6px \" ; > \r\n < li style= \" ;padding:0 \" ; > \r\n < img src= \" ;/images/unknown_horse.png \" ; style= \" ;width:298px;margin-bottom:-3px;border-radius:5px; \" ; > \r\n < /li > \r\n < /ul > \r\n < h4 > Horse Profile < /h4 > \r\n < ul > \r\n < li > Age < span > 3yo < /span > < /li > \r\n < li > Foaled < span > 17/11/2014 < /span > < /li > \r\n < li > Country < span > New Zealand < /span > < /li > \r\n < li > Location < span > <PERSON> < /span > < /li > \r\n < li > Sex < span > Filly < /span > < /li > \r\n < li > Colour < span > Grey < /span > < /li > \r\n < li > Sire < span > Mastercraftsman < /span > < /li > \r\n < li > Dam < span > In Essence < /span > < /li > \r\n < li > Trainer\r\n < span > \r\n < a href= \" ;/trainer/26970-r-l-price/ \" ; > R & amp; L Price < /a > \r\n < /span > \r\n < /li > \r\n < li > Earnings < span > $19,795 < /span > < /li > \r\n < /ul > \r\n < h4 > Owners < /h4 > \r\n < ul > \r\n < li style= \" ;font:normal 12px &#39;Tahoma \" ; > Bell View Park Stud (Mgr: <PERSON>) < /li > \r\n < /ul > \r\n < /div > \r\n \" ; \" ; \" ;\r\n \r\n \r\n from bs4 import BeautifulSoup\r\n \r\n soup = BeautifulSoup(data, &#39;lxml&#39;)\r\n \r\n for li in soup.select(&#39;span&#39;):\r\n if li.text.strip() == &#39;&#39;:\r\n continue\r\n print(li.text)\r\n\r\nWill print:\r\n\r\n 3yo\r\n 17/11/2014\r\n New Zealand\r\n Kembla Grange\r\n Filly\r\n Grey\r\n Mastercraftsman\r\n In Essence\r\n \r\n R & L Price\r\n \r\n $19,795", "1017" ], [ "You can use `Counter` from `collections`:\r\n\r\n from collections import Counter\r\n from pprint import pprint\r\n \r\n foo = [\r\n {&#39;color&#39;: &#39;yellow&#39;, &#39;type&#39;: &#39;foo&#39;},\r\n {&#39;color&#39;: &#39;yellow&#39;, &#39;type&#39;: &#39;bar&#39;},\r\n {&#39;color&#39;: &#39;red&#39;, &#39;type&#39;: &#39;foo&#39;},\r\n {&#39;color&#39;: &#39;red&#39;, &#39;type&#39;: &#39;foo&#39;},\r\n {&#39;color&#39;: &#39;green&#39;, &#39;type&#39;: &#39;foo&#39;},\r\n {&#39;color&#39;: &#39;red&#39;, &#39;type&#39;: &#39;bar&#39;}\r\n ]\r\n \r\n c = Counter( tuple( (i[&#39;color&#39;], i[&#39;type&#39;]) for i in foo))\r\n pprint([{&#39;color&#39;: k[0], &#39;type&#39;: k[1], &#39;count&#39;: v} for k, v in c.items()])\r\n\r\nOutput:\r\n\r\n [{&#39;color&#39;: &#39;yellow&#39;, &#39;count&#39;: 1, &#39;type&#39;: &#39;foo&#39;},\r\n {&#39;color&#39;: &#39;yellow&#39;, &#39;count&#39;: 1, &#39;type&#39;: &#39;bar&#39;},\r\n {&#39;color&#39;: &#39;red&#39;, &#39;count&#39;: 2, &#39;type&#39;: &#39;foo&#39;},\r\n {&#39;color&#39;: &#39;green&#39;, &#39;count&#39;: 1, &#39;type&#39;: &#39;foo&#39;},\r\n {&#39;color&#39;: &#39;red&#39;, &#39;count&#39;: 1, &#39;type&#39;: &#39;bar&#39;}]\r\n\r\nEdit:\r\n\r\nIf you want to sort the new list, you can do something like this:\r\n\r\n l = sorted(newFoo, key=lambda v: (v[&#39;color&#39;], v[&#39;type&#39;]), reverse=True)\r\n pprint(l)\r\n\r\nWill print:\r\n\r\n [{&#39;color&#39;: &#39;yellow&#39;, &#39;count&#39;: 1, &#39;type&#39;: &#39;foo&#39;},\r\n {&#39;color&#39;: &#39;yellow&#39;, &#39;count&#39;: 1, &#39;type&#39;: &#39;bar&#39;},\r\n {&#39;color&#39;: &#39;red&#39;, &#39;count&#39;: 2, &#39;type&#39;: &#39;foo&#39;},\r\n {&#39;color&#39;: &#39;red&#39;, &#39;count&#39;: 1, &#39;type&#39;: &#39;bar&#39;},\r\n {&#39;color&#39;: &#39;green&#39;, &#39;count&#39;: 1, &#39;type&#39;: &#39;foo&#39;}]\r\n\r\nEdit:\r\n\r\nThanks to @MadPhysicist, you can generalize the above example:\r\n\r\n \r\n c = Counter(tuple(item for item in i.items()) for i in foo)\r\n pprint([{**dict(k), &#39;count&#39;: v} for k, v in c.items()])", "761" ], [ "Using one example how to set environment variables from _URL_0_:\r\n\r\nYou can have script, which sets environment variable in parent shell:\r\n\r\n import pipes\r\n import os\r\n value = int(os.environ[&#39;MY_COUNTER&#39;]) + 1 if &#39;MY_COUNTER&#39; in os.environ else 1\r\n print( \" ;export MY_COUNTER=%s \" ; % (pipes.quote(str(value))))\r\n\r\nand run this script with command:\r\n\r\n eval $(python _URL_1_)\r\n\r\nThen each run will increment `MY_COUNTER` by 1.\r\n\r\nOf course, this environment variable will not persists, it&#39;s only in memory.", "191" ], [ "In your function `fetch_name()` you are adding to the array empty strings (on pages without any name, the ` < ul class= \" ;arrow \" ; > ` is empty string). With simple if you can filter it away, this will print all names without spaces:\r\n\r\n from urllib.request import urlopen\r\n from bs4 import BeautifulSoup as bS\r\n import re\r\n \r\n # get the internals links\r\n \r\n def get_internals():\r\n array=[]\r\n html = urlopen( \" ;_URL_0_;)\r\n soup = bS(html, \" ;lxml \" ;)\r\n azlinks = soup.find( \" ;nav \" ;, { \" ;class \" ;: \" ;page-nav \" ;}).findAll( \" ;a \" ;, { \" ;href \" ;:re.compile( \" ;^p.*$ \" ;)})\r\n for links in azlinks:\r\n array.append(links.attrs[&#39;href&#39;])\r\n return array\r\n \r\n # The function for fetching the names\r\n \r\n def fetch_name(url):\r\n array=[]\r\n html = urlopen( \" ;_URL_1_)\r\n soup = bS(html, \" ;lxml \" ;)\r\n for child in soup.findAll( \" ;ul \" ;, { \" ;class \" ;: \" ;arrow \" ;}):\r\n if not child.text.strip():\r\n break\r\n array.append(child.text.strip())\r\n return array\r\n \r\n alpha_array = get_internals()\r\n \r\n first_names=[]\r\n for links in alpha_array:\r\n first_names += (fetch_name(links))\r\n \r\n for names in first_names:\r\n print(names)", "1017" ], [ "Supposing ListA and ListB are sorted:\r\n\r\n ListA = [&#39;Jan 2018&#39;, &#39;Feb 2018&#39;, &#39;Mar 2018&#39;]\r\n ListB = [&#39;Sales Jan 2018&#39;,&#39;Units sold Jan 2018&#39;,&#39;Sales Feb 2018&#39;,&#39;Units sold Feb 2018&#39;,&#39;Sales Mar 2018&#39;,&#39;Units sold Mar 2018&#39;]\r\n \r\n print([v1 + \" ; \" ; + v2 for v1, v2 in zip(ListA, [v1 + \" ; \" ; + v2 for v1, v2 in zip(ListB[::2], ListB[<IP_ADDRESS><IP_ADDRESS>2], ListB[1::2])])])\r\n\r\nThis will print:\r\n\r\n [&#39;Jan 2018 Sales Jan 2018 Units sold Jan 2018&#39;, &#39;Feb 2018 Sales Feb 2018 Units sold Feb 2018&#39;, &#39;Mar 2018 Sales Mar 2018 Units sold Mar 2018&#39;]\r\n\r\nIn my example I firstly concatenate ListB variables together and then join ListA with this new list.", "319" ], [ "In your example `soup.find_all(&#39;doc&#39;)` will return all elements < doc > in the form of list. You need to iterate this list to find information you want.\r\n\r\nIf you want to extract specific tags inside ` < doc > ` tag, you can do it in various ways. I use CSS selectors, e.g. `soup.select(&#39;doc str[name= \" ;id \" ;]&#39;)` will select all ` < str > ` tags with attribute `name= \" ;id \" ;` which are inside ` < doc > ` tag:\r\n\r\n data = \" ; \" ; \" ; < doc > \r\n < str name= \" ;id \" ; > 1 < /str > \r\n < str name= \" ;version \" ; > 20110601 < /str > \r\n < arr name= \" ;access \" ; > < /arr > \r\n < arr name= \" ;cf_standard_name \" ; > < /arr > < arr name= \" ;cmor_table \" ; > \r\n < str name= \" ;instance_id \" ; > < /str > \r\n < /doc > \r\n \r\n < doc > \r\n < str name= \" ;id \" ; > 2 < /str > \r\n < str name= \" ;version \" ; > 20110602 < /str > \r\n < arr name= \" ;access \" ; > < /arr > \r\n < arr name= \" ;cf_standard_name \" ; > < /arr > < arr name= \" ;cmor_table \" ; > \r\n < str name= \" ;instance_id \" ; > < /str > \r\n < /doc > \r\n \r\n < doc > \r\n < str name= \" ;id \" ; > 3 < /str > \r\n < str name= \" ;version \" ; > 20110603 < /str > \r\n < arr name= \" ;access \" ; > < /arr > \r\n < arr name= \" ;cf_standard_name \" ; > < /arr > < arr name= \" ;cmor_table \" ; > \r\n < str name= \" ;instance_id \" ; > < /str > \r\n < /doc > \r\n \" ; \" ; \" ;\r\n \r\n from bs4 import BeautifulSoup\r\n from pprint import pprint\r\n \r\n soup = BeautifulSoup(data, &#39;lxml&#39;)\r\n \r\n all_ids = [tag.text for tag in soup.select(&#39;doc str[name= \" ;id \" ;]&#39;)]\r\n all_versions = [tag.text for tag in soup.select(&#39;doc str[name= \" ;version \" ;]&#39;)]\r\n \r\n pprint([*zip(all_ids, all_versions)])\r\n\r\nThis example prints:\r\n\r\n [(&#39;1&#39;, &#39;20110601&#39;), (&#39;2&#39;, &#39;20110602&#39;), (&#39;3&#39;, &#39;20110603&#39;)]", "1017" ], [ "You can use BeautifulSoup for parsing/modifying XML documents. This example will fill all tags with zero content and insert empty string to them - effectively expanding ` < tag/ > ` to ` < tag > < /tag > `:\r\n\r\n data = \" ; \" ; \" ; < TRANSFORMATION > \r\n < ID_RSSD_PREDECESSOR > 28 < /ID_RSSD_PREDECESSOR > < ID_RSSD_SUCCESSOR > 75026 < /ID_RSSD_SUCCESSOR > \r\n < D_DT_TRANS/ > \r\n < /TRANSFORMATION > \" ; \" ; \" ;\r\n \r\n from bs4 import BeautifulSoup\r\n \r\n xml_data = BeautifulSoup(data, &#39;xml&#39;)\r\n \r\n for tag in xml_data.find_all(lambda t: len(t.contents) == 0):\r\n tag.string = \" ; \" ;\r\n \r\n print(xml_data.prettify())\r\n\r\nThis will print:\r\n\r\n < ?xml version= \" ;1.0 \" ; encoding= \" ;utf-8 \" ;? > \r\n < TRANSFORMATION > \r\n < ID_RSSD_PREDECESSOR > \r\n 28\r\n < /ID_RSSD_PREDECESSOR > \r\n < ID_RSSD_SUCCESSOR > \r\n 75026\r\n < /ID_RSSD_SUCCESSOR > \r\n < D_DT_TRANS > \r\n < /D_DT_TRANS > \r\n < /TRANSFORMATION >", "1017" ], [ "You can use builtin `zip()` function (this example is using f-string for concatenating the strings inside the lists):\r\n\r\n ol=[( \" ;a \" ;, \" ;b \" ;, \" ;c \" ;),( \" ;A \" ;, \" ;B \" ;, \" ;C \" ;)]\r\n print([f&#39;{a}{b}&#39; for a, b in zip(*ol)])\r\n\r\nOutput:\r\n\r\n [&#39;aA&#39;, &#39;bB&#39;, &#39;cC&#39;]\r\n\r\nThe asterisk `*` in the `zip` will expands the iterable, so you don&#39;t have to index it by hand.\r\n\r\nTo make it universal and concatenate multiple values, you can use this script:\r\n\r\n ol=[( \" ;a \" ;, \" ;b \" ;, \" ;c \" ;),( \" ;A \" ;, \" ;B \" ;, \" ;C \" ;), (1, 2, 3), (&#39;!&#39;, &#39;@&#39;, &#39;#&#39;)]\r\n print([(&#39;{}&#39; * len(ol)).format(*v) for v in zip(*ol)])\r\n\r\nWill print:\r\n\r\n [&#39;aA1!&#39;, &#39;bB2@&#39;, &#39;cC3#&#39;]", "761" ], [ "For avoiding exhausting checks, you need to restructure your code to smaller parts and introduce control structures, such as `while`.\r\n\r\nIn my example I created two functions `get_data_set()` and `check_months()`.\r\n\r\nFunction `get_data_set()` loops infinitely, until the input is correct. That means the number of words is divisible by 4 and every 4th word is a months name.\r\n\r\nFunction `check_months()` has one argument - `data_set` and checks it if every 4th word is month. If it is, returns `True`, in not `False`.\r\n\r\nExample is bellow:\r\n\r\n import re\r\n \r\n def get_data_set():\r\n while True:\r\n data_input = input( \" ;Please input data.\\n \" ;)\r\n data_set = re.sub(r \" ;[^\\w] \" ;, \" ; \" ;, data_input).split()\r\n if len(data_set) % 4 != 0:\r\n print( \" ;That\\&#39;s not a valid input. For formatting help, type \\&#39;help\\&#39;.&#39; \" ;)\r\n continue\r\n if check_months(data_set) == False:\r\n print( \" ;That\\&#39;s not a valid input.&#39; \" ;)\r\n continue\r\n return data_set\r\n \r\n def check_months(data_set):\r\n for word in data_set[::4]:\r\n if word not in ( \" ;<PERSON> \" ;, \" ;FEB \" ;, \" ;<PERSON> \" ;, \" ;<PERSON> \" ;, \" ;MAY \" ;, \" ;<PERSON> \" ;, \" ;<PERSON> \" ;, \" ;<PERSON> \" ;, \" ;<PERSON> \" ;, \" ;OCT \" ;, \" ;<PERSON> \" ;, \" ;<PERSON><IP_ADDRESS>4]:\r\n if word not in ( \" ;JAN \" ;, \" ;FEB \" ;, \" ;MAR \" ;, \" ;APR \" ;, \" ;MAY \" ;, \" ;JUN \" ;, \" ;JUL \" ;, \" ;AUG \" ;, \" ;SEP \" ;, \" ;OCT \" ;, \" ;NOV \" ;, \" ;DEC \" ;):\r\n return False\r\n return True\r\n \r\n data_set = get_data_set()\r\n print(&#39;Valid data set!&#39;)\r\n print(data_set)\r\n\r\nOutput:\r\n\r\n Please input data.\r\n JUL ENT 20 K AUG SAL 2 M MAR OTR 200 K\r\n Valid data set!\r\n [&#39;JUL&#39;, &#39;ENT&#39;, &#39;20&#39;, &#39;K&#39;, &#39;AUG&#39;, &#39;SAL&#39;, &#39;2&#39;, &#39;M&#39;, &#39;MAR&#39;, &#39;OTR&#39;, &#39;200&#39;, &#39;K&#39;]", "926" ], [ "The `datetime` class support arithmetic operations (you can do `+`, `-`, etc.). If you combine it with `timedelta`, you can **get all days** between `start_date` and `end_date`. Then searching for first day of month is easy:\r\n\r\n import datetime\r\n start_date= datetime.datetime.strptime(&#39;2017-10-25&#39;, \" ;%Y-%m-%d \" ;).date()\r\n end_date= datetime.datetime.strptime(&#39;2018-03-28&#39;, \" ;%Y-%m-%d \" ;).date()\r\n \r\n delta = end_date - start_date\r\n \r\n first_days_of_month = []\r\n for i in range(delta.days + 1):\r\n d = start_date + datetime.timedelta(i)\r\n if d.day == 1:\r\n first_days_of_month.append(d)\r\n \r\n print(&#39;start date =&#39;, start_date)\r\n print(&#39;end date =&#39;, end_date)\r\n for d in first_days_of_month:\r\n print(d, end=&#39; &#39;)\r\n print()\r\n\r\nPrints:\r\n\r\n start date = 2017-10-25\r\n end date = 2018-03-28\r\n 2017-11-01 2017-12-01 2018-01-01 2018-02-01 2018-03-01", "956" ], [ "The data is loaded dynamically through Ajax - the page itself doesn&#39;t contain any data.\r\n\r\nYou need to extract SKU (product number) from the main page and then call API located at _URL_0_ for JSON data (you can see all requests that the page is doing in Firefox/Chrome network inspector):\r\n\r\n from bs4 import BeautifulSoup\r\n import requests\r\n import json\r\n \r\n product_url = \" ;_URL_0_catalog_system/pub/products/search/?fq=productId:{} \" ;\r\n url = \" ;_URL_1_;\r\n \r\n r = requests.get(url)\r\n soup = BeautifulSoup(r.text, &#39;lxml&#39;)\r\n sku = soup.select_one(&#39;meta[itemprop= \" ;sku \" ;]&#39;)[&#39;content&#39;]\r\n data_json = json.loads(requests.get(product_url.format(sku)).text)\r\n \r\n for p in data_json:\r\n print(p[&#39;description&#39;])\r\n # print(json.dumps(data_json, indent=4)) # this will print all data about the product\r\n\r\nOutput:\r\n\r\n O arroz integral faz parte da linha de produtos naturais da Camil. &#201; saud&#225;vel, pr&#225;tico e gostoso. Melhor que saborear um prato delicioso &#233; fazer isso com sa&#250;de!\r\n\r\nEDIT:\r\n\r\nAlternatively you can get description from ` < meta itemprop= \" ;description \" ; > `, but I&#39;m not sure if the description is complete in this tag:\r\n\r\n url = \" ;_URL_1_;\r\n \r\n r = requests.get(url)\r\n soup = BeautifulSoup(r.text, &#39;lxml&#39;)\r\n print(soup.select_one(&#39;meta[itemprop= \" ;description \" ;]&#39;)[&#39;content&#39;])\r\n\r\nPrints:\r\n\r\n O arroz integral faz parte da linha de produtos naturais da Camil. &#201; saud&#225;vel, pr&#225;tico e gostoso. Melhor que saborear um prato delicioso &#233; fazer isso com sa&#250;de!", "1017" ], [ "You can use `zip()` and BeautifulSoup&#39;s CSS selector to combine tags you are looking for (e.g. `svg.select(&#39;[x1]&#39;)` will find all tags with `x1` attribute):\r\n\r\n from bs4 import BeautifulSoup\r\n import requests\r\n \r\n url = &#39;_URL_0_;\r\n r = requests.get(url)\r\n soup = BeautifulSoup(r.text, &#39;lxml&#39;)\r\n \r\n svg = soup.select_one(&#39;svg#pitch&#39;)\r\n \r\n info = []\r\n for x1, y1, x2, y2 in zip(svg.select(&#39;[x1]&#39;), svg.select(&#39;[y1]&#39;), svg.select(&#39;[x2]&#39;), svg.select(&#39;[y2]&#39;)):\r\n info.append((x1[&#39;x1&#39;], y1[&#39;y1&#39;], x2[&#39;x2&#39;], y2[&#39;y2&#39;]))\r\n \r\n for i, (x1, y1, x2, y2) in enumerate(info):\r\n print( \" ;line={}:\\tx1={} y1={} x2={} y2={} \" ;.format(i+1, x1, y1, x2, y2))\r\n\r\nThis prints coordinates for each line found in the SVG:\r\n\r\n line=1:\tx1=393.52 y1=234.79 x2=373.76 y2=157.941\r\n line=2:\tx1=283.28 y1=193.97 x2=338.4 y2=<PHONE_NUMBER>\r\n line=3:\tx1=250 y1=476.57 x2=267.68 y2=435.75\r\n line=4:\tx1=176.16 y1=283.46 x2=190.72 y2=270.9\r\n line=5:\tx1=358.16 y1=277.18 x2=417.44 y2=133.469\r\n line=6:\tx1=238.56 y1=299.16 x2=312.4 y2=258.34\r\n line=7:\tx1=252.08 y1=291.31 x2=340.48 y2=192.4", "1017" ], [ "To select tag that contains all specified classes, you can use BeautifulSoup&#39;s `select()` method.\r\n\r\n`soup.select(&#39;div#rezultatipretrage div.listitem.artikal.obicniArtikal.imaHover-disabled.i.index&#39;)` will select all ` < div > ` tags with class `listitem artikal obicniArtikal imaHover-disabled i index` that are under ` < div > ` tag with `id= \" ;rezultatipretrage \" ;`:\r\n\r\n from bs4 import BeautifulSoup\r\n import requests\r\n \r\n r = requests.get(&#39;_URL_0_;, timeout=5)\r\n soup = BeautifulSoup(r.text, &#39;lxml&#39;)\r\n \r\n all_items = soup.select(&#39;div#rezultatipretrage div.listitem.artikal.obicniArtikal.imaHover-disabled.i.index&#39;)\r\n \r\n for item in all_items:\r\n print(item.p.text)\r\n print(&#39;-&#39; * 80)\r\n\r\nWill print:\r\n\r\n VW Golf 6 2.0 TDI XENON-NAVI-KAMERA-KOZA\r\n --------------------------------------------------------------------------------\r\n Golf 5 2.0 tdi. Sport line. bosch dizne\r\n --------------------------------------------------------------------------------\r\n VW GOLF 7 2.0 TDI DSG , ID: 086\r\n --------------------------------------------------------------------------------\r\n VW GOLF 5 2.0 TDI, 2005 god. Registrovan\r\n --------------------------------------------------------------------------------\r\n Golf 5 2.0 DIZEL SDI TEK REGISTROVAN\r\n --------------------------------------------------------------------------------\r\n Volkswagen Golf 6 2.0 TDI GTI-GTD-R LINE\r\n --------------------------------------------------------------------------------\r\n VW GOLF 5,2.0 TDI,103 KW,04 G.P,6 BRZ.MOTOR U KVARU\r\n --------------------------------------------------------------------------------\r\n Golf 6 2.0 TDI\r\n --------------------------------------------------------------------------------\r\n VW GOLF 7 2.0tdi 110kw 150ks mod 2014g\r\n --------------------------------------------------------------------------------\r\n Golf 2 1.6Dizel reg do 12 2018god\r\n --------------------------------------------------------------------------------\r\n VW Golf 2.0 ekstra stanje\r\n --------------------------------------------------------------------------------\r\n Golf 2 DIZEL 4 VRATA\r\n --------------------------------------------------------------------------------\r\n Golf 2\r\n --------------------------------------------------------------------------------\r\n VW GOLF 5 V 2.0 TDI CLIMATRONIC\r\n --------------------------------------------------------------------------------", "1017" ], [ "You can combine data from two URLs and create virtual csv file (you can then supply the created csv file to dataframe or otherwise process it):\r\n\r\n import requests\r\n import re\r\n import csv\r\n from io import StringIO # for Python2 use: from StringIO import StringIO\r\n \r\n data_1 = requests.get(&#39;_URL_0_;).text\r\n data_2 = requests.get(&#39;_URL_1_;).text\r\n \r\n row_names = re.findall(r&#39;\\d+\\.\\s+([a-z]+)&#39;, data_2)\r\n f = StringIO(&#39;,&#39;.join(&#39; \" ;{} \" ;&#39;.format(v) for v in row_names) + &#39;\\n&#39; + data_1)\r\n \r\n cr = csv.reader(f, delimiter=&#39;,&#39;) # cr is your created csv file\r\n\r\n for row in cr:\r\n print(row)\r\n\r\nOutputs:\r\n\r\n [&#39;mcv&#39;, &#39;alkphos&#39;, &#39;sgpt&#39;, &#39;sgot&#39;, &#39;gammagt&#39;, &#39;drinks&#39;, &#39;selector&#39;]\r\n [&#39;85&#39;, &#39;92&#39;, &#39;45&#39;, &#39;27&#39;, &#39;31&#39;, &#39;0.0&#39;, &#39;1&#39;]\r\n [&#39;85&#39;, &#39;64&#39;, &#39;59&#39;, &#39;32&#39;, &#39;23&#39;, &#39;0.0&#39;, &#39;2&#39;]\r\n [&#39;86&#39;, &#39;54&#39;, &#39;33&#39;, &#39;16&#39;, &#39;54&#39;, &#39;0.0&#39;, &#39;2&#39;]\r\n [&#39;91&#39;, &#39;78&#39;, &#39;34&#39;, &#39;24&#39;, &#39;36&#39;, &#39;0.0&#39;, &#39;2&#39;]\r\n [&#39;87&#39;, &#39;70&#39;, &#39;12&#39;, &#39;28&#39;, &#39;10&#39;, &#39;0.0&#39;, &#39;2&#39;]\r\n [&#39;98&#39;, &#39;55&#39;, &#39;13&#39;, &#39;17&#39;, &#39;17&#39;, &#39;0.0&#39;, &#39;2&#39;]\r\n [&#39;88&#39;, &#39;62&#39;, &#39;20&#39;, &#39;17&#39;, &#39;9&#39;, &#39;0.5&#39;, &#39;1&#39;]\r\n [&#39;88&#39;, &#39;67&#39;, &#39;21&#39;, &#39;11&#39;, &#39;11&#39;, &#39;0.5&#39;, &#39;1&#39;]\r\n [&#39;92&#39;, &#39;54&#39;, &#39;22&#39;, &#39;20&#39;, &#39;7&#39;, &#39;0.5&#39;, &#39;1&#39;]\r\n\r\n ...and so on.", "288" ], [ "The page isn&#39;t very scrapping friendly, so you can use trial and error method until you get your results right. My attempt is here (I substituted missing values for ` \" ;- \" ;`, at least it won&#39;t throw ValueError but you need to check if it scrapes correct info):\r\n\r\n from bs4 import BeautifulSoup as bs\r\n from requests import get\r\n import re\r\n from pprint import pprint\r\n \r\n \r\n def getHTML(link, counter):\r\n return bs(get(link.format(counter)).content, \" ;html.parser \" ;)\r\n \r\n PAGE_URL = &#39;_URL_3_;\r\n CAR_URL = &#39;_URL_0_{}&#39;\r\n \r\n # car_id = &#39;mazda-3-sedan-auto-<PHONE_NUMBER>&#39;\r\n car_id = &#39;nissan-nv200-1-5-manual-182141686&#39;\r\n # car_id = &#39;toyota-corolla-axio-1-5-auto-x-177344405&#39;\r\n \r\n car = {}\r\n content = getHTML(CAR_URL, car_id).find(&#39;div&#39;, {&#39;class&#39;: &#39;aG-c aG-b&#39;})\r\n car[&#39;Model&#39;] = content.find(&#39;p&#39;, {&#39;class&#39;: &#39;cU-b cU-e&#39;}).text\r\n \r\n data = []\r\n for p in content.select(&#39;_URL_2_-h _URL_1_-d&#39;)[:4]:\r\n if re.match(r&#39;\\d+\\s+Likes&#39;, p.text):\r\n break\r\n data.append(p.text)\r\n \r\n car[&#39;Post&#39;], car[&#39;Price&#39;], car[&#39;Deprec&#39;], car[&#39;Regstr_Date&#39;], *_ = data + [&#39;-&#39;] * 4\r\n \r\n # swap Deprec and Registration Date?\r\n if car[&#39;Deprec&#39;] != &#39;-&#39; and &#39;$&#39; not in car[&#39;Deprec&#39;]:\r\n car[&#39;Regstr_Date&#39;], car[&#39;Deprec&#39;] = car[&#39;Deprec&#39;], car[&#39;Regstr_Date&#39;]\r\n \r\n pprint(car)\r\n\r\nPrints for this car:\r\n\r\n {&#39;Deprec&#39;: &#39;-&#39;,\r\n &#39;Model&#39;: &#39;Nissan NV200 1.5 Manual&#39;,\r\n &#39;Post&#39;: &#39;an hour ago by rubberr&#39;,\r\n &#39;Price&#39;: &#39;S$25,800&#39;,\r\n &#39;Regstr_Date&#39;: &#39;-&#39;}", "1017" ], [ "You need to only select all ` < div > ` with `listitem` class, to get all items from page, not only featured cars. \r\n\r\nI made few changes and checks to your code to successfully scrape all 30 pages (I put ` \" ;- \" ;` as default value to some fields, so check your result if it&#39;s correct):\r\n\r\n from bs4 import BeautifulSoup\r\n import requests\r\n from pprint import pprint\r\n \r\n res = []\r\n for i in range(30):\r\n r = requests.get(&#39;_URL_0_ str(i))\r\n soup = BeautifulSoup(r.text, &#39;lxml&#39;)\r\n \r\n all_items = soup.select(&#39;div#rezultatipretrage div.listitem&#39;)\r\n \r\n for item in all_items:\r\n \r\n if not item.find(&#39;p&#39;, class_=&#39;na&#39;):\r\n continue\r\n \r\n naziv = item.find(&#39;p&#39;, class_=&#39;na&#39;).text\r\n link = item.a[&#39;href&#39;]\r\n lokacija = item.find(&#39;div&#39;, class_=&#39;lokacijadiv&#39;).text.strip()\r\n godiste = item.find(&#39;span&#39;, class_=&#39;desnopolje&#39;).text if item.find(&#39;span&#39;, class_=&#39;desnopolje&#39;) else &#39;-&#39;\r\n try:\r\n gorivo = item.find_all(&#39;p&#39;, class_=&#39;polje&#39;)[1].find(&#39;span&#39;, class_=&#39;desnopolje&#39;).text\r\n except IndexError:\r\n gorivo = &#39;-&#39;\r\n \r\n if item.find(&#39;div&#39;, class_=&#39;cijena&#39;).span.text == &#39;PO DOGOVORU&#39;:\r\n cijena = &#39;PO DOGOVORU&#39;\r\n else:\r\n cijena = item.find(&#39;div&#39;, class_=&#39;cijena&#39;).span.contents[-1][:-2].strip()\r\n <PERSON> = int(cijena.replace(&#39;.&#39;,&#39;&#39;))\r\n \r\n <PERSON> = item.find(&#39;div&#39;, class_=&#39;stanje k&#39;).text.strip() if item.find(&#39;div&#39;, class_=&#39;stanje k&#39;) else &#39;-&#39;\r\n datum = item.find(&#39;div&#39;, class_=&#39;kada&#39;).text\r\n \r\n res.append((naziv, link, lokacija, godiste, gorivo, cijena, stanje, datum))\r\n \r\n pprint(res)\r\n\r\nThis prints all info from 30 pages:\r\n\r\n [(&#39;VW GOLF 5 2.0 TDI, 2005 god. Registrovan&#39;,\r\n &#39;_URL_3_;,\r\n &#39;Živinice&#39;,\r\n &#39;2005&#39;,\r\n &#39;Dizel&#39;,\r\n 8400,\r\n &#39;KORIŠTENO&#39;,\r\n &#39;Prije 4 dana&#39;),\r\n (&#39;VW GOLF 2 DIZEL TEK REGISTROVAN&#39;,\r\n &#39;_URL_5_;,\r\n &#39;Ilijaš&#39;,\r\n &#39;1985&#39;,\r\n &#39;Dizel&#39;,\r\n 1550,\r\n &#39;KORIŠTENO&#39;,\r\n &#39;Jučer, 16:05&#39;),\r\n (&#39;Golf 5 2.0 DIZEL SDI TEK REGISTROVAN&#39;,\r\n &#39;_URL_6_;,\r\n &#39;Travnik&#39;,\r\n &#39;2004&#39;,\r\n &#39;Dizel&#39;,\r\n 7950,\r\n &#39;KORIŠTENO&#39;,\r\n &#39;Prije 5 dana&#39;),\r\n (&#39;Volkswagen Golf 6 2.0 TDI GTI-GTD-R LINE&#39;,\r\n &#39;_URL_1_;,\r\n &#39;Banja Luka&#39;,\r\n &#39;2010&#39;,\r\n &#39;Dizel&#39;,\r\n 19500,\r\n &#39;KORIŠTENO&#39;,\r\n &#39;Prije 7 dana&#39;),\r\n (&#39;VW GOLF 5,2.0 TDI,103 KW,04 G.P,6 BRZ.MOTOR U KVARU&#39;,\r\n &#39;_URL_2_;,\r\n &#39;Prnjavor&#39;,\r\n &#39;2004&#39;,\r\n &#39;Dizel&#39;,\r\n 5555,\r\n &#39;KORIŠTENO&#39;,\r\n &#39;Prije 4 dana&#39;),\r\n (&#39;VW Golf 6 2.0 TDI XENON-NAVI-KAMERA-KOZA&#39;,\r\n &#39;_URL_4_;,\r\n &#39;Banja Luka&#39;,\r\n &#39;2010&#39;,\r\n &#39;Dizel&#39;,\r\n 19500,\r\n &#39;KORIŠTENO&#39;,\r\n &#39;Prije 7 dana&#39;),\r\n\r\n ...and so on.", "1017" ], [ "Change `radius` to property and add new property `radius_log`.\r\n\r\nInside `radius` property setter you will add value to `_property_log` list in every change. This log will be exposed through `radius_log` property:\r\n\r\n import math\r\n class Circle:\r\n \" ; \" ; \" ;Class to create Circle objects \" ; \" ; \" ;\r\n \r\n def __init__(self, radius=1):\r\n \" ; \" ; \" ;Circle initializer \" ; \" ; \" ;\r\n self.radius = radius\r\n \r\n @property\r\n def radius(self):\r\n return self._radius\r\n \r\n @radius.setter\r\n def radius(self, value):\r\n self._radius = getattr(self, &#39;_radius&#39;, None)\r\n if self._radius == value:\r\n return\r\n self._radius_log = getattr(self, &#39;_radius_log&#39;, [])\r\n self._radius_log.append(value)\r\n self._radius = value\r\n \r\n @property\r\n def radius_log(self):\r\n return self._radius_log[:]\r\n \r\n @property\r\n def area(self):\r\n \" ; \" ; \" ;Calculate and return the area of the Circle \" ; \" ; \" ;\r\n return math.pi * self.radius ** 2\r\n \r\n @property\r\n def diameter(self):\r\n \" ; \" ; \" ;Calculate and return the diameter of the Circle \" ; \" ; \" ;\r\n return self.radius * 2\r\n \r\n @diameter.setter\r\n def diameter(self, diameter):\r\n \" ; \" ; \" ;Set the diameter \" ; \" ; \" ;\r\n self.radius = diameter / 2\r\n \r\n def __str__(self):\r\n return &#39;Circle of radius {}&#39;.format(self.radius)\r\n \r\n def __repr__(self):\r\n return \" ;Circle(radius={}) \" ;.format(self.radius)\r\n \r\n circle = Circle()\r\n print(circle)\r\n print(circle.radius_log) \r\n circle.radius = 2\r\n circle.diameter = 3\r\n print(circle)\r\n print(circle.radius_log) \r\n circle2 = Circle(radius=2)\r\n print(circle2.radius_log)\r\n\r\nThis prints:\r\n\r\n Circle of radius 1\r\n [1]\r\n Circle of radius 1.5\r\n [1, 2, 1.5]\r\n [2]", "834" ], [ "As you can see, the desired text is first content after ` < div class= \" ;teams \" ; > `. You can access it in BeautifulSoup with `.contents` property, which can be indexed (0 in case of first content):\r\n\r\n from bs4 import BeautifulSoup\r\n import requests\r\n \r\n r = requests.get(&#39;_URL_0_;)\r\n soup = BeautifulSoup(r.text, &#39;lxml&#39;)\r\n \r\n print(soup.select_one(&#39;div.teams&#39;).contents[0].strip())\r\n\r\nPrints:\r\n\r\n Waldstadion Frankfurt, Saturday, May 20, 2017 - 14:30\r\n\r\nEDIT:\r\n\r\nTo parse the string for place, date, time you can use regular expression:\r\n\r\n from bs4 import BeautifulSoup\r\n import requests\r\n import re\r\n \r\n r = requests.get(&#39;_URL_0_;)\r\n soup = BeautifulSoup(r.text, &#39;lxml&#39;)\r\n \r\n data = soup.select_one(&#39;div.teams&#39;).contents[0].strip()\r\n \r\n place, date, time = re.search(r&#39;(.*?)(?:,.*?)((?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Dec)\\s+\\d+,\\s+\\d+).*?(\\d+:\\d+)&#39;, data).groups()\r\n print(place)\r\n print(date)\r\n print(time)\r\n\r\nThis will print:\r\n\r\n Waldstadion Frankfurt\r\n May 20, 2017\r\n 14:30\r\n\r\nExplanation of this regular expression is [here][1].\r\n\r\n\r\n [1]: _URL_1_", "1017" ], [ "You can use builtin CSS selector within BeautifulSoup:\r\n\r\n data = \" ; \" ; \" ; < div id= \" ;6 \" ; class= \" ;post has-profile bg2 \" ; > some text 1 < /div > \r\n < div id= \" ;7 \" ; class= \" ;post has-profile bg1 \" ; > some text 2 < /div > \r\n < div id= \" ;8 \" ; class= \" ;post has-profile bg2 \" ; > some text 3 < /div > \r\n < div id= \" ;9 \" ; class= \" ;post has-profile bg1 \" ; > some text 4 < /div > \r\n < div class= \" ;panel bg1 \" ; id= \" ;abc \" ; > ... < /div > \" ; \" ; \" ;\r\n \r\n from bs4 import BeautifulSoup\r\n \r\n soup = BeautifulSoup(data, &#39;lxml&#39;)\r\n \r\n divs = soup.select(&#39;_URL_0_.has-profile.bg2, _URL_0_.has-profile.bg1&#39;)\r\n \r\n for div in divs:\r\n print(div)\r\n print(&#39;-&#39; * 80)\r\n\r\nPrints:\r\n\r\n < div class= \" ;post has-profile bg2 \" ; id= \" ;6 \" ; > some text 1 < /div > \r\n --------------------------------------------------------------------------------\r\n < div class= \" ;post has-profile bg2 \" ; id= \" ;8 \" ; > some text 3 < /div > \r\n --------------------------------------------------------------------------------\r\n < div class= \" ;post has-profile bg1 \" ; id= \" ;7 \" ; > some text 2 < /div > \r\n --------------------------------------------------------------------------------\r\n < div class= \" ;post has-profile bg1 \" ; id= \" ;9 \" ; > some text 4 < /div > \r\n --------------------------------------------------------------------------------\r\n\r\nThe `&#39;_URL_0_.has-profile.bg2, _URL_0_.has-profile.bg1&#39;` selector selects all ` < div > ` tags with class ` \" ;post hast-profile bg2 \" ;` and all ` < div > ` tags with class ` \" ;post hast-profile bg1 \" ;`.", "1017" ], [ "To match only word `shutdown` in line, you can use this example (key is using flag `re.MULTILINE`, because we are using `^` and `$` in our regex):\r\n\r\n data = \" ; \" ; \" ;!\r\n interface GigabitEthernet5/19\r\n switchport access vlan 102\r\n switchport mode access\r\n switchport voice vlan 100\r\n qos trust device cisco-phone\r\n !\r\n interface GigabitEthernet5/20\r\n !\r\n interface GigabitEthernet5/21\r\n description Test AP 335\r\n switchport access vlan 999\r\n switchport mode access\r\n shutdown\r\n spanning-tree portfast\r\n !\r\n interface GigabitEthernet5/22\r\n !\r\n interface GigabitEthernet5/23\r\n switchport access vlan 102\r\n switchport shutdown mode access\r\n switchport voice vlan 100 shutdown \" ; \" ; \" ;\r\n \r\n import re\r\n \r\n print(re.findall(r&#39;^\\s*(shutdown)\\s*$&#39;, data, flags=re.MULTILINE))\r\n\r\nThis will print:\r\n\r\n [&#39;shutdown&#39;]\r\n\r\n[Detailed explanation][1] on Regex101 here.\r\n\r\n\r\n [1]: _URL_0_", "286" ], [ "This code snippet will parse the quick summary table of the property url and saves it in csv file:\r\n\r\n from urllib.request import urlopen as uReq\r\n from bs4 import BeautifulSoup as soup\r\n import csv\r\n \r\n # my_url = &#39;_URL_0_;\r\n my_url = &#39;_URL_2_;\r\n \r\n with uReq(my_url) as uClient:\r\n page_soup = soup(uClient.read(), &#39;lxml&#39;)\r\n \r\n \r\n with open(&#39;data.csv&#39;, &#39;w&#39;, newline=&#39;&#39;) as csvfile:\r\n csvwriter = csv.writer(csvfile, delimiter=&#39;,&#39;, quotechar=&#39; \" ;&#39;)\r\n \r\n for dt, dd in zip(page_soup.select(&#39;section#quick-summary dt&#39;), page_soup.select(&#39;section#quick-summary dd&#39;)):\r\n csvwriter.writerow([dt.text.strip(), dd.text.strip()])\r\n\r\nThe result is in `data.csv`, screenshot from my LibreOffice:\r\n\r\n[![enter image description here][1]][1]\r\n\r\nFor having the table transposed, you can use this code:\r\n\r\n from urllib.request import urlopen as uReq\r\n from bs4 import BeautifulSoup as soup\r\n import csv\r\n \r\n # my_url = &#39;_URL_0_;\r\n my_url = &#39;_URL_2_;\r\n \r\n with uReq(my_url) as uClient:\r\n page_soup = soup(uClient.read(), &#39;lxml&#39;)\r\n \r\n headers = [&#39;Numer oferty&#39;,\r\n &#39;Liczba pokoi&#39;,\r\n &#39;Cena&#39;,\r\n &#39;Cena za m2&#39;,\r\n &#39;Powierzchnia&#39;,\r\n &#39;Piętro&#39;,\r\n &#39;Liczba pięter&#39;,\r\n &#39;Typ kuchni&#39;,\r\n &#39;Balkon&#39;,\r\n &#39;Czynsz administracyjny&#39;,\r\n &#39;Rodzaj ogrzewania&#39;,\r\n &#39;Gorąca woda&#39;,\r\n &#39;Rodzaj budynku&#39;,\r\n &#39;Materiał&#39;,\r\n &#39;Rok budowy&#39;,\r\n &#39;Stan nieruchomości&#39;,\r\n &#39;Rynek&#39;,\r\n &#39;Dach:&#39;,\r\n &#39;Liczba balkon&#243;w:&#39;,\r\n &#39;Piwnica:&#39;,\r\n &#39;Kształt działki:&#39;,\r\n &#39;Szerokość działki (mb.):&#39;,\r\n &#39;Długość działki (mb.):&#39;,\r\n &#39;Droga dojazdowa:&#39;,\r\n &#39;Gaz:&#39;,\r\n &#39;Prąd:&#39;,\r\n &#39;Siła:&#39;]\r\n \r\n with open(&#39;data.csv&#39;, &#39;w&#39;, newline=&#39;&#39;) as csvfile:\r\n csvwriter = csv.writer(csvfile, delimiter=&#39;,&#39;, quotechar=&#39; \" ;&#39;)\r\n csvwriter.writerow(headers)\r\n \r\n row = [&#39;-&#39;] * len(headers)\r\n for dt, dd in zip(page_soup.select(&#39;section#quick-summary dt&#39;), page_soup.select(&#39;section#quick-summary dd&#39;)):\r\n if dt.text.strip() not in headers:\r\n print( \" ;Warning, column [{}] doesn&#39;t exist in headers! \" ;.format(dt.text.strip()))\r\n continue\r\n row[headers.index(dt.text.strip())] = dd.text.strip()\r\n csvwriter.writerow(row)\r\n\r\nThe result will be in csv file like this (the values not present will be substituted with &#39;-&#39;):\r\n\r\n[![enter image description here][2]][2]\r\n\r\n\r\n [1]: _URL_3_\r\n [2]: _URL_1_", "1017" ], [ "This code snippet will selects all links from `_URL_5_` homepage that contains `/watch?` in their `href` attribute (links to videos):\r\n\r\n from bs4 import BeautifulSoup\r\n import requests\r\n \r\n soup = BeautifulSoup(requests.get(&#39;_URL_2_;).text, &#39;lxml&#39;)\r\n \r\n for a in soup.select(&#39;a[href*= \" ;/watch? \" ;]&#39;):\r\n print(&#39;https://www._URL_5_{}&#39;.format(a[&#39;href&#39;]))\r\n\r\nPrints:\r\n\r\n _URL_3_\r\n _URL_3_\r\n https://www._URL_5_/watch?v=gnn7GwqXek4\r\n https://www._URL_5_/watch?v=gnn7GwqXek4\r\n _URL_4_\r\n _URL_4_\r\n https://www._URL_5_/watch?v=daQcqPHx9uw\r\n https://www._URL_5_/watch?v=daQcqPHx9uw\r\n https://www._URL_5_/watch?v=V_MXGdSBbAI\r\n https://www._URL_5_/watch?v=V_MXGdSBbAI\r\n _URL_0_\r\n _URL_0_\r\n _URL_1_\r\n _URL_1_\r\n https://www._URL_5_/watch?v=6NPHk-Yd4VU\r\n https://www._URL_5_/watch?v=6NPHk-Yd4VU\r\n https://www._URL_5_/watch?v=dHiAls8loz4\r\n https://www._URL_5_/watch?v=dHiAls8loz4\r\n https://www._URL_5_/watch?v=2_mDOWLhkVU\r\n https://www._URL_5_/watch?v=2_mDOWLhkVU\r\n\r\n ...and so on", "1017" ], [ "Using the `key` and `reverse` argument of python built-in function `sorted()`:\r\n\r\n lst = [\r\n {&#39;id&#39;: &#39;SOMEDATA_31_30&#39;, &#39;age&#39;: &#39;31:30&#39;, &#39;values&#39;:0, &#39;hasdata&#39;: False, &#39;name&#39;: u&#39;SOMEDATA&#39;},\r\n {&#39;id&#39;: &#39;SOMEDATA1_32_29&#39;, &#39;age&#39;: &#39;32:29&#39;, &#39;values&#39;:1, &#39;hasdata&#39;: False, &#39;name&#39;: u&#39;SOMEDATA1&#39;},\r\n {&#39;id&#39;: &#39;SOMEDATA2_22_20&#39;, &#39;age&#39;: &#39;22:20&#39;, &#39;values&#39;:3, &#39;hasdata&#39;: False, &#39;name&#39;: u&#39;SOMEDATA2&#39;},\r\n {&#39;id&#39;: &#39;SOMEDATA2_28_27&#39;, &#39;age&#39;: &#39;28:27&#39;, &#39;values&#39;:4, &#39;hasdata&#39;: False, &#39;name&#39;: u&#39;SOMEDATA2&#39;},\r\n ]\r\n \r\n import re\r\n from pprint import pprint\r\n \r\n \r\n pprint( sorted(lst, reverse=True, key=lambda v: [(int(i[0]), int(i[1])) for i in re.findall(r&#39;(\\d+):(\\d+)&#39;, v[&#39;age&#39;])]), width=120 )\r\n\r\nThis prints:\r\n\r\n [{&#39;age&#39;: &#39;32:29&#39;, &#39;hasdata&#39;: False, &#39;id&#39;: &#39;SOMEDATA1_32_29&#39;, &#39;name&#39;: &#39;SOMEDATA1&#39;, &#39;values&#39;: 1},\r\n {&#39;age&#39;: &#39;31:30&#39;, &#39;hasdata&#39;: False, &#39;id&#39;: &#39;SOMEDATA_31_30&#39;, &#39;name&#39;: &#39;SOMEDATA&#39;, &#39;values&#39;: 0},\r\n {&#39;age&#39;: &#39;28:27&#39;, &#39;hasdata&#39;: False, &#39;id&#39;: &#39;SOMEDATA2_28_27&#39;, &#39;name&#39;: &#39;SOMEDATA2&#39;, &#39;values&#39;: 4},\r\n {&#39;age&#39;: &#39;22:20&#39;, &#39;hasdata&#39;: False, &#39;id&#39;: &#39;SOMEDATA2_22_20&#39;, &#39;name&#39;: &#39;SOMEDATA2&#39;, &#39;values&#39;: 3}]", "91" ], [ "You can make it with pure Python. In this example I firstly parse the string (can be read from file) to Python structures, make the desired operation (add a single title, add column to row based on first item on that row), and write the values back:\r\n\r\n data = \" ; \" ; \" ;\r\n title1\r\n title2\r\n title3\r\n title4\r\n title5\r\n var1 var2 var3 var4 var5\r\n var1.1 var2.1 var3.1 var4.1 var5.1\r\n \" ; \" ; \" ;\r\n \r\n import re\r\n \r\n \r\n # parse string to Python structures:\r\n titles = re.findall(r&#39;^(\\w+)$&#39;, data, flags=re.M)\r\n rows = []\r\n for row in re.finditer(r&#39;^.*? .*?$&#39;, data, flags=re.M):\r\n rows.append([])\r\n for values in re.finditer(r&#39;[\\w\\.]+&#39;, row[0]):\r\n rows[-1].append(values[0])\r\n \r\n # add title:\r\n titles.append(&#39;NEWTITLE&#39;)\r\n \r\n # add value to all rows (some example operation with column 0):\r\n for row in rows:\r\n row.append(&#39;NEW&#39; + row[0])\r\n \r\n # print values back to old form:\r\n for title in titles:\r\n print(title)\r\n for row in rows:\r\n print(&#39; &#39;.join(row))\r\n\r\nOutputs:\r\n\r\n title1\r\n title2\r\n title3\r\n title4\r\n title5\r\n NEWTITLE\r\n var1 var2 var3 var4 var5 NEWvar1\r\n var1.1 var2.1 var3.1 var4.1 var5.1 NEWvar1.1", "761" ], [ "I created a generator, which takes one argument, an iterable and yields values that are within range of `min`, `max` of this iterable. The product is computed as usual:\r\n\r\n from itertools import chain\r\n \r\n def values(iterable):\r\n lst = list(int(i) for i in chain.from_iterable(i.split() for i in n))\r\n _min, _max = min(lst), max(lst)\r\n for i in lst:\r\n if _min < i < _max:\r\n yield i\r\n \r\n n = [&#39;7 5 -1 3 9&#39;, &#39;<PHONE_NUMBER>&#39;, &#39;-<PHONE_NUMBER>&#39;]\r\n \r\n p = 1\r\n for i in values(n):\r\n p *= i\r\n \r\n print(p)\r\n\r\nOutput:\r\n\r\n -1234517760000", "761" ], [ "You can use `re` for splitting log file according `USER INPUT : \" ;clear \" ;`:\r\n\r\n log_file = \" ; \" ; \" ;USER INPUT : “clear”\r\n SYSTEM RESPONSE: “Hello! How are you?”\r\n USER INPUT : “Good thank you”\r\n SYSTEM RESPONSE: \" ;Okay \" ;\r\n USER INPUT : “clear”\r\n SYSTEM RESPONSE: “Hello! How are you?”\r\n USER INPUT : “I am good, Thank you!”\r\n SYSTEM RESPONSE: \" ;Great! \" ;\r\n USER INPUT : “Good” \" ; \" ; \" ;\r\n \r\n import re\r\n from pprint import pprint\r\n \r\n groups = re.findall(r&#39;USER INPUT.*?clear.*?(?:(?=USER INPUT :\\s+\\Wclear\\W)|(?=\\Z))&#39;, log_file, flags=re.DOTALL)\r\n data = [&#39;F&#39;,&#39;P&#39;]\r\n \r\n style = {&#39;P&#39;: &#39; < p style= \" ;color:green; > &#39;, &#39;F&#39;: &#39; < p style= \" ;color:red; > &#39;}\r\n \r\n html = &#39;&#39;\r\n for d, g in zip(data, groups):\r\n for line in g.splitlines():\r\n html += style[d] + line + &#39; < /p > \\n&#39;\r\n \r\n pprint(html)\r\n\r\nThis prints:\r\n\r\n (&#39; < p style= \" ;color:red; > USER INPUT : “clear” < /p > \\n&#39;\r\n &#39; < p style= \" ;color:red; > SYSTEM RESPONSE: “Hello! How are you?” < /p > \\n&#39;\r\n &#39; < p style= \" ;color:red; > USER INPUT : “Good thank you” < /p > \\n&#39;\r\n &#39; < p style= \" ;color:red; > SYSTEM RESPONSE: \" ;Okay \" ; < /p > \\n&#39;\r\n &#39; < p style= \" ;color:green; > USER INPUT : “clear” < /p > \\n&#39;\r\n &#39; < p style= \" ;color:green; > SYSTEM RESPONSE: “Hello! How are you?” < /p > \\n&#39;\r\n &#39; < p style= \" ;color:green; > USER INPUT : “I am good, Thank you!” < /p > \\n&#39;\r\n &#39; < p style= \" ;color:green; > SYSTEM RESPONSE: \" ;Great! \" ; < /p > \\n&#39;\r\n &#39; < p style= \" ;color:green; > USER INPUT : “Good” < /p > \\n&#39;)\r\n\r\nEDIT:\r\n\r\nI made an online example how the [regex works here][1].\r\n\r\n\r\n [1]: _URL_0_", "349" ], [ "You can use `html` module and `BeautifulSoup` to get text without escaped tags:\r\n\r\n s = \" ; & lt;b & gt; & lt;i & gt; & lt;u & gt;Charming boutique selling trendy casual & amp;amp; dressy apparel for women, some plus sized items, swimwear, shoes & amp;amp; jewelry. & lt;/u & gt; & lt;/i & gt; & lt;/b & gt; \" ;\r\n \r\n from bs4 import BeautifulSoup\r\n from html import unescape\r\n \r\n soup = BeautifulSoup(unescape(s), &#39;lxml&#39;)\r\n print(soup.text)\r\n\r\nPrints:\r\n\r\n Charming boutique selling trendy casual & dressy apparel for women, some plus sized items, swimwear, shoes & jewelry.", "1017" ], [ "You can leverage list and dict comprehensions:\r\n\r\n contacts_to_parse = [\r\n {\r\n \" ;contact_order \" ;: \" ;1 \" ;,\r\n \" ;contact_type \" ;: \" ;Other \" ;,\r\n \" ;contact_role \" ;: \" ;role here \" ;,\r\n \" ;contact_text \" ;: \" ;contact text here \" ;\r\n },\r\n {\r\n \" ;contact_order \" ;: \" ;2 \" ;,\r\n \" ;contact_type \" ;: \" ;Mail Alias \" ;,\r\n \" ;contact_role \" ;: \" ;role here \" ;,\r\n \" ;contact_text \" ;: \" ;contact text here \" ;\r\n },\r\n ]\r\n \r\n from pprint import pprint\r\n \r\n pprint([{k.replace(&#39;_&#39;, &#39; &#39;).title():v for k, v in contact.items()} for contact in contacts_to_parse])\r\n\r\nPrints:\r\n\r\n [{&#39;Contact Order&#39;: &#39;1&#39;,\r\n &#39;Contact Role&#39;: &#39;role here&#39;,\r\n &#39;Contact Text&#39;: &#39;contact text here&#39;,\r\n &#39;Contact Type&#39;: &#39;Other&#39;},\r\n {&#39;Contact Order&#39;: &#39;2&#39;,\r\n &#39;Contact Role&#39;: &#39;role here&#39;,\r\n &#39;Contact Text&#39;: &#39;contact text here&#39;,\r\n &#39;Contact Type&#39;: &#39;Mail Alias&#39;}]", "442" ], [ "You can use `select()` for getting your data:\r\n\r\n data = \" ; \" ; \" ;[ < div class= \" ;ticket_type \" ; > ‐ Help With Steam Workshop < a\r\n href= \" ;javascript:\r\n jsTicketsLast7Days.getOptions().appendValueToParam( &#39;requestid&#39;,\r\n &#39;29&#39; ); jsTicketsLast7Days.getOptions().showSelectedRange( true\r\n ); $J(&#39;#TicketsLast7Days&#39;).get(0).scrollIntoView(); \" ; > + < /a > \r\n < /div > ,\r\n < div class= \" ;ticket_last_24 report_table_right \" ; > \r\n < span > 15 < /span > \r\n < span > ( < /span > < span\r\n class= \" ;change_increase \" ; > +36% < /span > < span > ) < /span > \r\n < /div > ,\r\n < div class= \" ;ticket_last_week report_table_right \" ; > \r\n < span > 271 < /span > \r\n < span > ( < /span > < span\r\n class= \" ;change_increase \" ; > +632% < /span > < span > ) < /span > \r\n < /div > ,\r\n < div class= \" ;ticket_waiting_not_elevated\r\n report_table_right \" ; > 0 < /div > ,\r\n < div class= \" ;ticket_waiting_elevated\r\n report_table_right \" ; > 37 < /div > ,\r\n []] \" ; \" ; \" ;\r\n \r\n from bs4 import BeautifulSoup\r\n \r\n soup = BeautifulSoup(data, &#39;lxml&#39;)\r\n \r\n nums = soup.select(&#39;&#39;&#39;div.ticket_waiting_not_elevated.report_table_right,\r\n div.ticket_waiting_elevated.report_table_right&#39;&#39;&#39;)\r\n \r\n print([num.text for num in nums])\r\n\r\nPrints:\r\n\r\n [&#39;0&#39;, &#39;37&#39;]\r\n\r\nThe `soup.select(&#39;div.ticket_waiting_not_elevated.report_table_right, div.ticket_waiting_elevated.report_table_right&#39;)` selects all divs with `ticket_waiting_not_elevated report_table_right` class or `ticket_waiting_elevated report_table_right` class.", "1017" ], [ "You need use Python time and date functions to get your desired data range. Something like this:\r\n\r\n from bs4 import BeautifulSoup\r\n import requests\r\n import datetime\r\n \r\n \r\n def start_of_year():\r\n today = datetime.datetime.utcnow().date()\r\n return datetime.datetime(today.year, 1, 1, tzinfo=datetime.timezone.utc)\r\n \r\n def get_date(d):\r\n return datetime.datetime.strptime(d, &#39;%m-%d-%Y&#39;)\r\n \r\n def get_url(start, end):\r\n start = start.strftime( \" ;%Y%m%d \" ;)\r\n end = end.strftime( \" ;%Y%m%d \" ;)\r\n return &#39;_URL_0_{} & end={}&#39;.format(start, end)\r\n \r\n \r\n now = lambda: datetime.datetime.utcnow()\r\n td = lambda *args, **kwargs: datetime.timedelta(*args, **kwargs)\r\n \r\n ranges = [\r\n (now() - td(days=6), now()), # last 7 days\r\n (now() - td(days=30), now()), # last 30 days\r\n (now() - td(days=3 * 365//12), now()), # last 3 months\r\n (now() - td(days=365), now()), # last 12 months\r\n (start_of_year(), now()), # year to date\r\n (get_date(&#39;<PHONE_NUMBER>&#39;), now()) # from <PHONE_NUMBER> to now\r\n ]\r\n \r\n for r in ranges:\r\n r = requests.get(get_url(*r))\r\n soup = BeautifulSoup(r.text, &#39;lxml&#39;)\r\n data_table = soup.select_one(&#39;table.table tbody&#39;)\r\n for row in data_table.select(&#39;tr&#39;):\r\n print([r[&#39;data-format-value&#39;] for r in row.select(&#39;td[data-format-value]&#39;)])\r\n print(&#39;-&#39; * 80)\r\n\r\nThis will go through all date/time ranges and get the value data:\r\n\r\n [&#39;0.999317&#39;, &#39;1.00715&#39;, &#39;<PHONE_NUMBER>&#39;, &#39;0.99891&#39;, &#39;4311410000.0&#39;, &#39;<PHONE_NUMBER>.64&#39;]\r\n [&#39;<PHONE_NUMBER>&#39;, &#39;1.00161004066&#39;, &#39;<PHONE_NUMBER>&#39;, &#39;0.998919010162&#39;, &#39;<PHONE_NUMBER>.0&#39;, &#39;<PHONE_NUMBER>&#39;]\r\n [&#39;<PHONE_NUMBER>&#39;, &#39;1.00268995762&#39;, &#39;<PHONE_NUMBER>&#39;, &#39;<PHONE_NUMBER>&#39;, &#39;<PHONE_NUMBER>&#39;, &#39;<PHONE_NUMBER>&#39;]\r\n [&#39;<PHONE_NUMBER>&#39;, &#39;1.0043900013&#39;, &#39;<PHONE_NUMBER>&#39;, &#39;<PHONE_NUMBER>&#39;, &#39;<PHONE_NUMBER>.0&#39;, &#39;<PHONE_NUMBER>.0&#39;]\r\n [&#39;<PHONE_NUMBER>&#39;, &#39;1.00374996662&#39;, &#39;<PHONE_NUMBER>&#39;, &#39;<PHONE_NUMBER>&#39;, &#39;<PHONE_NUMBER>&#39;, &#39;<PHONE_NUMBER>&#39;]\r\n [&#39;<PHONE_NUMBER>&#39;, &#39;1.0020699501&#39;, &#39;<PHONE_NUMBER>&#39;, &#39;0.998790979385&#39;, &#39;<PHONE_NUMBER>.0&#39;, &#39;<PHONE_NUMBER>.0&#39;]\r\n --------------------------------------------------------------------------------\r\n\r\n ... and so on", "1017" ], [ "You can use `re` to extract desired column:\r\n\r\n import re\r\n \r\n data = \" ; \" ; \" ;root:*:17709:0:99999:7<IP_ADDRESS>:\r\n daemon:*:17709:0:99999:7<IP_ADDRESS>:\r\n bin:*:17709:0:99999:7<IP_ADDRESS>:\r\n sys:*:17709:0:99999:7<IP_ADDRESS>:\r\n sync:*:17709:0:99999:7<IP_ADDRESS>:\r\n games:*:17709:0:99999:7<IP_ADDRESS>:\r\n man:*:17709:0:99999:7<IP_ADDRESS>:\r\n lp:*:17709:0:99999:7<IP_ADDRESS>:\r\n mail:*:17709:0:99999:7<IP_ADDRESS>:\r\n news:*:17709:0:99999:7<IP_ADDRESS>:\r\n uucp:*:17709:0:99999:7<IP_ADDRESS>:\r\n proxy:*:17709:0:99999:7<IP_ADDRESS>:\r\n www-data:*:17709:0:99999:7<IP_ADDRESS>:\r\n backup:*:17709:0:99999:7<IP_ADDRESS>: \" ; \" ; \" ;\r\n \r\n groups = re.findall(&#39;(.*?):(.*?):(.*?):(.*?):(.*?):(.*?):(.*?):(.*?):&#39;, data)\r\n \r\n if all(g[1].strip() for g in groups):\r\n print(&#39;All good&#39;)\r\n else:\r\n print(&#39;This is a problem&#39;)\r\n\r\nThis prints:\r\n\r\n All good\r\n\r\nExplanation of this regex [here][1]. In the second group (`g[1]`), you have the shadowed password (`*`), or empty string.\r\n\r\n\r\n [1]: _URL_0_", "772" ], [ "As you see, the bold element (` < td > `) is last ` < td > ` element inside the ` < tr > ` tag. So you select all ` < td > ` tags inside ` < tr > ` tag and get the element with index `-1` (in Python that means last index):\r\n\r\n data = \" ; \" ; \" ;\r\n < tr > \r\n < td > \r\n < div class= \" ;graph-legend-color \" ;\r\n style= \" ;width:12px;height:11px;background-\r\n color:#3366CC \" ; > \r\n < /div > \r\n < /td > \r\n < td class= \" ;percent \" ; > 48,9 % < /td > \r\n < td class= \" ;number \" ; > 92.234 < /td > \r\n < td > Proxy-Block Types From Download Media Type Blocklist < /td > \r\n < /tr > \" ; \" ; \" ;\r\n \r\n from bs4 import BeautifulSoup\r\n \r\n soup = BeautifulSoup(data, &#39;lxml&#39;)\r\n \r\n print(soup.select(&#39;tr > td&#39;)[-1].text)\r\n\r\nPrints:\r\n\r\n Proxy-Block Types From Download Media Type Blocklist", "1017" ], [ "You can using `re` for parsing the input data:\r\n\r\n data = \" ; \" ; \" ;\r\n name: <PERSON>\r\n add: <PERSON>\r\n add: India\r\n \r\n name: <PERSON>\r\n add: <PERSON>\r\n add: tamilnadu\r\n add: India\r\n \" ; \" ; \" ;\r\n \r\n import re\r\n \r\n for group in re.findall(r&#39;(name:.*?)(?:(?=name:)|\\Z)&#39;, data, flags=re.DOTALL):\r\n name = re.findall(r&#39;(?:name:\\s*([^\\n]+))&#39;, group, flags=re.DOTALL)\r\n addresses = re.findall(r&#39;(?:add:\\s*([^\\n]+))+&#39;, group, flags=re.DOTALL)\r\n print(name[0], addresses)\r\n print(&#39;-&#39; * 80)\r\n\r\nPrints:\r\n\r\n <PERSON> [&#39;hyderabad&#39;, &#39;India&#39;]\r\n --------------------------------------------------------------------------------\r\n samuel [&#39;chennai&#39;, &#39;tamilnadu&#39;, &#39;India&#39;]\r\n --------------------------------------------------------------------------------", "761" ], [ "Without `pandas`, but with `groupby` from `itertools`:\r\n\r\n from itertools import groupby\r\n \r\n data = \" ; \" ; \" ;\r\n 1182659 Sample05 22\r\n 1182659 Sample33 14\r\n 4758741 Sample05 74\r\n 4758741 Sample33 2\r\n 3652147 Sample05 8\r\n 3652147 Sample33 34\r\n \" ; \" ; \" ;\r\n \r\n groups = groupby((line.split() for line in data.splitlines() if line), key=lambda v: v[0])\r\n \r\n rows = []\r\n headers = []\r\n for g, v in groups:\r\n v = list(v)\r\n for i in v:\r\n if i[1] not in headers:\r\n headers.append(i[1])\r\n rows.append([g] + [i[-1] for i in v])\r\n \r\n print(&#39;\\t&#39;+ &#39;\\t&#39;.join(headers))\r\n for row in rows:\r\n for value in row:\r\n print(value, end=&#39;\\t&#39;)\r\n print()\r\n\r\nPrints:\r\n\r\n \tSample05\tSample33\r\n 1182659\t22\t14\t\r\n 4758741\t74\t2\t\r\n 3652147\t8\t34", "256" ], [ "You aren&#39;t using expressions from the list of expressions, just string `r&#39;expr&#39;`\r\n\r\nUse expr directly, without quotes, e.g. `re.search(expr, key, re.I)`:\r\n\r\n import re\r\n \r\n data = {r&#39;\\windows\\temp\\zzz.rar&#39;: &#39;xxx&#39;}\r\n expressions = [r&#39;(temp|tmp)\\\\[a-z]+\\.rar&#39;]\r\n \r\n for key, value in data.items():\r\n for expr in expressions:\r\n matchStr = re.search(expr, key, re.I)\r\n if matchStr:\r\n print(&#39;Match found&#39;)\r\n break\r\n\r\nPrints:\r\n\r\n Match found", "761" ], [ "Using REST API from the site _URL_3_.\r\n\r\nDisclaimer: The site is made by user @matthiasmullie \r\n_URL_2_\r\n\r\nExample here:\r\n\r\n from bs4 import BeautifulSoup\r\n import requests\r\n import json\r\n \r\n url = &#39;_URL_0_;\r\n \r\n data = \" ; \" ; \" ; < script > \r\n window.addEventListener(&#39;load&#39;, function (e)\r\n {\r\n i = 4;\r\n });\r\n < /script > \r\n \" ; \" ; \" ;\r\n \r\n soup = BeautifulSoup(data, &#39;lxml&#39;)\r\n script = soup.select_one(&#39;script&#39;)\r\n r = _URL_1_(url, data={ \" ;source \" ;:script.text, \" ;type \" ; : \" ;js \" ;})\r\n json_data = json.loads(r.text)\r\n script.clear()\r\n script.append(json_data[&#39;minified&#39;])\r\n \r\n print(script)\r\n\r\nIt prints:\r\n\r\n < script > window.addEventListener(&#39;load&#39;,function(e)\r\n {i=4}) < /script >", "1017" ], [ "Using `re` module:\r\n\r\n import re\r\n \r\n aList = [&#39;0.01&#39;, &#39;xyz&#39;, &#39;J0.01&#39;, &#39;abc&#39;, &#39;xyz&#39;]; \r\n print([i for i in (re.sub(r&#39;\\d+\\.?\\d*$&#39;, &#39;&#39;, i) for i in aList) if i])\r\n\r\nPrints:\r\n\r\n [&#39;xyz&#39;, &#39;J&#39;, &#39;abc&#39;, &#39;xyz&#39;]\r\n\r\nEDIT:\r\n\r\nThe regexp substitution `re.sub(r&#39;\\d+\\.?\\d*$&#39;, &#39;&#39;, i)` will substitute every digit followed by dot (optional) and followed by any number of digits for empty string. The `$` signifies that the digit should be at the end of the string.\r\n\r\nSo. e.g. the following matches are valid: ` \" ;0.01 \" ;`, ` \" ;0. \" ;`, ` \" ;0 \" ;`. Explanation on [external site here][1].\r\n\r\n\r\n [1]: _URL_0_", "772" ], [ "I have following snippet of C code that I want wrap with Cython and use in my Python program:\r\n\r\n typedef union my_mat4\r\n {\r\n float Elements[4][4];\r\n #ifdef MAT4_MATH__USE_SSE\r\n __m128 Rows[4];\r\n #endif\r\n } my_mat4;\r\n \r\n static inline my_mat4 init_my_mat4(void)\r\n {\r\n my_mat4 Result = {0};\r\n return (Result);\r\n }\r\n\r\nI wrap this code in mat4.pxd following way:\r\n\r\n cdef extern from \" ;mat4.h \" ;:\r\n ctypedef union my_mat4:\r\n float Elements[4][4]\r\n\r\n my_mat4 init_my_mat4()\r\n\r\n cdef class MyClass:\r\n cdef my_mat4 m\r\n cdef object o\r\n\r\nand the mat4.pyx code:\r\n\r\n cdef class MyClass:\r\n def __cinit__(self):\r\n self.m = init_my_mat4()\r\n\r\nWhen I use MyClass in Python\r\n\r\n my_class = MyClass()\r\n\r\nPython exits with message **Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)**.\r\n\r\nHowever, when I disable **MAT4_MATH__USE_SSE** from the C union, program runs normally. Even when I remove **cdef object o** from MyClass, everything runs ok.\r\n\r\nI searched extensively for a solution but couldn&#39;t find anything. Is this some kind of alignment problem?\r\n\r\nThanks,\r\nA.\r\n\r\n**EDIT 1:**\r\n\r\nThe Python program crashes only when module **decimal** is imported and __m128 is compiled in Cython extension module, so:\r\n\r\n import decimal\r\n my_class = MyClass()\r\n\r\ncrashes the interpreter (I get splash icon on my Ubuntu program launcher)\r\n\r\n**EDIT 2:**\r\n\r\nAs <PERSON> in comments said, the import decimal is probably not significant in this case - for him the program segfaults without the import, runs with import.\r\n\r\n**EDIT 3:**\r\n\r\nAs <PERSON> wrote, almost certainly it&#39;s misalignment problem. The solution is to remove `__m128` member from union and make proposed `load_vec()` or similar macro with `_mm_loadu_ps`.\r\n\r\n**EDIT 4:**\r\n\r\nAnother solution is using `unaligned__m128` defined as `typedef float __attribute((vector_size(16), aligned(4))) unaligned__m128;` instead of __m128 in union. Thanks <PERSON>.", "74" ], [ "You can use `Counter` class for exactly this purpose:\r\n\r\n from collections import Counter\r\n\r\n x = [&#39;Gaga&#39;, &#39;Gaga&#39;, &#39;Lam&#39;, &#39;Reem&#39;, &#39;Pal&#39;, &#39;Gaga&#39;,&#39;Lam&#39;]\r\n\r\n c = Counter(x)\r\n\r\n new_values = [item for item in x if c[item] > 1]\r\n indexes = [1 if c[item] == 1 else 0 for item in x]\r\n\r\n print(new_values)\r\n print(indexes)\r\n\r\nOutput is:\r\n\r\n [&#39;Gaga&#39;, &#39;Gaga&#39;, &#39;Lam&#39;, &#39;Gaga&#39;, &#39;Lam&#39;]\r\n [0, 0, 0, 1, 1, 0, 0]", "761" ], [ "For very simple purposes you could use builtin map for storing 2D table:\r\n\r\n class Matrix_Table:\r\n def __init__(self):\r\n self.__data = {}\r\n\r\n def __getitem__(self, idx):\r\n try:\r\n return self.__data[idx]\r\n except KeyError:\r\n return 0\r\n\r\n def __setitem__(self, idx, value):\r\n self.__data[idx] = value\r\n\r\n def __len__(self):\r\n return len(self.__data.items())\r\n\r\n m = Matrix_Table()\r\n m[1, 2] = 10\r\n m[2, 3] = 20\r\n print(m[1, 2]) # prints 10\r\n print(m[1, 1]) # prints 0\r\n print(len(m)) # prints 2", "710" ], [ "I would use prepared statement in your case and DATETIME for storing times:\r\n\r\n import sqlite3\r\n from datetime import datetime\r\n\r\n db = sqlite3.connect( \" ;:memory: \" ;)\r\n\r\n now = datetime.now()\r\n\r\n with db:\r\n cur = db.cursor()\r\n cur.execute( \" ; \" ; \" ;CREATE TABLE Login(StartTime1 DATETIME NOT NULL,\r\n BreakBegin1 DATETIME NOT NULL,\r\n BreakEnd1 DATETIME NOT NULL,\r\n EndTime1 DATETIME NOT NULL,\r\n comments TEXT) \" ; \" ; \" ;)\r\n cur.execute( \" ; \" ; \" ;INSERT INTO Login values(?, ?, ?, ?, \" ;No Comments \" ;) \" ; \" ; \" ;, \r\n (now, now, now, now))\r\n\r\n for row in cur.execute( \" ; \" ; \" ;select * from Login \" ; \" ; \" ;):\r\n print(row)\r\n\r\nOutput:\r\n\r\n (&#39;2018-07-08 08:25:57.718175&#39;, &#39;2018-07-08 08:25:57.718175&#39;, &#39;2018-07-08 08:25:57.718175&#39;, &#39;2018-07-08 08:25:57.718175&#39;, &#39;No Comments&#39;)", "733" ], [ "To change values you need to pass them in list for example:\r\n\r\n class MainClass:\r\n def importantFunction(self): # don&#39;t forget self\r\n truthValues = [False, False]\r\n changeBoolValue(truthValues)\r\n return truthValues[0] and truthValues[1] # using `and`, not ` & & `\r\n \r\n def changeBoolValue(val):\r\n val[0] = not val[0]\r\n val[1] = not val[1]", "839" ], [ "`cursor.fetchall()` fetches all rows in form of list. In this case the row has only one value `Year`, so list of one valued tuples.\r\n\r\nSolution:\r\n\r\nUse `.fetchone()` to fetch only one row in form of `tuple` and index it:\r\n\r\n def find_dase(Plants):\r\n conn = sqlite3.connect( \" ;dexro.db \" ;)\r\n cursor = conn.cursor()\r\n cursor.execute(( \" ;SELECT Years FROM Plants_no WHERE Plant=? \" ;),(Plants,))\r\n data = cursor.fetchone()[0] # THIS IS CHANGED\r\n conn.close()\r\n return data", "374" ], [ "from pprint import pprint\r\n from collections import Counter, OrderedDict\r\n \r\n d = {\r\n &#39;2018-05-10&#39;: [\r\n {&#39;Clicks&#39;: 229, &#39;Link Clicks&#39;: 210},\r\n {&#39;Clicks&#39;: 139, &#39;Link Clicks&#39;: 11}\r\n ],\r\n &#39;2018-05-11&#39;: [\r\n {&#39;Clicks&#39;: 365, &#39;Link Clicks&#39;: 379},\r\n {&#39;Clicks&#39;: 1348, &#39;Link Clicks&#39;: 73}\r\n ],\r\n }\r\n \r\n m = OrderedDict()\r\n for k, v in d.items():\r\n m[k] = Counter()\r\n for i in v:\r\n m[k].update(i)\r\n m[k] = dict(m[k])\r\n # or if you want to keep the &#39;vals&#39; key and list:\r\n # m[k] = [{ \" ;vals \" ;: dict(m[k])}]\r\n \r\n pprint(m)\r\n\r\nOutput:\r\n\r\n OrderedDict([(&#39;2018-05-11&#39;, {&#39;Clicks&#39;: 1713, &#39;Link Clicks&#39;: 452}),\r\n (&#39;2018-05-10&#39;, {&#39;Clicks&#39;: 368, &#39;Link Clicks&#39;: 221})])", "58" ], [ "Json is unordered, so when you read it back you must sort it yourself:\r\n\r\n from pprint import pprint\r\n from collections import OrderedDict\r\n import re\r\n \r\n d = {\r\n \" ;Frame_1 \" ;: {\r\n \" ;Gyro \" ;: {\r\n \" ;Y \" ;: 0.<PHONE_NUMBER>,\r\n \" ;X \" ;: -0.128382220864296,\r\n \" ;Z \" ;: 0.00210362509824336\r\n },\r\n \" ;Speed \" ;: 35.288933944702144\r\n },\r\n # ... etc\r\n }\r\n \r\n def sort_my_dict(d):\r\n l = sorted([(k, v) for k, v in d.items()], key=lambda v: int(re.findall(&#39;\\d+&#39;, v[0])[0] ))\r\n return OrderedDict(l)\r\n \r\n pprint(sort_my_dict(d))\r\n\r\nOutput:\r\n\r\n OrderedDict([(&#39;Frame_0&#39;,\r\n {&#39;Gyro&#39;: {&#39;X&#39;: 0.00864287838339806,\r\n &#39;Y&#39;: 0.00257105240598321,\r\n &#39;Z&#39;: 0.00034347633481957},\r\n &#39;Speed&#39;: 36.00000686645497}),\r\n (&#39;Frame_1&#39;,\r\n {&#39;Gyro&#39;: {&#39;X&#39;: -0.128382220864296,\r\n &#39;Y&#39;: 0.<PHONE_NUMBER>,\r\n &#39;Z&#39;: 0.00210362509824336},\r\n &#39;Speed&#39;: 35.288933944702144}),\r\n (&#39;Frame_2&#39;,\r\n {&#39;Gyro&#39;: {&#39;X&#39;: -0.064938560128212,\r\n &#39;Y&#39;: 0.0185721646994352,\r\n &#39;Z&#39;: 0.00250079506076872},\r\n &#39;Speed&#39;: 35.<PHONE_NUMBER>}),\r\n #etc...\r\n\r\n**EDIT:**\r\n\r\nYou can access `OrderedDict` like normal `dict`:\r\n\r\n sorted_dict = sort_my_dict(d) \r\n pprint(sorted_dict[ \" ;Frame_18 \" ;])\r\n\r\nOutput:\r\n\r\n {&#39;Gyro&#39;: {&#39;X&#39;: -0.<PHONE_NUMBER>,\r\n &#39;Y&#39;: -0.00475228251889348,\r\n &#39;Z&#39;: 0.00177123316098005},\r\n &#39;Speed&#39;: 35.<PHONE_NUMBER>}", "837" ], [ "This program firstly ask the the three questions, validates them and then asks in loop only for questions that didn&#39;t validate. Until all questions are validated:\r\n\r\n # This is only example validate function:\r\n def validate(resp):\r\n if resp == \" ;a \" ;:\r\n return True\r\n return False\r\n \r\n valid = [False, False, False]\r\n while not all(valid):\r\n a = valid[0] or input( \" ;Enter a: \" ;)\r\n b = valid[1] or input( \" ;Enter b: \" ;)\r\n c = valid[2] or input( \" ;Enter c: \" ;)\r\n \r\n valid = [True if valid[i] else bool(validate(v)) for i, v in enumerate((a, b, c))]", "953" ], [ "This question is based on [previous Stackoverflow answer][1]. The problem seems too big for me.\r\n\r\nI now have sorting function `sort_multi(lst, index_normal, index_reversed)` which takes input list, and two parameters which indicates which column is sorted in normal order and which in reverse:\r\n\r\n from pprint import pprint\r\n from itertools import groupby, chain\r\n \r\n l = ((1, &#39;b&#39;),\r\n (1, &#39;d&#39;),\r\n (2, &#39;a&#39;),\r\n (1, &#39;a&#39;))\r\n \r\n def sort_multi(lst, index_normal, index_reversed):\r\n return list(chain.from_iterable([sorted(list(j), key=lambda v:v[index_reversed], reverse=True) for i, j in groupby(sorted(lst), key=lambda v:v[index_normal])]))\r\n \r\n pprint(sort_multi(l, 0, 1), width=10) # index 0 is sorted normally, 1 in reversed order.\r\n\r\nOutput:\r\n\r\n [(1, &#39;d&#39;),\r\n (1, &#39;b&#39;),\r\n (1, &#39;a&#39;),\r\n (2, &#39;a&#39;)]\r\n\r\nWhat I want is extend the function to work for **any** number of indices. Eg.\r\n\r\nFor example input of 3 columns:\r\n\r\n l = ((1, &#39;c&#39;, &#39;aa&#39;),\r\n (2, &#39;b&#39;, &#39;bb&#39;),\r\n (1, &#39;c&#39;, &#39;cc&#39;),\r\n (1, &#39;d&#39;, &#39;dd&#39;))\r\n \r\n sort_multi(l, reversed=(False, True, True))\r\n\r\nGives output:\r\n\r\n [(1, &#39;d&#39;, &#39;dd&#39;),\r\n (1, &#39;c&#39;, &#39;cc&#39;),\r\n (1, &#39;c&#39;, &#39;aa&#39;),\r\n (2, &#39;b&#39;, &#39;bb&#39;)]\r\n\r\nThe tuples can contains strings, integers, ...\r\n\r\n [1]: _URL_0_", "820" ], [ "Using `chain` from builtin module `itertools`:\r\n\r\n from itertools import chain\r\n \r\n _list = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]\r\n \r\n print(list(i for i in chain.from_iterable(_list) if i < = 6))\r\n\r\nOutput:\r\n\r\n > [1, 2, 3, 4, 5, 6]\r\n\r\nWhat `itertools.chain` does? According [manual pages][1]:\r\n\r\n > Make an iterator that returns elements from the first iterable until\r\n > it is exhausted, then proceeds to the next iterable, until all of the\r\n > iterables are exhausted. Used for treating consecutive sequences as a\r\n > single sequence.\r\n\r\n\r\n [1]: _URL_0_", "319" ], [ "You need to define `cash` and `coins` as [global variable][1]:\r\n\r\n cash = 0\r\n coins = 0\r\n\r\n def main():\r\n global cash, coins\r\n\r\n cash = float(input( \" ;How much money: \" ;))\r\n coins = 0\r\n \r\n def changeCounter(n):\r\n global cash, coins\r\n \r\n while True:\r\n if cash - n > 0:\r\n cash -= n\r\n coins += 1\r\n else:\r\n break\r\n return\r\n \r\n main()\r\n changeCounter(0.25)\r\n\r\n > But better way than storing the state in global variables is using\r\n > returing variables and function arguments or other method. See\r\n > _URL_1_\r\n\r\n [1]: _URL_0_", "835" ], [ "I have two functions returning generator:\r\n\r\n def f1():\r\n return (i for i in range(1000))\r\n \r\n def f2():\r\n return ((yield i) for i in range(1000))\r\n\r\nApparently, generator returned from `f2()` is twice as slower than `f1()`:\r\n\r\n Python 3.6.5 (default, Apr 1 2018, 05:46:30) \r\n [GCC 7.3.0] on linux\r\n Type \" ;help \" ;, \" ;copyright \" ;, \" ;credits \" ; or \" ;license \" ; for more information.\r\n > > > import timeit, dis\r\n > > > timeit.timeit( \" ;list(f1()) \" ;, globals=globals(), number=1000)\r\n 0.057948426001530606\r\n > > > timeit.timeit( \" ;list(f2()) \" ;, globals=globals(), number=1000)\r\n 0.09769760200288147\r\n\r\nI tried to using dis to see what&#39;s going on but to no avail:\r\n\r\n > > > dis.dis(f1)\r\n 2 0 LOAD_CONST 1 ( < code object < genexpr > at 0x7ffff7ec6d20, file \" ; < stdin > \" ;, line 2 > )\r\n 2 LOAD_CONST 2 (&#39;f1. < locals > . < genexpr > &#39;)\r\n 4 MAKE_FUNCTION 0\r\n 6 LOAD_GLOBAL 0 (range)\r\n 8 LOAD_CONST 3 (1000)\r\n 10 CALL_FUNCTION 1\r\n 12 GET_ITER\r\n 14 CALL_FUNCTION 1\r\n 16 RETURN_VALUE\r\n > > > dis.dis(f2)\r\n 2 0 LOAD_CONST 1 ( < code object < genexpr > at 0x7ffff67a25d0, file \" ; < stdin > \" ;, line 2 > )\r\n 2 LOAD_CONST 2 (&#39;f2. < locals > . < genexpr > &#39;)\r\n 4 MAKE_FUNCTION 0\r\n 6 LOAD_GLOBAL 0 (range)\r\n 8 LOAD_CONST 3 (1000)\r\n 10 CALL_FUNCTION 1\r\n 12 GET_ITER\r\n 14 CALL_FUNCTION 1\r\n 16 RETURN_VALUE\r\n\r\nApparently, the results from `dis` are the same. \r\n\r\nSo why is generator returned from `f1()` faster than generator from `f2()`? And what is proper way to debug this? Apparently `dis` in this case fails.\r\n\r\n**EDIT 1:**\r\n\r\nUsing `next()` instead of `list()` in timeit reverses the results (or they are the same in some cases):\r\n\r\n > > > timeit.timeit( \" ;next(f1()) \" ;, globals=globals(), number=10**6)\r\n 1.0030477920008707\r\n > > > timeit.timeit( \" ;next(f2()) \" ;, globals=globals(), number=10**6)\r\n 0.9416838550023385\r\n\r\n**EDIT 2:**\r\n\r\nApparently it&#39;s bug in Python, fixed in 3.8. See _URL_0_\r\n\r\nGenerator with yield inside actually yields two values.", "199" ], [ "There are many possibilities how to do it, one is using 2 queues:\r\n\r\n from time import sleep\r\n import threading, queue\r\n \r\n class Foo():\r\n def help(self):\r\n print(&#39;Running help&#39;)\r\n return 42\r\n \r\n \r\n class MyThread(threading.Thread):\r\n \r\n def __init__(self, q_main, q_worker):\r\n self.queue_main = q_main\r\n self.queue_worker = q_worker\r\n threading.Thread.__init__(self)\r\n \r\n def run(self):\r\n while True:\r\n sleep(1)\r\n self.queue_main.put(&#39;run help&#39;)\r\n item = self.queue_worker.get() # waits for item from main thread\r\n print(&#39;Received &#39;, item)\r\n \r\n queue_to_main, queue_to_worker = queue.Queue(), queue.Queue( )\r\n bar = Foo()\r\n \r\n my_work_thread = MyThread(queue_to_main, queue_to_worker)\r\n my_work_thread.start()\r\n \r\n while True:\r\n i = queue_to_main.get()\r\n if i == \" ;run help \" ;:\r\n rv = Foo().help()\r\n queue_to_worker.put(rv)\r\n\r\nOutput:\r\n\r\n Running help\r\n Received 42\r\n Running help\r\n Received 42\r\n Running help\r\n Received 42\r\n ...etc", "880" ], [ "You can use re module for parsing the parameters:\r\n\r\n import requests\r\n from bs4 import BeautifulSoup\r\n import re\r\n from pprint import pprint\r\n \r\n url = \" ;_URL_0_;\r\n r = requests.get(url)\r\n soup = BeautifulSoup(r.content, \" ;lxml \" ;)\r\n \r\n return_value = []\r\n for s in soup.find_all(&#39;script&#39;):\r\n i = re.findall( \" ;average180.push\\(\\[new Date\\(&#39;(.*?)&#39;\\).*?(\\d+).*?(\\d+) \" ;, s.text)\r\n for v in i:\r\n return_value.append(v)\r\n \r\n pprint(return_value)\r\n\r\nOutput:\r\n\r\n [(&#39;2018/01/13&#39;, &#39;1584&#39;, &#39;1389&#39;),\r\n (&#39;2018/01/14&#39;, &#39;1530&#39;, &#39;1396&#39;),\r\n (&#39;2018/01/15&#39;, &#39;1512&#39;, &#39;1402&#39;),\r\n (&#39;2018/01/16&#39;, &#39;1501&#39;, &#39;1408&#39;),\r\n (&#39;2018/01/17&#39;, &#39;1489&#39;, &#39;1414&#39;),\r\n (&#39;2018/01/18&#39;, &#39;1483&#39;, &#39;1420&#39;),\r\n (&#39;2018/01/19&#39;, &#39;1487&#39;, &#39;1427&#39;),\r\n (&#39;2018/01/20&#39;, &#39;1511&#39;, &#39;1435&#39;),\r\n (&#39;2018/01/21&#39;, &#39;1516&#39;, &#39;1443&#39;),\r\n (&#39;2018/01/22&#39;, &#39;1517&#39;, &#39;1449&#39;),\r\n (&#39;2018/01/23&#39;, &#39;1529&#39;, &#39;1456&#39;),\r\n (&#39;2018/01/24&#39;, &#39;1527&#39;, &#39;1463&#39;),\r\n (&#39;2018/01/25&#39;, &#39;1524&#39;, &#39;1470&#39;),\r\n (&#39;2018/01/26&#39;, &#39;1498&#39;, &#39;1477&#39;),\r\n (&#39;2018/01/27&#39;, &#39;1491&#39;, &#39;1484&#39;),\r\n ...etc.", "1017" ], [ "Your problem is logic in function `_generate_ids()`. The function never ends so `pool.imap_unordered()` never finishes by itself, only needs to be interrupted by CTRL-C.\r\n\r\nChange it for something like this:\r\n\r\n def _generate_ids(self):\r\n \" ; \" ; \" ; Generator function of the IDs for the Processes Pool \" ; \" ; \" ;\r\n\r\n for i in range(self.max_count):\r\n time.sleep(3)\r\n my_id = \" ;ID-{} \" ;.format(self.count)\r\n _URL_0_(&#39;[Daemon] Generated ID %s&#39;, my_id)\r\n if self.done:\r\n break\r\n self.count += 1\r\n yield my_id\r\n\r\nAnd the processes end by themselves normally.", "739" ], [ "Make simple decorator that will use `inspect` module to get list of function parameters. This will give you example:\r\n\r\n import inspect\r\n \r\n def take_many_arguments(fn):\r\n origf = fn\r\n def _f(*arg, **args):\r\n new_args = {}\r\n \r\n for a in inspect.getargspec(origf).args:\r\n if a not in args:\r\n continue\r\n new_args[a] = args[a]\r\n \r\n return origf(*arg, **new_args)\r\n return _f\r\n \r\n \r\n class C:\r\n @take_many_arguments\r\n def fn1(self, a):\r\n print(a)\r\n \r\n @take_many_arguments\r\n def fn2(self, a, b):\r\n print(a, b)\r\n \r\n @take_many_arguments\r\n def fn3(self, a, b, c):\r\n print(a, b, c)\r\n \r\n \r\n @take_many_arguments\r\n def fn4(a, b):\r\n print(a, b)\r\n \r\n \r\n d = {&#39;a&#39;: 1, &#39;b&#39;: 2, &#39;c&#39;: 3}\r\n \r\n # for classes:\r\n c = C()\r\n c.fn1(&#39;Normal call&#39;)\r\n c.fn1(**d)\r\n c.fn2(**d)\r\n c.fn3(**d)\r\n \r\n # for functions:\r\n fn4(9, 8)\r\n fn4(**d)\r\n\r\nOutput:\r\n\r\n Normal call\r\n 1\r\n 1 2\r\n 1 2 3\r\n 9 8\r\n 1 2", "904" ], [ "Using &#39;`Counter`&#39; and &#39;`defaultdict`&#39; from Python:\r\n\r\n l = [[&#39;laravel&#39;, 1.0, 54],\r\n [&#39;laravel&#39;, 1.0, 3615],\r\n [&#39;php&#39;, 1.0, 1405],\r\n [&#39;php&#39;, 1.0, 5175],\r\n [&#39;php&#39;, 1.0, 5176],\r\n [&#39;php&#39;, 1.0, 54],\r\n [&#39;php&#39;, 1.0, 5252],\r\n [&#39;php&#39;, 1.0, 5279],\r\n [&#39;python&#39;, 1.0, 54],\r\n [&#39;laravel&#39;, 0.8333333333333334, 54],\r\n [&#39;python&#39;,0.8333333333333334, 3615]]\r\n \r\n from pprint import pprint\r\n from collections import Counter, defaultdict\r\n \r\n c = Counter(i[2] for i in l)\r\n \r\n d = defaultdict(lambda: defaultdict(int))\r\n for i in l:\r\n if c[i[2]] > 1:\r\n d[i[2]][i[0]] += 1\r\n \r\n rv = []\r\n for k, v in d.items():\r\n rv.append({&#39;id&#39;: k, &#39;No_matched_skills&#39;: len(v), &#39;skills&#39;: [*v]})\r\n \r\n pprint(rv, width=10)\r\n \r\nOutput:\r\n \r\n [{&#39;No_matched_skills&#39;: 3,\r\n &#39;id&#39;: 54,\r\n &#39;skills&#39;: [&#39;laravel&#39;,\r\n &#39;php&#39;,\r\n &#39;python&#39;]},\r\n {&#39;No_matched_skills&#39;: 2,\r\n &#39;id&#39;: 3615,\r\n &#39;skills&#39;: [&#39;laravel&#39;,\r\n &#39;python&#39;]}]", "91" ], [ "You can modify the data just before running `ast.literal_eval()`, possibly with `re` module:\r\n\r\n import re\r\n from ast import literal_eval\r\n from pprint import pprint\r\n \r\n s = \" ; \" ; \" ;new = [{ \" ;id \" ;: \" ;L0 \" ;, \" ;tags \" ;: null, \" ;disable \" ;: false},\r\n { \" ;id \" ;: \" ;L1 \" ;, \" ;tags \" ;: null, \" ;disable \" ;: false},\r\n { \" ;id \" ;: \" ;L2 \" ;, \" ;tags \" ;: null, \" ;disable \" ;: false}] \" ; \" ; \" ;\r\n \r\n s = re.sub(&#39;null&#39;, &#39; \" ;null \" ;&#39;, s)\r\n s = re.sub(&#39;false&#39;, &#39; \" ;false \" ;&#39;, s)\r\n s = re.sub(&#39;new\\s*=\\s*&#39;, &#39;&#39;, s)\r\n \r\n new = literal_eval(s)\r\n pprint(new)\r\n \r\nOutput:\r\n\r\n [{&#39;disable&#39;: &#39;false&#39;, &#39;id&#39;: &#39;L0&#39;, &#39;tags&#39;: &#39;null&#39;},\r\n {&#39;disable&#39;: &#39;false&#39;, &#39;id&#39;: &#39;L1&#39;, &#39;tags&#39;: &#39;null&#39;},\r\n {&#39;disable&#39;: &#39;false&#39;, &#39;id&#39;: &#39;L2&#39;, &#39;tags&#39;: &#39;null&#39;}]", "259" ], [ "I have following Cython code with one C buffer defined (`c_buffer`):\r\n\r\n ctypedef struct my_struct_t:\r\n float x\r\n float y\r\n \r\n cdef class CMyClass:\r\n cdef my_struct_t c_buffer[1000]\r\n\r\n def get_array(self):\r\n return < my_struct_t[:1000] > & self.c_buffer[0]\r\n\r\n def get_memoryview(self):\r\n return memoryview( < my_struct_t[:1000] > & self.c_buffer[0])\r\n\r\nI&#39;m using this class to store elements that eventually go to OpenGL VBO buffer. What I&#39;m trying to do is avoid unnecessary copies of memory.\r\n\r\nWhen I call `get_array()` I get result of type \r\n\r\n < c_wrappers.array object at 0x7fffce17d650 > \r\n\r\nwith `get_memoryview()` the result is:\r\n\r\n < memory at 0x7fffd242e648 > \r\n\r\n1. What&#39;s the difference between them (in functionality/speed)? I&#39;m reading official document in about [Typed Memoryviews][1], but it focuses mainly on numpy. Am I returning the memoryviews here correctly?\r\n\r\n2. Now the buffer is fixed (max 1000 elements). Does in Cython exist dynamic array that I could use and it automatically handles memory for me (for adding/removing elements at runtime) and having continuous memory layout (that I could eventually supply to OpenGL VBO)? Or should I use `from libcpp.vector cimport vector`?\r\n\r\n\r\n [1]: _URL_0_", "712" ], [ "Using `re` module:\r\n\r\n import re\r\n \r\n exmpstr = \" ;Hi there <PERSON>! Don&#39;t you know that <PERSON> (the programmer) created something useful or & easy to control \" ;\r\n \r\n s = re.sub(&#39;(\\,)|(\\[)|(\\&#39;)|(\\()|(\\))|(\\ & )|(\\])|(\\&#39;)&#39;, &#39;&#39;, exmpstr)\r\n \r\n print(s)\r\n\r\nOutput:\r\n\r\n > Hi there <PERSON>! Dont you know that <PERSON> the programmer created something\r\n > useful or easy to control", "277" ], [ "My take on the problem:\r\n\r\n XDict = {\r\n \" ;<PERSON> \" ; : 0,\r\n \" ;<PERSON> \" ; : -1,\r\n \" ;<PERSON> \" ; : 0,\r\n \" ;<PERSON> \" ; : 1,\r\n \" ;<PERSON> \" ; : 0\r\n }\r\n \r\n YDict = {\r\n \" ;<PERSON> \" ; : 0,\r\n \" ;<PERSON> \" ; : 0,\r\n \" ;<PERSON> \" ; : -1,\r\n \" ;Vegas \" ; : 0,\r\n \" ;<PERSON> \" ; : 1\r\n }\r\n \r\n \r\n hereX = 0\r\n hereY = 0\r\n \r\n for ((n1, x), (n2, y)) in zip(XDict.items(), YDict.items()):\r\n if (x==hereX) and (y==hereY):\r\n print(n1)\r\n break\r\n\r\nPrints:\r\n\r\n > Jersey\r\n\r\nHowever, it&#39;s unclear why you store the city names in both dictionaries. Better solution would be storing the dataset like this:\r\n\r\n d = {(0, 0): \" ;Jersey \" ;,\r\n (-1, 0): \" ;Boston \" ;,\r\n (0, -1): \" ;York \" ;,\r\n (1, 0): \" ;Vegas \" ;,\r\n (0, 1): \" ;<PERSON> \" ;}\r\n\r\nThat way you can index it by `d[(hereX, hereY)]`.", "714" ], [ "You are unpacking from the list in for loop and creating 3 variables `name`, `appt` and `salary`. With this variables it isn&#39;t possible to easily change your `data` structure. What you need is extract a list from `data` and access it by indexing: \r\n\r\n from pprint import pprint\r\n \r\n data = [[&#39;Ben&#39;, &#39;Manager&#39;, 3000],\r\n [&#39;James&#39;, &#39;Cleaner&#39;, 1000],\r\n [&#39;Ken&#39;, &#39;Supervisor&#39;, 2000]]\r\n \r\n for d in data:\r\n if d[0] == &#39;James&#39;:\r\n d[2] = 1500\r\n print(d) # prints only changed row\r\n \r\n pprint(data) # prints whole structure\r\n\r\nPrints:\r\n\r\n [&#39;James&#39;, &#39;Cleaner&#39;, 1500]\r\n [[&#39;Ben&#39;, &#39;Manager&#39;, 3000],\r\n [&#39;James&#39;, &#39;Cleaner&#39;, 1500],\r\n [&#39;Ken&#39;, &#39;Supervisor&#39;, 2000]]", "761" ], [ "This problem can be done multiple ways, but I made `get_disctrict_and_city()` function which has one parameter `postal_code` and returns tuple with `district` and `city`:\r\n\r\n zipcode = { \" ;Trap City \" ;:{ \" ;C District \" ;: 100, \" ;D District \" ;: 103, \" ;E District \" ;: 104, \" ;S District \" ;: 105},\r\n \" ;Zap City \" ;:{ \" ;R District \" ;: 200, \" ;D District \" ;: 201},\r\n \" ;Los City \" ;: { \" ;X District \" ;: 207, \" ;Y District \" ;: 208}}\r\n \r\n def get_disctrict_and_city(postal_code, data=zipcode):\r\n for city, districts in data.items():\r\n for district, code in districts.items():\r\n if code == postal_code:\r\n return district, city\r\n \r\n postal_code=int(input(&#39;Enter postal code: &#39;))\r\n district, city = get_disctrict_and_city(postal_code)\r\n \r\n print(&#39;District = {} City = {}&#39;.format(district, city))\r\n\r\nOutput:\r\n\r\n Enter postal code: 100\r\n District = C District City = Trap City", "714" ], [ "# assuming list is sorted:\r\n pattern = [ \" ;ABCDE \" ;,\r\n \" ;ABCDEFG \" ;,\r\n \" ;ABCDEFGH \" ;,\r\n \" ;ABCDEFGHIJKLMNO \" ;,\r\n \" ;CEST \" ;,\r\n \" ;DBTSFDE \" ;,\r\n \" ;DBTSFDEO \" ;,\r\n \" ;EOEUDNBNUW \" ;,\r\n \" ;EAEUDNBNUW \" ;,\r\n \" ;FG \" ;,\r\n \" ;FGH \" ;]\r\n \r\n pattern = list(reversed(pattern))\r\n \r\n def iterate_patterns():\r\n while pattern:\r\n i = pattern.pop()\r\n throw_it_away = False\r\n for p in pattern:\r\n if p.startswith(i):\r\n throw_it_away = True\r\n break\r\n if throw_it_away == False:\r\n yield i\r\n \r\n print(list(iterate_patterns()))\r\n\r\nOutput:\r\n\r\n > [&#39;ABCDEFGHIJKLMNO&#39;, &#39;CEST&#39;, &#39;DBTSFDEO&#39;, &#39;EOEUDNBNUW&#39;, &#39;EAEUDNBNUW&#39;,\r\n > &#39;FGH&#39;]", "761" ], [ "s = \" ; \" ; \" ;Apple 300 2 kg\r\n Shirt Medium Blue 1350 3 shirt\r\n Shirt Medium Blue 1850 4 shirt \" ; \" ; \" ;\r\n \r\n from collections import Counter\r\n import re\r\n \r\n m = re.findall(&#39;([^\\d]+)(\\d+)\\s+(\\d+)\\s+(.*)&#39;, s)\r\n c_price = Counter()\r\n c_items = Counter()\r\n for g in m:\r\n c_price.update( {(g[0].strip(), g[3]): int(g[1])} )\r\n c_items.update( {(g[0].strip(), g[3]): int(g[2])} )\r\n \r\n for (item_name, item_type), count in c_items.items():\r\n print(item_name, c_price[(item_name, item_type)], count, item_type)\r\n\r\nOutputs:\r\n\r\n Apple 300 2 kg\r\n Shirt Medium Blue 3200 7 shirt", "761" ], [ "What are you looking for is `clamp()` function, which takes 3 arguments: value, desired minimal value and desired maximal value. \r\n\r\nProperties are defined by the `@property` decorator. For testing if the value assigned to property is number I use `numbers` module. Here is sample code:\r\n\r\n import numbers\r\n \r\n def clamp(v, _min, _max):\r\n return max(min(v, _max), _min)\r\n \r\n class Point:\r\n def __init__(self, x, y):\r\n self.x = x\r\n self.y = y\r\n \r\n @property\r\n def x(self):\r\n return self.__x\r\n \r\n @x.setter\r\n def x(self, value):\r\n if not isinstance(value, numbers.Number):\r\n raise AttributeError()\r\n self.__x = clamp(int(value), 0, 10)\r\n \r\n @property\r\n def y(self):\r\n return self.__y\r\n \r\n @y.setter\r\n def y(self, value):\r\n if not isinstance(value, numbers.Number):\r\n raise AttributeError()\r\n self.__y = clamp(int(value), 0, 10)\r\n \r\n p = Point(1,12)\r\n print(p.x, p.y) # output \" ;1 10 \" ;\r\n p.x = 25\r\n p.y = -5\r\n print(p.x, p.y) # output \" ;10 0 \" ;", "118" ], [ "Using `re` and `defaultdict` from `collections` module:\r\n\r\n data_in = \" ; \" ; \" ;\r\n 11/11/2015 <IP_ADDRESS> 30s success\r\n 11/11/2015 <IP_ADDRESS> 30s stuck\r\n 11/11/2015 <IP_ADDRESS> 30s Sync\r\n 11/11/2015 <IP_ADDRESS> 30s success\r\n 11/12/2015 <IP_ADDRESS> 30s success\r\n 11/12/2015 <IP_ADDRESS> 30s stuck\r\n 11/12/2015 <IP_ADDRESS> 30s stuck\r\n 11/12/2015 <IP_ADDRESS> 30s success\r\n 11/12/2015 <IP_ADDRESS> 30s success\r\n 11/12/2015 <IP_ADDRESS> 30s success\r\n 11/12/2015 <IP_ADDRESS> 30s stuck\r\n 11/12/2015 <IP_ADDRESS> 30s success\r\n 11/12/2015 <IP_ADDRESS> 30s Sync\r\n 11/12/2015 <IP_ADDRESS> 30s Sync\r\n \" ; \" ; \" ;\r\n \r\n import re\r\n from collections import defaultdict\r\n \r\n groups = re.findall(&#39;([\\d/]+)\\s*([\\d\\.]+)\\s*([\\ds]+)\\s*([a-zA-Z]+)&#39;, data_in)\r\n d = defaultdict(int)\r\n for g in groups:\r\n d[(g[0], g[1], g[2], g[3])] += 1\r\n \r\n for k, v in d.items():\r\n s = &#39; &#39;.join(i for i in k)\r\n print(f&#39;{s} {v}&#39;)\r\n\r\nOutput:\r\n\r\n 11/11/2015 <IP_ADDRESS> 30s success 2\r\n 11/11/2015 <IP_ADDRESS> 30s stuck 1\r\n 11/11/2015 <IP_ADDRESS> 30s Sync 1\r\n 11/12/2015 <IP_ADDRESS> 30s success 4\r\n 11/12/2015 <IP_ADDRESS> 30s stuck 3\r\n 11/12/2015 <IP_ADDRESS> 30s success 1\r\n 11/12/2015 <IP_ADDRESS> 30s Sync 2", "58" ], [ "Another approach to use without any libraries (like `collections.Counter`):\r\n\r\n lis = [[&#39;apple&#39;,32],[&#39;Blue shirt&#39;,323],[&#39;Blue shirt&#39;,320]]\r\n \r\n d = {}\r\n \r\n for name, item in lis:\r\n try:\r\n d[name] += item\r\n except KeyError:\r\n d[name] = item\r\n \r\n lis = [[k ,v] for k, v in d.items()]\r\n print(lis)\r\n\r\nOutput:\r\n\r\n [[&#39;apple&#39;, 32], [&#39;Blue shirt&#39;, 643]]", "761" ], [ "Firstly, `print` function returns always `None`, so you are assigning to `b` always `None` value.\r\n\r\nFor replacing `1` I would recommend using function arguments. Define function `a` with two arguments, eg. `value1` and `value2` and use the arguments in your algorithm for printing character. That way you can change your output:\r\n\r\n def a(value1, value2):\r\n for row in range(5):\r\n for col in range(5):\r\n if ((col==0 or col==4)and row!=0)or ((row==0 or row==2)and (col > 0 and col < 4)):\r\n print(value1,end= \" ; \" ;)\r\n else:\r\n print(value2,end= \" ; \" ;)\r\n print()\r\n \r\n a(&#39;#&#39;, &#39;.&#39;)\r\n\r\nWill print:\r\n\r\n . # # # . \r\n # . . . # \r\n # # # # # \r\n # . . . # \r\n # . . . #", "941" ], [ "l = sorted(l, key=lambda v: 1 if v in (&#39;ga:goal1Completions&#39;, &#39;ga:bounces&#39;, &#39;ga:operatingSystem&#39;) else 0)\r\n print(l)\r\n\r\nPrints:\r\n\r\n [&#39;ga:date&#39;, &#39;ga:hour&#39;, &#39;ga:dimension1&#39;, &#39;ga:dimension2&#39;, &#39;ga:userType&#39;, &#39;ga:landingpagePath&#39;, &#39;ga:deviceCategory&#39;, &#39;ga:sessions&#39;, &#39;ga:source&#39;, &#39;ga:medium&#39;, &#39;ga:campaign&#39;, &#39;ga:adContent&#39;, &#39;ga:keyword&#39;, &#39;ga:goal1Completions&#39;, &#39;ga:bounces&#39;, &#39;ga:operatingSystem&#39;]\r\n\r\nOr with weights, if you want **exactly** the group in the order:\r\n\r\n weights = {&#39;ga:sessions&#39;:1, &#39;ga:goal1Completions&#39;:2, &#39;ga:bounces&#39;:3}\r\n l = sorted(l, key=lambda v: 0 if v not in weights else weights[v])\r\n print(l)\r\n\r\nOutput:\r\n\r\n [&#39;ga:date&#39;, &#39;ga:hour&#39;, &#39;ga:dimension1&#39;, &#39;ga:dimension2&#39;, &#39;ga:userType&#39;, &#39;ga:landingpagePath&#39;, &#39;ga:deviceCategory&#39;, &#39;ga:operatingSystem&#39;, &#39;ga:source&#39;, &#39;ga:medium&#39;, &#39;ga:campaign&#39;, &#39;ga:adContent&#39;, &#39;ga:keyword&#39;, &#39;ga:sessions&#39;, &#39;ga:goal1Completions&#39;, &#39;ga:bounces&#39;]", "256" ], [ "It&#39;s really implementation dependent, you could try this in CPython with `ctypes.string_at` function (it dumps whole Python3 integer structure):\r\n\r\n import ctypes\r\n from sys import getsizeof\r\n \r\n my_value_1 = int(1)\r\n my_value_2 = int(2)\r\n \r\n b1 = ctypes.string_at(id(my_value_1), getsizeof(my_value_1))\r\n b2 = ctypes.string_at(id(my_value_2), getsizeof(my_value_2))\r\n print(hex(id(b1)), &#39;&#39;.join(format(x, &#39;02x&#39;) for x in b1))\r\n print(hex(id(b2)), &#39;&#39;.join(format(x, &#39;02x&#39;) for x in b2))\r\n\r\nPrints:\r\n\r\n 0x7ffff670ffb0 4d0300000000000040b89d0000000000010000000000000001000000\r\n 0x7ffff670f5f0 740000000000000040b89d0000000000010000000000000002000000\r\n\r\nIn other implementations of Python (Jython, Iron Python etc.) this probably won&#39;t work. On CPython `id()` returns memory address of the object.", "91" ], [ "You can try `re` module:\r\n\r\n s = &#39;&#39;&#39;[2018-07-10 15:04:11] USER INPUT \" ;hello \" ;\r\n [2018-07-10 15:04:12] SYSTEM RESPONSE: \" ;Hello! How are you doing today \" ;\r\n [2018-07-10 15:04:42] USER INPUT \" ;I am doing good thank you \" ;\r\n [2018-07-10 15:04:42] SYSTEM RESPONSE: \" ;Good to know \" ;&#39;&#39;&#39;\r\n \r\n import re\r\n \r\n print(re.sub(r&#39;\\[(.*?)\\]\\s+&#39;, &#39;&#39;, s))\r\n\r\nprints:\r\n\r\n USER INPUT \" ;hello \" ;\r\n SYSTEM RESPONSE: \" ;Hello! How are you doing today \" ;\r\n USER INPUT \" ;I am doing good thank you \" ;\r\n SYSTEM RESPONSE: \" ;Good to know \" ;\r\n\r\nTo connect it to your code just read the string from file to variable and use the `re.sub` function.", "351" ], [ "You can use `collections.abc` and subclass your class `F` from `Generator` ([manual pages][1]). If you implement __enter__ and __exit__, your instance will be generator and have context manager support as well:\r\n\r\n from collections.abc import Generator\r\n \r\n class F(Generator):\r\n def __init__(self):\r\n self.__my_generator = self._my_generator()\r\n next(self.__my_generator) # prime the generator\r\n \r\n def _my_generator(self):\r\n while True:\r\n v = yield 42\r\n print(&#39;generator received &#39;, v)\r\n \r\n # context manager interace:\r\n def __enter__(self):\r\n return self\r\n \r\n def __exit__(self, *exc):\r\n print(&#39;exit&#39;)\r\n \r\n # Generator interface:\r\n def send(self, value):\r\n return self.__my_generator.send(value)\r\n \r\n def throw(self, typ, value=None, traceback=None):\r\n return self.__my_generator.throw(typ, value, traceback)\r\n \r\n \r\n with F() as o:\r\n while True:\r\n a = o.send(2)\r\n print(&#39;I received &#39;, a)\r\n\r\nPrints:\r\n\r\n generator received 2\r\n I received 42\r\n ...etc.\r\n\r\n\r\n [1]: _URL_0_", "490" ], [ "One possible solution (without `groupby` from `itertools`):\r\n\r\n foo = [&#39;bar&#39;, &#39;bar&#39;, &#39;bar&#39;, &#39;foo&#39;, &#39;foo&#39;,&#39;bar&#39;]\r\n \r\n def my_groupby(l):\r\n first, last, current_value = 0, 0, l[0]\r\n for i, value in enumerate(l):\r\n if value != current_value:\r\n yield first + 1, last + 1, current_value\r\n current_value, first, last = value, i, i\r\n else:\r\n last = i\r\n yield first + 1, last + 1, current_value\r\n \r\n for first, last, value in my_groupby(foo):\r\n if first != last:\r\n print(f&#39;{first}-{last} = {value}&#39;)\r\n else:\r\n print(f&#39;{first} = {value}&#39;)\r\n\r\nPrints:\r\n\r\n 1-3 = bar\r\n 4-5 = foo\r\n 6 = bar", "256" ], [ "Easiest solution is using `ChainMap` from `collections` ([manual pages][1]). That way you can chose which arguments have precedence. Example:\r\n\r\n from collections import ChainMap\r\n\r\n def fun_one(*args, **kwargs): # short example function\r\n print(kwargs)\r\n \r\n inputs = {&#39;length&#39;: 15.8, &#39;width&#39;: 1.1, &#39;some_other_args&#39;: 1}\r\n \r\n c = ChainMap({&#39;length&#39;: 23.7}, inputs) # we overwrite length here\r\n fun_one(**c)\r\n\r\nOutputs:\r\n\r\n {&#39;some_other_args&#39;: 1, &#39;width&#39;: 1.1, &#39;length&#39;: 23.7}\r\n\r\nIf we call fun_one just with inputs:\r\n\r\n c = ChainMap(inputs)\r\n # or c = inputs\r\n fun_one(**c)\r\n\r\nOutput will be:\r\n\r\n {&#39;width&#39;: 1.1, &#39;length&#39;: 15.8, &#39;some_other_args&#39;: 1}\r\n\r\nFrom manual:\r\n\r\n > A **ChainMap** groups multiple dicts or other mappings together to create\r\n > a single, updateable view. If no maps are specified, a single empty\r\n > dictionary is provided so that a new chain always has at least one\r\n > mapping.\r\n\r\nYou can wrap this ChainMap in decorator, one change is that don&#39;t call `fun_one()` with `**input`, only `input`:\r\n\r\n from collections import ChainMap\r\n \r\n def function_with_many_arguments(func):\r\n orig_func = func\r\n def _f(*args, **kwargs):\r\n if args:\r\n c = ChainMap(kwargs, args[0])\r\n return orig_func(**c)\r\n else:\r\n return orig_func(*args, **kwargs)\r\n return _f\r\n \r\n @function_with_many_arguments\r\n def fun_one(*args, **kwargs): # short example function\r\n print(kwargs)\r\n \r\n inputs = {&#39;length&#39;: 15.8, &#39;width&#39;: 1.1, &#39;some_other_args&#39;: 1}\r\n fun_one(inputs, length=23)\r\n\r\nPrints:\r\n\r\n {&#39;some_other_args&#39;: 1, &#39;length&#39;: 23, &#39;width&#39;: 1.1}\r\n\r\n\r\n\r\n [1]: _URL_0_", "761" ], [ "In your code you are opening the file in `with` statement, that means it closes automatically. No need to call `close()` explicitly.\r\n\r\nFor any string manipulation/searching it&#39;s good to know Regular expression (in Python `re` module). For counting variables you could use `Counter` from `itertools`. Here&#39;s an example:\r\n\r\n from collections import Counter\r\n import re\r\n \r\n with open(&#39;logfile.txt&#39;, &#39;r&#39;) as f:\r\n data_in = f.read()\r\n \r\n columns = re.findall(r&#39;([\\d\\/]+)\\s+([\\d\\.]+)\\s+([\\d:]+)\\s+([a-zA-Z]+)&#39;, data_in)\r\n c = Counter(columns)\r\n \r\n for (column_1, column_2, column_3, column_4), count in c.items():\r\n print(column_1, column_2, column_3, column_4, count)\r\n\r\n\r\nPrints:\r\n\r\n 9/1/2013 <IP_ADDRESS> 0:10 Established 2\r\n 9/1/2013 <IP_ADDRESS> 0:10 Failed 1\r\n 9/1/2013 <IP_ADDRESS> 0:10 Syn 1\r\n 9/2/2013 <IP_ADDRESS> 0:10 Established 4\r\n 9/2/2013 <IP_ADDRESS> 0:10 Failed 3\r\n 9/2/2013 <IP_ADDRESS> 0:10 Established 1\r\n 9/2/2013 <IP_ADDRESS> 0:10 Syn 2", "1022" ], [ "You can use CSS selectors for matching tag attributes that start with certain string: e.g. `soup.select(&#39;a[href^= \" ;/game/ \" ;]&#39;)` will match all ` < a > ` tags with attribute href starting with `/game/`.\r\n\r\nFor the second part, you can use `re` module:\r\n\r\n from bs4 import BeautifulSoup\r\n import re\r\n \r\n data = &#39;&#39;&#39;\r\n < td colspan= \" ;4 \" ; > \r\n < a href= \" ;/game/index/4599712?org id=418 \" ; class= \" ;skipMask \" ; target= \" ;TEAM_WIN \" ; > 35-28 < /a > \r\n < /td > \r\n < td nowrap bgcolor= \" ;#FFFFFF \" ; > \r\n < a href= \" ;/team/145/18741 \" ; > Philadelphia < /a > == $0\r\n \" ; (3-1) \" ;\r\n < /td > \r\n &#39;&#39;&#39;\r\n \r\n soup = BeautifulSoup(data, &#39;lxml&#39;)\r\n \r\n for a in soup.select(&#39;a[href^= \" ;/game/ \" ;]&#39;):\r\n print(a[&#39;href&#39;])\r\n \r\n for a in soup.select(&#39;a[href^= \" ;/team/ \" ;]&#39;):\r\n m = re.findall(r&#39;\\s*(.*?)(?=\\s*==).*?(\\(.*?\\))&#39;, a.parent.text, flags=re.DOTALL)\r\n if m:\r\n print(dict(m))\r\n\r\nPrints:\r\n\r\n /game/index/4599712?org id=418\r\n {&#39;Philadelphia&#39;: &#39;(3-1)&#39;}", "1017" ], [ "You can try to extract tags containing page numbers from soup before getting text.\r\n\r\n soup = BeautifulSoup(html.text, &#39;html.parser&#39;)\r\n \r\n for hr in soup.select(&#39;hr&#39;):\r\n hr.find_previous(&#39;p&#39;).extract()\r\n \r\n texts = soup.findAll(text=True)\r\n\r\nThis extracts tags with page numbers that are in style:\r\n\r\n < p style= \" ;text-align:center;margin-top:12pt;margin-bottom:0pt;text-indent:0%;font-size:10pt;font-family:Times New Roman;font-weight:normal;font-style:normal;text-transform:none;font-variant: normal; \" ; > 57 < /p > \r\n < p style= \" ;text-align:center;margin-top:12pt;margin-bottom:0pt;text-indent:0%;font-size:10pt;font-family:Times New Roman;font-weight:normal;font-style:normal;text-transform:none;font-variant: normal; \" ; > 58 < /p > \r\n\r\n ... etc.", "1017" ], [ "As you see, the text `141분` is first sibling of first tag with ` < span > ` with class `split`. So we will select all tags with class `split`, get first one (`[0]`), and get `nextSibling` of that one:\r\n\r\n from bs4 import BeautifulSoup\r\n \r\n data = \" ; \" ; \" ; < dd > \r\n \r\n < span class= \" ;link_txt \" ; > \r\n \r\n < a href= \" ;/movie/sdb/browsing/bmovie.nhn?genre=2 \" ; > 판타지 < /a > < !-- N=a:nol.genre,r:1 -- > ,\r\n \r\n < a href= \" ;/movie/sdb/browsing/bmovie.nhn?genre=1 \" ; > 드라마 < /a > < !-- N=a:nol.genre,r:2 -- > \r\n \r\n < /span > \r\n \r\n < span class= \" ;split \" ; > | < /span > \r\n 141분\r\n < span class= \" ;split \" ; > | < /span > \r\n 2018.08.01 개봉\r\n \r\n < /dd > \" ; \" ; \" ;\r\n \r\n soup = BeautifulSoup(data, &#39;lxml&#39;)\r\n \r\n print(soup.select(&#39;.split&#39;)[0].nextSibling.strip())\r\n\r\nPrints:\r\n\r\n 141분", "1017" ], [ "You have various possibilities here:\r\n\r\n**1. Do it inside your script**\r\n\r\nThis will print first 10 containers:\r\n\r\n containers = page_soup.findAll( \" ;div \" ;, { \" ;class \" ;: \" ;image_list \" ;})[0:10]\r\n for c in containers:\r\n print(c)\r\n\r\n**2. Do it in the shell**\r\n\r\nYou can print all all your containers and filter only lines you want to see with shell commands. That way you have flexibility to change your output without editing your code again and again.\r\n\r\nInside your script we will print all containers:\r\n\r\n containers = page_soup.findAll( \" ;div \" ;, { \" ;class \" ;: \" ;image_list \" ;})\r\n for c in containers:\r\n print(c)\r\n\r\n\r\nIn the shell:\r\n\r\nThis will print first 10 lines:\r\n\r\n python name_of_my_script.py | head\r\n\r\nThis will print lines 5 to 10:\r\n\r\n python name_of_my_script.py | sed -n &#39;5,10p&#39;\r\n\r\nThis will print last 10 lines:\r\n\r\n python name_of_my_script.py | tail\r\n\r\nLook for manual pages for additional information.", "1017" ], [ "You can leverage the `random.choices` method and it&#39;s `weights` parameter, if you are using > =Python3.6 ([docs][1]):\r\n\r\n import random\r\n import time\r\n \r\n ranges = {\r\n 0.9: {&#39;pressure&#39;: (2409, 2415), &#39;temp&#39;: (6989,7045)}, # 90% will be in normal range\r\n 0.08: {&#39;pressure&#39;: (2500, 3000), &#39;temp&#39;: (7100, 7500)}, # 8% will be a peak\r\n 0.02: {&#39;pressure&#39;: (3500, 4000), &#39;temp&#39;: (8100, 9500)}, # 2% will be a extreme peak\r\n }\r\n \r\n def generate_random_data(ranges):\r\n while True:\r\n r = random.choices(list(ranges.values()), weights=ranges.keys())[0]\r\n pressure = float(random.randint(*r[&#39;pressure&#39;]) / 100)\r\n temp = float(random.randint(*r[&#39;temp&#39;]) / 100)\r\n yield pressure, temp\r\n \r\n if __name__ == &#39;__main__&#39;:\r\n n = 10000\r\n generated_data = [v for i, v in zip(range(n), generate_random_data(ranges))]\r\n \r\n print(&#39;number of temp > = 24:&#39;, len(list(i[0] for i in generated_data if i[0] > = 24)))\r\n print(&#39;number of temp > = 25:&#39;, len(list(i[0] for i in generated_data if i[0] > = 25)))\r\n print(&#39;number of temp > = 35:&#39;, len(list(i[0] for i in generated_data if i[0] > = 35)))\r\n \r\n print(&#39;number of pressure > = 69:&#39;, len(list(i[1] for i in generated_data if i[1] > = 69)))\r\n print(&#39;number of pressure > = 71:&#39;, len(list(i[1] for i in generated_data if i[1] > = 71)))\r\n print(&#39;number of pressure > = 81:&#39;, len(list(i[1] for i in generated_data if i[1] > = 81)))\r\n\r\nThis will print:\r\n\r\n number of temp > = 24: 10000\r\n number of temp > = 25: 1033\r\n number of temp > = 35: 207\r\n number of pressure > = 69: 10000\r\n number of pressure > = 71: 1033\r\n number of pressure > = 81: 207\r\n\r\n [1]: _URL_0_", "531" ], [ "You can use `random.sample()` method like in your example. Just use `zip()` method to tie randomly sampled values from dis and f together:\r\n\r\n import random\r\n \r\n dis = [&#39;5&#39;, &#39;6&#39;, &#39;9&#39;, &#39;4&#39;, &#39;7&#39;, &#39;8&#39;]\r\n f = [&#39;Left&#39;, &#39;Right&#39;, &#39;Forward&#39;]\r\n \r\n for direction, d in zip(random.sample(f, len(f)), random.sample(dis, len(f))):\r\n print(&#39;You can move {} {} meters&#39;.format(direction, d))\r\n\r\nThis will print for example:\r\n\r\n You can move Forward 9 meters\r\n You can move Left 5 meters\r\n You can move Right 8 meters", "531" ], [ "Hopefully I&#39;ve understood the algorithm right. The explanation is in comments in the code:\r\n\r\n import random\r\n \r\n # initial state\r\n x = [5, 5, 5, 5, 5]\r\n print(&#39;step 1:\\tx =\\t&#39;, x)\r\n \r\n # decrease each element by random number = create list x2\r\n x2 = [random.randint(1, 3) for _ in range(len(x))]\r\n print(&#39;step 2:\\tx2 =\\t&#39;, x2)\r\n x = [vx - vx2 for vx, vx2 in zip(x, x2)]\r\n print(&#39;step 3:\\tx =\\t&#39;, x)\r\n \r\n while x2:\r\n # pop element from x2\r\n v = x2.pop()\r\n # apply this element to random value in list x\r\n x[random.randint(0, len(x)-1)] += v\r\n \r\n # print final value of list x\r\n print(&#39;step 4:\\tx =\\t&#39;, x)\r\n\r\nThis prints (for example):\r\n\r\n step 1:\tx =\t [5, 5, 5, 5, 5]\r\n step 2:\tx2 = [1, 1, 1, 3, 2]\r\n step 3:\tx =\t [4, 4, 4, 2, 3]\r\n step 4:\tx =\t [5, 4, 4, 8, 4]", "418" ], [ "I tried to use `requests` module to get a response, and it worked. If this isn&#39;t working for you, the website might have some GeoIP blocking or other mechanism in order:\r\n\r\n import requests\r\n from bs4 import BeautifulSoup\r\n \r\n r = requests.get(&#39;_URL_0_;)\r\n soup = BeautifulSoup(r.text, &#39;lxml&#39;)\r\n \r\n print(soup.title.text)\r\n print(soup.h1.text)\r\n\r\nPrints:\r\n\r\n Hybrid IT & Managed Cloud Hosting Solutions | Pulsant\r\n \r\n Experts in compliant business cloud platforms", "1017" ], [ "You are trying to transform lines of text to columns. This code is supposing that in your file `blah.txt` you are having same amount of headers and values:\r\n\r\n with open(&#39;blah.txt&#39;, &#39;r&#39;) as f_in, open(&#39;out.txt&#39;,&#39;w&#39;,newline=&#39;&#39;) as f_out:\r\n lines = [l.strip() for l in f_in.readlines()]\r\n headers, values = lines[:len(lines)//2], lines[len(lines)//2:]\r\n for h in headers:\r\n f_out.write(h + &#39;\\t\\t&#39;)\r\n f_out.write(&#39;\\n&#39;)\r\n for v in values:\r\n f_out.write(v + &#39;\\t\\t&#39;)\r\n f_out.write(&#39;\\n&#39;)\r\n\r\nWith this the out.txt will be:\r\n\r\n serial\t\tname\t\tphone\t\tgmail\t\t\r\n 1\t\tblah blah\t\t55555\t\t<EMAIL_ADDRESS>", "782" ], [ "I did some measurement, and although comparing lists and Counters are both O(n) and creating Counter is O(n), which is better than sorting O(n.log n), the `anagram_checker` with sorting is faster. \r\n\r\n from timeit import timeit\r\n from collections import Counter\r\n \r\n def anagram_checker_1(word=None, words=[]):\r\n anagrams = []\r\n \r\n if len(words) == 0: # if the second arg list is empty then there is nothing to check\r\n return anagrams\r\n else:\r\n counter_word = Counter(word)\r\n for given_word in words:\r\n if given_word != word: # Cannot be same as the word in question\r\n if Counter(given_word) == counter_word:\r\n anagrams.append(given_word)\r\n return anagrams\r\n \r\n \r\n def anagram_checker_2(word=None, words=[]):\r\n anagrams = []\r\n \r\n if len(words) == 0: # if the second arg list is empty then there is nothing to check\r\n return anagrams\r\n else:\r\n counter_word = list(sorted(word))\r\n for given_word in words:\r\n if given_word != word: # Cannot be same as the word in question\r\n if list(sorted(given_word)) == counter_word:\r\n anagrams.append(given_word)\r\n return anagrams\r\n \r\n print(timeit( \" ;anagram_checker_1(&#39;battle&#39;, [&#39;battet&#39;, &#39;batlet&#39;, &#39;battel&#39;, &#39;tablet&#39;]) \" ;, globals=globals(), number=100_000))\r\n print(timeit( \" ;anagram_checker_2(&#39;battle&#39;, [&#39;battet&#39;, &#39;batlet&#39;, &#39;battel&#39;, &#39;tablet&#39;]) \" ;, globals=globals(), number=100_000))\r\n\r\nOutput:\r\n\r\n 2.3342012430075556\r\n 0.47786532100872137\r\n\r\nProfiling the anagram 1 shows this:\r\n\r\n ncalls tottime percall cumtime percall filename:lineno(function)\r\n 500000 0.662 0.000 2.512 0.000 /usr/lib/python3.6/collections/__init__.py:517(__init__)\r\n 500000 0.501 0.000 0.821 0.000 /usr/lib/python3.6/_URL_0_:180(__instancecheck__)\r\n 500000 0.438 0.000 1.808 0.000 /usr/lib/python3.6/collections/__init__.py:586(update)\r\n 100000 0.433 0.000 2.978 0.000 _URL_1_:4(anagram_checker_1)\r\n 1000006 0.320 0.000 0.320 0.000 /usr/lib/python3.6/_weakrefset.py:70(__contains__)\r\n 500000 0.283 0.000 0.283 0.000 {built-in method _collections._count_elements}\r\n 500002 0.225 0.000 1.047 0.000 {built-in method builtins.isinstance}\r\n 1100000 0.090 0.000 0.090 0.000 {built-in method builtins.len}\r\n 1 0.042 0.042 3.020 3.020 < timeit-src > :2(inner)\r\n 300000 0.025 0.000 0.025 0.000 {method &#39;append&#39; of &#39;list&#39; objects}\r\n\r\nSo it&#39;s clearly to see, that Python&#39;s overhead in creating `Counter` objects overrides here any algorithmic complexity advantage. \r\n\r\nEDIT:\r\n\r\nProfiling report from Anagram 2, for comparison:\r\n\r\n ncalls tottime percall cumtime percall filename:lineno(function)\r\n 500000 0.372 0.000 0.372 0.000 {built-in method builtins.sorted}\r\n 100000 0.353 0.000 0.762 0.000 _URL_1_:18(anagram_checker_2)\r\n 1 0.041 0.041 0.803 0.803 < timeit-src > :2(inner)\r\n 300000 0.028 0.000 0.028 0.000 {method &#39;append&#39; of &#39;list&#39; objects}\r\n 100000 0.009 0.000 0.009 0.000 {built-in method builtins.len}", "149" ], [ "Don&#39;t open your file in binary mode (open it without the `b` flag):\r\n\r\n with open(&#39;data_out.csv&#39;, &#39;w&#39;) as f: # output csv file\r\n\r\nComplete source (notice you can have multiple `open()` in with, also I changed %Y to %y in your `strptime`):\r\n\r\n import csv\r\n from datetime import datetime\r\n \r\n with open ( \" ;data.csv \" ;, \" ;r \" ;) as f1, open(&#39;data_out.csv&#39;, &#39;w&#39;) as f: # output csv file\r\n writer = csv.writer(f)\r\n with open(&#39;data.csv&#39;,&#39;r&#39;) as csvfile: # input csv file\r\n reader = csv.reader(csvfile, delimiter=&#39;,&#39;)\r\n next(reader, None)\r\n for row in reader:\r\n dater = row[2]\r\n #print (dater)\r\n my_date = datetime.strptime(dater, &#39;%d-%b-%y&#39;)\r\n kr = (my_date.date())\r\n row[2] = kr\r\n data = [[ \" ;Symbol \" ;, \" ;Series \" ;, \" ;Date \" ;, \" ;Prev Close \" ;, \" ;Open Price \" ;, \" ;High Price \" ;, \" ;Low Price \" ;, \" ;Last Price \" ;, \" ;Close Price \" ;, \" ;Average Price \" ;, \" ;Total Traded Quantity \" ;, \" ;Turnover \" ;, \" ;No. of Trades \" ;, \" ;Deliverable Qty \" ;, \" ;% Dly Qt to Traded Qty \" ;],row]\r\n writer.writerow(row)\r\n\r\nThe output of your file will become:\r\n\r\n BIOCON,EQ,2017-07-21,402.6,403,409.55,393.2,399,400.25,401.52,3032146,<PHONE_NUMBER>,39314,321923,10.62\r\n BIOCON,EQ,2017-07-24,400.25,399,405.9,396.1,399.6,399,401.25,2090835,<PHONE_NUMBER>,25520,<PHONE_NUMBER>,18.79", "288" ], [ "You can use `ast.literal_eval` for converting string to python object. Of course, your input need some modification before that - using `re` module for example:\r\n\r\n from ast import literal_eval\r\n import re\r\n \r\n p_str = \" ;{1=[128, 12, 132], 2=[137, 1, 141, 5, 129, 9], 3=[2, 138, 6, 142]} \" ;\r\n s_str = \" ;{1=[200, 11, 987], 2=[765, 198, 31, 912, 234, 11], 3=[19, 12, 38, 60, 212]} \" ;\r\n \r\n p_str = re.sub(r&#39;(\\d+)\\=&#39;, r&#39; \" ;x\\1 \" ;:&#39;, p_str)\r\n s_str = re.sub(r&#39;(\\d+)\\=&#39;, r&#39; \" ;x\\1 \" ;:&#39;, s_str)\r\n p_d = literal_eval(p_str)\r\n s_d = literal_eval(s_str)\r\n \r\n for k, v in p_d.items():\r\n print(&#39;{{ \" ;text \" ;: \" ;For id {}. \" ;, \" ;p \" ;:{}, \" ;s \" ;:{}}}&#39;.format(k.lstrip(&#39;x&#39;), v, s_d[k]))\r\n\r\nThis will print:\r\n\r\n { \" ;text \" ;: \" ;For id 1. \" ;, \" ;p \" ;:[128, 12, 132], \" ;s \" ;:[200, 11, 987]}\r\n { \" ;text \" ;: \" ;For id 2. \" ;, \" ;p \" ;:[137, 1, 141, 5, 129, 9], \" ;s \" ;:[765, 198, 31, 912, 234, 11]}\r\n { \" ;text \" ;: \" ;For id 3. \" ;, \" ;p \" ;:[2, 138, 6, 142], \" ;s \" ;:[19, 12, 38, 60, 212]}\r\n\r\nFor loading from files you can use this:\r\n\r\n from ast import literal_eval\r\n import re\r\n \r\n with open(&#39;p.txt&#39;, &#39;r&#39;) as p_in, open(&#39;s.txt&#39;, &#39;r&#39;) as s_in:\r\n p_str = p_in.read()\r\n s_str = s_in.read()\r\n \r\n p_str = re.sub(r&#39;(\\d+)\\=&#39;, r&#39; \" ;x\\1 \" ;:&#39;, p_str)\r\n s_str = re.sub(r&#39;(\\d+)\\=&#39;, r&#39; \" ;x\\1 \" ;:&#39;, s_str)\r\n p_d = literal_eval(p_str)\r\n s_d = literal_eval(s_str)\r\n \r\n for k, v in p_d.items():\r\n print(&#39;{{ \" ;text \" ;: \" ;For id {}. \" ;, \" ;p \" ;:{}, \" ;s \" ;:{}}}&#39;.format(k.lstrip(&#39;x&#39;), v, s_d[k]))", "91" ], [ "For finding position of some string in other string, you can use `str.index()` method.\r\n\r\nThis `function()` accepts list and string and yield words that match and position of the word in the string:\r\n\r\n def function(lst, s):\r\n for i in lst:\r\n if i not in s:\r\n continue\r\n yield i, s.index(i)\r\n \r\n \r\n lst = [&#39;house&#39;, &#39;John&#39;, &#39;garden&#39;]\r\n s = &#39;MynameisJohn&#39;\r\n \r\n for word, position in function(lst, s):\r\n print(word, position)\r\n\r\nOutput:\r\n\r\n John 8", "615" ], [ "As with everything in BeautifulSoup, you have many alternatives. For value pairs I tend to use `zip()` function most:\r\n\r\n from bs4 import BeautifulSoup\r\n \r\n html = &#39;&#39;&#39;\\\r\n < tr > \r\n < td > Project ID: < /td > \r\n < td > \r\n < span > 112120 < /span > < /td > \r\n < /tr > \r\n &#39;&#39;&#39;\r\n \r\n soup = BeautifulSoup(html, &#39;lxml&#39;)\r\n \r\n # option 1\r\n td = soup.select(&#39;td&#39;)\r\n for name, value in zip(td, td[1:]):\r\n print(name.text, value.text)\r\n \r\n # option 2\r\n td = soup.find(lambda t: t.text.strip()==&#39;Project ID:&#39;).parent.select(&#39;td&#39;)\r\n for name, value in zip(td, td[1:]):\r\n print(name.text, value.text)\r\n \r\n # option 3\r\n td1 = soup.find(lambda t: t.text.strip()==&#39;Project ID:&#39;)\r\n td2 = td1.find_next(&#39;td&#39;)\r\n print(td1.text, td2.text)\r\n\r\nEvery option prints:\r\n\r\n Project ID: \r\n 112120\r\n\r\n**Option 1** finds all ` < td > ` and zips them together to get desired value pairs.\r\n\r\n**Option 2** finds tag with text &#39;Project ID:&#39;, finds parent (` < tr > `) and zips ` < td > `s together like in Option 1.\r\n\r\n**Option 3** finds tag with text &#39;Project ID:&#39;, finds next ` < td > ` tag and prints text of both of them.", "1017" ], [ "If you replace `price` with `priceText__1853e8a5` you will get your result, but I suspect that the class name changes dynamically/is dynamically generated (note the number at the end). So to get your result you need something more robust.\r\n\r\nYou can target tags in BeautifulSoups with CSS selectors (with `select()`/`select_one()` methods. This example will target all ` < span > ` tags with `class` attribute that begins with `priceText` (`^=` operator - more info about CSS selectors [here][1]).\r\n\r\n from bs4 import BeautifulSoup\r\n import requests\r\n \r\n r = requests.get(&#39;_URL_0_;)\r\n soup = BeautifulSoup(r.text, &#39;lxml&#39;)\r\n \r\n print(soup.select_one(&#39;span[class^= \" ;priceText \" ;]&#39;).text)\r\n\r\nThis prints:\r\n\r\n 2,813.36\r\n\r\n [1]: _URL_1_", "1017" ], [ "In function `g()` you are declaring variable `x` global. That variable doesn&#39;t exists yet in global namespace so when assigning `43` to it, the python creates it in `globals()`.\r\n\r\nNote:\r\nVariable `x` in function `f()` isn&#39;t global, it exists in local namespace of that function.\r\n\r\nTo access variable `x` declared in function `f()` from function `g()`, declare variable `x` in function `g()` `nonlocal`.\r\n\r\nEDIT:\r\n\r\n**Example 1:** x is defined globally and also locally inside f()\r\n\r\n x = 43\r\n def f():\r\n x=42\r\n print(x)\r\n f() # prints 42\r\n print(x) # prints 43\r\n\r\n\r\n**Example 2:** x isn&#39;t defined globally, but inside function f() the x is defined `global`. That means when assigning to x inside function f(), Python will make the variable inside global namespace and you can print it outside function `f()` too:\r\n\r\n def f():\r\n global x\r\n x=42\r\n print(x)\r\n f() # prints 42\r\n print(x) # prints 42", "667" ], [ "The desired behaviour you are mentioning (getting the expression before Python evaluates it) isn&#39;t possible (or easily possible, without digging into very deep of Python internals).\r\n\r\nWhen python sees 2 + 2.0, it will evaluate it first and your function gets the result, 4.0. Your function will not know, how the python got the result in first place.\r\n\r\nOne way to get around this is putting the expression in string and evaluate it lazily with for example `eval()`:\r\n\r\n def func_print(expression):\r\n print( \" ;{} : {} \" ;.format(expression, eval(expression)))\r\n \r\n func_print(&#39;2 + 2.0&#39;)\r\n\r\nThis prints:\r\n\r\n 2 + 2.0 : 4.0\r\n\r\nOverloading builtin functions isn&#39;t good idea, because other functions in your code might depend on the old behaviour. \r\n\r\nBut if you insist, `print()` in Python3 is just classic function, so you can freely do this:\r\n\r\n import sys\r\n \r\n def func_print(expression, *args, **kwargs):\r\n sys.stdout.write( \" ;{} : {}\\n \" ;.format(expression, eval(expression)))\r\n \r\n old_print_function = print\r\n \r\n print = func_print\r\n print(&#39;2 + 2.0&#39;)\r\n \r\n print = old_print_function\r\n\r\nThe result is:\r\n\r\n 2 + 2.0 : 4.0", "91" ], [ "You are creating the certificates but not loading them to the SSL chain. And change your ssl_context creation from `ssl.Purpose.SERVER_AUTH` to `ssl.Purpose.CLIENT_AUTH`:\r\n\r\n from aiohttp import web\r\n import ssl\r\n \r\n async def handle(request):\r\n name = request.match_info.get(&#39;name&#39;, \" ;Anonymous \" ;)\r\n text = \" ;Hello, \" ; + name\r\n return web.Response(text=text)\r\n \r\n app = web.Application()\r\n app.add_routes([web.get(&#39;/&#39;, handle),\r\n web.get(&#39;/{name}&#39;, handle)])\r\n \r\n \r\n ssl_context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)\r\n ssl_context.load_cert_chain(&#39;domain_srv.crt&#39;, &#39;domain_srv.key&#39;)\r\n \r\n web.run_app(app, ssl_context=ssl_context)\r\n\r\nWhen you run your server, the client will print upon connection:\r\n\r\n b&#39;Hello, Anonymous&#39;", "11" ], [ "You can use BeautifulSoup to navigate XML:\r\n\r\n from bs4 import BeautifulSoup\r\n \r\n data = \" ; \" ; \" ; < data > \r\n < number > \r\n 1\r\n < /number > \r\n < text > \r\n abc def\r\n < /text > \r\n < number > \r\n 2\r\n < /number > \r\n < text > \r\n fhi jklmn\r\n < /text > \r\n < /data > \" ; \" ; \" ;\r\n \r\n soup = BeautifulSoup(data, &#39;xml&#39;)\r\n text = input(&#39;Please input your text : &#39;)\r\n t = soup.find(lambda t: False if _URL_0_ != &#39;text&#39; else text in t.string)\r\n if t:\r\n number = t.findPrevious(&#39;number&#39;).text.strip()\r\n print(&#39;Text {} found, the number is {}&#39;.format(text, number))\r\n else:\r\n print(&#39;Text {} not found&#39;.format(text))\r\n\r\nThis will input user for a string and tries to find the string in ` < text > ` tags. If it is found, it will print value contained in ` < number > `.\r\n\r\nExample:\r\n\r\n Please input your text : abc\r\n Text abc found, the number is 1\r\n\r\nEDIT:\r\n\r\nFor searching all tags for given string, not just ` < text > ` change the `find()` function to:\r\n\r\n t = soup.find(lambda t: False if not t.string else text in t.string)", "1017" ], [ "You can use back references in `re.sub` ([online regex here][1]):\r\n\r\n import re\r\n \r\n data = [\r\n \" ;My email <PERSON>d is abcd@g _URL_1_ \" ;,\r\n \" ;Email <PERSON>d: defg@yah _URL_2_ \" ;,\r\n \" ;id is rock@gmail .com \" ;\r\n ]\r\n \r\n for s in data:\r\n print(re.sub(r&#39;(@.*)(\\s+)(.*)&#39;, r&#39;\\1\\3&#39;, s))\r\n\r\nPrints:\r\n\r\n My email Id is abcd@g_URL_1_\r\n Email Id: defg@ya_URL_0_\r\n id is rock@g_URL_1_\r\n\r\nEDIT:\r\n\r\nIf the blank space is before the `@`, the regexp is a little bit tricky (to not match e.g. \" ;aaa bbb ccc k@g_URL_1_ \" ;, [online regex here][2]):\r\n\r\n import re\r\n \r\n data = [\r\n \" ;My email Id is ab cd@g_URL_1_ \" ;,\r\n \" ;Email Id: def g@ya_URL_0_ \" ;,\r\n \" ;id is roc k@g_URL_1_ \" ;,\r\n \" ;aaa bbb ccc k@g_URL_1_ \" ;\r\n ]\r\n \r\n for s in data:\r\n print(re.sub(r&#39;(?=is|:)(.*)\\s+(.*@.*)&#39;, r&#39;\\1\\2&#39;, s))\r\n\r\nPrints:\r\n\r\n My email Id is abcd@g_URL_1_\r\n Email Id: defg@ya_URL_0_\r\n id is rock@g_URL_1_\r\n aaa bbb ccc k@g_URL_1_\r\n\r\nNow we can combine these regexes:\r\n\r\n import re\r\n \r\n data = [\r\n \" ;My email Id is ab cd@g_URL_1_ \" ;,\r\n \" ;Email Id: def g@ya _URL_0_ \" ;,\r\n \" ;id is roc k@gm _URL_3_ \" ;,\r\n \" ;aaa bbb ccc k@g_URL_1_ \" ;\r\n ]\r\n \r\n for s in data:\r\n s = re.sub(r&#39;(@.*)\\s+(.*)&#39;, r&#39;\\1\\2&#39;, s)\r\n s = re.sub(r&#39;(?=is|:)(.*)\\s+(.*@.*)&#39;, r&#39;\\1\\2&#39;, s)\r\n print(s)\r\n\r\nWill print:\r\n\r\n My email Id is abcd@g_URL_1_\r\n Email Id: defg@ya_URL_0_\r\n id is rock@g_URL_1_\r\n aaa bbb ccc k@g_URL_1_\r\n\r\n [1]: _URL_5_\r\n [2]: _URL_4_", "286" ], [ "When all files are sorted on their own (like in your example), you can use `heapq.merge` ([docs here][1]) with `key` argument to merge them. This example is with two files, but you can merge arbitrary number of files this way: \r\n\r\n from heapq import merge\r\n \r\n with open(&#39;f1.txt&#39;, &#39;r&#39;, newline=&#39;&#39;) as f1_in, \\\r\n open(&#39;f2.txt&#39;, &#39;r&#39;, newline=&#39;&#39;) as f2_in, \\\r\n open(&#39;data_out.txt&#39;, &#39;w&#39;, newline=&#39;&#39;) as f_out:\r\n \r\n for line in merge(f1_in, f2_in, key=lambda l: int(l.split(&#39; &#39;)[0])):\r\n f_out.write(line)\r\n\r\nLines in output file will look like:\r\n\r\n 0 eapceou79 289109.1707774 345638.6043512\r\n 8 upchimy79 291160.8516853 345706.9991016\r\n 9 upchimy79 291160.8516853 345706.9991016\r\n 60 eapceou79 289091.8125863 345656.2855532\r\n 70 upchimy79 291178.7591454 345733.5179607\r\n 120 eapceou79 289041.8477906 345702.7290361\r\n 134 upchimy79 291391.9184244 345688.8950164\r\n 183 eapceou79 288993.3282226 345747.8902265\r\n 190 upchimy79 291511.4331200 345634.4573389\r\n 215 eapceou79 289074.9134241 345759.2455079\r\n\r\n\r\n [1]: _URL_0_", "782" ], [ "You can store your functions in dictionary, where values are desired functions. That way, you have easy access to them by keys and you can traverse categories normally:\r\n\r\n categories = [&#39;Creams&#39;, &#39;Bath&#39;, &#39;Personal Care&#39;]\r\n \r\n my_dict = {\r\n &#39;Conditioners&#39;: lambda: print(1),\r\n &#39;Bath&#39;: lambda: print(2),\r\n &#39;Shaving Gels&#39;: lambda: print(3)\r\n }\r\n \r\n \r\n for category in categories:\r\n fn = my_dict.get(category, lambda: None)\r\n fn()\r\n\r\nOutput:\r\n\r\n 2", "58" ], [ "from bs4 import BeautifulSoup\r\n from collections import OrderedDict\r\n from pprint import pprint\r\n \r\n soup = BeautifulSoup(data, &#39;lxml&#39;)\r\n \r\n d = OrderedDict()\r\n for th, td in zip(soup.select(&#39;th&#39;), soup.select(&#39;td&#39;)[<IP_ADDRESS>2]):\r\n d[th.text.strip()] = td.text.strip().splitlines()\r\n \r\n pprint(d)\r\n\r\nPrints:\r\n\r\n OrderedDict([(&#39;Mon&#39;, [&#39;2:00 pm - 3:00 pm&#39;, &#39;5:00 pm - 10:00 pm&#39;]),\r\n (&#39;Tue&#39;, [&#39;2:00 pm - 3:00 pm&#39;, &#39;5:00 pm - 10:00 pm&#39;]),\r\n (&#39;Wed&#39;, [&#39;2:00 pm - 3:00 pm&#39;, &#39;5:00 pm - 10:00 pm&#39;]),\r\n (&#39;Thu&#39;, [&#39;2:00 pm - 3:00 pm&#39;, &#39;5:00 pm - 10:00 pm&#39;]),\r\n (&#39;Fri&#39;, [&#39;2:00 pm - 3:00 pm&#39;, &#39;5:00 pm - 10:00 pm&#39;]),\r\n (&#39;Sat&#39;, [&#39;5:00 pm - 10:00 pm&#39;]),\r\n (&#39;Sun&#39;, [&#39;Closed&#39;])])", "1017" ], [ "You can use CSS selector, that is built within BeautifulSoup (methods `select()` and `select_one()`):\r\n\r\n data = \" ; \" ; \" ; < div class= \" ;style3 \" ; id= \" ;weather_today_content \" ; > \r\n < img alt= \" ; \" ; src= \" ;/database/img/weather_today.jpg?ver=2018-08-01 \" ; style= \" ;width: 400px \" ;/ > \r\n < /div > \" ; \" ; \" ;\r\n \r\n \r\n from bs4 import BeautifulSoup\r\n \r\n soup = BeautifulSoup(data, &#39;lxml&#39;) \r\n print(soup.select_one(&#39;div#weather_today_content img&#39;)[&#39;src&#39;])\r\n\r\nPrints:\r\n\r\n /database/img/weather_today.jpg?ver=2018-08-01\r\n\r\nThe selector `div#weather_today_content img` means select ` < div > ` with `id=weather_today_content` and withing this ` < div > ` select an ` < img > `.", "1017" ], [ "From the `eval(expression, globals=None, locals=None)` [docs][1]:\r\n\r\n > If the globals dictionary is present and lacks ‘`__builtins__`’, the\r\n > current globals are copied into globals before expression is parsed.\r\n > This means that expression normally has full access to the standard\r\n > `__builtin__` module and restricted environments are propagated.\r\n\r\nBut you are setting `__builtins__` to `None` in the globals dictionary, so your code will evaluate to `None[&#39;potato&#39;]` which leads to:\r\n\r\n TypeError: &#39;NoneType&#39; object is not subscriptable\r\n\r\nEDIT:\r\n\r\nPython2.7 raises `NameError` if it doesn&#39;t find the variable in `__builtins__` - [source code][2]. `NAME_ERROR_MSG` is defined as:\r\n\r\n #define NAME_ERROR_MSG \\\r\n \" ;name &#39;%.200s&#39; is not defined \" ;\r\n\r\nPython3 print different message - see [source][3] - the `PyObject_GetItem` will not raise `KeyError` but `TypeError` so the string is formatted differently, in this case `TypeError: &#39;NoneType&#39; object is not subscriptable`\r\n\r\nIn CPython, the name `__builtins__` can be bound to a module or a dictionary. That is [documented under the execution model][4]:\r\n\r\n > The builtins namespace associated with the execution of a code block is actually found by looking up the name `__builtins__` in its global namespace; this should be a dictionary or a module (in the latter case the module’s dictionary is used).\r\n\r\n [1]: _URL_3_\r\n [2]: _URL_1_\r\n [3]: _URL_0_\r\n [4]: _URL_2_", "667" ], [ "You can use `re` for changing/manipulating strings ([explanation of this regex on external site][1]):\r\n\r\n data = \" ; \" ; \" ;\r\n # PRIMER_PRODUCT_SIZE_RANGE=xxx-yyy\r\n PRIMER_PRODUCT_SIZE_RANGE=100-300\r\n PRIMER_NUM_RETURN=3\r\n PRIMER_MAX_END_STABILITY=9.0\r\n \r\n PRIMER_MAX_HAIRPIN_TH=24.0\r\n \" ; \" ; \" ;\r\n \r\n import re\r\n \r\n def change_parameter(data, parameter, new_value):\r\n return re.sub(r&#39;^(\\s*(? < !#)\\s*{}\\s*)=.*$&#39;.format(parameter), r&#39;\\1={}&#39;.format(new_value), data, flags=re.M|re.I)\r\n \r\n data = change_parameter(data, &#39;PRIMER_PRODUCT_SIZE_RANGE&#39;, &#39;100-500&#39;)\r\n data = change_parameter(data, &#39;PRIMER_MAX_HAIRPIN_TH&#39;, &#39;99.9&#39;)\r\n print(data)\r\n\r\nThis prints:\r\n\r\n\r\n # PRIMER_PRODUCT_SIZE_RANGE=xxx-yyy\r\n PRIMER_PRODUCT_SIZE_RANGE=100-500\r\n PRIMER_NUM_RETURN=3\r\n PRIMER_MAX_END_STABILITY=9.0\r\n \r\n PRIMER_MAX_HAIRPIN_TH=99.9\r\n\r\nFor reading/writing to file you can use this snippet:\r\n\r\n with open(&#39;parameters.txt&#39;, &#39;r&#39;, newline=&#39;&#39;) as f_in:\r\n data = f_in.read()\r\n \r\n with open(&#39;parameters.txt&#39;, &#39;w&#39;, newline=&#39;&#39;) as f_out:\r\n data = change_parameter(data, &#39;PRIMER_PRODUCT_SIZE_RANGE&#39;, &#39;100-500&#39;)\r\n data = change_parameter(data, &#39;PRIMER_MAX_HAIRPIN_TH&#39;, &#39;99.9&#39;)\r\n f_out.write(data)\r\n\r\nEDIT:\r\n\r\nExtended version of `change_parameter()`:\r\n\r\n import re\r\n data = \" ; \" ; \" ;\r\n PRIMER_PRODUCT_SIZE_RANGE=100-500 200-400\r\n PRIMER_NUM_RETURN=3\r\n PRIMER_MAX_END_STABILITY=9.0\r\n \" ; \" ; \" ;\r\n \r\n def change_parameter_ext(data, parameter, old_value, new_value):\r\n def _my_sub(g):\r\n return g[1] + &#39;=&#39; + re.sub(r&#39;{}&#39;.format(old_value), new_value, g[2], flags=re.I).strip()\r\n return re.sub(r&#39;^(\\s*(? < !#)\\s*{}\\s*)=(.*)$&#39;.format(parameter), _my_sub, data, flags=re.M|re.I).strip()\r\n \r\n data = change_parameter_ext(data, &#39;PRIMER_PRODUCT_SIZE_RANGE&#39;, &#39;200-400&#39;, &#39;500-600&#39;)\r\n data = change_parameter_ext(data, &#39;PRIMER_NUM_RETURN&#39;, &#39;3&#39;, &#39;100-200 300-400&#39;)\r\n print(data)\r\n\r\nPrints:\r\n\r\n PRIMER_PRODUCT_SIZE_RANGE=100-500 500-600\r\n PRIMER_NUM_RETURN=100-200 300-400\r\n PRIMER_MAX_END_STABILITY=9.0\r\n\r\n [1]: _URL_0_", "286" ], [ "You can use CSS selectors built-in within BeautifulSoup. Selector `option[selected]` will find tag ` < option > ` with attribute `selected`:\r\n\r\n data = \" ; \" ; \" ; < select name= \" ;month \" ; onchange= \" ;submit() \" ; > \r\n < option value= \" ;09 \" ; selected= \" ; \" ; > 09 < /option > \r\n < option value= \" ;10 \" ; > 10 < /option > < option value= \" ;11 \" ; > 11 < /option > \r\n < /select > \" ; \" ; \" ;\r\n \r\n from bs4 import BeautifulSoup\r\n \r\n soup = BeautifulSoup(data, &#39;lxml&#39;)\r\n \r\n print(soup.select_one(&#39;option[selected]&#39;).text)\r\n\r\nPrints:\r\n\r\n 09\r\n\r\nEdit:\r\n\r\n If you want to find option with value=08, you can do CSS selector `option[value=08]`:\r\n \r\n data = \" ; \" ; \" ; < select name= \" ;month \" ; onchange= \" ;submit() \" ; > \r\n < option value= \" ;08 \" ; > 08 < /option > \r\n < option value= \" ;09 \" ; selected= \" ; \" ; > 09 < /option > \r\n < option value= \" ;10 \" ; > 10 < /option > < option value= \" ;11 \" ; > 11 < /option > \r\n < /select > \" ; \" ; \" ;\r\n \r\n from bs4 import BeautifulSoup\r\n \r\n soup = BeautifulSoup(data, &#39;lxml&#39;)\r\n \r\n print(soup.select_one(&#39;option[value=08]&#39;))\r\n\r\nPrints:\r\n\r\n < option value= \" ;08 \" ; > 08 < /option >", "1017" ], [ "You can scrap links using CSS selector. Selector `div.sabai-directory-title a` will find any ` < a > ` tags inside ` < div > ` tag with class `sabai-directory-title` (I updated the URL, yours was giving me error pages):\r\n\r\n from bs4 import BeautifulSoup\r\n import requests\r\n from pprint import pprint\r\n \r\n r = requests.get(&#39;_URL_4_;)\r\n soup = BeautifulSoup(r.text, &#39;lxml&#39;)\r\n \r\n hrefs = [a[&#39;href&#39;] for a in soup.select(&#39;div.sabai-directory-title a&#39;)]\r\n \r\n pprint(hrefs)\r\n\r\nThis will print:\r\n\r\n [&#39;_URL_8_;,\r\n &#39;_URL_3_;,\r\n &#39;_URL_1_;,\r\n &#39;_URL_16_;,\r\n &#39;_URL_0_;,\r\n &#39;_URL_13_;,\r\n &#39;_URL_10_;,\r\n &#39;_URL_20_;,\r\n &#39;_URL_12_;,\r\n &#39;_URL_7_;,\r\n &#39;_URL_11_;,\r\n &#39;_URL_14_;,\r\n &#39;_URL_9_;,\r\n &#39;_URL_18_;,\r\n &#39;_URL_2_;,\r\n &#39;_URL_17_;,\r\n &#39;_URL_19_;,\r\n &#39;_URL_6_;,\r\n &#39;_URL_5_;,\r\n &#39;_URL_15_;]", "1017" ], [ "After the examples in Wikipedia about what is Diagonally dominant matrix ([link][1]), why are you having `sum` global? `sum` needs to be computed only for each row:\r\n\r\n A=[[7,2,1],\r\n [1,7,2],\r\n [1,2,7]]\r\n \r\n def isDiagonallyDominantMatrix(A):\r\n for i, row in enumerate(A):\r\n s = sum(abs(v) for j, v in enumerate(row) if i != j)\r\n if s > abs(row[i]):\r\n return False\r\n return True\r\n \r\n if(isDiagonallyDominantMatrix(A)):\r\n print(&#39;yes&#39;)\r\n else:\r\n print(&#39;no&#39;)\r\n\r\nThis prints:\r\n\r\n yes\r\n\r\nNote: Don&#39;t use `0` or `1` for indicating `False` or `True`. Python has constants for it.\r\n\r\n [1]: _URL_0_", "493" ], [ "Explanation of this regexps [here][1] and [here][2]. Assuming your data is stored in `data.txt`:\r\n\r\n import re\r\n \r\n with open(&#39;data.txt&#39;, &#39;r&#39;, newline=&#39;&#39;) as f_in, \\\r\n open(&#39;links.txt&#39;, &#39;w&#39;, newline=&#39;&#39;) as links_out, \\\r\n open(&#39;titles.txt&#39;, &#39;w&#39;, newline=&#39;&#39;) as titles_out:\r\n \r\n data = f_in.read()\r\n \r\n for link in re.findall(r&#39;(?:href= \" ;)([^ \" ;]+)&#39;, data):\r\n links_out.write(link + &#39;\\n&#39;)\r\n \r\n for title in re.findall(r&#39;(?: > )(.*?)$&#39;, data, flags=re.M):\r\n titles_out.write(title + &#39;\\n&#39;)\r\n\r\nIn titles.txt you will have:\r\n\r\n Scotland - Wikipedia\r\n VisitScotland - Official Site\r\n BBC Scotland News - Official Site\r\n Scotland travel - Lonely Planet\r\n\r\nIn links.txt you will have:\r\n\r\n _URL_0_/wiki/Scotland\r\n _URL_1_\r\n _URL_3_\r\n _URL_4_\r\n\r\nNote:\r\nThe parsing of HTML document is better done and more robust with `BeautifulSoup` or similar libraries.\r\n\r\nEDIT:\r\n\r\nTo parse only domains, you can use `urllib.urlparse`:\r\n\r\n # on the top:\r\n from urllib.parse import urlparse\r\n\r\n for link in re.findall(r&#39;(?:href= \" ;)([^ \" ;]+)&#39;, data):\r\n url = urlparse(link)\r\n links_out.write(url.scheme + &#39;://&#39; + url.netloc + &#39;\\n&#39;)\r\n\r\nThe links.txt will look:\r\n\r\n _URL_0_\r\n _URL_2_\r\n _URL_9_\r\n _URL_8_\r\n\r\n [1]: _URL_5_\r\n [2]: _URL_6_", "417" ], [ "You need to specify `User-Agent` in headers, also `twitter:title` is in `name` attribute:\r\n\r\n from bs4 import BeautifulSoup\r\n import requests\r\n \r\n url = &#39;_URL_0_;\r\n \r\n headers = {&#39;User-Agent&#39;: &#39;Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0&#39;}\r\n response = requests.get(url, headers=headers)\r\n \r\n soup = BeautifulSoup(response.text, \" ;lxml \" ;)\r\n \r\n title1 = soup.select_one(&#39;meta[name=twitter:title]&#39;)[&#39;content&#39;]\r\n title2 = soup.select_one(&#39;meta[property=og:title]&#39;)[&#39;content&#39;]\r\n title3 = soup.select_one(&#39;meta[property=og:description]&#39;)[&#39;content&#39;]\r\n \r\n print( \" ;TITLE1: \" ;+str(title1))\r\n print( \" ;TITLE2: \" ;+str(title2))\r\n print( \" ;TITLE3: \" ;+str(title3))\r\n\r\nPrints:\r\n\r\n TITLE1: <PERSON> is a corporate cash-in, but it fakes sincerity better than most\r\n TITLE2: <PERSON> is a corporate cash-in, but it fakes sincerity better than most\r\n TITLE3: <PERSON> and pals return to give their old friend a pep talk in a movie overshadowed by the company that made it.", "1017" ], [ "In Python until recently, `dict` objects are unordered. To have ordered dictionary type, you need to use for example `OrderedDict` from `collections` module ([docs here][1]):\r\n\r\n from collections import OrderedDict\r\n from pprint import pprint\r\n \r\n c = OrderedDict((\r\n (&#39;Date#1&#39;, &#39;07/03/2018&#39;),\r\n (&#39;Item#1&#39;, &#39;789807&#39;),\r\n (&#39;Description#1&#39;, &#39;Wooden Blocks&#39;),\r\n (&#39;Qty#1&#39;, &#39;4&#39;),\r\n (&#39;Unit_Price#1&#39;, &#39;$10.00&#39;),\r\n (&#39;Discount#1&#39;, &#39;$2.00&#39;),\r\n (&#39;Total#1&#39;, &#39;$38.00&#39;),\r\n (&#39;Date#2&#39;, &#39;07/03/2018&#39;),\r\n (&#39;Item#2&#39;, &#39;789808&#39;),\r\n (&#39;Description#2&#39;, &#39;Magnetic Alphabets&#39;),\r\n (&#39;Qty#2&#39;, &#39;5&#39;),\r\n (&#39;Unit_Price#2&#39;, &#39;$10.00&#39;),\r\n (&#39;Discount#2&#39;, &#39;$2.00&#39;),\r\n (&#39;Total#2&#39;, &#39;$48.00&#39;),\r\n (&#39;Date#3&#39;, &#39;07/03/2018&#39;),\r\n (&#39;Item#3&#39;, &#39;769804&#39;),\r\n (&#39;Description#3&#39;, &#39;Building Blocks Flat&#39;),\r\n (&#39;Qty#3&#39;, &#39;3&#39;),\r\n (&#39;Unit_Price#3&#39;, &#39;$23.00&#39;),\r\n (&#39;Discount#3&#39;, &#39;$2.00&#39;),\r\n (&#39;Total#3&#39;, &#39;$67.00&#39;)\r\n ))\r\n \r\n groups, actual_group = [], OrderedDict()\r\n \r\n for k, v in c.items():\r\n if k.startswith(&#39;Date&#39;):\r\n if actual_group:\r\n groups.append(actual_group)\r\n actual_group = OrderedDict()\r\n actual_group[k] = v\r\n \r\n if actual_group:\r\n groups.append(actual_group)\r\n \r\n pprint(groups)\r\n\r\nThis code will produce 3 groups of `OrderedDict`:\r\n\r\n [OrderedDict([(&#39;Date#1&#39;, &#39;07/03/2018&#39;),\r\n (&#39;Item#1&#39;, &#39;789807&#39;),\r\n (&#39;Description#1&#39;, &#39;Wooden Blocks&#39;),\r\n (&#39;Qty#1&#39;, &#39;4&#39;),\r\n (&#39;Unit_Price#1&#39;, &#39;$10.00&#39;),\r\n (&#39;Discount#1&#39;, &#39;$2.00&#39;),\r\n (&#39;Total#1&#39;, &#39;$38.00&#39;)]),\r\n OrderedDict([(&#39;Date#2&#39;, &#39;07/03/2018&#39;),\r\n (&#39;Item#2&#39;, &#39;789808&#39;),\r\n (&#39;Description#2&#39;, &#39;Magnetic Alphabets&#39;),\r\n (&#39;Qty#2&#39;, &#39;5&#39;),\r\n (&#39;Unit_Price#2&#39;, &#39;$10.00&#39;),\r\n (&#39;Discount#2&#39;, &#39;$2.00&#39;),\r\n (&#39;Total#2&#39;, &#39;$48.00&#39;)]),\r\n OrderedDict([(&#39;Date#3&#39;, &#39;07/03/2018&#39;),\r\n (&#39;Item#3&#39;, &#39;769804&#39;),\r\n (&#39;Description#3&#39;, &#39;Building Blocks Flat&#39;),\r\n (&#39;Qty#3&#39;, &#39;3&#39;),\r\n (&#39;Unit_Price#3&#39;, &#39;$23.00&#39;),\r\n (&#39;Discount#3&#39;, &#39;$2.00&#39;),\r\n (&#39;Total#3&#39;, &#39;$67.00&#39;)])]\r\n\r\n\r\n [1]: _URL_0_", "58" ], [ "You can use CSS selector to target your tags with methods `select()`/`select_one()`. Selector `div.hello2 span` will target ` < span > ` tag under ` < div > ` tag with class `hello2`:\r\n\r\n from bs4 import BeautifulSoup as b\r\n \r\n data = \" ; \" ; \" ;\r\n < div class= \" ;hello1 \" ; > \r\n < span class= \" ;string1 \" ; > This is string 1 < /span > \r\n < span class= \" ;string2 \" ; > This is string 2 < /span > \r\n < /div > \r\n < div class= \" ;hello2 \" ; > \r\n < span class= \" ;string1 \" ; > Another String 1 < /span > \r\n < /div > \" ; \" ; \" ;\r\n \r\n bsObj = b(data, &#39;html.parser&#39;)\r\n \r\n print(bsObj.select_one(&#39;div.hello2 span&#39;).text)\r\n\r\nPrints:\r\n\r\n Another String 1", "1017" ], [ "For grouping elements you can use `groupby` from `itertools` ([docs here][1]). This code snippet will find sublist with maximal consecutive elements that each element < = number (8 in this case): \r\n\r\n from itertools import groupby\r\n \r\n l = [4, 5, 2, 19, 3, 8, 9]\r\n number = 8\r\n \r\n print(max([list(g) for v, g in groupby(l, key=lambda v: v < = number) if v], key=len))\r\n\r\nThis will print:\r\n\r\n [4, 5, 2]\r\n\r\nEDIT (to explain):\r\n\r\n**1.step** is to find groups where elements are < = of selected number:\r\n\r\n for v, g in groupby(l, key=lambda v: v < = number):\r\n print(v, list(g))\r\n\r\nPrints:\r\n\r\n True [4, 5, 2]\r\n False [19]\r\n True [3, 8]\r\n False [9]\r\n\r\n**2.step** is filter out `False` groups:\r\n\r\n print([list(g) for v, g in groupby(l, key=lambda v: v < = number) if v])\r\n\r\nPrints:\r\n\r\n [[4, 5, 2], [3, 8]]\r\n\r\n**3.step** is find sublist with maximum number of elements (`max()` function with `key` argument, as key we use `len()` function):\r\n\r\n print(max([list(g) for v, g in groupby(l, key=lambda v: v < = number) if v], key=len))\r\n\r\nPrints:\r\n\r\n [4, 5, 2]\r\n\r\n\r\n\r\n [1]: _URL_0_", "319" ], [ "Fir searching elements you can use `lambda` and `tag.text`:\r\n\r\n from bs4 import BeautifulSoup\r\n import re\r\n \r\n data = \" ; \" ; \" ;\r\n < B > < A NAME= \" ;toc96446_13 \" ; > < /A > TEXT < /B > < /P > \r\n \" ; \" ; \" ;\r\n soup = BeautifulSoup(data, &#39;html5lib&#39;)\r\n print(soup.find(lambda t: _URL_0_==&#39;b&#39; and re.search(r&#39;TEXT&#39;, t.text)))\r\n\r\nPrints:\r\n\r\n < b > < a name= \" ;toc96446_13 \" ; > < /a > TEXT < /b > \r\n \r\nFor **only** digits, you can leverage `regexp` `^` and `$` constants (note, this will match only first ` < p > ` tag with `169` inside, not second with `ab1234` inside):\r\n\r\n soup = BeautifulSoup( \" ; < p > 169 < /p > < p > ab1234 < /p > \" ;, &#39;html5lib&#39;)\r\n print(soup.find(&#39;p&#39;, text=re.compile(r&#39;^\\d+$&#39;)))\r\n\r\nPrints:\r\n\r\n < p > 169 < /p >", "1017" ], [ "Actually, the behaviour it&#39;s not the same.\r\n\r\nFrom the documentation of `super()` ([docs here][1]):\r\n\r\n > Return a proxy object that delegates method calls to a parent or\r\n > sibling class of type.\r\n\r\nSo if you have:\r\n\r\n class MyParentClass:\r\n def __init__(self):\r\n print(&#39;MyParentClass.__init__ called!&#39;)\r\n \r\n class SubClass(MyParentClass):\r\n def __init__(self):\r\n super(MyParentClass, self).__init__()\r\n\r\nThe call:\r\n\r\n super(MyParentClass, self).__init__()\r\n\r\nhas no effect, because `MyParentClass` has no parents but `object`.\r\n\r\nIf you call:\r\n\r\n super(SubClass, self).__init__()\r\n\r\nIt will print:\r\n\r\n MyParentClass.__init__ called!\r\n\r\nBecause `SubClass` has one parent, `MyParentClass`.\r\n\r\n\r\n [1]: _URL_0_", "689" ], [ "Your code is almost ok. For selecting all ` < a > ` tags with `href` attribute, you can use CSS selector `soup.select(&#39;a[href]&#39;)`. Then just iterate found elements and print URLs and text inside them:\r\n\r\n html = \" ; \" ; \" ; < html > \r\n < head > \r\n < title > About me < /title > \r\n \r\n < /head > \r\n \r\n < body > \r\n < h1 > About Me < /h1 > \r\n \r\n < h4 > My Hobbies < /h4 > \r\n < a href= \" ;_URL_3_; hello world < /a > \r\n < a href= \" ;_URL_2_ < /a > \r\n \r\n < ul > \r\n < li > Cooking < /li > \r\n < li > Gym < /li > \r\n < li > Code < /li > \r\n < /ul > \r\n < /body > \r\n < /html > \" ; \" ; \" ;\r\n \r\n from bs4 import BeautifulSoup\r\n soup = BeautifulSoup(html, &#39;lxml&#39;)\r\n \r\n print([(a[&#39;href&#39;], a.text.strip()) for a in soup.select(&#39;a[href]&#39;)])\r\n\r\nPrints:\r\n\r\n [(&#39;_URL_1_;, &#39;hello world&#39;), (&#39;_URL_0_;, &#39;byeworld&#39;)]", "1017" ], [ "Another attempt, using `re` module ([explanation of regexp here][1]):\r\n\r\n import re\r\n from itertools import chain\r\n \r\n string = &#39;python programming&#39; # string\r\n start = &#39;p&#39; # start\r\n end = &#39;g&#39; # end\r\n \r\n groups = re.finditer(rf&#39;(?=({start}.*{end}))(?=({start}.*?{end}))&#39;, string)\r\n s = set(chain.from_iterable([(g.start(1), g.end(1), g[1]), (g.start(2), g.end(2), g[2])] for g in groups))\r\n print([i[2] for i in s])\r\n\r\nPrints:\r\n\r\n [&#39;prog&#39;, &#39;python prog&#39;, &#39;programming&#39;, &#39;python programming&#39;]\r\n\r\n\r\n [1]: _URL_0_", "761" ], [ "Assuming `data` will hold the HTML text:\r\n\r\n from bs4 import BeautifulSoup\r\n from pprint import pprint\r\n\r\n soup = BeautifulSoup(data, &#39;lxml&#39;)\r\n rows = []\r\n for tr in soup.select(&#39;tr&#39;):\r\n row = [td.text.strip() for td in tr.select(&#39;td&#39;) if td.text.strip() and td.text.strip() != &#39;-&#39;]\r\n if row:\r\n rows.append(row)\r\n \r\n pprint(rows, width=120)\r\n\r\nThis will print:\r\n\r\n [[&#39;4342141&#39;, &#39;25.07.2018 09:00&#39;, &#39;Golbasi Ankara, Turkey&#39;, &#39;Konya Havalimani Turkey&#39;],\r\n [&#39;4134123&#39;, &#39;26.07.2018 09:00&#39;, &#39;Kucuktepe, Van, Turkey&#39;, &#39;Maltepe, Istanbul, Turkey&#39;]]\r\n\r\nFor writing the `rows` list to csv you can use this script:\r\n\r\n import csv\r\n \r\n with open(&#39;data.csv&#39;, &#39;w&#39;, newline=&#39;&#39;) as f:\r\n writer = csv.writer(f)\r\n writer.writerows(rows)\r\n\r\nThen in `data.csv` file you will have:\r\n\r\n 4342141,25.07.2018 09:00, \" ;Golbasi Ankara, Turkey \" ;,<PERSON><PHONE_NUMBER>:00&#39;, &#39;Golbasi Ankara, Turkey&#39;, &#39;Konya Havalimani Turkey&#39;],\r\n [&#39;4134123&#39;, &#39;<PHONE_NUMBER>:00&#39;, &#39;Kucuktepe, Van, Turkey&#39;, &#39;Maltepe, Istanbul, Turkey&#39;]]\r\n\r\nFor writing the `rows` list to csv you can use this script:\r\n\r\n import csv\r\n \r\n with open(&#39;data.csv&#39;, &#39;w&#39;, newline=&#39;&#39;) as f:\r\n writer = csv.writer(f)\r\n writer.writerows(rows)\r\n\r\nThen in `data.csv` file you will have:\r\n\r\n 4342141,<PHONE_NUMBER>:00, \" ;Golbasi Ankara, Turkey \" ;,Konya Havalimani Turkey\r\n 4134123,<PHONE_NUMBER>:00, \" ;Kucuktepe, Van, Turkey \" ;, \" ;Maltepe, Istanbul, Turkey \" ;", "1017" ], [ "You can use `StringIO` class ([docs here][1]) to write to memory (without creating any file) and then write to terminal. This example will write CSV data to `StringIO` object and prints it:\r\n\r\n import csv\r\n from io import StringIO # from StringIO import StringIO in case of Python2\r\n \r\n test = [{&#39;col1&#39;:1, &#39;col2&#39;:2, &#39;col3&#39;:3},\r\n {&#39;col1&#39;:4, &#39;col2&#39;:5, &#39;col3&#39;:6}]\r\n \r\n output_file = StringIO(newline=&#39;&#39;)\r\n \r\n dict_writer = csv.DictWriter(output_file, [&#39;col1&#39;, &#39;col2&#39;, &#39;col3&#39;])\r\n dict_writer.writeheader()\r\n dict_writer.writerows(test)\r\n \r\n output_file.seek(0)\r\n print(output_file.read())\r\n\r\nPrints:\r\n\r\n col1,col2,col3\r\n 1,2,3\r\n 4,5,6\r\n\r\nEdit:\r\n\r\nFor writing to multiple CSV files you can use this snippet:\r\n\r\n import csv\r\n from io import StringIO\r\n \r\n test = [{&#39;col1&#39;:1, &#39;col2&#39;:2, &#39;col3&#39;:3},\r\n {&#39;col1&#39;:4, &#39;col2&#39;:5, &#39;col3&#39;:6}]\r\n \r\n output_file = StringIO(newline=&#39;&#39;)\r\n \r\n dict_writer = csv.DictWriter(output_file, [&#39;col1&#39;, &#39;col2&#39;, &#39;col3&#39;])\r\n dict_writer.writeheader()\r\n dict_writer.writerows(test)\r\n \r\n with open(&#39;work1.csv&#39;, &#39;w&#39;, newline=&#39;&#39;) as f1_out, \\\r\n open(&#39;work2.csv&#39;, &#39;w&#39;, newline=&#39;&#39;) as f2_out:\r\n \r\n f1_out.write(output_file.getvalue())\r\n f2_out.write(output_file.getvalue())\r\n\r\nThis will create two files `work1.csv` and `work2.csv`.\r\n\r\n\r\n [1]: _URL_0_", "288" ], [ "This page isn&#39;t very friendly to web scraping. I made a function `get_text()` that takes two parameters, `tag_from` and `tag_to`. It will scrape all text between these two tags:\r\n\r\n from bs4 import BeautifulSoup, NavigableString\r\n import requests\r\n \r\n soup = BeautifulSoup(requests.get(&#39;_URL_0_;).text, &#39;lxml&#39;)\r\n \r\n def get_text(tag_from, tag_to):\r\n rv = &#39;&#39;\r\n while True:\r\n s = tag_from.next_sibling\r\n if s == tag_to:\r\n break\r\n if isinstance(s, NavigableString):\r\n rv += s\r\n else:\r\n rv += s.text\r\n tag_from = tag_from.next_sibling\r\n return rv.strip()\r\n \r\n s = get_text(soup.select_one(&#39;#Acquisition&#39;).parent, soup.select_one(&#39;#Acquisition&#39;).parent.find_next(&#39;table&#39;))\r\n print(s)\r\n\r\nPrints:\r\n\r\n Frost&#39;s component blueprints are acquired from Lieutenant <PERSON> & Captain <PERSON> (Exta, Ceres).\r\n\r\nEDIT:\r\n\r\nOn this page this text isn&#39;t easily targetable, no tag that encapsulates it. So my method is going from one tag and building the string from all content I find along the way until the end tag.\r\n\r\nSome of the content is of type `NavigableString` (plain text), some of the content is other tags (I get the string from these tags with `.text` property).", "1017" ], [ "You can try CSS selectors built-in within BeautifulSoup. This will select all span whose ids are beginning with `ContentPlaceHolder`:\r\n\r\n soup.select(&#39;span[id^=ContentPlaceHolder]&#39;)\r\n\r\nExample:\r\n\r\n from bs4 import BeautifulSoup\r\n \r\n html = \" ; \" ; \" ; < span id=&#39;ContentPlaceHolder_0&#39; > 0 < /span > \r\n < span id=&#39;ContentPlaceHolder_1&#39; > 1 < /span > \r\n < span id=&#39;ContentPlaceHolder_2&#39; > 2 < /span > \r\n < span id=&#39;ContentPlaceHolder_3&#39; > 3 < /span > \r\n \r\n < span id=&#39;xxx&#39; > xxx < /span > \" ; \" ; \" ;\r\n \r\n soup = BeautifulSoup(html, &#39;lxml&#39;)\r\n \r\n for s in soup.select(&#39;span[id^=ContentPlaceHolder]&#39;):\r\n print(s.text)\r\n\r\nPrints:\r\n\r\n 0\r\n 1\r\n 2\r\n 3", "1017" ], [ "I want to match every substring that begins with `w` and ends `d` with regex.\r\n\r\nFor example for input `worldworld` it should return\r\n`(&#39;worldworld&#39;, &#39;world&#39;, &#39;world&#39;)`. (note: there are two `world` but they are different because they are at different position in the string)\r\n\r\nFor this purpose I ended with this program [with following regex][1]:\r\n\r\n import re\r\n \r\n s = &#39;&#39;&#39;worldworld&#39;&#39;&#39;\r\n \r\n for g in re.finditer(r&#39;(?=(w.*d))(?=(w.*?d))&#39;, s):\r\n print(g.start(1), g.end(1), g[1])\r\n print(g.start(2), g.end(2), g[2])\r\n print(&#39;-&#39; * 40)\r\n\r\nThis prints:\r\n\r\n 0 10 worldworld\r\n 0 5 world\r\n ----------------------------------------\r\n 5 10 world\r\n 5 10 world\r\n ----------------------------------------\r\n\r\nIt finds all substrings, but some are duplicates also (notice the starting and ending position of the group). \r\n\r\nI can filter the groups afterwards with group&#39;s starting and ending position, but I&#39;m wondering if it can be done with change to my regex, to only return unique groups.\r\n\r\nCan I change this regex to only match group that is different from other? If yes how? I&#39;m open to suggestions how to solve this problem.\r\n\r\n [1]: _URL_0_", "772" ], [ "@eDen Do you mean hot to escape `while True` infinite loop? You have multiple ways: using `break` - this will break the loop and program will continue afterwards, using `return` - if the `while True` is inside function, the function will ends and value will will be returned, and throwing exception `raise` - in that case the program jumps to next `except` statement.", "326" ], [ "The url-shortener sends a meta-refresh to redirect to desired page. This code should help:\r\n\r\n from bs4 import BeautifulSoup\r\n import requests\r\n import re\r\n \r\n shortened_url = &#39; < YOUR SHORTENED URL > &#39;\r\n \r\n headers = {&#39;User-Agent&#39;: &#39;Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0&#39;}\r\n \r\n response = requests.get(shortened_url, headers=headers)\r\n soup = BeautifulSoup(response.text, \" ;lxml \" ;)\r\n \r\n while True:\r\n # is meta refresh there?\r\n if soup.select_one(&#39;meta[http-equiv=refresh]&#39;):\r\n refresh_url = re.search(r&#39;url=(.*)&#39;, soup.select_one(&#39;meta[http-equiv=refresh]&#39;)[&#39;content&#39;], flags=re.I)[1]\r\n response = requests.get(refresh_url, headers=headers)\r\n soup = BeautifulSoup(response.text, \" ;lxml \" ;)\r\n else:\r\n break\r\n \r\n title = soup.find( \" ;meta \" ;, { \" ;name \" ;: \" ;twitter:title \" ;})\r\n title2 = soup.find( \" ;meta \" ;, property= \" ;og:title \" ;)\r\n title3 = soup.find( \" ;meta \" ;, property= \" ;og:description \" ;)\r\n \r\n print( \" ;TITLE: \" ;+str(title[&#39;content&#39;]))\r\n print( \" ;TITLE2: \" ;+str(title2[&#39;content&#39;]))\r\n print( \" ;TITLE3: \" ;+str(title3[&#39;content&#39;]))\r\n\r\nPrints:\r\n\r\n TITLE: Mamma Mia! Here We Go Again Is the Only Good Thing About This Summer - Vogue\r\n TITLE2: Mamma Mia! Here We Go Again Is the Only Good Thing About This Summer\r\n TITLE3: Is it possible to change your country of origin to a movie sequel?", "1017" ], [ "Don&#39;t format your SQL string by hand (in your case with f-strings), it&#39;s error prone. You could use parameterized queries in SQLite3:\r\n\r\n import sqlite3\r\n \r\n with sqlite3.connect( \" ;:memory: \" ;) as con:\r\n \r\n cur = con.cursor()\r\n \r\n cur.execute(&#39;CREATE TABLE funcionarios (id integer PRIMARY KEY, nome text)&#39;)\r\n \r\n cur.execute(&#39;INSERT INTO funcionarios (nome) VALUES (:nome)&#39;,\r\n {&#39;nome&#39;: &#39;Rua Jose&#39;})\r\n \r\n cur.execute(&#39;UPDATE funcionarios SET nome = :nome WHERE id = 1&#39;,\r\n {&#39;nome&#39;: &#39;Santa Maria&#39;})\r\n \r\n cur.execute(&#39;SELECT * FROM funcionarios&#39;)\r\n print(cur.fetchall())\r\n\r\nThis prints:\r\n\r\n [(1, &#39;Santa Maria&#39;)]", "492" ], [ "Here&#39;s one liner using `groupby`:\r\n\r\n from itertools import groupby\r\n \r\n sandwiches = [[ \" ;bacon \" ;, \" ;banana \" ;], [ \" ;<PERSON> \" ;, \" ;<PERSON> \" ;, \" ;cheese \" ;]]\r\n preferences = [ \" ;salami \" ;, 999, \" ;<PERSON> \" ;, 5, \" ;ham \" ;, -2, \" ;banana \" ;, 1000]\r\n \r\n l = [(v, sum(i[-1] for i in g)) for v, g in groupby(((sandwich, preferences[preferences.index(p)+1]) for sandwich, prefs in zip(sandwiches, [preferences[::2]] * len(sandwiches)) for p in prefs if p in sandwich), key=lambda v: v[0])]\r\n print(l)\r\n\r\nPrints:\r\n\r\n [([&#39;bacon&#39;, &#39;banana&#39;], 1005), ([&#39;ham&#39;, &#39;salami&#39;, &#39;cheese&#39;], 997)]\r\n\r\nFor sandwich `[&#39;bacon&#39;, &#39;banana&#39;]`: Bacon has 5, banana has 1000, sandwich score is 1005\r\n\r\nFor sandwich `[&#39;ham&#39;, &#39;salami&#39;, &#39;cheese&#39;]`: <PERSON><IP_ADDRESS>2]] * len(sandwiches)) for p in prefs if p in sandwich), key=lambda v: v[0])]\r\n print(l)\r\n\r\nPrints:\r\n\r\n [([&#39;bacon&#39;, &#39;banana&#39;], 1005), ([&#39;ham&#39;, &#39;salami&#39;, &#39;cheese&#39;], 997)]\r\n\r\nFor sandwich `[&#39;bacon&#39;, &#39;banana&#39;]`: Bacon has 5, banana has 1000, sandwich score is 1005\r\n\r\nFor sandwich `[&#39;ham&#39;, &#39;salami&#39;, &#39;cheese&#39;]`: Ham has -2, salami has 999, sanwich score is 997", "256" ], [ "Solution using CSS selectors built-in within BeautifulSoup:\r\n\r\n from bs4 import BeautifulSoup\r\n import requests\r\n \r\n url = &#39;_URL_0_;\r\n soup = BeautifulSoup(requests.get(url).text, &#39;lxml&#39;)\r\n \r\n print(soup.select_one(&#39;.pagination a[title^=Next]&#39;)[&#39;href&#39;])\r\n\r\nPrints:\r\n\r\n /b-apartments-condos/edmonton/page-2/c37l1700203\r\n\r\nThis will select ` < a > ` tag with attribute `title` that begins with `Next`. This ` < a > ` tag needs to be under tag with class `.pagination`.", "1017" ], [ "Looking at the source code, the best bet here is combine `BeautifulSoup` with `regular expressions`:\r\n\r\n import requests\r\n from bs4 import BeautifulSoup\r\n import re\r\n \r\n url = \" ;_URL_0_;\r\n \r\n r = requests.get(url)\r\n soup = BeautifulSoup(r.text, &#39;lxml&#39;)\r\n for td in soup.select(&#39;td.specs&#39;):\r\n m = re.search(&#39;^(8|16).*?onboard memory.*?$&#39;, td.text, flags=re.M|re.I)\r\n if not m:\r\n continue\r\n print(td.select_one(&#39;h3&#39;).text.strip())\r\n print(&#39;Full text: {} | Memory: {}&#39;.format(m[0].strip(), m[1]))\r\n print(&#39;-&#39; * 80)\r\n\r\nThis code finds all products with 8 or 16 GB and prints them:\r\n\r\n Refurbished 13.3-inch MacBook Pro 2.3GHz dual-core Intel Core i5 with Retina display - Space Grey\r\n Full text: 8GB of 2133MHz LPDDR3 onboard memory | Memory: 8\r\n --------------------------------------------------------------------------------\r\n Refurbished 13.3-inch MacBook Pro 2.3GHz dual-core Intel Core i5 with Retina display - Silver\r\n Full text: 8GB of 2133MHz LPDDR3 onboard memory | Memory: 8\r\n --------------------------------------------------------------------------------\r\n Refurbished 13.3-inch MacBook&#160;Pro 2.0GHz Dual-core Intel Core i5 with Retina Display — Space Grey\r\n Full text: 8GB of 1866MHz LPDDR3 onboard memory | Memory: 8\r\n --------------------------------------------------------------------------------\r\n Refurbished 13.3-inch MacBook Pro 2.3GHz dual-core Intel Core i5 with Retina display - Silver\r\n Full text: 8GB of 2133MHz LPDDR3 onboard memory | Memory: 8\r\n --------------------------------------------------------------------------------\r\n Refurbished 13.3-inch MacBook Pro 2.3GHz dual-core Intel Core i5 with Retina display - Space Grey\r\n Full text: 8GB of 2133MHz LPDDR3 onboard memory | Memory: 8\r\n --------------------------------------------------------------------------------\r\n Refurbished 13.3-inch Macbook&#160;Pro 2.9GHz Dual-core Intel Core i5 with Retina Display - Space Grey\r\n Full text: 8GB of 2133MHz LPDDR3 onboard memory | Memory: 8\r\n --------------------------------------------------------------------------------\r\n Refurbished 13.3-inch Macbook&#160;Pro 2.9GHz Dual-core Intel Core i5 with Retina Display - Silver\r\n Full text: 8GB of 2133MHz LPDDR3 onboard memory | Memory: 8\r\n --------------------------------------------------------------------------------\r\n Refurbished 13.3-inch Macbook&#160;Pro 2.9GHz Dual-core Intel Core i5 with Retina Display - Silver\r\n Full text: 8GB of 2133MHz LPDDR3 onboard memory | Memory: 8\r\n --------------------------------------------------------------------------------\r\n Refurbished 13.3-inch MacBook Pro 3.1GHz dual-core Intel Core i5 with Retina display - Silver\r\n Full text: 8GB of 2133MHz LPDDR3 onboard memory | Memory: 8\r\n --------------------------------------------------------------------------------\r\n Refurbished 13.3-inch MacBook Pro 3.1GHz dual-core Intel Core i5 with Retina display - Space Grey\r\n Full text: 8GB of 2133MHz LPDDR3 onboard memory | Memory: 8\r\n --------------------------------------------------------------------------------\r\n Refurbished 13.3-inch Macbook&#160;Pro 3.3GHz Dual-core Intel Core i7 with Retina Display - Space Grey\r\n Full text: 16GB of 2133MHz LPDDR3 onboard memory | Memory: 16\r\n --------------------------------------------------------------------------------", "1017" ], [ "My attempt, using counter that is increased every time when there&#39;s change greater or equal than `distance`. That way this generator can be supplied with ease to `groupby`:\r\n\r\n def gen(lst, distance=10):\r\n counter = 0\r\n for cur, nxt in zip(lst[::1], lst[<IP_ADDRESS><IP_ADDRESS>1], lst[1::1]):\r\n yield counter, cur\r\n if abs(cur.x_coord - nxt.x_coord) > = distance:\r\n counter += 1\r\n yield counter, nxt\r\n \r\n myGroupedList = [list(i[1] for i in g) for _, g in groupby(gen(mylist), lambda v: v[0])]\r\n print(myGroupedList)\r\n\r\nPrints:\r\n\r\n [[Date, of, Entry], [Date, of, Birth]]", "256" ], [ "Explanation of [this regex here][1].\r\n\r\n import re\r\n \r\n data = \" ; \" ; \" ;\r\n #Scene 1#\r\n <PERSON>: Who&#39;s there?\r\n <PERSON>: Nay, answer me: stand, and unfold yourself.\r\n \r\n #Scene 2#\r\n <PERSON>: Tis now struck twelve; get thee to bed, <PERSON>.\r\n <PERSON>: Peace, break thee off; look, where it comes again!\r\n \" ; \" ; \" ;\r\n \r\n print(re.findall(r&#39;(?:#Scene 1#)\\s*(.*?)\\s*(?:#Scene 2#)&#39;, data, flags=re.DOTALL)[0])\r\n\r\nPrints:\r\n\r\n <PERSON>: Who&#39;s there?\r\n <PERSON>: Nay, answer me: stand, and unfold yourself.\r\n\r\n\r\n [1]: _URL_0_", "772" ], [ "The page seems to blocklist Tor Ip addressees, so we can circumvent this by going through another site, e.g. W3 validator, that is showing source to us: _URL_1_\r\n\r\nWe&#39;re still using TOR, but letting other site to fetch the site for us (and their IP isn&#39;t blocked):\r\n\r\n from bs4 import BeautifulSoup\r\n import requests\r\n\r\n proxies = {\r\n &#39;http&#39;: &#39;_URL_0_ PROXY ADDRESS > : < YOUR PROXY PORT > &#39;,\r\n &#39;https&#39;: &#39;_URL_0_ PROXY ADDRESS > : < YOUR PROXY PORT > &#39;,\r\n }\r\n\r\n headers = {\r\n &#39;User-Agent&#39;: &#39;Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.84 Safari/537.36&#39;,\r\n &#39;accept&#39; : &#39;text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8&#39;,\r\n }\r\n\r\n r = requests.get(&#39;_URL_1_&#39;, proxies=proxies, headers=headers)\r\n soup = BeautifulSoup(r.text, &#39;lxml&#39;)\r\n source_code = &#39;&#39;\r\n for code in soup.select(&#39;ol.source > li > code&#39;):\r\n if &#39;class&#39; in code.attrs and &#39;lf&#39; in code.attrs[&#39;class&#39;]:\r\n source_code += &#39;\\n&#39;\r\n else:\r\n source_code += code.text\r\n\r\n soup2 = BeautifulSoup(source_code, &#39;lxml&#39;)\r\n\r\n for li in soup2.select(&#39;li.lister__item h3&#39;):\r\n print(li.text)\r\n print(&#39;-&#39; * 80)\r\n\r\nPrints:\r\n\r\n Corporate Partner\r\n --------------------------------------------------------------------------------\r\n Personal Injury Paralegal\r\n --------------------------------------------------------------------------------\r\n Healthcare Regulatory Lawyer - London\r\n --------------------------------------------------------------------------------\r\n Company Secretary and Corporate Governance\r\n --------------------------------------------------------------------------------\r\n Junior FCPA/Compliance Associate, Beijing - 14612/TTL\r\n --------------------------------------------------------------------------------\r\n International Project Manager, Shanghai - 14611/TTL\r\n --------------------------------------------------------------------------------\r\n Corporate Associate (4+ PQE) Beijing - 14610/TTL\r\n --------------------------------------------------------------------------------\r\n Corporate Associate (5+ PQE) Shanghai - 14609/TTL\r\n --------------------------------------------------------------------------------\r\n Corporate or Commercial Counsel -Pharma- Surrey\r\n --------------------------------------------------------------------------------\r\n Corporate/Public M & A PSL, 5+ PQE\r\n --------------------------------------------------------------------------------\r\n Solicitor\r\n --------------------------------------------------------------------------------\r\n In-house Legal Counsel - Excellent opportunity to go In-House!\r\n --------------------------------------------------------------------------------\r\n Real Estate Partner\r\n --------------------------------------------------------------------------------\r\n Child Brain Injury Solicitor\r\n --------------------------------------------------------------------------------\r\n Corporate/Commercial In-House Lawyer, 1+\r\n --------------------------------------------------------------------------------\r\n In-house Regulatory Counsel, Banking/Payments, 5+\r\n --------------------------------------------------------------------------------\r\n In-house Property Finance/Banking Lawyer, 1-3\r\n --------------------------------------------------------------------------------\r\n Hybrid Legal & Compliance Data Protection Manager\r\n --------------------------------------------------------------------------------\r\n Hedge Fund Legal Counsel 3-5 years PQE\r\n --------------------------------------------------------------------------------\r\n Corporate PSL\r\n --------------------------------------------------------------------------------", "1017" ], [ "I&#39;m not using Selenium, but selected dates can be extracted with just BeautifulSoup. The timedates are coded as Unix timestamp inside tag classes:\r\n\r\n from bs4 import BeautifulSoup\r\n import requests\r\n import re\r\n import datetime\r\n \r\n headers = {&#39;User-Agent&#39;: &#39;Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0&#39;}\r\n r = requests.get(&#39;_URL_0_;, headers=headers)\r\n soup = BeautifulSoup(r.text, &#39;lxml&#39;)\r\n \r\n for td in soup.select(&#39;table#tournamentTable td.datet&#39;):\r\n for c in td[&#39;class&#39;]:\r\n if re.match(r&#39;t\\d+&#39;, c):\r\n unix_timestamp = int(re.match(r&#39;t(\\d+)&#39;, c)[1])\r\n d = datetime.datetime.utcfromtimestamp(unix_timestamp).strftime(&#39;%d %b %Y--%H:%M&#39;)\r\n print(d)\r\n\r\nPrints:\r\n\r\n 10 Aug 2018--09:30\r\n 10 Aug 2018--10:15\r\n 11 Aug 2018--05:00\r\n 11 Aug 2018--05:00\r\n 11 Aug 2018--09:00\r\n 12 Aug 2018--06:00\r\n 12 Aug 2018--06:00\r\n\r\nIf you want also the matches printed:\r\n\r\n for td in soup.select(&#39;table#tournamentTable td.datet&#39;):\r\n for c in td[&#39;class&#39;]:\r\n if re.match(r&#39;t\\d+&#39;, c):\r\n unix_timestamp = int(re.match(r&#39;t(\\d+)&#39;, c)[1])\r\n d = datetime.datetime.utcfromtimestamp(unix_timestamp).strftime(&#39;%d %b %Y--%H:%M&#39;)\r\n print(d, end=&#39; &#39;)\r\n print(td.find_next(&#39;td&#39;).text)\r\n\r\nPrints:\r\n\r\n 10 Aug 2018--09:30 Melbourne Knights - Port Melbourne Sharks\r\n 10 Aug 2018--10:15 Pascoe Vale - Dandenong Thunder\r\n 11 Aug 2018--05:00 Avondale FC - Bentleigh Greens\r\n 11 Aug 2018--05:00 Northcote City - Bulleen\r\n 11 Aug 2018--09:00 Hume City - Oakleigh Cannons\r\n 12 Aug 2018--06:00 Heidelberg Utd - Green Gully\r\n 12 Aug 2018--06:00 South Melbourne - Kingston City", "1017" ], [ "You can use `str.join()` to print text with linebreaks:\r\n\r\n from bs4 import BeautifulSoup\r\n import requests\r\n \r\n r = requests.get(&#39;_URL_1_;)\r\n soup = BeautifulSoup(r.text, &#39;lxml&#39;)\r\n \r\n print(&#39;\\n&#39;.join(strong.text for strong in soup.select(&#39;strong.literal&#39;)))\r\n\r\nPrints:\r\n\r\n import webbrowser\r\n webbrowser.open(&#39;_URL_2_;)\r\n pyperclip\r\n else:\r\n # Get address from clipboard.\r\n address = pyperclip.paste()\r\n webbrowser.open(&#39;_URL_0_; + address)\r\n import requests\r\n import requests\r\n\r\n ...and so on.", "1017" ], [ "You can use builtin `re` and `json` module for extracting Javascript variables:\r\n\r\n from bs4 import BeautifulSoup\r\n import re\r\n import json\r\n from pprint import pprint\r\n \r\n data = &#39;&#39;&#39;\r\n < html > \r\n < body > \r\n \r\n < script > \r\n var meta = \" ;variants \" ;:[{ \" ;id \" ;:12443604615241, \" ;price \" ;:14000},\r\n { \" ;id \" ;:12443604648009, \" ;price \" ;:14000}]\r\n < /script > \r\n \r\n < /body > \r\n &#39;&#39;&#39;\r\n \r\n soup = BeautifulSoup(data, &#39;lxml&#39;)\r\n json_string = re.search(r&#39;meta\\s*=\\s*(.*?}])\\s*\\n&#39;, str(soup.find(&#39;script&#39;)), flags=re.DOTALL)\r\n \r\n json_data = json.loads(&#39;{&#39; + json_string[1] + &#39;}&#39;)\r\n \r\n pprint(json_data)\r\n\r\nThis prints:\r\n\r\n {&#39;variants&#39;: [{&#39;id&#39;: 12443604615241, &#39;price&#39;: 14000},\r\n {&#39;id&#39;: 12443604648009, &#39;price&#39;: 14000}]}", "1017" ], [ "You need to select the right element, in this case `div.StandardArticleBody_body > p`:\r\n\r\n from bs4 import BeautifulSoup\r\n import requests\r\n \r\n r = requests.get(&#39;_URL_1_;)\r\n soup = BeautifulSoup(r.text, &#39;lxml&#39;)\r\n \r\n print(soup.h1.text)\r\n print(&#39;-&#39; * 80)\r\n print()\r\n for p in soup.select(&#39;div.StandardArticleBody_body > p&#39;):\r\n print(p.text)\r\n\r\nThis prints:\r\n\r\n UPDATE 1-TSMC plans five new advanced wafer plants -paper\r\n --------------------------------------------------------------------------------\r\n \r\n (Adds TSMC’s comments) \r\n TAIPEI, Jan 2 (Reuters) - TSMC (_URL_0_) plans to build five new advanced 12-inch wafer plants on the island in the next few years, a local newspaper said on Tuesday, after a government move to allow companies to make more advanced chips in China. \r\n \r\n ...and so on", "1017" ], [ "The page loads it&#39;s data through AJAX, so through network inspector we see, where the call is made. This snippet will obtain all the image links found on page `1`, sorted by `trending`:\r\n\r\n import requests\r\n import json\r\n \r\n url = &#39;_URL_4_;\r\n page = requests.get(url)\r\n json_data = json.loads(page.text)\r\n \r\n for data in json_data[&#39;data&#39;]:\r\n print(data[&#39;cover&#39;][&#39;medium_image_url&#39;])\r\n\r\nPrints:\r\n\r\n _URL_5_\r\n _URL_0_\r\n _URL_6_\r\n _URL_2_\r\n _URL_3_\r\n _URL_1_\r\n\r\n ... and so on.\r\n\r\nIf you print the variable `json_data`, you will see other information the page sends (like icon image url, total_count, data about the author etc.)", "8" ], [ "This page changes its structure with JavaScript, but you can print the soup upon downloading and see, where the video links are initially. In this case, in tag ` < tr > ` with class `pl-video`:\r\n\r\n from bs4 import BeautifulSoup\r\n import requests\r\n \r\n url = &#39;_URL_1_;\r\n page = requests.get(url)\r\n soup = BeautifulSoup(page.text, &#39;lxml&#39;)\r\n \r\n for i, tr in enumerate(soup.select(&#39;_URL_4_-video&#39;)):\r\n print(&#39;{}. {}&#39;.format(i + 1, tr[&#39;data-title&#39;]))\r\n print(&#39;_URL_5_; + tr.a[&#39;href&#39;])\r\n print(&#39;-&#39; * 80)\r\n\r\nPrints:\r\n\r\n 1. Shell Scripting Tutorial for Beginners 1 - Introduction\r\n _URL_7_\r\n --------------------------------------------------------------------------------\r\n 2. Shell Scripting Tutorial for Beginners 2 - using Variables and Comments\r\n _URL_2_\r\n --------------------------------------------------------------------------------\r\n 3. Shell Scripting Tutorial for Beginners 3 - Read User Input\r\n _URL_0_\r\n --------------------------------------------------------------------------------\r\n\r\n ... all the way to:\r\n\r\n 32. How Install VirtualBox Guest Additions on Ubuntu 18.04 Guest / virtual machine\r\n _URL_6_\r\n --------------------------------------------------------------------------------\r\n 33. How to install Java JDK 10 on Ubuntu 18.04 LTS (Debian Linux)\r\n _URL_3_\r\n --------------------------------------------------------------------------------", "1017" ], [ "For writing csv dictionary you can use `csv.DictWriter` ([docs here][1], `ChainMap` is just a version of dictionary):\r\n\r\n from bs4 import BeautifulSoup\r\n import requests\r\n import csv\r\n from collections import ChainMap\r\n \r\n def get_data(soup):\r\n default_data = {&#39;name&#39;: &#39;n/a&#39;, &#39;clinic&#39;: &#39;n/a&#39;, &#39;profession&#39;: &#39;n/a&#39;, &#39;region&#39;: &#39;n/a&#39;, &#39;city&#39;: &#39;n/a&#39;}\r\n \r\n for doctor in soup.select(&#39;.view-practitioners .practitioner&#39;):\r\n doctor_data = {}\r\n \r\n if doctor.select_one(&#39;.practitioner__name&#39;).text.strip():\r\n doctor_data[&#39;name&#39;] = doctor.select_one(&#39;.practitioner__name&#39;).text\r\n \r\n if doctor.select_one(&#39;.practitioner__clinic&#39;).text.strip():\r\n doctor_data[&#39;clinic&#39;] = doctor.select_one(&#39;.practitioner__clinic&#39;).text\r\n \r\n if doctor.select_one(&#39;.practitioner__profession&#39;).text.strip():\r\n doctor_data[&#39;profession&#39;] = doctor.select_one(&#39;.practitioner__profession&#39;).text\r\n \r\n if doctor.select_one(&#39;.practitioner__region&#39;).text.strip():\r\n doctor_data[&#39;region&#39;] = doctor.select_one(&#39;.practitioner__region&#39;).text\r\n \r\n if doctor.select_one(&#39;.practitioner__city&#39;).text.strip():\r\n doctor_data[&#39;city&#39;] = doctor.select_one(&#39;.practitioner__city&#39;).text\r\n \r\n yield ChainMap(doctor_data, default_data)\r\n \r\n \r\n url = &#39;_URL_0_;\r\n \r\n with open(&#39;data.csv&#39;, &#39;w&#39;, newline=&#39;&#39;) as csvfile:\r\n \r\n fieldnames = [&#39;name&#39;, &#39;clinic&#39;, &#39;profession&#39;, &#39;region&#39;, &#39;city&#39;]\r\n writer = csv.DictWriter(csvfile, fieldnames=fieldnames)\r\n writer.writeheader()\r\n \r\n for i in range(5):\r\n page=requests.get(url % i)\r\n soup = BeautifulSoup(page.text, &#39;lxml&#39;)\r\n writer.writerows(get_data(soup)\r\n\r\n)\r\n\r\nThis outputs all data to `data.csv` file. Screenshot from my LibreOffice:\r\n\r\n[![enter image description here][2]][2]\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_1_", "1017" ], [ "You don&#39;t see the text because BeautifulSoup doesn&#39;t run javascript, it just parses html text. You must use Selenium or headless browser and execute javascript on that page to obtain the text. However, this simple javascript function you can emulate in Python too (with help of _URL_0_):\r\n\r\n data = &#39;&#39;&#39;\r\n < td style= \" ;text-align:left; font-weight:bold; \" ; > \r\n < script type= \" ;text/javascript \" ; > document.write(Base64.decode(str_rot13( \" ;ZGDjYwVjAF4lZwVhZj== \" ;))) < /script > \r\n < /td > &#39;&#39;&#39;\r\n \r\n from bs4 import BeautifulSoup\r\n import re\r\n import base64\r\n \r\n rot13 = str.maketrans(\r\n \" ;ABCDEFGHIJKLMabcdefghijklmNOPQRSTUVWXYZnopqrstuvwxyz \" ;,\r\n \" ;NOPQRSTUVWXYZnopqrstuvwxyzABCDEFGHIJKLMabcdefghijklm \" ;)\r\n \r\n soup = BeautifulSoup(data, &#39;lxml&#39;)\r\n encoded_string = re.search(r&#39;str_rot13\\( \" ;(.*?) \" ;\\)&#39;, str(soup.find(&#39;script&#39;)))[1]\r\n decoded_string = base64.b64decode(encoded_string.translate(rot13)).decode(&#39;utf-8&#39;)\r\n \r\n print(decoded_string)\r\n\r\nThis prints the decoded string:\r\n\r\n <IP_ADDRESS><PHONE_NUMBER>", "1017" ], [ "Yes, to delete attribute you simply use `del` on `tag.attrs`:\r\n\r\n data = &#39;&#39;&#39;\r\n < ul > \r\n < li data-animal-type= \" ;bird \" ; data-other= \" ;this is other data \" ; > Owl < /li > \r\n < li data-animal-type= \" ;fish \" ; > Salmon < /li > \r\n < li data-animal-type= \" ;spider \" ; > Tarantula < /li > \r\n < /ul > &#39;&#39;&#39;\r\n \r\n from bs4 import BeautifulSoup\r\n \r\n soup = BeautifulSoup(data, &#39;lxml&#39;)\r\n \r\n print(&#39;Original soup:&#39;)\r\n print(soup)\r\n print(&#39;-&#39; * 80)\r\n \r\n for tag in soup.find_all(lambda t: any(i.startswith(&#39;data-&#39;) for i in t.attrs)):\r\n for attr in list(tag.attrs):\r\n if attr.startswith(&#39;data-&#39;):\r\n del tag.attrs[attr]\r\n \r\n print()\r\n print(&#39;Soup without data-* tags:&#39;)\r\n print(soup)\r\n print(&#39;-&#39; * 80)\r\n\r\nThis prints:\r\n\r\n Original soup:\r\n < html > < body > < ul > \r\n < li data-animal-type= \" ;bird \" ; data-other= \" ;this is other data \" ; > Owl < /li > \r\n < li data-animal-type= \" ;fish \" ; > <PERSON> < /li > \r\n < li data-animal-type= \" ;spider \" ; > <PERSON> < /li > \r\n < /ul > < /body > < /html > \r\n --------------------------------------------------------------------------------\r\n \r\n Soup without data-* tags:\r\n < html > < body > < ul > \r\n < li > <PERSON> < /li > \r\n < li > <PERSON> < /li > \r\n < li > <PERSON> < /li > \r\n < /ul > < /body > < /html > \r\n --------------------------------------------------------------------------------", "1017" ], [ "You can use python&#39;s `zip()` method to zip ` < dt > ` and ` < dd > ` tags together in this case. If ` < dt > ` tag will contain the text `Episodi` you know the next ` < dd > ` tags contains the number of episodes:\r\n\r\n import requests\r\n from bs4 import BeautifulSoup\r\n \r\n r = requests.get(&#39;_URL_0_;)\r\n soup = BeautifulSoup(r.text, &#39;lxml&#39;)\r\n \r\n for dt, dd in zip(soup.select(&#39;#dettagli dl > dt&#39;),\r\n soup.select(&#39;#dettagli dl > dd&#39;)):\r\n if &#39;Episodi&#39; in dt.text.strip():\r\n print(&#39;Number of episodes:&#39;, dd.text.strip())\r\n break\r\n\r\nPrints:\r\n\r\n Number of episodes: 11", "1017" ], [ "You can use `re` to parse the news. This code creates temporary :memory: sqlite database and prints all the places, dates and short excerpt of articles:\r\n\r\n import re\r\n import bs4\r\n import sqlite3\r\n import requests\r\n import textwrap\r\n \r\n res = requests.get(&#39;_URL_0_;)\r\n res.raise_for_status()\r\n soup = bs4.BeautifulSoup(res.text, &#39;html.parser&#39;)\r\n \r\n news = [p.text.strip() for p in soup.select(&#39;h1 ~ p&#39;) if p.find(&#39;font&#39;)]\r\n \r\n with sqlite3.connect( \" ;:memory: \" ;) as conn:\r\n c = conn.cursor()\r\n c.execute(&#39;&#39;&#39;CREATE TABLE\r\n mytable (Location STRING,\r\n Date STRING,\r\n Description STRING)&#39;&#39;&#39;)\r\n \r\n for n in news:\r\n groups = re.match(r&#39;(.*?)\\W+—?\\W+On\\W+(.*?\\d{4})\\W*(.*)&#39;, n, flags=re.DOTALL)\r\n if not groups:\r\n continue\r\n place, date, article = groups[1], groups[2], groups[3]\r\n \r\n c.execute(&#39;&#39;&#39;INSERT INTO mytable(Location, Date, Description) VALUES(?,?,?)&#39;&#39;&#39;,\r\n (place, date, article))\r\n conn.commit()\r\n \r\n # print the data back:\r\n c.execute(&#39;&#39;&#39;SELECT * FROM mytable&#39;&#39;&#39;)\r\n \r\n for place, date, article in c:\r\n print(&#39;{} -- {}&#39;.format(place, date))\r\n print(textwrap.shorten(article, width=70))\r\n print(&#39;*&#39; * 80)\r\n\r\nPrints:\r\n\r\n Shell Beach -- August 1, 2018\r\n <PERSON> was paddling an outrigger with two companions [...]\r\n ********************************************************************************\r\n Monterey Bay -- August 1, 2018\r\n <PERSON> was spearfishing for California Halibut, [...]\r\n ********************************************************************************\r\n Pacifica -- July 27, 2018\r\n <PERSON> was surfing with 4 unidentified surfers at Pacifica [...]\r\n ********************************************************************************\r\n Santa Monica -- July 26, 2018\r\n <PERSON> was surfing between lifeguard towers 29 and 30 in [...]\r\n ********************************************************************************\r\n <PERSON> -- July 23, 2018\r\n <PERSON> was surfing at Rincon Beach 3 miles East of [...]\r\n ********************************************************************************\r\n\r\n ... and so on.", "761" ], [ "You can use `.text` property to get text that is contained within tag. I used `str.rsplit` to strip the date from titles:\r\n\r\n import requests\r\n from bs4 import BeautifulSoup\r\n \r\n url = &#39;_URL_0_;\r\n resp = requests.get(url)\r\n soup = BeautifulSoup(resp.text, &#39;lxml&#39;)\r\n \r\n for a in soup.select(&#39;h3 a[href]&#39;):\r\n print(a.text.rsplit(&#39;,&#39;, maxsplit=1)[0])\r\n print(a[&#39;href&#39;])\r\n print(&#39;-&#39; * 80)\r\n\r\nThis prints:\r\n\r\n Press Briefing by Press Secretary <PERSON>\r\n _URL_10_\r\n --------------------------------------------------------------------------------\r\n Daily Briefing by the Press Secretary\r\n _URL_8_\r\n --------------------------------------------------------------------------------\r\n Press Briefing by Senior Administration Officials on the Fact Sheet on Strengthening U.S.-China Economic Relations\r\n _URL_9_\r\n --------------------------------------------------------------------------------\r\n Press Briefing by the Press Secretary\r\n _URL_4_\r\n --------------------------------------------------------------------------------\r\n Press Briefing by Press Secretary <PERSON>\r\n _URL_1_\r\n --------------------------------------------------------------------------------\r\n Press Gaggle by Principal Deputy Press Secretary <PERSON> -- Los Angeles\r\n _URL_6_\r\n --------------------------------------------------------------------------------\r\n Press Gaggle by Principal Deputy Press Secretary <PERSON> Aboard Air Force One en route San Francisco\r\n _URL_2_\r\n --------------------------------------------------------------------------------\r\n Daily Briefing by the Press Secretary\r\n _URL_3_\r\n --------------------------------------------------------------------------------\r\n Briefing by Principal Deputy Press Secretary <PERSON>\r\n _URL_5_\r\n --------------------------------------------------------------------------------\r\n Press Briefing by Press Secretary <PERSON>\r\n _URL_7_\r\n --------------------------------------------------------------------------------", "1017" ] ]
24
[ 3043, 11204, 18036, 15314, 13576, 16670, 4048, 5622, 11037, 16611, 17288, 18382, 18575, 17086, 2634, 12919, 15300, 9124, 19298, 11686, 5393, 2043, 14343, 10856, 8157, 10797, 1948, 10945, 8304, 8168, 2238, 11847, 15279, 16652, 12746, 1958, 10463, 3905, 9227, 14788, 15834, 14773, 17956, 18130, 6791, 220, 11522, 12256, 17616, 19384, 10241, 17371, 3608, 13702, 601, 10896, 19452, 13490, 6216, 17380, 7169, 6689, 4151, 13955, 4203, 6090, 15859, 19503, 4071, 18977, 13801, 13452, 5063, 15988, 15677, 9633, 16215, 12954, 1756, 6347, 17157, 15011, 18735, 7307, 13891, 14795, 4183, 17723, 4917, 12131, 14485, 16568, 293, 654, 11940, 4316, 2645, 10952, 14991, 16534, 14832, 3215, 4343, 17696, 5705, 16216, 9305, 9523, 2460, 10359, 13887, 151, 9869, 10564, 8350, 17465, 1806, 14235, 7311, 4206, 589, 15984, 16971, 9322, 4748, 8617, 12037, 14831, 6303, 7775, 663, 14035, 13706, 3421, 16648, 16284, 4404, 14650, 10211, 4002, 10421, 5213, 13848, 13356, 15903, 10491, 18655, 6292, 3896, 2510, 17622, 13289, 14890, 10487, 7518, 10001, 17972, 13151, 12528, 18334, 14301, 7046, 19335, 13141, 19688, 282, 7207, 13797, 15873, 3119, 10104, 16822, 1553, 8626, 17044, 9435, 5682, 10811, 14737, 4675, 6842, 8512, 17748, 4734, 2465, 13376, 4764, 10513, 14052, 4589, 6582, 6642, 7237, 12110, 13767, 1113, 14524, 14537, 9442, 10832, 17026, 5655, 15581, 16522, 10269, 2269, 18012, 1458, 16512, 765, 17856, 13196, 19729, 3555, 8526, 7529, 4796, 4647, 1910, 5088, 15017, 7441, 15820, 19499, 18428, 2950, 7082, 11927, 5165, 8760, 2780, 15511, 10937, 18186, 14620, 12350, 9623, 707, 3259, 19397, 12764, 19713, 19089, 17297, 16589, 8296, 17053, 357, 12977, 15523, 4148, 9003, 19562, 18442, 788, 19302, 15710, 14652, 16330, 17947, 13701, 9684, 8, 862, 16323, 13338, 5372, 12593, 1093, 478, 13105, 19750, 2551, 15466, 826, 3980, 18835, 7879, 11449, 16278, 2880, 155, 2767, 9771, 271, 12571, 10620, 11214, 8664, 1358, 12028, 4821, 11116, 9809, 18637, 17370, 1649, 12475, 632, 1628, 10551, 1439, 19128, 12421, 13304, 4000, 10839, 16337, 13277, 14699, 17762, 6009, 3311, 5882, 7133, 13160, 307, 11790, 13158, 2107, 12831, 6360, 8170, 2308, 19634, 5836, 820, 12666, 10345, 16242, 6700, 5772, 11537, 8576, 3182, 4056, 12780, 11284, 19528, 9537, 8193, 17280, 18568, 12040, 13715, 5231, 13923, 19678, 11035, 8407, 15684, 18738, 15309, 7218, 10418, 11626, 6306, 2856, 16472, 9854, 5906, 9188, 14041, 10849, 9033, 7172, 16549, 11343, 14765, 17860, 4093, 17407, 6988, 7781, 14224, 1644, 19317, 10207, 11428, 9735, 7967, 4940, 19013, 6746, 3638, 5116, 13485, 8608, 7777, 12757, 11089, 318, 11331, 11407, 9220, 19242, 6118, 14324, 2898, 19764, 5282, 10886, 18321, 7970, 5079, 3098, 7178, 12559, 7610, 4868, 11809, 7114, 6665, 8155, 10906, 3914, 10219, 7814, 9399, 19582, 15758, 15165, 9911, 13444, 5302, 11786, 2293, 7521, 18070, 8039, 11944, 17503, 10103, 8795, 14285, 9783, 19655, 18478, 18861, 9798, 16713, 16008, 14751, 15546, 14363, 15338, 15130, 895, 10032, 5437, 5957, 3425, 7168, 3578, 8582, 9494, 942, 5770, 7076, 8606, 18456, 18813, 18240, 10943, 14558, 15066, 3427, 19207, 424, 15811, 10165, 15411, 9750, 12632, 17010, 9788, 6007, 12109, 3594, 10816, 10144, 12870, 13656, 8068, 8463, 17066, 9078, 2684, 2069, 10912, 15842, 14549, 71, 15440, 5713, 2580, 4723, 14420, 16644 ]
STX_100361.0
[ [ "Let us consider maximal repeats starting from $i$th symbol for some $i$, $1 \\le i \\le n$. Suppose that are at least two of them. Then one maximal repeat is a proper substring of another one, that is not possible by definition of maximal repeat. Therefore for each $i$ there is at most one maximal repeat starting from $i$th symbol. So there are at most $n$ different non-empty maximal repeats. Each of them is at most $n$ symbols long. Therefore total length of all maximal repeats is $O(n^2)$.", "947" ], [ "Let $G$ be the desired graph. We can consider possible $\\overline{G}$ on 10 vertices with 3 edges. There are 5 of them: $(7K_1, K_3)$, $(6K_1,K_{1, 3})$, $(6K_1, P_4)$, $(5K_1, P_2, P_3)$ and $(4K_1, 3P_2)$.\r\n\r\nIf $G \\cong \\overline{(6K_1, P_4)}$ then partition is not unique:\r\n$$\r\n\\begin{align}\r\n100 & = 2 + 20 + 15 + 3 + 6 + 6 + 12 + 12 + 12 + 12\\\\\r\n & = 2 + 20 + 15 + 3 + 6 + 6 + 6 + 12 + 12 + 18\\\\\r\n & = 2 + 20 + 15 + 3 + 6 + 6 + 6 + 6 + 12 + 24\\\\\r\n & = 2 + 20 + 15 + 3 + 6 + 6 + 6 + 6 + 18 + 18\\\\\r\n & = 2 + 20 + 15 + 3 + 6 + 6 + 6 + 6 + 6 + 30\r\n\\end{align}$$\r\n\r\nThere are exactly 3 pairs of relatively prime numbers: $2$ and $15$, $2$ and $3$, $20$ and $3$, because last $6$ numbers are divisible by $2$ and $3$, $2$ and $20$ are divisible by $2$, $3$ and $15$ are divisible by $3$, $15$ and $20$ are divisible by $5$.\r\n\r\nThe same for $G \\cong \\overline{6K_1, K_{1, 3}}$:\r\n$$\r\n\\begin{align}\r\n100 & = 5 + 6 + 12 + 12 + 10 + 10 + 10 + 10 + 10 + 15\\\\\r\n & = 5 + 6 + 6 + 18 + 10 + 10 + 10 + 10 + 10 + 15\r\n\\end{align}$$\r\n\r\nIf $G \\cong \\overline{(7K_1, K_3)}$ then each vertex of $7K_1$ should have at least $3$ prime divisors to have edge with each of 3 pairwise non-adjacent vertices of $K_3$. Therefore there are $7$ numbers in partition that are at least $30$ each. Then it is impossible to get sum of $100$.\r\n\r\nIf $G \\cong \\overline{(4K_1, 3P_2)}$ then at least $4$ of vertices of $3P_2$ should have at least $3$ prime factors each (different for each vertex) therefore maximum of them is at least $3 \\cdot 5 \\cdot 7 = 105 > 100$. So this graph gives no partition.\r\n\r\nIf $G \\cong \\overline{(5K_1, P_2, P_3)}$, there is a partition:\r\n$$100 = 10 + 10 + 21 + 14 + 15 + 6 + 6 + 6 + 6 + 6.$$\r\nTo prove it is unique for this graph let us note that each vertex should have at least $2$ prime factors and there are at least $4$ prime factors in total. As shown above it is possible to take $2, 3, 5$ and $7$ as prime factors and $5$ of $6$ pairs as values for vertices. Also it is easy to see that this way gives minimum sum of values. If we take another prime factors or more then $2$ prime factors for at least $1$ vertex then we get even greater sum. Therefore this partition is unique for its P-graph.", "805" ], [ "Ok, let $u$ and $v$ not belong to a cycle and have equal outdegree. Since the graph $G$ is tournament then without loss of generality there is an arc $(u, v)$. Let&#39;s consider vertex $w$ that is a head of arc $(v, w)$. Since there is no cycle containing $u$ and $v$ and $G$ is tournament then there is also arc $(u, w)$. Therefore\r\n$$N^+(v) \\subseteq N^+(u) \\setminus \\{\\,v\\,\\}$$\r\nand\r\n$$\\deg^+ v = |N^+(v)| \\le |N^+(u)| - 1 = \\deg^+ u - 1$$\r\nthat implies\r\n$$\\deg^+ v < \\deg^+ u,$$\r\nwhere $\\deg^+ x = |N^+(x)|$ is outdegree of vertex $x$, $N^+(x) = \\{\\,y \\mid (x, y) \\in A(G)\\,\\}$ and $A(G)$ is set of arcs of $G$.", "805" ], [ "You need choose $3$ elements that stay on their positions in $\\binom{10}{3} = 120$ and multiply it by the number $!7$ of permutations of special kind called [derangement](_URL_0_) on remaining $7$ elements. There are many ways to compute number $!k$ (see link), particularly it is known to be equal to $\\frac{k!}{e}$ rounded to the nearest integer. Therefore $\\frac{5040}{e} \\approx 1854 =\\,!7$ and the desired number of permutations on $10!$ elements keeping exactly $3$ of them in place is $\\binom{10}{3} \\cdot\\,!7 = 120 \\cdot 1854 = 222\\,480$.\r\n\r\n---\r\n\r\nAnother way to compute number of such permutation is [inclusion-exclusion principle](_URL_1_). There are $\\binom{10}{3}\\cdot 7!$ ways to select $3$ elements to stay in place and permute all remaining. But for each of $\\binom{10}{4}$ ways to select $4$ elements each permutation that keeps them in place was computed $4$ times, but should not be computed at all. Continuing these thoughts we get that the right number of desired permutations is\r\n$$\\binom{10}{3}\\cdot 7! - \\binom{10}{4} \\cdot 6! \\cdot \\binom{4}{3} + \\binom{10}{5} \\cdot 5! \\cdot \\binom{5}{3} - \\binom{10}{6} \\cdot 4! \\cdot \\binom{6}{3}\\\\\r\n + \\binom{10}{7} \\cdot 3! \\cdot \\binom{7}{3} - \\binom{10}{8} \\cdot 2! \\cdot \\binom{8}{3} + \\binom{10}{9} \\cdot 1! \\cdot \\binom{9}{3} - \\binom{10}{10} \\cdot 0! \\cdot \\binom{10}{3}\\\\\r\n = 604800 - 604800 + 302400 - 100800 + 25200 - 5040 + 840 - 120 = 222480.$$", "247" ], [ "Randić had conjecture, that even more strong property of equality of distance degree sequences implies isomorphism of trees. But there are [counterexamples to Randić&#39;s conjecture](_URL_1_), one of them is below.\r\n\r\n[![enter image description here][1]][1]\r\n\r\nBoth trees have the same *distance degree sequence* that is essentially the same as multiset\r\n$$\\{\\,\\{\\,d(v, u) \\quad \\forall u\\in V(G)\\,\\} \\quad \\forall v \\in V(G)\\,\\}$$\r\nof multisets of distances $d(v, u)$ from each vertex $v$ to all other vertices.\r\n\r\nP. S.\r\nIt is easy to check that in your notation we have $D_{T_1} = D_{T_2} = \\{\\,(16, 5), (42, 4), (48, 3), (30, 2), (17, 1)\\,\\}$ for trees $T_1$ and $T_2$ above.\r\n\r\n\r\n [1]: _URL_0_", "931" ], [ "I have tried the following idea. At first we take a certain value $k$ of height to test whether it is reachable. Then like in [Graham scan](_URL_2_) algorithm modification called Andrew&#39;s Monotone Chain Algorithm we will build lower and upper bounds of convex hull moving from left to right. Moving from left to right for each next point we take all possible $k$ variants, but move further to the right only if it is possible to add this point to either upper or lower bound without removing any other point from this bound. (There is a special case for the first and the last points which should be added to both lower and upper bounds.)\r\n\r\nI&#39;ve implemented this idea, it computed the first 16 rows in 38 seconds, took 687 more to compute the 17th row and 934 more to compute the 18th row.\r\n\r\n$$\\begin{array}{l|l}\r\nn & \\pi_n \\\\\\hline\r\n2 & 1, 1 \\\\\r\n3 & 1, 1, 2 \\\\\r\n4 & 1, 1, 2, 2 \\\\\r\n5 & 1, 1, 3, 2, 3 \\\\\r\n6 & 1, 2, 1, 3, 2, 3 \\\\\r\n7 & 1, 3, 1, 4, 4, 2, 3 \\\\\r\n8 & 2, 3, 1, 1, 4, 4, 2, 3 \\\\\r\n9 & 1, 3, 4, 1, 5, 5, 2, 4, 3 \\\\\r\n10 & 3, 2, 4, 1, 1, 5, 5, 2, 4, 3 \\\\\r\n11 & 2, 1, 5, 6, 1, 7, 7, 2, 6, 3, 4 \\\\\r\n12 & 4, 3, 6, 2, 7, 7, 1, 1, 6, 2, 5, 4 \\\\\r\n13 & 2, 4, 1, 7, 8, 1, 9, 9, 2, 8, 3, 4, 6 \\\\\r\n14 & 4, 6, 7, 2, 8, 1, 1, 9, 9, 2, 8, 3, 4, 6 \\\\\r\n15 & 3, 5, 2, 8, 9, 1, 1, 11, 11, 2, 10, 3, 4, 8, 7 \\\\\r\n16 & 5, 4, 8, 9, 2, 10, 1, 1, 11, 11, 2, 10, 3, 4, 8, 7 \\\\\r\n17 & 4, 3, 8, 2, 11, 12, 1, 1, 14, 14, 2, 13, 3, 4, 11, 7, 9\\\\\r\n18 & 6, 8, 4, 11, 12, 2, 13, 1, 1, 14, 14, 2, 13, 3, 4, 11, 7, 9\\\\\r\n19 & 5, 4, 10, 12, 2, 15, 16, 1, 1, 17, 17, 2, 16, 3, 4, 14, 13, 8, 10\\\\\r\n20 & 8, 10, 5, 4, 14, 15, 2, 16, 1, 1, 17, 17, 2, 16, 3, 4, 14, 13, 8, 10\\\\\r\n21 & 7, 9, 4, 3, 14, 2, 17, 18, 1, 1, 20, 20, 2, 19, 3, 4, 17, 16, 8, 13, 11\\\\\r\n22 & 10, 8, 13, 5, 4, 17, 18, 2, 19, 1, 1, 20, 20, 2, 19, 3, 4, 17, 16, 8, 13, 11\\\\\r\n\\end{array}$$\r\n\r\nNote that $h(11) - h(10) = h(13) - h(12) = h(15) - h(14) = 2$ and $h(17) - h(16) = 3$ where $h(n)$ is the minimum height of $n$-gon that indirectly confirms my conjecture about unlimited growth of $\\frac{h(n)}n$.\r\n\r\nAnother interesting note is that $\\pi_{n}$ has rather long common suffix with $\\pi_{n - 1}$ for even $n$, with an exception of $n = 12$.\r\n\r\nP. S. I would clarify in description of sequence that we need strictly convex polygon, because otherwise there is a trivial polygon of zero height.\r\n\r\nP. P. S. It is easy to see that the sequence [_URL_1_](_URL_0_) mentioned in comments counts identical permutation that gives degenerate convex hull however its perimeter contains all points.", "221" ], [ "Let&#39;s show that each [strongly connected](_URL_0_) digraph with no odd cycles has $1$-basis. It is easy to see that base of strong digraph with no directed odd cycle is bipartite graph. Thus we can include into $S$ all vertices from one non-empty part and get $1$-basis.\r\n\r\nIn general case of digraph with no directed odd cycle we find condensation that is a result of contraction of all strongly connected components. In condensation there always is a vertex of zero indegree, corresponding to some strongly connected component $C$. We take $1$-basis $S_C$ of $C$ and remove from graph each vertex $v$ from $S_C$ together with $N^+(v)$ (that is a set of vertices adjacent from $v$). If there are some vertices remaining then repeat this process.\r\n\r\nAt the end process gives $1$-basis $S = \\bigcup_c S_C$ of initial digraph.", "805" ], [ "DFS is optimal algorithm for this problem. Breadth-first search (BFS) is another optimal algorithm. Both of them take time proportional to the sum of number of vertices and the number of arcs outgoing from $X$ if graph is directed or the number of edges with both ends in $X$ if graph is undirected. This is obviously the best possible time. This bound is true if you use [adjacency list](_URL_0_) for graph storing. If you use adjacency matrix both algorithms become slower, but take $O(|X|\\cdot|G|)$ of time that is the best possible in this case.", "238" ], [ "It is easy to compute an answer for the second question by hand for each point moving from left to right, as shown at picture below, just sum for each point up to 3 numbers on point to the left.\r\n[![enter image description here][1]][1]\r\nIn general case of $n^2$ small triangles we can get recurrent relation and understand that it is the same as [_URL_2_](_URL_1_), that has no closed form (i. e., without recurrent relations or summation). But OEIS confirms answer 90 :)\r\n\r\nThe first question is not so easy. I have computed 5 first values (using program) and didn&#39;t find this sequence in OEIS, so it doesn&#39;t seem to be well-known. The answer for your question is 2726.\r\n\r\n [1]: _URL_0_", "82" ], [ "This is a partial answer that significantly improves the upper bound.\r\n\r\nAt first note that $z = 0 < k^2$ for $n \\le 1$. $\\ddot\\smile$\r\n\r\nFor $n = 2$ it is possible to reach the lower bound of $k^2$ parties that is equal to the trivial upper bound.\r\n\r\nIn graph theory terms I would say we need to cover all edges of complete $n$-partite graph $G(n, k)$ (with parts of equal size $k$) with cliques of size $n$. Let&#39;s show that $(n - 2) k^2$ cliques would be enough for $n \\ge 3$, so this is a new upper bound.\r\n\r\nLet $n = 3$. Then we have $2k$-regular $3$-partite graph $G(3, k) = K_{k, k, k}$. Let&#39;s show that graph $K_{k, k}$ has [$1$-factorization](_URL_0_).\r\nBy [Hall&#39;s marriage theorem](_URL_1_) it has perfect matching. Removing all edges of perfect matching we again get regular bipartite graph and so on. Therefore we have $k$ perfect matchings that contain all edges between two parts of our $K_{k, k, k}$. Now for each vertex $v$ of the third part we take one perfect matching $M$ of these $k$ and for each edge $\\{\\,u, w\\,\\} \\in M$ of this matching we take clique $\\{\\,v, u, w\\,\\}$. Then we have $k^2$ cliques that cover all edges of $K_{k, k, k}$. This is the base of induction.\r\n\r\nSuppose that for $n = m$ all edges of $G(m, k)$ can be covered by at most $(m - 2)k^2$ cliques. Then for $n = m + 1$ we can add any vertex from the last part to the same $(m - 2)k^2$ cliques and add $k^2$ cliques as follows. For each vertex from the last part take the first vertex from each other part, then take the second vertex from each other part and so on for $k^2$ cliques in total. (I. e. each of $k$ vertices of the last part has $k$ edges to each other part.)\r\n\r\nThus $k^2 \\le z \\le (n - 2)k^2$ for $n \\ge 3$. Both lower and upper bounds are not sharp still if $n > 3$. For example for $n = 4$ and $k = 2$ it is possible to take only $6$ cliques that is between $k^2 = 4$ and $(n - 2)k^2 = 8$.", "805" ], [ "This is number of connected unicyclic *labeled* graphs. Therefore if $r$ is the length of a cycle we have $\\binom{n}{r}$ ways to select $r$ vertices of cycle, $\\frac{(r - 1)!}2$ ways to build a cycle on these vertices.\r\n\r\nAll we need now is the number of forests on $n$ vertices with $r$ rooted trees with given roots. It can be computed in the same way as Cayley&#39;s formula was confirmed with [Pr&#252;fer code](_URL_0_). So we can relabel vertices so that $r$ roots have numbers $n, n - 1, \\ldots, n - r + 1$. Then we compute Pr&#252;fer code of forest while there is at least one edge. (Note that in case of tree we stop one step before, i. e. we compute code while there are at least two edges.) Then it is easy to see that each forest can be uniquely mapped to its Pr&#252;fer code. Each of $n - r - 1$ leaves can be adjacent to any of $n$ vertices and the last, $n - r$th leaf is adjacent to one of $r$ roots. Also no root will be deleted as leaf with minimum label, because there always is at least one other leaf. So there are $rn^{n - r - 1}$ desired forests. So\r\n$$c(k, k) = \\sum_{r = 3}^n \\binom{n}{r} \\frac{(r - 1)!}2 rn^{n - r - 1} = \\sum_{r = 3}^n \\binom{n}{r} \\frac{(r - 1)!}2 rk^{k - r - 1} = \\sum_{r = 3}^k \\frac{k!}{2(k - r)!} k^{k - r - 1}.$$\r\n\r\nProof of asymptotics I&#39;ll give later.", "931" ], [ "Let $f_k(n)$ be the probability of $n$ flips and no $k$ equal successive outcomes. Then\r\n$$f_k(n) =\r\n\\begin{cases}\r\n1, & \\text{if } n = 0;\\\\\r\nf_k(n - 1) - [n \\ge k]\\cdot\\frac{1}{2^k}\\cdot(1 + [n = 1])\\cdot f_k(n - k), & \\text{if } n > 0;\\\\\r\n\\end{cases}$$\r\nbecause after new flip can be $k$th equal successive outcomes if $k$ last outcomes are equal and not equal to the one before them if it exists. Computing this value for all $n \\le 1024$ and $k = 11$ we get $f_{11}(1024) \\approx 0.6076519$ that is really close to $e^{-1/2}$ mentioned by <PERSON> in comments.", "430" ], [ "I guess it is impossible to find polynomial of $n$ solution for set $\\{\\,\\sqrt1, \\sqrt2, \\ldots, \\sqrt n\\,\\}$ of numbers unless $\\mathrm P = \\mathrm{NP}$. However I wouldn&#39;t prove this conjecture. Because I can suggest an approach that takes $\\mathrm O(n\\cdot 2^{n / 2})$ time for even more general case, i. e., for arbitrary (multi-)set $\\{\\,a_1, a_2, \\ldots, a_n\\,\\}$ of numbers. For $n = 50$ it should take $1$ second or less on any modern computer.\r\n\r\nIf we want to get two part with the most equal sums then it is the same when we want to minimize an absolute value of sum $S(\\overline{\\alpha})(-1)^{\\alpha_1}a_1 + (-1)^{\\alpha_2}a_2 + \\cdots + (-1)^{\\alpha_n}a_n$ subject to $\\alpha_i \\in \\{\\,0, 1\\,\\}$. We will use it further.\r\n\r\nSo at first we separate all numbers into two almost equal parts. I. e., let $k = \\left\\lfloor \\frac{n}{2}\\right\\rfloor$, then $A = \\{\\,a_1, a_2, \\ldots, a_k\\,\\}$ and $B = \\{\\,a_{k + 1}, \\ldots, a_{n - 1}, a_n\\,\\}$. Now we can compute collection $S_A$ of all possible sums $(-1)^{\\alpha_1}a_1 + (-1)^{\\alpha_2}a_2 + \\cdots + (-1)^{\\alpha_k}a_k$ for $\\alpha_i \\in \\{\\,0, 1\\,\\}$ in $\\mathrm O(2^k)$ time. (However you can do it in the most trivial way using $\\mathrm O(k\\cdot 2^k)$ time that is acceptable.) In other words we consider separation of $A$ into two parts and subtract sum of the second part from sum of the first part for all possible separations. The same we can do to compute $S_B$ that is collection of all possible similar sums for $B$.\r\n\r\nAfter that we sort one of them, say $S_A$, using $\\mathrm O(|S_A| \\log |S_A|) = \\mathrm O(2^k \\cdot k)$ time. Then for each element $s$ of $S_B$ we can find an element $t(s)$ of $S_A$ that is the closest to $s$ among all elements of $S_A$. Just use binary search for that purpose and use $\\mathrm O(\\log |S_A|) = O(k)$ time for each of $O(2^k)$ elements of $B$. So we have $\\mathrm O(\\log k \\cdot 2^k) = \\mathrm O(n \\cdot 2^{n / 2})$ time in total. Getting for $s \\in S_B$ the closest to $s$ element $t(s) \\in S_A$ we minimize the absolute value of $s + t(s)$ and therefore taking minimum over all $s \\in S_B$ we get we minimum of $S(\\overline{\\alpha})$ as desired.", "757" ], [ "If balls are distinguishable by color only then the first man can chose balls in\r\n$$w = \\sum_{i = 0}^7 \\sum_{j = 0}^8 [12 - 9 \\le i + j \\le 12]$$\r\nways, where $[P]$ is $1$ if $P$ is true and $0$ otherwise. Here $i$ is the number of red balls and $j$ is the number of yellow balls taken by the first man. Conditions on $i + j$ guarantees that there are enough green balls for sum $12$ and sum wouldn&#39;t exceed $12$. The second man gets all remaining balls in the only way. So we can compute the desired number:\r\n$$w = \\sum_{i = 0}^7\\sum_{j} [0 \\le j \\le 8]\\cdot [3 \\le i + j \\le 12] \r\n= \\sum_{i = 0}^7\\sum_j [\\max \\{\\,0, 3 - i\\,\\} \\le j \\le \\min \\{\\,8, 12 - i\\,\\}]\\\\\r\n= \\sum_{i = 0}^7 \\min \\{\\,8, 12 - i\\,\\} - \\max \\{\\,0, 3 - i\\,\\} = 6 + 7 + 8 + 9 + 9 + 8 + 7 + 6 = 60.$$\r\nP. S. I don&#39;t see more elegant solution, but it may exist.", "446" ], [ "I guess induction is not a good idea here. There is a rather straightforward proof.\r\n\r\nLet there be an edge between vertices $u$ and $v$ of the same level of BFS tree. Then there is obviously a cycle of odd length: let $w$ be the lowest common ancestor of $u$ and $v$, then cycle $u \\leftrightsquigarrow w \\leftrightsquigarrow v - u$ has an odd length (here $x \\leftrightsquigarrow y$ is a $(x, y)$-path in BFS tree and $x - y$ is just an edge).\r\n\r\nLet there be no edge between vertices of the same level of BFS tree. Suppose there is a cycle of odd length. Obviously it should have an edge between two vertices of levels that differ not by $1$. Then it should be at least $2$ since there is no edge between vertices of the same level. But any such edge contradicts to the way the tree was built, because edge between vertices $u$ and $v$ of levels that differ by at least $2$ implies that lower of $u$ and $v$ should go directly after higher of $u$ and $v$, i. e., higher than it actually is. This constradiction finishes the proof.", "931" ], [ "Firstly tree is a *connected* graph without cycles. As it is mentioned in comments *finite* regular tree is either $K_2$ or $K_1$. However term *homogeneous tree* concerns not finite, but locally finite trees. A tree $T$ is *locally finite* if set $N(v)$ of vertices adjacent to $v$ is finite for all $v \\in V(T)$. Locally finite tree is *homogeneous* of degree $d$ if each vertex is incident to $d$ edges. See more in book \" ;[Harmonic Analysis for Anisotropic Random Walks on Homogeneous Trees](_URL_0_) \" ; by <PERSON> <PERSON>.", "931" ], [ "Given positive integers $n$ and $m$. We choose any [partial grid](_URL_0_) $G$ that is a subgraph of $n \\times m$ [grid](_URL_1_). We choose some vertex $v$ of $G$ and run breadth first search (BFS) algorithm from this vertex. *Layer of BFS tree* is a set of vertices with the same distance (in edges) to $v$. The question is the following:\r\n > What is the maximum size of layer of BFS tree over all choices of $G$ and $v$ for given $n$ and $m$?\r\n\r\nParticularly, is it true that size of each layer is $O(n + m)$? Or can it be $\\Omega(nm)$?\r\n\r\nBackground of this question is the following. I want to challenge student&#39;s solution for a problem that requires BFS on partial grid. The problem in his implementation is that he uses array instead of queue and deletes the first element shifting all others. Therefore time complexity of his implementation is $\\Omega(\\ell_0^2 + \\ell_1^2 + \\cdots + \\ell_d^2)$, where $\\ell_i$ is number of vertices with distance $i$ to vertex $v$ and $d$ is the maximum distance to $v$. This is obviously quadratically bad time for general case, however it would be acceptable by judge system subject to existing constraints on $n$ and $m$ (up to $300$) if there is no test case with layer size of $\\omega(n + m)$.", "931" ], [ "we don&#39;t compare running time of two solutions, we have some time limit (an integral number of seconds) for each test and guarantee that every proper solution wouldn&#39;t break it. Surely there is a solution that gives this guarantee for each problem. Also I should say that practical performance may significantly depend on test structure as in case we are dealing with.", "585" ], [ "Yes, Euler&#39;s formula is a good start. So, $n - m + f = 2$ for any connected non-trivial planar graph $G$, where $n$ is the number of vertices, $m$ is the number of edges and $f$ is the number of faces. If $G$ is a tree than it obviously has a *leaf* that is a vertex of degree $1$. If $G$ contains a cycle, then each edge belongs to at most $2$ faces, while each face contains at least $3$ edges, so $3f \\le 2m$ that is $f \\le \\frac23 m$. Then $n - m + f + \\frac23 m \\ge 2 + f$, therefore $3n - 6 \\ge m$.\r\n\r\nAlso by handshake lemma we have $\\sum_{v \\in V(G)} \\deg v = 2m$. So if $\\deg v \\ge 6$ for all $v \\in V(G)$, then $6n - 12 \\ge 2m \\ge 6n$. This contradiction shows that there is a vertex of degree at most $5$.", "805" ], [ "This is not a complete answer, just an upper bound.\r\nA trivial upper bound is $\\binom{n}{k - 1}$, because each part has its specific subset of size $k - 1$ that is subset of each element of part (even is a part has only one subset of size $k$ it can be assigned some subset of size $k - 1$).\r\n\r\nI&#39;m going to show that $\\binom{n - 1}{k - 1}$ for $k \\ge 1$ is a better upper bound (and $k = 0$ is a trivial case with the only part of one empty subset). Let $f(n, k)$ be the desired minimum number of parts. Then $f(n, 1) = 1$ and $f(n, n) = 1$. Suppose $f(m, k) \\le \\binom{m - 1}{k - 1}$ for all $m < n$ and $1 \\le k \\le m$. We have $f(n, k) \\le f(n - 1, k - 1) + f(n - 1, k)$ since we can firstly divide all subsets with element $n$ into $f(n - 1, k - 1)$ parts and then divide all subsets without element $n$ into $f(n - 1, k)$ parts. So\r\n$$f(n, k) \\le f(n - 1, k - 1) + f(n - 1, k) \\le \\binom{n - 2}{k - 2} + \\binom{n - 2}{k - 1} = \\binom{n - 1}{k - 1}$$\r\nfor $2 \\le k \\le n$ and $f(n, 1) = 1 \\le 1 = \\binom{n - 1}{0}$. Thus we have proven an induction step and the basis is $n = 2$.\r\n\r\nThis upper bound is less than $k$ times greater than the lower bound achieved before:\r\n$$\\frac{\\binom{n - 1}{k - 1}}{\\frac{\\binom{n}{k}}{n - (k - 1)}} = \\frac{(n - k + 1)}{n}k.$$\r\n\r\nHowever $f(6, 3) = 6$ shows that both of them are not tight.", "334" ], [ "No, you approach is not right. Let $G = (\\{\\,1, 2, 3\\,\\}, \\{\\,\\{\\,1, 2\\,\\}, \\{\\,1, 3\\,\\}, \\{\\,2, 3\\,\\}\\,\\})$. The edge $\\{\\,1, 2\\,\\}$ is red and two other edges are blue. Let DFS start from 1 and choose neighbouring vertices in increasing order. Then we have arcs $(1, 2)$, $(2, 3)$ and $(1, 3)$, so the order $1, 2, 3$ is topological. You have “distances” 0, 0 and 1 and take only one blue edge.\r\n\r\nThere is an appropriate algorithm which doesn&#39;t deal with weighted spanning tree.\r\n > ! Use disjoint set data structure and unite sets by all blue edges. (If edge connects vertices from different sets add this edge to a spanning tree and unite corresponding sets.) After that unite remaining sets with red edges. This give minimum number of blue edges takes $O(n \\alpha^{-1}(n) + m)$ time where $n$ is the number of vertices, $m$ is the number of edges and $\\alpha^{-1}(\\cdot)$ is the [inverse Ackermann function](_URL_0_).", "238" ], [ "Let $f_{i, k, n, N} = (-1)^{g(i, k, n, N)}$ for $g(i, k, n, N) \\in \\{\\,0, 1\\,\\}$. Then we can take\r\n$$g(1, k, n, N) = \\left[k > \\binom{N - 1}{n}\\right],\\\\\r\ng(2, k, n, N) = \\left[k - g(1, k, n, N)\\binom{N - 1}{n} > \\binom{N - 2}{n - g(1, k, n, N)}\\right]$$\r\nand so on:\r\n$$g(i, k, n, N) = \\left[k - \\sum_{j = 1}^{i - 1}g(j, k, n, N)\\binom{N - j}{n - \\sum_{\\ell = 1}^{j - 1}g(\\ell, k, n, N)} > \\binom{N - i}{n - \\sum_{\\ell = 1}^{i - 1}g(\\ell, k, n, N)}\\right].$$\r\nThis formula is recursive, but this recurrence is inside the $k$th combination.\r\nThe other way to write the same is the following:\r\n$$g(1, k, n, N) = \\left[k > \\binom{N - 1}{n}\\right],\\\\\r\ng(i, k, n, N) = g\\left(i - 1, k - g(1, k, n, N)\\binom{N - 1}{n}, n - g(1, k, n, N), N - 1\\right) \\text{ for } 2 \\le i \\le n.$$\r\nThe sense of this relation is pretty straightforward: we don&#39;t take the first element in the first $\\binom{N - 1}{n}$ combinations and take it in all others.\r\nThen we continue to build the remaining part of combination.\r\n\r\nP. S. $[P]$ is $1$ if $P$ is true and $0$ otherwise. This is rather widespread [Iverson notation](_URL_0_).", "699" ], [ "This is the Rectilinear Picture Compression problem that is known to be NP-hard (see textbook Computer and Intractability, a guide to the theory of NP-completeness by <PERSON> and Johnson, p. 232, SR25). So noone will give you polynomial time solution if $\\mathrm{P} \\ne \\mathrm{NP}$. You can apply methods for solving NP-hard problems, e. g., brunch and bounds.\r\n\r\nEDIT: The note above was about cover-version of problem. For partition-version there are polynomial time algorithms. You can start from [Efficient Algorithms for Geometric Graph Search Problems](_URL_0_) by <PERSON> and <PERSON>, subsection 7.1. As far as I see for your case it provides $O(N^{5/2})$-time algorithm for a single connected region of squares and therefore $O(N^{7/2})$-time in total.\r\n\r\nIt seems that painting grid like chess board gives maximum number $\\left\\lceil\\frac{N^2}2\\right\\rceil$ of rectangles needed, however I can&#39;t give rigorous proof now.", "293" ], [ "Suppose there is a graph $G$ and its strong orientation $D$ such that there is a block $B$ of graph $G$ such that corresponding subdigraph $B_D = D(V(B))$ is not strong.\r\n\r\nLet there be vertices $u$ and $v$ such that there is no directed $(u, v)$-path inside $B_D$, but there is a directed $(u, v)$-path in $D$. This means that $(u, v)$-path goes through some cut-vertex $w$ outside of $B_D$ and then returns in to $B_D$. But when it returns to $B_D$ it goes again through $w$ otherwise $w$ is not a cut-vertex ans/or $B$ is not a block. Then we can remove part of path between the first occurrence of $w$ and the last orccurrence of $w$. Doing that for each cur-vertex we get a path inside $B_D$. This contrary shows that if $D$ is strong than $B_D$ is strong.\r\n\r\nLet orientation $B_D$ of each block $B$ be strong. Now we will show that $D$ is strong. Really let vertices $u$ and $v$ be in different blocks and $(u, v)$-path in $G$ contain cut-vertices $w_1, w_2, \\ldots, w_k$ in this order. Since each block is strong then there are directed paths between $u$ and $w_1$, $w_1$ and $w_2$, \\ldots, $w_{k - 1}$ and $w_k$, $w_k$ and $u$ in digraph $D$. Concatenating all these paths we get a directed $(u, v)$-path for all $u$ and $v$ from different block. And there is an $(u, v)$-path for all $u$ and $v$ from the same block since each block is strong. So $D$ is strong if and only if each subdigraph of $D$ induced by the vertices of block of $G$ is strong.\r\n\r\nFor the second question the answer is yes, line digraph $L(G)$ of a strong digraph $G$ is also strong. Let $(u, v)$ and $(x, y)$ be arbitrary directed edges of $G$ (and therefore vertices of $L(G)$). There is a directed $(v, x)$-path in $G$, let it be $v = w_0, w_1, \\ldots, w_k = x$. Then there is a directed path $$(u, v), (w_0, w_1), (w_1, w_2), \\ldots, (w_{k - 1}, w_k), (x, y)$$ in $L(G)$. Then $L(G)$ is strong since we&#39;ve chosen arbitrary ordered pair of vertices of $L(G)$.", "805" ], [ "At first since this is a tournament there can be at most one vertex of zero in-degree. So there is exactly one such vertex. And the question now is how many (up to isomorphism) tournaments are there on four vertices.\r\n\r\nThe first case is that one vertex has zero in-degree in this subtournament on four vertices. Then we have two different subtournaments on remaining three vertices (one directed cycle and one acyclic digraph).\r\n\r\nThe second case is that no vertex has zero in-degree and no vertex has zero out-degree in this subtournament on four vertices. Then there are two vertices of in-degree $2$ and two vertices of in-degree $1$. If it easy to see that there is the only such subtournament on four vertices.\r\n\r\nAnd the third case is that no vertex has zero in-degree and one vertex has in-degree $3$ in this subtournament on four vertices. Then there is one more tournament.\r\n\r\nThus we have $4$ tournaments in total.\r\n\r\nP. S. Thanks to [<PERSON>_) for pointing on the third case.", "805" ], [ "At first note that if a vertex $u \\in V(G)$ has more than $\\frac{n + 2}{2}$ neighbours then $\\deg u \\ge \\frac{n + 3}2$ since $\\deg u$ is an integer. The graph $G$ is not empty, because it has two vertices with positive degree. Then there is no vertex of degree $0$ or $1$, since there are two edge-disjoint spanning trees. If there is a vertex $v$ of degree $2$ then $v$ is a leaf in both edge-disjoint spanning trees, thus $G - v$ is a good graph. If $\\deg v \\ge 3$ for all $v \\in V(G)$, then taking into account two vertices of degree at least $\\frac{n + 3}2$ we get that\r\n$$|E(G)| = \\frac12\\sum_{v \\in V(G)} \\deg v \\ge \\frac12\\left((n - 2) \\cdot 3 + 2 \\cdot \\frac{n + 3}2\\right) = \\frac12 (4n - 3).$$\r\nSince $|E(G)|$ is an integer then $|E(G)| \\ge \\left\\lceil \\frac{4n - 3}2\\right\\rceil = 2n - 1$. Each spanning tree has $n - 1$ edges for $2n - 2 < |E(G)|$ edges in total for the pair of edge-disjoint spanning trees. Therefore there is an edge that doesn&#39;t belong to either spanning tree of the pair. We can remove this edge keeping graph being good.", "805" ], [ "This part is about proper colorings. Any tree is connected bipartite graph. So when you color one vertex you can use either breadth-first search or depth-first search to color all other vertices, because when you push new vertex to a queue or stack you know the only appropriate color for it. Since you have only two possibilities to color the first vertex the time is linear, no DP is required.\r\n\r\n---\r\n\r\nThis part is about maximum independent set. So after edit question become about maximum independent set (the set of blue vertices). For leave $v$ it is easy to see that there is maximum independent set $I_v$ that contains $v$. Really if some maximum independent set $I&#39;$ doesn&#39;t contain $v$ than it should contain the only neighbor $u$ of $v$ because otherwise it is not maximal and therefore can not be maximum. Then $I_v = (I&#39; \\setminus \\{\\,u\\,\\}) \\cup \\{\\,v\\,\\}$. Also if $\\deg v = 0$ then $v$ obviously should be in each maximum independent set.\r\n\r\nTherefore the algorithm is the following. Take arbitrary vertex of degree 0 or 1 leave color it into blue and remove this vertex from graph together with its neighbor if it exists. Continue while there are non-colored vertices. To make this approach efficient we can use queue (or stack) which contains all non-colored vertices of degree 0 or 1. Still no DP is required.\r\n\r\nIf DP is the only acceptable way then let&#39;s do the following. Do depth-first search (so the stack is required anyway). For each vertex $v$ compute the number of blue vertices in subtree of $v$ if $v$ is blue (number $f_b(v)$) and if $v$ is red (number $f_r(v)$). It is possible to compute it after computing for all children in the following way:\r\n$$f_b(v) = 1 + \\sum_{u \\in N^+(v)} f_r(u),\\\\\r\nf_r(v) = \\sum_{u \\in N^+(v)} \\max\\{\\,f_r(u), f_b(u)\\,\\}.$$\r\nThis way also gives linear time.", "805" ], [ "Firstly let see that your solution is wrong. Consider matrix\r\n$$A_1 = \\begin{bmatrix}\r\n1 & 0 & 1 & 1\\\\\r\n0 & 1 & 1 & 0\\\\\r\n0 & 0 & 1 & 1\\\\\r\n0 & 0 & 0 & 1\\\\\r\n\\end{bmatrix}.$$\r\nMatrix $A_1$ is upper-triangular therefore it is triangular, but you would say it is not triangular, because there is no $j$ such that $n_j = 4$.\r\n\r\nIt could seem that replacing conditions $n&#39;_j = j$ and $m&#39;_i = i$ by $n&#39;_j \\le j$ and $m&#39;_i \\le i$ (where $n&#39;_1, n&#39;_2, \\ldots, n&#39;_n$ and $m&#39;_1, m&#39;_2, \\ldots, m&#39;_n$ are non-decreasing permutations of $n_1, \\ldots, n_n$ and $m_1, \\ldots, m_n$ correspondingly) may help. But that is not right too. One of possible counterexamples is\r\n$$A_2 = \\begin{bmatrix}\r\n1 & 0 & 0 & 0\\\\\r\n0 & 1 & 1 & 1\\\\\r\n0 & 1 & 1 & 1\\\\\r\n0 & 0 & 1 & 1\\\\\r\n\\end{bmatrix}.$$\r\n\r\n---\r\n\r\nThis problem is [known](_URL_0_) to be NP-complete. Exponential time algorithm is presented in this paper. Brief description is here:\r\n\r\n* If permanent is greater than $1$ then no desired permutation of rows and columns exists.\r\n* If permanent is equal to $1$ then we can place corresponding 1&#39;s on the main diagonal. Consider remaining matrix as adjacency matrix of digraph and check whether there is topological order of this digraph (which correspond to upper-triangular permutation of matrix rows and columns).\r\n* If permanent is equal to $0$ then some exhaustive search should be done.\r\n\r\nCheck whether permanent is $0$, $1$ or greater than $1$ can be done in polynomial time. It is based on easy fact that permanent of a $(0, 1)$-matrix $A$ is the number of perfect matchings in bipartite graph with biadjacency matrix $A$.", "493" ], [ "Let&#39;s consider the following bipartite graph $G = ((S_{[n]}, [n]), E)$, where vertices of the first part are sets $(S_i)$, vertices of the second part are numbers and there is an edge between set $S_i$ and number $j$ iff $j \\in S_i$. It is easy to see that $G$ is bipartite $C_4$-free graph and $|E| = \\sum_{i = 1}^n |S_i|$.\r\n\r\nTherefore let&#39;s count the maximum number of edges in $G$. Let&#39;s count the number $x$ of subgraphs $P_3$ where middle vertex is a set, that is the number of pairs of numbers that belong to the same set. On one hand it is exactly $x = \\sum_{i = 1}^n \\binom{|S_i|}{2}$. On the other hand $x \\le \\binom{n}{2}$ because each pair can belong to at most one set. So we have\r\n$$\\begin{align}\r\n\\sum_{i = 1}^n \\binom{|S_i|}{2} & \\le \\binom{n}{2},\\\\\r\n\\sum_{i = 1}^n |S_i|^2 - \\sum_{i = 1}^n |S_i| & \\le n^2 - n,\\\\\r\n\\sum_{i = 1}^n |S_i|^2 & \\le n^2 - n + \\sum_{i = 1}^n |S_i|.\\\\\r\n\\end{align}$$\r\n\r\nRemember that\r\n$$ \\frac{\\sum_{i = 1}^m a_i}{m} \\le \\sqrt{\\frac{\\sum_{i = 1}^m a_i^2}{m}}$$\r\nor\r\n$$ \\left(\\sum_{i = 1}^m a_i\\right)^2 \\le m\\sum_{i = 1}^m a_i^2$$\r\nby <PERSON> inequality for any real numbers $a_i$. Then\r\n$$\\left(\\sum_{i = 1}^n |S_i|\\right)^2 \\le n\\sum_{i = 1}^n |S_i|^2 \\le n^3 - n^2 + n\\sum_{i = 1}^n |S_i|,\\\\\r\n|E|^2 \\le n^3 - n^2 + n|E|,\\\\\r\n|E|^2 - n|E| - n^3 + n^2 \\le 0,\\\\\r\n\\left(|E| - \\frac{n + n\\sqrt{4n - 3}}2\\right)\\left(|E| - \\frac{n - n\\sqrt{4n - 3}}2\\right) \\le 0,\\\\\r\n\\frac{n - n\\sqrt{4n - 3}}2 \\le |E| \\le \\frac{n + n\\sqrt{4n - 3}}2 = O(n\\sqrt n).$$\r\nThus $\\frac1n\\sum |S_i| = \\frac{|E|}n = O(\\sqrt n)$.", "805" ], [ "Is is possible to make a spoiler space with a numbererd list inside?\r\n\r\n > ! Here is what I have tried:\r\n\r\n > ! 1. The first.\r\n > ! 2. The second.\r\n\r\nor\r\n\r\n > ! Here is what I have tried:\r\n > !\r\n > ! 1. The first.\r\n > ! 2. The second.\r\n\r\nor\r\n\r\n > ! Here is what I have tried:\r\n1. The first.\r\n2. The second.\r\n\r\nor\r\n\r\n > ! Here is what I have tried:\r\n > ! 1. The first.\r\n > ! 2. The second.\r\n\r\nBut nothing works... I guess it is a bug.\r\n\r\nEdit. The solution provided in [this answer](_URL_0_) mentioned by <PERSON> works fine for pure text like above:\r\n\r\n > ! Here is the proposed workaround:\r\n > !\r\n > ! < pre > 1. The first.\r\n > ! 2. The second. < /pre > \r\n\r\nbut has a problem with formulae:\r\n\r\n > ! Here is the proposed workaround:\r\n > !\r\n > ! < pre > 1. The first $n$.\r\n > ! 2. The second $k$. < /pre >", "829" ], [ "The Hamiltonian cycle problem (HCP) is NP-complete in the class of $2$-connected bipartite $d$-regular graphs for each $d \\ge 3$.\r\n\r\n*Proof.* It is known (see [<PERSON>, <PERSON>, <PERSON>, NP-Completeness of the Hamiltonian Cycle Problem for Bipartite Graphs](_URL_1_)) that HCP is NP-complete in the class of $3$-connected bipartite cubic graphs (and therefore is NP-complete in the class of $2$-connected bipartite cubic graphs). And it is clear that HCP is in NP for any graph class. Let&#39;s show a polynomial reduction of HCP in the class of $2$-connected bipartite $d$-regular graphs to HCP in the class of $2$-connected bipartite $(d+1)$-regular graphs for $d \\ge 3$.\r\n\r\nLet $G$ be a $2$-connected bipartite $d$-regular graph. Let $G_1$ and $G_2$ be two copies of $G$. Now for each vertex $v$ of $G$ we take a copy $X_v$ of complete bipartite graph $K_{d+1, d+1}$, remove an edge between vertices $u_1$ and $u_2$ and then add edges $\\{\\,u_1, v_1\\,\\}$ and $\\{\\,u_2, v_2\\,\\}$, where $v_1$ and $v_2$ are copies of $v$ in $G_1$ and $G_2$ correspondingly. It is easy to see that constructed graph $H$ is bipartite and $(d + 1)$-regular. Graph $H$ is Hamiltonian if and only if $G$ is Hamiltonian.\r\n\r\nLet $C$ be a Hamiltonian cycle in graph $G$. Then we replace each vertex $v$ with $v_1P_vv_2$ where $P_v$ is a Hamiltonian $(u_1, u_2)$-path in $X_v$. So we get a Hamiltonian cycle in $H$.\r\n\r\nLet $C$ be a Hamiltonian cycle in graph $H$. Then for each $v$ all vertices of $X_v$ take consequtive $2d + 2$ positions between $v_1$ and $v_2$. If we replace each such part of cycle with $v$ we get a Hamiltonian cycle in $G$. $\\square$\r\n\r\n\r\n\r\nTherefore the answer to your question is no, no and again no, for each $d \\ge 3$ there are infinitely many connected bipartite $d$-regular non-Hamiltonian graphs. However [almost all regular bipartite graphs are Hamiltonian](_URL_0_). Also non-Hamiltonian such graphs are not too small. Particularly it is conjectured by H&#228;ggkvist that every $2$-connected $k$-regular bipartite graph on at most $6k$ vertices is Hamiltonian. And it is [proved](_URL_2_) that every $2$-connected $k$-regular bipartite graph on at most $6k - 38$ vertices is Hamiltonian.", "805" ], [ "It is rather common in discrete math to define $0^0 = 1$. For example it is known that $\\sum_{k = 0}^n (-1)^k\\binom{n}{k} = (1 - 1)^n = 0^n$ that should be true for $n = 0$ too: $\\binom{0}{0} = 1$. More arguments you can find [here](_URL_0_).\r\n\r\n > Some textbooks leave the quantity $0^0$ undefined, because the functions $0^x$ and $x^0$ have different limiting values when $x$ decreases to $0$. But this is a mistake. We must define\r\n$$x^0=1 \\text{ for all }x,$$\r\nif the binomial theorem is to be valid when $x=0$, $y=0$ , and/or $x=-y$. The theorem is too important to be arbitrarily restricted! By contrast, the function $0^x$ is quite unimportant.\r\n\r\nfrom Concrete Mathematics, p. 162, <PERSON>, <PERSON>, <PERSON>, Addison-Wesley, 1988\r\n\r\nHowever note that there are some cases in discrete math when $0^0$ should be defined some other way, e. g., $0^0 = 0$ or $0^0 = 2$.", "500" ], [ "Values themselves are not important, we just use that they are pairwise distinct. Let compute number $f(n)$ of binary search trees (BSTs) on $n$ vertices for some values of $n$.\r\n\r\nObviously $f(1) = 1$ since there is the only BST on $1$ vertex. \r\nFor $n > 1$ we can take any vertex as root. If we take vertex with the smallest value as root then all other $n - 1$ vertices go to the right subtree and there are $f(n - 1)$ such BSTs. If we take vertex wtih the second smallest value as root then $1$ certain vertex goes to the left subtree in $f(1)$ possible ways and other $n - 2$ vertices go to the right subtree in $f(n - 2)$ possible ways. And so on. Assuming $f(0) = 1$ we have\r\n$$f(n) = f(0) \\cdot f(n - 1) + f(1) \\cdot f(n - 2) + \\cdots + f(n - 1) \\cdot f(0) = \\sum_{i = 0}^{n - 1}f(i)\\cdot f(n - 1 - i).$$\r\nThen\r\n$$f(1) = 1,\\\\\r\nf(2) = 1 + 1 = 2,\\\\\r\nf(3) = 2 + 1 + 2 = 5,\\\\\r\nf(4) = 5 + 2 + 2 + 5 = 14,\\\\\r\nf(5) = 14 + 5 + 4 + 5 + 14 = 42,\\\\\r\nf(6) = 42 + 14 + 10 + 10 + 14 + 42 = 132.\r\n$$\r\nIn general $f(n) = C_n = \\frac{(2n)!}{(n + 1)!n!}$ where $C_n$ is the [Cathalan number](_URL_0_).", "931" ], [ "We can use inclusion/exclusion principle here. The total number of solutions of equation such that $x_i \\ge b_i k + 1$ is $\\binom{M - k\\sum_i b_i - 1}{n - 1}$, where $b_i \\in \\{\\,0, 1\\,\\}$. Then the number of solutions such that $1 \\le x_i \\le k$ is\r\n$$\\binom{M - 1}{n - 1} - \\binom{n}{1} \\binom{M - k - 1}{n - 1} + \\binom{n}{2} \\binom{M - 2k - 1}{n - 1} - \\cdots + (-1)^{\\left\\lfloor \\frac{M - n}{k}\\right\\rfloor} \\binom{n}{\\left\\lfloor \\frac{M - n}{k}\\right\\rfloor} \\binom{M - \\left\\lfloor \\frac{M - n}{k}\\right\\rfloor k - 1}{n - 1}\\\\\r\n= \\sum_{\\ell = 0}^{\\left\\lfloor \\frac{M - n}{k}\\right\\rfloor}(-1)^{\\ell}\\binom{n}{\\ell}\\binom{M - \\ell k - 1}{n - 1}.$$", "757" ], [ "There is a not located on the next page after one more greedy algorithm:\r\n\r\n > Note that both these algorithms come up with a maximal packing (or maximal dual solution) and pick\r\nthose vertices in the cover for which the dual constraint is met with equality. Any method that comes up\r\nwith such a maximal dual solution would in fact yield a 2 approximation. These are just two ways of defining\r\na maximal dual solution.\r\n\r\nSo Clarkson&#39;s greedy algorithm is stated to be $2$-approximate.", "170" ], [ "I have searched and searched but cannot find/ calculate an answer I trust. I am trying to design a control module that will be based off the power from a 3-phase star wind generator. The current generator has a open-circuit voltage of 800 VAC at 140 RPM. The phase resistance is 2 ohms. Max output is 15kW. I was planning on using a hall effect or a CT to measure the current and then measure the voltage to calculate the power output. I don&#39;t know the maximum or operating current output in order to select a device to scale the current properly. \r\n\r\nEdit:\r\nI found the data on this generator else where and under the graph there is a note that the voltage is DC rectified! The original information sheet had no note. Assuming that the Max power output is 15kW and my max dc output is 800V at a fixed load I can say my max dc current is 18 A. Where does this leave me for AC current max?", "803" ], [ "Thank you <PERSON> for your answer. 800VAC is what the specifications say. The generator is meant to be run at 125RPM so there will be something in place to avoid over rotation. The current plan to calculate the power is to sum the instantaneous power. I am aware that AC power calculations are a lot more complicated then P=VI. Transistor this is currently just a hobby for testing some theories. I am interested in hearing what your advice for hobby vs mass production is though.", "803" ], [ "In this case phrase \" ;cycle $C$ of simple graph $G$ has a chord \" ; means that there is an edge $e \\in E(G)$ that links two vertices of cycle $C$, but is not a part of this cycle. In other words given a cycle of length at least $4$ in chordal graph you can easily find a shorter cycle in this graph taking a chord of the given cycle and a part of the cycle between ends of the chord. And yes, graph $K_4 - e \\cong K_{1, 1, 2}$ is chordal.\r\n\r\nP. S. You can find [several equivalent definitions](_URL_0_) of chordal graphs.", "805" ], [ "Moving from $S_i$ to $S_{i + 1}$ you should either include or exclude one of elements 1 and 2. Therefore since $S_1 = S_n$ there should be an even number of “moves” for 1 and an even number of “moves” for 2. This immediately implies that there is no such sequence for odd $n - 1$, i. e. for even $n$. Selecting arbitrary set of even size of moves for 1 can be done in $\\frac{2^{n - 1} + [n = 1]}{2}$ ways. Each such way gives a sequence for a fixed $S_1$. Also there are $4$ ways to select $S_1$. So the total answer is\r\n$$[n\\text{ is odd}]\\cdot 4 \\cdot \\frac{2^{n - 1} + [n = 1]}{2} = [n\\text{ is odd}] \\cdot (2^n + 2[n = 1]),$$\r\nwhere $[P]$ is 1 if $P$ is true and 0 otherwise.", "699" ], [ "Firstly note that $\\binom{k}{a}\\binom{b}{k} = \\binom{b}{a}\\binom{b - a}{k - a}$ for $k \\ge a$. This is almost all. Also we need to see that $\\binom{b}{k} = 0$ for all $k > b$ and $\\binom{k}{a} = 0$ for all $k < a$, therefore\r\n$$\\sum_{k = 0}^t \\binom{k}{a}\\binom{b}{k}y^{b - k}x^{k - a} = \\binom{b}{a}y^{b - a} \\sum_{k = a}^b \\binom{b - a}{k - a} y^{a - k}x^{k - a} \\\\\r\n= \\binom{b}{a}y^{b - a} \\sum_{\\ell = 0}^{b - a} \\binom{b - a}{\\ell} y^{-\\ell}x^{\\ell} = \\binom{b}{a}y^{b - a} \\left(1 + \\frac{x}{y}\\right)^{b - a} = \\binom{b}{a}(y + x)^{b - a}$$\r\nfor all $b \\ge a$.\r\n\r\nIf $b < a$ then all summands on the LHS are $0$ because either $k < a$ or $k > b$ for all $k$ and RSH is also $0$.", "757" ], [ "The PIC can operate with the lower voltage. The only thing I am unsure of is if your seven segment LEDs will have enough forward bias voltage to operate at the lower voltage. For some segment displays 3V isn&#39;t enough. My suggestion is (if you can&#39;t find the required forward bias voltage) try it and if it doesn&#39;t work add another AA battery in series to get 4.5V.", "1020" ], [ "I want to be able to move the windmill I am designing out of the wind when the power output is to much (high wind scenario). To do this I need to measure the output of the power. To set everything up I need to be able to select my equipment for max current/voltage/power/etc. The generator I am planning to use for now is [this generator][1]. The max output from the graph seems to be about 800V DC rectified. At max RPM however the max OC DC rectified voltage is about 675V. Some calculations later I figure about 500VAC LL output @ 675V DC rectified. This is assuming a balanced load and current flow but there is none at the open-circuit point. I am assuming the voltage will be lower under load. **Being under load all the time (diversion unit in place) will allow me to \" ;safely \" ; use equipment rated for typical 3-phase AC voltage of 480V?** \r\n\r\nAlso for testing and maintenance since this is a prototype I wanted a shut off switch to be able to work on the control section. I am thinking the best way is to have a 3 phase 480V knife switch (lock out tag out method) in series between the diverting modular and the control modular. Any other suggestions?\r\n\r\n\r\n [1]: _URL_0_", "803" ], [ "This doesn&#39;t answer my question but it gets me to my final solution. I initially thought of using the RPM but figured the output power would be more useful for monitoring so that was stuck in my head and never thought of RPMs again. Now that I have it all laid out, I can see there will be more parts and cost using the output power then I wanted. Since the system is open ended in that it could be used to use/store power locally or connect to the grid the power can be calculated later on. I will probably calculate the power/RPM to calibrate the system once working. Thank you.", "851" ], [ "No, it can&#39;t have a closed-form for the following reason. It is [known](_URL_0_) that even sum $\\sum_{k = 0}^K \\binom{N}{k}$ has no closed form. Without loss of generality we can assume that $K \\le \\frac{N}{2}$. Then\r\n\r\n$$\\sum_{k = 0}^K \\binom{N}{k} = (K \\bmod 2)\\binom{N}{K} + \\sum_{k = 0}^{2\\left\\lfloor\\frac{K}{2}\\right\\rfloor}\\binom{N}{k} = (K \\bmod 2)\\binom{N}{K} + \\sum_{k = 0}^{2m}\\binom{2m + n - 1}{k}\\\\\r\n= (K \\bmod 2)\\binom{N}{K} + \\sum_{\\ell = 0}^{2m}\\binom{2m + n - 1}{2m - \\ell}1^{\\ell}$$\r\n\r\nfor $m = \\left\\lfloor\\frac{K}{2}\\right\\rfloor$, $n = N - 2m + 1 > \\frac{N}{2} \\ge 2m \\ge m$ and $\\ell = 2m - k$. So if your sum had a closed form then $\\sum_{k = 0}^K \\binom{N}{k}$ would have too. This contradiction shows that your sum has no closed form.", "757" ], [ "The Hamiltonian Cycle Problem can be polynomially reduced to the Restricted Spanning Tree Problem with an additional condition on vertex degrees in the following way.\r\n\r\nTo solve HCP for graph $G$ one can take each edge $e \\in E(G)$, remove this edge, build in graph $G - e$ a spanning tree of maximum degree $k = 2$. If for some edge $e$ there is such tree, that is a Hamiltonian path $P$, then combining $P$ with $e$ we get a Hamiltonian cycle. If for each $e$ there is no such spanning tree in $G - e$ then graph $G$ is not Hamiltonian.", "805" ], [ "It is hard, almost impossible to hit any certain point when you are modelling absolutely continuous random variable $\\xi$. I mean that probability of such event is zero. Even more, probability is zero to get into any set of zero measure. More specific if $f(\\cdot)$ is the probability density function, $\\lambda(\\cdot)$ is the measure and $S$ is a set of zero measure $\\lambda(S) = 0$ then\r\n$$\\mathrm{P}\\{\\xi \\in S\\} = \\int_{S} f(x) \\,\\mathrm{d}x \\le \\sup_{x \\in \\mathbb{R}} f(x) \\cdot \\lambda(S) = 0.$$\r\n\r\nYou can compute the probability of being close to the mean value for a normally distributed random variable $\\eta \\sim \\mathcal{N}(\\mu, \\sigma^2)$:\r\n$$\\mathrm{P}\\{|\\eta - \\mathbb{E}\\eta| \\le \\varepsilon\\} = \\mathrm{erf}\\left(\\frac{\\mu + \\varepsilon - \\mu}{\\sigma\\sqrt2}\\right) - \\mathrm{erf}\\left(\\frac{\\mu - \\varepsilon - \\mu}{\\sigma\\sqrt2}\\right) = 2\\mathrm{erf}\\left(\\frac{\\varepsilon}{\\sigma\\sqrt2}\\right)$$\r\nfor any $\\varepsilon > 0$, where $\\mathrm{erf}(\\cdot)$ is the [error function](_URL_0_). Note that $\\mathrm{erf}(0) = 0$.", "913" ] ]
290
[ 12101, 12014, 16524, 11401, 18359, 11202, 1364, 5197, 1401, 1634, 8278, 39, 11699, 18309, 12633, 13816, 18723, 12798, 7379, 1679, 5418, 7586, 2440, 5002, 19057, 16677, 3412, 15686, 6376, 5610, 6485, 14784, 2650, 18964, 1129, 9155, 8562, 8057, 6701, 11367, 13403, 5278, 12974, 2809, 11741, 9653, 4863, 10431, 17162, 3769, 1889, 8618, 3552, 3445, 2605, 1547, 7903, 11681, 4985, 16606, 3303, 16918, 8549, 482, 10172, 7566, 8703, 4767, 19326, 68, 462, 2983, 14831, 13334, 13231, 17738, 10219, 4177, 1722, 8367, 5371, 18853, 4119, 14349, 16357, 19117, 6562, 6108, 869, 8430, 17563, 12987, 8593, 18479, 8791, 19563, 10699, 17256, 9283, 7912, 13519, 14971, 12150, 7029, 9166, 2151, 1273, 4148, 1983, 8487, 13372, 7750, 12208, 13157, 3034, 12137, 4605, 12957, 5592, 2387, 11587, 15622, 5651, 9677, 5657, 8473, 4509, 8019, 13562, 18308, 3807, 8667, 15603, 5579, 776, 19141, 3843, 18624, 18389, 18620, 6992, 3765, 3173, 16980, 4582, 8769, 4816, 12415, 3467, 14557, 16015, 4312, 8701, 2851, 6418, 3739, 4616, 407, 2749, 3142, 10663, 18577, 7482, 8594, 9102, 144, 932, 2776, 11785, 12332, 5390, 18935, 15961, 14943, 18428, 12050, 1053, 8064, 8966, 16751, 8273, 7432, 7873, 19300, 1805, 4044, 115, 15837, 4321, 11985, 10502, 12129, 12368, 5257, 8865, 15556, 8434, 2150, 7491, 12379, 19571, 5012, 10218, 2050, 8245, 18036, 18789, 17502, 11249, 7761, 3060, 8658, 357, 5540, 10358, 9135, 12209, 17940, 14125, 17192, 11615, 19099, 3855, 16659, 883, 4651, 8636, 7550, 2885, 3191, 13103, 18398, 7791, 18982, 10121, 8112, 704, 7577, 11979, 7367, 4054, 2079, 1806, 8058, 8939, 2975, 9243, 4364, 825, 1509, 17087, 17044, 12696, 7843, 19060, 13194, 14657, 2566, 8361, 1340, 7113, 11326, 6265, 9885, 4479, 5510, 18272, 8873, 19200, 16041, 15549, 8644, 17757, 14055, 3388, 8059, 14661, 3460, 4132, 12182, 16510, 4162, 3099, 7811, 4110, 11010, 5892, 6787, 4371, 19036, 12328, 6575, 5376, 15175, 3902, 11784, 7822, 5862, 6996, 1675, 14669, 2991, 17429, 9548, 2373, 802, 4076, 2587, 8107, 6644, 6425, 2269, 15182, 4053, 11962, 16955, 15264, 10290, 8360, 3841, 18418, 8185, 15780, 4343, 7123, 6355, 13615, 1855, 13598, 19421, 10865, 3923, 334, 773, 3684, 10339, 2203, 10861, 14076, 3589, 7102, 2704, 18961, 3447, 12296, 17507, 19604, 9697, 8526, 19049, 8546, 1774, 1437, 16317, 7109, 4766, 8488, 10794, 13768, 8397, 7229, 15861, 8514, 11943, 3986, 16150, 6647, 17364, 10496, 7576, 10363, 4399, 19487, 17271, 681, 8431, 3558, 16740, 11284, 18878, 8290, 8425, 19517, 4062, 2808, 6654, 8489, 15400, 2878, 9016, 8889, 4513, 12766, 4570, 712, 3632, 8714, 6841, 19709, 17028, 6393, 2074, 16330, 13929, 7492, 18379, 19772, 14128, 3833, 12372, 8246, 13511, 7712, 7520, 7939, 19616, 1131, 15827, 18540, 663, 2973, 390, 3889, 8597, 18500, 5249, 3884, 1101, 16420, 3643, 6835, 18995, 7722, 5822, 7579, 12140, 8200, 10623, 18943, 18804, 2179, 1193, 12528, 16505, 10707, 8852, 12037, 10688, 7952, 8790, 1580, 475, 12213, 19512, 11913, 5622, 18296, 763, 16116, 5805, 8016, 19532, 1177, 2308, 5899, 16922, 10530, 8481, 16729, 6288, 3659, 12015, 297, 11971, 9856, 9238, 17019, 2518, 7926, 6672, 4043, 13967, 3931, 9268, 8274, 936, 3205, 18463, 4301, 10186, 1462, 3567, 16585, 15743, 13861, 12993, 4917, 19001, 2258 ]
STX_1003632.0
[ [ "Experimenting with Swift3, Alamofire and AlamofireImage. I am trying to display some Instagram images in a tableview. I have a `data.json` file of **Places** retrieved using Alamofire which look like this:\r\n\r\n {\r\n \" ;places \" ; : [\r\n { \" ;name \" ; : \" ;place1 \" ;, \" ;url \" ; : \" ;_URL_4_; },\r\n { \" ;name \" ; : \" ;place2 \" ;, \" ;url \" ; : \" ;_URL_3_; },\r\n { \" ;name \" ; : \" ;place3 \" ;, \" ;url \" ; : \" ;_URL_0_; },\r\n ]\r\n }\r\n\r\nI have setup `PlaceTableViewCell` with a `UIImageView` and attached it to an outlet in the corresponding controller.\r\n\r\nI also have a `PlaceTableViewController` which includes:\r\n\r\n var places = [Place]() //empty array to store places\r\n\r\n\r\nIn `viewDidLoad()` method I call a private function:\r\n\r\n loadJson()\r\n\r\nand the function looks like this:\r\n\r\n private func loadJson() {\r\n Alamofire.request( \" ;_URL_2_;).responseJSON { response in\r\n if let JSON = response.result.value as? [String : Any],\r\n let places = JSON[ \" ;places \" ;] as? [[String : String]] {\r\n for place in places {\r\n //should I call loadImage() function here?\r\n }\r\n }\r\n }\r\n }\r\n\r\nI also have a model for each place in the JSON file:\r\n\r\n import UIKit\r\n \r\n class Place {\r\n \r\n var name: String\r\n var url: String\r\n \r\n init?(name: String, url: String) {\r\n _URL_1_ = name\r\n self.url = url \r\n }\r\n \r\n }\r\n\r\n**QUESTION**\r\n\r\nI&#39;m not sure where to go from here. I would like to use AlamofireImage (which I have included in my project) to download each image but can I do this in a loop of some sort? I would also like to show each image in a new table row. Any advice and code examples would be much appreciated.", "8" ], [ "I have managed to get some code working where Instagram pictures are fetched (via Alamofire) when a table row comes into view. However, once fetched, I don&#39;t want another call being made when the table row comes into view again. How can I avoid this behaviour?\r\n\r\n override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {\r\n \r\n let url = places[indexPath.row].url\r\n if let c = cell as? PlaceTableViewCell {\r\n print( \" ;Downloading Image \" ;)\r\n Alamofire.request(url, method: .get).responseImage { response in\r\n guard let image = response.result.value else {\r\n print( \" ;Error downloading image \" ;)\r\n return\r\n }\r\n c.photoImageView.image = image\r\n }\r\n \r\n }\r\n }", "870" ], [ "I&#39;m just learning how tab bar controllers and nav controllers work together. I have the following storyboard but I&#39;ve also experimented with nav controllers too but can&#39;t seem to make things work how I want:\r\n\r\n[![enter image description here][1]][1]\r\n\r\nI have added a segue between the table cell and the \" ;detail view \" ; view controller. However, the transition isn&#39;t what I want as it slides up from the bottom. I would like it to slide from right to left. I select \" ;push \" ; but it still slides from the bottom.\r\n\r\nIn addition, I would like the table view to have the tab bar (which it does) but I don&#39;t want the \" ;detail view \" ; to have a tab bar (or nav bar and status bar).\r\n\r\n\r\n [1]: _URL_0_", "735" ], [ "I have three labels in my view:\r\n\r\n[![enter image description here][1]][1]\r\n\r\nThe first label is a description and as the text will be fetched from an API it varies in length.\r\n\r\n**First question** is how do I make the description label auto-adjust its height?\r\n\r\n**Second question** is how do I make label 1 move relative to the height of description label and also label 2 relative to label 1.\r\n\r\n [1]: _URL_0_", "57" ], [ "Getting started with React and Redux and I have a method in my class to create new lines in a piece of text:\r\n\r\n class JobPage extends React.Component {\r\n\r\n componentWillMount() {\r\n this.props.dispatch(fetchJob(this.props.match.params.slug))\r\n }\r\n\r\n getMultiLineText(text) {\r\n text.split(&#39;\\n&#39;).map((item, key) = > {\r\n return < span key={key} > {item} < br/ > < /span > \r\n })\r\n }\r\n\r\n render() {\r\n\r\n const { job } = this.props;\r\n\r\n return(\r\n {this.getMultiLineText(job.desc)}\r\n )\r\n }\r\n\r\n \r\n }\r\n\r\nWithin my `render()` method I try and call it using the following but the param is not passed. It&#39;s `null`:\r\n\r\n {this.getMultiLineText(job.desc)}\r\n\r\nIf I just do...\r\n\r\n {job.desc}\r\n\r\nit prints the description.", "530" ], [ "Trying to clean my React app up a little with Container and Presentation components. I&#39;m using **react-router v4** and I previously used an onClick event for each `job` to show a specific job page:\r\n\r\n < div onClick={() = > this.props.history.push(&#39;/jobs/&#39; + job.slug)} > \r\n //The job info\r\n < /div > \r\n\r\nNow I&#39;ve created a dumb component in a separate file for the jobs like this:\r\n\r\n const Jobs = (props) = > (\r\n < div > \r\n {\r\n _URL_0_.map(job = > \r\n < div key={job.slug} onClick(//todo) > \r\n < p > {job.title} at < Link to= \" ;/ \" ; > {job.company} < /Link > < /p > \r\n < /div > \r\n )\r\n }\r\n < /div > \r\n )\r\n\r\nbut I can no longer access `this.props.history`\r\n\r\nHow can I solve this issue? Should I pass another prop in the following:\r\n\r\n < Jobs jobs={jobs}/ >", "530" ], [ "Still getting to grips with React and ES6. I have the following functional presentation component which works fine:\r\n\r\n const Jobs = (props) = > (\r\n < section id= \" ;jobs \" ; > \r\n < div > \r\n {\r\n _URL_0_.map(job = > \r\n < div className= \" ;job \" ; key={job.slug} > \r\n < p > < strong > {job.title} at < Link to={ \" ;/jobs/ \" ; + job.slug} > {job.company} < /Link > < /strong > < /p > \r\n < p > {job.intro} < /p > \r\n < /div > \r\n )\r\n }\r\n < /div > \r\n < /section > \r\n )\r\n\r\nHowever, when I try to add some extra JS between the brackets as shown below I get errors about unexpected token.\r\n\r\n const Jobs = (props) = > (\r\n < section id= \" ;jobs \" ; > \r\n < div > \r\n {\r\n console.log( \" ;THIS DOESN&#39;T WORK \" ;)\r\n _URL_0_.map(job = > \r\n < div className= \" ;job \" ; key={job.slug} > \r\n < p > < strong > {job.title} at < Link to={ \" ;/jobs/ \" ; + job.slug} > {job.company} < /Link > < /strong > < /p > \r\n < p > {job.intro} < /p > \r\n < /div > \r\n )\r\n }\r\n < /div > \r\n < /section > \r\n )\r\n\r\nCould someone explain why this doesn&#39;t work.", "530" ], [ "Trying to create a React app without using `create-react-app` so that I can learn a bit more and know what&#39;s going on in the background.\r\n\r\nI&#39;m trying to get webpack to work but getting this error that appears to be linked to `redux-form` when running `webpack` command.\r\n\r\n\r\n[![enter image description here][1]][1]\r\n\r\nI&#39;ve just [copied code][2] from their site so not sure what the issue is?\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "530" ], [ "I have this code that returns a component:\r\n\r\n const Test = ({places}) = > (\r\n < div > \r\n {places.map(place = > (\r\n < div className= \" ;location \" ; key={place.slug} > \r\n < div className= \" ;photo \" ; style={ { backgroundImage: \" ;url( \" ; + place.src + \" ;) \" ; } } > < /div > \r\n < h2 > {_URL_0_} < /h2 > \r\n < /div > \r\n ))}\r\n < /div > \r\n );\r\n\r\nbut I&#39;m getting confused between `(` and `{` brackets. I&#39;m actually trying to get rid of the outer ` < div > ` tags but it doesn&#39;t seem to work when I use:\r\n\r\n const Test = ({places}) = > (\r\n {places.map(place = > (\r\n < div className= \" ;location \" ; key={place.slug} > \r\n < div className= \" ;photo \" ; style={ { backgroundImage: \" ;url( \" ; + place.src + \" ;) \" ; } } > < /div > \r\n < h2 > {_URL_0_} < /h2 > \r\n < /div > \r\n ))}\r\n );", "231" ], [ "I am using `create-react-app` and I am trying to work out an \" ;efficient \" ; way to apply stylesheets to specific pages.\r\n\r\nMy `src` folder structure looks something like this:\r\n\r\n | pages\r\n | - About\r\n | - - index.js\r\n | - - styles.css\r\n | - Home\r\n | - - index.js\r\n | - - styles.css\r\n | index.js\r\n | index.css\r\n\r\n\r\n\r\nIn each of the `index.js` files I use `import &#39;./style.css&#39;`\r\n\r\nHowever, I&#39;m finding that when I navigate from one page to the next the styles from the starting page are being applied to the target page as if they&#39;re being cached and the styles from the target page are not being followed. \r\n\r\nI just wondered if I&#39;m misunderstanding how to apply styles in React to specific pages. Should I be making entirely self contained components which incude the styles too?\r\n\r\nI am considering applying them inline but I realise there are limitation when using JS styles.", "811" ], [ "I&#39;m able to find the number of followers for a particular user but I wondered how best to go about finding the number of followers each follower has. I could of course loop through each follower and then total up the follower count but this will be \" ;expensive \" ; and start pushing me towards the API rate limiting.\r\n\r\nDoes anyone know of a better way to approach something like this?", "215" ], [ "I&#39;m using Redux to fetch data from my back end. I fetch the data from my smart component using:\r\n\r\n componentWillMount() {\r\n this.props.dispatch(fetchPlaces())\r\n }\r\n\r\nand my action:\r\n\r\n export function fetchPlaces() {\r\n return function(dispatch) {\r\n dispatch({type: \" ;FETCH_PLACES \" ;});\r\n let path = \" ;/server/places \" ;\r\n \r\n axios.get(path)\r\n .then((response) = > {\r\n dispatch({type: \" ;FETCH_PLACES_FULFILLED \" ;, payload: response.data})\r\n })\r\n .catch((err) = > {\r\n dispatch({type: \" ;FETCH_PLACES_REJECTED \" ;, payload: err})\r\n })\r\n }\r\n }\r\n\r\nand my reducer:\r\n\r\n const reducer = (state={\r\n places: [],\r\n isFetching: false,\r\n error: null\r\n }, action) = > {\r\n switch(action.type) {\r\n case \" ;FETCH_PLACES \" ; : {\r\n return { ...state, isFetching: true }\r\n }\r\n case \" ;FETCH_PLACES_REJECTED \" ; : {\r\n return { ...state, isFetching: false, error: action.payload }\r\n }\r\n case \" ;FETCH_PLACES_FULFILLED \" ; : {\r\n return { ...state, isFetching: false, places: action.payload }\r\n }\r\n default:\r\n return state\r\n }\r\n }\r\n\r\n\r\nEach place has a property called `good_for` and this is an array of strings.\r\n\r\nI would now like to be able to filter the places via a tag (passed via a query string which is already in place) but I need to be able to do this straight after the places have been retrieved from the database.\r\n\r\nHow can I integrate this in the \" ;Redux way \" ;?", "530" ], [ "I am confused about the order of lifecycle stages in my React app. I have the following class:\r\n\r\n constructor(props) {\r\n super(props);\r\n\r\n this.state = {\r\n skip: 0\r\n }\r\n\r\n }\r\n\r\n fetchMoreArticles() {\r\n this.props.dispatch(fetchArticles(this.state.skip))\r\n this.setState({skip: (this.state.skip + 5)})\r\n console.log(this.state.skip); //This outputs 0 on page refresh???\r\n }\r\n\r\n componentDidMount() {\r\n this.fetchMoreArticles()\r\n }\r\n\r\nWhen I write to the console (see `fetchMoreArticles()`) I would expect the output to be 5 but it&#39;s 0. Could someone explain why?\r\n\r\n**Note:** `fetchArticles()` is an ajax call using Redux", "530" ], [ "I have two routes (react-router v4):\r\n\r\n < Route exact path=&#39;/&#39; component={HomePage}/ > \r\n < Route exact path=&#39;/tag/:tag&#39; component={HomePage}/ > \r\n\r\nwhere the top route shows a list of places and the second route shows a list of places that contain a specific tag. I wanted to set things up like this to reuse the `HomePage` component.\r\n\r\nHowever, if I&#39;m viewing places with a tag and then click on a link ` < Link to= \" ;/ \" ; > Homepage < /Link > ` then it doesn&#39;t reload all places (Axios/Redux) because (I assume) the Homepage component is already in use.\r\n\r\nShould I force a reload in some way, make a second component that&#39;s very similar to `HomePage` and duplicate code or is there an even better way?", "357" ], [ "I&#39;m building my React/Node app on Heroku by running `webpack -p` with `heroku-postbuild`.\r\n\r\nI have a build folder which webpack adds the `bundle.js` to and the whole app is served using Express with:\r\n\r\n //Serve React App\r\n app.use(express.static(__dirname + &#39;/build&#39;));\r\n app.get(&#39;*&#39;, function(req, res) {\r\n res.sendFile( __dirname + \" ;/build/ \" ; + \" ;index.html \" ; );\r\n });\r\n\r\nHowever, I&#39;m not sure where to place my `index.html`? Typically, I&#39;ve always kept it inside the build folder but I&#39;m having to re-think this approach as I don&#39;t wan&#39;t to include the build folder in version control.\r\n\r\nAny suggestions?", "194" ], [ "When users navigate to `/places/:slug` in my React/Redux app, an ajax call is triggered to get the relavant place data from the database.\r\n\r\nWhile this all works as expected I&#39;m not sure how to show a 404 if no place was found. I have a 404 route setup for when users navigate to a non-route but how can I trigger a 404 using Redux?\r\n\r\nIn my container component I have:\r\n\r\n this.props.dispatch(fetchPlace(this.props.match.params.slug))\r\n\r\nand my action: \r\n\r\n import axios from \" ;axios \" ;;\r\n \r\n export function fetchPlace(slug) {\r\n return function(dispatch) {\r\n dispatch({type: \" ;FETCH_PLACE \" ;});\r\n axios.get( \" ;/server/places/ \" ; + slug)\r\n .then((response) = > {\r\n dispatch({type: \" ;FETCH_PLACE_FULFILLED \" ;, payload: response.data})\r\n })\r\n .catch((err) = > {\r\n dispatch({type: \" ;FETCH_PLACE_REJECTED \" ;, payload: err})\r\n })\r\n }\r\n }\r\n\r\nand my reducer:\r\n\r\n const reducer = (state={\r\n place: {},\r\n isFetching: false,\r\n error: null\r\n }, action) = > {\r\n switch(action.type) {\r\n case \" ;FETCH_PLACE \" ; : {\r\n return { ...state, isFetching: true }\r\n }\r\n case \" ;FETCH_PLACE_REJECTED \" ; : {\r\n return { ...state, isFetching: false, error: action.payload }\r\n }\r\n case \" ;FETCH_PLACE_FULFILLED \" ; : {\r\n return { ...state, isFetching: false, place: action.payload }\r\n }\r\n default:\r\n return state\r\n }\r\n }\r\n \r\n export default reducer\r\n\r\n**Ideas**\r\n\r\nI could use another state property in my reducer called `notFound` and initialize it to `false`. Then read the response data payload and detect whether a job has been returned. If not then set `notFound` to `true`. But how do I listen for notFound to be true and trigger a 404?", "530" ], [ "I have a div `hero` that sits at the top of the homepage. It is the full height of the viewport and there are other divs below. I have the following code to create the effect of faster scrolling over the first div due to it&#39;s size:\r\n\r\n $(document).scroll(function(){\r\n var h = $(&#39;#hero&#39;).height()\r\n $(&#39;#hero&#39;).height(h - 200);\r\n });\r\n\r\nbut as I&#39;ve changed the height of the div I&#39;m not sure how to change the div back to it&#39;s original height when the user scrolls back to the top.", "882" ], [ "Just messing around with Github API and oauth. I have got to the point where I receive the `access_token` back from GH.\r\n\r\nI have so far:\r\n\r\n url := \" ;_URL_0_;\r\n\r\n params := map[string]string{ \" ;client_id \" ;: client_id, \" ;client_secret \" ;: client_secret, \" ;code \" ;: code}\r\n data, _ := json.Marshal(params)\r\n resp, _ := _URL_1_(url, \" ;application/json \" ;, bytes.NewBuffer(data))\r\n\r\n defer resp.Body.Close()\r\n \r\n body, _ := ioutil.ReadAll(resp.Body)\r\n\r\nbut I would now like to access the response parts. According to the GH docs, they are in the form \r\n`access_token=e72e16c7e42f292c6912e7710c838347ae178b4a & scope=user%2Cgist & token_type=bearer`\r\n\r\nDo I need to parse the string or is there a \" ;better \" ; way?", "178" ], [ "Using a high level language, is it the job of the interpreter/compiler to convert mathematical expressions from infix notation into postfix or prefix before execution. In fact, do infix expressions need to be converted at all for them to be \" ;processed \" ;? I&#39;m trying to understand what is going on \" ;behind the scences \" ; a little. I&#39;m fine however with the concept of the stack and its use with RPN.", "252" ], [ "I assume that to halve an integer such as 42 using assembly language (ARM 6), a logical right shift can be used to produce 21 but could someone explain how 21 could then be halved to give me 10.5? I&#39;m not sure what goes on \" ;behind the scenes \" ; to handle the fractional value.\r\n\r\n**Update**\r\n\r\nI guess the real question is: **is the LSR intended for division or just to shift bits to the right? If it is the latter then what is the application of Logical Shifts?**", "671" ], [ "I have the following date filter:\r\n\r\n {{(selectedUser.created_at * 1000) | date: \" ;d-MMM yyyy \" ;}}\r\n\r\nI don&#39;t show the date until I click on a user.\r\n\r\nI&#39;m having to multiply the `selectedUser.created_at` timestamp to convert to milliseconds but this then gives me an error: **NaN-undefined 0NaN** before I&#39;ve even clicked on a user.\r\n\r\nWithout the multiplication i don&#39;t get the error but of course the date is wrong.\r\n\r\nWhat&#39;s a good way around this?", "49" ], [ "I would like to upgrade my Angular app from version 1.3 to 1.4 but I&#39;m worried I might make a hash of it. Therefore, I wanted to ask this question first.\r\n\r\nHere is my `bower.json` file:\r\n\r\n {\r\n \" ;name \" ;: \" ;my app \" ;,\r\n \" ;version \" ;: \" ;0.0.1 \" ;,\r\n \" ;dependencies \" ;: {\r\n \" ;angular \" ;: \" ;~1.3.x \" ;,\r\n \" ;angular-animate \" ;: \" ;~1.3.x \" ;,\r\n \" ;angular-resource \" ;: \" ;~1.3.x \" ;,\r\n \" ;angular-sanitize \" ;: \" ;~1.3.x \" ;,\r\n \" ;angular-ui-router \" ;: \" ;~0.2.15 \" ;,\r\n \" ;jquery \" ;: \" ;~2.1.1 \" ;,\r\n \" ;semantic-ui \" ;: \" ;~2.0.0 \" ;,\r\n \" ;angular-elastic-input \" ;: \" ;~2.0.1 \" ;,\r\n \" ;angular-sweetalert \" ;: \" ;~1.0.4 \" ;,\r\n \" ;angular-marked \" ;: \" ;~0.0.14 \" ;,\r\n \" ;angular-highlightjs \" ;: \" ;~0.4.1 \" ;,\r\n \" ;angular-nanoscroller \" ;: \" ;~0.2.1 \" ;,\r\n \" ;angular-gravatar \" ;: \" ;~0.4.1 \" ;,\r\n \" ;angular-cookies \" ;: \" ;~1.4.8 \" ; //this needs updated version of Angular\r\n },\r\n \" ;resolutions \" ;: {\r\n \" ;angular \" ;: \" ;~1.3.x \" ;\r\n }\r\n }\r\n\r\nIs it simple a case of changing the angular setting to `~1.4.x` and running `bower update` or is there anything else I need to be aware of?", "7" ], [ "I have a `user.save` route (below) in my Golang API that can be used to `create` and `update` a user depending on whether an `id` was provided in the request object. The route uses the `auth` middleware which other routes do too.\r\n\r\n _URL_0_( \" ;/user.save \" ;, auth(), user.Save())\r\n _URL_0_( \" ;/user.somethingElse \" ;, auth(), user.SomethingElse())\r\n\r\nHere is my middleware:\r\n\r\n func auth() gin.HandlerFunc {\r\n return func(c *gin.Context) {\r\n //I would like to know here if user.save was the route called\r\n //do authy stuff\r\n }\r\n }\r\n\r\nI&#39;m thinking that if I can detect in the `auth` middleware whether the `user.save` route was called I can then check to see if an `id` was included and decide whether to continue or return.", "623" ], [ "Looking in to making a simple Angular - Node app and of course I have come across PassportJS for auth. Looking at the website, I&#39;m finding it difficult to understand why I need it or what it does for me?\r\n\r\nMy users will login using a username and password. Why can&#39;t I just find a matching record in the db, set a session if required and return a response? Why should/would I use Passport for this?", "528" ], [ "I am learning how to use `resolve` in `ui-router`. So far I have this in my state (which is a parent state):\r\n\r\n resolve: { \r\n currentApp: function(appService) {\r\n return appService.retrieve();\r\n }\r\n }\r\n\r\nand it calls this function in my `appService`:\r\n\r\n retrieve: function() {\r\n var deferred = $q.defer();\r\n Apps.retrieve({}, function(error, result) {\r\n if (error) {\r\n deferred.reject( \" ;App could not be retrieved \" ;);\r\n } else {\r\n app = result;\r\n deferred.resolve(app);\r\n }\r\n });\r\n return deferred.promise;\r\n },\r\n\r\nThe `app` returned is on object with an `id`. Now I would like to run the following code inside the resolve but I&#39;m not sure how I access the resolved app:\r\n\r\n setId(_URL_0_);", "357" ], [ "I realize there are similar questions to this already on SO but I can&#39;t find the solution to my problem.\r\n\r\nI have the following directive which extracts a key and value for the input box that the cursor leaves (blur):\r\n\r\n .directive(&#39;updateOneField&#39;, function() {\r\n return {\r\n restrict: &#39;A&#39;,\r\n scope: [],\r\n link: function(scope, element, attr) {\r\n \r\n element.bind(&#39;blur&#39;, function() {\r\n var key = attr.ngModel.split(&#39;.&#39;);\r\n key = key[key.length - 1];\r\n \r\n // Get the input value\r\n var value = element[0].value;\r\n \r\n \r\n });\r\n }\r\n };\r\n });\r\n\r\nThis will potentially be used across multiple controllers so my question is how do I access the `key` and `value` values from any controller?", "142" ], [ "I am trying to show a ` < div > ` called settings when I click a button. It should fade in and then slide to the right. It fades in on the left side of the screen.\r\n\r\nI have so far:\r\n\r\n**The HTML**\r\n\r\n < div id= \" ;settings \" ; ng-show= \" ;settings \" ; > \r\n \r\n < /div > \r\n\r\nand the link to call the `showSettings() function`:\r\n \r\n < a href= \" ;# \" ; ng-click= \" ;showSettings() \" ; > < i class= \" ;icon setting \" ; > < /i > < /a > \r\n\r\n**The CSS**\r\n\r\n #settings {\r\n background:red;\r\n position:fixed;\r\n top:0;\r\n left:0;\r\n bottom:0;\r\n width:400px;\r\n }\r\n\r\n**The Controller**\r\n\r\n $scope.showSettings = function(){\r\n $timeout(function() {\r\n $scope.settings = true;\r\n }, 250); \r\n }\r\n\r\nSo I have it fading in but how do I now make it slide to the right by say `200px`?\r\n\r\nAlso, I would like to be able to click anywhere other than the ` < div > ` itself to reverse the process.", "882" ], [ "I&#39;ve been trying to get a sequence of two animations running but I&#39;m getting really annoyed as I just can&#39;t make it work! I need to fade a div in and then slide it to the right. Fade in is easy using:\r\n\r\n ._URL_1_-hide-remove {\r\n animation: 0.8s appear;\r\n display: block!important;\r\n }\r\n \r\n ._URL_0_-hide-remove-active {\r\n opacity:1;\r\n }\r\n\r\n @keyframes appear {\r\n from {\r\n opacity: 0;\r\n }\r\n to {\r\n opacity: 1;\r\n }\r\n }\r\n\r\nand \r\n\r\n < div id= \" ;settings \" ; ng-show= \" ;settingsPanel \" ; class= \" ;fadein \" ; > < /div > \r\n\r\nand\r\n\r\n $scope.showSettings = function(){\r\n $scope.settingsPanel = true;\r\n }\r\n\r\nSettings looks like this:\r\n\r\n #settings {\r\n background:#353734;\r\n position:fixed;\r\n top:0;\r\n bottom:0;\r\n left:-280px;\r\n width:500px;\r\n z-index:100;\r\n }\r\n\r\nI&#39;ve completed sliding too in a similar way but to get them to trigger one after the other is proving impossible for me. Could someone show me how to do this please?", "93" ], [ "I&#39;m experimenting with an inline-edit directive form here: _URL_0_\r\n\r\n**I would like to know how to set the cursor in the text box that gets created when I click some text to be edited.**\r\n\r\nHere is the directive with a few minor changes to the template:\r\n\r\n .directive( \" ;clickToEdit \" ;, function() {\r\n var editorTemplate = &#39; < div class= \" ;click-to-edit \" ; > &#39; +\r\n &#39; < div ng-hide= \" ;view.editorEnabled \" ; ng-click= \" ;enableEditor() \" ; > &#39; +\r\n &#39;{{value}} &#39; +\r\n &#39; < /div > &#39; +\r\n &#39; < div ng-show= \" ;view.editorEnabled \" ; > &#39; +\r\n &#39; < input ng-model= \" ;view.editableValue \" ; ng-blur= \" ;save() \" ; > &#39; +\r\n &#39; < /div > &#39; +\r\n &#39; < /div > &#39;;\r\n\r\n return {\r\n restrict: \" ;A \" ;,\r\n replace: true,\r\n template: editorTemplate,\r\n scope: {\r\n value: \" ;=clickToEdit \" ;,\r\n },\r\n controller: function($scope) {\r\n $scope.view = {\r\n editableValue: $scope.value,\r\n editorEnabled: false\r\n };\r\n\r\n $scope.enableEditor = function() {\r\n $scope.view.editorEnabled = true;\r\n $scope.view.editableValue = $scope.value;\r\n };\r\n\r\n $scope.disableEditor = function() {\r\n $scope.view.editorEnabled = false;\r\n };\r\n\r\n $scope.save = function() {\r\n $scope.value = $scope.view.editableValue;\r\n $scope.disableEditor();\r\n };\r\n }\r\n };\r\n });", "631" ], [ "I&#39;m using the following code to execute a SET and EXPIRE from my Go app.\r\n\r\n _, err = _URL_2_( \" ;SETEX \" ;, key, 3600, data)\r\n\r\nbut I&#39;ve started to get an error: **Use of closed network connection**. I use <PERSON>Redigo][1] package and RedisLabs.\r\n\r\nMy code to connect to Redis is:\r\n\r\n\t//Connect to cache (Redis)\r\n\tcache, err := connectToCache()\r\n\tif err != nil {\r\n\t\tlog.Printf( \" ;Cache connection settings are invalid \" ;)\r\n\t\tos.Exit(1)\r\n\t}\r\n\tdefer cache.Close()\r\n\r\n func connectToCache() (redis.Conn, error) {\r\n \tcache, err := redis.Dial( \" ;tcp \" ;, CACHE_URI)\r\n \tif err != nil {\r\n \t\treturn nil, err\r\n \t}\r\n \t_, err = _URL_0_( \" ;AUTH \" ;, CACHE_AUTH)\r\n \tif err != nil {\r\n \t\tcache.Close()\r\n \t\treturn nil, err\r\n \t}\r\n \treturn cache, nil\r\n }\r\n\r\n\r\n [1]: _URL_1_", "921" ], [ "I&#39;m getting an error: **undefined: req** during compilation. I understand why I&#39;m getting the error but I&#39;m not sure how to overcome it. This is my code: \r\n\r\n switch path {\r\n case \" ;user.save \" ;:\r\n var req SaveRequest\r\n case \" ;user.update \" ;: \r\n var req UpdateRequest\r\n }\r\n \r\n err := c.BindJSON( & req)\r\n if err != nil {\r\n c.JSON(http.StatusOK, gin.H{ \" ;error_code \" ;: \" ;SERVER_ERROR \" ;, \" ;message \" ;: \" ;Request is not valid JSON \" ;})\r\n return \r\n }\r\n\r\n c.Set( \" ;req \" ;, req)\r\n\r\nI&#39;m trying to parse JSON requests and then add them to the context. I reaslise that if I define my `req` variable before the `switch` statement then this should overcome the problem but I don&#39;t know what type to declare it as initially?", "824" ], [ "You just need to define the `login` state first. Order is important.\r\n\r\n $stateProvider\r\n .state(&#39;login&#39;, {\r\n url: &#39;/login&#39;,\r\n templateUrl: &#39;somewhere/login.html&#39;,\r\n controller: &#39;LoginPageCtrl&#39;\r\n },\r\n .state(&#39;userPage&#39;, {\r\n url: &#39;/:username&#39;,\r\n templateUrl: &#39;js/user-page/user-page.html&#39;,\r\n controller: &#39;UserPageCtrl&#39;\r\n },\r\n\r\n });\r\n\r\nIf a user navigates to `/login` then a matching state will be searched for. It will check your first state, then the second and so on until a matching state is found. In this case, the `login` state will match so the searching for another matching state will cease.", "193" ], [ "I have an update function and a number of input boxes. Each input has an `ng-blur` attached to it so that the update function is called whenever the cursor leaves the box.\r\n\r\n $scope.update = function(data) {\r\n console.log(data); //outputs value in the textbox\r\n //how can I output/access the key?\r\n }\r\n\r\nThe input for `name` look like this:\r\n\r\n < input type= \" ;text \" ; ng-model= \" ;_URL_0_ \" ; ng-blur= \" ;update(_URL_0_) \" ;/ > \r\n\r\n\r\nAs I need to be able to post a JSON object in the form `{ \" ;name \" ; : \" ;bob smith \" ;}` what&#39;s a good way of generating the \" ;key \" ; of the object bearing in mind that it will differ depending on the input box that&#39;s being used at the time?", "8" ] ]
20
[ 10161, 1142, 13737, 11055, 18209, 11041, 16859, 15041, 9991, 914, 17875, 2836, 16080, 9724, 19522, 2640, 11667, 4707, 16509, 3108, 6630, 15628, 15424, 10449, 1423, 11086, 10291, 574, 1740, 17164, 8588, 14656, 16634, 3952, 15427, 3958, 127, 16468, 3781, 15382, 15471, 18549, 3940, 11002, 12717, 11632, 7274, 6493, 4139, 7805, 3722, 18068, 7743, 12895, 1877, 5564, 19751, 16386, 10069, 8883, 13462, 9278, 4812, 9992, 9743, 7145, 1965, 2981, 4269, 19685, 1947, 19508, 15453, 11151, 14513, 3630, 232, 3337, 14117, 15391, 2768, 14242, 14533, 17338, 2164, 11735, 15046, 16635, 12574, 10483, 18205, 4726, 15305, 16447, 7688, 10989, 18458, 14211, 18819, 13692, 18348, 7443, 12834, 18534, 1870, 12853, 16630, 2094, 11163, 13654, 8917, 13849, 6382, 2847, 7986, 15345, 16424, 4008, 19215, 12119, 11571, 6260, 10198, 2774, 4577, 19511, 17639, 14216, 11, 16319, 16463, 11567, 12082, 18876, 2613, 29, 7717, 16899, 12594, 14169, 8951, 12370, 13800, 11411, 7678, 1314, 10638, 11786, 17784, 3858, 19174, 15014, 12054, 11542, 8973, 14666, 3405, 17582, 10833, 4034, 7301, 6255, 5985, 17638, 5946, 13808, 17450, 4631, 3768, 935, 9525, 6796, 13037, 14540, 19684, 17498, 1489, 70, 4526, 8819, 14898, 16436, 5924, 14615, 15331, 12095, 17920, 7069, 717, 9884, 18559, 11719, 14103, 8935, 639, 7271, 14056, 14954, 12639, 5427, 8337, 6185, 18239, 5455, 7127, 7661, 13009, 10275, 4178, 1793, 10894, 9954, 13255, 18275, 3096, 15685, 2061, 19606, 15161, 11660, 2331, 2594, 4334, 19372, 10680, 6047, 17815, 3129, 2557, 16180, 3775, 7478, 8764, 5487, 15936, 5520, 17327, 1031, 5891, 489, 12765, 3531, 16841, 11251, 10045, 17230, 12665, 4074, 12536, 10089, 15013, 19271, 12893, 13072, 10817, 4231, 2134, 17367, 9880, 19570, 8252, 12184, 9635, 15132, 16755, 7032, 11309, 13284, 16556, 15380, 12061, 4801, 15728, 2128, 12495, 16750, 428, 3812, 13872, 14863, 4482, 4109, 13704, 2684, 18454, 4, 1664, 14407, 1209, 6770, 8959, 9307, 1414, 10181, 2721, 13368, 11064, 5715, 266, 200, 17426, 12763, 19348, 5097, 1408, 12673, 13780, 9526, 1566, 15922, 6621, 17217, 15467, 16810, 13601, 13854, 13655, 19501, 2799, 11983, 2206, 1027, 9945, 12945, 13295, 9103, 11186, 67, 10212, 19765, 5773, 6778, 7281, 5345, 5626, 11424, 15339, 14838, 13227, 17975, 11917, 14646, 15066, 16773, 598, 2457, 4090, 14874, 19575, 15580, 13863, 4275, 6400, 15950, 13612, 15024, 16227, 15725, 3723, 11256, 1450, 10096, 3153, 5675, 4323, 1214, 1153, 5545, 13474, 17375, 17942, 13765, 6543, 12949, 9298, 8486, 13369, 14791, 616, 6855, 3664, 5101, 12466, 14081, 10668, 16844, 11935, 6702, 57, 11453, 13224, 5432, 8119, 10298, 5021, 11349, 4182, 2654, 6289, 5841, 8783, 13336, 13709, 8379, 626, 2469, 18195, 17046, 10266, 18126, 12334, 7396, 12288, 2325, 7784, 1627, 17071, 9132, 8131, 9253, 15180, 1054, 11669, 12456, 16222, 13348, 16102, 11106, 1355, 14351, 6076, 5250, 15748, 6111, 17345, 878, 18554, 8320, 6341, 7732, 18698, 3862, 8068, 11518, 4309, 16418, 15201, 9748, 9417, 7705, 3787, 7720, 16605, 982, 13690, 2498, 8259, 5497, 6569, 13079, 6904, 6565, 3604, 17328, 18023, 14042, 12215, 16949, 7033, 7437, 526, 871, 14879, 4340, 1346, 5661, 5637, 4823, 13660, 13201, 6991, 4330, 19289, 12937, 8151, 3936, 16525, 11205, 8098, 8317, 3721, 15928, 13681, 12710, 18103, 5495, 8050, 11263, 12794 ]
STX_100371.0
[ [ "I have a project that I want to use [this package][1] in my app. I googled and follow the instructions:\r\n\r\n //in Terminal\r\n \r\n ? mkdir SGLMath\r\n ? cd SGLMath\r\n ? swift package init --type executable\r\n\r\nThen I open the `package.swift` file and change to this:\r\n\r\n // swift-tools-version:3.1\r\n \r\n import PackageDescription\r\n \r\n let package = Package(\r\n name: \" ;SGLMath \" ;,\r\n dependencies: [\r\n .Package(url: \" ;_URL_0_;, majorVersion: 1)\r\n ]\r\n )\r\n\r\nthen `Terminal`:\r\n\r\n ? swift package fetch\r\n\r\nThen I got this error:\r\n\r\n > error: the package has an unsupported layout, unexpected source\r\n > file(s) found:\r\n > /Users/xuanxi/SGLMath/.build/checkouts/Math.git-9167533630816302265/Tests/EqualWithAccuracy.swift,\r\n > /Users/xuanxi/SGLMath/.build/checkouts/Math.git-9167533630816302265/Tests/FunctionsTests.swift,\r\n > /Users/xuanxi/SGLMath/.build/checkouts/Math.git-9167533630816302265/Tests/Matrix2x2Tests.swift,\r\n > /Users/xuanxi/SGLMath/.build/checkouts/Math.git-9167533630816302265/Tests/Matrix3x3Tests.swift,\r\n > /Users/xuanxi/SGLMath/.build/checkouts/Math.git-9167533630816302265/Tests/Matrix4x4Tests.swift,\r\n > /Users/xuanxi/SGLMath/.build/checkouts/Math.git-9167533630816302265/Tests/SwizzleTests.swift,\r\n > /Users/xuanxi/SGLMath/.build/checkouts/Math.git-9167533630816302265/Tests/Vector2Tests.swift,\r\n > /Users/xuanxi/SGLMath/.build/checkouts/Math.git-9167533630816302265/Tests/Vector4Tests.swift,\r\n > /Users/xuanxi/SGLMath/.build/checkouts/Math.git-9167533630816302265/Tests/glmMatrixTests.swift\r\n\r\n > fix: move the file(s) inside a module\r\n\r\nHow can I resolve this?\r\n\r\n2. What if I want to add this package into my existing `Xcode` project?\r\n\r\n\r\n [1]: _URL_1_", "46" ], [ "I tried to translate [this shadertoy scene][1] into `Metal Kernel`. In shadertoy code:\r\n\r\n void mainImage( out vec4 fragColor, in vec2 fragCoord )\r\n {\r\n \tvec3 dir = rayDirection(45.0, iResolution.xy, fragCoord);\r\n ...\r\n }\r\n\r\nin `OpenGL` case, we need to send `iResolution` from the `glfw` window. And `fragCoord` will be `gl_FragCoord` from `Fragment Shader`.\r\n\r\nI have this in `metal` file:\r\n\r\n kernel void compute(texture2d < float, access<IP_ADDRESS>write > output [[texture(0)]],\r\n uint2 gid [[thread_position_in_grid]]) {\r\n int width = output.get_width();\r\n int height = output.get_height();\r\n ....\r\n }\r\n\r\nSo I can get my `iResolution` from the `width` and `height`. But I am not sure how to get `gl_FragCoord`.\r\n\r\nDo `Metal_stdlib` have something equivalent to `gl_FragCoord`? Or if I have to calculate, How can I get obtain the same value?\r\n\r\n\r\n\r\n\r\n [1]: _URL_0_", "211" ], [ "I notice my `ionic 2` have this error if I use `Chrome` running on `iphone5`, `iphone6`,`ipad` or `iPad pro`:\r\n\r\n > kernel.js:281 Uncaught TypeError: Cannot read property &#39;1&#39; of null\r\n\r\nwhich apparently is coursed by this line:\r\n\r\n ...\r\n ver: (navigator.appVersion.match(&#39;Chrome/([0-9\\.]+)&#39;) || \r\n \r\n navigator.userAgent.match(&#39;Firefox/([0-9\\.]+)&#39;))[1],/// < ---[1] is the issue\r\n ...\r\n\r\nI googled and read a bit about this and it seems like it is because of the `[1]`. [this post][1] suggest to remove `[1]`. But I am not sure where the `kernel.js` is. \r\n\r\nIt is not an issue now because I only deploy to `Android`(Strangely, even in simulation there is no issue. only on all the `ios` be it simulation or device). But I think is better to resolve it so that my client will not bark at me when they decided to deploy to `ios`.\r\n\r\nHow should I resolve this?\r\n\r\n2. Where can I find the `kernel.js`? I look into `node_modules` and it is too big to search. I want to try delete it and see if it give me issue.\r\n\r\n\r\n [1]: _URL_0_", "885" ], [ "How can I use `struct` to get the buffer value? For example:\r\n\r\n struct mouseInput\r\n {\r\n float x;\r\n float y;\r\n };\r\n \r\n kernel void compute(texture2d < float, access<IP_ADDRESS>write > output [[texture(0)]],\r\n constant float & time [[buffer(0)]],\r\n constant mouseInput.x & mouseX [[buffer(1)]],/// < --mouseX from swift\r\n constant mouseInput.y & mouseY [[buffer(2)]],/// < --mouseY from swift\r\n uint2 gid [[thread_position_in_grid]]) {\r\n ...\r\n }\r\n\r\nThen I can access `mouseInput.x` and so anywhere in `Metal`. The closest is [this thread][1] however I am not sure how to translate that into my use.\r\n\r\n\r\n [1]: _URL_0_", "113" ], [ "Is it possible to change the buffer size at runtime? We allocate the buffer size during the register our `device`:\r\n\r\n device = MTLCreateSystemDefaultDevice()\r\n queue = device!.makeCommandQueue()\r\n do {\r\n let library = device!.newDefaultLibrary()!\r\n let kernel = library.makeFunction(name: \" ;compute \" ;)!\r\n cps = try device!.makeComputePipelineState(function: kernel)\r\n } catch let e {\r\n Swift.print( \" ;\\(e) \" ;)\r\n }\r\n paramBuffer = device!.makeBuffer(length: MemoryLayout < Float > .size*2, options: [])\r\n\r\nthen we update it accordingly at run time:\r\n\r\n override public func draw(_ dirtyRect: NSRect) {\r\n super.draw(dirtyRect)\r\n if let drawable = currentDrawable {\r\n let command_buffer = queue.makeCommandBuffer()\r\n let command_encoder = command_buffer.makeComputeCommandEncoder()\r\n command_encoder.setComputePipelineState(cps)\r\n command_encoder.setTexture(drawable.texture, at: 0)\r\n command_encoder.setBuffer(paramBuffer, offset: 0, at: 0)\r\n\r\nIt works for now. But what if I have a scenario that, Have particles, at different state have different counts. For example, at the beginning I have 500 particles, After a while, the particles slowly increase by 10 at a time, say 510, 520, 530, ...\r\n\r\nHow should I approach this scenario? should I redo the `queue` every time there is a changes on the particle counts?:\r\n\r\n queue = device!.makeCommandQueue()\r\n do {\r\n let library = device!.newDefaultLibrary()!\r\n let kernel = library.makeFunction(name: \" ;compute \" ;)!\r\n cps = try device!.makeComputePipelineState(function: kernel)\r\n } catch let e {\r\n Swift.print( \" ;\\(e) \" ;)\r\n }\r\n paramBuffer = device!.makeBuffer(length: MemoryLayout < Float > .size*particleCount, options: [])// < --particleCount\r\n\r\nOr any better way to do this?", "893" ], [ "**TL;DR:**\r\nI want to make `Constructive Solid Geometry` app with `Signed Distance Functions`, but not sure how to split the serial process and parallel process between `cpu` and `kernel`.\r\n\r\nI have been exploring a lot with `Signed Distance Functions` and `Ray marching` with `Metal` lately and trying to make a simple `Constructive Solid Geometry` with `Metal`. However, after many rounds of coding and reading, I cannot figure out how to achieve this.\r\n\r\nIssue:\r\nAll of the `SDF`example is kind of hardcode every calculation is done in the `kernel`. For example:\r\n\r\n float map(float3 p){\r\n \r\n float a = ball(p,1.0);\r\n float b = ball(p+float3(1.0,0.0,0.0),1.0);\r\n \r\n return min(a,b);\r\n }\r\n\r\nso you will get 2 balls sitting side by side. \r\nBut I want to add, position and rotate the ball at runtime dynamically. \r\n\r\nSolution01: \r\n\r\nAll the `map()` calculation will be done in `swift`, then pass down to `kernel` to process. But that will be slow because you will have to process the calculation for the whole screen using `cpu`, then only pass down to `kernel`, which, the best job to use `kernel`, has been robbed by `cpu`.\r\n\r\nSolution02:\r\n\r\nSend an `array` of `object` with all the attributes to `kernel`:\r\n\r\n var objects = [{size:1.0,position:float3(0.0,0.0,0.0)},\r\n {size:1.0,position:float3(1.0,0.0,0.0)}, ...]\r\n\r\nThen process it based on the attributes using `for` loop in `map()` in the `kernel`:\r\n\r\n float map(float3 p, float3 objects[]){// < -- objects[] is pseudo code for easy illustration purposes\r\n float a;\r\n for(int i = 1; i < objects.size(); i++){\r\n a = min(ball(p + objects[i].position,objects[i].size),ball(p + objects[i-1].position,objects[i-1].size));\r\n }\r\n \r\n return a;\r\n }\r\n\r\nHowever, I am not sure if is the right way of doing because the `for` loop might overwork the `kernel`.\r\n\r\nSolution03:\r\n\r\nprocess and compile `map()` in `cpu`, then send the whole functions to `kernel`, then (somehow, I am not sure how) convert the functions for all the `ray- marching` use. \r\n\r\nMy questions:\r\n\r\nWhich is the right solution to adopt? \r\n\r\nPersonally I would be grateful if I can implement **Solution03**, but I am not sure that is possible.\r\n\r\n**Solution02** is not bad too. However, when the objects get complicated, the for loop will be too long. and I am not sure how `kernel` will handle this serial process while it is best for parallel processing.\r\n\r\n**Solution01** is not bad, if I don&#39;t have to process the whole screen resolution before I send to `kernel`.\r\n\r\nOr:\r\nAny other ways that people actually use and I am not aware of?\r\n\r\n\r\n**Update01:**\r\n\r\nI just test out **Solution02** and after 3 objects, the `FPS` drop to 5, obviously is not acceptable.", "739" ], [ "I have a `struct` in my `metal` file:\r\n\r\n struct Vects\r\n {\r\n float3 position[100];\r\n };\r\n\r\nwhich will be used to hold the buffer data:\r\n\r\n kernel void compute(texture2d < float, access<IP_ADDRESS>write > output [[texture(0)]],\r\n constant float & time [[buffer(0)]],\r\n constant mouseInput & mouse [[buffer(1)]],\r\n constant Vects & vects [[buffer(2)]],// < --- Vects\r\n uint2 gid [[thread_position_in_grid]]) {\r\n ...\r\n sceneSDF(origin, vects);\r\n ...\r\n }\r\n\r\nwhich\r\n\r\n float sceneSDF(float3 cotu,Vects vects) {\r\n \r\n float a;\r\n \r\n for(int i = 1; i < 3 ; i++){\r\n \r\n float3 u = vects[i-1].position;// < -- error!\r\n float3 v = vects[i].position;// < -- error!\r\n a = min(fSphere(cotu + u,0.7),fSphere(cotu + v,0.7));\r\n \r\n }\r\n return a;\r\n }\r\n\r\nI got an error at `float3 u` and `float3 v` that\r\n\r\n > Type &#39;Vects&#39; does not provide a subscript operator\r\n\r\nHow can I resolve this?", "74" ], [ "I had play around with `Signed Distance Functions` and the frame rate is falling to 30 fps. So I just take a look at the bebugger in `Xcode`:\r\n\r\n[![enter image description here][1]][1]\r\n\r\nand just realize that all the processing is done in `cpu` and seems like `gpu` is not running at all.\r\n\r\nAlmost all of my code is inside `metal` file with compute shader. `cpu` is just to compile and launch the app. \r\n\r\nWhat could possibly be happening here? Anyway for me to test and inspect this issue?\r\n\r\nI am using `macOS` 10.12.2 and `Xcode` 8.3.2.\r\n\r\n [1]: _URL_0_", "815" ], [ "I am learning `opengl` on my mac using both `glfw` and `sfml` and meet some hurdle on the `OpenGL` version.\r\n\r\nWhen I run the code:\r\n\r\n printf ( \" ;Renderer: %s\\n \" ;, glGetString (GL_RENDERER));\r\n printf ( \" ;OpenGL version supported: %s\\n \" ;, glGetString (GL_VERSION));\r\n printf( \" ;glsl: %s\\n \" ;, glGetString(GL_SHADING_LANGUAGE_VERSION));\r\n\r\non `glfw`\r\n\r\n Renderer: Intel(R) Iris(TM) Graphics 6100\r\n OpenGL version supported: 4.1 INTEL-10.22.25\r\n glsl: 4.10\r\n\r\non `sfml`\r\n\r\n Renderer: Intel(R) Iris(TM) Graphics 6100\r\n OpenGL version supported: 2.1 INTEL-10.22.25\r\n glsl: 1.20\r\n\r\nIs it my setting on the `xcode` project or that is the default framework setting? Is there a way I can change `sfml` to work with `OpenGL` 4.1 so that I get `glsl` 4.1 too? \r\n\r\n`glfw` have this settings:\r\n\r\n glfwWindowHint (GLFW_CONTEXT_VERSION_MAJOR, 4);\r\n glfwWindowHint (GLFW_CONTEXT_VERSION_MINOR, 1);\r\n\r\n\r\nDo `sfml` have something similar?", "211" ], [ "I am new in `Vuejs` so I am sure is my code. I have this simple `app.vue` file and I want to get the data from `JSON` and then setup my menu based on the data. I do a simple test:\r\n\r\n export default {\r\n name: &#39;app&#39;,\r\n data:function(){\r\n return{\r\n menu:[]\r\n }\r\n },\r\n methods:{\r\n GetMenu:function(s){\r\n $.get({\r\n url: &#39;static/json/menu.json&#39;,\r\n success:function(res) {\r\n s = res.menu;\r\n console.log(s[0].artist);// < -- have result\r\n }\r\n })\r\n }\r\n },\r\n created:function(){\r\n this.GetMenu(this.menu);\r\n console.log(this.menu);// < -- have [__ob__:Observer]\r\n }\r\n }\r\n\r\n\r\nIf I run the code above I will get the result from `console.log(this.menu)` first, which is `[__ob__:Observer]`, then only result from `console.log(s[0].artist)`, which is what I want. I did try:\r\n\r\n setTimeout(function(){\r\n console.log(this.menu);// < -- undefined\r\n },2000);\r\n\r\nThen I get `undefined`. \r\nHow can I resolve this?\r\n\r\n**Update01**\r\n\r\nI tried:\r\n\r\n export default {\r\n name: &#39;app&#39;,\r\n data:function(){\r\n return{\r\n menu:[]\r\n }\r\n },\r\n methods:{\r\n GetMenu:function(){\r\n $.get({\r\n url: &#39;static/json/menu.json&#39;,\r\n success:function(res) {\r\n console.log(res);// < -- result\r\n return res.menu;\r\n }\r\n })\r\n }\r\n },\r\n mounted:function(){\r\n this.menu = this.GetMenu();\r\n console.log(this.menu);// < -- undefined\r\n }\r\n }\r\n\r\nBasically, I change the `GetMenu()` to `return res.menu` then do `this.menu = this.GetMenu();`. I am still getting `undefined`.", "8" ], [ "I want to use `jquery` in my web scraping with `nightmare.js`. Based on [this tutorial][1], I can just `inject` the `jquery` and copy the file to the same root folder. But somehow I still get error:\r\n\r\n > ReferenceError: $ is not defined\r\n\r\n\r\nBelow is my code:\r\n\r\n var Nightmare = require(&#39;nightmare&#39;);\r\n \r\n new Nightmare()\r\n .goto(&#39;_URL_0_;)\r\n .inject(&#39;js&#39;, &#39;jquery.min.js&#39;)\r\n .wait()\r\n .run(function(err, nightmare) {\r\n if (err) {\r\n console.log(err);\r\n };\r\n \r\n var items = [];\r\n \r\n $(&#39;.someclass&#39;).each(function(){// < -- error - $ not defined\r\n item = {};\r\n item.value = $(this).val();\r\n items.push(item);\r\n });\r\n console.log(items);\r\n });\r\n\r\n\r\n [1]: _URL_1_", "824" ], [ "I want to use `p5js` to create game then wrap it with `Cordova`. I want to create a spaceship that when I click on it, it will shoot a bullet. Below is my code:\r\n\r\n function setup() {\r\n canvas = createCanvas(window.innerWidth, window.innerHeight);\r\n spr = createSprite(width/2, height-50,\r\n 40, 40);\r\n spr.shapeColor = color(255);\r\n \r\n spr.onMousePressed = function() {\r\n console.log( \" ;mouse press \" ;);\r\n var bullet = createSprite(spr.position.x, spr.position.y - 50, 10, 40);\r\n bullets.push(bullet);\r\n }\r\n \r\n } \r\n\r\nI test it with `Google Chrome` and it works with mouse. However if I change it mobile development mode, it doesn&#39;t work anymore. I tried\r\n\r\n spr.touchStarted = function() {\r\n console.log( \" ;mouse press \" ;);\r\n var bullet = createSprite(spr.position.x, spr.position.y - 50, 10, 40);\r\n bullets.push(bullet); }\r\n\r\nI wonder if There is a way for me to do that.", "85" ], [ "I am trying to design the data model for \r\n\r\n - > Section\r\n - > Sub Section\r\n - > Main Element\r\n - > Main Element\r\n - > Sub Section\r\n - > Main Element\r\n - > Main Element\r\n - > Main Element\r\n ...\r\nThis is what I have right now:\r\n\r\n [{\r\n &#39;section&#39;: &#39;market map&#39;,\r\n &#39;subsections&#39;: [&#39;aa&#39;,&#39;bb&#39;],\r\n &#39;mainelements&#39;: \r\n [\r\n \t\t[&#39;cc&#39;,&#39;dd&#39;],\r\n \t[&#39;ee&#39;,&#39;ff&#39;],\r\n ]\r\n }];\r\nThis is what I want:\r\n\r\n - > Market Map\r\n - > aa\r\n - > cc\r\n - > dd\r\n - > bb\r\n - > ee\r\n - > ff\r\nThis is my html:\r\n\r\n < ul > \r\n < li ng-repeat= \" ;data in datas \" ; > \r\n < ul > \r\n \t\t < li ng-repeat= \" ;subsection in data.subsections \" ; > \r\n \t\t < input type= \" ;text \" ; ng-model= \" ;subsection \" ; size= \" ;30 \" ; placeholder= \" ;add subsection here \" ; > \r\n \t\t < ul > \r\n \t\t \t\t\t < li ng-repeat= \" ;mainelement in audit.mainelements \" ; > \r\n \t\t \t\t < input type= \" ;text \" ; ng-model= \" ;mainelement \" ; size= \" ;30 \" ; placeholder= \" ;add mainelement here \" ; > \r\n \t\t \t < /li > \r\n \t\t\t\t < /ul > \r\n \t\t < /li > \r\n \t\t\t < /ul > \r\n < /li > \r\n < /ul > \r\n\r\nand i get this:\r\n\r\n - > Market Map\r\n - > aa\r\n - > [cc, dd]\r\n - > bb\r\n - > [ee, ff]\r\n\r\n1. How can I get the result I wanted?\r\n2. Is there a better way to design the `json` structure for this kind of hierarchy?", "505" ], [ "I create a page that can `add`, `edit`, `delete` users. I use `php` to save the updated `object` into `json` file.\r\n\r\n $scope.save = function() {\r\n $_URL_0_(&#39;php/saveusers.php&#39;, $scope.users).then(function() {\r\n // log success\r\n console.log($scope.users);\r\n console.log( \" ;php called \" ;);\r\n });\r\n }\r\n\r\nMy problem is the `view` update is not consistent. Every time I `add`, `edit`, `delete`, the `json` will be updated. But it `html` sometimes update to new one, sometimes it doesn&#39;t. Even I refresh the page many times. The `console.log($scope.users);` shows the latest result every time. But when I refresh the page, it goes back to the old one.\r\n\r\nI believe it is the similar problem with [this post][1]. But I don&#39;t know how to **empty** or **update** local `data` variable.\r\n\r\n**Update:**\r\nThis is my [Plunker][2].\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_2_", "510" ], [ "Yes it does work locally. The problem lies after `php` update the `json`, I am not so sure of what `$scope.users` hold after then. I did tried `console.log($scope.users)` at several places it seems ok. But the moment I refresh the page it goes back to the old one, even though `json` already have different data. I strongly believe it is at the `$scope` level.", "434" ], [ "I have a `javascript` event to update `input value` dynamically\r\n\r\n var posx = event.target.querySelector(&#39;input.posx&#39;);\r\n posx.value = event.dx;\r\nWhich it works to update the `html`:\r\n\r\n < input type= \" ;text \" ; ng-model= \" ;posx \" ; size= \" ;30 \" ; placeholder= \" ;x \" ; class= \" ;post \" ; > \r\n\r\nbut somehow it did not update the `ng-model= \" ;post`. When I `console.log($scope.posx);`, I get \r\n\r\n > undefined\r\n\r\nWhat seems to be the problem here", "196" ], [ "I want to only enable my button if the textfield have input but I can&#39;t get `ng-disabled` to work:\r\n\r\n < form novalidate > \r\n < button type= \" ;submit \" ; ng-click= \" ;add(&#39;+&#39;) \" ; ng-disabled= \" ;bittext.$invalid \" ; > Done < /button > \r\n < textarea type= \" ;text \" ; ng-model= \" ;bittext \" ; size= \" ;30 \" ; placeholder= \" ;add bittext here \" ; style= \" ;width: 212px; height:100px \" ; required= \" ; \" ; > < /div > \r\n < /form > \r\n\r\nBut when I tried(without the `$invalid`)\r\n\r\n < form novalidate > \r\n < button type= \" ;submit \" ; ng-click= \" ;add(&#39;+&#39;) \" ; ng-disabled= \" ;bittext \" ; > Done < /button > < !-- no &#39;.$invalid&#39;-- > \r\n < textarea type= \" ;text \" ; ng-model= \" ;bittext \" ; size= \" ;30 \" ; placeholder= \" ;add bittext here \" ; style= \" ;width: 212px; height:100px \" ; required= \" ; \" ; > < /div > \r\n < /form > \r\nit will disable my button when I input something in the text field.", "300" ], [ "have this issue with Angular.js that I can&#39;t seem to fix.\r\nHere is my simple `html`:\r\n\r\n < html ng-app= \" ;myAngularapp \" ; > \r\n < head > \r\n < script src= \" ;_URL_0_;\r\n < script src= \" ;myangular.js \" ; > < /script > \r\n < /head > \r\n < body > \r\n \t < div ng-controller= \" ;myAngularCtrl \" ; > \r\n < form ng-submit= \" ;addingName() \" ; > \r\n \t < input type= \" ;text \" ; ng-model= \" ;myAngular.newname \" ; size= \" ;30 \" ;\r\n placeholder= \" ;add new todo here \" ; > \r\n < input class= \" ;btn-primary \" ; type= \" ;submit \" ; value= \" ;add \" ; > \r\n < /form > \r\n < /div > \r\n < /body > \r\n < /html > \r\n\r\nand `myangular.js`:\r\n\r\n angular.module( \" ;myAngularapp \" ;,[])\r\n \t.controller( \" ;myAngularCtrl \" ;, function($scope){\r\n \t\t$scope.myNames = [\r\n \t\t {name: \" ;aaa \" ;},\r\n \t\t {name: \" ;aaa \" ;},\r\n \t\t {name: \" ;aaa \" ;}\r\n \t\t];\r\n \r\n \t\t$scope.addingName = function(){\r\n \t\t\t$scope.myNames.push({name:newname});\r\n \t\t}\r\n \t});\r\n\r\nWhen I press the submit button, I got an error:\r\n\r\n > Error: Can&#39;t find variable: newname \r\n\r\nWhat seems to be the problem?", "196" ], [ "I do a website with the footer always tie to the bottom:\r\n\r\ncss:\r\n\r\n bottom: 0;\r\n\r\nIt was OK until I test it with mobile phone. It appear OK in iPhone but go off screen in Android. So I use `@media` to check the screen size:\r\n\r\n .footer {\r\n bottom:0;\r\n }\r\n @media only screen and (max-device-width: 480px) {\r\n .footer {\r\n bottom:150px;\r\n }\r\n\r\nNow It works for Android but in iPhone, The `footer` is offset from the bottom. How can I resolve this? Is there a way to detect if there it is iPhone or Android?", "317" ], [ "I want to develop a site with main page that route to several other pages. All page will have their own `app.js` file with their own `.controller` for easy code management. \r\n\r\n**pages.html**\r\n\r\n < html ng-app= \" ;myPageApp \" ; > \r\n < head > \r\n < script src= \" ;_URL_0_;\r\n < script src= \" ;_URL_1_;\r\n < script src= \" ;js/mypages.js \" ; > < /script > \r\n < /head > \r\n < body > \r\n \t < ul class= \" ;nav navbar-nav navbar-right \" ; > \r\n < li > < a href= \" ;# \" ; > < i class= \" ;fa fa-home \" ; > < /i > Home < /a > < /li > \r\n < li > < a href= \" ;#users \" ; > < i class= \" ;fa fa-comment \" ; > < /i > Users < /a > < /li > \r\n < /ul > \r\n < !-- angular templating -- > \r\n < !-- this is where content will be injected -- > \r\n < div ng-view > < /div > \r\n \r\n < /body > \r\n < /html > \r\n**mypages.js**\r\n\r\n var myPageApp = angular.module( \" ;myPageApp \" ;,[&#39;ngRoute&#39;]);\r\n\tmyPageApp.config(function($routeProvider) {\r\n $routeProvider\r\n\r\n // route for the home page\r\n .when(&#39;/&#39;, {\r\n templateUrl : &#39;pages/users.html&#39;,\r\n });\r\n });\r\n**users.html**\r\n\r\n < html > \r\n < head > \r\n < script src= \" ;_URL_0_;\r\n < script src= \" ;../js/myusers.js \" ; > < /script > \r\n < /head > \r\n < body > \r\n < div ng-app= \" ;myUsersApp \" ; > \r\n < div ng-controller= \" ;UsersCtrl \" ; > \r\n < ul class= \" ;unstyled \" ; > \r\n < li ng-repeat= \" ;user in UsersCtrl.users \" ; > \r\n < span > {{user}} < /span > \r\n < /li > \r\n < /ul > \r\n < input type= \" ;text \" ; ng-model= \" ;user \" ; placeholder= \" ;Name please \" ; > \r\n User {{user}}\r\n < /div > \r\n < /div > \r\n < /body > \r\n < /html > \r\n**myusers.js**\r\n\r\n var myUsersApp = angular.module( \" ;myUsersApp \" ;,[&#39;&#39;]);\r\n myUsersApp.controller(&#39;UsersCtrl&#39;,[ &#39;$scope&#39;, function($scope){\r\n \t$scope.users = [&#39;john&#39;,&#39;marry&#39;];\r\n \r\n \t$scope.add = function() {\r\n $scope.users.push($scope.user);\r\n $scope.user = \" ; \" ;;\r\n }\r\n \r\n }]);\r\nI can never get the `myusers.js` to work. when I `Inspect element`, It seems like `myusers.js` was not called at all. Any thoughts?", "7" ], [ "After multiple tests and more [reading][1], I figured out how it work.\r\n\r\n**pages.html**\r\n\r\n < html ng-app= \" ;myApp \" ; > \r\n < head > \r\n < script src= \" ;_URL_1_;\r\n < script src= \" ;_URL_2_;\r\n < script src= \" ;js/mypages.js \" ; > < /script > \r\n < script src= \" ;js/usersctrl.js \" ; > < /script > ...\r\nAdd all `controllers` `js` files at the landing page. The sequence of the links are important.\r\n\r\n**mypages.js**\r\n\r\n var myApp = angular.module( \" ;myApp \" ;,[&#39;ngRoute&#39;]);\r\n \tmyApp.config(function($routeProvider) {\r\n $routeProvider\r\n // route for the home page\r\n .when(&#39;/&#39;, {\r\n templateUrl : &#39;pages/users.html&#39;,\r\n controller : &#39;UsersCtrl&#39;// < --add this\r\n });\r\n });\r\nLink controller with the specific page. Example above `pages/users.html` - > `UsersCtrl`.\r\n\r\n**usersctrl.js**\r\n\r\n var app= angular.module(&#39;myApp&#39;);\r\n myApp.controller(&#39;UsersCtrl&#39;,[ &#39;$scope&#39;, function($scope){\r\n \tconsole.log( \" ;UsersCtrl \" ;);\r\n\r\n $scope.clickMe = function() {\r\n \t\tconsole.log( \" ;i m clicked! \" ;);\r\n }\r\n }]);\r\n\r\nCreate and populate functions into `controller``js` as usual.\r\n\r\n**pages/users.html**\r\n\r\n < body > \r\n < div > \r\n < button ng-click= \" ;clickMe() \" ; > Click me! < /button > \r\n < /div > \r\n < /body > \r\n\r\nNotice that in the `users.html`, no need to add in `ng-app` and `ng-controller` anymore. This is important too.\r\n\r\n [1]: _URL_0_", "196" ], [ "I have this code:\r\n\r\n < ul class= \" ;unstyled \" ; > \r\n < li class= \" ;card \" ; ng-repeat= \" ;user in users \" ; > \r\n < form ng-submit= \" ;edit() \" ; > \r\n < input type= \" ;text \" ; ng-model= \" ;editname \" ; size= \" ;30 \" ;placeholder= \" ;add name here \" ; > \r\n < input class= \" ;btn-primary \" ; type= \" ;submit \" ; value= \" ;edit \" ; > \r\n < /form > \r\n < /li > \r\n < /ul > \r\nwhich `card` class will be duplicate based on `users` array. I want to have unique `ng-model` so that when I edit one of them, it will not affect others. I believe I can use `$index`. How can I make\r\n\r\n ng-model= \" ;editname \" ;\r\ninto\r\n\r\n ng-model= \" ;editname + $index \" ;\r\n\r\nOr is there a better way to do this?", "787" ], [ "I have a nested array:\r\n\r\n $scope.audits = [{\r\n\t\tname: &#39;2015&#39;, \r\n\t\tsections:[{\r\n\t\tsection:&#39;mm&#39;,\r\n\t\tid:&#39;1&#39;,\r\n\t\t subsections: [{\r\n\t\t \tsubsection:&#39;aa&#39;,\r\n\t\t \tmainelements: [&#39;cc&#39;,&#39;dd&#39;]\r\n\t\t\t},{\r\n\t\t \tsubsection:&#39;bb&#39;,\r\n\t\t \tmainelements: [&#39;ee&#39;,&#39;ff&#39;,&#39;gg&#39;]\r\n\t\t\t}]\r\n\t\t}]\r\n\r\n\t}];\r\n\r\n\r\nI want to have a few buttons to add and delete nested elements at will. I cannot use `$index` because it is multiple layers of array. \r\n\r\nHere is my [Plunker][1]\r\n\r\n\r\n [1]: _URL_0_", "1009" ], [ "I have a `main.html` with multiple subpages:`users.html`,`usergroups.html`,... which all of them have their own app files and controllers separately: `mainapp.js`,`usersapp.js`,`usergroupsapp.js`,...\r\n\r\nAnd I use `ui-router` to route to particular sub page as needed:\r\n\r\n var myApp = angular.module( \" ;myApp \" ;,[&#39;ui.router&#39;]);\r\n \tmyApp.config(function($stateProvider, $urlRouterProvider) {\r\n \r\n $stateProvider\r\n .state(&#39;users&#39;, {\r\n url: \" ;/users \" ;,\r\n templateUrl: \" ;pages/users.html \" ;,\r\n controller : &#39;UsersCtrl&#39;\r\n })\r\n .state(&#39;usergroups&#39;, {\r\n url: \" ;/usergroups \" ;,\r\n templateUrl: \" ;pages/usergroups.html \" ;,\r\n controller : &#39;UsergroupsCtrl&#39;\r\n })\r\n\r\n ...\r\n\r\nEverything works fine until I need to use one of the module `multiselect.js`in my `usergroups.html`. When I added it directly to `UsergroupsCtrl` in `usergroupsapp.js`:\r\n\r\n var app= angular.module(&#39;myApp&#39;,[&#39;am.multiselect&#39;]);\r\n ...\r\n\r\nBut immediately I have an error:\r\n\r\n > Error: [ng:areq] Argument &#39;MainCtrl&#39; is not a function, got undefined\r\n\r\nWhich `MainCtrl` is from `main app.js`. \r\nHow can I resolve this issue?", "7" ], [ "I use `ui-router` to route to particular sub page as needed:\r\n\r\n var myApp = angular.module( \" ;myApp \" ;,[&#39;ui.router&#39;]);\r\n \tmyApp.config(function($stateProvider, $urlRouterProvider) {\r\n \r\n $stateProvider\r\n .state(&#39;usergroups&#39;, {\r\n url: \" ;/usergroups \" ;,\r\n templateUrl: \" ;pages/usergroups.html \" ;,\r\n controller : &#39;UsergroupsCtrl&#39;\r\n })\r\n .state(&#39;usergroups.create&#39;, {\r\n url: \" ;/create \" ;,\r\n templateUrl: \" ;pages/usergroups.new.html \" ;,\r\n controller : &#39;UsergroupsCtrl&#39;\r\n })\r\n\r\n ...\r\n\r\nThis is my `usergroups.html`:\r\n\r\n < body > \r\n < h3 > User Groups < /h3 > < br/ > \r\n \r\n < button class= \" ;fon-btn \" ; type= \" ;button \" ; ng-hide = \" ;toAdd \" ; ng-click= \" ;toAdd = true \" ; ui-sref= \" ;usergroups.create \" ; > Create New Group < /button > \r\n < div ui-view > < /div > \r\n < ul > \r\n < li class= \" ;bitcard padding10 \" ; ng-repeat= \" ;group in usergroups \" ; > \r\n \t < span class= \" ;padding10 \" ; > < strong > {{_URL_1_}} < /strong > < /span > \r\n < /li > \r\n < /ul > \r\n < /body > \r\n\r\nand `usergroups.new.html`:\r\n\r\n < body > \r\n < form ng-submit= \" ;add() \" ; > \r\n < input class= \" ;btn \" ; type= \" ;submit \" ; value= \" ;Add Usergroup \" ; > < br/ > < br/ > \r\n < /form > \r\n < /body > \r\n\r\nWhen I click on `Add Usergroup`, it will called `add()` from `UsergroupsCtrl`:\r\n\r\n $scope.add = function() {\r\n $scope.usergroups.push({name:$_URL_0_});\r\n console.log($scope.usergroups);\r\n }\r\n\r\nThe console show that `$scope.usergroups` is already updated. but somehow in `usergroups.html`: `ng-repeat= \" ;group in usergroups \" ;` did not update the view. I add `$scope.$apply()` and `$scope.$digest()` but got an error:\r\n\r\n > $apply already in progress\r\n\r\nBut everything works fine if I did not use `ui-router`. How can I resolve this?", "7" ], [ "I have a `textarea` in my `html` for user to input some text. I can get it to save into `mysql` table field with `text` attribute using `php`. Before insert into `mysql`, I will `mysql_real_escape_string($data);`(for security reason). But when I retrieve it back out from database, I will get\r\n\r\n { \" ;bittext \" ;: \" ;i \r\n love\r\n mcD \" ;}\r\n\r\nWith that I will get error:\r\n\r\n > Error: JSON Parse error: Unterminated string\r\nparse@[native code]\r\n\r\nI am not sure how I can reformat it back so that I can parse it to `JSON`. \r\n\r\n**Update:**\r\n\r\nI found out that I did not add `json_encode($data)` function. Now I can turn\r\n\r\n { \" ;bittext \" ;: \" ;i \r\n love\r\n mcD \" ;}\r\ninto\r\n\r\n { \" ;bittext \" ;: \" ;i\\nlove\\nmcD \" ;}\r\nBut I am having problem to convert `\\n` to `\\\\n` using `$data = str_replace(array(&#39;\\r\\n&#39;, &#39;\\r&#39;, &#39;\\n&#39;),&#39;\\\\n&#39;, $data);`. For some reason `\\\\n` is not working. Is there other way to do this?\r\n\r\n\r\n\r\n**Update2:**\r\nAfter much of messing around with the code, I finally got it to work:\r\n\r\n $je = json_encode($rs,JSON_PRETTY_PRINT);\r\n $nl = array(&#39;\\r\\n&#39;, &#39;\\r&#39;, &#39;\\n&#39;);\r\n $<PERSON> = str_replace($nl,&#39;\\\\n&#39;, $je);\r\n\r\nMy initial issue is when I `log` it with `firephpcore`, I can only see `\\n` even after `str_replace($nl,&#39;\\\\n&#39;, $je)`. But as I do more test and found out it actually already work even though it did not display well in console.", "652" ], [ "I have this in my `app.js`:\r\n\r\n $stateProvider\r\n .state(&#39;actionplans&#39;, {\r\n url: \" ;/actionplans \" ;,\r\n templateUrl: \" ;pages/actionplans.html \" ;,\r\n //controller : &#39;ActionplansCtrl&#39;\r\n })\r\n .state(&#39;actionplans.planning&#39;, {\r\n url: \" ;/planning \" ;,\r\n templateUrl: \" ;pages/actionplans.planning.html \" ;,\r\n //controller : &#39;ActionplansCtrl&#39;\r\n })\r\n .state(&#39;actionplans.summary&#39;, {\r\n url: \" ;/summary \" ;,\r\n templateUrl: \" ;pages/actionplans.summary.html \" ;,\r\n //controller : &#39;ActionplansCtrl&#39;\r\n })\r\n\r\n\r\nHow can I default load nest view action `&#39;actionplans.summary.html&#39;` when called actionplans.html?", "747" ], [ "I found a simple solution [here][1].\r\n\r\n $urlRouterProvider.when(&#39;/actionplans&#39;, &#39;/actionplans/summary&#39;);// < -- Add in this line\r\n $stateProvider\r\n .state(&#39;actionplans&#39;, {\r\n url: \" ;/actionplans \" ;,\r\n abstract: true,/// < -- Add in this line\r\n templateUrl: \" ;pages/actionplans.html \" ;,\r\n })\r\n .state(&#39;actionplans.planning&#39;, {\r\n url: \" ;/planning \" ;,\r\n templateUrl: \" ;pages/actionplans.planning.html \" ;,\r\n })\r\n .state(&#39;actionplans.summary&#39;, {\r\n url: \" ;/summary \" ;,\r\n templateUrl: \" ;pages/actionplans.summary.html \" ;,\r\n })\r\n\r\n\r\nThis will load nest view `actionplans.summary.html` by default when you call `/actionplans`. My apology that I did not make this clearer in my question so I post the answer here hopefully it will help someone else with the similar scenario.\r\n\r\n [1]: _URL_0_", "357" ], [ "I have 5 colors and 1 `mixin`:\r\n\r\n @sec-blue: #29a1eb;\r\n @sec-purple: #3b519f;\r\n @sec-yellow: #ffda2e;\r\n @sec-green: #83c99e;\r\n @sec-brown: #cd9d76;\r\n \r\n .bgcollighten(@col,@per){\r\n @result: lighten(@col, @per);\r\n }\r\nand I want to use it on `#section`, `#subsection` and `#mainelement`:\r\n\r\n #section{\r\n .bgcollighten(@sec-blue,0%);\r\n background-color: @result;\r\n }\r\n \r\n #subsection{\r\n .bgcollighten(@sec-blue,15%);\r\n background-color: @result;\r\n }\r\n \r\n #mainelement{\r\n .bgcollighten(@sec-blue,30%);\r\n background-color: @result;\r\n }\r\nAs you can see, the hard way of doing this will be I repeat it for 5 times with different colors. Is there a better way to do this? \r\n\r\n**Update:**\r\nI found out that we can loop to generate class. But how to use it to loop a list of values?", "574" ], [ "I have 2 `javascript` files:\r\n\r\n //keystrokes.js\r\n function KeyPress(e) {\r\n var evtobj = window.event? event : e\r\n if (evtobj.keyCode == 13 & & evtobj.ctrlKey) {\r\n alert( \" ;Ctrl+ent \" ;);\r\n dragTest;\r\n }\r\n }\r\n \r\n document.onkeydown = KeyPress;\r\n\r\nand \r\n\r\n //draggable.js\r\n window.dragTest = function(){console.log(&#39;from draggable&#39;)};\r\n\r\nand they are both include in `index.html`:\r\n\r\n ...\r\n < script src= \" ;js/dragging.js \" ; > < /script > \r\n < script src= \" ;js/keystrokes.js \" ; > < /script > ...\r\n\r\nI want to call `dragTest` from `draggable.js` when I hit CTRL+ENTER. It did call alert function but never show anything at console. How can I go about to get this right?", "648" ], [ "I have a `javascript` that when press `Ctrl` + `Enter` it will call `CtrlEntInsertData()`:\r\n\r\n function KeyPress(e) {\r\n var evtobj = window.event? event : e\r\n if (evtobj.keyCode == 13 & & evtobj.ctrlKey) {\r\n CtrlEntInsertData();\r\n }\r\n }\r\n \r\n document.onkeydown = KeyPress;\r\n \r\n function CtrlEntInsertData() {\r\n var target = document.querySelector( \" ;input \" ;);\r\n var tarpos = getPosition(target); //!! < -- This work!\r\n target.setAttribute(&#39;data&#39;, 10); // Error line\r\n console.log(tarpos.x+ \" ; \" ;+tarpos.y); //!! < -- This return x, y of target\r\n console.log(target); //!! < -- NULL\r\n }\r\n\r\n function getPosition(element) {\r\n var xPosition = 0;\r\n var yPosition = 0;\r\n \r\n while(element) {\r\n xPosition += (element.offsetLeft - element.scrollLeft + element.clientLeft);\r\n yPosition += (element.offsetTop - element.scrollTop + element.clientTop);\r\n element = element.offsetParent;\r\n }\r\n return { x: xPosition, y: yPosition };\r\n }\r\n\r\nHere is my `HTML`:\r\n\r\n < div class= \" ;input \" ; data= \" ;0 \" ; > < /div > \r\n\r\nI got an error:\r\n\r\n > TypeError: null is not an object (evaluating &#39;target.setAttribute&#39;)\r\n\r\nBut when I use it to `getPosition()`, it did return me something. Why is this and how to get it to work?", "824" ], [ "I get all my `allusers` array from `myfactory`:\r\n\r\n $scope.allusers = myfactory.getFactoryOriginalAllUsers();\r\n ///[1,2,3]\r\n \r\n $scope.allusers.splice(0,1);\r\n ///[2,3]\r\n\r\nbut when I want my original\r\n\r\n $scope.allusers2 = myfactory.getFactoryOriginalAllUsers();\r\n ///[2,3]\r\n\r\nWhy is `$scope.allusers2` the same as `$scope.allusers`? Shouldn&#39;t it be still the same as original factory copy which is `[1,2,3]`?\r\n\r\nHow can I keep the original factory copy untouched?", "163" ], [ "I am using `ui-router` to route control a page with multiple sub pages that share the same controller:\r\n\r\n .state(&#39;users.create&#39;, {\r\n url: \" ;/create \" ;,\r\n views: {\r\n &#39;&#39;: { templateUrl: &#39;pages/users.html&#39;,\r\n controller : &#39;UsersCtrl&#39;\r\n },\r\n &#39;main@users&#39;: { \r\n templateUrl: &#39;pages/users.new.html&#39;,\r\n controller : &#39;UsersCtrl&#39;, parent:&#39;users&#39;},\r\n &#39;list@users&#39;: { \r\n templateUrl: &#39;pages/users.list.html&#39;,\r\n controller: &#39;UsersCtrl&#39;, parent:&#39;users&#39; }\r\n }\r\n })\r\n\r\nAt the moment whenever I call `users.create`, `UsersCtrl` will be called 3 times. \r\nand I have a specific function `updateListButton()` in `UsersCtrl` that only useful to `pages/users.list.html`. \r\n\r\nHow can I specifically call `updateListButton()` whenever I want to update `pages/users.list.html`?", "747" ], [ "I created a `directive` for my `d3js` chart:\r\n\r\n html:\r\n < donuts-chart chart-data= \" ;mydonuts \" ; > < /donuts-chart > \r\n \r\n directive:\r\n .directive(&#39;donutsChart&#39;, function ($parse) {\r\n var donutobject = {\r\n restrict: &#39;E&#39;,\r\n replace: false, \r\n scope: {data: &#39;=chartData&#39;},\r\n link: function (scope, element, attrs) {\r\n \r\n scope.$watch(&#39;data&#39;, function(newVals, oldVals) {\r\n console.log(&#39;there is new data&#39;);\r\n }, true);\r\n \r\n };\r\n return donutobject;\r\n })\r\n\r\nI add `scope.$watch` just to test if the data is updating. But it is not working. How can I get this to work? I need to update the chart whenever there is a new data.", "586" ], [ "I am using `acute.select` in my `angularjs` project. I have an `array`:\r\n\r\n $scope.users = [];\r\n $scope.acuteusers =[{UserName: \" ;<PERSON> \" ;},{UserName: \" ;<PERSON> \" ;},{UserName: \" ;<PERSON> \" ;}];\r\n \r\n $scope.stateSelected = function(state){\r\n \tconsole.log(state);\r\n \tfor (var i = 0; i < $scope.acuteusers.length; i++) {\r\n \t\tif (state.UserName == $scope.acuteusers[i].UserName) {\r\n \t\t\t$scope.acuteusers.splice(i,1);\r\n \t\t};\r\n \t};\r\n \tconsole.log($scope.acuteusers);\r\n }\r\n\r\nand `html`:\r\n\r\n < select class= \" ;ac-select stateList \" ; ac-model= \" ;users \" ; ac-options= \" ;s.UserName for s in acuteusers \" ; \r\n ac-settings= \" ;{ comboMode: true, loadOnOpen: true, minWidth: &#39;470px&#39; } \" ; ac-change= \" ;stateSelected(value) \" ; > \r\n < /select > \r\n\r\nI want to take out the element from `acute.select` dropdown list everything an element is selected. But somehow it will remain as initial states(no element is deleted) even the `console.log` show it already taken out. How can I resolve that?", "645" ], [ "After much reading about Isolated Scope for directives( [link1][1], [link2][2]), I decided to hack the `acute.select.js` directive.\r\n\r\nFirst I add in a new `scope data` in `acute.select.js`:\r\n\r\n .directive( \" ;acSelect \" ;, function($parse, acuteSelectService) {\r\n var defaultSettings = acuteSelectService.getSettings();\r\n return {\r\n restrict: \" ;EAC \" ;,\r\n scope: {\r\n \" ;acSettings \" ;: \" ;@ \" ;,\r\n \" ;acOptions \" ;: \" ;@ \" ;,\r\n \" ;model \" ;: \" ;=acModel \" ;,\r\n \" ;acChange \" ;: \" ; & \" ;,\r\n \" ;keyField \" ;: \" ;@acKey \" ;,\r\n \" ;acRefresh \" ;: \" ;= \" ;,///I believe you can use this, but no documentation at all.\r\n \" ;acFocusWhen \" ;: \" ;= \" ;,\r\n \" ;id \" ;: \" ;@ \" ;,\r\n data: \" ;=acuteOptions \" ;///newly added by me.\r\n },\r\n replace: true,\r\n templateUrl: defaultSettings.templatePath + \" ;acute.select.htm \" ;,\r\n link: function(scope, element, attrs) {\r\n scope.initialise();\r\n \r\n ///**Then I added in $watchCollection to watch the `data` changes.\r\n scope.$watchCollection(&#39;data&#39;, function(newVals, oldVals) {\r\n ///**I found out scope.allItems is the array to build and display the list. \r\n ///however it must follow {text,value,index} object format. So I reformat it that way.\r\n scope.allItems = [];\r\n for (var i = 0; i < newVals.length; i++) {\r\n scope.allItems.push({text:newVals[i].UserName,value:newVals[i],index:i});\r\n };\r\n }, true);\r\n },\r\n\r\nin `html`, add in `acute-options`:\r\n\r\n < select class= \" ;ac-select stateList \" ; ac-model= \" ;users \" ; acute-options= \" ;acuteusers \" ; ac-options= \" ;s.UserName for s in acuteusers \" ; \r\n ac-settings= \" ;{ comboMode: true, loadOnOpen: true, minWidth: &#39;470px&#39; } \" ; ac-change= \" ;stateSelected(value) \" ; > \r\n < /select > \r\n\r\nNow whenever `$scope.acuteuser` changes, it will change the dropdown list. \r\n\r\nI still believe `acRefresh` can do the job, but I am just can not figure out how. It will be nice if someone can share a more robust solution.\r\n\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "586" ], [ "I have this code:\r\n \r\n < !---- > \r\n < div ng-repeat= \" ;priority in toppriorities \" ; > \r\n < table > \r\n < tr > \r\n \t < td > {{priority}}. < /td > \r\n \t < td > \r\n \t < table > \r\n \t < tr > \r\n \t < td > \r\n < select name= \" ;singleSelect \" ; ng-model= \" ;APME \" ; ng-change= \" ;changedValue(APME,priority) \" ; > \r\n < option ng-repeat= \" ;me in mainelements \" ; value= \" ;{{me.Recomendation}} \" ; > {{me.Title}} < /option > \r\n < /select > \r\n \t < /td > \r\n \t < td > \r\n < div ng-model= \" ;APMER[priority] \" ; > {{APMER[priority]}} < /div > \r\n \t < /td > \r\n \t < /tr > \r\n < /table > \r\n < /div > \r\n\r\nI want to update `ng-model``APMER[priority]` to be updated after I selected something from `APME`:\r\n\r\n //JS\r\n $scope.changedValue=function(i, priority){\r\n\t \t$scope.APMER[priority] = i;\r\n\t } \r\n\r\n1. I somehow cannot get `ng-model= \" ;APMER[priority] \" ;` to work.\r\n2. in `js` - `ng-model= \" ;APMER[priority] \" ;`, What is the proper way to assign dynamic variable?", "196" ], [ "I am trying to have multiple `dropdown select`s which will decide on specific input values\r\n\r\nThe HTML\r\n\r\n < div ng-repeat= \" ;i in [1,2,3] \" ; > \r\n < select name= \" ;singleSelect \" ; ng-model= \" ;chosenitem \" ; style= \" ;width:100%; \" ; ng-change= \" ;changedValue(i,$index) \" ; > \r\n < option value= \" ; \" ; disabled selected > choose item < /option > \r\n < option ng-repeat= \" ;me in stuffs \" ; > {{me.item}} < /option > \r\n < /select > \r\n < input type= \" ;text \" ; ng-model= \" ;inputattr[i] \" ; placeholder= \" ;attribute \" ; > \r\n < /div > \r\n\r\nThe controller\r\n\r\n app.controller(&#39;MainCtrl&#39;, function($scope) {\r\n $_URL_0_ = &#39;World&#39;;\r\n $scope.stuffs = [\r\n {item:&#39;car&#39;, attribute:&#39;wheels&#39;},\r\n {item:&#39;plane&#39;, attribute:&#39;wings&#39;},\r\n {item:&#39;boat&#39;, attribute:&#39;propeller&#39;}\r\n ];\r\n \r\n $scope.changedValue = function(i,j){\r\n $scope.inputattr[i] = $scope.stuffs[j].attribute;\r\n };\r\n });\r\n\r\nThe problem is `inputattr` is dynamic. I can never get it to work. Here is my [plunk][1].\r\n\r\n\r\n [1]: _URL_1_", "196" ] ]
188
[ 2738, 11544, 14650, 12948, 11498, 11022, 1575, 13191, 4320, 1423, 11019, 14745, 16625, 3440, 11549, 18861, 2077, 6988, 1093, 13201, 7281, 8345, 12969, 16242, 15467, 5304, 6197, 2850, 19409, 13037, 18321, 12768, 10867, 12958, 17954, 15471, 11305, 5125, 10952, 17975, 7423, 5989, 14251, 17704, 12947, 18158, 8155, 16978, 8664, 2638, 15034, 8306, 18023, 19562, 7268, 1451, 11627, 8184, 443, 7610, 4278, 3119, 13092, 14150, 5220, 5111, 5478, 14475, 8576, 14816, 17629, 6911, 9750, 2774, 11667, 16400, 18815, 7970, 12909, 5102, 17919, 11709, 411, 14608, 4948, 13540, 155, 13105, 3285, 14084, 7166, 11719, 8756, 14422, 14533, 10199, 8100, 13715, 7774, 17927, 6806, 146, 3123, 1740, 2202, 7271, 9399, 14377, 2244, 13042, 370, 13536, 12089, 16209, 9640, 12588, 16797, 1603, 4615, 8619, 14881, 10896, 15235, 14808, 8578, 4251, 14042, 9436, 10625, 4002, 14620, 2877, 2013, 6130, 13969, 13993, 13377, 6839, 11714, 9618, 2684, 10080, 16838, 296, 5049, 5950, 6283, 10181, 14938, 2134, 9809, 19225, 2238, 1759, 16655, 6638, 14298, 13688, 14765, 2781, 1591, 18366, 6417, 5158, 10745, 12174, 17187, 12971, 18120, 11798, 4038, 745, 17785, 17021, 18494, 15256, 13568, 13448, 11877, 19000, 8880, 2804, 12073, 2107, 14643, 3585, 5868, 19397, 13145, 14656, 17559, 11149, 14842, 12469, 15455, 3868, 1355, 594, 11942, 2531, 4734, 5426, 391, 9718, 8339, 7184, 14712, 9466, 16358, 9208, 10521, 788, 10702, 10593, 17706, 4809, 13144, 7839, 18790, 13740, 14554, 10281, 8471, 14489, 12006, 4334, 14256, 9476, 16873, 12780, 10809, 5836, 14555, 18117, 11407, 12312, 13923, 120, 16472, 12593, 11055, 14254, 14211, 12539, 6636, 16392, 11645, 18316, 47, 14311, 1209, 12515, 19095, 17748, 8420, 17718, 1697, 4603, 10025, 9149, 14849, 9660, 7705, 14507, 14982, 2895, 7447, 3547, 15978, 2875, 17380, 19207, 13714, 3334, 16644, 16202, 19368, 19666, 12562, 6681, 11692, 8097, 19629, 13072, 10634, 14588, 952, 7792, 14021, 17150, 7307, 17690, 7078, 14074, 914, 14965, 16876, 19454, 13887, 5671, 4104, 15876, 17503, 17518, 8610, 3427, 11554, 13139, 10278, 17627, 11036, 8909, 12236, 7038, 18087, 4606, 8189, 5838, 9982, 11851, 10347, 2867, 12016, 19597, 264, 16859, 12082, 2799, 10525, 4793, 7609, 1649, 5844, 13454, 14969, 605, 1303, 18240, 13119, 10198, 2216, 3781, 248, 18568, 16380, 13369, 4269, 17306, 10898, 9188, 17254, 19549, 4587, 6266, 2398, 9634, 9771, 8093, 19688, 4707, 7286, 12846, 580, 10661, 10580, 19694, 16933, 195, 6543, 19381, 16477, 6192, 6325, 9721, 18149, 15527, 10264, 11277, 18682, 12254, 6895, 8580, 18070, 10539, 4748, 13409, 10558, 11402, 1381, 19644, 11984, 18003, 4923, 874, 2460, 5924, 9843, 15323, 19700, 1910, 726, 404, 16403, 8617, 320, 3882, 7457, 8894, 16419, 19722, 7082, 19102, 16331, 12757, 13074, 4796, 15871, 7218, 7172, 12941, 19128, 2094, 4298, 6842, 12155, 5312, 17072, 9305, 4223, 19233, 10404, 19490, 14747, 11449, 14737, 722, 4725, 11661, 18000, 12580, 11346, 15105, 5145, 4541, 11102, 17548, 17175, 4341, 14010, 15451, 17639, 674, 12558, 18179, 4383, 14242, 14590, 19575, 15401, 15428, 4671, 11106, 654, 1103, 13808, 17127, 11054, 13115, 18084, 7979, 11875, 15279, 6765, 2325, 11735, 13535, 3958, 7783, 13079, 1877, 1948, 12747, 4056, 16512, 19528, 4969, 19335, 639, 13905, 14005, 19240, 19365, 95, 1139, 1544, 17957, 16315, 15082, 12103 ]
STX_10038.0
[ [ "I&#39;m assuming the error you are getting is the: \r\n\r\n > Comparison arguments must be compatible types \r\n\r\nSince the Standard Account Address field is a compound address field and I am assuming the custom address__c field is not since you cannot create a custom compound field, this is why you are getting the error. Without knowing what is in the custom address__c field I can only assume it might be equivalent to BillingStreet vs. BillingAddress. Also, as <PERSON> mentioned you will want to use the _URL_0_ to filter your contacts Query not the AccountNumber field.", "789" ], [ "You can accomplish this in the process builder on the Opportunity object.\r\n\r\nSteps: \r\n\r\n 1. Select the Opportunity Object and start when created or edited\r\n 2. Set Criteria to look at the related Account Sales Manager and see if it is not null and if it does not match what is already on oppty record.\r\n 3. Update Sales Manager on Opportunity with a Reference to the related Account Sales Manager.", "905" ], [ "Like <PERSON> mentioned in the comment, to see if a Set has a value you need to use the contains method. From the help docs [here][1]: \r\n\r\n > **contains(setElement)**\r\n > \r\n > Returns true if the set contains the specified element.\r\n > \r\n > **Signature**\r\n > \r\n > public Boolean contains(Object setElement)\r\n > \r\n > **Parameters**\r\n > \r\n > setElement\r\n > \r\n > Type: Object\r\n > \r\n > **Return Value**\r\n > \r\n > Type: Boolean\r\n > \r\n > Example:\r\n > \r\n > Set < String > myString = new Set < String > {&#39;a&#39;, &#39;b&#39;};\r\n > Boolean result = myString.contains(&#39;z&#39;);\r\n > System.assertEquals(false, result);\r\n\r\nA couple other things I noticed in your code: \r\n1. You are looping through the accounts that are sent in and inside that loop you are querying for the related contacts, you risk hitting governor limits and should never have a query inside of a for loop. \r\n2. Your query is being filtered by the acc_id set, but there are no values assigned to this set - assuming that this class is called by a trigger you could pass in the map vs the list and use the map keyset to filter your query. \r\n\r\nThere is a great module on trailhead for triggers [here][2]. There is also a workbook that walks you through a similar example of preventing deletion of invoices with invoice line items [here][3].\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_\r\n [3]: _URL_2_", "241" ], [ "I&#39;m assuming this is because the task doesn&#39;t move with the lead when it is moved to a queue, since queue&#39;s can&#39;t own tasks (idea [here][1]) but stays under the initial owner. When the lead is then reassigned from the queue to the next user the task wouldn&#39;t move along with it. One idea would be to create a process in process builder that will run when a lead is moved to a user from a queue and reassign the tasks to the new lead owner. \r\n[![enter image description here][2]][2]\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "246" ], [ "If the lookup field is on the Opportunity then you would need to query the opportunity object not the Product__c object. I&#39;m guessing something like this: \r\n \r\n\r\n public without sharing class Test {\r\n \r\n public static void Org (List < Opportunity > organisations){\r\n Set < Id > prodIds = new Set < Id > ();\r\n \r\n for(Opportunity o : organisations) {\r\n prodIds.add(o.product__c);\r\n }\r\n \r\n for( Product__c product : [SELECT ID, Name, Product_ID__c FROM Product__c WHERE ID IN :prodIds])\r\n {\r\n system.debug(&#39;I am in here&#39; + product.Product_ID__c );\r\n }\r\n \r\n }\r\n }", "670" ], [ "From the help [docs][1] on using the Developer Console to check code coverage: \r\n\r\n > Checking Code Coverage\r\n > \r\n > The Developer Console retrieves and displays code coverage information\r\n > from your organization. Code coverage results come from any tests\r\n > you’ve run from an API or from a user interface (for example, the\r\n > Developer Console, the _URL_2_ IDE, or the Apex Test Execution\r\n > page). To clear the current results, click Test | Clear Test Data.\r\n > When you edit a class, the code coverage for that class is cleared\r\n > until you run the tests again.\r\n > \r\n > You can view code coverage in several places in the Developer Console.\r\n > \r\n > The Tests tab includes an Overall Code Coverage panel that displays\r\n > the code coverage percentage for every Apex class in your organization\r\n > that has been included in a test run. It also displays the overall\r\n > percentage.\r\n > \r\n > Double-click a completed test run to open a Tests Results view that\r\n > displays the tested class, the tested method, the duration, result\r\n > (skip, pass, or fail), and an optional error message. If the test\r\n > failed, a Stack Trace column shows the method and line number at which\r\n > the test failed.\r\n > \r\n > To view line-by-line code coverage for an Apex class, open the class.\r\n > The Code Coverage menu will include one or more of the following\r\n > options depending on the tests you have implemented:\r\n > \r\n > None\r\n > \r\n > All Tests: The percentage of code coverage from all test runs.\r\n > \r\n > className.methodName: The percentage of code coverage from a method\r\n > executed during a test run.\r\n > \r\n > Lines of code that are covered by tests are blue. Lines of code that\r\n > aren’t covered are red. Lines of code that don’t require coverage (for\r\n > example, curly brackets, comments, and System.debug calls) are left\r\n > white.\r\n\r\nAnother doc [here][2] for running the tests: \r\n\r\n > Use the Developer Console to set up test runs, run tests and check\r\n > Apex code coverage.\r\n > \r\n > The Developer Console Test menu allows you to manage your test runs.\r\n > It includes the following options:\r\n > \r\n > Always Run Asynchronously: Unless Always Run Asynchronously is\r\n > enabled, test runs that include tests from only one class run\r\n > synchronously. Test runs that include more than one class run\r\n > asynchronously regardless of whether this option is enabled.\r\n > \r\n > New Run: Creates a test run. For details, see Create a Test Run.\r\n > \r\n > Rerun: Runs the test that’s selected in the Tests tab.\r\n > \r\n > Rerun Failed Tests: To rerun only the failed tests from the test run\r\n > that’s highlighted in the Tests tab, choose this option.\r\n > \r\n > Run All: Runs all saved test runs.\r\n > \r\n > Abort: Aborts the test selected in the Tests tab.\r\n > \r\n > Collapse All: Collapses all open tests in the Tests tab.\r\n > \r\n > Expand All: Expands all tests in the Tests tab.\r\n > \r\n > Clear Test Data: Clears the current test data and code coverage\r\n > results.\r\n > \r\n > Developer Console Test menu\r\n > \r\n > Completed tests are listed on the Tests tab in the bottom panel of the\r\n > Developer Console.\r\n\r\nIn the past sometimes you had to make a small edit and save the trigger then rerun the test to get the coverage, but I haven&#39;t run into that in awhile. Try clearing your test data and rerunning make sure you are watching the test tab for any red x&#39;s, which is were you would see if your test is passing or failing. I wonder how it would not be failing if you are inserting a record without the required fields?\r\n\r\nAs a side note: you could accomplish this task with the process builder. If you want to stick with a trigger, watch the bulkification, you have a query inside of your for loop which would cause you to be at risk for hitting the limits. \r\n \r\n\r\n[1]: _URL_0_\r\n [2]: _URL_1_", "992" ], [ "1. On desktops and laptops, drivers are a necessary evil. Hardware is often user-serviceable and prone to changes, and there is a huge variety of possible combinations. On phones and tablets, this isn&#39;t quite so. You can&#39;t really change the hardware easily. It&#39;s entirely safe to disallow driver installation since you don&#39;t really need it.\r\n2. It is a lot easier to break ARM devices than x86 with messed-up drivers.\r\n3. Drivers on Android must be written for specific kernel versions and all. This is easy to do for a manufacturer, but hard to get right as a user.\r\n4. Most USB On-The-Go devices are USB interfaces, for which drivers are included. \r\n5. Driver installation requires root access, which is disabled by default on the vast majority of Android devices.\r\n6. Allowing driver install exposes a massive surface for the installation of rootkits and other malware. And, in fact, such malware can persist across devices wipes and firmware upgrades.\r\n\r\nWe will likely see some kind of driver installation if [Project Ara][1] takes off. But I imagine it will be along the lines of each component having its driver loaded onto it and installing when attached, as opposed to allowing the installation of arbitrary drivers found on the Internet.\r\n\r\n\r\n [1]: _URL_0_", "117" ], [ "You should be able to use the external objects just like a custom object. Here is an example using the repeat tag on the sample external object from the trailhead [project][1]:\r\n\r\n < apex:page standardController= \" ;Account \" ; > \r\n < apex:detail relatedList= \" ;false \" ;/ > \r\n < apex:repeat value= \" ;{!Account.Orders__r} \" ; var= \" ;order \" ; > \r\n < apex:outputField value= \" ;{!order.orderID__c} \" ;/ > \r\n < /apex:repeat > \r\n < /apex:page > \r\n\r\n\r\n [1]: _URL_0_", "145" ], [ "There is a great blog post [here][1] about getting started with the _URL_0_ cli including install instructions for the MAC.\r\n\r\n > For those using a Mac, go to _URL_1_ and download\r\n > the Mac version. All you get in your Downloads folder is a single file\r\n > called \" ;force \" ;. There is no installer, you just have to put this file\r\n > someplace that makes sense. I moved it to a place where my path could\r\n > see it and made sure it was executable for me.\r\n > \r\n > mv ~/Downloads/force /usr/local/bin\r\n > \r\n > chmod u+x /usr/local/bin/force\r\n\r\n\r\n [1]: _URL_2_", "487" ], [ "Do you have both mutli-currency and Advanced Currency Management enabled? If yes, then it appears rollup will not be available, please see and vote for this [idea][1]. \r\nOne suggestion is the rollup helper on the app exchange found [here][2], or there is also my favorite rollup tool that is available on [github][3] and explained in this blog post [here][4]. \r\nAlso just saw this [blog][5] post on using flow to create rollups.\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_4_\r\n [3]: _URL_3_\r\n [4]: _URL_0_\r\n [5]: _URL_1_", "693" ], [ "What is the deal with allowing Mozilla to host Tor relay nodes? \r\nThey say their contribution will help to greatly expand and improve the Tor network, yet despite all the recent spin on the truth about privacy that Mozilla is putting out with version Firefox V.42, they are still responding to government info requests, and would not hesitate to allow eyes on their nodes. This brings up an obvious question: \r\n\r\nTor seems to allow anybody to host a relay. How is this safe? \r\n\r\nIf I was a fed, I would host many relays and just fish all day.", "465" ], [ "From the docs [blog][2], in order to add a lightning component to a visualforce page... \r\n\r\n > you need to reference a Lightning app. This app is globally accessible\r\n > and extends ltng:outApp. The app declares dependencies on any\r\n > Lightning definitions (like components) that it uses... \r\n\r\nAccording to this walkthrough [blog][2], the app acts as a bridge between\r\nthe two: \r\n\r\n > In order to display a Lightning Component in a Visualforce page, you\r\n > need to construct a simple Lightning Application that is used as the\r\n > bridge between the two technologies. This needs to have a dependency\r\n > on the Lightning Component that will display the content...\r\n\r\nIn your case you would want to have an app something like: \r\n\r\n < aura:application access= \" ;GLOBAL \" ; extends= \" ;ltng:outApp \" ; > \r\n < aura:dependency resource= \" ;c:AccountsList \" ; / > \r\n < /aura:application > \r\nThen in your visualforce page you set the $Lightning.use is set to the application and $Lightning.createComponent is set to the component.\r\nAnother great blog [here][3] that breaks it all down.\n\r\n\r\n\n\n [1]: _URL_0_\n [2]: _URL_2_\n [3]: _URL_1_", "454" ], [ "From how I understand the docs [here][1]: access level of the component is determined by whether it&#39;s `public` and only accessable in it&#39;s own namespace or `global` and accessable in any namespace. \r\nFrom what I can tell after installing the PTO App only the \" ;lampone:ChartjsChangeChartTypeButton \" ; appears to be global as it shows up in the [Reference Doc App][2] \r\n\r\n > _URL_1_, where\r\n > < myDomain > is the name of your custom Salesforce domain.\r\n\r\nThis is also where you can see which attributes a component has. After installing the [Lightning Utility Pack][3], you can see the different components available for use along with their attributes.\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_3_\r\n [3]: _URL_2_", "454" ], [ "When I use the following command:\r\n\r\n`gpg --check-sigs A490D0F4D311A4153E2BB7CADBB802B258ACD84F`\r\n\r\nInstead of getting this:\r\n\r\n sig! 0x1202821CBE2CD9C1 2015-01-19 Tails developers (signing key) < <EMAIL_ADDRESS> > \r\n\r\n\r\n..I get this:\r\n\r\n pub 4096R/58ACD84F 2015-01-18 [expires: 2017-01-11]\r\n uid [ unknown] Tails developers (offline long-term identity key) < <EMAIL_ADDRESS> > \r\n sig!3 58ACD84F 2015-01-18 Tails developers (offline long-term identity key) < <EMAIL_ADDRESS> > \r\n sig!3 58ACD84F 2015-09-27 Tails developers (offline long-term identity key) < <EMAIL_ADDRESS> > \r\n uid [ unknown] Tails developers < <EMAIL_ADDRESS> > \r\n sig!3 58ACD84F 2015-09-27 Tails developers (offline long-term identity key) < <EMAIL_ADDRESS> > \r\n sub 4096R/752A3DB6 2015-01-18 [expires: 2017-01-11]\r\n sig! 58ACD84F 2015-09-27 Tails developers (offline long-term identity key) < <EMAIL_ADDRESS> > \r\n sub 4096R/2F699C56 2015-01-18 [expires: 2017-01-11]\r\n sig! 58ACD84F 2015-09-27 Tails developers (offline long-term identity key) < <EMAIL_ADDRESS><PERSON> [ unknown] Tails developers < tails@boum.org > \r\n sig!3 58ACD84F 2015-09-27 Tails developers (offline long-term identity key) < tails@boum.org > \r\n sub 4096R/752A3DB6 2015-01-18 [expires: 2017-01-11]\r\n sig! 58ACD84F 2015-09-27 Tails developers (offline long-term identity key) < tails@boum.org > \r\n sub 4096R/2F699C56 2015-01-18 [expires: 2017-01-11]\r\n sig! 58ACD84F 2015-09-27 Tails developers (offline long-term identity key) < tails@boum.org > \r\n\r\n 134 signatures not checked due to missing keys\r\n\r\n\r\nI do not see 1202821CBE2CD9C1 anywhere here, and the expiration date of 2017-01-11 doesn&#39;t seem right. I presume I am doing something wrong. \r\n\r\nThanks.", "921" ], [ "I have been researching this field for a media project I am working on, and while I am in no way qualified to answer this question as well as others here, it seems to me that Whonix is the thing to use if you are using your personal home computer, for the best possible safety and anonymity. While Tails is probably best used for short periods of time on a dedicated secondary mobile platform that is not used for anything personal - ever. Whonix is not safe for local forensics while Tails is. ;)", "153" ], [ "I would recommend taking a look at a quick action vs using a custom button url hack since they do not work in Lightning experience and are not supported by salesforce and therefor could break without notice but if you want to continue with the URL hack then you need to change your paramaters to set both the id and the name and also include CF before the field ID for custom fields: `{!URLFOR($Action.Rep_Expense__c.New,null,[CF00No0000000lFwWEAU=_URL_1_, CF00No0000000lFwWEAU_lkid=_URL_0_],true)}`", "459" ], [ "The error thinks you are attempting to use a bind variable, from the [docs][1]... \r\n\r\n > SOQL and SOSL statements in Apex can reference Apex code variables and\r\n > expressions if they’re preceded by a colon (:). This use of a local\r\n > code variable within a SOQL or SOSL statement is called a bind.\r\n\r\nWhich is allowed in apex but using another field as a value is not as <PERSON> pointed out in his answer. \r\n\r\nInstead what you can do is create a formula on the Contact object that compares the email to the account primary email then use that comparison field in your query. \r\n\r\nThere is an idea for this type of comparison in reports that is under consideration out on the idea exchange [here][2], but it looks like it may be a few releases out yet.\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "190" ], [ "Although I cannot find documentation to support it, from what I have found it appears this is not a bug but by design. What appears to be happening is Salesforce is removing the field all together since it has no value. You can see this in the logs if you debug all 3 variables by adding system debugs to your code: \r\n\r\n system.debug(&#39;Acct1: &#39; + account1);\r\n system.debug(&#39;Acct2: &#39; + account2);\r\n system.debug(&#39;Template: &#39; + template); \r\n\r\n[![Results][1]][1]\r\n\r\nIf you explicitly set the field to null then redo the system debugs you will see the field and it&#39;s null value printed out.\r\n\r\nSimilar issue found [here][2].\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "419" ], [ "I am struggling to understand how option processing works in classes. As a MWE\r\n\r\n`foo.tex`:\r\n\r\n \\documentclass[draft,figures]{foo}\r\n \\begin{document}\r\n \\includegraphics{example-image}\r\n \\end{document}\r\n\r\n`foo.cls`:\r\n\r\n \\ProvidesClass{foo}\r\n \\RequirePackage{foo}\r\n \\LoadClassWithOptions{article}\r\n \\RequirePackage{graphicx}\r\n\r\n`foo.sty`\r\n\r\n \\ProvidesPackage{foo}\r\n \\RequirePackage{etoolbox}\r\n \\newbool{foo@figures}\r\n \\DeclareOption{figures}{\\booltrue{foo@figures}}\r\n \\ProcessOptions\\relax\r\n \\ifbool{foo@figures}{\\PassOptionsToPackage{final}{graphicx}}{}\r\n\r\nWhen I process `foo.tex` with `pdflatex` the log shows\r\n\r\n > LaTeX Warning: Unused global option(s):\r\n [figures].\r\n\r\nbut I also see the graphic, which means that I am passing the `final` option to the `graphicx` package. Why does LaTeX think the `figures` option is unused?\r\n\r\nMoving `\\LoadClassWithOptions` to before the package is loaded gets rid of the warning. In my real use case, the class that is being loaded, loads the `graphicx` package and therefore I need to load the package before loading the class.", "558" ], [ "I have a series of .img files from a previous analysis in SPM that Freesurfer (FS) cannot directly handle. \r\n\r\nFS comes with a conversion tool, the mri_convert command, but I am not able to make it run iteratively over all the files in the same directory. I found a mention about the --sdcmlist argument [online](_URL_0_), however I am not figuring out the proper syntax for it.\r\n\r\nWhen I run:\r\n\r\n mri_convert --sdcmlist 000123_1_4.img 000123_1_4.mgz\r\n\r\nI get:\r\n\r\n mri_convert: missing output volume name\r\n\r\nWould anyone suggest a way of going about these conversions?", "929" ], [ "I couldn&#39;t find a way of doing that using the arguments in the mri_convert, so I decided to do it programatically in bash. This answer will only work in Linux (or in any bash). It&#39;s an one-line command to iterativelly run the convertion on all files in the same directory.\r\n\r\n for f in *.img; do mri_convert $f $f.mgz; done\r\n\r\nThere is one aspect that I did not get right, that is FS actually handles img files, however these files do not have directionality information, thus using them is not recommended. \r\n\r\nOne can simply feed the recon-all command with the img file and the command will take care of the conversion.", "523" ], [ "[FreeSurfer](_URL_1_) uses the recon-all command to semi-automatically generate its statistics. This tool implies a certain directory structure in which the files with the images for the samples should be organized into. In FreeSurfer tutorial they call this specific directory structure the [FSFAST structure](_URL_0_).\r\n\r\nI need to analyse images that were previously worked on in SPM, and it has the following directory structure for the patients:\r\n\r\n /experiment/patients/A.o/\r\n\r\nand for controls:\r\n\r\n /experiment/controls/A.o/\r\n\r\nWithin each directory there are .hdr, .img, .mat and .mask files for each observation, which was obtained in two different times. So the naming of the files have the following order: \r\n\r\n experiment_subjectnumber_time1.img\r\n\r\nand for the second acquisition reads:\r\n\r\n experiment_subjectnumber_time2.img\r\n\r\nThe same with all the before mentioned extensions (hdr, mat, mask).\r\n\r\nIt seems that in the FreeSurfer workflow the command [unpacksdcmdir](_URL_2_) is used to extract data from the nii and dicon types and organize them in the FSFAST structure. Can it be used on directory structures like the one I have?", "859" ], [ "I found help at the FreeSurfer mailing list regarding this question. The answer is that for the structural analysis, there is no need to run the recon-all command in a specific directory structure. \r\n\r\nIt is just a matter of running \r\n\r\n recon-all -s SUBJECTNAME -all -i IMAGE.IMG\r\n\r\nNote that I am feeding an img file, which is what I am using now, however the creators of the software suggest the use of the DICON filetype.", "523" ], [ "I would like to write a custom class that loads the `biblatex` package, but I am having trouble with option clashes. For example, the following MWE gives me an error\r\n\r\n % arara: pdflatex\r\n % arara: biber\r\n % arara: pdflatex\r\n % arara: pdflatex\r\n \r\n \\RequirePackage{filecontents}\r\n \r\n \\begin{filecontents*}{myclass.cls}\r\n \\NeedsTeXFormat{LaTeX2e}\r\n \\ProvidesClass{myclass}[2015/12/29 My MWE class]\r\n \\LoadClassWithOptions{article}\r\n \\PassOptionsToPackage{backend=biber}{biblatex}\r\n \\RequirePackage{biblatex}\r\n \\endinput\r\n \\end{filecontents*}\r\n \r\n \\documentclass{myclass}\r\n \\usepackage[style=authoryear]{biblatex}\r\n \\addbibresource{biblatex-examples.bib}\r\n \r\n \\begin{document}\r\n \\nocite{*}\r\n \\printbibliography\r\n \\end{document}\r\n\r\n > LaTeX Error: Option clash for package biblatex.\r\n\r\nThe error is pretty clear. The class loads biblatex with the `backend=biber` option and then again in the document with the `backend=biber` and `authoryear` options.\r\n\r\nI tried making the class only load the biblatex package with the `\\AtBeginDocument` hook (and the `\\AtEndPreamble` hook from the etoolbox package) if it is not loaded in the preamble. \r\n\r\n \\AtBeginDocument{\\@ifpackageloaded{biblatex}{}{\\RequirePackage{biblatex}}}\r\n\r\nThis apparently is too late to load the biblatex package. The only way I can get it to work is to patch the `\\document` macro\r\n\r\n \\preto{\\document}{\\endgroup\\@ifpackageloaded{biblatex}{}{\\RequirePackage{biblatex}\\begingroup}}{}{}\r\n\r\nHow should a class load the biblatex package?", "783" ], [ "One option is to add an option to the class to suppress loading the biblatex package in the class. This gives a default of loading biblatex with the default values, but if the user wants to manually load biblatex, then they need to provide the class option. \r\n\r\n % arara: pdflatex\r\n % arara: biber\r\n % arara: pdflatex\r\n % arara: pdflatex\r\n \r\n \\RequirePackage{filecontents}\r\n \r\n \\begin{filecontents*}{myclass.cls}\r\n \\NeedsTeXFormat{LaTeX2e}\r\n \\ProvidesClass{myclass}[2015/12/29 My MWE class]\r\n \\newif\\ifnobiblatex\r\n \\DeclareOption{nobiblatex}{\\nobiblatextrue}\r\n \\ProcessOptions\\relax\r\n \\LoadClassWithOptions{article}\r\n \\PassOptionsToPackage{backend=biber}{biblatex}\r\n \\ifnobiblatex%\r\n \\AtBeginDocument{%\r\n \\@ifpackageloaded{biblatex}{}\r\n {\\ClassError{myclass}{Fatal: biblatex not loaded}\r\n {You must load biblatex, I&#39;ll end here}\\@@end}%\r\n }\r\n \\else\\RequirePackage{biblatex}\\fi\r\n \\endinput\r\n \\end{filecontents*}\r\n \r\n \\documentclass[nobiblatex]{myclass}\r\n \\usepackage[style=authoryear]{biblatex}\r\n \\addbibresource{biblatex-examples.bib}\r\n \r\n \\begin{document}\r\n \\nocite{*}\r\n \\printbibliography\r\n \\end{document}", "783" ], [ "Updating children records is a feature of the process builder but it is not possible using Workflow rules. So I would definitely recommend using the Process Builder in your sceneario. Instructions from help [docs][1]:\r\n\r\n > The Process Builder allows you to update child records whenever the\r\n > parent record is modified. Here&#39;s how:\r\n > \r\n > Create a new Process.\r\n > \r\n > Select the Record you would like to update. Example record in account\r\n > Object.\r\n > \r\n > Define the Criteria.\r\n > \r\n > In \" ;Immediate Action, \" ; select Update Records.\r\n > \r\n > Click on the \" ;Object \" ; drop down: Select the Account record that\r\n > started your process and Select a record related to the Account:\r\n > \r\n > These are radio buttons and only one can be selected and to update\r\n > child records you need to select send option “Select a record related\r\n > to the Account”\r\n > \r\n > In \" ;Find a field, \" ; look for the child object name you want to update.\r\n > \r\n > If child object is a Custom Object the name would contain \" ;__r \" ; at the\r\n > end.\r\n > \r\n > Select the Child Object name, and then click Save.\r\n > \r\n > In \" ;Set new value \" ; section, define the field that you want to update\r\n > in child records and what value it should contain\r\n > \r\n > Click Save.\r\n > \r\n > Similar steps can be used to update lookup fields using process\r\n > builder too.\r\n\r\n \r\n\r\n[1]: _URL_0_", "318" ], [ "I think your best bet is to take a look at the Lightning Components Developer Guide, they have a quick start in Chapter 2 that walks you through both creating a form and using the lightning design system CSS framework, you don&#39;t need to rewrite the css, just include the slds resource. Example from the guide: \r\n\r\n < aura:application > \r\n < !-- Define the Design System static resource (version 0.9.0) -- > \r\n < ltng:require styles= \" ;/resource/slds090/assets/styles/salesforce-lightning-design-system.min.css \" ;/ > \r\n < div class= \" ;slds \" ; > \r\n < div class= \" ;slds-page-header \" ; > \r\n < div class= \" ;slds-grid \" ; > \r\n < div class= \" ;slds-col slds-has-flexi-truncate \" ; > \r\n < p class= \" ;slds-text-heading--label \" ; > Expenses < /p > \r\n < div class= \" ;slds-grid \" ; > \r\n < div class= \" ;slds-grid slds-type-focus slds-no-space \" ; > \r\n < h1 class= \" ;slds-text-heading--medium slds-truncate \" ; title= \" ;My\r\n Expenses \" ; > My Expenses < /h1 > \r\n < /div > \r\n < /div > \r\n < /div > \r\n < /div > \r\n < /div > \r\n < /div > \r\n < /aura:application >", "811" ], [ "I have a limited amount of time to analyse strucutural neuroimaging from a sample of patients. My objective is to simply extract volumes from selected fronto-parietal areas.\r\n\r\nI have no previous knowledge on using SPM nor FreeSurfer. Which should I learn? Which has the fastest learning curve?\r\n\r\nI usually prefer working with free and open source software in research, so if any of these two is able to plug into R, for example, it would be a plus.", "13" ], [ "I am using the `enotez` package and would like to be able to call `\\printendnotes` regardless of if there are actually any endnotes. In the case that there are no endnotes I would either like the `\\AtEveryEndnotesList` hook to not be evaluated or a way to add content to the hook that would only be used conditionally on there being any endnotes. I would also like to avoid printing the section title in the case of no notes.\r\n\r\n \\documentclass{article}\r\n \\usepackage{enotez}\r\n \\AtEveryEndnotesList{I do not want to see this}\r\n \\begin{document}\r\n \\printendnotes\r\n \\end{document}", "95" ], [ "Sorry didn&#39;t see your comment, if you are using the custom email template, where it has dropdowns under available merge fields. Copy and paste the merge field value instead of manually typing it in the subject. I know it shouldn&#39;t matter but for whatever reason I thought someone once resolved a similar issue that way.", "190" ], [ "I have been looking for any general datasets about LGBT Americans. The type of file I look for are either CSV or TSV. Although my inquiry will hopefully yield some spatial indices at the county or state level, because of the apparent lack of initial success in searching I am hoping for data of some depth of any sort. Any suggestions or help is greatly appreciated.", "307" ], [ "I am learning how to use SPM and ISAS to analyze ictal and interictal SPECT. However I am stuck at a point of their [tutorial](_URL_2_). \r\n\r\nIn the item 1.2 one has to set the origin for the SPECT image. That is, to pinpoint the [anterior commissure](_URL_0_). This is a fairly easy task in a MRI, but very hard to do in a SPECT. How am I to find a tiny anatomical area in such a blurry image (like the one below)?\r\n\r\n[![enter image description here][1]][1]\r\n\r\nAre there any anatomical references that I should be using in order to find the approximate area for the anterior commissure?\r\n\r\nAny help would be greatly appreciated.\r\n\r\n\r\n [1]: _URL_1_", "702" ], [ "I am trying to install [MARSBAR](_URL_4_) toolbox into [SPM12](_URL_6_), but I am running into different problems. Initially they were all related to directory ownership and permissions (using Ubuntu 14.04), which I managed to correct, but then [matlab](_URL_0_) wouldn&#39;t find the script files (extension .m). I added them manually to the path, and that worked out.\r\n\r\nFinally, and here is the point I can&#39;t go through, when I run ```marsbar``` in MATLAB I keep running into:\r\n\r\n > > marsbar\r\n MarsBaR analysis functions prepended to path\r\n Undefined function or variable &#39;marmoire&#39;.\r\n \r\n Error in marsbar (line 125)\r\n o = marmoire;\r\n \r\n Error in marsbar (line 57)\r\n marsbar(&#39;on&#39;);\r\n\r\nEven though the function marmoire that it is complaining about IS on the path and with proper permissions! ** < - Actually not, see below.**\r\n\r\nGoogling the error took me to a lot of different complaints from users that had difficulties about running it on SPM12 [1](_URL_3_) [2](_URL_1_), however none were quite the same as the problem I&#39;ve been facing.\r\n\r\nAlso, the [documentation](_URL_5_) for the toolbox is quite outdated now, it seems.\r\n\r\nAny light here would be greatly appreciated!\r\n\r\n**UPDATE 6.1.16**\r\nAs per suggestion in the comments I added two lines before marsbar calls marmoire.\r\n\r\n[![enter image description here][1]][1]\r\n\r\nNow the error is:\r\n\r\n > > marsbar\r\n MarsBaR analysis functions prepended to path\r\n Undefined function or variable &#39;marmoire&#39;.\r\n \r\n Error in marsbar (line 125)\r\n which marmoire\r\n \r\n Error in marsbar (line 57)\r\n marsbar(&#39;on&#39;);\r\n\r\nWhich means that marmoire is not actually in the proper path, however I copied it to the same directory as marsbar:\r\n\r\n[![enter image description here][2]][2]\r\n\r\n\r\nAnd the problem persists.\r\n\r\n\r\n [1]: _URL_7_\r\n [2]: _URL_2_", "885" ], [ "I am using Tor in Tails 1.8.1. I am attempting to upgrade online to 1.8.2 yet I&#39;m noticing that the Tor onion status logo is green yet it has a white bar at the bottom of it. I&#39;ve seen this before and I ignored it. I am not using Window camo, rather the default GUI. Strangely enough there doesn&#39;t seem to be any answers to this online. Thanks.", "724" ], [ "When using the `geometry` and `fancyhdr` packages it is possible to specify margins that are too small to hold the header and footer.\r\n\r\n \\documentclass{article}\r\n \\usepackage{geometry}\r\n \\usepackage{fancyhdr}\r\n \\geometry{vmargin=0.5in,\r\n head=\\dimexpr1in+\\dp\\strutbox\\relax,\r\n foot=\\dimexpr1in+\\dp\\strutbox\\relax}\r\n \\fancypagestyle{foo}{\r\n \\fancyhead[L]{\\rule{\\textwidth}{1in}}\r\n \\fancyfoot[L]{\\rule{\\textwidth}{1in}}}\r\n \\pagestyle{foo}\r\n \\begin{document}\r\n This does not give any warning that the \" ;margins \" ;\r\n are too small to hold the header and footer.\r\n \\end{document}\r\n\r\nIn my actual use case, I do not know the size of the header and footer in advance, although they are of constant size after `\\begin{document}`. It is relatively easy to adjust the size of the header/footer to fit the content and `fancyhdr` warns you if the content does not fit. The issue is if the header/footer runs off the page, neither `fancyhdr` nor `geometry` warn you. \r\n\r\nI would like to be able to specify that I want the margins to be either exactly 0.5 in or just big enough to hold the header/footer. In the case of the above MWE the margins should be 1 in (maybe the top margin should be a little bigger to include `\\headsep`) instead of the 0.5 in that they are. The `includehead` option would give me a 1.5 in margin which is too big.\r\n\r\nIn the absence of being able to specify a minimum margin size, is it possible to at least raise a warning.", "703" ], [ "You can actually have multiple developer orgs, it might be easier to just create a new developer org for trailhead and use the current org to play around with other items. Your username does not need to be a valid email address just in the form of an email address so you can create as many dev orgs as needed to learn.", "855" ], [ "The question is why sometimes we report certain psychiatric conditions as being discrete (henceforth categorical) and sometimes as being dimensional (or in a spectrum).\r\n\r\nThe answer is related to the history of psychiatric classifications. By the time DSM-III was designed, there was an increasing resistance to psychoanalysis in America. Psychoanalysis tended to organize disorders in a dimensional fashion (have a look at [this](_URL_0_) podcast. So the final product (DSM-III) translated that resistance by organizing all conditions in categories, increasing significantly their number as well.\r\n\r\nIn the past 10 years the lack of success (this is questionable, but psychiatry did not developed as well as, say, oncology) of the field made some scholars rethink about the exclusive use of categories. \r\n\r\nIt seems that categories are suited health insurances and legal objectives. For instance, judges are normally interested to know whether someone has or not a condition in order to decide about responsibility (necessary and sufficient conditions). The same with health insurance companies.\r\n\r\nThe problem is that psychiatry should be thinking on advancing the field, instead of satisfying the legal system or the health insurance companies (these are very important issues as well, don&#39;t get me wrong, but they are secondary). \r\n\r\nNow the question is: are mental disorders really dimensional things? What are the evidences for thinking this way? I will only mention on argument and then I will suggest some readings to read all the other findings that suggests so.\r\n\r\nThe level of co-occurrence of mental disorders (co-morbidity) are very high. So that alcoholism is commonly accompanied by anxiety and depression. Depression and anxiety are themselves commonly found together, and the same for almost all the other hundreds of conditions. That means that perhaps a dimensional approach would be a better one to treat theses concepts.\r\n\r\nWhy do we accept that personality and intelligence are the type of things that should be treated as dimensional, then? Because the psychologists have been working without giving as much attention to politics than the psychiatrists in the last half-century. And they developed the statistical scaffolding for their theories on personality and intelligence, quite independently from psychiatrists. That is why these subjects are treated today as dimensional, whereas mental disorders are treated as categorical (note though that personality disorders also exists in the classification systems and DSM-5 attempts to introduce some dimensional approach on the subject).\r\n\r\nFinally, why Autism has been taken as a spectrum condition? Simply because its study has gained traction only recently, and also because the main researchers in the area used methods from psychology to develop their ideas.\r\n\r\nSo the answer is that your perception that disorders are discrete is something inherited by the long use of classification systems like DSM, but that it will change shortly.\r\n\r\n**References:**\r\n\r\n- [<PERSON>, <PERSON> (2004). Madness Explained: Psychosis and Human Nature. Penguin.](_URL_3_)\r\n- <PERSON>, <PERSON>, & <PERSON>, J. C. (2014). From <PERSON> to DSM-5: autism as an evolving diagnostic concept. Annual Review of Clinical Psychology, 10, 193–212. _URL_1_\r\n- [APA. (2013). DSM 5. American Psychiatric Association. _URL_4_](_URL_2_)\r\n- <PERSON>, P. (2000). Psychiatric disorders are not natural kinds. Philosophy, Psychiatry, & Psychology, 7(3), 167–182.", "578" ], [ "Definitely is not an issue with splitting the string, simplified the code a bit and ran the following in the execute anonymous window to demonstrate:\r\n\r\n List < String > Useremails = new List < String > {\r\n &#39;<EMAIL_ADDRESS>;<EMAIL_ADDRESS>&#39;,\r\n &#39;<EMAIL_ADDRESS>;<EMAIL_ADDRESS>&#39;,\r\n &#39;<EMAIL_ADDRESS>&#39;, &#39;<EMAIL_ADDRESS>&#39;};\r\n List < String > emailResults = new List < String > ();\r\n \t\r\n for(String Useremail : Useremails) {\r\n for(String email : Useremail.split(&#39;;&#39;)){\r\n emailResults.add(email);\r\n System.debug(email);\r\n }\r\n }\r\n \r\n System.debug(emailResults);\r\n\r\n\r\n\r\n\r\n [![debug results][1]][1]\r\n\r\n\r\n [1]: _URL_0_", "349" ], [ "Your Query has `WHERE _URL_0_=:&#39;names&#39;` try removing the single quotes since it is a variable name and not a string as noted in the comments. \r\nAlso noted in the comments, you do not want to have a query being performed inside a for loop. \r\nYou also are only checking the first result of the trigger so if mutliple records were updated simultaneously with different owners this will cause you some issues. \r\nI would suggest something like: \r\nCreate a set of user ids; \r\nCreate a map from the result of query on User of Ids to User object include the name; \r\nLoop through the trigger.new list and use the owner id to access the user record from the map to check the name. \r\n\r\n trigger UpdateTeamOnOpp on Opportunity (before insert, before update) {\r\n /** @var ownerMap - map of Owner Ids to their matching Owner Record */\r\n Map < Id,User > ownerMap;\r\n /** @var oppOwnerIds - set of Opportunity Owner Ids from the inserted / updated records */\r\n Set < Id > oppOwnerIds = new Set < Id > ();\r\n /** @var nameOfOwner - will hold the name of the Oppturnity Owner */\r\n String nameOfOwner;\r\n \r\n for(Opportunity opps : trigger.new){ // loop through all updated/inserted opps\r\n oppOwnerIds.add(opps.OwnerId); // add the owner id to the set of owner ids\r\n System.debug(&#39;Opportunity Id&#39;+opps.OwnerId); \r\n } \r\n \r\n ownerMap = new Map < Id,User > ([SELECT Id, Name FROM User WHERE Id IN :oppOwnerIds]);\r\n \r\n for(Opportunity opps : trigger.new){ // loop through the updated/inserted opps again\r\n nameOfOwner = ownerMap.get(opps.OwnerId).Name; // use the opportunity owner id to grab the record from the map\r\n if (nameOfOwner == &#39;Test Bennett&#39;) { // check to see if owner name meets the test team criteria\r\n opps.Team_Name__c = &#39;Test&#39;; // if it does then set the Team to Test\r\n }\r\n }\r\n }\r\n\r\n \r\nAs an alternative you could use Process Builder: \r\n[![process builder working example][1]][1]\r\n\r\n\r\n [1]: _URL_1_", "80" ], [ "You could query the parent and subquery the children, you can run this example in the Developer console, just change the Account Name filter, to see the results: \r\n\r\n SELECT Name, (SELECT Name FROM Opportunities), (SELECT Name FROM Contacts) FROM Account WHERE Name = &#39;sForce&#39;\r\n\r\nTo Adrians point if you wanted only parents that had both types of children you could do semi-joins like: \r\n\r\n SELECT I<PERSON>, Name, (SELECT Name FROM Opportunities), (SELECT Name FROM Contacts) FROM Account WHERE Name = &#39;sForce&#39; \r\n AND I<PERSON> IN (SELECT AccountId FROM Contact WHERE FirstName = &#39;Jake&#39;) AND <PERSON><PERSON> IN (SELECT AccountId FROM Opportunity)\r\n\r\nOr just one of the children types like: \r\n\r\n SELECT <PERSON><PERSON>, Name, (SELECT Name FROM Opportunities), (SELECT Name FROM Contacts) FROM Account WHERE Name = &#39;sForce&#39; \r\n AND Id IN (SELECT AccountId FROM Contact WHERE FirstName = &#39;Jake&#39;)", "318" ], [ "Validation rules cannot be used to hide / unhide other fields. You would need to turn to Visualforce for that type of requirement.\r\n\r\nYou could use a validation rule to prevent modifications of the field when the checkbox is not checked.\r\n\r\nYou could potentially use a formula to show the contents of the text box only when the checkbox is checked but the text box would need to be displayed at some point or on a layout to allow for entry.", "223" ], [ "You can use the [iftex](_URL_0_) \" ;package \" ;. According to the documentation\r\n\r\n > This very simple package, for both Plain TeX and LaTeX,\r\ndefines the `\\ifPDFTeX`, `\\ifXeTeX`, and `\\ifLuaTeX` boolean\r\nfor testing whether PDFTeX, or XeTeX, or LuaTeX is being\r\nused for typesetting.", "558" ], [ "There are a number of ways of tackling this depending on how your directories are laid out. If you directory tree looks like\r\n\r\n -foo\r\n -foo1.tex\r\n -foo2.tex\r\n -baz.pdf\r\n -baz.eps\r\n -bar\r\n -bar1.tex\r\n -qux.pdf\r\n\r\nwhere the files in the `foo` and `bar` directories have unique names, then you can specify the `TEXINPUT` environment variable to include the sub-directories. The details of how to set `TEXINPUTS` depend on your distribution (e.g., TeXLive or MikTeX) and OS (e.g., Windows or Linux). In my opinion, this is the ideal setup since you are telling `tex` where to look for files. In this case your \" ;main \" ; file would look like\r\n\r\n \\section{Foo}\r\n \\subsection{Foo1}\r\n \\input{foo1}\r\n \\subsection{Foo2} \r\n \\input{foo2}\r\n \\section{Bar}\r\n \\subsection{Bar1}\r\n \\input{bar1}\r\n\r\nYou could also use `\\graphicspath` in this situation to set the directories to look for images in. In this case, the main file would look like\r\n\r\n \\graphicspath{{foo}{bar}}\r\n \\section{Foo}\r\n \\subsection{Foo1}\r\n \\input{foo/foo1}\r\n \\subsection{Foo2} \r\n \\input{foo/foo2}\r\n \\section{Bar}\r\n \\subsection{Bar1}\r\n \\input{bar/bar1}\r\n\r\nIf you directory tree looks like\r\n\r\n -foo\r\n -1.tex\r\n -2.tex\r\n -baz.pdf\r\n -baz.eps\r\n -bar\r\n -1.tex\r\n -qux.pdf\r\n -baz.pdf\r\n -baz.eps\r\n\r\nwhere the files in the `foo` and `bar` directories do not have unique names, then you cannot specify the `TEXINPUT` environment variable since it will not know which file you mean. You can still use `\\graphicspath`, but you have to set it before each `\\input`\r\n\r\n \\graphicspath{{foo}}\r\n \\section{Foo}\r\n \\subsection{Foo1}\r\n \\input{foo/1}\r\n \\subsection{Foo2} \r\n \\input{foo/2}\r\n \\graphicspath{{bar}}\r\n \\section{Bar}\r\n \\subsection{Bar1}\r\n \\input{bar/1}\r\n\r\nYou could also use the [`import`](_URL_0_) package.\r\n\r\n\r\n \\section{Foo}\r\n \\subsection{Foo1}\r\n \\import{foo/}{1}\r\n \\subsection{Foo2} \r\n \\import{foo/}{2}\r\n \\graphicspath{{bar}}\r\n \\section{Bar}\r\n \\subsection{Bar1}\r\n \\import{bar/}{1}\r\n\r\nThings get a little tricky with the `import` package if your directories are nested.", "523" ], [ "I&#39;m wondering if they mean that you can&#39;t set the profile object permission for the master field on the detail record. I am looking at a Profile at a Custom Object that is the detail (Line Items) to the Master record Invoice. I cannot modify the access to the field that relates to the Master Invoice as seen in this image, the field is grayed out and checked since it is required by default as noted in the Trailhead unit. \r\n\r\n > This creates a special type of relationship between two objects (the\r\n > child, or detail) and another object (the parent, or master). This\r\n > type of relationship closely links objects together such that the\r\n > master record controls certain behaviors of the detail and subdetail\r\n > record. In a master-detail relationship, the ownership and sharing of\r\n > detail records are determined by the master record, and when you\r\n > delete the master record, all of its detail records are automatically\r\n > deleted along with it. Master-detail relationship fields are always\r\n > required on detail records.\r\n\r\nIt might also be an error, you should submit your question as feedback on Trailhead.\r\n\r\nAdded 2 screenshots - > one with and one without the enhanced profile editor. (Click on Setup - > Profiles - > One of your Custom Profiles - > Object Settings or Scroll Down to Custom Object Permissions... Also note that I have Enabled Enhanced Profile User Interface under Setup - > User Interface)\r\n\r\n[![Enhanced Profile Editor][1]][1]\r\n[![Regular Profile Editor][2]][2]\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "858" ], [ "I have been unable to produce a working Tails USB on Linux Mint. I have tried many times using both command line and the software management front end yet always running into a some sort of road block. While I&#39;m brand new to Linux, it should not be this problematic. I&#39;ve been successful only at installing Tor on Linux Mint directly. Could you take a look at this folder&#39;s contents from this Tor installation and tell me if something is out of the ordinary? I will try a different distro to get Tails working or go with Whonix. \n\n_URL_0_", "4" ], [ "A couple things I would suggest: \r\n\r\n - Break this down and get one task accomplished at a time even if in a\r\n developer org or a separate sandbox.\r\n - You do not need to use the getter and setter methods\r\n - Before insert the Id of the lead will not be available so the keyset\r\n will be null and your leadidlist will not have any ids.\r\n - Eliminate all of your try and catch blocks and let the system handle\r\n it since you are really just eliminating errors and not handling\r\n them.\r\n - You are still only grabbing the first email, assuming this is not\r\n desired to use the 1st email on a lead for all remaining leads being\r\n inserted.\r\n - Add a system.debug at the beginning of your trigger and you should see that the trigger is indeed running but you are not getting the desired results\r\n\r\n \r\nI would do suggest doing something like: \r\n\r\n 1. Create a map of emails to the corresponding lead record.\r\n 2. Use the email keyset to query the matching contacts.\r\n 3. Create a map of emails to contactOwnerId\r\n 4. Reloop through the new leads and check the contact email map to see\r\n if it contains the lead email and update the ownerid.", "190" ], [ "I think the issue is with your handler class: if there are no Subject Visits left when you delete then you need to query the parent Site record not the child records. One approach I&#39;ve seen is to query the parent records with a subquery of the child records and setting the parent record to the size of the child list.\r\n\r\n this is handler class\r\n public class SubjectTriggerHandler {\r\n public static void perform(Set < Id > Ids){\r\n List < CTMS__Clinical_Site__c > CSToUpdate = new List < CTMS__Clinical_Site__c > ([SELECT Id, Subject_Visit_Count__c, (SELECT Id FROM CTMS__Subject_Visits__r) FROM CTMS__Clinical_Site__c WHERE Id IN :Ids]);\r\n \r\n \r\n for (CTMS__Clinical_Site__c site : CSToUpdate){\r\n site.Subject_Visit_Count__c = site.CTMS__Subject_Visits__r.size();\r\n }\r\n update CSToUpdate; \r\n }\r\n }", "721" ], [ "There&#39;s a badge for that! Trailhead has a great [unit][1] that walks you through the process. To simplify the install you can go [here][2] and install it as a managed package.\r\n\r\n > Step 2 - Install the SLDS Unmanaged Package\r\n > \r\n > The easiest way to get started is to install the latest Salesforce\r\n > Lightning Design System unmanaged package, which includes the Design\r\n > System as a static resource zip file.\r\n > \r\n > Log in to your developer org\r\n > \r\n > In a separate browser window, go to the Salesforce Lightning Design\r\n > System [downloads][2] page, look under the Design System Unmanaged Packages\r\n > section, and click on the latest unmanaged package. Press Install to\r\n > install it. This will install the package in your Salesforce org. The\r\n > unmanaged package includes the Salesforce Lightning Design System as a\r\n > static resource zip file\r\n\r\n \r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "487" ], [ "As <PERSON> pointed out since you will need access to the opportunity id you want to use after vs before. Below is a great visual flow chart of when to use which, read the full article [here][1]. \r\nAlso be careful as you are attempting to do an insert on the NwTask variable on line 16 which is inside of a for loop and is not following bulkification best practices. Since you have a list of tasks and are adding the task to that list you will want to perform the dml operation on the entire list outside of the for loop. \r\nInside of the IsUpdate section of your trigger you are creating the tasks but you are not inserting them but again make sure to insert the entire list outside of the for loop. \r\nAlso to note in your isupdate section of your trigger you are querying all opportunities not just items being updated. Not sure what the business logic is here but you definitely do not want to proceed with it the way it is. I would recommend starting with the after insert and get that all buttoned up and then move into the after update. \r\n[![sfdc99][2]][2]\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "310" ], [ "I&#39;m not sure if you didn&#39;t copy all of your code over or not but I do not see a variable named courseId. Also from the [developer guide][1]... \r\n\r\n > The < apex:param > component can only be a child of the following\r\n > components:\r\n > \r\n > < apex:actionFunction > \r\n > < apex:actionSupport > \r\n > < apex:commandLink > \r\n > < apex:outputLink > \r\n > < apex:outputText > \r\n > < flow:interview > \r\n\r\nThere is an awesome blog that will walk you through an example as well [here][2].\r\nExample from the blog: \r\n \r\n > \r\n > < apex:commandButton value= \" ;Del \" ; action= \" ;{!delCont} \" ; rerender= \" ;all \" ; > \r\n > < apex:param name= \" ;contIdParam \" ; value= \" ;{!_URL_0_} \" ; assignTo= \" ;{!contIdChosen} \" ;/ > \r\n > < /apex:commandButton > \r\n > \r\n > `public String contIdChosen {get; set;}`\r\n\r\n \r\n\r\n[1]: _URL_2_\r\n [2]: _URL_1_", "454" ], [ "I have IPv6 disabled in Internet Settings for this eth0 connection (Linux Mint) yet IPv6 addresses are still shown in the output of ifconfig. I have come to believe that it is best when using Tor to have IPv6 disabled for reasons of security. Do you agree? Is there a better, more fail safe way to completely disable IPV6 so even if Tor config files get compromised, IPv6 cannot be used? Here is my ifconfig. I would like to not see those IPv6 addresses. \r\n\r\n\r\n mint@mint ~ $ ifconfig\r\n eth0 Link encap:Ethernet HWaddr 00:XX:XX:XX:XX:XX \r\n inet addr:<IP_ADDRESS> Bcast:<IP_ADDRESS> Mask:<IP_ADDRESS>\r\n inet6 addr: XXXXX:e825/64 Scope:Global\r\n inet6 addr: XXXXX:e825/64 Scope:Link\r\n inet6 addr: XXXXX:422a/64 Scope:Global\r\n UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1\r\n RX packets:29311 errors:0 dropped:0 overruns:0 frame:0\r\n TX packets:17058 errors:0 dropped:0 overruns:0 carrier:0\r\n collisions:0 txqueuelen:1000 \r\n RX bytes:33554675 (33.5 MB) TX bytes:3450446 (3.4 MB)\r\n Interrupt:17 \r\n\r\n lo Link encap:Local Loopback \r\n inet addr:<IP_ADDRESS> Mask:<IP_ADDRESS><PHONE_NUMBER> Mask:<PHONE_NUMBER>\r\n inet6 addr: XXXXX:e825/64 Scope:Global\r\n inet6 addr: XXXXX:e825/64 Scope:Link\r\n inet6 addr: XXXXX:422a/64 Scope:Global\r\n UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1\r\n RX packets:29311 errors:0 dropped:0 overruns:0 frame:0\r\n TX packets:17058 errors:0 dropped:0 overruns:0 carrier:0\r\n collisions:0 txqueuelen:1000 \r\n RX bytes:33554675 (33.5 MB) TX bytes:3450446 (3.4 MB)\r\n Interrupt:17 \r\n\r\n lo Link encap:Local Loopback \r\n inet addr:127.0.0.1 Mask:255.0.0.0\r\n inet6 addr: <IP_ADDRESS>1/128 Scope:Host\r\n UP LOOPBACK RUNNING MTU:65536 Metric:1\r\n RX packets:40397 errors:0 dropped:0 overruns:0 frame:0\r\n TX packets:40397 errors:0 dropped:0 overruns:0 carrier:0\r\n collisions:0 txqueuelen:0 \r\n RX bytes:13958224 (13.9 MB) TX bytes:13958224 (13.9 MB)\r\n\r\nNOTE: Can someone also explain how to use this site&#39;s formatting options to format posts like this that contain log files or ifconfig stuff like this?", "168" ], [ "Interesting. So when I&#39;m connecting on a regular desktop without the icon and I get the first window showing I&#39;m connected, it&#39;s actually \" ;safe \" ; to assume I&#39;m connected and don&#39;t have to wait any longer? It sounds like a stupid question, yet the time difference between this and the other is so vast that it concerns me. Maybe the previous long wait in Tails had something to do with the connection problem I was having with Tails/Tor, that you already know about. Thanks <PERSON>.", "873" ], [ "LOL good one. Ubuntu (mint) is what I&#39;m learning now. Yet I could toss it for any Linux distro. There&#39;s much to be done to get it as secure and private as Tails claims to be. I&#39;m done with my grand tour of the dark web trying everything out like a big buffet of sin, so my interest in security and privacy is not dire and paranoid any longer, rather just a hobby, which is nice. It&#39;s curious that a Tor forum like this is public. Due to the very of nature of what Tor is, you&#39;d think many users would not want to discuss matters on the clear net. I guess that&#39;s a topic for another thread.", "4" ], [ "The following is my `torrc-defaults` file. I&#39;m trying to learn this stuff so I don&#39;t have to ask this kind of question here, yet I&#39;m still in the dark about much of this. So I&#39;m asking for feedback in regard to the lines pertaining to SOCKS and FTEproxy. Does this all look okay? What if I do not want IPV6? Can I change that line - and if so, to what?\r\n\r\n AvoidDiskWrites 1\r\n SocksPort 9150 IPv6Traffic PreferIPv6 KeepAliveIsolateSOCKSAuth\r\n ControlPort 9151\r\n CookieAuthentication 1\r\n ClientTransportPlugin fte exec ./TorBrowser/Tor/PluggableTransports/fteproxy.bin --managed\r\n ClientTransportPlugin obfs2,obfs3,obfs4,scramblesuit exec ./TorBrowser/Tor/PluggableTransports/obfs4proxy\r\n ClientTransportPlugin meek exec ./TorBrowser/Tor/PluggableTransports/meek-client-torbrowser -- ./TorBrowser/Tor/PluggableTransports/meek-client", "580" ], [ "As mentioned in the comments you cannot move data from the Sandbox to the Production environment using Eclipse. You could use the dataloader or a free tool like Jitterbit to export and then import your data. For other ideas on how to move the data see this question [here][1]. The question asks about moving production data to the sandbox but the same applies for sandbox to production. Keep in mind the Salesforce Ids will not be the same in the two different environments so you will need to do something to deal with any child records, like using an external id.\r\n\r\n\r\n [1]: _URL_0_", "3" ], [ "I can see both sides here. It&#39;s seems to be a grey area with a nod toward being Tor relevant. Here&#39;s a sound deductive argument based on premises that are 100% true. IPV6 does pose a potential security risk when enabled while using Tor. Tor&#39;s config files have been known to be compromised and altered by either some adversary or bug. Therefore it is of relevance to discuss how to disable IPV6 and/or other protocols outside the scope of Tor for the very sake of running Tor securely. Ifconfig is the very means to determine what protocols are enabled. continued....", "580" ], [ "It might be wise, depending on the IPV6 threat model to disable IPV6 at the kernel. This can be done via sysctl\n\n$ sudo gedit /etc/sysctl.conf\n\nAdd the following lines to the end of the file. Save, then close the file.\n\n# IPv6 disabled\nnet.ipv6.conf.all.disable_ipv6 = 1\nnet.ipv6.conf.default.disable_ipv6 = 1\nnet.ipv6.conf.lo.disable_ipv6 = 1\n\nrestart sysctl with \n\n$ sudo sysctl -p\n\ncheck ifconfig. no IPV6 addresses should be listed.\n\nThere, I figured it out on my own. You can delete this now. Thanks.", "168" ], [ "<PERSON> Easiest way would be to create an external Id on the parent obect and then when you insert the parent records set that Id field to the sandbox Id. Then insert the child record using the externalid to match them. Use a dataloader to do the imports, you should probably also clear out the externalid field when you are done since it&#39;s a one time update. I wrote a blog post awhile back on the opposite direction using jitterbit but the concept is the same, _URL_0_", "905" ], [ "Yes, there is a basic example in this trailhead [unit][1]: \r\n\r\n < apex:page showHeader= \" ;false \" ; standardStylesheets= \" ;false \" ; sidebar= \" ;false \" ; applyHtmlTag= \" ;false \" ; applyBodyTag= \" ;false \" ; docType= \" ;html-5.0 \" ; > \r\n \r\n < html xmlns= \" ;_URL_2_; xmlns:xlink= \" ;_URL_1_; \r\n \r\n < head > \r\n < title > Salesforce Lightning Design System Trailhead Module < /title > \r\n < apex:stylesheet value= \" ;{!URLFOR($Resource.REPLACE_WITH_NAME_OF_SLDS_STATIC_RESOURCE, &#39;assets/styles/salesforce-lightning-design-system-vf.css&#39;)} \" ; / > \r\n < /head > \r\n \r\n < body > \r\n \r\n < !-- REQUIRED SLDS WRAPPER -- > \r\n < div class= \" ;slds \" ; > \r\n \r\n < !-- MASTHEAD -- > \r\n < p class= \" ;slds-text-heading--label slds-m-bottom--small \" ; > \r\n Salesforce Lightning Design System Trailhead Module\r\n < /p > \r\n < !-- / MASTHEAD -- > \r\n \r\n < !-- PRIMARY CONTENT WRAPPER -- > \r\n < div class= \" ;myapp \" ; > \r\n \r\n < !-- SECTION - BADGE COMPONENTS -- > \r\n < section aria-labelledby= \" ;badges \" ; > \r\n < h2 id= \" ;badges \" ; class= \" ;slds-text-heading--large slds-m-vertical--large \" ; > Badges < /h2 > \r\n < div > \r\n < span class= \" ;slds-badge \" ; > Badge < /span > \r\n < span class= \" ;slds-badge slds-theme--inverse \" ; > Badge < /span > \r\n < /div > \r\n < /section > \r\n < !-- / SECTION - BADGE COMPONENTS -- > \r\n \r\n < /div > \r\n < !-- / PRIMARY CONTENT WRAPPER -- > \r\n \r\n < /div > \r\n < !-- / REQUIRED SLDS WRAPPER -- > \r\n \r\n < /body > \r\n < /html > \r\n < /apex:page > \r\n\r\n\r\n\r\n [1]: _URL_0_", "811" ], [ "This appears to be a class that is called by a Trigger more than likely before insert but could also be before update. If you look at your Accreditation__c custom object you should see the corresponding trigger and in there you will see how it is calling this method. \r\nAssuming this is before insert because it appears that it is assuming the account primary contact is not already set on the Accreditation__c record. Also assuming it is before and not after because there are no dml statements in the method. Lists are basically passed by reference in that the list sent in is being updated by the method so you do not need to return anything. Assuming my assumptions are correct the following is occurring: \r\n1. Records are being inserted \r\n2. The records being inserted cause the before insert trigger to run \r\n3. The trigger checks to see if it is before insert and creates an instance of this class \r\n4. Then the method on this instance is called and passed in the list of records that caused the trigger to run", "310" ], [ "From the help docs [here][1] it states that... \r\n\r\n > You can include these Salesforce objects in custom navigation menus:\r\n > Accounts, **Assets**, Campaigns, Cases, Contacts, Files, Dashboards,\r\n > Events, Knowledge Articles, Leads, Opportunities, Price Books,\r\n > Products, Reports, Tasks, Tenants, Work Orders, and your custom\r\n > objects. You can also add Home, the main Chatter feed, Groups, and\r\n > People.\r\n\r\nHowever, I do not see a way to add the Assets to the Navigation Menu. [![Nav Menu][2]][2] \r\n\r\nIs there something special I need to do in order to have Assets as an option?\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "340" ], [ "The issue could be related to this one from the knowledge article [here][1]: \r\n\r\n > **Description**\r\n\r\n > This error occurs on a VisualForce page when a related list is being\r\n > referenced but isn&#39;t available on the user&#39;s page. An example of this\r\n > error would be\r\n > \r\n > &#39;OpenActivities&#39; is not a valid child relationship name for\r\n > entityOpportunity.\r\n > \r\n > The problem can appear confusing when the related list is actually\r\n > added to the page layout by the system administrator.\r\n > \r\n > **Resolution**\r\n > \r\n > \r\n > However the related list has been removed by the individual user (it\r\n > doesn&#39;t appear only for the user receiving the error message). The\r\n > related list can be added back in by going to:\r\n > \r\n > Setup | My Personal Information | Change My Display | Customize My\r\n > Pages | Select the (custom/standard object) from the list | Customize\r\n > My Pages.\r\n > \r\n > Add the related list that is referenced at the start of the error\r\n > message into the selected list and click save. This should resolve the\r\n > error message.\r\n\r\nNote: Some child relationship names are not the plural of the object name like the following: \r\nHTML Email Status: \" ;EmailStatuses \" ;, Activity History: \" ;ActivityHistories \" ;, Notes and Attachments: \" ;NotesAndAttachments \" ;, Approval History: \" ;ProcessSteps \" ;, Campaign History: \" ;CampaignMembers \" ;.\r\n\r\n[1]: _URL_0_", "789" ], [ "Test.isRunningTest() is meant to be used in the class that the test is testing not in the test class itself. See the docs [here][1] for more information on that method. \r\n\r\n > Returns true if the **currently executing code** was called by code\r\n > contained in a test method, false otherwise. Use this method if you\r\n > need to run different code depending on whether it was being called\r\n > from a test.\r\n\r\nFound a helpful article [here][2] that goes over examples of when to use the method. \r\n\r\n > **Other Usage scenarios:**\r\n > \r\n > 1) To ensure the trigger doesn&#39;t execute the batch if\r\n > Test.IsRunningTest() is true, and then test the batch class with it&#39;s\r\n > own test method.\r\n > \r\n > 2) Testing callouts - in your callout code you check to see if you&#39;re\r\n > executing within a unit test context by checking Test.isRunningTest()\r\n > and instead of getting your callout response from an\r\n > HttpResponse.send() request, you return a pre-built test string\r\n > instead.\r\n\r\n \r\n\r\n[1]: _URL_1_\r\n [2]: _URL_0_", "738" ], [ "If your end goal is to create an unmanaged package you shoud be able to do that right in the developer org. For a nice walkthrough go [here][1], it walks you through creating a simple class and packing it up in a Developer org.\r\n\r\n > To get going, log in to your Developer Environment and then go to\r\n > Setup - > Develop - > Apex Classes to create the class.\r\n > \r\n > Now you&#39;re ready to create a package, so navigate to Setup - > Create\r\n > - > Packages. Hit \" ;New \" ; to start. After providing a name for the package (SimplePackage), you&#39;ll be given the opportunity to add\r\n > package components. Packages are collections of components, and these\r\n > components range the gamut of the _URL_1_ Platform. For example, you\r\n > can package an Apex class, a Visualforce page, triggers, email\r\n > templates, documents and workflow rules (see references at bottom for\r\n > links to entire list). For this tutorial, click “Add” and select a\r\n > component type of \" ;Apex Class \" ; and select the SimpleClass defined\r\n > above. You&#39;ll end up with a package definition that looks similar to\r\n > the following figure.\r\n\r\n \r\n\r\n[1]: _URL_0_", "483" ], [ "I am trying to get two pieces of text to align vertically. While I could probably do this with boxes, minipages, or a table, I was trying to adjust the alignment with `\\vspace` (somewhat as a learning exercise). In the following MWE the horizontal rules line up with the `article` class, but not with the `minimal` class. With the `minimal` class I am removing too much space (I think).\r\n\r\n %\\documentclass{minimal}\r\n \\documentclass{article}\r\n \\usepackage{graphicx}\r\n \\newsavebox{\\boxa}\r\n \r\n \\begin{document}\r\n \t\\savebox{\\boxa}{\\parbox[b]{\\textwidth}{%\r\n \t\t\\hrule Xg\\par%\r\n \t\t\\includegraphics{example-image}\\par%\r\n \t}}%\r\n \t\\hrule Xg\\par%\r\n \t\\includegraphics{example-image}\\par%\r\n \t\\vspace{-\\ht\\boxa}%\r\n \t\\vspace{-\\dp\\boxa}%\r\n \t\\vspace{-\\parskip}%\r\n \t\\nointerlineskip%\r\n \t\\hrule Xg\\par%\r\n \t\\includegraphics{example-image}\\par%\r\n \\end{document}\r\n\r\nI know the `minimal` class does not do a lot of things that are useful, but I don&#39;t understand what vertical space I am missing in this example.", "54" ], [ "Should a question be closed if the issue is a duplicate but the question is asked differently. Example: this question [here][1] and this question [here][2] where caused by the same issue but the way the questions were asked could make it hard for someone else coming along to find it. It felt wrong answering it again but I thought there might be value in leaving it in case others ran into it in the future?\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "10" ], [ "You should just be able to setup your query like: \r\n\r\n SELECT Id, Name , Isactive, SobjectType from RecordType\r\n WHERE (SobjectType = &#39;Insurance_Product__c&#39; AND IsActive = true) OR\r\n \t (SobjectType = &#39;Policy__c&#39; AND IsActive = false) \r\nwhich will return both Active Insurance Product Record Types and InActive Policy Record types. \r\n\r\nNote: otherwise you will definitely need to do a separate query as you can not do self inner joins as stated in the docs [here][1]: \r\n\r\n > You cannot query on the same object in a subquery as in the main\r\n > query.\r\n\r\n [1]: _URL_0_", "720" ], [ "@Pavantej - glad to hear you got it working, I would suggest writing down the steps to test this in the UI and then creating the test data and step through those steps in the test class. Use asserts to assert the expected outcome. If you get stuck or have issues please open a new question with what your class and test class have and where you are getting stuck.", "738" ], [ "[FreeSurfer](_URL_0_) makes inferences about volume, through the calculation of the surface of the brain. The parametric method (used in SPM) is a voxel-based statistics. \r\n\r\nFreeSurfer analysis does not map the brain using the traditional Brodmann&#39;s areas (BA) (at least not [entirely](_URL_1_)), instead it uses the Desikan-Killiany Atlas (DKA).\r\n\r\nResearchers that are used to think about the brain regions considering the BAs, may have a hard time to relocate them in terms of DKA. Is there a table with equivalence that one can use in order to translate from one into the other?", "13" ], [ "I am using the current version of Tails. I more often than not get the warning icon at the bottom left of the connection window telling me that the log file has been copied to the clip board. I will eventually connect with a green onion yet it takes quite a bit of time. I could use some feedback on this log. This log is from today at around 1pm, so the date/time is wrong. Also, there were so many repeats of the first line that I had to delete most of them in order to make them this post fit here on this forum.\r\n\r\n\r\n 02/12/2016 00:09:47.800 [NOTICE] New control connection opened from <IP_ADDRESS>. \r\n 02/12/2016 00:09:56.900 [NOTICE] DisableNetwork is set. Tor will not make or accept non-control network connections. Shutting down all existing connections. \r\n 02/12/2016 00:09:56.900 [NOTICE] Opening Socks listener on <IP_ADDRESS>:9150 \r\n 02/12/2016 00:09:56.900 [NOTICE] Opening DNS listener on <IP_ADDRESS>:5353 \r\n 02/12/2016 00:09:56.900 [NOTICE] Opening Transparent pf/netfilter listener on <IP_ADDRESS>:9040 \r\n 02/12/2016 00:09:56.900 [NOTICE] Renaming old configuration file to \" ;/etc/tor/torrc.orig.1 \" ; \r\n 02/12/2016 00:09:57.200 [NOTICE] New control connection opened from <IP_ADDRESS>. \r\n 02/12/2016 00:09:58.600 [NOTICE] Bootstrapped 5%: Connecting to directory server \r\n 02/12/2016 00:09:58.600 [NOTICE] Bootstrapped 10%: Finishing handshake with directory server \r\n 02/12/2016 00:09:58.800 [WARN] Proxy Client: unable to connect to <IP_ADDRESS>:51867 ( \" ;server rejected connection \" ;) \r\n 02/12/2016 00:10:33.900 [NOTICE] Closing no-longer-configured Transparent pf/netfilter listener on <IP_ADDRESS>:9040 \r\n 02/12/2016 00:10:33.900 [NOTICE] Closing no-longer-configured DNS listener on <IP_ADDRESS>:5353 \r\n 02/12/2016 00:06:38.900 [NOTICE] Bootstrapped 5%: Connecting to directory server \r\n 02/12/2016 00:06:38.900 [NOTICE] Bootstrapped 10%: Finishing handshake with directory server \r\n 02/12/2016 00:06:39.000 [WARN] Proxy Client: unable to connect to <IP_ADDRESS>:58693 ( \" ;server rejected connection \" ;) \r\n 02/12/2016 00:06:39.000 [WARN] Proxy Client: unable to connect to <IP_ADDRESS>:44912 ( \" ;server rejected connection \" ;) \r\n 02/12/2016 00:06:39.400 [NOTICE] Bootstrapped 15%: Establishing an encrypted directory connection \r\n 02/12/2016 00:06:39.500 [NOTICE] Bootstrapped 20%: Asking for networkstatus consensus \r\n 02/12/2016 00:06:39.800 [NOTICE] new bridge descriptor &#39;consolsmeringue&#39; (fresh): $9B1E39F667DBD7749CC653A7B2632A9D75DB1D27~consolsmeringue at <IP_ADDRESS> \r\n 02/12/2016 00:06:39.800 [NOTICE] I learned some more directory information, but not enough to build a circuit: We have no usable consensus. \r\n 02/12/2016 00:06:40.000 [NOTICE] Bootstrapped 25%: Loading networkstatus consensus \r\n 02/12/2016 00:06:40.900 [NOTICE] I learned some more directory information, but not enough to build a circuit: We have no usable consensus. \r\n ] Closing old Socks listener on <IP_ADDRESS><PHONE_NUMBER> \r\n 02/12/2016 00:06:39.800 [NOTICE] I learned some more directory information, but not enough to build a circuit: We have no usable consensus. \r\n 02/12/2016 00:06:40.000 [NOTICE] Bootstrapped 25%: Loading networkstatus consensus \r\n 02/12/2016 00:06:40.900 [NOTICE] I learned some more directory information, but not enough to build a circuit: We have no usable consensus. \r\n ] Closing old Socks listener on 127.0.0.1:9150", "921" ], [ "Know that you can and should prolly get Tails support from the Tails folks directly. Although I suppose this here too works. I can&#39;t help you with your resoltion issue. I&#39;m sure the Tails team know all about it, and so if you strike out here - go ask them. I am aware that MacBooks are known to have graphical issues with Tails - at least previous versions of Tails. There might not be a fix at the moment, but don&#39;t take my word for it. Be happy that your system works at all! Many people, including myself, had to go through a number of computers to get one to boot Tails properly. Every time I get", "424" ], [ "Tested on a public wifi and I&#39;m getting the same exact log entries. I am using a preliminary Tails Micro SD (not made with the Tails installer rather the universal USB installer) I don&#39;t know if that&#39;s relevant here. I&#39;ll go into why I&#39;m forced to use this if it&#39;s relevant. \n\nIt seems I must be using an adulterated Tails installation. I downloaded the iso via a torrent which I thought was fool-proof. I did not check SHA or PGP because I didn&#39;t think I had to with a torrent. Should I share the torrc and torsocks.conf file contents? Might the answer be in these files?", "915" ], [ "This is a intermediary Tails installation on a Micro SD card. During Tails startup, I set a root password at the intro window so I can make changes - Once Tails has loaded, I use the root terminal to take ownership of the torrc file so I can modify it (I don&#39;t know if this is what I&#39;m suppose to do - if I don&#39;t do this, I don&#39;t know how else to modify the file as the amnesia user does not have permission.) This torrc file is located at etc/tor. I modify it, then reboot, and my changes are gone and I&#39;m back to the previous config.", "708" ], [ "It depends on the day. For now, it&#39;s a dual-core HP Windows 7 laptop bought used to be a throw-away. I just finished installing Linux Mint. I was also considering Ubuntu MATE instead of mint? When booted into Mint, I cannot reach the Tails site via Firefox to do anything such as download the iso as I am getting an untrusted connection window.", "4" ], [ "From the help docs [here][1]: \r\n\r\n\t\r\n\r\n > First, double click on the SFO system tray icon (as explained above)\r\n > to open the actual error message with the details. If the error\r\n > message says \" ;Required fields are missing: [LastName] \" ; then follow the\r\n > steps below to resolve the issue. \r\n > \r\n > \r\n > 1- You can click on the contact name on the SFO error screen (it is in\r\n > a form of hyperlink that you can click on to open the contact in\r\n > Outlook) to open the contact&#39;s detail page 2- Click on Full name \r\n > 3- The “Check Full Name \" ; windows will open 4- Update the Last name\r\n > as it is a mandatory field in Salesforce. If your contact does not\r\n > have a Last Name or you are syncing a company as a contact, or for any\r\n > reasons you do not have a Last name you can use a dot \" ;. \" ; or comma \" ;, \" ;\r\n > or such to populate the Last Name field 5- Click OK and then click\r\n > on Save & Close \r\n > \r\n > You may have to repeat steps 1-5 if you have more than contact with\r\n > missing Last Name \r\n > \r\n > The screen shot below is from Outlook 2007 but the steps are the same\r\n > for other versions of Outlook [![User-added image][2]][2] \r\n > \r\n > 6- Click on Retry on the SFO error screen or if you have already\r\n > closed it, right click on SFO system tray icon and click on Sync |\r\n > Sync Now \r\n > \r\n > 7- Sync should complete successfully and you should not see that error\r\n > message again\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "925" ], [ "A few things jump out at me: \n1. Your trigger comment states after update and before insert but your trigger is set to only fire `(after update)` \n2. You do not need to create a set of Ids as the trigger.newMap has the keytset available for you. \n3. You are querying for a single lead record and then a single contact record but not sure why or where you are using that. \n4. Then you are using the keyset to get the lead records but limiting it to 1... \nYou might want to take a step back and read more about bulkification & triggers.", "310" ], [ "I would suggest marking your TestDataGenerator with @isTest for an example of creating test data see the Trailhead module [here][1]. \r\nWhen you are testing your extension maybe try and think about how you would test it in the UI then replicate those steps in your test class. This should also include navigating to the page and simulating clicking buttons or calling methods. You should then also assert what you believe should happen when the different actions are performed. Take a look at the testing best practices docs [here][2] for an example. Don&#39;t test just to cover lines of code, test to ensure your application is working as you expected. \r\nExample from docs: \r\n\r\n > public static testMethod void testMyController() {\r\n > \r\n > //Use the PageReference Apex class to instantiate a page\r\n > PageReference pageRef = Page.success;\r\n > \r\n > //In this case, the Visualforce page named &#39;success&#39; is the starting point of this test method. \r\n > Test.setCurrentPage(pageRef);\r\n > \r\n > //Instantiate and construct the controller class. \r\n > thecontroller controller = new thecontroller();\r\n > \r\n > //Example of calling an Action method. Same as calling any other Apex method. \r\n > //Normally this is executed by a user clicking a button or a link from the Visualforce\r\n > //page, but in the test method, just test the action method the same as any \r\n > //other method by calling it directly. \r\n > \r\n > //The .getURL will return the page url the Save() method returns.\r\n > String nextPage = controller.save().getUrl();\r\n > \r\n > //Check that the save() method returns the proper URL.\r\n > System.assertEquals(&#39;/apex/failure?error=noParam&#39;, nextPage);\r\n > \r\n > //Add parameters to page URL\r\n > ApexPages.currentPage().getParameters().put(&#39;qp&#39;, &#39;yyyy&#39;);\r\n > \r\n > //Instantiate a new controller with all parameters in the page\r\n > controller = new thecontroller(); \r\n > \r\n > //Example of calling the &#39;setter&#39; method for several properties. \r\n > //Normally these setter methods are initiated by a user interacting with the Visualforce page, \r\n > //but in a test method, just call the setter method directly. \r\n > controller.setLastName(&#39;lastname&#39;);\r\n > controller.setFirstName(&#39;firstname&#39;);\r\n > controller.setCompany(&#39;acme&#39;);\r\n > controller.setEmail(&#39;<EMAIL_ADDRESS>&#39;);\r\n > nextPage = controller.save().getUrl();\r\n > \r\n > //Verify that the success page displays\r\n > System.assertEquals(&#39;/apex/success&#39;, nextPage);\r\n > \r\n > }\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "738" ] ]
205
[ 5505, 7363, 4638, 8133, 11218, 7377, 6662, 13931, 4635, 16774, 8348, 15688, 4430, 9069, 3641, 624, 17488, 5929, 433, 6629, 7360, 549, 8728, 10200, 19643, 13566, 5876, 12346, 16985, 14778, 5527, 1172, 18307, 7288, 15479, 6628, 647, 11023, 7313, 18680, 11478, 16490, 64, 1735, 14815, 13815, 11802, 188, 8352, 18802, 16998, 15561, 9168, 17839, 5973, 7514, 19587, 1631, 18217, 12500, 8543, 7134, 13086, 19324, 5983, 1888, 1694, 6132, 10438, 5481, 4780, 7100, 8699, 14330, 6097, 5419, 7714, 5422, 7152, 17929, 17878, 771, 1309, 12517, 7256, 19656, 14868, 13211, 3616, 9560, 7016, 13556, 10494, 17152, 12755, 13082, 1683, 18048, 11216, 17135, 10717, 4678, 4382, 7933, 14688, 6909, 7064, 3987, 16628, 4374, 3605, 5912, 9084, 3603, 4313, 7023, 9156, 3784, 9676, 14782, 11672, 7028, 4413, 762, 11749, 11837, 13928, 11636, 5959, 10394, 5877, 19121, 11310, 3516, 15484, 7284, 10510, 11701, 16159, 6966, 9583, 10459, 4419, 17430, 12438, 1076, 16465, 10411, 711, 11809, 16915, 4307, 4228, 7706, 13120, 4633, 7538, 12722, 18001, 10509, 10730, 757, 5880, 9510, 14950, 13590, 464, 4661, 848, 14100, 9541, 10762, 18116, 9009, 6618, 7412, 3932, 6727, 3130, 11472, 4448, 17186, 3622, 18915, 11179, 1862, 1395, 13133, 6941, 2181, 19689, 7465, 18378, 14644, 16320, 7571, 4376, 15071, 16993, 4021, 9998, 2166, 15334, 6652, 8938, 13639, 9712, 9179, 168, 7655, 13762, 3325, 4620, 19725, 15576, 4299, 3490, 7584, 6129, 11883, 15917, 10457, 10149, 7444, 12844, 110, 15640, 12889, 18903, 4569, 2120, 10835, 13704, 19664, 9859, 11429, 6923, 14028, 7137, 5342, 10497, 11254, 3787, 14144, 3371, 4753, 12822, 7490, 9519, 9567, 6161, 15068, 17328, 2978, 5162, 4978, 15609, 2954, 6958, 19415, 16965, 12945, 753, 12592, 718, 9792, 16941, 3983, 7040, 15732, 6442, 1040, 3900, 5159, 7061, 9067, 17061, 12856, 17073, 1964, 4146, 6867, 11789, 3284, 9376, 126, 16550, 18368, 15586, 18711, 1693, 11108, 3238, 717, 5654, 211, 10096, 6456, 19414, 11720, 3981, 15606, 5589, 19737, 6315, 17594, 9714, 18073, 16834, 8341, 1240, 15445, 11999, 18275, 7042, 18700, 843, 7872, 556, 6972, 12717, 1208, 4186, 6819, 2858, 14143, 9928, 14621, 12812, 14273, 9756, 19068, 9700, 5232, 11400, 3844, 7220, 10919, 4609, 11466, 10871, 4673, 18325, 15940, 8048, 2733, 13725, 6514, 3189, 17968, 2654, 13778, 6699, 13685, 6468, 13044, 12250, 16277, 1607, 3235, 18586, 12828, 4904, 6114, 8141, 16072, 10789, 9745, 4323, 17030, 12220, 9701, 11160, 5320, 16405, 7448, 6078, 12795, 12335, 12248, 9661, 3963, 526, 3779, 10038, 8984, 10150, 17438, 6792, 12193, 9793, 4848, 15038, 15458, 11119, 9962, 2831, 13657, 11774, 2404, 10483, 10681, 12769, 322, 10151, 5751, 7092, 5964, 18184, 4896, 2354, 17155, 8762, 10685, 10957, 8932, 3654, 783, 6076, 11228, 1100, 19621, 817, 732, 3698, 12, 8106, 7439, 17867, 2501, 4563, 15470, 6975, 8964, 13038, 1156, 17909, 8716, 2583, 1671, 7249, 5440, 14255, 4330, 18297, 2869, 599, 13686, 11543, 6926, 13880, 13273, 9961, 8662, 19232, 18402, 19304, 8483, 15224, 1818, 11003, 12501, 13336, 18454, 19469, 10989, 2315, 7805, 944, 17523, 6586, 16458, 3418, 19705, 5613, 5448, 1054, 8177, 7333, 9021, 10046, 11903, 17346, 2206, 17183, 5421, 17343, 9543, 12298, 9682, 6388, 232, 6122, 13174, 5801, 152, 15481, 16106, 9577 ]
STX_100397.0
[ [ "I would imagine that you need to convert your image file to a block device before `dmcrypt` can handle it. Here we use the `loop` device, which allows us to present a block interface to the named file:\r\n\r\n # Create a loop device and capture its name\r\n lodev=$(losetup --show --find /home/crash/Documents/128gb.img)\r\n echo \" ;Using device $lodev for the image \" ; > & 2\r\n\r\n # Map the crypto layer on to the loop block device\r\n dmsetup create crypt6 --table \" ;<PHONE_NUMBER> crypt aes-cbc-essiv:sha256 HEXIDECIMALPASSPHRASEHERE 0 $lodev 0 \" ;\r\n\r\n ...\r\n # Delete the loop device when we have finished with it\r\n losetup -d \" ;$lodev \" ;\r\n\r\n\r\nActually, using this configuration you could replace your constant `250048479` with a call back to `blockdev` (notice I&#39;m also using the more modern `$(...)` rather than backticks `` `...` ``):\r\n\r\n dmsetup create crypt6 --table \" ;0 $(blockdev --getsize \" ;$lodev \" ;) crypt aes-cbc-essiv:sha256 HEXIDECIMALPASSPHRASEHERE 0 $lodev 0 \" ;", "929" ], [ "You&#39;re adding a new disk. There should be little reason why you can&#39;t set that new disk up for LVM, copy your data across in its entirety, and then bring the old partition into the existing LVM configuration. Just make sure you&#39;re taking backups. If either of your two disks dies the entire LVM configuration may be wiped out. (Similar to RAID 0.)", "228" ], [ "The [man page for `hosts.deny`](_URL_0_) (`man hosts.deny`) explains the order of processing:\r\n\r\n > The access control software consults two files. The search stops at the first match:\r\n > \r\n > * Access will be granted when a (daemon,client) pair matches an entry in the /etc/hosts.allow file.\r\n > * Otherwise, access will be denied when a (daemon,client) pair matches an entry in the /etc/hosts.deny file.\r\n > * Otherwise, access will be granted.\r\n\r\nSo from this you can see that it is quite safe to delete `/etc/hosts.deny` (and `/etc/hosts.allow`, for that matter).\r\n\r\nNow, as to your question regarding the automatic deletion - or not - of `/etc/hosts.deny` when you uninstall `denyhosts`. This file - and its complement `/etc/hosts.allow` - belongs to `tcp_wrappers` so it is not for `denyhosts` to remove it when you uninstall it.", "92" ], [ "Here is a community version of the answer by [Yokai](_URL_0_) that incorporates examples offered by [<PERSON>_).\r\n\r\n--------\r\nYou can use the tool called `xdotool` to control window size and location. Not only that, any script you write in `bash`, using `xdotool`, can be setup to work with a fully maximized window and it can be scripted to set the window size and x:y coordinates by manipulating the `mousemove` and `click` commands.\r\n\r\n1. Find the window ID:\r\n\r\n xdotool search --onlyvisible --name firefox\r\n\r\n1. Set the window size\r\n\r\n xdotool windowsize $WINDOW_ID_GOES_HERE $WIDTH $HEIGHT\r\n\r\n1. Move the window\r\n\r\n xdotool windowmove $WINDOW_ID_GOES_HERE $X $Y\r\n\r\nFor example, if the window id for firefox is 123 you would do this:\r\n\r\n xdotool windowsize 123 800 600\r\n xdotool windowmove 123 0 1080\r\n\r\nThe bottom-left positioning will have to be figured out based on your screen resolution.", "703" ], [ "I think this slightly different script will address your original desire to have the list of files piped directly into `tar`.\r\n\r\nI&#39;ve quoted variables where they are used, and replaced backticks `` `...` `` with the modern `$(...)` construct.\r\n\r\nFinally, I&#39;ve assumed you want this to run from `/`, so that the paths you&#39;ve used can exist.\r\n\r\n #!/bin/bash\r\n WHEN=$(date +%b-%d-%y)\r\n FILENAME= \" ;backup-$WHEN.tar.gz \" ;\r\n DESDIR=/home/pi/backups\r\n SRC=/home/pi/backuplist.txt\r\n\r\n mkdir -p \" ;$DESDIR \" ;\r\n\r\n cd /\r\n find -iname &#39;*.orig&#39; -o -iname &#39;*.py&#39; |\r\n tee \" ;$SRC \" ; |\r\n tar zcvf \" ;$DESDIR/$FILENAME \" ; --no-recursion --verbatim-files-from --files-from -\r\n\r\nYou can completely omit the two lines referencing `$SRC` if you don&#39;t need to create the list of files during the backup process.", "879" ], [ "Hugin will stitch these images for you.\r\n\r\nThere&#39;s a script available within the [tutorial for stitching scanned images](_URL_2_) called [run-scan-pto_var.sh](_URL_1_) that will do exactly what you need.\r\n\r\nOn my Debian system I need to install two packages (and, of course, their dependencies):\r\n\r\n apt-get install hugin hugin-tools\r\n\r\nIn the interests of question completeness I&#39;ve included a slightly modified version here (this version accepts image filenames on the command line instead of them being hardcoded):\r\n\r\n #! /bin/sh\r\n # hugin command tools script to stitch scanned images, fov unknown\r\n # use of fov > = 10 should be OK, could simply set FOV=10\r\n # <PERSON> 2013, 2014\r\n \r\n # usage...run-scan-pto_var.sh outputprefix fov\r\n \r\n #get the output file prefix\r\n Prefix=$1\r\n \r\n # get the fov\r\n FOV=$2\r\n \r\n shift 2\r\n \r\n pto_gen --projection=0 --fov=$FOV -o project.pto \" ;$@ \" ;\r\n pto_lensstack -o project1.pto --new-lens i1 project.pto\r\n cpfind -o project1.pto --multirow project1.pto\r\n cpclean -o project2.pto project1.pto\r\n linefind -o project3.pto project2.pto\r\n pto_var -o setoptim.pto --opt r,d,e,!r0,!d0,!e0 project3.pto\r\n autooptimiser -n -o autoptim.pto setoptim.pto\r\n pano_modify --projection=0 --fov=AUTO --center --canvas=AUTO --crop=AUTO -o autoptim2.pto autoptim.pto\r\n pto2mk -o _URL_0_ -p $Prefix autoptim2.pto\r\n make -j 2 -f _URL_0_ all\r\n\r\n # Clean up afterwards\r\n rm -f project.pto project1.pto project2.pto project2.pto _URL_0_\r\n rm -f \" ;$Prefix \" ;[0-9][0-9][0-9][0-9].tif\r\n rm -f autoptim.pto autoptim2.pto autoptim2.pto_rsp.arg\r\n rm -f setoptim.pto\r\n\r\nIf your images are called `wIowW.jpg` and `orMDp.jpg` - as yours are named - and you want the result in `rsp.tif` you can run the script like this:\r\n\r\n ./run-scan-pto_var.sh rsp 10 *.jpg\r\n\r\nThe output is always written to a TIFF file. However, this format is trivially converable to just about any other image format.\r\n\r\nThe result?\r\n\r\n[![enter image description here][1]][1]\r\n\r\n\r\n [1]: _URL_3_", "111" ], [ "The problem here for you is that the default blocksize for `dd` is 512 bytes, so that&#39;s two system calls and two requests for IO per KB. You&#39;ve got two million of those per GB; no wonder it&#39;s slow.\r\n\r\n- Don&#39;t use `dd`. Use `cat` (it&#39;s far faster in many situations and rarely, if ever, slower):\r\n\r\n cat /dev/zero > /dev/sdX\r\n\r\n- If you really must use `dd`, increase the blocksize to something rational:\r\n\r\n dd if=/dev/zero bs=32M of=/dev/sdX\r\n\r\n- If you&#39;re trying to erase the disk with pseudo-random data, consider [DBAN](_URL_1_) with a single pass. (Don&#39;t bother with multi-pass; either one pass is sufficient or you need a [hammer](_URL_0_).)", "437" ], [ "You&#39;re copying between two locations on the same system. This switches off the delta algorithm and reverts `rsync` to being a fancy implementation of `cp -a`.\r\n\r\nThe `-H` flag causes `rsync` to have to keep a record of every file with more then one hard link so that it can reconstruct the hard links in the target. This increases memory use (empirically I&#39;d say by quite a lot), which in turn can put heavier demand on your system.\r\n\r\nFinally, Cygwin `rsync` is considerably slower than a native UNIX/Linux implementation. I&#39;ve not determined whether this is because it&#39;s using a compatibility layer on top of Windows or because the filesystem is slower or even because of something else entirely. But it is slower for an otherwise identical set of files on the same hardware.", "437" ], [ "The Powershell implementation of `wget` is not `wget`. So it doesn&#39;t behave like the UNIX/Linux utility `wget`.\r\n\r\nAs [pointed out](_URL_2_) by user4556274, Powershell uses `wget` and `curl` as aliases for its own [`Invoke-WebRequest`](_URL_0_).\r\n\r\nLooking at that (or running `Get-Help wget` under Powershell) it can be seen that the `-O [filename]` flag is an acceptable abbreviation for `-Output [filename]`, and that `Invoke-WebRequest [URI]` actually returns an object representing a web page rather than writing a file named from the basename of the URL.\r\n\r\nThus, this returns \" ;nothing \" ; unless you assign it to a variable or pipe it to another command:\r\n\r\n wget _URL_1_\r\n\r\nBut this delivers a web page \" ;as expected \" ;:\r\n\r\n wget _URL_1_ -O page.html", "1005" ], [ "I&#39;m following a recipe I created a couple of years ago, where at one point I need to use `blkid` to obtain a filesystem UUID.\r\n\r\nI have this command noted, along with an expected example return value:\r\n\r\n blkid -o export -s UUID /dev/mapper/thathost_crypt_md3\r\n UUID=JNbF5T-vhSD-3aVv-intG-1Tk2-IEOZ-ABWXYZ\r\n\r\nHowever, times have moved on and I&#39;m no longer using Debian \" ;wheezy \" ; but instead \" ;jessie \" ;. I see that on this more recent version of Debian I now have a different return value for the same command:\r\n\r\n blkid -o export -s UUID /dev/mapper/thishost_crypt_sdb\r\n DEVNAME=/dev/mapper/thishost_crypt_sdb\r\n UUID=bddac63e-3510-4d24-a6fb-4d0a89abcdef\r\n\r\nThe man page for blkid seems to say that `-s UUID` should include only values matching that key, yet there&#39;s this extraneous `DEVNAME` in there, too.\r\n\r\nI have a work-around, in that I can write this in both cases, but it seems strange the output structure should have changed:\r\n\r\n echo \" ;UUID=$(blkid -o value -s UUID /path/to/device) \" ;\r\n UUID=bddac63e-3510-4d24-a6fb-4d0a89abcdef\r\n\r\nPackage `util-linux` versions are 2.20.1-5.3 and 2.25.2-6, respectively.\r\n\r\nQuestions\r\n\r\n1. Why the change in UUID shape, and does it matter?\r\n1. Why the change in the output format?", "348" ], [ "1. In 1984 there wasn&#39;t really any mass-access Internet, so the only resource for a reference source would have been a book. I suspect these days you&#39;ll do just fine with an online connection.\r\n\r\n2. Cygwin, Bash on Windows, a Linux/FreeBSD virtual machine, a cheap VPS. There are many options. It&#39;s not possible to give a definitive answer because you haven&#39;t provided any criteria for _the \" ;best \" ; option_.", "4" ], [ "Your `cron` entry runs once an hour, at one minute past:\r\n\r\n 1 * * * * sh /home/martien/_URL_0_\r\n\r\nIf you want every minute you should use this:\r\n\r\n * * * * * /home/martien/_URL_0_ \r\n\r\nSince you&#39;ve declared your script to be a `bash` script and you&#39;ve set it to be executable, just call it directly. Don&#39;t write a `bash` script and use `sh` to execute it as on some systems they really are different shells.\r\n\r\nYour script can be amended slightly, too:\r\n\r\n #!/bin/bash\r\n cd /home/martien/archives\r\n DIRECTORY= \" ;webcam-$(date +&#39;%y-%m-%d-%H-%s&#39;) \" ;\r\n mkdir \" ;$DIRECTORY \" ;\r\n\r\nI&#39;ve quoted your variables when they are used, and switched backticks to the more modern and consistent `$(...)` construct.", "496" ], [ "This is not possible over `sshfs` due to the way that it implements the filesystem.\r\n\r\nEssentially it maps the client side of the filesystem to a series of `sftp` file transfers. You update a file locally and `sshfs` copies that file (in its entirety) remotely. Here&#39;s what the man page itself has to say:\r\n\r\n > On the local computer where the SSHFS is mounted, the implementation makes use of the FUSE (Filesystem in Userspace) kernel module. The practical effect of this is that the end user can seamlessly interact with remote files being securely served over SSH just as if they were local files on his/her computer. On the remote computer the SFTP subsystem of SSH is used.\r\n\r\nFuthermore, bear in mind that FUSE is implemented in user space and so is subject to swapping. Consider the effect on a system that is already swapping, where the FUSE subsystem is called, but in order to run it needs to swap out another process (or worse, swap itself back in again)...\r\n\r\nIt would be possible over a block-based filesystem such as NFS, and indeed this was used on early diskless systems in the 80s/90s.", "883" ], [ "The `dead.letter` file is created by mail clients when they cannot send email. It&#39;s likely you don&#39;t have any mail subsystem installed on your machine. The date of the file corresponds to the date the mail was attempted.\r\n\r\nOn 18th January it looks like `smartctl` tried to warn you of 8 sectors that couldn&#39;t be read. This is a warning sign that the disk _may_ be dying but it&#39;s not a definite marker. I&#39;d start saving for a replacement, though.\r\n\r\nYou confirmed that the disk has been more recently checked and was reported to be fine. What&#39;s happened here is that you wrote new data to those sectors, the disk failed to write them, and silently remapped them to dedicated spare sectors elsewhere on the disk.\r\n\r\nThree are now no outstanding faulty sectors.\r\n\r\nAs the disk gets older and more sectors need remapping, eventually the spares will get filled up and real data will be lost. It&#39;s just a matter of time. Ensure you have got backups - or that you can afford to lose any or all of your data either in one big go out subtly so you don&#39;t really notice the corruption at first.", "325" ], [ "@SuperKrish you _can&#39;t_ hide your IP. You can stop the entry being written into - or read from - `/etc/?tmp` but users can still run `netstat -na` and look for (say) sessions landing on port 22 (ssh). This \" ;silly idea \" ; attempts to obfuscate inbound sessions by having them land on a different port, and then redirecting that port to the true port. Remote sessions are then added into `/etc/?tmp` as coming from `localhost` rather than from your true IP address.", "580" ], [ "Your variable `$var` doesn&#39;t contain the value you say it should contain. According to your question it should contain this:\r\n\r\n . /lapp2/Scripts/mdm.ksh\r\n\r\nBut the debugging value from `echo \" ;var is &#39;$var&#39; \" ;` shows that `$var` actually contains:\r\n\r\n /etlapp2/$1/mdm/Scripts/_URL_0_ /etlapp2/$1/mdm/Scripts/mdmxftpg.aimtlane\r\n\r\nThere are two issues here. There&#39;s the obvious one that the actual value isn&#39;t the expected value. But more subtly, notice that `$var` contains a literal `$1` in part of the path instead of an interpolation of the first command-line argument. I suspect you have used single quotes instead of double quotes at some point during the assignment of `$var`.\r\n\r\nContrast these two alternatives\r\n\r\n - `a=&#39;apple&#39;; var=&#39;/path/to/$a/_URL_1_&#39;; echo \" ;var=$var \" ; # incorrect`\r\n - `a=&#39;apple&#39;; var= \" ;/path/to/$a/_URL_1_ \" ;; echo \" ;var=$var \" ; # correct`\r\n\r\nYou need to review your code to find out why the value isn&#39;t as expected and to fix these errors.", "67" ], [ "Colours in a terminal (shell) window have no real relation to colours in your `.Xresources` file.\r\n\r\nIf you want to print colours in a terminal (shell) window you should seriously consider the `tput` command. This uses the `terminfo` database to generate the necessary escape sequences to obtain colours (amongst other things).\r\n\r\nYou can `man 5 terminfo` and read the section on `Color Handling`. Here&#39;s the table of available colours:\r\n\r\n Colour Value RGB\r\n black 0 0, 0, 0\r\n red 1 max,0,0\r\n green 2 0,max,0\r\n yellow 3 max,max,0\r\n blue 4 0,0,max\r\n magenta 5 max,0,max\r\n cyan 6 0,max,max\r\n white 7 max,max,max\r\n\r\nand you use the `setaf` (set ANSI foreground) and `setab` (set ANSI background) commands to set them. Use `sgr0` to reset them afterwards.\r\n\r\nFor example\r\n\r\n tput setaf 4 # Blue text\r\n tput setab 3 # Yellow background\r\n echo -n \" ;This is blue text on a yellow background \" ;\r\n tput sgr0 # Reset colours\r\n echo", "1008" ], [ "It looks like your environment doesn&#39;t include the `/usr/sbin` directory that holds such system programs.\r\n\r\nThe quick fix should be to use `/usr/sbin/adduser` instead of just `adduser`.\r\n\r\nTwo alternative solutions are:\r\n\r\n1. Change the `PATH` in `.bashrc` and/or `.bash_profile` so that `/usr/sbin` is included in the list. For example, here is my setting:\r\n\r\n export PATH= \" ;$HOME/bin:/usr/local/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/bin:/bin:/usr/local/games:/usr/games \" ;\r\n\r\n1. Edit the `sudoers` configuration (with `sudo visudo -f /etc/sudoers.d/securepath`) and add this line to the empty file:\r\n\r\n # Extend the PATH for sudo commands\r\n Defaults secure_path= \" ;/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \" ;\r\n\r\nEither would be sufficient.", "708" ], [ "The man page for `systemctl` (`man systemctl`) explains this behaviour clearly, and even offers options to change it:\r\n\r\n > `$SYSTEMD_PAGER` Pager to use when `--no-pager` is not given; overrides `$PAGER`. If neither `$SYSTEMD_PAGER` nor `$PAGER` are set, a set of well-known pager implementations are tried in turn, including `less`(1) and `more`(1), until one is found. If no pager implementation is discovered no pager is invoked. Setting this environment variable to an empty string or the value \" ;`cat` \" ; is equivalent to passing `--no-pager`.\r\n\r\nSo in your case the solution is to set the environment variable when you log in:\r\n\r\n export SYSTEMD_PAGER=cat", "708" ], [ "They don&#39;t \" ;all have the same mistake \" ;. True, the relatively new `pool` keyword should in a growing number of places be used instead of `server`, but `server` is not wrong merely suboptimal. In the particular situation here, it&#39;s likely that `pool` would exacerbate the problem by hiding the necessary IP addresses and making it even harder to get the data through what turns out to be a corporate firewall.", "873" ], [ "Your permissions on the `/mnt/HDA_ROOT/.config` directory are wrong. Here is the correct set of permissions for the directories leading to `/etc/passwd`, taken from a QNAP we have here:\r\n\r\n drwxr-xr-x 18 admin administ 1024 Mar 17 16:28 /\r\n drwxr-xr-x 24 admin administ 2048 Mar 18 03:00 /etc/\r\n lrwxrwxrwx 1 admin administ 21 Mar 17 16:25 /etc/config - > /mnt/HDA_ROOT/.config/\r\n -rw-r--r-- 1 admin administ 227 Feb 21 2016 /etc/config/passwd\r\n \r\n drwxr-xr-x 30 admin administ 4096 Apr 11 04:00 /mnt/HDA_ROOT/.config/\r\n\r\nComparing to yours, your `/mnt/HDA_ROOT/.config` is missing its read and execute permissions. Fix with this command\r\n\r\n chmod a=rx,u+w /mnt/HDA_ROOT/.config # or chmod 755 ...\r\n\r\nIt would be worth keeping an eye on this after your next reboot and raising a ticket with QNAP Technical Support if the permissions revert to the broken settings.", "708" ], [ "Many installations require `tcpdump` to run as root, so the remote side may well need to run as root. In corporate organisations it may be easier to arrange root equivalence between two systems than to allow a non-privileged account to `ssh` to a root account. And your `ssh ...sudo ... > file` construct will fail unless the `sudo` is set up to avoid asking for a password.", "740" ], [ "The first problem was that you were using the wrong syntax for the `telnet` command. Running `man telnet` will show you that the syntax is something like this:\r\n\r\n telnet < host > [ < port > ]\r\n\r\nSo in your case, you should run this:\r\n\r\n telnet <IP_ADDRESS> 5432\r\n\r\n-------\r\n\r\nA second problem is that you have a firewall rule on each host preventing _outbound_ traffic to 5432/tcp. (And probably other ports too.) The error message, \" ;No route to host \" ;, is generated by an `iptables --j REJECT` rule in the `OUTPUT` chain that has `--reject-with icmp-host-prohibited`. Here is an example of creating such a rule:\r\n\r\n iptables -I OUTPUT -p tcp --dport 5432 -j REJECT --reject-with icmp-host-prohibited\r\n\r\nThis satisfies the situation where the route clearly exists because `ping` succeeds, but where your `telnet` session fails. You yourself can check this with the command `iptables --line-numbers -nvL` (not `iptables -Ln`, which tries to list the rules for the chain `n`).\r\n\r\nTwo temporary fixes to confirm that traffic really can be established are\r\n\r\n - Disable the firewall on both systems entirely\r\n - Run these two commands on both systems (you can delete them afterwards by replacing `-I` with `-D`)\r\n\r\n iptables -I INPUT -p tcp --src <IP_ADDRESS>/30 -j ACCEPT\r\n iptables -I OUTPUT -p tcp --dst <IP_ADDRESS><PHONE_NUMBER> -j ACCEPT\r\n iptables -I OUTPUT -p tcp --dst <PHONE_NUMBER> -j ACCEPT\r\n\r\nI&#39;m not (yet) sufficiently familiar with the CentOS 7 firewall tool to give you a full solution for that. I can go digging or maybe someone else might like to edit this answer to provide that information.", "53" ], [ "This isn&#39;t a consequence of moving from a Linux-based system to some non-Linux based system (AIX, perchance?). It&#39;s a fundamental misunderstanding of how the shell parses and executes commands.\r\n\r\nYou cannot write this and expect it to write a timestamp to a file:\r\n\r\n v= \" ;date > /tmp/date.txt \" ;\r\n $v\r\n\r\nSimilarly you cannot write this and have it perform substitutions and write the results to an output file\r\n\r\n v= \" ;s/abc/XYZ/ /tmp/source > /tmp/destination \" ;\r\n sed $v\r\n\r\nThe file redirection cannot not be specified within the variable.\r\n\r\nWhat I think you&#39;re looking for is `sed -f`, where you can create a file of substitutions and have them applied to a source datafile:\r\n\r\n #!/bin/ksh\r\n # Usage: thisprogram < transform_file > < src_file > < dst_file > \r\n #\r\n transform= \" ;$1 \" ;\r\n src= \" ;$1 \" ;\r\n dst= \" ;$2 \" ;\r\n\r\n sed -f \" ;$transform \" ; \" ;$src \" ; > \" ;$dst \" ;\r\n\r\nThe transform file might contain operations like these:\r\n\r\n s/@Number@/1234/g\r\n s/@Value@/somevalue/g\r\n s/@Socket@/99b44/g\r\n\r\nObviously you&#39;d have to prepare this within the context of the particular execution.\r\n\r\nWith more detail in your question it might be possible to take this solution further, but I trust you have enough information here to rework it for your particular use case.", "613" ], [ "If you run this command you&#39;ll get two files, one called `stdout` and one called `stderr`, containing the output to *stdout* and the output to *stderr*, respectively:\r\n\r\n (source env_ora.sh > /dev/null; sh aclenv/arun) > stdout 2 > stderr\r\n\r\nYour `grep` command only sees data that is sent to *stdout*. It does not even see the data that here is written to _stderr_.\r\n\r\nTaking a variation of your example in a follow-on comment, you&#39;ll see that only _stdout_ comes through the pipe to be processed by `sed`:\r\n\r\n ( echo \" ;stdout \" ;; echo \" ;stderr \" ; > & 2 ) | sed &#39;s/std/STD/&#39;\r\n stderr\r\n STDout\r\n\r\nThe other line of output is written directly to the _stderr_ channel, which by default is attached to your terminal.\r\n\r\nIn summary: a pipeline attaches _stdout_ from one command to _stdin_ of the next. The _stderr_ channel is attached to your terminal so that error messages (or status updates) can be written there without impacting the flow of actual data.", "227" ], [ "The relevant part of the tutorial is this:\r\n\r\n > At this point, user’s account on the server can be locked for password authentication. On Linux systems, one can make:\r\n\r\n > <EMAIL_ADDRESS>:~# passwd -l ornellas\r\n\r\nSo, if you followed this part of the tutorial you&#39;ve locked your password. The only way to resolve this is either to use a root account to unlock your password, or boot with a rescue disk and fix up the `passwd`/`shadow` file directly:\r\n\r\n passwd -u ornellas", "915" ], [ "You say you&#39;re copying the same folder on the client. It&#39;s dual boot, so odds are you&#39;re using NTFS. Linux systems write to NTFS systems via the FUSE subsystem, which uses user-mode code to implement the filesystem access code. Every block written or read has to go through this FUSE interface, which is far far slower than kernel-native code.\r\n\r\nYou also say that you&#39;re copying the same folder from a remote Windows share. On Linux systems that&#39;s implemented through SAMBA, which is also user-mode code. So that&#39;s another bottleneck.\r\n\r\nIf you were to use Linux-native solution (which I grant, in this case you can&#39;t) you would find that was as fast as the Windows-native solution.", "665" ], [ "If you want to avoid having two VirtualBox configuration files but share the same one, there are two sets of conversions to consider.\r\n\r\n1. You have Windows paths with backslash `\\ ` between folders. For example, `D:\\OS\\Fedora-Workstation-Live-x86_64-25-1.3.iso`\r\n2. You have Windows paths with forward slash `/` between folders. For example, `D:/Virtual Box/Linux/Kali Linux/Kali Linux.vbox`\r\n\r\nIn both cases the paths start with `D:`\r\n\r\nYou can fix the path starting point with a symbolic link placed strategically in the directory from which you run VirtualBox. In addition, it&#39;s possible to fix up the backslashes in the configuration file with a repeatable transform:\r\n\r\n ln -s /media/large &#39;D:&#39;\r\n cp -p vbox.xml vbox.xml.old & & tr &#39;\\\\&#39; / < vbox.xml.old > vbox.xml\r\n\r\nIf you want to avoid fixing up the VirtualBox configuration file itself it gets a bit harder, but it&#39;s not impossible. Ideally you&#39;ll go back and check on the Windows side to see if you can provide forward slashed paths. If not, a careful further application of symbolic links may help. Here is an example of the sort of thing you&#39;ll have to apply:\r\n\r\n ln -s &#39;D:&#39;/OS/Fedora-Workstation-Live-x86_64-25-1.3.iso &#39;D:\\OS\\Fedora-Workstation-Live-x86_64-25-1.3.iso&#39;\r\n\r\nNotice that I&#39;ve quoted the target link name and left the backslashes verbatim. This will create a name that superfically may appear to be a Windows filename path apparently including folders, but is actually just a UNIX filename containing necessary backslashes.", "181" ], [ "You haven&#39;t changed the `eth_*` variables in your `bridge-start` script to match your actual scenario. As a result when you run your script the IP address gets changed from <IP_ADDRESS> to <IP_ADDRESS> and you lose connectivity.\r\n\r\nEven when you&#39;ve fixed that you&#39;ll probably need to recreate your routing table (default route, in particular).\r\n\r\nIf possible, get your bridge set up and working (`br0` and `eth0`) before you go any further with openvpn. Ideally you&#39;d get the bridge running at boot time, and then you can add in the `tap0` interface as you start testing openvpn.\r\n \r\nSuccessfully changing a network configuration remotely is not easy. If you have any way to get a KVM attached while you get this working I would recommend you jump at the chance.\r\n\r\n----------\r\nA comment appears to ask for a tutorial. Rather than pointing off-site, here is how I have a bridge set up on one of my systems. It does not use NetworkManager, but rather this is the configuration in `/etc/network/interfaces`. *If you get this wrong you will not be able to log in*, so I would suggest you use a KVM, or that you try it on a local machine to confirm the process works.\r\n\r\n allow-hotplug eth0\r\n iface eth0 inet manual\r\n \r\n auto br0\r\n iface br0 inet static ← ASSUMES STATIC IP ADDR\r\n address <IP_ADDRESS>\r\n netmask <IP_ADDRESS>\r\n gateway <IP_ADDRESS><PHONE_NUMBER>\r\n gateway 111.111.111.254 ← FIX ME BEFORE TRYING THIS\r\n bridge_ports eth0\r\n bridge_fd 0\r\n bridge_maxwait 0", "53" ], [ "By the time one removes all the comment lines (those starting with `#` or `;`) there&#39;s very little left. In particular there are no shares.\r\n\r\n sed -e &#39;s/^\\s*//&#39; -e &#39;/^[#;]/d&#39; -e &#39;/^$/d&#39; /etc/samba/smb.conf\r\n\r\n [global]\r\n usershare path = /var/lib/samba/usershares\r\n usershare max shares = 100\r\n usershare allow guests = yes\r\n usershare owner only = yes\r\n workgroup = WORKGROUP\r\n netbios name = necrostation\r\n server string = Samba Server\r\n map to guest = Bad User\r\n printcap name = /dev/null\r\n load printers = No\r\n disable spoolss = Yes\r\n printing = bsd\r\n log file = /var/log/samba/%m.log\r\n max log size = 50\r\n security = user\r\n name resolve order = <PERSON> lmhosts host <PERSON>\r\n <PERSON> support = yes\r\n dns proxy = no\r\n\r\nYou probably want to uncomment one of the commented blocks and create the directory (`mkdir -m777 /home/samba`):\r\n\r\n [public]\r\n comment = Public stuff\r\n path = /home/samba\r\n public = yes\r\n read only = no", "708" ], [ "This solution will find duplicates in O(n) time. Each file has a checksum generated for it, and each file in turn is compared to the set of known checksums via an associative array.\r\n\r\n < !-- language: bash -- > \r\n\r\n #!/bin/bash\r\n #\r\n # Usage: ./_URL_0_ [ < files... > ]\r\n #\r\n declare -A filecksums\r\n \r\n # No args, use files in current directory\r\n test 0 -eq $# & & set -- *\r\n \r\n for file in \" ;$@ \" ;\r\n do\r\n # Files only (also no symlinks)\r\n [[ -f \" ;$file \" ; ]] & & [[ ! -h \" ;$file \" ; ]] || continue\r\n \r\n # Generate the checksum\r\n cksum=$(cksum < \" ;$file \" ; | tr &#39; &#39; _)\r\n\r\n # Have we already got this one?\r\n if [[ -n \" ;${filecksums[$cksum]} \" ; ]] & & [[ \" ;${filecksums[$cksum]} \" ; != \" ;$file \" ; ]]\r\n then\r\n echo \" ;Found &#39;$file&#39; is a duplicate of &#39;${filecksums[$cksum]}&#39; \" ; > & 2\r\n echo rm -f \" ;$file \" ;\r\n else\r\n filecksums[$cksum]= \" ;$file \" ;\r\n fi\r\n done\r\n\r\nIf you don&#39;t specify any files (or wildcards) on the command line it will use the set of files in the current directory. It will compare files in multiple directories but it is not written to recurse into directories themselves.\r\n\r\nThe \" ;first \" ; file in the set is always considered the definitive version. No consideration is taken of file times, permissions or ownerships. Only the content is considered.\r\n\r\nRemove the `echo` from the `rm -f \" ;$file \" ;` line when you&#39;re sure it does what you want. Note that if you were to replace that line with `ln -f \" ;${filecksums[$cksum]} \" ; \" ;$file \" ;` you could hard-link the content. Same saving in disk space but you wouldn&#39;t lose the file names.", "879" ], [ "The man page for `pam_get_user(3)` says it gets its value from the user obtained by `pam_start(3)`. That function in turn says that elements in its structure can be set using `pam_set_item(3)`. The man page for this third function provides an explicit reference to changing the username being tested for authentication.\r\n\r\n > The `pam_set_item` function allows applications and PAM service modules to access and to update PAM informations of `item_type`. For this a copy of the object pointed to by the item argument is created. The following item_types are supported [...]\r\n\r\n > **PAM_USER** The username of the entity under whose identity service will be given. That is, following authentication, PAM_USER identifies the local entity that gets to use the service. Note, this value can be mapped from something (eg., \" ;anonymous \" ;) to something else (eg. \" ;guest119 \" ;) by any module in the PAM stack. As such an application should consult the value of PAM_USER after each call to a PAM function.", "103" ], [ "You had much of the work already in place. Reading the man page for `smbclient` would have given you the `-c < command > ` parameter, which can be used to provide one or more commands directly rather than interactively.\r\n\r\n #!/bin/bash\r\n username= \" ;DOMAIN\\\\USER \" ; # Double backslash\r\n password= \" ;PASSWORD \" ; # For demonstration purposes only\r\n hostname= \" ;TARGET_HOST \" ; # SMB hostname of target\r\n \r\n cd \" ;${TMPDIR:-/tmp} \" ;\r\n touch tmp_$$.tmp # Required locally to copy to target\r\n \r\n smbclient -L \" ;$hostname \" ; -g -A < ( echo \" ;username=$username \" ;; echo \" ;password=$password \" ; ) 2 > /dev/null |\r\n awk -F&#39;|&#39; &#39;$1 == \" ;Disk \" ; {print $2}&#39; |\r\n while IFS= read -r share\r\n do\r\n echo \" ;Checking root of share &#39;$share&#39; \" ;\r\n\r\n if smbclient \" ;//$hostname/$share/ \" ; \" ;$password \" ; -U \" ;$username \" ; -c \" ;dir \" ; > /dev/null 2 > & 1\r\n then\r\n status=READ\r\n\r\n # Try uprating to read/write\r\n if smbclient \" ;//$hostname/$share/ \" ; \" ;$password \" ; -U \" ;$username \" ; -c \" ;put tmp_$$.tmp ; rm tmp_$$.tmp \" ; > /dev/null 2 > & 1\r\n then\r\n status=WRITE\r\n fi\r\n else\r\n status=NONE\r\n fi\r\n\r\n case \" ;$status \" ; in\r\n READ) echo \" ;Well, $username has read access \" ; ;;\r\n WRITE) echo \" ;Yes, $username has write access \" ; ;;\r\n *) echo \" ;No, $username has no access \" ; ;;\r\n esac\r\n done\r\n\r\n rm -f tmp_$$.tmp", "883" ], [ "The loop device is what you need for this. Run these commands as root:\r\n\r\n truncate -s1G 1GB.img # Sparse allocation of a 1GB file\r\n ld=$(losetup --show --find 1GB.img); echo \" ;$ld \" ;\r\n\r\nYou will now have a loop device (for example, `/dev/loop0`) that you can treat as a block device.\r\n\r\n mkfs -t btrfs \" ;$ld \" ; # Device that was returned from losetup\r\n\r\n mkdir -p /mnt/dsk\r\n mount \" ;$ld \" ; /mnt/dsk\r\n\r\nWhen you&#39;ve finished, tidy up again\r\n\r\n umount /mnt/dsk\r\n losetup -d \" ;$ld \" ;\r\n rm 1GB.img\r\n\r\nIf you want to create a partition table on the block device, make sure you always include the `--partscan` flag on the `losetup` command. This will create the associated devices, for example, `/dev/loop0p1`.", "228" ], [ "@Modelmat I don&#39;t understand what you don&#39;t like about the two solutions I&#39;ve offered. You cannot have a file that is magically two different things at the same time; you either have to transform the file or its environment. I&#39;ve offered you both. Apply the chosen transforms just before you start VirtualBox on the Linux system and you&#39;ll be set.", "181" ], [ "The following works for me with `rsync` version 3.1.2:\r\n\r\n $ ls -F\r\n archive/ backup/ _URL_3_* _URL_0_* _URL_1_* _URL_2_* source/\r\n\r\n $ cat /tmp/excludes\r\n /archive/\r\n /backup/\r\n /_URL_3_\r\n /_URL_0_\r\n\r\n $ mkdir -p /tmp/target\r\n $ rsync --relative --recursive --delete --delete-excluded --exclude-from=/tmp/excludes . /tmp/target/\r\n\r\n $ ls -F /tmp/target\r\n _URL_1_* _URL_2_* source/\r\n\r\nWhat&#39;s happening here is as described in the man page for `rsync`, so your patterns must be anchored to `/` immediately at the start of the copy (i.e. under `.`).\r\n\r\n > **ANCHORING INCLUDE/EXCLUDE PATTERNS** < br/ > \r\n > As mentioned earlier, global include/exclude patterns are anchored at the \" ;root of the transfer \" ; [...].\r\n\r\n > Because the matching is relative to the transfer-root, changing the trailing slash on a source path or changing your use of the `--relative` option affects the path you need to use in your matching (in addition to changing how much of the file tree is duplicated on the destination host). [...]\r\n\r\n > Example:\r\n\r\n > cd /home; rsync -a --relative me/foo you/ /dest\r\n\r\n > +/- pattern: `/me/foo/bar` (starts at specified path) < br/ > \r\n > +/- pattern: `/you/bar/baz` (ditto)\r\n\r\n > Target file: `/dest/me/foo/bar` < br/ > \r\n > Target file: `/dest/you/bar/baz` < br/ > \r\n\r\nYou can see the exclusions being acted upon by adding `-vv` (or `--verbose --verbose`) to the `rsync` command.", "921" ], [ "@Pod what&#39;s really missing from this question is clarification of the types of metadata that the OP wants to be able to search for. For example, if it&#39;s only names then there are several alternative tools that spring to mind (including the `*locate` family). If it&#39;s names and dates then one needs to define the relationship between name and date (both must match? either must match? neither must match?). After that it starts to get complicated. But without an understanding of what the OP is hoping for it&#39;s difficult to provide a useful tool.", "307" ], [ "Here&#39;s a `tail-F` script. It takes a single argument - the file to tail. There are probably better options (such as installing GNU `tail`), but it&#39;s here to demonstrate that simple versions of tools can often be built from the parts available.\r\n\r\n #!/bin/bash\r\n #\r\n file= \" ;$1 \" ;\r\n size=$(stat -c &#39;%s&#39; \" ;$file \" ; 2 > /dev/null)\r\n test -z \" ;$size \" ; & & echo \" ;No file &#39;$file&#39; \" ; > & 2\r\n \r\n while sleep 1\r\n do\r\n n_size=$(stat -c &#39;%s&#39; \" ;$file \" ; 2 > /dev/null)\r\n \r\n if [[ -n \" ;$n_size \" ; ]]\r\n then\r\n if [[ 0 == \" ;$size \" ; ]]\r\n then\r\n # Output whole file (so far)\r\n dd bs=1K if= \" ;$file \" ; 2 > /dev/null\r\n size= \" ;$n_size \" ;\r\n \r\n elif [[ \" ;$n_size \" ; > \" ;${size:-0} \" ; ]]\r\n then\r\n # Output new part of file\r\n dd bs= \" ;$size \" ; skip=1 if= \" ;$file \" ; 2 > /dev/null\r\n size= \" ;$n_size \" ;\r\n \r\n elif [[ -z \" ;$size \" ; ]]\r\n then\r\n echo \" ;New file &#39;$file&#39; \" ; > & 2\r\n size=0\r\n \r\n elif [[ \" ;$n_size \" ; < \" ;${size:-0} \" ; ]]\r\n then\r\n echo \" ;Rewinding file &#39;$file&#39; \" ; > & 2\r\n size=0\r\n fi\r\n fi\r\n done", "879" ], [ "Using `parted` is fairly straightforward. The man page doesn&#39;t give examples but it&#39;s quite readable. Really. Here&#39;s a safe example for you:\r\n\r\n parted /dev/sdb unit MiB print\r\n\r\nOnce you have this information you still need to mount the various filesystems.\r\n\r\n mkdir /mnt/part # Adjust to suit\r\n mount /dev/sdb1 /mnt/part # You might need /dev/sdb2, /dev/sdb3, etc.\r\n cd /mnt/part\r\n ...\r\n cd\r\n umount /mnt/part\r\n\r\nThese will be read/write mounts. If you want to mount read-only then include the `-r` flag - `mount -r /dev/sdb1 /mnt/part`, etc.", "228" ], [ "Unless you set `rsync_short_args` or `rsync_long_args` in the configuration file for `rsnapshot`, you&#39;ll use `rsync -a` to perform the copy.\r\n\r\nThe default action for `rsync -a` is to copy a symlink as a symlink, and to ignore the target of the symlink. (Obviously, if the target of the symlink is within your source file tree it will get copied, but that&#39;s because of its position not because it&#39;s the target of an included symlink.)\r\n\r\nIf you want to exclude the symlink itself, you just need to reference it in an `exclude` line:\r\n\r\n exclude /foo/bar\r\n\r\nI&#39;ve not included the leading `/home` because that&#39;s the root of your source tree and filters are always based on the root of the source.", "523" ], [ "It doesn&#39;t really make a lot of sense to allow TFTP \" ;_from any server_ \" ;. However, if that&#39;s what you want here is what you need\r\n\r\n iptables -I INPUT -p udp -j ACCEPT\r\n iptables -I OUTPUT -p udp -j ACCEPT\r\n\r\nI don&#39;t think you&#39;ll like it, though.\r\n\r\nHere&#39;s an explanation taken from _URL_1_ (my bold highlighting)\r\n\r\n > TFTP uses UDP as its transport protocol. A transfer request is always initiated targeting port 69, but the **data transfer ports are chosen independently by the sender and receiver during the transfer initialization.** The ports are chosen at random according to the parameters of the networking stack, typically from the range of ephemeral ports.\r\n\r\nThis is defined more formally in [RFC 1350 section 4 paragraph 2](_URL_0_).", "79" ], [ "Next question is about the firewall on the CentOS system. It does allow NTP queries in from the Pi, doesn&#39;t it...? If in doubt, either temporarily turn off the firewall completely or (better) run `iptables -nvL INPUT; iptables -nvL OUTPUT` and put the output in your question. If you need to redact it please provide placeholders for whatever you&#39;ve removed.", "53" ], [ "Here is your fourth upstream server `_URL_0_.33.124` with the unexpected `.dj...` in the RefId field:\r\n\r\n > remote refid st t when poll reach delay offset jitter\r\n > ==============================================================================\r\n > _URL_0_.33.124 .dj... 16 u - 64 374 25.145 12.725 7.931\r\n\r\nLooking closely you can see that this server is unsynchronised to an upstream time source (it has a stratum of 16, the lowest possible). In this situation the Reference Id field is considered to be unspecified and should be ignored:\r\n\r\nAt Stratum 16 and above, the source is considered unsynchronized. The [`fudge` statement](_URL_1_) can be used to define the Reference Id for a timesource. So in this case I would suggest that the server is quite possibly using [its own local clock](_URL_2_) and this has been labelled `dj`.\r\n\r\nHere is one such (untested) example of using a local clock labelled as `dj`:\r\n\r\n fudge <IP_ADDRESS> 0 0 15 dj\r\n server <IP_ADDRESS>", "53" ], [ "It is a permissions issue.\r\n\r\nYou need to check permissions for all directories above and including `foobar`&#39;s home, and also all directories above the target `.ssh` directory on your external device. Apart from `foobar` and the target `.ssh` directories, all others must be owned by root and not writeable by anyone else.\r\n\r\nIt is a permissions issue.\r\n\r\nYou need to check permissions for all directories above and including `foobar`&#39;s home, and also all directories above the target `.ssh` directory on your external device. Apart from `foobar` and the target `.ssh` directories, all others must be owned by root and not writeable by anyone else.\r\n\r\n < br > \r\n\r\n-- **Update** --\r\n\r\n(This answer is already accepted, so I don&#39;t have a dog in the fight. These additions are mine. - 0xSheepdog)\r\n\r\nYou may also have an SELinux issue. You can check the SELinux security context of files and directories with the `-Z` flag:\r\n\r\n [sheepd0g@dogpound ~]$ ls -ZA\r\n drwxr-xr-x. root root system_u:object_r:home_root_t:s0 ..\r\n drwxrwxr-x. sheepd0g sheepd0g unconfined_u:object_r:user_home_t:s0 20170620-auditlogs\r\n -rw-rw-r--. sheepd0g sheepd0g unconfined_u:object_r:user_home_t:s0 random.dat\r\n drwx------. sheepd0g sheepd0g unconfined_u:object_r:ssh_home_t:s0 .ssh\r\n\r\nA couple things to note:\r\n\r\n 1. The period at the end of the permission mode fields means SELinux context is active for that file.\r\n 2. Notice the Type field for the .ssh folder is different (ssh_home_t).\r\n 3. SELinux objects, types, policies, and settings may not be the same across distributions, or even major versions. What works for RHEL6 may not for, say SUSE 10 or Debian 6 (I&#39;m not sure Debian 6 even has SELinux enforcing, out of the box...)\r\n\r\nRegardless, this is a good place to look if all else fails. You can check if SELinux is in enforcing mode easily enough with the following:\r\n\r\n [sheed0g@dogpound ~]$ sudo getenforce\r\n Enforcing\r\n\r\nIf you suspect SELinux us the issue, you can switch SELinux to Permissive mode (policies are enabled, but no action is taken -- just logging/auditing of actions):\r\n\r\n [sheepd0b@dogpound ~]$ sudo setenforce 0\r\n [sheepd0b@dogpound ~]$ sudo getenforce\r\n Permissive\r\n\r\nIf your issue goes away, this is likely the problem.\r\n\r\nPlease note, there is A LOT more complexity to SELinux than what is represented here. If your .ssh/ is on an NFS share you will be required to make more changes with boolean settings for SELinux.\r\n\r\nHere are two good references for SELinux:\r\n\r\n[CentOS wiki entry on SELinux][1]\r\n\r\n[Red Hat Enterprise Linux 7 SELinux guide][2]\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "708" ], [ "I am not offering a complete solution here, but rather I&#39;m hoping to be able to point you along the way to building your own solution. Personally I think there are better tools, such as `rsync`, but that doesn&#39;t seem to fit the criteria in your question.\r\n\r\nI really wouldn&#39;t use `split` because that requires you to be able to store the split data as well as the original. Instead I&#39;d go for extracting blocks with `dd`. Something like this approach may be helpful for you.\r\n \r\n file=/path/to/file\r\n blocksize=1024 # Bytes per block\r\n numbytes=$(stat -c &#39;%s&#39; \" ;$file \" ;)\r\n numblocks=$((numbytes / blocksize))\r\n [[ $((numblocks * blocksize)) -lt $numbytes ]] & & : $((numblocks++))\r\n \r\n blockno=0\r\n while [[ $blockno -lt $numblocks ]]\r\n do\r\n md5sum=$(dd bs=$blocksize count=1 skip=$blockno if= \" ;$file \" ; 2 > /dev/null | md5sum)\r\n # Do something with the $md5sum for block $blockno\r\n # Here we write to stdout\r\n echo \" ;$blockno $md5sum \" ;\r\n \r\n : $((blockno++))\r\n done", "782" ], [ "You could use `getopts` to parse the command line. See `man bash` and search for `getopts` for details. Here is an example of how it could be used:\r\n\r\n #!/bin/bash\r\n #\r\n usage= \" ;USAGE: ${0/*\\/} [-r < number > ] [-u < user > ] \" ;\r\n while getopts &#39;:r:u:&#39; OPT\r\n do\r\n case \" ;$OPT \" ; in\r\n r) thenumber= \" ;$OPTARG \" ; ;;\r\n u) theuser= \" ;$OPTARG \" ; ;;\r\n *) echo \" ;$usage \" ; > & 2; exit 1 ;;\r\n esac\r\n done\r\n shift $((OPTIND -1))\r\n \r\n echo \" ;thenumber=${thenumber:- < unset > } \" ;\r\n echo \" ;theuser=${theuser:- < unset > } \" ;\r\n exit 0", "613" ], [ "Your `awk` line actually has two separate statements in it. Here it is written out longhand\r\n\r\n date +&#39;%b&#39; | awk &#39;\r\n {print \" ;Left \" ; $1}\r\n {print \" ;Right \" ;}\r\n &#39;\r\n\r\nWhat happens is that for every line of input, each `awk` statement is evaluated and executed. These two statements don&#39;t have the optional expression on the front (for example, `$1 == \" ;apple \" ; { print \" ;I love fruit \" ; }` so they are always executed.\r\n\r\nThus, for each line of input (your single line from the `date` command), you&#39;ll get the `{print \" ;Left \" ; $1}` and then the `{print \" ;Right}`. The `print` statements end their output with the current _output record separator_ (`ORS` variable), which by default is newline (NL) so you get two lines of output.\r\n\r\nAs an alternative you could use this, which has only one `awk` statement, containing only one `print` statement, so only one terminating NL:\r\n\r\n `date +&#39;%b&#39; | awk &#39;{ print \" ;Left \" ;, $1, \" ;Right \" ; }&#39;", "848" ], [ "You have (at least) a couple of choices\r\n\r\n1. Run a DHCP server on your Pi. This will assign addresses to clients that connect to it. (Even if there&#39;s only one client - your laptop.) As an example this could be `dnsmasq` or `udhcpd`.\r\n\r\n2. Assuming your Pi has an address `192.168.1.1` with a typical 24 bit subnet you add an address from that subnet to the laptop&#39;s ethernet interface:\r\n\r\n ip addr add <IP_ADDRESS><IP_ADDRESS>` with a typical 24 bit subnet you add an address from that subnet to the laptop&#39;s ethernet interface:\r\n\r\n ip addr add <PHONE_NUMBER> dev eth0\r\n\r\nEither of these operations should give you network connectivity between the two systems. Having done that, you need to [ensure your Pi is actually running an ssh server](_URL_0_) by enabling it in `raspi-config`.", "728" ], [ "If your `find` supports the `-delete` action you&#39;ll find this about as fast as you can go without spawning multiple delete processes:\r\n\r\n find \" ;$DIRECTORY \" ; -name \" ;*.$FILETYPE \" ; -type f -mtime + \" ;$DELETE_OLDER_THAN \" ; \\\r\n -delete -print > > \" ;$REMOVAL_LOGFILE \" ; 2 > & 1\r\n\r\n\r\nYou&#39;ll find that `-exec rm {} \\;` is slow because it creates a new process for every delete operation. If your `find` has it, `-exec rm {} +` would be faster because it would create one `rm` process for a considerable number of files. But fastest of all single-threaded solutions would be `-delete`.\r\n\r\nWith somewhat more complexity you could fork one `find .. -delete` process per directory, in a tree of directories, and have (at least some of) those running in parallel. But I don&#39;t know how many directories you&#39;re processing so I can&#39;t determine whether this would be a net gain.", "879" ], [ "You&#39;re missing parts of the libraries. For example in your first error message, `ls` needs `_URL_0_.1`. It can find this as a symbolic link, but you&#39;ve moved the target of the symbolic link into `/root` so it fails. Here&#39;s an example of what you should have:\r\n\r\n ls -l /lib/x86_64-linux-gnu/librt*\r\n -rw-r--r-- 1 root root 31744 Dec 4 2016 /lib/x86_64-linux-gnu/_URL_1_\r\n lrwxrwxrwx 1 root root 13 Dec 4 2016 /lib/x86_64-linux-gnu/_URL_0_.1 - > _URL_1_\r\n\r\n\r\nIf you still have a `root` shell you can try copying the libraries back again. You&#39;ll need this alias:\r\n\r\n mcp() { src= \" ;$1 \" ; dst= \" ;$2 \" ;; test -f \" ;$src \" ; || return 1; while :; do read -N 10240 -r data; test -z \" ;$data \" ; & & break; echo -n \" ;$data \" ;; done < \" ;$src \" ; > \" ;$dst \" ;; }\r\n\r\nAnd here&#39;s how you&#39;d attempt the fix:\r\n\r\n cd /root\r\n for lib in lib*.so; do mcp \" ;$lib \" ; /lib/x86_64-linux-gnu/ \" ;$lib \" ;; done\r\n\r\nUnset your `LD_PRELOAD` and see if you&#39;ve recovered.\r\n\r\nFailing that you WILL need to restore from a rescue CD. Or reinstall.", "46" ], [ "You say that Observer1 gets a 500 ISE error from Web1. What does Web1&#39;s web server error log say caused the ISE? You also say that Web1 cannot ping Observer1. Since Observer1 can ping Web1 I would say you have a firewall misconfiguration either on Web1 or Observer1. Please add outputs of `iptables -nvL` and `ip addr show` from both systems to your question.", "53" ], [ "Requirements\r\n\r\n > I need a bash script that creates a directory named after each group. And then a text file inside named for each person in that group with their corresponding link on the first line.\r\n\r\n #!/bin/bash\r\n while read a b\r\n do\r\n # Skip blank lines\r\n test -z \" ;$a \" ; & & continue\r\n\r\n if [[ \" ;$a \" ; == \" ;Group \" ; ]]\r\n then\r\n # Create the group directory\r\n group_dir= \" ;$a $b \" ;\r\n mkdir \" ;$group_dir \" ;\r\n else\r\n # Write the link into the named file\r\n echo \" ;$a \" ; > \" ;$group_dir/$b \" ;\r\n fi\r\n done < list.txt\r\n\r\nFor the purists, this assumes a number of restrictions:\r\n\r\n- no line in your text file begins with significant whitespace\r\n- no link contains whitespace\r\n- there are either precisely two words per line separated by whitespace, or that lines are empty\r\n- that the first non-blank line is a Group header\r\n\r\nAll of these assumptions can be overcome at the expense of additional code (and complexity).", "613" ], [ "It&#39;s the expansion of the file (directory?) names in `/mydir/tmp/*20151014*` that&#39;s the problem here.\r\n\r\nTry this instead, which avoids the need for your shell to expand the wildcarded name into a list:\r\n\r\n find /mydir/tmp -name &#39;*20151014*&#39; -exec grep -l &#39;filesTransmitted=1&#39; {} \\;\r\n\r\nIt&#39;s slightly different to yours, in that yours searches files, or all files in directories, starting from matches to `/mydir/tmp/*20151014*` whereas mine searches all files whose name matches `*20151014*` anywhere under `/mydir/tmp` . If this doesn&#39;t meet your requirements please provide a _sample_ set of the files and their directory paths.", "20" ], [ "The [man page for `bash`](_URL_0_) has this to say about the `=~` operator:\r\n\r\n > An additional binary operator, =~, is available, with the same precedence as == and !=. When it is used, the string to the right of the operator is considered an extended regular expression and matched accordingly (as in [regex(3)](_URL_1_))\r\n\r\nHowever, I&#39;m finding that even trivial REs don&#39;t appear to work. Here is my use case example:\r\n\r\n n=&#39;hello&#39;\r\n [[ \" ;$n \" ; =~ &#39;llo&#39; ]] & & echo yes || echo no # < -- yes\r\n [[ \" ;$n \" ; =~ &#39;llo$&#39; ]] & & echo yes || echo no # < -- no\r\n\r\n\r\nGiven that `$` is a standard RE indicator for EOL, why does the second comparison return \" ;no \" ;?", "791" ], [ "If you simply want to compare them for identity then you could consider using something like a checksum to tag the file based on its content:\r\n\r\n find . -name &#39;protein.mol2&#39; -exec cksum {} + | sort\r\n\r\nYou can save the output to a file. Lines with the first pair of numbers the same represent files that are (almost certainly) identical. This extension to the command will group files by identity:\r\n\r\n find . -name &#39;protein.mol2&#39; -exec cksum {} + |\r\n sort |\r\n while read c1 c2 file\r\n do\r\n test \" ;$c1-$c2 \" ; != \" ;$o1-$o2 \" ; & & echo\r\n echo \" ;$file \" ;\r\n o1= \" ;$c1 \" ; o2= \" ;$c2 \" ;\r\n done\r\n\r\n < hr > \r\n < sub > As a one-liner it&#39;s `find . -name &#39;protein.mol2&#39; -exec cksum {} + | sort | while read c1 c2 file; do test \" ;$c1-$c2 \" ; != \" ;$o1-$o2 \" ; & & echo; echo \" ;$file \" ;; o1= \" ;$c1 \" ; o2= \" ;$c2 \" ;; done` but it would probably be better off being put into a script file for reuse. < /sub >", "782" ], [ "There are some pretty serious issues highlighted in that screenshot.\r\n\r\n1. `mmc0: Unknown controller` - this one is [probably nothing to worry about](_URL_0_)\r\n1. `fsck: error 2 (No such file or directory) ... fsck.ext4` - you&#39;re missing at least some of the system utilities for managing `ext4` filesystems. **Did the installation complete successfully?**\r\n1. `iwlwifi ... firmware: failed to load iwlwifi-7260-12.uc` - your WiFi firmware isn&#39;t installed so the card will neither be initialised nor available for use. **You need to install the missing firmware from the repository.**\r\n1. `failed to start Open Vulnerability Assessment System Scanner Daemon. See &#39;systemctl status openvas-scanner.service&#39; for details` - **have you run the command it tells you to run, to review the problem?**\r\n\r\nYou really need to address these issues before trying to move on further.\r\n\r\n--------\r\nWhen you don&#39;t know the name of a package there is a very useful command called `apt-cache` that can help you find it. From there it can be installed in the usual manner.\r\n\r\n apt-cache search iwlwifi\r\n firmware-iwlwifi - Binary firmware for Intel Wireless cards\r\n\r\n apt-get install firmware-iwlwifi\r\n\r\nPersonally, for my Debian systems I prefer the interactive mode of `aptitude`. (Run the program, then `/` is the search key, so `/iwlwifi`, and then `+` to mark for install and `g` to go and apply the changes.)\r\n\r\n----------\r\nIt seems that Kali uses an older version of the `iwlwifi` package that doesn&#39;t support your 7260 WiFi card. If you follow through the answer from _smoortema_ for [No wireless for Intel Corporation 7260 version 63](_URL_1_) over on Ask Ubuntu you should find it works for you too.", "728" ], [ "You mentioned these system adminstration functions\r\n\r\n > managing packages, editing config files, installing a program from source\r\n\r\nas things that\r\n\r\n > anything a regular user does\r\n\r\nIn a typical multiuser system these are not ordinary user actions; a systems administrator would worry about this. Ordinary users (not \" ;under privileged \" ;) can then use the system without worrying about its upkeep.\r\n\r\nOn a home system, yes, you end up having to administer the system as well as using it.\r\n\r\nIs it really such a hardship to use `sudo`? Remember that if it&#39;s just your system there&#39;s no reason why you can&#39;t either pop into a `root` shell (`sudo -s` - see [this post][1] for an overview of various means of getting a root shell) and/or configure `sudo` not to prompt for a password.\r\n\r\n\r\n [1]: _URL_0_", "740" ], [ "It doesn&#39;t make sense to \" ;sort \" ; a folder to remove files. You can sort by filenames with `ls -bU | sort` or you can process the list to remove unwanted files.\r\n\r\n1. Delete all PDF files for which there is a DOC\r\n\r\n for d in *.doc; do p= \" ;${d/%.doc/.pdf} \" ;; test -f \" ;$p \" ; & & rm -f \" ;$p \" ;; done\r\n\r\n2. Delete all PDF files\r\n\r\n rm -f *.pdf\r\n\r\nBoth variants handle filenames with spaces and other strange characters in them. You can test the solutions by substituting `rm` for `echo rm`.", "879" ], [ "Here&#39;s another solution:\r\n\r\n #!/bin/bash\r\n # Grab the pattern, just like grep\r\n re= \" ;$1 \" ;; shift\r\n \r\n # Loop across the remaining arguments, or stdin if none\r\n test 0 -eq $# & & set -- -\r\n for file\r\n do\r\n # Search through the file (compressed or otherwise)\r\n zcat -f \" ;$file \" ; | grep -q \" ;$re \" ; & & echo \" ;$file \" ;\r\n done\r\n\r\nYou should copy this into a file and make that file executable (`chmod a+x {filename}`, and then use it similarly to `zgrep`:\r\n\r\n mkdir -p ~/bin\r\n export PATH= \" ;$HOME/bin:$PATH \" ; # Add the ~/bin directory to your PATH. Also add this line to your ~/.profile\r\n\r\n cat > ~/bin/mygrep # Paste the file at this point, hit Ctrl/D on a blank line to end. Or otherwise edit ~/bin/mygrep\r\n chmod a+x ~/bin/mygrep # Make it executable\r\n\r\n mygrep &#39;hello.*world&#39; a* # Search for the RE &#39;hello.*world&#39; in all files beginning with &#39;a&#39;\r\n\r\n\r\n--------\r\nIf you find that `zcat -f` or `grep -q` aren&#39;t recognised you can swap each for the following\r\n\r\n ( zcat \" ;$file \" ; 2 > /dev/null || cat \" ;$file \" ; ) # zcat -f \" ;$file \" ;\r\n grep \" ;$re \" ; 2 > /dev/null # grep -q \" ;$re \" ;\r\n\r\nWith both substitutions applied the resulting replacement line would look like this\r\n\r\n ( zcat \" ;$file \" ; 2 > /dev/null || cat \" ;$file \" ; ) | grep \" ;$re \" ; 2 > /dev/null & & echo \" ;$file \" ;", "143" ], [ "The cause of the error is this pair of lines\r\n\r\n threshold=$96%\r\n ...\r\n if [ $used_space > = $threshold ]\r\n\r\nThe first one sets threshold to something entirely unlike what I suspect you thing it&#39;s doing. Mainly because you haven&#39;t quoted the string, but partly because there&#39;s a `$` in here that doesn&#39;t even make semantic sense:\r\n\r\n threshold=$96%\r\n echo \" ; > $threshold < \" ; # > 6% < \r\n\r\nThe `...` code I&#39;ve omitted manages to set `used_space=97`, so you then come to the comparison, which isn&#39;t really a comparison at all. The ` > ` redirects output from the test into the file `=` and then leaves the following to be evaluated as part of the test:\r\n\r\n [ 97 6% ]\r\n\r\nwhich spits out `-bash: [: 97: unary operator expected`. You were probably looking for the `-ge` operator (see `man bash` or even `man test` for details of the operators available to you).", "67" ], [ "You could use `rsync` (over `ssh`), which uses a single connection to transfer all the source files.\r\n\r\n rsync -avP cap_* user@host:dir\r\n\r\nIf you don&#39;t have `rsync` (and why not!?) you can use `tar` with `ssh` like this, which avoids creating a temporary file:\r\n\r\n tar czf - cap_* | ssh user@host tar xvzfC - dir\r\n\r\nThe `rsync` is to be preferred, all other things being equal, because it&#39;s restartable in the event of an interruption.", "883" ], [ "Your first suggestion should work correctly. I suppose the only variant is to check that you&#39;re entering the variables correctly (space separated, not comma separated). You can demonstrate that the code is correct by modifying it slightly to print the values of the two variables and to print the `matlab` command rather than execute it:\r\n\r\n #!/bin/bash\r\n echo \" ;Please variables 1 and 2: \" ;\r\n read var1 var2\r\n echo \" ;var1=$var1, var2=$var2. \" ;\r\n echo matlab -nodesktop -nosplash -r \" ;functionmat($var1,$var2) \" ;", "67" ], [ "You have some choices. Here are some suggestions:\r\n\r\n1. Connect from serverB to root@serverA using certificate based authentication and run the script within the root context on that server.\r\n\r\n You can then use that same certificate based authentication to pull the resulting file back with `scp` or `rsync`. The downside is that your account on serverB then has full unmitigated access to root@serverA. however, in a closely managed environment this may be acceptable.\r\n\r\n1. Connect from serverB to root@serverA using certificate based authentication that limits the connection to running a single command - your script.\r\n\r\n If the command were to output its file to _stdout_ it could be captured directly from the `ssh` session from serverB to root@serverA with no need to transfer the file after script completion. Your account on serverB would not have arbitrary access to root@serverA.\r\n\r\n An example of the necessary entry for root@serverA in its `~root/.ssh/authorized_keys` file to run the `bake` command might look a little like this:\r\n\r\n < !-- language: lang-none -- > \r\n\r\n ssh-rsa AAAAB3Nza...Fr9FvN me@roaima,command= \" ;/usr/local/bin/bake \" ;,no-agent-forwarding,no-port-forwarding,no-X11-forwarding\r\n\r\n1. Connect from serverB to serverA, and use `sudo` to run the script. You can configure `sudo` to allow your single user account to run the script as root but without requiring a password.\r\n\r\n This entry in `/etc/sudoers` would allow user \" ;roaima \" ; to run the named script with or without arguments as root using a command such as `sudo /usr/local/bin/bake --fruit=apple,blackberry --type=pie`\r\n\r\n roaima ALL = NOPASSWD: /usr/local/bin/bake\r\n\r\n1. More complicated things with triggers, such as connecting to a defined TCP port on serverA and having that trigger your script, run as root.\r\n\r\n This does mean that anyone who can access that TCP port on serverA can start your script, so you need to consider DDOS issues and preventing multiple instances of the script being run simultaneously. However, it would remove the need to have _any_ interactive root access on serverA -- even that mediated with `sudo`.", "883" ], [ "Not so much _probably shouldn&#39;t_ as _should not_. The `cron` daemon won&#39;t notice changes if you edit the files directly. Instead, use `crontab -l` to list for the current user, `crontab -e` to edit for the current user, and/or include `-u {user}` as well to access that different user&#39;s `crontab`. This is all well defined in the [man page for `crontab`](_URL_0_).", "496" ], [ "The clue is here\r\n\r\n [Wed Oct 28 20:05:52.281645 2015] [core:error] [pid 5887] (13)Permission denied: [client <IP_ADDRESS><PHONE_NUMBER>] [core:error] [pid 5887] (13)Permission denied: [client 127.0.0.1:46927] AH00035: access to /index.php denied (filesystem path &#39;/home/www/index.php&#39;)\r\n\r\nApache cannot access or run your `index.php`. Ensure the permissions on `/home` and `/home/www` are sufficient for Apache to access them and that `index.php` is readable too:\r\n\r\n chmod a+rx / /home /home/www\r\n chmod a+r /home/www/index.php\r\n\r\nYou will also need to review the access rights within the Apache configuration. Look for ` < Directory > ` or ` < Location > ` directives and ensure they match your new document root. Restart Apache as necessary.\r\n\r\n----------\r\nIf that doesn&#39;t solve the problem try disabling SELinux to test whether that&#39;s the issue. If it is, you can find out how to relax its access restrictions for Apache easily enough.", "406" ], [ "Alternatively, dispense with the script and use a `rename` tool instead.\r\n\r\nFrustratingly there are (at least) two different instances of `rename` depending on your distribution. On some systems the Perl version may be called `prename`. However, you can tell which one you have by running `rename -n &#39;;&#39; /dev/null`. If nothing happens you have the Perl version. If you get an error it&#39;s the other one.\r\n\r\n > The current syntax for filename is `program 1.c` and I want to change this to `cprogram-program1.c`. Assume that there are only 9 files i.e: 0,1,2,3..9\r\n\r\n1. The Perl-based `rename` (`prename`)\r\n\r\n rename &#39;s/^/cprogram-/; s/\\s//&#39; program\\ ?.c\r\n\r\n2. The other `rename`\r\n\r\n rename -v &#39;program &#39; cprogram-program program\\ ?.c", "879" ], [ "< sub > (This is going to have to be an incremental answer as there&#39;s too much for a comment just now.) < /sub > \r\n\r\nThe grey (possibly stippled) background for VNC is typical of an X Display Server that is running nothing.\r\n\r\nYour `/root/.vnc/xstartup` looks very strange.\r\n\r\n1. The `exec` line passes control _permanently_ to the file specified as its parameter, so only the first two non-comment lines of your script get executed. It would be worth looking in the references `xinitrc` to see what it wants to do. (If the file&#39;s not too long please add it to the question.)\r\n\r\n2. It&#39;s not usual to have `exec` followed by ` & ` as it negates the meaning of the `exec`.\r\n\r\nBased on information in the comments we also need to fix up the `PATH`. The resulting `xstartup` code therefore looks like this:\r\n\r\n #!/bin/sh\r\n export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin\r\n unset SESSION_MANAGER\r\n exec /etc/X11/xinit/xinitrc\r\n\r\nYou have remembered to make the file executable? `chmod u+x /root/.vnc/xstartup`\r\n\r\nIf this still doesn&#39;t work, comment the first two lines again, or update the file to look like this:\r\n\r\n #!/bin/sh\r\n export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin\r\n [ -r $HOME/.Xresources ] & & xrdb $HOME/.Xresources\r\n xsetroot -solid grey\r\n vncconfig -iconic & \r\n xterm -geometry 80x24+10+10 -ls -title \" ;$VNCDESKTOP Desktop \" ; & \r\n startx & \r\n gnome-session &", "742" ], [ "The following information is taken from _URL_0_ This is CentOS 6.3 but I don&#39;t see why it shouldn&#39;t also be applicable to 6.7.\r\n\r\n1. Boot the CentOS installation DVD and choose the Rescue option\r\n1. Skip options until you get to the point where you can start a shell. (Do not allow the system to attempt to mount the filesystems.)\r\n1. Enable LVM in the rescue environment with the commands `vgscan` and `vgchange -a y`\r\n1. Run `lvdisplay | grep Path` and confirm that the root partition you want to shrink is `/dev/vg/root`\r\n1. Ensure the filesystem is clean by running `fsck -f /dev/vg/root`. If you get a warning that the filesystem is mounted then STOP IMMEDIATELY and DO NOT PROCEED.\r\n1. Resize the `root` filesystem to the desired size, `lvresize --resizefs --size 92G /dev/vg/root`. This may re-run `fsck`; that&#39;s fine.\r\n\r\nAt this point you should now have enough space in your LVM partition to extend and create the new filesystems\r\n\r\n1. Resize the `tmp` partition into the newly available space, `lvresize --size 8G /dev/vg/tmp` and extend the filesystem `fsck -f /dev/root/tmp; resize2fs /dev/root/tmp`\r\n1. Create the `home` filesystem. I&#39;d recommend you initially create it as 1T rather than the full disk as it&#39;s very easy to increase the size of a filesystem and partition later. Run `lvcreate --name home --size 1T /dev/vg`\r\n1. Create the filesystem on the new filesystem `mkfs -t ext3 -L home /dev/vg/home`. If you have `ext4` available to you use that instead of `ext3` for the filesystem type\r\n1. Exit the rescue shell and restart your system\r\n\r\nLog on and mount the new `home` filesystem on `/mnt/home`\r\n\r\n mkdir /mnt/home\r\n mount /dev/vg/home /mnt/home\r\n\r\nMove all the data from /home to /mnt/home\r\n\r\n mv /home/* /mnt/home\r\n\r\nEdit `/etc/fstab` and create a new entry for `/home`. Remember to use `ext4` instead of `ext3` if that&#39;s how you created the filesystem earlier\r\n\r\n LABEL=home /home ext3 defaults 0 2\r\n\r\nUmount the new home directory filesystem and remount it where it belongs\r\n\r\n umount /mnt/home\r\n mount /home\r\n\r\nReboot once more for good measure. At the very least, log out, but I&#39;d recommend a full restart.", "228" ], [ "If you run this command your `touch file` will be run, potentially multiple times, from the directory in which the command has been started:\r\n\r\n find -name &#39;*.pdf&#39; -exec touch file \\;\r\n\r\nOn the other hand, if you run this variant, each instance of the command will be run in the target file&#39;s directory:\r\n\r\n find -name &#39;*.pdf&#39; -execdir touch file \\;\r\n\r\nIn both cases you can see this in action by substituting the `touch file` with either `echo {}` and/or `pwd`.\r\n\r\n\r\n----------\r\nFrom manpage:\r\n > -execdir command ; < br > < br > \r\n-execdir command {} + < br > \r\n Like -exec, but the specified command is run from the subdirectory containing the matched file, which is not normally the directory in which you started find.", "20" ], [ "There is no \" ;current terminal \" ; when running from `cron`.\r\n\r\nBy default, `cron` sends an email containing output from the job. Your local mail subsystem delivers that to the file `/var/spool/mail/$USER`, and you can read it using `mail`, `mailx`, or your preferred local email client.\r\n\r\nThere&#39;s no particular reason why you couldn&#39;t get your `cron` job to write its output to a file in your home directory, for example like this:\r\n\r\n * * * * * date > $HOME/.current_date 2 > & 1\r\n\r\nIf you&#39;re running a GUI you can use `notify-send` to write messages in a pop-up on your screen. BUT it&#39;s not straightforward to do this from `cron`. Have a [search](_URL_0_) around StackExchange for [solutions](_URL_0_+site:unix.stackexchange.com) to this sub-problem.\r\n\r\nIf you want to write to a tty you can indeed use something like `echo hello, world > /dev/tty1`. You would probably want to ensure that the right account was indeed logged on to `/dev/tty1` before writing to it (this can be done by checking the ownership of the device, `stat -c %U /dev/tty1`).\r\n\r\n #!/bin/bash\r\n #\r\n me=roaima # userid to write messages to\r\n \r\n log()\r\n {\r\n local tty owner\r\n for tty in $( who | awk -v me= \" ;$me \" ; &#39;$1 == me {print $2}&#39; )\r\n do\r\n owner= \" ;$( stat -c %U \" ;/dev/$tty \" ; 2 > /dev/null ) \" ;\r\n [[ \" ;$me \" ; = \" ;$owner \" ; ]] & & echo \" ;$@ \" ; > \" ;/dev/$tty \" ;\r\n done\r\n }\r\n \r\n # ...\r\n \r\n log \" ;hello, world \" ;\r\n log \" ;this is a message for you to read RIGHT NOW \" ;\r\n exit 0\r\n\r\n\r\nHowever, you might be better off using the `write` command. For example, to write to a user \" ;roaima \" ; on a logged in terminal you could do this:\r\n\r\n * * * * * echo hello from cron | write roaima > /dev/null 2 > & 1", "496" ], [ "Some general comments.\r\n\r\n1. You&#39;ve disabled SMART on both your disks (or at least, you&#39;ve not enabled it). No tests are being run and none has been run previously. This tells me that there is no way you can know whether or not the disk is faulty.\r\n\r\n2. The kernel error message, `Add. Sense: Unrecovered read error - auto reallocate failed` suggests that the disk is well on the way to failing catastrophically, as it has no more spare sectors available to replace the currently failed one. For a disk in a RAID 0 array this is really bad news.\r\n\r\nYou might get away with a complete power off and reboot, but regardless, I really would strongly recommend you install the SMART Tools and configure them to test the disks regularly.", "325" ], [ "Your command `patch -p1 file.patch` looks for the filenames in the patch file. The `-p1` strips everything in the filenames up to the first `/`; in your case this is the leading `src/`. The command therefore expects to find `bacula.h` in your current directory.\r\n\r\nIncidentally, there is something very strange about the filenames you have provided as your example. They don&#39;t match, and the filenames in the patch file that should not match, do so. I would strongly recommend that that next time you copy and paste rather than free-typing.", "20" ], [ "Not being in the US I don&#39;t know the specifics of a standard United States International keyboard. However, if by a standard keyboard you mean one that doesn&#39;t use dead keys (so quotes appear immediately rather than accenting characters) this should be set up almost as part of the standard installation. If this isn&#39;t what you need then it would help in the international community to explain what it is that you want.\r\n\r\nIf you need to access accented characters then consider enabling the Compose Key. The Compose Key is a prefix key that tells the system to take the next two characters and combine them \" ;visually \" ; to create a single character. For example, < kbd > Compose < /kbd > < kbd > o < /kbd > < kbd > \" ; < /kbd > will result in the single character &#246;. And so on.", "104" ], [ "There are a number of options available to you\r\n\r\n1. You can use `cron` to switch the `ssh` server on and off\r\n2. You can use `iptables` to block and unblock the `ssh` port\r\n3. You can sidestep all of this by running `ssh` on different port\r\n4. You can implement port knocking\r\n5. You can disable external access to `ssh` entirely and mandate use of a VPN\r\n\r\nI&#39;m sure other solutions are available, but I&#39;ve stopped at five.", "883" ], [ "The names of the patch files shouldn&#39;t matter. What does (usually) matter is the name of the file to patch, as defined within the first two lines of the patch file itself.\r\n\r\nAs an example\r\n\r\n --- /tmp/file.original 2015-10-08 13:02:28.171436259 +0100\r\n +++ /tmp/file 2015-10-08 13:02:31.167408397 +0100\r\n @@ -1,3 +1,3 @@\r\n This is the file\r\n -This is the original file\r\n +This is the patched version of the file\r\n This is the file\r\n\r\nThis shows that the file to be patched is `/tmp/file`, and the patch can be applied with `patch -p0 < patch_file`.", "919" ], [ "The solution I&#39;m offering starts each file with &#39;SET PATH&#39;. It does not check for &#39;END&#39; at the end of the section (but you didn&#39;t explain what should happen if a subsequent &#39;SET PATH&#39; occurred without a preceding &#39;END&#39;, so I&#39;m assuming this isn&#39;t a hard requirement).\r\n\r\n csplit -kz source.sql &#39;/^SET PATH /&#39; &#39;{*}&#39;\r\n\r\nThe `csplit` command splits the `source.sql` file with the regular expression that corresponds to the string &#39;SET PATH&#39; anchored to the beginning of the line. There are various flags controlling the names of the output files but by default the output for your sample is put into files `xx00` and `xx01`.", "879" ], [ "Spaces (and probably case) are ignored when sorting with your locale. Thus you have this ordering after the common prefix \" ;Star Wars Episode \" ;:\r\n\r\n- IIA\r\n- III\r\n- ITH\r\n\r\nThe `find` returns results in directory order, which just happens to be the \" ;expected \" ; order.\r\n\r\nYou can return to \" ;traditional \" ; sorting per this from the [man page](_URL_0_):\r\n\r\n > Set LC_ALL=C to get the traditional sort order that uses native byte values.", "837" ], [ "Your host doesn&#39;t sufficiently know that it is supposed to be `_URL_0_`. A local delivery to `root` is rewritten as `root@_URL_0_`, which is (wrongly) considered to be elsewhere, so an off-host delivery is attempted.\r\n\r\nYou need to complete the process telling `exim4` that your local host really is `_URL_0_`. Then, when it delivers to `root`, rewritten as `root@_URL_0_` it will consider this as local delivery. It will then check the `/etc/aliases` file and perform off-host delivery to `<EMAIL_ADDRESS>` per your instructions.\r\n\r\nLet&#39;s assume your host&#39;s real DNS name is `_URL_2_`. Rerun `dpkg-reconfigure exim4-config` and include these settings:\r\n\r\n- System mail name: `_URL_2_`\r\n- Other destinations for which [local] mail is accepted: `myhost : _URL_0_`\r\n- Domains to relay mail for: *{empty}*\r\n- Machines to relay mail for: *{empty}*\r\n\r\nThen run `update-exim4.conf` and `invoke-rc.d exim4 restart`", "160" ], [ "You&#39;ve demonstrated that it&#39;s not the login shell or `ssh` at fault, because if it was the `ssh pi@<IP_ADDRESS><PHONE_NUMBER> id` would have failed.\r\n\r\nNext things to try are temporarily moving your `.profile` out of the way. Don&#39;t worry about errors from `mv` not finding the file:\r\n\r\n ssh pi@192.168.151 mv .bash_profile .bash_profile.SAVE\r\n ssh pi@192.168.151 mv .profile .profile.SAVE\r\n\r\nNow try logging in again. If that fails then try this to identify the point at which the shell set-up fails:\r\n\r\n ssh pi@192.168.151 /bin/bash -xi\r\n\r\nYou&#39;ll get lots of lines starting with `+` showing the commands that `bash` runs during its set-up. The few lines immediately before the point it terminates unexpectedly are the most relevant. You will either be able to diagnose the issue from those lines or you&#39;ll need to add them to your question.", "883" ], [ "Take a look at the two outputs. Here are samples from my system\r\n\r\n lsof -n -itcp | head -4\r\n COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME\r\n rpcbind 1509 root 8u IPv4 9013 0t0 TCP *:sunrpc (LISTEN)\r\n rpcbind 1509 root 11u IPv6 9016 0t0 TCP *:sunrpc (LISTEN)\r\n rpc.statd 1537 statd 8u IPv4 10059 0t0 TCP *:36035 (LISTEN)\r\n \r\n lsof -n | grep TCP | head -4\r\n rpcbind 1509 root 8u IPv4 9013 0t0 TCP *:sunrpc (LISTEN)\r\n rpcbind 1509 root 11u IPv6 9016 0t0 TCP *:sunrpc (LISTEN)\r\n rpc.statd 1537 statd 8u IPv4 10059 0t0 TCP *:36035 (LISTEN)\r\n rpc.statd 1537 statd 10u IPv6 10063 0t0 TCP *:45203 (LISTEN)\r\n\r\nA quick perusal shows that the only obvious differences so far is whitespace. This can be compared easily enough to find real differences:\r\n\r\n lsof -n -itcp | sort > 1\r\n lsof -n | grep TCP | sort > 2\r\n diff -wu 1 2 | grep &#39;^[+-]&#39;\r\n --- 1 2015-10-13 20:43:12.588658249 +0100\r\n +++ 2 2015-10-13 20:43:18.272678740 +0100\r\n -COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME\r\n +dconf 3618 3634 roaima 11u IPv6 12705 0t0 TCP [<IP_ADDRESS>1]:45177- > [<IP_ADDRESS>1]:6010 (ESTABLISHED)\r\n +gdbus 3632 3633 roaima 5u IPv6 14008 0t0 TCP [<IP_ADDRESS>1]:45179- > [<IP_ADDRESS>1]:6010 (ESTABLISHED)\r\n +virt-mana 3618 3636 roaima 11u IPv6 12705 0t0 TCP [<IP_ADDRESS>1]:45177- > [<IP_ADDRESS>1]:6010 (ESTABLISHED)\r\n +virt-mana 3618 3645 roaima 11u IPv6 12705 0t0 TCP [<IP_ADDRESS>1]:45177- > [<IP_ADDRESS>1]:6010 (ESTABLISHED)\r\n\r\nBased on this output I&#39;d suggest that the difference in my case is the IPv6 traffic. You might want to review your own situation but I suspect it&#39;s the same.", "168" ], [ "If the two endpoints cannot see each other then no data will be transferred. On each scheduled run, a successful and complete connection will result in all outstanding data being transferred.\r\n\r\nHowever, it sounds like you really shouldn&#39;t be using `rsync` for this task, though, as it is unidirectional. If you can have updates going both ways you should consider something like `unison` to handle this.", "188" ], [ "I&#39;m a great believer in reminding new users that they should [edit](_URL_1_) their question to include updates rather than losing them amongst comments. What I find, though, is that the single word [edit](_URL_1_) is sometimes not as useful or visible as a [link to the edit button with some descriptive text](_URL_1_).\r\n\r\nI have found that it&#39;s not possible to use arbitrary text without unrolling the convenient shortcut \\[edit\\], and I was hoping that it would be a reasonable request to have \\[edit\\] work with \\[any relevant text\\](edit).\r\n\r\nI could then write _please \\[edit your question](edit)_ rather than _please \\[edit your question\\]\\(_URL_0_)_", "431" ], [ "You&#39;re using comma `,` to separate `mail.notice` and `!err`. However, this is additive so you&#39;re saying _Accept messages at `mail.notice` and also all `!err`_. What you want is to say _Accept messages at `mail.notice` except for `mail.err`_.\r\n\r\nThe [man page for `rsyslog.conf`](_URL_1_) does show this, although it&#39;s not as clear as it could be:\r\n\r\n > You can specify multiple facilities with the same priority pattern in one statement using the comma (&#39;,&#39;) operator. You may specify as much facilities as you want. Remember that only the facility part from such a statement is taken, a priority part would be skipped.\r\n\r\n > Multiple selectors may be specified for a single action using the semicolon (&#39;;&#39;) separator. Remember that each selector in the selector field is capable to overwrite the preceding ones. **Using this behavior you can exclude some priorities from the pattern.**\r\n\r\nTherefore, the solution is to replace the comma `,` with a semicolon `;` and include the facility thus:\r\n\r\n mail.notice;mail.!=err -/var/log/usomail.log\r\n\r\nThere is a similar example in the [`syslog.conf` man page](_URL_0_) too.", "812" ], [ "You want to sort the full set of \" ;recent \" ; files by their access/modify time, regardless of their location in the file tree?\r\n\r\nOne way of doing this is to use `stat` to print the modify time for each file, `sort` by the result, and then `cut` the modification time from the results.\r\n\r\nThis will break for files containing newlines in their names, but for other files here&#39;s a solution that will list files modified within the last 60 minutes, ordered from most recently to least recently modified:\r\n\r\n find . -type f -mmin -60 -exec stat -c $&#39;%Y\\t%n&#39; {} + | sort -nr | cut -f2-", "705" ], [ "This version works for me. However, as your own script also works here I&#39;m not entirely sure this will fix your problem.\r\n\r\nSystem-wide crontab entry (omit the `root` field if this is root&#39;s own crontab, as accessed with `crontab -e`):\r\n\r\n * * * * * root /root/_URL_0_\r\n\r\nAs far as I can detemine, your script takes the third iteration from `top` and collects the CPU usermode percentage. It also collects the cached memory value from `free`. Here I&#39;ve dispensed with `free` and extracted the same value from the third iteration of `top`. Copy this script to /root/_URL_0_ (and make it executable):\r\n\r\n #!/bin/bash\r\n top -b -n 3 -d 1 |\r\n awk -v date= \" ;$(date) \" ; &#39;\r\n /^%Cpu/ {cpu=$2}\r\n /cached Mem/ {cached=$9}\r\n END {printf \" ;\\n%s\\t%s\\t%s \" ;, date, cpu, cached}\r\n &#39; > > /root/log_lojar_top_free.txt\r\n\r\nMake the script executable:\r\n\r\n chmod +x /root/_URL_0_", "496" ], [ "I&#39;ve also come across this unwanted whitespace when working with a different database. Clearly, shell scripts and tools like SQLPlus are the wrong thing to use for extracting data from databases but there are occasions when it&#39;s convenient.\r\n\r\nMy solution is to strip leading and trailing whitespace from the result:\r\n\r\n psnr() {\r\n sqlplus -s USR/PASS@PROD < < &#39;EOS&#39; | sed -e $&#39;s/^[ \\t]*//&#39; -e $&#39;s/[ \\t]*$//&#39;\r\n SET PAGESIZE 0\r\n SET COLSEP \" ;; \" ;\r\n SET FEEDBACK OFF\r\n SET TRIMOUT ON\r\n SET TRIMSPOOL ON\r\n select max_number-last_number from postalslip\r\n where state = &#39;OPEN&#39;\r\n /\r\n exit\r\n /\r\n EOS\r\n }\r\n\r\n--------\r\n\r\nIf `ksh` doesn&#39;t support the `$&#39;...&#39;` string syntax it&#39;s easy enough to replace:\r\n\r\n # Original style\r\n sed $&#39;s/^[ \\t]*//&#39;\r\n\r\n # Alternative style\r\n T=$(printf \" ;\\t \" ;)\r\n ...\r\n sed \" ;s/^[ $T]*// \" ;\r\n\r\n---------\r\n\r\nAn alternate quick and dirty fix is to use the shell to strip unwanted whitespace. Leaving your `psnr()` function unchanged, instead of this:\r\n\r\n echo \" ;Today&#39;s result is: $PSNR \" ; > $MAILTMP\r\n\r\nyou would write this:\r\n\r\n echo \" ;Today&#39;s result is: \" ; $PSNR > $MAILTMP", "112" ], [ "The easiest approach is to find and save all files that have been modified in \" ;the last few weeks \" ;, then reinstall and reapply the changes.\r\n\r\n1. Boot a rescue disk.\r\n1. Find and save \" ;recently \" ; changed files - `cd /mnt/root & & tar czvf /mnt/usb/tarball.tgz --newer-mtime=&#39;2015-10-01 00:00:00&#39; .` Make sure that `/mnt/root` is the root of your Pi system and not the root of the rescue disk, and that `/mnt/usb` is somewhere safe, such as a USB stick\r\n1. Reinstall\r\n1. Restore the files you carefully saved - `cd / & & tar xzvf /root/tarball.tgz`\r\n1. Reboot", "428" ], [ "This is a collection of single-letter parameters (see the man page for `rsync`) along with the necessary extras to instruct `rsync` to run in stream-based server mode. Typically this is the server-side invocation for `rsync` over `ssh`.\r\n\r\nQuoting from the man page\r\n\r\n > The options `--server` and `--sender` are used internally by rsync, and should never be typed by a user under normal circumstances. Some awareness of these options may be needed in certain scenarios, such as when setting up a login that can only run an `rsync` command [...]", "883" ], [ "I understand you actually want N days listed rather than the hardcoded five you have actually shown in your question. Here is a `bash` solution that will address this requirement:\r\n\r\n n=5\r\n today=$(date +&#39;%Y-%m-%d&#39;)\r\n for ((d=1; n > 0; d++))\r\n do\r\n # Adjust this next line to get the date format you require, e.g. +&#39;%Y%m%d&#39;\r\n date=$(date --date \" ;$today -$d day \" ;)\r\n nday=$(date --date \" ;$today -$d day \" ; +&#39;%w&#39;)\r\n if [[ $nday > 0 & & $nday < 6 ]]\r\n then\r\n # Adjust this next line to output whatever you really need\r\n echo \" ;n=$n, d=$d, nday=$nday, date=$date: WEEKDAY \" ;\r\n : $((n--))\r\n fi\r\n done\r\n\r\nOutput for `n=5`, run on 5th November 2015\r\n\r\n n=5, d=1, nday=3, date=Wed, 4 Nov 2015 00:00:00: WEEKDAY\r\n n=4, d=2, nday=2, date=Tue, 3 Nov 2015 00:00:00: WEEKDAY\r\n n=3, d=3, nday=1, date=Mon, 2 Nov 2015 00:00:00: WEEKDAY\r\n n=2, d=6, nday=5, date=Fri, 30 Oct 2015 00:00:00: WEEKDAY\r\n n=1, d=7, nday=4, date=Thu, 29 Oct 2015 00:00:00: WEEKDAY", "956" ], [ "If haproxy isn&#39;t up to the job then replace it with something that is, such as a BigIP from F5. Re the port numbers, unless you move to port 80 (http) or port 443 (https) you _cannot_ remove the port numbers from your URLs. Re public IP, I don&#39;t see the problem: just don&#39;t listen on the public IP addresses for those server domains.", "580" ], [ "Your requirements state,\r\n\r\n > You can feed the user name to `finger` using the `whoami` command and piping the output to `xargs`. The argument for `xargs` is, of course, the `finger` command.\r\n\r\nYou then yourself say that you use this command: `find . _URL_0_ | xargs finger {username}` but that you don&#39;t get the required result.\r\n\r\nThe command you have designed doesn&#39;t match the criteria given in the requirement. Let&#39;s break that down:\r\n\r\n > The argument for `xargs` is [...] the `finger` command\r\n\r\nOK, so we have `xargs finger`. This requires input, and each line of input is appended to the end of the `finger` command by `xargs`.\r\n\r\n > feed the user name to `finger` using the `whoami` command\r\n\r\nWe can&#39;t do `whoami | finger` (well we can, but it&#39;s meaningless as `finger` doesn&#39;t read from _stdin_), but we can apply the output of `whoami` to the end of the `finger` command like this:\r\n\r\n whoami | xargs finger\r\n\r\nThat should answer the first part of your question. When you&#39;ve used this and worked out what&#39;s missing in your second part perhaps you&#39;d like to update your question with the new information.", "103" ], [ "If you&#39;re on a Linux-based system use `cat` instead of `dd`\r\n\r\n cat source.img > /dev/destdisk\r\n\r\nBut really you need to consider the IO speed of your disks and the data bus to which they&#39;re attached: how fast your spinning disk can deliver data, and the speed of whichever flavour of USB you are using.\r\n\r\nBottom line: if you were 100% CPU bound there might be something you can do in software, but here you are almost certainly IO bound.\r\n\r\n------\r\nAccording to [Why the cat(1) ran faster than dd(1M)](_URL_0_) the `cat` utility is faster than `dd` even when using the same block size. (The article explains why - it&#39;s apparently because `cat` uses `mmap()` whereas `dd` does not.)", "437" ], [ "@Error3735 you don&#39;t \" ;run \" ; a `.plan` file - it&#39;s just text. Please [update your question](_URL_0_) to explain properly what you are trying to achieve. Questions to consider: 1. if you&#39;re trying to run two commands in a script why can&#39;t you just put them on consecutive lines? 2. Why do you want to send the user&#39;s input through `xargs`? 3. What do you really mean by \" ;running \" ; the `.plan` file?", "351" ], [ "You have three almost-identically configured servers, but you want to run the `cron` jobs on only one of them?\r\n\r\nLet&#39;s follow your naming scheme for the servers: `web01`, `web02`, and `web03`. I&#39;m using shell script, but the principle is exactly the same for PHP. (I can throw PHP around but I don&#39;t consider myself well-versed enough to code it in public.)\r\n\r\nNear the top of each `cron` script you can do something like this, which will cause the script to exit unless the server name is `web01`.\r\n\r\n [ web01 != \" ;$(hostname) \" ; ] & & exit\r\n\r\nThis isn&#39;t very resilient in the face of a server outage. If `web01` dies you presumably want to pick up the `cron` jobs on another server. Assuming you have access to DNS you can create a CNAME to the server responsible for running `cron`. Here&#39;s a sample entry for `bind`; it&#39;ll be similar for other systems:\r\n\r\n _URL_1_ 300 IN CNAME _URL_0_\r\n\r\nYou can then use either `dig` or `nslookup` to compare the server name to the alias, and within five minutes (300 seconds) you can have swapped the responsibilities for `cron` to another server:\r\n\r\n myaddr= \" ;$(nslookup \" ;$(hostname) \" ; | awk &#39;$1== \" ;Address: \" ;{a=$2} END{print a}&#39;) \" ;\r\n cronaddr= \" ;$(nslookup \" ;$(hostname) \" ; | awk &#39;$1== \" ;Address: \" ;{a=$2} END{print a}&#39;) \" ;\r\n [ \" ;$myaddr \" ; != \" ;$cronaddr \" ; ] & & exit\r\n\r\nOr:\r\n\r\n myaddr= \" ;$(dig +short \" ;$(hostname)._URL_2_ \" ;) \" ;\r\n cronaddr= \" ;$(dig +short _URL_1_) \" ;\r\n [ \" ;$myaddr \" ; != \" ;$cronaddr \" ; ] & & exit", "496" ], [ "Two changes are required for this to work:\r\n\r\n1. Remove the `server` definition as it&#39;s replaced by the `broadcastclient` entry\r\n1. Remove the `nopeer` qualifier from the `restrict` statement. Otherwise the client cannot (will not) talk to the multicast server.\r\n\r\nHere&#39;s a corrected sample client configuration file:\r\n\r\n driftfile /var/lib/ntp/ntp.drift\r\n \r\n disable auth\r\n broadcastclient\r\n \r\n restrict -4 default noquery nomodify notrap\r\n restrict -6 default noquery nomodify notrap\r\n restrict <IP_ADDRESS>\r\n restrict <IP_ADDRESS>1", "53" ], [ "Consider two instances of your proposal running simultaneously, having started simultaneously. They will both find that (say) num=4 is available and both will attempt to use the same target name.\r\n\r\nI can&#39;t test this alternative right now, but something like this might be sufficient\r\n\r\n num=1 attempt=10\r\n while ! mv --no-clobber \" ;$1 \" ; \" ;${PWD}/DUPES/${num}-$1 \" ; & & [[ 0 -lt $attempt ]]\r\n do\r\n num=$((num+1))\r\n attempt=$((attempt-1))\r\n done\r\n [[ 0 -eq $attempt ]] & & echo \" ;ERROR: Too many attempts to handle $1 \" ; > & 2", "443" ], [ "What is expected to happen with the older files that may well never get transferred because newer files get in the way? If we&#39;ve found 9.5GB of files to transfer and the next one is 1GB does it matter if we end up transferring 10.5GB or is it essential that the transfer is capped at no more than 10GB? (As a corollary, what should happen if a single one of your files exceeds 10GB size?) Finally, is the target requirement actually to limit data transfer \" ;on the wire \" ; to 10GB (which is not what you&#39;ve asked)?", "893" ], [ "A quick Google shows that recommended safe configurations for `pgbouncer` often set up the listening port only on the loopback interface (`localhost`). [Here is one example](_URL_0_):\r\n\r\n [pgbouncer]\r\n listen_port = 5433\r\n listen_addr = localhost\r\n auth_type = any\r\n logfile = pgbouncer.log\r\n pidfile = pgbouncer.pid\r\n\r\nThe [configuration documentation](_URL_1_) explains clearly how to change the addresses on which the service listens:\r\n\r\n > **listen_addr**\r\n > \r\n > Specifies list of addresses, where to listen for TCP connections. You\r\n > may also use * meaning “listen on all addresses”. When not set, only\r\n > Unix socket connections are allowed.\r\n > \r\n > Addresses can be specified numerically (IPv4/IPv6) or by name.\r\n > \r\n > Default: not set\r\n > \r\n > **listen_port**\r\n > \r\n > Which port to listen on. Applies to both TCP and Unix sockets.\r\n > \r\n > Default: 6432\r\n\r\nSince you&#39;ve now responded that you&#39;ve already done this, I&#39;ll leave it here for the record, but make an additional suggestion below.\r\n\r\n--------\r\n\r\nThe follow-up posts on the mailing list to [the one you referenced](_URL_2_) provide [the answer](_URL_3_). I&#39;ll quote it here:\r\n\r\n > **User 1**\r\n > \r\n > I restarted using `/etc/init.d/pgbouncer restart`, which effectively\r\n > launches `pgbouncer` with `-R` for a online restart.\r\n > \r\n > **User 2**\r\n > \r\n > I suspect the `-R` is working too well for you - it reuses the old\r\n > listening socket, with means the bind address stays the same.\r\n > \r\n > This preference is natural - you rarely change bind addres, but may\r\n > change other settings (or `pgbouncer` version).\r\n > \r\n > **You should just do proper stop/start**, then it should take new address in use.", "168" ], [ "This is a Grub2 password prompt. You need to enter the Grub username and password that you have previously defined.\r\n\r\nSee _URL_0_\r\n\r\nPicking parts of this [page about Grub2 passwords](_URL_0_), we get this:\r\n\r\n > GRUB 2 offers basic password protection for its menu and terminal.\r\n > This page will detail the procedures necessary to establish and use\r\n > the GRUB 2 password option.\r\n > \r\n > Enter username:\r\n > <PERSON>\r\n > Enter password:\r\n > _\r\n > \r\n > \r\n > If GRUB 2 is set up to boot directly to a password-protected menuentry\r\n > without displaying a menu, the username/password prompt will appear\r\n > and booting will not occur until they are correctly entered.\r\n > \r\n > Errors in creating a password-protected GRUB 2 menu may result in an\r\n > unbootable system. To restore a system with broken passwords, access\r\n > and edit the GRUB 2 configuration files using the LiveCD or another\r\n > OS.\r\n > \r\n > If GRUB 2 is set up to boot automatically to a password-protected\r\n > menuentry the user has no option to back out of the password prompt to\r\n > select another menuentry. Holding the SHIFT key will not display the\r\n > menu in this case. The user must enter the correct username and\r\n > password. If unable, the configuration files will have to be edited\r\n > via the LiveCD or other means to fix the problem.\r\n\r\nAs to why the screen is purple, I assume it&#39;s because that&#39;s what you&#39;ve configured. I like purple, but I don&#39;t think I&#39;d choose it for a screen background colour.", "12" ], [ "The problem is with the combination of the first line of the script and the `rsync` command itself. Let&#39;s take a look...\r\n\r\nThe `find /backup/staging/ -mtime +7 -exec rm -rf {} \\;` command removes all files _and entire directory trees_ where the file or root of the directory tree hasn&#39;t been modified for at least seven days.\r\n\r\nYou are also using `rsync -a ...`, which copies across modification times of files and directories.\r\n\r\nThe net result is that your `find` will match and remove files and directory trees that have been created at least seven days ago. Typically this will include system files such as `/bin/ls` and almost certainly `/` itself. You can check with `ls -ld /`, and confirm that the modification date displayed is more than a week ago.\r\n\r\nOne solution would be to use `rsnapshot`, which manages timed and dated backups extremely well. Another might be to use `rsync -a ... --delete`, but on balance I&#39;d recommend `rsnapshot`.\r\n\r\nIf you really want to roll your own solution, consider something like this pair of commands:\r\n\r\n find /backup/staging -mtime +7 \\! -type d -delete\r\n find /backup/staging -depth -type d -exec rmdir {} + 2 > /dev/null\r\n\r\nThis will remove all non-directories (i.e. files, device nodes, etc.) that are older than seven days, and then remove all empty directories.", "92" ], [ "By default `xargs` splits at whitespace. You may be able to use the [non-standard](_URL_1_) `-0` [option](_URL_0_) to split at character `\\000`, but your input has to be prepared to match the expectation. (`find ... -print0` is one of the ways of doing this - assuming your version of `find` has the `-print0` option.)\r\n\r\nProvided that none of your files contains a new line in their name (i.e. you have one file per line) you can use `xargs` like this:\r\n\r\n xargs -I{} rm {} < real-dupes.txt\r\n\r\nThe man page for `xargs` has this to say about the `-I` flag:\r\n\r\n > **`-I replace-str`**\r\n > Replace occurrences of `replace-str` in the initial-arguments with\r\n > names read from standard input. Also, unquoted blanks do not\r\n > terminate input items; instead the separator is the newline\r\n > character. Implies `-x` and `-L 1`.", "349" ], [ "One option is to pass the shell variable into `awk`, which avoids requoting:\r\n\r\n awk &#39;NR > 13 {if ($4==dmn) print $1, $2, $3, $4;}&#39; dmn= \" ;${DMN[$i]} \" ; domain_all.dat > > ddh_domain_${DMN[$i]}.dat\r\n\r\n----------\r\n\r\nI&#39;d be inclined to refactor your shell script, too, so that the variable is passed into your shell function:\r\n\r\n declare -a DMN=( \" ; \" ; \" ;200 \" ; \" ;190 \" ; \" ;180 \" ;)\r\n NRL=3\r\n \r\n runDHFiles()\r\n {\r\n local dmn= \" ;$1 \" ;\r\n awk &#39;NR > 13 & & $4==dmn {print $1, $2, $3, $4;}&#39; dmn= \" ;$dmn \" ; domain_all.dat > > \" ;ddh_domain_${dmn}.dat \" ;\r\n }\r\n \r\n for ((i=1; i < =NRL; i++ ))\r\n do\r\n runDHFiles \" ;${DMN[$i]} \" ;\r\n done", "848" ], [ "You&#39;re confusing the two different result sets that can be obtained with `getent hosts`.\r\n\r\n1. `getent hosts` will return a result broadly equivalent to `cat /etc/hosts`\r\n1. `getent hosts TARGET` will use the `hosts` entry in `/etc/nsswitch.conf` to lookup one or more host databases for `TARGET`, returning the first match it finds\r\n\r\nScript 1 will look up `host` only from `/etc/hosts`. It can also be slightly shortened:\r\n\r\n host=_URL_0_\r\n ip=$(getent hosts | awk &#39;/&#39; \" ;$host \" ;&#39;/ {print $1; exit}&#39;)\r\n echo $ip\r\n\r\nScripts 2 and 3 will search `/etc/hosts` and probably DNS too. It&#39;s not clear to me where you are putting `&#39;` or ` \" ;` so that your third script fails to work.", "160" ], [ "Something like this may be what you&#39;re looking for:\r\n\r\n #!/bin/bash\r\n last= \" ;${PWD/*\\/} \" ;\r\n while test / != \" ;$PWD \" ;\r\n do\r\n cd ..\r\n this= \" ;${PWD/*\\/} \" ;\r\n if test &#39;B-dir&#39; = \" ;$this \" ;\r\n then\r\n find \" ;$last \" ; ...\r\n break\r\n fi\r\n last= \" ;$this \" ;\r\n done\r\n\r\n\r\nIt assumes you&#39;re starting in `/A-dir/B-dir/mydir/... some directories .../x-dir` and works its way up the tree until it reaches `B-dir`. At this point it runs the `find mydir...` command for whatever value of `mydir` preceded `B-dir`.\r\n\r\nThe current directory (`PWD`) is updated while the script is running. It wouldn&#39;t be very hard to avoid the directory change by manipulating a directory path string rather than the implicit use of `$PWD`, but I chose to implement it this way.", "613" ], [ "You wrote:\r\n\r\n > Force logrotate to run with the following: `logrotate --force /etc/logrotate.d/derp`. This command rotates the logs correctly but the next day they will not run.\r\n\r\nThe problem here is that the `daily` attribute actually means \" ;24 hours \" ;. So unless the `cron` entry for `logrotate` (probably in `/etc/cron.d/daily`) is more than 24 hours away from the time you manually rotate the log files, the log files will not be rotated until the day after that.\r\n\r\nOn my Debian system the entries in `/etc/cron.daily` are run daily at 06:25, so it&#39;s probable that any manual log rotation done during the normal working day will prevent a log rotation occurring until two days later.", "496" ], [ "@michalsol you&#39;re not generally expected to get banned immediately. There are parameters that control the number of wrong events and the time period in which they must happen. You could reduce it to one wrong attempt but you&#39;d be better off setting it at, say, two attempts in one minute. If this answer helped you please use the tick mark to accept it.", "1007" ], [ "The problem here is almost certainly that there is a rogue process attached to the terminal but still accepting input. You can ascertain the process by running\r\n\r\n ps -ft $(tty)\r\n\r\nIgnore the shell (often `bash`) and the `ps` command itself. Anything else you can kill (use `kill` or `kill -1`, followed by the numbers in the PID column). If you rerun the `ps` command and still see the rogue commands then repeat the `kill` command but this time go for `kill -9`. DO NOT use the `-9` unless other options have first been tried, and failed.\r\n\r\nExample\r\n\r\n $ ps -ft $(tty)\r\n UID PID PPID C STIME TTY TIME CMD\r\n roaima 29949 29948 1 17:43 pts/0 00:00:00 -bash\r\n roaima 30019 29949 1 17:44 pts/0 00:00:00 vi\r\n roaima 30021 29949 0 17:44 pts/0 00:00:00 ps -ft /dev/pts/0\r\n \r\n $ kill -1 30019 # vi is a background process eating input\r\n $ ps -ft ($tty)\r\n UID PID PPID C STIME TTY TIME CMD\r\n roaima 29949 29948 1 17:43 pts/0 00:00:00 -bash\r\n roaima 30019 29949 1 17:44 pts/0 00:00:00 vi\r\n roaima 30021 29949 0 17:44 pts/0 00:00:00 ps -ft /dev/pts/0\r\n\r\n $ kill -9 30019\r\n $ ps -ft $(tty)\r\n UID PID PPID C STIME TTY TIME CMD\r\n roaima 29949 29948 1 17:43 pts/0 00:00:00 -bash\r\n roaima 30021 29949 0 17:44 pts/0 00:00:00 ps -ft /dev/pts/0", "691" ], [ "You haven&#39;t added a physical interface (`envmw`) to your bridge. You also need to set that interface to promiscuous mode without an IP address:\r\n\r\n brctl addif virbr0 envmw\r\n ip addr add 0/0 dev envmw\r\n ip addr del <IP_ADDRESS>/24 dev envmw\r\n ip link set envmw promisc on\r\n\r\nRunning these commands from a remote session is a bad idea, because it&#39;s changing the interface configuration. This in turn will disconnect any remote traffic - including the remote session.", "53" ], [ "You need to make the file excutable. The `touch` command doesn&#39;t do that, the `chmod` command does:\r\n\r\n chmod a+x some_new_file.sh\r\n\r\nOr use your GUI to set the excutable permissions on the file.\r\n\r\nDon&#39;t forget, if you&#39;re uploading a script, that you must transfer the file in TEXT mode and _not_ in BINARY mode. Otherwise it&#39;ll fail at the next step (when you run it).", "708" ], [ "The definition of `sleep(3)` allows for the call to return *before*, *at*, or *after* the time specified:\r\n\r\n > **DESCRIPTION** `sleep()` makes the calling thread sleep until seconds seconds have elapsed or a signal arrives which is not ignored.\r\n\r\nSo we have these possible scenarios\r\n\r\n 1. The call is interrupted with an uncaught signal. `sleep()` returns immediately and before the specified time\r\n 1. The call completes satisfactorily, but the system is so busy it can&#39;t schedule your task for some time\r\n 1. The call complete satisfactorily and is put back on the run queue and executed immediately", "16" ], [ "Partition 3 is only 1MB long, which isn&#39;t enough to create a PV.\r\n\r\n**Empirical evidence**\r\n\r\n\r\n dd if=/dev/zero bs=1M count=1 > dd.img\r\n loop=$(losetup --show --find dd.img); echo \" ;$loop \" ;\r\n # /dev/loop0\r\n pvcreate \" ;$loop \" ;\r\n # Device /dev/loop0 not found (or ignored by filtering).\r\n losetup -d \" ;$loop \" ;\r\n rm -f dd.img\r\n \r\n dd if=/dev/zero bs=10M count=1 > dd.img\r\n loop=$(losetup --show --find dd.img); echo \" ;$loop \" ;\r\n # /dev/loop0\r\n pvcreate \" ;$loop \" ;\r\n # Writing physical volume data to disk \" ;/dev/loop0 \" ;\r\n # Physical volume \" ;/dev/loop0 \" ; successfully created\r\n losetup -d \" ;$loop \" ;\r\n rm -f dd.img\r\n\r\n**Discovery**\r\n\r\nFurther investigation shows that at least 2MB (2048000 bytes) is required for `pvcreate` to succeed. It turns out that this is defined in the `lvm.conf`(5) file with the keyword `pv_min_size`, where the [man page](_URL_0_) states\r\n\r\n > **pv_min_size** -- Minimal size (in KB) of the block device which can\r\n > be used as a PV. In clustered environment all nodes have to use\r\n > the same value. Any value smaller than 512KB is ignored. Up to\r\n > and include version 2.02.84 the default was 512KB. From 2.02.85\r\n > onwards it was changed to 2MB to avoid floppy drives by default.\r\n\r\nSo there you have it. I&#39;ve learned something today, too.", "893" ], [ "`rsync` is the wrong tool for this task, for exactly the reasons that you have encountered. Instead, consider using [`unison`][1]:\r\n\r\n unison A/ B/\r\n\r\nThe first time you run this it will identify files that are uniquely in `A`, and those that are uniquely in `B`. It will also flag those that are in both places and ask you to identify which is to be overwritten.\r\n\r\nThe next time you run this it will copy changes from `A` to `B` and also `B` to `A`, flagging any files that have been changed in both places for manual resolution.\r\n\r\n mkdir A B\r\n date > A/date\r\n who > B/who\r\n unison A/ B/\r\n # Lots of output from unison, showing synchronisation\r\n \r\n ls A\r\n date who\r\n ls B\r\n date who\r\n \r\n date > A/date\r\n unison A/ B/\r\n # Lots of output from unison, showing synchronisation\r\n\r\nThere are a number of useful flags available for `unison` which help automate the process by defining assumptions and thereby reducing the number of questions you&#39;re asked during the synchronisation.\r\n\r\n\r\n [1]: _URL_0_", "705" ], [ "The `source their-script` command tells your shell to execute `their-script` directly in the context of your script. This means it has access to all your variables, and can even change them.\r\n\r\nIf you remove the word `source` and just run `their-script` as a command it will be unable to affect any of your code, and its `$1` will be the first argument you give it, so in this example its `$1` will take the value `banana`:\r\n\r\n their-script banana", "613" ], [ "When `rsync` believes it&#39;s accessing both source and destination on the same host it does not use its incremental transfer. Instead, it simply copies the entire file.\r\n\r\nThis is the situation in your case. As a result, your second command is copying the `_URL_0_~new` across your ssh fuse link to the local host, and then immediately copying it back again.\r\n\r\nIs there anything wrong with using this instead?\r\n\r\n mv remote1/_URL_0_~new remote1/_URL_0_\r\n\r\nTo get the fastest speed you should not try to run `rsync` over `sshfs` but instead allow it to talk to the remote server directly (over `ssh`). You could then use the simple variant:\r\n\r\n rsync -av local/_URL_0_ remote:path/to/_URL_0_\r\n\r\nThe new file won&#39;t be installed until it has been completely copied, and you have the advantage of being able to use the old library as a base for the new one.", "883" ], [ "The [man page](_URL_0_) for `dhclient-script`(8) defines the behaviour carefully. The script(s) will get called for each possible action:\r\n\r\n > **OPERATION**\r\n > When `dhclient` needs to invoke the client configuration script, it defines a set of\r\n > variables in the environment, and then invokes `CLIENTBINDIR/dhclient-script`. In all\r\n > cases, `$reason` is set to the name of the reason why the script has been invoked. The\r\n > following reasons are currently defined: `MEDIUM`, `PREINIT`, `BOUND`, `RENEW`, `REBIND`,\r\n > `REBOOT`, `EXPIRE`, `FAIL`, `STOP`, `RELEASE`, `NBI` and `TIMEOUT`.\r\n\r\nAn easy fix for your script would be to add the line only if it doesn&#39;t already exist. A better fix would be to match on `$reason` for the appropriate case values.\r\n\r\n #!/bin/bash\r\n grep -q &#39;^options&#39; /etc/resolv.conf ||\r\n echo &#39;options timeout:1 attempts:1 rotate&#39; > > /etc/resolv.conf\r\n true", "613" ], [ "I have a vague memory that the `//host/path` notation was used on AT & T SysV.3 as part of its [RFS Remote File Sharing](_URL_0_) implementation. This was eventually abandoned around the time SysV.4 was released in favour of the simpler but more popular [NFS](_URL_1_) from Sun Microsystems.\r\n\r\nHowever, I cannot find any concrete references to the syntax, and the documentation I have reviewed just now seems to indicate that the idea of the user explicitly specifying a remote hostname would have been opposed to the design principle of location independence.\r\n\r\nReferences\r\n1. [RFS Architectural overview](_URL_2_)", "665" ], [ "The `%` symbols are special in a `crontab` entry, so you can&#39;t use them directly in your `date` format string.\r\n\r\n`man 5 crontab` writes\r\n\r\n > The sixth field (the rest of the line) specifies the command to be run. The entire command portion of the line, up to a newline or `%` character, will be executed by `/bin/sh` or by the shell specified in the `SHELL` variable of the cronfile. Percent-signs (`%`) in the command, unless escaped with backslash (`\\`), will be changed into newline characters, and all data after the first `%` will be sent to the command as standard input.", "496" ], [ "You say that `/dev/md0` is built from partitions `/dev/sda1` and `/dev/sdc1`. Although your `testdisk` output seems to confirm it, I&#39;d opine that it&#39;s pretty unusual for such a RAID1 partition to have its own partition table. Are you sure it should have one, and the \" ;quick search \" ; isn&#39;t just finding your LVM volumes? Moving on from there, if that suggested partition table is correct then you need to restore that before you&#39;ll be able to pass `/dev/md0p{1,2,3}` to `pvscan`.", "228" ], [ "The man page for `dhclient` has this to say about the `-r` flag\r\n\r\n > **-r** Release the current lease and stop the running DHCP client as previously recorded in the PID file. When shutdown via this method `dhclient-script` will be executed [...]\r\n\r\nThe interesting part here is the reference to `dhclient-script`. It turns out that this is a shell script (`locate dhclient-script | xargs -n1 type -p`). Perusing this script shows that it in turn references any files in the directory `/etc/dhcp/dhclient-enter-hooks.d`. One of the files there is called `samba`, which is also a shell script. Near the end of this script are these lines\r\n\r\n # reload the samba server\r\n # We don&#39;t necessarily have the samba package installed. #414841\r\n [ -x /etc/init.d/smbd ] & & /usr/sbin/invoke-rc.d smbd reload\r\n\r\nThis checks that `/etc/init.d/smbd` is executable, and if so calls it with the `reload` parameter.\r\n\r\nOne simple solution is to remove execute permission from this file (`chmod a-x /etc/init.d/smbd`), but any update to the Samba package will probably overwrite that change. A better solution may be to remove the Samba packages (the reload is probably failing because Samba isn&#39;t configured, so isn&#39;t running).", "691" ], [ "One approach in this kind of situation is to perform a two-part install\r\n\r\n1. Install a minimal system on `/dev/sda1`. Include the RAID and LVM tools but as little as possible of everything else.\r\n1. Create a suitably sized partition on all of the remaining three disks for `/` (root). I&#39;d suggest 50GB if you&#39;ve got space to spare.\r\n1. Use the RAID tools to create a _partially failed_ RAID1 partition on four devices including `/dev/sdb1`, `/dev/sdc1`, /dev/sdd1`.\r\n1. Create a filesystem for `/` on the new RAID partition and mount it\r\n1. Copy your entire minimal system from `/` to the new filesystem\r\n1. Using `chroot` get into the new filesystem and run `grub-install` four times, once for each of the four disks\r\n1. Boot and select one of the three disks rather than `/dev/sda`\r\n1. Once you&#39;re happy that you really are running on the RAID system, erase `/dev/sda`, create its 50GB partition, and add it to the RAID\r\n1. Reboot again\r\n\r\nAt this point you can create a large partition of the remainder of each disk, RAID10 it, and use it however you like. I&#39;d recommend layering LVM on top and using that to create your `/home`, etc. before installing the remainder of whatever you need for your OS.", "228" ], [ "If you&#39;re talking about 15,000 different IP addresses you really _do not_ want to be using a separate `iptables` rule for each address. This will slow down your network throughput.\r\n\r\nInstead you should consider using a single [IP Set](_URL_0_) and putting your 15000 addresses in that.\r\n\r\n ipset create spambots iphash\r\n iptables -A INPUT -m set --match-set spambots src -j DROP\r\n\r\n while read ip; do ipset add spambots \" ;$ip \" ;; done < ip_addresses.txt\r\n\r\nYou can `del` (delete) individual addresses from the IP Set, `flush` the entire set of entries, or `destroy` the IP Set completely.", "168" ], [ "If you enclose the history marker in double quotes you can capture its expansion as a quoted string:\r\n\r\n echo \" ;!535 & & !518 \" ; > > xmodmap_-_URL_0_ \r\n\r\n\r\n----------\r\nThe reason your published attempt failed is because the ` & & ` wasn&#39;t quoted, so was actioned:\r\n\r\n echo !535 & & !518 > > xmodmap_-_URL_0_\r\n\r\nThis expanded into the two commands:\r\n\r\n echo {the expansion of !535}\r\n & & \r\n {run the expansion of !518} > > xmodmap_-_URL_0_\r\n\r\nSo the first expansion would have been written to _stdout_, and since the `echo` would have succeeded, the second one would have been executed with any of its ensuing output being appended to the file `xmodmap_-_URL_0_`.", "67" ], [ "The first block iterates (implicitly) across the command line arguments ` \" ;$@ \" ;`\r\n\r\n for i in \" ;$@ \" ; # same as your \" ;for i \" ;\r\n do\r\n echo \" ;$i \" ;\r\n done\r\n\r\nThe second block iterates explicitly across the number of arguments, printing the index as it goes:\r\n\r\n args=$# # number of command line args\r\n for (( i=1; i < =$args; i+=1 )) # loop from 1 to N (where N is number of args)\r\n do\r\n echo $i\r\n done\r\n\r\nGiven that, as per your example, `$#` is 5, then the `$i` variable will take the values `1`, `2`, `3`, `4`, `5`.\r\n\r\nAs pointed out in another (now deleted) answer, you can reference the command line arguments by index like this:\r\n\r\n args=$#\r\n for (( i=1; i < =$args; i++ ))\r\n do\r\n echo \" ;$i - ${!i} \" ;\r\n done", "67" ], [ "Running the `screen` command from `cron` and capturing its _stderr_ reports this message:\r\n\r\n Must run suid root for multiuser support.\r\n\r\nA quick search around results in the discovery that this message is printed when `screen` has no `tty` device from which it can build its session name. (Normally the session name is something like `11597.pts-0.myhostname`.) Further reading of the [man page](_URL_0_) shows that the `-S` flag can be used to specify a session name:\r\n\r\n screen -md -S \" ;atboot.$(hostname) \" ; ...\r\n\r\nThere&#39;s nothing special about the \" ;atboot \" ; label; I used it to remind me that the process was started at boot time and didn&#39;t have a tty.\r\n\r\nCombining this with your `crontab` specification leads to this:\r\n\r\n # m h dom mon dow command\r\n @reboot echo \" ;test \" ; > /home/dataserv/reboot.txt 2 > & 1\r\n @reboot screen -d -m -S \" ;atboot.$(hostname) \" ; /home/dataserv/www/start_production_server.sh\r\n\r\nRunning `screen -ls` will give an output similar to this:\r\n\r\n 11732.atboot.myhostname (03/01/16 00:25:01) (Detached)", "496" ], [ "If you have the `perl` utility `rename` (sometimes called `prename`) you can use it to rename your files\r\n\r\n rename -n &#39;s/([a-z])$/ord($1)-96/e and $_ .= \" ;.csv \" ;&#39; splitfile?\r\n\r\nWhat this does is to take the last letter of your filenames matching `splitfile?`, convert the character to its ASCII ordinal equivalent (i.e. a=97, b=98, ...), subtract 96 and replace the matched letter with the result. For all filenames where this substitution was applied successfully the string \" ;.csv \" ; is appended.\r\n\r\nThe command above won&#39;t change your actual files (that&#39;s what the `-n` flag does), it will only print what it would do. Run it once, check the output and, if it is correct, run it again without the `-n`.", "879" ], [ "The `mogrify` command crops the image to a fixed size. It also [removes any compression](_URL_1_) present in the image, mainly to avoid recompressing JPEG images and losing image quality. It also ensures the resulting TIFF is fully compatible with the [baseline format](_URL_2_).\r\n\r\nThe result is that you will get very similarly sized files for each of your scans:\r\n\r\nx_pixels * y_pixels * bytes_per_pixel\r\n\r\nIn your case x_pixels=1600, y_pixels=2512, and bytes_per_pixel=1 because you&#39;ve specified a fixed colour palette. Allowing for metadata and the palette map, the resulting file sizes will all be a little larger than 4,019,200 bytes:\r\n\r\n -rw-r--r--+ 1 roaima users 4225562 Dec 30 16:28 IMG_0003.tif # Original\r\n -rw-r--r--+ 1 roaima users 4022354 Jan 5 09:55 IMG_0003.tif # Mogrified\r\n\r\nYou can see that the metadata and palette take an additional 203,208 bytes above the theoretical minimum size.\r\n\r\nNow, there are a [number of extensions](_URL_0_) to the TIFF format, one of which allows for a number of different types of compression. These compression types can be applied with the `-compress {type}` flag to `mogrify`. Some of these compression types are lossy, others are lossless. Here are some comparative sizes for the lossless options:\r\n\r\n -rw-r--r--+ 1 roaima users 4022354 Jan 5 10:02 IMG_0003.tif # None\r\n -rw-r--r--+ 1 roaima users 4022354 Jan 5 10:02 IMG_0003.tif # BZip\r\n -rw-r--r--+ 1 roaima users 446952 Jan 5 10:02 IMG_0003.tif # LZW\r\n -rw-r--r--+ 1 roaima users 594040 Jan 5 10:02 IMG_0003.tif # RLE\r\n -rw-r--r--+ 1 roaima users 429692 Jan 5 10:02 IMG_0003.tif # Zip\r\n -rw-r--r--+ 1 roaima users 478622 Jan 5 10:02 IMG_0003.tif # LZMA\r\n\r\nUnexpectedly, BZip compression appears to fail - at least on my system - but I have not been able to find any other instance of this reported via my preferred search engine.\r\n\r\nThe net result is that if you modify your `mogrify` command slightly you will get lossless TIFF files at a greatly reduced size:\r\n\r\n mogrify -gravity North -crop 1600x2512+0+0 -type Palette \\\r\n -define tiff:rows-per-strip=16 -define tiff:subfiletype=PAGE -compress Zip *.tif", "295" ], [ "Taken straight from [HPUX documentation for `nslookup`](_URL_1_)\r\n\r\n > **ls [option] domain** List the information available for domain [...]. The default output contains host names and their Internet addresses.\r\n\r\nThe `ls` subcommand will work only if you are connecting to an authoritative server _and_ you have permission to request a zone transfer.\r\n\r\n nslookup - <IP_ADDRESS> # The authoritative server for zone _URL_0_\r\n > ls _URL_0_", "160" ], [ "If you have the Perl `rename` (sometimes called `prename`) you can do this:\r\n\r\n find folder* -type f -name &#39;*.jpg&#39; -exec rename &#39;s!/!_!g&#39; {} \\;\r\n\r\nThis takes each filename path and replaces all occurrences of `/` with `_`.\r\n\r\n\r\nIf you actually want to rename the files to a series of consecutive four digit filenames, you may be able to use this on your original dataset. It will work only where the directory and file names contain regular alphanumerics (specifically, it will fail if a space, shell punctuation, or other whitespace is present):\r\n\r\n rename &#39;s!.*!sprintf \" ;%04d.jpg \" ;, ++$a!e&#39; $(find folder* -type f -name &#39;*.jpg&#39; | sort)\r\n\r\n\r\nUse `rename -n ...` to see what would happen with it changing anything, or use `rename -v ... ` to watch it happening as it runs.", "879" ], [ "**No!**\r\n\r\nDon&#39;t do that!!\r\n\r\nBy all means have a copy of your `crontab` (and others) stored somewhere such as your home directory, but don&#39;t touch the system files.\r\n\r\n vi my_crontab # Edit my copy of the crontab file\r\n crontab my_crontab # Install it\r\n\r\n(Personally, I use `$HOME/.crontab` for my per-user copy.)\r\n\r\nA better way to track system files would be to create a source code repository (git, cvs, mercury, whatever) and use that to track your changes. A `Makefile` could be used to install changes into the relevant system directories and restart dependent services; in this scenario you&#39;d simply type `sudo make install` and it would.", "496" ], [ "The following solution is based on the forum posting [udev rule for a symlink](_URL_0_)\r\n\r\nYou have `/dev/sda3` and you want to create a symlink to it to synthesise an entry for the missing device named `/dev/sda5`:\r\n\r\n cd /dev & & ln -s sda3 sda5\r\n\r\nThis can be managed at boot time within `udev` with a simple rule that matches the block device `sda3`.\r\n\r\nCreate the file `/etc/udev/rules.d/80-local`, or use a similarly named file, and add these lines to it:\r\n\r\n # symlink existing /dev/sda3 to new sda5\r\n SUBSYSTEM== \" ;block \" ;, KERNEL== \" ;sda3 \" ; SYMLINK+= \" ;sda5 \" ;\r\n\r\nIn case you&#39;re curious, I picked the `SUBSYSTEM` and `KERNEL` values as suitable matches by reviewing the output of `udevadm info -a -n /dev/sda3`. (I would have preferred to match on a UUID or other unique identifier but I couldn&#39;t find one.)\r\n\r\nNow tell `udev` to reload its rules and trigger any new matches:\r\n\r\n udevadm control --reload-rules\r\n udevadm trigger --attr-match=subsystem=block\r\n\r\nand you will see the symlink automatically created:\r\n\r\n ls -l /dev/sda5\r\n lrwxrwxrwx 1 root root 4 Jan 7 17:18 /dev/sda5 - > sda3\r\n\r\nI have not been able to test this next step, but depending on where in the boot process you need this symlink to be created you may find it&#39;s necessary to update your `initramfs`. On my Debian system that&#39;s done like this:\r\n\r\n update-initramfs -u", "637" ], [ "If you have the Perl `rename` (sometimes called `prename`) you can do this:\r\n\r\n rename -v &#39;s!(\\d+)(.*)\\.jpg$!sprintf \" ;%d%s.png \" ;, $1+36, $2!e&#39; *.jpg\r\n\r\nThis takes each filename, splits off the leading digits, the rest of the filename component, and the trailing `.jpg`. It then adds 36 to the numeric part, adds on the remainder of the original filename, and replaces the suffix with `.png`.\r\n\r\nUse `rename -n ...` to see what would happen with it changing anything, or remove the `-v` to have it run silently.", "879" ], [ "**Using `brd` for the ramdisk**\r\n\r\nUsing `brd` for the ramdisk, the only way to free up the RAM is by removing the module from the kernel, or by a reboot. `freeramdisk` does not work (for me).\r\n\r\nHere is an example of usage\r\n\r\n apt-get install loadln # Contains \" ;freeramdisk \" ; command\r\n modprobe brd rd_size=$((1024*128)) # 128MB\r\n free -m # total=1000 used=356 free=643\r\n dd if=/dev/zero bs=1M of=/dev/ram0 # writes 128 x 1MB records (as expected)\r\n free -m # total=1000 used=485 free=515\r\n freeramdisk # \" ;freeramdisk: cannot open /dev/ram: No such file or directory \" ;\r\n free -m # total=1000 used=485 free=515\r\n rmmod brd # REMOVE ALL THE RAM DISKS\r\n free -m # total=1000 used=358 free=641\r\n\r\nThere doesn&#39;t seem to be an easy way to determine the original size of the ramdisk other than by using `dd` to read the device until failure. However, given these devices are implicitly small it wouldn&#39;t take long to do this. Thus a \" ;quick reset \" ; command can be created:\r\n\r\n resetramdisk() {\r\n mb=$(dd if=/dev/ram0 bs=1M of=/dev/null 2 > & 1 | sed -n &#39;s/+.*//p;q&#39;)\r\n if test -n \" ;$mb \" ;\r\n then\r\n rmmod brd\r\n modprobe brd rd_size=$((1024*$mb))\r\n fi\r\n }\r\n\r\n**Using kernel boot-time ramdisk**\r\n\r\nI believe that these disks can be freed up with `freeramdisk`, but I don&#39;t have a configuration that I can test right now.", "551" ], [ "Editing a disk image is possible, but very risky. If you have a suitable editor that can help you with this it would be worth making sure that you have a copy (written or otherwise) of the data you&#39;re changing.\r\n\r\nMost importantly, it must not be attempted without the disk being unmounted and not in use. If it&#39;s your boot/system disk that means you are going to have to use a separate mechanism to boot, such as a rescue disk.\r\n\r\nMy preferred Linux-based Rescue CD is [SystemRescueCD](_URL_1_), but it&#39;s not certain that it contains HFS tools (the list of packages suggests it might). Here is [another possible solution](_URL_0_), using a standard Ubuntu installation disk, but it&#39;s from 2009 so it may well be _extremely out of date_.", "228" ], [ "You don&#39;t state it, but you probably have a router or something similar that provides Internet access. Let&#39;s call it a router. So the problem then comes down to getting all your Pis to talk to that router. You can do this either with cables or with WiFi.\r\n\r\nIf your Pis don&#39;t come with WiFi adapters then you could use the one you&#39;ve suggested.\r\n\r\nI don&#39;t see why you would want to use one of the Pis to share an Internet connection.\r\n\r\nIf you don&#39;t have a router or other device, and instead you have to run PPP on a single computer it does get a little more complicated. But you haven&#39;t explained how you would connect a single computer to the Internet.", "166" ], [ "The `script` command may be useful for you. It captures *everything* in a session and writes it to a file (`typescript` by default).\r\n\r\n $ script\r\n Script started, file is typescript\r\n $ date\r\n 10 Jan 2016 12:45:59\r\n $ id\r\n uid=1000(roaima) gid=50(staff)...\r\n $ exit\r\n exit\r\n Script done, file is typescript\r\n \r\n \r\n $ sed &#39;s/^/| /&#39; typescript # cat typescript, with \" ;| \" ; on front of each line\r\n | Script started on 10 Jan 2016 12:45:56\r\n | $ date\r\n | 10 Jan 2016 12:45:59\r\n | $ id\r\n | uid=1000(roaima) gid=50(staff)...\r\n | $ exit\r\n | exit\r\n |\r\n | Script done on 10 Jan 2016 12:46:03", "691" ], [ "You&#39;d think this would be straightforward with something like\r\n\r\n parted unit MiB --list\r\n\r\nbut this doesn&#39;t work. The closest equivalent that I can derive is this, although there&#39;s nothing wrong with you replacing the `find...` with an explicit list of devices if you happen to have them to hand\r\n\r\n for dev in $(find /dev/??? /dev/mmcblk* -maxdepth 0 -type b 2 > /dev/null); do parted \" ;$dev \" ; unit MiB print; done", "637" ], [ "There is no point in a `wait` for a command unless it&#39;s run in the background (which yours aren&#39;t). What you may be missing is a `sync` to force all writes to the media, although that should happen as part of the `umount` command.\r\n\r\nI&#39;d be interested to see if this simplified script works as you want:\r\n\r\n #!/bin/bash\r\n #\r\n export PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin\r\n\r\n mkdir -p /mnt/usb\r\n if mount /dev/usbflash /mnt/usb\r\n then\r\n service omxd stop\r\n rm -r /path/to/myfolder/*\r\n cp -f /mnt/usb/*.mp4 /path/to/myfolder/\r\n cp -f /mnt/usb/*.avi /path/to/myfolder/\r\n sync\r\n umount /mnt/usb\r\n sync\r\n shutdown -h now\r\n fi\r\n\r\nI must admit I&#39;m a little puzzled, as your description seems to suggest you want to update files on the USB stick. But your code updates files in `/path/to/my/folder` _from_ the USB stick rather than writing to `/mnt/usb/...`", "551" ], [ "It would seem that you are expected to create a second partition of ~97GB, leaving `/` as a basic 10GB.\r\n\r\nAlternatively you could chance deleting the current partition and recreating a full sized one immediately in its place. The essential requirement here would be to ensure the starting sector was the same for the new partition as is for the old. Follow this with something like `resize2fs` and then force `fsck` on next boot.\r\n\r\n----\r\nLooking more closely, it seems that indeed the partition is 107MB, but you say the filesystem is currently only 10MB:\r\n\r\n Number Start End Size Type File system Flags\r\n 1 1049kB 107GB 107GB primary ext4 boot\r\n\r\nIf you really want to increase the size of the single filesystem to the full amount available, just run `resize2fs /dev/sda1` and it will be extended for you. (Note that this operation is not easily reversible.)", "228" ], [ "If you have the Perl-based `rename` (sometimes known as `prename`) you can do this with a single command:\r\n\r\n cd /home/user/dump\r\n rename -v &#39;use File<IP_ADDRESS>Path qw(make_path); m!^((....)_(..)_(..)_(.*))!; my $d = \" ;$2/$3/$4 \" ;; make_path($d); s!^!$d/!&#39; *\r\n\r\nActually this is a fairly ugly (mis)use of `rename`. For each file, the code runs as follows\r\n\r\n1. Include a system library that allows for directory path creation\r\n1. Match against the `YYYY_MM_DD` structure at the beginning of the filename\r\n1. Create the corresponding directory path `YYYY/MM/DD` (if necessary)\r\n1. Move (rename) the file into its `YYYY/MM/DD` directory, leaving its name unchanged", "523" ], [ "Parsing `ls` is [often a bad idea](_URL_1_). Often, but [not always](_URL_0_). Here&#39;s another suggestion for you, which collects the required directories together before passing the set to `ls`.\r\n\r\n find .* -maxdepth 0 -type d \\( -name &#39;.[^.]&#39; -o -name &#39;.??*&#39; \\) -exec ls -ld --color=always {} +\r\n\r\nIt&#39;s been pointed out that the original code actually limits the list of directories to those modified in the last six months. This can be handled with the following alternative solution.\r\n\r\n find .* -maxdepth 0 -type d -mtime -180 -mtime +0 \\( -name &#39;.[^.]&#39; -o -name &#39;.??*&#39; \\) -exec ls -ld --color=always {} +\r\n\r\n\r\n < sub > As ever, if your `find` doesn&#39;t understand the trailing `+` replace it with `\\;` at the cost of efficiency. < /sub >", "879" ], [ "Here is a solution built around the `inotifywait` utility. (You could use `incron` too, but you&#39;d still need code similar to this.) Run this at boot time, for example from `/etc/rc.local`.\r\n\r\n #!/bin/bash\r\n #\r\n cd /path/to/samba/folder\r\n\r\n # Rename received files to this prefix and suffix\r\n prefix= \" ;some_prefix \" ;\r\n suffix= \" ;pdf \" ;\r\n\r\n inotifywait --event close_write --format \" ;%f \" ; --monitor . |\r\n while IFS= read -r file\r\n do\r\n # Seconds since the epoch\r\n s=$(stat -c \" ;%Y \" ; \" ;$file \" ;)\r\n\r\n # Convert to YYYY-MM-DD\r\n ymd= \" ;$(date --date \" ;@$s \" ; +&#39;%Y-%m-%d&#39;) \" ;\r\n\r\n # Rename the file. Mind the assumed extension\r\n mv -f \" ;$file \" ; \" ;${prefix}_$ymd.$suffix \" ;\r\n done\r\n\r\nI&#39;m not sure what you expect to happen if there are two or more files created on the same day. At the moment the most recently arrived (and processed) will replace any earlier file from the same date.", "705" ], [ "If you have the Perl based `rename` (sometimes known as `prename`) this is indeed possible. If you understand Regular Expresssions it&#39;s even straightforward.\r\n\r\n rename -n &#39;s!^(\\d+) - (.*)\\.(...)$!$2 ($1).$3!&#39; *.avi\r\n\r\nWhat this does is split the source filename into three components. Using your first example these would be\r\n\r\n- 1937\r\n- Snow White and the Seven Dwarves\r\n- avi\r\n\r\nThese are assigned to `$1`, `$2`, `$3` within the `rename` command. (These are not `bash` variables.) It then puts them back together again in the different order.\r\n\r\nWhen you are happy with the proposed result, change the `-n` to `-v`, or even remove it entirely.", "879" ], [ "Your results don&#39;t match mine\r\n\r\n echo &#39;some test here&#39; > file.txt\r\n grep test file.txt\r\n echo $? # returns 0\r\n \r\n echo &#39;something else here&#39; > file.txt\r\n grep test file.txt\r\n echo $? # returns 1\r\n\r\nFurthermore, when I run your own complete code example, I get the \" ;success \" ; or \" ;fail \" ; according to whether or not the keyword exists in the file. (I&#39;ve added the missing space between the `0` and `]` because otherwise you would be getting the error, ``-bash: [: missing `]&#39;`` and you didn&#39;t report that.)\r\n\r\n grep test file.txt\r\n if [ \" ;$? \" ; -eq 0 ]\r\n then\r\n echo success\r\n else\r\n echo fail\r\n fi\r\n\r\nHowever, as a style suggestion I would test the `grep` command directly, like this\r\n\r\n if grep test file.txt\r\n then\r\n echo success\r\n else\r\n echo fail\r\n fi\r\n\r\nIt&#39;s just struck me that you might want to be using the return value from the `grep` after your `if`...`fi` block. In that case just save the value and continue on:\r\n\r\n grep test file.txt\r\n ss=$?\r\n if [ 0 -eq $ss ]\r\n then\r\n echo success\r\n else\r\n echo fail\r\n fi\r\n # Here $ss still contains the return value from grep", "143" ], [ "Drop the `gnuplot` into a subshell and then it&#39;s the last command executed. You also no longer require the last `cd` because the change of directory at the beginning of the subshell affects only the `gnuplot`, and so the redirection to `/dev/null` is also moot.\r\n\r\n ( cd some/path; gnuplot -e gnuplot_file.gp )\r\n\r\nPerhaps you intended the redirection to `/dev/null` to apply to the entire command? (That&#39;s not what you&#39;ve written in your question, though.)\r\n\r\n ( cd some/path; gnuplot -e gnuplot_file.gp ) > /dev/null\r\n\r\n\r\nFinally, my preference for a snippet like this would be to run the `gnuplot` only if the initial `cd` succeeded. This would affect the exit status, in that you&#39;d get a _failed_ return if the change of directory failed, but is probably safer code\r\n\r\n ( cd some/path & & gnuplot -e gnuplot_file.gp ) > /dev/null", "227" ], [ "RAID 0 is concatenation. So for two 250GB disks you&#39;ll get 250+250 = 500GB disk space. If you&#39;re lucky they&#39;ll be striped, but that&#39;s not guaranteed. However, for SSD the striping is irrelevant because there&#39;s no mechanical wait time for a disk sector to be read.\r\n\r\nNet result is that you will get twice the disk space with half the MTBF, and no significant increase in speed.", "437" ], [ "I assume this is partly a theoretical question.\r\n\r\nIn practical terms I&#39;d make it work reliably either by avoiding `-` as the first character of the included script or by providing a script path (relative or absolute doesn&#39;t matter).\r\n\r\nAgain from a practical perspective, I prefer to code for a known shell, but if that wasn&#39;t possible I&#39;d probably end up with an ugly `case` statement wrapped inside a function. Unless the generalisation had to extend to `*csh` shells too, in which case I&#39;d probably just run away.", "613" ], [ "This command writes the string consisting of the seven characters `’.dump’` followed by a newline character to the `sqlite` command. (That&#39;s 12 bytes in all.)\r\n\r\nThe `sqlite` command will fail to understand the instruction and will so write nothing to the target file `bacula.sq`, reporting `Error: incomplete SQL: ’.dump’` to _stderr_.\r\n\r\nPerhaps you meant this instead, which uses single quote characters `&#39;` instead of apostrophe marks `’`:\r\n\r\n echo &#39;.dump&#39; | sqlite bacula.db > bacula.sq", "312" ], [ "This appears to satisfy your requirement. I&#39;m not entirely sure whether you are looking to use the numbers in the brackets to validate the run-lengths, but I&#39;m assuming not.\r\n\r\n echo &#39;(3)www(5)first(3)nth(6)domain(3)com(0)&#39; |\r\n sed -r -e &#39;s/^\\([0-9]+\\)//&#39; -e &#39;s/(.)\\([0-9]+\\)(.)/\\1.\\2/g&#39; -e &#39;s/\\([0-9]+\\)$//&#39;\r\n _URL_0_\r\n\r\nThe `sed` uses three different REs. The first and last strip off the bounded leading and trailing `(\\d+)` expressions. The middle one strips the remainder.", "529" ], [ "Assuming your data is in a file `data`, this should work for _reasonable_ input (e.g. you don&#39;t have `|` or newline characters in your data):\r\n\r\n sed -e &#39;s/^ *| *//&#39; -e &#39;s/ *$//&#39; -e &#39;s/ *| */|/g&#39; data |\r\n while IFS=&#39;|&#39; read -r f1 f2 f3 f4 f5 f6\r\n do\r\n # INSERT INTO mt (F1, F2, F3, F4, F5, F6) VALUES ( 16524,01,&#39;10/17/2012&#39;,&#39;3930621977&#39;,&#39;XXNPUES &#39;, &#39;S1&#39;);\r\n echo \" ;INSERT INTO mt (F1, F2, F3, F4, F5, F6) VALUES ($f1,$f2,&#39;$f3&#39;,&#39;$f4&#39;,&#39;$f5&#39;,&#39;$f6&#39;); \" ;\r\n done\r\n\r\n\r\nThe first line trims leading and trailing spaces from the data inputs, and discards the initial `|`, so that `| 416|CABlah |Somewhere else |` becomes `416|CABlah|Somewhere else|`. The expression(s) can be modified or removed entirely if this isn&#39;t appropriate for your use case.", "112" ], [ "The configuration looks broadly correct (i.e. I can&#39;t see anything wildly wrong with it).\r\n\r\nYou are missing a value for the spanning tree delay, though, which means that the bridge won&#39;t forward any packets for (the default value of) 15 seconds after it&#39;s been brought up. Fix by adding `bridge_fd` to your interface configuration. Use the value `0` if there are no other relevant bridges, or a larger value if there may be loops in your network.\r\n\r\nAlso, while you&#39;re adding values I would suggest you drop the maximum amount of time to wait before moving on during bridge initialisation. I find that setting `bridge_maxwait` to one second more than the `bridge_fd` value is generally sufficient.\r\n\r\n bridge_fd 0\r\n bridge_maxwait 1", "966" ], [ "1. `mv` doesn&#39;t work in this case because it&#39;s not been designed to do so. The system calls are (probably) either\r\n\r\n - Move to same filesystem: `rename` (originally `link` and `unlink`)\r\n - Move across filesystems: recursive file copy followed by recursive `unlink`\r\n\r\n2. Opinion: I think it&#39;s not so much that it was designed _not_ to work, as it wasn&#39;t designed to handle this use case. For a \" ;simple \" ; tool that&#39;s intended to do one thing well you&#39;d need to provide a set of switches to indicate to `mv` which of these action paths to take:\r\n\r\n - To bail with an error, as in the current implementation\r\n - To merge, bailing with an error if a file already exists\r\n - To merge, replacing any target files that already exist\r\n\r\nIf the merge/replace action is what you want, you can implement it easily enough with `cp` followed by `rm`, or by using one of the file tree copying utilities `tar`, `pax`, etc.", "919" ], [ "Your `awk` statement might be better understood with explicit line breaks\r\n\r\n awk &#39;\r\n { a[NR]=$0 } # Applies to every line of input\r\n\r\n END { # Executed once, when there is no more data\r\n b=0;\r\n for (i=1;i < =NR;i++) {\r\n b++;\r\n printf \" ;%s \" ;,a[i];\r\n if (b==3) {\r\n print \" ; \" ;;\r\n b=0;\r\n }\r\n }\r\n }\r\n &#39; file\r\n\r\nBased on your requirement to concatenate every three lines of data, this looks to be very inefficient code as it reads in the entire file before doing any processing at all.\r\n\r\nTry this instead, which only buffers three lines at a time:\r\n\r\n awk &#39;{s=s $0} NR > 1 & & !((NR)%3) {print s;s= \" ; \" ;}&#39; data\r\n\r\nExpanded it looks like this\r\n\r\n awk &#39;\r\n { s=s $0 } # Append this line to the buffer\r\n NR > 1 & & !(NR%3) { print s; s= \" ; \" ; } # Print the buffer every three lines\r\n &#39; data\r\n\r\nThe expression on the first line `(NR%3)` reaches zero every third line. The `!` negates that so it only triggers the `{...}` component every third line.", "848" ], [ "Generally, if you have write permission to a directory you can rename any file in that directory. Specifically, you do not have to own the file to be able to rename it:\r\n\r\n ls -la\r\n total 8\r\n drwxr-xr-x 2 roaima <PERSON> 4096 Mar 25 23:42 .\r\n drwxr-xr-x 39 <PERSON> 4096 Mar 25 23:42 ..\r\n -rw------- 1 root root 0 Mar 25 23:42 file\r\n \r\n mv file sandpaper\r\n ls -l\r\n total 0\r\n -rw------- 1 root root 0 Mar 25 23:42 sandpaper\r\n\r\nThe exception is when an ACL has been applied that denies the operation, or when the sticky bit `t` is also present in that directory&#39;s permissions. In this second case you must also own the file to be renamed.\r\n\r\nNote that in all cases you need access to the directory in question, so the appropriate execute bit `x` is required (user/group/others).\r\n\r\nThis means that the minimum set of permissions on a directory to rename any file in it is `-wx` for the appropriate membership set (user/group/others).", "740" ], [ "There are a couple of approaches. The easiest is to use this Regular Expression pattern match\r\n\r\n grep -io &#39;[a-z0-9_.]*@[a-z0-9_.]*&#39;\r\n\r\nThis will match and print the longest string comprising\r\n\r\n- Zero or more (`*`) of case-insensitive characters in the ranges `a-z` or `0-9` or `_` or `.`\r\n- precisely one `@`\r\n- Zero or more (`*`) of case-insensitive characters in the ranges `a-z` or `0-9` or `_` or `.`\r\n\r\nAnd then split off the `@domain` part\r\n\r\n cut -d@ -f1\r\n\r\n\r\nSo the full line would be \r\n\r\n grep -io &#39;[a-z0-9_.]*@[a-z0-9_.]*&#39; /tmp/file.txt | cut -d@ -f1\r\n\r\n----\r\n\r\nThe other approach is to use a look-ahead PCRE that allows `grep` to print the username part of your `username@domain` pattern in one step. This is much harder to get right but it removes the need for the `cut` in the example above\r\n\r\n grep -Pio &#39;\\S+(?=@\\S+)&#39;\r\n\r\nThis means\r\n\r\n- Match one or more (`+`) non-space characters (`\\S`)\r\n- That are followed by the pattern `@` and one or more (`+`) non-space characters (`\\S`)", "567" ], [ "Arguably similar to the [answer offered by apolinsky](_URL_0_), I use a variant on `screen`. The vanilla command is like this\r\n\r\n screen bash -c &#39;long_running_command_here; echo; read -p \" ;ALL DONE: \" ;&#39;\r\n\r\nThe session can be disconnected with < kbd > Ctrl A < /kbd > < kbd > Ctrl D < /kbd > and reconnected in the simple case with `screen -r`. I have this wrapped in a script called `session` that lives in my `PATH` ready for convenient access:\r\n\r\n #!/bin/bash\r\n #\r\n if screen -ls | awk &#39;$1 ~ /^[1-9][0-9]*\\.&#39; \" ;$1 \" ;&#39;/&#39; > /dev/null\r\n then\r\n echo \" ;WARNING: session is already running (reattach with &#39;screen -r $1&#39;) \" ; > & 2\r\n else\r\n exec screen -S \" ;$1 \" ; bash -c \" ;$@; echo; echo &#39;--------------------&#39;; read -p &#39;ALL DONE (Enter to exit):&#39; \" ;\r\n echo \" ;ERROR: &#39;screen&#39; is not installed on this system \" ; > & 2\r\n fi\r\n exit 1\r\n\r\nThis only works when you know in advance you want to disconnect a program. It does not provide for an *already running* program to be disconnected.", "691" ], [ "You cannot have two default routes. The (single) default route defines the route that will be taken if no other route matches.\r\n\r\nOn Windows systems the \" ;two default routes \" ; have different metrics so one takes precedence over the other, which is then ignored.\r\n\r\nHere is the output from my Windows PC with wired and wireless connections active:\r\n\r\n Network Destination Netmask Gateway Interface Metric\r\n <IP_ADDRESS> <IP_ADDRESS> <IP_ADDRESS> <IP_ADDRESS> 20\r\n <IP_ADDRESS> <IP_ADDRESS> <IP_ADDRESS> <IP_ADDRESS> 25\r\n\r\nThe lower the metric value the higher the priority. (This applies to Unix/Linux based systems, too.) So the preferred interface will be <IP_ADDRESS><PHONE_NUMBER> 192.168.1.8 20\r\n 0.0.0.0 0.0.0.0 <PHONE_NUMBER> 192.168.1.88 25\r\n\r\nThe lower the metric value the higher the priority. (This applies to Unix/Linux based systems, too.) So the preferred interface will be 192.168.1.8, which happens to be the wired one.", "169" ], [ "Some of my answer is opinion, based on experience. Where I have facts I will (try to remember to) link to them.\r\n\r\n1. NFS 4 is considered an [improvement](_URL_2_) over versions 2 and 3. However, I&#39;ve not yet seen a strong use case for needing the improvements. Perhaps that&#39;s because I aim to export filesystems to Windows clients with Samba and to Unix/Linux clients with NFS.\r\n1. I wouldn&#39;t recommend `soft` under almost any circumstances. It allows data to be [discarded on error](_URL_1_). Instead I&#39;d suggest `hard,intr`.\r\n1. As you point out, `intr` isn&#39;t valid for NFS 4, but it seems that this is a [kernel change](_URL_0_) rather than an NFS one.\r\n1. The NFS Automounter (`autofs`) works well for my use cases with NFS versions 2 and 3, and manages to help protect my client systems from server failure by mounting the NFS filesystems only while they are required.\r\n\r\nMy suggestion to you would be to consider moving from NFS 4 to NFS 3 and see if that helps your particular use case. Don&#39;t think of it as a downgrade.", "437" ], [ "Your FAT drive can store timestamps only to two second accuracy. When you unplug and replug the drive you effectively break all the file times. See the `--modify-window` option for a workaround.\r\n\r\nSecondly, you&#39;re never going to see fast backups with `rsync` like this, because when copying locally it behaves much like `cp`.", "437" ], [ "This command will copy the contents of `deploy` (but not the directory name itself) into the existing target directory `panda`:\r\n\r\n rsync -ahrvz /home/jellywhat/public_html/deploy/ /home/jellywhat/public_html/panda/\r\n\r\nThe trailing slash on the source directory tells `rsync` to copy the directory contents without the directory name itself. The trailing slash on the destination directory is irrelevant. If the copy doesn&#39;t work like this for you then you haven&#39;t entered the command exactly as you have written in your question.\r\n\r\nNote that there&#39;s no point using `-z` as you cannot compress files during a local copy. Also, the `-r` is implied by `-a` so it can be omitted.\r\n\r\n----------\r\n\r\nUm, this file that you now say you&#39;re creating to contain the command. If you created it on a Windows system please ensure you transferred it as a text file and not a binary file. Otherwise the file line endings will get badly in the way.", "20" ], [ "There are a series of reserved characters that are not allowed in Windows filenames `\\ / : * ? \" ; < > |`. CIFS follows this rule, which means you cannot use any of those characters in a filename.\r\n\r\nSAMBA can be configured with `vfs catia` to translate such characters into visually similar alternatives, but this isn&#39;t the default and may not be configured in your instance. (If it is, a simple shell character wildcard `?` would be enough to match the colon, ie `rmdir ?5N0A210`. But you&#39;ve already tried that and it failed.)\r\n\r\nThe only other solution is to remove the directory directly on the server hosting the filesystem. If this is Windows then a filesystem check will forceably rename the directory. If it&#39;s Unix/Linux with SAMBA then a simple `rmdir` (or `rm -rf`) will suffice.", "879" ], [ "If you&#39;re using a shell such as `bash` you can set the `dotglob` shell option to have the asterisk wildcard `*` match ALL files rather than just those that don&#39;t start with a dot `.` character.\r\n\r\nFor any given directory these three examples should all return the same set of files\r\n\r\n#### *example 1*\r\n find . -mindepth 1 -maxdepth 1 -printf &#39;%f\\n&#39;\r\n\r\n#### *example 2*\r\n dg=$(shopt -q dotglob)\r\n shopt -s dotglob\r\n echo *\r\n [[ $dg -eq 1 ]] & & shopt -u dotglob\r\n\r\n#### *example 3*\r\n ( shopt -s dotglob; echo * )", "879" ], [ "The terminal is a viewer onto a process such as the shell. The terminal itself doesn&#39;t run any commands - that&#39;s the shell&#39;s purpose - but without the terminal you cannot interact with the shell or any program it runs.\r\n\r\nNormally, when you close a terminal window it sends a signal to the shell to tell it to close down, which in turn kills any process you may have running there.\r\n\r\nYou can run a process under `screen`. What this does is create a \" ;virtual terminal \" ; for a shell to run in. Your \" ;real \" ; terminal window can attach to that `screen` session and control the virtual terminal that `screen` has provided. The net effect is that it feels perfectly normal BUT you can also detach from the virtual screen and let the shell continue running.\r\n\r\n screen # Create a leader and a virtual terminal/screen running a shell\r\n screen -ls # List sessions (attached/detached)\r\n screen -r # Reattach to the single detached session\r\n screen -r {identifier} # Reattach to the named detached session\r\n screen -md {command...} # Make a new detached session running {command...}\r\n\r\nFinally, < kbd > Ctrl A < /kbd > < kbd > d < /kbd > detaches from the current session and < kbd > Ctrl A < /kbd > < kbd > ? < /kbd > gets you the list of interactive commands.", "1008" ], [ "Your command\r\n\r\n sudo ./configure & & make & & make install\r\n\r\nruns these three commands sequentially:\r\n\r\n sudo ./configure\r\n make\r\n make install\r\n\r\nNotice that only the first one has root privileges.\r\n\r\nTypically you would run the configure/make stages as your own user account, assigning root privileges only for the final installation stage:\r\n\r\n ./configure\r\n make\r\n sudo make install\r\n\r\nYou can join these with ` & & ` if you&#39;re daring. Personally I prefer to leave the install stage as a separate activity that I apply only when I&#39;m happy that the first two stages have completed not only successfully but also correctly.", "740" ], [ "Building on the suggested related answer, [Why are folders in home directory (Documents, Pictures, etc) created only after the first graphical login?](_URL_0_), you can run this command as root to pre-create the XDG directories for your user `bob`:\r\n\r\n su - bob -c /usr/bin/xdg-user-dirs-update\r\n\r\nIn terms of best practice for passwords, that&#39;s a minefield. My particular thought is to generate a 12-16 character pseudo-random password that can be [typed fairly easily](_URL_1_) and set that to expire on first use (`passwd -e`).\r\n\r\n useradd -m -c &#39;Bob is my friend&#39; -s /bin/bash bob\r\n passwd bob # Enter a suitable pseudo-random password for Bob\r\n passwd -e bob\r\n\r\nConsider, though, that if your user is going to be logging in with an `ssh` certificate/key then it may be that they never even need to know their password.", "740" ], [ "You can feed the content of the file through `ssh` just like you can feed it through any other pipe\r\n\r\n # Create sample file\r\n cat > > /tmp/file < < &#39;EOF&#39;\r\n apple\r\n banana\r\n cherry\r\n EOF\r\n\r\n # Run &#39;nl&#39; locally\r\n nl < /tmp/file\r\n 1 apple\r\n 2 banana\r\n 3 cherry\r\n\r\n # Run &#39;tac&#39; on the remote server &#39;rserver&#39;\r\n nl < /tmp/file | ssh rserver tac\r\n 3 cherry\r\n 2 banana\r\n 1 apple\r\n\r\n # Postprocess result locally\r\n nl < /tmp/file | ssh rserver tac | grep ana\r\n 2 banana\r\n\r\n # Tidy up\r\n rm -f /tmp/file", "883" ], [ "Dynamic DNS is what you need. The client updates its own A record each time it changes. (This isn&#39;t a paid Dynamic DNS service you can get for DHCP-based hosts on the Internet, but it&#39;s the same principle.) The `bind` DNS server can handle DDNS for a zone; `dnsmasq` also will do it.\r\n\r\nDomain-joined Windows clients have used DDNS automatically with AD for a long time. I now see this with recent domain-joined Linux clients against Windows AD, but I haven&#39;t tested against a SAMBA AD.\r\n\r\nYou should find that SAMBA will provide this service automatically - see _URL_0_ for what appears to be a statement that it is supported through the `allow dns updates` parameter in the server&#39;s `smb.conf` file. However, as I&#39;ve already mentioned, I don&#39;t run SAMBA as an AD domain controller so I have not tested this.", "160" ], [ "The relevant line is this one\r\n\r\n > \" ;ARTIFACTORY_TAR_VERSION \" ; : \" ;01.00.00.26 \" ;\r\n\r\nThere are a couple of options: you could require ` \" ;ARTIFACTORY_TAR_VERSION \" ;` to appear on the line, and then substitute something that looks like a version number, or you could be less cautious and just substitute anything that looks like a version number.\r\n\r\nThis option will replace anything that looks like a version number that contains `01.00.` and is followed by digits and dots:\r\n\r\n sed -i \" ;s/01\\.00\\.[0-9.]*/${version}/g \" ; file.json\r\n\r\nThis one constrains the pattern to be bounded by double quotes (notice I switch mid-way through the RE from single-quoted to double-quoted protection against the shell interpreting the pattern):\r\n\r\n sed -ri &#39;s/( \" ;)[[:digit:].]* \" ;/&#39; \" ;\\1${version}\\1/g \" ; file.json\r\n\r\nThis final one also requires the pattern to match only on lines containing the word `VERSION` somewhere in them:\r\n\r\n sed -ri &#39;/VERSION/s/( \" ;)[[:digit:].]* \" ;/&#39; \" ;\\1${version}\\1/g \" ; file.json\r\n\r\n\r\nDon&#39;t forget that for testing you don&#39;t necessarily need to modify the file _in situ_. You can omit the `-i` flag and inspect the output without changing the source file.", "112" ], [ "I know of no command that will precisely match your requirement. Something like this should work (remove the `--dry-run` when you&#39;re sure you&#39;re happy with the result; replace the `--verbose` with `--quiet` if you want it to run more silently):\r\n\r\n src=/path/to/source\r\n dst=/path/to/target\r\n\r\n comm -z -23 \\\r\n < (find \" ;$src \" ; -type f -printf &#39;%P\\0&#39; | sort -z) \\\r\n < (find \" ;$dst \" ; -type f -mmin -60 -printf &#39;%P\\0&#39; | sort -z) |\r\n rsync --dry-run --verbose --archive --from0 --files-from - \" ;$src \" ; \" ;$dst \" ;\r\n\r\nIt assumes relatively recent utilities that understand how to handle NUL-terminated lines. If necessary, and provided that you can guarantee that no filenames contain newlines, you could remove the three `-z` flags and `rsync`&#39;s `--from0` and replace the `\\0` in the `find` commands with `\\n`.", "879" ], [ "I&#39;d use `grep` rather than `awk`. Here the `-P` flag asks `grep` to use PCRE regular expressions rather than its default (so that `.*?` matches _as little as possible_), and the `-o` flag gets `grep` to print only matching components:\r\n\r\n grep -Po &#39;{{.*?}}&#39;\r\n\r\nExample:\r\n\r\n grep -Po &#39;{{.*?}}&#39; < < < &#39;select {{112,department}},{{112,client}},{{112,place}} from table where id=1 and {{112,cgid}} and {{113,evid}}&#39;\r\n {{112,department}}\r\n {{112,client}}\r\n {{112,place}}\r\n {{112,cgid}}\r\n {{113,evid}}\r\n\r\nThere is no `{{va1,val2}}` to match in your query so the \" ;additional requirement \" ; is moot. Or are you generalising to the matched entities such as `{{112,department}}`? If so, you need to explain what is to be done, because to _replace [them] in the query with a single value which I&#39;ll get [later]_ is too broad a requirement to address with explicit code.", "143" ], [ "You could use `awk`:\r\n\r\n awk &#39;BEGIN {print \" ;Hello \" ; > \" ;/tmp/file \" ;}&#39;\r\n\r\nWhen an `awk` program consists of only a `BEGIN` statement, it just interprets that statement and doesn&#39;t process any input.\r\n\r\nYou can even parameterise this\r\n\r\n awk -v text= \" ;World \" ; -v file= \" ;/tmp/main \" ; &#39;BEGIN {print text > file}&#39;\r\n\r\nThough with that syntax, you&#39;d need to escape backslash characters. Using `ARGV` doesn&#39;t have the problem:\r\n\r\n awk &#39;BEGIN {print ARGV[1] > ARGV[2]}&#39; World /tmp/main", "848" ], [ "The entry `_URL_0_` is not a URL; it&#39;s a domain name, or possibly a host name. (It could be part of a URL, though.)\r\n\r\nIf you use `netstat -rn` you will get IP addresses instead of names in that first column. From there you can delete the route - again by reference to its network and subnet addressing.\r\n\r\n netstat -r\r\n Kernel IP routing table\r\n Destination Gateway Genmask Flags MSS Window irtt Iface\r\n default server.roaima <IP_ADDRESS> UG 0 0 0 eth1\r\n <IP_ADDRESS> <IP_ADDRESS> <IP_ADDRESS> U 0 0 0 eth0\r\n _URL_0_ <IP_ADDRESS> <IP_ADDRESS> UH 0 0 0 eth1\r\n \r\n netstat -rn\r\n Kernel IP routing table\r\n Destination Gateway Genmask Flags MSS Window irtt Iface\r\n <IP_ADDRESS> <IP_ADDRESS> <IP_ADDRESS> UG 0 0 0 eth1\r\n <IP_ADDRESS> <IP_ADDRESS> <IP_ADDRESS> U 0 0 0 eth0\r\n <IP_ADDRESS> <IP_ADDRESS> <IP_ADDRESS> UH 0 0 0 eth1\r\n \r\n route delete -host <IP_ADDRESS><PHONE_NUMBER> U 0 0 0 eth0\r\n _URL_0_ 0.0.0.0 255.255.255.255 UH 0 0 0 eth1\r\n \r\n netstat -rn\r\n Kernel IP routing table\r\n Destination Gateway Genmask Flags MSS Window irtt Iface\r\n 0.0.0.0 192.168.2.2 0.0.0.0 UG 0 0 0 eth1\r\n 192.168.1.0 0.0.0.0 <PHONE_NUMBER> U 0 0 0 eth0\r\n 216.58.198.174 0.0.0.0 255.255.255.255 UH 0 0 0 eth1\r\n \r\n route delete -host 216.58.198.174\r\n\r\nYou can also do this with the newer `ip route`, which lists routes only with IP addresses. Use `ip route del` to delete the unwanted entry.", "160" ], [ "Given your example command creates `/root/.video/video` instead of linking as expected, you appear to have both directories already present\r\n\r\n1. Move everything that is in `/root/.videos` to `/home/videos`\r\n\r\n mv /root/.videos/* /home/videos # Assumes no files beginning with a dot\r\n\r\n2. Remove the `/root/.videos` directory\r\n\r\n rmdir /root/.videos # If this fails, check no files are still hiding in here\r\n\r\n3. Link the existing directory\r\n\r\n cd /root\r\n ln -s /home/videos .videos", "523" ], [ "You&#39;re using an unknown account:\r\n\r\n check_ntlm_password: Authentication for user [pepe] - > [pepe] FAILED with error NT_STATUS_NO_SUCH_USER, authoritative=1\r\n\r\nso your access to `soft` is as guest. You&#39;ve allowed guest access in Samba but the permissions in the filesystem don&#39;t appear to be set up to honour that.\r\n\r\nBy default the guest user is `nobody` so you need to set your filesystem permissions to allow it access. Or change how you&#39;re trying to access the share.\r\n\r\n----\r\n\r\nFollowing through information added via comments it seems that we need a more detailed solution. At the moment you mount the NTFS filesystem with an explicit owner - essentially treating its ownerships like a vFAT filesystem. But that owner doesn&#39;t match the account you have defined through Samba to access the filesystem, so Samba accounts cannot access the filesystem. Either these must match or you need to use the NTFS filesystem permissions and remove the forced mount ownership.\r\n\r\nLet&#39;s take the route that requires fewer changes to your system. It&#39;s a home-user approach rather than a many-user ( \" ;enterprisey \" ;) approach.\r\n\r\n1. Leave the NTFS mount unchanged, so that you continue to force owner=1000, group=1000.\r\n\r\n2. Tell Samba that authenticated users must be treated as owner=1000, group=1000 when accessing the corresponding share, by including the `force user` directive:\r\n\r\n [global]\r\n ...\r\n security = user\r\n map to guest = bad user # Use \" ;guest \" ; account for unknown users\r\n ; guest account = nobody # Implicit default unless you override it\r\n\r\n [soft]\r\n path = /media/SYSTEM/soft\r\n read only = no\r\n writable = yes\r\n browsable = yes\r\n guest ok = yes # Allow unknown users to access this share\r\n force user = 1000 # Samba authenticates, but filesystem access is as uid=1000\r\n\r\nNote that a valid user with an invalid password will be refused access, but an invalid user (with any password) will be allowed access. This is what you have defined here with your `map to guest = bad user` and `guest ok = yes`. I would strongly recommend you change one of these to read either `map to guest = never` or `guest ok = no`.\r\n\r\nIn your `/etc/fstab` I would suggest you consider removing the `uid`, `gid`, and `umask` settings for the NTFS filesystem, as you can then remove the `force user` and `force group` settings in Samba. But you may have good reason for these values so I haven&#39;t changed them in my answer.", "708" ], [ "Consider a cup. Now drop it. Ooops, the handle&#39;s snapped off. It&#39;s still a cup and can hold liquid. But it&#39;s broken and if you try to use the handle you can&#39;t. Furthermore, the cup might be microscopically cracked and sooner or later it will snap into pieces. That&#39;s your disk drive.", "325" ], [ "1. The tool is a block copy. You&#39;re copying the entire drive so the partition table, filesystem structures and everything will be copied from the source to the destination.\r\n\r\n2. No. Emphatically no. You&#39;re about to overwrite it at the block level. If you have a mounted filesystem there you may well introduce unintended corruption. Ensure that the source disk is also unmounted. Neither must be in use.\r\n\r\n3. That depends on the particular command, and unfortunately it&#39;s not possible to generalise.\r\n\r\nYou may want to increase the read/write chunk size; the default is 512 byte chunks which is very small. Try 128KB or even bigger.", "437" ], [ "You write\r\n\r\n > because it starts with a ./ it will just be executed ( \" ;No such file or directory \" ;).\r\n\r\nThis isn&#39;t what&#39;s happening. You have provided a single command to the `find ... -exec` parameter of `echo \" ;{} \" ;`. Note that this is not `echo` and the directory found by `find`; it&#39;s a single command that includes a space in its name. The `find` command (quite reasonably) cannot execute a command called `echo \" ;./workspace/6875538616c6/raw/2850cd9cf25b/360 \" ;`.\r\n\r\nRemove the single quotes around the `-exec` parameter and you may find you don&#39;t need any additional changes or workarounds:\r\n\r\n find . -name &#39;360&#39; -type d -exec echo \" ;{} \" ; \\;\r\n\r\nSimilarly here you need to remove the quoting of the entire value passed to `-exec`. But in this case you still need to quote the storage arguments so the shell cannot interpret ` & `, etc.\r\n\r\n find reallylongfolderstructure -name &#39;360&#39; -type d -exec curl &#39;_URL_0_{}&#39; \\;", "67" ], [ "I think you&#39;ve answered your own question: you need `scp` on both sides.\r\n\r\nThe local instance of `scp` invokes `scp` remotely with the undocumented `-t` flag to handle the file transfer protocol.\r\n\r\nIf you really don&#39;t have `scp`, but you do have an `ssh` server, you might be able to use `sftp` to transfer the files, as in many cases the SFTP server component is built in to the `ssh` server.", "883" ], [ "You&#39;re using the wrong sort of quotes for your command.\r\n\r\nThe double quotes (` \" ;... \" ;`) allow the shell to evaluate your variables such as `$i`, and because you&#39;ve already used that variable and it has been left with the value `adrenal_4a_ERR315452_1.fastq.gz`, means your `qsub` sees this for execution:\r\n\r\n for i in *_1.fastq.gz; do echo adrenal_4a_ERR315452_1.fastq.gz > > t.txt; zcat adrenal_4a_ERR315452_1.fastq.gz | grep GCTGGCAAAAAGAAGGTAACATGTTTT > > t.txt ; echo > > t.txt ; done\r\n\r\nChange the outermost quotes to single quotes (`&#39;...&#39;`) and it&#39;ll work as expected:\r\n\r\n qsub -l h_vmem=4G -cwd -j y -b y -N n_tr -R y &#39;for i in *_1.fastq.gz; do echo $i > > t.txt; zcat $i | grep \" ;GCTGGCAAAAAGAAGGTAACATGTTTT \" ; > > t.txt ; echo > > t.txt ; done&#39;", "67" ], [ "The way I&#39;d approach this is as follows. It involves running Ubuntu and Debian simultaneously as VM Host and Guest with different parts of the same physical disk. Provided the two running systems do not attempt to write to each other&#39;s disk partitions this will work. However, it&#39;s not for the faint-hearted...\r\n\r\n1. Allocate a small-ish (say 15GB) partition for installing the Ubuntu distribution you know works. If you&#39;re really keen, allocate it at the end of the disk. Install Ubuntu into it. Shared root and boot. No swap.\r\n1. Fire up KVM with your real disk as its guest disk (yes really).\r\n1. As a guest inside the KVM install your Debian/Unstable onto the remainder of the disk. Keep the initial installation as small and simple as possible (no \" ;task \" ; selections at all, for example). You can extend it later. Use the Ubuntu system to provide your virtualised networking needs (NAT or Bridge; it doesn&#39;t really matter). My personal preference is to use LVM for as much as possible so that I don&#39;t need to assign disk sizes too early (15GB for root, 10GB for home, 1GB for swap, etc.) Use physical disk drivers rather than virtualised ones even though KVM may warn you it&#39;s not as efficient. You may want a separate `/boot` partition. **DO NOT TOUCH the Ubuntu partition!** Allow `grub` to update the boot partition but not if it thinks it&#39;s still part of the Ubuntu system.\r\n1. Ensure that the necessary physical ethernet modules have been installed within your Debian/Unstable and then shutdown the VM\r\n1. Reboot from Ubuntu into the newly installed Debian/Unstable, this time as the physical machine rather than as a VM guest. You may need to fix-up some of the disk partition names (`/dev/vdaN` or `/dev/sdbN` might need to be rewritten as `/dev/sdaN`, etc). If you were able to use disk UUIDs you will probably be fine.\r\n1. If you find you&#39;re missing parts of the Debian/Unstable, reboot back into Ubuntu and fire up Debian/Unstable as a VM guest once more.\r\n1. Once you&#39;ve got networking sorted properly in your Debian/Unstable OS (i.e. as a physical OS rather than as a virtualised guest), install the remainder of the system to suit - graphics, productivity tools, etc.\r\n1. When you&#39;re sure everything is working as expected you can delete the Ubuntu partition and extend the previous partition into the now-empty disk space.", "181" ], [ "One quick and dirty approach, if you don&#39;t mind an error message and you only need to copy non-dot files, is this\r\n\r\n scp -p asuser@host:&#39;/path/to/dir-or-file/*&#39; asuser@host:&#39;/path/to/dir-or-file&#39; .\r\n\r\nThe trailing dot copies the remote files to the current directory. Adjust to taste. The `-p` flag retains the time stamp and permissions. Omit if those aren&#39;t required.", "523" ], [ "You will find that `/Users/myusername/.config/yarn/global/node_modules/vue-cli/bin/vue` does not exist.\r\n\r\nThe symbolic link `/usr/local/bin/vue` exists, so you can see it with `ls -l`. But the target does not, so there&#39;s not really any file there.\r\n\r\nYou can confirm this with either of these two commands\r\n\r\n ls -lL /usr/local/bin/vue\r\n ls -l /usr/local/bin/../../../Users/myusername/.config/yarn/global/node_modules/vue-cli/bin/vue\r\n\r\nThe first tells `ls` to give you information about the _target_ of the link rather than the link itself (`-L`). The second looks directly at the target.", "708" ], [ "You&#39;re almost there. Your mount command is wrong though. It should be this\r\n\r\n /mnt/path cifs rw,noperm 0 0\r\n\r\nIf you leave the user and group unspecified the underlying permissions get applied. The noperm tells the client not to try and \" ;second guess \" ; the access controls. Otherwise you&#39;ll find that the local apparent permissions get in the way.", "708" ], [ "If you want to exclude files and directories that match `._*` and `.DS_Store` then either of the earlier answers is sufficient:\r\n\r\n rsync -av --exclude=&#39;._*&#39; --exclude=&#39;.DS_Store&#39; src dst\r\n\r\nOn the other hand, to answer your question exactly as asked, this snippet will exclude files that match your criteria while still including directories that match `_*` and `.DS_Store`:\r\n\r\n rsync -av --include &#39;.DS_Store/&#39; --include &#39;._*/&#39; --exclude &#39;.DS_Store&#39; --exclude &#39;._*&#39; src dst\r\n\r\nWorked example\r\n\r\n # Set up the example directory tree\r\n mkdir -p src/a/.DS_Store src/a/._example.dir dst\r\n touch src/.DS_Store src/._example.txt src/a/.DS_Store/keep src/a/._example.dir/keep src/item src/a/another\r\n \r\n # Show what we have\r\n find src -type f\r\n\r\n src/.DS_Store\r\n src/._example.txt\r\n src/a/.DS_Store/keep\r\n src/a/._example.dir/keep\r\n src/a/another\r\n src/item\r\n \r\n # Copy it. Omit matching files but keep the directories\r\n rsync -av --include &#39;.DS_Store/&#39; --include &#39;._*/&#39; --exclude &#39;.DS_Store&#39; --exclude &#39;._*&#39; src/ dst\r\n\r\n sending incremental file list\r\n ./\r\n item\r\n a/\r\n a/another\r\n a/.DS_Store/\r\n a/.DS_Store/keep\r\n a/._example.dir/\r\n a/._example.dir/keep\r\n\r\n # Tidy up\r\n rm -rf src dst", "92" ], [ "After running this command\r\n\r\n sudo grep -rl &#39;NOPASSWD:ALL&#39; /etc /lib /usr /var /home /root\r\n\r\nyou advised that several files matched:\r\n\r\n /etc/sudoers\r\n /usr/lib/snapd/snapd\r\n /var/log/auth.log\r\n /home/neon/HUAWEI-4g_Dongle/Linux/install\r\n\r\nThe first three of these files could be reasonably expected to contain a match, and can be safely ignored. The fourth, on the other hand, appears to be a possible culprit and bears further investigation.\r\n\r\nIndeed, your [pastebin](_URL_1_) shows these snippets:\r\n\r\n SOFTWARENAME= \" ;Mobile Partner \" ;\r\n SOFTWARENAME=$(echo $SOFTWARENAME | sed s\\#\\ \\#_\\#g)\r\n TEMPFILE= \" ;${SOFTWARENAME}_install_$PPID \" ;\r\n ... \r\n\r\n grep -v \" ;_URL_0_ \" ; /etc/sudoers > /tmp/${TEMPFILE} 2 > & 1\r\n echo -e \" ;ALL ALL=(ALL) NOPASSWD:ALL \" ; > > /tmp/${TEMPFILE}\r\n ...\r\n\r\n cp -f /tmp/${TEMPFILE} /etc/sudoers\r\n\r\nYes, I would say that&#39;s a (terrible) security hole from fairly lousy quality code.\r\n\r\nHaving removed (or commented out) the lines from your `/etc/sudoers` file, I would also recommend you check the permissions on that file. They should be `ug=r,o=` (`0440` = `r--r-----`), probably owned by `root`:`root`.", "708" ], [ "Since this is `bash` you can sidestep the check for `$1` being set and just use ` \" ;$@ \" ;` (when double-quoted, this parameter disappears completely if it has no values, which avoids it being caught by `set -u`):\r\n\r\n get_percent() {\r\n df -h \" ;$@ \" ; | awk &#39;NR > 1 { printf \" ;%s\\t%s\\n \" ;, $1, $5 }&#39;\r\n }\r\n\r\n\r\nI&#39;ve also tweaked the rest of the line slightly so that you don&#39;t get {space}{tab}{space} between the two values you output but insead you get just a {tab}. If you really want the two invisible spaces then change the `awk` to use `printf \" ;%s \\t %s\\n \" ;, $1, $5`.", "848" ], [ "If you really want `less` to clear the screen when it exits you can redefine the command like this\r\n\r\n less() { command less \" ;$@ \" ;; clear; }\r\n\r\nOn the other hand, if you want `less` to save the original content of the screen and restore that when it exits, this should be standard behaviour. (It&#39;s managed through the `ti` and `te` entries of `TERMINFO` and/or `TERMCAP`. These are set according to the terminal type as evidenced with `echo $TERM`.)\r\n\r\nYou can try forcing off the `-X` option with\r\n\r\n less -+X\r\n\r\nBut if that doesn&#39;t work either, provide the result of running an `echo $TERM` command, and it should be possible to determine what the `ti` and `te` values are, and therefore why they&#39;re not saving and restoring the screen.", "1008" ], [ "Since you have already determined that you cannot backup the entire 300GB amount within the mandated 24 hour period you need to review your requirements.\r\n\r\nAt the file level, an incremental tool such as `star`, `duplicity`, or even `rsync`/`rsnapshot` may still take more than your one day to create the base backup but after that it should be considerably faster. Obviously, this will be dependent on the number and size of the files that are changed within each 24 hours backup period.\r\n\r\nAt the filesystem level, a snapshot may be sufficient for your needs (although this isn&#39;t really a backup), especially as you can then take a true backup from the snapshot at leisure without significant regard to the time taken for it to complete. As before, once the base backup has been laid down your incrementals may take considerably less time to produce.\r\n\r\nYou haven&#39;t specified how your backup should be stored, but for many small-ish files something like `rsnapshot` could be a good fit. (I use it for file-based backups of many of our internal fileservers since it allows us trivial access to individual files for recovery purposes.)\r\n\r\nIncidentally, a backup to another disk on the same host shouldn&#39;t really be considered a safe backup. It would be far better to backup to a different host entirely. (If `/home/fs_backup` is a remote mount from a different server, seriously consider using `duplicity` or `rsync`/`rsnapshot` to communicate directly with the remote host rather than going through the remotely mounted filesystem.)", "555" ], [ "As mentioned in a comment, you cannot use ` < ` to compare month names:\r\n\r\n (( &#39;2018-Aug-29&#39; < &#39;2018-Feb-28&#39; )) & & echo &#39;Uh oh, August is before February&#39; || echo &#39;Sanity prevails&#39;\r\n Uh oh, August is before February\r\n\r\nIf you want to compare date strings lexically I would suggest you use YYYY-MM-DD format.\r\n\r\nBetter though, might be to use `find` to delete older directories regardless of the naming convention:\r\n\r\n find \" ;$BACKUP_SETS \" ; -mindepth 1 -maxdepth 1 -type d -mtime +2 -print -exec echo rm -rf {} \\;\r\n\r\nNeedless to say, remove the `echo` when you want it to run for real.", "705" ], [ "Following in from the first suggestion to replace `mount` with a script, this is the option I would consider first, too. But it really depends on whether the Java program uses the external `mount` program to perform the mount or it uses some form of library call. If it&#39;s the latter you&#39;d need to look at schemes that override library calls in a manner such as `fakeroot`.", "28" ], [ "@Rui it might, but it depends on whether or not there&#39;s a smarthost and all sorts of things that the OP hasn&#39;t mentioned. Oleh, can you elaborate, please. Steps and an example would be great. At the moment your answer doesn&#39;t really solve the problem as described - it&#39;s just a vague pointer to a possible solution.", "1004" ], [ "`man rsync` will show an option to log output to a logfile:\r\n\r\n > **`--log-file=FILE`**\r\n > This option causes `rsync` to log what it is doing to a file. This is similar to the logging\r\n > that a daemon does, but can be requested for the client side and/or the server side of a\r\n > non-daemon transfer. If specified as a client option, transfer logging will be enabled with a\r\n > default format of ` \" ;%i %n%L \" ;`. See the `--log-file-format` option if you wish to override this.", "436" ], [ "If you&#39;ll accept `perl`, then this solution copied straight from [Perl, using tr function to convert uppercase to lowercase and vice-versa at the same time?](_URL_0_) will work for you:\r\n\r\n echo &#39;Hello &#201;l&#232;ve. It is beautiful!&#39; |\r\n perl -Mopen=locale -Mutf8 -pe &#39;s/([[:upper:]])|([[:lower:]])/defined $1 ? lc $1 : uc $2/eg&#39;\r\n\r\n hELLO &#233;L&#200;VE. iT IS BEAUTIFUL!\r\n\r\nI also wondered about using something like `( gsed ... || tr ... )` so that on systems with GNU&#39;s `gsed` it would take priority, but on other systems where `tr` was _probably_ not GNU that would execute instead. (Non-GNU POSIX `tr` apparently handles multi-byte characters correctly.)", "567" ], [ "I do this for my Tomcat instances. (Formerly Confluence, now XWiki.)\r\n\r\n1. The http → https vHost is a straight redirect, no proxies.\r\n1. The https vHost manages the proxy rewrites for Tomcat, knowing that the URI has a sane pattern.\r\n\r\nHere&#39;s a (slightly) edited version of my configuration:\r\n\r\n < VirtualHost *:80 > \r\n ServerAdmin <EMAIL_ADDRESS>\r\n \r\n ServerName _URL_0_\r\n \r\n DocumentRoot /home/www/_URL_0_/docroot\r\n \r\n \r\n # Global protection\r\n #\r\n < Directory / > \r\n Options none\r\n AllowOverride None\r\n < /Directory > \r\n \r\n \r\n # Send users to canonical website\r\n #\r\n Redirect / https://_URL_0_/\r\n \r\n \r\n # Logging\r\n #\r\n ServerSignature On\r\n LogLevel warn\r\n ErrorLog \" ;|/usr/bin/cronolog /home/www/_URL_0_/logs/%Y/%m/%d/public-error.log \" ;\r\n CustomLog \" ;|/usr/bin/cronolog /home/www/_URL_0_/logs/%Y/%m/%d/public-access.log \" ; combined\r\n \r\n < /VirtualHost > \r\n \r\n < VirtualHost *:443 > \r\n ServerAdmin <EMAIL_ADDRESS>\r\n \r\n ServerName _URL_0_\r\n \r\n DocumentRoot /home/www/_URL_0_/docroot\r\n AddDefaultCharset UTF-8\r\n \r\n \r\n # Global protection\r\n #\r\n < Directory / > \r\n Options none\r\n AllowOverride None\r\n < /Directory > \r\n \r\n \r\n # Access to the application itself\r\n #\r\n ProxyPassMatch /(.*) http://_URL_0_:8090/$1\r\n ProxyPassReverse / http://_URL_0_:8090/\r\n ProxyPassReverseCookieDomain _URL_0_ _URL_0_\r\n \r\n \r\n # Logging\r\n #\r\n ServerSignature On\r\n \r\n LogLevel warn rewrite:debug\r\n ErrorLog \" ;|/usr/bin/cronolog /home/www/_URL_0_/logs/%Y/%m/%d/secure-error.log \" ;\r\n CustomLog \" ;|/usr/bin/cronolog /home/www/_URL_0_/logs/%Y/%m/%d/secure-access.log \" ; combined\r\n \r\n #RewriteLogLevel 1\r\n #RewriteLog \" ;|/usr/bin/cronolog /home/www/_URL_0_/logs/%Y/%m/%d/secure-rewrite.log \" ;\r\n \r\n \r\n # SSL\r\n #\r\n SSLEngine on\r\n \r\n SSLCertificateFile \" ;...crt \" ;\r\n SSLCertificateKeyFile \" ;...key \" ;\r\n SSLCertificateChainFile \" ;...ca-bundle \" ;\r\n \r\n BrowserMatch \" ;MSIE [2-6] \" ; \\\r\n nokeepalive ssl-unclean-shutdown \\\r\n downgrade-1.0 force-response-1.0\r\n BrowserMatch \" ;MSIE [17-9] \" ; ssl-unclean-shutdown\r\n \r\n < /VirtualHost >", "222" ], [ "It wasn&#39;t easy to articulate either. Part of StackExchange&#39;s success is that it is intentionally easy to ask a question. You have a problem. A quick Google throws up either gibberish that you don&#39;t understand or else nothing useful, so you pop across to the (appropriate) Stack and ask away. Sometimes you&#39;ll get people asking for clarification. Other times there&#39;ll be \" ;Closed - unclear \" ; or anonymous downvotes. It&#39;s a tricky one to answer, for sure.", "862" ], [ "If you ran `sudo mv ./* /wordpress` from the `/srv/www/wptestsite` directory then you might have filled up the root directory&#39;s filesystem (`/`).\r\n\r\nI don&#39;t think this should have caused the system to fail to boot, but it might have caused some of the more critical services to fail to start.\r\n\r\nDepending on what \" ;safe boot \" ; really means you should be able to use that to get to the filesystems and move the files from `/wordpress` back to `/src/www/wptestsite`. I would not recommend a reinstallation of the OS.", "861" ], [ "It sounds like you actually want to detect whether or not a terminal (TTY) is available to the application. (This will allow you to display a progress bar when running on a terminal, but not bother if running under `crontab`.)\r\n\r\n #!/bin/bash\r\n #\r\n [[ -t 2 ]] & & echo \" ;This is a status update for the terminal \" ; > & 2\r\n echo \" ;This is a normal line of results \" ;\r\n\r\nThe `test -t` operation checks to see whether or not the numbered file descriptor is connected to a terminal. 0 is _stdin_, 1 is _stdout_, and 2 is _stderr_.\r\n\r\nGenerally, progress information would be written to _stderr_ with actual results written to _stdout_. This way the user can discard progress/status output if they don&#39;t want to see it, and status updates and results can be separated usefully:\r\n\r\n yourprogram arg1 arg2 ... > results.txt", "859" ], [ "I think you&#39;re asking for a more complex scenario. You haven&#39;t described how to identify the \" ;last \" ; file to arrive, so this one simply times out after 5 seconds of file inactivity since at least one file has been transferred.\r\n\r\n1. Set flag = waiting\r\n1. In parallel: whenever a file is notified, set flag = not_done\r\n1. Wait until flag == not_done\r\n\r\n1. Start loop\r\n - Wait for USB to be connected and start the synchronisation process (`rsync`)\r\n - If any new files were transferred then set flag = not_done\r\n - Otherwise\r\n - If flag == probably_done then set flag = definitely_done otherwise set flag = probably_done\r\n - If we took less than five seconds then wait for the remaining time\r\n1. Loop until flag == definitely_done\r\n\r\nSince we need IPC between the main process and the parallel `inotifywait` process I&#39;d consider implementing the flag as a file, possibly even a set of file names.\r\n\r\nAs far as I can tell [it&#39;s not easy](_URL_0_) to identify whether or not `rsync` has transferred new files. You might need to compare target directory contents before and after.", "16" ], [ "> I want to find the program which has accessed (in the past not at the moment) this js file\r\n\r\nYou cannot find this information retrospectively.\r\n\r\nIf you have `auditd` installed you can identify which processes have run, but not what files they accessed. `sar` will give similar types of information but more generally about the system.\r\n\r\nIf you can force the issue to repeat then a tool such as `inotifywait` may run quickly enough to capture details of the process accessing your JS file.\r\n\r\nAlso see [What information about a process is retrievable after it is terminated?](_URL_0_)", "651" ], [ "Unless it&#39;s a particularly long list you may be able to dispense with `xargs` entirely\r\n\r\n list=(a b c)\r\n \r\n # With xargs\r\n printf \" ;%s\\n \" ; \" ;${list[@]} \" ; | xargs foo # Results in &#171; foo a b c &#187;\r\n\r\n # Without xargs\r\n foo \" ;${list[@]} \" ; # Also results in &#171; foo a b c &#187;\r\n\r\nOf course, the applicability of this to your situation is dependent on the additional flags (if any) that you want to pass to your actual `xargs` command.", "67" ], [ "As has already been described you can use this construct to write (and continue writing) to a file:\r\n\r\n awk &#39;{ print \" ;hello, world \" ; > > \" ;file.log \" ; }&#39;\r\n\r\nThe other part of the puzzle is how to get your shell variable `$log` into `awk` without complex quoting. The `-v` flag allows you to define an `awk` variable, which in this case we set to be the value of the shell variable `$log`:\r\n\r\n awk -v logfile= \" ;$log \" ; { print \" ;Appending to \" ;, logfile, \" ;here \" ; > > logfile }&#39;\r\n\r\n\r\n(I didn&#39;t use `log= \" ;$log \" ;` because `awk` variants (at least `mawk` and `gawk`) use `log` as a built-in and won&#39;t allow it to be redefined.)", "848" ], [ "I don&#39;t see this behaviour here.\r\n\r\n- Here&#39;s my sample code, entered verbatim on the command line:\r\n\r\n bash -c &#39;echo This is parent $$; sleep 7; bash -c \" ;echo This is child \\$$; sleep 7; echo Child done \" ;; echo This is parent $$ again; sleep 7&#39;\r\n\r\n- As soon as you get the `This is child xx` message, hit < kbd > Ctrl < /kbd > < kbd > Z < /kbd > to suspend the process.\r\n\r\n- Wait a further 7 seconds to confirm that it really has paused\r\n- Now `jobs -l` to list the process leader (parent PID). Actually, we can use the jobs number, in this case `%1`\r\n\r\n- Continue the process in the background `kill -CONT %1`\r\n\r\nI saw that the child continued and then exited, allowing the parent to complete.\r\n\r\nHere is the complete run result (including ` > $` shell prompts)\r\n\r\n > $ bash -c &#39;echo This is parent $$; sleep 7; bash -c \" ;echo This is child \\$$; sleep 7; echo Child done \" ;; echo This is parent $$ again; sleep 7&#39;\r\n This is parent 2004\r\n This is child 10696\r\n \r\n [1]+ Stopped bash -c &#39;echo This is parent $$; sleep 7; bash -c \" ;echo This is child \\$$; sleep 7; echo Child done \" ;; echo This is parent $$ again; sleep 7&#39;\r\n > $ jobs -l\r\n [1]+ 2004 Stopped bash -c &#39;echo This is parent $$; sleep 7; bash -c \" ;echo This is child \\$$; sleep 7; echo Child done \" ;; echo This is parent $$ again; sleep 7&#39;\r\n > $ kill -CONT %1\r\n > $ Child done\r\n This is parent 2004 again\r\n\r\nIf you want to experiment further with an automated test-harness, you can use `kill -TSTP ...` to send the same signal as is generated by < kbd > Ctrl < /kbd > < kbd > Z < /kbd > on the keyboard.", "691" ], [ "See _URL_3_ for instructions on the Ubuntu approach to fixing the issue. Here are what I think are the relevant extracts, but note that I have not tested this as I don&#39;t have your hardware:\r\n\r\n**If you have kernel 4.5.0**\r\n\r\n sudo mkdir -p /lib/firmware/ath10k/QCA6174/hw3.0/\r\n sudo rm /lib/firmware/ath10k/QCA6174/hw3.0/* 2 > /dev/null\r\n sudo wget -O /lib/firmware/ath10k/QCA6174/hw3.0/board.bin _URL_1_\r\n sudo wget -O /lib/firmware/ath10k/QCA6174/hw3.0/board-2.bin _URL_4_\r\n sudo wget -O /lib/firmware/ath10k/QCA6174/hw3.0/firmware-4.bin _URL_5_\r\n\r\nReboot or reload the ath10k_pci module and you should be able to connect.\r\n\r\n**Otherwise**\r\n\r\n sudo mkdir -p /lib/firmware/ath10k/QCA6174/hw3.0/\r\n sudo rm /lib/firmware/ath10k/QCA6174/hw3.0/* 2 > /dev/null\r\n sudo wget -O /lib/firmware/ath10k/QCA6174/hw3.0/board.bin _URL_2_\r\n sudo wget -O /lib/firmware/ath10k/QCA6174/hw3.0/firmware-4.bin _URL_0_\r\n sudo chmod +x /lib/firmware/ath10k/QCA6174/hw3.0/*\r\n\r\nReboot or reload the ath10k_pci module and you should be able to connect.\r\n\r\n**Caveats**\r\n\r\nA number of comments on the original link say that these fixes do not work straight off, and tweaks are supplied. I would strongly recommend you work your way through the entire thread. Read it twice - once to see what&#39;s going on, and the once (at least) to work out what needs applying in your situation. This isn&#39;t going to be easy.", "401" ], [ "When you run an `scp` on a local client between two remote systems, like this:\r\n\r\n scp remote1:file remote2:\r\n\r\nYou are authenticating to `remote1` from your local, as expected, but then it is `remote1` that authenticates to `remote2` directly. The file transfer is NOT sent via your local client as you might expect.\r\n\r\nTo tell `scp` on the client to authenticate to both remote hosts and to manage the file transfer itself you need an additional flag:\r\n\r\n scp -3 remote1:file remote2:\r\n\r\nIn your situation I expect that the first Pi doesn&#39;t have a certificate-based login _that works without manual involvement_ set up to the second, so the authentication fails. (Bear in mind your keys appear to require a passphrase to unlock, and that isn&#39;t available on the first Pi when it tries to communicate with the second.)\r\n\r\n-----\r\n\r\nOK, so I can repeat your issue when I have no certificate based authentication set up. It seems that to transfer between two remote systems you _must_ have certificate-based authentication (i.e. no password required).", "883" ], [ "Consider the simplified file\r\n\r\n AAA\r\n BBB\r\n CCC1\r\n DDD\r\n EEE\r\n CCC2\r\n DDD\r\n FFF\r\n GGG\r\n CCC3\r\n HHH\r\n\r\nI can pick out the range `EEE` to `FFF` with\r\n\r\n sed -n &#39;/EEE/,/FFF/p&#39;\r\n\r\nSuppose though that I want to print any line containing `C` but only within the matching range. I can pipe the result from `sed` through `grep`\r\n\r\n sed -n &#39;/EEE/,/FFF/p&#39; | grep &#39;C&#39;\r\n\r\nI could also do the range and match in a little `awk` script (or `perl`, `python`, etc.). But how would I do this using just one invocation of `sed`?", "112" ], [ "This works for me on Stretch (Debian 9). If it doesn&#39;t work for you, you&#39;ll need to update your question with contrasting information:\r\n\r\n1. First ensure that `contrib` repository has been added to your `sources.list`. If the following command returns nothing you need to add it.\r\n\r\n grep -rq &#39;stretch/.* contrib&#39; /etc/apt/sources.list{,.d} 2 > /dev/null & & echo ok\r\n\r\n Expected output\r\n\r\n ok\r\n\r\n1. Update the repository and install the necessary set of packages.\r\n\r\n apt-get update\r\n apt-get install build-essential module-assistant\r\n module-assistant prepare\r\n\r\n1. Mount and run the VirtualBox Guest Additions image. Ensure the DVD image is available by going to the Guest window and then using the menu Devices > Insert Guest Additions Image... If you get an error here that you cannot understand, report it back _in your question_.\r\n\r\n mount /media/cdrom\r\n bash /media/cdrom/VBoxLinuxAdditions.run\r\n\r\n Expected output\r\n\r\n mount: /dev/sr0 is write-protected, mounting read-only\r\n\r\n Verifying archive integrity... All good.\r\n Uncompressing VirtualBox 5.2.8 Guest Additions for Linux........\r\n VirtualBox Guest Additions installer\r\n ...\r\n\r\n1. Check that the modules have been loaded into the running kernel. You _may_ need to reboot to see this take effect (but I didn&#39;t).\r\n\r\n lsmod | grep vb\r\n\r\n Expected output (ignore the column of high-valued numbers)\r\n\r\n vboxvideo 36864 1\r\n ttm 98304 1 vboxvideo\r\n drm_kms_helper 155648 1 vboxvideo\r\n drm <PHONE_NUMBER> 4 vboxvideo,ttm,drm_kms_helper\r\n vboxsf 45056 0\r\n vboxguest 286720 1 vboxsf", "181" ], [ "The `--list-only` option does not identify the files that _will_ be transferred; it only identifies the files that are _candidates_ for being transferred. You can see this here\r\n\r\n touch aa bb cc; ln -s cc dd\r\n rsync --list-only --no-links -a ?? /tmp\r\n rsync -av ?? /tmp\r\n \r\n rsync --list-only --no-links -a ?? /tmp\r\n\r\nOutput from last `rsync`\r\n\r\n -rw-r--r-- 0 2018/09/05 16:35:01 aa\r\n -rw-r--r-- 0 2018/09/05 16:35:01 bb\r\n -rw-r--r-- 0 2018/09/05 16:35:01 cc\r\n lrwxrwxrwx 2 2018/09/05 16:35:01 dd - > cc\r\n\r\n\r\nConsider the last `rsync`, where the files have already been transferred and remain unchanged on the source. If `--list-only` were to show files that needed to be transferred, nothing would be listed. However, it still shows the set of source files that need to be considered.\r\n\r\nIf you want to use context of the target to manage the set of files to be reported, use `--dry-run --info=name`\r\n\r\n rsync --dry-run --info=name --archive --no-links ?? /tmp\r\n\r\nOr, if you want a similar output to that produced by `--list-only` (notably omitting the entry type from the first character)\r\n\r\n rsync --dry-run --info=name --out-format=&#39;%B%16l %t %f&#39; --archive --no-links ?? /tmp\r\n\r\nInitial output\r\n\r\n skipping non-regular file \" ;dd \" ;\r\n rw-r--r-- 0 2018/09/05 16:42:30 aa\r\n rw-r--r-- 0 2018/09/05 16:42:30 bb\r\n rw-r--r-- 0 2018/09/05 16:42:30 cc\r\n\r\nSubsequent output, once the files have been copied\r\n\r\n skipping non-regular file \" ;dd \" ;", "919" ], [ "`pwd` will give us the directory context in which you&#39;re running the `ln -s`. By all means obfuscate BOTH commands similarly if you would like to hide the precise name of one or more of directories. But without the context we can&#39;t see where you&#39;ve put `symlink_file_name` and so we can&#39;t reliably determine why you should get the behaviour you&#39;re seeing.", "665" ], [ "Almost every command has an associated manual page. Suppose the command verb is `ls`, then typing `man ls` at the command line prompt will give you that command&#39;s reference page.\r\n\r\nThe `-t` flag has no specific meaning across all commands. You will need to look at the man page for the particular command to find out what it does.", "1008" ], [ "You&#39;ve got a classic ownership/permissions problem here. You&#39;ve told SAMBA to allow access to `/home/hoster/sharetest` only to `equah` but your underlying filesystem permissions deny access to that user (`drwx------ 19 hoster hoster 4096 Sep 8 20:20 /home/hoster`).\r\n\r\nAllow `equah` access to the directory and it should be ok\r\n\r\n chmod a+x /home/hoster\r\n\r\nOr force the access by `equah` to be performed by `hoster`\r\n\r\n # add to smb.conf share definition\r\n force user = hoster\r\n\r\nIn general this kind of problem can be diagnosed using `log level = 3` and looking in the SAMBA server log files.", "708" ], [ "We seem to have a particularly large number of (sometimes reasonably well asked) questions being downvoted recently. Here are three examples, where I don&#39;t think the question has been too badly asked. (I grant that there may not have been much _visible_ research effort, but I suspect that in some cases people may simply not know the terminology to perform decent searches):\r\n\r\n- [Permanent outgoing IP with enabled DHCP](_URL_2_)\r\n- [samba - permission denied when share in another users home directory](_URL_1_)\r\n- [Ubuntu installation in Windows 10](_URL_0_)\r\n\r\nI know that we don&#39;t need to provide comments to justify votes. I&#39;m also fairly sure that in the review phase there&#39;s a recommendation to provide an explanation of what&#39;s wrong and to encourage better question writing.\r\n\r\nJust wondering out loud how we can help these users better. (Or indeed _if_ we should help these users better.) I&#39;ve carefully avoided included Kali examples because those are addressed elsewhere.", "109" ], [ "This code segment will create five `xterm` windows. As you kill them off another one will be spawned.\r\n\r\n #!/bin/bash\r\n #\r\n pids=()\r\n \r\n # Eternal loop\r\n while :\r\n do\r\n if [[ ${#pids[@]} -lt 5 ]]\r\n then\r\n # Start another process\r\n xterm & \r\n pid=$!\r\n \r\n # Save process id\r\n pids+=($pid)\r\n else\r\n # We have enough so wait for (at least) one to die\r\n wait -n\r\n \r\n # Reap old process ids\r\n oldpids=( \" ;${pids[@]} \" ;)\r\n pids=()\r\n n=0\r\n while [[ $n -lt ${#oldpids[@]} ]]\r\n do\r\n pid=${oldpids[$n]}\r\n [[ -n \" ;$pid \" ; ]] & & kill -0 $pid 2 > /dev/null & & pids+=($pid)\r\n n=$((n+1))\r\n done\r\n fi\r\n done", "691" ], [ "Hello Coder <PERSON>. It&#39;s looking likely that you&#39;re about to get another \" ;Why won&#39;t anyone help me \" ; closure. Please could I strongly suggest that while you start to learn about Linux-based systems you choose a more friendly distribution. Kali is not a beginner&#39;s distribution. This will also improve your chances of getting help here - we expect Kali users to be competent Linux users and beginners&#39; questions tend to be shut down fast.", "4" ], [ "I use versioned directory names, with a symlink holding the generic name. This sounds exactly the same as your solution. I find it works really well because I can usually rollback instantly if I need to. Also I can afford to take time to apply an upgrade, leaving it partially built overnight if it&#39;s a particularly complex process.", "583" ], [ "This will handle the general case where you know that there are duplicate file names but you don&#39;t know what they are:\r\n\r\n find -type f -print0 |\r\n awk -F/ &#39;BEGIN { RS= \" ;\\0 \" ; } { n=$NF } k[n]==1 { print p[n]; } k[n] { print $0 } { p[n]=$0; k[n]++ }&#39;\r\n\r\nWithin the `awk` script, we handle file paths that are NULL terminated (so we can process file names that might contain newlines), with `$0` as the current file pathname. The variable `n` holds the file name component. `k[]` is a hash (keyed by `n`) that counts the number of occurrences of this file name, and `p[]` is another hash (also keyed by `n`) that holds the first corresponding full pathname.\r\n\r\nExample\r\n\r\n # Preparation\r\n mkdir -p tmp/a tmp/b\r\n touch tmp/a/xx tmp/a/yy tmp/b/yy tmp/b/zz\r\n\r\n # Do it\r\n find tmp -type f -print0 |\r\n awk -F/ &#39;BEGIN { RS= \" ;\\0 \" ; } { n=$NF } k[n]==1 { print p[n]; } k[n] { print $0 } { p[n]=$0; k[n]++ }&#39;\r\n\r\n tmp/a/yy\r\n tmp/b/yy\r\n\r\n # Tidyup\r\n rm -rf tmp", "848" ], [ "You can use `usermod` to modify an existing account. However this will not populate the user&#39;s HOME directory as `useradd --create-home` does.\r\n\r\nInstead, you have to do it yourself.\r\n\r\n # Consider a user &#39;fred&#39;\r\n user=fred\r\n skel=$(. /etc/defaults/useradd 2 > /dev/null; echo \" ;$SKEL \" ;)\r\n home=$(getent passwd \" ;$user \" ; | cut -d: -f6)\r\n gid=$(getent passwd \" ;$user \" ; | cut -d: -f4)\r\n mkdir -p -m755 \" ;$home \" ;\r\n cp -a \" ;${skel:-/etc/skel}/. \" ; \" ;$user \" ;\r\n chown -R \" ;$user \" ;: \" ;$gid \" ; \" ;$home \" ;\r\n\r\nMissing XDG directories will be created as the user first logs in.", "740" ], [ "If we can assume per your comment that _tab_ characters will appear only at the beginning of lines, then we can count alternatives to a minimum of 80 characters.\r\n\r\n- No tabs, at least 81 characters\r\n- One tab, at least 73 characters\r\n- Two tabs, at least 65 characeters\r\n- Etc.\r\n\r\nThe resulting mess is as follows, with your `awk` statement summing the individual line counts to provide a grand total\r\n\r\n git grep -hcP &#39;^(.{81,}|\\t.{73,}|\\t{2}.{65,}|\\t{3}.{57,}|\\t{4}.{49,}|\\t{5}.{41,}|\\t{6}.{33,}|\\t{7}.{25,}|\\t{8}.{17,}|\\t{9}.{9,}|\\t{10}.)&#39; **/*.{c,h,p{l,y}} |\r\n awk &#39;{ i+=$1 } END { printf ( \" ;%d\\n \" ;, i) }&#39;", "848" ], [ "<PERSON> there&#39;s nothing stopping you either extending `usermod` or writing your own as a script. I&#39;ve often extended system tools with extra features - either using the same command but adding new features (I have `/usr/local/bin` and `$HOME/bin` near the front of my `$PATH` so I can do exactly this) or by creating my own variant. In this case you could create `userhome` that create a user&#39;s home directory using pretty much the code I&#39;ve supplied in this Answer.", "740" ] ]
509
[ 4216, 2375, 1141, 551, 453, 1090, 4815, 9096, 5480, 5223, 1643, 18823, 18699, 17011, 5966, 18387, 13484, 10333, 863, 3302, 4699, 2265, 2675, 8034, 8382, 1733, 16671, 18594, 1137, 557, 2816, 4204, 576, 14219, 2871, 15522, 10468, 14287, 2157, 3929, 18532, 343, 9367, 12751, 814, 3214, 7241, 5874, 9384, 12873, 16790, 17111, 4091, 2224, 19546, 6513, 2747, 8056, 6834, 1978, 6136, 15069, 12439, 14455, 2344, 16383, 14087, 12336, 10094, 6789, 17691, 4640, 10261, 2115, 10137, 1258, 12858, 10890, 6974, 2845, 13689, 16688, 4773, 2367, 14467, 7254, 15867, 19030, 2227, 421, 18360, 5475, 13286, 19740, 6040, 17793, 3504, 19058, 575, 14552, 18895, 15558, 5752, 17490, 16691, 1670, 1145, 6550, 17415, 507, 14835, 1, 3854, 4157, 2136, 13242, 15970, 702, 17278, 14617, 1581, 16042, 5526, 4466, 2083, 3282, 18978, 4089, 5033, 6101, 14328, 12826, 2705, 14932, 3022, 2697, 10355, 7111, 17029, 9183, 9774, 6674, 10997, 634, 5867, 17707, 3541, 8679, 5172, 16900, 2835, 11408, 15047, 17252, 5290, 5389, 9988, 14470, 11658, 15519, 19170, 16948, 7071, 6545, 8567, 13516, 2758, 5217, 7847, 14628, 18701, 8433, 12550, 12950, 8410, 16256, 10701, 2458, 12504, 9749, 5082, 16504, 1972, 5627, 9899, 7143, 3821, 4212, 15847, 15872, 15054, 5414, 9713, 16676, 5322, 2952, 1768, 4891, 5468, 14582, 9851, 3379, 18646, 16518, 17766, 8006, 3971, 16484, 1856, 14154, 9513, 12455, 18429, 19047, 780, 2632, 18377, 3127, 16663, 10105, 1811, 15805, 13414, 13080, 19069, 16612, 2775, 16813, 13093, 19766, 11631, 534, 291, 8525, 5084, 13733, 8838, 5628, 12307, 442, 9527, 6079, 4408, 7024, 6337, 6105, 17941, 1807, 18292, 9465, 16647, 18408, 19771, 13779, 3999, 904, 3244, 6882, 15142, 16456, 7153, 488, 10373, 7819, 17388, 6635, 8470, 15749, 7251, 5936, 354, 14261, 5696, 15348, 5918, 1708, 4164, 4988, 4884, 4273, 19753, 7020, 10464, 2717, 2430, 14189, 6774, 4586, 5483, 12036, 1674, 3748, 2298, 12887, 3773, 2969, 10470, 13181, 11800, 1519, 7655, 16645, 7345, 10632, 6608, 16963, 18676, 1387, 12701, 9142, 11297, 7672, 14027, 10148, 3192, 8639, 5706, 19088, 8462, 2262, 2787, 11574, 10710, 4417, 3663, 6884, 9866, 16186, 17191, 17479, 6584, 4694, 2287, 15616, 8024, 6971, 18444, 7035, 5642, 3968, 5641, 6226, 4845, 12856, 5732, 10074, 4068, 8102, 15181, 5454, 1410, 3335, 8575, 17, 3990, 11928, 17346, 9210, 12315, 6234, 9294, 6114, 8211, 2506, 17483, 1178, 15773, 7756, 13203, 12268, 2121, 11573, 6740, 18332, 6524, 15355, 13124, 632, 5981, 18557, 18224, 1682, 15482, 2230, 13611, 1082, 9091, 6158, 16416, 5109, 14382, 14465, 2583, 5677, 6328, 4598, 14071, 6706, 3345, 17984, 13324, 8747, 11626, 1264, 11537, 14901, 1590, 9961, 18167, 14584, 207, 15877, 5335, 17289, 1772, 12432, 9900, 14543, 2719, 16210, 11311, 4730, 3222, 17759, 3746, 17697, 14939, 3372, 18274, 13382, 967, 3565, 11569, 8004, 3891, 17050, 8516, 13783, 10673, 5006, 6784, 19246, 350, 16435, 12524, 4226, 1748, 2343, 19568, 12706, 18748, 11635, 19359, 5379, 2919, 1743, 17515, 19493, 11261, 10920, 5041, 17007, 17403, 19256, 17611, 13830, 14357, 1769, 16638, 15953, 2001, 2434, 9130, 16345, 19767, 12046, 12493, 16169, 8991, 14602, 13809, 9817, 501, 8326, 12529, 17454, 4117, 12612, 12670, 17348, 4195, 9398, 1402, 19125, 11295, 17924, 17917, 15964, 1836 ]
STX_10040839.0
[ [ "I have 2 circles next to each other with a dash line from the center linking between them.\r\n\r\nHere is the HTML code:\r\n\r\n < div class= \" ;container-fluid \" ; > \r\n\t < div class= \" ;row \" ; > \r\n \t < div class= \" ;col-xs-push-2 col-xs-8 text-center \" ; > \r\n \t\t < div class= \" ;col-xs-6 \" ; > \r\n \t\t < div class= \" ;wrapper right_dash \" ; > \r\n\t\t\t\t\t < span class= \" ;text-center circle \" ; > A < /span > \r\n\t\t\t\t < /div > < !-- wrapper -- > \r\n \t\t < /div > < !-- col-xs-6 -- > \r\n \t\t < div class= \" ;col-xs-6 \" ; > \r\n\t\t\t\t < div class= \" ;wrapper left_dash \" ; > \r\n\t\t\t\t\t < span class= \" ;text-center circle \" ; > B < /span > \r\n\t\t\t\t < /div > < !-- wrapper -- > \r\n \t\t < /div > < !-- col-xs-6 -- > \r\n \t < /div > < !-- col-xs-8 -- > \r\n \t < /div > < !-- row -- > \r\n < /div > < !-- container-fluid -- > \r\n\r\nThe CSS:\r\n\r\n .row{\r\n margin: 5% auto;\r\n }\r\n\r\n .wrapper{\r\n position: relative;\r\n margin:auto -15px;\r\n }\r\n\r\n .circle{\r\n border-radius: 50%;\r\n border: 2px dashed #1f4e79;\r\n background-color: #f7eebe;\r\n padding: 15% 35%;\r\n font-size: 300%;\r\n display: inline-block;\r\n position: relative;\r\n z-index: 9999\r\n }\r\n\r\n .right_dash:after{\r\n\t content: \" ; \" ;;\r\n position: absolute;\r\n top: 50%;\r\n border-bottom: 2px dashed #1f4e79;\r\n width: 50%;\r\n left:50%;\r\n\t}\r\n\t.left_dash:before{\r\n\t content: \" ; \" ;;\r\n position: absolute;\r\n top: 50%;\r\n border-bottom: 2px dashed #1f4e79;\r\n width: 50%;\r\n right: 50%;\r\n\t}\r\n\t\r\n\r\nHere is a fiddle to see it live: _URL_1_\r\n\r\n#Try to increase the result section to see the shape better.\r\n\r\nI want to create flipping card effect to the 2 circles, So I changed the `wrapper` for both cirlces content to:\r\n\r\n < span class= \" ;text-center circle front \" ; > front < /span > \r\n < span class= \" ;text-center circle back \" ; > back < /span > \r\n\r\nWhere front will be the visible and on hovering over the circle, The back will be shown.\r\n\r\nSo I added the following CSS:\r\n\r\n .wrapper{\r\n position: relative;\r\n transform-style: preserve-3d;\r\n transition: all 1s ease-in-out\r\n }\r\n\r\n .wrapper:hover{\r\n transform: rotateY(180deg);\r\n }\r\n\r\n .front,\r\n .back{\r\n position: absolute;\r\n display:block;\r\n backface-visibility: hidden;\r\n width:100%;\r\n height: 100%;\r\n }\r\n\r\n .back{\r\n transform: rotateY(180deg);\r\n }\r\n\r\nHere is a fiddle: _URL_0_\r\n\r\nBut the circles and the dash lines are not the same as before.\r\n\r\nHow to solve that so the circles are next to each other and the content is centered vertically and horizontally and the dash line is in the center?\r\n\r\nI don&#39;t mind changing the whole HTML and CSS.", "455" ], [ "I have a circle that is flipping when you hover over it, On the front it shows \" ;front \" ;, And on back it shows \" ;back \" ;.\r\n\r\nYou can see it live here: _URL_1_ , You will see a circle with grey background and the word \" ;front \" ; at the bottom right side.\r\n\r\nThat circle is contained with Bootstrap `col-xs-4`, Which means it should take ` width: 33.33333333%;`.\r\n\r\nThe div with class `face-container` is taking width and height of `210px`, When I change that to 100%, The circle and the content disappears.\r\n\r\nI think that&#39;s because of using `position: absolute` on the content inside the circle.\r\n\r\nI want the circle to take the content width and height, Like these 2 examples: _URL_2_ and _URL_0_ , The width and height is not set to `x px` and the \" ;A \" ; letter is still shown.\r\n\r\nHere is the CSS code:\r\n\r\n .item-circled {\r\n \tposition: relative;\r\n text-align: center;\r\n font-size: 300%;\r\n }\r\n \r\n .face-container {\r\n \tposition: relative;\r\n \tz-index: 1;\r\n \tperspective: 1000px;\r\n width: 210px; /* Fixed width */\r\n height: 210px; /* Fixed height */\r\n }\r\n \r\n .face-card {\r\n \ttransform-style: preserve-3d;\r\n \ttransition: all .5s linear;\r\n width:100%;\r\n height: 100%\r\n }\r\n \r\n .face-container:hover .face-card { /* to rotate on hovering over the circle */\r\n \ttransform: rotateY(180deg);\r\n \tborder-radius: 50%;\r\n }\r\n \r\n .face-1 { /* For both back and end elements. */\r\n \tposition: absolute;\r\n \twidth: 100%;\r\n \theight: 100%;\r\n backface-visibility: hidden;\r\n \toverflow: hidden;\r\n \tborder-radius: 50%;\r\n }\r\n \r\n .face-1.front{ /* style the front element */\r\n background-color: #eee;\r\n height: 100%\r\n }\r\n \r\n .face-1.back { /* style the back element */\r\n \tbackground-color: #aaa;\r\n \ttransform: rotateY(180deg);\r\n }\r\n\r\nHere is the HTML:\r\n\r\n < div class= \" ;container-fluid \" ; > < !-- Bootstrap container -- > \r\n \t\t\t < div class= \" ;row center-block \" ; > \t\r\n < !-- Leave 2 columns to the left and the right and center the content within 8 columns. -- > \r\n \t\t\t\t < div class= \" ;col-xs-push-2 col-xs-8 text-center \" ; > \t\r\n < !-- 33.33333% of the 8 columns. -- > \r\n \t\t < div class= \" ;item-circled col-xs-4 \" ; > \r\n < !-- The Element with 210px height and width. -- > \r\n \t\t\t\t\t\t < div class= \" ;face-container \" ; > \r\n \t\t\t\t\t\t\t < div class= \" ;face-card \" ; > \r\n < !-- Front Element. -- > \r\n \t\t\t\t\t\t\t\t < div class= \" ;face-1 front \" ; > \r\n \t\t\t\t\t\t\t\t\t < span > front < /span > \r\n \t\t\t\t\t\t\t\t < /div > \r\n < !-- Back Element. -- > \r\n \t\t\t\t\t\t\t\t < div class= \" ;face-1 back \" ; > \r\n \t\t\t\t\t\t\t\t\t < p > back < /p > \r\n \t\t\t\t\t\t\t\t < /div > \r\n \t\t\t\t\t\t\t < /div > < !-- face-card -- > \r\n \t\t\t\t < /div > < !-- face-container -- > \r\n \t\t\t\t < /div > < !-- col-xs-4 -- > \r\n \t\t\t\t < /div > < !-- col-xs-8 -- > \r\n \t\t\t < /div > < !-- row -- > \r\n < /div > < !-- container-fluid -- >", "455" ], [ "I have a spinner around a circle that moves in a closed circle path, On hovering over the circle the spinner is fired, It&#39;s not moving smoothly, But it seems like it&#39;s moving right and left from specific parts, Like it&#39;s getting wider from parts and smaller from others.\r\n\r\n < !-- begin snippet: js hide: false console: true babel: false -- > \r\n\r\n < !-- language: lang-css -- > \r\n\r\n .item-circled {\r\n \tposition: relative;\r\n \twidth: 157.5px;\r\n \tmargin: 5% 40px;\r\n \tdisplay: inline-block;\r\n }\r\n\r\n .item-circled .face-container {\r\n \tposition: relative;\r\n \twidth: 157.5px;\r\n \theight: 157.5px;\r\n \tz-index: 1;\r\n \tperspective: 1000px;\r\n }\r\n\r\n .item-circled .face-card {\r\n \twidth: 100%;\r\n \theight: 100%;\r\n \ttransform-style: preserve-3d;\r\n \tborder-radius: 50%;\r\n \ttransition: all .5s linear;\r\n }\r\n\r\n .item-circled .face-container:hover .face-card {\r\n \ttransform: rotateY(180deg);\r\n \tborder-radius: 50%;\r\n }\r\n\r\n .item-circled .face-1 {\r\n \tposition: absolute;\r\n \twidth: 100%;\r\n \theight: 100%;\r\n \tbackface-visibility: hidden;\r\n \toverflow: hidden;\r\n \tborder-radius: 50%;\r\n }\r\n\r\n .item-circled .face-1.front{\r\n background-color: #f7eebe;\r\n width: 100%;\r\n height: 100%\r\n }\r\n\r\n .item-circled .face-1.back {\r\n \tdisplay: block;\r\n \tbox-sizing: border-box;\r\n \tpadding: 35px 13px;\r\n \ttext-align: center;\r\n \tbackground-color: #1f4e79;\r\n \ttransform: rotateY(180deg);\r\n \tborder-radius: 50%;\r\n }\r\n\r\n .item-circled .dashed-border {\r\n \tposition: absolute;\r\n \tborder-radius: 50%;\r\n \tborder: 2px dashed #18d9ec;\r\n \theight: 187.5px;\r\n \twidth: 187.5px;\r\n \ttop: -15px;\r\n \tleft: -15px;\r\n }\r\n\r\n .item-circled:hover .dashed-border {\r\n \tanimation-duration: 0.5s;\r\n \tanimation-timing-function: linear;\r\n \tanimation-name: <PERSON>;\r\n \tanimation-iteration-count: infinite;\r\n }\r\n\r\n @keyframes spiner {\r\n \tfrom {\r\n \t\ttransform: rotate(0deg);\r\n \t}\r\n \tto {\r\n \t\ttransform: rotate(360deg);\r\n \t}\r\n }\r\n\r\n\r\n\r\n < !-- language: lang-html -- > \r\n\r\n < link rel= \" ;stylesheet \" ; href= \" ;_URL_0_;\r\n\r\n < div class= \" ;item-circled \" ; > \r\n < div class= \" ;face-container center-block text-center \" ; > \r\n \t < div class= \" ;face-card \" ; > \r\n < !-- Front side -- > \r\n \t\t < div class= \" ;face-1 front \" ; > \r\n \t\t\t < p > front < /p > \r\n \t\t\t < /div > \r\n < !-- Back side -- > \r\n \t\t < div class= \" ;face-1 back \" ; > \r\n \t\t\t\t < p > back < /p > \r\n \t\t\t < /div > \r\n \t\t < /div > \r\n < !-- Spinner element -- > \r\n \t\t < div class= \" ;dashed-border \" ; > < /div > \r\n \t < /div > < !-- face-conteiner -- > \r\n < /div > < !-- item-circled -- > \r\n\r\n < !-- end snippet -- > \r\n\r\nHere is a fiddle to see the result:\r\n_URL_1_", "882" ], [ "I&#39;m using WordPress, In the **header.php** inside ` < head > `:\r\n\r\n < meta charset= \" ; < ?php bloginfo( &#39;charset&#39; ); ? > \" ; > \r\n\r\nWhich returns:\r\n\r\n < meta charset= \" ;UTF-8 \" ; > \r\n\r\nThen in **index.php**, I have the following:\r\n\r\n < h2 > Vei&#240;ileyfi < /h2 > \r\n\r\nThat&#39;s an Icelandic word, It&#39;s shown on the homepage as:\r\n\r\n < h2 > Vei�0�8ileyfi < /h2 > \r\n\r\nWhy that&#39;s happening and how to solve that?\r\n\r\nI searched about that, But most of them was about data from the DB and dealing with mysql, mysqli, PDO .. etc", "150" ], [ "I have 3 elements next to each other, The content and everything is the same, But when I set a big font size to one of them, That one goes up.\r\n\r\nHere is a fiddle: _URL_0_\r\n\r\nAs you see when I gave the `a` inside the first element `font-size: 300%` which means that the text will exceed the width, The first element goes up.\r\n\r\nShouldn&#39;t it goes down to fit the content?\r\n\r\nIs that&#39;s normal?\r\n\r\nIf not, How to fix it so that the container goes down with the content, Not going up. \r\n\r\nHere is the code:\r\n\r\n .container{\r\n width:80%;\r\n margin: 5% auto\r\n }\r\n \r\n .child{\r\n display:inline-block;\r\n width: 32%;\r\n }\r\n \r\n .first{\r\n background-color: #444\r\n }\r\n \r\n .second{\r\n background-color: #eee\r\n }\r\n \r\n .third{\r\n background-color: #aaa\r\n }\r\n \r\n .first a{\r\n font-size:200%\r\n }\r\n\r\nThe HTML:\r\n\r\n < div class= \" ;container \" ; > \r\n < div class= \" ;child first \" ; > \r\n < div > first < /div > \r\n < h3 > This is the 1st child < /h3 > \r\n < a > This is link for 1st child < /a > \r\n < /div > < !-- .first -- > \r\n < div class= \" ;child second \" ; > \r\n < div > second < /div > \r\n < h3 > This is the 2nd child < /h3 > \r\n < a > This is link for 2nd child < /a > \r\n < /div > < !-- .second -- > \r\n < div class= \" ;child third \" ; > \r\n < div > third < /div > \r\n < h3 > This is the 3rd child < /h3 > \r\n < a > This is link for 3rd child < /a > \r\n < /div > < !-- .third -- > \r\n < /div > < !-- .container -- >", "455" ], [ "I have a website and in the ` < head > ` tag there is:\r\n\r\n < meta name= \" ;viewport \" ; content= \" ;width=device-width, initial-scale=1 \" ; > \r\n\r\nAnd I&#39;m using media queries and Bootstrap for responsiveness.\r\n\r\nSo I&#39;m wondering if it&#39;s possible to view the website in a full screen mode.\r\n\r\nLike when you open an app on your mobile, Or press the full screen button on a video.\r\n\r\nSo that the website takes the whole width and height of the screen and the mobile options are visible, Like the top tools menu, The time and battery percentage .. etc.\r\n\r\nIs there is a ` < meta > ` tag for that?\r\n\r\nOr a property to set when the screen width is within that range for example?\r\n\r\n @media screen and (max-width: 767px){\r\n\r\n }\r\n\r\nIs that possible?\r\n\r\nI searched for that, But couldn&#39;t get an answer.", "317" ], [ "I have a form like that for logging in:\r\n\r\n < form action= \" ;form.php \" ; method= \" ;post \" ; > \r\n < input type= \" ;text \" ; name= \" ;name \" ; placeholder= \" ;Type your name \" ; > \r\n < input type= \" ;password \" ; name= \" ;password \" ; placeholder= \" ;Type your password \" ; > \r\n < input type= \" ;submit \" ; name= \" ;submit \" ; value= \" ;Login \" ; > \r\n < /form > \r\n\r\nI want to add Google Recaptcha only if the user is trying to login more than 3 times for example:\r\n\r\n < form action= \" ;form.php \" ; method= \" ;post \" ; > \r\n < input type= \" ;text \" ; name= \" ;name \" ; placeholder= \" ;Type your name \" ; > \r\n < input type= \" ;password \" ; name= \" ;password \" ; placeholder= \" ;Type your password \" ; > \r\n < ?php\r\n if(){ // Check if submitted more than 3 times.\r\n < div class= \" ;g-recaptcha \" ; data-sitekey= \" ;=== Your site key === \" ; > < /div > \r\n }\r\n ? > \r\n < input type= \" ;submit \" ; name= \" ;submit \" ; value= \" ;Login \" ; > \r\n < /form > \r\n\r\nI&#39;m thinking of using **Cookies**, After validating and login fails add a cookie with value = 1 and if this cookie exists, Increase by 1.\r\n\r\n if( isset($_COOKIE[&#39;tries&#39;]) ){\r\n createcookie(&#39;tries&#39;, $_COOKIE[&#39;ties&#39;] +1 );\r\n }else{\r\n createcookie(&#39;tries&#39;, &#39;1&#39;);\r\n }\r\n\r\nBut what if the cookies are disabled?!\r\n\r\nAlso I&#39;m thinking of using the **IP Address** , Create a table with IP Addresses of users trying to login and the login fails:\r\n\r\n __________________________________\r\n | | | |\r\n | ip | count | date |\r\n |________|__________|_____________|\r\n\r\nWhere count is the login fails times and date is today date, So if it&#39;s today date and the count > 3, Show the Recaptcha.\r\n\r\nBut what if the user is using a VPN?\r\n\r\nIs there is a reliable way for doing that?\r\n\r\nHow does stackoverflow do that?", "620" ], [ "I want to view my website from mobile device in a full screen mode, I check if it&#39;s a mobile device using CSS:\r\n\r\n @media screen and (max-width: 767px){\r\n \r\n }\r\n\r\nOr using Javascript:\r\n\r\n var isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);\r\n if (isMobile) {\r\n\r\n }\r\n\r\nI tried some solutions with Javascript like:\r\n \r\n\r\n function maxWindow() {\r\n window.moveTo(0, 0);\r\n \r\n \r\n if (document.all) {\r\n top.window.resizeTo(screen.availWidth, screen.availHeight);\r\n }\r\n \r\n else if (document.layers || document.getElementById) {\r\n if (top.window.outerHeight < screen.availHeight || top.window.outerWidth < screen.availWidth) {\r\n top.window.outerHeight = screen.availHeight;\r\n top.window.outerWidth = screen.availWidth;\r\n }\r\n }\r\n }\r\n\r\nand:\r\n\r\n document.documentElement.webkitRequestFullScreen();\r\n\r\nThis solution seems to work only on desktop, As it presses f11:\r\n\r\n function requestFullScreen(element) {\r\n // Supports most browsers and their versions.\r\n var requestMethod = element.requestFullScreen || element.webkitRequestFullScreen || element.mozRequestFullScreen || element.msRequestFullScreen;\r\n \r\n if (requestMethod) { // Native full screen.\r\n requestMethod.call(element);\r\n } else if (typeof window.ActiveXObject !== \" ;undefined \" ;) { // Older IE.\r\n var wscript = new ActiveXObject( \" ;WScript.Shell \" ;);\r\n if (wscript !== null) {\r\n wscript.SendKeys( \" ;{F11} \" ;);\r\n }\r\n }\r\n }\r\n \r\n var elem = document.body; // Make the body go full screen.\r\n requestFullScreen(elem);\r\n\r\nAlso tried:\r\n\r\n window.open(theURL, &#39;&#39;, &#39;fullscreen=yes, scrollbars=auto&#39;);\r\n\r\nBut non of these works.\r\n\r\nHow to do that? Or it&#39;s not possible?", "317" ], [ "I have a search form:\r\n\r\n < form method= \" ;POST \" ; > \r\n < input type= \" ;search \" ; name= \" ;q \" ; > \r\n < input type= \" ;submit \" ; value= \" ;Search \" ; name= \" ;search \" ; > \r\n < /form > \r\n\r\nThen in PHP file:\r\n\r\n if( isset($_POST[&#39;q&#39;]) ){\r\n\r\n //Assigning the posted query to a variable.\r\n $query = $_POST[&#39;q&#39;];\r\n\r\n //Get matches from the DB.\r\n $stmt = $conn- > prepare(&#39;SELECT * FROM posts WHERE title OR description LIKE :s&#39;);\r\n $stmt- > bindValue(&#39;:s&#39;, &#39;%&#39; . $query . &#39;%&#39;, PDO<IP_ADDRESS>PARAM_STR);\r\n $stmt- > execute();\r\n $count = $stmt- > rowCount();\r\n\r\n //if there are matches.\r\n if($count > 0){\r\n \r\n //Get the matches.\r\n $matches = $stmt- > fetchAll();\r\n foreach($posts as $post){\r\n //Do Something.\r\n }\r\n }\r\n }\r\n\r\nNow everything is fine I think, Why if I do the following:\r\n\r\n < input type= \" ;search \" ; value= \" ; < ?php if(isset($_POST[&#39;q&#39;])){echo $_POST[&#39;q&#39;];} ? > \" ; name= \" ;q \" ; > \r\n\r\nOR:\r\n\r\n < input type= \" ;search \" ; value= \" ; < ?php if(isset($query)){echo $query;} ? > \" ; name= \" ;q \" ; > \r\n\r\nThat could lead to an attack?", "768" ], [ "Using PDO for prepared statements:\r\n\r\n $servername = \" ;localhost \" ;;\r\n $username = \" ;Database Username \" ;;\r\n $password = \" ;Database Password \" ;;\r\n $dbname = \" ;Database Name \" ;;\r\n try {\r\n $conn = new PDO( \" ;mysql:host=$servername;dbname=$dbname \" ;, $username, $password);\r\n // set the PDO error mode to exception\r\n $conn- > setAttribute(PDO<IP_ADDRESS>ATTR_ERRMODE, PDO<IP_ADDRESS>ERRMODE_EXCEPTION); \r\n }catch(PDOException $e)\r\n {\r\n echo \" ;Error: \" ; . $e- > getMessage();\r\n }\r\n\r\nThen Run your SQL query:\r\n\r\n $stmt = $conn- > prepare(&#39;SELECT username FROM yourTableName LIMIT 1&#39;);\r\n $stmt- > execute();\r\n $username = $stmt- > fetchAll();\r\n\r\n echo $username[0];\r\n //Or foreach($username as $name){echo $name;}\r\n\r\n#That code should be wrapped inside php tags ` < ?php //the code ? > `\r\n\r\nUPDATE from comments it showed up that you are using MYSQLI, SO you should use something like:\r\n\r\n $mysqli = new mysqli( \" ;localhost \" ;, \" ;username \" ;, \" ;password \" ;, \" ;DBname \" ;);\r\n \r\n /* check connection */\r\n if (mysqli_connect_errno()) {\r\n printf( \" ;Connect failed: %s\\n \" ;, mysqli_connect_error());\r\n exit();\r\n }\r\n \r\n $query = \" ;SELECT username from users ORDER by username DESC LIMIT 1 \" ;;\r\n $result = mysqli_query($mysqli, $query);\r\n $result = mysqli_fetch_object($result);\r\n\r\n echo $result- > username;", "768" ], [ "Use `file_get_contents(&#39;fileName&#39;)` or `fopen(&#39;fileName&#39;, &#39;mode&#39;); fread(&#39;fileName&#39;, length);`\r\n\r\n1st method:\r\n\r\nReplace your PHP code to the following:\r\n\r\n < ?php \r\n $temperature = file_get_contents( \" ;temperaturelog.txt \" ;);\r\n $temp = substr($temperature, -5);\r\n print $temp;\r\n ? > \r\n\r\nYou can find more information about `file_get_contents()` here: _URL_1_\r\n\r\nThe 2nd method:\r\n\r\n < ?php \r\n $fileName = \" ;temperaturelog.txt \" ;;\r\n $handle = fopen($fileName , &#39;r&#39;);\r\n $temperature = fread($handle, filesize($fileName));\r\n $temp = substr($temperature, -5);\r\n print $temp;\r\n ? > \r\n\r\nAnd for the 2nd method more info:\r\n_URL_3_\r\n\r\n_URL_0_\r\n\r\n_URL_2_", "132" ], [ "`document.getElementsByClassName()` will return an array.\r\n\r\nIf you have only one element you could use the first index in the array:\r\n\r\n document.getElementsByClassName( \" ;dot \" ;)[0].style.visibility= \" ;visible \" ;;\r\n\r\nElse if you have more that one:\r\n\r\n var dot = document.getElementsByClassName( \" ;dot \" ;)\r\n for(var i = 0; i < dot.length; i++) {\r\n dot[i].style.visibility = \" ;visible \" ;;\r\n }", "98" ], [ "I added another `li` for testing:\r\n\r\nHere is a working live fiddle: _URL_0_\r\n\r\n\r\n < div class= \" ;links \" ; > \r\n < ul > \r\n < li data-name= \" ;hello \" ; > Hello < /li > \r\n < li data-name= \" ;bye \" ; > Bye < /li > \r\n < li data-name= \" ;hey \" ; > Hey < /li > \r\n < /ul > \r\n < /div > < !-- .links -- > \r\n \r\n < div class= \" ;image \" ; > \r\n < img class= \" ;main-image \" ; src= \" ;image.png \" ; alt= \" ;image \" ; > \r\n < /div > < !-- .image -- > \r\n\r\nHere is the code:\r\n\r\n $(&#39;ul li&#39;).on(&#39;click&#39;, function() {\r\n\r\n // Get the class of the clicked list.\r\n var name = $(this).data(&#39;name&#39;),\r\n\r\n // Get that clicked list siblings, In that case the other two lists.\r\n \t siblingElements = $(this).siblings();\r\n\r\n //Loop through the siblings.\r\n for(var i = 0; i < siblingElements.length; i++){\r\n\r\n // Remove the two other siblings classes from the image.\r\n \t $(&#39;.main-image&#39;).removeClass( siblingElements[i][&#39;attributes&#39;][&#39;data-name&#39;][&#39;value&#39;] );\r\n\r\n } // End loop.\r\n\r\n // Add the clicked list class to the image.\r\n $(&#39;.main-image&#39;).addClass(name);\r\n\r\n }); // End onclick function.", "993" ], [ "Here is a fiddle: _URL_0_\r\n\r\nCSS code:\r\n\r\n .tag-box {\r\n word-break: break-word;\r\n }\r\n \r\n .tag {\r\n color: white;\r\n background: #000;\r\n border: 1px solid white;\r\n border-radius: 5px;\r\n margin-bottom: 10px;\r\n margin-right: 5px; \r\n padding: 5px;\r\n line-height: 200%;\r\n display:inline-block;\r\n }\r\n\r\nHTML:\r\n\r\n < ul class= \" ;tag-box \" ; > \r\n < li class= \" ;tag \" ; > [first] < /li > \r\n < li class= \" ;tag \" ; > [second thing] < /li > \r\n < li class= \" ;tag \" ; > [third thing] < /li > \r\n < li class= \" ;tag \" ; > [yet another thing] < /li > \r\n < li class= \" ;tag \" ; > [first] < /li > \r\n < li class= \" ;tag \" ; > [second thing] < /li > \r\n < li class= \" ;tag \" ; > [third thing] < /li > \r\n < li class= \" ;tag \" ; > [yet another thing] < /li > \r\n < /ul >", "115" ], [ "To fetch and match the saved hashed password and the user login password:\r\n\r\nReplace that part in the login file:\r\n\r\n $sql= \" ;SELECT * FROM users WHERE (username=&#39;$uname&#39; OR email=&#39;$uname&#39;) AND password=&#39;$psw&#39; \" ;;\r\n $result= mysqli_query($con,$sql) or die(mysqli_errno());\r\n $trws= mysqli_num_rows($result);\r\n if($trws==1){\r\n $rws= mysqli_fetch_array($result);\r\n $_SESSION[&#39;user&#39;]=1;\r\n $_SESSION[&#39;username&#39;]=$rws[&#39;username&#39;];\r\n $_SESSION[&#39;password&#39;]=$rws[&#39;password&#39;];\r\n header( \" ;location:index.php?username=$uname & request=login & status=success \" ;);\r\n }\r\n else{\r\n echo \" ;Username and password does not matched \" ;;\r\n }\r\n \r\nWith:\r\n\r\n //Select user data based on email/username.\r\n $sql= \" ;SELECT * FROM users WHERE (username=&#39;$uname&#39; OR email=&#39;$uname&#39;) \" ;;\r\n $result= mysqli_query($con,$sql) or die(mysqli_errno());\r\n $trws= mysqli_num_rows($result);\r\n if($trws==1){\r\n $rws= mysqli_fetch_array($result);\r\n //Verify the hashed password and the username login password.\r\n if( password_verify($psw, $rws[&#39;password&#39;]) ){\r\n $_SESSION[&#39;user&#39;]=1;\r\n $_SESSION[&#39;username&#39;]=$rws[&#39;username&#39;];\r\n $_SESSION[&#39;password&#39;]=$rws[&#39;password&#39;];\r\n header( \" ;location:index.php?username=$uname & request=login & status=success \" ;); \r\n }\r\n }\r\n else{\r\n echo \" ;Username and password does not matched \" ;;\r\n }", "768" ], [ "That&#39;s the CSS applied when the checkbox is checked to move the slider to the right:\r\n\r\n input:checked + .slider:before {\r\n -webkit-transform: translateX(26px);\r\n -ms-transform: translateX(26px);\r\n -o-transform: translateX(26px);\r\n -moz-transform: translateX(26px);\r\n transform: translateX(26px);\r\n }\r\n\r\nI added `-moz-` and `-o-` prefixes for Mozilla and Opera.\r\n\r\nYou need to change that to your specification after increasing the width.\r\n\r\nHere is a fiddle with bigger width and the slider to the right:\r\n_URL_0_\r\n\r\nThe HTML(As it is):\r\n\r\n < label class= \" ;switch \" ; > \r\n < input type= \" ;checkbox \" ; > \r\n < span class= \" ;slider \" ; > < /span > \r\n < /label > \r\n\r\nThe CSS:\r\n\r\n .switch {\r\n position: relative;\r\n display: inline-block;\r\n width: 200px; /* width increased */\r\n height: 34px;\r\n }\r\n .switch input {display:none;}\r\n .slider {\r\n position: absolute;\r\n cursor: pointer;\r\n top: 0;\r\n left: 0;\r\n right: 0;\r\n bottom: 0;\r\n background-color: #ccc;\r\n -webkit-transition: .4s;\r\n transition: .4s;\r\n }\r\n .slider:before {\r\n position: absolute;\r\n content: \" ; \" ;;\r\n height: 26px;\r\n width: 26px;\r\n left: 4px;\r\n bottom: 4px;\r\n background-color: white;\r\n -webkit-transition: .4s;\r\n transition: .4s;\r\n }\r\n input:checked + .slider {\r\n background-color: #2196F3;\r\n }\r\n input:focus + .slider {\r\n box-shadow: 0 0 1px #2196F3;\r\n }\r\n \r\n input:checked + .slider:before {\r\n -webkit-transform: translateX(160px); /* Move the slider to the right */\r\n -ms-transform: translateX(160px);\r\n -moz-transform: translateX(160px);\r\n -o-transform: translateX(160px);\r\n transform: translateX(160px);\r\n }", "882" ], [ "I&#39;m developing a custom WordPress theme and I want to fetch some date from the database that I used to install WordPress.\r\n\r\nThe data I want to fetch is not the website posts, It&#39;s custom data.\r\n\r\nThat data is stored in a table inside the same Database that WordPress is installed on, So in that Database there are the following tables (`custom_table`, `wp-posts`, `wp-users`, `wp-settings`, ..Etc Etc).\r\n\r\nSo I&#39;m wondering if WordPress has some functions or files to connect to that database.\r\n\r\nI can create a custom PHP file and connect to the Database, Then include that file to the files where I want to fetch the data.\r\n\r\nBut I want to see if there is a better way.\r\n\r\nAlso if these features exist in WordPress, Does it use specific database connection functions like `mysql_connect`, `mysqli_connect` or PDO?", "150" ], [ "I&#39;m building a new WordPress website, There will be a php file that is executed daily using a cron job.\r\n\r\nI&#39;m thinking of creating a new section in admin dashboard to show the new errors that may occur from that script.\r\n\r\nOne of the ideas is creating a text file and throw the errors there and separate between them with a new line or a comma, Then fetch these errors to that section.\r\n\r\nUsing `fopen()`, `fwrite()` and `fread()`, Or using `error_log()`.\r\n\r\nHow to do that?\r\n\r\nIs there is a better way to be notified, When an error occurs?", "150" ], [ "There is a text file that errors from a script will be saved into.\r\n\r\nEach error on a new line, Then these errors will be shown on a new admin menu.\r\n\r\nHere is the code to save the errors:\r\n\r\n $error = &#39;Error Message&#39;;\r\n\tfile_put_contents(&#39;erros.txt&#39;, $error.PHP_EOL , FILE_APPEND | LOCK_EX);\r\n\r\nGetting the errors from that text file:\r\n\r\n file_get_contents(&#39;errors.txt&#39;);\r\n\r\nMy question is how to create a notification when a new error is thrown to that file?\r\n\r\nSomething like when a new WordPress update, Or stackoverflow notifications.\r\n\r\nShould I for example add some code beneath the `file_put_contants()` function that creates the notification?\r\n\r\nIt doesn&#39;t be so fancy, Maybe just a red element without numbers, Something that tells there is a new text added.\r\n\r\n![WordPress Notifications Screenshot][1]\r\n\r\n\r\n [1]: _URL_0_", "150" ], [ "I want to show a notification bubble next to a custom menu name on admin dashboard.\r\n\r\nIt&#39;s a custom admin menu, And the notification will be showing a custom value from the Database.\r\n\r\nSomething like when there is a new WordPress update.\r\n\r\n[![WordPress New Update Notification Screenshot][1]][1]\r\n\r\nI viewed some question, But they were related to posts and not custom menus.\r\n\r\nHow to do that?\r\n\r\n\r\n [1]: _URL_0_", "802" ], [ "I have a php file that is executed by a Cron Job, I want to throw the error messages that may appear from that file and some other files in a text file.\r\n\r\nThe functions I&#39;m using:\r\n\r\n - require_once()\r\n - parse_url()\r\n - simplexml_load_file()\r\n - preg_replace()\r\n - file_put_contents()\r\n - file_get_contents()\r\n - for()\r\n - if()\r\n - strpos() , str_replace()\r\n - Database Connection using PDO $conn = new PDO( \" ;mysql:host=$servername;dbname=$dbname \" ;, $username, $password);\r\n\r\nThat file executed by Cron Job contain that:\r\n\r\n set_time_limit(0);\r\n ini_set(&#39;allow_url_fopen &#39;,&#39;ON&#39;);\r\n require_once(&#39;connect.php&#39;);\r\n\r\n $rss = simplexml_load_file($website);\r\n\r\n\t\tforeach ($rss- > channel- > item as $item) {\r\n\t\t $post[&#39;title&#39;] = (string)trim(strip_tags($item- > title));\r\n\t\t $post[&#39;link&#39;] = (string)$item- > link;\r\n\t\t $post[&#39;date&#39;] = (string)$item- > pubDate;\r\n\t\t\t\r\n\t\t\t$articles[$post[&#39;title&#39;]] = $post;\r\n\t\t}\r\n\r\n }\t\r\n\r\n $conn- > setAttribute(PDO<IP_ADDRESS>ATTR_ERRMODE, PDO<IP_ADDRESS>ERRMODE_EXCEPTION); \r\n\t$statement = $conn- > prepare( \" ;SELECT id FROM posts WHERE `title` = ? \" ;);\r\n //More Code\r\n\r\nSo i&#39;m wondering if I wrapped the whole code inside a PHP file with:\r\n\r\n try {\r\n\t //Code here.\r\n } catch (Exception $e) {\r\n\t file_put_contents(&#39;errors.txt&#39;, $e- > message);\r\n }\r\n\r\nWould the warnings, Notices and Fatal Errors from that code be inserted in that text file? Or I have to handle each function with its error handling function?", "132" ], [ "I want to save all script errors in a txt file, I know that there is a function to change the log file:\r\n\r\n ini_set( \" ;error_log \" ;, \" ;file path \" ;);\r\n\r\nIs that function changing the error_log path in the php.ini?\r\n\r\nOr it just log that PHP file errors to a specific file rather that the error_log file?\r\n\r\nSo for example if I have a file called &#39;file.php&#39; and that file contains some PHP code, If an error occurs there it&#39;s saved to that custom files.\r\n\r\nBut for other PHP files, When an error occurs, It&#39;s saved to the default error_log file.\r\n\r\nHow to do that?", "434" ], [ "I want to save errors from a specific file in a custom file, Not the default file.\r\n\r\nSo I added that at the top of my script:\r\n\r\n ini_set( \" ;log_errors \" ;, TRUE);\r\n ini_set( \" ;error_log \" ;, get_template_directory_uri() . \" ;/errors.log \" ;);\r\n\r\nThen I removed a character from a function to create an error:\r\n\r\n echo $date- > fomat( \" ;F j, Y \" ;);\r\n //Should be format( \" ;F j, Y \" ;)\r\n\r\nThat caused a fatal error:\r\n\r\n Fatal error: Call to undefined method DateTime<IP_ADDRESS>fomat()\r\n\r\nBut I can&#39;t see any text in the log file.\r\n\r\nI read a comment saying that `ini_set` works only when the code is executed, So I have to edit that function in `php.ini`.\r\n\r\nBut I want only to save that script errors in that custom file, Not all the errors, As I will parse that errors into a section on the website.\r\n\r\nI can&#39;t use :\r\n\r\n try {\r\n\t //Script Here.\r\n } catch (Exception $e) {\r\n\t file_put_contents(get_template_directory_uri() . \" ;/errors.log \" ;, $e- > message);\r\n }\r\n\r\nBecause that won&#39;t get all the fatal errors, Warnings and notices.\r\n\r\nWhat to do then to get that script errors saved in a separate file?", "434" ], [ "I want to get each error in the log error file.\r\n\r\nSo if the file contains:\r\n\r\n [08-Jul-2018 08:12:04 UTC] PHP Fatal error: Call to undefined method DateTime<IP_ADDRESS>fomat() in C:\\xampp\\htdocs\\wordpress\\wp-content\\themes\\theme\\index.php on line 44\r\n\r\n [08-Jul-2018 08:22:22 UTC] PHP Fatal error: Uncaught exception &#39;PDOException&#39; with message &#39;SQLSTATE[42S02]: Base table or view not found: 1146 Table &#39;database.table&#39; doesn&#39;t exist&#39; in C:\\xampp\\htdocs\\wordpress\\wp-content\\themes\\theme\\index.php:37\r\n Stack trace:\r\n #0 C:\\xampp\\htdocs\\wordpress\\wp-content\\themes\\news_theme\\index.php(37): \r\n PDOStatement- > execute()\r\n #1 C:\\xampp\\htdocs\\wordpress\\wp-includes\\template-loader.php(74): \r\n include(&#39;C:\\\\xampp\\\\htdocs...&#39;)\r\n #2 C:\\xampp\\htdocs\\wordpress\\wp-blog-header.php(19): \r\n require_once(&#39;C:\\\\xampp\\\\htdocs...&#39;)\r\n #3 C:\\xampp\\htdocs\\wordpress\\index.php(17): require(&#39;C:\\\\xampp\\\\htdocs...&#39;)\r\n #4 {main}\r\n thrown in C:\\xampp\\htdocs\\wordpress\\wp-content\\themes\\theme\\index.php on line 37\r\n\r\nThese are two errors, But one of them is very long and takes more than one line.\r\n\r\nI want to get each error of them in a variable.\r\n\r\nI tried:\r\n\r\n $contents = file(get_template_directory().&#39;/errors.txt&#39;, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);\r\n\tforeach ($contents as $key = > $content) {\r\n\t\techo $key . $content . &#39; < br > &#39;;\r\n\t}\r\n\r\nBut that gets each line, So the second one would be stored on several variables and I want to get each error in a variable.\r\n\r\nIs that possible?", "132" ], [ "I&#39;m using datatables jquery library to show some results from a Database.\r\n\r\n var table = jQuery(&#39;#table&#39;).DataTable({\r\n\t language: {\r\n\t \tsearchPlaceholder: \" ;Search Results \" ;,\r\n\t } ,\r\n\t \" ;lengthMenu \" ;: [[5, 10, 25, 50, 100, -1], [5, 10, 25, 50, 100, \" ;All \" ;]] ,\r\n\t \" ;autoWidth \" ;: true,\r\n\t \" ;responsive \" ;: true,\r\n\t \" ;lengthChange \" ;: true,\r\n\t \" ;ordering \" ;: true ,\r\n\t});\r\n\r\nBut some data has long text, So the table exceeds the browser width.\r\n\r\nI tried the following CSS:\r\n\r\n #table td{\r\n word-break: break-all\r\n }\r\n\r\nBut the length of the text increased and the height of the table too, Also one of the columns contain a URL which that property not working with.\r\n\r\nSo I need to use something like a readmore button.\r\n\r\nDoes datatables has that option? Or I should create that?", "626" ], [ "I&#39;m using an iframe inside of bootstrap modal:\r\n\r\n < div class= \" ;modal fade \" ; id= \" ;newsModal \" ; tabindex= \" ;-1 \" ; role= \" ;dialog \" ; aria-labelledby= \" ;newsModal \" ; aria-hidden= \" ;true \" ; > \r\n\t < div class= \" ;modal-dialog \" ; > \r\n\t < div class= \" ;modal-content \" ; > \r\n\t < div class= \" ;modal-body \" ; > \r\n\t < button type= \" ;button \" ; class= \" ;close \" ; data-dismiss= \" ;modal \" ; aria-hidden= \" ;true \" ; > & times; < /button > \r\n\t < div > \r\n\t < div id= \" ;loadingMessage \" ; > Loading... < /div > \t\r\n\t < iframe width= \" ;100% \" ; class= \" ;frame embed-responsive-item \" ; height= \" ;350 \" ; src= \" ; \" ; > < /iframe > \r\n\t < /div > \r\n\t < /div > \r\n\t < /div > \r\n\t < /div > \r\n\t < /div > \r\n\r\nThat iframe is open when an element of some elements with the same class clicked:\r\n\r\n < ?php foreach($new as $news){ ? > \r\n < div class= \" ;post_frame \" ; data-link= \" ; < ?php echo $news[&#39;link&#39;]; ? > \" ; data-toggle= \" ;modal \" ; data-target= \" ;#newsModal \" ; > \r\n Lorem ipsum dolor sit amet\r\n < /div > \r\n < ?php } ? > \r\n\r\n\r\nI&#39;m using that code to set the source of the iframe:\r\n\r\n $(&#39;.post_frame&#39;).each(function() {\r\n\t\t$(this).click(function() {\r\n\t\t\tvar data = $(this).data(&#39;link&#39;),\r\n\t\t\t frame = $(&#39;.frame&#39;);\r\n\r\n\t\t\tframe.attr(&#39;src&#39;, data);\r\n\t\t});\t\t\r\n\t\t\r\n\t});\r\n\r\nTo hide the preloader I use:\r\n\r\n frame.load(function() {\r\n\t $(&#39;#loadingMessage&#39;).css(&#39;display&#39;, &#39;none&#39;);\r\n });\r\n\r\nBut the preloader still there.\r\n\r\nAnd when I close that modal and click on another element with the same class `post_frame`, The previous source content still there until the content of the new source loads.\r\n\r\nHow to create a preloader before each source is loaded?", "908" ], [ "I created a custom admin menu:\r\n\r\n function new_menu() {\r\n add_menu_page(\r\n &#39;New Menu&#39;,\r\n &#39;New Menu&#39;,\r\n &#39;administrator&#39;, \r\n &#39;new_menu&#39;,\r\n &#39;new_menu_content&#39;\r\n );\r\n }\r\n\r\nadd_action(&#39;admin_menu&#39;, &#39;new_menu&#39;);\r\n\r\nInside that new menu, I get some data from a Database:\r\n\r\n function fishing_data_content($conn){\r\n require_once(get_template_directory() . &#39;/connect.php&#39;);\r\n \trequire_once(get_stylesheet_directory() . &#39;/data.php&#39;);\r\n }\r\n\r\nThe `connect.php` connects to the DB:\r\n\r\n $servername = \" ;localhost \" ;;\r\n $username = \" ;root \" ;;\r\n $password = \" ; \" ;;\r\n $dbname = \" ;data \" ;;\r\n try {\r\n $conn = new PDO( \" ;mysql:host=$servername;dbname=$dbname \" ;, $username, \r\n $password);\r\n // set the PDO error mode to exception\r\n $conn- > setAttribute(PDO<IP_ADDRESS>ATTR_ERRMODE, PDO<IP_ADDRESS>ERRMODE_EXCEPTION); \r\n }catch(PDOException $e){\r\n echo \" ;Error: \" ; . $e- > getMessage();\r\n }\r\n\r\nAnd the `data.php` fetches some data from that DB:\r\n\r\n $stmt = $conn- > prepare(&#39;SELECT * FROM posts&#39;);\r\n\t $stmt- > execute();\r\n\t\t$values = $stmt- > fetchAll();\r\n\t\tforeach($values as $val){\r\n echo $val . &#39; < br > &#39;;\r\n }\r\n }\r\n\r\nAlso I tried to require the connection file inside the data.php:\r\n\r\n require_once(dirname(__FILE__) . &#39;/connect.php&#39;);\r\n\r\nBut still having the same error:\r\n\r\n Fatal error: Call to a member function prepare() on string in /home/public_html/wordpress/wp-content/themes/theme/data.php on line 10", "768" ], [ "I send a post request to a php file with some data:\r\n\r\n function addNewPost(){\r\n\t\t$.post(&#39;create_post.php&#39;, {},\r\n\t\t function(data){\r\n\t\t\t if(data != &#39;OK&#39;){\r\n\t\t\t \t\t$(&#39;.errorMsg&#39;).html(data);\r\n\t\t }else{\r\n\t\t alert(&#39;Well Done! Post Is Added Successfully&#39;);\r\n\t\t }\r\n\t\t },\r\n\t\t);\r\n\t}\r\n\t\t \t\r\n\t$(document).on( \" ;click \" ;,&#39;#create&#39;, addNewPost);\r\n\r\nThe php file connects the DB and insert data to the Database, And if the data is inserted successfully the file returns `OK`:\r\n\r\n $st = $conn- > prepare(&#39;INSERT INTO posts() VALUES(?, ?, ?, ?, ?)&#39;);\r\n $st- > execute(); \r\n if ($st) {\r\n \techo &#39;OK&#39;;\r\n }\r\n\r\nIt returns OK, But it&#39;s added to the `errorMsg` element, So the if condition is executed although the returned data = `OK`.\r\n\r\nAlso I tried:\r\n\r\n if(data == &#39;OK&#39;){\r\n \talert(&#39;Success&#39;);\r\n }else{\r\n \t$(&#39;.errorMsg&#39;).html(data);\r\n }\r\n\r\nBut didn&#39;t work neither.\r\n\r\nWhat&#39;s wrong? Should I set specific dataType? Should I replace `echo` with `return`?", "132" ], [ "I have the following menu page with a sub page in **function.php**:\r\n\r\n function data_menu() {\r\n add_menu_page(\r\n &#39;Data&#39;,\r\n &#39;Data&#39;,\r\n &#39;administrator&#39;,\r\n &#39;data&#39;,\r\n &#39;data_content&#39;\r\n ); \r\n add_submenu_page( \r\n &#39;Data&#39; , \r\n &#39;Data&#39;, \r\n &#39;Data&#39;, \r\n &#39;manage_options&#39;, \r\n &#39;data&#39;,\r\n &#39;data_content&#39;\r\n );\r\n \r\n }\r\n\r\n\tadd_action(&#39;admin_menu&#39;, &#39;data_menu&#39;);\r\n\r\nI want to send an Ajax request to a PHP file, So I added javascript file to the admin dashboard in **function.php**:\r\n\r\n function admin_scripts() {\r\n wp_enqueue_script(&#39;my_custom_script&#39;, get_template_directory_uri() . &#39;/js/script.js&#39;);\r\n }\r\n\r\n add_action(&#39;admin_enqueue_scripts&#39;, &#39;admin_scripts&#39;);\r\n\r\nInside that file **script.js**:\r\n\r\n window.onload = function(){\r\n $(document).on(&#39;click&#39;, &#39;#toplevel_page_data ul.wp-submenu li:last-of-type&#39;, function() {\r\n console.log(&#39;menu clicked&#39;);\r\n $.post(&#39;file path&#39;, {}, \r\n function(data){\r\n console.log(data)\r\n });\r\n });\r\n };\r\n\r\nThen when I click the menu, The sentence `menu clicked` is logged in the console.\r\n\r\nI think the problem is that the Ajax request doesn&#39;t take enough time to be done, Before the page is opened.\r\n\r\nThe page URL becomes:\r\n\r\n _URL_0_\r\n\r\nIs there is a way to make that Ajax request when the menu is clicked?", "72" ], [ "I have a custom php file (Not a template file) or included in **function.php**.\r\n\r\nI want to check if the user is logged in, Or the current user is an admin.\r\n\r\nDoes WordPress uses a specific `cookie` or something I could check?\r\n\r\nfile.php:\r\n\r\n //Check if the current user is an admin.\r\n if(){\r\n\r\n }else{\r\n echo &#39;You are not admin&#39;;\r\n exit();\r\n }\r\n\r\nThat file connects and updates the DB, And the data is posted from an Ajax request, So I want to make sure that the data is posted from the admin.\r\n\r\n How to do that ?", "193" ], [ "I have 2 cron jobs to run 2 php files, The first one should be executed each 12 hours (twice a day 12am and 12pm), The second one should be executed each 12h:45m (12 hours and 45 minutes).\r\n\r\nThe Cpanel timezone is EDT (Eastern Daylight Time), I set the cron jobs at 2pm EDT timezone yesterday, Now it&#39;s 8:25 am and the files weren&#39;t executed.\r\n\r\nHere is a screenshot of the cron jobs:\r\n[![Cron Jobs Screenshot][1]][1]\r\n\r\n\r\nAnd here is an example from Cpanel:\r\n[![Cron Job Example From Cpanel][2]][2]\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_\r\n\r\nWhen I searched how to do it the command contains `-q` before the php file path, So I added it, It&#39;s not in the command example.\r\n\r\nIt that the problem or what?", "496" ], [ "I want to truncate the text after 20 words, Not characters.\r\n\r\nI have a php file that get content from DB and display them on the website, It contains:\r\n\r\n < ?php\r\n $query = $conn- > prepare(&#39;SELECT * FROM posts&#39;);\r\n\t$query- > execute();\r\n\t$data = $query- > fetchAll();\r\n\t\r\n foreach ($data as $post ) { ? > \r\n < p class= \" ;readmore \" ; data-text= \" ; < ?php echo $post[&#39;text&#39;] ? > \" ; data-link= \" ; < ?php echo $post[&#39;link&#39;] ? > \" ; > < /p > \r\n < ?php } ? > \r\n\r\nThen in the Javascript file:\r\n \r\n window.onload = function(){\r\n var more = document.getElementsByClassName(&#39;readmore&#39;);\r\n\r\n\t for(var i = 0; i < more.length; i++){\r\n\r\n\t more[i].innerHTML = more[i].getAttribute(&#39;data-text&#39;).split( \" ; \" ;).splice(0,20).join( \" ; \" ;);\r\n\r\n \t var data = \" ; < a href=&#39; \" ;+more[i].getAttribute(&#39;data-link&#39;)+ \" ;&#39; target=&#39;_blank&#39; > Read More < /a > \" ;;\r\n\r\n \t more[i].innerHTML += &#39;... &#39; + data;\r\n\t }\r\n }\r\n\r\nIt&#39;s working, but it takes much time to display the truncated text with readmore anchor at the end.\r\n\r\nIs there is a better and faster way?", "514" ], [ "I want to redirect the user when he visits the homepage.\r\n\r\nSo if he goes to _URL_1_, Of course if there is http,https,www or visiting from google, He should be redirected to `_URL_0_`.\r\n\r\nI can&#39;t use:\r\n\r\n header()\r\n\r\nBecause the website is built with CodeIgniter and I can&#39;t get the right php file.\r\n\r\nEither:\r\n\r\n window.location\r\n\r\nAs I don&#39;t want to rely on the client side.", "250" ], [ "I&#39;m running a PHP file using a cron job.\r\n\r\nIn that file I require wordpress `wp-load.php` file.\r\n\r\nIf I run that file, No problem happens because the path is correct then.\r\n\r\nBut when It&#39;s executed By the cron job I get that error:\r\n\r\n [12-Jul-2018 12:00:37 America/New_York] PHP Warning: require_once(../../../../wp-load.php): failed to open stream: No such file or directory in /home/username/public_html/wordpress/wp-content/themes/custom_theme/data/data.php on line 6\r\n\r\nHow should the path be to be executed by the cron job?", "150" ], [ "I have a search from, When the user type a keyword, The script looks for that keyword in the Database:\r\n\r\n < form method= \" ;GET \" ; > \r\n < input type= \" ;text \" ; name= \" ;q \" ; id= \" ;keyword \" ; placeholder= \" ;Enter a keyword \" ; > \r\n < input type= \" ;submit \" ; value= \" ;Search \" ; > \r\n < /form > \r\n\r\nAfter the form is submitted I check the following:\r\n\r\n //Check is the form is submitted.\r\n if( isset($_GET[&#39;q&#39;]) ){\r\n\r\n //Assign the submitted keyword to a variable.\r\n\t $query = $_GET[&#39;q&#39;];\r\n\r\n //Check if the keyword is empty.\r\n if(!empty($query)){\r\n\r\n //Check if the keyword matches the pattern.\r\n //The pattern checks that the keyword contains characters from any language and maybe there are spaces between them.\r\n $pattern = \" ;~^\\p{L}[\\p{L}\\p{M}\\h()]*$~u \" ;;\r\n\r\n //If the keyword matches the pattern.\r\n\t\t\tif(preg_match($pattern, $query)){\r\n\r\n //Fetch data from the Database.\r\n $stmt = $conn- > prepare(&#39;SELECT * FROM posts WHERE title OR description LIKE :s LIMIT 5&#39;);\r\n\t\t\t\t$stmt- > bindValue(&#39;:s&#39;, &#39;%&#39; . $query . &#39;%&#39;, PDO<IP_ADDRESS>PARAM_STR);\r\n\t\t\t\t$stmt- > execute();\r\n\t\t\t\t$posts = $stmt- > fetchAll();\r\n\r\n }\r\n }\r\n\r\nAre these checks enough to stop SQL injection and the other attacks?\r\n\r\nOr I need to create a blacklist? Or check something else?", "817" ], [ "I have a table for counting the views:\r\n\r\n post_views table\r\n ___________________________________\r\n | | | |\r\n | id | post_id | views |\r\n |________|_____________|___________|\r\n\r\nWhere the `post_id` is related to the `id` of `posts` table:\r\n\r\n \r\n posts table\r\n __________________________________________\r\n | | | | |\r\n | id | title | text | .. |\r\n |________|___________|__________|_________|\r\n\r\nEach `id` from `posts` should has one row in the `post_views` table, So the `id` is primary in views table and `post_id` is unique.\r\n\r\nI want to increase the `views` count if the `post_id` exists, Else insert that new `post_id`.\r\n\r\nSo I&#39;m using that query:\r\n\r\n INSERT INTO post_views (`post_id`, `views`) VALUES (1, 1) ON DUPLICATE KEY UPDATE `views` = `views`+1\r\n\r\nThat created a new row with `id` = 0:\r\n\r\n ____________________________________\r\n | | | |\r\n | id | post_id | views |\r\n |__________|_____________|___________|\r\n | | | |\r\n | 0 | 1 | 1 |\r\n | | | |\r\n |__________|_____________|___________|\r\n\r\nAnd whenever I run the same query with a new `post_id`:\r\n\r\n INSERT INTO post_views (`post_id`, `views`) VALUES (2, 1) ON DUPLICATE KEY UPDATE `views` = `views`+1\r\n\r\nThe views in the same existing row increases and the new `post_id` is not added:\r\n\r\n ____________________________________\r\n | | | |\r\n | id | post_id | views |\r\n |__________|_____________|___________|\r\n | | | |\r\n | 0 | 1 | 2 |\r\n | | | |\r\n |__________|_____________|___________|", "480" ], [ "I have 2 tables with one-to-one relationship:\r\n\r\n \r\n\r\n post_views table\r\n ___________________________________\r\n | | | |\r\n | id | post_id | views |\r\n |________|_____________|___________|\r\n\r\n\r\n\r\n\r\n posts table\r\n __________________________________________\r\n | | | | |\r\n | id | title | text | .. |\r\n |________|___________|__________|_________|\r\n\r\n \r\n\r\n`post_id` from `post_views` table is joined with `id` from `posts` table.\r\n\r\nThe `id` in both tables is primary and auto incremented, And the `post_id` is unique.\r\n\r\nHere is a screenshot of the indexes for `post_views`:\r\n_URL_0_\r\n\r\nEach post should has only one row in `post_views` table.\r\n\r\nI run this query to insert a new row or increase the views, If that `post_id` exists:\r\n\r\n INSERT INTO post_views (`post_id`, `views`) VALUES (1, 1) ON DUPLICATE KEY UPDATE `views` = `views`+1\r\n\r\nIt&#39;s executed successfully and a new row is inserted:\r\n\r\n ____________________________________\r\n | | | |\r\n | id | post_id | views |\r\n |__________|_____________|___________|\r\n | | | |\r\n | 1 | 1 | 1 |\r\n | | | |\r\n |__________|_____________|___________|\r\n\r\nThen when I run the same query again to increase the views, I get a success message saying that `2 rows inserted` and the row is now:\r\n\r\n ____________________________________\r\n | | | |\r\n | id | post_id | views |\r\n |__________|_____________|___________|\r\n | | | |\r\n | 1 | 1 | 2 |\r\n | | | |\r\n |__________|_____________|___________|\r\n\r\nAnd that&#39;s what I want, but if I run the query with a new `post_id`:\r\n\r\n INSERT INTO post_views (`post_id`, `views`) VALUES (2, 1) ON DUPLICATE KEY UPDATE `views` = `views`+1\r\n\r\nI get that:\r\n\r\n ____________________________________\r\n | | | |\r\n | id | post_id | views |\r\n |__________|_____________|___________|\r\n | | | |\r\n | 1 | 1 | 2 |\r\n |__________|_____________|___________| \r\n | | | |\r\n | 3 | 2 | 1 | \r\n |__________|_____________|___________|\r\n\r\nThe `id` is 3 instead of 2, So each time I run the query with the same `post_id` is like I&#39;m inserting a new row with an id.\r\n\r\nSo if I run the query with `post_id = 3` three times, The news id will be 7.\r\n\r\nIs that&#39;s normal?", "480" ], [ "On the homepage I have some links:\r\n\r\n < a class= \" ;link \" ; data-id= \" ;1 \" ; > first link < /a > \r\n < a class= \" ;link \" ; data-id= \" ;2 \" ; > second link < /a > \r\n < a class= \" ;link \" ; data-id= \" ;3 \" ; > third link < /a > \r\n\r\nWhen one of these links is clicked, I want to send an ajax request to a php file to update the Database to increase views column of that post.\r\n\r\n $(document).ready(function(){\r\n $(document).on(&#39;click&#39;, &#39;.link&#39;, function(e){\r\n \r\n var post_id = $(this).data(&#39;id&#39;);\r\n\r\n $.ajax({ \r\n url: \" ;views.php \" ;,\r\n type: &#39;POST&#39;,\r\n data: {id: post_id},\r\n success: function(){\r\n alert( \" ;done \" ;);\r\n }}); // ajax\r\n\r\n }); // on click\r\n\r\n }); // ready\r\n\r\nIn views.php:\r\n\r\n //Check if the id is posted.\r\n if( isset($_POST[&#39;id&#39;]) ){\r\n\r\n //Assigning the id to a variable.\r\n $id = $_POST[&#39;id&#39;];\r\n\r\n //Check if the id is an integer.\r\n $pattern = &#39;/[0-9]/&#39;;\r\n if( preg_match($pattern, $id) ){\r\n \r\n //Check that the user didn&#39;t visit that post before.\r\n $post_cookie = &#39;p_&#39; . $id;\r\n if( !isset($_COOKIE[$post_cookie]) ){\r\n\r\n //Insert or update if the post id exists.\r\n $query = $conn- > prepare(&#39;INSERT INTO posts (id, views) VALUES (:id, 1) ON DUPLICATE KEY UPDATE views = views+1&#39;);\r\n $query- > bindValue(&#39;:id&#39;, $id, PDO<IP_ADDRESS>PARAM_INT);\r\n $query- > execute();\r\n \r\n //Set a cookie with the post id to indicate that the post is viewed.\r\n setcookie( $post_cookie, &#39;1&#39;);\r\n\r\n }// No cookie with that name (the user didn&#39;t visit that post).\r\n } // id matches the pattern.\r\n } // id is posted.\r\n\r\nI could you other options that the posts id to add/update the views, But I&#39;m wondering if that way is safe or I should use `admin-ajax.php`.\r\n\r\n**The posts are custom posts from Database, Not WordPress posts**", "72" ], [ "I have the following html:\r\n\r\n < div class= \" ;container-fluid \" ; > \r\n < div class= \" ;row \" ; > \r\n < div class= \" ;col-sm-push-3 col-sm-6 text-center wrapper \" ; > \r\n < div class= \" ;col-sm-4 inner-wrapper \" ; > \r\n\t\t\t\t < span class= \" ;text-center circle \" ; > A < /span > \r\n\t\t\t\t < p class= \" ;text-center center-block \" ; > Click Start Now < /p > \r\n\t\t\t\t < a href= \" ; \" ; class= \" ;text-center center-block start-now \" ; > Start Now < /a > \r\n\t\t\t < /div > < !-- col-sm-4 -- > \r\n < /div > < !-- col-sm-6 -- > \r\n < /div > < !-- row -- > \r\n < /div > < !-- container-fluid -- > \r\nThere will be another 2 elements with `col-sm-4` inside `col-sm-6`.\r\n\r\nAnd the following CSS:\r\n\r\n .container-fluid{\r\n margin:10% auto\r\n }\r\n\r\n .wrapper{\r\n color: #fff;\r\n }\r\n\r\n .inner-wrapper{\r\n background-color: #ccc\r\n }\r\n\r\n .circle{\r\n border-radius: 50%;\r\n border: 1px solid #d1cfc8;\r\n background-color: #000;\r\n padding: 5% 15%;\r\n font-size: 300%;\r\n }\r\n\r\n .start-now{\r\n color: #fff;\r\n background-color: #96d0f1\r\n }\r\n\r\nHere is a fiddle to show the code live with Boostrap: _URL_0_\r\n\r\nAs you see the circle is exceeding the `row` and it&#39;s not fitting the content, And the circle extended behind the ` < p > ` beneath it.\r\n\r\nWhat is the problem? Can&#39;t I increase the `margin` to that limit? Is the pseudo element before `row` causing that?", "455" ], [ "I have 3 circles in a row and I want to link between them from the center with a dash line, Here is a screenshot similar to what I want:\r\n[![enter image description here][1]][1]\r\n\r\n\r\n [1]: _URL_0_\r\n\r\nHere is the html code:\r\n\r\n < div class= \" ;container-fluid \" ; > \r\n < div class= \" ;row \" ; > \r\n < div class= \" ;col-xs-push-3 col-xs-6 text-center \" ; > \r\n < div class= \" ;col-xs-3 \" ; > \r\n < div class= \" ;wrapper \" ; > \r\n < span class= \" ;circle text-center \" ; > A < /span > \r\n < span class= \" ;dash_line \" ; style= \" ;transform: translate(232%, -215%); \" ; > --- < /span > \r\n < /div > < !-- wrapper -- > \r\n < /div > < !-- col-xs-3 -- > \r\n < div class= \" ;col-xs-6 \" ; > \r\n < div class= \" ;wrapper \" ; > \r\n < !-- < span class= \" ;dash_line \" ; > --- < /span > -- > \r\n < span class= \" ;circle text-center \" ; > B < /span > \r\n < !-- < span class= \" ;dash_line \" ; > --- < /span > -- > \r\n < /div > < !-- wrapper -- > \r\n < /div > < !-- col-xs-6 -- > \r\n < div class= \" ;col-xs-3 \" ; > \r\n < div class= \" ;wrapper \" ; > \r\n < span style= \" ; transform: translate(-114%, 135%); \" ; class= \" ;dash_line \" ; > ----- < /span > \r\n < span class= \" ;circle text-center \" ; > C < /span > \r\n < /div > < !-- wrapper -- > \t\r\n < /div > < !-- col-xs-3 -- > \r\n < /div > < !-- col-xs-6 -- > \r\n < /div > < !-- row -- > \r\n < /div > < !-- container-fluid -- > \r\n\r\nHere is the custom CSS:\r\n\r\n .row{\r\n margin:5% auto\r\n }\r\n\r\n .circle {\r\n\t border-radius: 50%;\r\n border: 1px solid #d1cfc8;\r\n background-color: #f7eebe;\r\n padding: 15% 35%;\r\n font-size: 300%;\r\n display: inline-block\r\n }\r\n\r\n .dash_line{\r\n position: absolute;\r\n transform: translateY(50%);\r\n }\r\n\r\nHere is a fiddle to see it live:\r\n_URL_1_\r\n\r\nAs you see i&#39;m using specific values for each dash line, I want it to be dynamic.\r\n\r\nI don&#39;t mind changing the elements, Adding/removing elements.\r\n\r\nAlso I don&#39;t mind using Javascript/Jquery to achieve that.", "908" ] ]
416
[ 19644, 11022, 10025, 18494, 14178, 11549, 14377, 13189, 13191, 14422, 6197, 580, 16242, 18179, 1451, 10080, 1575, 7609, 9088, 7970, 9640, 19722, 14251, 13144, 11019, 4603, 15235, 10264, 13688, 9436, 86, 13105, 6911, 14215, 14816, 674, 13714, 11805, 14042, 10386, 10705, 19557, 2804, 14338, 14650, 11305, 13923, 645, 9618, 12326, 6130, 17021, 13887, 18070, 11304, 18861, 16124, 15690, 14808, 1591, 17943, 10066, 7792, 17380, 6842, 5868, 12768, 15490, 14499, 14765, 10525, 14881, 594, 17711, 7260, 8880, 19013, 7701, 5844, 120, 11498, 19734, 19207, 17706, 5158, 4320, 3098, 13542, 17629, 12570, 12947, 9064, 12254, 7078, 11149, 17503, 16808, 18087, 19694, 11709, 10898, 12237, 6417, 6266, 17605, 6691, 13890, 13299, 18815, 820, 19528, 15882, 14613, 8155, 17548, 19095, 15601, 10593, 12588, 16250, 6944, 3814, 11382, 14925, 6522, 9968, 10372, 16512, 19675, 13045, 19000, 18321, 13037, 14489, 10676, 7610, 19245, 10952, 2013, 15876, 13092, 14182, 5102, 12910, 6817, 16477, 13053, 10896, 3119, 14926, 17257, 14227, 12016, 14074, 16797, 16787, 12882, 19700, 11730, 16419, 2895, 15777, 15067, 5456, 12971, 13313, 5282, 14124, 4968, 19490, 16009, 19284, 12077, 12666, 9300, 4793, 16265, 1118, 8589, 17873, 17957, 12780, 19454, 1209, 10180, 3882, 14555, 44, 16861, 4269, 8097, 7783, 14733, 7038, 6435, 9836, 14894, 12613, 11407, 14152, 18240, 16071, 16255, 14456, 19562, 14737, 8339, 11483, 14509, 10825, 12958, 16655, 19602, 8426, 10407, 14590, 19396, 17187, 14609, 8920, 12174, 370, 7184, 875, 14872, 13568, 17077, 16818, 17755, 1218, 15402, 17662, 11037, 10765, 18104, 17919, 404, 16625, 13365, 6806, 12259, 17072, 11684, 11449, 722, 12930, 15029, 17962, 13583, 3763, 5989, 10832, 7839, 13969, 10912, 13683, 18568, 8706, 15297, 15836, 1103, 2466, 9634, 14828, 15373, 10368, 8664, 18753, 16296, 16019, 248, 14346, 9399, 14906, 91, 9208, 6167, 17601, 10199, 6325, 17172, 10611, 19726, 14181, 745, 6895, 15057, 3868, 9464, 16873, 10816, 2460, 13042, 7457, 5426, 4599, 10347, 13494, 14034, 14029, 11942, 14475, 15025, 2051, 18012, 16105, 8848, 11645, 18338, 12948, 17485, 4993, 19575, 8815, 12846, 17638, 15198, 8576, 12657, 7974, 12672, 443, 10278, 4853, 6516, 13770, 14106, 1948, 37, 8894, 10581, 17066, 12956, 1179, 15102, 10050, 2494, 12073, 9748, 5304, 18000, 11457, 7281, 15328, 17280, 8637, 146, 5280, 18537, 7428, 13159, 12348, 13797, 155, 8698, 11001, 6988, 2069, 18785, 11419, 264, 10702, 17053, 7161, 9108, 4948, 4342, 17159, 197, 6400, 17934, 14015, 7930, 13474, 4445, 14250, 15155, 2202, 1433, 17150, 2867, 32, 1184, 1381, 18790, 17987, 95, 17127, 8260, 4748, 15760, 13715, 19582, 15661, 15772, 17954, 15116, 8420, 15455, 12540, 13478, 17627, 7300, 1423, 123, 6410, 7218, 11661, 16472, 3846, 2752, 8492, 17175, 15514, 6308, 13605, 14321, 11832, 13145, 18117, 19472, 10198, 10461, 5049, 10867, 3429, 10706, 14935, 17748, 9049, 1127, 2996, 15751, 7307, 15471, 14388, 15401, 19757, 2267, 19381, 16765, 7447, 19, 14513, 12119, 14012, 874, 16076, 14010, 13784, 13141, 4996, 391, 2875, 7268, 14343, 18023, 16642, 15813, 13409, 9057, 6689, 8028, 8093, 14296, 5312, 13493, 2216, 5982, 15034, 6303, 11670, 14323, 5516, 8708, 1578, 15775, 6090, 18231, 9072, 10625, 7311, 8486, 11594, 9809, 14623, 7166, 17401, 9483, 15143, 19133, 10678, 10558, 18189, 19773, 10849, 6060, 5578, 17456 ]
STX_1004096.0
[ [ "Cython [extension types](_URL_0_) do not translate into c structures, they translate to python built in types. At a high level this means `Field` is a python class which happens to be implemented in C, like `list` or `ndarray` for example. At a lower level, cython does use c structures to implement extension types but these structures have fields you are not accounting for. Namely a field for tracking its type and anther for reference counting (maybe some others too).\r\n\r\nI think what you want is struct, not an extension type. Try this:\r\n\r\n cdef struct Field:\r\n np.float64_t u # x velocity\r\n np.float64_t v # y velocity\r\n np.float64_t w # z velocity", "816" ], [ "I believe, the arithmetic type if cython depends on the types of numbers being operated on. I believe the issue in your code is on this line, `key = (key ^ 0xdeadbeef) + (key < < 4)`. Cython translates this line to:\r\n\r\n __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_key); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}\r\n __Pyx_GOTREF(__pyx_t_1);\r\n __pyx_t_2 = PyNumber_Xor(__pyx_t_1, __pyx_int_<PHONE_NUMBER>); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}\r\n __Pyx_GOTREF(__pyx_t_2);\r\n __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;\r\n __pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_key < < 4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}\r\n __Pyx_GOTREF(__pyx_t_1);\r\n __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}\r\n __Pyx_GOTREF(__pyx_t_3);\r\n __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;\r\n __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;\r\n __pyx_t_4 = __Pyx_PyInt_As_unsigned_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (unsigned int)-1) & & PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}\r\n __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;\r\n __pyx_v_key = __pyx_t_4;\r\n\r\nWhat you probably want is this `key = (key ^ < unsigned int > 0xdeadbeef) + (key < < 4)`, which gets translated to:\r\n\r\n __pyx_v_key = ((__pyx_v_key ^ ((unsigned int)0xdeadbeef)) + (__pyx_v_key < < 4));\r\n\r\nBig difference right :). You might find the need for an explicit cast here surprising, but I think it makes sense. In cython everything behaves the way it would in pytyhon, unless explicitly told to do something different. Here cython treats `0xdeadbeef` as a python int type, unless you explicitly cast it or assign it to a typed variable.\r\n\r\nIf you&#39;re not already using it, I would highly recommend using `cython -a` and reviewing the html file that&#39;s created. It highlights your code in different shades of yellow depending on how directly each line can be converted to c. It makes catching subtle things like this much easier.", "977" ], [ "You want to make sure to compare keys as ints instead of strings, when you&#39;re using strings they&#39;re sorted alphabetically, ie `&#39;7&#39; > &#39;11&#39;`. The easiest way to do this is to define your own custom comparison methods for your `foo` class:\r\n\r\n from functools import total_ordering\r\n \r\n @total_ordering\r\n class foo:\r\n def __init__(self, key1, data1, data2):\r\n #all of these values are strings, even though some may be ints\r\n self.key = key1\r\n self.d1 = data1\r\n self.d2 = data2\r\n \r\n @staticmethod\r\n def _as_int(value):\r\n try:\r\n return int(value)\r\n except ValueError:\r\n return value\r\n \r\n def __le__(self, other):\r\n return self._as_int(self.key) < self._as_int(other.key)\r\n def __eq__(self, other):\r\n return self._as_int(self.key) == self._as_int(other.key)\r\n \r\n l1 = [foo(&#39;12&#39;, &#39;foo1&#39;, None),\r\n foo(&#39;8&#39;, &#39;qwer&#39;, None),\r\n foo(&#39;7&#39;, &#39;foo3&#39;, None),\r\n foo(&#39;13&#39;, &#39;foo2&#39;, None),\r\n foo(&#39;77&#39;, &#39;foo4&#39;, None),\r\n foo(&#39;12&#39;, &#39;foo5&#39;, None),\r\n foo(&#39;A&#39;, &#39;foo&#39;, None),\r\n foo(&#39;B&#39;, &#39;foo&#39;, None)]\r\n \r\n for item in sorted(l1):\r\n print item.key, item.d1, item.d2\r\nWhich gives:\r\n\r\n 7 foo3 None\r\n 8 qwer None\r\n 12 foo1 None\r\n 12 foo5 None\r\n 13 foo2 None\r\n 77 foo4 None\r\n A foo None\r\n B foo None\r\n\r\nIf you know for sure that the `key` attribute will be numeric, you can simplify the code a little bit.", "142" ], [ "There are a few small issues with your code. First you need to finish defining you class before you create `student1` and `student2`. In python when you de-indent, you&#39;re telling the interpreter that you&#39;ve reached the end of a block (ie a function, a class, a loop, or some other code block). If you want `work` to be a method of your class, it needs to be part of the class block for `Student`.\r\n\r\nSecond, afaict, you only ever set the `job` attribute in `work` but you never call `work`. It&#39;s often a good idea, but not required, to set every attribute to some default value in `init`.\r\n\r\nAnd third, it seems like you&#39;re missing some `:` and have at least one indentation error. Try something like this:\r\n\r\n class Student():\r\n def __init__(self, college, gpa, credits):\r\n self.college = college\r\n self.gpa = gpa\r\n self.credits = credits\r\n self.job = \" ;no job \" ;\r\n \r\n def setWork(self, job=&#39;work study&#39;):\r\n self.job = job\r\n \r\n student1 = Student( \" ;university \" ;, 3.2, 45)\r\n student1.setWork()\r\n student2 = Student( \" ;community college \" ;, 3.8, 51)\r\n student2.setWork( \" ;Starbucks \" ;)\r\n \r\n print student1.job\r\n # work study\r\n print student2.job\r\n # Starbucks", "621" ], [ "It&#39;s fine on stackoverflow to edit questions and ask new questions, but try to keep it to one complete questions per post. If you edit the question, do you best to update the title and tags to match and remove anything from the original question that no longer makes sense. If the new question is very different than the original, consider creating a new question instead of editing. Also take a look at [this post about how to ask a good question](_URL_0_).", "431" ], [ "It sounds like you&#39;re just using the wrong data structure, you really want a dict of dicts so you can do something like this:\r\n\r\n for itemA in dictOfDicts:\r\n thing = 0\r\n for itemB in dictOfDicts[itemA]:\r\n value = dictOfDicts[itemA][itemB]\r\n thing += fun(itemA, itemB, value)\r\n save(thing)\r\n\r\nYou can easily get a dict of dicts from your current data structure by doing something like this:\r\n\r\n dictOfDicts = {}\r\n for (itemA, itemB) in items:\r\n if itemA not in dictOfDicts:\r\n dictOfDicts[itemA] = {}\r\n dictOfDicts[itemA][itemB] = items[itemA, itemB]", "58" ], [ "The key here is to realize that `self[k]` is the same as `self.__getitem__(k)` so you don&#39;t want to use `self[k]` inside `__getitem__`, unless you are in fact trying to do some recursion. Instead always use `OrderedDict.__getitem__ (self,key)`.\r\n\r\nOn an unrelated note, you generally don&#39;t want to create a method that just calls the same method of the parent class, ie:\r\n\r\n class MyArray (OrderedDict):\r\n def __init__ (self,*args):\r\n OrderedDict.__init__(self,*args)\r\nJust delete the method and python will call the parent class method for you, inheritance is awesome :).\r\n\r\n### update:\r\n\r\nAfter some digging I found that you get infinite recursion when you try to print a `MyArray` because `OrderedDict.__repr__` calls `OrderDict.items` which then calls `OrderDict.__getitem__` (in the form of `self[key]`), then it calls `__repr__` on each of the items ... The issue here is that you&#39;re modifying `__getitem__` to do something very different than what it does in the Parent class. If you want this class to have the full functionality of a python class, you&#39;ll need to override every method that uses `self[key]` anywhere in the method. You can start with `items`, ie something like:\r\n\r\n def items(self):\r\n &#39;od.items() - > list of (key, value) pairs in od&#39;\r\n return [(key, OrderedDict.__getitem__(self, key)) for key in self]\r\n\r\nWhen you hit this kind of thing it&#39;s often better to drop the subclassing and just have the OrderedDict be an attribute of the new class, something like:\r\n\r\n class MyArray(object):\r\n \r\n def __init__(self, *args):\r\n self.data = OrderedDict(*args)\r\n \r\n def __getitem__(self, key):\r\n if not hasattr (key, &#39;__iter__&#39;):\r\n return MyArray([(key, self.data[key])])\r\n return MyArray([(k, self.data[k]) for k in key])", "58" ], [ "The issue is that in python, by default, a copy of an object does not compare equal to the original even if they are the \" ;same \" ;, for example:\r\n\r\n class Fruit(object):\r\n def __init__(self, name, color):\r\n _URL_0_ = name\r\n self.color = color\r\n \r\n def __repr__(self):\r\n return self.color\r\n\r\n print Fruit( \" ;apple \" ;, \" ;red \" ;) == Fruit( \" ;apple \" ;, \" ;red \" ;)\r\n # False\r\n\r\nTo fix this, you need to tell python how objects of type `Fruit` should be compared, for example:\r\n\r\n class Fruit(object):\r\n def __init__(self, name, color):\r\n _URL_0_ = name\r\n self.color = color\r\n \r\n def __repr__(self):\r\n return self.color\r\n\r\n def __eq__(self, other):\r\n try:\r\n if (_URL_0_ == _URL_1_) and (self.color == other.color):\r\n return True\r\n else:\r\n return False\r\n except AttributeError:\r\n return False", "903" ], [ "@simitar I&#39;m not trying to start an argument with you, I really do want to help you but I don&#39;t know where you&#39;re stuck. With these kinds of problems the first step is to break apart the problem into smaller problems, preferably problems with well known solutions. Your problem is similar to, but not the same as a mergesort. The goal of mergesort is to take many small (often size 2-10) arrays or lists and merge them into one final sorted array or list. If you understand how a mergsort works, it might help you solve your problem.", "820" ], [ "@simitar the key here is to understand that in a mergsort, all consecutive items must be compared so that if the inputs look like this: `[[..., 8, ...], [..., 9, ...], [..., 10, ...]]`, the output must look like this `[..., 8, 9, 10, ...]`. You&#39;re not going to create the output, but you do want to go through the process of comparing all consecutive items in the combined inputs. Does that make sense? Actually your problem might be simplified a little because it seems like maybe you only need to compare consecutive items from 1 & 2, 2 & 3, 3 & 4 and so on.", "820" ], [ "You have a bit of a catch 22. You need the GIL to call `numpy.searchsorted` but the GIL prevents any kind of parallel processing. Your best bet is to write your own `nogil` version of `searchsorted`:\r\n\r\n cdef mySearchSorted(double[:] array, double target) nogil:\r\n # binary search implementation\r\n\r\n for j in prange(0,N, nogil=True):\r\n for k in range(A2.shape[0]):\r\n for L in range(A2.shape[1]):\r\n C[j, k, L] = mySearchSorted(A1[j, :], A2[k, L])\r\n\r\n`numpy.searchsorted` also has a non trivial amount of overhead, so if N is large it makes sense to use your own `searchsorted` just to reduce the overhead.", "820" ], [ "You&#39;re trying to dynamically do type declarations, but type declarations are needed by Cython and the compiler at compile time. When you compile your cython code, cython uses the static type information you&#39;ve provided to optimize the code. If the types are not static, ie you don&#39;t know the type or dimension before runtime, cython cannot include that information at compile time.\r\n\r\nThere are two main ways to solve this issue, one is to define different functions for each possible type, ie something like this:\r\n\r\n def myFun1D(double[<IP_ADDRESS>1] array):\r\n pass\r\n\r\n def myFun2D(double[:, <IP_ADDRESS>1] array):\r\n pass\r\n\r\n def foo(array):\r\n cdef double r\r\n if array.ndim == 1:\r\n r = myFun1D(array)\r\n elif array.ndim == 2:\r\n r = myFun2D(array)\r\n \r\nThe second option is to simply not type declare array, and allow cython to treat it as a dynamically typed python object.", "977" ], [ "Understanding a few things about how python works will help you understand what&#39;s happening here. Here `obj` is a closure, closures are evaluated at call time, not when the function is defined so if I do this:\r\n\r\n x = \" ;hello \" ;\r\n def printX():\r\n print x\r\n x = \" ;goodbye \" ;\r\n printX() # goodbye\r\n\r\nI get \" ;goodbye \" ; because `printX` is referencing a global variable in my module, which changes after I create `printX`.\r\n\r\nWhat you want to do is create a function with a closure that references a specific object. The functional way to do this is to create a function that returns another function:\r\n\r\n x = \" ;hello \" ;\r\n def makePrintX(a):\r\n def printX():\r\n # We print a, the object passed to `makePrintX`\r\n print a\r\n return printX\r\n\r\n # x is evaluated here when it is still \" ;hello \" ;\r\n myPrintX = makePrintX(x) \r\n \r\n x = \" ;goodbye \" ;\r\n myPrintX() # \" ;hello \" ;\r\n\r\nIf you&#39;re having trouble understanding the above example I would recommend reading up on python&#39;s scoping rules. For your example, you could do something like this:\r\n\r\n class Example:\r\n def __init__(self, x):\r\n self.x = x\r\n \r\n def get(self):\r\n return self.x\r\n \r\n def makeObjFunction(obj):\r\n def objFunction(x):\r\n return obj.get()\r\n return objFunction\r\n \r\n a_list = []\r\n for index in range(3):\r\n obj = Example(index)\r\n my_function = makeObjFunction(obj)\r\n \r\n a_list.append(my_function)\r\n \r\n for c in a_list:\r\n print(c( \" ;some value \" ;))", "977" ], [ "I&#39;ve seen this used as a homework or quiz problem before, the question is begging you to use a [hash table](_URL_0_). Create an empty Boolean array of size `n` and for each number in the list set `array[num]` to `True`. Loop over the new array, and record all the instances of `False`, you know ahead of time how many there should be.", "443" ], [ "Where to start....\r\n\r\n1) I&#39;m not sure what you think `abc(keyv1)` does but `abc` has a return value you&#39;re ignoring so that&#39;s probably an issue. If you&#39;re trying to make `abc` an \" ;in-place \" ; function, don&#39;t. It just makes your code harder to read and understand.\r\n\r\n2) In your else-if you&#39;re trying to change `keyv1`, `keyv1[i] = str(keyv1[i])`. Don&#39;t do that, create a new list and return in instead.\r\n\r\n3) In your else clause you say `key = str(key)` but then you don&#39;t use `key` anywhere. You need to put `key` into your return structure.\r\n\r\n4) Python dictionaries don&#39;t guarantee that the type of the key in the dictionary will be the same as the type of variable you used to update the dictionary. For example try this:\r\n\r\n d = dict(one=1)\r\n d[unicode(&#39;one&#39;)] = &#39;new value&#39;\r\n key = d.keys()[0]\r\n print key, &#39;:&#39;, type(key) # one : < type &#39;str&#39; > \r\n\r\n5) This isn&#39;t part of you question, but `str(unicode_thing)` does not always work, try this `str(u&#39;abcd&#233;&#39;)`. You either need to handle that exception explicitly or you must know a priori that `unicode_thing` is actually valid ascii. If the second is the case, then I would ask why are you using unicode at all?\r\n\r\nHere is some code that might help you get started:\r\n\r\n json_result = [{u&#39;NI&#39;: {u&#39;Li&#39;: u&#39;0&#39;, u&#39;Receive&#39;: u&#39;3&#39;, u&#39;Slot&#39;: u&#39;0002&#39;,u&#39;PCID&#39;: u&#39;165F&#39;, u&#39;PCIV&#39;: u&#39;14e4&#39;, u&#39;LinkD&#39;: u&#39;0&#39;,&#39;Per&#39;: u&#39;44&#39;, u&#39;Max&#39;: u&#39;0&#39;, u&#39;Pro&#39;:u&#39;Br&#39;, u&#39;Nic&#39;: u&#39;3&#39;,u&#39;Co&#39;: u&#39;1.36&#39;, u&#39;lis&#39;: [u&#39;1&#39;,u&#39;2&#39;]}}]\r\n \r\n def abc(item):\r\n if type(item) is list:\r\n return list(abc(i) for i in item)\r\n elif type(item) is dict:\r\n iteritem = item.iteritems()\r\n return dict((str(key), abc(value)) for (key, value) in iteritem)\r\n else:\r\n try:\r\n return str(item)\r\n except UnicodeEncodeError:\r\n return item\r\n # Or maybe do something smarter.\r\n \r\n print abc(json_result)", "91" ], [ "functions defined using `cdef` are translated directly into c functions by python and can only be called from cython code. `cdef` and `cpdef` functions, in general, have performance similar to c code. Functions imported from python modules or defined using `def` have more overhead. `searchsorted` specifically has a lot of overhead associated with numpy type and correctness checking. You can do any necessary checking once, instead of every time `searchsorted` is called.", "799" ], [ "Your code is doing a lot of things you don&#39;t need. First you&#39;re rebuilding the KDtree on every loop and that&#39;s a waste. Also `query` takes an array of points, so no need to write your own loop. Ptos is an odd data structure, and you don&#39;t need it (and don&#39;t need to sort it). Try something like this.\r\n\r\n from scipy import spatial\r\n \r\n def nearest(arr0, arr1):\r\n tree = spatial.KDTree(arr1)\r\n distance, arr1_index = tree.query(arr0)\r\n best_arr0 = distance.argmin()\r\n best_arr1 = arr1_index[best_arr0]\r\n two_closest_points = (arr0[best_arr0], arr1[best_arr1])\r\n return two_closest_points, best_arr1, best_arr0\r\n\r\nIf that still isn&#39;t fast enough, you&#39;ll need to describe your problem in more detail and figure out if another search algorithm will work better for your problem.", "1021" ], [ "You seem to be confused about the terms column and row major. `Row-major` is `order=&#39;c&#39;` and `Column-major` is `order=&#39;f&#39;`. Here is an example to show aht\r\n\r\n shape = (2000, 10)\r\n buffer = \" ; \" ;.join( \" ;{:5d} \" ;.format(i) for i in range(np.prod(shape)))\r\n x = np.ndarray(shape, &#39;S5&#39;, order=&#39;f&#39;, buffer=buffer)\r\n print x[0, 1]\r\n # &#39; 2000&#39;\r\n print x.flags\r\n # C_CONTIGUOUS : False\r\n # F_CONTIGUOUS : True\r\n # OWNDATA : False\r\n # WRITEABLE : False\r\n # ALIGNED : False\r\n # UPDATEIFCOPY : False\r\n x = np.ndarray((2000, 10), &#39;S5&#39;, order=&#39;c&#39;, buffer=buffer)\r\n print x[0, 1]\r\n # &#39; 1&#39;\r\n print x.flags\r\n # C_CONTIGUOUS : True\r\n # F_CONTIGUOUS : False\r\n # OWNDATA : False\r\n # WRITEABLE : False\r\n # ALIGNED : False\r\n # UPDATEIFCOPY : False\r\n\r\nThere are a few ways to force a memory layout in numpy, here are some:\r\n\r\n # When you create the array:\r\n x = np.empty((2000, 10), order=&#39;f&#39;)\r\n\r\n # Check the order and copy if needed:\r\n x = np.asfortranarray(x)\r\n\r\n # Force a copy:\r\n x_fortran = x.copy(order=&#39;f&#39;)\r\n\r\nNote that all 3 of these methods will produce a numpy array that is \" ;the same \" ;, ie will look the same to all python code:\r\n\r\n print np.all(x.copy(&#39;c&#39;) == x.copy(&#39;f&#39;))\r\n # True", "654" ], [ "You need to catch the return value of the `Number` function, ie:\r\n\r\n classNo = Number();\r\n playerClass = Class(classNo)\r\n print playerClass\r\n\r\nA few other pointers. By convention, we use lower_case or camelCase for variable and function names and we use Capital letters for Class names. Also, if you&#39;re using a lot of `elif` in a row you probably want a dictionary. Here is an example:\r\n\r\n possibleClasses = {1: \" ;Warrior \" ;,\r\n 2: \" ;<PERSON> \" ;,\r\n 3: \" ;<PERSON> \" ;,\r\n 4: \" ;Terrorist \" ;,\r\n 5: \" ;<PERSON> \" ;}\r\n \r\n def pickClass():\r\n for number, playerClass in possibleClasses.items():\r\n print number, \" ;: \" ;, playerClass\r\n classNo = raw_input( \" ;Pick you class:\\n \" ;)\r\n classNo = int(classNo)\r\n return classNo\r\n \r\n playerClass = pickClass()\r\n className = possibleClasses[playerClass]\r\n print className", "490" ], [ "The only way to modify an object and keep the original intact, in general, is to copy the original, I think you&#39;re looking for something like:\r\n\r\n def fun2(x):\r\n x = x.copy()\r\n for i in range(0, x.shape[0]):\r\n x[i, :] = 2*x[i, :]\r\n return x\r\n\r\nThen answer to your question regarding the apparent difference between fun1 and fun2 is that python, like most OOP languages, is pass-by-object-reference. The first function reassigns the variable declared in the function signature, but doesn&#39;t mutate it&#39;s input. The second, simply mutates it&#39;s input. the To learn more about this, take a look at this article, _URL_0_", "977" ], [ "I think a prefix style approach is the right one here, but we can do a little better than a vanilla prefix tree. I think we want to build a \" ;subset \" ; tree where each node is the child of (one of) it&#39;s longest subset which is also in the tree. That way the tree is more compact, for example \" ;abc \" ; and \" ;acd \" ; can both be children of \" ;ac \" ;.", "931" ], [ "This is a bit handwavy, maybe someone else wants to flush it out with the math :) but basically you&#39;ve windowed your \" ;pulse domain \" ; to be [-X/2, X/2] while the fft expects it to be windowed [0, X]. The difference is a shift in the \" ;pulse domain \" ;, which results in a phase shift in the frequency domain. Because you&#39;ve shifted by exactly half the window, the phase shift is exactly `exp(-pi * f * i / sampling_freq)` (or something like that) so it shows up as every other item being multiplied as `exp(-pi * i)`. You can fix this by shifting your \" ;pulse space \" ; before applying the fft.\r\n\r\n import matplotlib.pyplot as plt\r\n import numpy as np\r\n \r\n def plot_complex(space, arr):\r\n plt.figure()\r\n plt.plot(space, arr.real, label= \" ;real \" ;)\r\n plt.plot(space, arr.imag, label= \" ;imag \" ;)\r\n plt.legend(loc=&#39;upper left&#39;)\r\n \r\n lo = -10\r\n hi = 10\r\n num_samples = 1000\r\n sample_freq = num_samples/(hi-lo)\r\n linspace = np.linspace(lo, hi, num_samples)\r\n array = abs(linspace) < .5\r\n array_shifted = np.fft.fftshift(array)\r\n \r\n coeff = np.fft.fft(array_shifted, num_samples)\r\n \r\n # we need to shift the coefficients because otherwise negative frequencies are in the right half of the array\r\n coeff_shifted = np.fft.fftshift(coeff)\r\n \r\n plot_complex(linspace, array_shifted)\r\n plt.title( \" ;The unit pulse (shifted) \" ;)\r\n \r\n icoeff = np.ftt.ifftshift(np.fft.ifft(coeff))\r\n \r\n plot_complex(linspace, icoeff)\r\n plt.title( \" ;The recovered signal \" ;)\r\n \r\n freqspace = np.fft.fftshift(np.fft.fftfreq(1000)) * sample_freq\r\n plot_complex(freqspace, coeff_shifted)\r\n plt.title( \" ;DFT coefficients \" ;)\r\n \r\n plot_complex(freqspace[450:550], coeff_shifted[450:550])\r\n plt.title( \" ;Zoomed in \" ;)\r\n \r\n \r\n def flip_seconds(coeff):\r\n return np.array([(1 if i%2 == 0 else -1) * s for (i,s) in enumerate(coeff)])\r\n \r\n plot_complex(freqspace, flip_seconds(coeff_shifted))\r\n plt.show()", "616" ], [ "This answer is loosely based on the idea of prefix trees but it comes at the problem from a slightly different tact. Basically we want to figure out how we can avoid touching the entire search space when we enumerate all subsets by using some kind of early stoping.\r\n\r\nIf we arrange our data into a \" ;SubsetTree \" ; such that all the children of a node are supersets of that node, we can stop exploring tree whenever we reach a node that isn&#39;t a subset of our current query because we know all of it&#39;s children will also not be subsets. When we build the tree, we want to prefer long parents over short parents because that&#39;ll increase the amount of early stopping in our search.\r\n\r\nIf you put all this together it looks something like this:\r\n\r\n class SubsetTree:\r\n def __init__(self, key):\r\n self.key = key\r\n self.children = []\r\n \r\n def longestSubset(self, query):\r\n if not self.key.issubset(query):\r\n return None\r\n more = (x.longestSubset(query) for x in self.children)\r\n more = filter(lambda i: i is not None, more)\r\n return max(more, key=lambda x: len(x.key), default=self)\r\n \r\n def allSubsets(self, query):\r\n if not self.key.issubset(query):\r\n return\r\n if len(self.key) > 0:\r\n yield self.key\r\n for c in self.children:\r\n yield from c.allSubsets(query)\r\n \r\n\r\n def buildSubtree(sets):\r\n sets = sorted(sets, key=lambda x: len(x))\r\n tree = SubsetTree(frozenset())\r\n for s in sets:\r\n node = SubsetTree(s)\r\n tree.longestSubset(s).children.append(node)\r\n return tree\r\n \r\n dictionary = {\r\n frozenset([1]): 1,\r\n frozenset([2]): 2,\r\n frozenset([3]): 3,\r\n frozenset([3, 4]): 34\r\n }\r\n biglist= [3, 4, 5]\r\n \r\n subsetTree = buildSubtree(dictionary.keys())\r\n allSubsets = subsetTree.allSubsets(set(biglist))\r\n results = {k: dictionary[k] for k in allSubsets}\r\n assert results == {frozenset([3]): 3, frozenset([3, 4]): 34}", "954" ], [ "Starting the manager in a function shouldn&#39;t be an issue, but based on the question you&#39;ve asked I&#39;m not even sure you need manager. The managers are a bit advanced and can be avoided for many use cases.\n\nWe can&#39;t really red your mind here at stack overflow :), if you put time into asking a clear question that lays out your needs and requirements you&#39;ll get much better answers.", "1007" ], [ "`count` and `saveAsTable` are both actions that execute the the query plan that you&#39;re building in your code. Spark has a build-plan, execute-plan model similar to the compile-code, run-code model of some programming languages. All the parts of your code up to your action (eg count or save) are building the plan, the plan doesn&#39;t actually run until you hit the action. It seems your plan builds fine but is having trouble running (is slow, is throwing errors?). There are lots of reasons your plan could have issues running, we&#39;d need to see the code to help.", "407" ], [ "Some context, a list comprehension is a sort of \" ;imperative \" ; syntax for the `map` and `filter` functions that exist in many functional programing languages. What you&#39;re trying to do is usually referred to as an `accumulate`, which is a slightly different operation. You can&#39;t implement an `accumulate` in terms of a `map` and `filter` except by using side effects. Python allows you have side effects in a list comprehension so it&#39;s definitely possible but list comprehensions with side effects are a little wonky. Here&#39;s how you could implement this using accumulate:\r\n\r\n nums = [1,1,0,1,1]\r\n\r\n def accumulator(last, cur):\r\n return 1 if (last == 1 and cur == 1) else 0\r\n\r\n list(accumulate(nums, accumulator))\r\n\r\nor in one line:\r\n \r\n list(accumulate(nums, lambda last, cur: 1 if (last == 1 and cur == 1) else 0))\r\n\r\nOf course there are several ways to do this using an external state and a list comprehension with side effects. Here&#39;s an example, it&#39;s a bit verbose but very explicit about how state is being manipulated:\r\n\r\n class MyState:\r\n def __init__(self, initial_state):\r\n self.state = initial_state\r\n def getNext(self, cur):\r\n self.state = accumulator(self.state, cur)\r\n return self.state\r\n\r\n mystate = MyState(1)\r\n [mystate.getNext(x) for x in nums]", "91" ], [ "In general it&#39;s quite hard to kill a subprocess reliably because the subprocess can be executing uninterruptible code when you want to kill it. That being said, it sounds like a \" ;best effort \" ; approach might be appropriate for your case. You&#39;ll want to create and wait on your subprocess in a way allows you to clean up if the process is interrupted. The easiest way to do this is to put your subprocess in a try/finally block.\r\n\r\n try:\r\n print( \" ;starting subprocess \" ;)\r\n x = subprocess.Popen([ \" ;sleep \" ;, \" ;100000 \" ;])\r\n x.wait()\r\n finally:\r\n print( \" ;stopping subprocess \" ;)\r\n x.terminate()\r\n\r\nI believe spark sends an interrupt signal", "691" ], [ "Python has a sample function that does selection without replacment. You can sample from the indices and apply the sample to your inputs.\r\n\r\n from random import sample\r\n\r\n A = [&#39;cat&#39;, &#39;dog&#39;, &#39;cow&#39;, &#39;pig&#39;, &#39;monkey&#39;]\r\n B = [&#39;Felix&#39;, &#39;Fido&#39;, &#39;Moo&#39;, &#39;Trump&#39;, &#39;King Kong&#39;]\r\n k = 3\r\n\r\n samp = sample(range(len(A)), k)\r\n A_p = [A[i] for i in samp]\r\n B_p = [B[i] for i in samp]", "91" ], [ "Python&#39;s sort functions can take a key, you can use a lambda function to define the key you want to sort over. In this case, i&#39;d suggest sorting the indices and then applying the order to both `v` and `w`. For example:\r\n\r\n v = [60, 100 , 120] \r\n w = [20, 50, 30]\r\n order = sorted(range(len(v)), key=lambda i: v[i] / w[i], reverse=True)\r\n\r\n v_new = [v[i] for i in order]\r\n w_new = [w[i] for i in order]", "820" ], [ "The question doesn&#39;t mention numpy, but I thought I&#39;d add an answer using numpy because it handles this kind of thing really well. Numpy has an argsort that can be used to apply the ordering of any sort to other arrays, for example:\r\n\r\n import numpy as np\r\n\r\n v = np.array([60, 100 , 120])\r\n w = np.array([20, 50, 30])\r\n\r\n order = np.argsort(v / w)[<IP_ADDRESS>-1]\r\n v_new = v[order]\r\n w_new = w[order]\r\n\r\n`argsort` doesn&#39;t have a `reverse` argument, but we can always just invert the output using `[<IP_ADDRESS>-1]`.", "656" ], [ "I think the issue you&#39;re seeing is that all your processes share the same random seed, if I fix the bugs in your code and add a random seed to the distributed function, everything seems to work. Try commenting out the line with the random seed bellow and running it again.\r\n\r\n import multiprocessing\r\n import string\r\n import numpy\r\n \r\n class Test():\r\n def __init__(self, num):\r\n self.num = num\r\n self.out_come = multiprocessing.Manager().list()\r\n \r\n def func1(self):\r\n numpy.random.seed(self.num)\r\n for n in range(self.num): \r\n self.out_come.append(numpy.random.randn(1)[0])\r\n return self.out_come\r\n \r\n obj_l = []\r\n for s in range(1, 6):\r\n lettr = Test(s) # Initiating the class\r\n obj_l.append(lettr)\r\n \r\n proc = []\r\n for n in range(len(obj_l)):\r\n proc.append(multiprocessing.Process(target=obj_l[n].func1))\r\n \r\n for p in proc:\r\n p.start()\r\n for p in proc:\r\n p.join()\r\n \r\n for i in obj_l:\r\n print(i.out_come)\r\n\r\n # [1.6243453636632417]\r\n # [-0.4167578474054706, -0.056266827226329474]\r\n # [1.7886284734303186, 0.43650985051198943, 0.09649746807200862]\r\n # [0.05056170714293955, 0.<PHONE_NUMBER>, -0.9959089311068651, 0.6935985082913116]\r\n # [0.44122748688504143, -0.33087015189408764, 2.43077118700778, -0.2520921296030769, 0.10960984157818278]\r\n\r\nA few more things to keep in mind, you can&#39;t send a method to another process. What you&#39;re actually doing is sending the whole instance, then having the method called on that instance. I&#39;d recommend writing your distributed functions as top level functions with explicit arguments, that way it&#39;s cleared what&#39;s being transmitted between Processes. It&#39;ll help in debugging :).\r\n\r\nLastly I&#39;d highly recommend looking at `multiprocessing.Pool` and its `map` methods, especially `map_async` and `imap_unordered`. If you can express your workload as functions with explicit returns instead of stateful operations on shared objects, it&#39;ll both be easier to write your code & more performant in the long run.", "739" ], [ "`map` in python 3 doesn&#39;t pad with `None`, you&#39;ll need to do that yourself. You might want to use `zip_longest` and maybe starmap.\r\n\r\n[Python 2 docs for map](_URL_0_)\r\n\r\n > map(function, iterable, ...) Apply function to every item of iterable\r\n > and return a list of the results. If additional iterable arguments are\r\n > passed, function must take that many arguments and is applied to the\r\n > items from all iterables in parallel. If one iterable is shorter than\r\n > another it is assumed to be extended with None items. If function is\r\n > None, the identity function is assumed; if there are multiple\r\n > arguments, map() returns a list consisting of tuples containing the\r\n > corresponding items from all iterables (a kind of transpose\r\n > operation). The iterable arguments may be a sequence or any iterable\r\n > object; the result is always a list.\r\n\r\n[Python 3 docs for map](_URL_1_)\r\n\r\n > Return an iterator that applies function to every item of iterable,\r\n > yielding the results. If additional iterable arguments are passed,\r\n > function must take that many arguments and is applied to the items\r\n > from all iterables in parallel. With multiple iterables, the iterator\r\n > stops when the shortest iterable is exhausted. For cases where the\r\n > function inputs are already arranged into argument tuples, see\r\n > itertools.starmap().", "91" ], [ "Inheritance is probably the best way to do this, but since you asked specifically about decorators, I wanted to show you could do this using decorators.\r\n\r\nYou&#39;ll need to use a dictionary to store the your functions by version, then look up which version to use at runtime. Here&#39;s an example.\r\n\r\n version_store = {}\r\n\r\n def version(v):\r\n def dec(f):\r\n name = f.__qualname__\r\n version_store[(name, v)] = f\r\n def method(self, *args, **kwargs):\r\n f = version_store[(name, self.version)]\r\n return f(self, *args, **kwargs)\r\n return method\r\n return dec\r\n \r\n class Product(object):\r\n def __init__(self, version):\r\n self.version = version\r\n \r\n @version( \" ;1.0 \" ;)\r\n def function(self):\r\n print( \" ;1.0 \" ;)\r\n \r\n @version( \" ;2.0 \" ;)\r\n def function(self):\r\n print( \" ;2.0 \" ;)\r\n \r\n Product( \" ;1.0 \" ;).function()\r\n Product( \" ;2.0 \" ;).function()", "904" ], [ "You can put as many expressions into an `agg` as you want, when you collect they all get computed at once. The result is a single row with all the values. Here&#39;s an example:\r\n\r\n from pyspark.sql.functions import min, max, countDistinct\r\n \r\n r = df.agg(\r\n min(df.col1).alias( \" ;minCol1 \" ;),\r\n max(df.col1).alias( \" ;maxCol1 \" ;),\r\n (max(df.col1) - min(df.col1)).alias( \" ;diffMinMax \" ;),\r\n countDistinct(df.col2).alias( \" ;distinctItemsInCol2 \" ;))\r\n r.printSchema()\r\n # root\r\n # |-- minCol1: long (nullable = true)\r\n # |-- maxCol1: long (nullable = true)\r\n # |-- diffMinMax: long (nullable = true)\r\n # |-- distinctItemsInCol2: long (nullable = false)\r\n\r\n row = r.collect()[0]\r\n print(row.distinctItemsInCol2, row.diffMinMax)\r\n # (10, 9)\r\n\r\nYou can also use the dictionary syntax here, but it&#39;s harder to manage for more complex things.", "639" ], [ "DataFrames are dynamically typed, while Datasets and RDDs are statically typed. That means when you define a Dataset or RDD you need to explicitly specify a class that represents the content. This can be useful, because when you go to write transformations on your Dataset, the compiler can check your code for type safety. Take for example this dataset of Pet info. When I use `pet.species` or `_URL_0_` the compiler knows their types at compile time.\r\n\r\n case class Pet(name: String, species: String, age: Int, weight: Double)\r\n\r\n val data: Dataset[Pet] = Seq(\r\n Pet( \" ;spot \" ;, \" ;dog \" ;, 2, 50.5),\r\n Pet( \" ;mittens \" ;, \" ;cat \" ;, 11, 15.5),\r\n Pet( \" ;mickey \" ;, \" ;mouse \" ;, 1, 1.5)).toDS\r\n println(data.map(x = > x.getClass.getSimpleName).first)\r\n // Pet\r\n \r\n val newDataset: Dataset[String] = data.map(pet = > s \" ;I have a ${pet.species} named ${_URL_0_}. \" ;)\r\n \r\n\r\nWhen we switch to using a DataFrame, the schema stays the same and the data is still typed (or structured), but this information is only available at runtime. This is called dynamic typing. This prevents the compiler from catching your mistakes, but it can be very useful because it allows you to write sql like statements and defining new columns on the fly, for example appending columns to an existing DataFrame, without needing to define a new class for every little operation. This flip side is that you can define bad operations that result in nulls or in some cases, runtime errors.\r\n\r\n val df: DataFrame = data.toDF\r\n df.printSchema()\r\n // root\r\n // |-- name: string (nullable = true)\r\n // |-- species: string (nullable = true)\r\n // |-- age: integer (nullable = false)\r\n // |-- weight: double (nullable = false)\r\n \r\n val newDf: DataFrame = df\r\n .withColumn( \" ;some column \" ;, ($ \" ;age \" ; + $ \" ;weight \" ;))\r\n .withColumn( \" ;bad column \" ;, ($ \" ;name \" ; + $ \" ;age \" ;))\r\n newDf.show()\r\n // +-------+-------+---+------+-----------+----------+\r\n // | name|species|age|weight|some column|bad column|\r\n // +-------+-------+---+------+-----------+----------+\r\n // | spot| dog| 2| 50.5| 52.5| null|\r\n // |mittens| cat| 11| 15.5| 26.5| null|\r\n // | mickey| mouse| 1| 1.5| 2.5| null|\r\n // +-------+-------+---+------+-----------+----------+", "743" ] ]
37
[ 6615, 13661, 6884, 8747, 16289, 3593, 10453, 6068, 8444, 6899, 8525, 5071, 4058, 229, 12706, 3990, 6264, 7462, 3074, 19359, 9817, 17674, 8453, 12062, 10269, 10793, 10464, 18167, 12154, 7775, 792, 13156, 13778, 11631, 2676, 15749, 2634, 2526, 8368, 1412, 2384, 11537, 13181, 8375, 17242, 8218, 2679, 12680, 17828, 13399, 3504, 13635, 15820, 11261, 8943, 5874, 18073, 6395, 12406, 3862, 632, 7345, 17005, 6476, 19601, 17725, 18701, 17392, 151, 18819, 8485, 5039, 18103, 4552, 17910, 15181, 10606, 3905, 2101, 14382, 16822, 16684, 10359, 1411, 8655, 15338, 3954, 17936, 5682, 14923, 675, 8433, 11910, 18975, 10211, 10900, 114, 3107, 16216, 17479, 16537, 7030, 15147, 10938, 14341, 11786, 17948, 7842, 19291, 9909, 8305, 2022, 8676, 9527, 3458, 1408, 6050, 13446, 18929, 19740, 2121, 14442, 15493, 14543, 16790, 12307, 3244, 6216, 10160, 7906, 4738, 16658, 19170, 12315, 9406, 12031, 9635, 4723, 8620, 16906, 9393, 6523, 13264, 17634, 2305, 6002, 5468, 17986, 1508, 2649, 19030, 12261, 19080, 8561, 17448, 3419, 15156, 16367, 10638, 13331, 13837, 10254, 10105, 15773, 371, 17288, 13835, 13329, 14154, 667, 577, 8567, 7200, 12928, 4198, 8647, 7251, 2669, 19703, 8172, 5483, 19634, 13064, 9130, 2296, 19767, 13289, 5389, 57, 8613, 11809, 8963, 17188, 2675, 1559, 5233, 2491, 5459, 6668, 4694, 16039, 6579, 18586, 15142, 9379, 11463, 18332, 7837, 15334, 13903, 17490, 13783, 1368, 1823, 6935, 7301, 15977, 17527, 11280, 3731, 12574, 3022, 13666, 14028, 13667, 18676, 8034, 16714, 15770, 13655, 16917, 8211, 11363, 16844, 1758, 17772, 863, 11269, 1581, 1553, 10355, 11044, 18376, 3746, 15713, 7859, 9663, 13971, 1158, 13081, 16643, 11297, 12145, 10094, 10504, 15858, 199, 5432, 8512, 18254, 15494, 13176, 6225, 14027, 16210, 6025, 7541, 13077, 10588, 9269, 8582, 2705, 15186, 9555, 2497, 5526, 14888, 17272, 9425, 10468, 6600, 8456, 16173, 16062, 6475, 9197, 6706, 904, 1387, 10335, 5487, 18953, 12036, 6168, 8860, 5867, 15321, 17395, 11162, 17611, 8086, 5916, 4827, 14884, 10483, 9165, 18985, 3555, 1769, 13915, 5480, 16341, 13656, 6991, 18111, 8858, 1780, 19306, 5165, 18397, 10217, 13846, 8991, 15642, 10344, 9929, 16484, 16058, 10436, 10422, 1497, 3152, 16509, 9429, 5966, 19791, 1388, 3297, 6545, 17697, 19089, 13830, 4699, 12317, 1743, 18214, 17388, 7414, 221, 6158, 1978, 13633, 15558, 18532, 11484, 9654, 12675, 2632, 6495, 10973, 7032, 9536, 3379, 13895, 5735, 8032, 9304, 13206, 13150, 160, 15168, 13592, 314, 11994, 922, 8506, 14584, 6371, 1446, 6860, 9888, 18940, 17890, 8755, 18038, 7273, 10272, 17111, 13613, 8232, 3080, 5475, 11247, 20, 7340, 12806, 5033, 10063, 14307, 3663, 17922, 14434, 10997, 17292, 6864, 5802, 13551, 13473, 12226, 702, 10559, 3942, 3350, 7931, 10734, 15489, 14200, 11040, 14742, 18876, 7730, 15174, 10387, 14357, 6234, 1761, 3274, 12524, 1935, 16810, 4952, 10201, 575, 6786, 5067, 7326, 16418, 5638, 18678, 5326, 8563, 589, 17375, 1856, 15100, 13429, 3810, 5964, 956, 1258, 1025, 15433, 15907, 6774, 16934, 15367, 5147, 5041, 1651, 17574, 8764, 126, 1119, 10977, 16020, 1458, 17506, 5275, 2005, 2476, 14465, 5732, 3796, 15319, 13576, 8970, 13196, 14494, 6789, 18549, 1320, 14956, 4691, 6027, 3748, 11576, 6261, 13013, 14722, 9091, 2697, 3690, 4619, 5605, 10238, 6573, 2224, 19078, 1763 ]
STX_100430.0
[ [ "Pursuant to [this Meta discussion][1], I propose the following:\r\n\r\nAll questions should be closed as soon as they have one answer, with the following notice:\r\n\r\n > This question already has an answer. If those answers do not fully\r\n > address your question, please ask a new question.\r\n\r\n\r\nNow I do not actually think this is a good idea, but it seems to me to logically follow from the upvoted answer there (see the comments there at length). Therefore, should this be implemented so that the policies are consistent?\r\n\r\n\r\n----------\r\n\r\n\r\n## Edit ##\r\n\r\nThose who voted to close this question as primarily opinion-based, please see [this Meta post][2].\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "1018" ], [ "<PERSON> You don&#39;t need to address the specific number of students in each house in order to address whether there is even distribution. In fact, the accepted answer simply derived the number of students per house by taking the alleged total number of students and assuming an even distribution and dividing by 4. And you certainly don&#39;t need to address the house distribution in order to address the total number of students.", "197" ], [ "@Valorum If an answer fully addresses the question that was asked you can&#39;t call it a partial answer for not also addressing what was not asked. If I find a passage that shows that there are/aren&#39;t house quotas but says nothing about the total number of students, that wouldn&#39;t be a partial answer. It would be a complete answer as it addresses the question completely. Therefore, since it is theoretically possible to answer the question without a discussion of total number of students it doesn&#39;t meet the condition of *any good answer to one question would have to satisfactorily answer the other*", "197" ], [ "@Edlothiad But a good answer could also have not addressed it. The fact that a particular answer here happened to address it is irrelevant. Anyone can throw anything into an answer. That doesn&#39;t make a different question a duplicate. If you can&#39;t reasonably answer one without answering the other, that&#39;s a different story, and that could be grounds for a duplicate.", "10" ], [ "<PERSON> I would actually call that a lose-lose. It would be a lot simpler for them to have a question which actually asks their question, and thereby solicits good answers to that question, then to have to be redirected to a different question and read through a lot of unnecessary information and hope to find the answer to their question in there, in one answer which may or may not be good, on a question which certainly isn&#39;t specifically soliciting good answers to their question.", "359" ], [ "The [closed question][1] was reopened by 5 voters, and I managed to post [an answer][2] to it before it was summarily reclosed by a single voter with a gold badge.\r\n\r\nAs you can see, my answer cites many passages to develop an argument that there were many hundreds of students, probably around 800. My answer does not in any way shape or form address whether there are house quotas. I can&#39;t imagine that anyone thinks that my answer would be a good answer to [the question about house quotas][3].\r\n\r\nThat should be all the proof necessary to show that the questions are not duplicates. As I pointed out in the question post here, and in subsequent comments, closing such questions as duplicates prevents potentially good answers from being posted.\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_1_\r\n [3]: _URL_0_", "10" ], [ "@TheLethalCarrot Looking at it from both sides leads to the same conclusion. None of the evidence cited in my answer was cited in the answer to the open question. And there&#39;s a reason for that – it&#39;s not what the open question was asking for. Therefore, to close the question because an answer to a different question made one point relating to this question, only serves to prevent good answers to the closed question.", "1018" ], [ "I&#39;ll take one more stab at this\r\n--------------------------------\r\n\r\nLet&#39;s imagine a good sample answer to each one. To my mind, you can&#39;t get better than an answer which quotes a specific passage in the series under discussion where the question is explicitly answered.\r\n\r\nSo, here is my sample answer to [the open question][1]:\r\n\r\n > Yes, there are house quotas. If Harry&#39;s name was <PERSON> it is\r\n > possible that he would have been sorted into <PERSON>. This can be\r\n > demonstrated from the following quote from <PERSON>*:\r\n > \r\n > > \" ;I actually had a great uncle in Slytherin, \" ; <PERSON> said.\r\n > > \r\n > > \" ;Really? \" ; asked <PERSON>, surprised.\r\n > > \r\n > > \" ;Well it wasn&#39;t his fault. By the time they got up to Weasely there\r\n > > were no spots left in Gryffindor or Hufflepuff, and he wasn&#39;t clever\r\n > > enough to get into Ravenclaw. \" ;\r\n\r\n\r\nAnd here is my sample answer to [the closed question][2]:\r\n\r\n > There are 2,500 students attending Hogwarts. This can be seen from the\r\n > following quote from *Order of the Phoenix*:\r\n > \r\n > > \" ;<PERSON>, <PERSON> said she would confiscate every broomstick in the\r\n > > castle if she has to! \" ;\r\n > > \r\n > > \" ;Er, <PERSON>, there are 2500 students here. Does she really think she\r\n > > can fit 2,500 brooms in her office? \" ;\r\n > > \r\n > > \" ;Come off it, <PERSON>. You know that most students don&#39;t even have their own brooms. \" ;\r\n\r\n**As you can see, these answers have absolutely nothing in common.** Each one would be a great answer to the question it would be posted to (assuming the quotes are accurate), but would be a horrible answer to the other question.\r\n\r\nThis shows, beyond any doubt, that these are two fundamentally different questions. If one of these questions is closed then there is a great answer that will never be posted, as it would be a horrible answer to the other question.\r\n\r\n\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "391" ], [ "<PERSON> I believe I showed that it goes both ways. See my other answer here for more on that. As for whether my answer to the closed question was good, it&#39;s hard to judge based on how many votes it has. Voting on late answers is much less reliable, especially on closed questions. I also don&#39;t discount the possibility that people may be voting on that answer as an extension of the Meta discussion.", "1018" ], [ "@TheLethalCarrot If a case is that something could theoretically exist, then making something up would support the case. As that is my case ( \" ;an answer could exist that would answer one question without addressing the other \" ;) all I have to do to prove my point is make up an such an answer. To refute my point you would have to show why such an answer **couldn&#39;t** exist. We all know that the quotes don&#39;t actually exist, but there is no reason why such quotes **couldn&#39;t** exist. Thus, I am not sure why <PERSON> asserts that it is implausible, or why you think this post doesn&#39;t prove anything.", "686" ], [ "@TheLethalCarrot That is incorrect. Making up an answer wouldn&#39;t prove your point. You could make up all the answers in the world but it still wouldn&#39;t show that there can&#39;t be other answers that could address one question but not the other. I, however, by making up examples where an answer **does** address one without the other, have proven my point, namely that these must therefore be two different questions, and the closure of one of them prevents a set of potential answers (those that would address the closed question without addressing the open question) from ever being posted.", "14" ], [ "New Solution/Compromise\r\n-----------------------\r\n\r\n\r\nI have not changed my mind from my question and previous two answers where I strongly argued that the two questions are not duplicates. However, even if we assume that the questions are duplicates, there is another possible solution.\r\n\r\nIn this case, [the question about the number of students in Hogwarts][1] was closed as a duplicate of [the question about whether houses have quotas][2] because in [an answer to the latter question][3] [Slytherincess][4] discussed the number of students at Hogwarts. I.e. since the number of students was discussed in an answer to another question it is considered as if the question about the number of students has already been answered.\r\n\r\nNow if we look at Slytherincess&#39;s actual answer we find that there are only two mentions of the number of students in Hogwarts. The first paragraph mentions two aspects of this:\r\n\r\n 1. <PERSON> once said that there are around 1,000 students.\r\n 2. There is an article that discusses the number of students.\r\n\r\nIn the third paragraph she writes that the linked article suggests that **if there were** 1,000 students (the article disagrees with this estimate) there would be 36 per year per house.\r\n\r\nBeyond this there is no other mention of number of students. \r\n\r\nWhen we read the rest of the answer (which argues that there are not quotas) we see that none of the argumentation is supported by the alleged number of students. No argumentation is contradicted by it either, but no argumentation is related to it.\r\n\r\nThere is only one line of evidence that is actually related to the question of quotas, and that is whether the Sorting Hat has ever placed a student into the wrong house. <PERSON> notes that the Sorting Hat admits that it is possible for it to make a mistake, but that <PERSON> has stated that it has never been wrong. (Even this doesn&#39;t fully address the quota question; all it tells us is that according to <PERSON> no one was ever sorted into a house other than the one they should have been in.)\r\n\r\n**What we see here is that the alleged number of students played no role whatsoever in answering the question; it is entirely extraneous information.**\r\n\r\nIf all mention of the number of students would be removed we would still have the same answer, namely, that there do not seem to be quotas based on Rowling&#39;s statement that the Sorting Hat was never wrong.\r\n\r\nTherefore, why don&#39;t we simply edit Slytherincess&#39;s answer and remove all mention of the number of student&#39;s at Hogwarts, which would not affect her answer to the question about quotas. Then the other question would not be a duplicate, and could be reopened and receive all the possible answers to the specific question of how many students there are at Hogwarts.\r\n\r\nI would imagine that ideally, <PERSON> herself should edit her answer. However, she hasn&#39;t been seen on this site in almost a month, so that is unlikely to happen.\r\n\r\nThe best solution would then seem to be for us to make the edits, which will now allow answers to the question of how many students there are that would otherwise not have been postable. \r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_1_\r\n [3]: _URL_0_\r\n [4]: _URL_3_", "391" ], [ "It is pretty simple in the Wizarding World to track someone&#39;s whereabouts.\r\n\r\nWhen <PERSON> receives his initial letters from Hogwarts, the person writing the address was able to know where he was at a given time. They knew when he was in the cupboard under the stairs, they knew when he moved to Dudley&#39;s second bedroom, they knew when they went to a hotel and even knew which room they were in, and they knew that <PERSON> was on the floor of a hut on a rock in the sea.\r\n\r\nAdditionally, we find that <PERSON> is able to send letters to <PERSON> all the time despite having no idea where <PERSON> is. If an owl can track someone, then presumably a wizard can too, or at the very least a wizard can follow an owl to track someone.\r\n\r\nIn later books we also find out that underage wizards have a \" ;trace \" ;, and that taboos can be created that give people&#39;s locations.\r\n\r\nThus, while we are never told the precise method that <PERSON> used to track Harry&#39;s whereabouts, and some methods are probably beyond the ability of a single wizard on the run with no wand, the idea of tracking someone&#39;s whereabouts is hardly a novelty and it is therefore not very surprising that <PERSON> was able to figure out some way to locate <PERSON>.", "391" ], [ "There are several factors that may have come together to provide some of the details of what had happened.\r\n\r\nThere may have been some indication that something had happened to <PERSON> because people who had been under his enchantments would have been released. <PERSON> notes this effect when he first tells <PERSON> the story in *Philosopher&#39;s Stone* Chapter Four:\r\n\r\n\r\n > People who was on his side came back ter ours. Some of ’em came outta\r\n > kinda trances. Don’ reckon they could’ve done if he was comin’ back.\r\n\r\nSo as soon as Voldemort&#39;s curse rebounded on him, there may have been dozens of people who recovered from enchantments. This would have been an immediate clue that something had happened.\r\n\r\nWe also know that it was known that <PERSON> was targeting the Potters. This fact was known by at least <PERSON>, <PERSON>, <PERSON>, <PERSON>, and <PERSON>, and possibly others. They may have arranged some sort of check-in system to constantly verify that they were still safe, and when they failed to check in it was clear that something had happened. Indeed, in *Prisoner of Azkaban* Chapter 17 <PERSON> mentions that he had arranged a check-in with <PERSON>:\r\n\r\n > I’m to blame, I know it. ... The night they died, I’d arranged to\r\n > check on <PERSON>, make sure he was still safe, but when I arrived at\r\n > his hiding place, he’d gone. Yet there was no sign of a struggle. It\r\n > didn’t feel right. I was scared. I set out for your parents’ house\r\n > straight away. And when I saw their house, destroyed, and their\r\n > bodies ... I realized what <PERSON> must’ve done ... what I’d done. ...”\r\n\r\nThere may have also been witnesses in Godric&#39;s Hollow who saw some kind of attack/explosion and reported it.\r\n\r\nPutting these facts together, it is certainly possible that someone would have been dispatched to the <PERSON> house to investigate. The investigator would likely have found the dead bodies of <PERSON> and <PERSON>, and possibly the dead body of <PERSON>. It would be relatively easy to surmise that <PERSON> had killed <PERSON> and <PERSON>, and somehow died himself in the process. If there were no other signs of damage to the bodies that would probably be indicative of *Avada Kedavra*.\r\n\r\nAdditionally, an investigator might have found Voldemort&#39;s wand. A simple *Prior Incantato* would have revealed that <PERSON> had just cast three Killing Curses. As only two people were dead, this could have indicated that <PERSON> had survived. (Of course this could also be explained by simply saying that one of the curses missed its target.) Furthermore, an investigator might have noticed Harry&#39;s scar and guessed that that was somehow related to what had happened.\r\n\r\nThough it does seem from the books that there was no one else there when <PERSON> arrived, it is possible that someone else was sent first to see what had happened, and immediately reported back (to <PERSON>?) without doing anything at the scene of the crime.\r\n\r\nThere doesn&#39;t seem to be any evidence that the general Wizarding World knew of Voldemort&#39;s defeat before the next morning, but it is quite possible that that&#39;s how long it took for the news to spread from those in the know to the general populace.", "416" ], [ "@TheLethalCarrot How is this not treating it case by case? And while the top answer does not necessarily agree with the question, it does say that removing 80% of a post is vandalism. The implication of that is that something significantly less than 80% would not be vandalism. My suggestion here is to only remove a little bit of content, so it would not necessarily be vandalism. Moreover, the second answer there (which only has one fewer vote) seems to allow for any removal of content (with a reasonable warning time), which also suggests that it is not vandalism.", "734" ], [ "Mr. <PERSON> would not have had to known any of the specifics of Sirius&#39;s betrayal.\r\n\r\nLet&#39;s assume he knows the following:\r\n\r\n - <PERSON> and <PERSON> were best friends.\r\n - <PERSON> was always presumed to be on the good side, a staunch anti-Voldemortian.\r\n - <PERSON> and <PERSON> were murdered by <PERSON> on the very day that <PERSON>\r\n was discovered to be working for <PERSON>.\r\n - <PERSON> is looking to kill <PERSON> now as well.\r\n - Based on the above, <PERSON> was likely involved in some way with the <PERSON> tragedy, even if the details are unknown.\r\n\r\nMr. <PERSON>, knowing this, puts himself in Harry&#39;s shoes and realizes that knowing the above information could easily arouse in <PERSON> the desire to go after <PERSON>. Even if <PERSON> would never know that <PERSON> was the secret-keeper and directly told <PERSON> how to get to the <PERSON>, there is enough here to spark <PERSON> to action, particularly given Harry&#39;s propensity to get involved in things.\r\n\r\nTherefore, it makes perfect sense for Mr. <PERSON> to try to prevent <PERSON> from going after <PERSON>, even though he himself (Mr. <PERSON>) was unaware of the extent of Sirius&#39;s betrayal.", "416" ], [ "@TheLethalCarrot Can you point to one thing in that answer that relates to quotas that is derived from the first paragraph about number of students? The entire answer is mostly speculation, with one bit of evidence from a quote about whether the Sorting Hat was ever wrong, none of which flows from the number of students. Thus, while the number of students might be an interesting fact, it has absolutely nothing to do with the answer, and most certainly is not a necessary fact to answer the question.", "686" ], [ "<PERSON> I understand your point, and that&#39;s why I didn&#39;t just directly edit it myself, but instead brought it up for discussion here. However, if something is truly tangential (such that nothing in the answer would be affected by removing it) then it&#39;s not really that \" ;harmful \" ; to remove it. Especially considering that according to this duplicate policy, **including tangential information is actively harmful** because it can prevent answers to other questions from being posted. Of course, though, this proposal is only if my other arguments aren&#39;t accepted.", "936" ], [ "<PERSON> The second example is not about two entirely unrelated questions. A major aspect of the Potters&#39; death was the secret-keeper situation; a discussion of whether <PERSON> set them up to die could certainly take that into account. While the two questions are **different** they are not **unrelated**. Just like the questions about house quotas and number of students in Hogwarts are different questions yet are related.", "391" ], [ "@Edlothiad House quotas are indeed related to number of students, but related does not = duplicate. The only way to derive number of students from house quotas is if a particular answer for house quotas is correct, and within that answer being correct we also know certain details, and even with a particular answer being correct and knowing certain details we still wouldn&#39;t know how many students there are, but only the maximum number of students that there could be.", "197" ], [ "@Edlothiad In point of fact, though, the answer did not derive the number of students from knowing whether there are quotas. Just the opposite. It tried to argue that there are quotas from knowing the number of students, and it failed to show how the latter flowed from the former. Indeed, I would argue that my examples are even more duplicatey than this case because in this case the duplicate content did not contribute to the answer (I.e. remove the content the answer is the same) whereas in my examples the duplicate content did contribute to the answers.", "197" ], [ "@Edlothiad One doesn&#39;t need to address the number of beds to determine whether there is a quota. Indeed, the answer did not, except to assert (without evidence) that the Sorting Hat wouldn&#39;t care about number of beds. One also would not need to know whether student numbers are above or below the number of beds in order to address the number of beds.", "197" ], [ "This is discussed by <PERSON> and <PERSON> when <PERSON> begged them not to kill him in the Shrieking Shack at the end of *Prisoner of Azkaban*. The reason was that they didn&#39;t know who the spy was and <PERSON> was a suspect.\r\n\r\n > “<PERSON>!” <PERSON> squeaked, turning to <PERSON> instead, writhing\r\n > imploringly in front of him. “You don’t believe this ... wouldn’t\r\n > <PERSON> have told you they’d changed the plan?” \r\n > \r\n > “Not if he thought I was the spy, <PERSON>,” said <PERSON>. “I assume\r\n > that’s why you didn’t tell me, <PERSON>?” he said casually over\r\n > <PERSON>’s head. \r\n > \r\n > “Forgive me, <PERSON>,” said <PERSON>. \r\n > \r\n > “Not at all, <PERSON>, old friend,” said <PERSON>, who was now rolling up\r\n > his sleeves. “And will you, in turn, forgive me for believing you\r\n > were the spy?” \r\n > \r\n > “Of course,” said <PERSON>, and the ghost of a grin flitted across his\r\n > gaunt face. He, too, began rolling up his sleeves. “Shall we kill him\r\n > together?”\r\n\r\nThus, the reason for not telling <PERSON> was deliberate (they didn&#39;t trust him) and not that they simply didn&#39;t have time to tell him (as [another answer][1] suggests). In fact, we know from *Prisoner of Azkaban* Chapter 10 that there was at least a full week between the performance of the Fidelius Charm and the deaths of the <PERSON>:\r\n\r\n > “But <PERSON> insisted on using <PERSON>?” \r\n > \r\n > “He did,” said <PERSON> heavily. “And then, barely a week after the\r\n > Fidelius Charm had been performed — ” \r\n > \r\n > “<PERSON> betrayed them?” breathed Madam <PERSON>. \r\n > \r\n > “He did indeed.\r\n\r\n \r\n\r\n\r\n [1]: _URL_0_", "416" ], [ "<PERSON> The fact that knowledge of certain facts can lead you to figure out other facts doesn&#39;t mean that the other facts are necessary to answer a question about the certain facts. And note that that is not even what happened in this case. Nowhere in her answer did <PERSON> demonstrate a connection between the number of students she alleged, and her statement that there are probably not quotas. As <PERSON> argued, the number of students set the scene and flowed into the discussion of quotas, which is the reverse of what you are saying.", "686" ], [ "It seems likely that the same requirement exists for the Imperius Curse that exists for the Cruciatus Curse. When <PERSON> uses the Imperius Curse for the first time in Gringotts, we see the following:\r\n\r\n**Deathly Hallows Chapter 26**\r\n\r\n > “We’re in trouble; they suspect,” said <PERSON> as the door slammed\r\n > behind them and he pulled off the Invisibility Cloak. <PERSON> jumped\r\n > down from his shoulders; neither <PERSON> nor <PERSON> showed the \r\n > slightest surprise at the sudden appearance of <PERSON>Potter in their\r\n > midst. “They’re Imperiused,” he added, in response to <PERSON> and\r\n > <PERSON>’s confused queries about <PERSON> and <PERSON>, who were both now \r\n > standing there looking blank. “I don’t think I did it strongly\r\n > enough, I don’t know....” \r\n > \r\n > And another memory darted through his mind, of the real Bellatrix\r\n > <PERSON> shrieking at him when he had first tried to use an\r\n > Unforgivable Curse: “You need to *mean* them, <PERSON>!”\r\n\r\nHere <PERSON> seems to apply the same standard to both curses.\r\n\r\nThis makes sense, as Bellatrix&#39;s statement itself referred to the Unforgivable Curses in general:\r\n\r\n**Order of the Phoenix Chapter 36**\r\n\r\n > \" ;Never used an Unforgivable Curse before, have you, boy? \" ; she yelled.\r\n > She had abandoned her baby voice now. \" ;You need to *mean* them,\r\n > <PERSON>!\r\n\r\nSimilarly, a comment from <PERSON> at the end of *Half-Blood Prince* seems to equate all the Unforgivable Curses:\r\n\r\n > \" ;No Unforgivable Curses from you, <PERSON>! \" ; he shouted over the rushing\r\n > of the flames, Hagrid&#39;s yells, and the wild yelping of the trapped\r\n > <PERSON>. \" ;You haven&#39;t got the nerve or the ability – \" ;", "416" ], [ "Is there actually any proof that <PERSON> knew that <PERSON> was in Gryffindor? It&#39;s certainly likely, but he wasn&#39;t a teacher when <PERSON> was at Hogwarts, so it&#39;s possible that he never interacted with him at Hogwarts in a capacity that would reveal Sirius&#39;s house. He seems to have known that <PERSON> was friends with <PERSON>, but that doesn&#39;t automatically mean they would be in the same house, and perhaps he didn&#39;t even know what house <PERSON> was in. Indeed, the way <PERSON> refers to <PERSON> in Chapter 1 of *Philosopher&#39;s Stone* makes it sound like <PERSON> is almost a stranger.", "416" ], [ "In *Goblet of Fire* Chapter 14 Professor <PERSON> showed Harry&#39;s Defense Against the Dark Arts class the Unforgivable Curses. He used spiders to demonstrate the curses.\r\n\r\nIs there any particular reason why he needed to use a different spider for each of the three curses? Why couldn&#39;t he just have done the Cruciatus Curse on the same spider that he had done the Imperius Curse on, and then done the Killing Curse on that same spider as well?\r\n\r\nEven if he did not know in advance which order he would demonstrate the curses in, he would have only needed two spiders in case he did the Killing Curse first.\r\n\r\nSo is there any particular reason why separate spiders were necessary? Would the effects of the curses not been the same, or not as apparent, if the spider had just been subjected to a different Unforgivable Curse?", "416" ], [ "These are the memories that I found explicitly mentioned in the books:\r\n\r\n - **First time riding a broomstick.**\r\n\r\n > <PERSON> cast his mind about for a happy memory. Certainly, nothing that had happened to him at the <PERSON>’ was going to do. Finally, he settled on the moment when he had first ridden a broomstick.\r\n\r\n - **Winning the House Championship in Second Year.**\r\n\r\n > <PERSON> thought hard and decided his feelings when <PERSON> had won the House Championship last year had definitely qualified as very happy.\r\n\r\n - **Finding out that he was a wizard.**\r\n\r\n > The moment when he’d first found out he was a wizard, and would be leaving the <PERSON> for Hogwarts! If that wasn’t a happy memory, he didn’t know what was. ... Concentrating very hard on how he had felt when he’d realized he’d be leaving Privet Drive, <PERSON> got to his feet and faced the packing case once more.\r\n\r\n - **Going to live with <PERSON>.**\r\n\r\n > I’m going to live with my godfather. I’m leaving the <PERSON>. \r\n > \r\n > He forced himself to think of <PERSON>, and only <PERSON>, and began to chant: “*Expecto Patronum! Expecto Patronum!*”\r\n\r\n - **Celebrating winning the Triwizard Tournament with <PERSON> and <PERSON>.**\r\n\r\n > He summoned the happiest thought he could, concentrated with all his might on the thought of getting out of the maze and celebrating with <PERSON> and <PERSON>, raised his wand, and cried, “*Expecto Patronum!*”\r\n\r\n - **Thinking of <PERSON> and <PERSON>.**\r\n\r\n > He was never going to see <PERSON> and <PERSON> again — \r\n > \r\n > And their faces burst clearly into his mind as he fought for breath —\r\n > \r\n > “*EXPECTO PATRONUM!*”\r\n\r\n\r\n - **Imagining <PERSON> getting sacked.**\r\n\r\n\r\n > <PERSON> raised his wand, looked directly at <PERSON>, and imagined her being sacked. \r\n > \r\n > “*Expecto Patronum!*”\r\n\r\n - **Thinking of <PERSON> and <PERSON>.**\r\n \r\n > He raised his wand: He could not, would not, suffer the Dementor’s Kiss, whatever happened afterward. It was of <PERSON> and <PERSON> that he thought as he whispered, “*Expecto Patronum!*”\r\n\r\n(Interestingly, aside from the lesson with <PERSON> in which <PERSON> used happy memories, it appears that every other time where it&#39;s mentioned he actually uses a happy *thought* rather than a happy *memory*.)", "416" ], [ "There is another instance where it seems clear that <PERSON> forgot something that she read in a book. In *Prisoner of Azkaban* Chapter Eleven we find the following:\r\n\r\n > “I’m sure I’ve read about a case of hippogriff-baiting,” said\r\n > <PERSON> thoughtfully, “where the hippogriff got off. I’ll look it up\r\n > for you, <PERSON>, and see exactly what happened.”\r\n\r\nHere it is clear that <PERSON> read something about hippogriff-baiting but she does not remember what it was (or at least does not remember the details). This seems to parallel the case of her not remembering what she read about the Chamber of Secrets in *Hogwarts: A History*. \r\n\r\n\r\nAdditionally, <PERSON> admits to a mistake on one of her exams in *Order of the Phoenix*:\r\n\r\n\r\n\r\n\r\n > “I mistranslated ‘ehwaz,’ ” said <PERSON> furiously. “It means\r\n > ‘partnership,’ not ‘defense,’ I mixed it up with ‘eihwaz.’ ”\r\n\r\nPresumably, this means that she forgot something.\r\n\r\n\r\nThus, to answer the question here of:\r\n\r\n > Alternatively, are there other examples of <PERSON> forgetting things\r\n > she had read/known, that would establish a pattern of her being a\r\n > normal human being that forgets things?\r\n\r\nThe answer is yes.", "542" ], [ "A Muggle-born is someone who has no wizarding lineage.\r\n\r\nA Pure-blood is someone who has no Muggle lineage.\r\n\r\nA Half-Blood is someone who has both wizarding lineage and Muggle lineage.\r\n\r\nThus in all four of your cases the offspring would be a half-blood.\r\n\r\n\r\nA few relevant quotes:\r\n\r\n\r\n\r\n**Deathly Hallows**\r\n\r\n > “‘Recent research undertaken by the Department of Mysteries reveals\r\n > that magic can only be passed from person to person when Wizards\r\n > reproduce. Where no proven Wizarding ancestry exists, therefore, the\r\n > so- called Muggle-born is likely to have obtained magical power by\r\n > theft or force.\r\n\r\n**Ibid**\r\n\r\n > “I know,” said <PERSON>. “Nevertheless, unless you can prove that you\r\n > have at least one close Wizarding relative, you are now deemed to\r\n > have obtained your magical power illegally and must suffer the \r\n > punishment.”\r\n\r\n**Half Blood Prince**\r\n\r\n > “The Death Eaters can’t all be pure-blood, there aren’t enough\r\n > pure-blood wizards left,” said <PERSON> stubbornly. “I expect most of\r\n > them are half-bloods pretending to be pure. It’s only Muggle-borns\r\n > they hate, they’d be quite happy to let you and <PERSON> join up.”", "391" ], [ "[This question][1] was closed as a duplicate of [this question][2]. The reason stated was that the the answers to the latter question address the former question as well. The problem is that the two questions are different. The content of the answers to the second question that addressed the first question is not content that would automatically be necessary to answer the second question. If someone would answer the second question with just that content, it would not be an answer because that content alone does not answer the second question. \r\n\r\nNow suppose someone wants to answer the first question. There is nowhere to do so. You can&#39;t answer it on the first question because that question is closed. You can&#39;t answer it on the second question because it wouldn&#39;t answer the second question. How, then can the first question be closed as a duplicate of the second question, when that is effectively saying that we are not allowing any other answers to the question? \r\n\r\nSee also [here][3], [here][4], [here][5], [here][6], [here][7], [here][8], [here][9], [here][10], and [here][11] which seem to agree that this type of question should not be considered a duplicate.\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_5_\r\n [3]: _URL_4_\r\n [4]: _URL_9_\r\n [5]: _URL_1_\r\n [6]: _URL_8_\r\n [7]: _URL_2_\r\n [8]: _URL_10_\r\n [9]: _URL_3_\r\n [10]: _URL_7_\r\n [11]: _URL_6_", "10" ], [ "***Prisoner of Azkaban* Chapter 22**\r\n\r\n > But the thing that was lowering <PERSON>’s spirits most of all was the \r\n > prospect of returning to the <PERSON>. For maybe **half an hour, a\r\n > glorious half hour**, he had believed he would be living with <PERSON>\r\n > from now on . . . his parents’ best friend. ... It would have been\r\n > the next best thing to having his own father back. [My emphasis]\r\n\r\n***Goblet of Fire* Chapter 2**\r\n\r\n > For **one glorious hour**, <PERSON> had believed that he was leaving the\r\n > <PERSON> at last, because <PERSON> had offered him a home once his name\r\n > had been cleared. [My emphasis]\r\n\r\nSo how long did <PERSON> really believe this for?", "542" ], [ "In *Prisoner of Azkaban* Chapter 22 <PERSON> tells <PERSON> the following:\r\n\r\n > <PERSON> took the order to the Owl Office for me. I used your name\r\n > but told them to take the gold from my own Gringotts vault. Please\r\n > consider it as thirteen birthdays’ worth of presents from your\r\n > godfather.\r\n\r\nAs <PERSON> was 13 years old at the time, this indicates that the Firebolt counted as a present for all 13 of his birthdays.\r\n\r\nHowever, in *Deathly Hallows* Chapter 10 we find out that <PERSON> had in fact given <PERSON> a present for his first birthday:\r\n\r\n > *Dear <PERSON>, Thank you, thank you, for <PERSON>’s birthday present! It was his favorite by far. One year old and already zooming along on a\r\n > toy broomstick, he looked so pleased with himself, I’m enclosing a\r\n > picture so you can see.*\r\n\r\n\r\nThis being the case, he really only \" ;owed \" ; him 12 years of presents, so why did he get him a present worth 13 years of presents?\r\n\r\nIs it possible that he meant the Firebolt to also exempt him from getting <PERSON> a present for his 14th birthday?", "416" ], [ "I don&#39;t think your first paragraph is true. If we delete the part of her answer that talks about how many total students there were, it would not affect her answer. She doesn&#39;t provide any evidence that shows that because there are X number of students they are evenly distributed. She just says there seem to be X number of students and they seem to be evenly distributed.", "197" ], [ "As for your third paragraph, my point is not about whether duplicates are considered a bad thing. My point is that by closing something as a duplicate when it was not in fact asked prevents it from getting answers. It can&#39;t get answers where it was asked because the question is closed, and it can&#39;t get answered on the original question because that&#39;s a different question.", "10" ], [ "I don&#39;t think this answers the question. The only part that seems relevant to the question is the quote. The quote implies that the Sorting Hat will never put someone in the wrong house. So at least we know that someone would not get put in a different house because of a quota. But it doesn&#39;t really tell us much more than that. and the rest of the answer seems to be speculation.", "432" ], [ "The system feature makes sense when the same question was actually asked. Then it doesn&#39;t prevent new answers because you can answer the second question on the first question. When the same question was not asked it prevents new answers because there is nowhere to answer the second question. This would be like saying that all questions should be closed as soon as they have one answer, because the question has already been answered. This would, of course, run counter to a fundamental purpose of Stack Exchange.", "10" ], [ "The fact that Harry&#39;s wand shares a core with Voldemort&#39;s does not make him invincible to <PERSON>. This is clearly evidenced by the fact that in the graveyard <PERSON> was able to perform several curses on <PERSON> without anything out of the ordinary happening.\r\n\r\n - He used the Cruciatus Curse on <PERSON> when <PERSON> was wandless. \r\n\r\n > <PERSON> moved slowly forward and turned to face <PERSON>. He raised\r\n > his wand. \r\n > \r\n > “*Crucio!*” \r\n > \r\n > It was pain beyond anything <PERSON> had ever experienced; his very\r\n > bones were on fire; his head was surely splitting along his scar; his\r\n > eyes were rolling madly in his head; he wanted it to end ... to black\r\n > out ...to die ...\r\n\r\n - And again after <PERSON> was given his wand back.\r\n\r\n > “And now — we duel.” \r\n > \r\n > <PERSON> raised his wand, and before <PERSON> could do anything to\r\n > defend himself, before he could even move, he had been hit again by\r\n > the Cruciatus Curse. The pain was so intense, so all-consuming, that\r\n > he no longer knew where he was. ... White-hot knives were piercing\r\n > every inch of his skin, his head was surely going to burst with pain,\r\n > he was screaming more loudly than he’d ever screamed in his life —\r\n\r\n\r\n - He used the Imperius Curse on <PERSON>.\r\n\r\n\r\n > “I asked you whether you want me to do that again,” said <PERSON>\r\n > softly. “Answer me! *Imperio* \" ;\r\n\r\n\r\n - He used a spell that forced <PERSON> to bow.\r\n\r\n > “I said, bow,” <PERSON> said, raising his wand — and <PERSON> felt his\r\n > spine curve as though a huge, invisible hand were bending him\r\n > ruthlessly forward, and the Death Eaters laughed harder than ever.\r\n\r\n - He used another curse (probably the Cruciatus Curse again) that missed.\r\n\r\n > “You won’t?” said <PERSON> quietly, and the Death Eaters were not\r\n > laughing now. “You won’t say no? <PERSON>, obedience is a virtue I need\r\n > to teach you before you die. ... Perhaps another little dose of\r\n > pain?” \r\n > \r\n > <PERSON> raised his wand, but this time <PERSON> was ready; with the\r\n > reflexes born of his Quidditch training, he flung himself sideways\r\n > onto the ground; he rolled behind the marble headstone of <PERSON>’s\r\n > father, and he heard it crack as the curse missed him.\r\n\r\n\r\nThe extraordinary things only begin happening once spells generated from the two wands collide with each other. The connection **created by the collided spells** generated from twin wands is what protects <PERSON>.\r\n\r\nThis being the case, there would be no reason why <PERSON> would not be able to kill <PERSON>. When casting a curse at <PERSON> there is no other spell that is colliding with Voldemort&#39;s spell, so nothing out of the ordinary would happen. In much the same way as <PERSON> could (and did) curse <PERSON> to his heart&#39;s content if <PERSON> didn&#39;t cast any spells back (and presumably <PERSON> could even cast spells at Harry&#39;s wand, and possibly destroy it) he can curse <PERSON>. The fact that Voldemort&#39;s wand has a feather from <PERSON> is of no import because the extraordinary things are only generated by a collision of spells, something that <PERSON> cannot make happen.", "416" ], [ "@JanusBahsJacquet Dumledore says: *“Only **this morning**, for instance, I took a wrong \nturning on the way to the bathroom and found myself \nin a beautifully proportioned room I have never seen \nbefore, containing a really rather magnificent \ncollection of chamber pots.* So it&#39;s not necessarily evidence about where he sleeps. I thought of the <PERSON> quotes, but they only indicate that she sleeps somewhere in the castle, not that she sleeps specifically in (or off of) her office.", "189" ], [ "<PERSON> She had her wand. She used it to incarcerate <PERSON>, at which point the rest of the herd attacked and overpowered her: *He saw a flash of red light and knew that she had \nattempted to Stun one of them — then she screamed \nvery loudly. Lifting his head a few inches, <PERSON> saw \nthat <PERSON> had been seized from behind by <PERSON> \nand lifted high into the air, wriggling and yelling with \nfright. Her wand fell from her hand to the ground and \n<PERSON>’s heart leapt, if he could just reach it —*", "416" ], [ "***Order of the Phoenix*, Chapter 3**\r\n\r\n > <PERSON> descended the stairs, very conscious of everybody still staring\r\n > at him, stowing his wand into the back pocket of his jeans as he\r\n > came. \r\n > \r\n > \r\n > “Don’t put your wand there, boy!” roared <PERSON>. “What if it ignited?\r\n > Better wizards than you have lost buttocks, you know!”\r\n\r\nThis passage seems to imply that it would be possible for the wand to ignite without anyone using it.", "416" ], [ "<PERSON> was a smart man\r\n--------------------------\r\n\r\n<PERSON> knew that <PERSON> had escaped but he presumably did not have the foggiest idea how. It&#39;s not like there was a plethora of people in Hogwarts who would have, or could have, untied <PERSON> precisely in the minute between when the executioner confirmed that <PERSON> was there and when he came out to do the execution:\r\n\r\n > “No!” said <PERSON>. “If we steal him now, those Committee people\r\n > will think <PERSON> set him free! \r\n > \r\n > We’ve got to wait until they’ve seen he’s tied outside!” \r\n > \r\n > “That’s going to give us about sixty seconds,” said <PERSON>. This was\r\n > starting to seem impossible.\r\n\r\n<PERSON>, being <PERSON>, tried to come up with a theory to explain what had happened. As we find earlier in *Prisoner of Azkaban*:\r\n\r\n > “Have you any theory as to how he got in, <PERSON>?” asked <PERSON>. \r\n > \r\n > <PERSON> raised his head very slightly off his arms to free his other\r\n > ear. \r\n > \r\n > “Many, <PERSON>, each of them as unlikely as the next.”\r\n\r\nWhen <PERSON> heard the story from <PERSON>, <PERSON>, and <PERSON>, he decided that they might be able to use time travel to save <PERSON>. Once he decided on time travel he must have realized that that could be the perfectly reasonable explanation for how <PERSON> escaped – someone from the future who knew exactly what was going on had freed <PERSON> during the one minute window.\r\n\r\nBased on this possibility, <PERSON> told <PERSON> and <PERSON> to save <PERSON> as well (he didn&#39;t actually tell them directly; he hinted it to them).\r\n\r\nThe cool part is, though, that even if <PERSON> turns out to be wrong about <PERSON> being saved by time-travelers, there is not really anything to lose by telling <PERSON> and <PERSON> to save him. Either <PERSON> and <PERSON> will save him, or he will get saved some other way and <PERSON> and <PERSON> will see how he got saved. <PERSON> knows that <PERSON> will definitely get saved – otherwise <PERSON> would have already been dead. So either he is providing the method of saving, or he is dispatching witnesses to find out what happened. Either way he wins.\r\n\r\nEssentially, <PERSON> took a well-founded guess, that had no downside, and everything turned out great.", "416" ], [ "@NKCampbell I presented several issues with how you describe it: 1) The Tournament could conceivably be over before the Third Task. 2) Someone could get the cup without winning the cup. 3) The couple minutes pole positioning is basically negligible considering how long they are in the maze for. 4) Contrary to Dumbledore&#39;s words, they are not actually getting judged on how well they perform the Third Task. 5) Baagman&#39;s statement might imply that everyone gets points.", "364" ], [ "1) It picked someone who couldn&#39;t even complete the Second Task. Not only that, she was thwarted by creatures that <PERSON> learned how to deal with in Third Year. 2) The difference is you don&#39;t win a quidditch match by catching the quidditch cup. 3) Sometimes. 4) What&#39;s at that point? The fact is no one is getting judged on how well they completed a task. 5) \" ;Implying \" ; by definition entails a derivation of something that was not said.", "854" ], [ "Not that it particularly matters, but in situations where you are editing the question and posting an answer at the same time, you might want to do the question first. This way the homepage will show \" ;answered by <PERSON> \" ; instead of \" ;modified by <PERSON> \" ;, and I suspect the former is more likely to attract readers than the latter (especially on old questions that already have answers), and perhaps more importantly, clicking on the link will bring them to your answer rather than to your minor edits to the question.", "14" ], [ "I believe the premise of the question is incorrect. It could not have been necessary for <PERSON> to intend to mark <PERSON> as his equal, because <PERSON> did not even know that part of the prophecy:\r\n\r\nAs <PERSON> tells us at the end of *Order of the Phoenix*:\r\n\r\n > “He heard only the first part, the part foretelling the birth of a\r\n > boy in July to parents who had thrice defied <PERSON>. Consequently,\r\n > he could not warn his master that to attack you would be to risk \r\n > transferring power to you — again marking you as his equal. So\r\n > <PERSON> never knew that there might be danger in attacking you,\r\n > that it might be wise to wait or to learn more. He did not know that\r\n > you would have ‘power the Dark Lord knows not’ — ”\r\n\r\nTherefore, \" ;mark him as his equal \" ; simply means that by choosing to attack <PERSON>, he is by definition marking him as his equal. It is the choice which is the marking. By choosing <PERSON>, <PERSON> unknowingly assigns the status of \" ;equal \" ; to <PERSON>. \r\n\r\nWhen <PERSON> says \" ;he gave you that scar \" ; he is not saying that the scar is the mark of equality. The \" ;marking \" ; is from the previous sentence where <PERSON> says:\r\n\r\n > And so he did, <PERSON>. He chose you, not <PERSON>.\r\n\r\nThe sentence about giving <PERSON> the scar is merely <PERSON> saying what the choice consisted of – attempted murder which gave <PERSON> the scar.\r\n\r\nMarking him as his equal essentially means deciding that he is the subject of the prophecy. The subject of the prophecy is probably his equal in the sense that he has the power to vanquish the Dark Lord.", "416" ], [ "@QuestionAuthority My point about <PERSON> not knowing is just to show that by definition the marking can not have been intentional in the way that you assume. While <PERSON> chose to attack many people, he only chose to attack one person in response to a prophecy about \" ;one with the power to vanquish the Dark Lord \" ;. By attacking <PERSON>, <PERSON> marked him as the one with the power, and hence his equal. Dumbledore&#39;s mention of the scar is just a description of what happened. All murder is attempted murder until it succeeds.", "416" ], [ "It makes no difference\r\n----------------------\r\n\r\nWhen <PERSON> originally came after <PERSON>, there are two options:\r\n\r\n - He came after <PERSON> and not <PERSON> because he had specifically chosen <PERSON> as the threat.\r\n - He was planning on coming after both of them and only coincidentally got to <PERSON> first.\r\n\r\nIn the first option, <PERSON> is definitely chosen. In the second option, there are two further possibilities:\r\n\r\n - The mere fact that <PERSON> ended up attacking <PERSON> first is by definition considered as <PERSON> having chosen <PERSON> for the purposes of the prophecy (or at least that <PERSON> thinks this).\r\n - No \" ;choice \" ; was registered when <PERSON> first went after <PERSON>.\r\n\r\nIf the first of these latter options is correct then <PERSON> was chosen. If the second option is correct then no one was chosen. However, that just means that the choice wasn&#39;t made until <PERSON> came back to power. At that point <PERSON> deliberately pursued only <PERSON> and not <PERSON>. Therefore, even if until then there had not been an official choice, once <PERSON> regained his power he did make an official choice.\r\n\r\nThus, no matter how you look at it, by the time we get to the second half of the series <PERSON> is chosen and <PERSON> is not. Whether <PERSON> is correct about whether Voldemort&#39;s original attack on <PERSON> was an official choice, is basically immaterial.\r\n\r\nTherefore, to whatever extent it matters, <PERSON> is the Chosen One and <PERSON> is just <PERSON>.\r\n\r\nAs a side note, it is possible that <PERSON> did not accept Dumbledore&#39;s proffered reason as to *why* <PERSON> chose <PERSON> over <PERSON>:\r\n\r\n > <PERSON>’s childhood had been blighted by <PERSON> just as much as\r\n > <PERSON>’s had, but <PERSON> had no idea how close he had come to having\r\n > <PERSON>’s destiny. The prophecy could have referred to either of them,\r\n > yet, for his own inscrutable reasons, <PERSON> had chosen to believe\r\n > that <PERSON> was the one meant.", "416" ], [ "It is fairly clear that there are users here from various time zones. With different groups having different times of sleeping, working, etc. there are times when you can predict fairly well which users will be around.\r\n\r\nSuppose there is something to be voted on, e.g. closing or reopening questions. Suppose as well that you can predict with some level of accuracy how various users would vote.\r\n\r\nSuppose further that there is some level of correlation between the first two suppositions. That is to say that the users who you predict would agree with you are around at a specific time, and the users you predict would disagree with you are around at a specific other time.\r\n\r\nHow, if at all, can/should this information be taken into account when deciding *when* to bring up the vote?\r\n\r\n(I imagine that it some cases it&#39;s important for the issue to be raised immediately, but in other cases a few hours doesn&#39;t seem so important.)", "1018" ], [ "In addition to [Bellatrix&#39;s evidence][1], further evidence that the Dark Mark tattoos were not known about comes from Harry&#39;s conversation with <PERSON> in the cave in *Goblet of Fire* (my emphasis):\r\n\r\n > “Yeah, you should’ve seen <PERSON>’s face when <PERSON> turned up in\r\n > Potions yesterday!” said <PERSON> quickly. “<PERSON> wanted to talk to\r\n > <PERSON>, he says <PERSON>’s been avoiding him. <PERSON> looked really \r\n > worried. He showed <PERSON> something on his arm, but I couldn’t see\r\n > what it was.” \r\n > \r\n > **“He showed <PERSON> something on his arm?” said <PERSON>, looking frankly bewildered. He ran his fingers distractedly through his\r\n > filthy hair, then shrugged again. “Well, I’ve no idea what that’s\r\n > about** ... but if <PERSON>’s genuinely worried, and he’s going to \r\n > <PERSON> for answers ...”\r\n\r\n<PERSON> was clearly showing <PERSON> his Dark Mark. <PERSON> knows that <PERSON> was a Death Eater. <PERSON> had also been in the original Order of the Phoenix. If anyone would have known about the Dark Mark tattoos it would have been the Order. Yet when <PERSON> hears that a known Death Eater shows something on his arm to a suspected Death Eater, he has no idea what that&#39;s about. It seems pretty clear that <PERSON> was simply unaware of the tattoos.\r\n\r\n\r\nHowever, it seems that even before the second war began, the fact that Death Eaters have the mark was already better known. For one, <PERSON> must have told <PERSON> about it at some point because we see in his memories in *Deathly Hallows* that in the months leading up to Voldemort&#39;s return he told <PERSON> that it was getting darker:\r\n\r\n > “<PERSON>’s Mark is becoming darker too. He is panicking, he fears\r\n > retribution; you know how much help he gave the Ministry after the\r\n > Dark Lord fell.”\r\n\r\n\r\nAdditionally, <PERSON> clearly references the Dark Mark to <PERSON> in *Goblet of Fire* while masquerading as <PERSON>, so presumably he thought it would be in character for <PERSON> to know about the Dark Mark:\r\n\r\n > “ ’Course <PERSON> trusts you,” growled <PERSON>. “He’s a trusting\r\n > man, isn’t he? Believes in second chances. But me — I say there are\r\n > spots that don’t come off, <PERSON>. Spots that never come off, d’you \r\n > know what I mean?” \r\n > \r\n > <PERSON> suddenly did something very strange. He seized his left forearm\r\n > convulsively with his right hand, as though something on it had hurt\r\n > him.\r\n\r\nMost importantly, perhaps, by the time we get to *Order of the Phoenix* <PERSON> is already assuming that lack of a Dark Mark would be sufficient evidence to show that one is not a Death Eater (my emphasis):\r\n\r\n > “The trouble is,” she said to <PERSON>, “until <PERSON> — oh for\r\n > heaven’s sake, <PERSON> — comes out into the open, <PERSON> is going to have\r\n > to stay hidden, isn’t he? I mean, the stupid Ministry isn’t going to\r\n > realize <PERSON> is innocent until they accept that <PERSON>’s been \r\n > telling the truth about him all along. **And once the fools start\r\n > catching real Death Eaters again it’ll be obvious <PERSON> isn’t one\r\n > ... I mean, he hasn’t got the Mark, for one thing.**”\r\n\r\n\r\n\r\n\r\n [1]: _URL_0_", "416" ], [ "As the other answers have mentioned, <PERSON> wanted to kill <PERSON> because of the prophecy. He killed <PERSON> because <PERSON> was trying to stop him.\r\n\r\nHowever, what the other answers have not mentioned is that <PERSON> explicitly tells us (or rather we are privy to his thoughts about) why he killed <PERSON>. In *Deathly Hallows* when <PERSON> relives the night of the attack we find:\r\n\r\n > He could have forced her away from the crib, but it seemed more\r\n > prudent to finish them all. ...\r\n\r\nThat is to say that although <PERSON> had not originally planned on killing her, he made an at-the-moment decision to kill her even though he could have achieved his goal without killing her – even after she stood in his way.", "542" ], [ "When <PERSON> returns in *Goblet of Fire*, <PERSON> attempts to reorganize the Order of the Phoenix as soon as possible. In pursuit thereof he gives the following instructions to <PERSON>:\r\n\r\n > <PERSON>, I need you to set off at once. You are to alert <PERSON>,\r\n > <PERSON>, <PERSON> — the old crowd. Lie low at Lupin&#39;s\r\n > for a while; I will contact you there.”\r\n\r\nHow exactly could <PERSON> accomplish this? <PERSON> was at the time the most wanted wizard criminal in the country (if not the world). The only ones who believed he was innocent were <PERSON>, <PERSON>, <PERSON>, <PERSON>, and <PERSON>. How exactly could <PERSON> just show up to old Order members and tell them that <PERSON> had returned and the Order was being restarted? In fact, in the beginning of *Order of the Phoenix* this very line of reasoning is given to explain why <PERSON> couldn&#39;t do anything for the Order:\r\n\r\n > “Well, as everyone thinks I’m a mad mass murderer and the Ministry’s\r\n > put a ten-thousand-Galleon price on my head, I can hardly stroll up\r\n > the street and start handing out leaflets, can I?” said <PERSON>\r\n > restlessly.\r\n\r\nWhat exactly was <PERSON> expecting <PERSON> to do at the end of *Goblet of Fire*?", "416" ], [ "The \" ;very old library book \" ; that <PERSON> uses in *Chamber of Secrets* appears to disagree with *Fantastic Beasts and Where to Find Them* about how the Basilisk kills. *Fantastic Beasts* states as follows:\r\n\r\n > It has exceptionally venomous fangs but its most dangerous means of\r\n > attack is the gaze of its large yellow eyes. Anyone looking directly\r\n > into these will suffer instant death.\r\n\r\nThe implication of this is that as long as the person does not directly see the Basilisk&#39;s eyes he will not die.\r\n\r\nThe library book, on the other hand, states:\r\n\r\n > the Basilisk has a murderous stare, and all who are fixed with the\r\n > beam of its eye shall suffer instant death.\r\n\r\nThis seems to indicate that it does not matter if the person sees the Basilisk&#39;s eyes. As long as the Basilisk stares and fixes the beam of its eye on a person the person will die.\r\n\r\nThe library book&#39;s version is perhaps supported by <PERSON> on *Potterwatch* in which he says that a basilisk can kill with a single glance:\r\n\r\n > \" ;Agreed, \" ; said <PERSON>. \" ;So, people, let&#39;s try and calm down a bit.\r\n > Things are bad enough without inventing stuff as well.For instance,\r\n > this new idea that You-Know-Who can kill with a single glance from his\r\n > eyes. That&#39;s a basilisk, listeners. One simple test: Check whether the\r\n > thing that&#39;s glaring at you has got legs. If it has, it&#39;s safe to look\r\n > into it&#39;s eyes, although if it really is You-Know-Who, that&#39;s still\r\n > likely to be the last thing you ever do. \" ;", "559" ], [ "I don&#39;t really know anything about Star Trek, but according to [Wikipedia](_URL_0_) the Vulcan salute is based on Judaism: \n*The Vulcan salute is a hand gesture popularized by the 1960s television series Star Trek. It consists of a raised hand with the palm forward and the thumb extended, while the fingers are parted between the middle and ring finger. <PERSON> from the series based the gesture on the Jewish Priestly Blessing.*", "135" ], [ "I think that wizards assume that laws about Muggles telling others would be largely unnecessary, since Muggles would not believe other Muggles telling them about magic, and the Muggles who know would be afraid to talk about it for fear of being considered mad. This is in fact borne out by Fudge&#39;s conversation with the prime minister in the beginning of *Half-Blood Prince* (my emphasis):\r\n\r\n > “But,” said the Prime Minister breathlessly, watching his teacup\r\n > chewing on the corner of his next speech, “but why — why has nobody\r\n > told me — ?” \r\n > \r\n > “The Minister of Magic only reveals him- or herself to the Muggle\r\n > Prime Minister of the day,” said <PERSON>, poking his wand back inside\r\n > his jacket. “We find it the best way to maintain secrecy.” \r\n > \r\n > “But then,” bleated the Prime Minister, “why hasn’t a former Prime\r\n > Minister warned me — ?” \r\n > \r\n > At this, <PERSON> had actually laughed. \r\n > \r\n > “**My dear Prime Minister, are you ever going to tell anybody?”** \r\n > \r\n > Still chortling, <PERSON> had thrown some powder into the fireplace,\r\n > stepped into the emerald flames, and vanished with a whooshing sound.\r\n > **The Prime Minister had stood there, quite motionless, and realized\r\n > that he would never, as long as he lived, dare mention this encounter\r\n > to a living soul, for who in the wide world would believe him?**", "391" ], [ "The text doesn&#39;t actually say that they thought it was ghosts. What it says is: *“Very haunted up here, isn’t it?” said <PERSON>, with the \nair of one commenting on the weather. <PERSON> and <PERSON> were looking scared. Their bulging \nmuscles were no use against ghosts.* Thus, we have <PERSON> suggesting that it might be ghosts (or possibly some other form of hauntedness) and the narrator&#39;s observation (presumably Harry&#39;s perspective) that muscles would be useless against ghosts.", "189" ], [ "Besides for <PERSON> (and <PERSON> as mentioned in [another answer][1]) there are no other explicit expulsions from Hogwarts mentioned in the seven storyline books.\r\n\r\n There is one other expulsion mentioned in the books, but it is an expulsion from Durmstrang. In *Deathly Hallows* Chapter 18 we find out that <PERSON> was expelled from Durmstrang, but this obviously does not count as being expelled from Hogwarts (although this specification is not mentioned in the question title).\r\n\r\n > (This was your mistake at Durmstrang! But I do not complain, because\r\n > if you had not been expelled, we would never have met.)\r\n\r\n-\r\n\r\n > <PERSON>, expelled from Durmstrang for near-fatal attacks upon\r\n > fellow students, fled the country hours after the girl’s death, and\r\n > <PERSON> (out of shame or fear?) never saw him again, not until forced \r\n > to do so by the pleas of the Wizarding world.\r\n\r\n \r\n\r\n\r\n [1]: _URL_0_", "391" ], [ "As per *Chamber of Secrets* there&#39;s actually at least 5 upper floors: *They slipped out of the kitchen and down a narrow \npassageway to an uneven staircase, which wound its \nway, zigzagging up through the house. On the third \nlanding, a door stood ajar. <PERSON> just caught sight of \na pair of bright brown eyes staring at him before it \nclosed with a snap.\n“<PERSON>,” said <PERSON>. “You don’t know how weird it is for \nher to be this shy. She never shuts up normally — ”\nThey climbed two more flights until they reached a \ndoor with peeling paint and a small plaque on it, \nsaying <PERSON>’S ROOM.*", "542" ], [ "In *Chamber of Secrets* we find the following description of the Burrow&#39;s floors:\r\n\r\n > They slipped out of the kitchen and down a narrow passageway to an\r\n > uneven staircase, which wound its way, zigzagging up through the\r\n > house. On the third landing, a door stood ajar. <PERSON> just caught\r\n > sight of a pair of bright brown eyes staring at him before it closed\r\n > with a snap. “<PERSON>,” said <PERSON>. “You don’t know how weird it is for\r\n > her to be this shy. She never shuts up normally — ” They climbed two\r\n > more flights until they reached a door with peeling paint and a small\r\n > plaque on it, saying <PERSON>’S ROOM.\r\n\r\nThis indicate&#39;s that Ron&#39;s room is on the fifth floor above the ground floor. We know that Ron&#39;s room is on the top floor because it is directly beneath the attic:\r\n\r\n > “It’s a bit small,” said <PERSON> quickly. “Not like that room you had\r\n > with the <PERSON>. And I’m right underneath the ghoul in the attic;\r\n > he’s always banging on the pipes and groaning. ...”\r\n\r\n\r\nThus, there are precisely five floors between the ground floor and the attic. The question here, then, is why there are only five bedrooms in five floors. This assumes that each floor is a full floor that has multiple rooms. However, the description of the house structure that we get in *Chamber of Secrets* is:\r\n\r\n\r\n \r\n > It looked as though it had once been a large stone pigpen, but extra\r\n > rooms had been added here and there until it was several stories high\r\n > and so crooked it looked as though it were held up by magic (which, \r\n > <PERSON> reminded himself, it probably was).\r\n\r\nThis indicates that there are not necessarily full floors. Rather, rooms were added on individually and eventually the house ended up with all those floors.\r\n\r\nThat being the case, it is possible that each floor is actually only the one room that was added. If so then it makes perfect sense why there would be five bedrooms across five floors – the five floors *are* the five bedrooms.\r\n\r\nThis is also supported by the fact that when they walk up the stairs they don&#39;t see anything else besides the landings and the bedrooms off the landings. \r\n\r\nSuch a setup also fits with how the various rooms are described. We know from the beginning of *Half-Blood Prince* that <PERSON> and George&#39;s room is on the second floor:\r\n\r\n > <PERSON> and <PERSON>’s bedroom was on the second floor.\r\n\r\nWe know from *Goblet of Fire* that Percy&#39;s room is on the second landing (which would be the third floor):\r\n\r\n > Just then a door on the second landing opened, and a face poked out\r\n > wearing horn-rimmed glasses and a very annoyed expression. \r\n > \r\n > “Hi, <PERSON>,” said <PERSON>.\r\n\r\nWe know from *Chamber of Secrets* that <PERSON> is on the third landing (which would be the fourth floor):\r\n\r\n > On the third landing, a door stood ajar. <PERSON> just caught sight of \r\n > a pair of bright brown eyes staring at him before it closed with a\r\n > snap. \r\n > \r\n > “<PERSON>,” said <PERSON>. “You don’t know how weird it is for her to be this\r\n > shy. She never shuts up normally — ”\r\n\r\nWe know from *Goblet of Fire* that Ron&#39;s room is the uppermost room:\r\n\r\n > The room at the top of the house where <PERSON> slept\r\n\r\nThus, five floors of one bedroom each fits perfectly:\r\n\r\n 1. Ground Floor\r\n 2. <PERSON> and George&#39;s Room\r\n 3. Percy&#39;s Room\r\n 4. Ginny&#39;s Room\r\n 5. Mr. and Mrs. Weasley&#39;s Room\r\n 6. Ron&#39;s Room\r\n 7. Attic", "542" ], [ "@Jenayah It&#39;s likely that things have changed since <PERSON> and <PERSON> moved out. When they&#39;re all together in *Goblet of Fire* <PERSON> says: *“<PERSON> and <PERSON> are in here with us, because \n<PERSON> and <PERSON> are in their room,” he told <PERSON>. \n“<PERSON> gets to keep his room all to himself because \nhe’s got to work.”* This indicates that at that point <PERSON> and <PERSON> don&#39;t have a room anymore.", "542" ], [ "First of all, we know from chapter 14 of *Prisoner of Azkaban* that the Shrieking Shack was not really part of the village proper (my emphasis):\r\n\r\n > The day was fine and breezy, and neither of them felt like staying\r\n > indoors, so they walked past the Three Broomsticks and **climbed a\r\n > slope to visit the Shrieking Shack**, the most haunted dwelling in \r\n > Britain. **It stood a little way above the rest of the village**, and\r\n > even in daylight was slightly creepy, with its boarded windows and\r\n > dank overgrown garden.\r\n\r\nRight off the bat this may be a reason that the villagers pay it less heed.\r\n\r\n\r\nSecond of all, it was not necessarily \" ;a dilapidated boarded-up creepy looking house \" ; when it was first built. We (the readers) don&#39;t see it until some 20 years after it was built. During those 20 years it had spent several years being ravaged by a werewolf, followed by many years of abandonment and neglect. The rumors were started when <PERSON> started using it; once the rumors were started the villagers would henceforth avoid it.\r\n\r\nThus, there was not really any time when the villagers would have been expected to investigate. As soon as it was built it already appeared haunted. According to <PERSON> (also in chapter 14) the rumor was that a rough crowd lived there:\r\n\r\n > “I asked <PERSON> <PERSON> ... he says he’s heard a very rough \r\n > crowd lives here.\r\n\r\nVillagers would be hesitant to go snooping around a house where a rough crowd is rumored to be living.\r\n\r\nTherefore, when faced with a new house emitting haunted sounds, coupled with rumors of a bad crowd living there, the simplest thing for the villagers to do is just accept that it&#39;s haunted and move on, and for the most part ignore it in their day-to-day lives.", "391" ], [ "We know of one joke/prank that the Marauders played. As <PERSON> tells <PERSON> in *Prisoner of Azkaban* (my emphasis):\r\n\r\n > “I would hate for you to run away with a false idea of your father,\r\n > <PERSON>,” he said, a terrible grin twisting his face. “Have you been\r\n > imagining some act of glorious heroism? Then let me correct you —\r\n > your saintly father and his friends played a **highly amusing joke** on\r\n > me that would have resulted in my death if your father hadn’t got\r\n > cold feet at the last moment. There was nothing brave about what he\r\n > did. He was saving his own skin as much as mine. Had their **joke** \r\n > succeeded, he would have been expelled from Hogwarts.”\r\n\r\n\r\n\r\nLater in the book it is described as \" ;amusing \" ; by <PERSON> and a \" ;joke \" ; by <PERSON> (my emphasis):\r\n\r\n\r\n > <PERSON> thought it would be — er — \r\n > **amusing**, to tell <PERSON> all he had to do was prod the knot on the tree trunk with a long stick, and he’d be able to get in after me.\r\n > Well, of course, <PERSON> tried it — if he’d got as far as this house,\r\n > he’d have met a fully grown werewolf — but your father, who’d heard \r\n > what <PERSON> had done, went after <PERSON> and pulled him back, at great\r\n > risk to his life . . . <PERSON> glimpsed me, though, at the end of the\r\n > tunnel. He was forbidden by <PERSON> to tell anybody, but from \r\n > that time on he knew what I was. ...” \r\n > \r\n > “So that’s why <PERSON> doesn’t like you,” said <PERSON> slowly, “because\r\n > he thought you were in on the **joke**?”\r\n\r\nAdditionally, they are referred to as the greatest \" ;troublemakers \" ; by Professor <PERSON> in *Prisoner of Azkaban*:\r\n\r\n\r\n > “Precisely,” said Professor <PERSON>. “<PERSON> and <PERSON>.\r\n > Ringleaders of their little gang. Both very bright, of course —\r\n > exceptionally bright, in fact — but I don’t think we’ve ever had such\r\n > a pair of troublemakers — ”\r\n\r\n \r\n\r\n\r\n\r\n \" ;Troublemakers \" ; seems to connote somewhat of a more fun-spirited rulebreaking, which could be referring to various pranks/jokes. Indeed, in that very same conversation <PERSON> compares them to <PERSON> and <PERSON> who were certainly jokesters/pranksters:\r\n\r\n\r\n\r\n > “I dunno,” chuckled <PERSON>. “<PERSON> and <PERSON> could give ’em a\r\n > run fer their money.”\r\n\r\n\r\nMore importantly, when <PERSON> reminisces about overhearing this conversation two years later in *Order of the Phoenix*, he explicitly attributes to <PERSON> the sentiment that <PERSON> and <PERSON> were the forerunners of the <PERSON> twins:\r\n\r\n > Yes, he had once overheard Professor <PERSON> saying that his\r\n > father and <PERSON> had been troublemakers at school, but she had\r\n > described them as forerunners of the <PERSON> twins, and <PERSON> could\r\n > not imagine <PERSON> and <PERSON> dangling someone upside down for the fun\r\n > of it ... not unless they really loathed them . . . Perhaps <PERSON>,\r\n > or somebody who really deserved it . . .", "416" ], [ "@Himarm You think it&#39;s plausible that <PERSON> and <PERSON> are illegally sneaking out of school into Hogsmeade and buying butterbeer from the Three Broomsticks when anyone can see that they are students? And then carry back enough for the entire <PERSON> house? Not to mention that there is no reason why <PERSON> an <PERSON> would be inclined to pay for everyone else&#39;s food/drinks, even if they could afford it (which they can&#39;t). I think they are simply getting the food/drinks from the kitchens where it is readily available.", "391" ], [ "@Au101 None of what you mention is anything that <PERSON> would have any reason to be aware of. If it is established that butterbeer is easily accessible enough to have at random house parties, and is even served at Hogwarts on occasion, it doesn&#39;t matter how many times <PERSON> actually did have it. <PERSON> should have no reason to be so sure that butterbeer is something you can only get if you are allowed to go into Hogsmeade.", "391" ], [ "<PERSON> might not have been (only) looking for <PERSON>\r\n-------------------------------------------------------\r\n\r\nIf <PERSON> was indeed simply looking for <PERSON>, there does not seem to be a reason why she would have ended up by the Room of Requirement. In fact when <PERSON> points this out to her she doesn&#39;t give him an answer. However, it is possible that <PERSON> was using \" ;looking for <PERSON> \" ; as a cover for something else (or she had something else to take care of in addition to seeing <PERSON>).\r\n\r\nIn fact, this is implicitly suggested by <PERSON> when <PERSON> describes the encounter:\r\n\r\n > \" ;It&#39;s a thought, \" ; said <PERSON> slowly. \" ;But I still don&#39;t know why\r\n > she&#39;d be bursting into the castle to see <PERSON>, if that&#39;s really\r\n > why she was here.... \" ;\r\n\r\n(It is true that at the end of the book <PERSON> seems to think he figured out why <PERSON> came to see <PERSON>, but that does not necessarily mean that he is correct.)\r\n\r\n\r\nIf <PERSON> was there for a different reason, we don&#39;t know what it is. But if she was at the Room of Requirement perhaps that was actually her goal and she was thwarted by Harry&#39;s presence.\r\n\r\nAlternatively, she may have ended up at the Room of Requirement by accident. She doesn&#39;t seem to be fully in her right mind at this point, so it is possible that when she saw that <PERSON> was gone she just started wandering aimlessly and that&#39;s where she ended up.", "542" ], [ "Does \" ;them \" ; refer to the people or the portraits of the people? The entire rest of the question only speaks of the portraits, and it seemed obvious to me that the question was asking about whether they have commented on any current events via their portraits, not whether there are any records of things they said 1,000 years ago. However, given that your answer has a bunch of upvotes and no other critical comments (including from the asker) I might be wrong.", "521" ], [ "When all the adults are arguing in the side room after Harry&#39;s name came out of the Goblet of Fire, <PERSON> suggests that someone confunded the Goblet to think there were four schools, and submitted Harry&#39;s name as the only candidate for that school:\r\n\r\n\r\n > “Because they hoodwinked a very powerful magical object!” said <PERSON>.\r\n > “It would have needed an exceptionally strong Confundus Charm to\r\n > bamboozle that goblet into forgetting that only three schools \r\n > compete in the tournament. ... I’m guessing they submitted <PERSON>’s\r\n > name under a fourth school, to make sure he was the only one in his\r\n > category....”\r\n\r\nThat this is in fact what happened, as is confirmed when <PERSON> tells <PERSON> in his office after <PERSON> returns from the graveyard:\r\n\r\n\r\n > “Who put your name in the Goblet of Fire, under the name of a\r\n > different school? I did.\r\n\r\nThroughout the rest of the book <PERSON> is considered (one of) the Hogwarts champion(s) and is not considered the champion of the unnamed fourth school.\r\n\r\n\r\nThis would seem to indicate that a student is the champion of the school he attends, regardless of the school that he entered under.\r\n\r\nTheoretically, then, students could submit their names under different schools and the Goblet will pick one student with each school name, and we could end up with all three students from the same school.\r\n\r\nFor example, three students from Hogwarts enter the tournament. One writes \" ;Hogwarts \" ;, one writes \" ;Beauxbatons \" ;, and one writes \" ;Durmstrang \" ;. The Goblet decides that the best candidates from Beauxbatons and Durmstrang are actually the Hogwarts students and they get picked. Since all three students are from Hogwarts, <PERSON> and Beauxbatons now have no champions, Hogwarts automatically wins, and they can all just go home.\r\n\r\nCould something like this actually happen? If not, why not?\r\n\r\nIf yes, this seems like a really easy way to have a rigged tournament.", "391" ], [ "At the start-of-term feast in *Goblet of Fire* <PERSON> announces the following:\r\n\r\n > “The heads of Beauxbatons and Durmstrang will be arriving with their\r\n > short-listed contenders in October, and the selection of the three\r\n > champions will take place at Halloween.\r\n\r\nShortly thereafter he says:\r\n\r\n > Only students who are of age — that is to say, seventeen years or\r\n > older — will be allowed to put forward their names for consideration.\r\n\r\nIn discussing how the delegations would arrive, <PERSON> says the following:\r\n\r\n > “A Portkey?” <PERSON> suggested. “Or they could Apparate — maybe you’re\r\n > allowed to do it under seventeen wherever they come from?”\r\n\r\nWas there any reason to suspect that any of the visitors would be younger than 17? <PERSON> had said that the contenders are coming, and the contenders have to be 17. Was this just typical <PERSON> nonsense, or were there actually some younger students that were supposed to be coming as well?", "391" ], [ "@Jenayah *Also, plain logic: if you have two exactly equivalent schools, but one is on the other side of the globe, why would you sen your kid there?* Why wouldn&#39;t you send your kid there? What do you gain by having your kid closer to home? To illustrate: if there was no Italian school and Italian kids have been going to Hogwarts or Beauxbatons or wherever, would there be any benefit to starting a school in Italy (barring, as I said earlier, any language issues)?", "167" ], [ "According to <PERSON> in *Order of the Phoenix*:\r\n\r\n > And of course he uses the Department of Mysteries to develop terrible\r\n > poisons, which he feeds secretly to anybody who disagrees with him.\r\n\r\n\r\nAccording to <PERSON> in *Order of the Phoenix*, no one really knows:\r\n\r\n\r\n > “I know they call the people who work in there ‘Unspeakables,’ ” said\r\n > <PERSON>, frowning. “Because no one really seems to know what they do in\r\n > there... Weird place to have a weapon ...”\r\n\r\n\r\nRon&#39;s view is confirmed by his father at the Quidditch World Cup:\r\n\r\n > “That was <PERSON>, Head of the Goblin Liaison Office. ...\r\n > Here comes <PERSON>; he’s with the Committee on Experimental\r\n > Charms; he’s had those horns for awhile now. ... Hello, <PERSON> ... \r\n > <PERSON>, he’s an Obliviator — member of the Accidental Magic\r\n > Reversal Squad, you know. ... and that’s <PERSON> and <PERSON> ... they’re\r\n > Unspeakables. ...” \r\n > \r\n > “They’re what?” \r\n > \r\n > “From the Department of Mysteries, top secret, no idea what they get\r\n > up to. ...”\r\n\r\n\r\nAt the end of *Order of the Phoenix* <PERSON> tells us one of the most mysterious things studied there:\r\n\r\n > “There is a room in the Department of Mysteries,” interrupted\r\n > <PERSON>, “that is kept locked at all times. It contains a force\r\n > that is at once more wonderful and more terrible than death, than\r\n > human intelligence, than forces of nature. It is also, perhaps, the\r\n > most mysterious of the many subjects for study that reside there. It\r\n > is the power held within that room that you possess in such\r\n > quantities and which <PERSON> has not at all. That power took you to\r\n > save <PERSON> tonight. That power also saved you from possession by\r\n > <PERSON>, because he could not bear to reside in a body so full of\r\n > the force he detests. In the end, it mattered not that you could not\r\n > close your mind. It was your heart that saved you.”\r\n\r\nIn *Deathly Hallows* they apparently studied how people obtain magic, but given the circumstances the study might not have been pure:\r\n\r\n > “ ‘Recent research undertaken by the Department of Mysteries reveals\r\n > that magic can only be passed from person to person when Wizards\r\n > reproduce. Where no proven Wizarding ancestry exists, therefore, the\r\n > so- called Muggle-born is likely to have obtained magical power by\r\n > theft or force.", "416" ], [ "@RDFozz True. But if he has (allegedly) spent most of his life in Defense Against the Dark Arts exploits then his autobiography would tell all about it and be on-topic for Defense Against the Dark Arts Class. If most of his life is already told in the adventure books, a separate autobiography would not be so necessary. Except to tell us random facts about his life not related to his exploits, e.g. his favorite color. But (at least some of) those things are also covered in the adventure books.", "391" ], [ "It appears that <PERSON> was afraid of <PERSON> finding out that he knew about the <PERSON>. As we find in a conversation in *Half-Blood Prince* (my emphasis):\r\n\r\n > He turned to go, then another question occurred to him, and he turned\r\n > back again. “Sir, am I allowed to tell <PERSON> and <PERSON> everything\r\n > you’ve told me?” \r\n\r\n > <PERSON> considered him for a moment, then said,\r\n > “Yes, I think Mr. <PERSON> and Miss <PERSON> have proved themselves\r\n > trustworthy. But <PERSON>, I am going to ask you to ask them not to\r\n > repeat any of this to anybody else. **It would not be a good idea if\r\n > word got around how much I know, or suspect, about Lord <PERSON>’s\r\n > secrets.”** \r\n\r\n > “No, sir, I’ll make sure it’s just <PERSON> and <PERSON>. Good\r\n > night.”\r\n\r\n\r\nAdditionally, at the end of *Deathly Hallow* <PERSON> realized that <PERSON> also didn&#39;t want to waste anyone else&#39;s life. <PERSON> had to die anyway, so <PERSON> decided to use him as the Horcrux hunter:\r\n\r\n > <PERSON>’s betrayal was almost nothing. Of course there had been a\r\n > bigger plan; <PERSON> had simply been too foolish to see it, he realized\r\n > that now. He had never questioned his own assumption that <PERSON>\r\n > wanted him alive. Now he saw that his life span had always been\r\n > determined by how long it took to eliminate all the Horcruxes.\r\n > <PERSON> had passed the job of destroying them to him, and\r\n > obediently he had continued to chip away at the bonds tying not only\r\n > <PERSON>, but himself, to life! How neat, how elegant, not to waste\r\n > any more lives, but to give the dangerous task to the boy who had\r\n > already been marked for slaughter, and whose death would not be a\r\n > calamity, but another blow against <PERSON>.", "416" ], [ "In the end of *Half-Blood Prince* <PERSON> explains to <PERSON> why they can&#39;t be together anymore:\r\n\r\n > \" ;<PERSON> uses people his enemies are close to. He&#39;s already used you\r\n > as bait once, and that was just because you&#39;re my best friend&#39;s\r\n > sister. Think how much danger you&#39;ll be in if we keep this up. He&#39;ll\r\n > know, he&#39;ll find out. He&#39;ll try and get to me through you. \" ;\r\n\r\nI assume this is referring to the time when <PERSON> took <PERSON> into the Chamber of Secrets.\r\n\r\nHowever, I don&#39;t see any indication that in that case he was using <PERSON> as bait *because* she was Harry&#39;s best friend&#39;s sister. He didn&#39;t have any control over who ended up with the diary. It happened to be <PERSON> because <PERSON> chose to give it to her. If it had been <PERSON> who had used the diary, <PERSON> would presumably have been unable to bring <PERSON> into the Chamber. He explains how he got her in:\r\n\r\n > \" ;So I made <PERSON> write her own farewell on the wall and come down here\r\n > to wait.\r\n\r\nThis makes it sound like he was able to force her to go into the Chamber because he was possessing her; had he been possessing someone else, though, he would not have been able to force <PERSON> to come.\r\n\r\nAdditionally, if <PERSON> could theoretically have forced **anyone** into the Chamber, then why would he use <PERSON> (who was only the sister of Harry&#39;s best friend) and not <PERSON> (who was actually Harry&#39;s best friend? This again would seem to indicate that he used <PERSON> because that&#39;s who he had access to.\r\n\r\nFurthermore, <PERSON> actually tells <PERSON> what the primary bait was:\r\n\r\n > From everything <PERSON> had told me about you, I knew you would go to\r\n > any lengths to solve the mystery – particularly if one of your best\r\n > friends was attacked.\r\n\r\nThis seems to be referring to <PERSON>. <PERSON> would still have to be taken into the Chamber, but only in order for there to be a purpose for <PERSON> to go there.\r\n\r\nAlso, while it is certainly possible that <PERSON> would have mentioned to <PERSON> that her brother was Harry&#39;s best friend, it&#39;s not actually mentioned anywhere that she told him this.\r\n\r\n\r\nIn light of the above, is there actually any evidence that <PERSON> had targeted <PERSON> specifically because she was Harry&#39;s best friend&#39;s sister?", "416" ], [ "I don&#39;t see any evidence that the rules allowed <PERSON> to know what the tasks were significantly in advance. In fact, I don&#39;t see any evidence that <PERSON> actually did know the tasks significantly in advance, nor any evidence that *anyone* was ever **officially** told significantly in advance.\r\n------------------------------------------------------------------------\r\n\r\nWe know that <PERSON> knew about the First Task, but that was because <PERSON> had showed him the dragons for his personal enjoyment, not because he was supposed to be told by anyone. <PERSON> knew about the dragons as well, but there is a simple explanation for this. As he told <PERSON> under the influence of Veritaserum:\r\n\r\n > My master had found out that I was still alive. He had captured <PERSON> <PERSON> in Albania. She told him a great deal. She told him about the\r\n > Triwizard Tournament.\r\n\r\nAs <PERSON> worked for Bagman&#39;s department, which was the department that was running the tournament, it is entirely conceivable that she told <PERSON> what the tasks were, and <PERSON> in turn told <PERSON>.\r\n\r\nAs for how <PERSON> knew about the dragons, it is possible that she was told illegally as well, or it is possible that she did not actually know about them much in advance. The quote that demonstrates that she knew comes as she is bringing <PERSON> to the task. By that point the dragon enclosure and stands had already been set up; it it likely that many people knew about the dragons by then.\r\n\r\nWhen we get to the Second Task we again find that <PERSON> and <PERSON> appeared to know about it in advance. As explained above, Moody&#39;s knowledge is already accounted for. With <PERSON>, once again we only see that she knew about it on the morning of the task when <PERSON> discussed it with her in the staffroom. As <PERSON> told <PERSON> after the Third Task:\r\n\r\n > I called the elf to the staffroom to collect some robes for cleaning.\r\n > I staged a loud conversation with Professor <PERSON> about the\r\n > hostages who had been taken, and whether <PERSON> would think to use\r\n > <PERSON>.\r\n\r\nOnce again it is possible that <PERSON> only knew about the task because it was about to start, or it is possible that she found out about it illegally (perhaps even from <PERSON>).\r\n\r\nIn this case, <PERSON> also must have known the nature of the task at least the night before, as per Hermione&#39;s version of events:\r\n\r\n > At first he gave what seemed to be the truth; it tallied with\r\n > Hermione&#39;s story, anyway – <PERSON> had put all the hostages into a\r\n > bewitched sleep in Professor McGonagall&#39;s office, first assuring them\r\n > that they would be quite safe, and would awake when they were back\r\n > above the water.\r\n\r\nAgain, though, this was close enough to the task that for all we know all the heads had been told at this point (especially if their cooperation would have been needed to take the hostages).\r\n \r\n\r\nIn short, I don&#39;t see any acknowledgement that anyone from any of the three schools was allowed to be told about the tasks significantly in advance. Everyone had the choice to cheat and some may have cheated more than others, but I don&#39;t see any evidence that Dumbledore/Hogwarts was deliberately given an unfair advantage.", "416" ], [ "I don&#39;t think the example from outside Tonks&#39;s house is indicative of Apparition. <PERSON> was still there; he just \" ;vanished \" ; in the sense that <PERSON> could no longer see him because <PERSON> couldn&#39;t proceed (because of the protective enchantments). Note that <PERSON> seems to know this: *He imagined <PERSON>, a hundred yards above them as they spoke, looking for a way to penetrate what <PERSON> visualized as a great transparent bubble.*", "542" ], [ "There is not much information as to what the Order was doing during *Half-Blood Prince*. There are, however, two \" ;missions \" ; that we definitely know about:\r\n\r\n 1. **Spying on Werewolves**\r\n\r\nWhen <PERSON> talks to <PERSON> over Christmas, we have the following dialogue:\r\n\r\n > “What have you been up to lately?” <PERSON> asked <PERSON>, as Mr. <PERSON>\r\n > bustled off to fetch the eggnog, and everybody else stretched and\r\n > broke into conversation.\r\n > \r\n > “Oh, I’ve been underground,” said <PERSON>. “Almost literally. That’s why\r\n > I haven’t been able to write, <PERSON>; sending letters to you would have\r\n > been something of a giveaway.”\r\n > \r\n > “What do you mean?”\r\n > \r\n > “I’ve been living among my fellows, my equals,” said <PERSON>.\r\n > “Werewolves,” he added, at <PERSON>’s look of incomprehension. “Nearly\r\n > all of them are on <PERSON>’s side. <PERSON> wanted a spy and here\r\n > I was… ready-made.”\r\n > \r\n > He sounded a little bitter, and perhaps realized it, for he smiled\r\n > more warmly as he went on, “I am not complaining; it is necessary work\r\n > and who can do it better than I? However, it has been difficult\r\n > gaining their trust. I bear the unmistakable signs of having tried to\r\n > live among wizards, you see, whereas they have shunned normal society\r\n > and live on the margins, stealing—and sometimes killing—to eat.”\r\n\r\n 2. **Protecting Hogwarts**\r\n\r\nWhen <PERSON> leaves Hogwarts he has several Order members come to protect it. As <PERSON> tells <PERSON> immediately before they set out to find the Horcrux:\r\n\r\n > \" ;Do you think that I have once left the school unprotected during my\r\n > absences this year? I have not. Tonight, when I leave, there will\r\n > again be additional protection in place.\r\n\r\n\r\nAnd as <PERSON> elaborates after the battle (my emphasis): \r\n\r\n > \" ;I don&#39;t know exactly how it happened, \" ; said Professor <PERSON>\r\n > distractedly. \" ;It&#39;s all so confusing.... <PERSON> had told us that\r\n > he would be leaving the school for a few hours and that we were to\r\n > patrol the corridors just in case... **<PERSON>, Bill, and <PERSON>\r\n > were to join us**... and so we patrolled.\r\n\r\n\r\n\r\n\r\n [1]: _URL_0_", "391" ], [ "I see two good reasons for the memory modification mentioned in the quote.\r\n\r\n 1. ***so that they’re convinced they’re really called <PERSON> and <PERSON>***\r\n\r\nIf Death Eaters are looking for Hermione&#39;s family, just about the only information they have to go on is their names. By forcing them to assume new identities she makes it a lot harder for anyone to track them down.\r\n\r\n 2. ***If I don’t – well, I think I’ve cast a good enough charm to keep them safe and happy.***\r\n\r\n<PERSON> is preparing for the possibility that she will die. If she does die, her parents will be grief-stricken. Losing your only child is a pretty devastating blow. <PERSON> wants to save them from this pain and grief so she enchants them so that they won&#39;t remember that they have a daughter – thus, if she dies there will be no grief and pain for her parents.", "542" ], [ "I thank you for addressing my points in the post, but I stand by my last comment. You are essentially arguing that even if it doesn&#39;t actually say that <PERSON> Apparated, we can assume that he Apparated because Apparition is more efficient. If that is the argument then no examples of Apparition are necessary. It is simply a logical argument that doesn&#39;t require any examples. Therefore, citing examples that are only examples of Apparition *if we already grant the logical argument* doesn&#39;t strengthen the argument.", "27" ], [ "Despite the other answers providing citations that indicate that <PERSON> has feet and walks, in *Deathly Hallows* when <PERSON> has an unprecedented view of Voldemort&#39;s movements <PERSON> is frequently described as \" ;gliding \" ;. One time he is actually explicitly described as \" ;slithering \" ;. Thus, even if <PERSON> does not actually have the physical body of a snake, his movements definitely evoke a snakelike body (and that is presumably the image the author wished to conjure).\r\n\r\n - \r\n\r\n > He was gliding along a twilit street.\r\n\r\n - \r\n > Abandoning the attempt to close the door, she began to back away down\r\n > the dark hall, and <PERSON> followed, gliding toward her, and his\r\n > long-fingered hand had drawn his wand.\r\n\r\n - \r\n > *And he was gliding along, that sense of purpose and power and\r\n > rightness in him that he always knew on these occasions.*\r\n\r\n - \r\n > Voldemort&#39;s thoughts had suddenly become razor-sharp again; he was \r\n > gliding toward the gigantic building with a sense of calmly euphoric \r\n > purpose....\r\n\r\n - \r\n > *– He was gliding around the high walls of the black fortress –*\r\n\r\n - \r\n > The sun was barely visible over the horizon as he glided alongside\r\n > <PERSON>, up through the grounds toward the lake.\r\n\r\n - \r\n > *And he made less noise than the dead leaves slithering along the\r\n > pavement as he drew level with the dark hedge, and stared over it....*\r\n\r\n\r\nOn the other hand, having legs is specifically given by <PERSON> as the characteristic that *distinguishes* <PERSON> from a snake:\r\n\r\n > \" ;Agreed, \" ; said <PERSON>. \" ;So, people, let&#39;s try and calm down a bit.\r\n > Things are bad enough without inventing stuff as well.For instance,\r\n > this new idea that You-Know-Who can kill with a single glance from his\r\n > eyes. That&#39;s a *basilisk*, listeners. One simple test: Check whether\r\n > the thing that&#39;s glaring at you has got legs. If it has, it&#39;s safe to\r\n > look into it&#39;s eyes, although if it really is You-Know-Who, that&#39;s\r\n > still likely to be the last thing you ever do. \" ;", "416" ], [ "In *Deathly Hallows* Chapter 19 there is an example of a wizard carrying a backup wand, and he explicitly states that its purpose is to be a backup wand:\r\n\r\n\r\n\r\n > \" ;Did you just say you got away from the Snatchers with a spare wand? \" ;\r\n > \r\n > \" ;What? \" ; said <PERSON> who had been watching <PERSON> examining the locket.\r\n > \" ;Oh – oh yeah. \" ;\r\n > \r\n > He tugged open a buckle on his rucksack and pulled a short, dark wand\r\n > out of its pocket. \" ;Here. I figured it&#39;s always handy to have a\r\n > backup. \" ;\r\n\r\nWhile it is true that <PERSON> did not *deliberately* procure a backup wand, the fact remains that he had the backup wand for several weeks already.", "416" ], [ "In addition to the previous answers, when <PERSON>, <PERSON>, and <PERSON> infiltrated the Ministry with Polyjuice Potion in *Deathly Hallows*, the potion didn&#39;t wear off until they got to the Quidditch World Cup location, which would have been well more than an hour after they had taken it.\r\n\r\n > The Polyjuice Potion was wearing off now: <PERSON> was halfway between\r\n > <PERSON> and himself in appearance, his hair turning redder and\r\n > redder as his face drained of the little color it had left.", "416" ], [ "The only person in the books that we see using Kwikspell is <PERSON>, and it doesn&#39;t seem to have helped him. For instance, in *Order of the Phoenix* Filch we have the following:\r\n\r\n > “Right you are, Headmistress!” wheezed <PERSON>, who was a Squib and\r\n > could no more have Stunned the fireworks than swallowed them.\r\n\r\nApparently <PERSON> was unable to do any magic at all despite the Kwikspell course.\r\n\r\nHowever, it is unlikely that Kwikspell is meant for Squibs. It seems generally accepted that Squibs cannot gain the ability to do magic. For instance, we have Ron&#39;s comment in *Deathly Hallows*:\r\n\r\n > \" ;But how are they supposed to have &#39;stolen&#39; magic? \" ; said <PERSON>. \" ;It&#39;s\r\n > mental, if you could steal magic there wouldn&#39;t be any <PERSON>, would\r\n > there? \" ;\r\n\r\n The opening paragraph of the Kwikspell course indeed seems addressed to wizards who are poor at magic, not those who have no magic at all:\r\n\r\n > *Feel out of step in the world of modern magic? Find yourself making\r\n > excuses not to perform simple spells? Ever been taunted for your\r\n > woeful wandwork?*\r\n\r\nThe testimonials as well reflect people who were able to do magic poorly, rather than not at all:\r\n\r\n > *I had no memory for incantations and my potions were a family joke!*\r\n\r\n < ! > \r\n\r\n > *My wife used to sneer at my feeble charms*\r\n\r\nFor such people it is certainly possible that Kwikspell would help. The first Kwikspell lesson is described as:\r\n\r\n > \" ;Lesson One: Holding Your Wand (Some Useful Tips) \" ;\r\n\r\nNot holding a wand properly could easily be something that would contribute to a wizard&#39;s poor performance of magic, and useful tips on how to hold a wand is something that could address that and be taught in a correspondence course.\r\n\r\nTherefore, while it is certainly possible that it is a scam, we have no particular reason to think that Kwikspell wouldn&#39;t work **for those whom it was intended for**.", "391" ], [ "(I hope everything works out with whatever&#39;s going on in your life, and that my comments haven&#39;t contributed to any problems.) This is where I distinguish between the facts and the question. I would not have asked the question, because I don&#39;t see any reason to think that <PERSON> wouldn&#39;t Apparate. Even if we never saw him Apparate it wouldn&#39;t mean much because we are very limited in what we see of <PERSON>. That said, it is the questioner&#39;s prerogative to ask if there any actual examples of him Apparating. So I agree with your conclusions, but I just think that nothing is an **cont.**", "686" ], [ "<PERSON> [answer][1] correctly identifies the word אמת (*emmet*) which is the Hebrew word for \" ;truth \" ;. However, there is another Hebrew word in the right panel that is written in Latin characters. In the bottom left corner the text says:\r\n\r\n > ... A new shred of the **RAGMAN**... forever binded by a protective\r\n > **SHEM**.\r\n\r\nThe word *shem* is the Hebrew word שם, which means \" ;name \" ;. In addition to the simple meaning \" ;name \" ;, in certain contexts it can be used specifically to refer to holy or Divine names, that are usually invoked for some supernatural purpose. In Jewish lore you can find protective amulets with such names inscribed on them.\r\n\r\n\r\nAdditionally, the (Hebrew) [Wikipedia page][2] for the Jewish name for God says the following (my translation):\r\n\r\n > בפולקלור היהודי, יודעי תורת הנסתר הפיחו בגולם רוח חיים, על ידי כך שהיו\r\n > כותבים את השם המפורש על פיסת נייר, ומניחים אותה בפיו של גוש חומר, ואחר\r\n > כך היו רושמים את המילה \" ;אמת \" ; על מצחו. כאשר היה צורך להפסיק את פעולת\r\n > הגולם, נמחקה האות א&#39;, וכך הוא נותר \" ;מת \" ;.\r\n > \r\n > In Jewish Folklore, those who know the Secret Wisdom would blow the breath of life into a\r\n > *golem* by means of writing the Ineffable Name on a piece of paper and placing it in the mouth of a lump of matter, following\r\n > which they would write the word אמת [*emmet* – \" ;truth \" ;] on its\r\n > forehead. When it was necessary to stop the operations of the *golem*\r\n > they would erase the letter א [*aleph*] and what remained would be מת\r\n > [*met*].\r\n\r\n(Slight explanation – the Hebrew word א-מ-ת is one letter off from the Hebrew word מ-ת. The former means \" ;truth \" ; while the latter is the word for death. Thus by removing the first letter (the א) from the word אמת that was written on the forehead, you would be left with the word מת, signifying that the creature should \" ;die \" ;, or shut down.)\r\n\r\n\r\nThus, (as mentioned in the other answer) this comic may be referencing the use of the word אמת to activate/deactivate a superpowered creature.\r\n\r\n\r\n----------\r\n\r\n\r\nThe Hebrew word in the third panel that was edited into the question is the same word: אמת (*emmet*) – \" ;truth \" ;. The slight difference between its appearance here and in the other panels is due to the inclusion of *[nekudot][3]* – dots. Hebrew words can be written with or without *nekudot*. These dots instruct the reader how to vowelize the word, because the Hebrew alphabet is (for the most part) all consonants. The set of dots under the two letters in this case are *[segol][4]* which tells us that the vowel sound should be \" ;eh \" ;. Without the inclusion of the dots the word would technically just say *&#39;mt* without telling you that the two syllables both have the \" ;eh \" ; vowelization. Most people familiar with Hebrew would recognize that the letters א-מ-ת are pronounced with the \" ;eh \" ; vowelization, so it is usually not necessary to include the dots.\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_1_\r\n [3]: _URL_0_\r\n [4]: _URL_3_", "1016" ], [ "In *Goblet of Fire* Chapter 12 we see that <PERSON> starts at Hogwarts that year:\r\n\r\n > “Hiya, <PERSON>!” \r\n > \r\n > It was <PERSON>, a third year to whom <PERSON> was something of a\r\n > hero. \r\n > \r\n > “Hi, <PERSON>,” said <PERSON> warily. \r\n > \r\n > “<PERSON>, guess what? Guess what, <PERSON>? My brother’s starting! My\r\n > brother <PERSON>!”\r\n\r\nBy all accounts, then, in *Order of the Phoenix* (one year later) he should be in his second year. Yet in Chapter 16 of *Order of the Phoenix* we find him in Hogsmeade for the first D.A. meeting (my emphasis):\r\n\r\n > First came <PERSON> with <PERSON> and <PERSON>, who were closely followed\r\n > by <PERSON> and <PERSON> with (<PERSON>’s stomach did a back flip) <PERSON>\r\n > and one of her usually giggling girlfriends, then (on her own and \r\n > looking so dreamy that she might have walked in by accident) Luna\r\n > <PERSON>; then <PERSON>, <PERSON><PERSON>, and <PERSON>,\r\n > <PERSON> and <PERSON>**, <PERSON>, <PERSON> <PERSON>, <PERSON>, and a Hufflepuff girl with a long\r\n > plait down her back whose name <PERSON> did not know; three Ravenclaw\r\n > boys he was pretty sure were called <PERSON>, <PERSON>,\r\n > and <PERSON>; Ginny, followed by a tall skinny blond boy with an \r\n > upturned nose whom <PERSON> recognized vaguely as being a member of the\r\n > Hufflepuff Quidditch team, and bringing up the rear, <PERSON> and <PERSON> <PERSON> with their friend <PERSON>, all three of whom were \r\n > carrying large paper bags crammed with <PERSON>’s merchandise.\r\n\r\nWe know from *Prisoner of Azkaban* Chapter 1 that <PERSON> is only permitted to third years and above (my emphasis):\r\n\r\n > *Dear Mr. <PERSON>,* \r\n\r\n > *Please note that the new school year will begin on \r\n > September the first. The Hogwarts Express will leave from King’s Cross\r\n > station, platform nine and three- quarters, at eleven o’clock.* \r\n\r\n > ***Third years are permitted to visit the village of Hogsmeade on certain \r\n > weekends.** Please give the enclosed permission form to your\r\n > parent or guardian to sign.* \r\n\r\n > *A list of books for next year is\r\n > enclosed.* \r\n > \r\n > *Yours sincerely,*\r\n > \r\n > \r\n > \r\n > *Professor <PERSON>*\r\n > \r\n > \r\n > \r\n > *Deputy Headmistress*\r\n\r\nWe also know from *Order of the Phoenix* Chapter 16 that <PERSON> was checking the permission status of everyone leaving the castle *for that very <PERSON> visit*:\r\n\r\n > The morning of the <PERSON> visit dawned bright but windy. After\r\n > breakfast they queued up in front of <PERSON>, who matched their names\r\n > to the long list of students who had permission from their parents or\r\n > guardian to visit the village.\r\n\r\nHow, then, was <PERSON> able to get into Hogsmeade, considering he would have only been a second year?", "391" ], [ "\" ;<PERSON> was exposed \" ; is a bit of an overstatement. What happened was that she boasted about it:\r\n\r\n > “What <PERSON> doesn’t know won’t hurt him,” said <PERSON>, who was\r\n > now panting slightly as she pointed her wand at different parts of\r\n > <PERSON>’s body in turn, apparently trying to decide what would hurt the\r\n > most. “He never knew I ordered dementors after <PERSON> last summer,\r\n > but he was delighted to be given the chance to expel him, all the\r\n > same...”\r\n\r\nThe only people present at this event were:\r\n\r\n - <PERSON>\r\n - Crabbe\r\n - Goyle\r\n - Warrington\r\n - Millicent Bulstrode\r\n - A large Slytherin girl\r\n\r\nIt is highly unlikely that any of the Slytherins would have reported Umbridge&#39;s crime, nor is it likely that <PERSON> or his friends told <PERSON>. Indeed, when <PERSON> finally meets <PERSON> for the first time in *Half-Blood Prince*, <PERSON> mentions <PERSON> and <PERSON> is shocked that she is still at the ministry. Even so he does not mention that <PERSON> sent the Dementors, even though he does show <PERSON> the scars on his hand from Umbridge&#39;s quill:\r\n\r\n\r\n > <PERSON><PERSON> has told me that you cherish an ambition to become\r\n > an Auror. Well, that could be arranged very easily. ...” \r\n > \r\n > <PERSON> felt anger bubbling in the pit of his stomach: So <PERSON>\r\n > <PERSON> was still at the Ministry, was she?\r\n\r\n-\r\n\r\n > “No, it was honest,” said <PERSON>. “One of the only honest things\r\n > you’ve said to me. You don’t care whether I live or die, but you do\r\n > care that I help you convince everyone you’re winning the war against\r\n > <PERSON>. I haven’t forgotten, Minister. ...” \r\n > \r\n > He raised his right fist. There, shining white on the back of his\r\n > cold hand, were the scars which <PERSON><PERSON> had forced him to\r\n > carve into his own flesh: *I must not tell lies*. \r\n > \r\n > “I don’t remember you rushing to my defense when I was trying to tell\r\n > everyone <PERSON> was back. The Ministry wasn’t so keen to be pals\r\n > last year.”\r\n\r\n \r\n\r\nThus, <PERSON> does not seem to have known about Umbridge&#39;s crime, despite her admitting to it.", "416" ], [ "Indeed, <PERSON> probably thought that aurors could provide protection from <PERSON>. This can be seen from the end of *Half-Blood Prince* when <PERSON> directly offers <PERSON> auror protection:\r\n\r\n > <PERSON> hesitated, then said, in what was evidently supposed to be\r\n > a tone of delicacy, “The Ministry can offer you all sorts of\r\n > protection, you know, <PERSON>. I would be delighted to place a couple\r\n > of my Aurors at your service — ”\r\n\r\n<PERSON>, though, seems to agree with you that such protection would be futile, as illustrated by his response to <PERSON>:\r\n\r\n > <PERSON> laughed. “<PERSON> wants to kill me himself, and Aurors won’t\r\n > stop him. So thanks for the offer, but no thanks.”", "416" ], [ "<PERSON> does in fact appear once in *Half-Blood Prince*, at Dumbledore&#39;s funeral (my emphasis):\r\n\r\n > An extraordinary assortment of people had already settled into half\r\n > of the chairs; shabby and smart, old and young. Most <PERSON> did not\r\n > recognize, but a few he did, including members of the Order of the \r\n > Phoenix: <PERSON>; <PERSON>**; <PERSON>, her hair\r\n > miraculously returned to vividest pink; <PERSON>, with whom she\r\n > seemed to be holding hands; Mr. and Mrs. <PERSON>; <PERSON> supported by\r\n > <PERSON> and followed by <PERSON> and <PERSON>, who were wearing jackets of\r\n > black dragon skin.\r\n\r\nThe reason for his otherwise lack of appearance is probably that he was not present (or his presence was unimportant) at the various events portrayed in the story. Most of the book takes place at Hogwarts, where <PERSON> would not be expected to appear. Even though Hogwarts is under the guard of aurors that year, <PERSON> is an *ex*-auror; moreover, <PERSON> rarely saw the aurors that were there anyway.\r\n\r\nIn the small part of the book that takes place elsewhere, even though we never see <PERSON> we almost see him. When <PERSON> arrives at the Burrow, we find out that <PERSON> is coming for dinner on the weekend:\r\n\r\n\r\n > “Dear, why not come to dinner at the weekend, \r\n > \r\n > <PERSON> and Mad-Eye are coming — ?”\r\n\r\n\r\n\r\n However, the weekend dinner is apparently not an important enough part of the story for us to actually see it. The same is probably true of other events where <PERSON> would have been present throughout the year.", "416" ], [ "If this happened it is not mentioned in the books. Following the battle in the Department of Mysteries at the end of *Order of the Phoenix*, <PERSON> is almost a non-character. He is not mentioned at all in *Half-Blood Prince*, and he only appears once in *Deathly Hallows* when he is knocked out by <PERSON> during the battle at Hogwarts.\r\n\r\n\r\nWe do know from <PERSON> that <PERSON> particularly enjoys killing, so perhaps it would not be surprising if he had specifically asked to be reinstated as executioner, but there doesn&#39;t seem to be any evidence in the books that this actually happened. This is what <PERSON> said when he returned from his expedition to the giants in *Order of the Phoenix*:\r\n\r\n\r\n\r\n > “Because I recognized one of ’em,” <PERSON> growled. “<PERSON>, remember\r\n > him? Bloke they sent ter kill <PERSON>? Maniac, he is. Likes killin’\r\n > as much as <PERSON>, no wonder they were gettin’ on so well.”\r\n\r\n\r\n<PERSON> did promise <PERSON> better victims when the Death Eaters convened at the end of *Goblet of Fire*, but that doesn&#39;t necessarily tell us whether he would have wanted or not wanted <PERSON> to also be the Ministry executioner:\r\n\r\n > “<PERSON> ... destroying dangerous beasts for the Ministry of Magic\r\n > now, <PERSON> tells me? You shall have better victims than that soon,\r\n > <PERSON>. Lord <PERSON> will provide. ...”", "416" ], [ "Yes, the Sunday Prophet is part of the Daily Prophet\r\n----------------------------------------------------\r\n\r\nIf we look at some passages discussing this issue of the paper, it seems pretty clear that they are referencing back to what the Daily Prophet has been saying all year. This makes sense if they are the same paper, but not if they are two different papers:\r\n\r\n > “He’s ‘the Boy Who Lived’ again now, though, isn’t he?” said <PERSON>\r\n > darkly. “Not such a show-off maniac \r\n > anymore, eh?”\r\n\r\n < !-- > \r\n\r\n\r\n > “Yes, they’re very complimentary about you now, <PERSON>,” said\r\n > <PERSON>, now scanning down the article. “ ‘A lone voice of truth ...\r\n > perceived as unbalanced, yet never wavered in his story . . . forced\r\n > to bear ridicule and slander ...’ Hmmm,” said <PERSON>, frowning, “I\r\n > notice they don’t mention the fact that it was them doing all the\r\n > ridiculing and slandering, though...”\r\n\r\n < !-- > \r\n\r\n > “ ‘You-Know- Who’s Last Attempt to Take Over, pages two to four, What\r\n > the Ministry Should Have Told Us, page five, Why Nobody Listened to\r\n > <PERSON>, pages six to eight, Exclusive Interview with Harry \r\n > Potter, page nine ...’ Well,” said <PERSON>, folding up the newspaper\r\n > and throwing it aside, “it’s certainly given them lots to write\r\n > about. And that interview with <PERSON> isn’t exclusive, it’s the one\r\n > that was in The Quibbler months ago...”\r\n\r\nAdditionally, when <PERSON> goes to visit <PERSON> that same day, we have the following:\r\n\r\n\r\n > The hot sun hit him with a blast as he walked across the lawns toward\r\n > <PERSON>’s cabin. Students lying around on the grass sunbathing,\r\n > talking, reading the Sunday Prophet, and eating sweets looked up at\r\n > him as he passed. Some called out to him, or else waved, clearly\r\n > eager to show that they, like the <PERSON>, had decided he was\r\n > something of a hero.\r\n\r\nIn this passage the Sunday Prophet is referred to as just \" ;the <PERSON> \" ; which is what the Daily Prophet is referred to as throughout the books. That would make sense if they are the same newspaper. If they are two different newspapers, they likely would not be flippantly referred to in the same way.", "897" ], [ "Lupin&#39;s two statements seem to be referring to two different things\r\n-------------------------------------------------------\r\n\r\nWhen <PERSON> first says:\r\n\r\n > “<PERSON>, the time for Disarming is past! These people are trying to\r\n > capture and kill you! At least Stun if you aren’t prepared to kill!”\r\n\r\nHe is referring to fighting Death Eaters in general. He is telling <PERSON> that ideally he should be trying to kill Death Eaters, but if he can&#39;t handle the Killing Curse he should at least do something that can inflict damage, and possibly even result in a Death Eater death.\r\n\r\nIn response to this <PERSON> tells <PERSON> that <PERSON> is not himself, and stunning him would have killed him. In other words, <PERSON> is telling <PERSON> that <PERSON> is innocent and does not deserve to be killed.\r\n\r\n<PERSON> then agrees that *in the specific case of <PERSON>* <PERSON> was correct to not kill him, or even stun him which could have killed him. However, <PERSON> then makes an additional point which is that even in a situation where it would be improper to kill someone, <PERSON> still should not be disarming them. Disarming makes one look weak and incapable of mounting any form of attack. It also does no damage to the opponent and gives him the opportunity to escape (and therefore perhaps return to another battle and cause more damage). <PERSON> thus tells <PERSON> that even when he does not want to **kill**, he still has to **attack**. By attacking he shows that he is a serious opponent, and he might even be able to incapacitate his target.\r\n\r\nThus, <PERSON> was not referring to a specific spell that <PERSON> should have used. He merely meant that <PERSON> should be using offensive magic even when not trying to kill someone, rather than disarming which is defensive magic.\r\n\r\nThere are, of course, spells that can attack without killing. Indeed, in this very battle <PERSON> uses *Sectumsempra* against <PERSON> non-lethally.", "37" ], [ "As far as I know this is not confirmed anywhere, but a possible student that got held back would be <PERSON>. Consider the following:\r\n\r\n**In *Harry Potter and the Philosopher&#39;s Stone* she was sorted right before <PERSON>.**\r\n\r\n > There weren&#39;t many people left now. \r\n > \r\n > \" ;<PERSON> \" ; ... \" ;<PERSON> \" ; ... \" ;<PERSON> \" ; ... then a pair of twin girls, \" ;<PERSON> \" ; and \" ;<PERSON> \" ; ... then \" ;<PERSON>, <PERSON>-Anne \" ; ... and then, at last — \r\n > \r\n > \" ;<PERSON>, <PERSON>! \" ;\r\n\r\n**In *Harry Potter and the Order of the Phoenix* students are called into their Charms O.W.L in alphabetical order, yet <PERSON> is mysteriously absent when the <PERSON> and <PERSON> are called.**\r\n\r\n > Ten minutes later, Professor <PERSON> called, \" ;<PERSON>, <PERSON> — <PERSON>, <PERSON> — <PERSON>, <PERSON> — <PERSON>, <PERSON>. \" ;\r\n\r\nThis tells us that she was not present at the Charms O.W.L. As Charms is a mandatory course, she can&#39;t have not taken the class. While it is possible that she missed the exam for some other reason (e.g. she was in the Hospital Wing with some dreadful injury), perhaps she was not there because she was held back.\r\n\r\n(This could also explain why we never hear of her again after the sorting – if she was held back, <PERSON> and his friends would have much less to do with her.)", "391" ], [ "*“And what,” she said in a whisper that nevertheless\ncarried all around the entrance hall, “are you going to\ndo with her once I appoint a new Divination teacher\nwho needs her lodgings?”\n“Oh, that won’t be a problem,” said <PERSON>\npleasantly. “You see, I have already found us a new\nDivination teacher, and he will prefer lodgings on the\nground floor.”*", "189" ], [ "Potential evidence for the theory that it&#39;s the gamekeeper&#39;s hut: *“Would you mind moving out of the way?” came \n<PERSON>’s cold drawl from behind them. “Are you trying \nto earn some extra money, <PERSON>? Hoping to be \ngamekeeper yourself when you leave Hogwarts, I \nsuppose — that hut of <PERSON>’s must seem like a \npalace compared to what your family’s used to.”* <PERSON> seems to be implying that if <PERSON> would be the gamekeeper he would live in the hut. (Of course, no particular reason to believe that <PERSON> is correct.)", "391" ], [ "The reason why <PERSON> lives in a hut may be the specific circumstances of his appointment\r\n------------------------------------------------------------------------\r\n\r\nIn *Philosopher&#39;s Stone* <PERSON> tells <PERSON> the following:\r\n\r\n > \" ;Oh well – I was at Hogwarts meself but I – er – got expelled, ter\r\n > tell yeh the truth. In me third year. They snapped me wand in half an\r\n > everything. But <PERSON> let me stay on as gamekeeper. Great man,\r\n > <PERSON>. \" ;\r\n\r\nSimilarly, in *Chamber of Secrets* <PERSON> tells <PERSON>:\r\n\r\n > \" ;Only the Transfiguration teacher, <PERSON>, seemed to think <PERSON>\r\n > was innocent. He persuaded <PERSON> to keep <PERSON> and train him as\r\n > gamekeeper.\r\n\r\nThus, <PERSON> went straight from being a student at Hogwarts to being the gamekeeper (or gamekeeper-in-training). As a student he had undoubtedly lived in the castle. But if he would have retained his lodgings in the castle after his expulsion (or have been given separate lodgings in the castle), there would be nothing to distinguish him from any other student. He would simply be another 13 year old boy in the castle. \r\n\r\nBy putting him in a hut on the grounds they are actually removing him from Hogwarts. They are clearly marking him as a non-student, as an expelled student, as an outcast. To take this a step further, they may have even forbade him from entering the castle altogether as part of his punishment, or to prevent him from getting access to any magical education. And once he lived in the hut he never bothered to move back to the castle, even once he was older and the original reasons for his banishment might no longer apply.\r\n\r\nThus, it is possible that the reason why <PERSON> lived in a hut was not because of his job, or his personality, or anything like that. It may have simply been the result of the circumstances in which he was removed from Hogwarts and appointed as gamekeeper.", "391" ], [ "When Professor <PERSON> is introduced at Hogwarts in *Goblet of Fire* we are told:\r\n\r\n > It was usual for new staff members to be greeted with applause\r\n\r\nIndeed, when <PERSON> was appointed as the teacher for Care of Magical Creatures in *Prisoner of Azkaban* he received a nice amount of applause:\r\n\r\n > <PERSON>, <PERSON>, and <PERSON> stared at one another, stunned.Then they\r\n > joined in with the applause, which was tumultuous at the Gryffindor\r\n > table in particular.\r\n\r\nIt thus doesn&#39;t seem odd that he would receive applause when he returned from Azkaban in *Chamber of Secrets*.", "391" ], [ "There appear to be nine books; however, both <PERSON> and <PERSON> himself describe the seven books on the Hogwarts list as the complete set\r\n------------------------------------------------------------------------\r\n\r\nIn the beginning of *Chamber of Secrets* Harry&#39;s booklist contains the following titles by <PERSON>:\r\n\r\n 1. *Break with a Banshee*\r\n 2. *Gadding with Ghouls*\r\n 3. *Holidays with Hags*\r\n 4. *Travels with Trolls*\r\n 5. *Voyages with Vampires*\r\n 6. *Wanderings with Werewolves*\r\n 7. *Year with the Yeti*\r\n\r\nFred promptly says (my emphasis):\r\n\r\n > \" ;You&#39;ve been told to get **all Lockhart&#39;s books**, too! \" ;\r\n\r\nThis would imply that the complete set of Lockhart&#39;s books is seven in number.\r\n\r\nWhen they are degnoming the garden Mrs. <PERSON> reads from <PERSON> Household Pests* so that brings us up to eight books altogether.\r\n\r\n\r\nWhen they meet <PERSON> in Flourish and Blotts he is signing copies of *Magical Me*, which would bring us up to nine books.\r\n\r\n<PERSON> gives <PERSON> a complete set of his books:\r\n\r\n > The crowd cheered and clapped and <PERSON> found himself being presented\r\n > with the entire works of <PERSON>.\r\n\r\n<PERSON> promptly gives these books to <PERSON>:\r\n\r\n > \" ;You have these. \" ; <PERSON> mumbled to her, tipping the books into the\r\n > cauldron. \" ;I&#39;ll buy my own – \" ;\r\n\r\nThis implies that there wouldn&#39;t be too many other books besides for the seven that were required for school, because otherwise there would be no need to give them to <PERSON>, nor to buy others for himself.\r\n\r\n\r\n<PERSON> himself, in the first Defense Against the Dark arts class appears to describe the books on the Hogwarts list as the complete set:\r\n\r\n > \" ;I see you&#39;ve all bought a complete set of my books – well done. \" ;", "391" ] ]
279
[ 15010, 18092, 15506, 12725, 12939, 13907, 9598, 13965, 2316, 14637, 1920, 12138, 15835, 15292, 273, 5600, 15795, 10143, 13048, 5753, 8989, 15637, 18028, 15674, 18889, 7369, 9918, 16697, 8891, 17857, 9148, 4389, 17967, 15208, 14966, 12852, 992, 6753, 16538, 12223, 15634, 12850, 11949, 4752, 19035, 8719, 1475, 17464, 10251, 15957, 11335, 2770, 13417, 13210, 8793, 18228, 8332, 10348, 8003, 13349, 16898, 7053, 12382, 10049, 16038, 3838, 6373, 6275, 17698, 3218, 15438, 6577, 5903, 6156, 16160, 11414, 4819, 14957, 13937, 15336, 8560, 14067, 17002, 12233, 8988, 14774, 3331, 16712, 7357, 18530, 710, 1589, 12279, 17199, 4544, 13366, 18636, 6413, 16444, 14348, 4614, 9006, 17863, 8263, 9671, 2116, 8956, 5122, 7372, 19150, 8244, 18677, 13280, 5978, 12803, 5321, 12283, 11782, 12187, 5519, 4946, 19251, 10270, 16590, 6541, 4153, 16817, 4674, 6243, 678, 8886, 785, 3232, 15739, 2806, 19054, 5620, 17166, 11299, 4179, 6651, 18727, 16200, 17730, 14267, 14968, 11379, 2208, 16593, 2445, 5337, 6048, 331, 822, 7179, 17335, 8573, 5572, 18376, 4250, 8693, 18365, 14729, 1083, 640, 2177, 550, 9574, 8326, 1800, 15667, 5010, 954, 11843, 14014, 5960, 1503, 5856, 530, 17808, 8559, 10804, 16094, 7115, 2418, 15932, 15150, 16287, 12344, 5026, 11361, 7233, 9779, 8497, 4966, 3408, 18353, 11404, 3219, 15647, 10098, 5864, 5394, 5367, 1071, 13623, 7118, 18848, 18431, 12452, 4443, 8429, 6671, 17796, 7080, 13599, 18055, 8143, 1512, 948, 6274, 10713, 11633, 10511, 16362, 5215, 19224, 4532, 4347, 17822, 2660, 7297, 4187, 9230, 12874, 14571, 11577, 10966, 13278, 13677, 5758, 18452, 2514, 11308, 13739, 12589, 14886, 6626, 1023, 19319, 6913, 795, 18127, 8833, 906, 8324, 13358, 968, 14390, 14757, 11589, 3404, 19507, 15854, 13935, 12020, 6452, 4888, 10470, 2413, 15395, 2076, 437, 13468, 9845, 18832, 7384, 2883, 5471, 18204, 18094, 9437, 14981, 4084, 6290, 6940, 15073, 6946, 6759, 3426, 12805, 876, 7932, 613, 18248, 925, 8916, 7679, 16689, 3160, 12023, 14452, 12294, 7350, 5284, 12847, 7132, 1562, 19250, 17964, 2395, 5121, 14492, 5557, 15821, 854, 8784, 7395, 10102, 4348, 5635, 16926, 6963, 14098, 2123, 5687, 16489, 13379, 5743, 19466, 9539, 1282, 14048, 15573, 2399, 962, 17945, 13933, 17924, 2207, 4513, 14070, 10074, 1278, 3921, 4358, 1865, 1763, 4774, 2891, 4272, 7050, 6897, 16972, 11422, 1827, 15351, 5975, 1701, 709, 16125, 6678, 12981, 5894, 7316, 18039, 12011, 6318, 7585, 11171, 15245, 16373, 5209, 12017, 8558, 1802, 5893, 786, 7622, 16309, 2967, 5218, 4108, 16940, 568, 19086, 13908, 19417, 3621, 2006, 11188, 17363, 6617, 11934, 19605, 3494, 19295, 12908, 8182, 11290, 12126, 3075, 16093, 6532, 14974, 5444, 15579, 2049, 16613, 4751, 16507, 2432, 8436, 16868, 14844, 6222, 769, 2564, 4630, 3645, 630, 12742, 6088, 7318, 3406, 14680, 13355, 15962, 3257, 7914, 12622, 11377, 4655, 7084, 17080, 9285, 17410, 5493, 4243, 6181, 11467, 3523, 3946, 17484, 16052, 16060, 11177, 3888, 11946, 14345, 13522, 1757, 16936, 3860, 2472, 7989, 8856, 9150, 7742, 17630, 850, 18223, 19043, 84, 11770, 15257, 9846, 690, 18259, 16558, 4555, 1173, 3839, 5633, 18224, 17321, 16432, 16466, 6894, 15899, 2368, 4180, 12952, 10841, 7876, 6189, 17014, 1225, 7173, 4943, 11795, 9073, 3363, 5724, 880, 7022, 3793, 8621, 14416 ]
STX_100441.0
[ [ "From some Portuguese language textbooks, I learned the following definitions:\r\n\r\n - linear motion (_movimento linear_): motion along a line;\r\n - rectilinear motion (_movimento retil&#237;neo_): motion along a straight line;\r\n - curvilinear motion (_movimento curvil&#237;neo_): motion along a curved line.\r\n\r\nJudging by those definitions, it&#39;s clear that _linear_ includes _rectilinear_ and _curvilinear_, what seems logical when I look at the words, but it seems that, in English language Physics, _linear motion_ is the same as _rectilinear motion_.\r\n\r\nShould that difference be considered a simple linguistic difference? A divergence in how the original concepts evolved and were reinterpreted in each language? Or, contrary to what seemed to me, does _linear_ also include _recti-_ and _curvilinear_ motions in English?\r\n\r\n**Edit**:\r\n\r\nIt was said that a \" ;linear motion \" ; would be simply \" ;motion \" ; if defined the way I described. I think that&#39;s true if you have already restricted ourselves to the motion of `particles`, since the motion of solid bodies and fluids are not fully described as lines.\r\n\r\nI should explain that I found that distinction in Portuguese in the context of `uniform` and `uniformly varying` motion. As the motion of a car moving on a road or a float in the stream of a river are usually nonrectilinear but might be considered as at approximately constant speed, the concept of `uniform linear motion` (constant velocity magnitude) is used instead of that of `uniform rectilinear motion` (constant velocity vector).\r\n\r\nIt seems that Brazilians use the expression `uniform linear motion` to refer to `uniform curvilinear motion` (the adjective \" ;curvilinear \" ; is rared used here) while English speakers use it to `uniform rectilinear motion` (I guess \" ;rectilinear \" ; is rarely used there, since it&#39;s a synonym of \" ;linear \" ; in practice).", "106" ], [ "@knzhou Well, besides that \" ;linear motion \" ; thing, I can&#39;t recall other extra Physics terms in Portuguese language, compared to English. Come to think of it, the translations in practice are `pt. \" ;linear \" ;: en. \" ;curvilinear \" ;`, `pt. \" ;retil&#237;neo \" ;: en. \" ;linear \" ;`. Althought our \" ;linear \" ; rigorously includes \" ;retil&#237;neo \" ;, it&#39;s mostly used to take into consideration that the motion is not along a **straight** line.", "237" ], [ "I have given some people access to a Monte Carlo program that I created to simulate ferrofluids. They adapted it in order to simulate hysteresis loops. I had warned that Metropolis algorithm can only provide expected values of physical quantities for systems in thermal equilibrium. That means that a certain value of magnetic field **B** will provide a single value for magnetization **M**. That is to say that it only represents para- or superparamagnetic behaviour for a model of spheres with fixed magnetic moment magnitude.\r\n\r\nI had also told them that they could note some kind of hysteresis curve if they changed the magnetic field before the system reached thermal equilibrium, but that I didn&#39;t know how to link that to reality. They actually did so and note very nice hysteresis curves that looks pretty similar to experimenta hysteresis curves.\r\n\r\nThe problem is that the observed remanence depends on how many Monte Carlo steps the program takes to change a given \\Delta{B}. They showed me those results and I opined they could possibly interpreted it by relating a given amount of MC steps to a \\Delta{t}. However, by doing that we would be admitting that the time taken to change B by a certain amount changes the value of the remanent and coercive fields.\r\n\r\nDoes that happens in experiment? Or is the hysteresis curve always the same, with no regards to how fast the field varies?", "974" ], [ "@CuriousOne Surely, MC steps are not time steps, but there are some tricks to relate them in some MC methods. It&#39;s certain that a hysteresis curve will never be observed for dipolar hard sphere model through Metropolis algorithm if the system is allowed to converge to thermal equilibrium in each B value. The trick of the simulation I described was changing B before the system reaches equilibrium. Otherwise, a superparamagnetic curve, with no hysteresis, is obtained.", "974" ], [ "@CuriousOne Besides, as colloidal magnetic particles can be displaced by means of magnetic field gradients, a simulation may focus on the nanoparticles positions instead of their magnetic moments. Also, one might not be interested in the evolution of single nanoparticles, but in how the density of nanoparticles change. Or in how the overall colloidal system magnetic moment changes. For that, _exact_ rotational and translational trajectories of individual particles are not necessary, as long as they follow a realistic tendence as a group.", "106" ], [ "Lets consider a net, that should map image to an arbitrary four-sided 2D polygon (all vertices are scaled to (0,0) - (1,1)). We need a loss function with a gradient to train it. If we try to use some simple loss function like euclidean distance between 4 target corners and 4 predicted corners - a problem arises. Target corners we supply to the net *aren&#39;t ordered*. Sure, we can list them in, say, clockwise order, but the start point will be random. Our loss function should expect (p1 p2 p3 p4) to be equal to (p2 p3 p4 p1). Any attempt, I think, to somehow fix the starting point (say, lets start with a point with min x, then clockwise) will result in instability in some cases (two points with equal minimal x) and the training will fail. \r\n\r\nMy first idea was to craft target data looking on a net output, selecting one of the four sequences ((p1 p2 p3 p4), (p2 p3 p4 p1), etc.) which gives minimal loss as target. Gradient descent thus will pursue closest sequence and converge on it. But in practice that failed due to stationary points - sometimes it gets stuck on *centers of polygon sides*, some training examples will push our 4 points clockwise, some - counterclockwise.\r\n\r\nMaybe there is a better space for polygon data where euclidean distance loss can be used? Or maybe some custom loss function like Jaccard measure of polygon areas in some space will work and will not be prone to local minima or stationary points?\r\n\r\nGoing further: what if we want to train a neural net to output *totally unordered* data, like a set of N points? If this is 1D points we can presumably sort them, but what to do in 2D or higher dimensional case?", "1003" ], [ "I&#39;m trying to make a detector of objects that occur very rarely (in images), planning to use a CNN binary classifier applied in a sliding/resized window. I&#39;ve constructed balanced 1:1 positive-negative training and test sets (is it a right thing to do in such case btw?), and classifier is doing fine on a test set in terms of accuracy. Now I want to control recall/precision of my classifier so, for example, it will not wrongly label too much of a majority class occurrences. \r\n\r\nObvious (for me) solution is to use same logistic loss which is used now, but weight type I and type II errors differently by multiplying loss in one of the two cases on some constant, which can be tuned. Is it right?\r\n\r\nP.S. On a second thought this is equivalent to weighting some training samples more than the others. Just adding more of one class will achieve the same I think.", "960" ], [ "They say that if $A = X \\times Y$, with $X$ _statistically independent_ of $Y$, then\r\n\r\n$$\\frac{\\Delta{A}}{A}=\\sqrt{ \\left(\\frac{\\Delta{X}}{X}\\right)^2 + \\left(\\frac{\\Delta{Y}}{Y}\\right)^2 }$$\r\n\r\nI can&#39;t understand why that is so geometrically.\r\n\r\nIf $X$ and $Y$ are interpreted as _lengths_ and $A$ as _area_, it is pretty easy to understand, geometrically, that\r\n\r\n$$\\Delta{A} = X\\times\\Delta{Y} + Y\\times\\Delta{X} + \\Delta{X}\\times\\Delta{Y}$$\r\n\r\nIgnoring the term $\\Delta{X}\\times\\Delta{Y}$ and dividing the both sides by $A$ ($= X \\times Y$), that expression becomes\r\n\r\n$$\\frac{\\Delta{A}}{A} = \\frac{\\Delta{X}}{X} + \\frac{\\Delta{Y}}{Y}$$\r\n\r\nwhich is different from\r\n\r\n$$\\frac{\\Delta{A}}{A}=\\sqrt{ \\left(\\frac{\\Delta{X}}{X}\\right)^2 + \\left(\\frac{\\Delta{Y}}{Y}\\right)^2 }$$\r\n\r\nwhich looks like a _distance_ calculation. I just can&#39;t see how a distance is related to $\\Delta{A}$.\r\n\r\nInterpreting $A$ as the area of a rectangle in a $XY$ plane, I do see that $\\Delta{X}^2+\\Delta{Y}^2$ is the how much the distance between two opposite corners of that rectangle varies with changes $\\Delta{X}$ in $X$ and $\\Delta{Y}$ in $Y$. But $\\Delta{A}$ is how much the _area_, not that distance, would vary.", "35" ], [ "Documentation about tikz-uml does not talk about it, but it is possible.\r\nIn fact, when you define a umlcall (or umlcallself), you draw two activity rectangles. On top and bottom of these rectangles, nodes are defined with special names.\r\n\r\nHere is the code for your example:\r\n\r\n \\begin{tikzpicture}\r\n \\begin{umlseqdiag}\r\n \\umlactor[x=0, class=Person]{me}\r\n \\umlboundary[x=6, class=Door]{door}\r\n \\umlcontrol[x=12, class=Bed]{bed}\r\n \\begin{umlcallself}[op={find keys}, name=callfk]{me}\r\n \\end{umlcallself}\r\n \\begin{umlcall}[op={open door}, return={door opened}]{me}{door}\r\n \\end{umlcall}\r\n \\umlnote[x=5,y=-5]{sb-callfk}{This note should be connected to my lifeline instead of the actor, e.g. after find keys.}\r\n \\end{umlseqdiag}\r\n \\end{tikzpicture}\r\n\r\nBy giving a name to the self call \" ;find keys \" ;, you can guess the name of these nodes.\r\n\r\nFor sender, you have on top of its activity rectangle a node called (st-callfk), st standing for \" ;start-top \" ;, and at the bottom, a node called (sb-callfk), sb standing for \" ;start-bottom \" ;.\r\nFor receiver, you have on top of its activity rectangle a node called (et-callfk), et standing for \" ;end-top \" ;, and at the bottom, a node called (eb-callfk), eb standing for \" ;end-bottom \" ;.\r\n\r\nI did not expected someone may need to define a note on a lifeline, so current node names are probably improvable. Perhaps using sender/receiver instead of start/end will be better. As I will make a new release of tikz-uml soon, I will update these node names.", "36" ], [ "You&#39;re right. tikz-uml offers a way to define global default value thanks to the command `\\tikzumlset` but I only activated it for drawing purpose, namely draw, fill and text options of each available UML element. I added the possibility to define global default value for quite every option of every element. This will be available soon in the new release of tikz-uml.", "650" ], [ "Sorry if I did wrong, I am newbie to stackexchange. When I released tikz-uml 3 years ago, I was not aware of its interest and did not check the web to know if someone wrote somewhere about the package. To fix some bugs I encountered, I discovered solutions here and all other posts about it. So I wanted to warn people that the package still lives and that I was finally aware of people&#39;s needs. Actually, the release should be next week, and as you suggest me to do, I will edit my answers to show new features, if it is possible. So thank you for your remarks.", "1023" ] ]
58
[ 17562, 4460, 6869, 17192, 1569, 5148, 8555, 4945, 9268, 4076, 3695, 13168, 12224, 17757, 4583, 4171, 10092, 10358, 5397, 1799, 6063, 3324, 19373, 4509, 9430, 8928, 7174, 18226, 6747, 19642, 9135, 3177, 17044, 28, 4940, 4136, 11202, 12310, 2631, 4745, 1554, 11027, 19471, 5150, 19242, 9686, 17148, 12127, 8873, 940, 10871, 5002, 16316, 4529, 6946, 16916, 4652, 18663, 5310, 13758, 565, 15563, 297, 1481, 7675, 18947, 7034, 17202, 2411, 16497, 1042, 18805, 16112, 23, 11272, 1265, 8697, 19447, 10165, 212, 10893, 883, 7576, 4369, 8864, 19313, 4314, 17862, 6459, 9856, 8564, 3100, 9697, 17507, 12632, 4274, 13334, 227, 8715, 16177, 15709, 17102, 4041, 7257, 18227, 71, 13679, 802, 18994, 11156, 11817, 5576, 122, 17622, 2179, 16847, 2973, 4690, 11513, 10794, 12257, 9386, 7296, 8734, 7650, 1273, 4992, 7476, 1954, 19470, 679, 15625, 10994, 16082, 19267, 6877, 4679, 19590, 16150, 7290, 17024, 12301, 11737, 7108, 2734, 14964, 3001, 2261, 261, 18296, 8392, 16015, 16032, 14243, 3223, 7221, 744, 4704, 12120, 16357, 3713, 218, 14971, 4301, 3687, 68, 18341, 10723, 2037, 7087, 7586, 528, 2805, 3352, 3927, 6066, 19138, 11329, 16012, 4855, 18811, 8748, 16753, 18105, 4818, 9532, 7559, 65, 8526, 17211, 19604, 18330, 19485, 14291, 3343, 11551, 7520, 15996, 4110, 17356, 7178, 1123, 18319, 12124, 19669, 7052, 4202, 9551, 19022, 14104, 4450, 15665, 18829, 10910, 5513, 6696, 13712, 10734, 2559, 19295, 16651, 1774, 1462, 503, 19117, 10369, 18878, 18609, 8064, 4031, 18193, 12914, 10285, 8170, 16434, 17205, 7392, 15624, 13823, 2167, 18723, 19393, 9319, 3102, 3765, 8313, 19337, 10491, 13302, 5501, 4703, 7217, 7940, 846, 5884, 14662, 18937, 82, 2983, 7415, 10844, 4960, 2089, 15716, 4161, 3887, 10219, 10056, 19596, 2465, 3920, 5087, 8568, 9623, 8350, 15441, 11368, 4680, 16547, 11246, 1363, 11485, 8727, 8290, 451, 14814, 12870, 16974, 11330, 3215, 19645, 5885, 8767, 5043, 3884, 1484, 18957, 7722, 8829, 6508, 15808, 714, 14424, 1370, 1157, 8434, 9395, 9157, 14897, 13073, 10954, 2323, 16390, 18138, 13517, 2456, 11213, 10017, 4836, 10046, 9672, 14410, 13161, 19057, 16318, 13013, 4768, 17932, 19626, 10043, 13525, 16803, 17207, 8594, 5524, 19152, 4775, 10936, 7518, 5997, 11941, 18406, 4075, 4593, 16742, 13162, 3357, 4343, 4083, 2665, 3190, 19579, 3903, 14840, 3717, 19552, 17020, 833, 16955, 14134, 18036, 9821, 4538, 19426, 4863, 16398, 11291, 13909, 3627, 198, 17604, 1921, 17851, 7270, 7269, 18765, 364, 6731, 4248, 4803, 3631, 19004, 11343, 5821, 12417, 1341, 13024, 18119, 10379, 7789, 10237, 13378, 10677, 18470, 12831, 11223, 4433, 9773, 10194, 6657, 17738, 16059, 3783, 18791, 16055, 17369, 10629, 15833, 8707, 6887, 2038, 13485, 10732, 16733, 7310, 8045, 17019, 358, 5895, 10633, 16747, 13194, 523, 14193, 6575, 1779, 17323, 19663, 12292, 6223, 4697, 10993, 3892, 636, 154, 5112, 15934, 9310, 5652, 9517, 100, 9382, 11532, 1129, 12447, 15859, 12539, 14153, 15011, 12681, 17364, 15215, 13183, 11410, 3496, 1501, 4535, 9630, 5174, 7699, 867, 2813, 18717, 7432, 16700, 11943, 4878, 6672, 1801, 17886, 17912, 4017, 3543, 5679, 6670, 27, 334, 2548, 7883, 6519, 2561, 6557, 13816, 17530, 4304, 13285, 4427, 4857, 13682, 12004, 378, 4059, 4130, 18731, 12583, 2221, 4467, 8745, 6746 ]
STX_10045057.0
[ [ "You can use a method to do this:\r\n\r\n int GetOption(int startRow, string[] options)\r\n {\r\n int currentOption = 0;\r\n ConsoleKeyInfo sizeKey = new ConsoleKeyInfo();\r\n\r\n do\r\n {\r\n for (int i = startRow; i < options.Length + startRow; i++)\r\n {\r\n if (currentOption == i - startRow)\r\n Console.SetCursorPosition(1, i);\r\n }\r\n\r\n sizeKey = Console.ReadKey();\r\n switch (sizeKey.Key)\r\n {\r\n case ConsoleKey.DownArrow:\r\n if (currentOption == options.Length - 1)\r\n currentOption = 0;\r\n else\r\n currentOption++;\r\n break;\r\n case ConsoleKey.UpArrow:\r\n if (currentOption == 0)\r\n currentOption = options.Length - 1;\r\n else\r\n currentOption--;\r\n break;\r\n }\r\n } while (sizeKey.Key != ConsoleKey.Enter);\r\n\r\n return currentOption;\r\n }\r\n\r\nUsage:\r\n\r\n string[] sizeOptions = { \" ;6-inches \" ;, \" ;Footlong \" ;};\r\n Console.WriteLine(); //Line 12\r\n Console.WriteLine( \" ;Choose a bread size. \" ;); //Line 13\r\n Console.WriteLine( \" ;[ ] \" ; + sizeOptions[0]); //Line 14\r\n Console.WriteLine( \" ;[ ] \" ; + sizeOptions[1]); //Line 15\r\n\r\n Row = 14;\r\n int currentSize = GetOption(Row, sizeOptions);\r\n Console.SetCursorPosition(0, 16);\r\n string size = sizeOptions[currentSize];\r\n\r\nI can&#39;t test it right now, but I hope it helps you!", "819" ], [ "You did well to point the direction and talk about refactoring. I agree that the path to the answer is important. But for someone that is learning, sometimes it&#39;s easier to visualize things with examples, not just description. Especially when we are talking about something as abstract as programming. You can&#39;t teach someone how to fish with just theory, right? Our answers complement each other and would be better together. (:", "795" ], [ "If you want your function to return something, it should not be `void`. If you don&#39;t want it to return something, `string result =` is not necessary. You have to decide what you really need. (**EDIT:** *Looks like you already did, and other answers covered this very well*). Also instead of holding those two lists, you should create a `class` or `struct` to your items:\r\n\r\n public class Item\r\n {\r\n public string Name { get; set; }\r\n public decimal Price{ get; set; }\r\n \r\n public Item(string name, decimal price)\r\n {\r\n Name = name;\r\n Price = price;\r\n }\r\n }\r\n\r\nAnd use it like this:\r\n\r\n static void Main(string[] args)\r\n {\r\n List < Item > items = new List < Item > ();\r\n \r\n items.Add(new Item( \" ;Bread \" ;, 2.50M));\r\n items.Add(new Item( \" ;Milk \" ;, 3.00M));\r\n items.Add(new Item( \" ;Juice \" ;, 4.50M));\r\n items.Add(new Item( \" ;Chocolate \" ;, 1.50M));\r\n items.Add(new Item( \" ;Cheese \" ;, 2.50M));\r\n items.Add(new Item( \" ;Ham \" ;, 3.50M));\r\n items.Add(new Item( \" ;Chicken \" ;, 13.50M));\r\n \r\n string result = PrintList(itemsNames, itemsPrices);\r\n \r\n Console.WriteLine( \" ;\\r\\nPress enter to continue... \" ;);\r\n Console.ReadKey();\r\n }\r\n \r\n public static string PrintList(List < Item > items)\r\n {\r\n var stringBuilder = new StringBuilder();\r\n for (int i = 0; i < items.Count; i++)\r\n {\r\n string names = items[i].Name;\r\n decimal prices = items[i].Price;\r\n sb.AppendLine($ \" ;The {names} costs ${prices} \" ;);\r\n }\r\n return sb.ToString();\r\n }\r\n\r\nThis will make your life much easier.\r\n\r\n**EDIT2:** Other ways to loop through the list:\r\n\r\n**foreach:**\r\n\r\n foreach(Item i in items)\r\n {\r\n string name = _URL_0_;\r\n decimal price = i.Price;\r\n }\r\n\r\n **while:**\r\n\r\n int i = 0;\r\n while(i < items.Count) \r\n {\r\n string name = items[i].Name;\r\n decimal price = items[i].Price;\r\n i++;\r\n }", "18" ], [ "The parser is not able do detect the language of your string. You&#39;ll have to explicitly tell it that the date is in Portuguese. This is what the second argument of the `Convert.ToDateTime` method is for.\r\n\r\nMethod documentation: _URL_0_\r\n\r\nFull list of culture codes supported: _URL_1_\r\n\r\nExample of use:\r\n\r\n CultureInfo culture = new CultureInfo( \" ;pt-BR \" ;);\r\n DateTime dateTimeValue = Convert.ToDateTime(youDateString, culture);", "764" ], [ "I don&#39;t see anything wrong with your code. As the error says, looks like there&#39;s another account already registered with the email of the Facebook account you&#39;re trying to login with. Does your app allow other login methods? \r\n\r\nFrom Firebase Help:\r\n\r\n > You can configure whether users can create multiple accounts that use\r\n > the same email address, but are linked to different sign-in methods.\r\n > For example, if you don&#39;t allow multiple accounts with the same email\r\n > address, a user cannot create a new account that signs in using a\r\n > Google Account with the email address <EMAIL_ADDRESS> if there already is\r\n > an account that signs in using the email address <EMAIL_ADDRESS> and a\r\n > password.\r\n\r\nLink: _URL_0_\r\n\r\nYou can fix this in your Firebase console. In `Authentication > Sign-in Method`, scroll down and you will see the section * \" ;Multiple accounts per email address \" ;*. Allow it and the error should be fixed.", "119" ], [ "You can use [`Input.inputString`][1] to get the characters entered in the current frame:\r\n\r\n > **Input.inputString**\r\n > \r\n > Returns the keyboard input entered this frame. (Read Only)\r\n > \r\n > Only ASCII characters are contained in the `inputString`.\r\n > \r\n > The string can contain two special characters which should be handled:\r\n > Character ` \" ;\\b \" ;` represents backspace. Character ` \" ;\\n \" ;` represents return\r\n > or enter.\r\n\r\nYou can see an example of how to use it in the documentation link above.\r\n\r\n [1]: _URL_0_", "567" ], [ "You have to set the `gameLoader` variable before trying to access it. Otherwise its value will always be `null` by default. There are lots of ways to do this. The simpler one is to just search for it in the scene using [`FindObjectOfType`][1]. Just add this to your SceneController&#39;s `Awake`:\r\n\r\n void Awake () \r\n {\r\n gameLoader = FindObjectOfType < GameLoader > ();\r\n }\r\n\r\nRemember that `FindObjectOfType` should be used only in one-time operations:\r\n\r\n > Please note that this function is very slow. It is not recommended to\r\n > use this function every frame. In most cases you can use the singleton\r\n > pattern instead.\r\n\r\n\r\n [1]: _URL_0_", "85" ], [ "This is odd. Try to create a new empty project and import the assets directly from Asset Store. Inside Unity, go to Window > Asset Store, search for 2D Game Kit, download it and click on Import. Don&#39;t know how you did it at the first time, but this way should work. I&#39;ve tried myself and the menu is there", "982" ], [ "I&#39;ve already used _URL_0_ tons of times in my projects to save data, and never worried about creating parameterless constructors for my serialized classes. \r\n\r\nRight now I am working on a project that fits this case. It uses _URL_0_ to serialize a few classes that do not have an parameterless constructor and it&#39;s working ok. However, I was warned by a colleague that I was lucky to have never had any problems, and that the error `ExecutionEngineException: Attempting to JIT compile method`&#160;could appear and crash my app at any time in iOS builds.\r\n\r\nI&#39;ve seen a lot of topics about _URL_0_ and Constructors or _URL_0_ and AOT, but nothing about _URL_0_, Constructors and AOT. At least nothing from this century. \r\n\r\nSo, my question is, should I be worried about my serialized classes with no parameterless constructors in iOS devices?\r\n\r\n**EDIT:** my classes HAVE constructors, but they receive arguments. I yould like to know if I need constructors without parameters besides them.", "89" ], [ "Probably the example project wasn&#39;t imported correctly. Try to create a new empty project and import the assets directly from Asset Store. Inside Unity, go to `Window > Asset Store`, search for **2D Game Kit**, download it and click on Import. Don&#39;t know how you did it at the first time, but this way should work. I&#39;ve tried myself and the menu is there.", "46" ], [ "The short answer is: no, there are no rules.\r\n\r\nHere you have a good answer explaining about the folder structure: _URL_0_\r\n\r\nAbout the scene hierarchy, the base I usually use is:\r\n\r\n Cameras\r\n ├── ... \r\n UI\r\n ├── ... \r\n Managers\r\n ├── ...\r\n Scenery\r\n ├── Static\r\n │ └── ...\r\n └── Non-static\r\n └── ...\r\n\r\nBut it **really** depends on the project. \r\n\r\nTake a look on this post in Unity blog about how to optimize your hierarchy: [Spotlight Team Best Practices: Optimizing the Hierarchy][1]. It has some good practices to follow when organizing the scene:\r\n\r\n > **Hierarchy Structure Guidelines** \r\n\r\n > - If something moves every frame, make\r\n > sure all its children care about position. Only rendering, physics,\r\n > audio, or core systems like that should be there. \r\n\r\n > - When dynamically\r\n > creating game objects at runtime, if they do not need to be children\r\n > of the spawner for the above reasons, spawn things at the root of the\r\n > scene. \r\n\r\n > - You can easily register everything you spawn and pass along the\r\n > ActiveInHeirarchy state of the spawner using OnEnable and OnDisable.\r\n\r\n > - Try to group your moving transforms such that you have around 50 or so\r\n > GameObjects per root. This lets the underlying system group your\r\n > TransformChangeDispatch jobs into a fairly optimal amount of work per\r\n > thread. Not so few that the thread overhead dominates; not so many\r\n > that you are waiting on thread execution.\r\n\r\n [1]: _URL_1_", "85" ], [ "Maybe a `for` loop would be more suitable for what you&#39;re trying to achieve.\r\n\r\n bool regexMatch = true;\r\n\r\n for (int i = 0; i < withRegex.Length; i++)\r\n {\r\n var r = new Regex(valuesToMatch[i], RegexOptions.IgnoreCase);\r\n\r\n if (!r.IsMatch(regexValuesToMatchWith[i]))\r\n {\r\n regexMatch = false;\r\n break;\r\n }\r\n }\r\n }\r\n\r\nThe `foreach` loop will compare each value with both email and SSN regex, which is unnecessary. Besides that, if you set `regexMatch` to true like you&#39;re doing, it&#39;s going to be true even if one of the comparisons doesn&#39;t match.\r\n\r\nI&#39;m assuming `valuesToMatch` and `regexValuesToMatchWith` are always of the same size and with data in correct order, based on your example.", "286" ], [ "This probably happened because you&#39;re setting the destination to positions inside the cubes, so your agent keeps trying to reach them though it&#39;s impossible. \r\n\r\nFirst of all, you may want to tell your agent to stop once one of the movement keys is pressed to avoid conflicts. You can use this to stop:\r\n\r\n agent.isStopped = true;\r\n agent.velocity = Vector3.zero;\r\n\r\nIf this is not enought to solve the problem, one workaround would be to put a `Nav Mesh Obstacle` Component in your cubes, check `Carve` and rebake your `Nav Mesh`. This way the agent would stop in the nearest point from the one you set, outside the cube. \r\n\r\nA second option would be to check the collision with the cubes, and tell your agent to stop once it collides with the one you clicked.\r\n\r\nHopefully one of these will work for you!", "845" ], [ "Probably your new objects are missing the RectTransform. Try this:\r\n\r\n GameObject txtObj = new GameObject( \" ;myText \" ;, typeof(RectTransform));\r\n\r\nAnd if you want them to show starting from top, uncheck both Height checkboxes at the Layout Component.\r\n\r\n**Edit:**\r\nIf you want the content to fit the text, keep the Height checkboxes checked and add the `ContentSizeFitter` component to the Content game object with `Vertical Fit` set to `Preferred Size`. The `txtObj` must also have a layout group attached. This should do the trick:\r\n\r\n public void CreateTextButtonClick(GameObject panel)\r\n {\r\n string text = \" ;hello.. \" ;;\r\n Debug.Log( \" ;Hey starting of this.. \" ;);\r\n\r\n //Create Canvas Text and make it child of the Canvas\r\n GameObject txtObj = new GameObject( \" ;myText \" ;, typeof(RectTransform));\r\n txtObj.transform.SetParent(panel.transform, false);\r\n HorizontalLayoutGroup layoutgroup = txtObj.AddComponent < HorizontalLayoutGroup > ();\r\n layoutgroup.childAlignment = TextAnchor.MiddleCenter;\r\n layoutgroup.childControlWidth = false;\r\n\r\n //image\r\n GameObject back = new GameObject( \" ;image \" ;);\r\n back.transform.SetParent(txtObj.transform, false);\r\n back.AddComponent < LayoutElement > ().ignoreLayout = true;\r\n Image i = back.AddComponent < Image > ();\r\n RectTransform imageRectTransform = back.GetComponent < RectTransform > ();\r\n imageRectTransform.anchorMin = Vector2.zero;\r\n imageRectTransform.anchorMax = Vector2.one;\r\n imageRectTransform.sizeDelta = Vector2.zero;\r\n\r\n //text\r\n GameObject pan = new GameObject( \" ;text \" ;);\r\n pan.transform.SetParent(txtObj.transform, false);\r\n\r\n //Attach Text,RectTransform, an put Font to it\r\n Text txt = pan.AddComponent < Text > ();\r\n txt.text = text;\r\n Font arialFont = Resources.GetBuiltinResource < Font > ( \" ;Arial.ttf \" ;);\r\n txt.font = arialFont;\r\n txt.lineSpacing = 1;\r\n txt.color = Color.blue;\r\n\r\n Debug.Log( \" ;Hey its done.. \" ;);\r\n }", "378" ], [ "You are calling `WaitingOnAction` on Update every frame, which will set the animator&#39;s `IsIdle` back to true and start a new `BackToPatrol` coroutine. This should not happen. Try to check if the character has reached it&#39;s destination before calling `WaitingOnAction` again. Something like:\r\n\r\n else if (Vector3.Distance(player.position, this.transform.position) > 30 & & !isPatrolling)\r\n {\r\n WaitingOnAction();\r\n }\r\n\r\nAnd in your Coroutine:\r\n\r\n IEnumerator BackToPatrol()\r\n {\r\n isPatrolling = true;\r\n yield return new WaitForSeconds(5);\r\n anim.SetBool( \" ;IsIdle \" ;, false);\r\n\r\n yield return StartCoroutine( \" ;Patrol \" ;); \r\n isPatrolling = false;\r\n }\r\n\r\n IEnumerator Patrol()\r\n {\r\n Debug.Log( \" ;In Patrol \" ;); \r\n agent.speed = patrolSpeed;\r\n agent.SetDestination(waypoints[waypointInd].transform.position);\r\n anim.SetBool( \" ;WalkForwards \" ;, true);\r\n agent.isStopped = false;\r\n\r\n while (Vector3.Distance(this.transform.position, waypoints[waypointInd].transform.position) > = 2 & & isPatrolling)\r\n {\r\n yield return null;\r\n }\r\n \r\n agent.isStopped = true;\r\n anim.SetBool( \" ;WalkForwards \" ;, false);\r\n waypointInd++;\r\n\r\n if(waypointInd > = waypoints.Length) waypointInd = 0;\r\n }\r\n\r\nI didn&#39;t test it, but something like this should work.", "121" ], [ "Since an AR Camera shows the real world, i think it doesn&#39;t make much sense to zoom or pan it. The AR Camera has to be aligned with the phone&#39;s camera to behave well, so it&#39;s movement should be controlled only by the user. What you can do is change the scale of the AR objects, giving a feeling of zoom.", "702" ], [ "Shouldn&#39;t you call list.Remove before changing the dict[ID]? You&#39;re trying to remove the instance you&#39;ve just created instead of the old one. There&#39;s no way the new instance is already on the list... I&#39;m supposing ResourceBuildings is a class since you&#39;ve said it can be null.", "721" ], [ "The reason why it&#39;s not working is because you&#39;re changing the value of `textField.text`, so when you repeat the process the substrings are generated with this new value, including the number. You shouldn&#39;t give up your first solution, it&#39;s much cleaner. Store the original value of the text field on Start:\r\n\r\n using System.Collections;\r\n using System.Collections.Generic;\r\n using System.Text;\r\n using UnityEngine;\r\n using UnityEngine.UI;\r\n \r\n public class CustomText : MonoBehaviour\r\n {\r\n public string toBeSearched;\r\n public Text textField;\r\n private string defaultValue;\r\n\r\n private void Start()\r\n {\r\n defaultValue = textField.text;\r\n GenerateRandomHour();\r\n }\r\n \r\n private void Update()\r\n {\r\n if (Input.GetKeyDown(KeyCode.Space))\r\n {\r\n GenerateRandomHour();\r\n }\r\n }\r\n \r\n private void GenerateRandomHour()\r\n {\r\n string numberName = Random.Range(1, 10).ToString();\r\n textField.text = string.Format(defaultValue, numberName);\r\n }\r\n }\r\n\r\nAdd the {0} directly to your text field value in the inspector:\r\n\r\n**Hello my friend, It&#39;s about time to wakeup. You were sleeping for almost {0} hours. My name is NAVI and i&#39;m your navigation helper in the game.**", "894" ], [ "Native Share has a way to choose what app you want to share with, but it&#39;s Android only:\r\n\r\n\t// Share on WhatsApp only, if installed (Android only)\r\n if( NativeShare.TargetExists( \" ;com.whatsapp \" ; ) )\r\n \t\tnew NativeShare().AddFile( filePath ).SetText( \" ;Hello world! \" ; ).SetTarget( \" ;com.whatsapp \" ; ).Share();\r\n\r\nWith this, you could make one button for each app you want to allow the user to share with, preventing sharing with non-social apps. I think this is the closest you can get of what you want.\r\n\r\nUnfortunately I don&#39;t know if there are any workarounds for iOS and cancel/back button.", "888" ], [ "Assuming you&#39;re using _URL_0_, use the following class structure:\r\n\r\n public class RootObject\r\n {\r\n public Result[] result { get; set; }\r\n }\r\n\r\n public class Result\r\n {\r\n public Encabezado encabezado { get; set; }\r\n public Respuesta respuesta { get; set; }\r\n }\r\n\r\n public class Encabezado\r\n {\r\n public string resultado { get; set; }\r\n public string imensaje { get; set; }\r\n public string mensaje { get; set; }\r\n public string tiempo { get; set; }\r\n }\r\n\r\n public class Respuesta\r\n {\r\n public Datos datos { get; set; }\r\n }\r\n\r\n public class Datos\r\n {\r\n public string crear { get; set; }\r\n }\r\n\r\nAnd to deserialize:\r\n\r\n var json = \" ;{&#39;result&#39;: [{&#39;encabezado&#39;: {&#39;resultado&#39;: &#39;true&#39;,&#39;imensaje&#39;: &#39;&#39;,&#39;mensaje&#39;: &#39;&#39;,&#39;tiempo&#39;: &#39;28&#39;},&#39;respuesta&#39;: {&#39;datos&#39;: {&#39;crear&#39;: &#39;true&#39;}}}]} \" ;;\r\n RootObject info = JsonConvert.DeserializeObject < RootObject > (json);\r\n\r\n**TIP:** In Visual Studio, you can copy your JSON and go to `Edit > Paste Special > Paste JSON As Classes` and it will automatically generate the classes for you.", "125" ], [ "Try this:\r\n\r\n float left = 30;\r\n float right = 20;\r\n \r\n m_Viewport.anchorMin = Vector3.zero;\r\n m_Viewport.anchorMax = Vector3.one;\r\n m_Viewport.anchoredPosition = new Vector2((left - right)/2, 0f);\r\n m_Viewport.sizeDelta = new Vector2(-(left + right), 0);\r\n\r\n`sizeDelta` streches the rectTransform to left and right in the same proportion. As you want the left size different from the right size, you have to move the x position to adjust.", "378" ], [ "No, I don&#39;t know... The other answers lead me to believe that this is not possible. Even if you figure out some native code that tells you if the person closed the sharing dialog before actually share, you woudn&#39;t be able to know if he or she canceled the sharing **inside** the social app. Miguel&#39;s idea looks like the most viable way to do this, but it will only work if the link is clicked by the receiver, for what I understood.", "996" ], [ "To throw an exception, you will have to change the default Serialization Settings. By default, _URL_0_ ignores when a member of the Json is missing in the class:\r\n\r\n > `MissingMemberHandling` – By default this property is set to Ignore\r\n > which means that if the Json has a property that doesn’t exist on the\r\n > target object it just gets ignored. Setting this to Error will cause\r\n > an exception to be thrown if the json contains members that don’t\r\n > exist on the target object type.\r\n\r\nThe code should be something like this:\r\n\r\n JsonSerializerSettings serializerSettings = new JsonSerializerSettings();\r\n serializerSettings.MissingMemberHandling = MissingMemberHandling.Error;\r\n var response = JsonConvert.DeserializeObject < OrderResponse > (errorJson, serializerSettings);", "785" ], [ "Not sure what&#39;s going on here, but maybe what you want is something like this:\r\n\r\n public delegate void EventDelegate();\r\n\r\n //dictionary of events supported by this class\r\n protected Dictionary < EventName, EventDelegate > events = new Dictionary < EventName, EventDelegate > ();\r\n\r\n public void AddListener(EventName name, EventDelegate listener)\r\n {\r\n if (!events.ContainsKey(name))\r\n {\r\n events[name] = listener;\r\n }\r\n else\r\n {\r\n events[name] += listener;\r\n }\r\n }\r\n\r\n protected virtual void OnPickup(EventName name)\r\n {\r\n if (events.ContainsKey(name) & & events[name] != null)\r\n {\r\n events[name]();\r\n }\r\n }\r\n\r\nI really couldn&#39;t understand what you&#39;re trying to achieve, but the problem is that when you add `pickupEvent` to the dictionary, it&#39;s `null`. Then you add `listener` to nothing. If you really need that `pickupEvent`, add `listener` to it right before registering it to the Dictionary.", "516" ], [ "What about RemoveValueAsync? Here:\r\n\r\n[DatabaseReference.RemoveValueAsync][1]\r\n\r\nIt would be like\r\n\r\n DatabaseReference rootReference = FirebaseDatabase.DefaultInstance.RootReference;\r\n DatabaseReference childToRemove = rootReference.Child( \" ;your child path \" ;);\r\n \r\n childToRemove.RemoveValueSync().ContinueWith(\r\n (task) = > \r\n {\r\n if (task.IsCanceled || task.IsFaulted) Debug.Log( \" ;Fail \" ;);\r\n else if (task.IsCompleted) Debug.Log( \" ;Success \" ;);\r\n });\r\n\r\n [1]: _URL_0_", "721" ], [ "This is the ISO 8601 format, an international standard to represente date and time.\r\n\r\nIn your case, you have ` < date > T < time > < zone > `\r\n\r\n < date > = 2018-05-13 (YYYY-MM-DD)\r\n < time > = 10:03:18.4195735 (hh:mm:ss.sssssss)\r\n < zone > = +03:00\r\n\r\nYou can see more information about this convention here: [ISO 8601][1]\r\n\r\nProbably they&#39;re using something to parse it to `DateTime`. \r\n\r\nI don&#39;t know much about C++, but looks like you can use [`GetTimeZoneInformation`][2] to get the timezone (Windows only). The time and date I think you already have, though they&#39;re asking for more precision than milliseconds. Looks like you can get only 1/1000000 of second in C++ with `chrono` (one [nanosecond][3]), which would be 6 decimal places. Do they really need it so precise? If not you can just add a 0 in the 7th decimal place. \r\n\r\n [1]: _URL_2_\r\n [2]: _URL_1_\r\n [3]: _URL_0_", "813" ], [ "Complementing Andrew&#39;s answer, you can use the following class structure:\r\n\r\n public class Result\r\n {\r\n public Category[] categories { get; set; }\r\n public Description description { get; set; }\r\n public string requestId { get; set; }\r\n public Metadata metadata { get; set; }\r\n public Color color { get; set; }\r\n }\r\n\r\n public class Description\r\n {\r\n public string[] tags { get; set; }\r\n public Caption[] captions { get; set; }\r\n }\r\n\r\n public class Caption\r\n {\r\n public string text { get; set; }\r\n public float confidence { get; set; }\r\n }\r\n\r\n public class Metadata\r\n {\r\n public int width { get; set; }\r\n public int height { get; set; }\r\n public string format { get; set; }\r\n }\r\n\r\n public class Color\r\n {\r\n public string dominantColorForeground { get; set; }\r\n public string dominantColorBackground { get; set; }\r\n public string[] dominantColors { get; set; }\r\n public string accentColor { get; set; }\r\n public bool isBWImg { get; set; }\r\n }\r\n\r\n public class Category\r\n {\r\n public string name { get; set; }\r\n public float score { get; set; }\r\n }\r\n\r\nAnd then use Newsontsoft&#39;s `Result result = JsonConvert.DeserializeObject < Result > (json);` to deserialize your Json.\r\n\r\nNewtonsoft download: [_URL_0_][1]\r\n\r\n\r\n [1]: _URL_0_", "125" ], [ "You shouldn&#39;t change the score `Text` directly. Use a `Controller` to make the bridge instead. I would do something like this:\r\n\r\nPut this script somewhere in your scene:\r\n \r\n public class ScoreManager : Singleton < ScoreManager > \r\n {\r\n private int score = 0;\r\n \r\n // Event that will be called everytime the score&#39;s changed\r\n public static Action < int > OnScoreChanged; \r\n \r\n public void SetScore(int score)\r\n {\r\n this.score = score;\r\n InvokeOnScoreChanged();\r\n }\r\n \r\n public void AddScore(int score)\r\n {\r\n this.score += score;\r\n InvokeOnScoreChanged();\r\n }\r\n \r\n // Tells to the listeners that the score&#39;s changed\r\n private void InvokeOnScoreChanged()\r\n {\r\n if(OnScoreChanged != null)\r\n {\r\n OnScoreChanged(score);\r\n }\r\n }\r\n }\r\n\r\nThis script attached in the `Text` game object:\r\n\r\n [RequireComponent(typeof(Text))]\r\n public class ScoreText : MonoBehaviour\r\n {\r\n private Text scoreText;\r\n \r\n private void Awake()\r\n {\r\n scoreText = GetComponent < Text > ();\r\n RegisterEvents();\r\n }\r\n \r\n private void OnDestroy()\r\n {\r\n UnregisterEvents();\r\n }\r\n \r\n private void RegisterEvents()\r\n {\r\n // Register the listener to the manager&#39;s event \r\n ScoreManager.OnScoreChanged += HandleOnScoreChanged; \r\n }\r\n \r\n private void UnregisterEvents()\r\n {\r\n // Unregister the listener\r\n ScoreManager.OnScoreChanged -= HandleOnScoreChanged;\r\n }\r\n \r\n private void HandleOnScoreChanged(int newScore)\r\n {\r\n scoreText.text = newScore.ToString();\r\n }\r\n }\r\n\r\nAnd in your PickUps class:\r\n\r\n void DisplayScore()\r\n {\r\n ScoreManager.Instance.SetScore(Score); // Maybe what you need is AddScore to not \r\n // reset the value everytime\r\n }\r\n\r\nA simple singleton you can use (you can find more complete ones on the internet):\r\n\r\n public class Singleton < T > : MonoBehaviour where T : MonoBehaviour\r\n {\r\n static T instance;\r\n \r\n public static T Instance\r\n {\r\n get\r\n {\r\n if (instance == null)\r\n {\r\n instance = (T)FindObjectOfType(typeof(T));\r\n \r\n if (instance == null) Debug.LogError( \" ;Singleton of type \" ; + typeof(T).ToString() + \" ; not found in the scene. \" ;);\r\n }\r\n \r\n return instance;\r\n }\r\n }\r\n }\r\n\r\nBut **be careful**, the singleton pattern can be a shot in the foot if not used correctly. You should only it them moderately for managers.", "85" ] ]
304
[ 17361, 13834, 15258, 10667, 6128, 5681, 10697, 5070, 11291, 15436, 9220, 7581, 11397, 15121, 6130, 11407, 14052, 2512, 14295, 3497, 3753, 3814, 6623, 8606, 1904, 964, 6303, 17748, 4833, 1649, 12578, 17503, 17353, 19528, 2763, 11207, 19013, 14713, 6427, 13564, 19721, 4093, 11790, 13466, 13305, 11904, 16680, 820, 12760, 8763, 13698, 6948, 13189, 2460, 14335, 11693, 7007, 2317, 12666, 3498, 10782, 11331, 994, 9731, 10432, 1369, 8492, 18645, 10078, 11596, 13953, 13364, 13866, 16831, 1433, 12609, 11318, 13891, 11143, 9359, 139, 13770, 3125, 14233, 17662, 3969, 10480, 17600, 1943, 13409, 7783, 17144, 8350, 3114, 16512, 9072, 19463, 17468, 10856, 17380, 6518, 7878, 7974, 14491, 1406, 8654, 19590, 10676, 12687, 17646, 9399, 7570, 4969, 7161, 6988, 8068, 15383, 2312, 3194, 12658, 1808, 9003, 675, 10053, 14042, 11661, 16921, 8176, 13629, 17533, 3955, 6689, 16361, 16580, 15811, 14489, 6259, 4000, 2489, 6389, 13910, 148, 17724, 16313, 9968, 6642, 12097, 4418, 1647, 2466, 9660, 18425, 6159, 19018, 10571, 10832, 8336, 18446, 11449, 10461, 12757, 15066, 9414, 12271, 3995, 18599, 9623, 15652, 352, 5814, 11942, 9112, 10583, 10286, 6232, 9436, 6445, 3914, 9709, 15105, 17465, 18960, 18768, 10131, 18231, 19313, 14324, 16360, 102, 15937, 11634, 5906, 14574, 555, 3253, 7686, 17072, 15309, 4159, 18156, 13767, 11272, 8294, 723, 13563, 8629, 5359, 5516, 11504, 8664, 11590, 4551, 19503, 3098, 12552, 17838, 3269, 2922, 16726, 5090, 8145, 506, 10925, 15323, 5331, 12785, 8894, 9266, 18096, 14719, 5316, 3429, 12457, 9227, 8970, 4688, 5146, 17053, 6801, 15095, 4748, 14213, 17726, 6188, 13784, 17574, 13159, 13923, 18736, 7610, 4178, 2482, 16296, 2069, 12780, 5250, 8134, 12174, 14524, 10152, 12103, 248, 12819, 17706, 19195, 16818, 18971, 11214, 4520, 8554, 7701, 5988, 1916, 2238, 6813, 18070, 3438, 952, 2051, 2268, 16346, 6686, 13088, 12710, 8726, 14238, 8898, 10566, 5640, 4498, 5655, 18222, 9738, 4675, 8571, 6178, 14575, 7521, 15909, 17066, 14702, 3742, 15319, 12496, 639, 1381, 10885, 7479, 13776, 15471, 14312, 5302, 6516, 16009, 18674, 4660, 13887, 17447, 11385, 15171, 1126, 19254, 7644, 12236, 982, 5138, 10198, 1901, 19675, 2895, 13333, 14734, 13911, 14643, 10672, 6118, 594, 5979, 17471, 6261, 69, 15060, 18269, 2244, 8259, 14802, 1162, 6507, 1913, 13176, 17500, 10368, 15566, 8260, 707, 4436, 14054, 16731, 14878, 14215, 3304, 4589, 4137, 11481, 8907, 10243, 14249, 13714, 16105, 7946, 18414, 13982, 17373, 13687, 18240, 8061, 14290, 16614, 6609, 14187, 14798, 17511, 16128, 17305, 10463, 8486, 16522, 13144, 4653, 12387, 8844, 9523, 1596, 12006, 17673, 16005, 8240, 19165, 9261, 6434, 10386, 17831, 12139, 7279, 9571, 4495, 12257, 1578, 8635, 8895, 4288, 16464, 17700, 4074, 17202, 13789, 5366, 9010, 13448, 14675, 15249, 4170, 3182, 10756, 874, 6798, 14825, 5993, 7505, 15596, 5282, 18189, 8356, 16849, 6060, 17860, 8536, 4531, 13056, 210, 6875, 6477, 912, 1641, 3662, 11712, 10347, 1828, 13141, 11107, 10000, 15541, 8405, 11479, 9122, 5155, 1184, 12778, 8079, 8906, 16796, 6502, 10593, 10195, 13811, 18933, 14846, 4977, 2202, 183, 19110, 16244, 14147, 19078, 18120, 14805, 19037, 6435, 12056, 6437, 9215, 5845, 15775, 7463, 16787, 5025, 19094, 11792, 162, 7879, 12746, 17298, 7457, 6492, 2035, 18843, 16594, 14012, 8155 ]
STX_100463.0
[ [ "I am working on the following problem: \r\n\r\n > Let $R$ be an additive abelian group. Turn $R$ into a ring by defining $xy = 0$ for all $x$, $y$ $\\in$ $R$. Under which conditions is an ideal $I$ of $R$ prime?\r\n\r\nI have already shown that if $I$ is prime, then $R - I$ is at most a singleton by showing the contrapositive:\r\n\r\n > Suppose $I \\subset R$ is an ideal of $R$ such that $R - I$ has at least two elements, $x$ and $y$. Then, $x$, $y$ $\\notin I$, but because of how multiplication is defined in the ring $R$, $xy=0$, so $xy \\in I$, since $I$ is an ideal and thus an additive subgroup of $R$ (and therefore must contain the additive identity element $0$). \r\n > \r\n > However, since $xy \\in I$, but $x \\notin I$, $y \\notin I$, $I$ is not prime.\r\n\r\nWhat I did here though is just show something that has to be true if we already know that $I$ is prime, NOT a condition that $I$ must meet if we want to conclude that it is prime.\r\n\r\nI was therefore wondering if this condition is sufficient as well - i.e., that $R - I$ at most a singleton $\\implies$ that $I$ is prime, and if so, how do I show it? From the way multiplication is defined in $R$, for any $v, w \\in R$, $vw =0$. Thus, this must hold for any two $a,b \\in I$ as well. If it helps, the determination of conditions under which $I$ is prime is part (b) of the question. Part (a) asked me to describe all ideals of $R$, and for that part I answered by proving that all ideals of $R$ are additive subgroups. So, if $R - I$ is a singleton, then its additive inverse can&#39;t be in $I$, and so I&#39;m very confused.\r\n\r\n----------\r\n**UPDATE**: It has been brought to my attention that this condition is NOT also sufficient. Therefore, I am at an absolute loss as what would be a sufficient condition. Could somebody please help me figure out what is? Thank you in advance.", "967" ], [ "Let $R = R_{1} \\oplus R_{2}$ and let $I_{1}$ and $I_{2}$ be ideals of rings $R_{1}$ and $R_{2}$, respectively. \r\n\r\nWe consider $R_{1}$ and $R_{2}$ as subrings of $R$ under canonical embeddings $R_{i} \\to R$ and thus $I_{1}$ and $I_{2}$ are considered as subrings of $R$.\r\n\r\nI need to do the following two things:\r\n\r\n > a. Prove that $I_{1}$ and $I_{2}$ are ideals of $R$. \r\n > \r\n > b. If each $I_{i}$ is a proper ideal of $R_{i}$, determine whether the ideal $I_{1}+I_{2}$ of $R$ is maximal. Is it prime?\r\n\r\nFor part (a), if we identify $I_{1} = I_{1}\\times 0$, then in order for it to be an ideal of $R$, I need it to be both an additive subgroup of $R_{1} \\times R_{2}$ and I would need $(R_{1}\\times R_{2})(I_{1}) \\subseteq I_{1}$ and $(I_{1})(R_{1} \\times R_{2}) \\subseteq I_{1}$. The latter two things especially are confusing me because of the direct sum notation.\r\n\r\nCould anybody assist me with this part especially - hints for part (b) as to how to get at least started are also welcome.\r\n\r\nThank you.", "967" ], [ "actually, I have to disagree with you about what you said regarding part (b). In order for $I_{1} + I_{2}$ to be prime if and only if $R/(I_{1}+I_{2})$ is a(n integral) domain, $R$ needs to be a non-zero commutative ring with identity. I never said it had to be. FYI, I&#39;m not working in a rng vs. ring framework. When I say ring, I mean that it does not have the identity unless I specifically say that it has the identity. I also never said anywhere that it had to be commutative. So I don&#39;t think that argument works here.", "476" ], [ "After being given the following definition of the least common multiple, $lcm$:\r\n\r\n > Let $R$ be a commutative ring with identity. Let $x,y\\in R$. It is said that $m \\in R$ is the **least common multiplier** of $x$ and $y$ if the following conditions are satisfied:\r\n > \r\n > - $x | m$ and $y | m$\r\n > \r\n > - If $x|m^{\\prime}$ and $y|m^{\\prime}$, then $m|m^{\\prime}$\r\n\r\nAs is the case for the **greatest common divisor** in such a ring, I want to say that the **$lcm$ is unique up to associates**, meaning if $m$ and $m^{\\prime}$ are both $lcm(x,y)$, then $m | m^{\\prime}$ and $m^{\\prime}|m$, and we write $m \\sim m^{\\prime}$.\r\n\r\nTo justify this, I give the following argument:\r\n\r\n > Suppose first that $m = lcm(x,y)$. Then this implies that $x|m$, $y|m$. If $m^{\\prime}$ is any other multiple of $x$ and $y$ (including another alleged $lcm$), we also have that $x|m^{\\prime}$, $y|m^{\\prime}$. So, we must have that $m|m^{\\prime}$.\r\n > \r\n > Suppose instead that $m^{\\prime} = lcm(x,y)$. Then this implies that $x|m^{\\prime}$, $y|m^{\\prime}$. If $m$ is any other multiple of $x$ and $y$ (including another alleged $lcm$), we also have that $x|m$, $y|m$. So, we must have that $m^{\\prime}|m$.\r\n > \r\n > Since both $m$ and $m^{\\prime}$ are the $lcm(x,y)$, we must have that $m|m^{\\prime}$ and $m^{\\prime}|m$. Therefore, $m$ and $m^{\\prime}$ are associates - i.e., $m \\sim m^{\\prime}$.\r\n\r\nMy question is whether my proof is correct and looks how it&#39;s generally supposed to look.\r\n\r\nIf not, how should I fix it?\r\n\r\nThanks in advance.", "334" ], [ "@dxiv I wasn&#39;t even thinking about my question - I was thinking about other people&#39;s questions regarding how to show that the lcm exists in a Unique Factorization Domain. My earlier question about uniqueness up to associates wasn&#39;t assuming anything about even being in a Unique Factorization Domain, so an lcm wasn&#39;t even guaranteed to exist at all. Here, I am trying to show that one must exist because we are now in a UFD. Also, I would like these \" ;trivial \" ; cases explained to me.", "209" ], [ "I had to find the $\\gcd$ of the following polynomials in $\\mathbb{Q}[x]$ using the Euclidean algorithm, and I wanted to check that I had done so correctly, since my notes on the subject from class are a little questionable.\r\n\r\n 1. $x^{3}-1$ and $x^{2}+x-2$\r\n\r\n > My attempt:\r\n > \r\n > Using polynomial long division to divide $y:=x^{3}-1$ by $x:=x^{2}+x-2$, on the first step, I obtained\r\n > $$ x^{3}-1 = (x-1)(x^{2}+x-2)+(3x-3) $$\r\n > where the remainder $r= 3x-3$\r\n > \r\n > Now, on the second step, replace $y$ with $r$ to obtain $y:=3x-3$, $x:=x^{2}+x-2$, and swap $x$ and $y$ so that now $y:=x^{2}+x-2$ and $x:=3x-3$.\r\n > \r\n > Using polynomial long division to divide $y$ by $x$, I obtain that \r\n > $$\\displaystyle x^{2}+x-2 = \\left( \\frac{1}{3}x+\\frac{2}{3}\\right)(3x-3) + 0 $$\r\n > \r\n > And so now that $r=0$, \r\n > $$\\mathbf{\\gcd(x^{2}+x-2,\\, x^{3}-1) = \\gcd(3x-3,\\, x^{2}+x-2)} = 3x-3$$\r\n\r\n 2. $x^{4}+1$ and $x+1$\r\n\r\n > My attempt:\r\n > \r\n > Using polynomial long division to divide $y:=x^{4}+1$ by $x:=x+1$, on the first step, I obtained\r\n > $$ x^{4}+1 = (x+1)(x^{3}-x^{2}+x-1)+2 $$\r\n > where the remainder $r= 2$\r\n > \r\n > Now, on the second step, replace $y$ with $r$ to obtain $y:=2$, $x:=x+1$, and swap $x$ and $y$ so that now $y:=x+1$ and $x:=2$.\r\n > \r\n > Using polynomial long division to divide $y$ by $x$, I obtain that \r\n > $$\\displaystyle x+1 = \\left( \\frac{1}{2}x+\\frac{1}{2}\\right)(2) + 0 $$\r\n > \r\n > And so now that $r=0$, \r\n > $$\\mathbf{\\gcd(x^{4}+1,\\, x+1) = \\gcd(2,\\, x+1} )= 2$$\r\n > \r\n > Since $2$ is a unit in $\\mathbb{Q}$, this means that $x^{4}+1$ and $x+1$ are relatively prime in $\\mathbb{Q}[x]$\r\n\r\nDid I do these correctly? \r\n\r\nFor the second one, especially, I wasn&#39;t sure if that actually meant that the two polynomials were relatively prime in $\\mathbb{Q}[x]$, because my notes didn&#39;t say anything about that, but it seemed to make sense.\r\n\r\nThank you ahead of time.", "965" ], [ "@rschwieb I have a bunch of questions: 1. When user0990 says $G$ is a free abelian group, how does he know that? Because it&#39;s infinite cyclic, and so is isomorphic to one copy of $\\mathbb{Z}$? 2. I don&#39;t know what a localization is - I&#39;ve come across group rings and this problem in a first year graduate level algebra course, and we haven&#39;t learned anything that sophisticated. Would it be possible for you to edit your answer to explain it in simpler terms? 3. How do you know it is isomorphic to $\\mathbb{Q}[x,x^{-1}]$? That seems strange to me since $G$ is cyclic and should have only 1 generator", "23" ], [ "This question is related to [this][1] one, in that I am asking about the same problem, but not necessarily about the same aspect of the problem.\r\n\r\nI need to identify all units of the group ring $\\mathbb{Q}(G)$ where $G$ is an infinite cyclic group.\r\n\r\nNow, as I understand it, if $R$ is a ring and $G$ is a group, then if we consider the set of all formal sums \r\n\r\n$$r_{1}g_{1}+r_{2}g_{2}+\\cdots + r_{k}g_{k},$$ \r\n\r\n$r_{i} \\in R$, $g_{i} \\in G$, where we allow the empty sum to play the part of the zero element $0$, \r\n\r\nthen if we consider two formal sums to be equivalent if they have the same reduced form, the group ring $R(G)$ refers to the set of equivalence of classes of such sums with respect to this equivalence relation.\r\n\r\nIn this case, then, since $\\mathbb{Q} = R$ and $G$ is some infinite cyclic group, say $\\langle x \\rangle$ (although, if it is an infinite cyclic group, couldn&#39;t we say that it is isomorphic to $\\mathbb{Z}$?), so our sums look like \r\n\r\n$$q_{1}x_{1} + q_{2}x_{2} + \\cdots + q_{k}x_{k}$$\r\n\r\nfor some rationals $q_{i}$ and elements of $\\langle x \\rangle$, $x_{i}$. \r\n\r\nNow, the units of this group ring are the nonzero, invertible elements, and that various relationships exist among units, principal ideals, and associate elements. I am not sure how to apply any of this information to this situation, though, as I am relatively inexperienced with working with group rings.\r\n\r\nMoreover, I did find the answered question I linked to above, but this answer uses some terminology that I am unfamiliar with: for example, I do not know what it means to be a \" ;localization of \\mathbb{Q}[x] \" ;, and I only know a little bit about <PERSON> polynomials from Complex Analysis, which I&#39;m assuming is where he is getting the negative powers from in his answer.\r\n\r\nNow, among my questions is: **1. How do you know that $\\mathbb{Q}(G)$ is isomorphic to $\\mathbb{Q}[x, x^{-1}]$?** That it is seems weird to me, since $G$ here is supposed to be cyclic, and he seems to be saying that a group ring on a cyclic group is isomorphic to a group ring on a group with two generators, but perhaps my confusion just stems from my inexperience with group rings? If someone could please explain this to me, I would be forever grateful. Also, **2. what is the actual isomorphism used or how do you show that the two group rings are isomorphic? 3. How does this tell us what the units are?**\r\n\r\nI&#39;m extremely confused and I thank you very much in advance for your time, help, and patience!\r\n\r\n [1]: _URL_0_", "23" ], [ "I&#39;m trying to show that $\\mathbb{Z}[\\sqrt{-5}]$ is not a principal ideal domain by showing that $3$, which I&#39;ve already shown is irreducible in $\\mathbb{Z}[\\sqrt{-5}]$, is not prime there.\r\n\r\nTo that effect, My goal is to show that although $3$ divides $(2+\\sqrt{-5})(2-\\sqrt{-5})=3^{2}$, neither of the factors $2+\\sqrt{-5}$ or $2-\\sqrt{-5}$ is divisible by $3$. \r\n\r\nThere are a plethora of examples out there showing $\\mathbb{Z}[\\sqrt{-5}]$ is not a PID by using similar techniques, but when it comes time to show that something like $2+\\sqrt{-5}$ is not divisible by $3$, the details are completely glossed over. \r\n\r\nI realize that another method of approaching this problem is to show that it is not a UFD, and I have actually already completed the proof that way. I also wanted to approach it this way, but I don&#39;t know how to show that $2+\\sqrt{-5}$ is not divisible by $3$. There is nothing in my class notes that is helpful, so if anyone could please show me in detail how to do this at long last, I would be eternally grateful.", "967" ], [ "Let $R$ be a commutative ring with identity and let $f: R[x]\\to R$ be a ring homomorphism defined by \r\n\r\n$$ f(r_0 + r_1 x + \\cdots + r_n x^n) = r_0 + r_1 + \\cdots + r_n. $$\r\n\r\nI need to prove that $\\ker f$ is a principal ideal of $R[x]$, and find an element of $R[x]$ that generates $\\ker f$.\r\n\r\nApparently, here $f$ is the evaluation map that evaluates every polynomial with coefficients in $R$ at $x = 1$. However, I can&#39;t even figure out what the kernel of this homomorphism is, let alone how to show that it is a principal ideal, since I can&#39;t figure out when $r_0 + r_1 + \\cdots r_n = 0$. \r\n\r\nMy thoughts thus far are that if $n+1$ is even (i.e., when there is an even number of terms), the image of $f$ is $0$ when $\\forall i$ from $i = 0$ to $n$, $\\exists j$ from $j = 0$ to $n$ such that $i \\neq j$ and $r_i = -r_j$. \r\n\r\nOn the other hand, if $n+1$ is odd, then $n$ must be even. So supposing that an odd number $k$ of the terms $= 0$, then for the remaining $m:=n+1 - k$ terms, of which there are an even number, if we renumber them as $s_0$ to $s_{m-1}$, then the image of $f$ is $0$ when $\\forall i$ from $i = 0$ to $m-1$, $\\exists j$ from $j = 0$ to $m-1$ such that $i \\neq j$ and $s_i = -s_j$.\r\n\r\nI don&#39;t, however, know how to write this compactly and in such a way where it would be easy to show that it is principal and to tell what element of $R[x]$ generates it.\r\n\r\nCould somebody please assist me with this? **First**, if I am not on the right track with identifying the kernel of $f$, please help me do so. **Secondly**, once I have the kernel identified, how do I show that it is a principal ideal of $R[x]$ and (**thirdly**) go about identifying its generator?\r\n\r\nThank you ahead of time for your help and patience!", "476" ], [ "okay so $x-1 \\in \\ker f$, and up until now, I misunderstood the rest of what you were doing. I thought that we needed to show that $x-1$ WAS the $\\ker f$. But we don&#39;t actually have to identify exactly what the $\\ker f$ is equal to here in order to get the job done, do we? All we need to do, as you said is show that $\\ker f \\in (x-1)$, and to do that, we must show that any $p(x) \\in \\ker f $ belongs to $(x-1)$. Is the answer to the second part: \" ;find an element of $R[x]$ which generates $\\ker f$ \" ; $x-1$, then?", "695" ], [ "thanks! Believe it or not, continuing to write things out, I was able to get there: since $p(x)$ is an arbitrary polynomial in $\\ker f$, we conclude that every such polynomial can be expressed as $p(x) = (x-1)q(x)$, for some $q(x) \\in R[x]$. Then, $\\ker f \\in$ the set of all multiples of $x-1$ in $R[x]$. So, coupled with the earlier thing we said about how all multiples of $x-1$ in $R[x]$ are contained in $\\ker f$, we have that $\\ker f = $ this set. Since $f$ is a ring homomorphism, $\\ker f$ is an ideal, and an ideal consisting of all multiples of a single element is principal ideal.", "967" ], [ "Let $G = \\langle x \\rangle$ be the infinite cyclic group generated by an element $x$. The group ring $R = \\mathbb{Q}(G)$ consists of finite sums of the form $$ r_{-m}x^{-m}+r_{-m+1}x^{-m+1}+\\cdots + r_{-1}x^{-1} + r_{0} + r_{1}x + \\cdots + r_{n}x^{n} $$\r\n\r\nwhere $m,n \\geq 0$ and $r_{-m}$, $r_{-m+1}$, $\\cdots$, $r_{n}$ are rational numbers. The ring of polynomials $\\mathbb{Q}[x]$ is naturally embedded in $R$.\r\n\r\nI need to prove that any element $f \\in R$ is an associate to the polynomial $\\overline{f}\\in \\mathbb{Q}[x]$ (i.e., $f|\\overline{f}$ and $\\overline{f}|f$), the only thing is, **I am not entirely sure what $\\overline{f}$ is supposed to be in this context.** \r\n\r\nIs it some kind of conjugate? Is it just any polynomial in $\\mathbb{Q}[x]$? (And so I&#39;m just showing that any of the finite sums in $R$ is associate to any polynomial in $\\mathbb{Q}[x]$?)\r\n\r\nIf someone could explain to me what $\\overline{f}$ is supposed to be here, that would help immensely.\r\n\r\nThank you!", "23" ], [ "As an example of a continuous function that needs not map open sets to open sets, our professor exhibited the identity map:\r\n\r\n$$ 1_{x}:(X, \\mathcal{T}) \\to (X, \\mathcal{O})$$\r\n$$ x \\mapsto x$$\r\n\r\nwhen $\\mathcal{O}$ is a proper subset of $\\mathcal{T}$, but I&#39;m not sure I understand why.\r\n\r\nCould someone please explain this to me?\r\n\r\nIf $x \\in \\mathcal{T}$ but is not in $\\mathcal{O}$, it seems to me that it could be mapped to $\\emptyset$, which is always open. Or would this then contradict the fact that it&#39;s the identity map, and thus, $x$ needs to be mapped to itself?\r\n\r\nI&#39;m possibly overthinking this, but humor me anyway.", "15" ], [ "Recall Tychonoff&#39;s Product Theorem:\r\n\r\n > Given a family of topological spaces $(X_{\\alpha}, \\mathcal{T}_{\\alpha})_{\\alpha \\in \\Lambda}$, $(\\prod_{\\alpha}X_{\\alpha}, \\mathcal{T}_{\\text{prod}})$ (where $\\mathcal{T}_{\\text{prod}}$ is the Product topology) is compact if and only if each topological space $(X_{\\alpha}, \\mathcal{T}_{\\alpha})_{\\alpha \\in \\Lambda}$ is compact.\r\n\r\nThe proof of this theorem relies on Alexander&#39;s Theorem, which states that&#39;s a topological space on $X$ is compact if and only if every covering of $X$ by ***subbasic elements of $\\mathcal{T}$*** has a finite subcovering.\r\n\r\nI was wondering what is the advantage to appealing only to subbasic sets in the proof of Tychonoff&#39;s Product Theorem? Does there also exist a proof that relies on the more traditional approach of every open covering implying a finite subcovering?\r\n\r\nThank you for indulging my curiosity!", "778" ], [ "I am trying to prove that the one-point compactification of the interval $(0,1)$ with the Euclidean Topology is $S_{1} = \\{(x,y)\\in \\mathbb{R}^{2}|x^{2}+y^{2}=1\\}$ and I am having some trouble getting there. \r\n\r\nThe process I am going by has two steps: \r\n\r\n 1. Show that $(0,1)$ is homeomorphic to $S_{1} - \\{ (1,0)\\}$\r\n 2. Show that the one-point compactification of $S_{1} - \\{(1,0)\\}$ is $S_{1}$ itself.\r\n \r\n\r\nRight now, I am stuck on Step 1: \r\n\r\nWhat I did was I set up a mapping $g: (0,1) \\to S_{1} - \\{ (1,0) \\}$ defined by $g: x \\mapsto (\\cos 2\\pi x, \\sin 2 \\pi x)$. Now, I need to show that $g$ is a homeomorphism. \r\n\r\nTo show that $g$ is onto, I said that if we let $X:= \\cos 2 \\pi x$ and $Y:= \\sin 2 \\pi x $, $X^{2}+Y^{2} = (\\cos 2\\pi x)^{2} + (\\sin 2 \\pi x)^{2} = \\cos ^{2} 2\\pi x + \\sin^{2} 2 \\pi x = 1$, so every point on the unit circle is given by $(X,Y)$. The only point on the unit circle we are not including is $X=1$, $Y=0$, but the preimage of this point under $g$ would be the point $x = 0$, which is not included in the domain. Therefore, the range consists solely of the image set of $g$, so $g$ is onto.\r\n\r\nTo show that $g$ is one-to-one, literally what I did was, I drew graphs of the sine and cosine functions from $0$ to $2\\pi$ side-by-side on the same plot, and pointed out that as the parameter $x$ ranges from $0$ to $1$, $X = \\cos 2\\pi x$ ranges from $\\cos (0) $ to $\\cos (2 \\pi)$ and $Y = \\sin 2 \\pi x$ ranges from $\\sin (0)$ to $\\sin (2 \\pi)$. Looking at the graphs, we see that for no $x_{1} \\neq x_{2}$ do we obtain $(\\cos (2\\pi x_{1}), \\sin(2 \\pi x_{1})) = (\\cos (2 \\pi x_{2}), \\sin(2 \\pi x_{2}))$, so clearly $g$ is one-to-one as well.\r\n\r\n**I feel as though these two proofs are too handwavey - could anyone provide me with more rigorous looking way of proving these things?**\r\n\r\nReally, though, what I wanted to ask about is showing that $g$ is continuous and an open map. If I can show these two things, I can show that $g$ is a homeomorphism and thus I will have part 1 completed. However, normally, to show that $g$ is continuous, I would take an arbitrary open set in the range, so an arbitrary open set in $S_{1}-\\{ (1, 0) \\}$ and show that its preimage is also open in the interval $(0,1)$. T**he problem here is that I don&#39;t know what an arbitrary open set in $S_{1}-\\{ (1,0) \\}$ looks like! Can somebody please show me how to prove this part?** I imagine that once I&#39;ve seen what this proof is supposed to look like, showing that an open set in $(0,1)$ maps to an open set in $S_{1} - \\{(1,0)\\}$ won&#39;t be too hard. Although, if you want to provide me with a proof of that too, I won&#39;t complain!\r\n\r\nThank you ahead of time for your help and patience!", "731" ], [ "Let $F$ be a field and let $f,g \\in F[x]$ be two coprime polynomials. I need to prove that for every $h \\in F[x]$, there exist $h_{1}, h_{2} \\in F[x]$ such that \r\n$$ h_{1}f + h_{2}g+h=0$$\r\n\r\n**What I attempted is the following:** \r\n\r\n > Suppose $F$ is a field and $f,g\\in F[x]$ are coprime polynomials. Then $\\gcd(f,g)=1$.\r\n > \r\n > Since $F$ is a field, we have that $F[x]$ is a Euclidean domain. Moreover, we also have results that say that the ring of polynomials with one variable over a field is a principal ideal domain, and hence a unique factorization domain.\r\n > \r\n > Therefore, we have that if $1 = \\gcd(f(x),g(x))$, then \r\n$$ 1 = r_{1}(x)f(x) + r_{2}(x)g(x) $$\r\n > for some $r_{1}(x), r_{2}(x) \\in F[x]$.\r\n > \r\n > Since $F[x]$ is a principal ideal domain, it is also an integral domain, and thus has no zero divisors. Therefore, we are able to multiply the last equation through by any $k(x)\\in F[x]$ to obtain\r\n$$k(x) = k(x)r_{1}(x)f(x) + k(x)r_{2}(x)g(x) $$\r\n > Now, subtracting $k(x)$ from both sides, we obtain \r\n$$ k(x)r_{1}(x)f(x) + k(x)r_{2}(x)g(x) - k(x) = 0 $$\r\n > Now, define\r\n$$ h(x):=-k(x) $$\r\n$$ h_{1}(x):=k(x)r_{1}(x)$$\r\n$$ h_{2}(x):=k(x)r_{2}(x) $$\r\n > Then, the last equation becomes\r\n$$ h_{1}(x)f(x) + h_{2}(x)g(x)+h(x) = 0. $$\r\n > Since $k(x)$ was any arbitrary element of $F[x]$, for any $h \\in F[x]$, we were able to find $h_{1}$, $h_{2} \\in F[x]$ (depending on $h$) such that $h_{1}f+h_{2}g+h=0$.\r\n\r\n**Is what I did correct?** If not, what can I do to fix it?\r\n\r\nIt just seemed too easy to me - we have everything in place we need to get the $ 1 = r_{1}(x)f(x) + r_{2}(x)g(x)$, and from there to get to the $h_{1}f+h_{2}g+h=0$. So, I thought I would ask just to make sure.\r\n\r\nI thank you for your help!", "449" ], [ "Let $R$ be a division ring and $n \\geq 2$. I need to identify up to isomorphism all homomorphic images of the $n$-th power of $R$:\r\n\r\n$$ R^{n} = R \\oplus R \\oplus \\cdots \\oplus R\\quad (\\text{for}\\,n\\, \\text{summands}\\, R)$$\r\n\r\n(Note that $R$ is not given to be a ring with identity. I don&#39;t use the ring/rng terminology. BUT, see next parenthetical statement.)\r\n\r\nNow, recall that a division ring $R$ is a ring such that the set $R\\setminus\\{ 0\\}$ of nonzero elements of $R$ is a group under multiplication, meaning every nonzero element has a multiplicative inverse (so does this mean then that $R$ IS a ring with identity??), but $R$ is not necessarily commutative.\r\n\r\nAnother thing I know is that every division ring is an integral domain, but I also know that the property of not having zero divisors is not preserved under the direct sum. \r\n\r\nFinally, by the First Isomorphism Theorem, I know that if $f:R\\to S$ is a ring homomorphism, then $R/\\ker f \\simeq \\text{Im} f$. \r\n\r\nFrom this point, I do not know how to proceed. How do I put all of these things together to prove what I need to prove? Is induction required here? \r\n\r\nPlease help - and I thank you for your time and patience", "476" ], [ "**I need to determine which, if any, of the following ideals in $\\mathbb{Z}_{3}[x]$are maximal:** \r\n\r\n$$\\mathbf{(2)},\\, \\mathbf{(x+1)},\\, \\text{and}\\, \\mathbf{(x^{2}+x+1)}$$\r\n\r\n(i.e., the principal ideals generated by the polynomials $2$, $x+1$, and $x^{2}+x+1$, respectively).\r\n\r\nThis is my attempt:\r\n\r\n - For $(x+1)$: \r\n\r\n > $\\mathbb{Z}_{3}$ is a field, since $3$ is prime. Therefore, $\\mathbb{Z}_{3}[x]$ is an integral domain.\r\n > \r\n > Moreover, since $\\mathbb{Z}_{3}$ is a field, it is vacuously a unique factorization domain. Therefore, $\\mathbb{Z}_{3}[x]$ is also a unique factorization domain.\r\n > \r\n > Now, for $f = x+1 = x - (-1) = x-2$ in $\\mathbb{Z}_{3}[x]$, the content is $C(f) = 1$, which is a unit of $\\mathbb{Z}_{3}$. Therefore, $x+1$ is primitive in $\\mathbb{Z}_{3}[x]$, which implies that $x+1$ is irreducible in $\\mathbb{Z}_{3}[x]$. Since $\\mathbb{Z}_{3}[x]$ is an integral domain, $(x+1)$ **is a maximal ideal** of $\\mathbb{Z}_{3}$\r\n\r\n - For $(x^{2}+x+1)$:\r\n\r\n > In $\\mathbb{Z}_{3}[x]$, $g = x^{2}+x+1=(x+2)(x+2)$, so $g$ is not irreducible there. Therefore, since $\\mathbb{Z}_{3}[x]$ is an integral domain, $(x^{2}+x+1)$ is **not maximal** there.\r\n\r\n - For $(2)$:\r\n\r\n > For $h = 2$, the content $C(h) = 2$, which is a unit of $\\mathbb{Z}_{3}$. Hence, $h$ is primitive in $\\mathbb{Z}_{3}[x]$\r\n > \r\n > Any possible factorization of $2$ in $\\mathbb{Z}_{3}$ will include $2$, so $2$ is an irreducible element of $\\mathbb{Z}_{3}[x]$, which implies that $(2)$ **is maximal**, since $\\mathbb{Z}_{3}[x]$ is an integral domain.\r\n\r\nIs this correct? If not, what can I do to fix them? I&#39;m worried I might be missing some subtlety here as to why a nonzero element $k \\in \\mathbb{Z}_{3}[x]$ irreducible implies $(k)$ maximal. I have a theorem that says that such \" ;$k$ in an integral domain $R$ is irreducible if and only if $(k)$ is a maximal ideal in the set of all principal ideals of $R$ \" ;, but does this necessarily mean that it is a maximal ideal of $R$ period?", "967" ], [ "Let $R = \\mathbb{Z}\\left[\\frac{1}{2} \\right]$ be the ring of all rational numbers of the form $\\displaystyle \\frac{n}{2^{m}}$. I need to describe the set of units of the polynomial ring $R[x_{1},x_{2}]$\r\n\r\nI am assuming that polynomials in this ring look like $f = \\frac{n_{3}}{2^{m_{3}}}x_{2}x_{1} +\\frac{n_{2}}{2^{m_{2}}}x_{2} + \\frac{n_{1}}{2^{m_{1}}}x_{1} + \\frac{n_{0}}{2^{m_{0}}}$? Where $n_{i}$ and $m_{i}$ are integers? \r\n\r\nWould I consider another polynomial $g = ax_{2}x_{1} + b x_{2} + cx_{1} + d$, multiply $f$ and $g$ together, and then figure out the general form I would need $a$, $b$, $c$, and $d$ to be in in order to get $fg=1$, or is there an easier and/or better way to approach this? If so, can you give me any guidance as to how to proceed?\r\n\r\nThanks in advance", "987" ], [ "Let $f \\in \\mathbb{Z}[x]$ be a non-constant polynomial where $p$ is a prime that is not a divisor of the leading coefficient of $f$.\r\n\r\nAssume that $f = g_{1}g_{2},\\ldots, g_{k}$ is a factorization of $f$ into a product of irreducible polynomials over $\\mathbb{Z}_p$ (i.e., all $g_i \\in Z_p[x]$ and $f$ is viewed as a polynomial over $\\mathbb{Z}_p$) and let $h$ be any divisor of $f$ over $\\mathbb{Z}$.\r\n\r\n**I need to prove that some $g_i$ is a divisor of $h$ over $\\mathbb{Z}_p$.**\r\n\r\n\r\n----------\r\n\r\nThis is my attempt so far: \r\n\r\n > If $h$ is a divisor of $f$ over $\\mathbb{Z}$, then $\\exists k \\in\r\n\\mathbb{Z}[x]$ such that $f = h \\cdot k$.\r\n > \r\n > Now, correct me if I&#39;m wrong, but I&#39;m assuming that $f$ can be\r\nconsidered the same polynomial over both $\\mathbb{Z}$ and\r\n$\\mathbb{Z}_{p}$ here, unless when we say that \" ;$h$ is a divisor of\r\n$f$ over $\\mathbb{Z}$ \" ;, we mean that it is the divisor of the image of\r\n$f$ (call it $\\tilde{f}$) under a map that takes $f$ from\r\n$\\mathbb{Z}_p \\to \\mathbb{Z}$, which we know is not a function. In\r\nthis case, then we have that $\\exists k \\in \\mathbb{Z}[x]$ such that\r\n$\\tilde{f}= h \\cdot k$. \r\n > \r\n > Then, reducing $\\tilde{f} \\mod p$ we obtain that $f = \\overline{h}\r\n\\cdot \\overline{k}$, where $\\overline{h}$ is $\\,h\\mod p\\,$ and\r\n $\\overline{k}$ is $k$ reduced modulo $p$. \r\n > \r\n > Now, we know that $f = \\overline{h} \\cdot \\overline{k} = g_1 g_2\r\n \\cdots g_k$. But, all this tells me is that some $g_i$ is a\r\n divisor of the product of $h$ over $\\mathbb{Z}_p$ and $k$ over\r\n $\\mathbb{Z}_p$.\r\n\r\n\r\n----------\r\n\r\n**At this point, I get completely stuck.** \r\n\r\nIt&#39;s entirely possible that this is not the correct way to approach this problem. If someone could help me figure out the right way to do this, I would be most appreciative! \r\n\r\nThank you for your time and petience!\r\n\r\nAlso, could be related to [this][1] question.\r\n\r\n\r\n [1]: _URL_0_", "449" ], [ "Consider the polynomial $$ f = 2x+1 $$\r\n\r\nI need to determine whether this polynomial is a unit (invertible element) in the polynomial ring $\\mathbb{Z}_{5}[x]$.\r\n\r\nIf it were a unit in this ring, then there would have to exist a polynomial of the form $ax+b$ with $a,b \\in \\mathbb{Z}_{5}$ such that $$ \\displaystyle (2x+1)(ax+b) = 1_{\\mathbb{Z}_{5}[x]} $$\r\n\r\nTo that effect, I supposed that such a polynomial existed, and multiplied out $$ (2x+1)(ax+b) = 2ax^{2}+(2b+a)x + b = 1$$\r\n\r\nThen, I solved the following system of equations in $\\mathbb{Z}_{5}$:\r\n$$ 2a = 0 \\quad (1) $$\r\n$$ a + 2b = 0 \\quad (2) $$\r\n$$ b = 1 \\quad (3) $$\r\n\r\nSupposing that equation $(3)$ holds, I substituted $b = 1$ into equation $(2)$, and got that $a = 3$. But, then if $a=3$, $2a = 1 \\neq 0$, so that $(1)$ does not hold. \r\n\r\nTherefore, the system of equations is inconsistent in $\\mathbb{Z}_{5}$, and so we can find no such $ax+b$, which in turn, implies that $2x+1$ is not a unit.\r\n\r\n**I was wondering if this is the correct way to approach this problem and if I have successfully proven what I set out to prove, which was that $f = 2x+1$ is not a unit in $\\mathbb{Z}_{5}$.**\r\n\r\nThank you for your time and patience.", "987" ], [ "I am given a polynomial $$ f = 2x^{2} + 4x + 6$$\r\n\r\nand I have to determine in which of the rings, $\\mathbb{Z}[x]$, $\\mathbb{Q}[x]$, or $\\mathbb{Z}_{5}[x]$, $f$ is a primitive polynomial, and I have to compute the content $C(f)$ in each case.\r\n\r\nFor $\\mathbb{Z}[x]$, I was able to calculate $C(f)$ by using the Euclidean algorithm on the coefficients $2,4,6$, and found it to be $2$. Since $2$ is not a unit in $\\mathbb{Z}$, I determined that $f$ is NOT primitive there.\r\n\r\nFor $\\mathbb{Z}_{5}[x]$, I reduced all the coefficients $\\mod 5$ and then found $C(f)$ to be equal to $1$, again, via the Euclidean algorithm. Since $1$ is a unit in $\\mathbb{Z}_{5}$, I determined that $f$ is primitive there.\r\n\r\nMy question is what to do in the case of $\\mathbb{Q}[x]$. Of course, all integers are also rationals, but can I use the same Euclidean algorithm to find the same $C(f)$, and then determine that because $2$ is a unit in $\\mathbb{Q}$ that $f$ is primitive in $\\mathbb{Q}[x]$? Or is there a different way to calculate the $\\gcd$ of rational numbers?\r\n\r\nThanks.", "751" ], [ "Lebesgue outer measure is usually defined as a function $m^{*}: \\{ \\text{subsets of }\\,\\mathbb{R} \\} \\to \\mathbb{R}_{\\geq 0} \\cup \\{ \\infty \\} $ where $m^{*}(A)=\\inf \\left\\{\\sum_{k=1}^{\\infty}l(I_{k})\\vert I_{1},\\cdots,\\, \\text{open intervals such that}\\, A \\subseteq \\cup_{k=1}^{\\infty}I_{k}\\right\\}$. \r\n\r\nI am being tasked with showing that the following function, $c^{*}: \\{ \\text{subsets of }\\,\\mathbb{R} \\} \\to \\mathbb{R}_{\\geq 0} \\cup \\{ \\infty \\}$ where $c^{*}(A)=\\inf \\left\\{\\sum_{k=1}^{n}l(I_{k})\\vert I_{1},\\cdots,I_{n}\\, \\text{closed, bounded intervals such that}\\, A \\subseteq \\cup_{k=1}^{n}I_{k}\\right\\} $, is equal to $m^{*}$. I have been provided with the hint to prove that every closed interval in the cover for $A$ can itself be covered by open intervals with arbitrarily small \" ;surplus \" ; and vice-versa, but I am really very confused and unsure how to do this (especially regarding weird subscripts).\r\n\r\nI was thinking to cover each $I_{i}$ with the set of $\\{I_{i,j} \\}_{j=1}^{n}$, and then the \" ;surplus \" ; would be covering the points in between the n intervals covering $I_{i}$, but I don&#39;t know how to express it mathematically. Could somebody please show me how to do this?", "301" ], [ "I am currently looking through Bartle&#39;s The Elements of Integration and Lebesgue Measure, and am reading the proof of the following theorem:\r\n\r\nIf $F_{k}$ is a decreasing sequence of <PERSON> measurable sets, and if $m(F_{1}) < \\infty$, then $\\displaystyle \\left(\\cap_{k=1}^{\\infty}F_{k}\\right) = \\lim_{k \\to \\infty} m(F_{k})$.\r\n\r\nThe proof defines $E_{k}:=F_{1}-F_{k}$ for $k \\in \\mathbb{N}$, \" ;so that $\\{E_{k}\\}$ is an increasing sequence of measurable sets \" ;. I find this a bit confusing: Essentially, this sequence consists of everything that is in $F_{1}$ but not in the subsequent $F_{k}$&#39;s. Could somebody please explain to me why this is an increasing sequence?\r\n\r\nAlso, why is the $m(F_{1}) < \\infty$ necessary? Is that just to make sure it&#39;s increasing (not sure whether <PERSON> uses \" ;increasing \" ; to mean \" ;strictly increasing \" ; or just \" ;nondecreasing \" ;)?", "301" ], [ "Let $F$ be the subset of $[0,1]$ constructed in the same manner as the <PERSON> set except that each of the intervals removed at $n$th iteration has a length $\\frac{\\alpha}{3^{n}}$ with $0 < \\alpha < 1$ rather than $\\frac{1}{3^{n}}$.\r\n\r\nI&#39;ve been told that on each iteration, each of the intervals removed has length $\\frac{\\alpha}{3^{n}}$, but that the total length of $F$ is $1-\\alpha$. \r\n\r\nI&#39;m trying to show this by taking the limit as $n \\to \\infty$ of the length of the intervals left behind at each iteration. For example, on the second iteration, the way I see it, two intervals of length $\\frac{\\alpha}{3^{2}}$ should be removed, so the length left behind would be $1-\\frac{\\alpha}{3} - \\frac{2\\alpha}{9} = 1-\\frac{5\\alpha}{3^{2}} = 1-\\left(\\alpha-\\frac{2\\alpha}{3}\\right)$.\r\n\r\nSo, my question is, a I correct in assuming that after the $n$th iteration, what is left behind will be $1-\\left(\\alpha - \\left(\\frac{2}{3}\\right)^{n}\\right)$, which, as $n \\to \\infty$, converges to $1-\\alpha$?", "156" ], [ "Related to a [question I asked earlier][1].:\r\n\r\nLet $F$ be the subset of $[0,1]$ constructed in the same manner as the <PERSON> set except that each of the intervals removed at the $n$th iteration has length $\\frac{\\alpha}{3^{n}}$ with $0 < \\alpha < 1$.\r\n\r\n**I need to show that $F$&#39;s complement, $[0,1]\\backslash F$ is dense in $[0,1]$.**\r\n\r\nI know that a $[0,1]\\backslash F$ is dense in $[0,1]$ if any open interval in $[0,1]$ contains a point of $[0,1]\\backslash F$. \r\n\r\nObviously, the open intervals in $[0,1]$ comprising $[0,1]\\backslash F$ contain points $[0,1]\\backslash F$,so, I just need to worry about the open intervals inside $[0,1]$ that are not part of $[0,1]\\backslash F$. \r\n\r\nHowever, those would be open intervals inside the <PERSON> set, and **while I know that the <PERSON> set does not contain any intervals of positive measure, I don&#39;t know how to show this** all epsilon-y (i.e., with neighborhoods, ets). Therefore, I was asking how to formally prove this (either an outline or a full proof is fine; hints are fine, too, if you don&#39;t mind follow-up questions.)\r\n\r\n\r\n [1]: _URL_0_", "356" ], [ "@Arthur, so total length remaining is $1-\\alpha$, so a length of $\\alpha$ is removed. But, I&#39;ve got to tell you, I am having a lot of trouble figuring out which points are guaranteed to be removed. I guess it would be right endpoint of closed interval $+ \\epsilon$ and left endpoint of closed interval $-\\epsilon$, but because of the $\\alpha$&#39;s, as opposed to even $1/3$rds, I am really having trouble visualizing this. Please elaborate more on what you mean. If you turned your comment into an answer with appropriate details, I might be willing to accept your answer and give you points.", "367" ], [ "@Arthur, maybe I&#39;m not clear as to the correct definition of a dense subset. I thought it meant if $A \\subset B$ is dense in $B$, then, $\\exists$ an open interval $(a,b) \\in B$ containing $x \\in A$. How does that coincide with the idea that if $[0,1]\\backslash F$ is not dense in $[0,1]$, then $F$ must contain an open interval? I&#39;m so confused! It&#39;s not true that if $A^{c}$ is dense then $A$ cannot be - look at the rationals and irrationals in $\\mathbb{R}$.", "356" ], [ "I&#39;m trying to find all non-negative integers $n$ satisfying $2^{n}\\equiv n^{2}\\pmod{5}$. \r\n\r\nSo far, all the progress I&#39;ve made is figuring out that $n^{2} mod \\, 5$ for $n=1$ to $5$ has the pattern \" ;$1,\\, 4,\\, 4,\\, 1,\\, 0$ \" ; which repeats $mod \\, 5$. Then, I started looking at powers of $2$ to see if there was a pattern to when they are $0,\\,1,\\,\\text{and}\\, -1\\, mod\\, 5$. I saw that when $n = 4k$, where $k$ is an integer $\\geq 0$, $2^{n}\\,mod\\,5 = 1$; for $n=5k$, where $k$ is an integer $\\geq 0$, $2^{n} \\, mod\\, 5 = -1$; and there exists no $n$ such that $2^{n} \\,mod\\, 5 = 0$.\r\n\r\nBut, I found no pattern as to when $2^{n}\\mod 5 = n^{2}\\,\\mod\\,5$, so then I can find all the $n$&#39;s that give me the divisibility I want.\r\n\r\nNo hints, please, I&#39;m not a number theorist and am really out of my comfort zone. Just complete answers, so I can figure out how problems that look like this are supposed to be done.\r\n\r\nThank you in advance", "874" ], [ "Let $N$ be a normal subgroup of $G$ and both groups $N$ and $G/N$ are cyclic. I need to prove that $G$ is generated by at most two elements. \r\n\r\nTo that effect, what sorts of things do we know about $G$ if $N$ is a subgroup of $G$ and $N$ and $G/N$ are both cyclic?\r\n\r\nI know that all cyclic groups are abelian, so $N$ and $G/N$ must both be abelian as well. Does that necessarily mean that $G$ itself is abelian? Or cyclic?\r\n\r\nReally, I am having a lot of trouble proving that $G$ is generated by at most two elements, especially in the case where $G$ is generated by a single element (i.e., is cyclic) and showing that it is not possible for $G$ to be generated by more than two elements.\r\n\r\nCould somebody please provide me with insight into this?\r\n\r\nThank you.", "570" ], [ "> \" ;Suppose $f$ and $g$ are continuous on the measurable set $E$. If $f = g$ a.e. on $E$, then $f=g$ on $E$. \" ;\r\n\r\nI have shown that this statement is true when $E = [a,b]$ and I have shown that the statement is true for $E$ when $m(E)\\neq 0$. However, my proof for the latter case never explicitly used the fact that $m(E)\\neq 0$.\r\n\r\nI have been told that the statement does not hold when $m(E)=0$. However, I am unconvinced (seems to me it should be vacuously true) and unable to prove it.\r\n\r\nCould somebody please share with me a quick, not too complicated proof for why the statement is not true when $m(E) = 0$?\r\n\r\nThank you.", "236" ], [ "This is related to a [question][1] I just asked, that I now think was based on wrong assumptions.\r\n\r\nIt is true that if $f=a$ a.e. on the interval $[a,b]$, then $f = a$ on $[a,b]$. However, apparently it is not true for a general measurable set $E$ with $m(E) \\neq 0$, which confuses me greatly. \r\n\r\nI just finished the following proof which I thought showed that the statement was true for a general measurable set $E$. Apparently, it&#39;s not. Could somebody please tell me 1) what&#39;s wrong with it, 2) how to fix it, 3) how to use it to show that the statement is not true for $E$ with $m(E) \\neq 0$ (or whichever kind of set it doesn&#39;t work for):\r\n\r\n > Suppose $f$ and $g$ are continuous on the general measurable set $E$. Suppose also that $E_{0}\\subseteq E$ is the set of all points where $f \\neq g$ are all contained (i.e., $\\forall x \\in E_{0}$, $f \\neq g$), where $m(E_{0})=0$.\r\n\r\n > Consider $|h|=|f-g|$. $|h|$ is the composition of a continuous function and the linear combination of two continuous functions, so $|h|$ is continuous.\r\n\r\n > Now, $E_{0} = |h|^{-1}(\\mathbb{R}\\backslash\\{0\\})=h^{-1}((-\\infty,0)\\cup (0,\\infty))$. $(-\\infty,0)\\cup(0,\\infty)$ is a union of open sets and therefore open. Since $|h|$ is continuous, $E_{0}$ is also open.\r\n\r\n > Since $E_{0}$ is open and $m(E_{0})=0$, it must be empty (as otherwise, it must contain a nonempty interval, whose measure would be positive. \r\n\r\n > Therefore, since the set of points on which $f \\neq g$ is empty, $f=g$ everywhere on $E$.\r\n\r\n\r\n [1]: _URL_0_", "301" ], [ "I need to prove that if $G$ is a group such that any two commutators of elements of $G$ commute, then $G$ is solvable.\r\n\r\nThis is the idea that I had: The subgroup of all commutators of $G$, $G^{\\prime}$ is a normal subgroup of $G$. Therefore, $G^{\\prime}$ is abelian. Hence, $G/G^{\\prime}$ is abelian, which in turn implies that $G$ is abelian, and thus solvable.\r\n\r\nIt doesn&#39;t seem right to me, however - it just seems too easy this way. I&#39;ll admit, I find cosets and subnormal series intimidating, and I&#39;m not sure I understand them completely. So, I&#39;m ready to be schooled by someone who can explain them well to me if that is the only way this problem can be solved.\r\n\r\nIn any case, please let me know if what I did was correct. If not, a full solution would be preferred - one with subnormal series explained thoroughly and clearly would be the best case scenario, so I can work backwards from your solution and hopefully learn something.", "570" ], [ "Neglecting round-off error, how many terms of the Maclaurin series for $\\sin x$ are required to obtain a maximum error of less than $10^{-7}$ in the range $[0,\\pi]$?\r\n\r\nThis is part (b); in part (a), I had to do the same thing for the range $[0, \\pi/2]$. Using the error term $E_{n}(x)=\\frac{1}{(n+1)!}f^{(n+1)}(\\xi)x^{n+1}$, I have that six terms are necessary, so $E_{n} \\leq \\frac{1}{13!}(1)x^{13}$. And this must be less than the upper end of the range, where we have $\\displaystyle \\frac{\\left( \\displaystyle \\frac{\\pi}{2}\\right)^{13}}{13!} \\approx 5.69 \\times 10^{-8}$.\r\n\r\nFor $[0,\\pi]$, however, I am unsure how to proceed. I would think that six terms would again be necessary, because the precision we want is the same. But, it seems too obvious. I&#39;d think that I&#39;d proceed the same way, and plug $\\pi$ into the 7th term again, but I don&#39;t know if that&#39;s the correct thing to do.\r\n\r\nPlease help! If I could see the whole thing worked out, that would be wonderful.", "886" ], [ "I just converted the fraction $\\frac{3}{5}$ to the following floating point binary number: $(1.001100110011001100110011\\cdots)_{2}\\times 2^{-1}$. \r\n\r\nNow, I am trying to find the two nearest machine numbers to 23 places to the right of the binary point. \r\n\r\nThe lower bound can be found by simply chopping after 23 places: $x_{\\_}=(1.00110011001100110011001)_{2}\\times 2^{-1}$.\r\n\r\nThe upper bound needs to be done by rounding up, but how do I round up $(1.001100110011001100110011\\cdots)_{2}\\times 2^{-1}$ to 23 places? Pleaes help - I am not yet comfortable working in binary.", "82" ], [ "Prove directly from the definition of Outer Measure $m^{*}$ that if $m^{*}(A) = 0$, then $m^{*}(A \\cup B)=m^{*}(B)$ (this is actually an exercise from <PERSON>, but our professor wants us to use the definition of Outer Measure (a function $m^{*}: \\{\\text{subsets of}\\,\\mathbb{R}\\} \\to \\mathbb{R}_{\\geq 0} \\cup \\{\\infty \\}$ defined as:\r\n\r\n > $m^{*}(A) = \\inf \\left \\{\\displaystyle \\sum_{k=1}^{\\infty} l(I_{k})\\, \\vert I_{1},I_{2},\\cdots \\text{open bounded intervals such that}\\, A \\subseteq \\cup_{k=1}^{\\infty} I_{k} \\right\\}$ (where $l(I_{k})$ is the length of the $k$th interval)).\r\n\r\nNow, let $m^{*}(B) = \\inf \\left \\{\\displaystyle \\sum_{k=1}^{\\infty} l(J_{k})\\, \\vert J_{1},J_{2},\\cdots \\text{open bounded intervals such that}\\, B \\subseteq \\cup_{k=1}^{\\infty} J_{k} \\right\\}$ and $m^{*}(A \\cup B) = \\inf \\left \\{\\displaystyle \\sum_{k=1}^{\\infty} l(M_{k})\\, \\vert M_{1},M_{2},\\cdots \\text{open bounded intervals such that}\\, A \\cup B \\subseteq \\cup_{k=1}^{\\infty} M_{k} \\right\\}$\r\n\r\n\r\nThe way I think the proof should go is the following:\r\n\r\n > $m^{*}(A \\cup B) = \\inf \\sum_{k=1}^{\\infty} l(M_{k}) = \\inf \\sum_{k=1}^{\\infty}l(I_{k}) + \\inf \\sum_{k=1}^{\\infty}l(J_{k}) = 0 + m^{*}(B) = m^{*}(B)$.\r\n\r\nHowever, in order to do this, I would (1) need to show that $\\cup_{k=1}^{\\infty} M_{k} = (\\cup_{k=1}^{\\infty}I_{k})\\cup (\\cup_{k=1}^{\\infty}J_{k})$ and (2) that this implies that $\\inf \\sum_{k=1}^{\\infty} l(M_{k}) = \\inf\\sum_{k=1}^{\\infty}l(I_{k}) + \\inf\\sum_{k=1}^{\\infty}l(J_{k})$.\r\n\r\nIt&#39;s frustrating, too, because this is supposed to be an easy exercise, and intuitively, it makes sense that the absolute minimum needed to cover $A \\cup B$ should also be the absolute minimum needed to cover $A$ plus the absolute minimum needed to cover $B$, but I need to show this in a mathematically rigorous way, and can&#39;t just assert things without being able to mathematically explain them. \r\n\r\nIf someone could please help me fill in the justification gaps in this proof and/or fix it if it&#39;s incorrect, it would be very much appreciated, and would definitely help me in my attempts to tackle the harder problems.", "301" ], [ "I am trying to show rigorously that $m^{*}(\\emptyset)$ is zero. I know intuitively why it makes sense, but intuitively isn&#39;t going to cut it - I need to show it rigorously where $m^{*}(A) = \\inf \\left\\{ \\sum_{k=1}^{n}l(I_{k}) | I_{1},\\cdots,I_{n}\\,\\text{open intervals,}\\,A \\subseteq \\cup_{k=1}^{n}I_{k}\\right\\}$. So, it&#39;s NOT THE USUAL DEFINITION OF AN OUTER MEASURE; IN THIS CASE, ONLY FINITE OPEN COVERS ARE ALLOWED.\r\n\r\nI actually have to show that $m^{*}$ is monotone and finitely subadditive as well, but right now, I&#39;m just working on this part.\r\n\r\nMy idea is that any collection of open intervals covers $\\emptyset$, since it is a subset of every set. So, we have some leniency in choosing our $I_{k}$&#39;s. I thought $\\left(-\\frac{1}{k},\\frac{1}{k} \\right)$ would be a good choice for the $I_{k}$&#39;s, since its length $l(I_{k})=\\frac{2}{k}$ for every $k$. \r\n\r\nThe problem is that I need to show that $\\inf \\left\\{\\sum_{k=1}^{n} \\frac{2}{k} \\right\\}$ either equals $0$ or is $\\leq 0$, and I am not sure how to do that. As essentially the $k$-th partial sum of the divergent series $\\sum_{k=1}^{\\infty}\\frac{2}{k}$, its is not getting any smaller as $k$ gets larger, so perhaps I picked the wrong series of intervals? Could somebody please help me 1) choose a good (finite) series of intervals and 2) show that the inf of the sum of the lengths of those intervals is what I need it to be in order to show that $m^{*}(\\emptyset)=0$ for this finite outer measure I have defined.\r\n\r\n(If you had hints on the other two parts, that would be great as well!)", "268" ], [ "I have the following proof, but I don&#39;t think it&#39;s right. Could somebody please tell me what&#39;s wrong with it, and how to fix it? Thanks :)\r\n\r\nLet $B$ be the set of rational numbers in the interval $[0,1]$ Let $I_{k}$, $k=1,2,\\cdots, n$ be a finite collection of open intervals that covers $B$. Prove that $\\sum_{k=1}^{n}l(I_{k})\\geq 1$.\r\n\r\n($l(I)$ denotes the length of the interval $I$).\r\n\r\n > $\\underline{\\mathbf{\\text{Proof}}}$: Suppose $a,b \\in [0,1]$ such that $a < b$. By the density of the rational numbers in $\\mathbb{R}$, $\\exists q_{i} \\in \\mathbb{Q}$ such that $\\forall a_{i} < b_{i}$, $q_{i}\\in(a_{i},b_{i})$.\r\n\r\n > Since the rationals are dense in $\\mathbb{R}$ and hence in $[0,1]$, we can cover $[0,1]$ as follows:\r\n\r\n > $[0,1] \\subseteq \\cup_{k=1}^{\\infty}I_{k}=\\cup_{k=1}^{\\infty} (a_{k},b_{k}) $.\r\n\r\n > (In the case where the $(a_{k},b_{k})$ do not completely cover $[0,1]$ completely, $\\exists$ a point between $(a_{i},b_{i})$ and $(a_{i+1}, b_{i+1})$ that remains uncovered. However, because there are countably many intervals, there will be only countably many such points. Thus, the set of points, call it $S$, being a countable set will have $m^{*}(S)=0$. So, these points will be negligible in terms of their effect on the sum of the lengths of the intervals.)\r\n\r\n > By Heine-Borel, since $[0,1]$ is closed and bounded, every such open cover has a finite subcover. So, $[0,1] \\subset \\cup_{k=1}^{n}(a_{k},b_{k}) = \\cup_{k=1}^{n}I_{k}$.\r\n\r\n > Now, the outer measure of an interval is its length. So $m^{*}([0,1])=l([0,1]) = 1$, and by the definition of the outer measure, $1 = m^{*}([0,1]) = \\inf_{k=1}^{n}l(I_{k}) \\leq \\sum_{k=1}^{n}l(I_{k})$ \r\n\r\nQ.E.D.\r\n\r\nI also realize this question has been asked before on here, but I am terribly dissatisfied with the answers that have thus far been given.", "356" ], [ "I am looking at a solution to the first part of problem 21 in Section 4.3 of Royden&#39;s Real Analysis.\r\n\r\nThe part of the problem I am interested in states as follows:\r\n\r\n > Let the function $f$be nonnegative and integrable over $E$ and $\\epsilon > 0$. Show tat there is a simple function $\\eta$ on $E$ that has finite support, $0 \\leq \\eta \\leq f$ on $E$ and $\\int_{E}|f-\\eta| < \\epsilon$. \r\n\r\nI am trying to justify the steps of the solution to myself.\r\n\r\nThe solution starts off as follows:\r\n\r\n > Let $\\epsilon > 0$. We know by the definition of the integral for non-negative measurable functions that there exists a bounded, measurable function of finite support, $h \\leq f$, such that $\\int_{E} h > \\int_{E}f-\\epsilon/2$.\r\n\r\nUp to this point, I am fine. It then goes on to state:\r\n\r\n > We also know that for any given bounded, measurable function $h$ with finite support, there exists a simple function $\\eta \\leq h$ **with the same support as $h$** such that $\\int_{E}\\eta > \\int_{E}h - \\epsilon/2$.\r\n\r\nAt the beginning of this section in Royden, he defines the integral of a nonnegative measurable function $f$ over $E$ by $\\int_{E}f = \\sup \\left\\{\\int_{E}h\\vert h\\,\\text{bounded, measurable, of finite support, and}\\, 0 \\leq h \\leq f\\,\\text{on}\\,E\\right\\}$. But, this is the only thing even remotely close to saying you can find a function g with finite support such that $\\int_{E} g > \\int_{E}f - \\epsilon/2$. How, if $f$ already has finite support, then, do we know that we can find a function $h$ that not only has finite support, it has the same support as $f$ and is simple?! \r\n\r\nI would like a full proof in your answer - nothing too complicated; just using what is available to us up to Section 4.2 of Royden. Thank you.", "647" ], [ "I have just proven that the Nikodym (pseudo)metric $\\rho(A,B)$ is a pseudometric (i.e., satisfies all the metric axioms, except that $\\rho(A,B)$ can be $0$ even if $A \\neq B$), and **now I need to show that $\\mathbf{\\rho(A,B)=\\int_{E}\\vert\\chi_{A}-\\chi_{B}\\vert}$.**\r\n\r\nA little background:\r\n\r\nLet $E$ be a <PERSON> measurable set of real numbers of finite measure. Let $X$ be the set of <PERSON> measurable subsets of $E$, and let $m$ denote the <PERSON> measure. For $A$, $B$ $\\in X$, define $\\rho(A,B) = m(A \\Delta B) = m((A\\backslash B) \\cup (B \\backslash A))$ (i.e., the symmetric difference of $A$ and $B$).\r\n\r\nTo show that $\\rho(A,B)=\\int_{E}\\vert\\chi_{A}-\\chi_{B}\\vert$, first off I assume we can apply countable additivity of the <PERSON> measure, since $A\\backslash B$ and $B\\backslash A$ are disjoint, to give us $\\rho(A,B)=m(A \\Delta B) = m[(A\\backslash B) \\cup (B \\backslash A)] = m(A \\backslash B) + m(B \\backslash A)$, **but I don&#39;t know where to go from there**.\r\n\r\nPlease help!", "301" ], [ "Related to [this question][1]:\r\n\r\nHow do I show that $f(x)=\\frac{(−1)^{n}}{n}$ for every $n⩽x < n+$ and $n\\geq 1$ is not Lebesgue Integrable? I&#39;m extremely confused by the notation.\r\n\r\nWhat I need to show is the following: Given that $a_{n} = \\int_{n}^{n+1}f$ $\\forall n$, show that even though $\\sum_{n=1}^{\\infty}a_{n}$ converges, $f$ is not integrable over $[1,\\infty)$.\r\n\r\nIt seems to me like $\\frac{(-1)^{n}}{n}$ is more of an $a_{n}$, which adds to my confusion even more.\r\n\r\nPlease help! A full solution is preferred; remember that you are talking to an extremely confused and clueless person here.\r\n\r\n [1]: _URL_0_", "647" ], [ "Suppose $f$ is a locally bounded, nonnegative, and measurable function on $[1,\\infty)$ and define $\\displaystyle \\int_{n}^{n+1}f$, $\\,\\,\\forall n \\in \\mathbb{N}$. Then, is it true that $f$ is integrable on $[1, \\infty)$ if and only if the series $\\displaystyle \\sum_{n=1}^{\\infty}a_{n}$ converges absolutely?\r\n\r\nIf so, how would you prove it? I&#39;m thinking the Monotone Convergence Theorem, but I&#39;m not entirely sure how to put it into practice.\r\n\r\nIn one direction, $f$ integrable implies $\\sum_{n=1}^{\\infty}a_{n}$ converges absolutely, I&#39;m thinking the following:\r\n\r\n > Suppose $f$ is locally bounded, measurable, and nonnegative on $[1,\\infty)$, and also that $f$ is integrable over $[1,\\infty)$.\r\n\r\n > Then, $\\int_{1}^{\\infty}|f| < \\infty$, and define $A:=[n, n+1]$. Then, $f \\chi_{A}=f\\vert_{A}$.\r\n\r\n > Since $\\int_{1}^{\\infty}|f| < \\infty$, $\\int_{1}^{\\infty}|f|\\vert_{A} < \\infty$ implies that $\\int_{A}|f| < \\infty$, and since $\\int_{A}|f| = \\int_{n}^{n+1}|f| = |a_{n}|$, $sum_{n=1}^{\\infty}|a_{n}| = \\sum_{n=1}^{\\infty}\\int_{n}^{n+1}|f|$.\r\n\r\nAnd that was as far as I got. \r\n\r\nPlease help. Full proofs preferred.", "647" ], [ "@B.S.Thomson, I would be inclined to agree with your assessment of my abilities if I didn&#39;t have only 40 minutes to figure this out. In the other direction, it is similar to a problem I&#39;ve done before, but in the direction where I&#39;m assuming $f$ is integrable, I&#39;m kind of lost. If I let $f(x) = g_{n}(x)$ as you have defined it above, then am I using the Monotone Convergence theorem to pull the limit outside the integral??", "949" ], [ "This is related to a [question][1] I asked yesterday.\r\n\r\nLet $G$ be a group such that for every $x$, $y$ $\\in G$, the elements $x^{2}$ and $y$ commute. I need to show that $G$ is nilpotent.\r\n\r\nThis is what I have so far:\r\n\r\n > Since $\\forall x,\\,y \\in G$, the elements $x^{2}$ and $y$ commute,\r\n > $\\{x^{2}\\} \\in C(G)$, the center of $G$.\r\n > \r\n > Now, $G_{0} = G$, $G_{1}=G/C(G)=\\{\\text{elements of the form}\\,zC(G),\\,\\text{where}z\\in G\\}$.\r\n\r\nBut, **1) I&#39;m not sure if $x^{2}$ is even all of $C(G)$** (there could be other elements in $G$ that also commute) or even how to show that it is if in fact it is. Also, **2) If I have it done right so far, how do I figure out what $G_{2}$ is, and whether or not it is trivial?**\r\n\r\nI say that this problem is related to the other one I asked about because showing that a group is nilpotent or solvable **both kind of deal with looking at quotient groups/cosets, and I still don&#39;t entirely understand those.** \r\n\r\nCould somebody help me with this, and in the process, help me to understand? **Pretend like you&#39;re trying to explain this to somebody who is incredibly clueless,** because that is exactly how I feel right now.\r\n\r\n\r\n [1]: _URL_0_", "570" ], [ "@oxeimon, also, how do you know that the only possible ranks of $f(\\mathbb{Z}^{2})$ are $0$, $1$, or $2$? We know that $2$ is the rank of $\\mathbb{Z}^{2}$, and so any subspaces of it will have rank of $0$, $1$, or $2$, but how do we know this about its image? The fundamental theorem of abelian groups doesn&#39;t seem to be particularly helpful in this matter. Is there a theorem out there that would let me know that $0$, $1$, or $2$ are 1) the cases, 2) the only cases? Or at least is there one that tells me it will be isomorphic only to the identity, $\\mathbb{Z}$, or $\\mathbb{Z}^{2}$?", "23" ], [ "I am faced with the following problem:\r\n\r\n > Let $p$ be a prime number and $\\gcd(p,n)=1$. Define an equivalence\r\n > relation on $\\mathbb{Z}_{p}$ as follows: $x \\sim y$ iff $n^{r}x = n^{t}y$ for some $r,t \\geq 0$. Let $m$ be the number of equivalence\r\n > classes of this equivalence relation. Prove that $m-1$ is a divisor\r\n > of $p-1$.\r\n\r\nI must admit that I am at a loss as even where to begin with this one: the only thing I know for certain is that $m-1$ is certainly not a divisor of $p$! (Unless of course, $m-1$ is equal to either $1$ or $p$). Well, that and that since there are $m$ equivalence classes, one of them must be $[m-1]$.\r\n\r\nI even tried working backwards, saying to myself okay, if $m-1|p-1$, then $\\exists c$ such that $p-1 = c(m-1)\\, \\to \\, p = cm-c+1$. But that also doesn&#39;t seem to get me anywhere. \r\n\r\nIt seems as though I have been staring at this forever with nothing to show for it. Thus, any assistance anyone out there could give me would be greatly appreciated.", "258" ], [ ",right. Linearly independent generating sets, kind of like a basis for a vector space. I was rather hoping more for a proof by contradiction, for example, that in any set of three elements, one of them could be written as a linear combination of the other two or something. If you&#39;re not willing to provide me with something like that, could you at least let me know the basic process for how I&#39;d go about doing that?", "944" ], [ "Recall Lusin&#39;s Theorem:\r\n\r\n > Let $f$ be a real-valued measurable function on $E=[0,1]$. Then, for each $\\epsilon > 0$, there is a continuous function $g$ on $\\mathbb{R}$ and a closed set $F$ contained in $E$ for which $f=g$ on $F$ and $m(E\\backslash F) < \\epsilon$.\r\n\r\nI was wondering if $f$ itself ever has to be continuous at any point (as a function on $E$)? I figured that it would at least need to be continuous on the interior of $F$, where it actually equals $g$ (I realize it technically equals $g$ on the boundary of $F$ as well, but we don&#39;t know what&#39;s going on outside $F$, so we can&#39;t necessarily say it&#39;s continuous on the boundary, can we?), because there it&#39;s coinciding with a function that is known to be continuous. \r\n\r\nIs there any more to this, and if so (and even if not), what would a proof look like?", "236" ], [ "Let $f_{n}(x)=\\chi_{[n,\\infty)}(x) = \\begin{cases} 1 & \\text{if}\\,x\\in[n,\\infty)\\\\ 0 & \\text{if}\\, x \\notin [n,\\infty) \\end{cases}$. \r\n\r\nAccording to my textbook, as $n \\to \\infty$, $f_{n}(x) \\to 0$ pointwise. \r\n\r\nCould someone please explain to me (and if you could provide me with a proof, that would be even better) why this is?\r\n\r\nProbabilistically, I can kind of see why: as $n$ gets larger, the intervals $[n,\\infty)$ \" ;shrink \" ; (if you can really say such a thing when one of the endpoints is infinite), so there is less likelihood that a given point $x$ will fall into that interval, thus forcing the value of $\\chi_{[n,\\infty)}(x)$ to be $0$ the further out in the sequence we go. \r\n\r\nHowever, this is a straight-up analysis course I&#39;m taking, not a probability course, and I would like to understand this better in a more \" ;analysisy \" ; way.", "268" ], [ "I have the following problem:\r\n\r\n > Let $\\{ f_{n}\\}$ be a sequence of measurable functions on $E$ that converges to the real-valued $f$ pointwise on $E$. Show that $E = E_{0} \\cup \\left( \\cup_{k=1}^{\\infty}E_{k} \\right)$, where all sets $E_{0}$, $E_{1}, \\cdots$ are measurable, and $\\{f_{n} \\}$ converges uniformly to $f$ on each $E_{k}$ \r\n > if $k > 0$, and $m(E_{0}) = 0$.\r\n\r\nNow, the way to approach this problem is by a repeated application of Egoroff&#39;s Theorem.\r\n\r\nSo, if $\\{f_{n}\\}$ is a sequence of measurable functions on $E$ that converges pointwise on $E$ to the real-valued function $f$, then by Egoroff&#39;s Theorem, $\\forall \\epsilon > 0$, $\\exists$ a closed set $E_{1}$ contained in $E$ on which $f_{n} \\to f$ uniformly, and such that $m(E\\backslash E_{1}) < \\frac{\\epsilon}{2}$. Further, since all closed sets are measurable, $E_{1}$ is measurable.\r\n\r\nSince uniform convergence implies pointwise convergence, $\\{f_{n}\\}$ also converges pointwise to $f$ on $E_{1}$. Thus, $\\exists$ a closed set $E_{2}\\subset E_{1}$ such that $f_{n} \\to f$ uniformly on $E_{2}$ and $m(E_{1} \\backslash E_{2}) < \\frac{\\epsilon}{4}$.\r\n\r\nIf we keep proceeding in this manner, eventually, we get that $E = (\\cup_{k=1}^{\\infty} E_{k}) \\cup E_{0}$, and I&#39;m trying to figure out what $E_{0}$ is and how to show that its measure is zero.\r\n\r\nMy professor gave me the hint that the complement of their union is going to have measure 0 and I will need to explain why. However, I&#39;m not sure what he means by the complement of their union. The complement of which union?? The complement of the union of the $E_{k-1}\\backslash E_{k}$&#39;s? The complement of $\\cup_{k=1}^{\\infty} E_{k}$? That part is unclear to me. And in any case, I still am unsure how to show the measure of this part equals 0. \r\n\r\nPlease help!!! I need this explained to me thoroughly and detailed as though you were explaining it to a completely clueless person. A complete solution would be best, since I already have most of it except for this part.", "301" ], [ "I am looking at the following problem:\r\n\r\n > Let $\\{a_{n}\\}$ be a sequence of nonnegative real numbers. Define the function $f$ on $E=[1,\\infty)$ by setting $f(x) = a_{n}$ if $n \\leq x < n+1$. Show that $\\int_{E}f=\\sum_{n=1}^{\\infty}a_{n}$ using the Monotone Convergence Theorem.\r\n\r\nNow, if we knew that $f$ were measurable, we could use additivity over domains of integration, and the problem would be nice.\r\n\r\nHowever, we cannot, and I can&#39;t for the life of me figure out how to use the Monotone Convergence theorem to do this problem. The $\\{a_{n}\\}$ aren&#39;t increasing, so what about this calls for the Monotone Convergence Theorem?? How do I go about proving this?", "647" ], [ "I am trying to show the following:\r\n\r\n > Let $f$ be a measurable function on a set $E$, and let $A$ be a measurable subset of $E$. Then, **using the definition of the Lebesgue Integral of nonnegative functions** (given below), prove that $\\int_{A}f=\\int_{E}\\chi_{A}f$.\r\n > \r\n > **Definition of the Lebesgue Integral for Nonnegative Functions**: For an arbitrary nonnegative measurable function $f:E\\to \\mathbb{R} \\cup + \\infty$, define its Lebesgue integral by $\\int_{E}f = \\sup \\left\\{\\int_{E} h \\vert h\\,\\text{bounded, measurable, of finite support, and}\\,0 \\leq h \\leq f\\, \\text{on}\\,E \\right\\}$\r\n\r\nNow, the definition holds only for nonnegative measurable functions. So, I let $f = f^{+}-f^{-}$ on $E$. Then, we consider $\\int_{E}\\chi_{A}f = \\int_{E}\\chi_{A}f^{+}-\\int_{E}\\chi_{A}f^{-} $.\r\n\r\nApplying the definition, we get that this is equal to $\\sup\\{\\int_{E}h\\vert h\\,\\text{bounded, measurable, of finite support, and}\\,0 \\leq h \\leq \\chi_{A}f^{+}\\,\\text{on}\\,E\\} -\\sup\\{\\int_{E}h\\vert \\tilde{h}\\,\\text{bounded, measurable, of finite support, and}\\,0 \\leq \\tilde{h} \\leq \\chi_{A}f^{+}\\,\\text{on}\\,E\\}$\r\n\r\n where $h$ and $\\tilde{h}$ are suitable nonnegative, bounded, measurable functions with finite support.\r\n\r\nSince $A \\subseteq E$, $h \\leq \\chi_{A}f^{+}$ and $\\tilde{h} \\leq \\chi_{A}f^{-}$ on $A$ as well, and since $\\chi_{A}$ is the characteristic function of the set $A$, $\\chi_{A}f^{+}=\\chi_{A}f^{-}=0$ on $E\\backslash A$, so $h = \\tilde{h}=0$ there as well.\r\n\r\nNow, there is a corollary to the Monotone Convergence Theorem I would like to use in order to help me introduce series in a similar manner as in the second answer to [this question][1] (proving the same thing, but instead using the definition of the Lebesgue Integral for bounded functions). The corollary states as follows:\r\n\r\n > Let $\\{ u_{n}\\}$ be a sequence of nonnegative measurable functions on $E$. If $f=\\sum_{n=1}^{\\infty}u_{n}$ pointwise a.e. on $E$, then $\\int_{E}f=\\sum_{n=1}^{\\infty}\\int_{E}u_{n}$.\r\n\r\nI&#39;d somehow like to be able to express both $h$ and $\\tilde{h}$ as a sum $\\displaystyle \\sum_{i=1}^{n} u_{i}\\chi_{\\displaystyle [E_{i}\\backslash A) \\cup (E_{i}\\cap A)]}$. But I am not sure I am 1) justified in doing it, 2) exactly how to do it. \r\n\r\nThen, once I have that, I can apply the Corollary to turn the finite sum into an infinite series, and can use a bunch of bounding to get the result that I want. I just require assistance with this one part.\r\n\r\n\r\n [1]: _URL_0_", "647" ], [ "Let $\\{u_{1},u_{2},\\cdots,u_{n}\\}$ e an orthonormal basis for a subspace $U$ in an inner product space $X$. \r\n\r\nDefine the **orthogonal projection** of $X$ onto $U$, $P:X \\to U$, to be $Px = \\sum_{i=1}^{n}\\langle x, u_{i} \\rangle u_{i}$, where $\\langle \\cdot, u_{i} \\rangle$ represents the inner product.\r\n\r\nI need to prove that $P = P^{2}$; i.e., that $P$ is idempotent. I have already proven that $P$ is linear, and am therefore free to use it.\r\n\r\nSo far, I set up what I am trying to show as follows:\r\n\r\n > $P^{2}x = \\sum_{i=1}^{n} \\langle Px, u_{i}\\rangle u_{i} =\\sum_{i=1}^{n}\\langle \\sum_{i=1}^{n}\\langle x, u_{i} \\rangle u_{i},u_{i}\\rangle u_{i}$\r\n\r\nThen, I thought that perhaps expanding out the inner sum might be helpful, and then somewhere along the line I might be able to use linearity to get $\\sum_{i=1}^{n}\\langle x, u_{i}\\rangle u_{i}$ eventually on the RHS.\r\n\r\nThis is about as far as I got playing around with the sums:\r\n\r\n > $\\sum_{i=1}^{n}\\langle \\langle x, u_{1}\\rangle u_{1}+\\langle x, u_{2}\\rangle u_{2} + \\cdots + \\langle x, u_{n} \\rangle u_{n}, u_{i} \\rangle u_{i} = \\sum_{i=1}^{n}\\left(\\langle \\langle x, u_{1} \\rangle u_{1}, u_{i} \\rangle + \\langle \\langle x, u_{2}\\rangle u_{2}, u_{i} \\rangle + \\cdots + \\langle \\langle x, u_{n} \\rangle u_{n}, u_{i} \\rangle \\right)u_{i} = \\sum_{i=1}^{n}\\left[\\left(\\langle \\langle x, u_{1} \\rangle u_{1}, u_{i}\\rangle u_{i}\\right) + \\left(\\langle \\langle x, u_{2} \\rangle u_{2}, u_{i} \\rangle u_{i}\\right) + \\cdots + \\left(\\langle \\langle x, u_{n} \\rangle u_{n}, u_{i} \\rangle u_{i} \\right)\\right] = \\sum_{i=1}^{n} \\langle \\langle x, u_{1} \\rangle u_{1}, u_{i}\\rangle u_{i} + \\sum_{i=1}^{n}\\langle \\langle x, u_{2} \\rangle u_{2}, u_{i} \\rangle u_{i} + \\cdots + \\sum_{i=1}^{n}\\langle \\langle x, u_{n} \\rangle u_{n}, u_{i} \\rangle u_{i}$\r\n\r\nBut, it&#39;s still not looking anywhere closer to where I need to be.\r\n\r\nCould somebody please help me finish this?\r\n\r\nThank you.", "344" ], [ "I am currently working on showing that $\\Vert Px \\Vert_{2} \\leq \\Vert x \\Vert_{2}$, where $x \\in$ an inner product space $X$, and $P$ is the orthogonal projection operator. Also, I am supposing that $X$ has a subspace $U$ with orthonormal basis $\\{u_{1},u_{2},\\cdots,u_{n}\\}$, and thus that $P:X \\to U$ is defined by $Px = \\sum_{i=1}^{n}\\langle x, u_{i} \\rangle u_{i}$. \r\n\r\nTo show that $\\Vert Px \\Vert_{2} \\leq \\Vert x \\Vert_{2}$ for all $x \\in X$, I am proceeding as follows:\r\n\r\n > $\\Vert P x \\Vert_{2}^{2} = \\vert \\langle Px, Px \\rangle \\vert = \\vert \\langle x, Px \\rangle \\vert \\leq \\Vert x \\Vert_{2}\\,\\, \\Vert Px \\Vert_{2}$\r\n\r\nMy only concern is that I&#39;m justified in saying that $Px = x$ inside the inner product operator for the first components. I&#39;ve read that that&#39;s a property of orthogonal operators, but it also looks an awful lot like the statement that $Px = x$ for $x \\in U$, which is something that needs to be proven, AND is true ONLY for $x \\in U$, not for $x \\in X \\backslash U$, so it&#39;s making me uncomfortable.\r\n\r\nCan someone please let me know if my discomfort is justified, and if so, how I show that $Px=x$ for $x$ in ALL of $X$ as well?\r\n\r\nThank you!", "41" ], [ "Recall the Cholesky Theorem on $LL^{T}$-Factorization: \r\n\r\n > Theorem: If $A$ is a real, symmetric, and positive definite matrix, then it has a unique factorization, $A=LL^{T}$, in which $L$ is lower triangular with a positive digonal.\r\n\r\nI need to use the Cholesky Theorem to show that the following two propertie sof a symmetric matrix $A$ (i.e., a matrix where $A = A^{T}$) are equivalent:\r\n\r\n 1. $A$ is positive definite (i.e., $x^{T}Ax > 0$ for every nonzero vector $x$).\r\n 2. There exists a linearly independent set of vectors $x^{(1)},x^{(2)},\\cdots,x^{(n)}$ in $\\mathbb{R}^{n}$ such that $A_{ij} = \\left( x^{(i)}\\right)^{T}\\left( x^{(j)} \\right)$.\r\n\r\nI *kind of* see where the second part comes from, since if $A$ were a matrix we got as a result of multiplying together two other matrices $B$ and $C$, then each entry $A_{ij}$ would be the product of a row vector and a column vector. But, I&#39;m really kind of lost as to how to prove this.", "320" ], [ "For the following two collections of subsets $S$, where the set function $\\mu: S \\to [0,\\infty]$, I need to determine the outer measure $\\mu^{*}$ induced by $\\mu$ and the $\\sigma$-algebra of measurable sets:\r\n\r\n 1. On the collection $S = \\{\\emptyset, [1,2] \\}$ of subsets of $\\mathbb{R}$, where $\\mu: S \\to [0,\\infty]$ is defined to be $\\mu(\\emptyset) = 0$, $\\mu([1,2])=1$.\r\n 2. On the collection $S$ of all subsets of $\\mathbb{R}$, $\\mu: S \\to [0,\\infty]$ is defined by setting $\\mu(A)$ to be the number of integer points in $A \\in S$.\r\n\r\nI assume that the first one is easier than the second. I&#39;m not even entirely sure how $\\mu(A)$ is being defined, but it seems kind of like a counting measure.\r\n\r\nI&#39;ve never done either of these types of problems before, and am therefore at a loss as to how to approach them. \r\n\r\nThank you.", "301" ], [ "@Ramiro, there is a theorem: \" ;Let $S$ be a collection of subsets of a set $X$ and $\\mu:S \\to [0, \\infty]$ a set function. Define $\\mu^{*}(\\emptyset) = 0$ and for $E \\subset X$, $E \\neq \\emptyset$, define $\\mu^{*}(E)=\\inf \\sum_{k=1}^{\\infty}\\mu(E_{k})$, where the infimum is taken over all countable collections $\\{ E_{k}\\}_{k=1}^{\\infty}$ of sets in $S$ that cover $E$. Then the set function $\\mu^{*}: 2^{X} \\to [0,\\infty]$ is an outer measure called the outer measure induced by $\\mu$ \" ;. So, I&#39;m guessing for 1., since there&#39;s only $[1,2]$, and $\\emptyset$, $\\inf \\sum_{k=1}^{\\infty}\\mu (E_{k})=1$?", "301" ], [ "I just found the least squares solution of the system $\\mathbf{x}A = \\mathbf{b} = \\begin{pmatrix} x & y \\end{pmatrix}\\begin{pmatrix} 3 & 2 & 1 \\\\ 2 & 3 & 2\\end{pmatrix} = \\begin{pmatrix} 3 & 0 & 1\\end{pmatrix}$ to be $\\begin{pmatrix} x \\\\ y\\end{pmatrix} = \\begin{pmatrix} \\frac{29}{21} \\\\ -\\frac{2}{3}\\end{pmatrix}$. **I now am tasked with answering how this solution can be verified without solving for $x$ and $y$.**\r\n\r\n\r\nThe system can be rewritten as follows: $\\begin{pmatrix}3 & 2 \\\\ 2 & 3 \\\\ 1 & 2 \\end{pmatrix}\\begin{pmatrix} x \\\\ y \\end{pmatrix} = \\begin{pmatrix} 3 \\\\ 0 \\\\ 1 \\end{pmatrix}$.\r\n\r\nSince the least-squares solution is the vector $\\mathbf{x}$ that makes $\\Vert b - A\\mathbf{x} \\Vert_{2}$ a minimum, should I try graphing the equations $3x + 2y = 3$, $2x + 3y = 0$, and $x + 2y = 1$, then pointing out on the graph that $\\begin{pmatrix}x \\\\ y \\end{pmatrix} = \\begin{pmatrix}\\frac{29}{21} \\\\ -\\frac{2}{3} \\end{pmatrix}$ is close to the point where the three lines intersect?\r\n\r\nI figure there must be a more formal way of verifying the solution, but it is escaping me. Could somebody please let me know how I should do it?", "765" ], [ "I need to determine which of the properties of a natural cubic spline the following function possesses or does not possess:\r\n\r\n$$f(x) = \\begin{cases} (x+1)+(x+1)^{3}, & x \\in [-1,0] \\\\ 4+(x-1)+(x-1)^{3}, & x \\in (0,1] \\end{cases}.$$\r\n\r\nHowever, this function is extremely weird in the sense that I have never seen a spline-like function with one of its intervals only half-open.\r\n\r\nI&#39;m thinking that this creates a problem in terms of continuity, because ***technically***, the second piece of the function is not defined at $x=0$, so even though if we plug $x=0$ into that piece, we get the same output as we do from plugging it into the first piece, I&#39;m thinking it&#39;s most definitely going to fail continuity at $x=0$. (Moreover, I don&#39;t think it would be any different at $f^{\\prime}(0)$ or $f^{\\prime\\prime}(0)$, would it?)\r\n\r\nAlthough, I could be overthinking this problem, or it could be a typo in my textbook. For reference, this is problem 18 in Section 6.4 of Numerical Analysis: Mathematics of Scientific Computing (3$^{\\text{rd}}$ edition) by <PERSON> and <PERSON>.\r\n\r\nCould somebody please let me know if the half-open interval is a problem?\r\n\r\nThank you.", "236" ], [ "Let $\\epsilon$ be a small positive number such that $1+\\epsilon$ and $3+2\\epsilon$ are machine numbers but $3+2\\epsilon + \\epsilon^{2}$ is computed to be $3 + 2\\epsilon $. Now, let the (classical) Gram-Schmidt process be applied to the three vectors $v_{1} = fl(1 + \\epsilon, 1, 1)^{T} $, $v_{2} = fl(1, 1+\\epsilon, 1)^{T}$, $v_{3} = fl(1, 1, 1 + \\epsilon)^{T}$. **Verify that the supposedly orthonormal base produced by the computer will be**\r\n\r\n $\\mathbf{x_{1}=fl[1/\\sqrt{3+2\\epsilon}]v_{1}}$, \r\n\r\n$\\mathbf{x_{2}=fl[1/\\sqrt{2}](-1,1,0)^{T}}$, \r\n\r\n$\\mathbf{x_{3}=fl[1/\\sqrt{2}](-1,0,1)^{T}}$.\r\n\r\nI am so incredibly lost because I have no idea how to perform Gram-Schmidt on numbers that look like this! \r\n\r\nCould someone at least show me how to get $x_{2}$ ($x_{1}$ is easy enough)? **If I could see how the operations with $\\epsilon$&#39;s and floats are supposed to work in calculating $x_{1}$, I could probably figure out the rest of it myself.** (I assume we&#39;re supposed to solve this problem by actually performing Gram-Schmidt on $v_{1}$, $v_{2}$, and $v_{3}$; correct me if I&#39;m wrong).", "170" ], [ "Consider the subspace of continuous, real-valued functions on $[0,1]$ that are <PERSON>. Is this subspace complete under the sup norm ($\\Vert \\cdot \\Vert_{\\infty} = \\sup \\{ |f(x)| : x\\in S \\}$)?\r\n\r\nI would say yes, since all <PERSON> functions ($d_{Y}(f(x_{1}),f(x_{2}))\\leq K d_{X}(x_{1},x_{2})$, $K \\geq 0$, where here $X = [0,1]$, $Y = \\mathbb{R}$) are uniformly continuous, functions of certain types tend to converge uniformly to functions of the same types (e.g. differentiable functions to differentiable functions), but it seems unlikely. \r\n\r\nCould somebody please help?", "236" ], [ "I&#39;m trying to prove that $\\mu$ is a measure on $\\mathcal{M}$, where $\\mu(E) = \\int_{E}f$, $f: \\mathbb{R} \\to [0, \\infty]$ is a <PERSON> measurable funciton, and $\\mathcal{M}$ consists of all the <PERSON> measurable subsets of $\\mathbb{R}$.\r\n\r\nRight now, I&#39;m trying to show countable additivity: $\\mu(\\cup_{k=1}^{\\infty}E_{k}) = \\cup_{k=1}^{\\infty}\\mu(E_{k})$, where the $E_{k}$ are disjoint.\r\n\r\nSo far, I have that $\\mu(\\cup_{k=1}^{\\infty}E_{k}) = \\int_{\\cup_{k=1}^{\\infty}E_{k}}f = \\int f 1_{\\cup_{k=1}^{\\infty}E_{k}}$ (where $1_{\\cup_{k=1}^{\\infty}E_{k}}$ is an indicator function) $= \\int \\sum_{k=1}^{\\infty}f 1_{E_{k}}$, and on the next step, I need to switch the $\\int$ and the $\\sum$. I would like to use Monotone Convergence Theorem to get the job done, but $f 1_{E_{k}}$, while nonnegative, is not necessarily increasing (or is it?). \r\n\r\nSo, how do I get this to look like something that is monotone increasing so that I can apply the theorem I need?", "301" ], [ "I am attempting to solve the following:\r\n\r\n > Let $0 < \\alpha < 1$. Suppose that $\\{x_{n}\\}$ is a sequence in a complete metric space $(X,\\rho)$, and for each $n$, $\\rho (x_{n},x_{n+1}) \\leq \\alpha^{n}$. Show that $\\{ x_{n}\\}$ converges. Does $\\{x_{n}\\}$ necessarily converge if we only require that for each $n$, $\\rho (x_{n},x_{n+1}) \\leq 1/n$?\r\n\r\nRight now, I am working on the first part, showing that $\\{x_{n}\\}$ converges, and I am stuck.\r\n\r\nSince $(X,\\rho)$ is a complete metric space, I am trying to show that $\\{x_{n}\\}$ is Cauchy. I.e., I need to show that $\\forall \\epsilon > 0$, $\\exists N \\in \\mathbb{N}$ for which if $n$, $m$ $\\geq N$, then $\\rho(x_{n},x_{m}) < \\epsilon$.\r\n\r\nAlso, since the triangle inequality seems to be a good friend of ours when working in metric spaces, I decided to try the following:\r\n\r\n$\\rho (x_{n}, x_{m}) \\geq \\rho(x_{n}, x_{n+1}) + \\rho (x_{n+1},x_{m}) \\leq \\alpha^{n} + \\rho (x_{n+1}, x_{m})$.\r\n\r\nNow, I know that for $n$ sufficiently large, $\\alpha^{n}$ goes to $0$, but I&#39;m not sure how to use that to help me here. Also, I don&#39;t know how to put a bound on $\\rho(x_{n+1}, x_{m})$ so that I can make the whole thing less than $\\epsilon$. Please help.\r\n\r\nAlso, I&#39;m not really sure at all what to do for the next part. I&#39;d like to say the answer is yes, because sometimes I&#39;ve seen limit problems where we use $1/n$&#39;s instead of $\\epsilon$&#39;s, and I&#39;d think that for $n$ sufficiently large, we would get that $\\rho (x_{n},x_{n+1}) < \\epsilon$, but also most of the time when a \" ;Does the blah blah necessarily blah blah \" ; is attached to problems, the answer is no! Any assistance you could offer would be much appreciated, as long as it isn&#39;t too cryptic/Socratic. Thank you.", "268" ], [ "Let $\\mathcal{D}$ be the subspace of $C[0,1]$ (with uniform metric) consisting of the continuous functions $[0,1]\\to \\mathbb{R}$ that are differentiable on $(0,1)$. Is $\\mathcal{D}$ complete?\r\n\r\nI&#39;m thinking no, because I&#39;m thinking that $\\mathcal{D}$ is not closed, but I don&#39;t know how to show this.\r\n\r\nCould somebody please let me know whether I&#39;m right in my reasoning, and if so, how to show this?\r\n\r\nIf I&#39;m not correct in my reasoning, then if you could please steer me in the right direction, I would very much appreciate it.", "15" ], [ "I am faced with the following problem:\r\n\r\n > Let $X$ be a totally bounded metric space. If $f$ is a uniformly continuous mapping from $X$ to a metric space $Y$, show that $f(X)$ is totally bounded. Is the same true if $f$ is only required to be continuous?\r\n\r\nFor the first part -i.e., showing that $f(X)$ is totally bounded, so far I have the following:\r\n\r\n > Suppose that $X$ is totally bounded. Then $\\forall \\epsilon > 0$, $X$ can be covered by a finite number of open balls of radius $\\epsilon$, thus also making $X$ immediately compact. Since $f$ is uniformly continuous, it is also continuous. Therefore, $f(X)$ is compact. \r\n\r\nNow, I know that it is true that if a metric space $X$ is compact, it is sequentially compact, and if a metric space $X$ is sequentially compact, it is complete and totally bounded. However, $f(X)$ is not necessarily a metric space is it?\r\n\r\nAnd although as of yet, I have not used the fact that the continuity is uniform, I believe it is important, and that the second part of the problem is therefore false. What I&#39;m thinking is that the uniform continuity has something to do with making $f(X)$ totally bounded in addition to just being compact, but I&#39;m missing a piece of the puzzle here.\r\n\r\n**Edit:** But then, there is also a theorem that says that a continuous mapping from a compact metric space into a metric space is uniformly continuous, so isn&#39;t $f$ uniformly continuous regardless of whether we explicitly say so? Still, though, I am not sure I&#39;m correct then in assuming this would guarantee that $f(X)$ is totally bounded, because although a metric space $X$ is totally bounded if and only if it is compact, I&#39;m not convinced that $f(X)$ is a metric space. I know that $Y$ is, but $f(X)$ is just a subset of a metric space. How do I know/show that it is a subspace??\r\n\r\nCould somebody please help me out?\r\n\r\nThank you", "356" ], [ "I&#39;m currently working on the following:\r\n\r\n > Define the function $\\psi: C[a,b] \\to \\mathbb{R}$ by $\\begin{equation*} \\psi(f)=\\int_{a}^{b}f(x)\\,dx \\end{equation*}$ for each $f \\in C[a,b]$. \r\n > Show that $\\psi$ is <PERSON> on $C[a,b]$ with the metric induced by the maximum norm $\\Vert \\cdot \\Vert_{\\infty}$.\r\n\r\nSo, what we want to show is $\\Vert \\psi(f) -\\psi(g)\\Vert_{\\infty} \\leq c\\Vert f-g \\Vert_{\\infty}$.\r\n\r\nNow, $\\Vert \\psi(f) - \\psi(g) \\Vert_{\\infty}=\\Vert \\int_{a}^{b}f(x)dx - \\int_{a}^{b}g(x)dx\\Vert_{\\infty} = \\Vert \\int_{a}^{b}f(x)-g(x)\\,dx\\Vert_{\\infty}$\r\n\r\nAnd this is about as far as I got. Maybe it&#39;s working with the maximum norms, but I am having great difficulty figuring out how to turn this into something resembling $\\leq c \\Vert f-g \\Vert_{\\infty}$.\r\n\r\nI&#39;m wondering if I can use uniform continuity to help me, since $f$ is mapping a compact metric space into a metric space.\r\n\r\nPlease Help!", "647" ], [ "I am in the process of proving the following:\r\n\r\n > Let $\\mathcal{F}$ be a family of continuous real-valued functions on a complete metric space $X$ that is pointwise bounded in the sense that for each $x \\in X$, there is a constant $M_{x}$ for which $|f(x)|\\leq M_{x}$ for all $f \\in \\mathcal{F}$.\r\n\r\n > Then, there is a nonempty open subset $\\mathcal{O}$ of $X$ on which $F$ is uniformly bounded in the sense that there is a constant $M$ for which $|f|\\leq M$ on $\\mathcal{O}$ for all $f \\in \\mathcal{F}$.\r\n\r\nSo far, I have done the following:\r\n\r\n > Define the sets $E_{n} = \\{ x \\in X: |f(x)|\\leq n, \\forall f \\in \\mathcal{F}\\} = \\cap_{f \\in \\mathcal{F}}\\{x \\in X: |f(x)|\\leq n\\} = \\cap_{f \\in \\mathcal{F}}f^{-1}[-n,n]$, which is closed in $X$, since $\\mathcal{F}$ is a family of continuous functions.\r\n > \r\n > Since $\\mathcal{F}$ is pointwise bounded, then $\\exists x \\in E_{n}$ whenever $|f(x)|\\leq M_{x} \\leq n$, which implies that $X = \\cup_{n=1}^{\\infty}E_{n}$.\r\n > \r\n > Since $X$ is nonempty, it has nonempty interior, and since $X = \\cup_{n=1}^{\\infty}E_{n}$, by a previous result, at least one of the $E_{n}$&#39;s, say $E_{n_{0}}$ has nonempty interior; i.e., for $x_{0} \\in E_{n_{0}}$, $\\exists r > 0$ such that $B_{0}(x_{0},r)\\subset E_{n_{0}}=\\overline{E_{n_{0}}}$.\r\n\r\nFrom here, I have no idea where to go in order to get the uniform boundedness. Please help. I am completely and utterly clueless as to how to proceed.", "236" ], [ "Related to [this similar problem][1].\r\n\r\nI am attempting to solve the following:\r\n\r\n > Find a natural cubic spline function whose knots are $-1$, $0$, and $1$ and that takes on the values $S(-1)=5$, $S(0)=7$, and $S(1)=9$.\r\n\r\nNeither my textbook nor my class notes have been particularly helpful in showing me how to work out a cubic spline problem like this. What I have seen thus far has been very theoretical, and I have not been able to find a completely worked out problem, so after I get the equations set up, I do not know how to proceed. I know it&#39;s supposed to involve a matrix, but I don&#39;t know how to set it up.\r\n\r\nThis is what I have done so far (I have tried to model what I did off of [the similar problem I referenced earlier][1]):\r\n\r\n > Suppose the natural cubic spline function has the form $S(x) = \\begin{cases} S_{1}(x), & x \\in (-\\infty,-1] \\\\\r\nS_{2}(x), & x \\in [-1,0]\\\\\r\nS_{3}(x), & x \\in [0,1]\\\\\r\nS_{4}(x), & x \\in [1,\\infty).\r\n\\end{cases}$\r\n\r\n > Then, in order to meet the necessary conditions for it to be a natural cubic spline, we need to have\r\n\r\n > - $S_{1}(-1)=S_{2}(-1) = 5$\r\n > - $S_{1}^{\\prime}(-1)=S_{2}^{\\prime}(-1)$\r\n > - $S_{1}^{\\prime\\prime}(-1)=S_{2}^{\\prime\\prime}(-1) = 0$ (the $=0$ is the \" ;natural \" ; condition)\r\n > - $S_{2}(0)=S_{3}(0) = 7$\r\n > - $S_{2}^{\\prime}(0)=S_{3}^{\\prime}(0)$\r\n > - $S_{2}^{\\prime\\prime}(0)=S_{3}^{\\prime\\prime}(0)$\r\n > - $S_{3}(1)=S_{4}(1) = 9$\r\n > - $S_{3}^{\\prime}(1)=S_{4}^{\\prime}(1)$\r\n > - $S_{3}^{\\prime\\prime}(1)=S_{4}^{\\prime\\prime}(1) = 0$ (the $=0$ is the \" ;natural condition)\r\n\r\n > Now, from here, I formed the $S_{i}(x)=a_{i}x^{3}+b_{i}x^{2}+c_{i}x+d_{i}$, the $S_{i}^{\\prime}(x)=3a_{i}x^{2}+2b_{i}x+c_{i}$, and $S_{i}^{\\prime\\prime}(x)=6a_{i}x+2b_{i}$ for $i = 1,2,3,4$. \r\n\r\n > Plugging in some conditions, I found that $d_{2}=7$ and $d_{3}=7$. Also, I ended up with $c_{2}=c_{3}$, and a couple more not terribly interesting things.\r\n\r\nAt this point, I do not know how to proceed. I know I have to form a matrix, but in terms of the parameters I have here, I don&#39;t know what that matrix is supposed to look like or how big it is supposed to be.\r\n\r\nWould somebody please tell me what to do next? And please don&#39;t ask me what I know about this or that, because honestly, I don&#39;t know anything. I&#39;m extremely lost and frustrated to the point of tears.\r\n [1]: _URL_0_", "316" ], [ "I have to draw the region on the complex plane defined by the following relation:\r\n\r\n$|z-z_{1}|=|z-z_{2}|$.\r\n\r\nAfter squaring both sides, we obtain the equality $(z-z_{1})\\overline{(z-z_{1})} = (z-z_{2})\\overline{(z-z_{2})}$. Then, letting $z = x + i y$, $z_{1} = x_{1} + iy_{1}$, and $z_{2} = x_{2} + i y_{2}$, multiplying out and collecting terms, we obtain the following expression:\r\n\r\n$(x-x_{1})^{2} + (y-y_{1})^{2} = (x-x_{2})^{2}+(y-y_{2})^{2}$, \r\n\r\nwhich, to me, looks like two unit circles set equal to each other, so I assume the region defined by the above relation is the area where the two circles intersect. **Please let me know if I am correct.**\r\n\r\nHowever, I now have to sketch this. Is this going to require separate cases depending on which quadrant $(x_{1},y_{1})$ and $(x_{2},y_{2})$ are in, and then cases where they don&#39;t intersect at all? I&#39;m going a bit crazy overthinking this. **Please help me figure out what to sketch.**", "35" ], [ "[This question][1] is similar, but please do not mark this as a duplicate, because it is not exactly the same as what is being asked in that question, and besides, the answers given to it do not answer my question.\r\n\r\nI need to sketch the region described by $\\text{Im}\\left[\\frac{z-z_{1}}{z-z_{2}}\\right]=0$.\r\n\r\nTo that effect, I multiplied top and bottom by the complex conjugate $\\overline{z}-\\overline{z_{2}}$ in a manner similar to that found [in this problem][2] to obtain that $\\text{Im}\\left[\\frac{z-z_{1}}{z-z_{2}}\\right] = 0$ is equivalent to $\\text{Im}\\left[\\frac{(z-z_{1})(\\overline{z}-\\overline{z_{2}})}{|z-z_{2}|^{2}}\\right] = 0$.\r\n\r\nThen, this is really the same as $\\text{Im}[(z-z_{1})(\\overline{z}-\\overline{z_{2}})] = 0$, or $(x-x_{2})(y-y_{1})-(x-x_{1})(y-y_{2})=0$, which is the imaginary part of $(z-z_{1})(\\overline{z}-\\overline{z_{2}})$ when you multiply it out.\r\n\r\nNow, I&#39;m thinking this is a line, and so I tried to rewrite it in a more \" ;liney \" ; form: $$y = x \\frac{(y_{1}-y_{2})}{(x_{1}-x_{2})} + \\frac{x_{1}y_{2} - x_{2}y_{1}}{x_{1} - x_{2}}$$\r\n\r\nSo, it&#39;s a line with slope $\\displaystyle\\frac{y_{1}-y_{2}}{x_{1}-x_{2}}$ and $y-$intercept $\\displaystyle\\left(0, \\frac{x_{1}y_{2} - x_{2}y_{1}}{x_{1} - x_{2}}\\right)$.\r\n\r\n**But, how do I draw this?** \r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "186" ], [ "I&#39;m having trouble classifying images using a random forest. \r\n\r\nThe images all have a very similar scale, but they may be rotated arbitrarily around a fixed point in the image.\r\n\r\nThe core problem is that the images of the test set vary somewhat from the training images. But in this case, it is crucial to train based on the given training set and to test it on the given test set(!).\r\n\r\nIt&#39;s thus easily concluded that, I \" ;simply \" ; need a very robust random forest.\r\n\r\nThe classes are:\r\n\r\n* class 0: images that show an certain plane part (the inside of the engine)\r\n* class 1: images that don&#39;t show that part\r\n\r\nMy learners (node functions) are simple intensity comparisons, that check if a pixel value is lower than another pixel value in the same image:\r\n\r\n* I(u1,v1) < I(u2,v2) - > true/false\r\n\r\nMy current configuration is:\r\n\r\n* supervised learning, all class lables available\r\n* number of positive samples: 100 000\r\n* number of negative samples: 100 000\r\n* image size: 160x120\r\n* tree depth = 6\r\n* number of trees: 400\r\n\r\nDo you have any suggestions for me?", "931" ], [ "I need to find the image of the strip $0 < x < 1$ if $w = \\frac{z-1}{z-2}$. \r\n\r\nTo approach this problem, I followed the advice of <PERSON> on [this post][1], and solved $w = \\frac{z-1}{z-2}$ for $z$. So, $z=\\frac{1-2w}{1-w}$.\r\n\r\nThen, since $w = u+iv$, I substituted $u+iv$ in for $w$ above, and multiplied top and bottom by the complex conjugate of the bottom to obtain $\\frac{1-3u+2u^{2}+2v^{2}}{(1-u)^{2}+v^{2}} - i \\frac{v}{(1-u)^{2}+v^{2}}$.\r\n\r\nNow, $x = Re\\,z =\\frac{1-3u+2u^{2}+2v^{2}}{(1-u)^{2}+v^{2}} $, so what we need is $ 0 < \\frac{1-3u+2u^{2}+2v^{2}}{(1-u)^{2}+v^{2}} < 1$.\r\n\r\nFor $0 < \\frac{1-3u+2u^{2}+2v^{2}}{(1-u)^{2}+v^{2}}$, we really only need $0 < 1-3u+2u^{2}+2v^{2}$. So, by completing the square, I get that the area that should make that quantity $ > 0$ is the exterior of a circle centered at $(3/4,0)$ with radius $1/4$, or $1 < \\displaystyle \\frac{(u-3/4)^{2}}{(1/4)^{2}} + \\frac{v^{2}}{(1/4)^{2}}$.\r\n\r\nFor $1 > \\displaystyle \\frac{1-3u+2u^{2}+2v^{2}}{(1-u)^{2}+v^{2}}$, by completing the square again, I get that the area that should make that quantity $ < 1$ is the interior of a circle centered at $\\left(\\frac{1}{2},0 \\right)$ with radius $\\frac{1}{2}$. \r\n\r\nAnd also, we need to be sure to omit the point $(1,0)$ because that makes the denominator in $\\displaystyle \\frac{1-3u+2u^{2}+2v^{2}}{(1-u)^{2}+v^{2}}$ zero.\r\n\r\nI know I went wrong somewhere, because these two areas together don&#39;t make any sense. It&#39;s almost like the $0 > $ part was redundant. So, I&#39;m assuming I made a mistake. \r\n\r\nCan someone please help me fix it? \r\n\r\n\r\n [1]: _URL_0_", "35" ], [ "I am faced with the following problem: \r\n\r\nLet $z_{0}\\neq 0$ and let $f(z) = \\ln r + i \\varphi$, where $r = |z|$, $\\varphi \\in arg z$, and $\\varphi$ is chosen so that $f$ is continuous in a neighborhood of $z_{0}$. Prove that $f$ is differentiable in a neighborhood of $z_{0}$.\r\n\r\nBeing differentiable in a neighborhood of $z_{0}$ means that it&#39;s analytic there, right? It sounds to me like the problem is asking me to show that the Cauchy-Riemann equations hold at $z_{0}$, but I&#39;m not sure how the continuity of $f$ fits in here. \r\n\r\nCould someone please let me know what exactly I am being asked to do here? I&#39;m very confused and am not sure how to begin, other than just applying the Cauchy-Riemann equations in polar form, at least.", "403" ], [ "@LevBorisov, or whoever is reading, this is how my solution looks: I checked the CR-equations, and they hold for $r = |z| \\neq 0$. At $z_{0}$, this certainly is the case; therefore, $f$ is analytic at $z_{0}$. Now, since $\\varphi \\in arg z$ is chosen so that $f$ is continuous in a neighborhood of $z_{0}$, this means that for $\\varphi = \\arctan \\frac{y}{x} + 2 \\pi n$, $n \\in \\mathbb{Z}$, $x \\neq 0$, and we will not be dealing with $\\ln r$ at any of its branch cuts where it is discontinuous and hence not differentiable. Is this correct/complete?", "403" ], [ "I have to find an angle by which tangents to curves at $z_{0}$ are rotated under the mapping $w = z^{2}$ if\r\n(a) $z_{0} = i$, (b) $z_{0} = -1/4$, (c) $z_{0} = 1+i$,\r\nand also find the corresponding values of magnification.\r\n\r\nI know that if $z_{0} \\neq 0$, then in linear approximation, $f$ at a point $z = z_{0}$ is a composition of rotation by the angle $arg\\, f^{\\prime}(z_{0})$ and dilation by $|f^{\\prime}(z_{0})|$. \r\n\r\nSo, what I think I have to do is the following: 1) Take the derivative of $f(z) = w = z^{2}$, 2) For each of (a), (b), and (c) above, evaluate $f^{\\prime}(z)$ at the given value of $z_{0}$, 3) Find the argument of each of those derivatives, and 4) Take the magnitude of each derivative.\r\n\r\nStep 3) should give me the angle I want, and Step 4) should give me the value of magnification. Is this correct?\r\n\r\nIf so, could somebody please verify if the following are correct, and if not, please tell me what I have to do to fix:\r\n\r\nFirst, if $f(z) = z^{2}$, then $f^{\\prime}(z) = 2z$.\r\n\r\n(a) $f^{\\prime}(z_{0})=f^{\\prime}(i) = 2i$, so $\\varphi \\in arg \\,(2i) = \\frac{\\pi}{2} + 2\\pi n$ is an angle by which the tangents are rotated. And, the corresponding value of magnification is $|2i|=\\sqrt{0^{2} + 2^{2}} = 2$.\r\n\r\n(b) $f^{\\prime}(z_{0})=f^{\\prime}\\left(-\\frac{1}{4}\\right) = 2\\left(-\\frac{1}{4}\\right) = -\\frac{1}{2}$, so $\\varphi \\in arg\\,\\left(-\\frac{1}{2}\\right) = \\pi + 2\\pi n$ is an angle by which the tangents are rotated. And, the corresponding value of magnification is $\\left\\vert -\\frac{1}{2} \\right\\vert = \\frac{1}{2}$.\r\n\r\n(c) $f^{\\prime}(z_{0}) = f^{\\prime}(1+i) = 2(1+i) = 2+2i$, so $\\varphi \\in arg\\, (2(1+i)) = arg \\,(1+i) = \\frac{\\pi}{4} + 2 \\pi n$ is an angle by which the tangents are rotated. And, the corresponding value of magnification is $|2+2i|=\\sqrt{2^{2} + 2^{2}} = \\sqrt{4+4} = \\sqrt{8} = 2\\sqrt{2}$.\r\n\r\nIt just seems all too easy, so I thought I&#39;d check with another set of more experienced eyes!", "186" ], [ "I&#39;m currently using Royden&#39;s Real Analysis for a course in real variables, and I was reading Chapter 11, which is on Topological Spaces.\r\n\r\nIt gives the following definition for a subbase:\r\n\r\n > **Definition**: For a topological space $(X, \\mathcal{T})$, a subcollection $\\mathcal{S}$ of $\\mathcal{T}$ that covers $X$ is a **subbase** for the topology $\\mathcal{T}$ provided intersections of finite subcollections of $\\mathcal{S}$ are a base of $\\mathcal{T}$.\r\n\r\nNow, it gives the following example of a subbase, which I&#39;m having a bit of trouble wrapping my head around:\r\n\r\n > Consider a closed, bounded interval $[a,b]$ as a topological space with the topology it inherits from $\\mathbb{R}$. This space has a subbase consisting of intervals of the type $[a,c)$ or $(c,b]$ for $a < c < b$.\r\n\r\nFrom what I understand, the \" ;topology it inherits from $\\mathbb{R}$ \" ; is the standard topology on $\\mathbb{R}$, which has as its base elements the open intervals $(a,b)$. Intersections of half-open intervals of the same type (i.e., two intervals of the type $[a,c)$) result in more half-open intervals, not open ones. So, I don&#39;t understand how the half-open intervals serve as a subbase for the standard topology on $[a,b]$. Could somebody please explain this to me? \r\n\r\nThanks.", "778" ], [ "just to make sure, in order to get, say, $[a,c)$ from the intersection of $[a,b]$ and an open interval, you&#39;d need to intersect $[a,b]$ with an open interval whose left endpoint is less than $a$ (i.e., outside the closed interval on this side), and whose right endpoint is greater than $c$, right? Then, I&#39;d assume something similar in order to get $(c,b]$: you&#39;d need to intersect $[a,b]$ with an open interval whose left endpoint is less than $c$ and whose right endpoint is greater than $b$ (and so outside the interval on this side). Is this correct?", "576" ], [ "I know this is going to come across as a very strange question, but it&#39;s important that I know the answer.\r\n\r\nSay I have a degree $k$ polynomial (for my case, I need it to be a complex-valued polynomial with real coefficients, but I think the idea would work even if it were real-valued), $f(z) = a_{0}+a_{1}z+a_{2}z^{2}+\\cdots + a_{k-2}z^{k-2}+a_{k-1}z^{k-1}+a_{k}z^{k}$, then what is the formula for the $k-1$st derivative?\r\n\r\nObviously, the first few derivatives are:\r\n\r\n$f^{\\prime}=a_{1}+2a_{2}z+\\cdots (k-2)a_{k-2}z^{k-3}+(k-1)a_{k-1}z^{k-2}+ka_{k}z^{k-1}$\r\n\r\n$f^{\\prime\\prime}=2a_{2} + 3\\cdot 2 a_{3}z + 4 \\cdot 3 a_{4}z^{2} + \\cdots + (k-3)(k-2)a_{k-2}z^{k-4}+(k-2)(k-1)z^{k-3}+(k-1)ka_{k}z^{k-2}$\r\n\r\n$f^{\\prime\\prime\\prime}=3\\cdot 2 a_{3} + 4(3)(2) a_{4}z + \\cdots + (k-4)(k-3)(k-2)a_{k-2}z^{k-5}+(k-3)(k-2)(k-1)z^{k-4}+(k-2)(k-1)ka_{k}z^{k-3}$\r\n\r\nI&#39;m thinking the $k-1$st derivative would definitely contain only two terms, a constant term and a linear term, and the coefficient of the linear term would be $(k-(k-1))(k-(k-2))\\cdots (k-2)(k-1)k$, but I can&#39;t figure out the pattern for what the constant term should be.\r\n\r\nCould somebody please help me?!", "987" ], [ "In our lecture notes for our complex analysis class, we were given the following theorem:\r\n\r\n > **Theorem**: There exists a unique complex function $f$ such that \r\n\r\n > 1. $f(z)$ is a single valued function $f(z) \\in \\mathbb{R}$ whenever $z \\in \\mathbb{R}$ and $f(1)=e$.\r\n > 2. $\\forall z_{1},z_{2} \\in \\mathbb{C}$, $f$ satisfies $f(z_{1}+z_{2}) = f(z_{1})f(z_{2})$.\r\n > 3. $f$ is complex differentiable for all $z \\in \\mathbb{C}$.\r\n > Such $f(z)$ is denoted by $e^{z}$ or $\\exp(z)$ and called the **exponential function**.\r\n\r\nOn our homework, we were asked to give an alternative form of the proof by following these steps:\r\n\r\n > (a) Prove that $f^{\\prime}(0)=1$. (Hint: Argue why the limit $\\lim_{\\Delta z \\to 0} \\frac{f(\\Delta z)-f(0)}{\\Delta z}$ must be the same as $\\lim_{\\Delta x \\to 0} \\frac{f(\\Delta x)-f(0)}{\\Delta x}$, $x \\in \\mathbb{R}$.)\r\n\r\n > (b) Prove that $f^{\\prime}(z) = f(z)$ for all $z \\in \\mathbb{C}$.\r\n\r\n > (c) Treating the resulting differential equation $f^{\\prime}=f$, ,$f(0)=f^{\\prime}(0)=1$ as a system of real-number differential equations, prove that the only complex differentiable function $f$ that satisfies it is $f(z) = e^{x}(\\cos y + i \\sin y)$. (Hint: Don&#39;t forget the Cauchy-Riemann equations.)\r\n\r\nI think that once I have part (a) taken care of, I can figure out (b) and (c) by myself, but I am having a lot of trouble with part (a) - even understanding how arguing that $\\lim_{\\Delta z \\to 0} \\frac{f(\\Delta z)-f(0)}{\\Delta z}$ must be the same as $\\lim_{\\Delta x \\to 0} \\frac{f(\\Delta x)-f(0)}{\\Delta x}$, $x \\in \\mathbb{R}$ would help us, and how even to do so. \r\n\r\nBasically, as far as I&#39;ve gotten is the following:\r\n\r\n > Suppose $f$ is such a function. \r\n\r\n > Then $f^{\\prime}(0) = \\lim_{\\Delta z \\to 0} = \\frac{f(\\Delta z) - f(0)}{\\Delta z}$. \r\n\r\n > And since $\\Delta z = z - z_{0} = z-0 = z$, this becomes $\\lim_{z \\to 0} \\frac{f(z)-f(0)}{z} = \\displaystyle \\lim_{(a+bi) \\to (0+0i)}\\frac{f(a+bi)-f(0)}{a+bi} = \\displaystyle \\lim_{(a+bi) \\to (0+0i)}\\frac{f(a)f(bi) - f(0)}{a+bi}$.\r\n\r\nBut, I have no idea how to take it from there, or even if what I&#39;ve done so far is correct.\r\n\r\n**Could someone please help me with part (a)? Once I have that done, I&#39;m pretty sure parts (b) and (c) shouldn&#39;t be a problem.**\r\n\r\nThanks.", "403" ], [ "This is a step on the way to proving \r\n$$\r\n\\lim_{n \\to \\infty}\\left(1 + \\frac{z}{n}\\right)^{n} = e^{z}.$$\r\n\r\nI&#39;m looking for an answer *without* \r\n1) a summation or \r\n2) a logarithmic function. \r\n\r\nSo far, I have that \r\n$$\r\n\\lim_{n \\to \\infty} |z_{n}| = \\lim_{n \\to \\infty} \\vert\\left(1+\\frac{z}{n}\\right)^{n}\\vert = \\lim_{n \\to \\infty} \\left(\\sqrt{\\left(1+\\frac{x}{n}\\right)^{2} +\\left( \\frac{y}{n}\\right)^{2} }\\right)^{n} = \\lim_{n \\to \\infty}\\left(\\left( 1+\\frac{x}{n}\\right)^{2} + \\left(\\frac{y}{n} \\right)^{2} \\right)^{n/2} = \\lim_{n \\to \\infty} \\left( 1 + \\frac{2x}{n} + \\left(\\frac{x}{n}\\right)^{2} + \\left( \\frac{y}{n}\\right)^{2}\\right)^{n/2}.\r\n$$\r\nNow, I was given the following hint, and I would like to use it, but I don&#39;t know how:\r\n\r\n > **Hint**: Argue that you can discard terms with $1/n^{2}$; for example, by showing that the limit $\\displaystyle \\lim_{n \\to \\infty} \\frac{\\left(\\left( 1 + \\frac{x}{n}\\right)^{2} + \\left(\\frac{y}{n}\\right)^{2}\\right)^{n/2}}{\\left(1 + \\frac{2x}{n}\\right)^{n/2}} = 1$.\r\n\r\nHow would I show this ($\\epsilon$-definition?), and how would it help me here with what I&#39;ve already done?", "156" ], [ "@user254665, there is a way to do it. I cannot assume that I know the power series expansion for $e$ here. What I think our prof wants us to do is somehow get rid of all terms in the limit with a $n^{2}$ in the , but I don&#39;t understand his hint on how to do that. Also, remember that I am trying to find what the modulus of $(1+\\frac{z}{n})^{n}$ is, not $(1+\\frac{z}{n})^{n}$ itself. So it&#39;s going to approach a real number.", "757" ], [ "This question is related to another question I asked [here][1].\r\n\r\nSpecifically, using the definition of $e$ I gave in that question:\r\n\r\n > There exists a unique complex function $f$ such that \r\n\r\n > 1. $f(z)$ is a single valued function $f(z) \\in \\mathbb{R}$ whenever $z \\in \\mathbb{R}$ and $f(1) = e$\r\n > 2. $\\forall z_{1}, z_{2} \\in \\mathbb{C}$, $f$ satisfies $f(z_{1} + z_{2}) = f(z_{1})f(z_{2})$\r\n > 3. $f$ is complex differentiable for all $z \\in \\mathbb{C}$.\r\n\r\nEssentially, what I&#39;m doing in the problem linked here is trying to prove that for $f$ such a function as meets those three criteria, $f^{\\prime}(0) = 1$. The $f$ I am hoping to get eventually is $f(z) = e^{z}$, but that is what I am trying to prove; I cannot use anything specifically about $e^{z}$ here, only what is provided here in our definition of the function $f$.\r\n\r\nEventually, I was able to show that $f^{\\prime}(0) = \\lim_{\\Delta z \\to 0} \\frac{f(\\Delta z)-f(0)}{\\Delta z} = f(0) \\lim_{\\Delta x \\to 0} \\frac{f(\\Delta x) - 1}{\\Delta x}$.\r\n\r\nBut, I don&#39;t know how to go any further!\r\n\r\nI need to show that $f&#39;(0) = \\lim_{\\Delta x \\to 0} \\frac{f(\\Delta x)-1}{\\Delta x} = 1$. \r\n\r\nOther people have posted similar questions to this on here, but they haven&#39;t been answered particularly well. I can&#39;t assume anything about $e^z$, nor can I use anything like L&#39;Hopital&#39;s rule, or logarithms, or series expansions. \r\n\r\nThis is probably very very simple. Even an $\\epsilon$-$\\delta$ proof would be good, if you could write the whole thing out. I tried that route and I wasn&#39;t able to make any progress.\r\n\r\nPlease help!! \r\n\r\n [1]: _URL_0_", "403" ], [ "@Dr.MV, I don&#39;t have $e^{z}$ available to me right now. Right now, I have a function $f$ that meets the above criteria. I am trying to prove that that function $f$ is in fact $e^{z}$ using the differential equations method of proof. In order to do that, the first step I need to take is to show that $f^{\\prime}(0) = 1$. What I have posted in this question here is the very last part of showing that, but I don&#39;t know how to finish it.", "403" ], [ "can you please explain in greater detail the step where you went from $arg \\left( \\left( 1 + \\frac{x}{n} + i\\frac{y}{n}\\right)^{n}\\right)$ to $n \\arctan \\left(\\frac{y/n}{1+x/n}\\right) + 2\\mathcal{l}\\pi$? I&#39;m working on this same problem, and I understand that $arg\\left(1+ \\frac{x}{n} + i\\frac{y}{n}\\right) = \\arctan\\left(\\frac{y/n}{1+x/n}\\right) = 2\\mathcal{l}\\pi$, but I don&#39;t understand where the $n$ out front came from. Nor do I understand why the $n$ out front doesn&#39;t make the limit blow up to $\\infty$. Can you please explain this in greater detail? Thanks :)", "451" ], [ "I need to find and sketch the image of the straight line $z = (1+ia)t +aib$, where $-\\infty < t < + \\infty$, $a,b\\in \\mathbb{R}$, and $a \\neq 0$, under the map $w = e^{z}$.\r\n\r\nIn order to accomplish this thus far, I have substituted the expression for $z$ into the expresison for $w$ to yield \r\n\r\n > $\\displaystyle w = e^{z} = e^{(1+ia)t+ib} = e^{(1+ia)t}e^{ib}=e^{t}e^{i(at+b)} = e^{t}(\\cos(at+b)+i\\sin(at+b))$\r\n\r\nWhat I have to do next is eliminate $t$ in order to put the answer in polar coordinates. So, I let $\\varphi = at+b$, and then $t = \\frac{\\varphi}{a}-\\frac{b}{a}$. \r\n\r\nAlso, I am told that after eliminating $t$, the answer should be $r = ce^{\\varphi/a}$, where $c = e^{-b/a}$, which, upon substituting my expression for $t$ into $e^{t}(\\cos(at+b)+i\\sin(at+b))$ is what I get for $r$: $w = e^{\\frac{\\varphi}{a}-\\frac{b}{a}}(\\cos(\\varphi)+i\\sin(\\varphi)) = e^{\\frac{\\varphi}{a}-\\frac{b}{a}}e^{i\\varphi}$. \r\n\r\nBut what about this $e^{i\\varphi}$ part? Is this part of the image under the map? Do I have the correct image under the map? And how do I sketch it once I do have the correct image?\r\n\r\nI am very, very confused!", "723" ], [ "This question is related to one I asked [here][1] about the logarithmic spiral. \r\n\r\nIn the linked problem, I had to find and sketch the image of the straight line $z=(1+ia)t+ib$, for $-\\infty < t < +\\infty$,- where $a,b\\in \\mathbb{R}$ and $a \\neq 0$ under the map $w=e^{z}$.\r\n\r\nSubstituting that expression for $z$ into $w = e^{z}$, and then eliminating the parameter, $t$, by letting $\\varphi = at+b$, we obtained that $w = e^{\\frac{\\varphi}{a}-\\frac{\\varphi}{b}}e^{i\\varphi}$, and that the modulus of $w$ gives us $r = Ce^{\\varphi/a}$, where $C = e^{-b/a}$.\r\n\r\nNow, I am asked to do the following:\r\n\r\n > Given $a \\in \\mathbb{R}$, find the condition on real numbers $C$, $C^{\\prime} \\, > 0$ for the spirals $r=Ce^{\\varphi/a}$ and $r = C^{\\prime}e^{\\varphi/a}$ to be the same (as sets on a plane). I.e., find conditions on $C$ and $C^{\\prime}$ such that the logarithmic spiral is self-similar.\r\n\r\nIn doing some research about the logarithmic spiral, I have discovered that scaling by a factor of $e^{2\\pi b}$, with the center of scaling at the origin, will give us back our original curve, but I am not sure why or how to show this algebraically. \r\n\r\nCould somebody please help me out with this?\r\n\r\nThank you. \r\n\r\n [1]: _URL_0_", "186" ], [ "I need to show that $\\lim_{r \\to 0} \\int_{0}^{2 \\pi}f(r e^{i \\varphi})d \\varphi = 2 \\pi f(0)$ if $f$ is continuous on a neighborhood of $z = 0$. \r\n\r\nI was given the following hint: Write $\\int_{0}^{2 \\pi} f(r e^{i \\varphi})d \\varphi = \\int_{0}^{2\\pi}f(0) d\\varphi + \\int_{0}^{2\\pi}(f(re^{i \\varphi}) - f(0))d \\varphi$. Use the $Ml$-inequality to show that the latter integral $\\to 0$.\r\n\r\nThe $Ml$-inequality refers to the following: \r\n\r\n > If $f$ is integrable along $\\gamma$, $|f(z)|\\leq M$ for all $z \\in \\gamma$, and $l$ is the length of $\\gamma$, then $\\displaystyle \\left\\vert \\int_{\\gamma}f(z)dz \\right\\vert \\leq Ml$.\r\n\r\nSo, in order to apply this hint, I need to show that $|\\int_{0}^{2 \\pi}(f(re^{i \\varphi})-f(0))d\\varphi| \\leq M * 2\\pi$, but how do I find an $M$ such that $f(re^{i \\varphi })-f(0) \\leq M$? And even then, how will that inequality show that that integral goes to $0$?\r\n\r\nPlease note that I am not supposed to know Lebesgue&#39;s Dominated Convergence Theorem or any similar theorems, so answers using such theorems will not be helpful.", "186" ], [ "Suppose the sequence $(z_{n}) \\in \\overline{\\mathbb{C}}$ (where $\\overline{\\mathbb{C}}$ is the extended complex plane) converges to infinity as $n \\to \\infty$. I need to determine what this implies about $|z_{n}|$, $Re(z_{n})$, $Im(z_{n})$, $Arg(z_{n})$.\r\n\r\nI know that a sequence $(z_{n})$ converges to $z=x+iy$ if and only if $(x_{n}) \\to x$ and $(y_{n}) \\to y$. I suppose, therefore, that when $(z_{n}) \\to infty$ it does so because either $Re(z_{n})$, $Im(z_{n})$, or both must converge to $\\infty$. But, I am not 100 percent sure about this, or how to prove it.\r\n\r\nAs for $|z_{n}|$, I suppose it would be the same thing.\r\n\r\nFinally, for $Arg(z_{n})$, not sure what this would mean...perhaps that it converges to $\\pi/2$? \r\n\r\nCould somebody please explain this to me?\r\n\r\nThanks.", "268" ], [ "Given the family of circles $x^{2}+y^{2} = ax$, where $a \\in \\mathbb{R}$, I need to find the image under the transformation $w = 1/z$. I was given the hint to rewrite the equation first in terms of $z$, $\\overline{z}$, and then plug in $z = 1/w$.\r\n\r\nHowever, I am having difficulty doing this. \r\n\r\nI completed the square in $x^{2}+y^{2}=ax$ to obtain $\\left(x - \\frac{a}{2} \\right)^{2} + y^{2} = \\left(\\frac{a}{2} \\right)^{2}$.\r\n\r\nThen, given that $\\displaystyle x = Re(z) = \\frac{z+\\overline{z}}{2}$ and $\\displaystyle y = Im(z)= \\frac{-(z-\\overline{z})}{2i}$, I made those substitutaions and my equation became $\\left( \\frac{z+\\overline{z}-a}{2}\\right)^{2} - \\left(\\frac{\\overline{z}-z}{2} \\right)^{2} = \\left(\\frac{a}{2} \\right)^{2}$.\r\n\r\nThen, sbustituting in $z = \\frac{1}{w}$, this became $\\displaystyle \\frac{\\left(\\frac{1}{w} + \\frac{1}{\\overline{w}} - a \\right)^{2}}{4} - \\frac{\\left(\\frac{1}{\\overline{w}} - \\frac{1}{w} \\right)^{2}}{4} = \\frac{a^{2}}{4}$.\r\n\r\nBeyond this, my algebra gets very wonky.\r\n\r\nCould someone please tell me what my final result should be? Knowing that would allow me to work backwards and then apply these methods to other problems (of which I have many to do!).\r\n\r\nThanks.", "723" ], [ "I need to find the image of the upper half disc $|z| < 1$, $Im\\, z > 0$ under the inverse transformation $w = 1/z$.\r\n\r\nNow, since $|z| < 1$, $|z|^{2} < 1$. Rewriting this as $z\\overline{z} < 1$, we make the substitution $z = 1/w$ to obtain $\\frac{1}{u^{2}+v^{2}} < 1$, or $1 < u^{2}+v^{2}$, which is the exterior of the unit circle in the $w$-plane.\r\n\r\nAlso, we need to have $Im\\, z = \\frac{z-\\overline{z}}{2i} > 0$. Again, making the substitution $z = 1/w$ and simplifying, we get that $-\\frac{v}{u^{2} + v^{2}} > 0$, which implies that $\\frac{v}{u^{2}+v^{2}} < 0$, and since $u^{2} + v^{2}$ is always positive, that $v < 0$.\r\n\r\nSo, what I think is that the image of the upper half disc under $w = 1/z$ is the exterior of the lower half disc $|w| > 1$, $Im\\, w < 0$. Could someone please tell me if I&#39;m right? And if not, where did I go wrong?\r\n\r\nThank you.", "723" ], [ "Assuming arithmetic operations on $\\overline{\\mathbb{C}}$ (that&#39;s the extended complex plane) are defined via arithmetic operations on the corresponding sequences, I need to give examples showing why $0\\cdot \\infty$, $\\infty/\\infty$, and $0/0$ are meaningless.\r\n\r\nI also had to show the same thing for $\\infty - \\infty$, but that was easy: Consider the sequences $\\{1,3,3,5,5,7,7,9,\\cdots \\}$ and $\\{1,2,3,4,5,6,7,8,\\cdots \\}$, both of which belong to the class $\\infty$ (i.e., the equivalence class of all sequences converging to $\\infty$). Then, subtracting the second sequence from the first, term-by-term, we obtain the resulting sequence $\\{0,1,0,1,0,1,\\cdots\\}$, which does not belong to any convergence class, since it has no limit.\r\n\r\nHowever, I can&#39;t approach the three cases I&#39;m asking on here about in the same way. I must admit, I&#39;m a little confused as to what is being asked. For reference, it is problems 2-4 on p. 79 of Markushevich&#39;s Theory of Functions of a Complex Variable, Vol I.\r\n\r\nIf someone could furnish me with an example, at least for $0 \\cdot \\infty$, and maybe either $0/0$ or $\\infty/\\infty$, perhaps I could use that to help me figure out the other case on my own.\r\n\r\nThank you.", "543" ], [ "I think you know. take the formula $f(z) = \\frac{az+b}{cz+d}$, plug in $f(1)=1$ to get $f(1) = \\frac{a+b}{c+d} = 1$ (which means $a + b = c+ d $ in this case), $f(0)=-1$ to get $f(0) = \\frac{b}{d} = -1$, and $f(i)=i$ to get $f(i)=\\frac{ai + b}{ci+d}= i$. Then, you&#39;d have three equations, and you&#39;d use them to help you solve for $a,b,c,d$. My problem is that I&#39;m not entirely well-versed on how to solve equations with imaginary parts in them. For example, to simplify $\\frac{ai+b}{ci+d} = i$, can I multiply both sides by $ci+d$? Or do I need to multiply top and bottom by the conjugate $ci-d$?", "765" ], [ "I am working on the following problem:\r\n\r\n > Let $L$ be a closed, rectifiable simple curve, traversed\r\n > counterclockwise. Let $f(z)$ be a differentiable function on a domain\r\n > $G$ where $L \\cup E(L)$ ($E(L)$ is the *exterior* of $L$, $I(L)$ is\r\n > the *interior* of $L$) is contained in $G$. (That is, $f$ is\r\n > differentiable on a neighborhood of $L$ and outside of $L$, but not\r\n > necessarily inside.) \r\n > \r\n > Suppose that $\\displaystyle \\lim_{z \\to \\infty}f(z) = A$.\r\n > \r\n > Prove that $\\displaystyle \\frac{1}{2\\pi i}\\int_{L}\r\n\\frac{f(\\zeta)}{\\zeta-z}d \\zeta = A$ if $z \\in I(L)$ and that\r\n$\\displaystyle \\frac{1}{2\\pi i}\\int_{L} \\frac{f(\\zeta)}{\\zeta-z}d\r\n\\zeta = -f(z)+A$ if $z \\in E(L)$\r\n\r\nOur professor gave us a hint: Pass to integration over a large circle $|z|=R$ (which, I assume must contain $L$?) using Cauchy Theorem for multiple contours. Then, use the following result:\r\n\r\n > If $f(z)$ is continuous in the closed domain $|z| \\geq R_{0}$, $0 \\leq arg z \\leq \\alpha$ ($0 \\leq \\alpha \\leq 2\\pi$), and if the limit $\\displaystyle \\lim_{z \\to \\infty}zf(z) = A$ exists, then $\\displaystyle \\lim_{R \\to \\infty} \\int_{\\displaystyle \\Gamma_{R}} f(z) dz = iA\\alpha$ where &#1048576;$\\displaystyle \\Gamma_{R}$ is the arc of the circle $|z| = R$ lying in the given domain.\r\n\r\n\r\nThe professor&#39;s hint is confusing me a bit, and I&#39;m not sure how to apply it here. I.e., how do limits come into play here? Also, how do I use this circle to split the domain into multiple contours? \r\n\r\nI tried applying it, and this is all I have so far: Let $\\zeta = Re^{i \\theta}$, then $d \\zeta = i Re^{i \\theta} d \\theta$, so the integral becomes: $\\displaystyle \\frac{1}{2 \\pi i} \\int_{0}^{2\\pi} \\frac{f(Re^{i \\theta})}{Re^{i \\theta} - z}d\\theta $, and from that point, I am completely lost...", "186" ], [ "Suppose $f$ is an entire function such that $|f(z)|\\leq M|z|$ for some real constant $M$.\r\n\r\nThen, by Cauchy&#39;s Integral Formula,\r\n\r\n$\\displaystyle f^{\\prime}(z) = \\frac{1!}{2\\pi i} \\int_{\\gamma_{\\rho}} \\frac{f(\\zeta)}{(\\zeta - z)^{2}}d\\zeta$.\r\n\r\nSo, $\\displaystyle |f^{\\prime}(z)| = \\frac{1}{2\\pi }\\left\\vert \\int_{\\gamma_{\\rho}} \\frac{f(\\zeta)}{(\\zeta - z)^{2}}d\\zeta\\right\\vert \\leq \\frac{1}{2\\pi} \\int_{\\gamma_{\\rho}}\\left\\vert\\frac{f(\\zeta)}{(\\zeta - z)^{2}}d \\zeta\\right\\vert = \\frac{1}{2\\pi} \\int_{\\gamma_{\\rho}}\\frac{|f(\\zeta)|}{|(\\zeta - z)^{2}|}|d\\zeta| \\leq \\frac{1}{2\\pi}\\int_{\\gamma_{\\rho}}\\frac{M|\\zeta|}{|(\\zeta-z)^{2}|}|d\\zeta| = \\frac{M}{2\\pi}\\int_{\\gamma_{\\rho}}\\frac{|\\zeta|}{|(\\zeta-z)^{2}|}|d\\zeta| = \\frac{MI}{2\\pi}$, where $\\displaystyle I = \\int_{\\gamma_{\\rho}}\\frac{|\\zeta|}{|(\\zeta-z)^{2}|}|d\\zeta|$.\r\n\r\nThus, we have established that $f^{\\prime}(z)$ is bounded. It is certainly differentiable, since $f$ itself being first-differentiable implies that $f$ is infinitely differentiable.\r\n\r\nBy Liouville&#39;s Theorem, then, $f^{\\prime}(z)$ is constant. I.e., $f^{\\prime}(z) = a$, for $a \\in \\mathbb{C}$.\r\n\r\nIntegrating this, we obtain that $f(z) = \\int f^{\\prime}(z) dz = \\int a dz = az+b$, where $b \\in \\mathbb{C}$ is a constant of integration.", "186" ], [ "For $u(x,y) = x^{3} + Axy^{2}$, where $A$ is a real number, I need to find a harmonic conjugate, or if one does not exist, show that it does not exist.\r\n\r\nI began my approach to this problem by first checking whether $u(x,y)$ is even harmonic.\r\n\r\nHowever, I got that $\\displaystyle \\frac{\\partial ^{2} u}{\\partial x^{2}} = 6x$ and $\\displaystyle \\frac{\\partial ^{2}u}{\\partial y^{2}} = 2Ax$.\r\n\r\nSo, $u(x,y)$ appears to satisfy Laplace&#39;s Equation only when $A = -3$ or at $x = 0$ for any $A \\in \\mathbb{R}$.\r\n\r\nI believe that in order for $u(x,y)$ to be harmonic, however, it would need to be like analyticity, where Laplace&#39;s Equation would need to hold in at least a neighborhood of $x = 0$, the imaginary axis, and not just on the axis itself. But, that is only my intuition. I&#39;m not sure if this is actually true. If so, then we would need $A = -3$.\r\n\r\nSo, I suppose then I could go ahead and try to find a harmonic conjugate in the case where $A$ must be $-3$?\r\n\r\nI&#39;m a little confused as to how to proceed on this problem. Please help.", "316" ], [ "Suppose $f$, $g:G \\to \\mathbb{C}$ are defined on a domain $G \\subseteq \\mathbb{C}$ and are differentiable on $G$. Then, if $f^{\\prime} = g^{\\prime}$, then $f = g + C$ for some constant $C$.\r\n\r\nI attempted to prove this using the expression of $f^{\\prime}$ as the sum of partial derivatives - namely, if $f(z) = u(x,y)+iv(x,y)$ and $g(z) = t(x,y) + iw(x,y)$, then $f^{\\prime} = g^{\\prime}$ implies that $u_{x}(x,y) + i v_{x}(x,y) = t_{x}(x,y) + iw_{x}(x,y)$ (where $u_{x}(x,y)$ is the partial derivative of $u$ with respect to $x$).\r\n\r\nThis in turn implies that $u_{x}(x,y)=t_{x}(x,y)=w_{y}(x,y)$ by the Cauchy-Riemann equations, so $\\int w_{y}(x,y)dy = w(x,y) + h(x)$, where $h$ is a function solely of $x$.\r\n\r\nAlso, $v_{x}(x,y) = w_{x}(x,y) = -t_{y}(x,y)$ by the Cauchy-Riemann equations, so $\\int -t_{y}(x,y) dy = -t(x,y) + j(x)$, where $j$ is a function solely of $x$.\r\n\r\nBut all this tells me is that I can express $g$ as $w(x,y) + h(x) + i(t(x,y)-j(x))$, it doesn&#39;t say anything about $f$ equaling it. \r\n\r\nNeedless to say, I&#39;m stuck, and am not sure how to proceed with this proof. Please help.", "876" ], [ "I have to show the following:\r\n\r\n > Suppose that $X$ is a topological space for which there is a collection of continuous real-valued functions on $X$ that separates points in $X$. Show that $X$ must be <PERSON>.\r\n\r\nJust as a reminder, $f$ is said to **separate points** whenever for any $u$, $v$ $\\in X$, if $u \\neq v$, then $f(u) \\neq f(v)$, and a topological space $X$ is said to be **Hausdorff** provided that each two points in $X$ can be separated by disjoint neighborhoods.\r\n\r\nI attempted to approach this problem by showing that **Not Hausdorff $\\mathbf{\\to}$ Doesn&#39;t Separate Points**. My attempt is as follows:\r\n\r\n > Suppose $X$ is not Hausdorff. Then, for some $u$, $v$ $\\in X$ s.t. $u \\neq v$\r\n > , $\\displaystyle \\exists N_{\\delta_{1}}(u)$ and $\\displaystyle N_{\\delta_{2}}(v)$ s.t. $\\displaystyle N_{\\delta_{1}}(u) \\cap N_{\\delta_{1}}(v) \\neq \\emptyset$. I.e., $\\displaystyle \\exists x \\in N_{\\delta_{1}}(u) \\cap N_{\\delta_{2}}(v)$. \r\n\r\n > This implies that $|x-u| < \\delta_{1}$, $|x-v| < \\delta_{2}$. So, $|u-v| = |u-x+x-v| \\leq |x-u| + |x-v| < \\delta_{1}+\\delta_{2} = \\delta$. Then, because $f$ is continuous, this implies that $\\forall \\epsilon > 0$, $|f(u)-f(v)| < \\epsilon$.\r\n\r\n > Since this is true for any $\\epsilon > 0$, we conclude that $|f(u)-f(v)|= 0$, which implies that $f(u) = f(v)$, so $f$ does not separate points.\r\n\r\nIs this proof correct, and if not, what is wrong with it? How can I fix it so that it is correct?", "778" ], [ "@Arthur, I&#39;m actually working on this problem now myself. And I&#39;m not sure I can work out how far in the sequence I need to go for $|f_{n}g_{n} - fg|$ to be small enough. I was thinking that for $f_{n}$ to converge to $f$ in the sup norm, we&#39;d have $\\forall \\epsilon > 0$, $\\exists N_{1} \\in \\mathbb{N}$ st $\\forall n \\geq N_{1}$, $\\max_{x \\in X}|f-f_{n}| < \\epsilon$, which we&#39;re guaranteed b/c $X$ and thrfore $C(X)$ is compact. Then, there would be a similar $N_{2}$ for $g_{n}$, and then for $f_{n}g_{n}$, $N = \\max \\{ N_{1}, N_{2}\\}$ or something. Am I on the right track? If not, help please!", "268" ], [ "Let $\\mathcal{A}$ be an algebra of continuous real-valued functions on a compact space $X$ that contains the constant functions. Let $f \\in C(X)$ have the property that for some constant function $c$ and real number $a$, the function $a(f+c)$ belongs to $\\overline{\\mathcal{A}}$ (the closure of $\\mathcal{A}$ w.r.t. the sup norm). \r\n\r\nI need to show that $f$ also belongs to $\\overline{\\mathcal{A}}$.\r\n\r\nI know that by definition of an algebra of functions, if $f$, $g$ $\\in \\mathcal{A}$, then $fg \\in \\mathcal{A}$ as well. But, I have no yet proven that if $\\mathcal{A}$ is an algebra, then $\\overline{\\mathcal{A}}$ is an algebra (I&#39;m actually also working on that problem: asked a follow-up to somebody else&#39;s unanswered question about that [here][1], if you&#39;d care to help out with that), and thus can&#39;t multiply $a(f+c)$ by itself and hope to be able to squeeze an $f$ out of it somewhere.\r\n\r\nSo, essentially, I&#39;m stuck. Help would be much appreciated! Thanks.\r\n\r\n\r\n [1]: _URL_0_", "500" ], [ "**This is not a duplicate**. I realize similar questions to this have been asked, but **what I am asking is slightly different**:\r\n\r\nI need to prove the following, arguing by complex differentiability only, and **NOT** by calculating $\\displaystyle \\frac{\\partial^{2}}{\\partial x^{2}} + \\frac{\\partial^{2}}{\\partial y^{2}}$:\r\n\r\n > Let $u$, $v$ be conjugate harmonic functions on a domain $G$ (notice\r\n > it says nothing about $G$ being simply connected). For any function\r\n > $g = s + i t$ analytic on the image of $G$ under $u+iv$, the functions\r\n > $s(u(x,y), \\,v(x,y))$ and $t(u(x,y),\\, v(x,y))$ are harmonic, and the\r\n > latter is a harmonic conjugate of the former.\r\n\r\nI just proved a little while ago that if $u$ and $v$ are harmonic, and $f = u+iv$ is analytic, then $u^{2}-v^{2}$ is harmonic by considering $f^{2}$, and was told that what I am asking about here is a generalization of that result. However, thus far I have been unable to use that to help me.\r\n\r\nThe other times questions similar to this have been asked on this site, either it has been asked in the other direction, or OPs have not been specific about what they wanted, and so there have been all kinds of answers given, either doing exactly what I **don&#39;t** want to do here, which is to calculate the 2nd order partials and show that Laplace&#39;s Equation is satisfied (I have been specifically told **not** to do it that way), or referring to such esoteric things as Riemannian manifolds, which are completely useless to me in my current coursework.\r\n\r\nCould someone please help me out in proving this result the way I have been asked to prove it, using complex differentiability properties and results only, and not by either calculating 2nd order partials or anything too advanced (also no series)? I am at a loss as to what to do...thank you.", "876" ], [ "I am currently working on the following:\r\n\r\nProve that $\\displaystyle \\int_{L}\\frac{dz}{z^{2}+1} = 0$ if $L$ is any closed rectifiable simple curve on the outside of the unit disc, i.e., $L$ is contained in the region $|z| > 1$. Show that the equality is in general false for arbitrary closed rectifiable simple curves that miss zeros of $z^{2}+1$.\r\n\r\nPartial fraction decomposition yields that our integrand is not analytic at $z = \\pm i$ (surprise, surprise):\r\n\r\n$\\displaystyle \\int_{L} \\frac{dz}{z^{2}+1} = \\int_{L} \\left( \\frac{i}{2(z+i)} - \\frac{i}{2(z-i)}\\right)dz$.\r\n\r\n**Now, FYI, I am not allowed to use Cauchy&#39;s Integral Formula or Residues to solve this problem. Please do not post answers using either of those two methods, as they are useless to me.**\r\n\r\nI&#39;m thinking that for the first part, Cauchy&#39;s Theorem would work, although Cauchy&#39;s Theorem requires the function to be analytic in a simply connected domain. I think that a simply closed rectifiable curve on a region of $\\mathbb{C}$ where the function is analytic would form a simply connected domain, but I&#39;m not sure. **Update: I am having the hardest time with this part of the problem. I asked my professor, he said the $|z| > 1$ allows us to use Cauchy&#39;s Theorem for multiple contours. But, I&#39;m not sure how that would work, since we can&#39;t draw circles around each of the singularities, because neither of them are in the region. This is the part I would most appreciate an answer for** \r\n\r\nFor the second part, I&#39;m not entirely sure what is being asked. When they say \" ;miss zeros of $z^{2}+1$ \" ;, do they mean curves around such zeros? Or do they mean curves that don&#39;t go anywhere near them? I&#39;m a bit confused. **Update: I now understand this part**\r\n\r\nPlease help.", "186" ], [ "I need to evaluate the integral $\\displaystyle \\int_{|z-i|=R}\\frac{z^{4}+z^{2}+1}{z(z^{2}+1)} dz$ as a function of $R > 0$. I may omit values of $R$ for which the denominator turns to $0$.\r\n\r\nNow, using partial fraction decomposition, the integral can be split up as follows: $\\displaystyle \\int_{|z-i|=R} z \\,dz + \\int_{|z-i|=R}\\frac{1}{z}\\,dz-\\frac{1}{2}\\int_{|z-i|=R}\\frac{1}{z+i}\\,dz -\\frac{1}{2}\\int_{|z-i|=R} \\frac{1}{z-i}\\,dz$\r\n\r\nValues for which the denominator of the non-decomposed function turns to $0$ include $R=1$ (when $R=1$, the curve intersects the singularity $z=0$) and $R=2$ (when $R=2$, the curve intersects the singularity $z=-i$). \r\n\r\nAlso, as $R$ grows to encompass all the singularities, the integral will go to $0$, by Cauchy&#39;s Theorem. \r\n\r\nHowever, I am not really sure what to do with this problem. I tried actually parametrizing each integral, letting $|z-i|=R$ become $z = Re^{i \\theta} + i$, but for the second and third integrals, I wound up getting $\\ln|0|$, which is undefined. Anyway, this is not evaluating the integral as a function of $R$, but as a function of $z$ (or $\\theta$).\r\n\r\nPlease help! Any help is needed, but any answers cannot use Residues or Cauchy&#39;s Integral Formula (Cauchy&#39;s Theorem for either simply or multiply connected domains is fine). And I would prefer something completely worked out. Thank you.", "186" ], [ "My question is related to [this one][1], but it is not a duplicate, because I am not allowed to use Residues or Cauchy&#39;s Integral Formula to solve it. The only tools I have at my disposal are Cauchy&#39;s Theorem and Cauchy&#39;s Theorem for Multiply Connected Domains. \r\n\r\nI need to solve the following: \r\n\r\n > Given a polynomial $p(z) = (z-z_{1})(z-z_{2})\\cdots (z-z_{n})$, where\r\n > $z_{k} \\neq z_{j} $for $k \\neq j$, let $L$ be a simple closed\r\n > rectifiable curve that does not pass through any of the roots of\r\n > $p(z)$. How many distinct values of $\\int_{L}\\frac{dz}{p(z)}$ can one\r\n > obtain, at most, by changing $L$? (In other words, the integral\r\n > $\\int_{L}\\frac{dz}{p(z)}$ is a function $J(L)$ of $L$. How many values\r\n > can it take on, at most?)\r\n\r\nUsing partial fraction decomposition, we know that what we would want is to have $\\displaystyle \\int_{L}\\frac{dz}{p(z)} = \\int_{L}\\frac{1}{(z-z_{1})(z-z_{2})\\cdots(z-z_{n})}dz = \\int_{L} \\frac{A_{1}}{(z-z_{1})}+\\frac{A_{2}}{(z-z_{2})}+\\cdots + \\frac{A_{n}}{(z-z_{n})}dz$.\r\n\r\nSo, $A_{1}(z-z_{2})\\cdots(z-z_{n})+A_{2}(z-z_{1})(z-z_{3})\\cdots(z-z_{n})+\\cdots + A_{n}(z-z_{1})(z-z_{2})\\cdots(z-z_{n-1}) = 1$,\r\n\r\nand each $\\displaystyle A_{k} = \\frac{1}{(z_{k}-z_{1})(z_{k}-z_{2})\\cdots (z_{k}-z_{k-1})(z_{k}-z_{k+1})(z_{k}-z_{n})}$.\r\n\r\nBut, I don&#39;t know where to go from there.\r\n\r\nThe other question mentioned that $\\sum_{i=1}^{n}A_{i} = 0$, which makes absolutely no sense to me. If this is true, I would welcome an explanation why. \r\n\r\nI get that as $L$ gets larger to encompass all of the $z_{i}$ (even if the $z_{i}$ are not in order from smallest to largest, we can, WLOG, order them that way), the integral will become zero, by Cauchy&#39;s Theorem. But, this is as far as I have been able to reason. \r\n\r\nFeel free to be extremely detailed in your answer. I am completely clueless. \r\n\r\n [1]: _URL_0_", "186" ], [ "Suppose that $f(z)$ is analytic at every point of the closed domain $0 \\leq arg z \\leq \\alpha$ $(0 \\leq \\alpha \\leq 2 \\pi)$, and that $\\lim_{z \\to \\infty}z f(z) = 0$. I need to prove that if the integral $\\displaystyle J_{1}=\\int_{0}^{\\infty}f(x) dx$ exists, then the integral $\\displaystyle J_{2}=\\int_{L}f(z)dz$, where $L$ is the ray $z=r e^{i \\alpha}$, $0 \\leq r \\leq \\infty$. Moreover, I need to show that $J_{1} = J_{2}$\r\n\r\nI have been given the hint to use Cauchy&#39;s Theorem (not the Cauchy integral formula or residues - answers using either of those things are useless to me), and the result of the previous problem, which states as follows:\r\n\r\n > If $f(z)$ is continuous in the closed domain $|z|\\geq R_{0}$, $0 \\leq arg z \\leq \\alpha$ $(0 \\leq \\alpha \\leq 2 \\pi)$, and if the limit $\\displaystyle \\lim_{z \\to \\infty} zf(z) = A$ exists, then $\\displaystyle \\lim_{R \\to \\infty}\\int_{\\displaystyle \\Gamma_{R}}f(z)dz = i A \\alpha$, where $\\Gamma_{R}$ is the arc of the circle $|z|=R$ lying in the given domain.\r\n\r\nSo, for this problem, I can use the fact that $\\lim_{z \\to \\infty}zf(z) = 0$ to show that $\\displaystyle \\lim_{r \\to \\infty}\\int_{\\displaystyle \\Gamma_{r}}f(z)dz = 0$ at some point, I guess.\r\n\r\nThus far, I&#39;ve tried approaching this problem in two different ways.\r\n\r\nThe first way was to start out with $J_{2} = \\int_{L}f(z)dz$ and then try to get $L_{1}$ to pop out somewhere. Didn&#39;t get too far with that, and anyway, I&#39;m not sure that it is correct to write $\\int_{L}f(z)dz = \\lim_{r \\to \\infty}\\int_{0}^{2\\pi}f(re^{i\\alpha})ire^{i \\alpha}d \\alpha$. All of these angles and args are confusing me, and I&#39;m not even entirely sure what the domain on which $f(z)$ is analytic looks like.\r\n \r\nThe second way was to start out with $J_{1} = \\int_{0}^{\\infty}f(x) dx$, and try to parametrize it in terms of $z = re^{i \\alpha}$. But, I&#39;m not sure exactly how to do this (again, the domain is confusing. Tried to draw it; didn&#39;t help. Maybe I&#39;m just not visualizing it right). Then, at some point, I assume I can apply Cauchy&#39;s Theorem and the given limit.\r\n\r\nI&#39;m guessing that since Cauchy&#39;s Theorem is involved and that the given limit goes to $0$, I&#39;m probably going to wind up with $0 = J_{1} = J_{2}$, but I need a lot of help and guidance to show this. \r\n\r\nI&#39;m at my wits end, don&#39;t have a lot of time to figure this out, and am starting to panic. Please help.", "186" ] ]
336
[ 4858, 5014, 10138, 5264, 5510, 5662, 6190, 10623, 18190, 7926, 10405, 11938, 16317, 4841, 790, 9042, 2567, 15343, 4215, 9803, 12581, 6943, 17551, 19036, 7004, 6563, 4085, 6967, 4452, 9284, 7477, 9472, 7754, 6654, 14125, 11096, 5249, 10496, 6124, 19141, 13724, 7693, 1850, 5746, 12299, 7319, 10210, 9964, 6296, 1022, 16116, 4483, 17695, 2536, 8312, 8738, 6885, 389, 7873, 5415, 8954, 10870, 8491, 7575, 17339, 934, 5517, 15301, 15545, 17105, 6284, 2724, 6182, 12137, 10506, 17946, 11739, 2074, 10154, 10605, 8044, 12165, 8107, 8494, 8790, 3807, 10363, 7645, 5810, 7822, 7084, 15277, 14988, 19411, 15665, 3993, 7258, 8597, 16335, 3701, 3833, 16119, 3453, 5670, 9983, 8831, 1887, 10934, 17613, 8239, 4686, 3659, 8215, 10883, 6480, 6028, 16729, 7776, 19730, 15556, 1805, 3609, 3706, 3068, 2387, 9572, 2513, 7123, 16402, 16500, 6390, 4911, 15708, 10924, 5908, 10020, 4732, 8803, 8019, 7745, 15734, 2257, 2030, 1488, 8544, 6098, 869, 19343, 644, 6510, 9243, 2079, 8775, 12302, 7952, 6037, 7951, 812, 12209, 4110, 2282, 7113, 16067, 9061, 18174, 7492, 5532, 10239, 7183, 1815, 5592, 18891, 5910, 3423, 2252, 12129, 3035, 4065, 8725, 19116, 3163, 1190, 7008, 14272, 18479, 12147, 11121, 11326, 932, 8454, 5492, 6054, 18590, 11762, 2864, 1711, 1687, 14347, 15325, 840, 1467, 17173, 8632, 2150, 14360, 4876, 18789, 6701, 12166, 6714, 7229, 11808, 8112, 4955, 356, 7696, 872, 8363, 13197, 17429, 475, 7480, 3412, 2878, 815, 3493, 8298, 7611, 9885, 11785, 3552, 1177, 15861, 4140, 7330, 7662, 7070, 1131, 3009, 3558, 8367, 18961, 7379, 17376, 6193, 8701, 8487, 655, 3132, 15474, 7520, 4766, 10416, 1312, 11893, 9133, 4053, 10260, 14937, 19300, 14661, 2373, 3769, 8425, 16420, 15227, 7440, 2591, 7791, 9017, 19117, 4054, 9248, 8149, 14979, 3115, 6237, 7041, 2605, 721, 1462, 18540, 7231, 7761, 8057, 11620, 5344, 231, 8431, 890, 10744, 8458, 7627, 6209, 4908, 4242, 8767, 4816, 12150, 7318, 10699, 4162, 10865, 1857, 8128, 17087, 11759, 17504, 3589, 3467, 2894, 7892, 17244, 8185, 1101, 3847, 2808, 7085, 19533, 1863, 4066, 8022, 13746, 9105, 6787, 6457, 18379, 4877, 8481, 1186, 8399, 7000, 10012, 4364, 6369, 15203, 5360, 18359, 2093, 6723, 8274, 12990, 5257, 14887, 8787, 16740, 5834, 3841, 12182, 144, 6485, 6992, 14669, 12101, 19487, 8901, 10826, 16585, 8714, 9946, 13511, 19651, 6937, 8755, 15891, 2971, 19200, 6942, 15264, 773, 704, 4847, 3822, 18577, 11212, 19483, 5659, 19717, 3087, 4828, 12741, 16659, 8852, 9016, 11249, 8653, 19588, 9271, 9166, 13315, 6575, 1509, 11240, 8198, 7591, 7709, 2851, 6466, 2966, 7309, 10806, 18112, 10142, 7021, 13394, 17751, 7264, 3138, 13855, 8406, 3388, 14209, 9886, 10218, 2874, 7221, 7552, 7386, 7135, 2704, 13598, 7742, 19060, 13555, 18123, 17377, 3415, 15393, 5012, 5992, 14943, 17494, 10993, 8064, 16532, 6355, 17139, 1219, 3034, 2970, 12050, 13812, 1247, 11237, 12328, 8791, 11985, 7397, 434, 1364, 13986, 3142, 16980, 13562, 15216, 18405, 5952, 12987, 7466, 9035, 9221, 16357, 1868, 7939, 2990, 1073, 3173, 14813, 9404, 2854, 8273, 19326, 2076, 1983, 2589, 3620, 1679, 16505, 462, 12368, 10842, 11679, 1861, 8441, 3943, 12379, 6376, 6265, 8658, 763, 10396, 14396, 7366, 8863, 7339, 8690, 4767, 12372, 10431 ]
STX_100490.0
[ [ "The logic behind this could be that when the spokes move each one of them traces an area per sec. There are free electrons in the spoke. Assume that the spoke is divided into small parts. Electrons of a part have a velocity which is equal to the velocity of that part of the spoke, since they are perpendicular to the magnetic field they experience a force. Each electron shifts to one side of the spoke due to force given by F = BeV. Thus creating a potential difference/EMF.", "891" ], [ "My book says : \r\nThe number of interference fringes occuring in the broad diffraction peak depends on the ratio d/a that is the ratio of the distance between the two slits to the width of a slit. In the limit of \" ;a \" ; becoming very small, the diffraction pattern will become very flat and we will observe the two slit interference pattern.\r\n\r\nHow can interference pattern be observed in a diffraction pattern? Why does it depend upon the ratio d/a? Why will we observe interference when a is very small?", "471" ], [ "For a definitive, although OS specific, answer, from [Memory Usage Performance Guidelines][1]:\r\n\r\n\r\n\r\n > **Wired Memory**\r\n\r\n > Wired memory (also called resident memory) stores kernel code and data structures that must never be paged out to disk. Applications, frameworks, and other user-level software cannot allocate wired memory. However, they can affect how much wired memory exists at any time. For example, an application that creates threads and ports implicitly allocates wired memory for the required kernel resources that are associated with them.\r\n\r\n > Table 2 lists some of the wired-memory costs for application-generated entities\r\n\r\n > [![Wired memory generated by user-level software][2]][2]\r\n\r\n > As you can see, every thread, process, and library contributes to the resident footprint of the system. In addition to your application using wired memory, however, the kernel itself requires wired memory for the following entities:\r\n > \r\n > - VM objects\r\n > - the virtual memory buffer cache\r\n > - I/O buffer caches\r\n > - drivers\r\n > \r\n > Wired data structures are also associated with the physical page and\r\n > map tables used to store virtual-memory mapping information, Both of\r\n > these entities scale with the amount of available physical memory.\r\n > Consequently, when you add memory to a system, the amount of wired\r\n > memory increases even if nothing else changes. When a computer is\r\n > first booted into the Finder, with no other applications running,\r\n > wired memory can consume approximately 14 megabytes of a 64 megabyte\r\n > system and 17 megabytes of a 128 megabyte system.\r\n > \r\n > Wired memory pages are not immediately moved back to the free list\r\n > when they become invalid. Instead they are “garbage collected” when\r\n > the free-page count falls below the threshold that triggers page out\r\n > events.\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "257" ], [ "[![qu][1]][1]`[![question 24][1]][1]`[![2nd page][2]][2][![derivation for maximum current][3]][3]Suppose in a circuit the battery has emf 6V and internal resistance 3ohm. It is connected to an external resistance = R ohm. According to my book the maximum power dissipated is when R = 3 ( I.e. internal resistance). They have derived the result and it seems fine. Now power = I^2 ( R+3) and I = 6/(R + 3) so power should be 36/(R+3). But if we put R=3 power is 6 w and if we put R = 0 power is 12 w. So shouldn&#39;t power be maximum when external resistance is 0?\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_2_\r\n [3]: _URL_1_", "803" ], [ "Following on from the answer to [Can you make OSX mount just certain partitions when you connect an external HDD?][1], all of the sites that I have checked ([CNET][2], OSXDaily, [Apple Support community threads][3]) say that you have to use Disk Utility (or the command line `diskutil info /dev/disk < X > s < Y > `) to find the UUID. \r\n\r\nIs there a command line equivalent that will give me this information, which is not `diskutil`? In particular, one that will work in single user mode?\r\n\r\n###Why diskutil does not work\r\n\r\nIn *single user mode* (at least on Mountain Lion) after running: \r\n\r\n /sbin/fsck -fy\r\n /sbin/mount -uw /\r\n\r\nrunning: \r\n\r\n diskutil info disk0s5\r\n\r\ngives the following error\r\n\r\n Unable to run because unable to use the DiskManagement framework.\r\n Common reasons include, but are not limited to, the DiskArbitration\r\n framework being unavailable due to being booted in single user mode.\r\n\r\n\r\n\r\n###Background\r\n\r\nMy issue is that I have a dying partition on my internal disk, which only holds an out of date Snow Leopard OS, but is slowing down my Mac (unbearably), as the console is (repeatedly) reporting:\r\n\r\n kernel: disk0s5: I/O error.\r\n\r\nI no longer boot into Snow Leopard as I boot Mountain Lion which is on an external FireWire disk, so I would like to leave the Snow Leopard partition unmounted, using the line\r\n\r\n UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX none hfs rw,noauto\r\n\r\nin `/etc/fstab`. \r\n\r\nHowever, to obtain the UUID of the faulty partition, I have to open up Disk Utility and have the faulty partition mounted, which is a torturously slow process (it takes Disk Utility about twenty minutes to open).\r\n\r\n----\r\n\r\n**TL;DR** -\r\nCan I obtain the UUID of the internal partition, when booting into single user mode of an OS stored on a partition which is on an external FW disk?\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_1_\r\n [3]: _URL_0_", "551" ], [ "The article [Thermal Paste Thermal Tape Question Logic Board][1] mentions a similar black substance used in a G4 PowerBook logic board:\r\n\r\n > When installing the logic board, I know your&#39;re required to use the silver colored thermal paste on the main processor and it&#39;s heat sink. On the other chip however, ( I assume it&#39;s the video chip, it says Motorola on it), the original techs appear to have used something black, and it is thicker, and harder to remove and appears to be cut to size. My question is,...what is the black stuff used on the other processor with a copper heat sink? Is it black thermal tape, cut to size and if so, where do you buy it from? And do you apply a piece of tape on the video processor and on the copper heat sink? Or do you apply the thermal substance on only only one part either the video chip or the copper heat sink?\r\n\r\nUnfortunately, as you mention, there appears to be no source for the black thermal substance < sup > 1 < /sup > . However, silver (which has an extra 5% efficiency) thermal paste, rather than white , should do the trick.\r\n\r\n----\r\n\r\n < sup > 1 < /sup > Unless this [Thermal paste for iPhone 5 Mainboard][2] is the black stuff.\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "846" ], [ "@bmike - Sorry, I think my question may be somewhat unclear. I am attempting to do as you suggest - However, I have Mountain Lion on an external FW disk (en lieu of USB), which works perfectly well, but the internal drive partition needs to be unmounted first using the `/etc/fstab` technique`... hence the requirement for the UUID to be obtained in single user mode. Unless I open up the Mac and physically remove the drive, which I am not willing to do just yet.", "424" ], [ "`ioreg -c IOMedia -r` unfortunately still scrolls too much data too quickly, in the same way that as `ioreg -l` on its own just scrolls streams of unreadable data up the screen, and using it in conjunction with `|more` just causes illegible binary data to be displayed, for some reason. `ioreg -c IOMedia -r | grep UUID` followed by `ioreg -c IOMedia -r | grep disk` fits on screen and one can correlate the two results, thereby linking the disks and the UUIDs. However, strangely, `ioreg -l | grep UUID` followed by `ioreg -l | grep disk` has better formatting and is actually _easier_ to read.", "143" ], [ "As an aside, I have just discovered that there is no actual need to do any of this, because, en lieu of using the UUID, you can use the *volume label* instead, in `/etc/fstab`, like so:\r\n\r\n LABEL=Archive none hfs rw,noauto 0 0\r\n\r\nThis method has the benefit of:\r\n\r\n 1. Being much simpler to implement, and **more importantly**;\r\n 2. The volume label does not change, whereas the UUIDs change as you plug in other FW or USB disks. So, if you are using UUIDs in `/etc/fstab` then you need to update those UUIDs for the unmounted disks, in `/etc/fstab`, each time you change the disk configuration.\r\n\r\nNote: The use of the `LABEL` in `/etc/fstab`, may not always work (i.e. if the disk is very corrupted and the label can not be read). In such cases, you will be obliged to use UUID.", "551" ] ]
245
[ 4739, 6206, 10722, 11573, 4230, 8004, 4207, 1923, 1014, 3510, 10398, 8329, 1420, 4501, 9410, 6452, 9694, 16878, 7545, 2904, 4891, 3436, 9265, 7804, 17945, 5493, 10747, 2458, 19763, 4959, 2846, 9053, 5395, 10319, 3004, 11931, 12898, 4417, 9384, 17264, 716, 11321, 4640, 10997, 5082, 4382, 11248, 16236, 12068, 3786, 13098, 9096, 3267, 552, 17806, 18650, 10655, 5605, 18554, 4164, 12128, 7420, 5832, 18851, 8734, 1670, 16813, 19190, 10685, 9984, 2871, 3489, 15886, 4013, 14638, 17823, 4511, 4972, 4840, 3078, 11431, 13324, 19255, 696, 4510, 13611, 10137, 12096, 4529, 15339, 2521, 5839, 18937, 8621, 9938, 5475, 12642, 17009, 19382, 19477, 752, 11872, 7542, 12627, 16916, 10261, 11907, 12020, 2647, 18243, 5127, 15435, 7129, 14856, 785, 15781, 455, 192, 8913, 11410, 1440, 15867, 8570, 12751, 17569, 7097, 3006, 18360, 4774, 7401, 5706, 11196, 19426, 821, 10723, 8556, 17697, 12455, 3162, 3655, 18123, 18915, 14978, 5347, 11749, 9745, 4577, 7506, 7813, 1699, 3629, 4282, 16592, 5490, 11015, 17490, 16640, 7905, 7655, 2893, 16012, 3426, 11578, 46, 4598, 9512, 14628, 18550, 15196, 15489, 9903, 15348, 16617, 17348, 7493, 2784, 9941, 1772, 1266, 7024, 16676, 18557, 19236, 350, 4153, 6843, 16994, 11287, 16507, 1919, 4068, 8326, 13669, 19439, 16866, 2744, 14681, 385, 9638, 10910, 453, 9213, 1827, 1044, 523, 7197, 3031, 2805, 271, 9198, 1445, 2281, 19732, 16306, 927, 10046, 17096, 1251, 9553, 2083, 12430, 16842, 1994, 15069, 19215, 5981, 15728, 7409, 14068, 3999, 5406, 3002, 1765, 13390, 4204, 18040, 19604, 14424, 11653, 15970, 16407, 17660, 12070, 16788, 10, 13827, 1794, 10645, 8927, 8318, 7626, 15623, 1402, 4348, 3571, 476, 575, 11425, 1809, 1964, 958, 15934, 4953, 13242, 10621, 536, 8462, 4679, 3109, 4425, 5195, 5286, 18402, 17106, 18592, 12212, 1748, 18924, 19045, 4997, 15595, 9749, 13880, 1785, 15631, 1070, 1893, 9368, 11262, 19251, 4027, 3177, 3712, 16339, 18119, 8056, 14994, 2758, 4759, 10935, 18001, 2866, 19041, 4938, 18909, 3257, 462, 17177, 12856, 1, 4964, 10629, 14467, 12120, 5034, 4544, 14905, 11574, 3398, 12158, 7125, 3740, 14219, 7088, 6965, 8530, 10148, 15941, 9713, 16475, 10333, 7042, 7439, 9460, 15430, 9866, 2823, 18967, 5311, 15571, 16575, 19431, 3420, 8791, 7077, 6542, 15868, 5672, 5030, 1613, 16693, 17356, 13183, 15452, 5421, 3792, 7937, 14410, 19334, 16256, 16221, 3202, 18086, 14357, 12275, 19169, 11703, 2007, 15989, 2166, 2734, 5309, 768, 1068, 2855, 1278, 3557, 2123, 14616, 6105, 3757, 7329, 18878, 3810, 11923, 7918, 4447, 17295, 9691, 16700, 3580, 8879, 18387, 2289, 8812, 2711, 4216, 12873, 19470, 16539, 8076, 3206, 948, 19553, 8730, 786, 1349, 12933, 5901, 7010, 13362, 9936, 11618, 4843, 12653, 16456, 5752, 1790, 1705, 9441, 711, 4740, 5185, 18823, 12617, 11916, 7308, 8194, 9090, 8503, 5938, 11371, 12104, 19066, 173, 2890, 18284, 12234, 19491, 5749, 6461, 3326, 10121, 2735, 1311, 16671, 17430, 9346, 811, 8040, 4944, 18749, 14293, 16834, 16277, 18830, 11203, 7703, 3764, 18767, 18613, 13019, 14897, 4226, 18532, 9636, 16261, 16484, 3000, 12010, 18638, 13008, 4482, 3703, 8588, 10155, 5322, 2615, 17278, 17007, 11537, 12055, 5498, 10664, 8034, 10608, 491, 12355, 1064, 34, 8529, 11278, 13285, 9183, 14345, 11066, 12183, 19144, 6296 ]
STX_1005022.0
[ [ "How do I reference SHDocVw and IEFrame in LINQPad?\r\n\r\nI tried both system32 and SysWOW64 but they both fail to load: \" ;Metadata file &#39;c:\\Windows\\SysWOW64\\ieframe.dll&#39; could not be opened -- &#39;An attempt was made to load a program with an incorrect format. &#39; \" ;\r\n\r\nIn Visual Studio this is done using the COM tab and choosing \" ;Microsoft Internet Controls \" ; but in LINQPad the reference dialog is completely different...\r\n\r\nIs tlbimp RCW generation an option? Surely there are existing wrappers I can leverage on (as any .NET apps developed in VS can)\r\n\r\nThanks.", "206" ], [ "Thank you @zett42, your comment pointed me out in the right direction - I created a Wix Preprocessor Extension, following the documentation here: _URL_0_ \r\n\r\nHere are the classes I created:\r\n\r\n public class MaterialiserExtension : WixExtension\r\n {\r\n private MaterialiserPreprocessorExtension preprocessorExtension;\r\n \r\n public override PreprocessorExtension PreprocessorExtension\r\n {\r\n get\r\n {\r\n if (this.preprocessorExtension == null)\r\n {\r\n this.preprocessorExtension = new MaterialiserPreprocessorExtension();\r\n }\r\n \r\n return this.preprocessorExtension;\r\n }\r\n }\r\n }\r\n\r\n public class MaterialiserPreprocessorExtension : PreprocessorExtension\r\n {\r\n private static string[] prefixes = { \" ;versionUtil \" ; };\r\n public override string[] Prefixes { get { return prefixes; } }\r\n\r\n public override string EvaluateFunction(string prefix, string function, string[] args)\r\n {\r\n string result = null;\r\n switch (prefix)\r\n {\r\n case \" ;versionUtil \" ;:\r\n switch (function)\r\n {\r\n case \" ;ToString \" ;:\r\n if (0 < args.Length)\r\n {\r\n result = Version.Parse(args[0]).ToString(args.Length > 1 & & args[1] != null ? int.Parse(args[1]) : 4);\r\n }\r\n else\r\n {\r\n result = String.Empty;\r\n }\r\n break;\r\n }\r\n break;\r\n }\r\n return result;\r\n }\r\n }\r\n\r\nOne thing that was not immediately obvious - in my Visual Studio Wix project, I had to add \r\n-ext \" ;$(SolutionDir)Materialiser.Wix\\bin\\Release\\Materialiser.Wix.dll \" ; to Properties (Alt+Enter) > Tool Settings > Compiler (candle) and the same in Linker (light).\r\n\r\nTo use, it is very simple:\r\nin my .wxs file I define a property like this:\r\n\r\n < ?define ProductVersion= \" ;<IP_ADDRESS> \" ; ? > \r\n\r\nThen I use it in Product like this:\r\n\r\n < Product Version= \" ;$(var.ProductVersion) \" ; .. > \r\n\r\nAnd then I create anew property like this:\r\n \r\n < Property Id= \" ;VersionWithNoBuildNumber \" ; Value= \" ;$(versionUtil.ToString([ProductVersion], 3)) \" ; / > \r\n\r\nand in my .wxl file I use it normally:\r\n\r\n < String Id= \" ;WelcomeDlgTitle \" ; > {\\WixUI_Font_Bigger}Welcome to the [ProductName] v[VersionWithNoBuildNumber] Setup Wizard < /String > \r\n\r\nI hope this helps someone else too :p", "363" ], [ "1. Open RegEdit (elevated)\r\n 2. Right click on HKEY_CLASSES_ROOT then select New > Key\r\n 3. Type &#39;alert&#39;\r\n 4. Right click on &#39;alert&#39; then select New > String value\r\n 5. Type (Default), then double click on the entry and write your value ie. \" ;URL:Alert Protocol \" ;\r\n 6. Repeat for the other entries, respecting the hierarchy and entry type of your list (NB. in the link you provided - DefaultIcon, shell, open and command are all Keys and the (Default) entries are all String Value)\r\n\r\nOnce you have all your entries, you can always right-click on any of the keys (the folders) and \" ;Export \" ; to file. Importing the resulting file is easy - just click on it :)\r\n\r\nHope this helps.\r\n\r\n<PERSON>", "905" ], [ "I think this is what you need... Although I suggest to word the question in a clearer way and to provide input and desired/expected output.\r\n\r\n void Main()\r\n {\r\n \tvar someObjects = new List < ObjectClass > ();\r\n \t\r\n \tsomeObjects.Add(new ObjectClass(){Name= \" ;numberWang \" ;, Value = 2});\r\n \tsomeObjects.Add(new ObjectClass(){Name= \" ;numberWang \" ;, Value = 3});\r\n \tsomeObjects.Add(new ObjectClass(){Name= \" ;numberTwang \" ;, Value = 4});\r\n \tsomeObjects.Add(new ObjectClass(){Name= \" ;numberTwang \" ;, Value = 5});\r\n \r\n \t//You could filter this beforehand with a Where clause ie. someObjects.Where(i= > _URL_1_ == \" ;whatever \" ;).Sum(i= > i.Value)\r\n \tint sumOfValuesOfAllObjects = someObjects.Sum(i= > i.Value);\r\n \t\t\r\n \tvar sumByObjectClassName = someObjects.GroupBy(a= > _URL_0_).Select(b= > \r\n \tnew ObjectClass() { Name = b.First().Name, Value =b.Sum(c= > c.Value) } );\r\n }\t\r\n \r\n public class ObjectClass\r\n {\r\n public string Name;\r\n public int Value;\r\n }", "490" ], [ "I looked deeper into this as the very helpful comments above pointed me to think this is not an issue with my addin code but rather with the VSTO host application ie. Word.\r\n\r\nSo I created a simple VSTO addin with a one button ribbon that just opens a taskpane with a label which says “Hello!” (nothing else – no WPF) and I can confirm that even in this scenario I still get the HKEY Leak on shutdown… \r\n\r\nFor completeness, when no addins are loaded I get a different stop:\r\n\r\n =======================================\r\n VERIFIER STOP 0000000000000300: pid 0x4008: Invalid handle exception for current stack trace. \r\n \r\n \t00000000C0000008 : Exception code.\r\n \t000000000F9DE670 : Exception record. Use .exr to display it.\r\n \t000000000F9DE180 : Context record. Use .cxr to display it.\r\n \t0000000000000000 : Not used.\r\n \r\n \r\n =======================================\r\n This verifier stop is continuable.\r\n After debugging it use `go&#39; to continue.\r\n \r\n =======================================\r\n \r\n ModLoad: 711a0000 711c5000 C:\\windows\\SysWOW64\\POWRPROF.DLL\r\n \r\n \r\n =======================================\r\n VERIFIER STOP 00000900: pid 0x4008: A heap allocation was leaked. \r\n \r\n \t0BDCCFB8 : Address of the leaked allocation. Run !heap -p -a < address > to get additional information about the allocation.\r\n \t041D9C54 : Address to the allocation stack trace. Run dps < address > to view the allocation stack.\r\n \t0C36AFE4 : Address of the owner dll name. Run du < address > to read the dll name.\r\n \t749C0000 : Base of the owner dll. Run .reload < dll_name > = < address > to reload the owner dll. Use &#39;lm&#39; to get more information about the loaded and unloaded modules.\r\n \r\n \r\n =======================================\r\n\r\n`!avrf` suggests a `APPLICATION_VERIFIER_LEAK_ALLOCATION (900)` so I don&#39;t think this is a problem with anything but Application Verifier.", "921" ], [ "This is the code I use to do this and it works:\r\n\r\n /// < summary > \r\n /// Set&#39;s the DNS Server of the local machine\r\n /// < /summary > \r\n /// < param name= \" ;NIC \" ; > NIC address < /param > \r\n /// < param name= \" ;DNS \" ; > DNS server address < /param > \r\n /// < remarks > Requires a reference to the System.Management namespace < /remarks > \r\n public void setDNS(string NIC, string DNS)\r\n {\r\n ManagementClass objMC = new ManagementClass( \" ;Win32_NetworkAdapterConfiguration \" ;);\r\n ManagementObjectCollection objMOC = objMC.GetInstances();\r\n\r\n foreach (ManagementObject objMO in objMOC)\r\n {\r\n if ((bool)objMO[ \" ;IPEnabled \" ;])\r\n {\r\n // if you are using the _URL_0_.NetworkInformation.NetworkInterface you&#39;ll need to change this line to if (objMO[ \" ;Caption \" ;].ToString().Contains(NIC)) and pass in the Description property instead of the name \r\n if (objMO[ \" ;Caption \" ;].Equals(NIC))\r\n {\r\n try\r\n {\r\n ManagementBaseObject newDNS =\r\n objMO.GetMethodParameters( \" ;SetDNSServerSearchOrder \" ;);\r\n newDNS[ \" ;DNSServerSearchOrder \" ;] = DNS.Split(&#39;,&#39;);\r\n ManagementBaseObject setDNS =\r\n objMO.InvokeMethod( \" ;SetDNSServerSearchOrder \" ;, newDNS, null);\r\n }\r\n catch (Exception)\r\n {\r\n throw;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\nHope it helps...", "160" ], [ "In one of the applications I work on, I found a very strange issue with a WPF `WebBrowser` control that we use to display a local html file.\r\n\r\nThe web browser control scrollbar initially displays two horizontal lines as shown in this picture: \r\n[![two horizontal lines on the scrollbar][1]][1]\r\n\r\nAs soon as the user scrolls, the lines disappear.\r\n\r\nHas anyone else experienced this? I think it is something to do with an `Height` not set or set incorrectly somewhere... \r\n\r\nUnfortunately the code is too messy and convoluted to share as is. I will try to replicate in isolation and post the code in due course.\r\n\r\nOne of my colleagues has already tried the following but no success so far:\r\n\r\n - Changing verticalAlignment property to center/stretch/top/down of grid (which is inside scrollviewer)\r\n - Changing margin property of scrollviewer so that scrollbar should appear little down by default as the lines were disappearing after moving the scroll bar. But in this case, whole textbox was moving because the grid is placed inside the scrollviewer.\r\n - Applying style to scrollbar of scrollviewer to move only scrollbar not full text:\r\n\r\n ` < ScrollViewer.Resources > \r\n < Style TargetType= \" ;ScrollBar \" ; > \r\n < Style.Triggers > \r\n < Trigger Property= \" ;Orientation \" ; Value= \" ;Vertical \" ; > \r\n < Setter Property= \" ;Margin \" ; Value= \" ;0,50,0,0 \" ;/ > //tried different values\r\n < /Trigger > \r\n < /Style.Triggers > \r\n < /Style > \r\n < /ScrollViewer.Resources > `\r\n \r\n - Changing different setter properties(`BoarderBrush`, `Thickness`, `VerticalAlignment` etc.) in CommonStyles.xaml file\r\n - Add line of code `LoadCompleted` event `currentlyDisplayedHtmlDocument.body.style.overflow = \" ;auto \" ;;`\r\n\r\n\r\n [1]: _URL_0_", "882" ], [ "You don&#39;t need to use `DllImport` as this library is managed code.\r\n\r\nJust use Nuget to install it like [this][1].\r\n\r\nAnd then follow the tutorial from the [project page][2].\r\n\r\nHere is the first example:\r\n\r\n using System;\r\n using S22.Pop3;\r\n \r\n namespace Test {\r\n \tclass Program {\r\n \t\tstatic void Main(string[] args) {\r\n \t\t\t/* connect on port 995 using SSL */\r\n \t\t\tusing (Pop3Client Client = new Pop3Client( \" ;_URL_2_ \" ;, 995, true))\r\n \t\t\t{\r\n \t\t\t\tConsole.WriteLine( \" ;We are connected! \" ;);\r\n \t\t\t}\r\n \t\t}\r\n \t}\r\n }\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "483" ], [ "How about:\r\n\r\n static void ConvertFont(Font fnt) {\r\n ...\r\n if (fnt.IsSpaceCharacter) {\r\n glyphs[idx].codepoint = 0x00FF;\r\n glyphs[idx].bmp = null;\r\n }\r\n else {\r\n glyphs[idx] = RenderFontGlyph(glyphs[idx]);\r\n // glyphs[idx].bmp is NOT ok here - it is null!\r\n }\r\n ...\r\n }\r\n \r\n static FontGlyph RenderFontGlyph(FontGlyph glyph) {\r\n ...\r\n glyph.bmp = new byte[256];\r\n // bmp is fine here, and can be populated as a normal array\r\n ...\r\n \r\n return glyph;\r\n } \r\n\r\nor use `ref` like this: `static void RenderFontGlyph(ref FontGlyph glyph)` and then call it like this: `RenderFontGlyph(ref glyphs[idx])`", "681" ], [ "Are you saying that you do not have the private key for the certificate? If that&#39;s the case then you definitely cannot sign the assembly/installer. The whole point of signing is to certify that the assembly comes from a trusted/certified source (ie. the certificate (private key) holder). \r\n\r\nWho is your employer? Larger companies have processes in place to get installers and assemblies signed via their IT/Security department. I&#39;d double check that is not the case where you work. \r\n\r\nOn another point... Do you have .NET4.5 installed? See [here][1] it might help...\r\n\r\n > This change is due to the fact that we stopped using legacy\r\n > certificates as default (SHA-1) in NetFX4.5 to sign manifest and\r\n > instead, use newer version (SHA-256), which is not recognized by\r\n > NetFx4.0 runtime. Therefore, while parsing the manifest, 4.0 runtime\r\n > complains of an invalid manifest. For legacy frameworks, when we try\r\n > to run a ClickOnce app on a box that does not have targeted runtime,\r\n > ClickOnce pops up a message to user saying “you need xxxx.xx runtime\r\n > to run this app”. But starting .NET 4.5, if a 4.5 ClickOnce app is run\r\n > on the box with only .NET 4.0 installed, the message complains about\r\n > an invalid manifest. In order to resolve the issue, you must install\r\n > .Net Framework 4.5 on the target system.\r\n\r\n\r\n [1]: _URL_0_", "635" ], [ "We have created a DocuSign integration within our Microsoft Word add-in using [the C# wrapper library from GitHub][1] (compiled version: v1.6.1.0) and we are now trying to &#39;Go Live&#39; by following the instructions [here][2].\r\n\r\nUnfortunately we have performed 20+ test transactions as required but we cannot see them in the audit logs and when we proceed with the process of reviewing the transactions - the system eventually returns \" ;Review Failed \" ;.\r\n\r\nWe checked the account details (urls + keys) and everything matches. \r\n\r\nIn our audit logs we cannot see any of the recent activity...\r\n\r\nAny idea what we are doing wrong?\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "858" ], [ "Sorry my first answer was not quite right...\r\n\r\nIn order to get alreadyExist to be true you need to put in place property comparison in your classes as otherwise the equality comparison performed is the default reference comparison. Your objects contains the same property values but are actually different instances... The default equality comparison for objects is comparing references not content.\r\n\r\nTry this...\r\n\r\n void Main()\r\n {\r\n \tSampleClass classWithValues = new SampleClass();\r\n \tvar listComponent = new Components();\r\n \tlistComponent.Add(new Component{Name = \" ;Random string \" ;,Age = \" ;31 \" ;});\r\n \tclassWithValues.Components = listComponent; \r\n \t_URL_1_ = \" ;TestName \" ;;\r\n \t\r\n \tvar listWithObjectClass = new List < SampleClass > ();\r\n \tlistWithObjectClass.Add(classWithValues);\r\n \r\n \tSampleClass classWithValues1 = new SampleClass();\r\n \tvar listComponent1 = new Components();\r\n \tlistComponent1.Add(new Component{Name = \" ;Random string \" ;,Age = \" ;31 \" ;});\r\n \tclassWithValues1.Components = listComponent1; \r\n \t_URL_2_ = \" ;TestName \" ;;\r\n \r\n \tbool alreadyExists = listWithObjectClass.Any(x = > x.Components.Equals(classWithValues1.Components));\r\n }\r\n \r\n public class SampleClass\r\n {\r\n public string Name { get; set; }\r\n public Components Components { get; set; }\r\n }\r\n \r\n public class Component : IEquatable < Component > \r\n {\r\n public string Name { get; set; }\r\n public string Age{ get; set; }\r\n \t\r\n \tpublic bool Equals(Component otherComponent)\r\n \t{\r\n \t\treturn Name == _URL_0_ & & Age == otherComponent.Age;\r\n \t}\r\n }\r\n \r\n public class Components :List < Component > , IEquatable < Components > \r\n {\r\n \tpublic bool Equals(Components otherComponents)\r\n \t{\r\n \t\tif(this.Count!= otherComponents.Count) return false;\r\n \t\t\r\n \t\treturn this.TrueForAll(a= > otherComponents.Any(q= > q.Equals(a)))\r\n \t\t & & otherComponents.TrueForAll(a= > this.Any(q= > q.Equals(a)));\r\n \t}\r\n }", "265" ], [ "How about [`Uri.CheckHostName()`][1]?\r\n\r\nThis returns a [`System.UriHostNameType`][2].\r\n\r\nExample:\r\n\r\n Uri.CheckHostName( \" ;<IP_ADDRESS> \" ;); //= > IPv4\r\n Uri.CheckHostName( \" ;_URL_1_ \" ;); //= > Dns\r\n Uri.CheckHostName( \" ;localhost \" ;); //= > Dns\r\n Uri.CheckHostName( \" ;2000:2000:2000:2000:: \" ;); //= > IPv6\r\n\r\nOf course, to use the way you suggested, the easiest way is to create an extension, like so:\r\n\r\n public static class UriExtension {\r\n public static bool IsIPAddress(this string input) {\r\n var hostNameType = Uri.CheckHostName(input);\r\n \r\n return hostNameType == UriHostNameType.IPv4 || hostNameType == UriHostNameType.IPv6;\r\n }\r\n }\r\n\r\nAnd this is the result:\r\n\r\n \" ;<IP_ADDRESS> \" ;.IsIPAddress(); //true\r\n \" ;2000:2000:2000:2000<IP_ADDRESS><IP_ADDRESS> \" ;); //= > IPv6\r\n\r\nOf course, to use the way you suggested, the easiest way is to create an extension, like so:\r\n\r\n public static class UriExtension {\r\n public static bool IsIPAddress(this string input) {\r\n var hostNameType = Uri.CheckHostName(input);\r\n \r\n return hostNameType == UriHostNameType.IPv4 || hostNameType == UriHostNameType.IPv6;\r\n }\r\n }\r\n\r\nAnd this is the result:\r\n\r\n \" ;127.0.0.1 \" ;.IsIPAddress(); //true\r\n \" ;2000:2000:2000:2000:: \" ;.IsIPAddress(); //true\r\n \" ;_URL_1_ \" ;.IsIPAddress(); //false\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_0_", "168" ], [ "I want to add a line to my Organization-Wide Disclaimer to say: `This email is only intended for: %%ToRecipientEmail%%`\r\n\r\nHowever there is no such wildcard as all wildcards are linked to the sender AD attributes...\r\n\r\nIs there another way to achieve this, either via Exchange admin center (EAC) or programmatically?\r\n\r\nAs a side note, in the event of multiple recipients, I would like to add all of them as a comma separated list.", "190" ], [ "I am trying to tokenize the following text:\r\n\r\n`F.B.I. is an acronym. FBI is an acronym, c.i.a. could also be one. $1,000,000.00 is a currency value as well as 1.000.000,00&#163; for example. Here is a measure cm24.54 and 34.3cm...`\r\n\r\nlike this:\r\n\r\n`F.B.I. | is | an | acronym | . | FBI | is | an | acronym | , | c.i.a. | could | also | be | one | . | $ | 1,000,000.00 | is | a | currency | value | as | well | as | 1.000.000,00 | &#163; | for | example | . | Here | is | a | measure | cm | 24,54 | and | 34.3 | cm | ...`\r\n\r\nI have started writing a regex to do this but I&#39;m not sure how to keep acronyms and numbers together.\r\n\r\nMy regex looks like this: `str.split(/\\s|(?=[^A-Za-z0-9#@])/)`, it splits and throws away whitespaces and it splits on non alphanumeric characters (excluding `#` and `@`) without removing them by using a positive lookahead.\r\n\r\nHow do I modify my regex to split the text as described above?", "567" ], [ "I need to serialize some javascript regular expressions.\r\n\r\nMy plan is to use `.toString()` to serialize and then `new RegExp(string)` to deserialize, however this does not work as I would expect - the regex delimiters in the string `/` are escaped by `new RegExp()`. Here is an example:\r\n\r\n < !-- begin snippet: js hide: false console: true babel: false -- > \r\n\r\n < !-- language: lang-js -- > \r\n\r\n let regEx = /^[A-Z][A-Z-\\\\.]+$/g;\r\n console.log( \" ;Initial: \" ; + regEx.source);\r\n \r\n let regExString = regEx.toString();\r\n console.log( \" ;toString(): \" ; + regExString);\r\n \r\n let nRegEx = new RegExp(regExString);\r\n console.log( \" ;new RegExp from string: \" ; + nRegEx.source);\r\n\r\n < !-- end snippet -- > \r\n\r\nreturns the following:\r\n\r\n \" ;Initial: ^[A-Z][A-Z-\\\\.]+$ \" ;\r\n \" ;toString(): /^[A-Z][A-Z-\\\\.]+$/g \" ;\r\n \" ;new RegExp from string:\\/^[A-Z][A-Z-\\\\.]+$\\/g \" ;\r\n\r\nIf I do this instead (`regEx.source.toString()`):\r\n\r\n < !-- begin snippet: js hide: false console: true babel: false -- > \r\n\r\n < !-- language: lang-js -- > \r\n\r\n let regEx = /^[A-Z][A-Z-\\\\.]+$/g;\r\n console.log( \" ;Initial: \" ; + regEx.source);\r\n \r\n let regExString = regEx.source.toString();\r\n console.log( \" ;toString(): \" ; + regExString);\r\n \r\n let nRegEx = new RegExp(regExString);\r\n console.log( \" ;new RegExp from string: \" ; + nRegEx.source);\r\n\r\n < !-- end snippet -- > \r\n\r\nIt results in:\r\n\r\n \" ;Initial: ^[A-Z][A-Z-\\\\.]+$ \" ;\r\n \" ;toString(): ^[A-Z][A-Z-\\\\.]+$ \" ;\r\n \" ;new RegExp from string:^[A-Z][A-Z-\\\\.]+$ \" ;\r\n\r\nWhich is better but it looses all my flags, in this instance `/g`\r\n\r\nWhat can I do to make this work?", "286" ], [ "Using the `type= \" ;email \" ;` will validate \" ;a@b \" ; which, of course, is an invalid email address.\r\n\r\nYou could use a pattern to validate the email address, like so:\r\n\r\n\r\n < !-- begin snippet: js hide: false console: true babel: false -- > \r\n\r\n < !-- language: lang-html -- > \r\n\r\n < form name= \" ;loginForm \" ; > \r\n < input type= \" ;email \" ; name= \" ;email \" ; id= \" ;email \" ; required pattern= \" ;[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,4}$ \" ;/ > \r\n < input type= \" ;submit \" ; value= \" ;save \" ; / > \r\n < /form > \r\n\r\n < !-- end snippet -- >", "190" ], [ "Your ` < script > ` tag has a `src` and a body.\r\n\r\nTry:\r\n\r\n < script src= \" ;_URL_0_; type= \" ;text/javascript \" ; > < /script > \r\n < script type= \" ;text/javascript \" ; > \r\n\r\n console.log(&#39;hi&#39;);\r\n var cen = document.getElementById( \" ;centro \" ;).value;\r\n $.ajax({\r\n url: &#39;centroUser.php&#39;, \r\n type: \" ;POST \" ;,\r\n data: { &#39;cen&#39;: cen },\r\n success: function(data){\r\n console.log(data);\r\n }\r\n }); \r\n < /script > \r\n\r\nIf the src has a URI value, user agents must ignore the element&#39;s contents and retrieve the script via the URI - [see here][1]. \r\n\r\n\r\n [1]: _URL_1_", "263" ], [ "Change the width and the height of the canvas, then change the collision detection values.\r\n\r\nHere is how you change it to be 800 x 800.\r\n\r\n\r\n < !-- begin snippet: js hide: false console: true babel: false -- > \r\n\r\n < !-- language: lang-html -- > \r\n < !doctype html > \r\n < html > \r\n\r\n < body > \r\n < canvas id= \" ;can \" ; width= \" ;800 \" ; height= \" ;800 \" ; style= \" ;background: Black \" ; > \r\n < /canvas > \r\n < script > \r\n var sn = [42, 41],\r\n dz = 43,\r\n fx = 1,\r\n n, ctx = document.getElementById( \" ;can \" ;).getContext( \" ;2d \" ;);\r\n\r\n function draw(t, c) {\r\n ctx.fillStyle = c;\r\n ctx.fillRect(t % 40 * 20 , ~~(t / 40) * 20 + 1, 18, 18);\r\n }\r\n document.onkeydown = function(e) {\r\n fx = sn[1] - sn[0] == (n = [-1, -40, 1, 40][(e || event).keyCode - 37] || fx) ? fx : n\r\n };\r\n ! function() {\r\n sn.unshift(n = sn[0] + fx);\r\n console.log(n);\r\n if (sn.indexOf(n, 1) > 0 || n < 0 || n > 1599 || fx == 1 & & n % 40 == 0 || fx == -1 & & n % 40 == 39)\r\n return alert( \" ;GAME OVER \" ;);\r\n draw(n, \" ;Lime \" ;);\r\n if (n == dz) {\r\n while (sn.indexOf(dz = ~~(Math.random() * 800)) > = 0);\r\n draw(dz, \" ;Yellow \" ;);\r\n } else\r\n draw(sn.pop(), \" ;Black \" ;);\r\n setTimeout(arguments.callee, 100);\r\n }();\r\n < /script > \r\n < /body > \r\n \r\n < !-- end snippet -- >", "703" ], [ "You are kind of taking the very long panoramic route when there is actually a very quick one... As <PERSON> stated in the comments use `xsd` directly...\r\n\r\nTo do this, open the Visual Studio command prompt, and write `where xsd` to find exact path of `xsd` executable.\r\n\r\nThen start a process using `xsd` from the path you found and the various options ie. `/c` and `filename`.\r\n\r\n using System.Diagnostics;\r\n ...\r\n FileInfo fi = new FileInfo(ofd.FileName);\r\n Process process = new Process();\r\n process.StartInfo.FileName = xsdPath;\r\n process.StartInfo.Arguments = \" ;/c \" ; + fi.FullName;\r\n process.StartInfo.WorkingDirectory = fi.DirectoryName;\r\n process.Start();\r\n //wait for exit if needed...\r\n process.WaitForExit();\r\n\r\nIf for some reason this is not working, capture the output from the command by doing this before `process.Start()`:\r\n\r\n process.StartInfo.UseShellExecute = false;\r\n process.StartInfo.RedirectStandardOutput = true;\r\n process.OutputDataReceived += \r\n (sender, args) = > Console.WriteLine( \" ;received output: {0} \" ;, args.Data);\r\n process.BeginOutputReadLine();", "742" ], [ "The problem is that your coordinates are `static`.\r\n\r\nRemove the `static` ie.\r\n\r\n public int coordsX { get; set; }\r\n public int coordsY { get; set; }\r\n\r\nThen use the `sender` instance rather than the class to access these properties in the click event.\r\n\r\n private void PieceButton_Click (object sender,EventArgs e)\r\n {\r\n var button = (ButtonControls)sender;\r\n MessageBox.Show(button.coordsX+ \" ;/ \" ;+ button.coordsY);\r\n }\r\n\r\nAs a side note, your class name `ButtonControls` is not great - why is it plural? `ButtonControl` is better but it still does not describe the difference from the class it inherits from... `PieceButton` is even better (I don&#39;t know the context so it is just a guess) but personally I would just call it `Piece`...", "479" ], [ "If you don&#39;t mind using regular expressions:\r\n\r\n function yourFunctionName(input){\r\n let grp = input.split(/(? < =(.))(?!\\1|$)/ig);\r\n grp.sort((a,b)= > b.length-a.length);\r\n \r\n if(grp.length < = 0){\r\n return null;\r\n }\r\n else if (grp.length == 1){\r\n return grp[0];\r\n }\r\n else{\r\n grp.sort(function(a, b){\r\n return b.length - a.length;\r\n });\r\n \r\n return grp[1];\r\n }\r\n }\r\n \r\n console.log(yourFunctionName( \" ;&#246;&#246;&#246;&#246;&#246;&#246;&#240;&#240;&#240;&#243;b \" ;));\r\n\r\nOr another way which does not use regular expressions...\r\n\r\n function yourFunctionName(input){\r\n input = input.toLowerCase();\r\n let counter = [];\r\n let prevChar;\r\n let countIndex = 0;\r\n \r\n for (let index = 0, length = input.length; index < length; index++) {\r\n const element = input[index];\r\n \r\n if(prevChar){\r\n if(prevChar != element){ \r\n countIndex++;\r\n counter[countIndex] = \" ; \" ;;\r\n }\r\n }\r\n else{\r\n counter[countIndex] = \" ; \" ;;\r\n }\r\n \r\n counter[countIndex] += element; \r\n prevChar = element;\r\n }\r\n \r\n if(counter.length < = 0){\r\n return null;\r\n }\r\n else if (counter.length == 1){\r\n return counter[0];\r\n }\r\n else{\r\n counter.sort(function(a, b){\r\n return b.length - a.length;\r\n });\r\n \r\n return counter[1];\r\n }\r\n }\r\n \r\n console.log(yourFunctionName( \" ;aaaaabbbbccdd \" ;));", "904" ] ]
203
[ 3067, 13507, 9744, 9727, 10672, 15728, 13649, 1677, 5681, 14381, 11142, 7686, 17516, 12876, 5138, 1894, 1703, 15460, 9772, 12578, 15937, 14216, 16580, 4673, 14404, 12160, 12760, 18873, 6623, 3061, 4309, 7280, 10711, 1396, 3955, 8906, 15936, 13344, 2698, 3814, 563, 3737, 9399, 10835, 12552, 8946, 7274, 13880, 18614, 5816, 12179, 12288, 8518, 1749, 1555, 3787, 7095, 17351, 7919, 5330, 15986, 6030, 16726, 8054, 14805, 4418, 6358, 3335, 14156, 5883, 17091, 104, 5843, 5500, 11416, 4258, 15774, 10230, 6999, 17381, 6829, 19232, 11827, 4159, 9112, 13637, 387, 9992, 4042, 6303, 1346, 12658, 3194, 9558, 18988, 6232, 1075, 3660, 2542, 5529, 1688, 3497, 16086, 1217, 9364, 6815, 15401, 18240, 10848, 8203, 3636, 13910, 9762, 5946, 11505, 6397, 17579, 19522, 19662, 14177, 817, 18318, 1882, 17208, 16233, 10570, 19469, 6686, 12271, 11024, 6473, 1785, 17671, 1965, 2285, 18534, 486, 8763, 19654, 3096, 2361, 6201, 912, 8902, 18863, 4838, 13225, 14610, 18195, 15732, 15201, 7487, 16897, 8898, 5023, 13687, 9720, 8629, 3550, 18691, 3812, 5715, 16831, 17337, 3140, 14850, 18435, 791, 18757, 15095, 6540, 17481, 11792, 19556, 5487, 13580, 17373, 6400, 3298, 12792, 15304, 7121, 12964, 5768, 3189, 18425, 16941, 18184, 10680, 17794, 6636, 2802, 1231, 8079, 15552, 1596, 10571, 7879, 5359, 1808, 19721, 180, 3459, 2963, 15281, 17328, 5171, 17913, 14878, 6973, 12585, 19051, 1607, 17305, 10315, 19682, 4523, 6783, 16960, 3389, 1188, 6776, 4577, 7838, 4308, 8861, 5305, 695, 10454, 11143, 6598, 15748, 4613, 5320, 18196, 8654, 8336, 12073, 3269, 19029, 241, 2166, 6941, 14263, 18392, 10078, 4567, 6931, 10522, 6336, 18528, 11324, 3681, 7916, 14685, 3237, 112, 5503, 12457, 3387, 16639, 101, 13859, 7624, 10982, 3437, 4205, 9745, 1645, 7151, 1709, 7396, 17426, 1386, 3129, 11879, 7033, 1874, 3103, 8119, 5530, 10640, 13466, 8078, 8483, 19511, 9025, 6903, 17566, 8917, 15309, 1559, 3248, 4214, 11318, 11059, 14044, 3900, 8227, 2331, 3439, 13749, 4231, 15675, 5, 16992, 6916, 11601, 6554, 8383, 4330, 12828, 15801, 19271, 18786, 6514, 9731, 4580, 10485, 7007, 18414, 10309, 4264, 14494, 8136, 1600, 14798, 6988, 9022, 8606, 611, 15651, 12804, 10151, 1159, 11520, 5091, 14574, 1910, 15334, 594, 13922, 4551, 17049, 10497, 13437, 3914, 6448, 6076, 17534, 14417, 13056, 10039, 2693, 4594, 1126, 587, 3110, 723, 12132, 15436, 6138, 10829, 12819, 11925, 12432, 4569, 10263, 13176, 5316, 17408, 2939, 3722, 14358, 1406, 17447, 13062, 17353, 17511, 5906, 12731, 9406, 12669, 12717, 11385, 14405, 12812, 17867, 6258, 10134, 12853, 8696, 19110, 16054, 1201, 19228, 737, 13087, 13240, 907, 8588, 9331, 12645, 6187, 8233, 17281, 14643, 1027, 10925, 1153, 183, 19184, 8302, 9266, 13763, 14102, 18187, 19633, 17146, 2669, 15219, 2713, 17653, 18784, 4843, 16796, 1064, 5423, 9636, 19428, 12942, 3856, 12960, 14052, 7792, 18287, 7946, 11178, 952, 10715, 506, 10000, 6742, 14257, 6130, 2206, 11660, 8776, 1601, 11786, 6750, 1184, 9791, 11272, 2069, 2688, 16313, 5889, 17646, 1648, 8068, 11125, 3677, 7610, 1269, 14387, 16961, 19215, 7028, 13083, 13857, 11049, 4705, 8958, 16463, 510, 13153, 4665, 19238, 9207, 4296, 175, 10096, 14589, 7581, 13305, 4748, 7378, 19407, 6202, 2039, 3168, 16337, 8635, 5232, 18448, 2573, 6620, 508 ]
STX_10051.0
[ [ "Do not worry, Wifi pass phrases _for personal use_ should only be in [printable ASCII characters][1], in other words English characters. They do not support Unicode or other codepages. \r\n\r\nFor more details check the [Wikipedia&#39;s Wi-Fi Protected Access page][2].\r\n\r\nExcept if you are redirected to a webpage for authentication, that&#39;s a whole different story and Karlson&#39;s answer is applicable. \r\n\r\n[1]: _URL_0_\r\n[2]: _URL_1_", "412" ], [ "I have some thoughts on this:\r\n\r\n * Adding a new answer if you know the answer;\r\n * Or, leaving a comment that the answer is obsolete. So, in the future the question finds its way to surface again, everyone will know that it&#39;s obsolete and someone might know the answer and provide a valid answer or edit the old answer.\r\n * Adding a new \" ;post notice \" ;, where community can flag an answer as obsolete and then it will marked as \" ;obsolete \" ; until it&#39;s edited or flag is removed by a mod. \r\n\r\nFor those who do not know what a post notice is, check [this question][1], you will see a notice:\r\n \r\n > \r\nPost is related to a rapidly changing event.\r\n\r\n\r\n[1]: _URL_0_", "494" ], [ "According to [Canadian Government site][1], you will need a visa in advance if you hold an alien&#39;s passport:\r\n\r\n > **Note**: Holders of Alien’s passport and Stateless individuals need a visa to visit or transit in Canada.\r\n\r\nAnother page ([Transit Without A Visa][2]) states the following:\r\n\r\n > All nationals who qualify for the TWOV program must also meet these conditions:\r\n \r\n > * They hold a **valid passport** or travel document **issued by the country of which they are a citizen**; \r\n\r\nThis does not include you, since the alien&#39;s passport is issued by Denmark, which is not your country of citizenship (that&#39;s clear because you hold an alien&#39;s passport).\r\n\r\nBottom line, visit a Canadian embassy/consulate to issue a transit visa in advance.\r\n\r\n[1]: _URL_1_\r\n[2]:_URL_0_", "606" ], [ "To be honest, I love all three moderators we have currently. I love them to the point I want to hug them! but, they are quite away lately I assume for personal/work reasons. \r\n\r\nNow, we should not fix a problem by making another problem, more moderators is not the solution. The solution is stepping down. If any of them knows that he is quite busy, then he should step down for now and give the chance for someone else, once they are free again I will be glad to vote for them again. \r\n\r\nI&#39;d vote for <PERSON>, <PERSON>, <PERSON>, <PERSON> or <PERSON>. \r\n\r\nAgain, I really love the current moderators.", "101" ], [ "APIs information according to the US CBP are to be sent anytime between 72 hours before the flight to 30 minutes before closing the aircraft doors for departure. \r\n\r\nJust remember there are many passengers who fly last minute (last minute as in last check-in time which is usually ~1 hour before the departure) and their information is also required to be sent to APIs, that&#39;s how they do it, they send the information in batches as they are available until 30 minutes before the flight not only for newly checked in passengers but also for passengers who changed their information at some point after the initial submission.\r\n\r\nIn addition to the above, I have travelled to the US at least two times with no reservation and just by showing up at the check-in counter last minute.\r\n\r\nSource: [CBP&#39;s APIS Frequently Asked Questions for airlines.][1]\r\n\r\n[1]: _URL_0_", "587" ], [ "Do not pack the suit! why spend time ironing/pressing the suit at the hotel/accommodation while you can carry them as they are with you? \r\n\r\nPut them in a travel suit bag, something like this:\r\n\r\n[![enter image description here][1]][1]\r\n\r\nOnce in the plane, ask a cabin crew member to hang it for you, in every plane there is a [coat compartment][2] and they will be happy to do that for you. This is what I would do as a frequent business traveler.\r\n\r\nMany airlines do not count this among the cabin luggage allowance, so your allowance will not be affected.\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "587" ], [ "You will need to prove the income, from the require documents page:\r\n\r\n > * **Latest Income Tax Return**\r\n > * **If the applicant is employed**\r\n\r\n > a. Certificate of Employment from employer/ NOC / Leave sanctioned for travel \r\n\r\n > b. Salary bank statement for last six months \r\n > * **If the applicant is Student / Dependant**\r\n\r\n > a. Consent from the parents / spouse \r\n\r\n > b. Original bank statement of last six months for parents / spouse \r\n\r\n > c. Latest Income Tax Return for parents / spouse \r\n > * **If the applicant is owner of company**\r\n\r\n > a. Proof of ownership (e.g. Director Identification Number approval issued from Ministry of Corporate Affairs or proprietorship document issued from bank or Import export license) \r\n\r\n > b. Company bank statement \r\n\r\nYou must be one of the above and bring the required documents depending on your situation.\r\n\r\nRegarding the secure way to submit the application, it would be through [VFS global][1]. \r\n\r\n* Prepare all [required documents][2]. \r\n* Fill [the form][3].\r\n* Visit the [VFS Japan Visa Center][4] to submit the documents, or you can email them from one of [these locations][5].\r\n* [Track the application][6].\r\n\r\n[1]: _URL_0_\r\n[2]: _URL_1_\r\n[3]: _URL_2_\r\n[4]: _URL_3_\r\n[5]: _URL_4_\r\n[6]: _URL_5_", "606" ], [ "My guess, because it varies from one airline to another, even for airlines in the same country. There is usually some sort of a nationwide limit, then the airlines can go more restrictive on defining \" ;unaccompanied minor \" ;. \r\n\r\nFor the airline I work for, a passenger between 5 and 12 years old is considered UM, while another neighbor airlines set the limit to 5-11. \r\n\r\nNow imagine a site that has to collect the information for most of the airlines around the world and then keep track of that in case of any change? including special fares and conditions for each airline, just too much work. \r\n\r\nAlso, most seats sold via agencies are [consolidated tickets][1], I do not think airlines sell UM seats in bulk to be used by agencies (online or offline).\r\n\r\nIn addition to that there is a technical problem. Unaccompanied minors&#39; reservations have special codes which are different from one reservation system to another, and since most agencies connect to airline&#39;s systems using GDS (think of the GDS as a webservice with limited types of transations allowed), I think handling this might be a techincal issue as well. Hence, many airlines offer the UM reservations by calling them directly, by visiting their office or via their own website. \r\n\r\nLast but not least, and it&#39;s also a guess, airlines do not want to handle people&#39;s children via a third party seller. \r\n\r\n[1]: _URL_0_", "587" ], [ "Simple: you will need to contact your home country&#39;s embassy/consulate in the country you are staying at, and they will issue you a travel document to be used to pass to your country. \r\n\r\nThe country in which you are staying can not issue you a passport (unless you are a refugee or stateless or something like that), when the passport is lost, the maximum the host country can do is issuing some sort of a report via a police station stating that you have lose your passport. The rest has to be done via the consulate/embassy. \r\n\r\nFor the visa, you will need to issue a new one. Unless the visa is not attached to the passport and it is in a separate card or so. You also most likely will have to re-issue it from your country as most consulates will issue you a single use travel document (in case you needed to get back quickly), this can not be used to issue visas. In case your consulate issued you a full passport, not much countries will issue you a visa while you are in the country, you will need to get back. Unless it is a long term visa, things tend to be different in these cases.", "606" ], [ "After more than a decade in the cabin crew business, I think it&#39;s time now to share a tip or two I know:\r\n\r\n* Keep your mind busy. Read a book, play a game on your smart phone, watch a movie, etc.\r\n* Take an aisle seat. It will help you feel a bit in control when your anxiety peaks. A little walk around the cabin can relieve it. \r\n* This is one of the cases where Xanax usage is legitimate, ask your doctor to prescribe some for you and use it shortly before the flight. \r\n* The first hour or so of the flight will be the hardest, fear will be less after that and it might start peaking again before landing. \r\n* Get enough sleep before the flight. Do not force yourself to be awake for long time before the flight planning to sleep the whole flight. If you have fear you know that you can&#39;t sleep, lack of sleep makes fear levels higher. Sleep well before the flight to have a better mood during the flight. \r\n* No harm in telling a cabin crew member that you are worried about flying. If you ever felt scared during the flight, look at their smiling faces, this will help you realize that things are ok.\r\n* Always remind yourself that flying is the safest transportation method.", "587" ], [ "The other day, I was on a flight and two of the toilets in my zone were blocked with a sign saying \" ;Inoperative \" ;, I had to walk down the aisle to the back to use the toilet there. I asked a cabin crew member and she told me someone vomited in the sinks and blocked them, they can&#39;t be used anymore and they had to block them.\r\n\r\nWhat happens if all toilets or most of them in a flight are inoperative at some point during the flight?", "463" ], [ "Lavatories (airplane toilets) can be inoperative for many reasons, they could get blocked by someone vomiting in the sink, or by throwing tissues or other objects in either the sink or the toilet seat. Sometimes, when a waste tank is full, or there&#39;s a problem in the sensor of the tank giving a wrong signal, all flushes connected to that tank will not work, this happens in modern aircrafts.\r\n\r\nIf a sink or a flush are not working, the toilet has to be blocked by the crew/maintenance or stuff would be piling up!\r\n\r\nFor each aircraft type (usually depending on the passenger load and toilet locations), there is a limit of toilets that can be inoperative while airborne **before the flight has to land at the nearest airport**. \r\n\r\nThis depends on the model and airline&#39;s policy. But a rule of thumb is: half of the toilets in each zone should be operative. Otherwise the flight has to land if this happened during the flight. If the flight is on ground and for example all toilets in business class are inoperative, the plane can take off but no passengers should be in that class. \r\n\r\nIn some airlines, if all the toilets at the front are inoperative, even if there are no passengers, the plane has to land if it&#39;s flying or will not be able to take off if it&#39;s on ground because pilots are only allowed to use toilets in the front.", "463" ], [ "It is an IATA recommendation, and airlines tend to go with the minimum recommended in case the policy is in their favor, and opposite is true when the recommendation is against them: \r\n\r\n > **3.2 PERIOD OF VALIDITY**\r\n\r\n > A ticket is valid for carriage for one year from the date of commencement of travel or if no portion of the ticket is used, from the date of issue thereof, except as otherwise provided in the ticket, these Conditions or Carrier’s Regulations. \r\n\r\nThere are conditions in which the validity is extended. Basically when it is the airline&#39;s mistake, such as cancelling a flight or so.\r\n\r\nMany airlines include this in their \" ;General Conditions of Carriage & Tariffs \" ;, some types of tickets have less validity, usually the discounted tickets (~3 months).\r\n\r\nSource: [Recommended practice 1724][1]\r\n\r\n[1]: _URL_0_", "587" ], [ "Yes you can. The second visit will be considered under \" ;tourism \" ;. The official [_URL_1_ page][1] states the following:\r\n\r\n > **You won’t need a visa to come to the UK**\r\n\r\n > However, you should bring the same documents you’d need to apply for a visa, to show to officers at the UK border. \r\n\r\n > **(!) You may want to apply for a visa if you have a criminal record or you’ve previously been refused entry into the UK.**\r\n\r\nThere is nothing prohibits you from visiting the UK again if you had a previous visa and they did not mention any time limit before you can come again to the UK.\r\n\r\n[1]:_URL_0_", "606" ], [ "As a cabin crew member, we actually have no instructions against it as long as the seatbelt signs are turned off. \r\n\r\nThe passengers seating policy is clear, seated while take off and landing, seat in upright position and seatbelt is fastened. During flights, the _recommendations_ are to keep the seatbelt fastened to be prepared in case of sudden turbulence. \r\n\r\nActually, the armrests are made movable for that reason, in addition to other reasons (easier cleaning is one of them).\r\n\r\nWe encourage people in mid/long-haul flights to do so because it makes them feel comfortable (leaving good impression). Also, sleeping passengers will not bother to press the call buttons! We even go one step further and ask awake passengers nicely to close the window shades in case it was a day flight. \r\n\r\nIs it dangerous? Yes it is, but not really. Strap yourself before sleeping and you&#39;ll be fine in case of turbulence. This is out of personal experience, people who are in direct danger in case of sudden turbulence are those who are standing, then those who are seated without fastening seatbelts. Others are in danger, but not as much as the aforementioned ones.", "463" ], [ "Some countries require that in-bound flights to be disinfected (either flights arriving from all countries or certain countries that are known to be affected with certain diseases, such as Malaria). A couple of mosquitoes or other insects can reproduce in the destination country and over time they will cause a general health or agriculture problem. \r\n\r\nEven in flights where you do not see the crew spraying the insecticide, there is a big chance that the cabin was sprayed with a residual insecticide before the passengers board. The cargo hold will also be sprayed as it is pressurized and living things can survive there during the flight. \r\n\r\nIs it dangerous? no, it is harmless. Some people might have light reactions, but this is quite rare. I have personally never seen or heard of anyone complaining about it.", "572" ], [ "Other than the obvious (knives and blades), any metal item with sharp edges that can cause harm to people is a good candidate for refusal in hand luggage. This is an international regulation coming from ICAO and [IATA][1] and other authorities/regulators.\r\n\r\n**What to do?** < br / > \r\nIf you have checked luggage allowance, use it. Check your hand luggage, if it&#39;s small then wrap it with plastic at the airport to add more protection. \r\n\r\nOther option would be taking the risk if the device is cheap enough, explain to the security officer and pray they&#39;ll accept it. Unless you know someone in the flight who is checking-in a luggage then ask him/her to take it.\r\n\r\n[1]: _URL_0_", "587" ], [ "It&#39;s not the most user friendly solution, but it&#39;s the best and most accurate information ever, it is TIMATIC.\r\n\r\nThere is no user interface, so we&#39;re going to use the web service via the link. We&#39;re going to use KLM&#39;s user, many Wikipedia pages link that, so I will assume it&#39;s fine. I also know some of the parameters via the reservation system which uses TIMATIC, so after a bit testing it turns out to be the same, here how&#39;s the link going to look like:\r\n\r\n > _URL_0_\r\n\r\n##Parameters\r\n* NA: Nationality, use two letter country codes.\r\n* TR: Transit airport, use three letter IATA airport codes.\r\n* DE: Destination, use three letter IATA airport codes.\r\n\r\nThe result will be comprehensive, something like:\r\n\r\n > TWOV (Transit Without Visa): < br / > \r\nVisa required, except for Nationals of Saudi Arabia holding\r\nconfirmed onward tickets making an airside transit at London\r\n\r\n > Gatwick (LGW), London Heathrow (LHR) or Manchester (MAN) on\r\nthe same calendar day to a third country (excluding Ireland\r\n(Rep.)). The following conditions must be complied with:\r\n\r\n > - passenger must arrive and depart by air; and\r\n- passenger only intends to transit through the United\r\nKingdom; and\r\n- passenger must hold all documents required for the next\r\ndestination; and\r\n- passenger must not leave the transit area. \r\n- OR: \r\nVisa required, except for Passengers holding confirmed onward\r\ntickets passing through United Kingdom immigration to make a\r\n\r\n > landside transit to a third country on a flight that departs\r\nbefore 23:59 the next day. The following conditions must be\r\n\r\n > complied with:\r\n\r\n > - passenger must arrive and depart by air; and\r\n- passenger must have no purpose in entering the United\r\nKingdom other than to pass through in transit; and\r\n- passenger must hold all documents required for the next\r\ndestination; and < br / > \r\n...... < br / > \r\n......", "587" ], [ "Social media is the way! file a proper complain via the airline&#39;s webpage or email, then follow up in Twitter or Facebook. \r\n\r\nAirlines hate it when people pick on them publicly. They will love to look like they are doing a good job and then reply you online to undo whatever image damage you have done. \r\n\r\nThis is my advice as a person working for an airline.", "587" ], [ "In case of emergency (which is more likely during take offs and landings) people should be prepared just in case. So during daytime, opening window shades and putting cabin lights to full makes the eyes used to sunlight so if something goes wrong and passengers need to be evacuated there will not be sudden change in light contrast which might lead to temporary blurred vision. \r\n\r\nSame thing at night flights, window shades are open and cabin lights are dimmed.", "463" ], [ "I just had a 30 minute call with a friend who is a professional ticketing agent. There is nothing officially called a \" ;backup flight \" ;, but he got the idea and explained it to me. \r\n\r\nWhat happens is, when the gate agent thinks that you will not be able to catch the flight, either by telling him in person or if the system detects that and shows some notification to him. The agent will have to find a solution, either by finding another flight or by cancelling the whole thing in case there is no way to catch the flight in your preferred times.\r\n\r\nIn your case, the agent found another flight and add it to your itinerary, nothing special so far. You had concerns about two flights in the same itinerary, I asked you in the comments for a copy of the itinerary just to show that there must some sort of a code there, as systems generally will delete duplicate confirmed sectors automatically, one of them must had some code, something like `UN` or `UU` depending on the system, it could be something else. These codes mean something like \" ;unable to confirm \" ;. \r\n\r\nSo, most likely you didn&#39;t have two confirmed sectors, one of them was confirmed and the other was there as an FYI with a special code next to it.", "587" ], [ "In a recent flight, I ordered fish, but it was not available, the crew apologized and offered me another meal. \r\n\r\nAnyway, I flew after that with the same airline, and when they started serving meals, a crew member came to me, greeted me by name and apologized again on behalf of the airline for not being able to serve me fish in my previous flight! \r\n\r\nThey asked me if I would like to try the fish in this flight, I said yes and I got it. \r\n\r\nHow did they know that?", "587" ], [ "You will only need a [US C Visa (Transit Visa)][1] to transit via any US airport.\r\n\r\nRegarding the UK, as an Indian citizen you can transit through the UK as long as you&#39;re holding a valid US visa. \r\n\r\nFrom the [official _URL_1_ website][2]:\r\n\r\n > You don’t need a visa if you have one of the following:\r\n\r\n > * **a visa for Canada, New Zealand, Australia or the USA (this can be used for travel to any country)**\r\n\r\n\r\n[1]: _URL_0_\r\n[2]: https://www._URL_1_/check-uk-visa/y/india/transit/no", "606" ], [ "Some years ago, I was invited to a friend&#39;s place. The home-cooked food contained alcohol, and I don&#39;t eat or drink anything that contains alcohol (religious reasons). I was shy enough to eat it to avoid embarrassments.\r\n\r\nAnyway, I am not planning to do that again, and I have plenty of friends around the world. So, is it rude to ask if the food contains pork or alcohol? Or even better, if I am to be invited, can I mention that earlier?\r\n\r\nIn a restaurant or a hotel since I will be paying, I never had an issue in mentioning that.\r\n\r\nI am mainly asking about the US when invited by Westerners (white Christians to be specific), but I think it will also work in other Western countries.", "1002" ], [ "In meta sites, you have to add one of the following tags: [tag:feature-request], [tag:discussion], [tag:bug]. That&#39;s a start..\r\n\r\nIf SE team can make it mandatory to have a [tag:xyz-citizens] with some selected tags, such as [tag:visas], [tag:transit-visas], etc.. this would be awesome, it does not have to be a hard rule, it can be a message where the user has to click OK or something.\r\n\r\nI do not know if this is technically possible, does SE have an audit logic which can be customized for each site? not sure.", "423" ], [ "I have a close friend who was diagnosed with G.A.D and panic attacks some years ago. I have been around and I have seen him suffer even when he travels with me, especially that he is a bit scared of flying, which triggers panic attacks for him.\r\n\r\nThe following tips usually work but it might be different from one person to another, so feel free to tweak them a bit:\r\n\r\n* Keep your mind busy. Read a book, play a game in your smart phone, watch a movie, etc.\r\n* Take an aisle seat. It will help you feel a bit in control when your anxiety peaks. A little walk around the cabin can relieve it. \r\n* This is one of the cases where Xanax usage is legitimate, ask your doctor to prescribe some for you to be used shortly before the flight. \r\n* The first hour or so of the flight will be the hardest, anxiety will be less after that and it might start peaking again before landing. \r\n* Get enough sleep before the flight. Do not force yourself to be awake for long time before the flight then plan to sleep the whole flight. If you have anxiety you know that you can&#39;t sleep, lack of sleep makes anxiety level higher. Sleep well before the flight to have a better mood during the flight. \r\n* No harm in telling a cabin crew member that you are worried about flying. If you ever have some fear of flying look at their smiling faces, this will help you realize that things are ok.\r\n* Always remind yourself that no one ever died from G.A.D or from panic attacks. It is just a mind trick. \r\n\r\nFor the medication times in different timezones, a [previous question][1] answers that. \r\n\r\nRegarding being alone in a strange place and struggling when walking alone, it&#39;s common with G.A.D. and medicines should help in these cases. Just remember to start exploring areas next to your accommodation, the feeling of being able to get back quickly will make you feel a bit calm. Avoid crowds and narrow places. \r\n\r\n[1]: _URL_0_", "916" ], [ "I do not have a link to a scientific research to prove this, but as a crew member, in the airline crews community, Melatonin is one of the most used remedies to overcome jetlagging problem we face every week as a part of our job as we need to fix the jetlag problem after every flight to be able to operate the next assignment which might be less than a day from the current one to a totally different side of the world in a totally different timezone.\r\n\r\nCompared to other sleep aid remedies, Melatonin does not cause that headache/laziness after waking up. I actually know some crew members who take it an hour or two before their assigned crew rest _during long flights_. They wake up 2-4 hours later and continue their duties with no problems. \r\n\r\nOf course this does not mean some people wouldn&#39;t react differently, I personally dislike it for no medical reason even though I have tried it a few times and it did work ok. I guess I dislike it because in my job I face this problem a lot and I do not want to get used to it so later when I do not have I will not be able to fix the jetlag. I do not think this applies to you. \r\n\r\n#Melatonin and FAA\r\nFurthermore, [FAA][1] has approved Melatonin for pilots without wait time after use, unlike Tylenol PM and other Over-the-counter sleeping pills. \r\n\r\nIt&#39;s approved for people _without_ sleeping disorders, which basically means it&#39;s approved for temporary cases like jetlags. FAA does not approve any medicine with no restrictions or ground times unless it&#39;s really safe for people who operate heavy machines, such as pilots.\r\n\r\n[1]: _URL_0_", "916" ], [ "If someone is travelling with a medicine that needs to be cool all the time, can I use the fridge onboard? I know that planes have them.\r\n\r\nI didn&#39;t find anything related to the topic in any airline&#39;s website. I am mostly interested in the US based airlines.\r\n\r\nNote: I am interested only in putting the medicine in the onboard chiller, not bringing ice or dry ice. If it&#39;s allowed then it is easier especially for long flights.\r\n\r\n**Note: I am not asking how to carry insulin and whether it needs to be cool or not. I am asking about onboard coolers ONLY.**", "587" ], [ "As a cabin crew member for long time, I can tell you that your responsibility ends by notifying a crew member, that&#39;s it. Let the crew members deal with it. \r\n\r\nThis is true for all other violations, unless it&#39;s a life threatening situation that cannot wait, for example fire! Grab the extinguisher and fight the fire. But that&#39;s a whole different issue.\r\n\r\nRegarding cell phones and out of personal experience, many people do not switch them off. In almost all my flights shortly before landings I hear one or two phones ringing, they must have been left on during the whole flight and once they get a signal they start getting messages or calls. I myself forgot mine switched on a few times, and believe it or not, sometimes when I reach my destination I find the famous welcome SMS from one or two operators along the way, how did it get the signal that high I don&#39;t know. Bottom line, I never crashed.", "463" ], [ "Some years ago I was a part of an operating cabin crew in a flight bound to Dubai, it was the time for one of Dubai&#39;s festivals. \r\n\r\nAnyway, I was positioned at the back and at the time we already started the descend, the crew chief called me and asked me to take a walk around and ask people to sit because many were standing! the plane was a narrow-bodied McDonnell Douglas.\r\n\r\nI went to the aisle to check, and they were standing because the fireworks were actually visible at that altitude (can&#39;t remember exactly, but it wasn&#39;t the cruising altitude nor it was very low). They were only visible from one side and people in the other side were standing to be able to see it from the other side&#39;s windows! I spent a few moments enjoying the view until I remembered that I was a crew member.\r\n\r\nBottom line, yes they are visible from high altitudes, and if the weather was clear I guess they would be visible from the cruising altitudes as well.", "464" ], [ "As a tall person with an ideal weight, you shouldn&#39;t worry about the width of the seat. What you should worry about is the pitch of the seat, which will give you a better idea of the leg room. \r\n\r\nIf you wonder [what a seat pitch is][1]:\r\n\r\n > Seat Pitch is the distance from any point on one seat to the exact same point on the seat in front or behind it. While it is not the exact equivalent of \" ;legroom \" ;, it does give a very good approximation of how much seat room you should expect. Bottom line: the more seat pitch the better.\r\n\r\nChina airline&#39;s 777 in economy has a seat pitch of a 32 \" ;, which is pretty standard in many regular airlines around the world (&#177;1 \" ;). \r\n\r\nIs it comfortable? not really for a guy your height, but almost all other airlines have similar seat sizes and your best option is to get a seat in the emergency exit row where leg room is much better. Other option would be upgrading yourself to premium economy or business. \r\n\r\n[1]:_URL_0_", "850" ], [ "Not the expert in this field, but in my opinion, prices will not go down. Oil prices went down big time, and ticket prices didn&#39;t change a bit. Other epidemics in the past few years did not end up making ticket prices lower. \r\n\r\nWhat happens is, people are scared to go to Latin America, fine! airlines will simply make flights less to that part, and see where do people want to spend their vacations now, and add more flights to the new destinations! no one needs to make ticket prices lower.\r\n\r\nAn example, when the Arab spring started (a name for the revolution that took place an various Arab countries), Middle Eastern airlines changed their routes a bit, more flights to Europe and the far East, less flights to Egypt, Tunis, Syria. Ticket prices were never reduced, not even a cent, but since people changed their regular holidays destinations, airlines did as well. \r\n\r\nBottom line, IMO, airlines just started making some money because of the oil prices do you think a zika virus will make them lose that? I didn&#39;t think so. It&#39;s just changing the routes to where people demand.", "587" ], [ "I personally manage a site that lists the public holidays of every country of the world, both with long-term forecasts (some of our clients license more than 20 years into the future), and quasi real-time updates, to react when a country makes a last minute change (on average there is one or two such changes, somewhere in the world, everyday).\r\n\r\nI won&#39;t mention which site it is, to avoid being spammed-out. In any case, which site it is is not relevant to what I am about to write.\r\n\r\nAll the forecasts are handled automatically by a library of code I have developed since 1989. I have also automated the search for last-minute updates. Yet, despite these 27 years of experience and automated code, and my ability to read news in 5 languages fluently, it takes me 4-5 hours per day, 7 days a week, 365 days a year, to make sure that I miss none of the daily and yearly changes to holidays and their rules, that occur all over the world.\r\n\r\nMy point ?\r\n\r\nYou will never find a reliable source of worldwide public holidays that is free. You&#39;ll find a few free sites that list the 10-15 \" ;easy \" ; countries. You&#39;ll find a few free sites that list more countries, but do not provide dates for non-western calendars. You&#39;ll mainly find free sites with lots of ads and cookies.\r\n\r\nIn some areas, there is still no such thing as a free lunch ;-)", "889" ], [ "No, you basically can not do that, at least not as simple as you described it.\r\n\r\nVisiting air-side transit areas is usually allowed for transit passengers who have no visa, hence the name. \r\n\r\nI am not aware of situations where people who live in a country are allowed to visit there. One of the reasons is exactly what you are trying to do, duty free goods. \r\n\r\nEven employees who work in such areas, will undergo security checks upon exiting, they will be checked for any stuff they brought from inside, including duty free items which they are not allowed to buy. Your case is similar, who will pay the tax for the phone and where? these transit areas are not equipped for such cases. \r\n\r\nIf somehow you managed to meet your friend, most likely she will be in a plane leaving the Schengen area totally, other than that I am not really sure.", "128" ], [ "I was chatting with a friend after I saw his photos in Russia (Petersburg). He is a white British dude who has been to many, many, many countries. On the other hand, I am a pure Arab who looks like a typical Middle Easterner or North African, who has also been to many countries, but never to Russia or its neighbors.\r\n\r\nAnyway, it seemed like he really liked Russia, so I told him it will be in my list. He told me \" ;**you do not belong** \" ;.\r\n\r\nAt first, I wasn&#39;t sure what he did mean. He started explaining and told me stuff like \" ;you will be hassled for no reason in some parts of the city \" ; and \" ;the police will stop you every few hundred meters asking for money \" ;. He made sure to make me believe that&#39;s all because I _do not belong_.\r\n\r\nCan someone clarify this? Of course, some of this is hyperbole to help convey the point, but to what extent?\r\n\r\n < sup > Note: The friend is [Gayot Fow](_URL_0_). If you think the question is wrong, feel free to downvote him ;) < /sup >", "565" ], [ "My guess, the questions page shows an overview of the question, which makes the rows higher while the main page which shows nothing but the title, which makes the row narrower. \r\n\r\nThe main page is just an overview, it needs to be compact to show as much rows as possible, while the questions page is mainly for those who intend to answer hence showing more details about each question (the overview).", "395" ], [ "I have a product type with **Date** and **Time** attributes. These are rendered on the Add to Cart form as select inputs and when they are changed they trigger an AJAX update of the form to show the relevant stock and price.\r\n\r\n[![attribute dropdowns][1]][1]\r\n\r\nUsing the values in the **Date** select list I am rendering a jQueryUI datepicker that, when selected, will also update the **Date** select input.\r\n\r\n[![datepicker][2]][2]\r\n\r\nI am using the following code to update the **Date** select when a date is clicked on the datepicker.\r\n\r\n $(&#39;.form-item-attributes-field-date select&#39;).val(selected).trigger( \" ;change \" ;);\r\n\r\nThis correctly selects the option in the Date select but does not trigger the AJAX update. I have to interact with the Date select dropdown manually to trigger an update, rendering the datepicker useless. Is there something I&#39;m missing?\r\n\r\nI have already looked at [this question][3] that suggests I use `.attr()` as well as `.trigger()` but that doesn&#39;t make a difference.\r\n\r\nEven when I print out `console.log(settings.ajax);` it tells me that the triggering event is change so I can&#39;t work out why triggering it doesn&#39;t call the AJAX update\r\n\r\n[![enter image description here][4]][4]\r\n\r\nThis is my code\r\n\r\n (function ($) {\r\n Drupal.behaviors.datePicker = {\r\n attach: function (context, settings) {\r\n // Insert datepicker div\r\n $(&#39; < div id= \" ;datepicker \" ; / > &#39;).insertBefore(&#39;.form-item-attributes-field-date&#39;);\r\n\r\n // Get array of valid dates\r\n var validDates = [];\r\n $( \" ;.form-item-attributes-field-date option \" ;).each(function () {\r\n validDates.push($(this).text());\r\n });\r\n\r\n $( \" ;#datepicker \" ;).datepicker({\r\n dateFormat: \" ;dd/mm/yy \" ;,\r\n defaultDate: $( \" ;.form-item-attributes-field-date option:selected \" ;).text(),\r\n beforeShowDay: function (date) {\r\n var string = jQuery.datepicker.formatDate(&#39;dd/mm/yy&#39;, date);\r\n return [validDates.indexOf(string) != -1]\r\n },\r\n onSelect: function (dateText, inst) {\r\n var selected = $(&#39;.form-item-attributes-field-date option&#39;).filter(function () {\r\n return $(this).html() == dateText;\r\n }).val();\r\n $(&#39;.form-item-attributes-field-date select&#39;, context).val(selected).trigger( \" ;change \" ;);\r\n },\r\n });\r\n }\r\n };\r\n })(jQuery);\r\n\r\n**Update**\r\n\r\nI have noticed that on first page load, selecting a date in the calendar widget does not trigger the AJAX refresh. However if I trigger the AJAX refresh by actually changing the select list, then clicking dates in the calendar does trigger the AJAX. Why would this not work on first load?\r\n\r\n\r\n [1]: _URL_3_\r\n [2]: _URL_1_\r\n [3]: _URL_0_ \" ;this question \" ;\r\n [4]: _URL_2_", "49" ], [ "*Update 2:* [Fixed in iOS 9.3.1](_URL_4_)\r\n\r\n*Update:* [Apple has confirmed the bug and is working on a fix for a 9.3.1 release](_URL_3_).\r\n\r\nMy Safari on iOS 9.2.1 (update: and now 9.3) won’t open most links anymore, i.e. tapping on a link on a page does not do anything. Worse, other apps like Messages, Chrome are having issues when they try to open URL/Links.\r\n\r\nThe common issue is pauses when tapping links and even Mobile Safari tap and hold (to get the app open a link in a new tab), the device freezes and eventually crashes.\r\n\r\n- Looking at the html source for the links causing issues, it seems all scheme absolute links are affected (e.g. `_URL_1_`), while relative links work (e.g. `/some/page.html`). \r\n- This makes me think third party registration of URL handlers (or what they are called) is related to the bug\r\n- All apps that can open links, such as Mail or Spark, are affected. Tapping a link freezes the device. Tap & hold and then selecting copy link, switch to Safari or Chrome and paste URL sometimes helps/works.\r\n- It happens mostly on Google and DuckDuckGo result pages. On some other pages it works.\r\n\r\nI tried things to rule out a simple setting error:\r\n\r\n1. disable all content blockers\r\n1. delete website data from Safari (in preferences app)\r\n1. kill all apps, restart iOS.\r\n1. Tried Chrome, and it doesn&#39;t work there on simple taps, but tap and hold works, and I can open them in a new tab at least.\r\n\r\nMy conclusion is that this bug relates to iOS 9.2 and third party app updates triggering bad behavior, I saw constant crashes of the `swdc` process in my iPhone logs and I [reported a bug with Apple][1]. Suspect apps include:\r\n\r\n- Wikipedia\r\n- _URL_0_\r\n\r\nIs there a way to list these apps that change link handling so I can selectively uninstall them?\r\n\r\n\r\n [1]: _URL_2_", "923" ], [ "There is a [manual fix that does not require a restore from backup][1] from <PERSON>, but apparently the timing of the steps is important. It involves reinstalling the _URL_1_ app via iTunes and USB with Airplane mode on, and quickly killing the app after the first launch.\r\n\r\nIt did not work for me (tried a few times), but posting in case it might help others. According to comments over there, if it works, it only fixes it partially, as not all the broken caches for different apps are reset, so I assume only Apple can provide the real fix.\r\n\r\nThere is also an [alternative one with more steps][2] by <PERSON>.\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_0_", "139" ], [ "I recently experienced issues with my hosting company and a few of my sites went down. All users could see was a standard Drupal PDO Exception page. Is there a way I can create/use a page to show a generic \" ;we&#39;re having issues, please check back later \" ; page instead of this if a major problem occurs? \r\n\r\n[![enter image description here][1]][1]\r\n\r\n\r\n [1]: _URL_0_", "110" ], [ "The site is called \" ;travel \" ;, so does that mean it&#39;s only about the process of \" ;traveling \" ;? Like how to move from A to B and what documents do I need? Of course not! \r\n\r\nPeople, food, culture, language, weather, etc. are all essential aspects of travel, whether you are going for business or pleasure. That is the whole idea in most travels, and it&#39;s not ridiculous at all. \r\n\r\nAs for stereotyping, I think it&#39;s not stereotyping, it&#39;s more like an attempt to understand some cultural differences. \r\n\r\nThink of it as science, sometimes we need to talk about sensitive topics because we have to. Same goes for travel, we need to know as much information as possible about all involved elements (especially the people) so we can make sure to not disrespect someone inadvertently or even worse, get into serious trouble. \r\n\r\nAs for that specific question, and why I think it&#39;s not ridiculous, in my culture if you say \" ;let&#39;s have dinner \" ; it means \" ;let&#39;s have dinner \" ;. Imagine how embarrassed I would be if I took that literally in the US.\r\n\r\nAlso I suggest that we stop taking things in a sensitive way when people ask about other people&#39;s cultures and behaviors because it&#39;s an important homework to do before you travel to a new place. Remember, not everyone is a en experienced \" ;road warrior \" ;.", "565" ], [ "Not at all! In fact, we see it as a sign of respect.\r\n\r\nIt will also help you with the heat! these things are designed for the hellish weather in this desert. \r\n\r\nOne thing to remember, be sure to use the right name in the right place, for some reason it has many names depending on the place and people might not understand it. The name \" ;Thobe \" ; in the UAE for example is used for ladies dresses, while Kandura anywhere else but the UAE sounds funny.\r\n\r\nFinally, thobe is not related to Islam. It&#39;s an ancient dress for the Arabs in the peninsula, way before Islam. However, during my visits to many non Arab countries with Muslim population, I noticed that it&#39;s used occasionally, especially when attending Friday prayers.", "664" ], [ "Use English, period. \r\n\r\nNot that using Hebrew is _the problem_, but why use the language of the people whom Palestinian see as the people who took their land? use the language that will make them feel respected, their own mother language.\r\n\r\nIn addition to that, unlike \" ;1948 Arabs \" ; who live in Israel and they are mostly bilingual, the general Palestinian population do not necessarily speak Hebrew. They study it in school, even in Gaza, they can _manage_ (usually to be able to communicate with the Israeli soldiers). Many who have worked in Israel in previous times when it was allowed, or imprisoned there do speak it fluently, but not all. \r\n\r\nPalestinians are [friendly][1] with foreigners, many (especially in the west bank) do speak English, it&#39;s after all a touristic area (area A). \r\n\r\nRegarding the similarities between Arabic and Hebrew, there are a lot of similar words but you will need to hear them slowly to understand, and both use the same concept of word roots. However, current Hebrew lost many of its Semitic features (grammar and sounds), Arabic is kinda more Semitic than Hebrew as Hebrew is heavily influenced by Europeans languages. \r\n\r\nHere are some words that will help you:\r\n\r\n* <PERSON> _or_ <PERSON>: Hi\r\n* <PERSON>?: Do you speak English?\r\n\r\nI am an Arab but not Palestinian, I know a lot of Palestinians and we have had long chats about this in a few occasions. \r\n\r\n[1]:_URL_0_", "807" ], [ "Enter the date in which you plan to leave the UK after your _first_ intended visit, whether the first visit is 1 day or 6 months. \r\n\r\nThe decision for the multiple entry family visit visa will usually be based on other criteria, such as proof of ties to your home country, financial status, etc. and the dates are really irrelevant except for the visa validity date.", "606" ], [ "He will be able to make it. I have seen many people with disabilities travel alone (I am a cabin crewmember)\r\n\r\nLet&#39;s break it down into a few elements (considering that you are going to use a major airline and not a LCC):\r\n\r\n\r\n1. Going to the airplane: almost all airlines/airports do provide _free_ services for people who need help with moving. Many airports even provide golf carts _free of charge_. **All you have to do is to flag the reservation with a wheelchair request**. Again, you can do that with almost all airlines online without the need to call someone.\r\n2. Getting off the airplane: Once the reservation is flagged with a wheelchair request, there should be a wheelchair waiting at the arrival gate. \r\n3. Luggage: Usually the same person who comes with the wheelchair will take care of that. In other cases, the airport itself will take care of that. \r\n4. Moving inside the cabin: Crutches are allowed on-board, he can use them in case he needed to move during the flight. I&#39;ve also seen people who use crutches use the seat-backs instead to give them support until they reach the toilet. However, if crutches are not an option due to small space, many wide bodied airplanes have a small cabin wheelchair, just inform him to ask the cabin crew. \r\n5. Lavatories: almost all airplane toilets are equipped with handles to support people with disabilities. \r\n\r\nAs for the \" ;first time traveler \" ; part. There&#39;s nothing to worry about, really. Airports have all kinds of signs, boarding passes can be obtained online, anyone with uniform will be able to provide support. Cabin crew onboard will be more than happy to help, safety demonstrations are there. He will be fine.\r\n \r\nMake sure to book him a seat near the toilet and in the left side of the airplane (for easier boarding and deplaning), a seat behind a bulkhead (extra legroom) will be perfect. Remember, seats at emergency exits will not be an option for him.", "587" ], [ "The area is called [Tulul Alsafa][1], Arabic for \" ;Al-Safa hills \" ;.\r\n\r\nFrom [Wikipedia][1]:\r\n\r\n > is a hilly region which lies in southern Syria, north-east of Jabal Al-Arab volcanic plateau. It consists of a basaltic lava field of volcanic origin, covering an area of 220 square kilometres, and contains at least 38 cinder cones\r\n\r\nWhat you have [zoomed in][3] in the linked map is one of those 38 [cinder cones][2].\r\n\r\nFactoids: According to news reports, this area is where ISIS is \" ;hiding \" ; now (Sep 2018) after being hit by the Syrian army, it has unique geographical features which makes it hard for the army to follow them (according to the article I read).\r\n\r\n[1]: _URL_2_\r\n[2]: _URL_1_\r\n[3]: _URL_0_", "464" ], [ "I was in Bali last week, I stayed for two weeks and in this two weeks I experienced two earthquakes. One of them was in the nearby island of Lombok, but it was too strong and it was felt in Bali, the other one was centered 60km from Bali but it wasn&#39;t that strong (5.6) but I was in the 4th floor and it was scary. However, nothing happened and no injuries at all, many of the people who were asleep didn&#39;t even wake up.\r\n\r\nBali is located inside the [ring of fire][1], which is an area where many earthquakes and volcano eruptions occur. That&#39;s a fact and no one can do anything about it. \r\n\r\nHow often do earthquakes happen? when will they happen? how strong will they be? Unfortunately, these questions are not answerable. But remember, mankind lived there for thousands of years and managed. Most buildings will stand most of the earthquakes. Most deaths occur from the destruction of weak buildings that are usually found in slums and in small villages where houses are built in the cheapest possible way with no support whatsoever. Checking the photos of the destroyed buildings in Lombok after the last serious earthquake revealed no large buildings were destroyed. I do not think that you would stay in one of those cheap houses.\r\n\r\nThe real problem from earthquakes are the tsunamis that follow, most hotels have a Tsunami Gathering Point in higher floors where all guests will be directed to go to in case there was a tsunami alert. Indonesian government issue tsunami alerts after earthquakes if they are possible, if you ever felt an earthquake just type \" ;tsunami alert \" ; in google and you should be aware if there&#39;s one.\r\n\r\nRegarding volcanoes, Mt. Agung could erupt in Indonesia and affect the aviation around the world, just like what happened with [Eyjafjallaj&#246;kull eruption in 2010][2]. So, your flight might be delayed due to an eruption in a different part of the world due to wind directions, while you could be close to the volcano and your flight takes off on time. I wouldn&#39;t worry about this.\r\n\r\n[1]: _URL_1_\r\n[2]: _URL_0_", "464" ], [ "Objects tracking is finding the trajectory of each object in consecutive frames. Human tracking is a subset of object tracking which just considers humans.\r\n\r\nI&#39;ve seen many papers that divide tracking methods into two parts: \r\n1- Online tracking: Tracker just uses current and previous frames.\r\n2- Offline tracking: Tracker uses all frames.\r\n\r\nAll of them mention that online tracking is suitable for autonomous driving and robotics, but I don&#39;t understand this part. What are the applications of object/human tracking in autonomous driving? \r\n\r\nDo you know some related papers?", "26" ], [ "I am a cabin crewmember, I did anything from as much as 10 flights per month to **35 flights per month** (around 80-100 hours flight time) for years and still alive and fine. \r\n\r\nCrewmembers follow a complicated system that regulate rest periods between flights and flying hours per month and many other things. This does not apply to passengers, they are not exposed as much as crewmembers and they don&#39;t do 4 or 5 flights a day as some crewmembers do. These regulations are well studied and are based on medical studies and a lot of organizations are involved in it to make sure it&#39;s safe for crewmembers. Considering that crewmembers do fly way more than passengers, then it&#39;s quite safe to assume that it&#39;s safe to fly 60 flights a year.\r\n\r\nIn my opinion, the only thing you really need to worry about is staying hydrated and moving from time to time to avoid blood clots in your legs.", "463" ], [ "According to [Google Maps][1], this photo was taken at the Powderface Ridge, next to the Sunrise Hill. \r\n\r\nThe Sunrise Hill according to [this page][2] is south-east of the Powderface Ridge. However, it&#39;s not shown in Google Maps. Here&#39;s a screenshot from [Google Maps][4] that shows the location of the Sunrise Hill (I added the text):\r\n\r\n[![enter image description here][3]][3]\r\n\r\nThe valley you see in the photo is called Elbow Valley. \r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_3_\r\n [3]: _URL_0_\r\n [4]: _URL_1_", "464" ], [ "It means nothing, really nothing. They are sold in car accessories shops and some people put them because they think it&#39;s \" ;cool \" ;. \r\n\r\nIt&#39;s usually done by van owners (the vans that are used for shared transportation for a small fee, like public transportation but owned by individuals), taxi drivers and truck owners. The pattern here is people who usually make a living by their cars, their car feels like home or something, they want to decorate it. \r\n\r\nI am not Egyptian, but I lived there for a few years.", "867" ], [ "It&#39;s not explicitly banned. However, a security personnel can ban it under the wide rule of (any item that can cause harm or can be used as a weapon). \r\n\r\nI think this wire will pass under the x-ray as a charger wire or something, it does not look dangerous to me. \r\n\r\nSecurity personnel usually choose to confiscate/deny uncategorized items based on their knowledge. If they know what it is they will usually allow it, if not they will go safe and deny it. \r\n\r\nIf it raises a flag, your best bet is to hope that you get checked by a security officer who knows what this wire is used for.", "272" ] ]
131
[ 6333, 13187, 2200, 9172, 19478, 14517, 15727, 13147, 18369, 11644, 9686, 19376, 14291, 7917, 3901, 7583, 10321, 19297, 2056, 867, 16082, 3911, 13494, 2334, 7343, 3671, 11173, 16753, 3715, 4314, 8568, 2973, 727, 16846, 5679, 15190, 19052, 5420, 15312, 10694, 9662, 218, 8290, 2123, 4170, 3716, 9215, 8785, 14770, 7290, 18042, 19243, 9216, 2691, 12459, 19514, 2424, 2098, 8864, 19485, 19258, 11535, 3922, 3557, 9348, 18884, 14734, 19369, 17124, 17465, 16595, 7161, 5734, 5169, 17053, 8715, 19242, 4000, 11390, 16651, 18925, 11805, 2198, 12257, 10243, 11700, 5027, 2374, 8818, 11499, 10569, 3018, 12746, 4900, 2038, 5935, 1407, 13024, 19172, 12417, 1005, 6478, 17314, 9399, 14762, 3352, 2180, 5206, 12844, 15952, 12899, 1176, 3995, 7428, 9236, 9309, 11270, 3551, 3806, 12195, 744, 18119, 8727, 5982, 8134, 15058, 8492, 6308, 10910, 7047, 5921, 10071, 16871, 1048, 18006, 12139, 2711, 601, 13685, 9947, 16024, 2303, 5350, 17918, 15882, 13814, 2242, 11513, 13954, 8607, 14032, 6665, 11027, 1246, 11723, 9547, 7868, 7174, 10949, 12224, 13375, 2042, 1520, 15996, 12120, 8848, 2568, 4818, 27, 5150, 16809, 4680, 15811, 14652, 3044, 4689, 10994, 10756, 3121, 18016, 18762, 1796, 2734, 902, 10918, 16707, 19675, 1908, 2085, 940, 10152, 11927, 19065, 12583, 6118, 1716, 4817, 14196, 4531, 10871, 15019, 15916, 5251, 13374, 1844, 3177, 533, 11936, 6508, 6685, 19492, 1234, 11449, 4465, 8529, 14380, 14393, 1629, 19152, 5686, 1943, 9022, 2223, 10388, 12397, 994, 16539, 13770, 2351, 3357, 12118, 16184, 15929, 13496, 1924, 3713, 536, 10926, 9895, 6304, 12326, 6286, 6670, 8169, 3474, 1921, 6799, 13679, 8688, 19489, 2460, 15116, 11291, 19590, 10553, 5392, 13144, 3580, 13095, 13682, 6689, 19226, 13517, 17404, 1843, 7178, 2763, 9738, 12624, 19022, 2532, 8350, 7757, 5052, 18558, 1085, 17503, 8009, 14225, 3668, 6151, 4745, 7521, 9968, 10440, 11331, 4661, 15768, 7946, 11760, 5548, 2499, 1059, 16700, 17536, 1915, 15309, 2037, 4219, 7457, 12258, 436, 15742, 18037, 2466, 3543, 14535, 12666, 6912, 638, 6872, 12584, 7728, 1224, 1370, 7656, 6157, 5407, 8011, 12549, 16283, 9003, 13705, 7682, 9587, 18675, 5162, 6063, 5882, 10785, 12496, 3355, 17907, 17564, 2658, 18241, 17988, 1469, 8374, 1633, 19470, 1948, 3414, 12964, 4998, 5544, 9041, 2727, 2243, 17686, 7783, 9220, 15036, 1969, 846, 14134, 7087, 15813, 10001, 10017, 9517, 4595, 764, 8842, 14574, 12732, 1612, 193, 9590, 11213, 15135, 2006, 14828, 9233, 17624, 957, 10299, 9585, 19503, 2141, 11198, 9198, 11188, 8914, 4130, 12923, 4031, 10684, 19779, 278, 9120, 9561, 9766, 15856, 5148, 11407, 13678, 82, 13161, 609, 1577, 9342, 4535, 17186, 4023, 7974, 4011, 17843, 5699, 5987, 11353, 6492, 6946, 15330, 4076, 9430, 9351, 3008, 18947, 17938, 4960, 1433, 319, 9072, 9623, 528, 18811, 16765, 15361, 19627, 13223, 2890, 1801, 9554, 7935, 13320, 8552, 15483, 19280, 15868, 2980, 1787, 12479, 11012, 6128, 14613, 12490, 17800, 2832, 13790, 9108, 19317, 5611, 18765, 18735, 8927, 8604, 7293, 4073, 14660, 900, 7570, 18120, 14295, 503, 1358, 10286, 17283, 12671, 18807, 1253, 2309, 15701, 18240, 19013, 6470, 10844, 5814, 7655, 15625, 14716, 7846, 9266, 404, 11956, 4388, 12870, 2745, 16219, 16788, 2757, 10849, 13887, 10386, 15455, 10076, 2978, 5139, 10278 ]
STX_10051908.0
[ [ "I have two database name db1 and db2 on same server, I need a sql query to get unique data. Below are databases and tables name\r\n\r\n**db1**\r\n\r\n**Table_db1**\r\n\r\n EmailID Name Mobile\r\n <EMAIL_ADDRESS> raj 7207542655\r\n <EMAIL_ADDRESS> kumar 111111111\r\n\r\n\r\n**db2**\r\n\r\n**Table_db2**\r\n\r\n EmailID Name Mobile\r\n <EMAIL_ADDRESS> raj 7207542655\r\n <EMAIL_ADDRESS> rohan 5555555555\r\n\r\n<EMAIL_ADDRESS> removed duplicate from tables and Output should be\r\n\r\n <EMAIL_ADDRESS> raj 7207542655\r\n <EMAIL_ADDRESS> kumar 111111111\r\n <EMAIL_ADDRESS><PERSON> 7207542655\r\n kumar@gmail.com <PERSON> 111111111\r\n\r\n\r\n**db2**\r\n\r\n**Table_db2**\r\n\r\n EmailID Name Mobile\r\n raj@gmail.com <PERSON> 7207542655\r\n rohan@gmail.com <PERSON> 5555555555\r\n\r\nraj@gmail.com removed duplicate from tables and Output should be\r\n\r\n raj@gmail.com raj 7207542655\r\n kumar@gmail.com <PERSON> 111111111\r\n rohan@gmail.com <PERSON><PHONE_NUMBER>\r\n kumar@gmail.com kumar 111111111\r\n\r\n\r\n**db2**\r\n\r\n**Table_db2**\r\n\r\n EmailID Name Mobile\r\n raj@gmail.com raj <PHONE_NUMBER>\r\n rohan@gmail.com rohan <PHONE_NUMBER>\r\n\r\nraj@gmail.com removed duplicate from tables and Output should be\r\n\r\n raj@gmail.com raj <PHONE_NUMBER>\r\n kumar@gmail.com kumar 111111111\r\n rohan@gmail.com rohan <PHONE_NUMBER>\r\n\r\n\r\n\r\nI need unique data from db1 and db2 base on EmailID of Table_db1 and Table_db2\r\n\r\nbring single EmailID data from Table_db1 and Table_db2", "720" ], [ "I am very new in MVC and my previous experience was _URL_0_ web forms, now i am getting difficulty to add Validation for @Html.DropDownList and @Html.DropDownListFor in Razor using C# _URL_0_ mvc code first approach\r\n\r\nBelow is my design:\r\n\r\n < div class= \" ;form-group \" ; > \r\n @Html.LabelFor(model = > model.State, new { @class = \" ;control-label col-md-2 \" ; })\r\n < div class= \" ;col-md-10 \" ; > \r\n @Html.DropDownList( \" ;States \" ;, new SelectList(ViewBag.States as System.Collections.IEnumerable, \" ;StateId \" ;, \" ;StateName \" ;, new { @class = \" ;control-label col-md-2 \" ; }), \" ;Select a State \" ;, new { id = \" ;dd_State \" ; })\r\n \r\n < /div > \r\n < /div > \r\n\r\n < div class= \" ;form-group \" ; > \r\n @Html.LabelFor(model = > model.City, new { @class = \" ;control-label col-md-2 \" ; })\r\n < div class= \" ;col-md-10 \" ; > \r\n @Html.DropDownListFor(Model = > Model.City, new SelectList(Enumerable.Empty < SelectListItem > (), \" ;CityName \" ;, \" ;CityName \" ;), \" ;Select a City \" ;, new { id = \" ;dd_City \" ; })\r\n < span id= \" ;span1 \" ; name= \" ;span1 \" ; > < /span > \r\n < /div > \r\n < /div > \r\n\r\n Below is my Models code _URL_4_ and not able to add require fields of **State** and **City**\r\n\r\n [Table( \" ;Register \" ;)]\r\n public class Register\r\n {\r\n [Key]\r\n public int Sno { get; set; }\r\n [Required(ErrorMessage = \" ;Name is required. \" ;)]\r\n [Display(Name = \" ;Full name \" ;)]\r\n public string Fullname { get; set; }\r\n [Display(Name = \" ;Email Id \" ;)]\r\n [Required(ErrorMessage = \" ;Email is required. \" ;)]\r\n public string EmailId { get; set; }\r\n [Required(ErrorMessage = \" ;Password is required. \" ;)]\r\n public string Password { get; set; }\r\n [Required(ErrorMessage = \" ;Mobile is required. \" ;)]\r\n public string Mobile { get; set; }\r\n [Required(ErrorMessage = \" ;Address is required. \" ;)]\r\n public string Address { get; set; }\r\n public string State { get; set; }\r\n public string City { get; set; }\r\n [Required(ErrorMessage = \" ;Entity is required. \" ;)]\r\n public string EntityType { get; set; }\r\n public string Website { get; set; }\r\n public string PinCode { get; set; }\r\n public string accountactivated { get; set; }\r\n \r\n }\r\n\r\nAlso i am not able to add bootstrap css to @Html.DropDownList and @Html.DropDownListFor please check dropdown look.\r\n\r\n[enter image description here][1]\r\n\r\n\r\nMy State and city model class.\r\n\r\n[enter image description here][2]\r\n\r\n\r\n[enter image description here][3]\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_1_\r\n [3]: _URL_3_", "560" ], [ "Convert list result to datatable using linq?\r\n\r\nI am getting below error but candidate ID is there in my datatable result.\r\n\r\n A field or property with the name &#39;Candidate ID&#39; was not found on the selected data source.\r\n\r\nBelow is my code. I am trying to bind result datat to gridview but error is coming.\r\n\r\n var m_strFilePath = \" ;webserviceurl \" ;;\r\n\r\n string xmlStr;\r\n using (var wc = new WebClient())//using Web client downloading xml string from WEB API\r\n {\r\n xmlStr = wc.DownloadString(m_strFilePath);\r\n }\r\n DataSet ds = new DataSet();\r\n ds = ConvertXMLToDataSet(xmlStr);\r\n DataTable dt = new DataTable();\r\n dt = ds.Tables[ \" ;FL \" ;];\r\n\r\n \r\n\r\n List < DataTable > result = dt.AsEnumerable().Where(x = > x.Field < int > ( \" ;row_Id \" ;) == 0)\r\n .GroupBy(x = > x.Field < int > ( \" ;row_Id \" ;))\r\n .Select(grp = > grp.CopyToDataTable())\r\n .ToList();\r\n GridView1.DataSource = result;\r\n GridView1.DataBind();\r\n\r\nBelow is gridview design code.\r\n\r\n < asp:GridView ID= \" ;GridView1 \" ; runat= \" ;server \" ; AutoGenerateColumns= \" ;false \" ; GridLines= \" ;None \" ; CssClass= \" ;table table-bordered table-striped \" ; Width= \" ;100% \" ; > \r\n < Columns > \r\n < asp:BoundField DataField= \" ;Candidate ID \" ; HeaderText= \" ;Id \" ; / > \r\n \r\n < asp:TemplateField HeaderText= \" ;Action \" ; > \r\n < ItemTemplate > \r\n < asp:LinkButton ID= \" ;lnkbtn_viewdetails \" ; runat= \" ;server \" ; OnClick= \" ;lnkbtn_viewdetails_Click \" ; CssClass= \" ;btn bg-light-blue-active \" ; > View Details < /asp:LinkButton > \r\n < /ItemTemplate > \r\n < /asp:TemplateField > \r\n < /Columns > \r\n < EmptyDataTemplate > \r\n < span style= \" ;color: red; font-size: 18px; font-weight: 600; text-align: center; padding-left: 355px; \" ; > No records for the entered search details < /span > \r\n < /EmptyDataTemplate > \r\n < /asp:GridView > \r\n\r\nbelow is result datatable data.\r\n\r\n[![enter image description here][1]][1]\r\n\r\n\r\n [1]: _URL_0_", "653" ], [ "I have created the MVC5 code first Website on IIS and established the site with the Application pool in Live., then I did it manually. I did not publish my application, because the IT Network team do not know the publishing process. I uploaded as it visual studio files into live, users are registering live successfully but I saw so many examples are saying to publish the site, please suggest I have to publish my application is mandatory. And If I will keep my application like now into live any issue will come in futures.", "888" ], [ "I have two buttons\r\n\r\n1) Submit\r\n2) Save and Edit\r\n\r\nif user will use **Submit** button all page validation should fire and after he will submit record\r\n\r\nif user will use **Save and Edit** then this button not require any validation will not fire. after clicking save and edit button controller will return on same page no need to show validation after return but its showing validations.\r\n\r\nI use **ModelState.Clear();** working fine but dropdown is loosing value after Save and Edit case.\r\n\r\n switch (command)\r\n {\r\n case \" ;Submit \" ;:\r\n \r\n \r\n ViewBag.StageInnovation = new SelectList(db.StageofInnovations.OrderBy(k = > k.StageName), \" ;StageId \" ;, \" ;StageName \" ;);\r\n\r\n return View(Application);\r\n\r\n case \" ;Save and Edit \" ;:\r\n \r\n ViewBag.StageInnovation = new SelectList(db.StageofInnovations.OrderBy(k = > k.StageName), \" ;StageId \" ;, \" ;StageName \" ;);\r\n ModelState.Clear();\r\n return View(Application);\r\n }\r\n\r\n\r\nBelow are html buttons.\r\n\r\n < input type= \" ;submit \" ; value= \" ;Submit \" ; name= \" ;command \" ; / > \r\n < input type= \" ;submit \" ; value= \" ;Save and Edit \" ; formnovalidate= \" ;formnovalidate \" ; name= \" ;command \" ; / >", "300" ], [ "I am very new to linq query so I need to join multiple tables and single output using Entity Framework mvc5\r\n\r\nBelow is my 3 table structures and Table_Application is a main table \r\n\r\n1) Table_Application\r\n\r\n Id ApplicationName ServiceId ProductID\r\n\r\n 1 Myapp\t\t 1 1\r\n\r\n\r\n2) Table_Service\r\n\r\n ServiceId SName\r\n 1 S1\r\n\r\n3) Table_Product\r\n\r\n ProductID PName\r\n 1 P1\r\n\r\n\r\nI need linq out result data in linq list base on Table_Application ID\r\n\r\n ApplicationName SName PName\r\n Myapp S1 P1\r\n\r\nmy sql query some thing like that \r\n\r\n select t1.ApplicationName,t2.SName,t3.PName from Table_Application t1,Table_Service t2,Table_Product t3 where t1.ServiceId =t2.ServiceId and t1.ProductID=t3.ProductID and _URL_0_= \" ;mysessionid \" ;\r\n\r\nI tried for single table coming but not able to join Table_Service and Table_Product\r\n\r\n var IA = db.Applications\r\n .Where(x = > _URL_1_ == Id)\r\n .Select(IAview = > new IAViewModel \r\n {\r\n ApplicationName = IAview.ApplicationName\r\n \r\n \r\n }).ToList();", "720" ], [ "Actually my model classes changed also tables effected in local, so now i am going update my database to live but how to update local db changes into live.\r\n\r\nSome buddy told me to use below command before update-database, but i did not taken update-database -script before executing update-database command\r\n\r\n update-database -script\r\n\r\nI do not want to stop my live website and i need to update my database changes and later i will upload application files.", "154" ], [ "Below is my State Model class.\r\n\r\n public class State\r\n {\r\n [Key]\r\n public int StateId { get; set; }\r\n public string StateName { get; set; }\r\n public virtual ICollection < City > Cities { get; set; }\r\n }\r\n\r\nBelow is my City Model Class base state, city will fill.\r\n\r\n public class City\r\n {\r\n [Key]\r\n public int CityId { get; set; }\r\n public string CityName { get; set; }\r\n [ForeignKey( \" ;State \" ;)]\r\n public int StateId { get; set; }\r\n public virtual State State { get; set; }\r\n }\r\n\r\nBelow is my Registration model class for the registration form which calls State city.\r\n\r\n\r\n public class Registration\r\n {\r\n [Key]\r\n public int Sno { get; set; }\r\n\r\n [Required(ErrorMessage = \" ;Name is required. \" ;)]\r\n [Display(Name = \" ;Full name \" ;)]\r\n public string Fullname { get; set; }\r\n [Display(Name = \" ;Email Id \" ;)]\r\n [Required(ErrorMessage = \" ;Email is required. \" ;)]\r\n public string EmailId { get; set; }\r\n [Required(ErrorMessage = \" ;Password is required. \" ;)]\r\n public string Password { get; set; }\r\n [Required(ErrorMessage = \" ;Mobile is required. \" ;)]\r\n public string Mobile { get; set; }\r\n [Required(ErrorMessage = \" ;Address is required. \" ;)]\r\n public string Address { get; set; }\r\n public int SelectedStateId { get; set; } \r\n public int SelectedCityId { get; set; }\r\n [Required(ErrorMessage = \" ;Entity is required. \" ;)]\r\n public string EntityType { get; set; }\r\n public string Website { get; set; }\r\n public string PinCode { get; set; }\r\n public string accountactivated { get; set; }\r\n public int RoleId { get; set; }\r\n [Display(Name = \" ;New Password \" ;)]\r\n [NotMapped]\r\n public string NewPassword { get; set; }\r\n [Display(Name = \" ;Confirm New Password \" ;)]\r\n [NotMapped] // Does not effect with your database\r\n [System.Web.Mvc.Compare( \" ;NewPassword \" ;, ErrorMessage = \" ;Password not match \" ;)]\r\n public string ConfirmNewPassword { get; set; }\r\n \r\n }\r\n\r\nMy question is how should i have to call state and city cascading drop down list in my Registration Model class to generate scaffolding for registration page with dependent drop down list.", "714" ], [ "I am passing query string value mailer url to an action method.\r\n\r\nI am passing like below URL to my activation `ActionResult`.\r\n\r\n body += \" ;Please click < a href= \" ; + LinkPath + \" ;Registers/Activation?emailId= \" ; + emailid + \" ; & uCode= \" ; + activationCodes + \" ; & type= \" ; + a + \" ; > here < /a > to active your account \" ; + \" ; < br > < br > \" ;;\r\n\r\nSimple can I pass query string value to action method like below. Activation is my action method:\r\n\r\n _URL_0_\r\n\r\nAlso I am getting a query string value in my `Activation` method like below\r\n\r\n Request.QueryString[ \" ;emailId \" ;].ToString();\r\n\r\nActually my previous expriece with _URL_2_ web forms now I am working using _URL_1_ MVC 5 and Entity Framework.\r\n\r\nMy question is it is fine to pass query string value like web form in my mailer.", "190" ], [ "I need top 5 LINQ query with group by using entity framework and below is sql query like that i need LINQ query.\r\n\r\n select top 5 \r\n EventId,\r\n Datename(day, EventDate) as Day, \r\n convert(varchar(3), EventDate, 100) as Month, \r\n Datename(yy, EventDate) as year,\r\n Title, Description, ThumbImage \r\n from \r\n EventGalleries \r\n group by \r\n EventId, Title, EventDate, Description, ThumbImage \r\n order by \r\n EventDate desc\r\n\r\nThis is my table structure in SQL Server:\r\n\r\n[![enter image description here][1]][1]\r\n\r\n [1]: _URL_0_\r\n\r\n\r\nThis is my action method and I need a linq query to return list to my view:\r\n\r\n public ActionResult Gellery()\r\n {\r\n var list = db.EventGallerys.ToList();// i need linq query here in place of this list\r\n return View(list);\r\n }\r\n\r\nThis is my model class:\r\n\r\n public class EventGallery\r\n {\r\n [Key]\r\n public int Sno {get;set;}\r\n public string ImageName { get; set; }\r\n public string ThumbImage { get; set; }\r\n public string Title { get; set; }\r\n public string Description { get; set; }\r\n public DateTime EventDate { get; set; } \r\n public string EventId { get; set; }\r\n public string GalleryType { get; set; } \r\n public string IP { get; set; }\r\n public string SubmittedBy { get; set; }\r\n public DateTime GalleryCreatedDate { get; set; }\r\n public string Status { get; set; }\r\n // Sno,ImageName,ThumbImage,Title,Description,EventDate,GalleryCreatedDate,EventId,GalleryType,Status\r\n\r\n public EventGallery()\r\n {\r\n GalleryCreatedDate = DateTime.Now;\r\n Status = \" ;Active \" ;;\r\n }\r\n }\r\n\r\nThank you in advance for your effort.", "97" ], [ "I am getting below error\r\n\r\n > The name &#39;XYZ&#39; does not exist while group by LINQ Query\r\n\r\nThis is my action method which have tried.\r\n \r\n public ActionResult Gellery()\r\n {\r\n var list = db.EventGallerys\r\n .GroupBy(eg = > new { EventId, Title, EventDate, Description, ThumbImage })\r\n .OrderByDescending(eg = > eg.EventDate)\r\n .Take(5)\r\n .AsEnumerable()\r\n .Select(eg = > new\r\n {\r\n EventId = eg.EventId,\r\n Day = eg.EventDate.ToString( \" ;D \" ;),\r\n Month = eg.EventDate.ToString( \" ;MMM \" ;),\r\n Year = eg.EventDate.ToString( \" ;yyyy \" ;),\r\n Title = eg.Title,\r\n Description = eg.Description,\r\n ThumbImage = eg.ThumbImage\r\n }).ToList();\r\n\r\n return View(list);\r\n }\r\nBelow is my error showing in image format\r\n\r\n[![enter image description here][1]][1]\r\n\r\nBelow is my requirement post yesterday but still not getting proper result.\r\n\r\n_URL_1_\r\n\r\nI also tried this query also but getting error.\r\n\r\n LINQ to Entities does not recognize the method &#39;System.String ToString(System.String)&#39; method, and this method cannot be translated into a store expression.\r\n \r\n var list = (from p in db.EventGallerys\r\n group p by new { p.EventId, p.EventDate, p.Title, p.Description, p.ThumbImage } into r\r\n select new\r\n {\r\n EventId = r.Key.EventId,\r\n Day = r.Key.EventDate.Day,\r\n Month = r.Key.EventDate.ToString( \" ;MMM \" ;),\r\n Year = r.Key.EventDate.Year,\r\n Title = r.Key.Title,\r\n Description = r.Key.Description,\r\n ThumbImage = r.Key.ThumbImage,\r\n EventDate = r.Key.EventDate\r\n }).OrderByDescending(c = > c.EventDate).ToList().Take(5);\r\n\r\n\r\n return View(list);\r\n\r\nBelow is my return view design\r\n\r\n @model List < IBAC.Models.EventGallery > \r\n @{\r\n ViewBag.Title = \" ;Gellery \" ;;\r\n }\r\n < br / > < br / > < br / > \r\n < h2 > Gellery < /h2 > \r\n\r\n\r\n @foreach (var item in Model)\r\n {\r\n < a href=&#39;@Url.Content( \" ;~/GalleryImages/ \" ; + item.ThumbImage)&#39; > \r\n < img class=&#39;thumbnail&#39; src=&#39;@Url.Content( \" ;~/GalleryImages/ \" ; + item.ThumbImage)&#39; / > \r\n < /a > \r\n\r\n }\r\n\r\n\r\n [1]: _URL_0_", "452" ], [ "List is giving correct result when return getting this error :The model item passed into the dictionary is of type &#39;System.Collections.Generic.List`1[ < > f__AnonymousType2`7[System.String,System.String,System.String,System.String,System.String,System.String,System.String]]&#39;, but this dictionary requires a model item of type &#39;System.Collections.Generic.List`1[IBAC.Models.EventGallery]&#39;., but this dictionary requires a model item of type &#39;System.Collections.Generic.List`1[IBAC.Models.EventGallery]&#39;. and also check i have update my view in question .@D-Shih", "789" ], [ "I am getting below error:\r\n\r\n > The model item passed into the dictionary is of type &#39;System.Collections.Generic.List\r\n\r\nBelow is my action method and returning correct result\r\n\r\n public ActionResult Gellery()\r\n {\r\n\r\n var list = db.EventGallerys.GroupBy(eg = > new\r\n {\r\n EventId = eg.EventId,\r\n Title = eg.Title,\r\n EventDate = eg.EventDate,\r\n Description = eg.Description,\r\n ThumbImage = eg.ThumbImage\r\n })\r\n .OrderByDescending(eg = > eg.Key.EventDate)\r\n .Take(5)\r\n .AsEnumerable()\r\n .Select(eg = > new\r\n {\r\n EventId = eg.Key.EventId,\r\n Day = eg.Key.EventDate.ToString( \" ;D \" ;),\r\n Month = eg.Key.EventDate.ToString( \" ;MMM \" ;),\r\n Year = eg.Key.EventDate.ToString( \" ;yyyy \" ;),\r\n Title = eg.Key.Title,\r\n Description = eg.Key.Description,\r\n ThumbImage = eg.Key.ThumbImage\r\n }).ToList();\r\n\r\n // var list = db.EventGallerys.ToList();\r\n\r\n return View(list);\r\n }\r\n\r\nI am not sure my view part is correct or not\r\n\r\n @model List < IBAC.Models.EventGalleryViewModel > \r\n\r\n @{ ViewBag.Title = \" ;Gellery \" ;; }\r\n \r\n < h2 > Gellery < /h2 > \r\n\r\n\r\n @foreach (var item in Model)\r\n {\r\n < a href=&#39;@Url.Content( \" ;~/GalleryImages/ \" ; + item.ThumbImage)&#39; > \r\n < img class=&#39;thumbnail&#39; src=&#39;@Url.Content( \" ;~/GalleryImages/ \" ; + item.ThumbImage)&#39; / > \r\n < /a > \r\n\r\n }\r\n\r\nbelow is my Viewmodelclass\r\n\r\n public class EventGalleryViewModel\r\n {\r\n public string EventId { get; set; }\r\n public string Day { get; set; }\r\n public string Month { get; set; }\r\n public string Year { get; set; }\r\n public string Title { get; set; }\r\n public string Description { get; set; }\r\n public string ThumbImage { get; set; }\r\n }\r\n\r\nI know error is coming from view html please help me to out this.Thank you in advance for your effort.", "343" ], [ "actually i added this app setting same as one of my old _URL_0_ web forms live working mailer. but this is mvc project so getting confused, i want to know if i will keep try catch then it will show exact error, as you telling i have to check value of gmailhost and smtclientclientpath values. @RichardHubley", "858" ] ]
49
[ 15027, 13743, 14732, 11948, 10855, 13818, 15140, 834, 17462, 6280, 12395, 12094, 294, 10371, 14547, 11011, 8919, 6822, 16189, 17666, 15771, 14750, 2304, 14425, 13155, 4850, 6736, 5221, 14673, 15028, 11102, 1944, 12029, 18719, 3511, 14475, 18890, 8214, 2572, 13010, 8777, 13546, 15063, 16192, 5491, 15134, 10481, 12532, 13112, 13482, 15354, 1019, 1797, 3340, 17225, 14300, 9246, 3590, 13640, 85, 10006, 17949, 5153, 16642, 10450, 15294, 10875, 15572, 6594, 19106, 19755, 14230, 1955, 12986, 6154, 6465, 11637, 19531, 15369, 5793, 150, 16609, 10840, 7747, 9363, 5643, 15499, 19457, 11788, 17218, 9664, 6001, 3692, 9546, 13438, 17299, 7595, 14946, 15070, 1594, 12013, 19272, 6173, 7322, 15672, 18045, 11756, 14511, 7726, 17934, 8265, 8002, 14361, 18780, 7845, 9325, 10475, 12116, 9318, 10109, 5727, 9728, 10005, 7300, 9162, 17581, 11803, 6804, 18640, 13325, 17795, 14074, 14064, 2646, 13341, 14090, 19438, 14130, 6814, 16890, 10955, 15485, 10099, 8685, 5784, 8241, 14203, 18181, 13207, 9496, 11510, 12911, 12708, 9678, 9138, 12360, 14017, 7877, 5047, 10008, 6071, 4714, 1325, 14889, 13478, 9311, 4220, 12178, 2925, 11646, 7983, 1348, 16462, 4373, 3252, 16139, 13306, 17826, 19173, 14677, 11345, 6441, 18584, 11265, 8768, 14370, 8979, 3170, 14262, 14586, 9249, 11710, 10725, 2065, 3049, 13961, 8706, 15788, 18921, 17386, 4045, 14388, 7966, 17971, 15139, 31, 9087, 9047, 11312, 604, 4541, 12358, 7964, 3037, 7533, 13402, 12648, 5737, 18283, 6474, 9710, 12779, 11456, 14462, 384, 13998, 16224, 5450, 9177, 17719, 19221, 7799, 6806, 17900, 19612, 142, 11141, 4192, 6511, 18553, 9306, 10374, 11364, 10234, 11772, 9235, 11488, 11683, 9860, 15442, 12052, 3689, 6252, 15018, 13851, 14437, 15638, 12249, 11911, 15000, 17827, 10737, 13892, 19287, 11323, 3795, 8435, 14998, 18522, 16381, 16276, 579, 2668, 15555, 8404, 11369, 4805, 13781, 607, 12886, 4933, 16426, 10082, 15535, 16908, 12603, 11296, 10477, 8171, 11870, 411, 7598, 4456, 13432, 14190, 12739, 10287, 14124, 6553, 12392, 17358, 14399, 9163, 7037, 16757, 14674, 14297, 5208, 8976, 15265, 2318, 7666, 5954, 274, 9385, 7262, 15518, 18170, 15679, 809, 5955, 17134, 18144, 7865, 18098, 11233, 11380, 5434, 2659, 5298, 19101, 4052, 8256, 13291, 16840, 12468, 7413, 13912, 5730, 10689, 9064, 12620, 16839, 2377, 11777, 14386, 15486, 16802, 12697, 19657, 14740, 14073, 1118, 15488, 13966, 7166, 13186, 17023, 17542, 9873, 9158, 2549, 11183, 14204, 3444, 4574, 13939, 11469, 17261, 16764, 16197, 16514, 8349, 11317, 4278, 12210, 16342, 13944, 16057, 9746, 11622, 745, 9508, 13559, 9051, 10448, 2706, 15166, 18078, 2222, 13397, 12940, 1456, 10062, 5568, 11915, 5465, 17783, 1058, 14860, 7094, 9125, 18051, 2738, 4573, 19660, 7762, 16151, 14642, 5708, 612, 13021, 15661, 3486, 14192, 10357, 6916, 9451, 14415, 17883, 15260, 8287, 10521, 12356, 9199, 18060, 6719, 15871, 18117, 18065, 8474, 15565, 18014, 14438, 2859, 15976, 13233, 14977, 1723, 17329, 87, 6892, 17835, 15061, 5416, 12102, 10153, 5009, 6950, 14990, 5476, 12607, 19358, 12786, 15101, 11169, 18007, 13016, 3824, 9007, 13483, 15218, 17379, 6839, 7342, 7774, 12963, 10126, 10446, 4077, 8121, 12548, 16763, 7844, 15187, 1795, 13671, 19122, 19349, 961, 15112, 11593, 5684, 16752, 4755, 13653, 7442, 17149, 16344, 11857, 7495, 7317, 14476, 3982, 11932, 15526, 3591, 18861, 5268 ]
STX_10056034.0
[ [ "I am getting this error trying to convert an image into a `CvMat`:\r\n\r\n > Error: Imencode - expected arg 0 to be a Buffer of Uint8 Values\r\n\r\nThis seems easy enough to fix, although I don&#39;t know how to convert an image into a `Uint8Array`, which is what the function is asking for. Here&#39;s my code so far:\r\n\r\n\trequest(url, function (error, response, body) {\r\n let uint8Array = new Uint8Array(body);\r\n\t\tlet imageCvMat = cv.imdecode(uintArray)\r\n\t})", "929" ], [ "I&#39;m getting the following error when attempting to process an image with `dlib`. I&#39;m using the `facial-recognition` npm package, but this is just a wrapper around `dlib`.\r\n\r\n **************************** FATAL ERROR DETECTED ****************************\r\n \r\n Error detected at line 1971. \r\n Error detected in file /Users/botvinick/Desktop/GitHub/_URL_2_. \r\n Error detected in function void dlib<IP_ADDRESS>cpu<IP_ADDRESS>tensor_conv<IP_ADDRESS>operator()(const bool, dlib<IP_ADDRESS>tensor & , const dlib<IP_ADDRESS>tensor & , const dlib<IP_ADDRESS>tensor & ).\r\n \r\n Failing expression was _URL_0_() < = _URL_1_() + 2*last_padding_y. \r\n Filter windows must be small enough to fit into the padded image.\r\n \r\n ******************************************************************************\r\n \r\n libc++abi.dylib: terminate_handler unexpectedly returned\r\n\r\nI have tried different types and sizes of images, to no avail.\r\n\r\n**Edit:** It may be important to mention that I am getting the image from a URL and converting it into a `CvImage`. Perhaps somewhere in this conversion process, the image is being truncated, but the question remains, how do I prevent this from happening?", "921" ], [ "The following function will iterate through the array twice, and if the first two items match, it will push an array containing the two items to an output array.\r\n\r\n function filterArray(arr) {\r\n var matching = []\r\n\r\n for (i in arr) {\r\n for (j in arr) {\r\n if (arr[i][0] === arr[j][0] & & arr[i][1] === arr[j][1]) {\r\n matching.push([arr[i], arr[j]])\r\n }\r\n }\r\n }\r\n\r\n for (k in matching) {\r\n matching[k] = [matching[k][0][0], matching[k][0][1], matching[k].count]\r\n }\r\n\r\n return matching\r\n }", "400" ], [ "I want to animate the transition between one root view controller and another. I could hypothetically perform a segue to the other view controller instead of switch roots, but if possible I would like to maintain the root view controller transition. Here&#39;s what I have to do this without animation. \r\n\r\n let initialViewController = UIStoryboard.initialViewController(for: .main)\r\n self.view.window?.rootViewController = initialViewController\r\n self.view.window?.makeKeyAndVisible()\r\n\r\nHow would I do this with, say, an animation where the first controller slides up and away and reveals the second one?", "735" ], [ "How can I set a User Defined Runtime Attribute in Xcode to a value associated with the object? For example, I want to set the `layer.cornerRadius` of a view to always be `size.width / 2` to round the corners. I know that if I know the size of the view, I can set it to a constant like this:\r\n\r\n[![enter image description here][1]][1]\r\n\r\nIs there a way to do this dynamically? I have tried replacing `150` with `size.width / 2` but I get the following warning:\r\n\r\n > The value “size.width / 2” is invalid.\r\n\r\n > Please provide a valid value.\r\n\r\n\r\n [1]: _URL_0_", "703" ], [ "If you are using Express, you could use Express Session, setting a session variable `req.session.sendToOnReload`, then the user reloads the page in the same session it will redirect them to this page.\r\n\r\n var url = require(&#39;url&#39;)\r\n\r\n router.get(&#39;/&#39;, function(req, res) {\r\n if (req.session.sendToOnReload === undefined) {\r\n req.session.sendToOnReload = url.format({\r\n pathname: req.session.sendToOnReload,\r\n query: req.query\r\n });\r\n res.end();\r\n } else {\r\n res.redirect(req.session.sendToOnReload);\r\n }\r\n }\r\nIn this code, when the page is first loaded, it sets the page to which the user will be redirected when they reload the page. Then, the second time the user requests the page (by reloading) the server redirects them to the page specified on the first page load.", "250" ], [ "This is similar to [this answer][1], however, I believe it could be better explained.\r\n\r\n import csv\r\n\r\n\twith open(&#39;filename.csv&#39;) as f:\r\n\t\theaders, *data = csv.reader(f)\r\n\t\toutput = {}\r\n\t\tfor firstInRow, *restOfRow in data:\r\n\t\t\toutput[firstInRow] = dict(zip(headers, [firstInRow, *restOfRow]))\r\n\t\tprint(output)\r\nWhat this does is loops through the rows of data in the file with the first value as the index and the following values in a list. The value of the index in the output dictionary is then set by zipping the list of headers and the list of values. That `output[first] = ...` line is the same as writing `output[firstInRow] = {header[1]: firstInRow, header[2]: restOfRow[1], ...}`.\r\n\r\nOutput:\r\n\r\n {&#39;4&#39;: {&#39;column1&#39;: &#39;4&#39;, &#39; column2&#39;: &#39;12&#39;, &#39; column3&#39;: &#39;5&#39;, &#39; column4&#39;: &#39;11&#39;}, \r\n &#39;29&#39;: {&#39;column1&#39;: &#39;29&#39;, &#39; column2&#39;: &#39;47&#39;, &#39; column3&#39;: &#39;23&#39;, &#39; column4&#39;: &#39;41&#39;}, \r\n &#39;66&#39;: {&#39;column1&#39;: &#39;66&#39;, &#39; column2&#39;: &#39;1&#39;, &#39; column3&#39;: &#39;98&#39;, &#39; column4&#39;: &#39;78&#39;}}\r\n\r\n\r\n [1]: _URL_0_", "288" ], [ "I believe [this post][1] is quite relevant. In short, it is not PHP, but SMTP, the thing that the PHP script passes the mail to for delivery, that is causing the delay. SMTP has some weird behavior that can cause this, the most common being [greylisting][2]. Greylisting attempts to reduce spam and prevent unverified emails by waiting for the request to be made multiple times before processing it. \r\n\r\nIf you want to send mail more quickly, I recommend using an API such as [Sendgrid][3] which has its own SMTP servers. API&#39;s tend to be a lot more reliable, fast, and much easier to work with. In general, the PHP `mail()` function is slow, and there&#39;s no way around that.\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_1_\r\n [3]: _URL_0_", "503" ], [ "This depends on how you want to redirect. You could...\r\n\r\n 1. Redirect from the client side. This is easy to do, simply add a script tag in the ` < head > ` of the page HTML document that contains the following.\r\n\r\n let excluded = [&#39;http://_URL_0_&#39;, &#39;https://_URL_1_&#39;, &#39;http://_URL_1_&#39;]\r\n\r\n if (excluded.indexOf(location.origin) !== -1) {\r\n location.href = &#39;https://_URL_0_&#39;\r\n }\r\n There is only one problem with this code, being that the browser might complain about too many redirects. The second option is safer.\r\n\r\n 2. If you know how, you could use `.htaccess`. You will find this file in the root directory of your web server. Add the following lines:\r\n\r\n RewriteEngine On\r\n RewriteCond %{HTTPS} !on\r\n RewriteRule (.*) _URL_2_{HTTP_HOST}%{REQUEST_URI}\r\n(Check out [this question][1] for more on this.)\r\n\r\n 3. If the page is not strictly static, you could redirect from the backend. There are a number of ways to do this, the most likely being to just use an npm module such as [forcedomain][2] (my personal favorite) to redirect when the request is made, rather than when the page loads. This is more efficient and the browser will not get cranky on you.\r\n\r\n 4. Use multiple CNAME records. If you aren&#39;t familiar with DNS, I would disregard this part of the answer. Basically, make a CNAME where the host is `@`, and the value is `www`. This will get all requests to the apex domain (_URL_1_) and redirect them to the subdomain (_URL_0_). When it comes to the protocol issue, there are a few ways of doing this, the best option being wildcard redirects (if your registrar provides this). \r\n\r\nAs a general rule of thumb, it&#39;s best to use DNS records, the `.htaccess` file, or some sort of backend plugin if possible for redirects if you know how. This all depends on your hosting, the nature of your website (static or dynamic), and your level of knowledge on these sorts of things.\r\n\r\n\r\n [1]: _URL_7_\r\n [2]: _URL_5_", "250" ], [ "This will bind the `focus` AND `click` events of the input field to the function. Hope this helps!\r\n\r\n < !-- begin snippet: js hide: false console: true babel: false -- > \r\n\r\n < !-- language: lang-js -- > \r\n\r\n $(&#39;#email&#39;).on(&#39;focus click&#39;, function() {\r\n $(this)[0].setSelectionRange(0, 0);\r\n })\r\n\r\n < !-- language: lang-html -- > \r\n\r\n < script src= \" ;_URL_0_;\r\n < input type= \" ;text \" ; placeholder= \" ;Enter your name \" ; autofocus > \r\n < input type= \" ;text \" ; id= \" ;email \" ; value= \" ;@website.com \" ; > \r\n\r\n < !-- end snippet -- > \r\n\r\nOr, without jQuery...\r\n\r\n < !-- begin snippet: js hide: false console: true babel: false -- > \r\n\r\n < !-- language: lang-js -- > \r\n\r\n document.getElementById(&#39;email&#39;).addEventListener(&#39;click&#39;, moveCursor);\r\n document.getElementById(&#39;email&#39;).addEventListener(&#39;focus&#39;, moveCursor);\r\n\r\n function moveCursor(event) {\r\n event.target.setSelectionRange(0, 0);\r\n }\r\n\r\n < !-- language: lang-html -- > \r\n\r\n < input type= \" ;text \" ; placeholder= \" ;Enter your name \" ; autofocus > \r\n < input type= \" ;text \" ; id= \" ;email \" ; value= \" ;@website.com \" ; > \r\n\r\n < !-- end snippet -- >", "648" ], [ "Objects are passed by reference, which means that when you add them to a set, even if they are exactly the same, they will not be the same if you check them with `===`.\r\n\r\n var a = {val1: &#39;hello&#39;, val2: &#39;there&#39;}\r\n var b = {val1: &#39;hello&#39;, val2: &#39;there&#39;}\r\n console.log(a === b) // false\r\n console.log(a == b) // false\r\n\r\nTo solve this problem, you could write something like the following, taken from [this article][1].\r\n\r\n < !-- begin snippet: js hide: false console: true babel: false -- > \r\n\r\n < !-- language: lang-js -- > \r\n\r\n var a = {val1: &#39;hello&#39;, val2: &#39;there&#39;};\r\n var b = {val1: &#39;hello&#39;, val2: &#39;there&#39;};\r\n\r\n function isEquivalent(a, b) {\r\n // Create arrays of property names\r\n var aProps = Object.getOwnPropertyNames(a);\r\n var bProps = Object.getOwnPropertyNames(b);\r\n\r\n // If number of properties is different,\r\n // objects are not equivalent\r\n if (aProps.length != bProps.length) {\r\n return false;\r\n }\r\n\r\n for (var i = 0; i < aProps.length; i++) {\r\n var propName = aProps[i];\r\n\r\n // If values of same property are not equal,\r\n // objects are not equivalent\r\n if (a[propName] !== b[propName]) {\r\n return false;\r\n }\r\n }\r\n\r\n // If we made it this far, objects\r\n // are considered equivalent\r\n return true;\r\n }\r\n\r\n console.log(a === b); // false\r\n console.log(a == b); // false\r\n console.log(isEquivalent(a, b)); // true\r\n\r\n < !-- end snippet -- > \r\n\r\nUsing this algorithm will check the actual values of the objects rather than the references.\r\n\r\n console.log(isEquivalent(a, b)) // true\r\n\r\n [1]: _URL_0_", "265" ], [ "First, set an event listener to the `browserAction.onClicked` event which accesses local storage and gets the token. You can then pass your token to your login function. The content of the event listener will work in other files, but the event listener itself will not (it needs to be running in the background to listen for the event).\r\n\r\nbackground.js\r\n\r\n chrome.browserAction.onClicked.addListener(function () { \r\n // event listener\r\n chrome.storage.local.get( \" ;token \" ;, function(items) {\r\n let token = items[ \" ;token \" ;]\r\n login(token)\r\n })\r\n })\r\n\r\n function login(token) {\r\n // login code here\r\n }", "648" ], [ "Right now you&#39;re trying to iterate over three values that don&#39;t actually make sense as parameters to the `for` loop. What you need to do is access one nested array at a time, check if that array&#39;s name is <PERSON>, and if it is, you change the salary.\r\n\r\n data = [[&#39;Ben&#39;, &#39;Manager&#39;, 3000],\r\n [&#39;James&#39;, &#39;Cleaner&#39;, 1000],\r\n [&#39;Ken&#39;, &#39;Supervisor&#39;, 2000]]\r\n\r\n for (person) in data:\r\n if person[0] == &#39;James&#39;:\r\n # change index 1 (occupation) to 1500\r\n person[1] = 1500\r\n\r\n print(data)\r\n\r\nOutput:\r\n\r\n [[&#39;Ben&#39;, &#39;Manager&#39;, 3000],\r\n [&#39;James&#39;, &#39;Cleaner&#39;, 1000],\r\n [&#39;Ken&#39;, &#39;Supervisor&#39;, 2000]]", "598" ], [ "Running `npm install face-recognition` runs fine on my mac, but when I try to do it on my Debian VM, it fails with the following error:\r\n\r\n SOLINK_MODULE(target) Release/obj.target/facerec.node\r\n /usr/bin/ld: cannot find -lX11\r\n /usr/bin/ld: cannot find -lpng\r\n collect2: error: ld returned 1 exit status\r\n _URL_0_:157: recipe for target &#39;Release/obj.target/facerec.node&#39; failed\r\n make: *** [Release/obj.target/facerec.node] Error 1\r\n make: Leaving directory &#39;/home/ben/face-rec/node_modules/face-recognition/build&#39;\r\n gyp ERR! build error \r\n gyp ERR! stack Error: `make` failed with exit code: 2\r\n gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)\r\n gyp ERR! stack at emitTwo (events.js:126:13)\r\n gyp ERR! stack at ChildProcess.emit (events.js:214:7)\r\n gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)\r\n gyp ERR! System Linux 4.9.0-6-amd64\r\n gyp ERR! command \" ;/usr/bin/node \" ; \" ;/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js \" ; \" ;rebuild \" ;\r\n gyp ERR! cwd /home/ben/face-rec/node_modules/face-recognition\r\n gyp ERR! node -v v8.11.3\r\n gyp ERR! node-gyp -v v3.7.0\r\n gyp ERR! not ok \r\n npm WARN face-rec@1.0.0 No repository field.\r\n \r\n npm ERR! code ELIFECYCLE\r\n npm ERR! errno 1\r\n npm ERR! face-recognition@0.9.3 install: `node-gyp rebuild`\r\n npm ERR! Exit status 1\r\n npm ERR! \r\n npm ERR! Failed at the face-recognition@0.9.3 install script.\r\n npm ERR! This is probably not a problem with npm. There is likely additional logging output above.\r\n \r\n npm ERR! A complete log of this run can be found in:\r\n npm ERR! /home/ben/.npm/_logs/2018-07-15T19_28_00_238Z-debug.log\r\n\r\nI think the key parts are lines 2 and 3, the parts about `ld` not being able to find `-lX11` or `-lpng`. This is easily solved on a mac by installing Xquartz, but a workaround seems impossible on a Linux server. Any ideas?", "46" ], [ "My app needs `cmake`, `libx11-dev` and `libpng-dev` to build. I came across [this documentation][1], which leads me to believe that I can list these as dependencies for my app to run on the Google App Engine platform, although I cannot figure out how. I was successfully able to run my app in a Compute Engine instance, although this is costly and, if I&#39;m not mistaken, unnecessary. How do I get the packages listed at the beginning of the question installed beyond session end?\r\n\r\n\r\n [1]: _URL_0_", "483" ], [ "Here&#39;s a simple algorithm that will check for the word &#39;hey&#39; and add a comma after it:\r\n\r\n def format(string):\r\n # get list split by spaces\r\n parsed_string = string.split(&#39; &#39;)\r\n i = 0\r\n for word in parsed_string:\r\n # check if word is &#39;hey&#39;\r\n if word == &#39;hey&#39;:\r\n # add a comma\r\n parsed_string[i] = &#39;hey,&#39;\r\n i += 1\r\n return &#39; &#39;.join(parsed_string)\r\n \r\n sentence = &#39;hey how are you&#39;\r\n print(format(sentence))\r\n\r\nOutput:\r\n\r\n hey, how are you", "296" ], [ "I seem to remember having the same problem on my first Raspberry Pi. Try running `sudo apt-get install xsel`. You can read about what this does [here][1], but essentially it&#39;s a clipboard utility that Pyperclip can use.\r\n\r\nIf this doesn&#39;t work it probably has something to do with the fact that you&#39;re trying to do this over SSH, but that shouldn&#39;t necessarily be an issue.\r\n\r\n\r\n [1]: _URL_0_", "708" ], [ "I want to change a user&#39;s current working directory when they run a Python script. For example, if I have the following script called `_URL_0_`:\r\n\r\n import os\r\n os.chdir(&#39;Desktop&#39;)\r\n\r\nI want to be able to do this:\r\n\r\n $ pwd\r\n /Users/me\r\n $ python _URL_0_\r\n $ pwd\r\n /Users/me/Desktop\r\n\r\nI know that `os.chdir(path)` changes the working directory *during the runtime*, but it resets when the script exits. Is there any way to prevent this?", "227" ], [ "Your manifest must request permission to access the current page by URL as well as just the current tab. Update your permissions to the following:\r\n\r\n \" ;permissions \" ;: [\r\n \" ;activeTab \" ;,\r\n \" ;*://*/* \" ;\r\n ],\r\n\r\nThis will allow the extension to access any page. I would also recommend changing `name` to `id`. This will prevent any confusion in the future. You would do this as follows:\r\n\r\n < input type= \" ;submit \" ; id= \" ;commit \" ; value= \" ;add to basket \" ; class= \" ;button \" ; > \r\n\r\nThen for background.js:\r\n\r\n chrome.browserAction.onClicked.addListener(function() {\r\n chrome.tabs.executeScript({\r\n code: \" ;document.getElementById(&#39;commit&#39;).click(); \" ;\r\n });\r\n });\r\n\r\nYou&#39;ll notice I also removed the specificity of the tab that you had in your question. This is not necessary.", "648" ] ]
191
[ 11309, 6615, 18103, 9635, 18843, 12261, 6991, 8676, 4178, 12637, 12710, 956, 10638, 15319, 15965, 199, 6733, 15365, 3080, 210, 14580, 12574, 10483, 6068, 17574, 275, 1985, 13589, 16180, 13284, 16658, 12965, 7140, 17986, 18068, 17725, 13759, 14290, 675, 9040, 10504, 13655, 8218, 8444, 5487, 16844, 13333, 17140, 12928, 16509, 8068, 6188, 8943, 13737, 8970, 15892, 9991, 18876, 12794, 14472, 10729, 6796, 18975, 6019, 13329, 4074, 1573, 17505, 15168, 7906, 2676, 11450, 9570, 2632, 7032, 8883, 2035, 15122, 7842, 17910, 6225, 2557, 6609, 7664, 17936, 11126, 12949, 7498, 9366, 7835, 6437, 18549, 10266, 16386, 12184, 9429, 11786, 8486, 11924, 14703, 14112, 9960, 16810, 7599, 6027, 8975, 16537, 2498, 12913, 2305, 19094, 1546, 3954, 19291, 19703, 17288, 5432, 982, 18819, 13846, 8409, 17466, 5867, 3990, 3941, 12851, 10262, 18167, 14056, 18591, 20, 9359, 10642, 16755, 2491, 2296, 14169, 1641, 10359, 8091, 19372, 792, 15013, 978, 2792, 1446, 9278, 12010, 17327, 17646, 3400, 5073, 1618, 15078, 10997, 10291, 5250, 15338, 13692, 2385, 14905, 5235, 10453, 13295, 17159, 3752, 13666, 6899, 1581, 3722, 16062, 12406, 15974, 11567, 17655, 16822, 3940, 5735, 10436, 1731, 12945, 16895, 17289, 222, 7301, 18239, 9253, 11163, 2169, 6429, 13255, 8561, 5067, 2482, 4275, 6168, 1054, 8620, 6531, 8131, 11407, 18214, 18929, 12061, 8485, 8763, 14088, 16106, 4269, 14341, 5442, 15331, 14187, 8783, 1412, 19744, 13884, 15492, 14872, 14324, 6866, 14855, 18454, 18114, 10588, 5011, 3735, 7805, 1742, 8741, 14543, 4657, 18126, 779, 11442, 7678, 3125, 1153, 16418, 7558, 9020, 16621, 17922, 16436, 6158, 12307, 4621, 4871, 10856, 5891, 13451, 18111, 16058, 839, 13446, 17948, 19601, 14275, 18665, 13206, 8609, 17270, 6986, 2121, 15950, 7353, 8525, 9010, 4381, 2001, 352, 471, 5165, 3973, 17245, 15174, 11495, 11409, 1082, 10124, 19045, 11017, 6934, 18678, 6860, 14236, 10833, 17753, 15334, 5776, 2164, 5917, 3108, 8315, 2649, 7542, 10198, 8819, 2486, 5874, 12706, 3253, 10341, 7345, 13913, 13474, 9724, 17223, 12271, 9406, 2669, 12730, 5825, 19195, 1514, 1892, 12680, 10078, 9817, 935, 15324, 2634, 12079, 10635, 235, 8211, 10096, 5459, 4632, 1316, 6050, 6264, 13399, 13125, 7797, 7732, 981, 5516, 12456, 8764, 15820, 17188, 2563, 4891, 17375, 1320, 13462, 11263, 8132, 10161, 17748, 10464, 8613, 12627, 18502, 16634, 15858, 5569, 4007, 17119, 12797, 19348, 17426, 7859, 12154, 9595, 10211, 5114, 10487, 14448, 14307, 12007, 3723, 7730, 15108, 5916, 9743, 2544, 13227, 9417, 17828, 19306, 3593, 15453, 13215, 13534, 14264, 5526, 14787, 6873, 12365, 5071, 15066, 15181, 15569, 4694, 13158, 5427, 7880, 13190, 9379, 4893, 13064, 1516, 12370, 564, 9307, 5039, 14394, 3663, 10885, 6047, 15416, 18701, 8496, 18586, 13527, 8686, 9298, 1553, 4631, 14028, 19341, 17498, 2190, 8072, 14539, 15124, 6884, 5455, 12849, 11632, 11912, 6990, 19359, 10900, 16227, 11349, 11490, 13586, 17890, 18854, 10606, 17392, 14181, 8156, 8252, 18534, 8032, 7093, 17056, 18414, 12667, 10368, 17506, 13657, 14666, 4309, 7551, 13141, 18038, 16571, 2844, 15042, 15431, 11113, 48, 109, 13982, 15631, 14923, 10147, 10586, 9791, 1515, 12812, 13963, 8973, 10094, 11954, 17460, 13274, 4823, 5198, 18376, 6545, 6258, 13809, 15770, 489, 6077, 17373, 11576, 12793, 3114, 16346, 12141, 2715, 6813 ]
STX_10057.0
[ [ "I&#39;m currently doing a research on the ToBI system (a system for transcribing prosody). The ToBI system is a phonological based system and does not show the variance in speech. for instance an L+H% transcribing two sentences in ToBI system, may be dramatically different since in one sentence the frequency change might be higher than the other. Having said that, I would like to know if there has been any solutions or any endeavors for solving the weakness of ToBI in showing the frequency variance in speech.\r\n\r\nPS. I&#39;m aware of systems like IViE (<PERSON>, 1998) and INTSINT (<PERSON>, 1998) but I would like to work on the ToBI system in particular. \r\n\r\nPS2. I want to know why don&#39;t we show frequency variance in speech in ToBI system?\r\n\r\nEDIT:\r\nI will add two sample pitch tracks for two separate recordings.\r\n[![pitch track number 1 shows an utterance. the boundary tone is an H+L%][1]][1] \r\n\r\n\r\npitch track number 1 shows an utterance. the boundary tone is an H+L%\r\n\r\n[![pitch track number 2 shows an utterance. the boundary tone is an H+L%][2]][2]\r\npitch track number 2 shows an utterance. the boundary tone is an H+L%\r\n\r\n\r\nNow this two pitch tracks are for giving intuition only they may not be exactly the same but I hope you get the point. \r\n\r\n\r\nThanks.\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "588" ], [ "@musicallinguist by variance I meant the **frequency variance in speech**. I didn&#39;t mention \" ;different in nature \" ; but I said dramatically different by which I meant the two utterance were different in term of tone. \nanyhow to clarify my objectives for this question I must say there are two goals (1) to implement an add-on for ToBI to show the differences in frequency (2) `I don&#39;t personally know if this question is novice or good BUT` to conduct a study on the time domain (duration) of the utterance on the tone (for example how the tone changes if the duration of the utterance is increased.", "588" ], [ "Besides the answers above you might as well take a look at the _URL_0_\r\n\r\n\r\n----------\r\nThe Library of Babel is a place for scholars to do research, for artists and writers to seek inspiration, for anyone with curiosity or a sense of humor to reflect on the weirdness of existence - in short, it’s just like any other library. If completed, it would contain every possible combination of 1,312,000 characters, including lower case letters, space, comma, and period. Thus, it would contain every book that ever has been written, and every book that ever could be - including every play, every song, every scientific paper, every legal decision, every constitution, every piece of scripture, and so on. At present it contains all possible pages of 3200 characters, about 104677 books.\r\n\r\nSince I imagine the question will present itself in some visitors’ minds (a certain amount of distrust of the virtual is inevitable) I’ll head off any doubts: any text you find in any location of the library will be in the same place in perpetuity. We do not simply generate and store books as they are requested - in fact, the storage demands would make that impossible. Every possible permutation of letters is accessible at this very moment in one of the library&#39;s books, only awaiting its discovery. We encourage those who find strange concatenations among the variations of letters to write about their discoveries in the forum, so future generations may benefit from their research.", "947" ], [ "Aside from @user6726&#39;s answer this is my personal view:\r\nPhonetic transcription is based on human&#39;s articulation (as human&#39;s produce for this case you can say for example the /k/ sound is palatal but do cats use hard palate to produce sounds?!) Imagine a hypothetical creature that makes a sound like modem&#39;s ``(actually old dial-up modems)`` sound. we would transcribe that sound in a way that our mind hears it like it&#39;s language. for better understanding you can have this in mind that in languages like Persian the cat&#39;s meow is transcribed as ``/miu:/`` (not sure if I transcribed it correctly but it&#39;s long /u/) having said that you first have to see how the cat articulates this sound (you could use MRI or cameras) then you have to see how the cat produces it and then you can assign a symbol for it.\r\n\r\n \r\n**BUT** there is another assumption in question: Can we use IPA for transcribing cat&#39;s sounds? YES. but it might and will cause a lot of confusions. Do cat&#39;s use the same manner of articulation as humans do?\r\n\r\n**Further Reading:**\r\n\r\n - <PERSON>, J.E. and <PERSON>. Neural and mechanical mechanisms of feline purring. Respiration Physiology, v. 16, December 1972: 351- 361.\r\n - <PERSON>, <PERSON>. Why do cats meow? New York, Dial Books for Young Readers, c2001. 46 p. (juvenile).\r\n - Frazer-Sissom, <PERSON>, <PERSON>, and <PERSON>. How cats purr. Journal of zoology: proceedings Zoological Society of London, v. 223, January 1991: 67-78..\r\n - <PERSON>, <PERSON> and <PERSON>. Functional neural pathways for vocalization in the domestic cat. In Physiological control of mammalian vocalization. Edited by <PERSON>. Plenum Press, New York, London, c1988: 21-41", "202" ], [ "As we know the ToBI system is designed to transcribe prosody and within it you can transcribe only High and Low prosody changes. The question is here ``Why don&#39;t we implement frequency change and/or duration in ToBI system?``\r\n\r\nFor instance we can add numerical value (like 50H%) to show that the H in this utterance is +50 Hz. \r\n\r\nMy questions are:\r\n\r\n 1. Is it plausible?\r\n 2. Is there any use in doing so?", "677" ], [ "I was surfing the side-links today and came across an [answer][3] that had been edited to replace a word with another which, according to the comments relating to the edit, was intended to be a less problematic equivalent. The comments indicated that the word violated the [ \" ;no bigotry \" ; rule][1]:\r\n\r\n > **Bigotry of any kind.** Language likely to offend or alienate individuals or groups based on race, gender, sexual orientation, religion, etc. will not be tolerated. At all. (Those are just a few examples; when in doubt, just don&#39;t.)\r\n\r\nThe word in question *(obscured to preserve delicate sensibilities)* was:\r\n\r\n > ! twat\r\n\r\nThe sense of the usage was: [a foolish or despicable person][2]\r\n\r\nI tried to discuss this with the moderator who had made the change, with a nod towards the fact that it is quite likely that my perception of the word is quite different. [He sent me here][4].\r\n\r\nFrom my view there is nothing about the word which contravenes the \" ;no bigotry \" ; rule. The specific usage of the word is gender neutral and does not touch on race, sexual orientation, religion or any other individual or group designation. Obviously this is not true of whichever culture the mod is from.\r\n\r\nTo further complicate things, the word was replaced with \" ;Jerk \" ; which - in the culture I was raised in - is a term applied exclusively to males and is generally considered to be a crude abbreviation for a particularly male activity. By definition then it is gendered and in contravention of the rule in question.\r\n\r\nNot that I have a problem with either word, I honestly don&#39;t. But since the given reason for the change was to correct a violation of a rule, I find it a little concerning that the replacement is a much more apparent violation of that rule *by the definitions of my culture*. If we&#39;re going to moderate away one, why not both?\r\n\r\nOr better yet: *neither*.\r\n\r\nI am not advocating for a complete lack of manners in questions, answers or comments. I&#39;m not asking to be able to use the common abbreviation of pusillanimous in my descriptions, since that one is mistaken as gendered fairly universally. Nor am I insisting that all discussion be carried out in carefully neutered words to ensure that no possibly offense can be taken from any of them.\r\n\r\nWhat I&#39;m concerned about is that petty words of neither impact nor importance are being treated as bigotry, regardless of intent or cultural considerations. I&#39;m hoping that I&#39;m not the only one that finds this to be concerning.\r\n\r\nDo we need better definitions as to what words are bad and banned, or could we perhaps put out a few of the fires on the censor ship?\r\n\r\n\r\n\r\n\r\n[1]: _URL_0_\r\n[2]: _URL_3_\r\n[3]: _URL_1_\r\n[4]: _URL_2_", "818" ], [ "I disagree that \" ;name calling \" ; is correct, and that the word used was worse because it was used to describe a female. Do you object as strongly when a male is called a dick on the site? I see numerous instances of this behavior, none of which appear to have been flagged for moderation or otherwise interfered with. Where is the difference? Are we constrained to only allowing insulting language that references male characteristics and activity, never female? Is that not hypocritical?", "734" ], [ "So the fact that a word derived from exclusively male masturbatory practice is acceptable *in some other usage* - which derives ultimately from the same original meaning - makes it OK, just as a synonymous word for that usage which also means male genitals appears to be considering the lack of moderation of that word... and yet another synonym which happens to also be slang for female genitalia is somehow not OK. This appears to be a massive double standard. We can use male-derogative but not female-derogative words?", "818" ], [ "@BESW I think this is a more complex issue than that. Perhaps my rhetorical style is clouding the issue, and if so I apologize. By highlighting the inconsistency I&#39;m trying to convey that this sort of word substitution is... well, silly. I&#39;m also trying to do this with words that aren&#39;t my first choice, because apparently my first choices might be cause for moderation.", "734" ], [ "@SevenSidedDie I&#39;d really like it if your comments didn&#39;t disappear. I was going to reply when I noted other pending updates and refreshed the page... and couldn&#39;t find your comment. I get that we occasionally write things that on reflection we wish we hadn&#39;t, but I&#39;d rather you write a retraction than simply pull the comment. All I have now is a sense that you were telling me not to bother trying to get people to lighten up on censorship here... and no way to re-read to confirm. Was it something along those lines?", "494" ], [ "@KorvinStarmast Search the site for \" ;Don&#39;t be a dick. \" ; It&#39;s a common statement used to advise people to not engage in certain types of negative behavior. And it&#39;s a perfectly acceptable statement in the gaming community, especially as it has a history of geek cred. Are we going to slash that history to ribbons just to satisfy some narrow interpretation of bigoted language? Or are we going to admit that there are times when that definition is too narrowly applied?", "734" ], [ "<PERSON> OK, so if I claim to be offended by something then that thing should automatically be censored from the site? Wow. I find censorship of words that are neither intended for nor commonly used to give offense when that censorship is based on the meaning of other usages of said words to be *highly* offensive. Now does that mean that the entire moderation team needs to cater to my feeling of being offended? And if not, why not?", "734" ], [ "@SevenSidedDie Not quite. My point is that both words are potentially offensive, but that they are evaluated inconsistently. Ideally I would have neither of them forbidden when used in context and with intent that does not breach the code of conduct. What I don&#39;t want is for us to have to censor ever word, just in case some Russian-speaker happens to see the word \" ;yep \" ; or something.", "734" ], [ "@LegendaryDude Nice sanitary etymologies are nice, but not always accurate. Sadly there were no jerk-water towns in my country that could have been the origin of such a term, but even if there were the usage remains clear: one who jerks off. As the Brits would say, a wanker. Language evolves, and clean etymology doesn&#39;t defend the common abbreviated form of pusillanimous.", "818" ], [ "The BSC got rolled into another body which no longer bothers to perform such research. Now they just tell broadcasters to not use the 3 or 4 most horrible without damned good reason, and never before 9pm. Offensiveness of words is judged on a case-by-case basis when complaints are received. Broadcasters have their own lists of words but have actively refused to reveal those when asked.", "734" ], [ "You can either downmix it to mono, or delete one channel. choosing one over the other depends on your situation. if your channels are identical you can delete one, if your channels are not identical you can downmix them in one channel so that you will not lose any data.\r\n\r\nTo downmix your audio in Praat go to ``Convert - Convert to mono``\r\n\r\nTo extract one channel, and obviously delete the other one go to ``Convert - Extract one channel``", "361" ], [ "Even in RTL languages you are still writing numbers and numbers are LTR so when writing numbers we should treat them as LTR so ``-10&#176;C`` is the correct way.\r\n\r\n\r\nConsider the following example from Persian:\r\n\r\n``هوا نزدیک 10- بود``\r\n\r\n``The temperature was nearly minus 10 degrees``\r\n\r\n\r\n**UPDATE:**\r\n\r\nmost of the mathematical abbreviations are written exactly as they are written in Latin languages. \r\nfor instance: \r\n\r\n[![pic1][1]][1]\r\n\r\n`` The speed of the car was 20 kilometers per hour``\r\n\r\nOr we can use both method like writing half of the abbreviation in Latin and the other half in Persian:\r\n\r\n[![enter image description here][2]][2]\r\n\r\n\r\nEDIT 2:\r\n\r\n[![enter image description here][3]][3]\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_1_\r\n [3]: _URL_0_", "603" ], [ "To my knowledge as of now there is no united way of transcribing prosodic features of language; however the need for one is critical and therefore there are several meetings being held for designing IPrA (internation prosodic alphabet) [(ucla page for the description of the meetings)][1]\r\n\r\nThis proposal is going to transcribe prosodic events at the \" ;categorical phonetic \" ; level of AM. For more details you can visit [BU page for the meetings][2]\r\n\r\nAlso you can see my question [here][3]\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_0_\r\n [3]: _URL_1_", "421" ], [ "On what aspects Tonal languages differ from Intonation languages when analyzing them acoustically? \r\n\r\n\r\n > **On intonation and tone**: <PERSON> (1960) - \" ;the variations which take place in the pitch of the voice in connected speech, i.e. the variations in the pitch of the musical note produced by vibration of the vocal cords. \" ;\r\n\r\n > Unlike lexical tone (as in tone languages), changing intonation does not change the lexical identity/meaning of individual words, though it may alter the meaning of the sentence as a whole.\r\n\r\n > Pitch accent languages (e.g. Japanese, Swedish) used to be regarded as an intermediate case: superficially like lexical tone languages, but phonologically pitch functions like stress in these languages. In most stress-accent languages, pitch is an important correlate of stress, so the dividing lines between tone, stress and pitch-accent are fuzzy. \r\n\r\n > [*_URL_0_][1]\r\n\r\nPersonal note for further info: I guess that in tonal languages you don&#39;t see any gradual pitch change when analyzing different sentence types, is that true?\r\n\r\n\r\n [1]: _URL_1_", "202" ], [ "The first and the second one are old scripts, and consequently orthography and spelling, and therefore has the /hamza/ the third one is the simpler one (and in the tanzil website under `Quran` tab you can select the type of text and as you will see it has been set to \" ;simple \" ;.\r\n\r\nThe older text of Quran from the above is probably Medina Mushaf (if I&#39;m not mistaken).\r\n\r\n > The Medina Mushaf (officially: Mushaf al-Madinah an-Nabawiyyah, Arabic: مصحف المدينة النبوية) is an authentic copy of the holy quran printed by King Fahad Complex for Printing of the Holy Quran [1]. The Complex publishes the holy quran according to three famous narration, i.e., <PERSON>, <PERSON>, and Ad-Duriyy.\r\n\r\n > _URL_0_\r\n\r\nThe <PERSON> details on Quran scripts are:\r\n\r\n - Simple: Quran text in Imlaaei script (this is the default text).\r\n - Simple Plain: Simple text without special demonstration of Ikhfas and Idghams.\r\n - Simple Minimal: Simple text with minimal number of diacritics and symbols.\r\n - Simple clean: Simple text with no diacritics or symbols.\r\n - Uthmani: Uthmani text, according to Medina Mushaf.\r\n - Uthmani Minimal: Uthmani text with minimal number of diacritics and\r\n symbols.", "664" ], [ "You can take a look at this corpus at Linguistic data consortium: _URL_0_\r\n\r\n > The ARRAU (Anaphora Resolution and Underspecification) Corpus of Anaphoric Information was developed by the University of Essex and the University of Trento. It contains annotations of multi-genre English texts for anaphoric relations with information about agreement and explicit representation of multiple antecedents for ambiguous anaphoric expressions and discourse antecedents for expressions which refer to abstract entities such as events, actions and plans.\r\n\r\n > The source texts in this release include task-oriented dialogues from the TRAINS-91 and TRAINS-93 corpora (the latter released through LDC, TRAINS Spoken Dialog Corpus LDC95S25), narratives from the English Pear Stories (a collection of narratives by subjects who watched a film and then recounted its contents), articles from the Wall Street Journal portions of the Penn Treebank (Treebank-2 LDC95T7) and the RST Discourse Treebank LDC2002T07, and the Vieira/Poesio Corpus which consists of training and test files from Treebank-2 and RST Discourse Treebank.\r\n\r\n > LDC Catalog No.:\tLDC2013T22\r\n\r\nAnd also take a look at this: _URL_1_", "307" ], [ "I personally think that a web TeX renderer that uses SVG (like what Mathematics SE has) will work because:\r\n\r\n **1)** you can type with your normal QWERTY keyboard, it even works on handheld devices.\r\n\r\n **2)** No need for special programms and installations. It requires less work. And it&#39;s easy. Same can be done for vowel charts, tree diagrams etc.", "971" ], [ "MathJax is not useful in linguistics purposes per se but it&#39;s a good example of how web display engines can be worked to fulfill special needs of a discipline. We, linguists can develop engines like MathJax for our needs; drawing tree diagrams, and IPA charts to name a few.", "884" ], [ "At first let&#39;s review your method: You are going to generate an essay based on semantically related words, that&#39;s not enough for an essay to be coherent. It would be [context-free grammar][1]. Within the scope of CFG: Yes, you can and as your professor mentioned it only takes several weeks (if you need to prepare noun list, programming issues etc.). A well known example of this method is [SCIgen][2] By <PERSON> et al. \r\n\r\nAs you specifically mentioned ``...for a constrained \" ;context \" ;`` which I presume you want an essay to be meaningful not just gibberish generated by algorithms then you should consider other methods like [N-gram based text generation][3] and [Neural network][4]\r\n\r\nIn conclusion, to answer question (a) I must say what is your definition of \" ;correct \" ;? by all means it&#39;s a working method but is it the best-working method? or the most efficient? You can&#39;t say, currently there are some better methods for generating meaningful textual data; For CFG this is an approach that works.\r\n\r\nFor a general plan regarding CFG you must first choose your subject, Nature or beach; what are specific vocabulary related to these essays? Simple analyze those specific essays by programs like [AntConc][5] and [Wordsmith][6] add them to a list (By the way you can use the data in SCIgen&#39;s Github page at [here][7]). write the code in a language you&#39;re familiar with. There you go.\r\n\r\nFor [deep] Neural-network or N-gram models you need a large corpus of essays (specially for DNN and NN you need very large corpora) and analyze them by code like [this][8] which is python.\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_2_\r\n [3]: _URL_1_\r\n [4]: _URL_3_\r\n [5]: _URL_6_\r\n [6]: _URL_7_\r\n [7]: _URL_4_\r\n [8]: _URL_5_", "421" ], [ "If your want a user-friendly program to use on the go you can check [Cmaptool][1] from good people at the Florida Institute for Human & Machine Cognition (IHMC) it&#39;s really easy to use straight forward and you can export your data to variety of extensions.\r\n\r\n[![enter image description here][2]][2]\r\n\r\nIf you TeX you can use [qTree][3] package from CTAN.\r\n\r\n \\Tree[.IP [.NP [.Det \\textit{the} ]\r\n [.N\\1 [.N \\textit{package} ]]]\r\n [.I\\1 [.I \\textsc{3sg.Pres} ]\r\n [.VP [.V\\1 [.V \\textit{is} ]\r\n [.AP [.Deg \\textit{really} ]\r\n [.A\\1 [.A \\textit{simple} ]\r\n \\qroof{\\textit{to use}}.CP ]]]]]]\r\n\r\nThe above code (from [here][4]) will produce the below:\r\n\r\n``(Although it is used to make syntax trees but still you could use it for Language family trees)``\r\n\r\n[![enter image description here][5]][5]\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_3_\r\n [3]: _URL_1_\r\n [4]: _URL_4_\r\n [5]: _URL_2_", "153" ], [ "Take a look at below:\r\n\r\n\r\nDeep Linguistic Analysis for Topic-level Analysis\r\n\r\nBitext’s API uses Deep Linguistic Analysis based on grammars, which allows for opinion analysis not only at the sentence level, but also at the phrase level within the sentence. This is possible because the syntactic analysis identifies the different phrases (noun phrases, adjective phrases, verb phrases etc) and their dependencies.\r\n\r\nThe sentiment analysis service is not limited to extracting a single opinion per sentence. It can actually detect as many opinions as the sentence contains. For example in the sentence “This phone is awesome, but it was much too expensive and the screen is not big enough”, three opinions will be extracted: “phone” + “awesome”, “phone” + “much too expensive” and “screen” + “not big enough”.\r\n\r\nThe service can therefore perform topic detection:\r\n\r\nan entity (brand/person/product/place…)\r\na concept (like “global warming”, “public policies” or “financial crisis”).\r\nand detect exactly which features or attributes of the topic are being discussed.\r\nDeep Linguistic Analysis accurately handles complex structures like negation: “their new camera is really not bad at all”.\r\n\r\nThe sentiment analysis service handles complex language structures which play a major role in sentiment analysis, such as negation or comparative sentences. Deep Linguistic Analysis automatically handles these structures and can capture the difference between opinions like:\r\n\r\n\r\n\r\n“This phone is much better than my old phone.” – Positive\r\n\r\n“This phone is not much better than my old phone.” – Negative\r\n\r\n\r\n - _URL_1_\r\n\r\n\r\nAlchemyAPI helps developers and businesses build cognitive applications through text analysis and deep learning.\r\n\r\n - _URL_0_", "421" ], [ "To make it explicit, Consider the following sentence:\r\n\r\n > \" ;Hey, How you doin&#39;? \" ;\r\n\r\nIn Semantics the sentence just asks about how the other person is doing, Or how he/she feels etc. But pragmatics says that if a guy (joey!) tells this sentence to a female, it means that he might be hitting on her. In another view Semantics is affected by the meaning of the sentence in whole but Pragmatics is more or less affected by the socio-cultural variables.", "469" ], [ "There are 3 steps in doing this task:\r\n\r\n 1. Identifying the languages in webpages\r\n 2. Building a crawler that downloads the web page\r\n 3. Doing linguistics analysis\r\n\r\n``since my primary NLP language is python and there are a lot of NLP libraries written for Python we use Python here.``\r\n\r\n\r\nFor identifying the language you can use some great language identifiers like [this][1] (based on Google&#39;s language-detection) and [this][2] (Based on guesslanguage.cpp by <PERSON>).\r\n\r\nThe second step is rather tricky. It&#39;s actually called ``Web Scraping``, you can read some great tutorials on web scraping [here][3] and [here][4] (Scrapy).\r\n\r\nFor the last step you use different snippets for concordances based on NLTK at [here][5]. Other things like word frequency etc. can be used easily via NLTK library.\r\n \r\n\r\n\r\n [1]: _URL_3_\r\n [2]: _URL_0_\r\n [3]: _URL_2_\r\n [4]: _URL_1_\r\n [5]: _URL_4_", "421" ], [ "The number you get in ``Query --- > Get Intensity...`` is the mean intensity of the sound which for the sound file I have is ``81.<PHONE_NUMBER> dB`` when I open the sound file in ``View and edit`` and select the whole sound file I will approximately get the same number:\r\n[![enter image description here][1]][1]\r\n\r\nThe windows showing spectrum analysis :\r\n[![enter image description here][2]][2]\r\n\r\nAs an alternative you can also select ``Spectrum --- > View Spectral Slice (Ctrl + L)`` to open a windows showing the intensity in dB.\r\n\r\n[![enter image description here][3]][3]\r\n\r\n\r\nSo why are they different?! \r\n\r\nImage number 2 shows the intensity of the sound in dB which the quietest is ``0`` and the loudest (in our recording is 63)\r\n\r\nImage number 3 shows the relative amount of noise in your recording so for example the loudest noise in your recording will be marked as ``0`` and the lowest, obviously, will be negative. You can read more about A-Weighting [here][4].\r\n\r\nLastly about the image number one. I really cannot understand what it is (by looking at it) but I presume it&#39;s some sort of scaling dB. \r\n\r\n < i > There was a mathematical review of the Praat&#39;s functions which I cannot find it right now. < /i > \r\n\r\n**EDIT:**\r\nIn general if you want to report the SNR in a research it&#39;s safer to report it in A-Weighting (Image number 3) it&#39;s more natural to grasp and easier to understand **but** if you are going to report the sound intensity in particular (for example you want to report that speakers of a certain language like Arabic speak louder than other speakers of let&#39;s say French) you can use dB. In the end it&#39;s up to you.\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_\r\n [3]: _URL_2_\r\n [4]: _URL_3_", "588" ], [ "Doing phonetics analysis is broad term, you should first mention what type of phonetics analysis you are looking for and how is your level of programming. \r\n\r\nFor the first question we will go into FFT only since it&#39;s an algorithm that is fundamental (you can manually check the formants, frequency etc.). If you are not familiar with FFT the simplest definition is that it converts sound waves to frequency-time patterns (you can read more at [here][1]). There are numerous FFT packages written for [Python][2], and [C++][3]\r\n\r\nThere are some great tutorials on realtime signal processing at [here][4], and [here][5].\r\n\r\n\r\n\r\n\r\n [1]: _URL_3_\r\n [2]: _URL_2_\r\n [3]: _URL_4_\r\n [4]: _URL_1_\r\n [5]: _URL_0_", "677" ], [ "You can&#39;t use the `standard f0 analysis`. There&#39;s no such thing as standard. You need a framework e.g. **Autosegmental-meterical Phonology (AM)**\r\n``supposing you are going to work in the phonological category``\r\n\r\nBut again this is when you are going to do a scientific study for a non-scientific observation you can take guess by looking at the pitch track but it&#39;s not scientific.\r\n\r\n**About prosodic transcription systems:**\r\nActually ToBI is not the only system for transcribing prosody. There numerous systems within different frameworks available: INTSINT (<PERSON>, 1998), IViE (<PERSON>, 1998), Tilt (<PERSON>, 1998), RFC (<PERSON>, 1994)...\r\n``ToBI is one of them``\r\n\r\nThe advantages of ToBI over other systems like INTSINT are as follow:\r\n\r\n 1. **ToBI is easy to learn**\r\n \r\n One can easily learn ToBI you don&#39;t need special guides. only two letters ``H`` and ``L`` which if you happened to be familiar with AM Phonology you have seen them in other systems (in INTSINT). Some special characters like ``%`` and ``*`` need to be interpreted before using and that&#39;s easy supposing you have an understanding of AM phonology.\r\n 2. **ToBI is easy to use**\r\n \r\n You can use ToBI right away, no need for special calcuations, no need for usage of other formulae. It&#39;s straight.\r\n 3. **ToBI is easy to read**\r\n\r\n Even if your first time looking at a ToBI transcription you can easily guess what are the transcriptions and you can read them easily.\r\n\r\nThe disadvantages of the ToBI system:\r\n\r\nWell, you can&#39;t always say that the easiest method is the best one. We still don&#39;t know what parts of prosody do we need so that we can throw away the others. ToBI is a system which neglects tremendous amount of prosodic data and that&#39;s not right.\r\n\r\nIn the end it&#39;s up to you to choose whatever works for you. But when talking about prosodic data, you have to be careful.", "677" ], [ "There is a book named: ``BASIC MALTESE GRAMMAR`` by ``<PERSON>``. \r\n\r\n < i > I don&#39;t know if I&#39;m allowed to put the link here. The version I have doesn&#39;t seem to have any publication name or copyrght signs. maybe moderators can help me through this. < /i > \r\n\r\nAnother book, freely available, is ``TEACH YOURSELF MALTESE`` A course of maltese for beginners:\r\n\r\n > TEACH YOURSELF MALTESE. A COMPLETE COURSE FOR BEGINNERS. JOSEPH\r\n > AQUILINA. MALTESE, WRITTEN WITH A MODIFIED LATIN ALPHABET, IS AN\r\n > INTERESTING AND UNIQUE LANGUAGE WITH AN ARABIC MORPHOLOGY AND A VERY\r\n > MIXED VOCABULARY OF ARABIC AND LATIN WORDS, MOSTLY FROM ITALIAN. THE\r\n > COURSE IS PRESENTED IN FOUR PARTS, 1. ALPHABET AND PRONUNTIATION, 2.\r\n > GRAMMAR [ MORPHOLOGY], 3. THE MALTESE VERB, 4. KEY TO THE EXERCISES.\r\n > 240 PAGES. <PERSON>, USA, 1965.\r\n\r\nAvailable [here][1] (From _URL_0_)\r\n\r\n\r\n [1]: _URL_1_", "251" ], [ "You can use Clark, an XML based corpous annotation tool, for annotating your corpora. The link is [here][1].\r\n\r\n\r\n\r\nOther tools are:\r\n\r\n - [GATE][2]\r\n\r\n GATE is a modular system for the linguistic processing of texts. It comprises an architecture, library framework and graphical development environment. Plugins can be used to build an application for a particular annotation task. GATE is freely available under GNU Library General Public License (LGPL 2.0) and can be downloaded after a registration. It is implemented in Java, and thus available for all major platforms.\r\n - [Alembic Workbench Project][3]\r\n\r\n Tool for manual and automatic annotation of text corpora. Automatic annotation is achieved by a mixed approach: heuristics for information extraction can be manually composed or automatically inducted. Available free of charge.\r\n - [PALinkA: A Discourse Annotation Tool][4]\r\n\r\n An annotation program which allows a wide range of annotations. At present it has been used to annotate texts for anaphora resolution, centering, summarisation and marking certain features in texts.\r\n\r\n - [Annotate][5]\r\n \r\n Annotate is a tool for efficient semi-automatic annotation of corpus data. It facilitates the generation of context-free structures and additionally allows crossing edges.\r\n\r\n - [MMAX][6]\r\n\r\n A tool for multi-modal annotation in XML\r\n\r\n---\r\n\r\nYou can also read about corpus annotation below:\r\n\r\n\\[1] : _URL_6_\r\n\r\n\\[2] : _URL_1_\r\n\r\n\r\n [1]: _URL_3_\r\n [2]: _URL_7_\r\n [3]: _URL_0_\r\n [4]: _URL_2_\r\n [5]: _URL_5_.\r\n [6]: _URL_4_", "153" ], [ "There is a list of vocabulary and the output from testing the snowball algorithm available at the Snowball Github page, though it is not precisely human tested but it&#39;s good for testing you stemmer.\r\n\r\nIt supports the following languages:\r\n\r\n arabic \t\r\n danish\r\n dutch\r\n english\r\n finnish\r\n french \t\r\n german \t\r\n hungarian \t\r\n italian \t\r\n <PERSON>\r\n norwegian\r\n portuguese \r\n romanian \r\n russian \r\n spanish \r\n swedish\r\n tamil\r\n turkish\r\n\r\nYou can find this dataset at: _URL_0_", "270" ], [ "The process in which ``one sound becomes more like a nearby sound`` is called assimilation. In assimilation mostly one sound changes but what is the process in which two sounds are changed? Consider the following example from Persian:\r\n\r\n``masjed- مسجد`` changes to ``masĉed`` and then changes to ``maĉĉed - مچد`` \r\n\r\nmeaning: ``Mosque``\r\n\r\n\r\nThis process, I presume, is called ``همگونی دوسویه`` which loosely translates into ``bidirectional assimilation``. \r\nIn general when does it happen? And how should we detect them?", "588" ], [ "As I was observing I didn&#39;t see any CW questions in Linguistics. So I was thinking about posting general questions for community wiki. These question are helpful for both new users and advanced users. Sample questions can be:\r\n\r\n - What are some general textbooks in linguistics?\r\n - What are some good pre-print servers for linguistics?\r\n\r\nAre these types of questions accepted in Linguistics SE?", "251" ], [ "Actually I wasn&#39;t sure about the English term though and yes, I meant ``reciprocal assimilation`` I didn&#39;t know the term.\nwell about the case I mentioned /masjed/ has two processes it first becomes /masĉed/ and then the /s/ sound turns into /ĉ/ which gives: /maĉĉed/\nThere are two processes similar to both gemination and reciprocal assimilation what is the deal with this word?!", "202" ], [ "But what about wiki? Community? Large amount of data? Etc. imagine if we had a list of websites that were a corpus compilation, wasn&#39;t that a step towards reducing the number of questions regarding resource request...but again this is just an example, and yes it would be too long. But let&#39;s focus on the bright side, would&#39;t that reduce the number of basic questions?", "359" ], [ "My inquiry was about the philosophy of not doing that. You said that we shouldn&#39;t post questions that are not specific, right? But why? I remember I saw a post on Stackoverflow which was titled something like this \" ;What are some hidden features of Python \" ; the question got so many good answers that they made an FAQ for it. What I&#39;m trying to say is that I see a lot of newbie question regarding linguistics that I feel a place for some general QAs (or on another suggestion we could encourage users to edit and read tag wikis for this purpose.)", "359" ] ]
174
[ 1024, 19555, 2339, 18811, 13263, 17988, 12347, 9236, 7557, 16708, 18650, 6141, 16595, 9533, 9975, 1005, 1059, 1844, 6335, 6946, 3811, 1520, 8604, 6685, 2007, 8742, 9393, 5775, 4450, 19327, 14604, 16788, 74, 12258, 692, 2306, 14994, 8009, 15913, 7707, 16372, 5603, 2006, 5206, 3177, 5613, 15903, 3361, 7636, 15906, 2801, 887, 3580, 2967, 3045, 523, 5420, 7728, 940, 18227, 13679, 6151, 7935, 640, 822, 7886, 5679, 2186, 15952, 15929, 5748, 5960, 9878, 6452, 1948, 8027, 18969, 9745, 2889, 4745, 10569, 17808, 6189, 5536, 8913, 13550, 13375, 5017, 13977, 5123, 17630, 16212, 1418, 4255, 19784, 3627, 3191, 15667, 1801, 4226, 3715, 5557, 454, 6954, 19723, 1048, 2734, 18541, 365, 7202, 846, 9407, 7230, 16321, 16700, 6508, 15455, 16623, 9041, 5901, 6965, 3557, 17964, 5987, 10695, 82, 15699, 18937, 7579, 6617, 8255, 1225, 9100, 30, 16112, 2490, 764, 16288, 14474, 13374, 786, 536, 13320, 18119, 811, 314, 19569, 6461, 1319, 14345, 4565, 16791, 8529, 8168, 2374, 6276, 4106, 26, 5185, 19319, 13636, 2449, 18365, 18884, 12292, 15417, 15002, 16201, 5403, 7655, 9711, 11766, 18058, 4960, 7576, 7502, 5621, 9535, 657, 14825, 7597, 1239, 17186, 16610, 1040, 1370, 16428, 6777, 15360, 4437, 4321, 8927, 3671, 8693, 14517, 3288, 13229, 15886, 1957, 7622, 10966, 5795, 19369, 1505, 17340, 18041, 14127, 12371, 11443, 8621, 3082, 14680, 17702, 2636, 1599, 7329, 8067, 1765, 9701, 5169, 12033, 18124, 9279, 15439, 696, 6514, 1964, 3004, 18765, 10871, 15821, 8998, 16675, 7221, 1927, 3732, 2514, 18241, 16683, 3352, 2923, 16261, 8244, 19126, 3765, 19226, 9348, 900, 13334, 5139, 7472, 3530, 16434, 251, 8429, 2141, 2140, 16012, 8326, 2561, 7708, 10734, 4544, 11460, 3698, 19470, 13712, 12416, 12959, 2455, 10177, 5162, 6069, 15190, 9215, 9431, 3577, 3922, 4929, 10189, 3406, 11843, 17790, 14355, 11425, 3797, 19393, 7876, 19077, 15996, 8322, 10284, 1238, 19010, 3357, 11986, 12224, 1234, 328, 3686, 1554, 17155, 14660, 3055, 17321, 3519, 10046, 18113, 7584, 16337, 7850, 19778, 16432, 18748, 1085, 1908, 9697, 11188, 12515, 19138, 15783, 1956, 602, 11801, 15579, 18006, 3523, 2123, 10556, 19489, 14759, 17484, 5750, 17944, 6803, 13378, 14308, 18836, 7061, 2951, 2890, 4818, 2187, 441, 1140, 3658, 8085, 3613, 503, 6365, 4188, 4347, 5435, 17357, 17548, 3631, 2615, 16812, 16862, 10844, 2471, 10751, 7846, 18715, 16887, 7186, 15786, 7940, 3053, 768, 15914, 8784, 11937, 2089, 14783, 5879, 297, 11558, 4941, 3668, 5224, 1755, 711, 10677, 4513, 4171, 17430, 14770, 19636, 8170, 6347, 785, 11254, 17047, 6501, 11465, 426, 1827, 4904, 2085, 14288, 6230, 14315, 3830, 18915, 15222, 19741, 3121, 11116, 6781, 14716, 6913, 12214, 17730, 19315, 12661, 13147, 16892, 1415, 2332, 5906, 17314, 2949, 3503, 988, 3793, 15968, 14886, 2879, 7675, 476, 6593, 5914, 11390, 19301, 18016, 17775, 8169, 9314, 18314, 8437, 2026, 5087, 5148, 15550, 19337, 16539, 4529, 15934, 17050, 14842, 3561, 12870, 7054, 16390, 16617, 6459, 4349, 17421, 1706, 18791, 3494, 6604, 524, 16277, 19645, 9486, 18558, 16924, 2423, 1900, 2532, 16979, 6696, 8607, 6303, 12212, 2648, 455, 16299, 2459, 17697, 2364, 1121, 4566, 3384, 1205, 4752, 15034, 11815, 17554, 18924, 19052, 756, 12350, 13967, 5808, 3892, 727 ]
STX_10058.0
[ [ "@ed.hank: What I meant is that suppose sometime during the Roman Empire, counterfeiters made good counterfeits by using an alloy with much less gold than the official coin was supposed to have. Then the government decides to debase the currency, and mints official coins with less gold (perhaps, as in Ankh-Morpork, about the same gold content as seawater :-)). So how, a couple of millenia later, do we tell the unofficial counterfeit from the official debased coin?", "988" ], [ "This is the only answer that doesn&#39;t discount the inevitable singularity that will occur when all work done by humans is obsolete. The day that an ai is made with human level intelligence, the next day there will be one with 10x human intelligence, and so on into eternity. A single computer mind can scale infinitely, while a single human mind can not. Of course the capitalist argument would be, that if no one has a job, then they have no money, then they can&#39;t buy things, so the people who do own things will have to sell. This doesn&#39;t work when the thing you can&#39;t afford to buy is food.", "370" ], [ "@Greg: But the born in a marriage assumption is simply a handy myth, a bit of cultural self-delusion. It&#39;s like the way women always say that a young baby looks just like it&#39;s father, even though to an unbiased observer, babies only look like other babies. The idea is to persuade the possibly jealous putative father that he really is the biological parent.", "126" ], [ "Our dating system (assuming \" ;ours \" ; refers to the one used in mainstream western culture) is not based on astronomical events at all, It&#39;s based on the belief/records/mythology (pick your term according to your personal tastes) of the Christian religion - and even then, the creators of the system apparently got it wrong, as others have computed the date of Christ&#39;s birth as \u00004 BCE :-)\r\n\r\nFor the astronomical events in various records, I think you&#39;ve got the logic reversed. We can use celestial mechanics and other astrophysical stuff (see the astronomy site for details) to figure just how long ago comets, eclipses, supernovae & c happened, and then translate that to our dating system. But we could as easily translate to the Chinese, Islamic, Japanese, Roman, or whatever system.", "1014" ], [ "@SJuan76: Yes, that&#39;s what I meant. There were these shifting kingdoms depending on which strong man held sway over some amount of territory, but there doesn&#39;t seem to be the idea of nationhood that takes precedence over religion, in the way that westerners today would identify primarily as American, British, French, German or what have you, and only secondarily (if at all) as being a member of a religious community.", "853" ], [ "The strength of belief does not depend on the truth or falsity of what&#39;s believed in. We can look to more recent history for examples. For instance <PERSON>, founder of the Mormon religion. Or the Branch Davidians, or the southern California sect who killed themselves to go ride on a comet... It&#39;s like the old <PERSON> (?) story about the man who started a rumour about a gold strike in Hell. After most of the town had headed off to the new diggings, he figured there must have been some truth to the rumor, so he went too.", "151" ], [ "Which shows you perhaps know little about hunting. Some of the better places to hunt for deer are the edges of planted fields, while birds, rabbits and so on can be hunted in crops or after harvest. (Many of the animals hunted are considered agricultural pests.) I also think you are greatly over-estimating the population density of medieval Europe, or even modern Europe outside cities today. However, none of this changes the fact that the peasantry were often forbidden to hunt, so had no chance to (legally) learn the use of bow & spear.", "234" ], [ "But many of the lands that <PERSON> conquered didn&#39;t stay conquered that long. E.g. the Farsi-speakers soon became the Persian Empire, and spent a millenium or so in conflict/coexistence with the Romans and later Greek-speaking Byzantines, until they were finally destroyed by the Islamic invasions. Though I wonder why Farsi wasn&#39;t replaced by Arabic, as was the case with the Islamic conquests in Egypt & North Africa.", "853" ], [ "Define \" ;Middle East \" ; more precisely. If you look at the territory of the Ottoman Empire, you have for instance the Armenian genocide during WWI, Then though the 19th century, we have the Ottoman Empire fighting against various independence movements in Greece, the Balkans, Egypt, and elsewhere, along with wars with Russia, various ethnic cleansings, and so on. So if there was relative peace in the area around modern Israel, it might be because the area was a backwater.", "853" ], [ "I think the problem here is first, that there&#39;s not going to be one single reason for everyone who left. At the extremes, some may have feared harm from the Jews, others may have wanted to leave the invading Arab armies a clear field for killing all the Jews. And everyone who writes about it is likely to have a bias towards one or another being the primary factor.", "980" ], [ "I&#39;m no expert, but I think mainstream opinion among historians is that the Aztecs and Mayans are not at all closely related. The Mayans had been indigenous to the Yucatan vicinity since ca 2000 BC; the Aztecs migrated from northern Mexico/southwest US ca 1250 AD. The languages are entirely different: Mayan is its own family, Nahuatl is a member of the Uto-Aztecan family, which includes languages like Hopi that are still spoken in the US southwest.", "853" ], [ "Those who are more expert than I certainly disagree. As I said, the spoken languages are entirely different families. The written languages are similar only in being ideographic, but so are Chinese, Japanese, and ancient Egyptian. Culturally the similarities - building pyramids and going in for large-scale human sacrifice - are outweighed by the many differences. Physiognomy hardly matters, since culture is not genetic.", "133" ], [ "Who claims that the Aztecs borrowed Mayan culture? Everything I&#39;ve read says that the cultures were quite different, perhaps no more similar to each other than each was to the ancient Egyptians. After all, they all built pyramids, used ideographic writing systems, and had a bunch of gods that seem pretty strange to us. And if the Aztecs did descend culturally and/or ethnically from the Mayans, why did they adopt a language similar to ones used by people living a thousand miles or so to the north?", "216" ], [ "<PERSON>: Now where did I say that religion was minor? I said that it has nothing to do with race, which is strictly determined by genetics, just as the breed of a dog or horse is determined by genetics. A person of any race can become a convert to any religion (though of course there may be practical problems doing so), espouse different religions over the course of their life, or even - like <PERSON> and <PERSON> - found their own new religion.", "831" ], [ "Also consider that the whole length of a typical aquaduct wasn&#39;t the arched, above ground structure we see in pictures. For much of its length, it would have been a (possibly covered) ditch or tunnel. Thus the water, being in contact with the ground, would have been at some temperature above freezing. So when a parcel of water enters the arched section, it must cool to freezing, then give up its latent heat of freezing, before it becomes solid. But if the aquaduct&#39;s well-designed, it gets to the other side before that happens.", "445" ], [ "@SJuan76: Really it&#39;s more apples to apples, as the population density of the buffalo-hunting plains tribes (probably fewer than 100K over a much larger area) would have been roughly the same as that of nobles in medieval England. It was primarily the Eastern market for buffalo robes & c that led to killing large numbers of buffalo. That killing could have been accomplished without guns: see the earlier extincion of most of the North American megafauna.", "853" ], [ "@Alex: Why not? Seems as though <PERSON> and his heirs at least started the process, replacing (or admixing) Egyptian culture with Greek, which some centuries later took a blow from the Romans, followed by the Christians until, if there was anything Egyptian left besides piles of stone, the Muslims delivered the coup de grace. India didn&#39;t really have those repeated foreign conquests, other than the Muslims in the north, until the British came along.", "853" ], [ "I&#39;m surprised that no one has mentioned what seems to be an obvious factor in the initial colonization of the Americas: gold. The Aztecs and Inca had lots of it, enough to more than pay for maintaining a military establishment a long way away, and for eventual colonization. Compare the first couple of centuries in Mexico and Peru, versus the really limited attempts to colonize a much more hospitable North American East Coast.", "853" ], [ "I too love crock pots and slow cookers, but they do have their drawbacks. I am not a fan of removing the end product to other pans and making a further mess, that defeats the purpose. Looking at the mechanics of the recipe, it tells me that it is a ceramic insert and you are home when you cooking it. (3 hours on high) There are a few tips I have developed over the years to help with such an issue. You did mention you do drain the tomatoes somewhat, I would drain them further. As someone mentioned, you could add a little tomato paste, but not too much. \r\n\r\nThe problem with adding thickeners in the beginning (outside the recipe) is that you risk deactivating the thickening power, or it thickens too soon and begins to burn on the bottom. There is no accuracy with crock pots and slow cookers.\r\n\r\nYou can approach this two ways or a combination of the two. If you are present when cooking, I would leave the lid open a crack with a wooden spoon for the last half hour, tilting the lid so the water does not go back into the pot. I usually use a paper towel to catch the water. This ensured the most of the heat is being reflected back into the pot. Using this method you may want to add and addition half hour in cooking. When almost finished you can thicken the liquid with different choices, but it depends on what outcome you are looking for. Is the liquid condensed enough for full flavor? Do you want a clear broth, does that matter? If I were cooking this recipe, I would finish it with Wondra Flour. It is a precooked flour in a can. _URL_0_ Since it is already been activated by the precooking, you wouldn&#39;t need a high boil point for it to thicken, mostly time to hydrate. I would start with a teaspoon, then put the cover completely back on and give it an additional 10 mins.", "928" ], [ "It&#39;s really not Apple vs Microsoft, but Apple vs the IBM PC. Back in the mid-80s, when PCs became available to ordinary folks, Apple had a closed architecture. IBM, OTOH, made their architecture open, so anyone could build add-on boards, or even complete clones. So competition soon meant that you could buy a more capable clone for far less money than an Apple machine. The openness also meant that if you didn&#39;t like Microsoft&#39;s OS, you could build your own (e.g. Linux), and eventually got to Beowulf clusters & c. (A comment because my reference is having worked on much of it.)", "73" ] ]
144
[ 10090, 1125, 3193, 11165, 6383, 1039, 17033, 9099, 8922, 16149, 10472, 10048, 2673, 4946, 16868, 703, 4209, 255, 9539, 8956, 8220, 19026, 15351, 7540, 16804, 16824, 1215, 3360, 5037, 12598, 18401, 8154, 15674, 2070, 1192, 10683, 19079, 5635, 17136, 5321, 2363, 5401, 4491, 13541, 19614, 396, 17363, 19466, 11327, 11381, 1652, 7179, 1802, 3381, 13428, 19262, 1574, 9337, 2229, 18618, 18400, 10348, 4221, 16309, 16120, 10156, 2470, 12080, 13136, 18658, 8328, 13917, 635, 3363, 4614, 3301, 11426, 11770, 8236, 4834, 0, 14416, 14680, 16882, 4208, 19111, 7875, 14975, 14744, 847, 7943, 3441, 8160, 512, 724, 1318, 98, 13693, 8810, 13349, 2770, 1023, 10499, 7403, 3910, 16408, 15923, 16053, 18832, 8547, 13071, 6246, 7173, 2682, 18107, 1275, 15408, 2900, 15719, 11665, 16373, 10330, 10911, 18002, 18046, 15302, 10599, 4512, 8668, 12670, 16114, 17769, 14603, 2976, 14091, 8910, 18697, 18601, 18595, 1582, 13561, 3909, 16593, 17463, 12233, 987, 16310, 1879, 12382, 2914, 6084, 15956, 1324, 8936, 12738, 3805, 8070, 8916, 4405, 9702, 15158, 16600, 2322, 2870, 16103, 9970, 5975, 184, 7374, 9580, 6581, 13178, 9767, 8327, 1691, 8247, 11451, 7519, 12800, 4885, 11344, 5903, 925, 16944, 9574, 5089, 6276, 640, 12523, 19507, 5324, 19786, 8923, 10511, 545, 10258, 16745, 16200, 84, 9131, 6087, 2728, 19206, 2782, 11145, 524, 12283, 362, 933, 5567, 14014, 6230, 13059, 10270, 8436, 9303, 5394, 9169, 18974, 18695, 6760, 7622, 9909, 4250, 6053, 4360, 16132, 19230, 18058, 6832, 5777, 4362, 10556, 7850, 4553, 16300, 5218, 6698, 6171, 12690, 6059, 3873, 9891, 17406, 2622, 1173, 14516, 4667, 10175, 17641, 1605, 5211, 11916, 2012, 1339, 4255, 1453, 5300, 18920, 10397, 15551, 17930, 18879, 18056, 15344, 4260, 15779, 5077, 5853, 9439, 19250, 8055, 5835, 16063, 1402, 6970, 1714, 11184, 13450, 19500, 5743, 12908, 8908, 608, 18314, 17168, 16712, 6344, 4018, 18154, 14722, 1865, 19131, 310, 613, 1124, 18373, 5209, 3913, 2233, 19046, 9478, 5308, 2067, 18431, 6318, 1084, 7721, 2810, 12092, 18877, 440, 17796, 18801, 14932, 12331, 11379, 2379, 8249, 12994, 9754, 8624, 9058, 11711, 4898, 1030, 4782, 19145, 13604, 5519, 10303, 13970, 17901, 8263, 2497, 13146, 12036, 10202, 5215, 8497, 7995, 3621, 13185, 14917, 19251, 16274, 12564, 2773, 19086, 8892, 945, 5032, 6547, 3178, 5026, 10795, 18763, 11025, 19392, 15457, 6593, 5004, 13184, 18836, 10065, 620, 5435, 15647, 17817, 6367, 13230, 18627, 11968, 5307, 9825, 11841, 9259, 2947, 10208, 18293, 7778, 6423, 13278, 16495, 15819, 6853, 9320, 3840, 5528, 17887, 3514, 14664, 15898, 1297, 9100, 6024, 16444, 7931, 15537, 6913, 1767, 7810, 7167, 4187, 14900, 18452, 17576, 9811, 476, 2113, 8867, 10814, 13229, 1404, 6754, 19315, 15623, 1304, 2999, 5185, 7373, 3951, 97, 6149, 2765, 1089, 12017, 1956, 1897, 12192, 4227, 16617, 17549, 2008, 1390, 11356, 3970, 3451, 9938, 11230, 710, 3838, 13468, 331, 16404, 9434, 14886, 568, 11095, 17520, 550, 2263, 8705, 18467, 259, 17967, 17811, 5154, 12020, 2442, 499, 9680, 2402, 14281, 3785, 3231, 6454, 3861, 3661, 14390, 949, 16287, 5170, 8311, 12280, 12153, 929, 5118, 3694, 415, 5534, 1891, 12579, 8881, 4179, 4944, 1701, 19356, 6100, 9180, 14952, 491, 6763, 2250, 2475, 5781, 14602, 12253, 18916 ]
STX_1006.0
[ [ "I have seen a number of different paths, but, it is a bit confusing to me. What should be in my value in the HIDDEN input action below?\r\n\r\n\r\n I have a twig page at my root:\r\n\r\n\t < form method= \" ;post \" ; action= \" ; \" ; accept-charset= \" ;UTF-8 \" ; > \r\n\t < input type= \" ;hidden \" ; name= \" ;action \" ; value= \" ;psychEmail/pubRequest \" ; > \r\n\r\n\t < !-- ...-- > \r\n\r\n\t < input class= \" ;btn submit \" ; type= \" ;submit \" ; value= \" ;{{ &#39;Submit&#39;|t }} \" ; > \r\n\t < /form > \r\n\r\nand then I have a plugin `PsychEmailPlugin.php` class file with \r\n`class PsychEmailPlugin extends BasePlugin`\r\n\r\nand then I have a controllers subdirectory with a `PsychEmailController.php` file that contains an action:\r\n\r\n class PsychEmailController extends BaseController\r\n {\r\n\t public function actionPubRequest($emailAddress)\r\n \t{\r\n\t \t$email = new EmailModel();\r\n\t\t $email- > fromEmail = $emailAddress;\r\n \t\t$email- > toEmail = &#39;<EMAIL_ADDRESS>&#39;;\r\n\t \t$email- > subject = &#39;Publication Request&#39;;\r\n \t\t$email- > body = &#39;Your requested publication is attached.&#39;;\r\n\r\n\t \tcraft()- > email- > sendEmail($email);\r\n \t}\r\n }", "998" ], [ "I have a form and a hidden action that successfully runs the controller action. I now want to include 2 variables (form input values) and then use those values while I am in the controller action. How do I grab the value (theemailaddress) that was in the form?\r\n\r\nTwig template file:\r\n\r\n < form method= \" ;post \" ; action= \" ; \" ; accept-charset= \" ;UTF-8 \" ; > \r\n \r\n < input type= \" ;hidden \" ; name= \" ;action \" ; value= \" ;psychEmail/publication/pubRequest \" ; > \r\n \t < input type= \" ;text \" ; name= \" ;theemailaddress \" ; value= \" ; \" ; size= \" ;100 \" ; > \r\n \r\n \t < !-- ...-- > \r\n \r\n \t < input class= \" ;btn submit \" ; type= \" ;submit \" ; value= \" ;{{ &#39;Submit&#39;|t }} \" ; > \r\n \t < /form > \r\n\r\nfunction IN controller:\r\n\r\n public function actionPubRequest()\r\n {\r\n \t$this- > requirePostRequest();\r\n \r\n \t$email = new EmailModel();\r\n \t$email- > fromEmail = &#39;<EMAIL_ADDRESS>&#39;;\r\n \t$email- > toEmail = &#39;<EMAIL_ADDRESS>&#39;;\r\n \t$email- > subject = &#39;Publication Request&#39;;\r\n \t$email- > body = &#39;Your requested publication is attached.&#39;;\r\n \r\n \tcraft()- > email- > sendEmail($email);\r\n }", "998" ], [ "All of the questions that ask about whether a source is \" ;reliable \" ; all have the same answer. There&#39;s no substitute for *doing the analysis yourself*, and to me these questions seem to ask for permission to skip analyzing the information.\r\n\r\nIn the don&#39;t-ask section of the help center which talks about constructive subjective questions, we see that they should:\r\n\r\n > invite sharing experiences over opinions\r\n\r\nI would like to edit these into questions and ask the question that I think should have been asked in the first place: about **how to evaluate** the source instead. \r\n\r\nThere is a valid question lurking in _URL_0_, because the standards of research required for getting in have probably become more rigorous over the decades as the standards of proof have been refined. But answering the question on those grounds ducks the real question about how to evaluate the information.\r\n\r\n\r\nYour thoughts?", "727" ], [ "@TomH This answer _URL_0_ does have a useful suggestion for this case, but it doesn&#39;t offer any practical advice on how to order the records from the MOD. I think we could make room for a Q on how to find WW2 records for service members who survived the war, since the advice on checking the various war memorials won&#39;t necessarily help.", "307" ], [ "My answer would be: \" ;It depends. \" ; What information to you hope to gain from the DNA test, and what role does that information play in your proof argument?\r\n\r\nOne advantage of joining a surname project: you have an opportunity to find more matches from descendants of those individuals. With a larger group of collaborators, you can get more data, both from the DNA itself, and from having more people to comb genealogical periodicals for case studies that might bear on your problem, and to look through the catalogs of archives and repositories for lesser-used record groups.\r\n\r\nIf you don&#39;t have a clear idea yet exactly what you hope to gain from the DNA test, take a step back and see how other genealogists make their cases. Some articles and presentations to consider are in the links below.\r\n\r\n - Elizabeth Shown Mills, CG℠, CGL℠, FASG, FNGS, \" ;FAN + GPS + DNA: The Problem-Solver&#39;s Great Trifecta \" ;, webinar [for rent or purchase at Vimeo][1] or for [purchase or by subscription at Legacy Family Tree Webinars][2].\r\n - <PERSON>, CG, CGL, FASG, FNGS, Testing the FAN Principle Against DNA: \r\nZilphy (Watts) Price Cooksey Cooksey of Georgia and Mississippi \" ; [NGSQ 102 (JUNE 2014):129-52][3] \r\n - \" ;[DNA and the GPS][4] \" ;, posted by <PERSON>,JD, CG℠, CGL℠, on Aug 3, 2014, on her blog *The Legal Genealogist*\r\n - Judy G. Russell, JD, CG℠, CGL℠, “[DNA and the Reasonably Exhaustive Search][5],” OnBoard 20 (January 2014): 1–2, 7\r\n - <PERSON>, CG,CGL,PhD,FASG,FUGS,FNGS “Too Few Sources to Solve a Family Mystery? Some Greenfields in Central and Western New York,” National Genealogical Society Quarterly 103 (June 2015): 85–103.\r\n - <PERSON>, CG,CGL,PhD,FASG,FUGS,FNGS \" ;Systematically Using Autosomal DNA Test Results to Help Break Through Genealogical Brick Walls \" ;, presentation at NGS 2016 Family History Conference, [recording available from Playback NGS][6].\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_1_\r\n [3]: _URL_5_\r\n [4]: _URL_3_\r\n [5]: _URL_0_\r\n [6]: _URL_4_", "179" ], [ "@PolyGeo Your title edit assumes that a person is actually buried where this stone is placed and when this burial took place, when we have no evidence for either fact. Stones can be placed at any time and the inscriptions can have errors. Note that in the British Isles the stones are called \" ;memorial inscriptions \" ;, a term I prefer. Families sometimes place stones as a memorial even though the person is not buried there.", "521" ], [ "This is a worked case study and is intended as a supplement to the related question _URL_4_.\r\n\r\nThere are two different websites which offer help with determining the location of the Anglican church where a marriage took place by entering the GRO index reference.\r\n\r\n**Surname Society Church Marriage Finder**\r\n\r\nThe Surname Society offers a [Church Marriage Finder][1] -- about their databse, the site says:\r\n\r\n > The database contains details of marriages between 1837 and 1911 and is not yet complete.\r\n > \r\n > We currently have data from the following registration districts:\r\n > Bermondsey, Bishopsgate, Bloomsbury, Braintree, Camberwell, Chelsea,\r\n > Clerkenwell, Colchester, East London, Farringdon, Fulham, Holborn,\r\n > Islington, Lambeth, Marylebone, Medway, Newington, North Aylesford,\r\n > Poole, Poplar, Southwark, St George Southwark, St Giles, St Luke, St\r\n > Saviour, Strood, West Ham, West London, Westminster, Westminster St\r\n > Margaret, Witham.\r\n\r\n**GOONS&#39; Marriage Locator**\r\n\r\nThe Guild of One-Name Studies (GOONS) has a [Marriage Locator][2] Database which also allows you to enter the GRO index and deduce where the marriage took place. However, their website cautions:\r\n\r\n > The Marriage-Locator Database currently contains 613,844 marriage-locator > points (of which 327,679 are &#39;cardinal points&#39;) in\r\n > 1,336 Registration Districts.\r\n > \r\n > This is still a work in progress, and not all the data needed for all\r\n > marriages is yet available. New data is continually being added.\r\n\r\nTheir statement of [Marriage Locator - the principles][3] explains how the locator works -- it is similar to the process described in _URL_0_\r\n\r\nThe marriage I want to know more about is an 1878 registration for <PERSON>. The marriage was registered in Kingsbridge (Devon) Registration District, Vol 5b Page 328. Ancestry lists the following people for that page:\r\n\r\n > Name\r\n > <PERSON>\r\n > <PERSON>\r\n > <PERSON>\r\n > <PERSON> \r\n\r\nThe Surname Society&#39;s Finder is not going to help because the database does not have entries from the Kingsbridge RD. When I entered the GRO Reference into the GOONS Marriage Locator, I got the following message:\r\n\r\n > Marriage Locator Search Results\r\n > \r\n > GRO Index: 1878 quarter 1, volume 5b, page 328:\r\n > \r\n > Sorry, we cannot locate the church for this marriage. The entry is\r\n > located between entries for Stokenham (RD: Kingsbridge) and Newton\r\n > Ferrers (RD: Plympton).\r\n\r\nTheir principles page explains how the volunteers build up the database:\r\n\r\n > For each of the churches within that RD, they take the following\r\n > steps:\r\n > \r\n > - First, identifying the earliest marriage in a quarter for a church, and noting down the names of the bride and groom.\r\n > \r\n > - Doing the same for the last marriage in the quarter.\r\n > \r\n > - Finally, using an online service, or FreeBMD, to find the page numbers where those two marriages have been indexed. These two page\r\n > numbers, representing the first and last marriages in a quarter, are\r\n > what have been termed the \" ;Cardinal Points \" ; for that church.\r\n\r\nThe widow <PERSON> that I am looking for is associated with Aveton Gifford. I have access to images to the parish register via DevonFHS. Can I use this information to cross-check the GOONS marriage locator, to see whether they have already established the \" ;Cardinal Points \" ; for that register?\r\n\r\n [1]: _URL_3_\r\n [2]: _URL_2_\r\n [3]: _URL_1_", "307" ], [ "UKBMD has pages which list the names of places within a registration district -- the page for [Kingsbridge][1] shows the following **civil parishes** later in the alphabet than Stokenham:\r\n\r\n - Strete\r\n - Thurlestone\r\n - West Alvington\r\n - Woodleigh\r\n\r\nAncestry&#39;s list of Ecclesiastical parishes for Kingsbridge RD (derived from The Phillimore Atlas and Index of Parish Registers) lists these parishes after Stokenham:\r\n\r\n - Thurlestone\r\n - West Alvington\r\n - Woodleigh\t\r\n\r\nDevonFHS has scanned registers for Woodleigh available in the members area of their website -- for the period of 1878, they have banns. The last entry (no 88) of page 18 in the register is for banns read in February / March of 1875. The top of page 19, entry 89, is for banns read in November 1879. Unless this register is a copy of an older register, it seems that there are no pages missing.\r\n\r\n**Devon Parish registers at findmypast**\r\n\r\nfindmypast&#39;s [Devon parish records coverage][2] \r\n\r\nThey list:\r\n\r\n - Thurlestone\tbanns 1755-1915\r\n - Thurlestone\tmarriages 1558-1915\r\n - West Alvington\tbanns 1769-1915\r\n - West Alvington\tmarriages 1559-1915\r\n - Woodleigh marriages 1757-1836 (not in the range I need for this question)\r\n\r\nI&#39;ll look through Thurlestone and West Alvington to see if I can see any marriages and determine what the corresponding GRO range is. I&#39;ll also check the Non-Conformist records which are online, newspapers, etc. to see if I can find more information about the couples I&#39;m looking for.\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "521" ], [ "Just noting for clarity that the older TreeSync was shut down at the end of March 2017, and that FTM2017 beta-testers are currently test-driving the new FamilySync service. Presumably this holds true for RootsMagic as well, although I don&#39;t have any information about RootsMagic&#39;s participation in the beta test of the new API at Ancestry. I thought <PERSON> had announced that FTM2017 will also have some ability to sync with FamilySearch but until the release we won&#39;t know how it compares to RootsMagic. See _URL_0_", "1023" ], [ "I&#39;m wondering if the clerk might have mis-heard the name *Listowel*. For pronunciations see _URL_7_ \r\n\r\nWikipedia&#39;s article on [Listowel][1] says:\r\n\r\n > Listowel (/lɪsˈtoʊl/; Irish: Lios Tuathail, meaning \" ;Tuathal&#39;s\r\n > ringfort \" ;) is a Heritage town and a market town in County Kerry,\r\n > Ireland, and is situated on the River Feale, 28 km (17 mi) from the\r\n > county town, Tralee.\r\n\r\nFor a map, see GENUKI&#39;s entry on [Tralee][2] -- the Google map displayed on that page shows Listowel and Tralee. On that page you can also see the names of other nearby towns and calculate the distance from Tralee to other places.\r\n\r\nResources for finding the names of places and townlands in Ireland:\r\n\r\n - Wikipedia: [List of townlands of County Kerry][3]\r\n - [County Kerry page][4] at [Irish Townlands][5]\r\n - _URL_10_&#39;s [Townland Index and Database - 1851][6]\r\n - The Irish Genealogical Society&#39;s Guide to the [Index of Townlands, 1901][7]\r\n - [IreAtlas Townland database][8]\r\n - Dublin City University&#39;s [Placenames Database of Ireland][9]\r\n - [Irish Genealogy Toolkit][10]\r\n - FamilySearch Wiki: [Ireland Gazetteers][11]\r\n\r\n\r\n [1]: _URL_8_\r\n [2]: _URL_6_\r\n [3]: _URL_5_\r\n [4]: _URL_0_\r\n [5]: _URL_12_\r\n [6]: _URL_1_\r\n [7]: _URL_9_\r\n [8]: _URL_4_\r\n [9]: _URL_11_\r\n [10]: _URL_2_\r\n [11]: _URL_3_", "464" ], [ "My main software is Calico Pie&#39;s Family Historian 6, which contains among its many features the capability to print booklets. You can see some screenshots on the **[tour page][1]**. \r\n\r\n[![enter image description here][2]][2]\r\n\r\nSee the FHUG&#39;s Knowledge Base article: [Report Content, Media, Format and Layout][3] and other related articles in the wiki for some how-to articles.\r\n\r\nCalico Pie says the book creation functions allow you to have \" ;a mix of auto-generated chapters and your own ‘free text’ pages and chapters \" ;. \r\n\r\nFor producing your own text, I highly recommend [Scrivener][4], the writing studio software from Literature and Latte; it is available for several different operating systems, and is designed to be used in conjunction with other programs. For example, a writer might do the preliminary drafts in Scrivener and then send the output selected in compile to Word or another program for final formatting.\r\n\r\nWriters who use Scrivener for Genealogy include:\r\n\r\n - <PERSON>, the author of [Scrivener for the Family Historian][5] (on YouTube: [Introduction to using Scrivener for Genealogy][6])\r\n - <PERSON> -- see her guest post at <PERSON> Genealogy Gems: [Scrivener Software for Writing Family History][7] and on the Legacy Blog: [Three Reasons You Should be Using Scrivener to Write Your Family History][8]; webinars in the [Legacy Family Tree Webinars Library][9]\r\n - [<PERSON>], who presented talks on using Scrivener for Genealogy during [RootsTech2014][11].\r\n\r\n\r\n\r\nOther resources:\r\n\r\n - *The Disciplined Genealogist*: [**Porting Genealogy Data to Word via Scrivener**][12] \r\n\r\n\r\n [1]: _URL_5_\r\n [2]: _URL_10_\r\n [3]: _URL_1_[]=book\r\n [4]: _URL_7_\r\n [5]: _URL_3_\r\n [6]: _URL_2_\r\n [7]: _URL_11_\r\n [8]: _URL_9_\r\n [9]: _URL_0_\r\n [10]: _URL_8_\r\n [11]: _URL_4_\r\n [12]: _URL_6_", "153" ], [ "Certain topics roll around every year, and I wonder if we can leverage this by reserving a few slots in the calendar for Monthly Topic Challenges dedicated to this. \r\n\r\nfor example: Every year for St. Patrick&#39;s Day, the big sites often have free access to Irish records. In November, we often see free access to military records.\r\n\r\nShould we propose topic challenges to coincide with these annual events? If so -- should they be on the calendar before, during, or after?\r\n\r\n 1. **Before**: so that people can have some time to clarify their thoughts and figure out what questions they want to investigate once the free access starts.\r\n 2. **During**: so people who might not have access to featured collections can work on the questions while the free access is on\r\n 3. **After**: so people who discovered things during the free access period can showcase what they found in self-answered questions.\r\n\r\nYour thoughts?\r\n\r\nI don&#39;t think we should fill up every month with a challenge, but we could use these two topics as anchor points which could be promoted every year.\r\n\r\nWe haven&#39;t talked a lot about promoting the topic challenges. A site-focused blog would be one way to do it, but SE has shut down the blogs here, so that would have to be hosted somewhere else. I&#39;ve done some promotion on Twitter, and I&#39;m starting to share more on Facebook. But (once again) I&#39;m frustrated by not having a place to chat with the newcomers before they are ready to post.", "109" ], [ "In a presentation at USCIS, historian <PERSON> answered a similar question by going through the correspondence for the agencies involved in order to trace what happened to the records. \r\n\r\nJust as we do for a person, we can build a timeline for records and trace them from creation to archive (plus the steps in between). Questions like this can help us fill in the waypoints:\r\n\r\n - Which agency created the record?\r\n - What were the rules of record retention and disposal in effect at the time?\r\n - If the records did become archival, which archive received them?\r\n - When did the records become archival?\r\n - Have the records been accessioned?\r\n - Do restrictions exist which prevent the records being viewed by researchers?\r\n\r\nIf an answer can be found, it might be in TNA&#39;s **[RG 19/42][1]**, whose catalog entry reads:\r\n\r\n > Census of London 1896; proposed censuses in 1906 and 1916: correspondence\r\n \r\nand \r\n\r\n > This record has not been digitised and cannot be downloaded.\r\n\r\nThe catalog entry is brief, so this record group may only be correspondence. \r\n\r\nA thread on the forum _URL_1_ titled [London 1896 census.][2] has [a post by user BraisherT][3], who says:\r\n\r\n > The Registrar General published a summary as a Parliamentary Paper in August 1896, and the LCC published a statistical return giving the population in each ward or parish divided into males and females, the number of rated households, and the numbers of inhabited and uninhabited houses (this was LCC Official Publications Vol.27, at LMA under reference SC/PPS/063/027). There are no personal details in either publication. \r\n\r\nA quick search on Google revealed some medical journals that referenced the census (some looking forward to the upcoming census) but I did not search extensively. No obvious research guide popped up in the first few pages. \r\n\r\n\r\n [1]: _URL_3_\r\n [2]: _URL_2_\r\n [3]: _URL_0_", "521" ], [ "This is probably a newby question, but, I am just trying to add a basic email send test and my twig page does not like the dollar signs. Is EmailModel built-in to craft or is there a plugin I need?\r\n\r\nI am just trying to add this code to a basically empty twig page:\r\n\r\n $email = new EmailModel();\r\n $email- > subject = \" ;Thanks! \" ;;\r\n $email- > htmlBody = \" ; < h1 > Congratulations! < /h1 \" ;;\r\n $email- > htmlBody .= \" ; < p > Hello World < /p > \" ;;\r\n $email- > fromEmail = \" ;<EMAIL_ADDRESS> \" ;;\r\n\r\nthanks for the help...\r\n\r\n<PERSON>", "856" ], [ "I am transitioning from a C#/.net background to a CraftCMS/Twig/PHP platform, so, I recognized that this didn&#39;t seem to make sense, but, I couldn&#39;t find a way to easily integrate an email process into my Craft CMS site (built of twig pages) and this was the only code I have found so far. What is the best way to do this: When a user hits a button on the site, I want a pdf file to be attached and emailed to an email address that was typed into a text box on that page.", "856" ], [ "Would it be possible to obscure the names associated with these kits? See this post from The Legal Genealogist: _URL_0_ \" ;...we should not take a screen capture of DNA results from a testing company and post it in a blog post or on Facebook with the names or pictures of our matches still attached unless we’ve asked those matches specifically if we can post it. \" ; Linking to results isn&#39;t the same as a screenshot, but I think the same caution should apply.", "700" ], [ "I want to clarify my objection to [the recent question][1] that has prompted this discussion. \r\n\r\nLinking directly to a page of GEDMatch match results revealed both full names and kit numbers of the kits being compared. This seems to me to be an obvious breach of our own policy not to publish the names of living people without their permission. Perhaps those testers have given consent for their results to be available to other people **on GEDMatch** -- that doesn&#39;t mean that they&#39;ve given consent for those results to be copied and shared on other sites.\r\n\r\nIn her post [A Matter of Consent][2], <PERSON> says:\r\n\r\n > What this means, put in simple terms, is that we should not take a\r\n > screen capture of DNA results from a testing company and post it in a\r\n > blog post or on Facebook with the names or pictures of our matches\r\n > still attached unless we’ve asked those matches specifically if we can\r\n > post it.\r\n\r\nThe match results were linked to, so technically they weren&#39;t distributed outside of GEDMatch, but in my opinion exposing the full names of people in this way is still a breach of *our own policy*. From [On Topic][3]: \r\n\r\n > Please note: You must not include here in any circumstances\r\n > information (including name, date and place of birth or any other\r\n > details) that would allow identification of any living (or possibly)\r\n > living individual by somebody reading this site. In practice, this\r\n > means details about anyone born in the last 100 years, whether they\r\n > are believed to be deceased or not, and whether or not they have given\r\n > their permission.\r\n\r\nDo we really want to say to someone, if you&#39;re doing paper-trail genealogy, you have to follow this restrictive policy, but if you&#39;re doing DNA research, it&#39;s okay -- as long as you&#39;re only linking to other pages that breach our policy, we&#39;ll look the other way?\r\n\r\nCan we at the very least agree that the DNA Kit numbers fall under the description of \" ;other details \" ; in our own policy? Or is it primarily the combination of kit number plus the full name that is problematic?\r\n\r\nMy gut feeling is that if the professionals are obscuring names and photos and portions of kit numbers when they show tables of results, then we should do it too. Otherwise experts who are following ethical standards won&#39;t be willing to post here.\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_0_\r\n [3]: _URL_1_", "465" ], [ "The clerks who created the passenger lists were employees of the steamship companies, working from forms that were filled out at the time the tickets were purchased, presumably by the person who bought the ticket or someone in their party. Thus they had the same difficulties reading the handwriting on the individual forms as any of us, plus tehy were working with a smaller sample of each person&#39;s handwriting than a modern indexer does.", "521" ], [ "@PolyGeo FYI there are steamships named after the cities where the ports are, a lovely trap for the drowsy researcher. \n\nIn order to answer this question, I&#39;d like to know what passenger list this is from -- a page number would be a bonus. We don&#39;t need the name of a passenger to answer the question, but it would be useful to see the entire page so we could see the notation in context and be able to read the headers. A simple citation of the arrival would suffice -- we don&#39;t need the entire page inlined.", "587" ], [ "This is a worked case study related to _URL_1_\r\n\r\n<PERSON> [WWI Draft Registration card][1] lists his birth date as 31 Oct 1887 and his birth place at Slapton, Devon, England.\r\n\r\nSearching for <PERSON> on findmypast turns up the following records:\r\n\r\n - a birth registration in 1887 Q4 in Kingsbridge Registration District, Vol 5b page 194 (FreeBMDs transcription agrees with this)\r\n - 1891 Census: Ven Cottage, Stoke Fleming, Kingsbridge, Devon, England; <PERSON> (aged 3) is the son of the head of household, born in Stokenham\r\n - 1901 Census return, Week Cottages, Dartmouth, Totnes, Devon, England; <PERSON> (aged 13) is the son of the head of household, born in Stokenham\r\n\r\nA search for <PERSON> in the Devon Baptisms doesn&#39;t give any results (both Slapton and Stokenham baptisms are in this record set). \r\n\r\nThe 1891 census says Nicholas&#39;s parents <PERSON> and <PERSON> are born in Slapton, and I have located them with two children in Slapton in the 1881 Census in Slapton Village. \r\n\r\nCould <PERSON> have given the Draft Registrar his parents&#39; birthplace instead of his own? What other clues do we have?\r\n\r\nThe rest of the family in the 1891 Census:\r\n\r\n - <PERSON> \tSon \tSingle \tMale \t10 \t1881 \tScholar \tSlapton, Devon, England\r\n - <PERSON><PERSON> \tDaughter \tSingle \tFemale \t8 \t1883 \tScholar \tStokenham, Devon, England\r\n - <PERSON> \tSon \tSingle \tMale \t6 \t1885 \tScholar \tStokenham, Devon, England\r\n - <PERSON> \tDaughter \tSingle \tFemale \t4 \t1887 \tScholar \tStokenham, Devon, England\r\n - <PERSON> \tSon \tSingle \tMale \t3 \t1888 \t- \tStokenham, Devon, England\r\n\r\nThe children in 1901 Census:\r\n\r\n - <PERSON><PERSON> \tDaughter \tSingle \tFemale \t18 \t1883 \tHouse Keeper \tStokenham, Devon, England\r\n - <PERSON><PERSON> \tDaughter \tSingle \tFemale \t14 \t1887 \t- \tStokenham, Devon, England\r\n - <PERSON> \tSon \tSingle \tMale \t13 \t1888 \tGardener&#39;s Boy \tStokenham, Devon, England\r\n - <PERSON> \tSon \tSingle \tMale \t9 \t1892 \tScholar \t<PERSON>, Devon, England\r\n\r\nGiven the migration pattern that is revealed from the birthplaces of the older siblings, it seems likely that the family was in Stokenham in 1887 and the family moved to Stoke Fleming before census day in 1891. \r\n\r\nSo what hidden clues can we get from the GRO birth registration?\r\n\r\nUsing the method in the linked question, Nicholas&#39; birth reg on page 194 appears to be in the Stokenham sub-district. The first two sub-districts from Kingsbridge registration district in the 1881 Census registration districts report from _URL_0_ are:\r\n\r\n 1. Blackawton: parish Blackawaton, Stokefleming, Slapton\r\n 2. Stokenham: parishes of Stokenham, Sherford, Charleton, South Pool, Chivelstone, East Portlemouth\r\n\r\nMy question is: is it necessary to register a birth from Stokenham in Stokenham sub-district? \r\n\r\nIf a family lived close by the border of the sub-district, could they register in the neighboring sub-district, or would the GRO list the birth in the sub-district where it belonged, regardless of what office was visited?\r\n\r\n(Note that in the US, if a person registered for the draft in WWI away from their usual residence,their draft card was forwarded to their local office.)\r\n\r\n [1]: _URL_2_", "521" ], [ "If your great-grandfather departed Germany from Hamburg, you might be able to find an outbound passenger list from that port. Unfortunately many of the lists for Bremen were destroyed -- it takes space to store records, so they only kept lists for a few years before getting rid of them, and we only have a few groups of records that happened to get saved.\r\n\r\nThe FamilySearch catalog entry for the collection [Germany, Bremen Passenger Departure Lists, 1904-1914][1] says:\r\n\r\n > The information contained in this index is for the years 1907-1908 and 1913-1914 only.\r\n\r\nThe FamilySearch research wiki article [Germany Emigration and Immigration][2] gives an overview of the process of emigration from Germany and discusses what kinds of records you might be able to find. It includes information on what emigration records exist for Hamburg and Bremen. \r\n\r\nThe article is written for people looking for their ancestors who emigrated to the United States, but all the information in the article about German records will be useful to you. When the article gives advice to look in the United States, like this, substitute \" ;in his new country \" ; and look for what you can find in Bolivia.\r\n\r\n > In order to research your ancestor in German records, you need to know the exact town of origin. Most of the time this information is found in U.S. sources. Thus it is very important to search all available records in the United States first. \r\n\r\nStart with the resources in Bolivia first and gather all the information you can -- this will make it easier to identify your great-grandfather in the German records. Look for information in your own family first ( \" ;home sources \" ;. After that, the FamilySearch Wiki article on [Bolivia][3] is a good place to start. Click on the blue button on the main page to see a table of [online records][4].\r\n\r\nYou have already given us a good deal of information in your question, so you&#39;ve made a good start. Make a timeline of events for your great-grandfather so you&#39;ll have something that is easy to refer to, and make note about where you got the information for each event. Knowing *how* we got the information is also an important part of the process. \r\n\r\nIf you need help with German jurisdictions and place-names while searching for records in Germany, the online [Meyers Gazetteer][5] is a superb resource.\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_3_\r\n [3]: _URL_4_\r\n [4]: _URL_2_\r\n [5]: _URL_0_", "307" ], [ "Hi, welcome to G & _URL_0_! Your answer doesn&#39;t really answer the question -- it is more of a comment. Can you add anything to your answer to make it more substantial? Even a list of the five different <PERSON> that you were able to find, and a note about how and where you found them, would help beef up this answer -- then people would have that to compare with their own search results.", "262" ], [ "Many NARA microfilm publications have a descriptive pamphlet which describes the microfilm and explains how it is arranged. These publications sometimes say when pages have been lost (similar to the [Known Issues articles at FamilySearch][1]. I have not been able to find such a description of the records from NARA yet, but I will link to it if I can find one. (The DPs are often reproduced as the first images on the microfilm rolls.)\r\n\r\nThere may be some information about missing records in Chapter 1 of NARA&#39;s [Guide to Genealogical Research in the National Archives][2]; in the section Useful Publications, the online research guide [1790-1890 Federal Population Censuses - Part 1][3] says:\r\n\r\n > Details on many of these records appear in Guide to Genealogical Research in the National Archives, chapter 1. Table 4 of the Guide (pp. 14-16) identifies most of the microfilm publications for the mortality schedules; section 1.3 of chapter 1 (pp. 28-38) discusses each state&#39;s special census schedules and problems.\r\n\r\n<PERSON>-Step Web pages has a [Description of US Census Microfilm Rolls, 1790-1940][4] and the list for Kentucky includes this entry:\r\n\r\n > 114. Henderson, Henry, Hickman, and Hopkins Counties \r\n\r\nA DP or roll list from NARA might say if the counties are on the roll in alphabetical order. \r\n\r\nIf you want to try browsing all the images for roll 114 of M704, you can view the Allen County Public Library&#39;s copy for free at the [Internet Archive][5]. <PERSON> also has a feature which allows you to [browse the individual rolls][6].\r\n\r\nFamilySearch&#39;s index was provided to them by Ancestry. So what I would like to know is who provided that index to Ancestry? \r\n\r\nMyHeritage Library Edition appears to have the same issue. Here is their page for the same record as the one you found on FamilySearch: \r\n\r\n[![enter image description here][7]][7]\r\n\r\n > Source: 1840 United States Federal Census _URL_2_ [online\r\n > database]. Lehi, UT, USA: MyHeritage (USA) Inc.\r\n > _URL_8_\r\n > Original data: United States of America, Bureau of the Census. Sixth\r\n > Census of the United States, 1840. Washington, D.C.: National Archives\r\n > and Records Administration microfilm publication M704, 580 rolls.\r\n > \r\n > Record:\r\n > _URL_0_\r\n > <PERSON> Year: 1840; State: Kentucky; County: Henry; Township: West\r\n > Division; NARA Publication: M704; NARA Roll: 114; Frame: 7827; Sheet:\r\n > 299\r\n > \r\n > Citation: <PERSON> Residence: 1840 - West Division, Henry,\r\n > Kentucky, United States\r\n\r\nIt is the only hit on the first page of the search results for <PERSON> in Kentucky that does not have an image. \r\n\r\nBy contrast, a [search for <PERSON> with name variants checked][8] at findmypast, which has the US Census collection for free (it was formerly free at Mocavo, which was purchased by findmypast), shows 7 results, none of whom appear to be from Henry County. Their search results page says:\r\n\r\n > **Last name \tFirst name \tBorn \tDied \tEvent \tRecord set \tLocation**\r\n > \r\n > - <PERSON> \t<PERSON> \t— \t— \t1840 \tUs Census 1840 \tChristian, Kentucky, United States \t\r\n > - Knight \t<PERSON> \t— \t— \t1840 \tUs Census 1840 \tChristian, Kentucky, United States \t\r\n > - Knight \t<PERSON> \t— \t— \t1840 \tUs Census 1840 \tGermantown, Mason, Kentucky, United States \t\r\n > - Knight \tJohn T \t— \t— \t1840 \tUs Census 1840 \tDivision 1, Fleming, Kentucky, United States \t\r\n > - Knight \tJ \t— \t— \t1840 \tUs Census 1840 \tNorthern District, Woodford, Kentucky, United States \t\r\n > \r\n > - Knight \tJ W \t— \t— \t1840 \tUs Census 1840 \tLouisville, Jefferson, Kentucky, United States \t\r\n > \r\n > - Night \tRufus J \t— \t— \t1840 \tUs Census 1840 \tJefferson, Kentucky, United States\r\n\r\n(I haven&#39;t clicked through to view the images, so I haven&#39;t confirmed that the images belong to the counties cited in the search results.)\r\n\r\n\r\n [1]: _URL_9_\r\n [2]: _URL_1_\r\n [3]: _URL_6_\r\n [4]: _URL_3_\r\n [5]: _URL_10_\r\n [6]: _URL_4_\r\n [7]: _URL_5_\r\n [8]: _URL_7_", "307" ], [ "I&#39;ve converted your answer to a comment since it doesn&#39;t answer the question. It&#39;s okay to answer your own question if you find the answer to your question. If you want to add further information to your question, you can either write a comment, or use the edit link under your question to add more information to the question. For more information about how the site works, take the [tour] -- you can also consult the [help] or ask in [meta].", "262" ], [ "When you&#39;re trying to sort out conflicting evidence -- it helps to write things out. It could be something as simple as a table in a Word document, a paper research journal, a project in Evernote or Scrivener, or using Lineascope: _URL_0_ -- just a summary of \" ;James Elston&#39;s 1759 was calculated from the 1790 census \" ; so you can see who says what and why, to compare and contrast them. If you have to leave off and come back to things later (and who doesn&#39;t), it&#39;s much easier if you&#39;ve got notes you can look at, and see the summary all in the same place.", "421" ], [ "Downvoted because asking \" ;who compiled these documents \" ; is a poor question when you don&#39;t give us *any* examples of the documents! If you have a question about a *specific* set of passenger lists, feel free to ask a new question. P.S. Please review \" ;What types of questions should I avoid asking? \" ; in the [help] -- \" ;Your questions should be reasonably scoped. If you can imagine an entire book that answers your question, you’re asking too much. \" ;", "262" ], [ "Don&#39;t throw out funeral books! They are an important record of other family members, friends, associates, and neighbors -- what [<PERSON>] has called the family&#39;s FAN Club.\r\n\r\nStudying my neighbors&#39; and godparents&#39; families gave me important clues that allowed me to learn more about where my family had lived before I was born. I didn&#39;t realize until then that my parents had known those families in other cities before they moved to the town where I was born. \r\n\r\nIf you really don&#39;t want to keep them, contact your local genealogical society, historical society, and local archives to see if you can find a home for them there. By themselves they may not seem to have much value, but taken as a group, and in combination with other historical records, they could be the key to solving countless problems, simply by being a record of different families still being in contact with each other at a particular point in time. I always try to identify *all* of the bearers at funerals when I get that information from obituaries and funeral notices in newspaper research -- having the funeral books allows you to widen the net significantly.\r\n\r\nSome resources:\r\n\r\n - [FAN Club Research to Build Your Family Tree][2] -- a video by <PERSON> from her Ancestry Desktop Education playlist\r\n - [QuickSheet: The Historical Biographer’s Guide to Cluster Research (the FAN Principle)][3] by <PERSON>\r\n - [QuickLesson 11: Identity Problems & the FAN Principle][4] from ESM&#39;s Evidence Explained website\r\n\r\nIn addition to being of value for genealogy, this kind of ephemera is valuable for social history research. Baby books were one of the many sources consulted by <PERSON> for her book [Pink and Blue: Telling the Boys from the Girls in America][5]. \r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_0_\r\n [3]: _URL_1_\r\n [4]: _URL_4_\r\n [5]: _URL_3_", "521" ], [ "I downvoted your answer because of the second sentence. I know at least one county archivist who would be happy if someone offered to donate these materials to her local archive. You and I aren&#39;t archivists -- so we can&#39;t know what other libraries or archives might want. Isn&#39;t it better to ask first instead of assuming no one will want them? Digitizing the materials and donating them to a local society is not an either/or scenario. Why not digitize the materials and then reserve your right to do as you see fit with your own scans as part of the Deed of Gift?", "798" ], [ "A couple of thoughts about specific problems.\r\n\r\nQuestions involving migration, emigration and immigration may be problematic because the question might need to be tagged in two places. Questions about finding where someone died, like _URL_2_ may be especially problematic because people can die anywhere, no matter where their usual residence is. \r\n\r\n\r\n**Historical vs. Modern names**\r\n\r\nOne solution that exists for the modern vs. historical place name problem is to do what the Family History Library does -- their place hierarchy is often based on that described in a particular gazetteer. For instance, the German place names are based on [Meyers Gazetteer of the German Empire][1] for which there is now an online searchable version at [_URL_0_][2]. We now have tags for all the jurisdictions that the online Meyersgaz calls \" ;Level 1 -- Level I shows which Kingdom or State the place is located in. \" ; On the other hand, people could be doing research in the period before the unification of Germany, and not know which kingdom or state is appropriate, so they may want to use Germany for those questions anyway.\r\n\r\n\r\n\r\n \r\n\r\n\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "468" ], [ "The [1880 Enumerator instructions][1], which can be viewed at _URL_0_, say:\r\n\r\n > Wherever an institution is to be enumerated, as a hospital, an asylum,\r\n > an alms-house, a jail, or a penitentiary, the enumerator will leave\r\n > three lines blank, and enter the name of the institution (as \" ;St.\r\n > Mary&#39;s Hospital, \" ; \" ;Protestant Orphan Asylum, \" ; \" ;Insane Asylum, \" ; \" ;City\r\n > jail, \" ; etc.) above the names and the inmates. All persons having their\r\n > \" ;usual place of abode \" ; in such institutions, whether officers,\r\n > attendants, beneficiaries, or persons in confinement, should then be\r\n > entered consecutively on the schedules, and at the close of the list\r\n > another space of three lines should be left blank.\r\n\r\nThe FamilySearch Wiki article [United States Records of Childrens Homes and Orphanages (National Institute)][2] says:\r\n\r\n > By the 1880s, most states had enacted laws requiring children to be\r\n > cared for in facilities separate from adults. It is at this time you\r\n > will see the creation of government-run county children’s homes.\r\n > \r\n > The term ‘orphanage’ is often a misnomer. These institutions often\r\n > took in not only parentless children, but also children whose parents\r\n > were unable or unwilling to provide for them. Such children could be\r\n > placed there either by the choice of their parent(s) or by the courts.\r\n\r\nLet&#39;s assume for the moment that the family story is true, and you won&#39;t be able to find any records from the orphanage itself. What you might be able to find are records that mention the orphanage by name, like the census, or there might be other records created by other agencies, like the local courts. The article in the Wiki article on Burned Counties Research (see the resources) was written for situations where the county courthouse has burned down, but the same principles apply to any record loss. Be sure to search all levels of jurisdiction (federal, state, county, and smaller localities) for records. Arkansas state statutes and those for surrounding states can tell you at what point children were placed in institutions separate from adults. Check online (Google Books, Hathi Trust, Internet Archive) for local histories that might mention the names of institutions operating at the time, then use that information to search the US Federal Census.\r\n\r\n\r\n \r\n\r\nResources:\r\n\r\n - Cyndi&#39;s List: Category [Orphans][3]\r\n - FamilySearch Wiki: [Burned Counties research][4]\r\n - Research Guide: [Statutes: US and State Codes][5] at Harvard Law School Library\r\n\r\n\r\n\r\n [1]: https://usa._URL_0_/usa/voliii/inst1880.shtml\r\n [2]: _URL_3_\r\n [3]: _URL_5_\r\n [4]: _URL_2_\r\n [5]: _URL_4_", "521" ], [ "If you&#39;d like to propose that we have a tag for \" ;orphan \" ;, that&#39;s a question for our [meta] area. Bear in mind that the word \" ;orphan \" ; has a specific meaning in the 20/21st centuries that isn&#39;t necessarily the same for earlier eras, and the difference in language usage over time is something that we&#39;d have to address in our usage guidance. I encourage you to ask the question about the tag on Meta, after which you or one of the mods can edit it out of your question.", "423" ], [ "I would assume the answer was \" ;yes \" ; until I found out otherwise. \r\n\r\nThe FamilySearch Wiki article about [Texas Vital Records][1] says:\r\n\r\n > From 1837 to 1966, the county recorders issued marriage licenses and\r\n > kept marriage registers. Copies of the records can be obtained by\r\n > writing to the clerk of the county where the license was issued. For\r\n > information from 1966 to the present, write to the Bureau of Vital\r\n > Statistics.\r\n\r\nOne difficulty, however, is that the couple may not have gotten married in the towns where you are expecting to find them. Check the article in the FamilySearch Wiki on *Gretna Greens* to see destination cities where couples may have gone in order to get married (e.g. to take advantage of civil marriage laws that are less restrictive than their hometown). \r\n\r\nCivil records in the United States during this period may be held at the local level rather than statewide, so try to find other means of discovering the location of the marriage, such as announcements in newspapers. Then use the information you&#39;ve discovered to track down a civil record or a record created by a rabbi. \r\n\r\n\r\n\r\n - FamilySearch Wiki:[United States Record Selection Table][2]\r\n - FamilySearch Wiki:[Gretna Greens in the United States][3] (runaway marriages)\r\n - FamilySearch Wiki:[Texas Research Tips and Strategies][4]\r\n - FamilySearch Wiki:[Texas Record Selection Finder][5]\r\n - [The Ancestor Hunt: Newspaper Research Links][6]\r\n - [JewishGen][7]\r\n - FamilySearch Wiki: [Jewish Genealogy: Search Strategies][8]\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_7_\r\n [3]: _URL_4_\r\n [4]: _URL_6_\r\n [5]: _URL_1_\r\n [6]: _URL_5_\r\n [7]: _URL_3_\r\n [8]: _URL_0_", "521" ], [ "NARA says: \" ;The records are arranged alphabetically by state, including Alaska, Hawaii, Puerto Rico, and the District of Columbia; thereunder, alphabetically by county or city (except for Connecticut, Massachusetts, and Rhode Island which are arranged by divisions and counties); thereunder alphabetically by the name of the registrant. \" ; see their guide at _URL_0_ -- technically speaking the A, B, C refer to the first/second/third **registrations**. One registers *for* a draft -- the draft is a separate event.", "714" ], [ "Hi, welcome to G & _URL_0_! I&#39;ve edited your question to narrow its focus since your original post was very broad. Please take the [tour] and look over the material in our [help] to learn a little about how the site works. It&#39;s okay to ask multiple questions about the same family or person -- our focus here is on solving specific problems. We&#39;d like to see one question per question -- that helps us write better answers.", "262" ], [ "According to the Indiana State [Family and Social Services Administration][1] website, many of the early patient records were destroyed. Their site says:\r\n\r\n > There are some archive books listing very limited patient information. To contact Richmond State Hospital for genealogy records contact <PERSON> the director of our medical records department.\r\n\r\n(click through to their site to use the contact information)\r\n\r\nThat page also says:\r\n\r\n > Indiana State Archives\r\n > (_URL_4_)\r\n > apparently has some materials. According to their website:\r\n > \r\n > \" ;Richmond State Hospital (1890-present) (formerly Eastern Hospital\r\n > for the Insane) Richmond State Hospital has served people with mental\r\n > illness from 18 counties in eastern Indiana for 105 years. Collection\r\n > Description: Annual Reports; List of Patients, 1887-1923; Medical\r\n > Records (sampling), NEED DATES. \" ; \r\n > \r\n > Contact the State Archives for arrangements to search their\r\n > collection.\r\n\r\nOn [another page][2] reviewing state institutions, the Indiana Archives and Records Administration says:\r\n\r\n > **Richmond State Hospital** (1890-present - formerly Eastern Hospital for\r\n > the Insane)\r\n > \r\n > This hospital, popularly known as “Easthaven,” opened in 1890 on a\r\n > 1000 acre campus near Richmond in Wayne County. It serves counties in\r\n > east central Indiana. Richmond is still in operation. As of June\r\n > 2008 it had admitted 42251 patients. The hospital maintains a\r\n > complete admission index. A sample of the medical records has been\r\n > sent to the State Archives; the remaining records were destroyed.\r\n\r\nYou may not be able to get any information apart from the dates when she was admitted. \r\n\r\nBefore making a request for medical records from an institution or from the state archives, it helps greatly to organize everything you already have collected about a person. See <PERSON> [Creating Timelines to Make Sense of Genealogy Records][3] from her site *Genealogy Decoded* -- she has also shared her [Excel template][4] which you can use as a guide. Timelines help us narrow the dates in which people might have been in the hospital, making any search in archives much easier to do. \r\n\r\n\r\n \r\n\r\n\r\n [1]: _URL_3_\r\n [2]: _URL_0_\r\n [3]: _URL_2_\r\n [4]: _URL_1_", "307" ], [ "Hi, welcome to G & _URL_2_. Please look at the [help] to see how the site works, especially [How do I ask a good question?](_URL_1_) Thanks for letting us know both the place and the time period your question is about -- if you can give us more information by editing your question, we can give better answers. Saying \" ;_URL_0_ was not helpful \" ; doesn&#39;t tell us anything because we don&#39;t know what search terms you used, and \" ;what I found on Ancestry \" ; doesn&#39;t tell us anything either because we don&#39;t know what that was.", "262" ], [ "As [previously mentioned][1] all the schedules were lost, but if you want to learn more about the census and the reports that were generated from the data before the schedules were lost, here are some resources.\r\n\r\n - [What? No British Censuses for 1931 or 1941?][2] published 17 Jun 2011 on the Family Search blog\r\n - [200 Years of the Census: Census 1911-2001][3] (Office of National Statistics) where you can [download a blank 1931 census form][4]\r\n - [Census of England and Wales, 1931][5] by <PERSON> (_URL_7_)\r\n - a search for [1931 Census][6] on Histpop gives 67 results, many of which are the individual reports on the total population by county.\r\n - List of reports from the 1931 Census from [A Vision of Britain][7]\r\n - [Census Returns][8] from _URL_2_ is general guide to UK Census returns, with a list of other records that can be consulted as &#39;census substitutes&#39;\r\n\r\n [1]: _URL_9_\r\n [2]: _URL_3_\r\n [3]: _URL_6_\r\n [4]: _URL_4_\r\n [5]: _URL_0_\r\n [6]: _URL_8_\r\n [7]: _URL_1_\r\n [8]: _URL_5_", "307" ], [ "Thanks for the information. The answer to \" ;When did civil records begin? \" ; will be different for every place and for every kind of record. In the United Kingdom, 1837 is the start of nationwide BMD registration. In the US, many states didn&#39;t start collecting births statewide until the early 20th century and anything earlier has to be found at the county where the record is kept.", "521" ], [ "As a follow-up to FamilySearch&#39;s [United States Research Seminar][1] which concluded today, our topic this week picks up from the final lecture, \" ;Some People Really Need to Get a Clue! Document Analyzation and Evaluation \" ;. \r\n\r\nLet&#39;s talk about how we can get the most out of the material we&#39;ve already collected. What clues to other records are sitting right under our nose? If you made a great find and smacked yourself, saying \" ;Why didn&#39;t I see that before? \" ;, head over to the [Conference Room][2] and share your war stories there.\r\n\r\nThe chat will occur in [The Conference Room][2] all week long. Be sure to [register yourself][3] to get an alert each week.\r\n\r\nIf you have any ideas for future topics, post them as answers to _URL_4_ and they might be used in an upcoming week!\r\n\r\n [1]: _URL_5_\r\n [2]: _URL_0_\r\n [3]: _URL_2_\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_3_", "307" ], [ "E.g. in this case the Archdeacon&#39;s Transcripts are browse-only (no search box on the catalog page); the parish records entry says \" ;Parish registers of christenings, marriages, and burials located in the County Record Office in Norfolk. Included are parishes both in and outside of Norfolk. Only a small part of the records in this collection are included in the index. Many of these records can also be found in the collection: England Births and Christenings, 1538-1975. \" ; FamilySearch will warn you. Ancestry is more likely to put in a search box without a warning.", "307" ], [ "The FamilyTree ID has a typo in it. I don&#39;t have time to edit the question but this might be the individual who is meant. _URL_0_. <PERSON>, I would also like to welcome you to G & _URL_1_. We ask that our community members add information about what they have already tried, and to put information relevant to the question in the question itself, so the rest of the community will be free to work on an answer. Adding links to shared trees is not always helpful because the information you want to show us may not be there later.", "262" ], [ "Have you tried searching for your focus person by name, and come up empty? You&#39;ve hit all your usual haunts, and don&#39;t know what do to next? \r\n\r\nA wealth of material is waiting for the researcher who knows how to search a catalog. Are you hooked on [JSTOR][1]? Does [ArchiveGrid][2] make your day? Are you a [WorldCat][3] maven? Is [TNA&#39;s Discovery][4], [The NRS Catalog][5], [National Archives of Australia][6] or [NARA&#39;s new catalog][7] your go-to resource? \r\n\r\nCome chat about your favorite online library and archive catalogs, share search tips, and talk about what finds you&#39;ve made. \r\n\r\nThe chat will occur in [The Conference Room][8] all week long. Be sure to [register yourself][9] to get an alert each week.\r\n\r\nIf you have any ideas for future topics, post them as answers to _URL_8_ and they might be used in an upcoming week!\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_6_\r\n [3]: _URL_4_\r\n [4]: _URL_3_\r\n [5]: _URL_0_\r\n [6]: _URL_5_\r\n [7]: _URL_9_\r\n [8]: _URL_1_\r\n [9]: _URL_7_", "307" ], [ "I&#39;ve forgotten the source already (apologies) but I read an article or research guide this weekend that suggested that in some periods of history, you may not be able to find a marriage record because it cost &#163;50 to have the marriage recorded. The figure of &#163;50 may have only applied to the US Colonial period, but it makes me wonder if a similar issue might apply in other times and places. In other words, if it cost too much to make the marriage &#39;official&#39; the couple would have the banns read for the three Sundays and then consider themselves married.", "126" ], [ "Find My Past has recently added a collection of England and Wales Electoral Registers, the data set [England & Wales, Electoral Registers 1832-1932][1].\r\n\r\nI would like to find background information about the registers, especially (but not exclusively) information that I can download and view off-line. Find My Past has some resources in their \" ;Learn More About These Records \" ; section, but there may be times I am working with downloaded images and can&#39;t get back online to read their background information.\r\n\r\nMy end goal is to create checklists so I can query my genealogy database and generate lists of names to look for in the registers. I would like to have:\r\n\r\n - a timeline of changes in the law and the eligibility requirements for voters \r\n - a timeline of which years have only one register and which have Summer/Autumn\r\n - any other information that helps me properly interpret the information in the registers I have collected already \r\n\r\nI am less concerned with maps covering the individual constituencies because I can capture that information from [A Vision of Britain][2]. Using the information found in the research guides, I hope to create checklists for each place I am searching for, showing what registers exist and where they can be found.\r\n\r\nWhat websites, research guides, and finding aids have been the most help to you in your research?\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "307" ], [ "Mostly I want a timeline of changes in the law, and changes in eligibility rules, plus notes on which years have spring/autumn registers instead of just one per year. The data is in the BL guides, and I can extract it, but if someone has already done so, I&#39;d rather build on prior work. Coverage in terms of parish varies by location, so if that data exists, I&#39;ll have to search the local Record Offices and FHS (family history societies), Genuki, etc. I want to build a list of cutoff dates for the eligibility for each year so I can fine-tune the possible residence dates.", "307" ], [ "I keep looking at that phrase \" ;using a combination of national and local registers \" ;. Could there be local registers, along the lines of the electoral rolls? I do have one person I&#39;m looking for who died before 5 July 1948, where I have the National Probate Calendar entry, but I don&#39;t know how practical it would be to make a FOIA request from outside the UK (and if they would take the Probate calendar as proof of death in lieu of the certificate).", "521" ], [ "For Halloween / The Day of the Dead, let&#39;s focus on cemetery records. If you&#39;ve found them to be helpful in your research, post a self-answered question and show everyone what you discovered. If you&#39;ve got a stumper about finding a burial, write up a question.\r\n\r\nIf there&#39;s a particular Topic Challenge you&#39;d like to see, post your ideas in [Vote for the next Topic Challenge!][1]\r\n\r\n\r\n [1]: _URL_0_", "152" ], [ "As I was writing up the Topic Challenge for this week, I noticed that we currently have these tags relating to burials and cemeteries:\r\n\r\n - [tag:burial] has 9 questions and no usage guidance\r\n - [tag:burial-records] has 3 questions and this description \" ;For questions about finding or interpreting records of burials. \" ;\r\n - [tag:cemeteries] has 10 questions and no usage guidance\r\n - [tag:grave-marker] has 10 questions and is for \" ;Artifacts or symbols that denote the burial of someone. \" ;\r\n\r\nI think all of these tags could be useful, but at the moment, the questions attached to each of these tags aren&#39;t necessarily questions that belong together.\r\n\r\nHere are my initial thoughts on what kind of tagging might be most useful, assuming we want to keep all three of these tags.\r\n\r\n**Proposal one:** reserve [tag:cemeteries] for questions that pertain to entire cemeteries:\r\n\r\n - _URL_4_\r\n\r\n**Proposal two:** reserve [tag:burial-records] for questions about how to **interpret** parish records of burials and the records about individuals created by cemeteries and undertakers\r\n\r\n - _URL_0_\r\n\r\n - _URL_2_\r\n\r\nThe tag [tag:grave-marker] is straightforward enough and is useful for questions that discuss the actual stones or other markers. \r\n\r\nOther questions that don&#39;t fall under these three tags, including finding records of burials, could be tagged with the more generic [tag:burial]. (We also have the tag [tag:locating-records] which could apply to those questions.)\r\n\r\nAt the moment, the tagging of questions is nothing like the proposal I&#39;ve outlined above. < s > We have problems like this question:\r\n\r\n - _URL_1_\r\n\r\nwhich is currently tagged [tag:headstone] [tag:grave-marker] and [tag:cemeteries] along with its place.\r\n\r\nIt makes more sense to me to have a [tag:preservation] on this question along with [tag:grave-marker], and to make [tag:headstone] a synonym of [tag:grave-marker]. And I see from the suggestions given by the site that we already have a prior question on that topic from 2013:\r\n\r\n - _URL_3_;\r\n\r\nI would like to see the tags bring together the questions which are functionally the same -- with [tag:cemeteries] noting the questions pertaining to research about cemeteries, [tag:burial] for individual burials, [tag:grave-marker] about the stones, and so on.\r\n\r\nPlease look over the questions we have, and post your suggestions below.", "423" ], [ "Do you have a story to tell about tracking down the final resting place of your family members? Come chat with us and talk about what finds you&#39;ve made (and the misadventures you may have had while getting there).\r\n\r\nThe chat will occur in [The Conference Room][1] all week long. Be sure to [register yourself][2] to get an alert each week.\r\n\r\nIf you have any ideas for future topics, post them as answers to _URL_1_ and they might be used in an upcoming week!\r\n\r\n[1]: _URL_0_\r\n[2]: _URL_2_", "307" ], [ "Hi, welcome to G & _URL_0_! This is a very good question -- but I have put it on hold because it is a near-duplicate of a previous question. If you want to edit your question to ask about a specific search result from that database (to ask if there might be other places to get that information) please use the edit link under your question. If the answers here and to the previous question don&#39;t help, edit your question and let us know why not We also encourage all new users to take the [tour] and to take a look at the [help] and [Meta] to get more information about how the site works.", "262" ], [ "@vervet My point is that if you are making an assumption, you need to be *aware* of what that assumption is. I don&#39;t care how unusual a name is -- there is always the possibility that there might be more than one person bearing that name. Being careless about how we know what we know is a major factor in how we create brick walls for ourselves. You say we can&#39;t be sure even if we have a certificate -- so -- that holds true even more for an index entry, which has far less information extracted than the original record has.", "495" ], [ "Electoral Registers -- lists of voters -- can be a fantastic resource for filling in gaps in your family&#39;s timeline. But they can be a challenge to find and to work with. \r\n\r\nHow do you find them? What research guides have been helpful? How do you organize the information you find. \r\n\r\nShare your tips and techniques by posting a self-answered question, or talking about them in the Conference Room this week.\r\n\r\n---\r\n\r\nThe chat will occur in [The Conference Room][2] all week long. Be sure to [register yourself][3] to get an alert each week.\r\n\r\nIf you have any ideas for future topics, post them as answers to _URL_1_ and they might be used in an upcoming week!\r\n\r\n\r\n [1]: _URL_3_\r\n [2]: _URL_0_\r\n [3]: _URL_2_", "307" ], [ "In the post [Short circuited!][1], posted on 9 Oct 2015, <PERSON> says:\t\r\n\r\n > [T]he records of the Circuit Courts from 1789 until 1911 are\r\n > considered trial court records, and they’re in Record Group 21,\r\n > Records of the United States District Courts. You’ll find them in the\r\n > specific National Archives branch that has the records for the\r\n > District Courts in that state.\r\n\r\n<PERSON> refers her readers to the [interactive map at the Federal Judicial Center][2], where you can mouse over the map and see what courts are included in that area. \r\n\r\nThe graphic in her blog posts shows that Mississippi and Louisiana, along with Texas, are in Circuit 5:\r\n\r\n - Fort Worth, U.S. Court of Appeals for the Fifth Circuit, Alabama, Florida, Georgia, Louisiana, Mississippi, and Texas.\r\n\r\n[The National Archives at Fort Worth][3] has [finding aids][4] for the records in RG21 -- here is the page for [Louisiana][5].\r\n\r\n<PERSON> also gives pointers to other resources on the Federal Judicial Center website, including a downloadable PDF, Guide to Research in\r\nFederal Judicial History.\r\n\r\nTo locate information about <PERSON>, it might help to find clues that would pinpoint when and where he was riding circuit, since the statutes in effect at the time would give you clues to where the records turned up. The [History of the Federal Judiciary][6] shows a timeline for the Fifth Circuit:\r\n\r\n > The Federal Judicial Circuits Organization of the Fifth Circuit\r\n > \r\n > - 1801 Georgia, North Carolina, South Carolina. (2 Stat. 89)\r\n > - 1802 North Carolina, Virginia. (2 Stat. 156)\r\n > - 1842 Alabama, Louisiana. (5 Stat. 507)\r\n > - 1862 Alabama, Florida, Georgia, Mississippi, South Carolina. (12 Stat. 576)\r\n > - 1866 Alabama, Florida, Georgia, Louisiana, Mississippi, Texas. (14 Stat. 209)\r\n > - 1948 Alabama, Canal Zone, Florida, Georgia, Louisiana, Mississippi, Texas. (62 Stat. 870)\r\n > - 1980 Canal Zone, Louisiana, Mississippi, Texas. (94 Stat. 1994)\r\n > - 1982 Louisiana, Mississippi, Texas. (93 Stat. 493)\r\n\r\nPossible sources of information, in addition to the court records themselves, might be:\r\n\r\n - State and County histories\r\n - Newspapers\r\n - Manuscript collections (diaries, etc.) in local, county, and state archives\r\n - The Congressional Record\r\n - The U.S. Congressional serial sets -- available through Heritage Quest (at some libraries) and Genealogy Bank (by subscription) -- see NARA&#39;s Know Your Records presentation [Genealogy Research Using the U.S. Congressional Serial Set (2016 Feb. 25)][7] on YouTube\r\n - *The Official register of the United States* has lists of judges for the District and Circuit Courts (check Google Books, the Internet Archive, and other online &#39;repositories&#39;)\r\n - OHGenweb&#39;s [Circuit Riders Database][8] (parts are hosted on RootsWeb) -- as of late Feb 2016 RootsWeb was down because of hardware difficulties and is scheduled to be back after 15 March 2016.\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_4_\r\n [3]: _URL_2_\r\n [4]: _URL_2_finding-aids/\r\n [5]: _URL_0_\r\n [6]: _URL_6_\r\n [7]: _URL_3_\r\n [8]: _URL_7_", "307" ], [ "To complement [the previous answer][1] -- sites do exist where people have shared their GEDCOM files for download. Here are some things to consider if you could download the entire tree. &#39;Best practice&#39; is to NOT merge their entire tree with yours, but to keep it separate and to use it as a reference because:\r\n\r\n - Some sites which allow users to upload trees don&#39;t have good mechanisms to allow the tree owners to update their tree. So the same person may have uploaded their tree multiple times (or on multiple sites). It isn&#39;t always obvious which of these trees is the most recent, and without talking to the owner, you can&#39;t know if they still agree with what they &#39;published&#39; previously.\r\n - Trees made with the aid of Hints may have errors because a bad identification was suggested by the hint algorithm -- and on a site like Ancestry that generates hints, you don&#39;t know whether the tree was made for &#39;hint bait&#39;. A person may attach a hint without doing any research at all, simply to see what other hints may show up if that speculative hint is &#39;correct&#39;. Since Ancestry doesn&#39;t have a flag to indicate the tree owner is not sure about a particular source or fact, unless the owner leaves a comment to alert other readers, there is no way to tell which part of the tree may be soundly researched and which parts are speculative, except by guessing that the outermost bits of the tree are likely to be the most &#39;iffy&#39;. Now consider that any part of the tree could have been, at one time or another, one of those &#39;speculative&#39; bits -- or could have been copied from someone else&#39;s \" ;hint bait \" ; tree.\r\n\r\nSome of the best professional genealogists I know warn people not to trust *their* work blindly, but to evaluate the work yourself. You can learn far more by examining and evaluating any sources used, and asking why someone might have decided a fact was correct, than you can by simply plugging the raw facts from their tree into your own.\r\n\r\n \r\n\r\n\r\n [1]: _URL_0_", "307" ], [ "I&#39;m playing a lot with my friends and daily we encounter something extremely hilarious. I would like to save these moments so we could watch them later.\r\n\r\nThis is what I would like to achieve:\r\n\r\n- Record HDMI stream with a 3rd party device so it doesn&#39;t lag my PC at all.\r\n- Record what others say in mumble\r\n- record what I say in mumble\r\n\r\nIs there a device that can do this?", "361" ], [ "Earlier this year, Ancestry introduced \" ;New Ancestry \" ; as a beta. Now they have announced that the new look-and-feel will become permanent on 14 (Australia) and 15 (United States) December. Have you used the new system yet? After months of tweaking, is it finally ready for Prime Time? \r\n\r\nCome chat about it in the Conference Room -- and share your experience.\r\n\r\nThe chat will occur in [The Conference Room][1] all week long. Be sure to [register yourself][2] to get an alert each week.\r\n\r\nIf you have any ideas for future topics, post them as answers to _URL_1_ and they might be used in an upcoming week!\r\n\r\n[1]: _URL_0_\r\n[2]: _URL_2_", "307" ], [ "I am trying to upload a basic Blink code from my computer to Arduino Lilypad contains Atmega 328. While my Blink codes are uploading, **FTDI 1402-C CN480661 FT232RL** module is not responding to the Arduino IDE at the end of the process. So I couldn&#39;t upload any codes with this uploading method, I mean using FTDI modules directly.\r\n\r\nThis is how I do the connections:\r\n\r\n[![enter image description here][1]][1]\r\n\r\n\r\nThis is my Blink code:\r\n\r\n void setup() { pinMode(13, OUTPUT);}\r\n\r\n void loop() {\r\n digitalWrite(13, HIGH); delay(1000); \r\n digitalWrite(13, LOW); delay(1000); \r\n }\r\n\r\nI chose **AVRISP mkII** as a programmer. **ATmega328** as a processor. **Arduino Lilypad** as a board on *Arduino IDE* **v1.6.6**\r\n\r\n\r\nAt this point, I got this error:\r\n\r\n > avrdude: ser_open(): can&#39;t open device \" ;\\\\.\\COM4 \" ;: Access is denied\r\n\r\nWindows&#39;s device manager says: USB Serial Port is attached to COM4, also Arduino IDE saw that.\r\n\r\n[![enter image description here][2]][2]\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_\r\n\r\nI downloaded FTDI driver for Windows, but still, I can&#39;t upload any code into my Lilypad Arduino.\r\n\r\nHow can I use FTDI to program my Lilypad Arduino?", "322" ], [ "Welcome to G & _URL_0_! We encourage all new users to take the [tour] and to read the guidelines in the [help] about how to ask a good question. Your question may not get much attention because it is very broad. It might require different answers for different time periods. If you can add an approximate date range for the periods you are interested in, or have any other information that would help focus your question, you can add it by using the edit link below your question.", "262" ], [ "Following up on last week&#39;s chat topic [New Ancestry: The Good, The Bad, The Ugly][1], let&#39;s talk about the main areas of the site. Some of the new record collections, like the recently-added collections in the [Wills, Probates, Land, Tax & Criminal][2] category, are only accessible to users who are using the new site.\r\n\r\nHave you had difficulty searching, especially in these new collections? What problems have you had? What workarounds have you discovered? \r\n\r\nCome chat about it in the Conference Room -- ask questions, share your experiences. And if you solve a problem or make a new discovery because of the chat, don&#39;t forget to write up what you learned in a self-answered question.\r\n\r\nThe chat will occur in [The Conference Room][3] all week long. Be sure to [register yourself][4] to get an alert each week.\r\n\r\nIf you have any ideas for future topics, post them as answers to _URL_4_ and they might be used in an upcoming week!\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_3_;\r\n [3]: _URL_1_\r\n [4]: _URL_2_", "307" ], [ "Thanks for accepting my answer, but aren&#39;t we still missing a document? Presumably the same process can be used to find the accounting in the volume holding the accounting records. Do you want to break that out into a different question? P.S. Upvoted because it is good to know how to use the browse on Ancestry because there are many records in the new probate collection which have NO names at all in the index. In one of my counties there are nearly 4000 entries with no name indexed at all.", "307" ], [ "P.S. I think your question would be a bit more clear if you led off with the \" ;where can I find the detail of these index records to find out who these individuals were? \" ; and put all the material above it at the end. Yes, your research question is to establish the identity of all the people, but your G & _URL_0_ question is how do I use the index to locate the full records? I say this as someone who is also guilty of talking too much about the research question in the how-do-I-find-it question.", "814" ], [ "Let&#39;s chat about the hot topic of the month: the release of the long-awaited 1939 Register. Share your search tips and triangulation strategies -- and if you&#39;ve unlocked any of the records, talk about what you&#39;ve found.\r\n\r\nThe chat will occur in [The Conference Room][1] all week long. Be sure to [register yourself][2] to get an alert each week.\r\n\r\nIf you have any ideas for future topics, post them as answers to _URL_1_ and they might be used in an upcoming week!\r\n\r\n[1]: _URL_0_\r\n[2]: _URL_2_", "307" ], [ "Welcome to G & _URL_0_! We encourage all new users to make use of the material in the [help] about how to ask a good question (I see by your badge that you have already taken the [tour]). I have removed your signature because the system automatically signs your question by adding your user card. You will get a better answer if you let us know how you know all the information you have written in your post. What sources have you looked at already?", "262" ], [ "Please do not post naked links to records (or trees) other sites. If something goes awry, people cannot see what record you are referring to. The information you&#39;re calling our attention to as part of your question should be incorporated as a quote in the body of the question (or answer) itself. Note that some sites do not have permalinks so it is impossible to bookmark individual search results -- in that case, it is best to link to the search page and state in your post exactly what search terms you used to find that result.", "541" ], [ "The same profile also has an unsourced Residence fact of \" ;27 Diggle Street \" ; in Wigan with the same date as Doris&#39; birth. The obvious next step is not to copy this tree blindly but to contact the owner and ask nicely if they have other source material which is not cited on their tree. Failing a reply, one could also search that address in the 1911 Census or 1939 Register and see what names pop on the preview.", "521" ], [ "<PERSON>; blog post [National registration day: 29 September 1939][1] says:\r\n\r\n > The completed household schedules were collected and returned to each\r\n > local National Registration Office, but they did not remain there.\r\n > Each person’s details were transferred to index cards, and the\r\n > original forms were sent to the local Food Office, for the preparation\r\n > of ration books. They were eventually reunited later in the war when\r\n > the National Registration Offices and Food Offices were combined.\r\n\r\n\r\nAn archived post (from nine years ago) from the newsgroup [soc.genealogy.britain][2] contains a summary of a communication received from [ONS][3] (Office for National Statistics):\r\n\r\n > 1. We do not know whether households completed forms. If they did, then they are certainly no longer in existence.\r\n > \r\n > 2. What we do have is the Transcript Books which are the schedules (booklets) made up by the 1939 enumerators showing one line of\r\n > information for each person in the household.\r\n > \r\n > 3. We do NOT have index cards made up from the household forms.\r\n > \r\n > 4. What we do have is the A1 which is a card index originally made up from the information held at Local Registration Offices and sent to\r\n > Southport at the time National Registration ended in 1952. These cards\r\n > contained information relating to the whereabouts, name, etc, of\r\n > persons in 1952 which was not necessarily the same as in 1939 if they\r\n > had moved house, got married, etc. These cards were added to and/or\r\n > amended right up until 1991 in respect of persons born before 1952.\r\n > \r\n > 5. These documents are no longer held in the Ballroom at Smedley Hydro. Some are in the basement and some are on microfilm.\r\n > \r\n > Further queries with regard the 1939 National Registration records\r\n > should be directed to the ONS Customer Contact Centre at\r\n > ***@statistics._URL_5_\r\n > \r\n > Ref: CCC84596 End of ONS message\r\n\r\nI searched for research guides on the ONS site, similar to the ones ONS provides for historical census data, but so far I haven&#39;t found any.\r\n\r\nAccording to <PERSON> *Lost Cousins* [Newsletter published 24 Aug 2015][4], the original forms haven&#39;t survived (he doesn&#39;t cite a source for that information).\r\n\r\nThe catalog description for [General Register Office: National Registration: 1939 Register][5] at TNA says:\r\n\r\n > For correspondence and papers on the administration of the 1939\r\n > Register, please see: RG 28\r\n\r\nRG28 is [General Register Office: National Registration: Correspondence and Papers][6]\r\n\r\nIf there is a discussion about whether the original household schedules should be retained or destroyed, it *might* be somewhere in RG28.\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_6_\r\n [3]: _URL_4_\r\n [4]: _URL_2_\r\n [5]: _URL_0_\r\n [6]: _URL_3_", "521" ], [ "The basic principle in studying family history is always to start what you know and work outwards from there in small increments. If you have a street address from the 1881 Census, or at least a district, the first thing I would do is look into the history of London street re-numbering -- I would not assume that any historical address that I found could be dropped into Google Street View.\r\n\r\nIf you can find a period city directory or London newspapers close in time to the 1881 Census, see if you can locate companies that might have made instruments in London (comparable to [The Cambridge Scientific Instrument Company][1]). Advertisements or catalogs might give you an idea of what sort of goods were manufactured there, and you might be able to find photos in auction catalogs.\r\n\r\nBy searching on Google, you can turn up history of science works such as Julian Holland&#39;s [ \" ;Historic Scientific Instruments and the Teaching of Science: A Guide to Resources \" ;][2] or works such as Gerard L&#39;Estrange Turner&#39;s *[Scientific Instruments, 1500-1900: An Introduction][3]* (check [_URL_1_][4] for a copy in a library near you).\r\n\r\nIf your 2Great-grandfather worked for an individual researcher rather than a business, you might get a &#39;lucky dip&#39; in a manuscript collection of that person&#39;s papers, or perhaps if he worked for a well-known firm, some business records might survive. \r\n\r\nThe National Archives (TNA) suggests looking in local archives. Museums that have collections of period scientific instruments might have research guides and finding aids. \r\n\r\nThis is the kind of problem where you have to go at it from multiple directions at once -- it&#39;s not likely to be a simple case of looking him up by name. But it can also be a lot of fun, learning about what instrument he *might* have created, even if you can&#39;t find out for sure.\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_4_\r\n [3]: _URL_3_\r\n [4]: _URL_2_", "307" ], [ "I think it is essential to look at case studies from other genealogists who have researched people who \" ;just disappeared \" ; -- so I recommend that you take the webinar coming up on Saturday, December 5 \" ;The Curious Case of the Disappearing Dude \" ; which is being presented by the Southern California Genealogical Society, If you attend the live broadcast you can watch it for free -- afterwards, the recording is available only to members of the Society. See the schedule at _URL_0_ I agree that your question as written is much too vague and too broad.", "307" ], [ "My main research is kept on my computer -- I attach sources to Ancestry&#39;s and Find My Past&#39;s online trees primarily as a means to keep track of what records I&#39;ve already found on Ancestry and Find My Past. But there&#39;s a weakness in both lineage-linked software and online trees -- they don&#39;t provide tools to keep track of data about localities in the same way that we can keep track of information about people. \r\n\r\nOne of the problems of doing research online with sites like Ancestry and Find My Past is that the same locality can be reported in the search results under many different names. You might find someone in the same place and not recognize it because the place name that turns up in the search results is not the one you expected to see.\r\n\r\nFor one of my families living in Plymouth for three decades, when I attached the 1891 Census to the tree, Ancestry&#39;s online tree system assigned them a Residence in Charles, Devon, England. When you look at the record abstract in the New Ancestry interface, this is what you see:\r\n\r\n - Civil parish:\tCharles\r\n - Ecclesiastical parish:\tEmmanuel\r\n - Town:\tLaira\r\n - County/Island:\tDevon\r\n - Country:\tEngland\r\n - Registration district:\tPlymouth\r\n - Sub registration district:\tCharles\r\n\r\nFor the same record (matching archive reference of RG12/1725/24/41), Find My Past&#39;s transcription reports \" ;Belgrave Road, Plymouth, Devon, England \" ;. Here&#39;s the transcription as it appears on [FamilySearch][1].\r\n\r\nIt&#39;s a simple matter to edit the fact on the online tree to say \" ;Plymouth \" ; instead of \" ;Charles \" ; and to note the address and various sub-districts in the description field. In many modern programs, we need to regularize the place name to make use of queries and mapping tools. But if we record all the place names as they appear in the original source, how can we make use of that information?\r\n\r\nWhat I&#39;m trying to do now is make up research notes about the locality which I can refer to, in case I am offline and I can&#39;t make use of the GENUKI gazetteer, A Vision of Britain, _URL_0_, or Curious Fox&#39;s lists of villages. I would like something I can refer to quickly, so if I am evaluating a baptism for Emmanuel Parish in Plymouth, I can see at a glance that I am in the same area as this family from this census. I am currently cross-checking all my other records against the electoral rolls (and the 1939 Register for those people still living in 1939). I can capture pages from all of my favorite geographical reference sites, but I want to make some kind of summary of what I&#39;ve collected.\r\n\r\nDo you transcribe the entire census record, headers and all? \r\n\r\nThe blank form for the 1891 Census has spaces to record:\r\n\r\n - Civil Parish\r\n - Municipal Borough\r\n - Municipal Ward\r\n - Urban Sanitary District\r\n - Town or Village or Hamlet\r\n - Rural Sanitary District\r\n - Parliamentary Borough or Division\r\n - Ecclesiastical Parish or District\r\n\r\nEcclesiastical Parish is useful when cross-checking against baptisms and other church records; parliamentary boroughs and divisions are clues for tracing electoral rolls. Even the sanitary districts can be used as clues to other records; I&#39;ve found articles about local water quality via the British Newspaper Archive.\r\n\r\nHow do you organize this material? Do you keep spreadsheets, make tables, or some other method? What are the advantages and disadvantages of the methods you use?\r\n\r\n----------\r\n\r\nSince writing the question, I see I could have saved myself a great deal of difficulty by going directly to Lewis&#39; A Topographical Dictionary of England at [British History Online][2], but at the time I wrote the question, I didn&#39;t know about the website; I was only vaguely aware of <PERSON> as the source behind A Vision of Britain.\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_2_", "307" ], [ "In 1901 FamilySearch reports the sub-district as Charles, but I don&#39;t see that on the actual image _URL_0_. FamilySearch puts them in St. Augustine ecclesiastical parish but the corresponding image at Find My Past says their EP is Emmanuel (same street, different house number). Thus my difficulty -- I need to record what&#39;s actually on the image, plus what it says on the index/transcription even if that doesn&#39;t match.", "521" ], [ "Yes, I should check that, thanks! I just looked at 1901 again, and it appears that the information in the headers is in a different ink than the lines holding the family names, etc. But the question remains -- how to make a visual summary of what I&#39;ve found, so that I can see this at a glance when I don&#39;t have access to A Vision of Britain to give me the administrative history of the place.", "521" ], [ "Remembrance Day / Veterans&#39; Day was this week. Did you find any new information about the service members in your family? Do you need help finding or interpreting something in their records?\r\n\r\nCome chat about it in the Conference Room -- share your stories! And if you have research tips to share or a puzzler you just can&#39;t solve, write up a question for the main site.\r\n\r\nThe chat will occur in [The Conference Room][1] all week long. Be sure to [register yourself][2] to get an alert each week.\r\n\r\nIf you have any ideas for future topics, post them as answers to _URL_1_ and they might be used in an upcoming week!\r\n\r\n[1]: _URL_0_\r\n[2]: _URL_2_", "307" ], [ "I have Arduino Uno and 0.96 \" ; I2C Oled 4 Pinned display. These are my Arduino codes:\r\n\r\n\r\n\r\n #include \" ;U8glib.h \" ;\r\n\r\n U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE);\t// VDD=5V SCL=A5 SDA=A4\r\n\r\n int a = 10;\r\n\r\n void setup(void) {\r\n }\r\n\r\n void loop(void) {\r\n\r\n u8g.setFont(u8g_font_gdr25r);\r\n u8g.drawStr(8, 30, \" ;E \" ;);\r\n u8g.setFont(u8g_font_gdr25r);\r\n u8g.drawStr(30, 30, \" ;l \" ;);\r\n delay(2000); \r\n\r\n // u8g.println(a); //This code raw is not working\r\n // delay(2000);\r\n }\r\n\r\nI am trying to indicate integer type variable is called \" ;a \" ; to the OLED screen, but u8glib library hasn&#39;t got \r\n\r\n > println( (int) a );\r\n\r\n function to do this. I only see \r\n > u8g.drawStr(); \r\n\r\nfunction that this can&#39;t handle integer variables to the display. How can I do that?", "963" ], [ "The blog at [1PS One Place Studies][1] has several posts with finding aids for information about the EDs in the 1939 Register (list has newest posts on top):\r\n\r\n - [1939 Register – Piece Number Quick Filter Tool][2] posted 13 Dec 2015 links to a QuickFilter Tool on [KiwiTrees][3] for the information in the links immediately below\r\n - [1939 Register – England & Wales – Enumeration Districts][4] posted 10 Dec 2015\r\n - [1939 Register – Wales – Enumeration Districts][4] posted 6 Dec 2015\r\n\r\nThere might be ED maps at The National Archives, but so far, I haven&#39;t been able to determine a good archive reference for them.\r\n\r\nSearching on Discovery, the catalog of The National Archives, for the keywords \" ;RG 101 \" ; and \" ;maps \" ; brought me to [this page][5] describing **Records of the General Register Office, Government Social Survey Department, and Office of Population Censuses and Surveys**. Within this page are two references to groups of GRO records with maps:\r\n\r\n - Maps of superintendent registrars&#39; districts, RG 18.\r\n - Maps of superintendent registrars&#39; districts and sub-districts are in RG 18.\r\n\r\nBoth of these lead back to the main catalog description for RG 18. Filtering for records at TNA, \" ;1925 - 1949 \" ;, \" ;Maps and Plans \" ; and records of the GRO leaves [one entry][6] which turns out to be the main description for the records about the 1939 Register arrived at with the earlier search.\r\n\r\nStarting with a fresh search and browsing through [RG 18][7] yields some entries for 1 inch and 6 inch Ordnance Survey maps for the 1921 Census, which might be a good starting point. I did not see an entry for ED maps while doing the browse.\r\n\r\nTNA&#39;s main research guide on the 1939 Register says:\r\n\r\n > The enumeration districts used for the Register were based broadly on\r\n > those used for the 1931 Census, sub-divided into smaller units. Some\r\n > were altered to account for the expansion in housing or to coincide\r\n > with reorganised voting district boundaries. The general rule was that\r\n > an enumeration district should contain no more than 300 households,\r\n > not counting institutions. For more information about enumeration\r\n > districts please read [understanding the 1939 registration districts][8].\r\n\r\nThat link goes to the article on Find My Past, which has no mention of maps.\r\n\r\nThe British Library has several guides to [electoral registers][9] on their site. Using guides such as [Parliamentary Constituencies and their Registers Since 1832][10] in conjunction with maps on [A Vision of Britain][11] might help, but if you are looking for enumerator&#39;s maps that define the actual street boundaries of each ED, so far I have not been able to find them.\r\n \r\nFor a case study, see [Census etc: 1930s][12] | 1939 National Register of England and Wales at the One-Name Study site [_URL_13_][13].\r\n\r\nThanks to the Twitter followers listed below for their contributions to this answer:\r\n\r\n - [OnePlaceStudiesXTRA][14] @1PlaceStudyReg\r\n - [_URL_13_][15] @AtcherleyONS\r\n - [<PERSON>] @DavidUnderdown9 \r\n \r\n----------\r\n\r\nThese maps aren&#39;t keyed to the 1939 Register specifically, but check the Ordnance Survey maps at the [National Library of Scotland][17]. In some of the series, there are maps from the late 1930s or early 1940s that show the district boundaries, like this [1:25,000 series map of Plymouth][18].\r\n\r\n[![enter image description here][19]][19]\r\n\r\n\r\n [1]: _URL_16_\r\n [2]: _URL_2_\r\n [3]: _URL_15_\r\n [4]: _URL_5_\r\n [5]: _URL_14_\r\n [6]: _URL_0_\r\n [7]: _URL_8_\r\n [8]: _URL_9_\r\n [9]: _URL_18_\r\n [10]: _URL_1_\r\n [11]: _URL_12_\r\n [12]: _URL_6_\r\n [13]: _URL_7_\r\n [14]: _URL_11_\r\n [15]: _URL_19_\r\n [16]: _URL_4_\r\n [17]: _URL_17_\r\n [18]: _URL_3_\r\n [19]: _URL_10_", "307" ], [ "Some records do exist, although what I found is much later than the introduction of the Act in 1853.\r\n\r\nThe National Archives catalog has [General Register Office: Smallpox Vaccination Returns][1] as part of RG 56. However, the catalog description says:\r\n\r\n > This series contains smallpox vacination returns for the years\r\n > 1898-1921 and 1938-1941. These smallpox returns contain statistical\r\n > information not likely to be found in any such detail elsewhere.\r\n > \r\n > **These registers do not contain personal information.**\r\n\r\nLooking at the individual sub-series, many of the descriptions are marked \r\n\r\n > This record has not been digitised and cannot be downloaded.\r\n\r\nThe records are listed as open access, but you have to get a reader&#39;s ticket to view them, or ask for a quote to get copies made and sent to you. \r\n\r\nI searched within this group for Nottingham and Nottinghamshire and got no results. However, one group of 1941 records (RG 56/24) is labeled \" ;Norfolk to Yorkshire \" ; so it isn&#39;t safe to assume the name of the locality you seek will be in the catalog description.\r\n\r\nIt might be worthwhile to inquire at TNA to ask what they mean when they say \" ;The registers do not contain personal information. \" ; I&#39;ve seen similar cautions about electoral registers (e.g. in the British Library&#39;s research guides), but if the researcher understands the original records, they can still be quite useful for family history study despite the lack of \" ;personal \" ; information. \r\n\r\n----------\r\n\r\nOne possible source of information about vaccinations might be in the [Poor Law Union][2] records. Find My Past has transcriptions by the Devon Family History Society which are said to be extracts from the \" ;Brixham Vaccinator Register 1905-1907 \" ; held by the Devon Heritage Center under a PLU reference number. This extract had a name, age (2 months), date of vaccination, and residence (the street name and town). Going to the website of the Devon FHS, I found several publications of vaccination register extracts in their store under the category [Joint Projects with Devon Record Office][3].\r\n\r\n\r\nCheck local archives for your research area to see if they might have similar registers in their collections, and if the local family history society has published extracts or transcriptions.\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_1_\r\n [3]: _URL_0_", "521" ], [ "This is the image from the source linked in your question:\r\n\r\n[![enter image description here][1]][1]\r\n\r\nI retweeted your question during a chat today, and [<PERSON>] at _URL_2_ kindly gave [this answer][3] (you can see from the conversation that [<PERSON>] agrees):\r\n\r\n > In C17th St Andrews, Mr implied magister i.e. master&#39;s degree rather than bachelor&#39;s.\r\n\r\nYour source confirms this because it says <PERSON> after his name and gives his college and graduation date. I suggest paging back to the front matter in your published source to see if there is a legend explaining the format of the entries. If not, try looking for a research guide that explains how to use this source.\r\n\r\nAs a test of whether other clergymen might be so listed in their marriage records, if you don&#39;t have the resources to look for the records of other married clergy with M.A. degrees, you could try searching for case studies from other genealogists studying people in the same period. It is useful to know which other people are working in the same geographical area and time periods that you are, even if you have no research subjects in common. They may be familiar with source material for the area that you didn&#39;t know about.\r\n\r\n----------\r\n\r\n<PERSON> also [tweeted][5] the link to his entry in the University of Edinburgh&#39;s [Laureation (graduation) Register][6] (click through to see the full image):\r\n\r\n[![enter image description here][7]][7]\r\n\r\n\r\n [1]: _URL_6_\r\n [2]: _URL_7_\r\n [3]: _URL_3_\r\n [4]: _URL_5_\r\n [5]: _URL_4_\r\n [6]: _URL_0_\r\n [7]: _URL_1_", "906" ], [ "Upvoted for the link to the GenGuide article. In my opinion, any record which places an individual in a specific place at a specific time has value -- a single record may not have a lot of &#39;wow&#39; factor by itself, but can be extremely useful when viewed in combination with other records. A strong *group* of records with indirect evidence can be more accurate than a single primary source with direct evidence.", "718" ], [ "The page in Ancestry&#39;s Support Center about installing updates is here:\r\n\r\n[Family Tree Maker 2014 - Installing Updates][1]\r\n\r\nLook for this section of the page:\r\n\r\n[![enter image description here][2]][2]\r\n\r\nRight click on the link for the file you want and click \" ;Save Link As \" ; or \" ;Save Target As \" ; (whichever command is correct for the browser you use).\r\n\r\nSave the files to a known directory. After that, you can store them in your preferred format in case you need to re-patch the program after it is no longer available from Ancestry. You can also print the instructions page on installing the upgrades manually to a PDF.\r\n\r\nThe files are small enough to fit on a CD-ROM which can be stored with your install disc. You can also back them up on other media for extra security. \r\n\r\nHere are the links that were accessed and working on 17 Dec 2015:\r\n\r\n - [32-bit patch (zip)][3] \r\n - [32-bit patch (exe)][4]\r\n - [64-bit patch (zip)][5]\r\n - [64-bit patch (exe)][6]\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_5_\r\n [3]: _URL_4_\r\n [4]: _URL_3_\r\n [5]: _URL_2_\r\n [6]: _URL_1_", "487" ], [ "This is a stub of an answer which I&#39;ll expand on, once I find the notes I took during my previous searches of Scotlands People.\r\n\r\nFollowing a suggestion from AdrianB38 to look for directories at the National Library of Scotland, I began by looking for a period map. Some City Directories have numerical guides as well as alphabetical lists, and if you can find a period map to use along with the city directory, the combination can be very helpful. \r\n\r\nAccording to Glasgow Guide&#39;s table of [Street Name Changes][1], described as \" ;A list of Glasgow street names which were subject to change prior to the 1940s \" ;. Holmhead Street&#39;s new name is Cunningham Street, C1. \r\n\r\nHowever, when I attempted to use the NLS&#39;s historical map feature, which has a gazetteer, no results appear if you type in Cunningham Street, C1.\r\n\r\nNext I discovered a thread on an Ancestry message board [Old Glasgow Streets][2], where an Ancestry member <PERSON> asked for help finding an address on Holmhead street. User <PERSON> posted this reply:\r\n\r\n > The street no longer exists. It WAS in the city centre, but nowadays\r\n > the Buchanan Galleries shopping centre covers that area. If you look\r\n > at a modern map it ran in between and parallel to Cathedral Street and\r\n > Killermont Street.\r\n\r\nThe thread had links to the OS maps at the [National Library of Scotland][3], and to a [1935 Glasgow Street map][4], both posted by member <PERSON>.\r\n\r\nHaving these two maps to triangulate will help once I start exploring the city directory collection.\r\n\r\n[![OS Six Inch, 1888-1913 map series at NLS][5]][5] \r\n\r\nSnipped from [OS Six Inch, 1888-1913 map series at NLS][6]\r\n\r\n[![enter image description here][7]][7]\r\n\r\nSnipped from quarter 2 of [1935 Map of Glasgow][4]\r\n\r\nWe can see from the maps that Holmhead Street had already been renamed by the time the 1935 Map was published.\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_4_\r\n [3]: _URL_5_\r\n [4]: _URL_2_\r\n [5]: _URL_3_\r\n [6]: _URL_0_\r\n [7]: _URL_6_", "521" ], [ "Since working forward chronologically has not been successful so far, work backwards from your known information and look for clues that might point you at his arrival date.\r\n\r\nHe died in 1954. That means you could:\r\n\r\n - Look for clues in his obituary or in other newspaper articles published around the time he died, or retired from his job.\r\n - Request an index search via [USCIS&#39;s Genealogy Program][1]. This would tell you whether the USCIS (the agency formerly called the INS) had any files about him. The USCIS&#39;s website and live webinars explain the [five record groups held by USCIS][2] which can be ordered if an index search is successful. USCIS can also advise you if any of the files created by their agency are old enough to be archival -- that is, whether they have been turned over to the US National Archives (NARA). Since he arrived in the US after 1906, the INS should have received a copy of his naturalization papers if he naturalized. Those papers are supposed to give the date of the person&#39;s arrival and the ship he arrived on.\r\n - Look for [Clues in Census Records][3]. Look for the 1920 and 1930 Census to see what information the census has about his naturalization status and the date of his arrival in the US. You have the 1920 Census -- does the 1930 Census agree or disagree?\r\n - For an overview of the Naturalization process, see the [handout][4] to a class given at the Family History Library, [Why Didn&#39;t My Ancestor Naturalize? Navigating US Naturalization Records][5] presented by <PERSON>, AG&#174;, MLS (the video is not online yet). This handout also explains the codes on the census records that indicate whether a person is naturalized.\r\n - Don&#39;t assume that your relative only entered the US once. Many families went back and forth multiple times. Search for the names of other relatives, too. Your relative might show up as the contact person in the US for a later arrival, or be listed as the closest relative in the old country while he is still in Birkenhead. Either way, the information can give you valuable clues for other searches, especially if the reason you can&#39;t find his arrival record is a faulty entry in the index.\r\n - Run searches for the passenger lists without your relative&#39;s name by using the search tools at <PERSON>: [One-Step Webpages][6].\r\n \r\nSearching records in England:\r\n - The British Newspaper Archive\r\n - [Outwards Passenger Lists][7] -- guide at The National Archives (TNA)\r\n - Search [Passenger Lists Leaving UK 1890-1960][8] at Find My Past\r\n - Search [Outwards Passenger Lists][9] at Ancestry UK\r\n\r\nGenerally speaking, the UK Outbound lists are much less nosy than the lists created for the US during this period. However, if the reason you can&#39;t find a US arrival list is due to bad indexing, the UK Outbound list might give you a ship name and departure date, which you could use to search for the corresponding arrival in the US.\r\n\r\nMy general recommendation would be to widen your search. I don&#39;t know why a resident of Birkenhead would depart from Southampton without some compelling reason, given that Liverpool is about three miles away, on the other side of the Mersey. Often the reason we can&#39;t find things is because of some tidbit of information we think we &#39;know&#39;. Sometimes it can be useful to review your information by making a list of everything you think you know, along with a list of where it came from, and by looking at all the documents you&#39;ve already collected with a fresh eye.\r\n\r\n [1]: _URL_8_\r\n [2]: _URL_1_\r\n [3]: _URL_7_\r\n [4]: _URL_2_\r\n [5]: _URL_3_\r\n [6]: _URL_4_\r\n [7]: _URL_5_\r\n [8]: _URL_0_\r\n [9]: _URL_6_", "307" ], [ "You&#39;re probably aware already that Pennsylvania&#39;s land records are defined and \r\nissued by the Commonwealth and not by the Federal Government. This is kind of obvious, since the Federal Government didn&#39;t exist in the time period your warrant comes from, but I want to mention it for the benefit of others who might be familiar with the later warrants issued by the Bureau of Land Management in the Federal Land States. Set all your knowledge of those warrants aside for the moment. \r\n\r\nIn this case, it helps to have a research guide that is specific to your state, and for Pennsylvania, try looking in WorldCat for [Pennsylvania land records : a history and guide for research][1] by <PERSON>, to find a copy in a library near you. You can also preview it or buy an eBook on [Google Books][20].\r\n\r\nOn page 13 and following, she discusses the different categories of purchasers. A section entitled [Servants][2] starts on page 16. Page 17 says:\r\n\r\n > When they were ready to claim their land, they submitted a formal\r\n > request and received a warrant to survey. Servants can be identified\r\n > by the phrasing of the warrants, which state that they were formerly\r\n > servants.\r\n\r\nThe records themselves are held by the [Pennsylvania State Archives][3]. Their website has a [Land Records Overview][4] which explains the different classes of documents created in the process of getting land. Clicking through the link about Warrants brings you to a page that describes the archives&#39; holdings and their arrangement. Another page describing the Records of the Land Office is here: [RG 17 Records of the Land Office][5].\r\n\r\nYou may also want to look at the main list of [Research Guides][6] for related records such as the guide about [Indentured Servants][7]\r\n\r\nThe FamilySearch Research Wiki&#39;s article [Pennsylvania Land and Property][8] also gives an overview and lists of resources such as indexes and maps.\r\n\r\n\r\n [1]: _URL_5_\r\n [2]: _URL_4_\r\n [3]: _URL_1_\r\n [4]: _URL_0_\r\n [5]: _URL_3_\r\n [6]: _URL_2_\r\n [7]: _URL_7_\r\n [8]: _URL_6_", "307" ], [ "Place names and boundaries change over time, but our genealogy software often encourages us to standardize on a particular set of place names. But knowing the historical jurisdictions of the time can be crucial when you want to find a record. \r\n\r\nWhat are your favorite tools and techniques for keeping track of the families that don&#39;t move at all, but the borders are shifting around them? \r\n\r\nShare your favorite sites with historical maps, archives which have special collections about places you wouldn&#39;t expect, and other ideas for finding elusive records.\r\n\r\nCome chat about it in the [Conference Room][1] -- ask questions, share your experiences. And if you solve a problem or make a new discovery because of the chat, don&#39;t forget to write up what you learned in a self-answered question.\r\n\r\nThe chat will occur in The Conference Room all week long. Be sure to [register yourself][2] to get an alert each week.\r\n\r\nIf you have any ideas for future topics, post them as answers to Weekly genealogy chat topics - now a week long event! and they might be used in an upcoming week!\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "307" ], [ "You can download a copy of the [1940 Instructions to Enumerators][1] from the US Census Bureau. \r\n\r\nStudents are discussed on page 16, under **Persons Not to Be Enumerated in Your District:**\r\n\r\n > e. Students or children living or boarding with this household in\r\n > order to attend some school, college, or other education in the\r\n > locality, but who have a usual place of residence elsewhere from which\r\n > they will be reported.\r\n\r\nHowever, on the next page, under Enumeration of Special Classes of Persons, paragraph 318 says:\r\n\r\n > 318. Students at School or College. -- If there is a school, college, or other educational institution in your district which has students\r\n > from outside your district, enumerate as residents of the school only\r\n > those students who have no usual places of residence elsewhere.\r\n > Especially in a university or professional school, there will be a\r\n > considerable number of the older students who are not members of any\r\n > household located elsewhere. Find and enumerate all such persons.\r\n\r\nMy search strategy would be to find a published history of the boarding school that listed the staff at the school. \r\n\r\nParagraph 319:\r\n\r\n > **School Teachers.** -- Enumerate teachers in a school or college at the place where they live while engaged in teaching, even though they\r\n > may spend the summer vacation at their parents&#39; home or elsewhere.\r\n\r\nAnother possibility is that the school might have been listed by mistake in the Non-Resident schedules. Check for any sheets numbered 81 or higher. \r\n\r\nIf you haven&#39;t already, check newspapers and published histories to make sure the school wasn&#39;t in another location on Census Day in 1940. \r\n\r\n\r\n\r\n\r\n\r\n [1]: _URL_0_", "307" ], [ "Recap: this feature used to be invoked in \" ;Classic Ancestry \" ; by clicking a link underneath the name of the person on their profile header:\r\n\r\n[![enter image description here][1]][1]\r\n\r\nThe \" ;View relationship to me \" ; link appeared on trees which had a person&#39;s name designated as \" ;**Who you are in this tree** \" ; on the Tree Settings page. \r\n\r\nIf the user clicked the link, the relationship to that person would be calculated, and the link would change to a relationship descriptor such as \" ;your great-aunt \" ;, which would be \" ;sticky \" ; until you changed the person designated as You. **If there was no person designated, the link would not appear.** \r\n\r\nHowever, since the transition to the &#39;New Ancestry&#39; in 2015, the calculator has not been working reliably. On the same profile as the image above, the link to the relationship calculator does not appear. I checked some of the profiles which previously did show a relationship, and the lines with the relationship are not showing. Presumably if the feature was working, they would appear directly under the name of the person and their vital records, just as they did before.\r\n\r\nAncestry has admitted that users were reporting problems on their blog in the Feature Updates listed below (see **Relationship to me string is randomly not appearing**):\r\n\r\n - [The New Ancestry: December 6th Feature Update][2]\r\n\r\nAs of the [December 11th Feature Update][3], fixing the Relationship Calculator had not yet appeared on the list of things Ancestry is working on. \r\n\r\nNote that in the comments, user <PERSON> posted on December 20, 2015 at 8:56 pm:\r\n\r\n > Just wanted to add that I too am waiting for the relationship\r\n > calculator to get fixed. I reported this problem months ago. I hope it\r\n > doesn’t take as long to fix this as the phantom hints problem.\r\n\r\nand @PolyGeo just posted:\r\n\r\n > I too am waiting for the relationship calculator to get fixed.\r\n > _URL_5_\r\n\r\nPlease post comments on the Ancestry blog -- and keep posting them with each new feature update. They will not restore the features that we had in Classic Ancestry unless people demand it. \r\n\r\n----------\r\n\r\nMessage from <PERSON> in the chatroom after today&#39;s (22 Dec 2015) live broadcast of her Barefoot Genealogist talk:\r\n\r\n > The relationship calculator was fixed and released onto the site\r\n > yesterday morning. If you still don&#39;t see it, you might be working off\r\n > an old cache of your page. Clear cache and cookies and see if that\r\n > helps.\r\n\r\n----------\r\n\r\nOn 23 Dec 2015 the \" ;relationship to me \" ; seems to have returned to the [profile in the question][4]:\r\n\r\n[![enter image description here][5]][5]\r\n\r\n\r\n [5]: _URL_2_\r\n [4]: _URL_1_\r\n [1]: _URL_4_\r\n [2]: _URL_0_\r\n [3]: _URL_3_", "724" ], [ "We have a question _URL_0_ about a problem which was caused by the transition from what is called \" ;Classic \" ; Ancestry to \" ;New Ancestry \" ;.\r\n\r\nSince the problem is not resolved yet, and the situation may be in flux for some time, I have answered the question and marked it as Community Wiki. I can see where it would be useful to share the information about the progress (or lack of it) for this feature being restored, but it&#39;s not what I would call a real answer. \r\n\r\nI&#39;ve also created a new tag to flag the questions that specifically deal with issues coming about because of this 14/15 December 2015 changeover.\r\n\r\nThis is what seems best to me as I write this -- but I&#39;d like to hear your thoughts.", "724" ], [ "@DannyBarber -- in my opinion -- Ancestry planned with this new system to drop a lot of features that \" ;no one was using \" ; or that had been reported as not working reliably before the changeover. They don&#39;t care about what is useful to customers -- they only care about what they can offer with the least effort to themselves. This is why Family Tree Maker has been jettisoned, because it was too much trouble and expense to squash the bugs and get it working properly. We should NOT &#39;be patient&#39; -- users who want this feature should speak up on EVERY feature update or it won&#39;t be reinstated.", "704" ], [ "I created a single called recList and the corresponding Entry Template is /rec/list.html\r\n\r\nI created an entry and I can view the webpage as you would expect.\r\n\r\nQuestion: If I disable the entry or even delete the recList entry it seems to have no effect on the corresponding entry template, meaning that everything still works fine. So, can someone explain the necessity of defining the single template pages in the admin site and what we are missing when we delete single sections?\r\n\r\nThanks!\r\n\r\nChip", "1009" ], [ "Did you discover new websites, get new software or hardware, a new subscription or new records, or receive new DNA test results? \r\n\r\nCome chat about what&#39;s new in the [Conference Room][1] -- ask questions, share your experiences. And if you solve a problem or make a new discovery because of the chat, don&#39;t forget to write up what you learned in a self-answered question.\r\n\r\nThe chat will occur in The Conference Room all week long. Be sure to [register yourself][2] to get an alert each week.\r\n\r\nIf you have any ideas for future topics, post them as answers to Weekly genealogy chat topics - now a week long event! and they might be used in an upcoming week!\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "307" ], [ "I&#39;ve edited your question to remove your previous assertion that the 1930 Census says that your relative immigrated to the US from Sweden in 1912, and reflect what information the Census actually asked for. Most emigrants probably did sail directly from their home country to the US, but some did not -- I have one person who arrived in the US sailing from Liverpool, whose place of origin is in the South of England. Previously he had lived in Belfast, and before that, Glasgow. If I had been adamant that a Liverpool departure was unlikely based on his origin, I might have missed his record.", "167" ], [ "Yes, it&#39;s that time of year again! Half the world bundles up with cocoa and candy canes for the season and the other half surfs the waves with Santa. Meanwhile, here at _URL_1_, we have the option to celebrate with a unique, age-old Stack Exchange tradition (of four years): hats!\r\n\r\nBy completing certain tasks, Stack Exchange users earn virtual hats (new and redesigned for 2015!) for their gravatars to wear that will last the holiday season (14 December 2015 - 3 January 2016). We will be able to see all the hats we&#39;ve earned on [_URL_5_][1]. Here&#39;s a screen shot from last year&#39;s leaderboard:\r\n\r\n[![enter image description here][2]][2]\r\n\r\nCheck that page for the FAQ after Winter Bash starts for an explanation of how things work -- right now it&#39;s a countdown.\r\n\r\nThis year the default is that everyone gets hats unless we mods send in a <PERSON> form in order to NOT have hats. If you hate hats (*gasp*), you can simply click the < kbd > I hate hats < /kbd > button and make all the hats invisible to you. \r\n\r\nBut no matter whether you like hats or hate them, **we still want to hear your opinion.** Let us know by 9 December 2015, or be prepared to press that < kbd > I hate hats < /kbd > button.\r\n\r\nAt the end of the event, all hats will go back into storage.\r\n\r\nDo you want to participate in the Winter Bash here at _URL_1_? Leave your thoughts below and a few cookies and milk for the mods!\r\n\r\n----------\r\n\r\nFor previous years see: \r\n\r\n - _URL_4_ (2012)\r\n - _URL_3_ (2013)\r\n - _URL_0_\r\n\r\n [1]: _URL_5_\r\n [2]: _URL_2_", "233" ], [ "Welcome to G & _URL_0_! Could you tell us how you know the information that you put in your question? Do you have any primary source material, or has the story come down through your family? You can add information to your question by using the edit link underneath it. More information about how the site works is in the [help], and we encourage all new users to take the [tour]. If you have other questions about how the site works, you can read more and ask questions in [Meta]. Hope you enjoy the site!", "262" ], [ "I have the simplest Email form from EE docs: _URL_0_\r\n\r\nUpon &#39;Submit&#39; I get returned to the homepage of our site. Also, there are no Error/Success messages upon form submission.\r\n\r\nWe are able to send Emails through Tools > Communication.\r\n\r\nAs a test, we installed Solspaces Freeform (Free version), the same thing happens.\r\n\r\nWe&#39;ve used the Email module many times on other sites without any trouble. This time around, we&#39;re on a different server and not sure if we&#39;re missing something on our config.\r\n\r\nEE v2.10.1\r\n\r\n\r\n > **Update: Resolved**\r\n > \r\n > We had a static index.html on our www folder. Removing that file, fixed the issue.", "856" ], [ "Yes we loved to do!\r\n\r\nBut, as you know, these hats are static. My opinion is that let&#39;s wear well-designed dinamically gif pictures to get these gifts. Not static jpegs, just make these hats can be able to rotate, dance, shining, and/or shaking e.t.c. according to the forums.\r\n\r\nFor example, if I am in Stack overflow, I want my hat is flowing. And, if I am in Arduino Forum, I want my hat to blink itself with red, white, yellow colors.\r\n\r\nThese are my opinions to improve your question.", "114" ], [ "This week _URL_3_ announced that its desktop software Family Tree Maker will no longer be sold as of 31 December 2015, and that support will end after a year (1 January 2017). \r\n\r\nLet&#39;s talk about what we need to consider when choosing new genealogy software, and other strategies for future-proofing our digital genealogy &#39;holdings&#39;.\r\n\r\nCome chat about it in the Conference Room -- ask questions, share your experiences. And if you solve a problem or make a new discovery because of the chat, don&#39;t forget to write up what you learned in a self-answered question.\r\n\r\nThe chat will occur in [The Conference Room][3] all week long. Be sure to [register yourself][4] to get an alert each week.\r\n\r\nIf you have any ideas for future topics, post them as answers to _URL_1_ and they might be used in an upcoming week!\r\n\r\n\r\n [3]: _URL_0_\r\n [4]: _URL_2_", "1023" ], [ "One counter-argument for using the word *experts* -- in a presentation for the Association of Professional Genealogists about ethical behavior, <PERSON> talked about how the APG&#39;s Code of Ethics says not to exaggerate or misrepresent one&#39;s experience. Even though we are not APG members, it is still a good idea to maintain ethical behavior. Switching the wording to place enthusiasts first is a good idea -- very few of us are professionals, let alone credentialed or accredited.", "932" ], [ "This case is a good illustration of how our genealogy software doesn&#39;t serve us well. We focus on entering information into our software about people, when in actuality, the tasks we perform are searching for records about people, analyzing the information in the records, and recording what we have found. \r\n\r\nIf you have a Church of England parish register, generally you have an entry which describes a three-step process of the banns having been read over three subsequent weeks. I don&#39;t see any reason to break this out into three separate facts in a database. My choice would be the same as [this answer][1], to use the date range to put the first and third dates, and enter what the source says in notes.\r\n\r\nIf you choose instead to enter a single date as in [this answer][2], I would choose the third week because this is when the three-step process was completed. The third and final date is, by nature, closer in time to the record creation date.\r\n\r\nNote that for Scotland, the page at [CPR Banns & Marriages][3] says:\r\n\r\n > Forthcoming marriages were supposed to be proclaimed on three\r\n > successive Sundays, however, in practice, all three proclamations\r\n > could be made on the same day on payment of a fee.\r\n\r\nIf you use a date range for the English parish registers which include three dates, and a single date for the marriages from Scotland where the actual event was only one day, as described above, you can see at a glance that the event which took place in Scotland is of a different nature. \r\n\r\nI would only use three separate events if my sources were separate -- if I had entries about the reading of the banns that came from church minute books or a person&#39;s diary, where an individual reading was recorded on one particular Sunday. \r\n\r\nWhichever method you choose -- especially if you choose to collapse all these different types of banns into a single recording method because it makes for a &#39;cleaner&#39; display of the information in your software -- be consistent, and record your reasoning for that choice in your research notes. \r\n\r\n [1]: _URL_2_\r\n [2]: _URL_1_\r\n [3]: _URL_0_", "956" ], [ "Reading the banns consists of three real-world events, but they are bound as a set, in the way that other multi-stages processes such as a US Naturalization are not. You can submit your Declaration of Intent in one court and your Petition for Naturalization in two completely different courts in different locations, and while they must be at least 2 years apart (not counting the exceptions where Declarations weren&#39;t required) they can be much more than 2 years apart. By contrast, reading the banns takes place at a single place on three consecutive Sundays.", "781" ], [ "Apologies for the browser glitch that resulted in my partial comment. No, I don&#39;t think the GPS is over-rated. I understand that hobbyist genealogists don&#39;t want to write formal research reports or agonize over commas in citations, but we all should be able to explain how we got the information we&#39;re using and why we&#39;ve come to the conclusion we&#39;ve reached so far. Making a search wide enough to find your person and not miss them, analyzing your sources, and looking at the information as a group instead of cherry-picking is common sense as far as I can see. Why is this objectionable to you?", "686" ], [ "@PatFarrell There&#39;s nothing inherently wrong with posting &#39;cousin bait&#39; but that&#39;s not what this site is about. The purpose of the site is for people to ask specific, answerable questions, and the answers to those questions. In my opinion, too much emphasis is placed on connecting with people who are related to you, at the expense of talking to other researchers working in the same locality and timeframe.", "109" ], [ "@ppumkin changing DNS prevents translation of names to IPs, but would not block outbound access from any app using an IP address or that may have cached the result of a DNS lookup. Changing the gateway IP would block outbound _and_ inbound traffic, because you need to route packets back to the sender in order to complete a connection. Since the OP is happy to have his network completely down, that would be one way to accomplish it.", "580" ], [ "I don&#39;t think <PERSON> had motives other than retaliation for Gen. <PERSON> ordering the execution of the black POWs. <PERSON> was ready to kill <PERSON> at the point when <PERSON> confessed to having ordered the execution:\r\n\r\n > <PERSON>: You captured a whole colored command that day. But not one\r\n > colored trooper made it to a camp, did they?\r\n > \r\n > <PERSON>: We had neither the time nor the food. Nor the\r\n > inclination to care for Northern horses, and least of all Northern\r\n > n*s!\r\n > \r\n > <PERSON>: So we shot &#39;em where they stood!\r\n\r\n<PERSON> had his hand on his gun at this point but <PERSON> immediately defused the situation. <PERSON> then notified <PERSON> that it is illegal to simply kill <PERSON>:\r\n\r\n > <PERSON>: Gentlemen! Gentlemen, I know Americans aren&#39;t apt to let a little thing like an unconditional surrender get in the way of a good war. But I strongly suggest we don&#39;t restage The Battle of Baton Rouge, during a blizzard in Minnie&#39;s Haberdashery.\r\n > \r\n > <PERSON>: Now, my Nubian friend, while I realize passions are high, that\r\n > was a while ago. And if you shoot this unarmed old man, I guarantee I\r\n > will hang you by the neck until you are dead, once we arrive in Red\r\n > Rock.\r\n > \r\n > <PERSON>: I damn will guarantee that too.\r\n > \r\n > <PERSON>: Yeah <PERSON>, that&#39;s the problem with old men. You can kick\r\n > &#39;em down the stairs and say it&#39;s an accident, but ya&#39; can&#39;t just shoot\r\n > &#39;em.\r\n\r\nSo <PERSON> devised a plan to kill <PERSON> in \" ;self-defense \" ;, to make his killing of <PERSON> legal. \r\n\r\n > Narrator: <PERSON>, <PERSON> and <PERSON>, had a vigorous debate about the\r\n > legality of the self-defense murder that just transpired.\r\n > \r\n > Narrator: Maj. <PERSON> who is supremely confident about the legality\r\n > of what just transpired, ignored them, sat at a table by himself and\r\n > drank brandy.", "542" ], [ "I&#39;m assuming these are Church of England registers? Have you seen the registers, or are you working off someone&#39;s index? It&#39;s a good idea to cite your sources, no matter what you&#39;ve seen. All you have here are a list of dates and names, with no place given -- it&#39;s impossible for anyone else to evaluate what you&#39;re showing us if we don&#39;t have context.", "684" ], [ "That question was also directed to <PERSON> (*The Walking Dead* comic book creator and also a writer for the TV show), in Talking Dead S05E08 (aired after S06E08 \" ;Start to Finish \" ;, the mid-season finale*). His response was (paraphrased slightly):\r\n\r\n > Well, look. One, it&#39;s not very practical. Being in close contact with\r\n > that material is also gonna cause all kinds of illnesses,\r\n > aside from any kind of zombie-related nonsense. So you don&#39;t want to\r\n > be doing that all the time.\r\n\r\n > Two, it&#39;s not going to last. You would have to be replenishing those zombie guts constantly because they&#39;re gonna dry out. They&#39;re gonna lose their nastiness. They&#39;re not gonna smell. It&#39;s just not\r\n > a practical way to go about things.\r\n\r\n*****\r\n > ! * Where Rick&#39;s group attempts to escape a walker horde by covering themselves with walker guts.", "559" ], [ "Hello, <PERSON> -- a belated welcome to G & _URL_1_! You&#39;ll find the usual [help] and [meta] where you expect them so don&#39;t hesitate to make use of them. Since your question as originally written might have been better as a [chat](_URL_0_) topic than a question, I&#39;m going to take the liberty of answering a related question which I&#39;ve put in my answer. I&#39;ve made some light edits to improve readability -- please feel free to re-edit, especially if I have inadvertently changed your meaning.", "262" ], [ "See Joni Kessler&#39;s class handout \" ;Using the FamilySearch\nCatalog Effectively \" ; which is available for download: _URL_0_ (the link to the handout is also in my answer linked to above). Users should also check the drop-down box to see if their local FHC is in the list -- if so they can browse the catalog of their local center before leaving home. Most of the FHC/FHLs are in the US but some international sites are being added to the list (as I write this, I see London and Taipei).", "307" ], [ "@PolyGeo I think we should follow the lead indicated by the two answers that we already have and address the workflow needed to make the transition, no matter which software someone might choose for the destination. The answer of \" ;what is least painful for me? \" ; is something each person has to answer for themselves -- but we can answer the question of advantages / disadvantages for particular strategies.", "330" ], [ "I highly recommend taking your data from the sources and putting it into a spreadsheet for analysis -- it gives you a fresh perspective that you don&#39;t get from looking at it on an Ancestry tree. For some examples see this set of spreadsheets by @ColeValleyGirl in the Family Historian User Group&#39;s download area: _URL_0_ and <PERSON> Census Record Summary V3 _URL_1_", "307" ], [ "Searching for &#39;bathing registers&#39; revealed this listing from The National Archives&#39; catalog, describing part of [RG 173 from the Suffolk Record Office, Ipswich Branch][1]:\r\n\r\n\r\n > 173 - Suffolk Record Office, Ipswich Branch\r\n > ID 411 - BLYTHBURGH AND DISTRICT HOSPITAL\r\n > ID 411/B - INMATES&#39; AND PATIENTS&#39; RECORDS\r\n > \r\n > \r\n > ID 411/B7 Bathing registers\r\n > \r\n > Volumes showing dates when each inmate was bathed\r\n\r\nA search result [from the Internet Archive][2] mentions bathing registers in summary reports about schools in Germany and Holland -- listing when the resident students bathed (see *Report of the Education Committee of the London County Council submitting a report of the council&#39;s officers on bathing arrangements in schools in Germany and Holland ...*).\r\n\r\n > No. 8. — Each class must keep a bathing register in which the bathing\r\n > attendant notes the number of baths given to each class per week. On\r\n > the last school day of every month all the bathing registers are to be\r\n > submitted to the headmaster. The school doctor is also requested to\r\n > inspect the bathing registers from time to time. Three times a year\r\n > the headmaster must send in a report to the school authorities,\r\n > shewing clearly how many pupils have reported themselves for bathing,\r\n > how many have actually bathed, and how many absences have occurred,\r\n > together with the reasons for the same.\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "521" ], [ "In my opinion -- the fact that there were many residents in an institution makes it more likely that someone&#39;s needs would get missed. Presumably they kept a register to make sure everyone got their turn. As for recording the event, my preference would be to enter a standard RESIdence event and cite the register as the source. The important thing is placing the person at that place and time.", "701" ], [ "For the tags listed -- \r\n\r\n- [tag:research-methods]: For questions about how to conduct genealogy research and best practices for genealogy research.\r\n\r\nIn _URL_0_, there was a suggestion about whether the tag should be [tag:research-methods] or [tag:methodology]. I&#39;m leaning towards [tag:research-methods].\r\n\r\n- [tag:research-guides]: Suggest adding something like this: \" ;For questions about finding &#39;how-to&#39; articles about specific record types and information papers about specific record groups \" ;", "423" ], [ "@PaulTaylor We had a similar question earlier when someone asked for free resources. See _URL_0_. In my opinion, it&#39;s easier to have one question and one set of answers, and divide each answer into online resources and offline resources. People are more likely to find the information if all of the answers are in one place, and it&#39;s easier to update the answers as specific collections are placed online.", "14" ], [ "It is possible to look at the coverage for a country on Ancestry&#39;s sites without having a World Subscription.\r\n\r\nGo to any Ancestry site and on the top navigation bar, choose search. From the drop-down menu, choose [Card Catalog][1]. You can filter the results further by going to the menu on the left and choosing **Europe**, then **Italy**.\r\n\r\nClick on each record collection -- for example, [Como and Lecco, Lombardy, Italy, Civil Registration Records, 1866-1936][2] -- and then scroll down the page until you can see the sections called **Source Information** and **About** [title of database]. The source information will tell you when Ancestry put the records online, and where the original records can be found:\r\n\r\n > _URL_2_. Como and Lecco, Lombardy, Italy, Civil Registration\r\n > Records, 1866-1936 [database on-line]. Provo, UT, USA: _URL_2_\r\n > Operations Inc, 2008. \r\n > \r\n > Original data: Lombardy Region, Italy, Civil\r\n > Registration Records, 1866-1936. Tribunale di Como, Como, Italy.\r\n\r\nThe About section describes the collection and says what kind of information you might find in the records.\r\n\r\nBy looking through the card catalog, users can see whether Ancestry has any records for the locality and time period needed *before* they pay for a subscription. \r\n\r\nOther websites with genealogy records can be evaluated the same way -- look for a link that will show you a list of records for the site.\r\n\r\n\r\n [1]: _URL_0_;\r\n [2]: _URL_1_", "307" ], [ "Welcome to G & _URL_1_! I also encourage you to 1) find a specific question to ask rather than &#39;anything I can find&#39; and 2) add to your post a brief statement of **how** you learned the information you&#39;ve stated. There is information in the [help] which can guide you, such as how to write a question which is [on-topic](_URL_0_). It&#39;s also a good idea to take the [tour] so you can get a better understanding of the site.", "262" ], [ "@DannyBarber Filtering hints by collection is neat, but the smaller collections don&#39;t show up in the hints. I don&#39;t know if entering the dbid of the small collections will force the hint engine to go through them or not. Worth a try ... as long as you remember that &#39;no results&#39; might only mean that the hint engine doesn&#39;t look at that db, and not that your people aren&#39;t there.", "305" ], [ "The closest thing I know of that meets your criteria is WorldCat&#39;s beta project [ArchiveGrid][1].\r\n\r\nIt has a feature **FIND ARCHIVES NEAR YOU** which allows you to search for a location or zip code, or pick out a library or archive via a pin on the map. A pop-up box offers you the choice of searching the collection or getting contact information for that facility.\r\n\r\n[![enter image description here][2]][2]\r\n\r\nClicking on the contact information link takes you directly to the website of that library or archive.\r\n\r\nUnderneath the map is a list of locations which expands to show a list of participating libraries and archives for each place. The United States is at the top, with other countries following alphabetically. (Examine the list carefully -- at the moment, the Australian provinces are displaying at the bottom of the list of US states, before Canada, instead of being listed together under a heading &#39;Australia&#39;.)\r\n\r\n[![enter image description here][3]][3] \r\n\r\nSearching ArchiveGrid will yield results from the catalog descriptions (not the contents of the manuscript collections). \r\n\r\nFor instance, a search for \" ;Quaker \" ; yielded over 7,700 results. I have the option of list view, or summary view. Summary view offers me a choice of six boxes which I can use to filter my results:\r\n\r\n - People\r\n - Groups\r\n - Places\r\n - Archives\r\n - Archive Locations\r\n - Topics\r\n\r\nChoosing \" ;Smith Family \" ; from the People box cuts my results down to a list of 26 results. \r\n\r\nThe drawback of ArchiveGrid is that it only includes the repositories that want to participate in the project -- but the advantage is that the contact information links take you directly to the archive&#39;s own site, which is more likely to be up-to-date than any directory or database maintained by a third party. \r\n\r\nWhile most of the contributors so far are archives and libraries, you can see from the final screenshot that some historical societies are participating in the project.\r\n\r\nThis may not be exactly what you had in mind, but no simple directory could provide enough information about the holdings of a library or archive to be of practical use. With ArchiveGrid, you have a far better chance of discovering which institution&#39;s collections have something of interest to you. \r\n\r\n----------\r\n\r\nOther resources:\r\n\r\n - Wikipedia: [List of Historical Societies][4]\r\n - Ancestry Wiki: [List of Historical Societies][5]\r\n - American Historical Association: [Affiliated Societies][6]\r\n - [Directory of Historical Societies, Preservation Organizations][7] from _URL_0_\r\n - [Society Hill][8] has links to sites, directories, inventories, etc.\r\n\r\n----------\r\n\r\nVia [Twitter][9], [Sir <PERSON>] suggested the book:\r\n\r\n > GRD \" ;Genealogical Research Directory \" ; pub. and upd. every yr but not #online \r\n\r\nOn _URL_5_, [Genealogical research directory : regional & international ... & guide to genealogical societies][11] by <PERSON> and <PERSON> has an electronic version of the 6th ed. from 1985 on [Hathi Trust][12] which is limited view (search only). This was apparently updated yearly for many years, but the latest version I see on WorldCat is [the 27th edition published in 2007][13]. \r\n \r\nA search of WorldCat for similar items found many directories of organizations by state, and the American Association for State and Local History&#39;s [Directory of historical organizations in the United States and Canada][14] (1990). One strategy for finding the kind of website you seek might be to look for these older volumes, then search for the book creators to see if they have shifted to an online or other electronic publication.\r\n\r\n\r\n\r\n\r\n [1]: _URL_10_\r\n [2]: _URL_14_\r\n [3]: _URL_4_\r\n [4]: _URL_13_\r\n [5]: _URL_2_\r\n [6]: _URL_9_\r\n [7]: _URL_8_\r\n [8]: _URL_11_\r\n [9]: _URL_1_/status/700454893065211905\r\n [10]: _URL_1_\r\n [11]: _URL_15_\r\n [12]: _URL_7_\r\n [13]: _URL_12_\r\n [14]: _URL_6_", "307" ], [ "Hello and welcome to G & _URL_0_! It isn&#39;t necessary to add the specific reference to the 1850 Census if you don&#39;t want to, but it would help if you could say what other records you have about this family besides the 1850 Census, and give us some idea of what kind of information you&#39;ve extracted from those records so far. It will help if you can narrow down a _precise_ research question, and tell us what information you&#39;d like to find.", "521" ], [ "For what it&#39;s worth -- I also have a line of research that goes into Tennessee and it&#39;s very likely that when I \" ;get back there \" ;, my research focus will be in the same time period or earlier. Many of the resources I&#39;ll be using will be the links I put into my answer, and the webinars and articles I linked to are either things I&#39;ve already used or webinars I plan to take. If I&#39;m gathering things up already, why shouldn&#39;t I share?", "307" ], [ "From a quick read of [the source code](_URL_0_), it appears you&#39;ve suffered an ECC-detected (but not correctable) two-bit corruption. And that corruption has hit some page in use by the kernel; other messages may give some clue as to what use.\r\n\r\nIt is important. Single-bit (correctable) errors happen sometimes, especially with high-density memory. Double-bit (uncorrectable) shouldn&#39;t happen—probably you need to find the failing memory module and replace it.\r\n\r\nSince some bit of kernel memory is corrupt, if you can&#39;t immediately pull the machine from service for hardware troubleshooting, you should probably schedule an emergency reboot.", "401" ], [ "According to Wikipedia, [SS Neckar][1] was operated by [Norddeutscher Lloyd (NDL)][2]. An arrival from 1882 means that the ship was the first S/S Neckar, not the later one launched in 1901. Wikipedia describes it like this:\r\n\r\n > SS Neckar (1874), in service 1874–1896; scrapped at Genoa, 1896\r\n\r\nNorway Heritage gives a build date of 1873 for the Neckar. In their [1882 fleet list for NDL][3], the Authorisation & Routes entry says:\r\n\r\n > Via Fredrikshavn or Hamburg and Bremen to New York or Baltimore, and via \r\n > Hull or London and Southampton to New York \r\n\r\nThe arrival of interest on 26 June 1882 probably corresponds to this entry from the [schedule][4] on the Norway Heritage site:\r\n\r\n > 1882 \t Bremen \t June 11 \t New York \t June 24 (no remarks)\r\n\r\n<PERSON> page [Arrivals reported in Norwegian newspapers\r\nFebruary 1882][5] also on Norway Heritage, says \" ;Passenger list is usually dated 1 - 2 days after arrival \" ;. \r\n\r\nLooking at US Newspapers on the website Genealogy Bank confirms this. The Neckar&#39;s arrival on the 24th is mentioned in the shipping news published in the Sunday, June 25, 1882 issue of the Evansville Courier and Press (Evansville, Indiana), page 1, and the Monday, June 26, 1882 issue of the Cincinnati Daily Gazette (Cincinnati, Ohio), page: 2. \r\n\r\nAccording to the Friday, June 9, 1882 issue of the *New York Herald* (New York, New York), and an ad published in the same newspaper on Wednesday, June 14, 1882, the Neckar was scheduled to depart for Bremen on June 28th. This would seem to confirm Norway Heritage&#39;s information that the NDL ships sailed either to New York City or to Baltimore, and not Bremen to New York to Baltimore to Bremen. (Later articles in the New York Herald indicate that the Neckar returned to Bremen by way of Brussels.)\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n \r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_3_\r\n [3]: _URL_0_\r\n [4]: _URL_2_\r\n [5]: _URL_4_", "521" ], [ "Hi, <PERSON>, welcome to G & _URL_2_! We encourage all new users to take the [tour] and read the material in the [help] to see how the site works, especially [What topics can I ask about here?](_URL_0_) and [What types of topics should I avoid asking?](_URL_1_). I&#39;ve put your question on hold because it is too broad. We can give you better answers if you can tell us a little more -- letting us know what country you are in will help us give you *better* answers.", "262" ], [ "Also, there is a FREE six-week Genealogy course being offered online by the University of Strathclyde which just started today on FutureLearn. _URL_0_ This is a great opportunity to learn HOW to study your lineage first and then worry about finding records for free or paying for record access later. The course is suitable for absolute beginners, but there are experienced people taking the course, too -- the community is a nice mix of people just getting started and people who have been going for a while who want a refresher.", "307" ], [ "Hi, <PERSON> - welcome to G & _URL_0_! if the record in question is on a site which is not behind a paywall, such as FamilySearch, feel free to link it in here. You can add to your answer at any time by using the edit link under your answer. If you would like more information about how the site works, feel free to take the [tour] and look at the information in the [help].", "307" ], [ "Hi, welcome to G & _URL_0_! I&#39;ve edited your question to add some whitespace for readability -- I also removed your signature because the system signs your post automatically with your usercard. You can add more information to your question at any time by using the edit link underneath your question. We encourage all new users to take the [tour] to lean how the site works, and if you&#39;d like more information, take a look at the material in the [help]. If you tell us more about what information you already have about <PERSON> and his family, we can write better answers.", "700" ], [ "Hi, welcome to G & _URL_0_! Your question is missing a critical element, which is how you know where your relatives came from. If you could post snippets of any record images showing the place name, and tell us which documents they came from, while leaving out the names of the people on the document, that would give us a better way to analyze the information you have, while still preserving your family&#39;s privacy.", "307" ], [ "Hi, <PERSON> -- welcome to G & _URL_2_! We encourage all new users to take the [tour] and look at the [help] to learn about how the site works. If you&#39;d like to add more information to your question, such as a list of what sources you&#39;ve looked at already, you can use the edit link underneath your question. While you&#39;re waiting for answers, try looking for other questions with the tag [South Carolina]((_URL_1_) to see if any of them can help, like this one _URL_0_", "262" ], [ "Could she have had the position we know in the US as a &#39;pharmacy technician&#39; -- someone working under the direction of someone who was univesity-trained? In <PERSON>, \" ;College, Career, and Community: Dalhousie Coeds, 1881-1921 \" ; (in Axelrod & Reid, &#39;Youth, University and Canadian Society&#39;), <PERSON> talks about the educated women and how many worked in health professions even though they had not finished their degrees. See page 43 where pharmacy is listed in a ranked set of professions.", "906" ], [ "Since the original image is at the US National Archives, your best course of action might be to ask if the original cards survive, and if so, if NARA can send you a fresh copy of the original card. Failing that, they might be able to make you a better copy of the card from their master copy microfilm. You could email them at <EMAIL_ADDRESS>\r\n\r\nDuring a recent presentation, I saw a card image from [this collection][1]:\r\n\r\n > Subject Index to Correspondence and Case Files of the Immigration and\r\n > Naturalization Service, 1903-1952. NARA microfilm publication T458, 31\r\n > rolls.\r\n\r\nThe image on Ancestry is in black-and-white, but the card shown in the presentation is in color.\r\n\r\nEven if the originals have been destroyed and only microfilm exists, NARA will probably be able to make you a better copy than you can download from Ancestry. \r\n\r\nIn the meantime, you can try using a program like [IrfanView][2] to experiment with. Changing the color channels to make the card have a non-white background may increase the readability -- try to get black lettering with a yellow background and see if that helps.\r\n\r\nI&#39;d also look at other images in the same collection to get a better idea of what the different field labels say. That might help you interpret the data in the fields. If you have a letter which is only a partial, compare it with the letter shapes on the same card and surrounding cards to see if you can puzzle out what letters it might be.\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "307" ], [ "Hello, welcome to G & _URL_0_! Even though you have narrowed down the time frame to a very tight window, this question is a bit broad -- entire books could be written on how to get started researching the life of an immigrant in the old country. As it stands you may only get very general answers. If you&#39;d like to narrow the focus of your question, you can use the edit button as PolyGeo suggested.", "606" ], [ "I also have concerns that any proof which looks at only parish registers and census records meets the standard for a reasonably exhaustive search. \r\n\r\nTo [Harry&#39;s excellent answer][1] I would add the following caution -- in a recent class on [Non-Conformist church records][2] that I took from the Family History Library, the instructor warned that there was a high degree of non-conformity in Wales, and that families would shift back and forth between Church of England (or Wales, in this case) and Non-Conformity all the time. It is not a safe assumption that successive generations, or all members of a sibling set, will all be in the same set of registers.\r\n\r\nIn his class handout from 2014, <PERSON>, AG&#174; advises \" ;Reconstruct families by combining church records with other sources like probate, parish \r\nchest court, tax, etc. \" ; Gathering BMDs (or baptisms/marriages/burials) plus the census is a good start, and helps establish the time frame for further study -- but especially in cases where there are many people with the same name, it may not give you enough information to distinguish same-name families.\r\n\r\nAnother thing that is missing from this proof is any sort of reference to a map. I have similar cases with records that seem to say my research subject came from different places -- when you look at the GENUKI gazetteer it becomes evident that the places named are all in a tight cluster and refer to the same general area, so one could argue they might be the same person. On the other hand, a non-conformist family could have events registered in the records of their circuit, which could cover a wider geographical range (they could appear to be as much as 10 miles away from where the event took place). \r\n\r\n\r\n\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "521" ], [ "In Stellar, the transactions are stored in ledgers. Since the computation of current hash does not depend on previous hash (since its blockless), how can it be guaranteed that the data stored is true.\r\nThe second question is about traversing to find the ledger state. To find an account details Do I need to traverse the stellar ledgers (like a link list) to find the last transaction details of an account or Do I directly query the account database and if its the latter case what is the guarantee that the database stored is the correct one ?", "910" ], [ "Hi, welcome to G & _URL_0_! We can give you better answers if you tell us what tests your family has taken and what company you purchased them from instead of saying you \" ;had your DNA done \" ;. You can use the edit link underneath your question to add to it.\n\nYour question could also be improved by explaining more about how the various people are related (on paper) and saying how they match or don&#39;t match via DNA, instead of using the word \" ;relation \" ; for everything.", "179" ], [ "@BobE Yes, that&#39;s why NARA warns us that the title of the microfilm is misleading because the term ED wasn&#39;t in use until later. The basic idea -- dividing up an area into smaller divisions when assigning the work -- applies to all censuses, but the manner of doing so and the terms used will differ depending on the particular census year.", "685" ], [ "From my testing, yes it seems that if an azure function times out the message is returned to the queue indefinitely.\r\n\r\nHere&#39;s my message info 8 hours after it was submitted:\r\n\r\nINSERTION TIME\r\nMon, 09 Jul 2018 16:04:33 GMT\r\n\r\nEXPIRATION TIME\r\nMon, 16 Jul 2018 16:04:33 GMT\r\n\r\nDEQUEUE COUNT\r\n29\r\n\r\nThis MSDN page _URL_0_ says \" ;The two triggers that have retry support are Azure Queue storage and Azure Blob storage. By default, these triggers are retried up to five times. After the fifth retry, both triggers write a message to a special poison queue. \" ;\r\n\r\nThis error behaviour does not hold true in the event of a function timeout; my message is at 29 retries and counting!", "433" ], [ "You cannot get parts of the private key using reattachments. To understand why, let&#39;s see how signing works.\r\n\r\nFirst of all, there is an unsigned bundle consisting out of several transactins. To sign it, we first need to calculate the bundle hash. Only the address, value, obsolete tag, timestamp, current index and last index are used. Note, nonce, trunk/branch tx and the tx hash are not required to sign a bundle\r\n\r\nWe then use the hash to calculate the signature for each input. Finally we select our branch and trunk tx and find s nonce so the final tx hash ends with 14 0-trits.\r\n\r\nWhen reattaching, we use the same set of in-and outputs, so the bundle hash doesn&#39;t change. As the hash is the same, the signature is also the same. But as our trunk/branch tx has changed, we need to redo the PoW.\r\n\r\nTo successfully steal IOTA, we need an input signed several times with different bundle hashes. As the hash doesn&#39;t change it doesn&#39;t make any difference for an attacker if a transaction is reattached 0 or 100 times", "489" ], [ "[Genetic Genealogy Tips & Techniques][1] is a Closed Group on Facebook. According to the Help Center&#39;s FAQ [What are the privacy settings for groups?][2], only current members of a group can see the content of the group, even when it is shared outside the group. \r\n\r\nI admin some closed groups on Facebook. The context is a mix of news items and personal postings. For ordinary news items, I might share those in the groups and on Twitter -- but for the personal postings, there is an *expectation* that the information doesn&#39;t go beyond the group. That was the whole point of making the groups closed -- that the members&#39; participation won&#39;t be broadcast in their News Feed on Facebook. \r\n\r\nIf something wasn&#39;t meant to be widely shared on Facebook, then it seems reasonable to assume that it shouldn&#39;t be shared outside Facebook either. \r\n\r\nI would say that only options three and four -- posting the question **with the permission of the original poster**, or inviting them to post here so you can share your answer, are acceptable.\r\n\r\n\r\n\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "426" ], [ "Hi, welcome to G & _URL_0_! It isn&#39;t necessary to write two answers to the same question. If you want to add more thoughts to your previous answer, please edit your first answer and add more information to it. Putting the new information under a divider or new heading can separate the two parts, if you&#39;d like to do that. If you want to know more about how Stack Exchange works, there is information available in the [help], and you can ask question on our site&#39;s [Meta] area.", "862" ], [ "I have two cautions. First, when I am working a possible same-name case, I often start NOT by asking \" ;Can I find my person named <PERSON>? \" ; but \" ;How many different people named <PERSON> might there be in this record set / community? \" ; When Names and addresses match, then you need more identifiers. Same-age records are not proof of the same person -- there might be two or more cousins in the same community around the same age. When you have conflicting evidence (e.g. occupation) the GPS advises us to account for the conflict. Proceed with caution.", "495" ], [ "Is there a &#39;latest greatest&#39; tool that I can add that has ongoing logging of disable/enable and delete/update activity of users or entries, etc..?\r\n\r\nIs there a good way to track this information before I add on a logging tool? In other words, is this information somewhere in the mysql database anyways?\r\n\r\nI know the current dashboard shows information related to entry creation, but, we have some new users that we are training and they have made some mistakes and we need to track those mistakes down.\r\n\r\nthanks!", "564" ], [ "There are no recommendations out yet, because we still need the coo to prevent double spends.\r\n\r\nIn the whitepaper it stats that the confirmation status of a transaction is given by the percentage of tips that directly or indirectly reference this transaction (_URL_0_ Page 3). If we select 100 random tips and 70% of them indirectly reference our transaction, it is 70% confirmed.\r\n\r\nHowever, it is unclear how the coo will be removed/decentralized. Depending on how confirmations are defined in the future we will get some recommendations for sure.", "62" ], [ "Yes, the coordinator does protect us against these kind of attacks.\r\n\r\nLet&#39;s call the honest transaction A and the double spend B.\r\n\r\nIf neither A or B are confirmed, the coordinator can only confirm one of them. If it would confirm both, his milestone would be rejected, just as any other transaction trying to archive that.\r\n\r\nIf A already got confirmed by the coo and the attacker adds weight to his own transactions, it can still not get confirmed by the coo. The coo is steady and never rollbacks his milestones, so for the coo the address is already empty == > the double spend is deemed invalid and rejected.", "427" ], [ "Hi, <PERSON>, welcome to G & _URL_0_! I&#39;ve put your question on hold because it is unclear what you&#39;re asking, and the question needs to be cleaned up to fit our site guidelines. Please take a look at some of the other questions about AncestryDNA on the site and see if the answers for those questions can help you, and if not, edit your question to let us know why not. Don&#39;t be alarmed if the community edits your question -- right now it is difficult to read.", "262" ], [ "Hi, welcome to G & _URL_0_! If you need more information about the way the site works, you can find it in the [help] or ask a question in the companion [Meta]. I&#39;ve shortened your question title so it will better fit our site guidelines. Can you tell us where you found this death notice? A source citation helps us when we analyze the source for the quality of the information it contains.", "262" ], [ "This is a stub of an answer, but here are some resources that can help you get started.\r\n\r\nFrom the FamilySearch Research Wiki:\r\n\r\n - [Danish Genealogical Word List][1]\r\n - [Denmark Record Finder][2] (to find other records which may have his parents\r\n\r\nFamilySearch also has resources for Denmark and Danish records in the [Help Center Lessons][3]. You can search by going to the main FamilySearch screen and clicking on Help in the upper right corner, then choosing Help Center from the drop-down menu. \r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_\r\n [3]: _URL_2_", "307" ], [ "These are my guidelines for making a question and answer more readable.\r\n\r\n**Make the link labels transparent**\r\n\r\nInstead of saying \" ;You can find it here \" ; give the name of the resource being linked to. This allows the reader to see at a glance if the page being referenced is something they&#39;ve seen already, or not. \r\n\r\n**Link to shareable objects**\r\n\r\nWe can&#39;t all maintain a continuous worldwide subscription to websites like Ancestry (dot wherever). If you need to link to content behind the paywall, include the shareable link that will allow non-subscribers to look at the image, or what Ancestry calls the \" ;citation media \" ;. It is frustrating to click on a link to see something and be sent to the page where Ancestry nags you to join. Complete transparency may require linking to FamilySearch for the record page / abstract / transcription and to Ancestry&#39;s shareable image. This is annoying for the writer of the question or answer, but much friendlier to the reader.\r\n\r\n**Replace links to vanished content with Wayback Machine snapshots if possible**\r\n\r\nI am probably the worst offender here because my answers have lots of links to both <PERSON> Mills&#39; *Evidence Explained* website (currently being redesigned) and the website of The Board for Certification of Genealogists. I need to review all my Q/As and clean up the busted links (as discussed elsewhere on Meta).\r\n\r\n**The answer should stand on its own without the links**\r\n\r\nMy personal goal when writing answers is to include enough content in the answer that the reader doesn&#39;t need to visit the linked site, unless they want to learn more. \r\n\r\nSpeaking as a reader of a question or answer, when others cite WikiTree or other websites whose content is volatile, I want to know what content on the page they are citing at the time they wrote the question or answer. Someone could come along at any time and edit the content on WikiTree to say something else entirely, thus making the original question incomprehensible unless the content is included in our question.", "262" ], [ "Hi, welcome to G & _URL_1_! We already have some other questions about the predicted relationships based on the percentage of shared DNA, which might help you answer your question -- answers like this one _URL_0_ -- you can find them by searching for keywords or looking at other questions tagged DNA. If those answers don&#39;t help, you can edit your question to explain why that information didn&#39;t help you. If you need more info about the site, there&#39;s lots more in the [help].", "179" ], [ "A follow-up question to: _URL_1_\r\n\r\nAs I write this, the Evidence Explained website is undergoing redesign. I need to edit all my answers (and there are **many**) that link to EE&#39;s Quicklessons. The EE page is referring people to the Wayback Machine&#39;s copies of the old site in the meantime.\r\n\r\nThe Archive of Quicklessons is available via the Wayback Machine here. _URL_0_\r\n\r\nI am willing to use a local Markdown editor to make the changes if no online solution exists. Are there Markdown editors or plug-ins for Markdown editors that would aid in the search for link rot?", "307" ], [ "The descriptive pamphlet for NARA microcopy publication T718 is a reproduction of its entry in the print catalog of microfilm publications. It contains a roll list and a brief description of the entries in the register. \r\n\r\n > Each entry shows the name of the pensioner, the name of the veteran (if different), the name of the pension agent, the name of the pension agency through which payment was made, and the quarter and year of the last payment to the pensioner. When an heir or a legal representative claimed an unpaid balance due the pensioner at the time of death, the date of death of the pensioner is given and the date of the final payment made to the family or heirs.\r\n\r\nI read the last part of the entry after the date of death as \" ;to 3rd qr 48 \" ;, understanding \" ;qr \" ; to mean &#39;quarter&#39;. \r\n\r\nYou could try looking for other entries for veterans who had died, and comparing those entries to see what form the information takes.\r\n\r\nTo find the DP for a NARA microfilm publication, follow these steps:\r\n\r\n 1. From [NARA&#39;s home page][1] choose [Research Our Records][2]\r\n 2. Choose **Microfilm Catalog** and on the top navigation bar choose **Microfilm**. \r\n 3. Type the publication number (e.g. T718) in the **Search and Browse Microfilm** box at the left-hand side of the screen. (Ignore the **Order Microfilm** box unless you really want your own copy. We aren&#39;t going to make an order, just look at the catalog.)\r\n\r\n[![enter image description here][3]][3]\r\n\r\nNext, choose a title from the list that results. When you get to the next screen, look on the right-hand side for the PDF icon where it says **View Important Publication Details**:\r\n\r\n[![enter image description here][4]][4]\r\n\r\nFrom there you should be able to download the DP, if one exists.\r\n\r\nSee also NARA&#39;s [Electronic Publications Bibliography][5].\r\n\r\n\r\n [1]: _URL_4_\r\n [2]: _URL_2_\r\n [3]: _URL_3_\r\n [4]: _URL_1_\r\n [5]: _URL_0_", "307" ], [ "On Twitter, one of my contacts recommended the link validator at _URL_0_. I&#39;ve tested it on a few questions and had mixed results. \r\n\r\nOne downside is that it isn&#39;t restricted to just a question or answer. It also tests all the other links like the Hot Network Questions and Related questions. A lot of time is wasted checking links which are blocked due to robots exclusion rules. \r\n\r\nIt would be cleaner to have a checker that allowed us to specify which part of the page needed checking.", "262" ], [ "Many of the online guides on US Vital Records give an overview of what information **may** be on the death certificates. Some examples for Arkansas:\r\n\r\nAncestry&#39;s *About the Database* for its database [Arkansas Death Index, 1914-1950][1], citing <PERSON>, \" ;Research in Birth, Death, and Cemetery Records, \" ; *The Source: A Guidebook of American Genealogy*, ed. <PERSON> and <PERSON> (Salt Lake City: Ancestry Incorporated, 1997), says:\r\n\r\n > Most contemporary death certificates include the deceased&#39;s name, sex, race, date of death, age at the time of death, place of death, date of birth, place of birth, marital status, name of spouse, Social Security number, occupation, residence, father&#39;s name, mother&#39;s name, cause of death, and place of burial. Records from some states provide the birthplace of the deceased&#39;s parents. \r\n\r\nThe RootsWeb Wiki article [Arkansas Vital Records][2] is an online version of <PERSON>, Ph.D., FUGA&#39;s article for *Red Book: American State, County, and Town Sources* doesn&#39;t go into depth about what might be on a death certificate.\r\n\r\nThe section on Death records in the FamilySearch Wiki article [Arkansas Vital Records][3] suggests alternatives. The Wiki article on the FamilySearch collection [Arkansas Deaths and Burials][4] includes a coverage table showing which FHL microfilms were indexed for the collection. If the death record you seek is recorded in one of the counties in this table, you might be able to get a copy of a record without ordering it by viewing the appropriate FHL film. \r\n\r\nIt is important to ask the question about whether the parents&#39; names are likely to be on a person&#39;s death certificate -- but as we know, even if the names were supposed to be recorded, there&#39;s no guarantee that the informant knew the information. You could order the certificate, only to discover that the certificate only says \" ;unknown \" ;. \r\n\r\nDid the deceased have siblings? If they died in another state, you might be able to do an end-run around the problem by getting the information elsewhere. \r\n\r\nIf the death certificate doesn&#39;t have the information, consider what other records might have that information. Aids such as the [United States Record Finder][5] could help. \r\n\r\n [1]: _URL_0_\r\n [2]: _URL_3_\r\n [3]: _URL_2_\r\n [4]: _URL_1_\r\n [5]: _URL_4_", "307" ], [ "This volume appears to be a state copy of information originally held in town registers. If you haven&#39;t done so already, place this image in context by browsing the pages around it. The controls on the left-hand side of the viewer allow you to look at thumbnails of all the pages on this film. Click on the dots to browse multiple images.\r\n\r\nThe first image after the microfilm target (image #384) identifies this book as Volume 281, Marriages 1876. Note how the next pages are from the towns of Amherst, Belchertown, Chesterfield, and so on. Someone has arranged this information alphabetically by town name, which suggests strongly that we aren&#39;t looking at an original town book. \r\n\r\nIn a case like this, I would try to find another register that covered the same time period to see what the other copies said. I might do any or all of the following (these are not listed in any particular order):\r\n\r\n - Contact the town of Reading directly and ask for an **image copy** of their town records for the entries you are interested in.\r\n - Cross-check the entries for marriages where the bride and/or groom were residents of towns other than Reading, to see what their registers said. (Vital records in Massachusetts can be recorded in more than one town because they were registered both in the town where the event took place and in the towns where the participants resided.)\r\n - Look at historical newspapers and other types of records to find information about when & where the events happened and/or whether the marriages actually took place.\r\n - Research the clergymen who performed the ceremonies and look for the marriages in church records.\r\n - Look for collections, finding aids, and research guides that refer to Massachusetts amended vital records. E.g. [Massachusetts, Delayed and Corrected Vital Records, 1753-1900][1] at FamilySearch ([Wiki article][2]).\r\n - Look at Massachusetts state statutes that would tell me what the reporting requirements for town clerks, so I could see what procedures were supposed to be followed if records were amended.\r\n\r\nThe better we understand who created a record, how it was created, and the purpose for which it was created -- as well as when it was created -- the better we can evaluate the quality of the information contained in that record. Copy registers are especially tricky because we don&#39;t always get clues about when the copies were made, or who made the copy. \r\n\r\nFurther reading:\r\n\r\n - <PERSON>, CG, CGL, FASG, “Working with Historical Evidence: Genealogical Principles and Standards,” *Evidence: A Special Issue of the National Genealogical Society Quarterly* 87 (September 1999): 165–84. [PDF download at Elizabeth Shown Mills, *Historic Pathways*][3] \r\n - [QuickLesson 17: The Evidence Analysis Process Map][4] from Mills&#39; *Evidence Explained* website (Archived Copy 26 Oct 2016 via the Internet Archives&#39; Wayback Machine)\r\n - [<PERSON>, Ph.D., CG, CGL, FASG, FNGS, FUGA, “Perils of Source Snobbery,” OnBoard 18 (May 2012)][5]\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_4_\r\n [3]: _URL_1_\r\n [4]: _URL_3_\r\n [5]: _URL_2_", "521" ], [ "@BobE I don&#39;t *suppose* anything. I look for other record sources that would either corroborate or contradict those entries. I look for research guides that might explain what is going on. I look for the instructions, if I can find them, so I can see what the clerks were *supposed* to have done when filling out the registers. As an example, the article _URL_0_ explains the lined-out entries in passenger lists. Some people shoot themselves in the foot pretty badly by trying to guess what those entries meant. I prefer to research rather than guess.", "686" ], [ "@BobE *All* sources need to be analyzed for their quality of information -- even original sources with primary information can have errors. I&#39;ve added a couple of references to the answer which might help. In general, I can say that the more one knows about the purpose a record was created and how it was created, the better one can evaluate and use the information contained in the record.", "541" ], [ "I hear that you&#39;re confused, but the hard facts are that in many states, adoption records are closed, and unless adopted kids happen to find a copy of the court records in their family papers, they don&#39;t have access to anything but what&#39;s called &#39;non-identifying&#39; information about their birth parents. As part of the adoption process, they get amended birth certificates issued by the state with the names of the adoptive parents on them. Adoptees don&#39;t have to \" ;go through life without a birth certificate \" ; as you put it. This is changing, but for many adoptees, the records are still closed.", "596" ], [ "According to the article [Mississippi and the U.S.-Mexican War, 1846-1848][1] by <PERSON>, posted on the website *Mississippi History Now* (an online publication of the Mississippi Historical Society), Company C was the **Vicksburg Southrons**.\r\n\r\nSee also this page at Tufts, which is a digital version of: [Colonel <PERSON>, Confederate Military History, a library of Confederate States Military History][2]: Volume 12.2, Mississippi, <PERSON>, Ed.\r\n\r\n > Vicksburg Southrons, Capt. <PERSON>\r\n\r\n\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "521" ] ]
56
[ 7908, 746, 11412, 4700, 15351, 7943, 2363, 5089, 9320, 847, 7244, 4272, 8326, 10330, 6276, 18611, 11229, 6222, 6894, 1023, 8877, 16373, 9961, 1339, 9927, 3953, 2322, 5743, 11366, 9478, 1030, 12994, 9303, 7679, 14098, 11970, 10074, 12222, 12430, 13136, 19079, 1278, 19605, 11770, 11916, 16712, 1956, 16149, 3621, 0, 4614, 18431, 5122, 17168, 14680, 19251, 1124, 2773, 350, 19262, 6024, 710, 2229, 18402, 7875, 12715, 1802, 6318, 6275, 3473, 10696, 6344, 8559, 5435, 5321, 5519, 9023, 9073, 13210, 18040, 2395, 6396, 12283, 9539, 18039, 10470, 19043, 8923, 4544, 6760, 17968, 3698, 1324, 7622, 9287, 3267, 19150, 11228, 7519, 18998, 16261, 12523, 17810, 906, 13184, 14416, 6230, 8558, 12856, 11711, 4179, 2870, 16274, 4752, 18601, 2770, 7421, 7810, 5211, 14097, 6078, 17769, 7621, 6580, 12034, 396, 2481, 13422, 6452, 5856, 17136, 1277, 5284, 3381, 6367, 10804, 9754, 17730, 15767, 1574, 18400, 4687, 18365, 5975, 18346, 876, 5635, 97, 3928, 19111, 6671, 3240, 5593, 18314, 6698, 18557, 3426, 19414, 706, 12579, 16600, 10208, 4358, 11754, 17382, 12382, 18915, 18848, 16120, 3838, 1402, 4227, 15438, 10966, 1652, 16679, 1922, 17346, 13623, 3363, 703, 16132, 3805, 14920, 11743, 8037, 3970, 972, 4313, 12738, 3371, 10348, 8311, 1617, 10205, 18999, 2402, 18974, 10251, 14014, 17033, 17241, 925, 3670, 84, 14390, 19507, 7350, 98, 16617, 4834, 4250, 4226, 9569, 18467, 2404, 7778, 4674, 16262, 640, 9574, 5077, 14883, 19234, 6912, 2133, 1453, 2472, 1801, 8238, 3860, 2900, 10258, 16309, 7126, 11356, 2459, 7631, 16814, 415, 5170, 4888, 11177, 12573, 1605, 9840, 4885, 6468, 1964, 9510, 18293, 15226, 16454, 7283, 5903, 14345, 5893, 5308, 15508, 5004, 5026, 17924, 6940, 476, 2835, 9701, 13349, 8497, 17166, 2355, 13970, 822, 2853, 4036, 19541, 6106, 13146, 3514, 15439, 18658, 15579, 6527, 4068, 13896, 6171, 6330, 13384, 6315, 12212, 13185, 12233, 2912, 6913, 16892, 6547, 2743, 9962, 19256, 12463, 8247, 1763, 635, 11467, 4491, 18401, 15224, 15158, 1879, 6127, 7636, 11171, 12023, 5835, 6141, 16558, 16347, 14197, 8784, 15647, 6353, 8810, 1225, 2626, 11140, 13183, 2379, 2890, 3811, 5636, 8584, 13288, 19392, 725, 7655, 17453, 1304, 4120, 17766, 10577, 4333, 13885, 13874, 16834, 6604, 2208, 16310, 1582, 9190, 10377, 18353, 16868, 16944, 17155, 2889, 3534, 18001, 19614, 14744, 1503, 3451, 499, 3734, 16195, 9006, 711, 2113, 657, 279, 17356, 14783, 11165, 1589, 15450, 13523, 11273, 2250, 11841, 10703, 3603, 9610, 15923, 8070, 16489, 8794, 16287, 1443, 18886, 3404, 14724, 11230, 15807, 2263, 1, 620, 10046, 10202, 7179, 7080, 7721, 6430, 5095, 1727, 16536, 13561, 6897, 15606, 12670, 14818, 11934, 15336, 17050, 4255, 3938, 613, 3494, 17252, 18224, 12598, 1393, 16103, 780, 19500, 8547, 17571, 8621, 5429, 9370, 16833, 15482, 5357, 13417, 388, 3821, 6970, 4348, 10683, 11187, 11379, 2399, 2353, 4389, 16429, 6483, 17944, 10597, 3697, 5879, 4347, 6422, 15731, 2123, 9702, 1930, 16824, 992, 602, 310, 2415, 18646, 13917, 17697, 18474, 6084, 16708, 8263, 7204, 1020, 2769, 15674, 8752, 7115, 9732, 1175, 7230, 11665, 2949, 4513, 18090, 2553, 17945, 184, 2012, 17554, 11299, 1071, 9711, 6551, 8573, 7042, 14477, 10361, 9845, 1919, 8766, 18197, 7499, 1300, 7643, 2907 ]
STX_10060.0
[ [ "My Apple remote&#39;s battery died. I can get to the start screen of Apple TV by unplugging the device, but I can&#39;t seem to get further than that without the remote. That means I can&#39;t activate the Apple TV Remote app for my iPhone - I can&#39;t navigate to the activation screen.\r\n\r\n[This previous answer][1] suggests I may be able to control Apple TV with the 1Keyboard app, but that app costs $10 and I have no reason to believe it can do what I need it to do.\r\n \r\nAny help?\r\n\r\n [1]: _URL_0_", "139" ], [ "You&#39;d need to go through the rituals in the temple if you were to believe you were going to the celestial kingdom. The other 2 levels I don&#39;t think required temple action, which is, so much as I know, the only point where anyone checks whether or not you tithe at all. _URL_0_ - and as for what <PERSON> says, it may be possible from ward to ward or territories that some may make a bigger deal about it than others. I&#39;ve never heard of anyone being excommunicated for not tithing. I&#39;m not mormon though", "922" ], [ "[Apologies for any mistakes in tagging, I&#39;m new to this site *and* topic]\r\n\r\nI&#39;m rendering a procedural surface in a game engine. A method returns density for a particular point in space. Density is a combination of forced values and multiple octaves of noise. A density of zero or less indicates air.\r\n\r\nUsing a simple marching cubes implementation, I can generate meshes and see an interesting (but slightly blocky) surface.\r\n\r\nI&#39;d like to try using [dual contouring][1] to improve the surface quality, however, that apparently requires hermite data.\r\n\r\nUnfortunately, I don&#39;t really understand what hermite data is. As far as I can tell, it&#39;s density values stored at various levels of precision for a given volume?\r\n\r\nIs it as simple as building something like an octree and recursively calling my density method until I get to a certain depth?\r\n\r\nWhat is a computationally cheap method of generating hermite data from my density data? (In case it&#39;s a trade-off, speed is more important than precision)\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "371" ], [ "You need to quantify : \" ;I measured the current through (one of the 4 wires of) my stepper motor, and it&#39;s always within a few percent of 0.5 A \" ;. A &#39;few percent&#39; may be all you need to detect a little extra current during stall (if there is extra current as I would also assume but would need to prove), which can be sensed and compared to normal stepping current. In some cases 40 uA is major and in some cases 4 mA is major difference. Without measurement parameters from you it is impossible to really advise you.\r\n\r\nSo, what exactly is the current for a step versus stall, and is the difference consistent? I would measure all the wires as well... You are using a unipolar correct? I have used steppers but never bothered to measure current as the steppers I used matched the load requirements and never stalled. So one quick answer is just to get a bigger stepper.", "760" ], [ "This isn&#39;t something that can be answered universally. It depends on your anatomy, your guitar neck shape and your preferences. Classical guitarists tend to keep the thumb closer to the middle of the neck, while electric guitarists will often extend it past and even use it to hold notes. In general, such clamping isn&#39;t often recommended, though, and a full barre chord should be used instead. OTOH, problems with buzz in the barre chords are common and simply require strength being built up, as well as precise, close touch applied to all of the strings uniformly.", "729" ], [ "One thing that no one has mentioned yet (I think) is the audio driver.\r\n\r\nOn Windows, to get multiple audio drivers you either need to use the windows driver, which in general doesn&#39;t work very well with DAWs, has more latency and limited multi-device options, or use ASIO4ALL which allows you to combine the inputs into one device and work with low-latency, at the cost of sporadic stability issues and hardware incompatibilites\r\n\r\nOSX on the other hand comes straight out of the box with \" ;Aggregate Device \" ; driver which allows you to easily combine multiple devices into one that can be fed to your DAW. Hardware producers also have a much easier job targetting a very limited Mac spectrum, which in general seems to make it all more stable.\r\n\r\nThis still depends on your choice of hardware, though, so don&#39;t make a decision based just on that. There are people who had success working on Windows with multiple devices just fine, and there are cases where a device refused to work with the Aggregate Device driver on OSX as well (one case I remember was when the producer didn&#39;t choose to support it because it would mean a drop in quality IIRC).\r\n\r\n---\r\n\r\nAnother thing that comes to mind is that a lot of vendors see the potential in the Thunderbolt interface. Given how scarce it is in non-Apple devices, getting one might be your only choice for using some of the hardware as well.", "361" ], [ "The typical studio setup would *add* recording on top of existing, basic playing infrastructure. That is, you connect guitar to the amp and monitor (listen to yourself) on it, while the line-out signal goes into some sound interface that converts that to digital and feeds back into the PC.\r\n\r\nPlaying backing tracks through a guitar amp is a pretty meh idea, IMHO, even through as versatile ones as yours. They are simply not built to provide good sound quality for other parts of the song, and are tuned for guitar-specific output instead.\r\n\r\nWhat I do myself when practicing with my amp is feed another set of monitors with the backing track signal. That way I get each speaker set do the job.\r\n\r\nOn headphones it&#39;s even easier; you just need to mute down your amp to 0, and route the input back to the interface output, doing the mixing on the PC. Some (better grade, typically) audio interfaces also allow the input to be mixed directly into the output, thus eliminating latency, while still allowing you to get good quality recording.\r\n\r\nIn this setup, if your audio interface of choice also allows impedance matching, you could get rid of the amp completely and do the whole modelling on the PC, but that might be less convenient depending on your preferences.\r\n\r\nIf you insist on using the amp as the only speaker, then you either need to\r\n\r\n * mix everything digitally before sending it to the amp\r\n * use an analog mixer and mix the guitar into the amp feed *before* it even hits the PC, send a copy to the PC and mix the PC output into the main mix as well. A mixer with a USB port would function essentially the same, but you&#39;d utilize its A/D/A converter instead of your PC&#39;s.", "887" ], [ "I disagree that an amplifier is incapable of working without a full set of tubes. Pulling out power stage tubes has been (is?) a common technique for power reduction. It&#39;s hardly to go unnoticed when it happens suddenly, but over a longer period of time, a tube could degrade significantly without the user noticing. As for compensation of differences, this applies to modern amps only, really. Pretty much every \" ;vintage \" ; one requires a matched set and only a limited bias setting for all of them.", "887" ], [ "@ToddWilcox that plainly means you didn&#39;t have to use multiple devices at the same time - because the WDM shared mode is absolutely not enough for any real use. Core Audio allows you to configure buffers and even intricacies as clock sources for the devices; what Windows offers isn&#39;t even remotely comparable. Without ASIO the latency is way too big even for scenarios as simple as playing a midi keyboard. And with ASIO enabled the exclusive mode is just a pain to work with. I also had numerous devices refusing to work with DirectSound outright.", "73" ], [ "Listen, I&#39;m not inventing this by a long shot. The only change that might be necessary is the impedance change. [There are credible sources](_URL_0_) that talk about this *without* having to do anything you&#39;re mentioning. And please keep in mind I&#39;m not taking sides in the \" ;is it a good idea \" ; debate; merely pointing out that the amp can run just fine.", "887" ], [ "@ToddWilcox It requires an edit to be made before you can change your vote (which yeah kinda doesn&#39;t make sense because of the comments). I&#39;ll incorporate the addendum and then you can make your choice again. I didn&#39;t really want to sound Apple-biased here, but I&#39;ve been working with multiple devices on a PC a bit *and even in simple scenarios* this has proven to be *at least* tricky - I&#39;m a recent Mac owner and so far it seems to confirm the \" ;urban legend \" ; that they&#39;re better prepared for that.", "139" ], [ "I started this a couple of weeks ago, went away fro Christmas and have now come back to finish it. This compiles and runs and finds/creates 16 jpg files however I can&#39;t open any of them. I feel like I&#39;m close to getting this but can&#39;t see what I&#39;m missing. I&#39;m hoping some fresh eyes will see it an point me in the right direction. All comments and *pointers appreciated. Thanks, <PERSON> :)\r\n\r\n #include < stdio.h > \r\n #include < stdlib.h > \r\n #include < string.h > \r\n #include < stdint.h > \r\n\r\n // define pattern(s) to look for\r\n #define BYTE_0 0xff\r\n #define BYTE_1 0xd8\r\n #define BYTE_2 0xff\r\n #define BYTE_3_1 0xe0\r\n #define BYTE_3_2 0xe1\r\n\r\n int main(void)\r\n {\r\n // set number of jpg files found to zero\r\n int jpg_count = 0;\r\n \r\n // open the recovery file, else return 1\r\n // recovery file name is \" ;card.raw \" ;\r\n FILE* recfile = fopen( \" ;card.raw \" ;, \" ;r \" ;);\r\n \r\n if (recfile == NULL)\r\n {\r\n printf( \" ;Could not open recovery file.\\n \" ;);\r\n return 1;\r\n }\r\n //declare buffer of recovery file size 512\r\n uint8_t buffer[512];\r\n \r\n //declare outfile, its name and length\r\n FILE* outfile;\r\n char filename[8];\r\n \r\n while (fread(buffer, 512, 1, recfile))\r\n {\r\n if (buffer[0] == BYTE_0 & & buffer[1] == BYTE_1 & & buffer[2] == BYTE_2 & & (buffer[3] == BYTE_3_1 || buffer[3] == BYTE_3_2))\r\n {\r\n if (jpg_count == 0)\r\n { // create output file\r\n sprintf(filename, \" ;%03d.jpg \" ;,jpg_count);\r\n outfile = fopen(filename, \" ;w \" ;);\r\n fwrite(buffer,sizeof(buffer),512,outfile);\r\n jpg_count++;\r\n }\r\n else if (jpg_count != 0)\r\n { fclose(outfile);\r\n sprintf(filename, \" ;%03d.jpg \" ;,jpg_count);\r\n outfile = fopen(filename, \" ;w \" ;);\r\n fwrite(buffer,sizeof(buffer),512,outfile);\r\n jpg_count++;\r\n } \r\n }\r\n else\r\n\t {\r\n\t \t if (jpg_count != 0)\r\n\t \t\t{\r\n\t \t\t fwrite(buffer, sizeof(buffer), 1, outfile);\r\n\t \t\t}\r\n\t \t}\t\r\n } \r\n }", "929" ], [ "Your guitar doesn&#39;t matter. You want regular guitar accessories. *What in particular* depends hugely on your personal preferences, needs and dreams. Hence I don&#39;t think this question can be adequately answered, because it would need to list every possible guitar equipment necessary, and that could fill a magazine or perhaps even a small book; way too much for an SE answer.", "729" ] ]
294
[ 5245, 4537, 4644, 19176, 17156, 1979, 16281, 19353, 10328, 10592, 6045, 18998, 10619, 3712, 1145, 13379, 14755, 3984, 14772, 18539, 8704, 14497, 18911, 3764, 16089, 7748, 9403, 11156, 5669, 8015, 7374, 16801, 16725, 16542, 1393, 18314, 13871, 3520, 18224, 5709, 1893, 19067, 4899, 15975, 18552, 1923, 17215, 13117, 11129, 11219, 10470, 14234, 19394, 11717, 8913, 9613, 14114, 1772, 5918, 18402, 3320, 10420, 11112, 12826, 3240, 19239, 10148, 9775, 1440, 7141, 6985, 16869, 3070, 10985, 16133, 17692, 1256, 4578, 7283, 18026, 12316, 17823, 15956, 476, 18259, 4036, 662, 14962, 8263, 18039, 17529, 17493, 97, 3528, 5122, 5893, 350, 11342, 11405, 2403, 12455, 3880, 592, 19160, 7153, 9943, 2784, 1328, 15867, 3347, 5634, 18916, 10040, 17330, 10075, 9600, 16737, 4655, 7626, 11635, 19641, 12701, 1123, 19192, 5995, 9767, 9984, 14127, 11476, 1296, 4815, 11410, 6423, 14714, 15851, 11907, 3514, 5082, 19420, 5562, 15340, 6617, 4212, 9450, 11685, 5574, 10536, 7233, 9701, 1035, 2811, 17607, 15074, 9534, 10490, 10155, 16261, 15362, 2123, 283, 2515, 2163, 15519, 3307, 19579, 17621, 3134, 9529, 16723, 2340, 2816, 16743, 2493, 14806, 6910, 8625, 13628, 1919, 184, 15767, 13623, 14467, 17276, 4336, 18391, 15500, 9547, 5490, 19213, 17454, 8045, 17323, 3113, 17984, 18786, 613, 1583, 3222, 18573, 850, 13839, 17362, 17360, 16407, 3785, 4977, 4068, 17126, 14886, 7350, 18099, 9961, 724, 9574, 3710, 15768, 7763, 4283, 3342, 17709, 1171, 18453, 2063, 1876, 1557, 19753, 13500, 11588, 575, 4708, 13242, 15522, 6759, 10966, 8229, 13285, 145, 5363, 12331, 8147, 710, 8062, 2561, 4515, 16245, 13093, 18770, 4224, 8150, 11229, 784, 246, 19642, 3355, 7789, 17945, 3968, 18010, 8868, 17219, 6279, 5573, 3760, 17492, 17887, 6394, 12968, 16097, 10137, 9053, 3267, 19670, 945, 16733, 11600, 17042, 16103, 6957, 14098, 6581, 3381, 17818, 335, 5677, 16359, 18072, 8558, 2595, 16845, 4348, 8784, 17176, 11061, 3627, 4083, 6059, 18836, 11582, 16152, 19334, 8754, 13440, 18499, 8010, 13970, 8881, 13183, 8055, 6940, 18901, 2355, 13382, 3036, 4306, 14919, 17766, 12177, 17831, 6228, 8965, 11136, 9106, 13410, 568, 4468, 10468, 17684, 9795, 9755, 6530, 13362, 8781, 8988, 12308, 10085, 15809, 17212, 14901, 19276, 6396, 15897, 11311, 8559, 513, 559, 16979, 4789, 18578, 18180, 1436, 12520, 18527, 7896, 5306, 2883, 17626, 14320, 10747, 5379, 15721, 9444, 11559, 11977, 4817, 5509, 1964, 13014, 6245, 13938, 4508, 10734, 4403, 16309, 15438, 18040, 19677, 18927, 7918, 18090, 4354, 17463, 10910, 6416, 14692, 3568, 18505, 9702, 14915, 17356, 11831, 9846, 18844, 14359, 910, 7867, 2717, 364, 13734, 18265, 15282, 13523, 9898, 7585, 2311, 13917, 14474, 8856, 3793, 17644, 5947, 7574, 9350, 12128, 14698, 15893, 6677, 3694, 17780, 3092, 12430, 8996, 10733, 10, 15457, 16489, 12194, 1891, 12800, 4033, 17096, 14205, 7672, 1954, 6157, 3662, 13496, 4027, 15617, 7980, 7198, 13324, 153, 11916, 13272, 1963, 19392, 925, 5761, 1088, 15558, 14856, 7494, 3892, 14077, 16099, 19031, 7251, 13492, 3928, 15587, 3208, 7798, 409, 6544, 13712, 9779, 4098, 16326, 10911, 7097, 16270, 18987, 4902, 13422, 16617, 9866, 5084, 3219, 8495, 18343, 15799, 2830, 19020, 9146, 10046, 17263, 4997, 17571, 17901, 1873, 4274, 2227, 7115, 12388, 6117, 16554, 3571, 17532, 4938 ]
STX_100611.0
[ [ "The `ResearvationId` has nothing to do with Reserved Instances. It is a unique value indicating a request to launch EC2 instances. A launch request may come from the cli, AutoScaling, or the AWS Management Console.\r\n\r\nEach request to `aws ec2 run-instances` will return zero or more reservations of instances. Usually, it&#39;ll be one if it succeeds, but the docs say \" ;zero or more \" ; (1), so a single launch request may be broken-up into multiple reservations.\r\n\r\nUsually, instances that are launched at one time get the same `ReservationId`, but that may not be a hard-and-fast rule. But launching 2 instances at 2 different times most likely will give different `ReservationId` values.\r\n\r\nFor example, as part of the `aws ec2 run-instances` command, you can indicate the minimum and maximum number of instances to launch simultaneously. Many times, this will be min = max = 1, but it can be more and/or different as long as 1 < = min < = max. You can also specify the number of instances to run when you launch new instances from the AWS Management Console. This can be seen on the \" ;Step 3: Configure Instance Details \" ; page.\r\n\r\nWhen executing `aws ec2 describe-instances`, your results will be grouped by the `ReservationId` value based on how they were launched.\r\n\r\nIn generally, you don&#39;t need to be concerned about the `ReservationId` value unless you want to know if they were launched simultaneously at which point `AmiLaunchIndex` on the instance will differ from instance-to-instance within the reservation (0, 1, 2, etc.).\r\n\r\nReferences:\r\n\r\n* (1) _URL_0_", "187" ], [ "It is not possible to send a single message to multiple SNS topics at the same time.\r\n\r\nA single SNS message can only be sent to one SNS topic.\r\n\r\nHowever, you could setup a third SNS topic which is designed for messages that go to multiple topics. \r\n\r\nFor example, TopicC could be designed to forward to TopicA and TopicB. Doing this, you would subscribe a Lambda function to TopicC, and in that Lambda function, forward the message to TopicA and TopicB.", "812" ], [ "This snapshot is not associated with an EC2 instance.\n\nIt is associated with an AMI image as mentioned in the error message.\n\nAMI images that are EBS-backed have associated EBS snapshots. These associated snapshots cannot be deleted until you deregister the AMI image.\n\nThe snapshot you are trying to delete is such a snapshot.\n\nIf you want to delete this snapshot, then you need to deregister the AMI image first. Once that has been done, you can delete the snapshot.", "721" ], [ "It is not possible to change the CIDR block for a VPC. So if you have created the VPC with <IP_ADDRESS><PHONE_NUMBER>, then that&#39;s as big as the VPC can get. You&#39;ll have to re-create the VPC to get more space.\r\n\r\nAlso, it&#39;s not possible to change a VPC subnet. You can only delete it and re-create it differently.\r\n\r\nOn top of that, it&#39;s not possible to delete a VPC subnet that has any resource inside it. So you&#39;ll have to delete all RDS instances, EC2 instances, etc. that are in your subnet first, then you can delete the subnet.", "168" ], [ "To restrict RDS access to only your Auto Scaling EC2 instances, and to allow access to your EC2 instances only from your ELB, you&#39;re going to use the same method: add a rule to your security group based on a source security group (rather than a source IP address CIDR).\r\n\r\nAssuming your EC2 instance(s) security group is sg-123, you would do the following:\r\n\r\n1. In the AWS Management Console, edit your RDS security group incoming rules.\r\n2. Add an incoming rule for port 3306. For the \" ;source \" ; field, where you would normally put an IP CIDR, instead put your EC2 instance&#39;s security group ID, eg. sg-123.\r\n3. Save your changes.\r\n\r\nThis will permit incoming to your RDS instance from any EC2 instance that has that security group attached.\r\n\r\nYou would do the same thing on your EC2 instance&#39;s security group for your ELB&#39;s security group. This will grant access to your EC2 instances from the ELB.", "187" ], [ "I&#39;m new to Tex and I&#39;ve just installed Texmaker from the Linux Mint software manager. Upon trying to start using a template I found (_URL_0_), the compiler errored out and told me that I&#39;m missing several .sty packages. \r\n\r\nI managed to resolve some of the problems with an update and by following another post, but neither resolved an issue with lipsum.sty, sectsty.sty and, I presume, several more to come since it only seems to be finding the first problem and then aborting builds.\r\n\r\nIs there anyway of managing Tex style packages without individually adding them to the home folder?", "46" ], [ "When you turn on versioning on the bucket, existing objects are not given a version ID. Instead, they will have a version ID of `null`. Any previous versions are not \" ;automatically restored \" ;.\r\n\r\nOther than that, existing objects will be versioned as normal in the future.\r\n\r\nNew objects added to or changed in the bucket will be given a unique version ID.\r\n\r\nAfter versioning is enabled, if you list all versions of an object, you&#39;ll notice that the last (oldest) version will have a version ID of `null`, if that original version existed before versioning was enabled.", "800" ], [ "**Issue 1:**\r\n\r\nElastic IP addresses should not be used to preserve the address of a \" ;back-end \" ; server. There are 2 reasons:\r\n\r\n1. Usually, you do not want back-end servers to be exposed to the internet and Elastic IP addresses only work from the internet into your EC2 instance.\r\n2. If you connect from one EC2 instance to another EC2 instance by it&#39;s Elastic IP address, then the connection leaves your VPC and re-enters the VPC. This makes security harder and will incur data traffic charges.\r\n\r\nInstead, you should reference your back-end server by it&#39;s private IP address. Stopping and restarting an EC2 instance will not change the private IP address. Only when an EC2 instance is terminated will the internal IP address be released. And when you launch an EC2 instance, you can optionally choose it&#39;s private IP address.\r\n\r\nYou can create a DNS entry (Route 53 private hosted zones) for your back-end server.\r\n\r\nAnother thing you can do, but it&#39;s not required, is to create a network interface with your private IP address. Then attach that network interface to the EC2 instance. If you need a new back-end server, then just move the network interface to the new instance and the private IP address will move with it.\r\n\r\n**Issue 2:**\r\n\r\nRDS instance endpoints do not change over time.\r\n\r\nAlso, RDS instances cannot be stopped. They can only be deleted. But, even if you delete an RDS instance and re-create it, if it has the same RDS instance ID, then it&#39;s endpoint will remain consistent.\r\n\r\nSo it&#39;s safe, and best-practice, to reference your RDS instance by it&#39;s hostname `_URL_0_`.\r\n\r\n**Final Thoughts:**\r\n\r\nPut your Redis server and your RDS instance in *private* subnets in your VPC. There is no reason why the public needs access to them. Your Rails app instance should be in a public subnet because the public will access your app through that instance.", "168" ], [ "This particular line item accounts for bandwidth costs which include:\r\n\r\n* Data transfer between availability zones\r\n* Data transfer within the same availablity zone, but using the public IP address instead of the private IP address\r\n* Data running through your ELB\r\n\r\nThis includes data transfer:\r\n\r\n* Between your EC2 instances\r\n* From your ELB to your EC2 instances\r\n* From your EC2 instances to your RDS instance\r\n\r\nIf your monthly cost for data transfer alone is $1,500.00, then that means you&#39;re transferring 150 TB of data between AZs and through your ELB.\r\n\r\nIf that amount of data seems high for your application, I would suggest talking to AWS support about it.", "187" ], [ "The last thing you want is to have a valid use case (eg. large video) hit the Lambda limitations (time and/or disk storage).\r\n\r\nYou should reduce your steps into small, single-task chunks, for example:\r\n\r\n* Convert video into frames\r\n* Convert frames into thumbnails\r\n* etc.\r\n\r\nEvaluate each small task individually. Determine your min/max/average file size and calculate your min/max/average time to process. If Lambda is a suitable fit, then choose it. Otherwise, you can use EC2 instance(s) to process items from queues (eg. using SQS).", "314" ] ]
477
[ 4060, 14695, 1833, 7660, 14483, 7354, 19453, 4040, 18054, 11818, 14956, 16483, 12298, 1388, 7071, 13140, 11101, 5454, 9234, 8125, 16106, 6258, 3818, 11447, 10403, 11611, 16169, 13446, 17283, 5217, 15519, 13319, 1682, 13947, 18182, 10724, 3039, 3663, 6160, 7698, 8860, 18135, 7842, 17707, 13657, 6342, 1229, 9513, 1982, 13437, 4936, 16777, 17869, 2902, 17766, 4657, 649, 18880, 2314, 14794, 17030, 1643, 2404, 1990, 8175, 11573, 8741, 7685, 5544, 16069, 1739, 894, 4273, 13293, 13997, 1027, 15310, 7819, 19547, 10074, 16900, 15409, 7905, 5485, 10997, 5728, 19045, 3999, 8485, 14543, 5316, 3269, 1237, 14068, 15365, 2742, 18725, 2296, 13915, 14165, 2632, 6789, 12878, 12928, 18474, 17806, 12493, 8462, 711, 16834, 17948, 15319, 15732, 2305, 13084, 10399, 1978, 3722, 1641, 6132, 8040, 3325, 2744, 2763, 19715, 8778, 6999, 4382, 2198, 15509, 12463, 12826, 8975, 16031, 15275, 768, 5232, 13762, 4295, 6502, 5641, 1067, 7077, 6310, 5011, 11228, 17670, 14459, 17415, 9899, 4804, 4771, 14939, 14098, 2415, 12917, 13295, 19610, 18320, 1964, 15858, 536, 9449, 16895, 5981, 11288, 16012, 1040, 14219, 19239, 2890, 1913, 12010, 4272, 12701, 1, 10149, 5162, 7599, 18668, 17360, 19334, 15226, 12856, 17941, 9052, 15324, 17936, 7433, 2083, 7045, 3235, 3681, 222, 9040, 3286, 12913, 7756, 8964, 16914, 2169, 1772, 4296, 13396, 2863, 9510, 13038, 3698, 15242, 275, 9165, 15767, 12365, 8084, 9595, 9962, 18915, 164, 19353, 15224, 17913, 3489, 12730, 14376, 9861, 2845, 3240, 9018, 6422, 1258, 2016, 12851, 15886, 554, 81, 4730, 15642, 1514, 9791, 5091, 8902, 697, 538, 5474, 11800, 11973, 8991, 2893, 13510, 15847, 4610, 1476, 14681, 10685, 5673, 9925, 3856, 732, 7655, 14614, 9701, 14273, 8587, 5654, 19605, 14078, 17183, 18473, 5520, 2454, 13215, 13174, 16807, 1726, 6498, 11356, 8405, 15438, 17903, 8973, 2078, 1240, 2313, 5581, 15355, 2227, 3712, 15303, 18591, 12141, 2563, 5475, 11324, 15862, 9866, 1050, 3550, 1264, 11749, 15989, 18678, 4895, 583, 19012, 5015, 16322, 14647, 15867, 718, 1054, 4318, 9359, 10930, 7137, 14345, 956, 2410, 4719, 2262, 7140, 15168, 17611, 10789, 6991, 14028, 17792, 6471, 9340, 5357, 8032, 13566, 207, 1645, 5867, 7664, 1937, 93, 97, 11874, 4709, 4478, 17245, 6623, 6940, 16407, 8883, 1468, 15770, 9960, 13390, 5611, 402, 16622, 15701, 15569, 5605, 7349, 15, 3284, 6340, 18402, 10642, 18841, 19621, 2733, 6609, 8917, 5526, 16249, 15008, 16349, 17155, 14617, 14180, 377, 7010, 13869, 5749, 6552, 11430, 17348, 16307, 4229, 10341, 4970, 778, 866, 9558, 15728, 16587, 18758, 16159, 9323, 19203, 4021, 19767, 12523, 16364, 18377, 2978, 471, 6742, 19680, 1082, 12234, 5092, 16280, 17895, 14580, 13232, 18664, 16025, 17014, 689, 3052, 18347, 15357, 14855, 9636, 4891, 12715, 12524, 3803, 6756, 19061, 15729, 15663, 189, 6984, 4425, 16842, 575, 6019, 13124, 3395, 11919, 6228, 11923, 12456, 5825, 10497, 7525, 11475, 6234, 1551, 6784, 3192, 10094, 11550, 6598, 19268, 2199, 18843, 10879, 5891, 8024, 1677, 3787, 14234, 13240, 978, 2123, 1070, 16102, 14571, 7804, 18360, 126, 19110, 8932, 15367, 18993, 7446, 16157, 7631, 8840, 15953, 6724, 9198, 16490, 9554, 5683, 11991, 2288, 9364, 18408, 8172, 12881, 19598, 18040, 10703, 19469, 761, 5696, 9675, 5395, 442, 199, 13846 ]
STX_10061438.0
[ [ "I have a simple python program with some math equations, that keep failing, and i don&#39;t know why. \r\n\r\n\r\n \r\n \r\n def add(x, y):\r\n\t return(x + y)\r\n\r\n def sub(x, y):\r\n\t return(x - y)\r\n\r\n\r\n def multiply(x, y):\r\n\t return(x * y)\r\n\r\n def divide(x, y):\r\n\t return(x / y)\r\n\r\n def sqaure(x):\r\n\t return math.sqrt(x)\r\n\r\n\r\n\r\nthe error appears on the first line, when i define the add function\r\n\r\n\r\nERROR:\r\n\r\n File \" ;_URL_0_ \" ;, line 9\r\n def add(x, y):\r\n ^\r\n SyntaxError: invalid syntax", "74" ], [ "I have a flask application where I want to flash different alert messages depending on an action. \r\n\r\nhere is my first message, where i check if an email matches my regex pattern:\r\n\r\n \r\n reciver = str(email)\r\n if not re.match(r \" ;[^@]+@[^@]+\\.[^@]+ \" ;, reciver):\r\n \tflash( \" ;Please enter a valid email address \" ;, &#39;error&#39;)\r\n \treturn render_template( \" ;about.html \" ;)\r\n\r\n\r\nhere is the second message, which is displayed if a message is sent successfully:\r\n\r\n flash(&#39;Message sent succesfully&#39;, &#39;succes&#39;) \r\n return render_template( \" ;about.html \" ;)\r\n\r\n\r\nhere is my HTML code:\r\n\r\n \r\n < h1 class= \" ;mb-5 \" ; > Enter your message, and i will get back to you as soon as possible < /h1 > \r\n {% with messages = get_flashed_messages() %}\r\n \t\t\t{% if messages %}\r\n \t\t\t{% for message in messages %}\r\n \t\t\t < div class= \" ;alert alert-success \" ; > \r\n \t\t\t < li > {{ message }} < /li > \r\n \t\t < /div > \r\n \t\t{% endfor %}\r\n \t\t\t{% endif %}\r\n\t\t\t{% endwith %}\r\n\t\t\t{% block body %}{% endblock %}\r\n\r\n\r\n\r\nhow can I make an alert-danger for the first message and an alert-success for the second message, is there some sort of conditional that can be used?", "812" ], [ "I have a Flask application, where I just created a new HTML file, which I want to link to, but it says URL not found. I have tried both using the `url_for ` and just linking directly with the path, but nothing works. \r\n\r\nI&#39;m not sure if it&#39;s a problem with sublime or Flask. I can easily link other HTML I have created in the past, but the new HTML just won&#39;t do it.\r\n\r\n[here is the picture of the files I have in my templates folder][1]\r\n\r\nDo I have no idea why this is happening?\r\n\r\n\r\n\r\n [1]: _URL_0_\r\n\r\nI have made to different HTML pages in sublime and saved them as HTML pages. Whenever I use the open in browser option it works fine, but not when I run it in the application.\r\n\r\nI tried to use the UNIX command `curl <IP_ADDRESS>:5000/test\r\n` to test the specific URL and got the error `curl: (7) Failed to connect to <IP_ADDRESS> port 5000: Connection refused\r\n`", "833" ], [ "I have a java program, where i have one Even object, that has a next method, where it is incrementing a value twice:\r\n\r\n\r\n public class Even\r\n {\r\n private int n = 0;\r\n public int next()\r\n {\r\n n++;\r\n n++;\r\n return n;\r\n }\r\n }\r\n\r\n\r\nif I run two threads, from the main method, where I access the same object, it ALWAYS returns even. Since both threads are accessing the same objects, should it not return an uneven value at some point?\r\n\r\n\r\n\r\n Even even = new Even();\r\n Thread t1 = new Thread(() - > {\r\n for (int i = 0; i < 10000; i++) {\r\n System.out.println(even.next());\r\n if (i % 2 == 0) {\r\n try {\r\n System.out.println( \" ;even \" ;);\r\n Thread.sleep(1000);\r\n } catch (InterruptedException ex) {\r\n System.out.println( \" ;fail \" ;);\r\n Logger.getLogger(Exercise2.class.getName()).log(Level.SEVERE, null, ex);\r\n return;\r\n }\r\n\r\n }\r\n\r\n }\r\n\r\n });\r\n Thread t2 = new Thread(() - > {\r\n for (int i = 0; i < 10000; i++) {\r\n System.out.println(even.next());\r\n if (i % 2 == 0) {\r\n try {\r\n System.out.println( \" ;even \" ;);\r\n Thread.sleep(1000);\r\n } catch (InterruptedException ex) {\r\n System.out.println( \" ;fail \" ;);\r\n Logger.getLogger(Exercise2.class.getName()).log(Level.SEVERE, null, ex);\r\n return;\r\n }\r\n }\r\n }\r\n });\r\n t1.start();\r\n t2.start();\r\n\r\n }\r\n }\r\n\r\nCan anyone clarify my confusion?", "880" ], [ "I have a simple calculate.js function, that calculates a price and displays it to the user. Here is my function:\r\n\r\n function calculatePrice() {\r\n\r\n //Get selected data \r\n\t var width = document.getElementById( \" ;width \" ;);\t \r\n\r\n\t var heigth = document.getElementById( \" ;height \" ;);\t\r\n\r\n var elt = document.getElementById( \" ;style \" ;);\r\n var style = elt.options[elt.selectedIndex].value;\r\n\r\n elt = document.getElementById( \" ;materials \" ;);\r\n var materials = elt.options[elt.selectedIndex].value;\r\n\r\n elt = document.getElementById( \" ;priority \" ;);\r\n priority= elt.options[elt.selectedIndex].value;\r\n\r\n //convert data to integers\r\n style = parseInt(style);\r\n materials = parseInt(materials);\r\n priority = parseInt(priority);\r\n width = parseInt(width);\r\n height = parseInt(height); \r\n\r\n //calculate total value \r\n var total = 500* (height + width) + (style + materials + priority)\r\n\r\n //print value to PicExtPrice \r\n document.getElementById( \" ;PicExtPrice \" ;).value=total;\r\n }\r\n\r\n\r\nEverything was working fine until I started using the width and height variables. The issue is that they are text fields, and I want the user to \r\ninput a number directly, instead of selecting an option like the other values.\r\n\r\nHTML code for input fields:\r\n \r\n\t\t\t < div class= \" ;col-lg-6 \" ; > \r\n\t\t\t\tInd&#230;st bredden p&#229; &#248;nskede malleri \r\n\t\t\t < input name= \" ;width \" ; type= \" ;text \" ; maxlength= \" ;512 \" ; id= \" ;width \" ; onChange= \" ;calculatePrice() \" ;/ > \r\n\r\n\t\t < /div > \r\n\r\n\r\n\t\t < div class= \" ;col-lg-6 \" ; > \r\n\t\t\t\tInd&#230;st l&#230;ngden p&#229; &#248;nskede malleri \r\n\t\t\t < input name= \" ;heigth \" ; type= \" ;text \" ; maxlength= \" ;512 \" ; id= \" ;heigth \" ; onChange= \" ;calculatePrice() \" ;/ > \r\n\t\t < /div > \r\n\r\nexample of an dropdown option:\r\n\r\n\r\n < div class= \" ;col-lg-6 \" ; > \r\n < SELECT NAME= \" ;Stil \" ; onChange= \" ;calculatePrice() \" ; id= \" ;style \" ; > \r\n \t\t\t < OPTION value= \" ;0 \" ; > Hvilken stil skal malleriet v&#230;re mallet i < /OPTION > \r\n \t\t\t < OPTION value= \" ;1 \" ; > Kubisme < /OPTION > \r\n \t\t\t < OPTION value= \" ;2 \" ; > Impressionisme < /OPTION > \r\n \t\t\t < OPTION value= \" ;3 \" ; > Pop/Ekspressionisme < /OPTION > \r\n \t\t\t < /SELECT > \r\n\r\n \t\t < /div >", "18" ], [ "I saw on this thread on StackOverflow: _URL_1_\r\n\r\nThe answer worked for me, but so far I have only tested it on localhost, and I want to make sure, that the IP-address is actually the IP from the user, and not the server itself. \r\n\r\nThe reason I&#39;m in doubt because I tried to different methods to test this out \r\n\r\n #I&#39;m using a Mail API, but here I will print for simplicity\r\n &#39;IP-address from user &#39; + request.remote_addr #retures <IP_ADDRESS> when running on localhost\r\n\r\nwhenever I try with the ipinfo API, I get the actual IP-address from my internet connection, not from localhost. \r\n\r\n\r\n url= &#39;_URL_0_;\r\n response = urlopen(url)\r\n data = json.load(response)\r\n\r\n IP=data[&#39;ip&#39;]\r\n org=data[&#39;org&#39;]\r\n city = data[&#39;city&#39;]\r\n country=data[&#39;country&#39;]\r\n region=data[&#39;region&#39;] \r\n\r\n print(&#39;IP : {4} \\nRegion : {1} \\nCountry : {2} \\nCity : {3} \\nOrg : {0}&#39;.format(org,region,country,city,IP))\r\n #returns actual IP-address from my internet connection\r\n\r\n\r\nHow can I ensure, that the later solution actual returns the IP and location from the user, the accesses the service", "168" ], [ "I have made a flask application that I want to deploy to Heroku for testing purposes.\r\n\r\n\r\nI have created the app and everything, but whenever I run the command:\r\n\r\n git push heroku master. \r\n\r\nI get the following error.\r\n\r\n remote: ----- > App not compatible with buildpack: _URL_0_\r\n cks/heroku/python.tgz\r\n\r\n\r\nsince it is a flask application, I do not understand, why it is wrong that I set the buildpack to python.\r\n\r\n(I&#39;m using python 2.7)\r\n\r\nIn my Procfile I have added the following line:\r\n\r\n web: gunicorn app:app\r\n\r\n\r\nIn my requirements.txt I have specified all the dependencies:\r\n\r\n\r\n Flask==0.12\r\n Flask-Bootstrap==<IP_ADDRESS>\r\n Flask-Mail==0.9.0\r\n Flask-MySQLdb==0.2.0\r\n Flask-ReCaptcha==0.4.2\r\n Flask-WTF==0.14.2\r\n gunicorn==19.7.1\r\n Jinja2==2.8.1\r\n\r\nalong with some more dependencies I used the \r\n pip freeze > requirements.txt \r\ncommand to get the file, so all should be included", "46" ], [ "I have a Flask application that I have deployed to Heroku, but I get an error:\r\n\r\n 2018-08-27T12:39:32.197715+00:00 heroku[router]: at=error code=H10 desc= \" ;App crashed \" ; method=GET path= \" ;/ \" ; host=_URL_0_ request_id=3e02d494-1a3f-4467-9eaa-aaa551b4ca03 fwd= \" ;<IP_ADDRESS><PHONE_NUMBER> \" ; dyno= connect= service= status=503 bytes= protocol=https\r\n\r\nIt appears that it is a mistake in my Flask app structure, because just above it throws a Python / Flask exception:\r\n\r\n File \" ;/app/.heroku/python/lib/python2.7/site- \r\n packages/gunicorn/_URL_1_ \" ;, line 357, in import_app \r\n __import__(module)\r\n ImportError: No module named app\r\n\r\nHere is my folder structure:\r\n\r\n- Folio\r\n - _URL_2_\r\n - (Procfile and other dependencies)\r\n - static\r\n - css\r\n - js\r\n - images\r\n - lib\r\n - templates \r\n - index.html\r\n - venv\r\n\r\nHere is my `_URL_2_` file:\r\n\r\n from flask import Flask\r\n from flask import render_template, request, flash, session, url_for, \r\n redirect\r\n\r\n app = Flask(__name__)\r\n\r\n @app.route(&#39;/&#39;)\r\n def index():\r\n return render_template(&#39;index.html&#39;)\r\n\r\n app.run(debug=True)\r\n\r\nHere is my `Procfile`:\r\n\r\n web: gunicorn app:app", "885" ], [ "I&#39;m working with some low-level multithreading in java where I have two methods produce and consume:\r\n\r\n\r\n public class Producer {\r\n\r\n private LinkedList < Integer > list = new LinkedList();\r\n private final int LIMIT = 10;\r\n private Object lock = new Object();\r\n\r\n public void produce() throws InterruptedException {\r\n\r\n int value = 0;\r\n\r\n while (true) {\r\n\r\n synchronized (lock) {\r\n\r\n // while loopet er til, for at blive ved med at tjekke at tjekke, at listen er fuld\r\n while (list.size() == LIMIT) {\r\n //notify v&#230;kker dette while-loop\r\n lock.wait(); //l&#229;sen venter indtil der er plads til at blive taget en ny v&#230;rdi ud\r\n System.out.println( \" ;hej \" ;);\r\n }\r\n list.add(value++);\r\n lock.notify();\r\n }\r\n }\r\n }\r\n\r\n public void consume() throws InterruptedException {\r\n\r\n Random random = new Random();\r\n while (true) {\r\n synchronized (lock) {\r\n while (list.size() == 0) {\r\n lock.wait();\r\n }\r\n System.out.print( \" ;list size is \" ; + list.size());\r\n int value = list.removeFirst();\r\n System.out.println( \" ;Current value is \" ; + value);\r\n lock.notify();\r\n }\r\n\r\n Thread.sleep(random.nextInt(1000));\r\n\r\n }\r\n }\r\n }\r\n\r\nwhat can I put in the main method for the thread to run? Since I&#39;m in the case is not using Thread of the Runnable interface, I can&#39;t start them, and instantiating an object, and calling the methods is not working?", "880" ], [ "I checked my chrome network tab, when inspecting, and found this script, that looked a bit fishy. It&#39;s called inject.js and has this code. I don&#39;t have any extensions, called something like this, so I&#39;m worried it might be a malware script?\r\n\r\n\r\n (() = > {\r\n try {\r\n const detectJs = (chain) = > {\r\n const properties = chain.split(&#39;.&#39;);\r\n\r\n let value = properties.length ? window : null;\r\n\r\n for (let i = 0; i < properties.length; i++) {\r\n const property = properties[i];\r\n\r\n if (value & & value.hasOwnProperty(property)) {\r\n value = value[property];\r\n } else {\r\n value = null;\r\n\r\n break;\r\n }\r\n }\r\n\r\n return typeof value === &#39;string&#39; || typeof value === &#39;number&#39; ? value : !!value;\r\n };\r\n\r\n const onMessage = (event) = > {\r\n if (_URL_0_ !== &#39;patterns&#39;) {\r\n return;\r\n }\r\n\r\n removeEventListener(&#39;message&#39;, onMessage);\r\n\r\n const patterns = event.data.patterns || {};\r\n\r\n const js = {};\r\n\r\n for (const appName in patterns) {\r\n if (patterns.hasOwnProperty(appName)) {\r\n js[appName] = {};\r\n\r\n for (const chain in patterns[appName]) {\r\n if (patterns[appName].hasOwnProperty(chain)) {\r\n js[appName][chain] = {};\r\n\r\n for (const index in patterns[appName][chain]) {\r\n const value = detectJs(chain);\r\n\r\n if (value & & patterns[appName][chain].hasOwnProperty(index)) {\r\n js[appName][chain][index] = value;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n postMessage({ id: &#39;js&#39;, js }, &#39;*&#39;);\r\n };\r\n\r\n addEventListener(&#39;message&#39;, onMessage);\r\n } catch (e) {\r\n // Fail quietly\r\n }\r\n })();\r\n\r\n\r\nIs this some sort of malware?", "230" ], [ "I have Flask application that I want to apply to Heroku. \r\n\r\nI have made a Procfile as such:\r\n\r\n web: gunicorn routes:app\r\n\r\nand a requirements.txt:\r\n\r\n click==6.7\r\n Flask==0.12\r\n gunicorn==19.6.0\r\n itsdangerous==0.24\r\n Jinja2==2.8.1\r\n MarkupSafe==1.0\r\n Werkzeug==0.14.1\r\n\r\nbut whenever I try to run the command:\r\n\r\n git push heroku master\r\n\r\nI always get this error:`App not compatible with buildpack: _URL_0_\r\n\r\neven though I have set the buildpack to python. My main python file is called `_URL_1_`, so the Profile should be correct, and I have made a lot of research and all the dependencies seems to be there, what could be the issue?\r\n\r\n\r\nfor all my dependencies I also have a Pipfile and a Pipfile.lock..\r\n\r\n\r\nI tried using `pip install --upgrade -r requirements.txt`\r\n\r\nand this resulted in this error:\r\n\r\n No matching distribution found for adium-theme-ubuntu==0.3.4 (from -r /tmp/build_622384b275f7a5f640333152a3b25ba1/requirements.txt (line 1))\r\n\r\n\r\noutput of Git Status:\r\n\r\n On branch master\r\n Your branch is ahead of &#39;origin/master&#39; by 3 commits.\r\n (use \" ;git push \" ; to publish your local commits)\r\n nothing to commit, working directory clean\r\n\r\n\r\nErrors i get from my requirements.txt \r\n\r\n File \" ;/app/.heroku/python/lib/python3.6/site-packages/setuptools/__init__.py \" ;, line 5, in < module > \r\n import distutils.core\r\n File \" ;/app/.heroku/python/lib/python3.6/distutils/co_URL_2_ \" ;, line 16, in < module > \r\n from distutils.dist import Distribution\r\n File \" ;/app/.heroku/python/lib/python3.6/distutils/_URL_5_ \" ;, line 9, in < module > \r\n import re\r\n File \" ;/app/.heroku/python/lib/python3.6/_URL_2_ \" ;, line 142, in < module > \r\n class RegexFlag(enum.IntFlag):\r\n AttributeError: module &#39;enum&#39; has no attribute &#39;IntFlag&#39;\r\n \r\n ----------------------------------------\r\n Command \" ;python _URL_3_ egg_info \" ; failed with error code 1 in /tmp/pip-build-oqscorl3/enum34/\r\n Push rejected, failed to compile Python app.", "46" ], [ "I&#39;m using Ubuntu 16.04 btw, and I got a lot of errors, from the requirements.txt file, and it can detect the Python application, but I get some errors, regarding python _URL_0_ egg-Info, maybe I have a wrong requirements.txt file? I just used pip freeze (using a virtual environment), to get the newest version, however, errors still occur?", "435" ], [ "I have a flask application, where I want to make an E-mail system so that the user is getting sent an email. So I have made two imports:\r\n\r\n\r\n\r\n from flask_mail import Message\r\n from app import mail\r\n\r\n\r\nhowever, whenever I import email from the app, I get this error, whenever I try to run my application. \r\n\r\n\r\n\r\n\r\n Usage: flask run [OPTIONS]\r\n\r\n Error: The file/path provided (routes) does not appear to exist. Please verify the path is correct. If app is not on PYTHONPATH, ensure the extension is .py", "20" ], [ "I have a flask application, where I want to add a recaptcha field. I use it to verify, that an email can be sent. here is my code so far:\r\n\r\n from flask import render_template, request, flash, session, url_for, redirect\r\n from flask import Flask\r\n from flask_mail import Mail, Message\r\n from flask_recaptcha import ReCaptcha\r\n\r\n\r\n\r\n app.config.update({&#39;RECAPTCHA_ENABLED&#39;: True,\r\n &#39;RECAPTCHA_SITE_KEY&#39;:\r\n &#39;6LdJ4GcUAAAAAN0hnsIFLyzzJ6MWaWb7WaEZ1wKi&#39;,\r\n &#39;RECAPTCHA_SECRET_KEY&#39;:\r\n &#39;secret-key&#39;})\r\n\r\n\r\n app=Flask(__name__)\r\n\r\n\r\n recaptcha = ReCaptcha(app=app)\r\n\r\n\r\n mail_settings = {\r\n \" ;MAIL_SERVER \" ;: &#39;_URL_2_&#39;,\r\n \" ;MAIL_PORT \" ;: 465,\r\n \" ;MAIL_USE_SSL \" ;: True,\r\n \" ;MAIL_USERNAME \" ;: &#39;USERNAME&#39;,\r\n \" ;MAIL_PASSWORD \" ;: &#39;PASSWORD&#39;\r\n }\r\n\r\n\r\n app.config.update(mail_settings)\r\n mail = Mail(app)\r\n\r\n\r\n @app.route(&#39;/&#39;)\r\n def index():\r\n return render_template(&#39;index.html&#39;)\r\n\r\n\r\n\r\n\r\n @app.route(&#39;/mail&#39;, methods=[&#39;GET&#39;, &#39;POST&#39;])\r\n def send_mail():\r\n\r\n r = _URL_1_(&#39;_URL_0_;,\r\n data = {&#39;secret&#39; : \r\n &#39;secret_key&#39;,\r\n &#39;response&#39; :\r\n request.form[&#39;g-recaptcha-response&#39;]})\r\n\r\n google_response = json.loads(r.text)\r\n print(&#39;JSON: &#39;, google_response)\r\n\r\n\r\n if google_response[&#39;success&#39;]:\r\n msg = Message(&#39;Thank you for contacting me&#39;, sender=&#39;<EMAIL_ADDRESS>&#39;, recipients = [request.form[&#39;email&#39;]])\r\n msg.body =&#39;sut den&#39;\r\n mail.send(msg)\r\n return render_template(&#39;index.html&#39;)\r\n else:\r\n\t return render_template(&#39;index.html&#39;)\r\n\r\n\r\n app.run(debug=True)\r\n\r\n\r\n\r\nThe problem is that whenever I have the `flask_recaptcha import ReCaptcha` I get the following error:\r\n\r\n\r\nit looks like the `import` statement is incorrect, but since I&#39;m not using WTForms, I don&#39;t know what do else. Whenever I remove the `import` statement it gives a syntax error instead (which makes sense)\r\n\r\n\r\n Usage: flask run [OPTIONS]\r\n\r\n Error: The file/path provided (routes) does not appear to exist. \r\n Please verify the path is correct. If app is not on PYTHONPATH, \r\n ensure the extension is .py", "856" ], [ "I have a flask application, where i want to use recapchta in order to send an email.\r\n\r\n\r\nI have made everything so far, and all seems to be working, however when i test the application on localhost, i get an error code back as a JSON response. \r\n\r\n\r\nHere is the error code:\r\n\r\n (&#39;JSON: &#39;, {u&#39;error-codes&#39;: [u&#39;invalid-input-secret&#39;], u&#39;success&#39;: False})\r\n\r\nSo i have checked that the secret code is written correctly, and i even tried deleting it, and making a new one. But neither worked, i suspect, i might by the way that i write it in my code \r\n\r\nNOTE! I&#39;m not using WTForms (because it is not a login, just a simply mail API). \r\n\r\n\r\nHere i how i have written my configuration:\r\n\r\n\r\n\r\n app.config.update({&#39;RECAPTCHA_ENABLED&#39;: True,\r\n &#39;RECAPTCHA_SITE_KEY&#39;:\r\n &#39;6Ldj2GcUAAAAAA7MuBOKsDRIk1fMLvNaGBtrB7Du&#39;,\r\n &#39;RECAPTCHA_SECRET_KEY&#39;:\r\n &#39;(secret key is written here correctly)&#39;})\r\n\r\nDoes anybody know why i keep getting this error?\r\n\r\n\r\nShould i put the keys in a _URL_0_ file?", "915" ], [ "Okay so I found a way to make it work, but I do not think this is the optimal solutions (comments or other answers are very welcome), I put my secret-key directly in the method like so:\r\n\r\n\r\n \r\n\r\n r = _URL_1_(&#39;_URL_0_;,\r\n data = {&#39;secret&#39; :\r\n &#39;secret-key inserted here directly&#39;,\r\n &#39;response&#39; :\r\n request.form[&#39;g-recaptcha-response&#39;]})\r\n google_response = json.loads(r.text)\r\n print(&#39;JSON: &#39;, google_response)\r\n\r\n\r\nI think this might not be an optimal reason for security reasons, I think it should be stored as a variable first, however, I have tried some different configurations, and it did not work.", "915" ], [ "I&#39;m new to react, and trying to understand why I can&#39;t add an HTML tag to my render method\r\n\r\n render() {\r\n return (\r\n < div className= \" ;App \" ; > \r\n My App\r\n < Projects projects={this.state.projects}/ > \r\n < /div > \r\n );\r\n }\r\n\r\n render() {\r\n return (\r\n < div className= \" ;App \" ; > \r\n My App\r\n < Projects projects={this.state.projects}/ > \r\n < /div > \r\n < h1 > hello world < /h1 > \r\n );\r\n }\r\n\r\n\r\n\r\nhow come this work but if I add ` < /h1 > hello world < /h1 > ` into the function it would no longer work?", "530" ], [ "I have a flask application, where I want to send an email, along with some data fetched from a form. Everything works fine, but the issue is, that when the email is received the HTML code is not rendered it is only displayed the raw code. Here is what I have done so far\r\n\r\n\r\n if google_response[&#39;success&#39;]: #this line is used for a ReCaptcha response\r\n msg = Message(&#39;Thank you for contacting me&#39;, sender=&#39;(my email address is put here as a string)&#39;, recipients=[request.form[&#39;email&#39;]])\r\n name = request.form[&#39;name&#39;]\r\n msg.body = render_template(&#39;email.html&#39;, name=name)\r\n mail.send(msg)\r\n return render_template(&#39;index.html&#39;)\r\n else:\r\n return render_template(&#39;index.html&#39;)\r\n\r\nWhat, am I doing wrong?", "856" ], [ "I have a flask application, where I would like to get the visitors IP-address, and either print it to the console or save it into a JSON file. \r\n\r\nThe problem is that I get an unexpected indent error, whenever I try to do it.\r\n\r\n\r\n @app.route(&#39;/&#39;)\r\n def index():\r\n\t requester = request.remote_addr\r\n print(requester)\r\n return render_template(&#39;index.html&#39;)\r\n\r\n\r\ni have tried making the requester object outside of my index function, however that causes another error as such: \r\n\r\n\r\n\r\n RuntimeError: Working outside of request context.\r\n\r\n This typically means that you attempted to use functionality that needed\r\n an active HTTP request. Consult the documentation on testing for\r\n information about how to avoid this problem.\r\n\r\n\r\nhow can I fix this, so that I can get a global variable that holds the IP address of the user?", "942" ], [ "I have tried installing react icons, in my application I ran the npm command:\r\n\r\n sudo npm install react-icons --save\r\n\r\nI didn&#39;t get any errors, apart from some optional dependencies, that where skipped\r\n\r\n npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 \r\n (node_modules/fsevents):\r\n npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for \r\n fsevents@1.2.4: wanted { \" ;os \" ;: \" ;darwin \" ;, \" ;arch \" ;: \" ;any \" ;} (current: \r\n { \" ;os \" ;: \" ;linux \" ;, \" ;arch \" ;: \" ;x64 \" ;})\r\n\r\n\r\nWhenever I try to import some of the icons, I get an error\r\n\r\n\r\n ./src/components/SkiDaysCount.js\r\n Module not found: Can&#39;t resolve &#39;react-icons/lib/md&#39; in &#39; \r\n &#39;/home/kristoffer/ReactApps/navbar/src/components&#39;\r\n\r\n\r\nhere are my imports:\r\n\r\n\r\n import {Terrain} from &#39;react-icons/lib/md&#39;\r\n import {SnowFlake} from &#39;react-icons/lib/ti&#39;\r\n import {Calender} from &#39;react-icons/lib/fa&#39;\r\n\r\n\r\nWhy am I getting this error?\r\n\r\n\r\nEDIT:\r\n\r\ni have also tried using the old syntax for importing, with the same issue as such:\r\n\r\n import Calender from &#39;react-icons/lib/fa/calender&#39;", "46" ], [ "< !-- language-all: lang-js -- > \r\n\r\nI&#39;m trying to create a skiing app in react, where I want to set some dates, for when a skiing event occurs. Whenever I use the date object, and pass in a date that is in the future into the constructor, it just displays \r\n\r\n Nan/Nan/Nan\r\n\r\nHere is my code:\r\n\r\n < SkiDayList\r\n days={[\r\n {\r\n resorts: \" ;Squaw Valley \" ;,\r\n date: new Date( \" ;20/8/2018 \" ;),\r\n powder: true,\r\n backcountry: false\r\n },\r\n {\r\n resorts: \" ;Val Thorens \" ;,\r\n date: new Date( \" ;5/10/2018 \" ;),\r\n powder: true,\r\n backcountry: true\r\n },\r\n {\r\n resorts: \" ;Val Desire \" ;,\r\n date: new Date( \" ;5/10/2018 \" ;),\r\n powder: false,\r\n backcountry: true\r\n },\r\n {\r\n resorts: \" ;Squaw Valley \" ;,\r\n date: new Date( \" ;1/2/2018 \" ;),\r\n powder: true,\r\n backcountry: false\r\n }\r\n ]}\r\n / > \r\n\r\nI know I could just multiply the dates or add values, but is it best practice to do that inside the constructor, or is it better to create values outside the component, and then pass them in, I&#39;m new to react, some I&#39;m not sure, what is the best practice. \r\n\r\n\r\nEDIT: \r\n\r\nhere is my SkiDayRow.js component\r\n\r\n import React, { Component } from \" ;react \" ;;\r\n import { FaBeer } from \" ;react-icons/fa \" ;;\r\n import React, { Component } from \" ;react \" ;;\r\n import { FaBeer } from \" ;react-icons/fa \" ;;\r\n \r\n export const SkiDayRow = ({ resort, date, powder, backcountry }) = > (\r\n < tr > \r\n < td > \r\n {date.getMonth() + 1}/{date.getDate()}/{date.getFullYear()}\r\n < /td > \r\n < td > {resort} < /td > \r\n < td > {powder ? < FaBeer / > : null} < /td > \r\n < td > {backcountry ? < FaBeer / > : null} < /td > \r\n < /tr > \r\n );", "49" ], [ "< !-- language-all: lang-js -- > \r\n\r\nI have a react component called SkiDaysCount, where I output some data and make a simple calculation. \r\n\r\nWhat is the difference between declaring the default props with the getDefaultProps method like such\r\n\r\n getDefaultProps() {\r\n return {\r\n total: 50,\r\n powder: 50,\r\n backcountry: 15,\r\n goal: 75\r\n };\r\n }\r\n\r\n\r\nand assigning them in your App.js/Index.js like this:\r\n\r\n\r\n SkiDaysCount.defaultProps = {\r\n total: 50,\r\n powder: 10,\r\n BackCountry: 15,\r\n goal: 75\r\n };\r\n\r\nand then just assigning the values inside the place, where you place your component\r\n\r\n\r\n < SkiDaysCount\r\n total={70}\r\n powder={20}\r\n backcountry={10}\r\n goal={75}\r\n / >", "530" ], [ "< !-- language-all: lang-js -- > \r\n\r\nI have an react app, where I have an array of some ski days, with some information about some ski trips:\r\n\r\n\r\n\r\n allSkiDays:[\r\n {\r\n resort: \" ;Squaw Valley \" ;,\r\n date: new Date( \" ;12/24/2018 \" ;),\r\n powder: true,\r\n backcountry: false\r\n },\r\n {\r\n resort: \" ;Val Thorens \" ;,\r\n date: new Date( \" ;12/22/2018 \" ;),\r\n powder: true,\r\n backcountry: true\r\n },\r\n {\r\n resort: \" ;Val Desire \" ;,\r\n date: new Date( \" ;5/15/2018 \" ;),\r\n powder: false,\r\n backcountry: true\r\n },\r\n {\r\n resort: \" ;Squaw Valley \" ;,\r\n date: new Date( \" ;1/18/2018 \" ;),\r\n powder: true,\r\n backcountry: false\r\n }\r\n ]\r\n }\r\n\r\n\r\ninitially, they were placed in my App.js (main file), I declared them with a component called SkiDaysList\r\n\r\nlike such :\r\n\r\n < SkiDaysList ={(array inserted here)} / > \r\n\r\n\r\nI have now created a new component called classCreator, where I want to store the array instead, for better code practice:\r\n\r\n export const classCreator = createClass({\r\n getInitialState(){\r\n return { (array put here)\r\n\r\n render() {\r\n return (\r\n < div className= \" ;classCreator \" ; > \r\n < /div > \r\n )\r\n }\r\n\r\n\r\nbut now i get this error:\r\n\r\n TypeError: Object(...) is not a function\r\n on this line \r\n\r\n export const classCreator = createClass({\r\n\r\n\r\n\r\nEdit: Here is my entire classCreator component:\r\n\r\n import {createClass} from &#39;react&#39;;\r\nimport React, { Component} from &#39;react&#39;;\r\n\r\n\r\n export const classCreator = createClass({\r\n getInitialState(){\r\n return {\r\n allSkiDays:[\r\n {\r\n resort: \" ;Squaw Valley \" ;,\r\n date: new Date( \" ;12/24/2018 \" ;),\r\n powder: true,\r\n backcountry: false\r\n },\r\n {\r\n resort: \" ;Val Thorens \" ;,\r\n date: new Date( \" ;12/22/2018 \" ;),\r\n powder: true,\r\n backcountry: true\r\n },\r\n {\r\n resort: \" ;Val Desire \" ;,\r\n date: new Date( \" ;5/15/2018 \" ;),\r\n powder: false,\r\n backcountry: true\r\n },\r\n {\r\n resort: \" ;Squaw Valley \" ;,\r\n date: new Date( \" ;1/18/2018 \" ;),\r\n powder: true,\r\n backcountry: false\r\n }\r\n ]\r\n }\r\n },\r\n\r\n render() {\r\n return (\r\n < div className= \" ;classCreator \" ; > \r\n < /div > \r\n )\r\n }\r\n\r\n\r\n })", "530" ], [ "I have an error in my MySQL program, even though my friend doesn&#39;t get the error after he autogenerated it\r\n\r\n create database person;\r\n CREATE TABLE person.`persons` (\r\n ID INT NOT NULL AUTO_INCREMENT,\r\n FNAME VARCHAR(45) NOT NULL,\r\n LNAME VARCHAR(45) NOT NULL,\r\n PHONE INT NOT NULL,\r\n PRIMARY KEY (ID),\r\n UNIQUE INDEX ID_UNIQUE (ID ASC));\r\n\r\n\r\nI get the error, that FIELD ID doesn&#39;t have a default value, even though I have specified it, how come this be? \r\nI have written it as AUTO_INCREMENT and NOT_NULL whenever I try to paste in some values I also get the error\r\n \r\n \r\nthe error occurs, when I try to insert some values into the table like such:\r\n\r\n\r\n INSERT INTO `Person`.`PERSON` (`FNAME`, `LNAME`, `PHONE`) VALUES (&#39;Kristoffer&#39;, &#39;T&#248;lb&#248;ll&#39;, &#39;6969&#39;);\r\n INSERT INTO `Person`.`PERSON` (`FNAME`, `LNAME`, `PHONE`) VALUES (&#39;Nioklai&#39;, &#39;Stein Bagger&#39;, &#39;1234&#39;);\r\n INSERT INTO `Person`.`PERSON` (`FNAME`, `LNAME`, `PHONE`) VALUES (&#39;Sebastian&#39;, &#39;Ananasfar&#39;, &#39;5475&#39;);", "480" ], [ "I&#39;m working with JSON and JPA, and have main method, to do some testing with my objects. \r\n\r\nwhenever I try to convert a Java Entity to a JSON string a get a stack overflow error as such \r\n\r\n String jsonString = gson.toJson(cus1)\r\nif I instead use a regular POJO in this case as a DTO, I don&#39;t get an error. But how come it makes a stack overflow error, when I use an entity class?\r\n\r\n\r\n @Entity\r\n @Table(name = \" ;Customers \" ;)\r\n @XmlRootElement\r\n @NamedQueries({\r\n @NamedQuery(name = \" ;Customer.findAll \" ;, query = \" ;SELECT c FROM Customer c \" ;)\r\n , @NamedQuery(name = \" ;Customer.findById \" ;, query = \" ;SELECT c FROM Customer c WHERE _URL_0_ = :id \" ;)\r\n , @NamedQuery(name = \" ;Customer.findByName \" ;, query = \" ;SELECT c FROM Customer c WHERE _URL_1_ = :name \" ;)\r\n , @NamedQuery(name = \" ;Customer.findByAge \" ;, query = \" ;SELECT c FROM Customer c WHERE c.age = :age \" ;)})\r\n \r\n public class Customer implements Serializable {\r\n private static final long serialVersionUID = 1L;\r\n @Id\r\n @GeneratedValue(strategy = GenerationType.IDENTITY)\r\n private Integer id;\r\n private String name;\r\n private int age;\r\n @JoinColumn(name = \" ;city \" ;, referencedColumnName = \" ;id \" ;)\r\n @ManyToOne(optional = false)\r\n private City city;\r\n //getters, setters and constructor", "785" ], [ "I have a pet entity class with some named queries, one of them like this:\r\n\r\n @NamedQueries({\r\n @NamedQuery(name = \" ;Pet.findAll \" ;, query = \" ;SELECT p FROM Pet p \" ;)\r\n\r\n\r\nI have a facade class, where I&#39;m calling the method like such.\r\n\r\n\r\n \r\n EntityManagerFactory emf = Persistence.createEntityManagerFactory( \" ;PetHospitaljpa \" ;);\r\n \r\n \r\n public Collection < Pet > returnAllPets (){\r\n \r\n EntityManager em = emf.createEntityManager();\r\n //vi laver en typed query for at specificere hvilken datatype, det er <PERSON>, i dette tilf&#230;lde er <PERSON> en Pet\r\n TypedQuery < Pet > query = em.createNamedQuery( \" ;Pet.findAll \" ;, Pet.class);\r\n return query.getResultList();\r\n }\r\n\r\n\r\nYet I get an empty collection in return whenever I call the method, I&#39;m using the debugger and I can see that the query is empty, but why is this? \r\n\r\nI have checked my MySQL database, and there is data inside. \r\n\r\nHere is the data from my MySQL table:\r\n\r\n[![data from MySQL table][1]][1]\r\n\r\n\r\n [1]: _URL_0_", "87" ], [ "I have a Json array, that I&#39;m parsing into a javascript object array.\r\n\r\n\r\n btn.addEventListener( \" ;click \" ;, function() {\r\n var request = new XMLHttpRequest();\r\n request.open(&#39;GET&#39;, &#39;_URL_0_;);\r\n request.onload = function() {\r\n var data = JSON.parse(request.responseText);\r\n // renderhtml(data);\r\n addPerson(data);\r\n };\r\n request.send();\r\n });\r\n\r\nI have made an addPerson function to add a user-defined object into the list.\r\n\r\n\r\n addPerson = (data) = > {\r\n var fName = document.getElementById( \" ;fname \" ;);\r\n var lName = document.getElementById( \" ;lname \" ;);\r\n var age = document.getElementById( \" ;age \" ;);\r\n var id = data.pop()+1;\r\n const person = {fName, lName, age, id};\r\n data.add(person);\r\n }\r\n\r\n\r\nwhen the function is called I get &#39;addPerson is not defined&#39; as an error. Why is this?\r\n\r\n\r\nhere is my entire file:\r\n\r\n\r\n var btn = document.getElementById( \" ;btn \" ;);\r\n var root = document.getElementById( \" ;root \" ;);\r\n \r\n \r\n btn.addEventListener( \" ;click \" ;, function() {\r\n var request = new XMLHttpRequest();\r\n request.open(&#39;GET&#39;, &#39;_URL_0_;);\r\n request.onload = function(){\r\n var data = JSON.parse(request.responseText);\r\n //renderhtml(data);\r\n addPerson(data);\r\n \r\n };\r\n request.send();\r\n \r\n });\r\n \r\n \r\n \r\n renderhtml = (data) = > {\r\n let htmlString = \" ; \" ;;\r\n \r\n for(i = 0; i < data.length; i++){\r\n htmlString += \" ; < p > \" ; + data[i].fName + \" ; \" ; + data[i].lName + \" ; < /p > \" ;\r\n }\r\n \r\n \r\n \r\n addPerson = (data) = > {\r\n var fName = document.getElementById( \" ;fname \" ;);\r\n var lName = document.getElementById( \" ;lname \" ;);\r\n var age = document.getElementById( \" ;age \" ;);\r\n var id = data.pop()+1;\r\n const person = {fName, lName, age, id};\r\n data.push(person);\r\n \r\n }\r\n \r\n \r\n \r\n root.insertAdjacentHTML(&#39;beforeend&#39;, htmlString);\r\n }", "8" ], [ "I have a JPQL query that currently selects all from a Pet entity. But I want to fetch some more information from the Owner entity. \r\n\r\nThere is a one to many relationships between the pet and the Owner. If I start off be querying this:\r\n\r\n SELECT p FROM Pet p JOIN \r\n\r\nHow should I join the owner class in order to fetch firstName and lastName from the entity class of the owner? \r\n\r\n\r\n\r\nhere is the reference in the entity class of pet:\r\n\r\n @JoinColumn(name = \" ;owner_id \" ;, referencedColumnName = \" ;id \" ;)\r\n @ManyToOne\r\n private Owner ownerId;\r\n\r\n\r\nand the owner entity: \r\n\r\n @OneToMany(mappedBy = \" ;ownerId \" ;)\r\n private Collection < Pet > petCollection;", "87" ], [ "I have a Java REST API, with some JSOn data, that I&#39;m working with, in javascript. \r\n\r\n\r\nI have two methods one to show data, and when to add new data:\r\n\r\n\r\nso I have added an EventListener to my first bata to submit data:\r\n\r\n\r\n btn.addEventListener( \" ;click \" ;, function() {\r\n var request = new XMLHttpRequest();\r\n request.open(&#39;GET&#39;, &#39;_URL_0_;);\r\n request.onload = function(){\r\n var data = JSON.parse(request.responseText);\r\n addPerson(data);\r\n \r\n \r\n };\r\n request.send();\r\n\r\n });\r\n\r\n\r\nwith the addPerson method like this:\r\n\r\n\r\n const addPerson = (data) = > {\r\n var fName = document.getElementById( \" ;fname \" ;).value;\r\n var lName = document.getElementById( \" ;lname \" ;).value;\r\n var age = document.getElementById( \" ;age \" ;).value;\r\n var id = data[data.length-1].id +1;\r\n const person = {fName, lName, age, id};\r\n \r\n data.push(person);\r\n console.log(person);\r\n for(i = 0; i < data.length; i++){\r\n console.log(data[i]);\r\n }\r\n }\r\n\r\n\r\nthe problem is, that new data is generated for each GET request, so I only want to fetch the data once, and save that in an array, and then add new persons from there on.\r\n\r\n\r\nI have a method to show the JSON data as well after converting it into objects:\r\n\r\n\r\nI added an event listener to another button like before where I&#39;m calling this method: \r\n\r\n\r\n render HTML = (data) = > {\r\n let htmlString = \" ; \" ;;\r\n \r\n \r\n for(i = 0; i < data.length; i++){\r\n htmlString += \" ; < p > \" ; + data[i].fName + \" ; \" ; + \" ; \" ; + data[i].lName + \" ; \" ; + data[i].age + \" ; \" ; + data[i].id + \" ; < /p > \" ;\r\n }\r\n root.insertAdjacentHTML(&#39;beforeend&#39;, htmlString);\r\n }", "8" ], [ "The reason you are getting this error is that the &#39;element&#39; is not referring to anything in this instance. You need to loop through the array, and then add the logic to each element, say that you would want to add two to teach element of your array, your callback function could look something like this: \r\n\r\n\r\n function specificAFunction( arr ) {\r\n let arrayResult = [];\r\n arr.forEach( element = > arrayResult.push(element + 2) );\r\n return arrayResult;\r\n };\r\n\r\n\r\nand then you could call your first function with the function and your array of values:\r\n\r\n const values = myFilter(myArray, specificAFunction);", "789" ], [ "I have a button where I want to add some data, from a file, into an event listener as a callback function\r\n\r\n\r\n \r\n \r\n function jokesFunc(){\r\n const allJokes = jokes.getJokes().map(joke = > \" ; < li > \" ;+joke+ \" ; < /li > \" ;);\r\n document.getElementById( \" ;jokes \" ;).innerHTML = allJokes.join( \" ; \" ;);\r\n };\r\n \r\n \r\n document.getElementById( \" ;container \" ;).addEventListener(&#39;click&#39;, jokesFunc)\r\n\r\nhere I have made a callback function, that is supposed to show jokes, whenever a button is clicked, but it says:\r\n\r\n Cannot read property &#39;addEventListener&#39; of null\r\neven tough I have an element with an id of the container in my HTML code\r\n\r\nI have made a function, that adds \" ;jokes \" ; elements in the my \" ;container \" ; div, whenever it is clicked, but since it is an anonymous function, how can I pass in the callback function?", "648" ], [ "I have a big svg file, that is displayed on an html page, with the following code \r\n\r\n \r\n < svg\r\n xmlns:dc= \" ;_URL_1_;\r\n xmlns:cc= \" ;_URL_0_;\r\n xmlns:rdf= \" ;_URL_2_;\r\n xmlns:svg= \" ;_URL_3_;\r\n xmlns= \" ;_URL_3_;\r\n version= \" ;1.0 \" ;\r\n width= \" ;680 \" ;\r\n height= \" ;520 \" ;\r\n viewBox= \" ;1754 161 9938 7945 \" ;\r\n id= \" ;svg2 \" ; > \r\n < title\r\n id= \" ;title4 \" ; > Countries of Europe < /title > \r\n < desc\r\n id= \" ;desc6 \" ; > A blank Map of Europe. Every country has an id which is its ISO-3166-1-ALPHA2 code in lower case.\r\n Members of the EU have a class= & quot;eu & quot;, countries in europe (which I found turkey to be but russia not) have a class= & quot;europe & quot;.\r\n Certain countries are further subdivided the United Kingdom has gb-gbn for Great Britain and gb-nir for Northern Ireland. Russia is divided into ru-kgd for the Kaliningrad Oblast and ru-main for the Main body of Russia. There is the additional grouping #xb for the & quot;British Islands & quot; (the UK with its Crown Dependencies - Jersey, Guernsey and the Isle of Man) \r\n ... file continues on \r\n\r\n\r\ni have used this javascript code, to different sections of the svg code targeting their id using this code\r\n\r\n\r\n \r\n document.querySelector(&#39;svg&#39;).addEventListener(&#39;click&#39;,function(e){\r\n const dir = (e.target.closest(&#39;g&#39;).id);\r\n alert(dir);\r\n });\r\n\r\nbut i get this error:\r\n\r\n Uncaught TypeError: Cannot read property &#39;addEventListener&#39; of null\r\n at Object. < anonymous > (index.js:29)\r\n at __webpack_require__ (bootstrap f06ab605832628ed0f5f:19)\r\n at Object. < anonymous > (html5-entities.js:190)\r\n at __webpack_require__ (bootstrap f06ab605832628ed0f5f:19)\r\n at bootstrap f06ab605832628ed0f5f:62\r\n at bootstrap f06ab605832628ed0f5f:62\r\n\r\n\r\n\r\n\r\nwhenever i click most of the parts, it will return another error:\r\n\r\n (index):27 Uncaught TypeError: Cannot read property &#39;addEventListener&#39; of null\r\n\r\n\r\n\r\nbut few parts of the drawing alerts the id of the element", "885" ], [ "I have a list of json object, with the attributes: first name, last name, and gender. \r\nI have a fetch function as such:\r\n\r\n\r\n buttonsend.addEventListener( \" ;click \" ;, function(){\r\n fetch( \" ;_URL_0_;).then(\r\n function(response){\r\n return response.json();\r\n }\r\n ).then(function(jsonData){\r\n for(var i = 0; i < = jsonData.length; i ++){\r\n console.log(JSON.stringify(jsonData[i]).gender);\r\n }\r\n //document.getElementById( \" ;json \" ;).innerHTML = JSON.stringify(jsonData);\r\n \r\n console.log(2);\r\n \r\n });\r\n });\r\n\r\nIn my for loop how can I access each of the elements of the object, and display them in a table in my HTML code?", "8" ], [ "buttonsend.addEventListener( \" ;click \" ;, function(){\r\n let txt;\r\n fetch( \" ;_URL_0_;).then(\r\n function(response){\r\n if(response.status > = 400){\r\n console.log( \" ;ERROR more then 500 names requested \" ;);\r\n alert( \" ;Don&#39;t request so many names \" ;);\r\n }\r\n return response.json();\r\n }\r\n ).then(function(jsonData){\r\n for(var i = 0; i < jsonData.length; ++i){\r\n console.log(body);\r\n console.log(jsonData.length);\r\n console.log(jsonData[0].name);\r\n txt += \" ; < tr > < td > \" ; + jsonData[i].name + \" ; < /td > \" ; + \" ; < td > \" ;+ jsonData[i].surname + \" ; < /td > \" ; + \" ; < td > \" ; + jsonData[i].gender + \" ; < /td > < /tr > \" ;;\r\n if(jsonData[i].name == undefined){\r\n // jeg kan seri&#248;st ikke se hvad det er \r\n console.log( \" ;here is is at index \" ; + jsonData[i])\r\n }\r\n }\r\n document.getElementById( \" ;tblbody \" ;).innerHTML = txt;\r\n //document.getElementById( \" ;json \" ;).innerHTML = JSON.stringify(jsonData);\r\n \r\n console.log(2);\r\n \r\n });\r\n });\r\n\r\n\r\nI have a function here where I display same data in an HTML table, but no I want to make another method, where I would display the same data, but as SQL data, so I think I would want to make the json data, global. I was considering using a callback function, but how can I do this. because the last &#39;then&#39; call goes directly into another function `).then(function(jsonData){\r\n for(var i = 0; i < jsonData.length; ++i){`", "8" ], [ "I have a person component, with this source code.\r\n\r\n const person = props = > {\r\n return (\r\n < div > \r\n < p onClick={props.click} > \r\n I&#39;m {_URL_0_} and I am {props.age} years old!\r\n < /p > \r\n < p > {props.children} < /p > \r\n < input type= \" ;text \" ; onChange={props.changed} / > \r\n < /div > \r\n );\r\n };\r\n\r\n\r\nThe idea is that I want the input text to update the name of the person component in my app.js file.\r\n\r\nHere I have made a function called nameChangedHandler, to actually change the name (to start off I have only targeted the second object in my persons array).\r\n\r\n nameChangedHandler = event = > {\r\n this.setState({\r\n persons: [\r\n { name: \" ;<PERSON> \" ;, age: 22 },\r\n { name: event.target.value, age: 24 },\r\n { name: \" ;<PERSON> \" ;, age: 29 }\r\n ]\r\n });\r\n };\r\n\r\n\r\n\r\nIn my render method, I have added a variable called changed, where I&#39;m calling the this.nameChangedHandler, to change the name of the second persons object\r\n\r\n\r\n < Person\r\n name={this.state.persons[1].name}\r\n age={this.state.persons[1].age}\r\n click={this.switchNameHandler.bind(this, \" ;<PERSON>! \" ;)}\r\n changed={this.nameChangedHandler}\r\n > \r\n My hobbies: Racing\r\n < /Person > ;\r\n\r\n\r\nWhenever I type some data into the input field, it is not changing the name of the person?", "970" ], [ "I have a static array, that I loop through to display three columns.\r\n\r\nBoys, Girls and All.\r\n\r\nSo far I have added a looping method that displays all the elements in the array as such:\r\n\r\n boys.forEach(function(boy) {\r\n strboy += &#39; < li > &#39;+ boy + &#39; < /li > &#39;;\r\n }); \r\n \r\n strboy += &#39; < /ul > &#39;;\r\n document.getElementById( \" ;boys \" ;).innerHTML = strboy;\r\n\r\nthis works fine, the issue comes, when I want the user to add another element to the array. I have made a function as such \r\n\r\n \r\n function addboy(){\r\n var boy=document.getElementById(&#39;newboy&#39;).value\r\n boys.push(boy);\r\n console.log(boys);\r\n }\r\n\r\nthis works, and the new array is logged to the console, but how can I update the UI, after the user added a new element. I tried not using an anonymous function, but then the entire new array got displayed again, I only want the new array to be displayed. I would prefer this with just Vanilla JavaScript and without JQuery.", "993" ], [ "I&#39;m new to using JPA, and i have a person Entity class, where i want to display some information, at first when i made the class, i had the ID set to \r\n\r\n @GeneratedValue(strategy = GenerationType.AUTO)\r\n private Long id;\r\n\r\nwhich genereated an ID of 51, where i was told by my teacher to change it to:\r\n\r\n @GeneratedValue(strategy = GenerationType.IDENTITY)\r\n private Long id;\r\nso it would just start with 1 and then add up for each person. \r\n\r\nNow i have a structure java class, where i want to delete the current database for each new instance i run the class, and i have this code:\r\n\r\n public static void main(String[] args) \r\n \r\n \r\n {\r\n HashMap < String, Object > puProperties = new HashMap < > ();\r\n \r\n puProperties.put( \" ;javax.persistence.sql-load-script-source \" ;, \" ;Scripts/ClearDB.sql \" ;);\r\n Persistence.generateSchema( \" ;jpadb \" ;, puProperties);\r\n \r\n \r\n puProperties.remove( \" ;javax.persistence.sql-load-script-source \" ;);\r\n Persistence.generateSchema( \" ;jpadb \" ;, puProperties);\r\n }\r\n\r\n\r\nwith a script as such: \r\n\r\n drop database jpadb if exists;\r\n create database jpadb;\r\n\r\n\r\nhere is the error i get:\r\n\r\n Internal Exception: \r\n com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an \r\n error in your SQL syntax; check the manual that corresponds to your \r\n MySQL server version for the right syntax to use near &#39;if exists&#39; at line 1\r\n Error Code: 1064\r\n Call: drop database jpadb if exists;\r\n Query: DataModifyQuery(sql= \" ;drop database jpadb if exists; \" ;)\r\n [EL Warning]: 2018-09-11 16:14:41.361--ServerSession<PHONE_NUMBER>)-- \r\n Exception [EclipseLink-4002] (Eclipse Persistence Services - \r\n 2.7.3.v20180807-4be1041): \r\n org.eclipse.persistence.exceptions.DatabaseException\r\n Internal Exception: java.sql.SQLException: Can&#39;t create database \r\n &#39;jpadb&#39;; database exists\r\n Error Code: 1007\r\n\r\nI don&#39;t know what the syntax error refers to?", "788" ], [ "I have a JPA application, with an entity diagram, that shows the relations between orders and customers. \r\n\r\nI have an ItemType entity class as such:\r\n\r\n @Entity\r\n public class ItemType implements Serializable {\r\n\r\n private static final long serialVersionUID = 1L;\r\n @Id\r\n @GeneratedValue(strategy = GenerationType.AUTO)\r\n private Long id;\r\n private String name;\r\n private String description;\r\n private int price;\r\n List < OrderLine > orderlines;\r\n\r\nthe class contains a list of OrderLines because it has a one to many relationships to the orderline entity. \r\n\r\nHere is my OrderLine entity. It contains a single instance of the ItemType class, because of the relationship.\r\n\r\n @Entity\r\n public class OrderLine implements Serializable {\r\n\r\n private static final long serialVersionUID = 1L;\r\n @Id\r\n @GeneratedValue(strategy = GenerationType.AUTO)\r\n private Long id;\r\n private int quantity;\r\n private Order order;\r\n private ItemType itemtype;\r\n \r\n\r\nI have a facade class, where i have made different methods, to calculate and select elements from my database, but i want to make a calculatePrice method, which multiplies the quantity from the orderline with the price from ItemType.\r\n\r\n\r\nI know that the functions need to take both an ItemType instance and an OrderLine instance like such:\r\n\r\n public int getTotalPrice(ItemType itemtype, OrderLine orderline){\r\n \r\n \r\n }\r\n\r\nbut I&#39;m not sure if I should use NamedQueries within the entity classes, to get the data from the database, or I should use something like a value annotation, that can make a calculation.", "87" ] ]
494
[ 6522, 16873, 6625, 12240, 12082, 6817, 8279, 17160, 16597, 17021, 14926, 17187, 12655, 12267, 2875, 7701, 15328, 13474, 14346, 9488, 13670, 17763, 17957, 14911, 13144, 11001, 14509, 14787, 8959, 6591, 158, 8250, 10611, 10567, 1302, 17978, 12863, 19565, 16701, 19575, 1399, 11149, 15180, 18753, 13079, 5280, 12600, 13365, 13654, 10705, 13934, 11998, 7590, 14311, 14468, 12089, 11674, 14733, 844, 13849, 13454, 19508, 11331, 13969, 16315, 12170, 4948, 1414, 3763, 12570, 11346, 8379, 17556, 13296, 11277, 7272, 15081, 111, 16832, 11684, 15020, 15102, 4793, 5304, 6259, 17531, 8698, 18179, 17943, 15690, 2531, 8277, 12231, 16625, 19757, 18374, 17690, 2906, 13765, 12228, 18291, 12846, 13141, 9954, 15801, 4707, 646, 11775, 14397, 3723, 1127, 14533, 14412, 7460, 14422, 14593, 1657, 11022, 9262, 7930, 16715, 10050, 13979, 15386, 17942, 8480, 15676, 6451, 12348, 16203, 10080, 17077, 3584, 14906, 14178, 10942, 11036, 14182, 11682, 3545, 32, 8337, 12105, 12871, 13254, 13605, 10299, 11126, 13563, 8286, 11542, 14242, 9347, 8909, 19783, 12019, 10354, 5667, 666, 17257, 9855, 6235, 15353, 8098, 13294, 6840, 17965, 11952, 12930, 1804, 17609, 13045, 18704, 14321, 5097, 13265, 19476, 4968, 3549, 15156, 5442, 19482, 7437, 605, 13890, 15421, 9640, 13688, 17874, 7820, 19540, 16841, 7767, 3397, 11744, 6267, 18894, 17962, 11151, 5035, 10833, 12125, 4178, 17145, 12613, 12656, 8135, 19773, 19700, 19607, 19726, 11019, 3846, 13330, 18035, 879, 19294, 674, 11305, 14351, 10278, 18673, 11814, 6778, 5024, 12868, 9759, 9748, 19346, 18460, 626, 14296, 12840, 17834, 14717, 5542, 14423, 13579, 9263, 1947, 14872, 15320, 14195, 11942, 11086, 17085, 8935, 2638, 11509, 167, 11594, 952, 10741, 12514, 18175, 19174, 9666, 15815, 7792, 17872, 19427, 15391, 11645, 5233, 16808, 12016, 17721, 10555, 12536, 280, 5680, 6341, 7949, 10372, 14862, 7717, 3086, 553, 14925, 17178, 7234, 17976, 17270, 13872, 15419, 18756, 12073, 5844, 12763, 12646, 6911, 18087, 15575, 5626, 8117, 10166, 15966, 13976, 17345, 1996, 14106, 15345, 15828, 12740, 2094, 10788, 16499, 14117, 15422, 13359, 17164, 15385, 17457, 9801, 14060, 1487, 14499, 9064, 13398, 19472, 18384, 16861, 11755, 10520, 7674, 13526, 4445, 15299, 17639, 14034, 9634, 5602, 17668, 14972, 1578, 11055, 14765, 9990, 3531, 15492, 12910, 9413, 182, 7496, 19691, 4603, 5066, 19722, 17606, 15451, 7378, 3290, 914, 15118, 17078, 7677, 17338, 18426, 19695, 18815, 1322, 13152, 14377, 5516, 18910, 17072, 19454, 2096, 11501, 9250, 18489, 13228, 7984, 13542, 11972, 14115, 19290, 14555, 18446, 11054, 6895, 12794, 16255, 14564, 9353, 13927, 13227, 15599, 10542, 17331, 70, 10867, 15331, 11669, 5553, 19570, 16897, 13802, 8819, 6391, 7398, 13159, 3778, 15626, 11955, 6842, 15326, 11612, 5886, 9848, 16455, 10487, 10294, 14720, 8259, 1381, 2594, 11549, 14198, 14961, 6516, 18438, 17548, 1122, 6631, 4747, 11719, 13189, 19675, 13638, 13137, 15267, 7663, 12060, 6801, 5426, 6266, 11214, 4046, 14645, 3440, 18511, 6404, 13481, 13415, 11352, 9483, 15220, 9584, 4777, 6518, 8990, 9843, 8471, 17603, 5953, 17821, 8589, 17894, 14826, 8426, 17372, 871, 18959, 11667, 13692, 186, 19, 2739, 6630, 47, 13527, 6924, 19309, 19684, 4923, 8466, 13601, 11873, 10735, 10630, 15084, 12353, 14629, 4577, 12849, 6213, 15151, 10407, 19661, 8093, 1540, 19640, 8707, 2378, 14999, 11161, 2841, 10593 ]
STX_10062.0
[ [ "You can edit field level security for all fields, but only 1 profile at a time.\r\n\r\nI still use the old profile interface, which would use this path\r\nsetup - profiles - field level security - account - edit\r\n\r\n[![fls select object][1]][1]\r\n\r\n[![fls edit mode][2]][2]\r\n\r\nYou can do the same for record type access - set access for all record types, 1 profile at a time:\r\nsetup - profiles - record type setings - accounts (edit)\r\n\r\n[![recordtype select object][3]][3]\r\n\r\nIn the new profile UI, its similar to doing this on permission sets, where you would click on a profile, then select the account object, where you can set record type access and field level security from the same page.\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_0_\r\n [3]: _URL_1_", "550" ], [ "You should be able to switch to test mode and run test card no.\n\nSee this cnp support article\n\n_URL_0_\n\n > You change the status of a page to “Test” to run transactions with a “test” credit card number. This way you can run a transaction on a payment page without using a real credit card. “Test” status allows you can see exactly how you payment page preforms before you make it “Active.”\n\nI believe this article may refer to the older cnp portal vs the new connect platform. If so cnp support should be able to point you at the details for how to do this on connect.", "687" ], [ "There is no way to achieve the desired result declaratively. \n\nField level security cannot be changed on a per record basis. A user has the given level of access to said field on all records they can access.\n\nThe closest I could imagine would be to put the sensitive data in a child object, and use apex managed sharing to grant access to that child record to the owner + hierarchy (the hierarchy bit w managed sharing might be tricky - that is not my expertise). \n\n**UPDATE**\nInstead of managed sharing, you could just use process builder to sync the parent record owner w the child record. Then you can set the org wide defaults on child to private, and check the share w hierarchy option, which would share these records up the role (not manager) heirarchy.\n\nAnother option could be using a visualforce page or component running in system mode to determine how to display that field. This however would not allow for reporting on that field.\n\nAlso note that formula fields don&#39;t evaluate field level security for the fields they reference. So a formula field could determine if running user equals owner, then display the value, else blank. This would w the VF option, or w the child record option if you add logic to write the value from child to the hidden field on parent which is referenced by the formula field.\n\nOne final note - grant access using hierarchies grants access via the role hierarchy, not the manager hierarchical relationship field on user. Manager sharing is now supported declaratively, but last I looked it had to be set per user, and couldn&#39;t be set to share all records of said object w the record owners manager.", "550" ], [ "Which version of campaign influence are you referring to? [The original campaign influence (now known as campaign influence 1.0) or customizable campaign influence?][1]\r\n\r\nPer the docs, [The original Campaign influence is not available via the API][2], which makes it hard to do much of anything with it.\r\n\r\n > The Campaign Influence object is not available via the API and therefore it is not possible to directly insert new or update existing campaign influence records.\r\n\r\nThe article above has a workaround that uses the primary campaign lookup field on opportunity to set campaign influence. As far as I know that is the only way to add campaign influence, other than via the UI or automatic association.\r\n\r\nCustomizable campaign influence does have API access, and can be added retroactively. [Per the docs][3], you would need to create a model, and then use triggers / processes to apply the model. \r\n\r\n > To implement a custom influence attribution model, first add a model in Setup with a few clicks. Then create a set of triggers and processes that add campaign influence records and assign them to the model.\r\n\r\nI think a batch job might be best for retroactive purposes, but did not see any specific information, beyond whats available in the SOAP API docs \r\n\r\n- [campaignInfluence][4]\r\n- [campaignInfluenceModel][5]\r\n\r\n\r\n [1]: _URL_4_\r\n [2]: _URL_0_\r\n [3]: _URL_3_\r\n [4]: _URL_2_\r\n [5]: _URL_1_", "905" ], [ "I&#39;d have a look at your account sharing rules.\r\n\r\nSharing rules on account allow you to specify not only the access level for accounts, but also specify the access level on opportunities, contacts, and cases.\r\n\r\nTo make cases private, you dont need to blank out the account on the case, you just need to ensure that your account sharing rules dont give access to cases by setting case access to private on all account sharing rules.\r\n\r\nSee step 10 [on this doc][1]\r\n\r\n > In the remaining fields, select the access settings for the records associated with the shared accounts.\r\n\r\nIf you have a business need that requires account sharing rules to give access to cases, then it gets more challenging, as account level rules dont let you determine which types of cases to share. Not sure what the best option is in that case, but perhaps some crafty usage of case team would be an option.\r\n\r\n\r\n [1]: _URL_0_", "550" ], [ "A quick and dirty fix could be to throw the update into a scheduled action in pb. Downside is that it wouldn&#39;t be immediate, but it could get you some additional breathing room. Not positive in the CPU time limit case, but generally it can handle more in a scheduled action.\n\nAn intermediate approach could be to try visual workflow, as you could design a counter that would increment and throw the remainder to a wait element if the number approaches the limit\n\nThat said PB, with all its limitations around bulkification, shouldl be able to update 200 records without hitting cpu time limit. I wonder what else is happening on contact or account that might be contributing.\n\nIn the end a trigger is by far the best option, but you might want to try to see if you can get a bit further before going there, and if other stuff you have going on is contributing to the CPU time issue, you may find that pops up w triggers as well.", "299" ], [ "Gotcha. Im not familiar w rootstock, but one surprising functionality I ran into recently that you may want to test is that when I had a fast update and a record update on the same object in a single flow, the fast update ran before the record update even though they were in the reverse order. I doubt it would be a full commit and don&#39;t believe it&#39;s documented, but you could have a go of it. Apex is prob the best bet.", "510" ], [ "If you&#39;re running the same data weekly and monthly, you should be able to use the created date field on the records being created by the snapshot to include/exclude the data you are interested in. If needed, you could add a formula field to the object you are storing these on, which could evaluate created date to determine which category it falls into (the formula used would depend on whether monthly runs on the beginning, middle, or the end of the month)\r\n\r\nThat said, when you run a snapshot you can map the snapshot name to the name field on the record being created (or I believe to any other text field on the object). So if you actually wanted to schedule the weekly and monthly runs separately, then you can just name them appropriately and map that to a text field on the object.\r\n\r\nA screenshot from a snapshot where I have done so is below.\r\n\r\n[![analytics snapshot field mappings][1]][1]\r\n\r\n\r\n [1]: _URL_0_", "956" ], [ "If the email is being sent internally to a specified user or to the case owner, I would look at escalation rules as they allow you to send an email, can honor business hours, and can calculate age based on last modified date.\r\n\r\nSee [this doc][1] for details.\r\n\r\nIf the email is to be sent externally, I think you need to dig into milestones and entitlements as Santanu suggests. It appears that workflow and process builder do not factor business hours in at present (there is an [idea that is under review for it][2])\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "190" ], [ "Screenshot of full report run page could be helpful to rule out a couple of things. \n\nIt looks like your report must be built on a custom report type, given that there is no standard opportunity with account report type, and you included the custom report type tag on the post.\n\nIf so, I believe it&#39;s possible that the users could have access to the opps but not to the underlying accounts, as the sharing could be configured separately.\n\nThis could impact the report, as it is on opps and accounts, while the list view is only on opps. There is no way to do opps w accounts in list view like you can on report.\n\nSo If you are using a custom report type, please include a screenshot of how that is setup, and indicate whether org wide defaults for opps and accounts are both private.", "855" ], [ "In using the metadata API to delete validation rules today, I ran into the issue described [in this post][1], where i needed to set `deployOptions.singlePackage` to true, in order for the rules to get deleted.\r\n\r\nI understand that this setting indicates the structure of the zip file, as per [the docs][2] on the deploy method. \r\n\r\n > Indicates whether the specified .zip file points to a directory structure with a single package (true) or a set of packages (false).\r\n\r\nHowever, it seems like all of the samples in the documentation use the structure where `singlePackage` = true. I have not been able to find an example of deploying with `singlePackage` = false.\r\n\r\nGiven that the default value (at least in workbench) is false, I would like to understand what file structure is expected in order to successfully deploy using `singlePackage` = false.\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "927" ], [ "Case team provides record access, just like manual sharing would.\n\nThey still need profile / permission set edit access on case object else they will have no access to the case, because they have no access to the case object.\n\nThey also would need field level read/edit access on any fields they need to read / edit.", "550" ], [ "I&#39;m testing SSO w openId connect (Azure AD as auth provider)\r\n\r\nI&#39;m trying to better understand how I should set it up so that I can use SSO to authenticate to sandboxes that are spun up from prod.\r\n\r\nI&#39;m considering these approaches:\r\n\r\n- design my registrationHandler to determine environment and parse the sandbox username appropriately, so that it returns the correct user\r\n\r\n- dont bother w sandbox SSO, just use environment hub in prod (i have never used hub..But I think that it can do this)\r\n\r\n- something else?\r\n\r\nMy sense is that I could just use environment hub to connect myself (admin) to all sandboxes and users to the UAT sandbox only, and that would eliminate the need for me to use Azure SSO in sandboxes. However I have no idea how SSO behaves with sandbox refreshes, nor do I have access to environment hub, so am looking for guidance.", "528" ], [ "Yes you can do this with process builder, though it&#39;s likely better with flow.\n\nWhat you are describing is also known as a \" ;dynamic approval process \" ;.\n\nYou need to add a lookup to user on object1 (lets call it approver__c) and reference that field as the approver in your approval process.\n\nThen use process builder to update approver__c to the user on object2, and have process builder itself submit the record for approval.\n\nYou can use a checkbox to launch the process.\n\nOr you can build a button that launches a flow to update the checkbox, or you can do the whole thing in flow, which gives you some more options.\n\nYou might want to add logic to evaluate if the user is inactive and if so, pop a screen to the user, etc. Flow let&#39;s you do this.\n\nThere is a free hands on training for this that I helped build, from dreamforce 15, available here (scroll down for the free ones)\n\n_URL_0_", "246" ], [ "We use cases internally, and are looking to personalize our outbound case responses to display the `From Name` of the live human who is actually responding to the ticket. \r\n\r\nWe must use our email-to-case address as the from address, so that responses are routed back to the case.\r\n\r\nSuccess would be if instead of emails coming from Salesforce Support (<EMAIL_ADDRESS>), the email would come from Gorav Seth (<EMAIL_ADDRESS><PERSON> (support@abc.com).\r\n\r\nThe only option I can envision would be to create copies of our `organization-wide address` for every person in my team, with the from name set appropriately - which isnt really an option, if it would work at all.\r\n\r\nIs there any other way to accomplish this (lightning, service cloud, case feed, watson)? \r\n\r\nWe are currently in classic, without case feed, but willing to move out of the stone age for the right reward.", "190" ], [ "If you have chatter enabled, any user can attach a file via chatter feed.\n\nThese files will display in the notes and attachments list just like the ones attached from the related list.\n\nIf you switch to using files, I believe any user w read access can attach a file directly via the files related list, and it&#39;s a better experience, so consider making the switch. It&#39;s also needed for Lightning.", "43" ], [ "so you have a ROS field. You send an email alert, including the ROS field, and you see..what? You see nothing? You see a zero? You see the prior value? Is this a html email template or a visualforce email template? I&#39;ve never had issue w/ this, though you can try to force recalculation of a ROS field which could perhaps help. Click edit - Force a mass recalculation of this field", "190" ], [ "The `Object` name needs to be included in the email template `merge field`.\r\n\r\nIf you add a field using the email template generation UI, Salesforce does that automatically.\r\n\r\n[![addFieldViaUI][1]][1] \r\n\r\nIf you copy the field&#39;s API name from the object details page, then you need to prepend the object API name manually.\r\n\r\n[![objectDetailPage][2]][2]\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "190" ], [ "While this is not a direct answer to your immediate question, I wanted to note that it&#39;s surprisingly easy to do this via visual workflow. \n\nI&#39;m using a custom button to copy attachments from email to case. I have set it up so I can select which attachments to move over w a clever hack I picked up from developer force.\n\nSee these two posts if this is an approach you want to try.\n\n_URL_1_\n\n_URL_0_", "363" ], [ "I&#39;m not sure if you can or can&#39;t do this via flow, but the reason (I believe) that they didn&#39;t bring this to Lightning is that files connect supersedes it.\n\n_URL_0_\n\nAnd w the spring release, users can now (once authenticated) post a link to a Google doc in chatter and it will automagically create a file reference. \n\n_URL_1_\n\nI wish they had that for box,but alas it&#39;s not even on the roadmap. \n\nBut it should work for you and may be a better option in the long run.\n\nI&#39;ve never seen the googledoc object, will see if I can find any documentation on it.", "693" ], [ "I had to read it twice, it&#39;s not very clear! I think what it is saying is that creating a record where a dependent picklist field is set without setting the controlling field will trigger this error when the field is a restricted picklist. In this example, the dependent picklist field can be set by having a default value itself, or by having a default value for the record type. Setting the controlling field should resolve the error.", "789" ], [ "You need to create a formula field on the object you are reporting on, and then filter report on that field.\n\nFormula fields can evaluate the running users fields using the $user [global variable][1], or any other user relationships on the object using standard dot notation.\n\nFor user relationships you could use a custom report type and [add the user field(s) via lookup][2], but for the running user only option is to use a formula field.\n\n\n [1]: _URL_1_\n [2]: _URL_0_", "905" ], [ "It is a **good practice to have both solo papers and collaborative works**. While the latter show your capability of **team working**, the former demonstrate your **self-motivation** and ability to publish on your own. Both are top remarks that hiring team would consider important.\r\n\r\n - If all papers are co-authored it would sound suspicious that you are heavily dependent on others; this is a bad mark.\r\n - If all papers are solo-authored it would sound suspicious that you are incapable of working with colleagues.\r\n\r\nHence it is the best to have both in your CV.\r\n\r\nBeside all the above, in current date, hiring especially in academia does not solely depend on your publication, but on many other factors.\r\n\r\nTo say that, you should not worry too much about your situation from this point of view.\r\n\r\nAnd it is quite easy to find someone to be added to your authorship list of your paper. Just look around, you will notice many are waiting or willing to do so.", "827" ], [ "Assuming pipeline is a custom object, you could accomplish this by setting the `organization-wide defaults` for the object to `public read-only` and unchecking the &#39;`Grant Access Using Hierarchies`&#39; checkbox.\r\n\r\nYou would need to build sharing rules to grant edit access to others. Sharing rules do not grant delete or transfer permission, so that would still be controlled.\r\n\r\nOnly the owner will be able to delete (other than users with the modify all data system permission or those with modify all on the object).\r\n\r\nOne other edge case is users with the &#39;transfer records&#39; system permission. Those could transfer the record to themselves and then delete it. That would apply with the trigger solution as well, so you would need to determine how best to address that.\r\n\r\n**UPDATE**\r\njust noticed that you indicated preventing deletion of records they did not *create*. I thought it was for records they did not *own.* Often the owner is the same as the creator, but depending on your use case my proposed solution may or may not work!", "550" ], [ "@TobiasKildetoft Of course it is a wrong doing. However the reality is that almost 99% professors in all universities around the world all are in favor of being listed as co-author in papers that they did no contribution at all. If you do not accept, I am afraid you are living in a dream world. Because of this reality (which is popular misconduct) many professors show CV in astronomy scale. I am sure that if you contact any professor in your geographic area and suggest a collaboration (and you are knowing that there is nothing he/she can help or add any value) there is no chance they reject.", "827" ], [ "Using a status field to reflect the latest approval will not work when steps are skipped. It will only reflect the last actual approval, not the current step in the process, as you are observing.\n\nOne option could be to use a text field instead of a picklist for status. Then, in the field update that sets status when prior step is approved, you can add logic *in the field update itself* that evaluates what the next step will be, and set the value appropriately. This can get complex and can be a bear to maintain, but is feasible if the field you are writing to is a text field.\n\nAnother thing to consider is that approval emails allow you to use approval step name as a merge field. That can be very helpful in conveying what the current status is.", "858" ], [ "I poked and prodded the &#39;infinite&#39; loop approach a while ago, and it eventually will throw an error.\r\n\r\nsee : _URL_2_\r\n\r\nSupport logged it as a [known issue][1], in review for the past oh 2 years or so, dont anticipate it getting much attention. I havent tested since then so its possible that the behavior is different now.\r\n\r\nInstead of this I suggest checking out <PERSON>; &#39;[process builder scheduler][2]&#39; which uses scheduled apex to trigger flows via a custom object. Its pretty crafty, and I think will be much more reliable in the long run. Doesnt require you to write any code, but your environment will no longer be 100% code free.\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "246" ], [ "I&#39;m not sure I follow. The approval process follows some logic, and the field update has access to all of the same variables as the approval criteria, so shouldn&#39;t it be possible to set the value for status appropriately? Imagine instead that status is a long text area field, couldn&#39;t the field update write a log for what happens at each step, so if from step 1, step 2 and 3 are skipped, the field update from step 1 could write step 1 complete; step 2 skipped; step 3 skipped, etc?", "858" ], [ "Well the [&#39;suggested solutions&#39; on help and training][1] logged their first win (for me) today. I think the &#39;resolution&#39; is bogus, as querying FeedItem will not get me the results I want. But looks like they are not treating this as a known issue as it will work properly in apex, just throws an error from workbench, dev console, etc \r\n\r\n\r\n [1]: _URL_0_", "964" ], [ "If I&#39;m reading your question correctly, you are looking for a programmatic means of displaying the correct picklist values given a specific record type on an sobject.\n\nI need to do something similar and have been looking at solutions. From what I have read nothing straightforward, unless you can use apex inputfield in a visualforce page, as that respects picklist values for record type.\n\nOtherwise, its more lifting than it seems like it should be. This post by <PERSON> seems to be quite robust, and has links to some other approaches.\n\n_URL_0_\n\nWill likely be trying this myself soon. Hope it works for you!", "97" ], [ "Can you clarify your report type structure - is it cases w case teams or case teams w cases? If the former, have you tried a w or w out report type, ie cases w or w out case teams. On mobile now so hard to poke on it. If all else fails, a trigger to automatically add case owner to case team could get you there.", "442" ], [ "What i want to do should be easy to do via URL hack, but looking at legitimate ways of doing this. I want to create a child invoice line item from parent invoice and set the save url to the parent invoice.\n\nI had the thought of approaching it using URLFOR and $Action but can&#39;t even get it to set the parent id. Saw some old threads on success that indicated you could pass the field IDs as parameters but system won&#39;t allow for save, and this seems little different from URL hack. Can&#39;t find any docs on what url parameters, if any, are officially supported on $action.\n\nSo, then, what is the supported means of doing this? Do I have to replace the line item page w a vf page and use an extension to override the save behavior? Is there a simpler supported means of doing this?", "318" ], [ "@sfdcfox I tried that, but the lookup to invoice from the line item does not get populated. So I tried passing in the invoice id via parameters but no luck. Would not let me save if I used the URL hack style of fieldid+fieldid_lkid and couldn&#39;t figure out a way to get it to simply link the child to the parent. Fwiw it is a m-d relationship. I figured I wouldn&#39;t be able to populate custom fields, but didn&#39;t think setting the relationship would be an issue. I&#39;m using a list button on the invocie record, from the invoice line item related list.", "318" ], [ "change set is non destructive and can&#39;t cause data loss. Losing all the data in a field is really only.possible via a data load, or by changing the field type. You should not be able to deploy a change in field type via change set, you should have to make that change in production. Have you done any field type changes?", "564" ], [ "You don&#39;t have to write test classes! It&#39;s a good point. Pushing flows to their limits may point at moving to code, but you can do some pretty cool stuff relatively easily. But relying on anything that is built in flash makes me think twice. That said you can combine apex plugins w flows so that the logic is handled by apex but could prob just go all in at that point.", "585" ], [ "If you are a strong coder then I think that balance would be heavily tilted to code. One place I&#39;ve seen combined is where you want a flow w screens to do something in system mode, BC user doesn&#39;t have access to it. Also <PERSON> explores some use cases here. _URL_0_. I find flows easier primarily bc i am not a good coder.", "330" ], [ "Thanks @crmprogdev, getting back after a break. Agreed re: url hack. I&#39;m trying to go legit but going to visualforce just to set save url is a tough sell. This is a M-D relationship between invoice and invoice line item. I create the line item from a related list on invoice. I would want the user to return to the parent invoice when the child is saved, and for the relationship to the parent to populate normally as it would w/ the standard new button. Its possible using a publisher action, but until we can run those from buttons its not usable. I think the VF would be simple, but still :(", "318" ], [ "They are a separate object, so related list. The new button works fine, I just want the user taken back to the parent record on save. It&#39;s so easy w a URL hack that it&#39;s hard to justify even building a flow for it. I will repent later! It&#39;s not that I don&#39;t like the global action option, it just doesn&#39;t work.", "901" ], [ "In order to do this in a bulkified manner in flows, you need to use an assignment element in your loop to add each record to an sobject collection, and then use a single fast update element to update the sobject collection. Otherwise your transaction will fail when there are more than 100 records in your loop as you are running an update on each record. \n\nThere is a great free hands on training by mvp for using loops and fast elements on this page\n\n_URL_0_\n\nScroll down till you see the videos, and look for Build Advanced Flow with Loops and Fast Elements\n\nProcess builder is also a good option, as suggested by <PERSON>.", "510" ], [ "Just to be sure, record type should be a 15 digit ID, not 14. I trust you have the right length since its working for you.\n\nTo resolve the error, you need to make sure the user has access to the record type via profile or permission set, otherwise the user cannot create records w that record type, which would lead to the error you describe.", "789" ], [ "Sounds like you have a lookup to the user object w a filter for profile = X? Now you want, for one specific user only to be able to select their manager, who can have any profile? Can you just flag the manager as \" ;OK \" ; and then add logic to lookup filter as such? Can do this w field on managers user record. Custom perms or settings are tricky bc they evaluate for the running user so can&#39;t figure a way to do it that way.", "550" ], [ "Ahh, interesting. So for each user, you want to be able to specify N approvers, and then enable the user to be able to only.select one of them, correct? For this you need to code up a page that allows a user to select the approver, and use custom object to model the authorized approvers for each submitter. In the end you will still have a field on the record for \" ;approver \" ; but users will use an interface to select the approver. You could build this out using visual workflow, but visualforce may be better", "550" ], [ "Is desired behavior that if submitted date is filled workflow 1 should NOT fire and workflow 2 should? Does wf1 include a criteria that submitted date is blank? You are correct in how time based rules evaluate - they are put in the queue. When the date is in the past, then the rule fires within 15 mins or so. Not fully following the expected behavior and the error but will try to help!", "123" ], [ "With Spring15 the idea to allow last activity date to kick of workflows is marked as delivered, by process builder.\n\n_URL_0_\n\nI think you would need to use pb to launch a headless flow when last activity date is changed. Don&#39;t think it would be possible w pb by itself.\n\nThe flow could lookup the activity where due date == last activity date (somewhat tricky given how last activity date evaluates contacts, opps, etc, but feasible) and then write the values to account.\n\nThinking out loud, it may be easier actually to just use pb and flow on activity as you can easily lookup all activities with a given account id, sort by due date, and write the values from the most recent activity to the account.\n\nEither way there should be a declarative option using flow and pb.", "246" ], [ "I can give you an ugly hack of a declarative option. Another way to state what you are after is that the lookup from project to opp should be unique across all projects. No opp should be used more than once. Now you can&#39;t set a lookup as unique, but you could use an immediate field update to write the opp Id to a text field that is marked case sensitive and unique. \n\nNow this is ugly, because when you try and hit save on project 2, it will just blow up and say that it it can&#39;t save bc a field update failed to trigger. You can&#39;t do any of the nice things you can do w validation rules. But it should keep folks from attaching more than 1 project to an opp.\n\nA friendlier approach may be to use an autolaunched flow to send an email to the offending party if they connect a second opp. You could even give them a week to rectify and then auto delete.\n\nThe proper way to do what you are after given a lookup relationship would be to use a before insert trigger to do the validation, but since it&#39;s a managed object, not sure if you want to go there (it may be ok, I&#39;m not much of a coder, just not sure what the implications are). You could check w the folks at bracket labs I hear they are a friendly bunch :)\n\n**edit**\n@crops comment re using DLRS is definitely worth considering. It&#39;s a good tool, perhaps a lot of overhead for a single validation rule but lots of possible use cases for it might surface", "560" ], [ "Create a checkbox \" ;launch flow \" ;\n\nUse process builder to launch the flow when checkbox is checked.\n\nThis is now an auto launched flow, which will run in system mode.\n\nIt was hard to find this clearly stated re process builder, but its clear on the flow trigger pilot docs and I got confirmation on this from the PM when these launched.\n\nSee flow trigger docs at _URL_0_\n\n > Flows that are launched from workflow rules are run in system context, which means that user permissions, field-level security, and sharing rules aren’t taken into account during flow execution\n\nJust to be clear, setting your flow property to auto launched is not enough. It must be launched via process builder / flow trigger to run in system mode (i assume launching from apex also could run in system mode but haven&#39;t tried to do so)", "123" ], [ "Great question. I have a flow w an email address field that miraculously has not failed due to this yet.\n\nYou can use regex in input field validation on flows.\n\nSee _URL_0_\n\nWhere it has the regex formula as:\n\nREGEX({!Email_Address}, \" ;[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\\\.[a-zA-Z]{2,4} \" ;)\n\nI will take their word for it as I&#39;m lousy at regex.\n\nNote that unlike validation rules, flow input field validation will pass if it evaluates to true, and fail if evaluates to false.", "560" ], [ "*Edit - updated report name, and details below* \n\nThere is a standard report type for opportunity history (distinct from opportunity field history). \n\nThis report does not include stage duration, but does track the date of each stage change so you could calculate the duration.\n\nYou could run this report, export the value, and load via data loader.\n\nCan&#39;t find good documentation on this yet. Will keep looking and will update the post when I do, but if you search your report types it should be there.", "491" ], [ "If you will always have one and only one of each role, you can use process builder or flow to set a field on the contract record for each recipient role user or email, then fire standard workflow email alerts to the recipient.\n\nBetter would be to use flow to send the email. You can use a collection element to store a list of emails, and can send the email from flow or use an email alert from within the flow.\n\nSince the role info is on child object, there is no way to send via workflow on child when parent is edited.\n\nI suppose you could use process builder to update a date field on the child records, and then use an email alert from the child records. Haven&#39;t tried it but should work.", "190" ], [ "I read that most Pythons would go for smaller prey, around the size of a house cat, but that larger species enjoy crocodiles, deer and even a bit of antelope for dinner. But why?\r\n\r\nNow, I realise that evolution is ongoing, and that [even in the year infinity evolution can&#39;t be expected to result in any subjective measure of \" ;perfection \" ;](_URL_0_). But, even so, it seems odd to me that this behaviour could have survived the eons.\r\n\r\nPerhaps I&#39;m misunderstanding the animal&#39;s physiology and it&#39;s more mobile in this state than I expect, but isn&#39;t this animal utterly defenceless for the next couple of weeks while it digests its tasty snack? Couldn&#39;t something else now come along, rip open the snake, steal its crocodile then leave the snake for dead, all without encountering much in the way of effective resistance?\r\n\r\nOne possible answer I thought of was that other animals may not much like the taste of half-digested crocodile. Conceivably, one could stalk the snake waiting for it to start swallowing the croc, then grab it while the food is still relatively fresh. But I doubt any animal that&#39;s not already substantially stronger than the snake would feel too comfortable stalking it in the first place. Is that enough to explain why Pythons have gotten into the habit of apparently making themselves sitting ducks for protracted periods of time rather than simply eating less more often?", "234" ], [ "Edit-changing answer based on Sebastian&#39;s comment\n\nIf your role hierarchy is reasonably small, you could create a public group for each of the senior roles for a given junior role.\n\nThen, you would evaluate the users role, and have a separate workflow for each role that sends an email alert to the appropriate public group.\n\nThus wouldn&#39;t scale to a large complex hierarchy, in which case code is prob best way to go.", "190" ], [ "Thanks been reading abt inner classes, will try wrapper classes. The examples all seem to be a variation on iterating over a list of X, and I&#39;m having a hard time thinking through how it applies, but I&#39;ve got an inner class that at least will save, and am working on trying to get at it from the vf page. Can&#39;t quite get that working, it seems to be looking for getter method in the user standard controller, not my extension. Though the getter methods in the outer class can be called.", "689" ], [ "Is there a list or a way to determine what objects are available for triggers? \n\nI&#39;m looking at writing one on `PermissionSetAssignment`. I looked up the properties on workbench and didn&#39;t see anything that resembled `triggerable`, and Googling this was not fruitful. I suppose I could try writing one and see what happens, but that seems rather crude.\n\n![permissions set assignment properties in workbench][1]\n\n\n [1]: _URL_0_", "118" ], [ "it never crossed my mind that it would be possible to store the child Assignee Ids &#39;inside&#39; a PermissionSet sObject from a single query. This is very cool. I am trying to figure out how to access these child IDs when I retrieve a permissionSet &#39;ps&#39; from the map. i&#39;ve tried dot notation ps.Assignments.AssigneeId and a for loop (which seems wierd since its a single perm set) but neither is compiling - can you clue me in to how to get at these? Trying to add them to a set of IDs. Thanks", "901" ], [ "thanks <PERSON> I just used the same technique to pull in collaboration group members in the collaboration group query. I am slowly slashing and burning my way towards a solution, turning back when i get into nested for loops and i think w a few more attempts i will finally get a sense of proper use of maps!", "256" ], [ "the beagle has landed. this is most awesome. used a set to store the collaborationgroupmembers so it can handle multiple perm sets to a single group and vice versa. <PERSON> will take me a month to write the tests for this, but then i think it might be time to join the github. i know comments aren&#39;t for saying thanks, but thanks anyways! the updated version is at _URL_0_ it has more for loops than I would like but no queries inside of them so i think fundamentally ok.", "405" ], [ "I just installed [Daniel Hoechst&#39;s test factory][1] into my sandbox and am trying to use it to create test data for the following objects:\r\n\r\n - User\r\n - CollaborationGroup\r\n - PermissionSet\r\n\r\nI&#39;m getting the following error when creating users:\r\nSystem.SObjectException: Invalid field Name for User\r\n\r\nI tried adding a &#39;UserDefaults&#39; method to set username as follows, but that isnt helping either.\r\n\r\n**UserDefaults Method in TestFactory**\r\n\r\n public class UserDefaults implements FieldDefaults{\r\n public Map < String,Object > getFieldDefaults() {\r\n return new Map < String, Object > {\r\n &#39;Username&#39; = > &#39;test&#39;+system.now()+&#39;@ashoka.org&#39;,\r\n &#39;Email&#39;= > &#39;testemail&#39;+system.now()+&#39;@ashoka.org&#39;\r\n };\r\n }\r\n }\r\n\r\n\r\nNote that I updated the line in my test method that creates the users as follows:\r\n\r\n User[] userList = (User[])TestFactory.createSObjectList(new User(),10, &#39;TestFactory.UserDefaults&#39;, TRUE);\r\n\r\n\r\nAlso, would like clarification on if there is a way to ensure that each name field is incremented by a number when creating a list of records, or whether that is taken care of automatically. Say on a list of users, firstname1, firstname2, and so on.\r\n\r\nThanks! Getting the test factory figured out is going to make me much better at writing tests! \r\n \r\n\r\n [1]: _URL_0_", "103" ], [ "I use jitterbit for an operation that runs daily, and reads/writes to a custom setting to store/update the &#39;last run date/time&#39; so that i can use that value in my query filter in jitterbit, to filter only records modified since my last run date, and to avoid the non-selective query on large object error that would happen when you get near 100k records as ca_peterson indicates above. I dont see any reason you couldnt do that every 15 minutes. Can post more info / complete answer if helpful.", "510" ], [ "In this case, I&#39;ve got a set of assigneeIds from a permission set, and a set of chatter group members from a chatter group. If the cgmember memberID is not in the set of permission set assignee ids, then I need to do something. Something being add the chattergroupmember to a list of records to delete. So I&#39;m not checking if the record is already in the set I&#39;m adding to, but I&#39;m comparing the two and then taking action, on the negative scenario. Prob many better ways but that&#39;s what v2 is for!", "550" ], [ "Thanks @sfdcfox, if this were two sets of ids remove all would work BC the only cgmembers left would be ones that need to be deleted. But as I&#39;m comparing a _URL_0_ to a set of IDs in a for loop, I would need to instead create a set of ids to compare and then go through a for loop to populate a list of records to delete, right? Or can you do a delete operation on a set of IDs?", "721" ], [ "First, add a formula field to opportunities, that compares the running user&#39;s manager to the opp owner manager\r\n\r\nPseudocode: `manager_compare__c` > \r\n\r\n \r\n\r\n $_URL_0_ = _URL_1_`\r\n\r\nThen, add a filter to your report such that `manager_compare__c = true`. \r\n\r\nAll credit for this answer goes to <PERSON> who talked about the idea of using $User in formula fields for reports and list views circa df 2010 :)", "905" ], [ "1 and 2 are straightforward, using the normal functionality in a single approval process.\n\nOption 3 is very tricky, and is not possible with a single approval process. Upon rejection, you could update a \" ;status \" ; field to indicate rejected, and then use process builder to auto submit to a different approval process to handle each part of the scenario. I&#39;m still not sure you could get it exactly as described but it may well be possible.\n\nIn approvals, on rejection you only have the option of going back one step, or doing a full rejection. And It&#39;s not possible to skip a step on the way \" ;up \" ; and hit it on a reject, I have tried that. So basically you need to do a full reject and then auto submit to a new approval process to route it appropriately.", "858" ], [ "@adam sure you can! The button that launches the flow can simply write the record id to a custom object. Then you use an auto launched flow from the custom object to do your dirty work. The user just needs create on the custom object. Many variations on this, such as a publisher action, or an inline visualforce section on the record detail page, but should be very feasible.", "905" ], [ "I&#39;ve got a simple visualforce page and I would like to include the ability for user to post to chatter on it via the chatter:feed component.\r\n\r\nWhen I include the chatter:feed tag with no attributes, the feed takes over the page. I cant find a way to limit the length or verbosity of the feed.\r\n\r\nBased on the documentation, it looks like I should be able to filter by feeditemtype and I believe that should limit the number or records.\r\n\r\nThe [vf dev documentation][1] says:\r\n\r\n > The feed item type on which the Entity or UserProfileFeed is filtered.\r\n > See FeedItem in the Object Reference for Salesforce and _URL_0_\r\n > (under Type) for accepted values.\r\n\r\nThe [FeedItem object reference][2] has a large number of options for type, but this one looked right:\r\n\r\n > TextPost—a direct text entry on a feed.\r\n\r\nSo putting this together, i tried adding a parameter to chatter:feed for feeditemtype = \" ;TextPost \" ; but **then I get nothing - no publisher or feed displayed on page at all.**\r\n\r\nEdit: I also tried including the showpublisher = true, with feeditemtype = textpost, but that ended up w/ no publisher/feed at all.\r\n\r\nI suppose I could set entity ID to be an activity or some record w no feed, but would like to figure out why this is not working as it appears like it should.\r\n\r\ncode snippet- vf page with no filter displays publisher. if feedItemType= \" ;TextPost \" ; is added - no publisher is displayed at all.\r\n\r\n < apex:outputPanel > \r\n < p > Exercise 6 - Request Full Profile < /p > \r\n < apex:outputPanel rendered= \" ;TRUE \" ; > REQUEST UPDATE BELOW\r\n < chatter:feed Entityid= \" ;{!_URL_2_} \" ; showPublisher= \" ;TRUE \" ;/ > \r\n < /apex:outputPanel > \r\n\r\noutput (goes on well beyond the end of the screenshot)\r\n\r\n[![visualforce page w chatter feed][3]][3]\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_3_\r\n [3]: _URL_4_", "343" ], [ "If the length of time to wait is constant, all you need is a single workflow rule and a time trigger.\n\nWorkflow rule criteria: checkbox = false.\nImmediate actions: none\nTime trigger: N hours/days\nAction: email alert to send email\n\nIf the checkbox is set to true before the allotted time has passed, the rule will no longer meet the criteria and so nothing will happen.\n\nIf checkbox remains false, then at the time set by the time trigger, the email alert will fire.\n\nIf the length of time to wait is dynamic, you need a second field to capture \" ;evaluation time \" ;\n\nYou still only need one rule, as you can set your time trigger to evaluate the evaluation time field.\n\nIf the checkbox is checked, the record won&#39;t meet the criteria, and the trigger will be removed from the queue.", "246" ], [ "I tested this in a dev org and this should work properly with a normal roll-up summary field and a field update.\r\n\r\nThis is supported by the [order of execution][1] - as the action of creating the **child record** triggers the save behavior on the **parent record** *when the roll-up is recalculated on the parent.*\r\n\r\nItem 16 on order of execution states:\r\n\r\n > If the record contains a roll-up summary field or is part of a\r\n > cross-object workflow, performs calculations and **updates the roll-up\r\n > summary field in the parent record. Parent record goes through save\r\n > procedure.**\r\n\r\nSo when you create a child record, the save on the child record triggers the roll-up summary field on the parent to recalculate, and the parent goes through the save behavior - which includes evaluation of workflow rules.\r\n\r\nI tested a simple scenario in a dev org.\r\n\r\nCreate a roll-up summary field &#39;opp_count__c&#39; on account that counts all opps.\r\n\r\nCreate a workflow rule on account that fires when &#39;opp count&#39; = 2.\r\n\r\nAdd a field update that updates a text field, with the value of TEXT(opp_Count__c).\r\n\r\nCreate one opp. Nothing happens.\r\n\r\nCreate a second opp. The text field is updated.\r\n\r\n[![account after adding second child opp][2]][2]\r\n\r\nUnless I am not understanding the question, this should be the standard behavior of roll-up summary fields - you can trigger workflows on the parent record based on a roll-up summary field value.\r\n\r\nReading again, it seems like you may want to set the value of a field based on the value of a rollup summary field, but then want to user to be able to edit it. That just requires you to set your workflow criteria appropriately, so it will fire when it should and then will not overwrite user changes. How to do so will depend on your use case but should be feasible. Please elaborate more and I can get into more details.\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "510" ], [ "I would first look at using a role based rule (if it makes sense for the 3 to be in a single role and nobody else is in that role). That often is not the case, in which case I would use a public group, as you can use a standard owner-based rule to share from the group members to the group members read/write.\r\n\r\nWhy? Because you are more limited in the number of criteria-based rules you can write per object, and to identify a specific user to share from, you need to use a criteria based rule on owner ID. You can share from/to public groups using a standard ownership based rule.\r\n\r\nI think this is easier to read/maintain. Even though there still is no description field on public groups, which would be tremendously helpful, if you use a good naming convention on your public groups, then its reasonably feasible to track down who has access to what. \r\n\r\nExhibit A: public group based rule\r\n[![public group based rule][1]][1]\r\n\r\nIf you use a criteria-based rule, you only have the UserID to try and work with, which for the average non-cyborg human, is typically more challenging. \r\n\r\nExhibit B: criteria based rule on owner\r\n[![owner based rule][2]][2]\r\n \r\nAs you can see from the pics above, we have rules based on owner, but that was from before my time. I think using roles / groups is the way to go for this type of need.\r\n\r\nHere is a [good link][3] to a blog post reviewing this type of sharing (from before crtieria based rules even existed). I dont know believe there are any speed / efficiency considerations here, i think that would work out the same, unless you had a large number of records shared from a single user, which is not recommended in the [large data volumes][4] implementation guide.\r\n\r\n > Avoiding sharing computations\tAvoid having any user own more than\r\n > 10,000 records.\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_\r\n [3]: _URL_3_\r\n [4]: _URL_2_", "550" ], [ "I&#39;ve run into an issue comparing sets of records to insert vs sets of records that already exist as the set of existing records contains a record ID and therefore the `removeAll` method doesnt see a match\r\n\r\nI&#39;ve got these two sets in my code, both of which only have one element in my test. The elements have the same values, except the existing record has an Id.\r\n\r\n`cgmembers:` a set of all existing collaborationgroupmember records\r\n\r\n {CollaborationGroupMember:{CollaborationGroupId=0F9L00000005hpDKAQ, Id=0FBL0000000gDtWOAU, MemberId=00540000001CkxPAAS}}\r\n\r\n`cgUsersToInsertSet:` set of records I want to insert. This set also has one element (without an Id, as they are not inserted yet)\r\n\r\n {CollaborationGroupMember:{MemberId=00540000001CkxPAAS, CollaborationGroupId=0F9L00000005hpDKAQ}}\r\n\r\nI need to remove the existing collaborationGroupMembers from the set of records to insert before inserting them, else I get a duplicate record error. Using two sets and RemoveAll seemed like a good approach...until it didnt work.\r\n\r\nSo how can I do this efficiently?\r\n\r\nIs there a way to populate the set of existing records without the ID field? \r\nOr if not whats the most efficient way to do the comparison?\r\n\r\nBelow is a snippet of the code that shows how I&#39;m populating the cgmembers set (the existing collaborationGroupMembers, which has the ID field)\r\n\r\n \r\n\r\n Map < String, CollaborationGroup > chatterGroups = new Map < String, CollaborationGroup > ();\r\n FOR (CollaborationGroup chatterGroup : \r\n [SELECT Name, (SELECT CollaborationGroupId, MemberId FROM GroupMembers) FROM CollaborationGroup WHERE Name IN :chatterGroupNames]) \r\n chatterGroups.put(_URL_0_, chatterGroup);\r\n \r\n \r\n FOR (PermissionSet_Map__c psmap : psmaps){\r\n \r\n string cg = psmap.collaborationgroup__c;\r\n \r\n //cgx = current chatter group in loop\r\n CollaborationGroup cgx = ChatterGroups.get(cg);\r\n \r\n cgmembers.addAll(cgx.GroupMembers)\r\n\r\n\r\n\r\nThank you!\r\n\r\n**EDIT - using a FOR loop to create sObject without ID field**\r\n\r\nso far the best I&#39;ve been able to do is to use a FOR loop to create a collaborationGroupMember sObject without the ID field. Seems redundant, hopefully there is a better way. \r\n\r\n set < collaborationGroupMember > cgmembersNoId = new set < collaborationGroupMember > ();\r\n FOR (collaborationGroupMember cgm : cgmembers){\r\n collaborationGroupMember cgmx = new collaborationGroupMember();\r\n cgmx.MemberId = cgm.MemberId;\r\n cgmx.CollaborationGroupId = cgm.CollaborationGroupId;\r\n cgMembersNoId.add(cgmx);\r\n }", "256" ], [ "The best solution I&#39;ve found is to run the list of `collaborationgroupmembers` through a FOR loop to create a new list that does not contain the Id field, and use that in the removeAll method.\r\n\r\n set < collaborationGroupMember > cgmembersNoId = new set < collaborationGroupMember > ();\r\n FOR (collaborationGroupMember cgm : cgmembers){\r\n collaborationGroupMember cgmx = new collaborationGroupMember();\r\n cgmx.MemberId = cgm.MemberId;\r\n cgmx.CollaborationGroupId = cgm.CollaborationGroupId;\r\n cgMembersNoId.add(cgmx);\r\n }", "678" ], [ "**Background:** I&#39;ve been working on a dynamic contact search page modeled on [<PERSON> 2010 post][1].\r\n\r\nIt works, and now I am exploring ways to add pagination and the ability to select records and take actions.\r\n\r\nWas reading &#39;[visualforce in practice][2]&#39; and on p62 they demonstrate how to use a `standardSetController` inside a custom controller to provide pagination and other functionality.\r\n\r\n**Question** Started fresh using the `standardSetController`, and Pagination is working well, but I have not been able to figure out how to pass a selected list of records back to the controller so that I could add the selected records to a campaign. \r\n\r\nI&#39;ve basically copied the code from the book and just switched it up to work on contacts and added an `apex:inputcheckbox` field. It seems like the standard set controller methods getSelected / setSelected methods would allow me to do this, but I cant pass selected records back to the controller successfully. \r\n\r\nI&#39;ve seen some examples of using a wrapper class for this type of functionality, but want to confirm that its not possible to use the `standardSetController` methods before heading down that road.\r\n\r\n**Visualforce Page**\r\n\r\n < apex:page controller= \" ;CustomSearchListController \" ; > \r\n < apex:form > \r\n \t < apex:pageBlock > \r\n \t < apex:pageBlockTable value= \" ;{!ssc.Records} \" ; var= \" ;c \" ; rows= \" ;25 \" ; > \r\n < apex:column > < apex:inputCheckbox value= \" ;{!ssc.Selected} \" ;/ > \r\n < /apex:column > \r\n < apex:column value= \" ;{!c[&#39;firstname&#39;]} \" ;/ > \r\n < apex:column value= \" ;{!c[&#39;lastname&#39;]} \" ;/ > \r\n < /apex:pageBlockTable > \r\n \t < apex:panelGrid columns= \" ;3 \" ; > \r\n < apex:commandLink action= \" ;{!ssc.Previous} \" ; value= \" ;previous page \" ; rendered= \" ;{!ssc.HasPrevious} \" ;/ > \r\n < apex:commandLink action= \" ;{!ssc.Next} \" ; value= \" ;Next Page \" ; rendered= \" ;{!ssc.HasNext} \" ;/ > \r\n < apex:commandButton action= \" ;{!addToCampaign} \" ; value= \" ;Add to campaign \" ;/ > \r\n < /apex:panelGrid > \r\n < /apex:pageBlock > \r\n < /apex:form > \r\n < /apex:page > \r\n\r\n**Controller**\r\n\r\n public with sharing class CustomSearchListController {\r\n \r\n public ApexPages.StandardSetController ssc {get; private set;}\r\n \r\n // init the controller and display some sample data when the page loads\r\n public CustomSearchListController() {\r\n ssc = new ApexPages.StandardSetController([SELECT firstname, lastname, _URL_4_, Fellows_Status__c,id, _URL_2_ from contact LIMIT 1000]);\r\n }\r\n \r\n public list < contact > selContacts {get;set;}\r\n \r\n public pageReference addToCampaign(){\r\n system.debug(&#39;button clicked&#39;);\r\n list < campaignMember > cml = new list < campaignmember > ();\r\n campaignmember cm = new campaignMember();\r\n selContacts = ssc.getSelected();\r\n system.debug(&#39;ssc&#39; + ssc.getSelected());\r\n system.debug(&#39;selcontacts&#39; + selContacts);\r\n FOR(contact c: selContacts){\r\n cm.ContactId = _URL_0_;\r\n cm.CampaignId = &#39;70140000000XZt6AAG&#39; ; //hard coding campaignID for testing purposes\r\n cml.add(cm);\r\n }\r\n insert cml;\r\n return null;\r\n }\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_3_", "747" ] ]
205
[ 7288, 11802, 11478, 7016, 10200, 14815, 4638, 4430, 1735, 8699, 7363, 7360, 1888, 11672, 9560, 5481, 6629, 8348, 9069, 1172, 17929, 18217, 6662, 11218, 17152, 5505, 188, 5876, 14330, 13931, 5929, 7377, 1631, 15688, 9168, 10494, 3641, 12346, 6628, 771, 17135, 549, 14778, 45, 16774, 12722, 16465, 19587, 1694, 17878, 4635, 18802, 13566, 7313, 15479, 10438, 11023, 15561, 6909, 5527, 8543, 6132, 9676, 1309, 433, 5973, 8728, 10411, 7538, 8352, 7933, 647, 7714, 13082, 3603, 848, 19643, 16490, 13086, 11310, 4633, 17488, 7134, 4374, 14782, 7514, 624, 14100, 10717, 7465, 3987, 757, 12517, 4571, 9009, 7284, 3784, 7023, 10510, 1683, 8133, 11837, 16998, 5983, 18307, 4753, 16320, 4678, 4780, 13815, 599, 9084, 13044, 16985, 16628, 7444, 9519, 13556, 14868, 12500, 18680, 2831, 10394, 1862, 12755, 17839, 3616, 464, 5877, 11108, 16993, 7152, 1395, 4307, 4146, 9583, 7064, 3516, 3605, 7490, 12438, 11216, 7100, 10459, 6097, 10509, 3238, 14688, 15576, 19121, 4620, 5419, 9998, 3932, 6819, 9156, 762, 4413, 728, 16915, 7872, 18903, 4419, 19725, 13120, 11883, 3622, 15609, 1076, 13211, 4313, 3490, 16965, 4228, 5422, 7706, 17594, 6122, 11543, 9859, 843, 4563, 11999, 5959, 17073, 3981, 10101, 6958, 9793, 13928, 19705, 4376, 13639, 5751, 13524, 12404, 7019, 4021, 11472, 368, 7028, 11749, 19324, 12982, 16159, 19656, 4382, 9510, 15481, 11701, 6456, 18416, 152, 1284, 11636, 9245, 12889, 7137, 13803, 11400, 6824, 18001, 6649, 15606, 2954, 5653, 17633, 1100, 12769, 7821, 6078, 9577, 13133, 12335, 9978, 2181, 14845, 5342, 8652, 18048, 15484, 9543, 5912, 15754, 7040, 13216, 4448, 10662, 10753, 7256, 15586, 15244, 4569, 6926, 363, 18116, 19362, 6792, 11038, 15793, 12601, 12289, 9192, 6966, 3844, 19414, 15470, 2699, 14375, 12501, 15650, 6442, 9567, 5880, 17968, 3635, 7092, 16458, 11732, 8048, 19621, 1732, 4299, 3027, 18295, 6336, 10877, 12936, 12822, 19063, 12248, 9179, 19664, 17374, 9376, 12564, 11774, 12298, 16587, 9340, 6867, 13062, 3130, 8774, 8014, 13852, 11179, 15068, 10205, 1540, 1422, 10457, 1712, 7180, 14143, 9712, 5974, 8177, 18824, 15247, 11953, 16364, 8716, 16136, 6468, 17061, 3951, 19680, 12225, 7412, 16928, 4673, 15327, 11177, 11854, 1818, 17030, 14908, 4867, 18820, 18450, 17186, 168, 18988, 6483, 110, 13140, 10042, 17183, 2310, 11122, 8762, 15529, 1849, 12191, 15228, 17147, 14822, 6652, 5971, 19277, 17772, 9232, 18711, 11885, 6907, 7042, 11429, 17322, 9433, 19762, 8932, 6332, 5593, 8208, 10033, 211, 2412, 13868, 11605, 3915, 7571, 6387, 3325, 13590, 8974, 11521, 13275, 15922, 17909, 1195, 11534, 14962, 4724, 15917, 6618, 13472, 9840, 5440, 4186, 1240, 6010, 15640, 6396, 8648, 14695, 17584, 2348, 11119, 6525, 4459, 6632, 7765, 10597, 258, 6412, 7921, 16530, 18088, 4346, 19415, 468, 16382, 11229, 11228, 16567, 7547, 3385, 3745, 11716, 2928, 9062, 944, 17913, 1470, 11376, 1990, 5815, 6923, 14606, 5200, 3794, 7655, 17799, 1617, 2478, 6981, 17591, 12569, 9288, 15919, 10987, 16171, 11967, 9375, 4567, 1468, 18968, 5703, 9538, 5688, 7208, 9171, 2644, 18679, 17567, 14144, 732, 5742, 17413, 7885, 6693, 2886, 11789, 9023, 8584, 13725, 10721, 15940, 19304, 10730, 10465, 6975, 16454, 2978, 5448, 12222, 17250, 12193, 5865, 15445, 7548, 9447, 12481, 14502, 540, 18152, 2869, 8166 ]
STX_10063.0
[ [ "While not exactly what you need but...\r\n\r\nYou can try `comment-box` command together with `C-u 20` prefix (or whatever number you want):\r\n\r\n[![enter image description here][1]][1]\r\n\r\nYou can also write your own function to do it (just grab the sources of the comment-box and try to adjust it to remove 1st and last comment lines + add padding you need).\r\n\r\n...\r\n\r\n...\r\n\r\n...\r\n\r\nNow, I had a look into the source code and here we are (not bullet-proof but):\r\n\r\n[![enter image description here][2]][2]\r\n\r\n\r\nThe function to use:\r\n\r\n (defun comment-fill-aligned (arg)\r\n \" ;Comment out the current line using fill-column to pad and align with comment chars.\r\n \r\n For the fill-column set to 80 it should look like:\r\n \r\n elisp:\r\n ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; hello ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\r\n \r\n c:\r\n /************************************* hello *************************************/\r\n \" ;\r\n (interactive \" ;p \" ;)\r\n (comment-normalize-vars)\r\n (let* ((comment-style &#39;aligned)\r\n (beg (line-beginning-position))\r\n (end (line-end-position))\r\n (com-add (/ (- fill-column (- end beg)) 2)))\r\n (comment-region beg end (+ comment-add com-add))))\r\n\r\n\r\nSo eval the function and call it interactively with `M-x comment-fill-aligned`. It works for the current line.\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "631" ], [ "I&#39;ve written the below class, called from a Trigger, which reassigns attachments from an inbound Case to an Opportunity identified via an external key. It&#39;s all working as expected, passes tests etc, so that&#39;s great. \r\n\r\n public static void QuotePDFCloning (List < Attachment > atts) { \r\n \r\n Set < String > CaseIds = new Set < String > ();\r\n for(Attachment file : atts) {\r\n\r\n // only collect those that are for the Case object (others can be ignored)\r\n if(file.ParentId.getSObjectType() == Case.getSObjectType()) {\r\n CaseIds.add(file.ParentId);\r\n }\r\n }\r\n\r\n if(!CaseIds.isEmpty()) {\r\n\t\t\r\n Set < String > OppIds = new Set < String > ();\r\n // find the Opportunity to which the Case relates\r\n Case op = [Select Id, PDF_Quote_Number__c from Case where Id in :CaseIds];{\r\n if(op.PDF_Quote_Number__c!=null){\r\n OppIds.add(op.PDF_Quote_Number__c);\r\n }}\r\n if(!OppIds.isEmpty()){\r\n \r\n Set < String > OppId = new Set < String > ();\r\n // find the Opportunity to which the Case relates\r\n Opportunity opp = [Select Id From Opportunity Where Quote_Reference_Number__c in :OppIds];{\r\n OppId.add(_URL_0_);\r\n }\r\n if(!OppId.isEmpty()){ \r\n \r\n List < Attachment > attachments = new List < Attachment > ();\r\n\r\n for(Attachment file : atts) {\r\n Attachment newFile = file.clone();\r\n newFile.ParentId = _URL_0_;\r\n attachments.add(newFile);\r\n \t\t}\r\n // finally, insert the cloned attachments\r\n insert attachments;\r\n \t\t}\r\n \t}\r\n \t}\r\n\t}\r\n\r\nWhat I now need to account for is that the timing of the case arriving with the attachment to be cloned; it may arrive before the opportunity exists. What I&#39;d like is where we have the **if(!OppIds.isEmpty()){** condition, can I set the ELSE so that it runs the code again in 15 minutes? By this time, the Opportunity should exist and it will run as expected.\r\n\r\nI&#39;m thinking store the logic in another class with `@future` or `@invocable`? I&#39;m straying into complexities I&#39;ve not dealt with before, so would appreciate some advice.", "310" ], [ "Let $f(x,y)$ be a function $X\\times Y\\rightarrow\\mathbb R$, where $X\\subset \\mathbb R^n$ and $Y\\subset \\mathbb R^m$, and $x\\in X,y\\in Y$.\r\n\r\nSuppose that $f(x,y)$ is convex in $x$ for any fixed $y$, and convex in $y$ for any fixed $x$. Does it follow that $f$ is convex?\r\n\r\nI have the feeling that it does not. But I cannot find a simple counterexample.\r\n\r\nThe assumptions of the question imply that:\r\n\r\n$$f\\left(\\lambda x_{1}+\\left(1-\\lambda\\right)x_{2},y\\right)\\le\\lambda f\\left(x_{1},y\\right)+\\left(1-\\lambda\\right)f\\left(x_{2},y\\right)$$\r\n\r\n$$f\\left(x,\\lambda y_{1}+\\left(1-\\lambda\\right)y_{2}\\right)\\le\\lambda f\\left(x,y_{1}\\right)+\\left(1-\\lambda\\right)f\\left(x,y_{2}\\right)$$\r\n\r\nfor any $0\\le\\lambda\\le1$.\r\n\r\nOn the other hand, if $f(x,y)$ is convex, the following (stronger) inequality must hold:\r\n\r\n$$f\\left(\\lambda x_{1}+\\left(1-\\lambda\\right)x_{2},\\lambda y_{1}+\\left(1-\\lambda\\right)y_{2}\\right)\\le\\lambda f\\left(x_{1},y_{1}\\right)+\\left(1-\\lambda\\right)f\\left(x_{2},y_{2}\\right)$$\r\n\r\nI tried to derive this inequality, without success:\r\n\r\n$$\\begin{aligned}\r\nf\\left(\\lambda x_{1}+\\left(1-\\lambda\\right)x_{2},\\lambda y_{1}+\\left(1-\\lambda\\right)y_{2}\\right) & \\le\\lambda f\\left(\\lambda x_{1}+\\left(1-\\lambda\\right)x_{2},y_{1}\\right)\\\\\r\n & \\qquad+\\left(1-\\lambda\\right)f\\left(\\lambda x_{1}+\\left(1-\\lambda\\right)x_{2},y_{2}\\right)\\\\\r\n & \\le\\lambda\\left(\\lambda f\\left(x_{1},y_{1}\\right)+\\left(1-\\lambda\\right)f\\left(x_{2},y_{1}\\right)\\right)\\\\\r\n & \\qquad+\\left(1-\\lambda\\right)\\left(\\lambda f\\left(x_{1},y_{2}\\right)+\\left(1-\\lambda\\right)f\\left(x_{2},y_{2}\\right)\\right)\\\\\r\n & =\\lambda^{2}f\\left(x_{1},y_{1}\\right)+\\left(1-\\lambda\\right)^{2}f\\left(x_{2},y_{2}\\right)\\\\\r\n & \\qquad+\\lambda\\left(1-\\lambda\\right)f\\left(x_{2},y_{1}\\right)+\\left(1-\\lambda\\right)\\lambda f\\left(x_{1},y_{2}\\right)\r\n\\end{aligned}$$", "236" ], [ "Let $N_i,M_i$ be a finite set of positive integers, $0\\le p_i\\le1$ real numbers, and $n$ another positive integer. Consider the sum: \r\n\r\n$$\\sum_{\\sum_{i}n_{i}=n}\\prod_{i}\\binom{N_{i}}{n_{i}}n_{i}^{M_i}p_{i}^{n_{i}}\\left(1-p_{i}\\right)^{N_{i}-n_{i}}$$\r\n\r\nwhere the sum on $n_i$ goes over all non-negative integers $n_i$ with constant sum $\\sum_i n_i = n$.\r\n\r\nCan it be simplified somehow? I have no reason to expect it can, this is not a textbook exercise. I&#39;m just wondering if it can be tamed, since it has a similar appearance to sums commonly occurring in combinatorics.", "757" ], [ "Let $N_1,\\dots,N_K$ and $M_1,\\dots,M_K$ be given non-negative integers, $x_1,\\dots,x_K$ positive real numbers. Does the following sum admit some analytical simplification?\r\n\r\n$$\\sum_{\\{n_i\\}}^* \\prod_{i=1}^K n_i^{M_i} \\binom{N_i}{n_i} x_i^{n_i}$$\r\n\r\nwhere the sum over $n_i$ goes from $n_i=0$ to $n_i=N_i$, the asterisk on the sum indicates that the $n_i$ are restricted to satisfy $\\sum_i n_i = T$, where $T$ is a given positive integer.\r\n\r\nI&#39;d be content with an approximation, like replacing the sum with an integral, since the $N_i$ are typically large.", "757" ], [ "I have a square matrix $M\\in\\mathbb R^{m\\times m}$ of the form:\r\n\r\n$$M=X^\\mathrm{T} (Q+D)X$$\r\n\r\nwhere $X\\in\\mathbb R^{n\\times m}$, $Q,D\\in\\mathbb R^{n\\times n}$. I want to invert $M$, and I know that $Q$ is symmetric and of very low rank, $D$ is diagonal, and the integers $m,n$ are such that $n > m \\gg 1$. Also, $Q$ is positive semi-definite, and $D$ is positive (therefore $Q+D$ is positive definite).\r\n\r\nTo get some intuition here, $M$ is the Hessian after a change of variables, and $Q+D$ is the Hessian before the change of variables. I am working with a Gaussian distribution so the inverse of $M$ gives me certain covariances that I need.\r\n\r\n$n,m$ are very large, on the order of $10^5$. This means that even storing $M$ in memory is very hard (I get an error if I try to store it in my laptop).\r\n\r\nUnder these conditions is there a way to find $M^{-1}$ efficiently?\r\n\r\nIn fact, I don&#39;t need all the entries of $M^{-1}$ right away. Ideally I would store some intermediate matrices (like a factorization) that would allow me to get arbitrary elements of $M^{-1}$ on demand and fast.\r\n\r\nWhat I **really need** is to compute certain specific elements of $M^{-1}$. If there is an algorithm that makes this doable it would be fine.", "493" ], [ "Can the [Laplace (saddle-point) approximation](_URL_0_) be applied to integrals of the form:\r\n\r\n$$\\int_0^1 \\mathrm e^{M f(\\mathbf x)} \\mathrm \\delta\\left(\\sum_i x_i - 1\\right) d\\mathbf x$$\r\n\r\nwhere $M$ is a large real number.\r\n\r\nAssume that the function $f(\\mathbf x)$ is sufficiently smooth and has a non-degenerate maximum inside the simplex $0\\le x_i \\le 1, \\sum_i x_i = 1$. Note however that the gradient $\\nabla f$ at this constrained maximum need not be zero, it is only perpendicular to the simplex.\r\n\r\nHow can I proceed here? Thanks.\r\n\r\n**Note:** A restricted version (and probably simpler) occurs when $f(\\mathbf x) = \\sum_i f_i(x_i)$, so the exponential part of the integrand factorizes. I am considering this variant in a separate question, _URL_1_.", "949" ], [ "I need to obtain an approximation to an integral of the form:\r\n\r\n$$I = \\int_0^1 \\mathrm e^{M \\sum_i f_i(x_i)} \\mathrm \\delta\\left(\\sum_i x_i - 1\\right) d\\mathbf x$$\r\n\r\nwhere $M$ is a large real number. Here the functions $f_1(x_1), f_2(x_2), \\dots, f_N(x_N)$ are $N$ real functions, sufficiently smooth.\r\n\r\nI suspect I can apply a variant of the [Laplace method](_URL_0_), but I am not sure how to proceed due to the presence of the Dirac delta. Any suggestions appreciated. Thanks.\r\n\r\n**Note:** See _URL_1_ for a more general version of this problem, where the integrand is not factorized.", "327" ], [ "While I can&#39;t tell you anything about skeletons, you can try the following:\r\n\r\n (define-key org-mode-map (kbd \" ;$ \" ;)\r\n (lambda ()\r\n (interactive)\r\n (if (org-in-block-p &#39;( \" ;SRC \" ; \" ;EXAMPLE \" ;))\r\n (self-insert-command 1)\r\n (self-insert-command 2)\r\n (backward-char))))\r\n\r\nThe binding works only for `org-mode` and inserts `$$` if the cursor is not in `BEGIN_SRC` or `BEGIN_EXAMPLE` blocks. Otherwise it inserts only one `$`.\r\n\r\nYou can adjust block names you want to avoid double `$` to be inserted -- I know not that much about block names in org but I believe you can figure it out.\r\n\r\nPS\r\nShort demo: _URL_0_", "722" ], [ "Ok, simplest option, i.e. no code, is a Process on each child object, fired when created or updated, Opportunity__c (lookup or master) is not null, update related object (Opportunity__c > > Custom_Last_Modified__c.\r\n\r\nThis would update the field on Opportunity each time one of the records is updated.\r\n\r\nOther option is an Apex helper class and a trigger on each object to call the class, passing in the sObject variables.\r\n\r\nI&#39;d go for option 1 for a future perspective.", "145" ], [ "The Gram determinant of the vectors $\\mathbf x_1,\\mathbf x_2,\\dots,\\mathbf x_k \\in \\mathbb R^n$ is defined as:\r\n\r\n$$\\Gamma (\\mathbf{x}_1, \\ldots ., \\mathbf{x}_k) = \\left|\\begin{array}{ccc}\r\n \\mathbf{x}_1^{\\top} \\mathbf{x}_1 & \\cdots & \\mathbf{x}_1^{\\top}\r\n \\mathbf{x}_k\\\\\r\n \\vdots & \\ddots & \\vdots\\\\\r\n \\mathbf{x}_k^{\\top} \\mathbf{x}_1 & \\cdots & \\mathbf{x}_k^{\\top} \\mathbf{x}_k\r\n\\end{array}\\right| = \\det (\\mathbf{X}^{\\top} \\mathbf{X})\r\n\\qquad\\qquad (1)$$\r\n\r\nwhere $\\mathbf{X}$ is the $n \\times k$ rectangular matrix with columns\r\n$\\mathbf{x}_1, \\ldots, \\mathbf{x}_k$. It gives the \" ;sub-dimensional \" ; squared volume of the parallelepiped spanned by these vectors.\r\n\r\nIf I apply a linear transformation $\\mathbf A\\in\\mathbb{R}^{n\\times n}$ on the vectors $\\mathbf x_i$, the volume changes to \r\n\r\n$$\\Gamma (\\mathbf{A}\\mathbf{x}_1, \\ldots, \\mathbf{A}\\mathbf{x}_k) = \\det\r\n(\\mathbf{X}^{\\top} \\mathbf{A}^{\\top} \\mathbf{A}\\mathbf{X})\r\n\\qquad\\qquad (2)$$\r\n\r\nalthough I see no obvious way to simplify this. I&#39;d expect the volume to change in a simple manner after a linear transformation, like a constant volume dilation, but \r\n\r\n$$\\Gamma (\\mathbf{A}\\mathbf{x}_1, \\ldots ., \\mathbf{A}\\mathbf{x}_k) \\ne [\\det (\\mathbf{A})]^2 \\Gamma(\\mathbf{x}_1, \\ldots, \\mathbf{x}_k)$$ \r\n\r\nin general (unless $k=n$ or $\\mathbf B$ is proportional to the identity matrix).\r\n\r\nI could apply a $k\\times k$ matrix $\\mathbf B$ \" ;on the right \" ; and use the identity,\r\n\r\n$$\\det (\\mathbf{B}^{\\top} \\mathbf{X}^{\\top} \\mathbf{X}\\mathbf{B}) = \\det\r\n(\\mathbf{X}^{\\top} \\mathbf{X}) [\\det (\\mathbf{B})]^2\r\n\\qquad\\qquad (3)$$\r\n\r\n*i.e.*, a volume dilation. But of course this is not the same as (2) above. Here the matrix $\\mathbf B$ is acting on the rows of $\\mathbf X$ and the geometrical meaning of this operation is not obvious to me.\r\n\r\nWhy my intuition is fails here? Why a linear transformation does not result in a constant volume dilation of sub-dimensional volumes? And what is the geometrical meaning of (3)?\r\n\r\nI am looking for answers to these questions that offer some intuition, and particularly geometrical insight.", "450" ], [ "Is there a way to simplify $\\det(D + C)$, where $D,C$ are square matrices of matching dimensions, $D$ is diagonal (with different diagonal elements, $D_{ij} = \\delta_{ij}d_i$), and $C$ is a constant matrix, that is, all entries $C_{ij}=c$ are equal to the same number?\r\n\r\nTo be more explicit, assuming $D,C\\in\\mathbb{R}^{n\\times n}$, the matrix $D+C$ has the form:\r\n\r\n$$D + C = \\left(\\begin{array}{ccccc}\r\n d_1 + c & c & c & \\cdots & c\\\\\r\n c & d_2 + c & c & \\cdots & c\\\\\r\n c & c & d_3 + c & \\cdots & c\\\\\r\n \\vdots & \\vdots & \\vdots & & \\vdots\\\\\r\n c & c & c & \\cdots & d_n + c\r\n\\end{array}\\right)$$", "493" ], [ "If you have 1 window in a frame the only way is shrink frame itself.\r\n\r\nIf you have many windows it could be impossible to ensure height of the particular window due to minimal height restriction.\r\n\r\nSo what is the usecase? Whenever you split vertically to have one of the window N lines if possible? Then use `(split-window-vertically 10)`, it will create 2 windows, the top one with 10 rows, the bottom one with the rest.", "990" ], [ "TV Tropes says that the [Naruto universe][1] lives in Schizo Tech.\r\n\r\n > The universe essentially mixes feudal society with modern technology (and clothing). The only exceptions are things like cars and guns. The only fields of technology which are outdated are transportation and military. \r\n\r\n It also goes on to explain that [**Schizo Tech**][2] is\r\n\r\n > The setting and timeline may seem at first to be The Middle Ages, The Colonial Period, or some Fantasy Counterpart Culture thereof, but when you look closer, you find polyester, robots, or other high-tech toys in between the horse-drawn wagons and wattle-and-daub buildings. There&#39;s generally no rhyme or reason for which technologies are anachronistically present besides the Rule of Cool. \r\n\r\nSo some technology exists while others do not.\r\n\r\n- What does the term *schizo* mean? It&#39;s in *schizophrenia* and *Schizo Tech*\r\n\r\nI think it&#39;s Latin or Greek but I don&#39;t know where else should I ask this.\r\n\r\nAfter all, isn&#39;t *schizophrenia* an English word?\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "630" ], [ "This is not a full answer, just too long to be a comment.\r\n\r\nOne can at least perform the integration on $x_3$ simply, since in the region of integration given, for any $x_1,x_2$ there is a $x_3$ such that $x_1 + x_2 + x_3 = 0$. Therefore one just needs to replace $x_3$ with $-x_1-x_2$, obtaining:\r\n\r\n$$I = \\int_{-1}^0\\mathrm{d}x_1 \\int_{0}^1\\mathrm{d}x_2 \\, \\exp[(a_1-a_3)x_1 + (a_2-a_3)x_2 + c(x_1 + x_2)^2]$$\r\n\r\nI don&#39;t know what else to do from here.\r\n\r\n**Update:** I had an idea that lets me convert this to a single integration. Use the identity (Hubbard-Stratonovich transform):\r\n\r\n$$\\exp(\\lambda x^2) = \\int_{-\\infty}^\\infty \\exp(-u^2/2 + \\sqrt{2\\lambda}u) \\, \\mathrm{d} u$$\r\n\r\nto get rid of the squared term $(x_1 + x_2)^2$. We have:\r\n\r\n$$\\begin{aligned}\r\nI & = \\int\\frac{\\mathrm{d}u}{\\sqrt{2\\pi}}\\mathrm{e}^{-u^{2}/2}\\int_{-1}^{0}\\mathrm{d} x_{1}\\int_{0}^{1}\\mathrm{d}x_{2}\\exp\\left[\\left(a_{1}-a_{3}\\right)x_{1}+\\left(a_{2}-a_{3}\\right) x_{3}+u\\sqrt{c}\\left(x_{1}+x_{2}\\right)\\right] \\\\\r\n & = \\int_{-\\infty}^{\\infty}\\frac{\\mathrm{d}u}{\\sqrt{2\\pi}}\\mathrm{e}^{-u^{2}/2}\\frac{1-\\mathrm{e}^{-a_{1}+a_{3}-u\\sqrt{c}}}{a_{1}-a_{3}+u\\sqrt{c}}\\frac{\\mathrm{e}^{a_{2}-a_{3}+u\\sqrt{c}}-1}{a_{2}-a_{3}+u\\sqrt{c}}\r\n\\end{aligned}$$\r\n\r\nwhich is now a single integration. I still wonder if this can be simplified even more.", "327" ], [ "Hi <PERSON>, Thanks for the formatting help. There has been a secondary issue with accumulating multiple Ids but I&#39;d solved that by ignoring the MessagesIds Set as it was here that was collecting multiples. Whether this is the right thing to do, I don&#39;t know. What I can&#39;t for the life of me figure out is that if the process is supposed to fire on Email creation, it only does so for the first email when created in quick succession. I&#39;m not sure if PB will automatically scoop up any other records which are meeting the same criteria; I&#39;d always assumed they run on separate threads.", "190" ] ]
291
[ 8928, 18878, 16116, 14897, 4110, 12328, 4690, 4583, 10046, 4759, 12050, 3467, 883, 10358, 1774, 19604, 17028, 13194, 7229, 14947, 3035, 4054, 5002, 3034, 6596, 9886, 8488, 17256, 11326, 16398, 17738, 7742, 1462, 3993, 18360, 4173, 19117, 17525, 2704, 9319, 8439, 9885, 7940, 3903, 3412, 15891, 858, 14493, 1286, 7722, 13519, 16357, 12208, 15163, 19563, 3552, 12870, 16955, 9016, 6575, 10837, 18624, 14887, 16510, 17494, 17429, 9102, 3087, 14424, 1190, 13103, 19326, 4877, 8508, 8701, 3142, 7379, 11845, 17546, 8755, 3558, 3769, 2805, 10871, 8825, 16015, 3002, 18788, 136, 3177, 7258, 10121, 16112, 13157, 19060, 462, 12127, 6745, 19373, 12112, 8791, 4766, 2093, 18112, 16420, 3415, 12209, 704, 2983, 2440, 12999, 4509, 14856, 6843, 13967, 19709, 18577, 10020, 17898, 740, 8489, 16335, 5910, 5310, 15665, 8361, 12282, 12101, 6542, 3965, 767, 7124, 1554, 1954, 17079, 17545, 17019, 17094, 16505, 12990, 8745, 19533, 4863, 8434, 4053, 8725, 7296, 15227, 5510, 389, 10506, 14360, 8301, 3783, 5397, 7542, 3223, 13266, 6790, 8690, 6284, 9997, 2089, 9697, 10865, 19483, 3751, 6452, 7788, 11586, 8044, 2566, 4955, 13013, 4908, 9684, 5241, 2293, 15896, 12696, 14944, 7480, 18638, 18138, 812, 16129, 39, 15603, 17186, 2971, 3042, 7029, 17221, 6696, 7392, 7552, 7559, 2929, 18359, 13138, 12618, 8190, 8307, 19141, 18937, 19200, 18893, 3589, 712, 10991, 5899, 12368, 6618, 7579, 113, 1687, 2179, 5376, 773, 13334, 7356, 6179, 12124, 1453, 15808, 11235, 16012, 2561, 8939, 14396, 15686, 19643, 11842, 19512, 7952, 11010, 19300, 2776, 9404, 5952, 16776, 13615, 17618, 16475, 4554, 2050, 15200, 9866, 18479, 9856, 8057, 7883, 11202, 15893, 19609, 16569, 1073, 8431, 1177, 15504, 989, 7058, 2605, 7939, 9283, 13183, 1003, 12415, 6108, 7586, 17490, 5657, 3109, 17751, 9042, 10734, 14764, 5920, 6747, 1827, 2151, 7791, 12512, 9908, 5576, 8360, 3567, 451, 15182, 4767, 1265, 1861, 19579, 2991, 13514, 16692, 18580, 6459, 10267, 5532, 15886, 386, 6896, 4958, 11237, 3687, 10496, 4041, 1679, 10842, 2808, 8734, 16980, 13197, 18190, 5908, 5718, 1722, 6355, 7520, 8076, 18557, 4876, 6265, 10396, 3970, 13812, 8475, 2616, 602, 2425, 3599, 6016, 13403, 10623, 445, 11154, 4044, 11943, 12255, 15855, 13986, 721, 15934, 8367, 8653, 18470, 13787, 14076, 2436, 2475, 10966, 10051, 18236, 7696, 3388, 19411, 10239, 19447, 407, 7070, 14116, 11539, 17697, 7217, 2908, 7594, 14272, 5540, 14309, 7822, 6457, 10794, 8064, 14209, 7576, 19710, 1401, 14669, 5311, 11947, 5196, 6420, 5043, 11931, 18389, 3822, 18040, 5415, 3138, 3556, 4076, 18323, 17184, 12789, 1053, 1437, 2, 782, 4162, 4393, 2150, 5278, 17563, 11315, 12858, 8215, 19487, 7021, 3701, 10629, 18379, 14347, 14814, 10387, 7750, 19266, 7336, 13391, 8322, 18767, 18319, 7703, 617, 10844, 17192, 4616, 2591, 8852, 16032, 8748, 13180, 18717, 12632, 7415, 4745, 5418, 7256, 7761, 15423, 16751, 8167, 8597, 3522, 8150, 17614, 4529, 12012, 4636, 13562, 7129, 8767, 12649, 19426, 19242, 8563, 12643, 8738, 2167, 5534, 9243, 8546, 16520, 3343, 15563, 5046, 5570, 10079, 5265, 4985, 7662, 5176, 18935, 5614, 7988, 3068, 14917, 16489, 3757, 18789, 1769, 10993, 1799, 3060, 18330, 14559, 14594, 3190, 4177, 10210, 2101, 8458, 18747, 8873, 5150, 8107, 11537, 10554, 12142 ]
STX_10064.0
[ [ "John 10:26\r\n----------\r\n\r\nNew International Version\r\n\r\n > <PERSON> said to her, \" ;<PERSON>. \" ; She turned toward him and cried out in\r\n > Aramaic, \" ;Rabboni! \" ; (which means \" ;Teacher \" ;).\r\n\r\nNew Living Translation\r\n\r\n > \" ;<PERSON>! \" ; <PERSON> said. She turned to him and cried out, \" ;Rabboni! \" ; (which\r\n > is Hebrew for \" ;Teacher \" ;).\r\n\r\nEnglish Standard Version\r\n\r\n > <PERSON> said to her, “<PERSON>.” She turned and said to him in Aramaic,\r\n > “Rabboni!” (which means Teacher).\r\n\r\nKing James Bible\r\n\r\n > <PERSON> saith unto her, <PERSON>. She turned herself, and saith unto him,\r\n > <PERSON>; which is to say, Master.\r\n\r\n\r\nWhere did this word originate? As far as I can tell, it is used very sparingly in the whole of the Bible, and consistently translated as so in this passage. Could anyone shed some light on the \r\n\r\n - origin \r\n - significance\r\n - overall usage \r\n\r\nof the word?\r\n\r\n_________________\r\n\r\nSome translations also have the word used in Mark 10:51; however, this word is translated as *rabboni* with a bit less frequency.\r\n\r\nMark 10:51\r\n----------\r\n\r\nNew International Version\r\n > \" ;What do you want me to do for you? \" ; <PERSON> asked him. The blind man said, \" ;**Rabbi**, I want to see. \" ;\r\n\r\nNew American Standard Bible\r\n > And answering him, <PERSON> said, \" ;What do you want Me to do for you? \" ; And the blind man said to Him, \" ;**Rabboni**, I want to regain my sight! \" ;\r\n\r\nKing James Bible\r\n > And <PERSON> answered and said unto him, What wilt thou that I should do unto thee? The blind man said unto him, **Lord**, that I might receive my sight.\r\n\r\nWith this being the case, I&#39;d also like to know if there are different words used in the Greek for the two different verses, and perhaps what they mean and typically translate into.", "719" ], [ "When we read in Philippians 2:4-7 \r\n\r\n > 4 Let each of you look not only to his own interests, but also to the\r\n > interests of others. 5 Have this mind among yourselves, which is yours\r\n > in <PERSON>, 6 who, though he was in the form of God, did not\r\n > count equality with God a thing to be grasped, 7 but **emptied himself**,\r\n > by taking the form of a servant, being born in the likeness of men. (ESV)\r\n\r\nwhat does <PERSON> mean by \" ;emptied himself \" ;? Does he mean <PERSON> \" ;puts aside \" ; his divine attributes when he takes the form of <PERSON>? Do the other letters of <PERSON> help provide insight as to what he has in mind?", "719" ], [ "I ask this as **blessed** can mean many things. Eternal life, financial wealth, health, having kids, having a job, being happy, etc. Blessings seem to be very broad, so I&#39;d like to see if anyone can narrow it down or define the word for better understanding of what <PERSON> was intending for his audience to understand. \r\n\r\nDoes the blessing that <PERSON> speaks of mean one *specific* blessing or type of blessing? Also, does the word blessed point to the same specific blessing in each new phrase? \r\n\r\nAlternatively, does part b of each phrase simply define the blessing from part a? \r\n\r\nThank you.\r\n\r\n[Matthew 5:3-11 NIV][1]\r\n\r\n\r\n > 3 “Blessed are the poor in spirit,\r\n > for theirs is the kingdom of heaven. 4 Blessed are those who mourn,\r\n > for they will be comforted. 5 Blessed are the meek,\r\n > for they will inherit the earth. 6 Blessed are those who hunger and thirst for righteousness,\r\n > for they will be filled. 7 Blessed are the merciful,\r\n > for they will be shown mercy. 8 Blessed are the pure in heart,\r\n > for they will see God. 9 Blessed are the peacemakers,\r\n > for they will be called children of God. 10 Blessed are those who are persecuted because of righteousness,\r\n > for theirs is the kingdom of heaven.\r\n > \r\n > 11 “Blessed are you when people insult you, persecute you and falsely\r\n > say all kinds of evil against you because of me. 12 Rejoice and be\r\n > glad, because great is your reward in heaven, for in the same way they\r\n > persecuted the prophets who were before you.\r\n\r\n\r\n [1]: _URL_0_ \" ;The Beatitudes \" ;", "719" ], [ "Is <PERSON> directing His words towards (a) <PERSON>, (b) <PERSON>, or (c) both? How can we draw a definite conclusion here?\r\n\r\n**[John 13:21-30 ESV][1]**\r\n\r\n > 21 After saying these things, <PERSON> was troubled in his spirit, and testified, “Truly, truly, I say to you, one of you will betray me.” 22 The disciples looked at one another, uncertain of whom he spoke. 23 One of his disciples, whom <PERSON> loved, was reclining at table at <PERSON>’ side, 24 so <PERSON> motioned to him to ask <PERSON> of whom he was speaking. 25 So that disciple, leaning back against <PERSON>, said to him, “Lord, who is it?” 26 <PERSON> answered, “It is he to whom I will give this morsel of bread when I have dipped it.” So when he had dipped the morsel, **he gave it to <PERSON>,** the son of <PERSON>. 27 Then after he had taken the morsel, **<PERSON> entered into him.** <PERSON> said to *him,* **“What you are going to do, do quickly.”** 28 Now no one at the table knew why he said this to him. 29 Some thought that, because <PERSON> had the moneybag, <PERSON> was telling him, “Buy what we need for the feast,” or that he should give something to the poor. 30 So, after receiving the morsel of bread, he immediately went out. And it was night.\r\n\r\n (Bold and italics my own emphasis)\r\n\r\n [1]: _URL_0_", "719" ], [ "In Galatians 1:19:\r\n\r\n > *New International Version*: \r\nI saw none of the other apostles--only <PERSON>, the Lord&#39;s brother.\r\n\r\n < !-- -- > \r\n\r\n > *English Standard Version*: \r\nBut I saw none of the other apostles except <PERSON> the Lord’s brother.\r\n\r\n < !-- -- > \r\n\r\n > *New American Standard Bible*: \r\nBut I did not see any other of the apostles except <PERSON>, the Lord&#39;s brother.\r\n\r\n < !-- -- > \r\n\r\n > *King James Bible*: \r\nBut other of the apostles saw I none, save <PERSON> the Lord&#39;s brother.\r\n\r\nAre we supposed to read this as I saw no apostle other than <PERSON> (an apostle) or I saw no apostles, but I did see <PERSON> the brother of the Lord? If the former, is there Scriptural support to say that <PERSON> was one of the twelve? I had believed it was widely assumed that none of Jesus&#39; family believed in Him during his earthly ministry. (That is, <PERSON> came to faith after seeing the resurrected <PERSON>)", "719" ], [ "<PERSON> is *not* affirming that the people who put <PERSON> to death and those who brought him off the tree were one and the same; he is merely stating that **both parties were made up of Jewish individuals**. \r\n\r\nRemember [**John 19:38-40 (NASB)**][1] which tells us exactly who \" ;brought <PERSON> off the tree. \" ;\r\n\r\n > 38 After these things **<PERSON> of Arimathea**, being a disciple of <PERSON>, but a secret one for fear of the Jews, asked <PERSON> that he might take away the body of <PERSON>; and <PERSON> granted permission. So he came and took away His body. 39 **<PERSON>**, who had first come to Him by night, also came, bringing a mixture of myrrh and aloes, about a hundred pounds weight. 40 So *they* took the body of <PERSON> and bound it in linen wrappings with the spices, as is the burial custom of the Jews.\r\n\r\nBoth <PERSON> of Arimathea (see [Mark15:43][2]) and <PERSON> ([John 3:1][3]) were part of the council of rulers at the time. Both, of course, were Jewish men.\r\n\r\nThe context of Acts 13, then, gives us insight as to why <PERSON> is speaking in this way, and that is to communicate the history and actions that led to this moment to his listeners, which consisted of both Jew and Gentile peoples. \r\n\r\nFurther context clues are found in **Acts 13:46-48**:\r\n\r\n > 45 When the Jews saw the crowds, they were filled with jealousy. They began to contradict what <PERSON> was saying and heaped abuse on him.\r\n46 Then <PERSON> and <PERSON> answered them boldly: “We had to speak the word of God to you first. Since you reject it and do not consider yourselves worthy of eternal life, we now turn to the Gentiles. 47 For this is what the Lord has commanded us:\r\n > \r\n“‘I have made you[f] a light for the Gentiles,\r\n that you[g] may bring salvation to the ends of the earth.’[h]”\r\n > \r\n48 When the Gentiles heard this, they were glad and honored the word of the Lord; and all who were appointed for eternal life believed.\r\n\r\nThus, when we consider the historical context and audience of the passage, we can come to the conclusion that <PERSON> was not connecting anyone but the Jewish people, as a *whole*, as being those involved in the crucifixion and burial of <PERSON>.\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_1_\r\n [3]: _URL_0_", "719" ], [ "Perhaps someone can explain why some translations of Genesis 3:8 refer to the \" ;*voice* of the Lord \" ; walking in the garden, and others simply state \" ;the Lord. \" ;\r\n\r\nKJV\r\n===\r\n\r\n > “**And they heard the voice of the LORD God walking** in the garden in\r\n > the cool of the day: and <PERSON> and his wife hid themselves from the\r\n > presence of the LORD God amongst the trees of the garden.”\r\n\r\nJubilee 2000\r\n============\r\n\r\n > \r\n > **And they heard the voice of the LORD God walking** in the garden in the\r\n > cool of the day, and the man and his wife hid themselves from the\r\n > presence of the LORD God among the trees of the garden.\r\n\r\nWord English Bible\r\n==================\r\n\r\n > **They heard the voice of <PERSON> walking** in the garden in the cool\r\n > of the day, and the man and his wife hid themselves from the presence\r\n > of <PERSON> among the trees of the garden.\r\n\r\n______________________________\r\nNow, compare those to:\r\n\r\nNIV\r\n===\r\n\r\n > **Then the man and his wife heard the sound of the LORD God** as he was\r\n > walking in the garden in the cool of the day, and they hid from the\r\n > LORD God among the trees of the garden.\r\n\r\nESV\r\n===\r\n\r\n > **And they heard the sound of the LORD God walking** in the garden in the\r\n > cool of the day, and the man and his wife hid themselves from the\r\n > presence of the LORD God among the trees of the garden.\r\n\r\nPossible that some translations are referencing the Memra of the Lord (as seen in the Aramaic Targum)? _URL_0_", "719" ], [ "Environment:\r\nIBM PowerVM 8\r\nIOS version <IP_ADDRESS>\r\n\r\nWhen I create an LPAR (Virtual Machine), I allocate 4 shared CPU&#39;s.\r\nI then install Redhat 6.6 p64.\r\nNproc shows 16 CPUs.\r\n\r\nOn a different machine, I allocate 1 shared CPU.\r\nI then install Redhat 6.6 p64.\r\nnproc show 4 CPUs.\r\n\r\nWhy does the OS report 4 times the processor I specify when setting up the machine?", "73" ], [ "Thanks for the Doc link. My VM setup screen, and existing VM config screen are different than what is in this doc. I see No select-able vCPU option. When i set up a new VM, I&#39;m instructed some things, like .1 shared process = 1 virtual processor, but even if I create a new VM with .2 processors, the OS reports 4 processors.", "181" ], [ "<PERSON> 12:1-8 ESV\r\n============\r\n\r\n > 1 At that time <PERSON> went through the grainfields on the Sabbath. His disciples were hungry, and they began to pluck heads of grain and to eat. 2 But when the Pharisees saw it, they said to him, “Look, your disciples are doing what is not lawful to do on the Sabbath.” 3 He said to them, “Have you not read what <PERSON> did when he was hungry, and those who were with him: 4 how he entered the house of God and ate the bread of the Presence, which it was not lawful for him to eat nor for those who were with him, but only for the priests? 5 Or have you not read in the Law how on the Sabbath the priests in the temple profane the Sabbath and are guiltless? 6 I tell you, something greater than the temple is here. 7 And if you had known what this means, ‘I desire mercy, and not sacrifice,’ you would not have condemned the guiltless. 8 **For the Son of Man is lord of the Sabbath.”**\r\n\r\n - What does lordship over the Sabbath entail?\r\n\r\n - Was <PERSON> abolishing the Sabbath? Was he redefining it? \r\n\r\n(If the former, was he simply doing away with the Sabbath or did he replace it or *fulfill* it in some way? If the latter, what are we to see in the redefinition [i.e. before / after]?)", "508" ] ]
14
[ 5085, 7211, 688, 5462, 5444, 8505, 19090, 18432, 6290, 4999, 5633, 337, 11589, 9965, 11332, 9948, 2630, 7497, 16178, 2108, 9580, 6500, 7267, 16560, 18518, 10208, 5402, 7818, 4222, 5743, 14241, 6818, 7185, 7544, 5975, 5712, 795, 477, 13921, 4544, 10716, 14968, 2207, 5758, 14097, 19150, 7914, 2049, 2496, 2399, 84, 10524, 7080, 15804, 6330, 16376, 16003, 6698, 3494, 11467, 426, 3184, 19328, 6222, 769, 17168, 5690, 3426, 12576, 11887, 4217, 6874, 11344, 16812, 2801, 18564, 4389, 10102, 15906, 6137, 794, 16399, 9469, 5940, 2564, 5369, 10115, 8621, 5685, 2187, 19541, 7858, 7483, 2229, 5493, 6656, 5321, 19473, 2429, 1927, 1319, 1589, 1104, 6318, 15854, 6890, 7230, 7636, 7096, 3811, 5284, 16235, 6709, 2455, 5122, 11127, 6230, 2353, 2159, 13019, 1066, 9927, 12816, 15699, 11937, 3867, 8324, 4227, 854, 2817, 18727, 550, 2806, 16347, 4601, 9775, 16287, 3398, 2188, 5620, 4255, 251, 6449, 17335, 9352, 8805, 3698, 1005, 7596, 6430, 2683, 9822, 17822, 15962, 8247, 620, 15913, 5519, 14680, 7329, 1225, 1169, 15562, 16712, 1418, 6141, 3645, 5421, 2524, 328, 12573, 15579, 9184, 6452, 3273, 2418, 2208, 11934, 5750, 13933, 14014, 13405, 13896, 11795, 6422, 10265, 4102, 948, 5017, 16619, 4566, 19315, 2538, 16448, 5600, 4752, 15739, 880, 6897, 6189, 950, 15292, 9023, 5026, 12212, 11188, 987, 5185, 1278, 3777, 15226, 2707, 13636, 6913, 6024, 1964, 7312, 1204, 16834, 876, 454, 3053, 3294, 7202, 1023, 16814, 8856, 331, 1974, 568, 5123, 10295, 5613, 3523, 10804, 1030, 16788, 7420, 3361, 9018, 17484, 5105, 2636, 937, 6467, 709, 5557, 12463, 4941, 17988, 5259, 641, 1792, 4272, 12146, 2968, 10537, 16487, 7531, 4358, 11874, 18228, 14604, 9701, 12738, 6977, 19696, 6049, 12612, 6697, 14774, 965, 10284, 6175, 2306, 19319, 7417, 4761, 2923, 13210, 7622, 9236, 14098, 17945, 5301, 10713, 11633, 5621, 2234, 15438, 6604, 18611, 14390, 1028, 2329, 5098, 999, 11986, 6843, 17166, 4415, 16926, 17787, 15104, 1285, 11558, 6191, 992, 504, 11299, 18917, 811, 11177, 2648, 13908, 5597, 2660, 17464, 1339, 19126, 1071, 1288, 5357, 8244, 10215, 6954, 12283, 3232, 12523, 4614, 1999, 7876, 2471, 15807, 17977, 8326, 9478, 1420, 19066, 10251, 13479, 6335, 17554, 4718, 1124, 18365, 8558, 6408, 5139, 710, 8559, 2133, 962, 4657, 9073, 9780, 4260, 7126, 11290, 9368, 7349, 18402, 6963, 15787, 14729, 1270, 18040, 4292, 3839, 6671, 786, 9600, 14094, 13977, 703, 5176, 17980, 9328, 15821, 13880, 3413, 10403, 9530, 9961, 17964, 2770, 13726, 12294, 16261, 13098, 2965, 5410, 13623, 16940, 3782, 7373, 5435, 861, 3658, 16277, 4243, 17253, 17660, 9535, 13548, 2472, 14284, 7079, 16817, 16700, 14337, 9598, 14355, 12742, 4036, 9845, 9117, 1956, 2055, 692, 16617, 5170, 8646, 3292, 5864, 11228, 5646, 11276, 17796, 16432, 3759, 15723, 515, 18107, 349, 7728, 16372, 5217, 5099, 9401, 16038, 8074, 2123, 11379, 9100, 822, 11770, 13897, 13965, 2902, 847, 17074, 11321, 4774, 4533, 3404, 657, 9636, 4628, 12953, 10966, 12471, 3000, 2686, 14067, 640, 3536, 7850, 1765, 17790, 15026, 984, 12113, 17571, 7719, 2316, 8730, 2957, 8541, 15010, 10506, 8047, 15886, 19054, 2528, 12233, 18650, 309, 1402, 1706, 9711, 6208, 9409, 11560, 6275, 17769, 14571, 97, 7861 ]
STX_10064334.0
[ [ "It seems that the buttons are iterated correctly by ngFor and if I inspect them they have the right attributes, however, when I click on them the function in the controller claims the parameter is &#39;undefined&#39; every now and then, I guess 50-50 most of the time, quite random.\r\n\r\nThis is the error I get: ERROR TypeError: Cannot read property &#39;value&#39; of undefined at (the line where the attribute is passed as a parameter in the controller)\r\n\r\nEverything worked fine when all the logic was within its controller. But I decided to refactor it and use a service + interceptors. For now, I&#39;ve included the headers and params in the service. \r\n\r\nThe thing is, everything works fine in Firefox with no errors, Chrome seems to be the only one experiencing this bug. And if I keep clicking on it, it will keep throwing errors for a while until it just works. Here&#39;s a screen recording: _URL_0_\r\n\r\nNote: If I just wait without clicking again and again -- nothing happens. Looking in the network tab reveals that the http call simply isn&#39;t firing at all.\r\n\r\nCode below: \r\n\r\nFront end:\r\n\r\n < div *ngFor= \" ;let button of lvl0 | errorfix \" ; > \r\n\r\n < !-- Actual buttons reiterated with ngIF -- > \r\n < button mat-raised-button color= \" ;accent \" ; [attr.data-param1]= \" ; button[&#39;md:<PHONE_NUMBER>_Level 0 – Section&#39;] | lvl0clean \" ; class= \" ;lvl0button \" ;\r\n (click)= \" ;reveallvl1($event) \" ; (click)= \" ;stepper.reset() \" ; (click)= \" ;resetAllSteps() \" ; > \r\n {{ button[&#39;md:<PHONE_NUMBER>_Level 0 – Section&#39;] | lvl0clean }}\r\n < /button > \r\n < /div > \r\n\r\nService: \r\n\r\n initialisingDocs() {\r\n let headers = new HttpHeaders();\r\n\r\n headers = headers.append(\r\n \" ;Authorization \" ;,\r\n \" ;Basic \" ; + btoa( \" ;SOMETHINGSOMETHING \" ;)\r\n );\r\n headers = headers.append(\r\n \" ;Content-Type \" ;,\r\n \" ;application/x-www-form-urlencoded \" ;\r\n );\r\n return this.http.get(this.ROOT_URL + \" ;initialising \" ;, { headers });\r\n }\r\n\r\nController:\r\n\r\n constructor(private service: DocsService) {\r\n // Initialising the first set of buttons\r\n\r\n this.lvl0 = this.service.initialisingDocs().subscribe(data = > {\r\n this.lvl0 = data;\r\n console.log(this.lvl0);\r\n });\r\n }\r\n\r\nFor the next lvl of buttons:\r\n\r\n reveallvl1($event) {\r\n this.service\r\n .lvl1Docs($event.target.attributes[ \" ;data-param1 \" ;].value) **// < < ERROR LINE > > **\r\n .subscribe(data = > {\r\n this.lvl1 = data;\r\n console.log(data);\r\n\r\n this.step1Folder($event.target.attributes[ \" ;data-param1 \" ;].value);\r\n });\r\n }", "824" ], [ "I have a series of button created by ngFor which all have custom attributes binded like this:\r\n\r\n [attr.queryParam1]= \" ;button[&#39;something&#39;] | clean \" ;\r\n (click)= \" ;next($event) \" ;\r\n\r\nThen in the controller:\r\n\r\n this.service.lvl1Docs($event.target.attributes[ \" ;queryParam1 \" ;].value).subscribe\r\n\r\nBut in chrome I&#39;m getting very inconsistent behaviour, the source seems to reveal the attributes are there and are correct but if I click them I get this error in console and nothing happens:\r\n\r\n ERROR TypeError: Cannot read property &#39;value&#39; of undefined\r\n at DocsBuilderComponent.push../src/app/docs-builder\r\n /docs-builder.component.ts.DocsBuilderComponent.reveallvl1\r\n\r\nEverything seems to work fine in firefox though and if I keep clicking in chrome it eventually works fine. I had no luck troubleshooting this all week and I can&#39;t seem to effectively reproduce from scratch.\r\n\r\nMy question is, is there a better/different way to bind these two so I can send that iterated attribute as a GET request param?\r\n\r\nI should mention I need to use about 5 params for each button slightly later on and can&#39;t bind to something like &#39;value&#39; or &#39;id&#39;, hence trying to use attribute binding.", "824" ], [ "All I can say is lol, why haven&#39;t I thought of that. That seems to make so much sense and is so much simpler than my solution with bundling all attributes in the $event object and then passing that and reading that there.\n\nWill refactor now using this logic and will get back here and reply, thanks a lot man! I literally dumped over 8 hours of fully-focused work into this issue.", "516" ], [ "I&#39;ve been trying to simply update a CosmosDB document via the mongodb api in my node application, I&#39;ve been testing in and out, no errors but the value does not update no matter what.\r\n\r\nI know updating array elements is not supported which is fine, but this is a top-level key-value pair. Changes simply don&#39;t happen with no error whatsoever.\r\n\r\nI&#39;ve been following the Mean.js project with uses CosmosDB + Mongoose + Node + Angular, looking at the API for updating hero and trying some of that code but it still doesn&#39;t update.\r\n\r\nI&#39;ve been reading the documentation trying to figure out the default way of handling CRUD operations within CosmosDB and which parts of the MongoAPI it supports but so far no luck.\r\n\r\nFor tests purposes, I&#39;m using this code:\r\n\r\n async function updateUser(id) {\r\n try {\r\n let user = await User.findById(id);\r\n \r\n console.log (id);\r\n console.log(user);\r\n if (!user) return\r\n _URL_0_ = id\r\n user.firstName = &#39;ASDASDASASDASDASDASDASDA&#39;\r\n\r\n const result = await user.save()\r\n console.log(result); \r\n } \r\n catch(err) {\r\n console.log( \" ;There was an error updating user \" ;, err);\r\n }\r\n }\r\n\r\nSo, I&#39;ve been playing around some more and managed to update a hero using this code: \r\n\r\n updateHero(&#39;10&#39;)\r\n\r\n async function updateHero(id) { \r\n const originalHero = {\r\n uid: id,\r\n name: &#39;Hero2&#39;,\r\n saying: &#39;nothing&#39;\r\n };\r\n Hero.findOne({ uid: id }, (error, hero) = > {\r\n \r\n _URL_2_ = _URL_1_;\r\n hero.saying = originalHero.saying;\r\n hero.save(error = > {\r\n return(hero);\r\n console.log(&#39;Hero updated successfully!&#39;);\r\n });\r\n });\r\n } \r\n\r\nNow I&#39;m just not sure why this has actually worked and why it hasn&#39;t before. The main thing that is different is that I&#39;m using an &#39;uid&#39; instead of the actual ID assigned by CosmosDB.", "547" ], [ "@DavidMakogon - wasn&#39;t trying to update the ID, just to find a document by ID and then update some other stuff in that document, the problem is there&#39;s nothing in the result object, that&#39;s why I haven&#39;t posted. No error no nothing. And the document stayed the same. But I have pieced together something that works from the Mean.js PUT example and it seems to work so far, I have updated the original post with that code.", "263" ], [ "After 8 hours of troubleshooting and some help in another thread + some help from colleagues, I ended up with this function:\r\n\r\n let countUniqueValues = (data, key) = > {\r\n return _(data).groupBy(key).values().map(\r\n (group) = > ({ key: group[0][`${key}`], count: group.length })\r\n ).value()\r\n }\r\n\r\nNow, when I update my store, I can call this function to create any kpi I want by passing it the data from the action and the key whose values I want to count. \r\n\r\nI don&#39;t even have to touch the function at all.", "256" ], [ "I have an angular project where I&#39;m using Angular Material and material table. \r\n\r\nIt seems that all the text in my table has the 10px margin top and bottom applied due to a class named something like: .ng-tns-c5-1 or .ng-tns-c6-1 etc. \r\n\r\nI can&#39;t find a way to change those margins without inspecting element, finding that class and then using CSS to change that margin.\r\n\r\nBut after some changes to other elements on the app, the .ng-tns-c6-1 (for example) is changed to something like: .ng-tns-c4-0 and then I have to change that. The problem is I&#39;ve done this 5-6 times now and it&#39;s a complete pain.\r\n\r\nBecause of that the table has a lot of useless white space and just overall makes things look bad.\r\n\r\nWhat is that class and what can I do to make sure the margin remains at the 2-3px I&#39;m setting?\r\n\r\nThis is the type of thing I have in my CSS:\r\n\r\n .ng-tns-c5-1 {\r\n margin-top: 2px !important;\r\n margin-bottom: 2px !important;\r\n }\r\n \r\n .ng-tns-c5-0 {\r\n margin-top: 2px !important;\r\n margin-bottom: 2px !important;\r\n }\r\n \r\n .ng-tns-c6-1 {\r\n margin-top: 2px !important;\r\n margin-bottom: 2px !important;\r\n }\r\n \r\n .ng-tns-c4-0 {\r\n margin-top: 2px !important;\r\n margin-bottom: 2px !important;\r\n }", "329" ], [ "I&#39;m making a mobile webpage that needs to have a bunch of links to various installed apps through the MDM. This is for managed devices and will launch both enterprise-internal apps and third-party. It does not need to do anything other than just launch.\r\n\r\nI&#39;ve been looking everywhere on how to make some simple basic links to simply launch the apps and nothing more. \r\n\r\nI&#39;ve tried some of the syntax below but it fails to actually open the installed app and instead just takes you to app store:\r\n\r\n < a href= \" ;intent://launch/#Intent;package=com.a14integrated.full;end \" ; > Take a QR code < /a > \r\n \r\n < intent android:action= \" ;launch \" ; > \r\n < extra android:name= \" ;com.a14integrated.full \" ; android:value= \" ;com.a14integrated.full \" ; / > \r\n LAUNCH?\r\n < /intent > \r\n\r\n**UPDATE #1:** \r\n\r\nAfter more research I&#39;m giving this up as it doesn&#39;t seem generically possible but rather something each app maker must implement themselves.", "888" ], [ "Recording of the elements insepcted: _URL_1_ \r\n\r\nThe container within &#39;interactive-models&#39; will simple not center inside his parent container. \r\n\r\nin App Component Html:\r\n\r\n < router-outlet fxLayout= \" ;column \" ; fxFlexAlign= \" ;center \" ; fxLayoutAlign= \" ;center center \" ; > \r\n\r\nInside Interactive-models commponent.html:\r\n\r\n < div fxLayout= \" ;row \" ; fxLayoutAlign= \" ;center center \" ; \r\n_URL_0_-md= \" ;true \" ; class= \" ;container theStupidList \" ; fxFlex= \" ;90% \" ; > \r\n\r\nThe Material grid list:\r\n\r\n < mat-grid-list class= \" ;item \" ; fxFlex= \" ;90 \" ; fxFlexAlign= \" ;center \" ; \r\n cols= \" ;3 \" ; rowHeight= \" ;600 \" ; gutterSize= \" ;15px \" ; > \r\n\r\nIn my CSS:\r\n\r\n .theStupidList {\r\n justify-content: center!important;\r\n justify-self:center !important;\r\n justify-items: center!important; }", "329" ], [ "Ah, this works but now the grid list won&#39;t display no matter if I set that div that&#39;s the parent of router outlet as column or row. I&#39;ve also removed the div parent from the interactive component and removed all directives from material grid list and it still won&#39;t display/give an error. The grid list element is a complete nightmare.", "182" ], [ "I&#39;ve been trying to deploy my dist folder via bitbucket pipelines + lftp for quite a while now. I&#39;ve tried various variations of the linux commands and gone through a couple dozen articles on the issue yet I still can&#39;t get the thing to work.\r\n\r\nSo far my pipeline commands look like this:\r\n\r\n - apt-get update\r\n - apt-get install lftp\r\n - lftp set ssl:verify-certificate no\r\n - lftp $FTP_HOST\r\n - user $FTP_USER\r\n - $FTP_PASSWORD\r\n - ls\r\n - quit\r\n\r\nBut for set I&#39;m getting `&#39;lftp: set: Name or service not known&#39;` -- when I delete the step it gets to user and I&#39;m getting `bash: user: command not found` if I add lftp in front of it I&#39;m getting `lftp: user: Name or service not known`\r\n\r\nI think in total I&#39;ve tried over 30+ times to get these right with no luck.", "708" ], [ "@TimBiegeleisen as mentioned in my post, I&#39;m trying to push the contents of the &#39;dist&#39; folder which are my compiled files. The Plesk Git extension then connects to that branch and continously mirrors everything on my production server. It&#39;s basically continous deployment. I have been trying things for over 15 hours with no luck -- this is the strategy I&#39;m trying out now.", "441" ], [ "I&#39;ve developed restful http services with Node to communicate with my angular front-end. \r\n\r\nIn the back-end I&#39;m using the MSSQL npm package which is an extension of TEDIOUS npm package made by microsoft to communicate with MS SQL Server. \r\n\r\nIn that package I&#39;m using the &#39;stream&#39; function to listen for changes. \r\n\r\nI&#39;d want to **trigger a get request on the Angular 6 front end** from the backend when that happens, but after looking through the documentation I can&#39;t find anything that would facilitate this strategy.", "942" ], [ "I must be missing something very obvious on this one.\r\n\r\nI&#39;ve been trying to trust/follow the official docs on this one but I&#39;m noticing I&#39;m not actually using that whole &#39;bearerStrategy&#39; I&#39;m defining anywhere. If I try to swap out oauth-bearer with bearerStrategy I&#39;m getting the exact same result.\r\n\r\nSetup:\r\n\r\n const passport = require(&#39;passport&#39;);\r\n const BearerStrategy = require(&#39;passport-azure-ad&#39;).BearerStrategy\r\n\r\nEndpoint in index.js:\r\n\r\n app.use( \" ;/andon \" ;, passport.authenticate(&#39;oauth-bearer&#39;, { session: false }), andon);\r\n\r\n\r\nConfiguration from the documentation files:\r\n\r\n let options = {\r\n identityMetadata: appconfig.get( \" ;creds.identityMetadata \" ;),\r\n clientID: appconfig.get( \" ;creds.clientID \" ;),\r\n passReqToCallback: appconfig.get( \" ;creds.passReqToCallback \" ;)\r\n }\r\n \r\n let bearerStrategy = new BearerStrategy(options,\r\n function(token, done) {\r\n _URL_0_(&#39;verifying the user&#39;);\r\n _URL_0_(token, &#39;was the token retreived&#39;);\r\n findById(token.oid, function(err, user) {\r\n if (err) {\r\n return done(err);\r\n }\r\n if (!user) {\r\n // \" ;Auto-registration \" ;\r\n _URL_0_(&#39;User was added automatically as they were new. Their oid is: &#39;, token.oid);\r\n users.push(token);\r\n owner = token.oid;\r\n return done(null, token);\r\n }\r\n owner = token.oid;\r\n return done(null, user, token);\r\n });\r\n }\r\n );", "623" ], [ "I&#39;m not trying to troubleshoot the sorting &#39;mechanism&#39; in the controller, it&#39;s purely the fact that it&#39;s not showing up. To reach this conclusion I have started from a [stackblitz][1] where I configured the data loading and everything to work the same way as my main project. Everything works fine and the arrows show up even if there&#39;s no data in the table or anything configured for the sorting in the controller.\r\n\r\nI&#39;ve checked all stylesheets and imports and they are identical.\r\n\r\nI have also copy-pasted the table in the view here on stackblitz with no other modifications than adjusting things for the &#39;displayed column&#39; object in the controller so that it loads my data.\r\n\r\nThis copy-pasted table doesn&#39;t show the arrows at all and can&#39;t for the life of me find either an error or something wrong in the compiled source.\r\n\r\nDue to this I&#39;m convinced there&#39;s a global issue in my project but don&#39;t know where I haven&#39;t yet looked.\r\n\r\n\r\nEdit 1:\r\n\r\n - Updated stackblitz with latest version of everything, sorting still works. Now versions match.\r\n - Dropped some icons in my project to make sure the material icons works/show up, they do, material icon is fine.\r\n\r\n [1]: _URL_0_", "837" ], [ "I&#39;m trying to automate deployment via ftp via bitbucket pipelines. \r\n\r\nPath is:\r\n\r\n /var/www/vhosts/_URL_0_\r\n\r\nTried it with and without the first forward slash in there. Also checked the default path when you connect and its _URL_0_ -- tried that too but same error.\r\n\r\nCode looks like this:\r\n\r\n \r\n\r\n image: node:9.8.0\r\n pipelines:\r\n default:\r\n - step:\r\n name: Deployment\r\n script:\r\n - apt-get update\r\n - apt-get install ncftp\r\n - ncftpput -v -u \" ;$FTP_USERNAME \" ; -p \" ;$FTP_PASSWORD \" ; -R $FTP_HOST $FTP_SITE_ROOT dist/*\r\n - echo Finished uploading /dist files to $FTP_HOST$FTP_SITE_ROOT\r\n\r\nBut the problem is ncftp doesn&#39;t like the file path to upload no matter what. I&#39;ve been using the one showing up in filezilla after navigating to that folder whilst connecting with the exact same credentials. \r\n\r\nHow could I trackdown the right path or troubleshoot this forward?", "20" ], [ "When inspecting served page: \r\n\r\n < !-- language: lang-html -- > \r\n\r\n < table _ngcontent-c6= \" ; \" ; class= \" ;mat-elevation-z8 mat-table \" ; fxfill= \" ; \" ; \r\n mat-table= \" ; \" ; matsort= \" ; \" ; role= \" ;grid \" ; ng-reflect-data-source= \" ;[object Object] \" ; > \r\n\r\nIn View:\r\n\r\n table matSort fxfill mat-table [dataSource]= \" ;dataSource \" ; class= \" ;mat-elevation-z8 \" ;\r\n\r\nIn Controller/Constructor:\r\n\r\n < !-- language: typescript -- > \r\n\r\n this.dataSource = new MatTableDataSource(this.section1)\r\n this.dataSource.sort = this.sort;\r\n\r\n this.service.getSection1().subscribe(data = > {\r\n this.section1 = data;\r\n console.log(this.section1);\r\n })\r\n\r\nI also made a function with a button that on click, changed datasource to \" ;BookingId \" ;: \" ;SomethingSomething \" ; and when I click on it, it works.I do get intellisense errors and other stuff.\r\n\r\nI also added console.log for dataSource in there and upon inspection, the data from the \" ;section1 \" ; object is not being added to the dataSource. \r\n\r\nI&#39;ve been re-using a lot of my code from a previous project where everything works fine with this configuration.\r\n\r\nI also have a \" ;displayedColumns \" ; object defined in my Controller + an interface model exported.\r\n\r\nI&#39;m testing this using only 1 row to make sure there&#39;s no misspelling or other small crap that&#39;s causing this.\r\n\r\nEdit: \r\n\r\nIf I add this to the click function, the data is added correctly to the table even if intellisense does not like it:\r\n\r\n this.service.getSection1().subscribe(data = > {\r\n this.dataSource = data;\r\n console.log(this.section1)\r\n })", "452" ], [ "In Angular + Redux, I&#39;m using the @select() to get an object called &#39;sectionAll&#39; , I&#39;m using that as my datasource for a table that I&#39;m presenting, due to that, I need to pass it to my dataSource in the controller. \r\n\r\nI&#39;m using the constructor to subscribe to this &#39;sectionAll&#39; observable.\r\n\r\nMy question is, if I use the @select() like this, will it destroy that subscription for me as well? or am I just using @select() wrong?\r\n\r\nEdit:\r\n\r\nI am using [@angular-redux/store][1] with Angular6 \r\n\r\nMy constructor:\r\n\r\n constructor(\r\n private adalService: AdalService,\r\n private service: DeliveriesService,\r\n private ngRedux: NgRedux < IAppState > \r\n ) {\r\n this.service.getSectionAll();\r\n this.sectionAll.subscribe(data = > {\r\n (this.dataSource = new MatTableDataSource(data)),\r\n (this.dataSource.sort = this.sort);\r\n });\r\n }\r\nFor the select part:\r\n\r\n @select() sectionAll;\r\n\r\n\r\n [1]: _URL_0_", "769" ], [ "I&#39;ve been following a tutorial on it, and the point of the @select() decorator is to have that manage the subscription for you and instead you just add the | async pype in the view and you don&#39;t need to do anything else manually yourself in that context. \n\nBased on that I was wondering if it still cancels the subscription when I manually subscribe to it in the controller. Have looked through the documentation and searched google+stack. I guess I&#39;ll have to just test it out and see", "769" ], [ "Just had the exact same issue. What I found was that the color is changing but due to the opacity settings, it&#39;s not that noticeable.\r\n\r\ntry something like this:\r\n\r\n .mat-sort-header-arrow {\r\n color: #fff !important;\r\n opacity: 1 !important;\r\n }\r\n\r\nAlso, make sure you add this in the main style.css file -- doesn&#39;t seem to work otherwise. At least didnt work for me.\r\n\r\nLet me know if this works for you.", "950" ], [ "Example: _URL_0_\r\n\r\nI have tried fxFlexAlign - fxLayoutAlign on the parent, giving it an ID and using display:flex + justify-content:center with !important on everything.\r\n\r\nThe thing is -- all of the above do something to it, it reacts to the CSS and FlexLayout directives but the thing still looks obviously missaligned no matter what.\r\n\r\nUpon inspection it becomes clear that it growns from the right bottom corner of its &#39;container&#39; and simply does not care about aligning in any way.\r\n\r\nIs there something I&#39;m missing on dealing with these? I&#39;ve looked through the documentation + stackoverflow + googled it and can&#39;t find a thing.", "329" ], [ "@Edric Thanks, that is what actually messes things up. If I just leave the font-size whatever it defaults to due to text around it or black magic, things center fine.\n\nChanging the font size, misaligns everyhthing. If I change it high enough, starting at about around 50 size, it will overlay on the text.\n\nI&#39;ve also tried adding it to a div, span in every combination I could think of.\n\nWorking with font awesome svg icons on the exact same thing/space has been just straightforward and perfect.", "30" ], [ "I just added this.dataSource = new MatTableDataSource(this.section1) after the this.section1 = data; seems to have worked, now I&#39;m just confused as to why it worked in the other app. \r\n\r\nA couple of days later I ended up rebuilding everything with redux and used the @select() decorator on the array in my store and then subscribed to it in the constructor. This works fine as well.", "690" ], [ "I&#39;m basically counting the number of times an object in an array has 2 keys that equals a certain value. I want to increment that number for each time the condition is met. \r\n\r\nif I console.log to see the number of times the &#39;for&#39; loop is firing, everything is good and all works well. But when I try to do something with this.multidropAccepted I&#39;m suddenly getting undefined errors, even when I&#39;m just trying to read it on the console.\r\n\r\nCode: \r\n\r\n function countAccepted(arr) {\r\n for (let i = 0; i < arr.length; i++) {\r\n if (arr[i].DeliveryStatus == \" ;Accepted \" ; & & arr[i].BookingId == \" ;0 \" ;) {\r\n console.log( \" ;poop \" ;);\r\n this.multidropAccepted++;\r\n }\r\n }\r\n }", "639" ], [ "I ended up writing it like this:\r\n\r\n let countAccepted = data = > {\r\n for (let i = 0; i < data.length; i++) {\r\n if (\r\n data[i].DeliveryStatus == \" ;Accepted \" ; & & \r\n data[i].BookingId == \" ;0 \" ;\r\n ) {\r\n this.multidropAccepted++;\r\n }\r\n }\r\n };\r\n\r\nHad to have it in the subscription block for it to work and defined before calling it.\r\nI called it at the end to make sure that my table has content in it as the first priority and only then counting these things\r\n\r\n countAccepted(data)\r\n\r\nThis is how the whole thing looks:\r\n\r\n constructor(\r\n private adalService: AdalService,\r\n private service: DeliveriesService,\r\n private ngRedux: NgRedux < IAppState > \r\n ) {\r\n this.service.getSectionAll();\r\n this.sectionAllSubscription = this.sectionAll.subscribe(data = > {\r\n let countAccepted = data = > {\r\n for (let i = 0; i < data.length; i++) {\r\n if (\r\n data[i].DeliveryStatus == \" ;Accepted \" ; & & \r\n data[i].BookingId == \" ;0 \" ;\r\n ) {\r\n this.multidropAccepted++;\r\n }\r\n }\r\n };\r\n \r\n let countDelivered = data = > {\r\n for (let i = 0; i < data.length; i++) {\r\n if (\r\n data[i].DeliveryStatus == \" ;Delivered \" ; & & \r\n data[i].BookingId == \" ;0 \" ;\r\n ) {\r\n this.multidropDelivered++;\r\n }\r\n }\r\n };\r\n \r\n (this.dataSource = new MatTableDataSource(\r\n data.filter(\r\n (value, index, array) = > \r\n !array.filter(\r\n (v, i) = > JSON.stringify(value) == JSON.stringify(v) & & i < index\r\n ).length\r\n )\r\n )),\r\n (this.dataSource.sort = this.sort),\r\n (this.dataSource.paginator = this.paginator),\r\n countAccepted(data);\r\n countDelivered(data);\r\n });\r\n }", "639" ], [ "The purpose is to have an array with all of the unique values for a specific key from another array. Those unique values (now keys in the new array) will have as value the number of times they appear in the original array. \r\n\r\nThis is my code so far:\r\n\r\n for (let i = 0; i < data.length; i++) {\r\n \r\n \r\n let theStupidKey = data[i].DeliveryStatus;\r\n \r\n if (\r\n this.differentValuesOfStatus.indexOf(theStupidKey) == \" ;-1 \" ;\r\n ) {\r\n this.differentValuesOfStatus.push(theStupidKey: 1);\r\n // this.differentValuesOfStatus[theStupidKey].push(theStupidKey = 1);\r\n }\r\n else {\r\n this.differentValuesOfStatus[theStupidKey] = 1\r\n }\r\n }\r\n console.log(this.differentValuesOfStatus);\r\n };\r\n\r\nBut the syntax is wrong and I tried everything I could think of to make it work.\r\n\r\nBasically I&#39;m looping through an array.\r\n\r\nIf the value of the &#39;deliverystatus&#39; key does not exist in the second array, I&#39;m adding it with the value of \" ;1 \" ;.\r\n\r\nIf it already exists, I want to add another number to it.", "142" ], [ "Code: \r\n\r\n this.countSmth = _(data).groupBy(&#39;DeliveryStatus&#39;).values().map(\r\n (group) = > ({ ...group[0], qty: group.length })\r\n ), console.log(this.countSmth);\r\n\r\nI&#39;ve been experimenting with [this stackblit][1]z and all works well, giving me the desired result. However in my project the end result looks like [this(link).][2]\r\n\r\n\r\nThe HTTP response that I&#39;m using as a source looks like this:\r\n\r\n {\r\n {\r\n \" ;BookingId \" ;: \" ;VALUE \" ;,\r\n \" ;OrderNumber \" ;: \" ;VALUE \" ;,\r\n \" ;ArrivalTime \" ;: \" ;VALUE \" ;,\r\n \" ;DepartureTime \" ;: \" ;VALUE \" ;,\r\n \" ;Duration \" ;: \" ;VALUE \" ;,\r\n \" ;DeliveryStatus \" ;: \" ;Accepted \" ;\r\n }\r\n ]\r\n\r\nIn my Angular project Ive used yarn to add &#39;lodash&#39; and @types/lodash. I decided to test the same stackblitz text in the same environment and it dosn&#39;t seem to work which means I&#39;ve written it wrong there.\r\n\r\n**EDIT: I&#39;ve created an angular project and imported lodash the same. I replaced the data object that I&#39;m getting with a typed array, here:**\r\n \r\n_URL_0_\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "964" ], [ "<PERSON> that.... worked O.o wow. Now the only problem that I&#39;m having is that the new objects have all data inside them as well, not just the key that I&#39;m interested. If you have suggestions on how to map as keys just the values of the keys that I&#39;m filtering it would be great. Also if you want to post as an answer I&#39;ll be glad to mark it as the solution! Thanks!", "597" ], [ "I&#39;ve built a PWA using angular 6 and the @angular/pwa package.\r\n\r\nI&#39;ve been trying to fix this but no matter what I do, I&#39;m getting the start_url error. I have tried:\r\n\r\n - Using absolute links\r\n - Making sure the start_url is within the SW&#39;s scope (sw is in the main folder)\r\n - Using the filename \" ;/index.html \" ; as I&#39;ve seen in other support threads here.\r\n - Clearing all browser history and cache everytime.\r\n - Searching through Github issues on the @angular/pwa package\r\n - Searching google in general for this PWA issue.\r\n\r\nHere&#39;s my manifest:\r\n\r\n {\r\n \" ;name \" ;: \" ;BC Doc View \" ;,\r\n \" ;short_name \" ;: \" ;BCview \" ;,\r\n \" ;theme_color \" ;: \" ;#1976d2 \" ;,\r\n \" ;background_color \" ;: \" ;#fafafa \" ;,\r\n \" ;display \" ;: \" ;standalone \" ;,\r\n \" ;scope \" ;: \" ;/ \" ;,\r\n \" ;start_url \" ;: \" ;/ \" ;,\r\n\r\nAfter this piece of code there&#39;s just a bunch of icons, irrelevant to this post.\r\n\r\nMy configuration for the service worker: \r\n\r\n {\r\n \" ;index \" ;: \" ;/index.html \" ;,\r\n \" ;assetGroups \" ;: [\r\n {\r\n \" ;name \" ;: \" ;BC Doc View \" ;,\r\n \" ;installMode \" ;: \" ;prefetch \" ;,\r\n \" ;resources \" ;: {\r\n \" ;files \" ;: [\r\n \" ;/favicon.ico \" ;,\r\n \" ;/index.html \" ;,\r\n \" ;/*.css \" ;,\r\n \" ;/*.js \" ;\r\n ]\r\n }\r\n }, {\r\n \" ;name \" ;: \" ;assets \" ;,\r\n \" ;installMode \" ;: \" ;lazy \" ;,\r\n \" ;updateMode \" ;: \" ;prefetch \" ;,\r\n \" ;resources \" ;: {\r\n \" ;files \" ;: [\r\n \" ;/assets/** \" ;\r\n\r\nMy actual produced service worker using the ng build --prod command is 2200 lines of code so I don&#39;t think it would be relevant to post that here.\r\n\r\nHave no idea what I&#39;m missing on this one.", "7" ], [ "I have a PWA built with Angular 6 and the @angular/pwa npm package and authenticating using adal-angular4 npm package (but could just rebuild that from scratch if needed -- the issue isn&#39;t a bug in the package I think)\r\n\r\nWhen attempting to authenticate, although it does work, users are very often greeted with [this message of not found (screenshot of console but its the same).][1]\r\n\r\nThis especially seems to be the case if you are already authenticated to another (or itself) Azure AD product. Where it normally should only load for a while and then let the user in.\r\n\r\nService worker error transcript:\r\n\r\n Failed to load &#39;_URL_1_; A serviceWorker passed a promise \r\n to FetchEvent.respondWith() that rejected with &#39;Error: Response not Ok \r\n (fetchAndCacheOnce): request for _URL_0_ returned response 404 Not Found&#39;.\r\n\r\n [1]: _URL_2_", "220" ], [ "I have an Angular 6 app built with the CLI. If I export for production using ng build --prod all is good and it works although I have some bugs unrelated to this issue.\r\n\r\nHowever, if I try to use ng serve nothing works in internet explorer. It would help a lot being able to check out if the fixes have worked without having to run ng build --prod everytime I want to check something in IE.\r\n\r\nSo far: \r\n\r\n - Looked on google in gneral\r\n - Looked on stackoverflow suggestions\r\n - Looked on Github related to angular CLI\r\n - Tried a few flags like --live-reload false\r\n - Cloned the repository again and ran a fresh install of dependencies (yarn install) to make sure I&#39;m not missing things due to some conflicts or whatever.", "7" ], [ "I have a table inside a div that looks like this: \r\n\r\n < div fxLayout= \" ;row \" ; class= \" ;container \" ; fxLayoutAlign= \" ;start center \" ; > \r\n\r\nNo related CSS -- I have tried various things but in internet explorer, where I have to use polyfills for anything to work anyway, it will simply refuse to center.\r\n\r\nI&#39;ve found a similar stackoverflow thread but the alignment of the items inside the div was different and didn&#39;t really apply to my use case.", "329" ], [ "I just tried the Visual Studio Community Edition and there&#39;s a huge visible difference between the two.\r\n\r\nVS code is clearly not running over 60fps and it just makes everything look laggy and annoying on a 144hz monitor. If you get used to 144hz and that responsiveness it&#39;s quite an annoying thing.\r\n\r\nI&#39;ve googled it and tried finding people that had the same problem but not much success.", "438" ] ]
179
[ 18959, 15748, 5289, 17338, 3781, 11346, 7701, 17743, 2847, 19684, 19751, 2039, 13228, 3812, 12082, 15345, 18209, 1291, 248, 16436, 3723, 11251, 16841, 3405, 15580, 10198, 13560, 1139, 19008, 15041, 17072, 11660, 8951, 914, 8098, 10449, 5101, 9843, 1965, 17983, 3958, 2981, 10161, 7238, 3327, 7396, 1381, 12456, 11984, 6778, 11055, 13377, 5661, 19565, 14256, 2956, 12270, 322, 2640, 19508, 9724, 13303, 14081, 13668, 9992, 7454, 10096, 5773, 8260, 6255, 2128, 6341, 15950, 3304, 1906, 11355, 5466, 8895, 12655, 16468, 1399, 18195, 12937, 4726, 16859, 11667, 10566, 15092, 12263, 11163, 17164, 7705, 10638, 17942, 9660, 15940, 8753, 13692, 12119, 10867, 19254, 14056, 266, 6518, 1314, 8379, 16810, 13368, 4721, 43, 6630, 13335, 16203, 4008, 729, 963, 1414, 17560, 18559, 14211, 12089, 8259, 4070, 139, 17733, 13780, 1870, 18756, 17240, 16949, 17965, 13800, 15030, 1749, 13462, 11719, 3722, 11214, 7677, 13079, 8894, 9003, 16499, 15453, 5715, 12160, 9208, 11, 1355, 2482, 8131, 19352, 14117, 12006, 9991, 3846, 7644, 10611, 8789, 3382, 7784, 1214, 387, 3940, 14042, 1130, 12840, 13601, 8223, 7979, 9065, 17786, 16669, 4812, 18068, 6817, 18534, 17345, 5626, 18348, 5035, 13849, 14851, 3787, 9647, 14787, 10281, 19174, 15628, 1142, 639, 3586, 19685, 4253, 16969, 2096, 2197, 1804, 11836, 11542, 7880, 18000, 18606, 8772, 12536, 16899, 15849, 19522, 3858, 4329, 2836, 9748, 10114, 4330, 17230, 2107, 1423, 15014, 16315, 16897, 12105, 674, 7609, 11178, 11495, 3168, 8279, 2875, 460, 12717, 15471, 5924, 4139, 5999, 9525, 14115, 13474, 15249, 12930, 374, 9861, 1996, 3285, 2331, 6879, 5320, 9485, 4383, 11571, 626, 1664, 15151, 18177, 15839, 19570, 5250, 146, 9743, 19415, 1877, 8726, 9132, 8471, 11632, 16263, 4380, 7624, 1031, 16392, 17892, 10089, 1793, 2009, 15366, 5345, 3650, 4793, 5304, 12016, 10542, 12846, 12639, 14436, 3768, 11942, 14926, 6259, 4587, 13409, 13654, 11277, 10848, 13563, 13364, 2500, 12324, 13660, 17784, 5516, 9584, 10199, 18616, 17753, 16080, 11599, 605, 13072, 13763, 11305, 15188, 6988, 8819, 5067, 7805, 7082, 14765, 5564, 7856, 16412, 15328, 8938, 15323, 2531, 5640, 574, 2844, 11515, 13332, 17875, 17503, 13709, 12853, 11086, 17160, 529, 8917, 2164, 13863, 10401, 10680, 8250, 7423, 17495, 10461, 11453, 6213, 2206, 3868, 4833, 2613, 3531, 11661, 13808, 3900, 17659, 17704, 1740, 982, 16492, 2466, 2799, 17668, 3604, 15615, 1050, 5146, 17639, 16630, 3387, 13319, 15922, 8662, 5066, 4445, 18819, 8345, 19722, 16113, 17107, 3704, 7783, 14870, 14769, 19661, 7443, 8342, 14169, 19368, 167, 13737, 11449, 13930, 17286, 2715, 9266, 9226, 8897, 15483, 7203, 18492, 16346, 17706, 2768, 13305, 37, 8068, 8756, 12871, 17355, 14482, 13805, 9482, 11151, 10989, 3397, 14533, 12966, 9278, 232, 9399, 6924, 18414, 9262, 19463, 15382, 17582, 16832, 14233, 10570, 7089, 4707, 17187, 3440, 13637, 9635, 8638, 16092, 7378, 3429, 8880, 7271, 15105, 6904, 10834, 13854, 17842, 5950, 14242, 7043, 12985, 11385, 3630, 11669, 13427, 3143, 19100, 12095, 9996, 878, 11029, 3737, 7863, 12063, 7946, 9189, 13190, 2895, 4090, 12969, 11594, 19773, 3129, 7475, 12797, 10370, 11281, 19597, 6934, 6565, 12947, 5161, 5985, 13927, 5053, 648, 5680, 15066, 12574, 11664, 16313, 4109, 17337, 5776, 18815, 9640, 12174, 3286, 17021, 19381 ]
STX_100673.0
[ [ "I would suggest that your datasets are dependent (they have repeated observations) and the direct application of statistical test can have several underlying problems. I would not recommend to divide your dataset in such a way.\r\n\r\nAlso I would recommend to introduce Train dataset for training of your classifiers or use cross validation (it is not clear from your question if you use it or not). Otherwise you will just compare the performance of the classifier on this particular sample, not on population from which it was sampled.\r\n\r\nArea Under ROC seems appropriate measure (from the previous answer).", "960" ], [ "I undestand in general that it is important to take correlational structure into account while applying almost any statistical techniques. \r\n\r\n*First question* - could you help with the examples why it is so important and what can go wrong? For example, I have vector of correlated random variables, identically distributed. Can I wrongly reject the $H_0 : \\{sample \\in distribution\\}$ not by chance, but because of correlational structure? (i.e., reject $H_0$ much more often than 0.05 with fixed level of significance $\\alpha=0.05$). Could you explain it, using the picture (samples are 2D-vectors):\r\n\r\n[![enter image description here][1]][1]\r\n\r\n*Second question*: for example, I have two normal distributions with different means $N(0, \\sigma), N(-1, \\sigma)$. I have a sample of rows of numbers, like\r\n\r\n$$(0.1, 0.5, -0.3), (-1.2, -1.0, -0.7, -1.1), \\ldots$$\r\n\r\n$$(0.2, 0.4, -0.2, 0.1), (-1.1, -0.5, -1.0), \\ldots$$\r\n\r\n$$\\ldots$$\r\n\r\n$$ \\xi_1(i), \\xi_2(i), \\xi_3(i), \\ldots $$\r\n\r\nhere I denotes \" ;islands \" ; generated by one distribution in brackets, $i$ indicates one of the distributions (so $i$ is choosen randomly fro each $\\xi(i)$).\r\n\r\nI want to determine the borders of the islands, but I know that there is a correlational structure inside each island (may be also a correlational structure between islands, but it does not matter).\r\n\r\nHow should I deal with this problem? Let us assume that it is not enough samples to calculate the whole matrix of covariances (it will overfit the data). The initial idea is to use something like linear discriminant analysis and regularisation for it, but the borders are unknown. How can PCA help in this case? Typically, the strongest correlations arise from random variables that are neighbors in the row, so one of the possible solutions is to use block covariance matrices, but the size of one block can be large enough to cause problems with overfitting.\r\n\r\nDoes HMM takes into account the correlational structure? If so, what if I do not have a set of states (for HMM), but a continuous set of parameters for distributions, which technique is better to use?\r\n\r\n\r\n [1]: _URL_0_", "380" ], [ "Nice example, thank you. So should I represent each value with the vector of PCs? I do not understand how PCA will behave if I have such a block structure (the covariance matrix is sparse)...Regarding second question, how would you regularise the covariance matrix? Also the question that is not really connected - how to operate with large covariance matrix, for example, 100.000 x 100.000 of floats? Is there any special techniques for working with large matrices?", "380" ], [ "@FrankHarrel what can you say about $S_n$ and $Q_n$ estimators for standard deviation? Which constant should I use for estimation of $\\sigma$ using Gini&#39;s mean difference for non-normal distributions? I could not find the papers that describe the procedure of this constant&#39;s calculation in open access sources...Also I did not found any information about robustness of Gini&#39;s mean difference, could you give an idea where to search it?", "830" ], [ "> Although many times we will get the same answer whether we use the MLE\r\n > or MOM methods, sometimes it can be different, particularly for more\r\n > complex probability models. In such cases, the MLE-based estimator is\r\n > often considered the better one. The tradeoff is that finding the\r\n > maximum likelihood estimator can be more difficult, and sometimes even\r\n > require computational effort.\r\n\r\n*(Probability and Statistics for Bioinformatics and Genetics, Course Notes, <PERSON>, The Johns Hopkins University)*", "390" ], [ "I just set up Evolution 3.16.0 in Ubuntu GNOME 15.04. I have a Gmail account, two _URL_0_ accounts, and an iCloud account. All accounts work fine in Thunderbird on my Windows laptop and on my iPhone.\r\n\r\nGmail, iCloud, and one of the _URL_0_ accounts work fine in Evolution, but the other _URL_0_ account only imported some of my older emails. It also also gives the error \" ;Error fetching message headers: unexpected server response. \" ; The settings on both _URL_0_ accounts are the same in Evolution.\r\n\r\nAny advice would be greatly appreciated!", "503" ], [ "@FrankHarrel they are (briefly) described [here](_URL_0_). As I understood, Gini&#39;s mean difference have a 0 robustness, it is just \" ;a bit more close to true value in presence of outliers \" ; (may be I&#39;m wrong, but if you sample rnom(1000) and add a huge number, this estimator becomes also huge). I would like to perform, i.e., standardization using robust estimator of sd. Could you give an idea how to use the original estimator? Thank you in advance.", "830" ], [ "Sample is a realisation of vector of random variables, each variable ~ $\\mathcal N$.\r\n\r\nThe number of samples is small, the length of sample is big.\r\n\r\nI would like to perform one-class LDA (linear discriminant), interested only in outliers, but even usage of diagonal matrix of covariance seems to be an overfitting - number of estimated parameters is bigger than number of samples.\r\n\r\nIs it the case? What can be done in order to find outliers of large multivariate normal distribution and small amount of samples for estimation of parameters?\r\n\r\nI guess further regularization (after diagonalization of matrix) is useless. Could you please give some ideas how to prevent overfitting even before train/test check, only based on number of estimated parameters?\r\n\r\n=======\r\n\r\nfinally found the answer [here][1] (if somebody will be interested in this problem).\r\n\r\n\r\n [1]: _URL_0_", "960" ], [ "@FrankHarrell $S_n$ and $Q_n$ also do not square and they do not use estimation of mean, just as Gini, but they have much higher breakdown point. They are much more efficient than MAD, but less than Gini. Now I&#39;m confused what estimator is better for particular problems - Gini or $Q/S_n$...So do you use Gini only for comparison of models (as I understood, non-normalised Gini is a relative measure), and do not use use it for parameter estimation? $Q/S_n$ also have normalisation constants for $\\mathcal N$, and I wonder how to calculate constant for arbitrary distribution...", "390" ], [ "Debug mode reveals two errors, but nothing I can understand. I&#39;m surprised how different the logs are between the two accounts. The errors are: \" ;(evolution:8197): GLib-GObject-CRITICAL **: g_closure_unref: assertion &#39;closure- > ref_count > 0&#39; failed \" ; and \" ;(evolution:8197): camel-imapx-CRITICAL **: imapx_untagged_fetch: assertion &#39;found&#39; failed \n[imapx:A] Data read failed with error &#39;unexpected server response:&#39;\n[imapx:A] I/O: &#39;&#39; \n[imapx:A] Ignoring timeout error, nothing was waiting (original error: Socket I/O timed out) \" ;", "921" ], [ "Typically the one restriction on random forest is that your number of features should be quite big - the first step of RF is to choose 1/3n or sqrt(n) features to construct a tree (depending on task, regression/classification). So if you have quite a lot of features, use RF even on small dataset - there is no algorithm that works really good on small datasets so you loose nothing.", "931" ], [ "I get stuck with understanding of the following two statements (from Wikipedia [on p-values](_URL_1_)):\r\n\r\n1. > The p-value is the probability of obtaining at least as extreme results given that the null hypothesis is true whereas the significance level $\\alpha$ is the probability of rejecting the null hypothesis given that it is true.\r\n\r\n2. > If one defines a false positive rate as the fraction of all “statistically significant” tests in which the null hypothesis is actually true, several arguments suggest that this is at least about 30 percent for p-values that are close to 0.05.\r\n\r\nIt is more or less explained in the [Regina Nuzzo&#39;s 2014 Nature editorial](_URL_0_). I predefined a level of significance = 0.05, made a single test and got a p-value of 0.049. The second statement tells me that the chances that I will be able to replicate this result using another sample is not 95%, but much lower. (I think it should be dependent on prior probabilities, but the statement in wikipedia makes more general conclusion).\r\n\r\nThe questions are:\r\n\r\n1. Is the second statement correct? Does it suggest that a priori probabilities of two hypothesis are equal to 0.5?\r\n\r\n2. How to understand it intuitively?", "995" ], [ "Na&#239;ve question:\r\n\r\nI would like to use Bayesian framework for model selection. I have more than 10 models **with the same number of parameters** (just different assumptions on underlying parameters of the distribution). How to apply, for example, <PERSON> factors in this case? One-vs-all? So \r\n\r\n$H_0 = H_0$, \r\n\r\n$H_A = H_1 \\cup H_2 \\ldots \\cup H_n$, \r\n\r\ncalculate Bayes factors for $H_0$ and $H_A$ for all hypothesis and than choose the model with the highest Bayes factor as the most appropriate (or decide that none of the models are suitable)?\r\n\r\n(I would use BIC/AIC if I would have models with different sets of parameters, but I do not know any method for this problem. Maximum likelihood does not use all the information so it is not a solution).\r\n\r\nHere is the example (without priors). I would say that Posterior Probability (pp) of 0.58 is not big enough to make a decision in favour of second model and I would increase the sample size, but using ML I would choose third model (while second is true). Is the suggested procedure correct?\r\n\r\n\r\n > dataset < - rnorm(10, mean=1.0)\r\n > \r\n > first_mu = 0.0\r\n > second_mu = 1.0\r\n > third_mu = 2.0\r\n > first_likelihood = prod((dnorm(dataset, first_mu)))\r\n > second_likelihood = prod((dnorm(dataset, second_mu)))\r\n > third_likelihood = prod((dnorm(dataset, third_mu)))\r\n > first_likelihood\r\n [1] 1.370522e-10\r\n > second_likelihood\r\n [1] 2.122489e-06\r\n > third_likelihood\r\n [1] 1.492313e-06\r\n > pp1 = first_likelihood / (first_likelihood + second_likelihood + third_likelihood)\r\n > pp2 = second_likelihood / (first_likelihood + second_likelihood + third_likelihood)\r\n > pp3 = third_likelihood / (first_likelihood + second_likelihood + third_likelihood)\r\n > pp1\r\n [1] 3.791275e-05\r\n > pp2\r\n [1] 0.5871438\r\n > pp3\r\n [1] 0.4128183\r\n\r\nIf I would have dataset from dnorm(n, mean=0.5), I would choose one model using likelihood, but I can choose none of models using BFs, that&#39;s why I don&#39;t want to use ML methods.\r\n\r\n**UPD**: the similar situation is described [here][1], but I still can not figure out how to switch to BFs for several models...Can not understand how posterior probability be interpreted (again, some arbitrary threshold on posterior probability? like level of significance for hypothesis testing?)\r\n\r\n\r\n**UPD2**: [If there are more than two models to compare then we choose one of them as a reference model and calculate <PERSON><PHONE_NUMBER>\r\n > pp3\r\n [1] <PHONE_NUMBER>\r\n\r\nIf I would have dataset from dnorm(n, mean=0.5), I would choose one model using likelihood, but I can choose none of models using BFs, that&#39;s why I don&#39;t want to use ML methods.\r\n\r\n**UPD**: the similar situation is described [here][1], but I still can not figure out how to switch to BFs for several models...Can not understand how posterior probability be interpreted (again, some arbitrary threshold on posterior probability? like level of significance for hypothesis testing?)\r\n\r\n\r\n**UPD2**: [If there are more than two models to compare then we choose one of them as a reference model and calculate Bayes factors relative to that reference.][2] - that is even more strange...\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "960" ], [ "Thank you for the answer. Yes, I can rank likelihoods, but there are several issues that I have described: likelihood tells me that a hypothesis is the most appropriate among alternatives, but only likelihood ratio can tell me is one of the hypothesis is strongly preferred than any other. The rule is just an application of <PERSON> factors: we have parameter space and two hypothesis that covers all space and we need to answer the question: how big is the evidence in favour of $H_i$ against all alternatives $H_A$?", "995" ], [ "I have set of tests. It is not difficult to calculate power for each of them (I have normal distributions and know effect sizes). I would like to infer power of combination of tests.\r\n\r\nI.e., $H_0 = $ sample is ill, $H_A = $ sample is healthy. $X_1$ means temperature, $X_2$ denotes running nose, test on $X_1$ has power of $a\\%$ and test on $X_2$ has power of $b\\%$, and tests have assumptions of normality on data distributions.\r\n\r\nHow can I calculate the power of combination of two tests? (I use standard [way][1] for combined p-value calculation)\r\n\r\n\r\n [1]: _URL_0_", "1019" ], [ "I want sense a \\$20\\mathrm{kHz}\\$ PWM signal from an electronic board. I want read this signal with \" ;analogRead(A0) \" ; function on my Arduino board. Therefore, I made a 1st order low pass filter that consists a resistor, capacitor and opamp buffer. \r\n\r\nFirstly I produced a \\$20\\mathrm{kHz}\\$ PWM signal from D9 pin of my Arduino. The duty cycle of PWM signal is fading with \\$0\\mathrm{\\%}\\$ and \\$100\\mathrm{\\%}\\$ continuously. The PWM generation code:\r\n\r\n pwmWrite(led, brightness);\r\n brightness = brightness + fadeAmount;\r\n if (brightness == 0 || brightness == 255) {\r\n fadeAmount = -fadeAmount ; \r\n } \r\n\r\nAccording to my calculations, for \\$20\\mathrm{kHz}\\$ low pass filter, resistor should be \\$82\\mathrm{k\\Omega}\\$ and capacitor is \\$100\\mathrm{pF}\\$.\r\n\r\nBut I used \\$68\\mathrm{k\\Omega}\\$ resistor because don&#39;t have \\$82\\mathrm{k\\Omega}\\$. In this case cut off frequency of low pass filter is being \\$23\\mathrm{kHz}\\$. I read this signal from A0 pin with analogRead and ADC sampling. The reading code is:\r\n\r\n int c;\r\n long a;\r\n for(c=0;c < 32;c++) {\r\n pwm_deger=analogRead(A0);\r\n a += pwm_deger;\r\n }\r\n \r\n int f = a / 32;\r\n Serial.println( \" ;pwm_deger: \" ;);\r\n Serial.println(f);\r\n delay(200);\r\n\r\nI&#39;ve added the results below. The figures are scaled in 0-1023 (Arduino&#39;s ADC value)\r\n\r\n* Figure 1 shows \\$20\\mathrm{kHz}\\$ PWM signal that I want to test signal with fading from \\$0\\mathrm{\\%}\\$ to \\$100\\mathrm{\\%}\\$ duty cycle with \\$200\\mathrm{ms}\\$. \r\n\r\n* Figure 2 shows LPF signal without buffer.\r\n\r\n* Figure 3 shows LPF signal from output of opamp buffer.\r\n\r\nIs there any problem in figures? Why figure 2 shows 0.7 of 1023 and cutting after ADC value of 700. Is it because of the opamp?\r\n\r\n---\r\n###Figure 1\r\n[![Figure 1 - Test Signal][1]][1]\r\n\r\n---\r\n###Figure 2:\r\n\r\n[![Figure 2 - Output signal from LPF without buffer opamp][2]][2]\r\n\r\n---\r\n###Figure 3:\r\n\r\n[![Figure 3 - LPF output with buffer opamp][3]][3]\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_0_\r\n [3]: _URL_1_", "207" ], [ "Really naive question. I have a time series. I know how to perform segmentation (like binary segmentation algorithm). The goal is to find intervals generated from different probabilistic models.\r\n\r\nBut I have all information about possible models (distribution shape, variance, mean). So for each time point I have likelihood of each model and its prior. = > I can calculate posterior for each time point, any model and any interval.\r\n\r\nProblem: if I just segment the time series using maximum posterior probability, I will have too many change points. HMM can be a solution, but it also takes only one point into account and does not \" ;look \" ; at the whole interval. Also it is difficult to apply HMM for non-normal data.\r\n\r\nIt can be solved with sliding window, but it is not clear how to choose size of sliding window.\r\n\r\nIs there an algorithm for this type of Bayesian change point detection (when you know possible models)? Like HMM, but takes the interval into account and can work with any parametric distribution? Heuristic algorithm is good too.\r\n\r\nHow can I apply maximum likelihood clustering for this problem?\r\n\r\nUPD:\r\nSimulation of the problem:\r\n\r\n variances < - runif(1000,0.01,0.5)\r\n \r\n coverages < - c()\r\n \r\n for (i in seq(1:100)) {\r\n coverages < - c(coverages, rnorm(1, mean=0, sd=variances[i]))\r\n }\r\n \r\n for (i in seq(101:200)) {\r\n coverages < - c(coverages, rnorm(1, mean=-log(2), sd=variances[i] / 0.75))\r\n }\r\n \r\n for (i in seq(201:300)) {\r\n coverages < - c(coverages, rnorm(1, mean=log(3/2), sd=variances[i] * 0.75))\r\n }\r\n \r\n for (i in seq(301:1000)) {\r\n coverages < - c(coverages, rnorm(1, mean=0, sd=variances[i]))\r\n }\r\n \r\n plot(coverages)\r\n[![enter image description here][1]][1]\r\n\r\n\r\n [1]: _URL_0_\r\n\r\nIn real life, I know possible variances and means for each time point. I need to infer prevalence of one of the models inside the segment.", "1019" ], [ "=( unfortunately, the thing that I did not notice in the first paper: We further assume that for each partition ρ, the data within it are i.i.d. from some probability distribution. For my situation I know distribution parameters, so I can answer the question: \" ;what are parameters for time point $t$ and model $H_i$ \" ;, but the data within is not i.i.d. so distributions for time points $t$ and $t+1$ can be different even for the same model $H_i$.", "746" ], [ "I have data that is $\\mathcal{NB}$-distributed. I have only ~100 data points in one sample. I have tried to fit Negative Binomial to the data, but at first I decided to do simulations:\r\n\r\n library(MASS)\r\n vect < - rnbinom(100, size=x, mu=y)\r\n fitdistr(vect)\r\n\r\nThe accuracy of estimation of $mu$ parameter is quite high, but $size$ is estimated &#177;50 (I can provide the exact plot).\r\n\r\nWhat is better to do: to use NB with wrongly estimated $size$ (it does not influence the shape of distribution a lot) or use sqrt/log/Box-Cox and normal distribution assumption? I can windsorize normal distribution.\r\n\r\nThe goal: assume, that we have 100 sets, each element is a vector of $n$ observations, each observation is a RV ~ NB. I would like to train on this 100 sets and then classify new elements as outliers from population or normal.", "830" ], [ "I.e., the data was generated from 5 normal distributions:\r\n\r\n first < - rnorm(10000, sd=0.5)\r\n second < - rnorm(1000, mean=2, sd=1.5)\r\n third < - rnorm(800, mean=-2,sd=0.5)\r\n fourth < - rnorm(500,mean=4, sd=2)\r\n fifth < - rnorm(600, mean=-4, sd=0.25)\r\n\r\nI know number of distributions in mixture (for this case 5). What I want to do: infer means. I know dependency between means and SDs: $\\sigma = f(\\mu)$ and I know $f$. Also I know: if we have data generated from normal distribution with mean $\\mu_1$, we also have substantial amount of data generated from $-\\mu_1$ (with other SD).\r\n\r\nIs modified $k$-means clustering \" ;optimal \" ; for this problem? Or are there more sophisticated algorithms, that can be helpful?\r\n\r\nUPDATE1:\r\nLab mates told me about the package mclust. I used it and obtained \" ;good \" ; results just after cutting of everything that is between -1SD and 1SD from 0 (it did not work with original data). But I am pretty sure that the additional information can help for the performance.\r\n\r\n[![enter image description here][1]][1]\r\n\r\n\r\n [1]: _URL_0_", "830" ], [ "I think you are right about the mean of the distribution (it will be $0.15 \\cdot E(X)$), but the dependency between first moment (mean) and second (variance) ($\\lambda = \\mu = \\sigma^2$ for Poisson) is not invariant for linear transformations so the distribution of $Y$ is not Poisson anymore. You can fit Negative Binomial for $Y$, it gives you a good approximation (in case the task is to model $Y$). If you want to infer parameters (like second and other moments), it should be done directly, using distribution function.\r\n\r\nAlso you can apply <PERSON> transformation to $X$ and work with it like with normal.", "390" ], [ "I am stuck with understanding of simple chi-squared test on proportion. We have\r\n\r\n$$\\sum \\frac{(Observed_i - Expected_i)^2}{Expected_i}$$\r\n\r\nand say that it follows chi squared distribution (sum of squared standard normals). Observed ~ $\\mathcal N$ (by central limit theorem). Expected is a true parameter so it does not follow any distribution. Why this normalisation (division by Expected) leads to standardisation? After understanding this it will be clear what are the sources of the error (why this test is approximate), I would finally like to understand this.\r\n\r\nUPDATE: I have found [this question][1] and answer by @Glen_b. However, it still sounds to me like \" ;$F=ma$ because it is \" ;. I believe that it is not a standard normal, but why it is negatively dependent and why it converges to chi square?\r\n\r\n\r\nUPDATE II: [another nice answer by @Glen_b][2] tells, finally, why.\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "830" ], [ "One of the main principles of HMM is that the future state is dependent on previous state. This method is widely used for time series segmentation. However, for offline segmentation one can run HMM from past to future and from future to the past. Clearly, the results are direction-dependent (I guess even for symmetric matrix of transitions probabilities).\r\n\r\n 1. Am I right in thinking that HMM is direction-dependent? \r\n \r\n 2. If so, is there an improvement of HMM that are free of the\r\n direction bias?\r\n\r\n(Sorry for silly question, and yes, I guess it is possible to make a circle from a time series and run several HMMs with different directions, then found true breakpoints as a most supported positions, but it sounds so bad...)", "130" ], [ "Typically, it is better to remove this values, called outliers. But I would warn you not to use OLS regression in order to detect such outliers: you will probably construct the wrong model and the outliers will be probably wrong. Instead of it, use robust linear regression model and calculate standardized residuals for it (using robust estimator of standard deviation), and then remove everything that you can not expect by chance (so tune your threshold according to the sample size).\r\n\r\nThe explanation of outliers is that your data does not follow your theoretical assumptions. There can be several possible reasons: your theoretical assumptions are wrong or you have data points generated by random variable with other distribution (so you have mixture of two or more distributions with some proportion, typically, we call outliers everything that belong to the smallest proportion, so less than 50% of data are outliers). It can not be \" ;diagnosed by photo \" ;, without full understanding of what are you trying to do.", "77" ], [ "I would be glad if you help me with at least one of the questions.\r\n\r\n**General question:** there are two groups, sampled from normal distributions with only two means (one for each group) and different variances for each point. Can I increase the power of test on difference between means, taking into account information about different variances? One group is sampled from $(\\mathcal N(\\mu_a, \\sigma_1), \\ldots, \\mathcal N(\\mu_a, \\sigma_k))$, another from $(\\mathcal N(\\mu_b, \\sigma_{k+1}), \\ldots, \\mathcal N(\\mu_b, \\sigma_n))$\r\n\r\n**Particular situation:**\r\n\r\nConceptually, I have a time series and I want to find a change point.\r\n\r\nTime series is from distribution $\\mathcal N(\\mu_a, \\sigma_1), \\mathcal N(\\mu_a, \\sigma_2), \\ldots, \\mathcal N(\\mu_a, \\sigma_k), \\mathcal N(\\mu_b, \\sigma_{k+1}), \\ldots, \\mathcal N(\\mu_b, \\sigma_n)$.\r\n\r\nProblem: I do not know the moment of switch $k$, I do not know $\\mu_a$ and $\\mu_b$.\r\n\r\nHow it is typically solved: t-test or any other test on means between groups, greedy search of change point. It does not take different $\\sigma$ into account. Paired with BIC on number of change points, this method skips short segments in time series.\r\n\r\nQuestion: I have functional dependency between $\\sigma$ and $\\mu$ for each coordinate $i$ in the vector, so $\\sigma_i = f_i(\\mu)$. Can I construct more powerful test for change point detection, using this additional information?\r\n\r\nCurrent approach: use local search for change point (sliding window) and find maximum likelihood solution (greedy) for this problem. However, it is computationally expensive (I need to iterate all $\\mu$ for all positions) and not suitable for long vectors.", "1019" ], [ "I found this phrase on one of the web sites that publish reviewer&#39;s quotes (they suppose to be funny). One of the reviewers told to the authors of paper:\r\n\r\n*First, unless my statistics is failing me, a less than 1.0 SD is not significant.* \r\n\r\nI do not know the paper, but I know tags under this comment:\r\n\r\n #you were right about one thing #yes your statistics is failing you #submission\r\n\r\nWhat does it mean? As for me, reviewer told that the result is in less than 1 SD distance from the mean, that means that p-value is quite big and is not significant, so the reviewer was right, but the hash tag states the opposite.\r\n\r\nCould somebody clarify what happens here, why the reviewer&#39;s comment is so short (as for me, there is no enough information) and what does it mean?\r\n\r\n**UPD:** To whom who thinks that it is not clear what I am asking about. I am asking \" ;Is there something that I miss in the information? \" ; It happened with me once, when I heard \" ;p-value of 0.05 means that you are wrong in approx 30% of the cases \" ;. It made no sense for me at first sight, but with the help of the community I understood an important concept. Unfortunately, it did not happen for this case.", "718" ], [ "I am trying to make a series of nodes that are all connected to each other in tikz. This is an MWE:\r\n\r\n \\documentclass{standalone}\r\n \\usepackage{tikz, pgfplots}\r\n\r\n \\begin{document}\r\n \\begin{tikzpicture}\r\n \\foreach \\ip in {0, ..., 3} {\r\n \\node[draw, circle] (a\\ip) at (2*\\ip, 0) {};\r\n }\r\n\r\n \\foreach \\ip in {0, ..., 2} {\r\n \\pgfmathsetmacro{\\minp}{\\ip+1}\r\n \\foreach \\jp in {\\minp, ..., 3} {\r\n \\pgfmathsetmacro{\\ango}{10*\\jp - 10*\\ip}\r\n \\pgfmathsetmacro{\\angi}{180 - 10*\\jp + 10*\\ip}\r\n \\draw (a\\ip) to[out=\\ango, in=\\angi] (a\\jp);\r\n }\r\n }\r\n\r\n \\end{tikzpicture}\r\n \\end{document}\r\n\r\nThe result is:\r\n\r\n[![enter image description here][1]][1]\r\n\r\nExpected behaviour is that none of the lines would intersect the circle of the nodes, i.e. lines connecting the adjacent nodes should not intersect with the circles as is the case now.\r\n\r\n\r\n [1]: _URL_0_", "36" ], [ "This question is everywhere, and I looked at many answers. A lot suggest using `mysql_real_escape_string` but that isn&#39;t an option, since it&#39;s depreciated now. \r\n\r\nBeing a rookie at PHP/SQL and especially when it comes to security, I can only hope some of you may be able to help out here. I know for a fact that some of these procedures I already use contribute to security.\r\n\r\nAs an example: I didn&#39;t use `:pname` before when defining `query_params`, which caused SQL to interpret submissions like `&#39;values&#39;; drop table dbname;` as actual commands. One thing that did save me from the command not being executed is the conversion of spaces to underscores.\r\n\r\n**search_submit.php**\r\n\r\n < ?php\r\n $pname=str_replace(&#39; &#39;,&#39;_&#39;,strtolower($_GET[&#39;pname&#39;]));\r\n require &#39;connection.php&#39;;\r\n if(isset($_GET[&#39;pname&#39;])){\r\n \r\n if(preg_match( \" ;/\\w/i \" ;, $_GET[&#39;pname&#39;])){\r\n $query= \" ;SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = :pname; \" ;;\r\n $query_params = array( \r\n &#39;:pname&#39; = > str_replace(&#39; &#39;,&#39;_&#39;,strtolower($_GET[&#39;pname&#39;]))\r\n );\r\n $prep=$conn- > prepare($query);\r\n $result=$prep- > execute($query_params) or die( \" ;failed! \" ;);\r\n $row = $prep- > fetch(); \r\n if($row) \r\n { \r\n die( \" ;Exists \" ;); \r\n }\r\n else{\r\n echo( \" ;doesn&#39;t \" ;);\r\n }\r\n }\r\n }\r\n else{\r\n echo \" ; < p > Error < /p > \" ;;\r\n }\r\n ? > \r\n\r\n**index.html**\r\n\r\n < form method= \" ;get \" ; action= \" ;search_submit.php \" ; id= \" ;searchform \" ; > \r\n < input type= \" ;text \" ; name= \" ;pname \" ; > \r\n < input type= \" ;submit \" ; name= \" ;input \" ; value= \" ;Search \" ; > \r\n\r\nAs of right now everything appears to be working perfectly, and any sneaky submissions are simply interpreted as text. But I am a very paranoid person.", "768" ], [ "Thanks for these inputs. The regex checking I want because I want to make sure only letters (upper and lower) digits (0-9) spaces and underscores get through. Would using &#39;/\\d[a-zA-Z]/&#39; be a better option in that case and would it allow underscores? I want this only because it&#39;ll be impossible for those results to contain any characters besides those anyway. What I am making here is in very early development, so I was only preparing to use that variable. Thanks for the rest of the recommendations too.", "286" ], [ "When inserting a figure in my latex document at a position where the figure cannot be placed precisely (e.g. at the bottom of a page in the pdf document), Latex nevertheless inserts white space between the two paragraphs around the figure.\r\nThis is an MWE:\r\n\r\n \\newline \\lipsum[100]\r\n\r\n \\begin{figure}\r\n \\centering\r\n \\includegraphics{path/to/fig}\r\n \\caption{This is a figure.}\\label{fig:sample}\r\n \\end{figure}\r\n\r\n \\lipsum[100]\r\n\r\nThe output is shown below (the figure is placed on the following page):\r\n\r\n[![enter image description here][1]][1]\r\n\r\nInserting `\\raggedbottom` (see e.g. [this link](_URL_1_)) to the preamble already gives a smaller spacing between the paragraphs, see below (again with the figure on the next page):\r\n\r\n[![enter image description here][2]][2]\r\n\r\nHowever, I do not succeed in removing the white space entirely. How could this be solved?\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_2_", "54" ], [ "I am interested in measure of quality of robust regression.\r\n\r\nHow should I calculate it? It is clear that $r^2$ of robust regression should be smaller than $r^2$ OLS regression. Even if OLS is totally wrong and robust is right.\r\n\r\nThe question is: which feature from the set is the best predictor for the response, using robust regression as a predictive model? I know that there are several clear outliers (leverage and \" ;out-of-prediction-interval \" ; points).\r\n\r\nThe types of regression that I&#39;m interested in: 1) regression that uses loss function (such as MM or M), 2) median regression (Theil-Sen).", "77" ], [ "1) I know that my data is NB distributed. But also I know that it has several outliers (probably, zeros and extremely big numbers). How can I estimate NB?\r\n\r\nI found the trick answered [here, on CV site][1], and I agree that it is reasonable, but are there more efficient strategies? For example, for some NB simulations too many points do not satisfy the criteria $\\sqrt{(x \\in X)} > med(\\sqrt{(X)}) + 3$. Can I use package [alphaOutlier][2] in an iterative way to exclude outliers? Actually, it works...Is there something REALLY wrong?\r\n\r\n install.packages( \" ;alphaOutlier \" ;)\r\n library( \" ;alphaOutlier \" ;)\r\n s=100\r\n m=100\r\n vect < - rnbinom(100, size=s, mu=m)\r\n vect < - c(vect, 1000)\r\n vect < - c(vect, 1000)\r\n vect < - c(vect, 1)\r\n vect < - c(vect, 1)\r\n distr < - fitdistr(vect, \" ;Negative Binomial \" ;)\r\n estim_s < - distr$estimate[ \" ;size \" ;]\r\n estim_m < - distr$estimate[ \" ;mu \" ;]\r\n out < - aout.nbinom(vect, param=c(estim_s, estim_s / (estim_s + estim_m)), alpha=0.05 / length(vect))\r\n while(length(which(out$is.outlier == \" ;TRUE \" ;)) > 0) {\r\n vect < - vect[which(out$is.outlier == \" ;FALSE \" ;)]\r\n distr < - fitdistr(vect, \" ;Negative Binomial \" ;)\r\n estim_s < - distr$estimate[ \" ;size \" ;]\r\n estim_m < - distr$estimate[ \" ;mu \" ;]\r\n out < - aout.nbinom(vect, param=c(estim_s, estim_s / (estim_s + estim_m)), alpha=1 / length(vect))\r\n }\r\n out\r\n\r\n**Solved:** 2) I know that $\\xi \\sim NB(r,p)$. Can I say something about $r,p$ of ``$2 \\xi$&#39;&#39;, i.e., when the process has double intensity? I mean, for <PERSON> I can make some conclusions of $Pois(2 \\lambda)$ when I have $Pois(\\lambda)$. Can I do the same trick for $NB$?\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "821" ], [ "As for me, it is not the best way of ranking. Your means have real values, so (as I understood) C1 will always be satisfied so you will not have to apply C2 selection criteria. Also you should not forget that you have confidence intervals for means, not just point estimations of means: it can be better by chance. So I would look at more traditional ways to measure performance, such as $r^2$, and of course use cross-validation (or train/test approach). Also I would recommend to exclude several outliers that are wrongly estimated by all 4 algorithms.\r\n\r\nBut, answering the second question, I would recommend to use $Q_n$ or $S_n$. Both of them have nice properties. Somebody can recommend to use Gini&#39;s means difference, but it has 0 breakdown point (but it is somewhat \" ;robust \" ; and also has a lot of good properties). As for C1, I would recommend to use Lehman-Hodges estimator.", "1019" ], [ "Using sd you measure the fit to model $y = \\alpha$, where $\\alpha$ denotes mean. I do not understand why do you need determination scores and why you just can not apply $r^2$ or Bland-Altman plots without \" ;determination scores \" ;. I do not what it is since I do not know statistical term with this name, but I assume that you used some heuristical approach to obtain this scores. Why can not you just compare performance of algorithm with the truth without this scores?", "610" ], [ "Correct me if I am wrong. Univariate analysis will make over-segmentation for sure. I see that mean of data points remain constant during the time. \r\n\r\n**Unsupervised way:** What if you model the distribution based on all data points of the time series, than choose a resolution of your algorithm (size of sliding window), then (based on your distribution) construct a statistic (similar to chi-squared statistic which can be constructed from squared normal distributions) and then detect windows that have a statistic value lower than 5% quantile of your distribution? I mean, left-sided test (that will mean that data points within sliding window fit your distribution extremely good, so they are close to the mean). You can do it online, but the accuracy for the first data points will be extremely low.\r\n\r\n**Supervised way:** Also you can label windows of fixed size for plateaus manually and create a distribution for them and consider all deviations from this multivariate distribution as \" ;not a plateaus \" ;. Also you may construct 2 distributions (with manual labelling of regions) and consider likelihood ratio as a measure.\r\n\r\nThese are standard approaches, may be not really sophisticated. For online recognition I would recommend to feed your classifier with the first $n$ data points to train it (you need to have at least some estimations) or use algorithm that can do backwards and re-analyse the first data points.", "1019" ] ]
335
[ 1273, 10219, 6644, 5579, 16434, 19337, 2203, 654, 4697, 14890, 13816, 3191, 7237, 3842, 15684, 7675, 5464, 14842, 8594, 334, 8617, 19729, 15715, 5150, 9876, 18036, 1756, 19298, 13490, 882, 12310, 293, 6807, 4301, 6063, 4343, 16209, 15011, 16545, 1806, 17068, 2898, 10237, 3215, 6803, 14035, 1113, 4076, 17999, 13769, 3927, 71, 17102, 7083, 17757, 2973, 14258, 10186, 1481, 4734, 7076, 951, 5140, 13160, 12342, 7586, 7133, 18227, 10194, 1228, 12224, 14840, 7075, 2780, 8163, 10906, 3561, 663, 5610, 11981, 11202, 11343, 1520, 42, 10871, 18723, 17507, 3980, 15523, 12266, 13413, 16718, 7741, 5052, 2880, 11944, 11293, 18956, 4397, 4768, 11367, 10996, 6407, 6288, 8463, 14833, 50, 5679, 18428, 4524, 18811, 13920, 1505, 14728, 7814, 15709, 11522, 8526, 10224, 15563, 14107, 12827, 1129, 9395, 2269, 18609, 12256, 8504, 11170, 13334, 15283, 3090, 5397, 5383, 8116, 12515, 16995, 8986, 128, 17685, 13679, 14971, 14304, 10634, 601, 4071, 3801, 15635, 19688, 3884, 11517, 867, 19001, 18969, 8290, 3564, 7539, 13643, 3352, 17912, 17192, 8126, 16644, 5809, 14439, 8555, 846, 4745, 19128, 17364, 8376, 15988, 10994, 10653, 18317, 7657, 16290, 1569, 4031, 18330, 7559, 10140, 18186, 8340, 12028, 16568, 14949, 7310, 12531, 2425, 11035, 7923, 15901, 12239, 17947, 11746, 3474, 19452, 7509, 2551, 13848, 6090, 14831, 18304, 11068, 16651, 2537, 4183, 4680, 10723, 1829, 17157, 19302, 1210, 11681, 13073, 10809, 5197, 9942, 2580, 3543, 7174, 1024, 14811, 19397, 3271, 11284, 8502, 1889, 15677, 4201, 9882, 3668, 8829, 802, 16541, 16547, 11083, 4770, 14055, 3486, 18149, 16974, 10491, 4171, 10557, 9402, 1080, 2360, 6066, 15859, 4104, 5622, 4148, 19225, 12958, 17044, 1029, 14549, 1043, 13578, 10023, 14484, 11760, 7259, 9055, 16768, 12101, 8473, 14631, 12265, 18359, 4743, 15034, 9632, 10241, 10794, 16652, 4857, 2569, 9697, 4119, 13361, 18449, 1391, 2449, 2767, 13521, 8278, 15349, 7307, 4450, 4917, 15853, 12686, 198, 15669, 12571, 8039, 16112, 12033, 17297, 18835, 2631, 10707, 2650, 19338, 1364, 4038, 9322, 8618, 12131, 8535, 3425, 4048, 14485, 12746, 5958, 18333, 3167, 5407, 8734, 2037, 707, 18531, 12205, 13452, 13967, 1045, 4371, 5821, 10745, 10305, 9735, 19099, 1238, 12292, 12377, 3043, 18006, 5063, 16494, 12681, 4937, 5088, 1048, 6357, 19010, 4923, 2167, 1976, 4467, 18309, 14660, 15756, 13151, 14812, 18153, 9585, 3137, 18928, 18765, 10984, 17785, 2178, 15394, 13277, 7915, 12213, 6590, 11289, 16646, 8407, 11817, 8626, 11873, 17280, 15744, 2781, 15886, 9327, 4141, 16756, 5001, 18608, 8576, 960, 16843, 2645, 1358, 13861, 10358, 12727, 17762, 11932, 5997, 708, 1634, 9783, 3765, 8191, 14699, 14288, 15622, 9160, 113, 1580, 424, 4796, 15017, 8157, 9794, 17341, 19655, 11401, 5013, 10104, 17575, 19012, 7891, 9360, 11204, 12037, 18296, 12977, 14420, 16524, 12625, 3578, 15983, 14305, 8760, 3575, 17472, 2757, 12875, 14620, 17956, 15264, 8378, 318, 9282, 6825, 14938, 8026, 15130, 523, 12905, 12014, 18477, 6339, 12528, 4202, 6491, 8749, 15581, 5228, 7034, 15077, 19433, 18093, 8568, 18791, 4536, 7806, 15760, 3567, 9856, 11612, 5775, 5327, 5286, 15255, 2238, 5385, 5258, 3100, 18575, 18340, 18053, 11393, 12539, 4460, 4509, 8847, 7940, 2107, 15193, 17086, 8607, 19768, 11089, 12824, 7332, 1334, 16549, 15578, 3896, 1064 ]
STX_10067555.0
[ [ "Thanks for the Collada specs resource. Right now, I&#39;m just working with one file, so my parser doesn&#39;t need to be super inclusive of every part of the collada schema. Do you know how a rig controls a mesh, or to better phrase it: once the controller data is parsed, how does a computer graphics application manipulate a mesh using that controller data.", "753" ], [ "For instance, in the following snippet:\r\n\r\n float roll = (float)Math.atan2(sinr, cosr);\r\n\r\nMath.atan2 returns a double, so I cast it to a float. However, most functions I&#39;ve used are returning of type double, which makes it sort of tedious that I have to cast so frequently, which made me think I&#39;m using the library wrong. I need my data in type float to work with other classes that also utilize floats. \r\n\r\nI&#39;m wondering why there aren&#39;t multiple versions of the Math functions to cast doubles to floats, which allow floats to be returned instead of doubles (if needed). I understand why the math shouldn&#39;t be directly in floating point, but the library seems inflexible to programmers who are working exclusively with floating point.\r\n\r\n **Why does the library mostly return of type double?**", "192" ], [ "In C#, I use the SerialPort **Read** function as so:\r\n\r\n byte[] buffer = new byte[100000];\r\n int bytesRead = serial.Read(buffer, 0, 100000);\r\n\r\nIn Processing, I use **readBytes** as so:\r\n\r\n byte[] buffer = new byte[100000];\r\n int bytesRead = serial.readBytes(buffer);\r\n\r\nIn Processing, I&#39;m getting the incorrect byte values when I loop over the buffer array from the **readBytes** function, but when I just use the regular **read** function I get the proper values, but I can&#39;t grab the data into a byte array. What am I doing wrong in the Processing version of the code that&#39;s leading me to get the wrong values in the buffer array? \r\n\r\nI print out the data the same way in both versions:\r\n\r\n for(int i=0; i < bytesRead; i++){ \r\n println(buffer[i]); \r\n }\r\n\r\nC# Correct Output:\r\n[![enter image description here][1]][1]\r\nProcessing Incorrect Output:\r\n[![enter image description here][2]][2]\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "863" ], [ "You need to make a **class** for your character, which needs an **update** and **draw** function. In the update function, when input such as WASD is received you can switch the image of the sprite. If you don&#39;t have a sprite sheet, you&#39;ll have to load multiple images and switch between them.\r\n\r\nHere&#39;s some ruby pseudocode to help you:\r\n\r\n @back_image = Gosu<IP_ADDRESS>Image.new( \" ;media/images/back.png \" ;)\r\n @front_image = Gosu<IP_ADDRESS>Image.new( \" ;media/images/front.png \" ;)\r\n @left_image = Gosu<IP_ADDRESS>Image.new( \" ;media/images/left.png \" ;)\r\n @right_image = Gosu<IP_ADDRESS>Image.new( \" ;media/images/right.png \" ;)\r\n current_image = front_image\r\n\r\nThis goes in your update function:\r\n\r\n if up\r\n current_image = back_image\r\n elsif down\r\n current_image = front_image\r\n elsif right\r\n current_image = right_image\r\n elsif left\r\n current_image = left_image\r\n end\r\n\r\nThen in your draw function all you need to do is \r\n\r\n def draw\r\n @current_image.draw(@character_location_X, @character_location_Y, 1)\r\n end\r\n\r\nThis is a pretty basic way, but if you use a sprite sheet, you can create your own animation class that Gosu can use that allows you to select between certain ranges of frames of your character spritesheet.", "85" ], [ "I create a Quaternion (w, x, y, z) using input from an IMU device. I then normalize the quaternion and find the euler angles based on this conversion code from quaternion to euler angles:\r\n\r\n private PVector setEulerAngles(){\r\n \r\n // roll: x-axis rotation\r\n float sinr = 2.0f * (w*x + y*z);\r\n float cosr = 1.0f - 2.0f * (x*x + y*y);\r\n float roll = (float)Math.atan2(sinr, cosr);\r\n \r\n // pitch: y-axis rotation\r\n float sinp = 2.0f * (w*y - z*x);\r\n float pitch = 0.0f;\r\n if(Math.abs(sinp) > = 1){\r\n pitch = (float)Math.copySign(Math.PI/2, sinp);\r\n } else {\r\n pitch = (float)Math.asin(sinp);\r\n }\r\n \r\n // yaw: z-axis rotation\r\n float siny = 2.0f * (w*z + x*y);\r\n float cosy = 1.0f - 2.0f * (y*y + z*z);\r\n float yaw = (float)Math.atan2(siny, cosy);\r\n \r\n return new PVector(roll, pitch, yaw);\r\n }\r\n\r\nI then apply the ZYX rotation within Processing. However, to orient my 3D object I have to flip the z and y values, and negate the y value for the z-rotation. I also had to create an offset of (PI/2) for rotateY, so my object faces the right direction. The object perfectly rotates around the x and y axis, but along the z-axis the object rotates in the right directions, but will flip suddenly. Is there a simple solution to get the object rotating properly around the z-axis? \r\n\r\n pushMatrx();\r\n translate(pos.x, pos.y, 0);\r\n rotateZ(-q.eulerAngles.y);\r\n rotateY(q.eulerAngles.z+(PI/2));\r\n rotateX(q.eulerAngles.x);\r\n shape(model);\r\n popMatrix();", "1010" ], [ "I fixed it flipping the camera around and flipping the model. I really appreciate your help on this. I only took linear algebra and intro to computer graphics, so working with quaternions is new to me. **Before, when I was using Euler angles with ZYX rotation was the reason it suddenly flipped on the z rotation, because of gimbal lock?** Last thing, do you recommend any book on computer graphics and mathematics?", "1010" ], [ "You can use a successor function that also looks for the best option of the available nodes to search through. I&#39;m referring to the A* search algorithm here. Eventually, as the path explores further away if the longer path is taken, the heuristic value will get worse until the other path with a better heuristic value is taken instead. A* is implemented useing a priority queue, which is harder to implement than BFS or DFS (which use a standard stack and queue), but A* can be quite useful for certain graphs that are more complicated. That said, BFS and DFS are faster and simpler to implement.", "238" ], [ "First, make sure that your object file has the reference to your `.mtl` file. For instance, here are the first few lines of an object file exported from Blender:\r\n\r\n # Blender v2.79 (sub 0) OBJ File: &#39;&#39;\r\n # _URL_0_\r\n mtllib lefthand.mtl\r\n o RobotHand_Cube.017\r\n v -<PHONE_NUMBER> -<PHONE_NUMBER>\r\n ...\r\n ...\r\n\r\nIn the 3rd line, the material file is referenced: `mtllib lefthand.mtl`. A common error happens when people rename their files and forget to change this reference to match the new names.", "414" ], [ "Create a set function in your player class and local variable called current_room. Pass in the global variable current_room with the function, set_room(current_room), so the player class has a reference to the room it&#39;s in. you&#39;re getting the error, because current_room can&#39;t be detected from within the player class, so that&#39;s why you need to pass it to the player. For instance, every time you switch rooms you call set_room for the player to get the correct room.", "466" ], [ "Here&#39;s a very simple Processing program that rotates a cube around the x-axis. In Processing, the box function&#39;s parameters are for the size of the box, but not the location. So in order to move the box I translate it; however, I want to know how to be able to move the box wherever, but rotate around another point. In this case, let&#39;s say I want to rotate the box around (0,0,0) instead of the translated point, how should I do that?\r\n \r\n float rot = 1;\r\n PShape model;\r\n void setup(){\r\n size(500,500,P3D);\r\n }\r\n \r\n void draw(){\r\n background(0);\r\n translate(width/2, height/2);\r\n rotateX(rot);\r\n rot+=.005;\r\n box(40);\r\n //shape(model);\r\n }", "1010" ], [ "I looked around a little more and found a good resource on the Processing forum answered by the user <PERSON>: _URL_0_\r\n\r\nThis program depicts different examples of rotating objects. The last example (of the blue cube) at the bottom depicts how to create an object that rotates around another point:\r\n\r\n float myAngle=-90; // degree measurement\r\n \r\n void setup () {\r\n // Init\r\n // 3D requires P3D or OPENGL as a parameter to size()\r\n size (600, 600, P3D);\r\n }\r\n \r\n void draw () {\r\n // repeated continously\r\n background(22);\r\n // switch on lights \r\n lights();\r\n // color for lines\r\n stroke(111);\r\n // \r\n // Box: A box with equal dimension on all sides is a cube.\r\n // red: in a distance around Y-axis\r\n pushMatrix();\r\n rotateY(radians(myAngle));\r\n translate(158, 148, -10); \r\n fill (color(242, 2, 2)); // red\r\n box(40); // only one parameter: box(size);\r\n popMatrix();\r\n // \r\n // Box: A box with equal dimension on all sides is a cube.\r\n // green: around itself \r\n pushMatrix();\r\n translate(258, 448, -10); \r\n rotateY(radians(myAngle));\r\n fill (color(2, 222, 2)); // green\r\n box(40); // only one parameter: box(size);\r\n popMatrix();\r\n //\r\n // Box: A box with equal dimension on all sides is a cube.\r\n // blue: around the green box\r\n translate(258, 0, 0); \r\n pushMatrix();\r\n rotateY(radians(myAngle));\r\n translate(158, 448, -10); \r\n fill (color(2, 2, 222)); // blue\r\n box(40); // only one parameter: box(size);\r\n popMatrix();\r\n // \r\n myAngle+=3; // speed\r\n if (myAngle > =360) {\r\n myAngle=0; // keep in degree\r\n }\r\n //\r\n }\r\n\r\n\r\n [1]: http://", "1010" ], [ "I&#39;m creating a Processing library that needs an object and material file stored in the data folder. Here is the file system:\r\n\r\n nameOfLibFolder\r\n - library (jar)\r\n - data (obj/mlt)\r\n\r\nWhen I create my library I have the main folder and within the library folder (contains the jar file) and data folder with the assets (obj/mtl files). When I import my library it can use my classes and functions (so it works), but it can&#39;t find the object file. \r\n\r\nThe Processing built-in loadShape function is supposed to read in the model, but it only reads in the file if the data folder is placed in the same directory as the sketch, so how does a library import the data folder automatically into a sketch so I don&#39;t get an error loading the file.", "225" ], [ "I found a workaround by just accessing the data folder directly. I&#39;m not sure how many people have come across this problem before, but loadShape was trying to load from the local data directory in the sketch folder instead of the data folder in the libraries sketchbook. \r\n\r\nSo just access the data directory from your library directly to get it working.", "347" ], [ "So I have `.pde` file and several `.java` files that are used in a project. I import the library as so into a `.java` file:\r\n\r\n import processing.serial.*;\r\n\r\nWhen I import the Processing serial library in the `.pde` file it works fine, but when I import the Processing serial library into a `.java` file I get this error:\r\n\r\n > The package \" ;processing.serial \" ; does not exist. You might be missing a\r\n > library\r\n > \r\n > Libraries must be installed in a folder named &#39;libraries&#39; inside the\r\n > sketchbook folder (see the Preferences window).\r\n\r\nDo I need to install the library to be able to use it with a `.java` file or is there another solution to import the Processing serial library into a `.java` file?", "741" ], [ "Yes, but you&#39;ll notice when going through Sketch > Import Library, Serial is already there and if you look up Serial in the \" ;Add Library.. \" ; window you won&#39;t find the correct library. The serial library is located in the processing folder when downloaded in the modes\\java\\libraries\\serial folder, so it does not need to be downloaded. It does need the import lines in both .pde and .java though.", "225" ], [ "I wrote this function in Ruby to find the target angle between two 2D (x,y) vectors, but now I want to find out how to do this in 3D in a similar way:\r\n\r\n def target_angle(point1, point2)\r\n x1 = point1[0]\r\n y1 = point1[1]\r\n x2 = point2[0]\r\n y2 = point2[1]\r\n delta_x = x2 - x1\r\n delta_y = y2 - y1\r\n return Math.atan2(delta_y, delta_x)\r\n end\r\n\r\nGiven an object (like a bullet in this case), I can shoot the object given a target_angle between the player (x,y) and the mouse (x,y), as such in the bullet update function:\r\n\r\n def update\r\n wall_collision\r\n # the angle here is the target angle where point 1 is the player and\r\n # point 2 is the mouse\r\n @x += Math.cos(angle)*speed\r\n @y += Math.sin(angle)*speed\r\n end\r\n\r\nIs there a similar method to calculate a target angle in 3D and use that angle in a similar manner as my update function (to shoot a bullet in 3D)? How can I make this work for two 3D vectors (x, y, z), where you have the player position (x,y,z) and some other arbitrary 3d point away from the player.", "834" ], [ "I&#39;ve looked over several of these questions for Windows and C# in general. I see some answers, where ManagementObjectSearcher is used, but as far as I know Unity doesn&#39;t have System.Management.dll by default, which is okay, because I&#39;d rather use another way if possible (I know you can manually add it, but I&#39;d prefer to use a different method). \r\n\r\nThis question below is similar to mine, but the answer uses System.Management and as a back-up tests every COM on the `SerialPort.GetPortNames()` list. I don&#39;t like that the back-up test needs to create new SerialPorts every time to test whether a device is connected or not. It just seems inefficient to check every COM port. This is the question and answer:\r\n\r\n_URL_0_\r\n\r\nOn Mac/Linux, it&#39;s fairly simple to look up a device in /dev/ folder, and find the proper device for both USB and bluetooth and get the proper port name to use when creating a new SerialPort:\r\n\r\n string[] ttys = _URL_1_.Directory.GetFiles( \" ;/dev/ \" ;, \" ;tty.* \" ;);\r\n // iterate over list looking for device by name for usb and bluetooth\r\n\r\nIs there a similar method in Windows to get a list of current devices connected to a Windows machine and their COM ports, without using System.Management or checking every single COM individually for feedback?\r\n\r\nAn ideal solution would be to lookup the devices on Windows without using System.Management.", "637" ], [ "I have RayCast represented by a LineRenderer in Unity, so it looks like a laser. I want this laser to move objects it collides with so that the object follows the `hit.point` of the Raycast hit.\r\n\r\nMy code doesn&#39;t work, because I move these GameObjects to the `hit.point`, which causes the object to comes towards the start point of the Raycast, because a new `hit.point` gets calculated since the object is moving to `hit.point`. I understand why this is happening, but I&#39;m not sure how to get the object to move with the Raycast, but not effect a new hit.point.\r\n\r\nHere&#39;s my update function in my script attached to my Laser GameObject. **Does anyone know how I can fix my code so that the object moves with the hit.point?**\r\n\r\n void Update()\r\n {\r\n Vector3 target = calculateDeltaVector();\r\n lr.SetPosition(0, palm.transform.position);\r\n RaycastHit hit;\r\n if (Physics.Raycast(palm.transform.position, target , out hit))\r\n {\r\n if (hit.collider)\r\n {\r\n lr.SetPosition(1, hit.point);\r\n if (hit.transform.gameObject.tag == \" ;Chair \" ;)\r\n {\r\n GameObject chair = hit.transform.gameObject;\r\n // !!! move object to hit point, problem HERE\r\n chair.transform.position = hit.point;\r\n hitLock = false;\r\n }\r\n }\r\n \r\n }\r\n else lr.SetPosition(1, target * 50);\r\n }", "85" ], [ "When a particle is emitted I wanted to calculate the rotation of the particle. Right now, I&#39;m updating the entire particle system to rotate towards a certain direction, which means particles already emitted will switch directions until they die if the particle system rotates.\r\n\r\nThis is my rotate function (in the script attached to the particle system) that updates the particle system.\r\n\r\n void lookAtTarget()\r\n {\r\n Vector3 lookPos = fingerAim.transform.position - transform.position;\r\n Quaternion lookRotation = Quaternion.LookRotation(lookPos);\r\n transform.rotation = Quaternion.Slerp(transform.rotation, lookRotation, Time.deltaTime * 10.5f);\r\n }\r\n\r\nUpdate function:\r\n\r\n void Update {\r\n transform.position = player.transform.position;\r\n lookAtTarget();\r\n }\r\n\r\nBasically, I want to apply `lookAtTarget` once when the particle is first emitted. Is there anyway how to do this in Unity", "1010" ], [ "I have a model with joints that individual shapes rotate around. The model is translated to the center. The matrix applied with `applyMatrix()` is a rotation matrix based on a quaternion value so it can rotate around without gimbal lock. \r\n\r\nBut then I want to translate and rotate around a JOINT point, which uses an offset of the model, so I can find that point, because it&#39;s just `model.x/y/z + offset.x/y/z`. However, this doesn&#39;t take into consideration the rotation from `applyMatrix()`, but I want to be able to calculate where the Joint point `(x,y,z)` is at whatever rotation it&#39;s in.\r\n\r\n < !-- language: java -- > \r\n\r\n translate(width/2, height/2, 0);\r\n applyMatrix(m[1][1],m[1][2],m[1][0],0,\r\n m[2][1],m[2][2],m[2][0],0,\r\n m[0][1],m[0][2],m[0][0],0,\r\n 0,0,0,1);\r\n pushMatrix();\r\n // rotate around this joint point\r\n translate(offsetX, offsetY, offsetZ);\r\n // !!!!\r\n // WHAT is the new x,y,z right here??\r\n // !!!!\r\n rotate(amt);\r\n translate(-offsetX, -offsetY, -offsetZ);\r\n shape(component)\r\n popMatrix();", "1010" ], [ "So I have an abstract Geo class that represents 3D geometric shapes, so it has inherited fields such as Vector positions and abstract methods, like update and display.\r\n\r\nSince my Cube class inherits from this Geo class, I don&#39;t re-declare my fields, and I just set them in the constructor for the Cube class. I didn&#39;t get an error originally when I didn&#39;t inherit from Geo and declared the fields in the Cube class.\r\n\r\nHowever, I noticed when I try to see if the Field exists it throws this error:\r\n\r\n java.lang.NoSuchFieldException: boundBox\r\n\r\nThis is the Reflection code that checks for the field (the object is a Cube object):\r\n\r\n try {\r\n Field field = object.getClass().getDeclaredField( \" ;boundBox \" ;);\r\n } catch(Exception e){\r\n e.printStackTrace();\r\n }\r\n\r\nSo again, I don&#39;t re-declare the \" ;boundBox \" ; field, because I already declared it in the Geo abstract class. Here&#39;s the basic portion of my abstract class and child class:\r\n\r\n abstract class Geo {\r\n public Vector pos;\r\n public BoundingBox boundBox;\r\n \r\n abstract void update();\r\n abstract void display();\r\n }\r\n \r\n class Cube extends Geo {\r\n public Cube(Vector pos, float dim){\r\n this.pos = pos; \r\n boundBox = new BoundingBox(pos,dim);\r\n }\r\n @Override\r\n void update(){\r\n }\r\n @Override\r\n void display(){\r\n }\r\n }", "6" ], [ "I found that I could access the field utilizing Reflection methods and cast to the object I needed. This is supported using an abstract class with this field so that all objects inheriting from this object can utilize this function. \r\n\r\n public < T > void setPosition(T object) {\r\n Field xField = object.getClass().getField( \" ;x \" ;);\r\n Field boxField = object.getClass().getField( \" ;boundBox \" ;);\r\n float xpos = (float)xField.get(object);\r\n BoundingBox box = (BoundingBox)boxField.get(object);\r\n }\r\n\r\nI&#39;m open to critique, but this has been working very well with my multiple classes inheriting from my abstract base class. The reason for this method, is for another class to work with these other classes without creating multiple functions, thus giving flexibility for a user who wants to create their own classes inheriting from the abstract class.", "145" ], [ "**Background Context:** \r\n\r\nI have a non-generic class that represents a complex 3D model. I also have a series of standard 3D geometric classes (Sphere, Cube, Cuboid) that all inherit from an abstract class so all the child classes inherit the same fields and functions. So each class needs to be able to work with the Complex 3D model class, which doesn&#39;t inherit from the abstract class (it doesn&#39;t have the need for the same fields/functions). \r\n\r\nSo I want to use all of the child classes with the complex model class. Specifically, one child class can work with complex model when needed by the user, so this will be saved as a field to this class for as long as the user needs it. The complex class will need to access fields and functions from these objects, so I thought using a generic function could apply to all the simple 3D mesh classes that have the same fields/functions.\r\n\r\n**Question**\r\n\r\nLet&#39;s say I have a non-generic class where I want a field of that class to be a generic type. I want the non-generic class to be able to handle a variety of user-created types.\r\n\r\nI want a generic method inside the non-generic class that can set the generic field, like this:\r\n\r\n void < T > setGenericObject(T object){\r\n genericField = object;\r\n }\r\n\r\nHowever, I don&#39;t know how to declare the generic field properly. I don&#39;t want to create a generic class just for one small field of it (since working with other objects is only a small part of the functionality of that class). How would I properly declare this genericField variable inside my class for this to work?", "801" ], [ "I have a BoundingBox class that I&#39;ll provide below. It works for moving objects, but not rotating ones, meaning that if I rotate the object that utilizes the boundingBox the boundingBox has no way to calculate the lower and upper points based on the 3x3 rotation matrix that&#39;s used to rotate the object around.\r\n\r\nRight now, the `update` function is used to set the new position and recalculate the new lower and upper points. \r\n\r\nI have a 3x3 rotation matrix saved in a 2D float array, but I don&#39;t know how to recalculate the new lower and upper points based on rotation matrix. Is there an efficient way to this? \r\n\r\n class BoundingBox {\r\n \r\n float x, y, z, w, h, d;\r\n float minX, minY, minZ;\r\n float maxX, maxY, maxZ;\r\n \r\n BoundingBox(PVector pos, PVector dim){\r\n x = pos.x;\r\n y = pos.y;\r\n z = pos.z;\r\n w = dim.x;\r\n h = dim.y;\r\n d = dim.z;\r\n \r\n // calculate lower and upper points\r\n calculateMinMax();\r\n }\r\n \r\n void update(PVector pos){\r\n x = pos.x;\r\n y = pos.y;\r\n z = pos.z;\r\n calculateMinMax();\r\n }\r\n \r\n void calculateMinMax(){\r\n // lower point\r\n minX = x - w/2;\r\n minY = y - h/2;\r\n minZ = z - d/2;\r\n // upper point\r\n maxX = x + w/2;\r\n maxY = y + h/2;\r\n maxZ = z + d/2;\r\n }\r\n \r\n boolean intersects(BoundingBox b) {\r\n return (minX < = b.maxX & & maxX > = b.minX) & & \r\n (minY < = b.maxY & & maxY > = b.minY) & & \r\n (minZ < = b.maxZ & & maxZ > = b.minZ);\r\n }\r\n \r\n }", "1010" ], [ "I have a parent class that has a declared unique ModelType object, which also has child classes. Each Child class has a unique modeltype so I want the reference variable \" ;model \" ; to be the same across all the child classes, so the variable can be referenced. However, after initializing the modeltype to whatever child object, my function throws an error, because the type isn&#39;t the ModelType, but rather Cuboid or Pyramind in this case (one of the children). \r\n\r\nThere&#39;s probably a better way to do this than creating a Parent and setting it to the child. How can I have a reference variable in the parent class that can be set to multiple types? In other words, the variable \" ;model \" ; needs to be different types.\r\n\r\n class Parent {\r\n ModelType model;\r\n }\r\n \r\n class ChildOne extends Parent {\r\n model = new Cuboid();\r\n void float vertices(Pyramid c){\r\n // ... stuff ...\r\n }\r\n }\r\n \r\n class ChildTwo extends Parent {\r\n model = new Pyramid();\r\n \r\n void float vertices(Pyramid c){\r\n // ... stuff ...\r\n }\r\n }\r\n\r\nI get an error when using vertices when passing the \" ;model \" ; of another ChildTwo to that class where:\r\n\r\n The function vertices(ModelType) doesn&#39;t exist\r\n \r\n\r\n ChildTwo a = new ChildTwo();\r\n ChildTwo b = new ChildTwo();\r\n a.vertices(b.model);", "901" ], [ "I created a Java plugin that utilizes the UsbManager devices to communicate with a specified serial device. I&#39;m using Android Studio to run the plugin and can write to the proper device, but I don&#39;t understand how to integrate my code with Unity. I pass the Context in the constructor so I can create the UsbManager, but I don&#39;t know how to this in Unity or if there&#39;s another way to get the Context.\r\n\r\nWhat&#39;s the proper way to pass the Context from Unity to my plugin? I&#39;m also not sure if my function is working in Unity, because I don&#39;t know if permissions are needed for USB as well in the manifest file.\r\n\r\nUnity Code:\r\n\r\n void Start()\r\n {\r\n ajc = new AndroidJavaObject( \" ;com.bebopsensors.dg.USBController \" ;);\r\n int connected = ajc.Call < int > ( \" ;startUSB \" ;);\r\n }\r\n\r\nJava Code:\r\n\r\n public class USBController {\r\n \r\n private Context context;\r\n private static final String ACTION_USB_PERMISSION = \" ;com.bebopsensors.dg.USB_PERMISSION \" ;;\r\n private final int BAUD_RATE = 19200;\r\n \r\n private int bytesRead;\r\n private byte[] readBuffer;\r\n private UsbManager usbManager;\r\n private UsbDeviceConnection connection;\r\n private UsbSerialDevice serial;\r\n private UsbDevice dg = null;\r\n \r\n public USBController(Context context){\r\n this.context = context;\r\n }\r\n \r\n public int startUSB(){\r\n //usbManager = (UsbManager) context.getSystemService(context.USB_SERVICE);\r\n HashMap < String, UsbDevice > deviceList = usbManager.getDeviceList();\r\n UsbDevice dg = null;\r\n \r\n if(deviceList.size() == 0){\r\n return -2;\r\n }\r\n // 1st and only device\r\n dg = deviceList.values().iterator().next();\r\n \r\n if(dg != null){\r\n PendingIntent pi = PendingIntent.getBroadcast(context, 0, new Intent(ACTION_USB_PERMISSION), 0);\r\n usbManager.requestPermission(dataglove, pi);\r\n UsbDeviceConnection connection = usbManager.openDevice(dataglove);\r\n \r\n UsbSerialDevice serial = UsbSerialDevice.createUsbSerialDevice(dg, connection);\r\n serial.open();\r\n serial.setBaudRate(BAUD_RATE);\r\n serial.setDataBits(UsbSerialInterface.DATA_BITS_8);\r\n serial.setStopBits(UsbSerialInterface.STOP_BITS_1);\r\n serial.setParity(UsbSerialInterface.PARITY_NONE);\r\n serial.setFlowControl(UsbSerialInterface.FLOW_CONTROL_OFF);\r\n serial.read(callback);\r\n } else {\r\n return -1;\r\n }\r\n return 0;\r\n }\r\n \r\n private UsbSerialInterface.UsbReadCallback callback = new UsbSerialInterface.UsbReadCallback() {\r\n @Override\r\n public void onReceivedData(byte[] data) {\r\n bytesRead = data.length;\r\n readBuffer = data;\r\n }\r\n };", "637" ], [ "Within the startUSB function, I use serial to write a byte array message to signal the device to turn on. This will also turn on an LED, but in Unity it never gets to the write point, which makes me think my class wasn&#39;t loaded correctly or something is wrong before I call the function in Unity. In Unity, the app runs, but no read data is being received from the device and the device never gets the write message.", "637" ], [ "I have a device that can connect via usb and bluetooth, but the ready message that sends to this device varies if it&#39;s bluetooth or usb.\r\n\r\nThe ready message is sent as a byte array where the 2nd element varies, where 0x01 is for USB and 0x02 is for Bluetooth.\r\n\r\n Serial serial = Serial(s, Serial.list()[0], BAUD_RATE);\r\n byte[] message = new byte[3];\r\n byte[0] = 0x01;\r\n byte[0] = 0x01; // 0x02 for bluetooth\r\n byte[0] = 0x12;\r\n serial.write(message);\r\n\r\nI want to make my code work dynamically depending on what the user is using, so if usb doesn&#39;t work then bluetooth is tested, and if that doesn&#39;t work an error message is printed. \r\n\r\nI was looking around, but couldn&#39;t find any way to detect if the COM port is bluetooth or not in Processing. Is there a reliable way to test for this in Processing?", "920" ] ]
304
[ 17820, 10873, 2482, 12427, 10515, 3362, 11207, 14472, 15554, 18888, 10266, 8131, 14629, 5848, 1895, 11113, 5489, 4646, 10354, 9080, 2848, 11942, 15948, 9991, 4457, 3886, 17315, 13982, 13789, 11904, 18876, 14233, 8415, 13329, 3055, 2613, 12514, 12988, 10851, 14648, 17673, 148, 7692, 10484, 14400, 11442, 13692, 8819, 12863, 626, 8579, 17471, 6516, 16544, 11556, 18686, 17095, 12261, 803, 11389, 4178, 555, 13474, 8571, 6879, 1031, 11955, 19333, 13834, 15331, 2435, 9848, 12162, 17466, 14787, 2906, 4339, 11641, 16755, 4118, 10567, 8353, 51, 13979, 10697, 12407, 4007, 8662, 15930, 224, 4684, 10729, 675, 14539, 4830, 16852, 17724, 1904, 13802, 6082, 696, 13564, 13190, 14236, 15892, 17761, 16527, 9059, 19346, 10833, 3624, 11495, 16680, 4653, 13654, 5431, 13866, 9635, 8259, 13725, 15160, 2986, 5803, 16832, 6817, 11599, 4899, 6058, 9406, 10436, 17735, 10096, 11998, 17361, 10350, 15736, 7629, 3836, 5180, 16630, 450, 4870, 3251, 15880, 15024, 14706, 14117, 11411, 13227, 7301, 13884, 3143, 15286, 12849, 16361, 4631, 13348, 5833, 13605, 14717, 17606, 11309, 7667, 15168, 17733, 11924, 12684, 9647, 13527, 18068, 2875, 8959, 12785, 7717, 12933, 16906, 14468, 10659, 18534, 13974, 13368, 1642, 14112, 3430, 11402, 6112, 6159, 16731, 5582, 9957, 5516, 10667, 19508, 11983, 1514, 17469, 4103, 13284, 182, 19735, 15385, 13295, 3459, 13729, 13500, 6681, 3338, 1151, 16499, 14264, 8763, 16621, 18986, 15915, 10291, 11349, 210, 12073, 57, 5573, 12985, 18281, 9223, 14115, 17443, 11032, 2289, 8970, 12456, 7325, 5387, 12752, 11126, 13206, 19765, 10445, 5297, 10050, 13398, 13872, 14733, 1984, 16715, 11787, 7701, 9743, 100, 12060, 12851, 10660, 3440, 6518, 17498, 18756, 12560, 639, 14056, 3764, 1985, 8478, 4954, 11664, 8091, 19661, 14319, 5455, 12007, 10053, 15566, 18843, 8424, 10638, 12673, 8379, 9137, 16841, 15950, 11660, 13894, 14618, 1980, 5776, 13678, 11009, 15274, 14775, 5494, 15319, 9766, 8845, 12631, 17864, 1647, 17531, 12442, 3940, 8072, 7835, 16436, 14730, 12231, 7450, 9347, 4515, 15492, 1663, 15258, 3422, 9044, 346, 13125, 15620, 12656, 12627, 13865, 5365, 13563, 12105, 14938, 5891, 18559, 18255, 9691, 13969, 11616, 2844, 6813, 2970, 17933, 12082, 9990, 11086, 2194, 15308, 4685, 6612, 4823, 13659, 6341, 3527, 14911, 13312, 10064, 16180, 3722, 3118, 10370, 18326, 19085, 8223, 17659, 7353, 4008, 10198, 5565, 1553, 16810, 15005, 12061, 8068, 1209, 11667, 14653, 12794, 1780, 10131, 16927, 14643, 14335, 8561, 14081, 9188, 13913, 5792, 11055, 17866, 14448, 12949, 13023, 10782, 7517, 14187, 9356, 10764, 14275, 11322, 13276, 16571, 19165, 6133, 3607, 5316, 13927, 11542, 16389, 6055, 14817, 18038, 1742, 15104, 19428, 183, 10642, 17194, 3629, 13327, 18122, 17140, 18648, 6528, 11755, 1054, 6213, 16349, 11056, 6609, 12667, 3309, 7281, 489, 15685, 8779, 13606, 10161, 12846, 1433, 17085, 446, 2268, 11115, 19684, 13601, 13201, 13808, 19777, 12121, 11407, 9584, 8486, 17748, 17357, 18244, 17460, 5909, 12478, 844, 11017, 16377, 11133, 5179, 13780, 982, 12250, 17203, 16634, 17439, 5624, 18438, 17332, 5988, 9738, 9103, 8953, 17071, 4418, 18414, 11234, 15849, 14646, 3108, 4806, 15121, 14656, 15728, 16388, 16128, 13849, 11703, 9526, 8337, 19431, 15391, 13534, 12799, 12056, 17753, 4920, 11226, 15156, 17639, 17506, 3680, 9010, 16492, 7295, 4127, 9403, 15082, 1731 ]
STX_10067658.0
[ [ "I have a job site where initially only job titles and business addresses are shown and when a user clicks a job title the details of the job are shown, when the user clicks another job the first job details are hidden and the second are shown. This is done with:\r\n\r\n $(document).ready(function(){\r\n \t\t$( \" ;.job_link \" ;).click(function(){\r\n \t\t $( \" ;.job_description \" ;).hide();\r\n $(this).parents(&#39;.job&#39;).find( \" ;.job_description \" ;).show();\r\n \t\t});\r\n \t});\r\n\r\nBut when a user clicks a job title the view is always reloaded to the top of the screen. How can I focus the view on the job title they clicked on?\r\n_URL_0_", "793" ], [ "I have a job site where a user enters a zip code into a form and a list of jobs matching that zip code is displayed \r\nsearch.html : \r\n\r\n < h6 > Results: {{ number_of_results }} < /h6 > \r\n \r\n {% for job in jobs_matching_query %}\r\n \r\n < h2 > < a class= \" ;job_link \" ; href= \" ;# \" ; > {{ job.job_title}} < /a > < /h2 > \r\n < p class= \" ;job_address lead \" ; > {{ job.establishment_name }} - {{ job.address }} < /p > \r\n \r\n {% endfor %}\r\n \r\n < form action = \" ;{% url &#39;email_subscription&#39; %} \" ; > \r\n < p > Subscribe to recieve job alerts near {{ query }}: < /p > < !-- query stores zip code-- > \r\n < input type= \" ;text \" ; name= \" ;email \" ; placeholder= \" ;Email \" ; > \r\n < button class= \" ;btn \" ; type= \" ;submit \" ; > Subscribe < /button > \r\n < /form > \r\n \r\nThe search form is handled by the following view (not sure if I need to include this or not):\r\n\r\n def job_query(request):\r\n if request.method == \" ;GET \" ;:\r\n query = request.GET.get(&#39;query&#39;)\r\n jobs_matching_query = Job.objects.filter(zip_code__iexact = query) | Job.objects.filter(city__iexact=query) | Job.objects.filter(state__iexact=query)\r\n number_of_results = 0\r\n for job in jobs_matching_query:\r\n number_of_results = number_of_results + 1\r\n return render(request, &#39;core/search.html&#39;, {&#39;query&#39;: query ,&#39;jobs_matching_query&#39;: jobs_matching_query, &#39;number_of_results&#39;: number_of_results})\r\n\r\nOn that search.html I have an email subscription box (subscribe to recieve alerts for that particular zip code), is there a way to pass the value of `query` from that page to an `email_subscription` view? I believe I&#39;ve seen this done in the url so here is the url for said view \r\n\r\n url(r&#39;^email_subscription$&#39;, views.email_subscription, name= \" ;email_subscription \" ;),", "190" ], [ "I am following a tutorial on _URL_4_, to accept a charge it says to use the following form and capture the `Token` it returns in a view\r\n\r\nStripe \" ;Checkout \" ; form:\r\n\r\n < form action= \" ;{% url &#39;payment&#39; %} \" ; method= \" ;POST \" ; > \r\n < script\r\n src= \" ;_URL_3_; class= \" ;stripe-button \" ;\r\n data-key= \" ;pk_test_z1bxF7Bk4Rk9PZuBFHMrYZnj \" ;\r\n data-amount= \" ;999 \" ;\r\n data-name= \" ;Demo Site \" ;\r\n data-description= \" ;Example charge \" ;\r\n data-image= \" ;_URL_2_;\r\n data-locale= \" ;auto \" ; > \r\n < /script > \r\n < /form > \r\n\r\nThe next step says to simply copy and paste this and your test account should be able to accept charges\r\nStripe view:\r\n\r\n def payment(request):\r\n # Set your secret key: remember to change this to your live secret key in production\r\n # See your keys here: _URL_1_\r\n stripe.api_key = \" ;sk_test_BJUliYkgS5VZEKFM1UQAz9cF \" ;\r\n \r\n # Token is created using Checkout or Elements!\r\n # Get the payment token ID submitted by the form:\r\n token = _URL_0_[&#39;stripeToken&#39;]\r\n \r\n charge = stripe.Charge.create(\r\n amount=999,\r\n currency=&#39;usd&#39;,\r\n description=&#39;Example charge&#39;,\r\n source=token,\r\n )\r\n\r\nbut `stripeToken` is mentioned nowhere in the form and the code returns an error because of this, can someone explain where this is coming from? (Note, the example was in Flask so I changed `token = request.form[&#39;stripeToken&#39;] # Using Flask` to `token = _URL_0_[&#39;stripeToken&#39;] #using Django`\r\n\r\nBoth of these can be found at https://_URL_4_/docs/quickstart (Step 1 shows &#39;Checkout&#39;, step 2 shows the python code) Thanks in advance for any help.", "835" ], [ "I am trying to get the eye color of this image to change when a button is clicked. The entire svg is included in the jsfiddle link but here is the element I am trying to target:\r\n\r\n < ellipse class= \" ;eye-color \" ; fill= \" ;#1b6811 \" ; stroke= \" ;#000000 \" ; stroke-width= \" ;0 \" ; stroke-dasharray= \" ;null \" ; stroke-linejoin= \" ;null \" ; stroke-linecap= \" ;null \" ; cx= \" ;274 \" ; cy= \" ;285 \" ; rx= \" ;31 \" ; ry= \" ;35 \" ;/ > \r\n\r\ncss:\r\n\r\n .eye-color{\r\n fill: blue;\r\n }\r\n\r\njs:\r\n\r\n $(document).ready(function(){\r\n $( \" ;button \" ;).click(function(){\r\n $( \" ;.eye_color \" ;).css(&#39;fill&#39;, &#39;red&#39;);\r\n });\r\n });\r\n\r\n\r\n_URL_0_\r\n\r\n\r\nThis code is not working, thanks for any help.\r\n\r\nEdit: Just noticed the tag &#39;jquery-svg&#39;, is this plugin required to manipulate svg images with jQuery?", "662" ], [ "I have a job site where a list of jobs titles are displayed, when a title is clicked certain elements set that were previously set to `display: \" ;none \" ;` are shown using the jquery `show()` function. How can I hide these elements again when a new job title is clicked on? So that one appears to collapse when a new job is expanded? link to larger jsfiddle: _URL_0_ but I believe included the most important parts of code below\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n < body > \r\n \t\t < div class= \" ;job \" ; > \r\n < h2 > < a class= \" ;job_link \" ; href= \" ;# \" ; > Accountant - ABC Bank < /a > < /h2 > \r\n < p class= \" ;start_hidden job_p \" ; > Lorem ipsum dolor sit amet, consectetur adipisicing elit. Consectetur corporis dolor eius facere laboriosam libero minima necessitatibus nobis nulla, officiis optio quis tempore vel. Exercitationem harum ipsum perspiciatis unde voluptate! < /p > \r\n < p class= \" ;start_hidden \" ; > salary: 12 < /p > \r\n < /div > \r\n \t\t < div class= \" ;job \" ; > \r\n < h2 > < a class= \" ;job_link \" ; href= \" ;# \" ; > Doctor - XYZ Hosptial < /a > < /h2 > \r\n < p class= \" ;start_hidden job_p \" ; > Lorem ipsum dolor sit amet, consectetur adipisicing elit. Consectetur corporis dolor eius facere laboriosam libero minima necessitatibus nobis nulla, officiis optio quis tempore vel. Exercitationem harum ipsum perspiciatis unde voluptate! < /p > \r\n < p class= \" ;start_hidden \" ; > salary: 12 < /p > \r\n < /div > \r\n \t\t < div class= \" ;job \" ; > \r\n < h2 > < a class= \" ;job_link \" ; href= \" ;# \" ; > Teacher - ABC School < /a > < /h2 > \r\n < p class= \" ;start_hidden job_p \" ; > Lorem ipsum dolor sit amet, consectetur adipisicing elit. Consectetur corporis dolor eius facere laboriosam libero minima necessitatibus nobis nulla, officiis optio quis tempore vel. Exercitationem harum ipsum perspiciatis unde voluptate! < /p > \r\n < p class= \" ;start_hidden \" ; > salary: 12 < /p > \r\n < /div > \r\n\r\n < /html > \r\n\r\n\r\n\r\njs (used to so far only show previously hidden elements):\r\n\r\n $(document).ready(function(){\r\n \t$( \" ;.job_link \" ;).click(function(){\r\n $(this).parents(&#39;.job&#39;).find( \" ;.start_hidden \" ;).show();\r\n \t});\r\n });\t\r\n\r\ncss: \r\n\r\n .start_hidden{\r\n display: none;\r\n }", "993" ], [ "I am trying to put a `border` and `background-color` behind a form, but when I try to do so, the form is set to the right and I am not sure which piece of my code is doing this.\r\n\r\nHere is an example: _URL_1_ , please ignore the django code - I figured I would leave those elements in the example in case they were the source of my problem.\r\n\r\nHere is an example of what I would want it to look like: _URL_0_ (not exactly, but the form is centered).\r\n\r\nCan anyone figure out why my form is being set to the right like that?", "329" ], [ "Summary: `while (1000000000 < = 0) #1 billion` is being tested.\r\nIs this too high of a value for an integer to be tested in Python or is my code(below) not executing the while loop for some other reasons?\r\n\r\nI am trying to determine how long it would take to spend a billion dollars by spending $100/second while the money is also earning 1% interest per year:\r\n\r\n currentAmount = 1000000000 # 1 billion\r\n \r\n MONEY_SPENT_PER_SECOND = 100\r\n \r\n days = 1 #up to 365\r\n \r\n INTEREST_RATE_PER_DAY = .01 / 365\r\n \r\n SECONDS_IN_DAY = 86400\r\n \r\n MONEY_SPENT_PER_DAY = SECONDS_IN_DAY * 100 # $8,640,000\r\n \r\n interestEarnedToday = 0\r\n \r\n while(currentAmount < = 0):\r\n print( \" ;In loop \" ;) #test to see if code is in loop, but this does not get printed\r\n interestEarnedToday = INTEREST_RATE_PER_DAY * currentAmount\r\n currentAmount = currentAmount + interestEarnedToday\r\n currentAmount = currentAmount - MONEY_SPENT_PER_DAY\r\n days = days + 1\r\n\r\nBut the while loop is never entered and I am not sure why? As `print(currentAmount)` outputs `1000000000` so I feel like this indicates that python can handle integers this large. Thanks for any help.", "512" ], [ "Summary: I am using jquery to apply an `active` class that adds a `&#39;border-bottom&#39;` to the the link the user is currently viewing. But, the individual links `border-bottom` is displaying a few pixels above the `navbar&#39;`s `border-bottom`.You can see this by expanding the runtime window here: \r\n_URL_0_ \r\n\r\nHTML:\r\n\r\n < nav class= \" ;navbar navbar-expand-lg navbar-light \" ; > \r\n < a class= \" ;navbar-brand left-most-link \" ; href= \" ;{% url &#39;index&#39; %} \" ; > LOGO < /a > \r\n < button class= \" ;navbar-toggler \" ; type= \" ;button \" ; data-toggle= \" ;collapse \" ; data-target= \" ;#navbarSupportedContent \" ; aria-controls= \" ;navbarSupportedContent \" ; aria-expanded= \" ;false \" ; aria-label= \" ;Toggle navigation \" ; > \r\n < span class= \" ;navbar-toggler-icon \" ; > < /span > \r\n < /button > \r\n \r\n \r\n < div class= \" ;collapse navbar-collapse \" ; id= \" ;navbarSupportedContent \" ; > \r\n < ul class= \" ;navbar-nav ml-auto \" ; > \r\n < li class= \" ;nav-item active \" ; > \r\n < a class= \" ;nav-link right-link \" ; href= \" ;# \" ; > Job Search < span class= \" ;sr-only \" ; > (current) < /span > < /a > \r\n < /li > \r\n < li class= \" ;nav-item \" ; > \r\n < a class= \" ;nav-link right-link right-most-link \" ; href= \" ;{% url &#39;employer_signup&#39; %} \" ; > Post a Job < span class= \" ;sr-only \" ; > (current) < /span > < /a > \r\n < /li > \r\n \r\n \r\n < /nav > \r\n\r\njQuery:\r\n \r\n\r\n $(document).ready(function(){\r\n $(&#39;li&#39;).click(function(){\r\n $(&#39;li&#39;).removeClass(&#39;active&#39;);\r\n $(this).addClass(&#39;active&#39;);\r\n })\r\n \r\n });\r\n\r\nCSS:\r\n\r\n nav{\r\n border-bottom: 2px solid #eeeeee;\r\n }\r\n .right-link{\r\n \r\n }\r\n .right-most-link{\r\n margin-right: 30px;\r\n }\r\n \r\n .left-most-link{\r\n margin-left: 30px;\r\n }\r\n .active{\r\n border-bottom: 1px solid black;\r\n }", "908" ], [ "For example I have a large image relatively positioned under the navbar:\r\n\r\n #nav{\r\n height: 75px;\r\n width: 100%;\r\n position: fixed;\r\n top: 0;\r\n z-index: 1;\r\n border-bottom: 1px solid white;\r\n background-color: white;\r\n border-bottom: 2px solid #eeeeee;\r\n }\r\n #main_image{\r\n position: relative;\r\n top: 75px; /*height of #nav*/\r\n width: 100%;\r\n height: 700px;\r\n }\r\n #content{\r\n position:relative;\r\n top: 48px;\r\n }\r\n\r\nbut now that I have positioned the prior two elements, everything else below it is out of place. Part of `#content` is being covered by the image which led to me setting:\r\n\r\n #content{\r\n position:relative;\r\n top: 48px;\r\n }\r\n\r\nto get it to fully show. This is an obnoxious way of doing this and I feel there is probably a better way. Is there anything in css that can tell an element to &#39;position itself directly below the element above it&#39; so that the `#content` would naturally be displayed after the `#main_image`?", "455" ], [ "For example I have fixed nav, is there a way to anchor the list items to the bottom of the nav? I attempted to give the list items a fixed position too but this messes up their layout as you can see at [fiddle][1]\r\n\r\nhere is my code:\r\n\r\n < !-- begin snippet: js hide: false console: true babel: false -- > \r\n\r\n < !-- language: lang-css -- > \r\n\r\n #nav{\r\n height: 75px;\r\n width: 100%;\r\n position: fixed;\r\n top: 0;\r\n z-index: 1;\r\n border-bottom: 1px solid white;\r\n background-color: #157FFB;\r\n border-bottom: 2px solid #eeeeee;\r\n }\r\n \r\n \r\n \r\n #nav > ul{\r\n list-style: none;\r\n margin: 0;\r\n }\r\n #nav > ul > li{\r\n display:inline;\r\n \r\n /*these two lines were my attempt at anchoring the list items to the bottom f the #nav, but it throws everything out of wack*/\r\n position: fixed; \r\n top:45px;\r\n }\r\n\r\n < !-- language: lang-html -- > \r\n\r\n < div id= \" ;nav \" ; > \r\n < ul > \r\n < li class= \" ;align_left \" ; > < a href= \" ;# \" ; > LOGO < /a > < /li > \r\n < li class= \" ;align_right \" ; > < a href= \" ;# \" ; > Repairs/Upgrades < /a > < /li > \r\n < li class= \" ;align_right \" ; > < a href= \" ;# \" ; > Networking < /a > < /li > \r\n < li class= \" ;align_right \" ; > < a href= \" ;# \" ; > Remote Backups < /a > < /li > \r\n < li class= \" ;align_right \" ; > < a href= \" ;# \" ; > Data Recovery < /a > < /li > \r\n < /ul > \r\n < /div > \r\n\r\n\r\n < !-- end snippet -- > \r\n\r\nAny suggestions on how this can be done?\r\n\r\n\r\n [1]: _URL_0_", "329" ], [ "I am trying to add a \" ;show results within X miles of zip code \" ; filter to my django site. I am using a file with all US zip codes in the format `ZIP,LATITUDE,LONGITUDE\\n` (_URL_0_), I plan on having a function get the user entered zip code, get the lat and long of that zip code from this file and then run some calculations to find all zip codes within a certain distance. My question is about the most efficient way to do this. Is saving this long file as a .txt, storing it on a server and having my website access this file and run these commands on the fly when a user uses the filter the best way of doing this? Will this cause a long load time?", "295" ], [ "yes, I&#39;m attempting to get a working version of a job site going to gain traction so probably very little users at first. I&#39;ve already handled everything but this zip code filter I would like to add. Do you think I should create a `ZipCode` model with the fields `zip_code`, `latitude` and `longitude` then fill this database using the file at _URL_0_) and then make queries from there?", "1012" ], [ "I have a file with every zip code in the US and its respective latitude and longitude. The file format is \" ;ZIP/LAT/LNG\\n \" ; I am going to save each of those values to a database. So I wrote the following code to test if I could properly split the values: \r\n\r\n zip_code_file = open(&#39;zipcode.rtf&#39;)\r\n for s in zip_code_file.read().split(&#39;,&#39;):\r\n print(s)\r\n\r\nBut this prints\r\n \" ;00602 \" ;\r\n \" ;18.361945 \" ;\r\n \" ;-67.175597\\ \" ;\r\n\r\nHow can I remove that &#39;\\&#39; from the longitude so I can properly save the number to my database? I tried the following, but it did not work:\r\n\r\n for s in zip_code_file.read():\r\n if s == &#39;\\\\&#39;:\r\n s.replace(&#39;\\]&#39;, &#39;&#39;)\r\n print(s)", "782" ], [ "I have a file with all zip codes in the US with their latitude and longitude. The file is in the format `ZIP,LAT, LONG\\n`. \r\n\r\nI plan on saving these to a database, so I have looped through the file word by word and set a `counter` variable. If the `counter == 1` it should assign the value to `zip_codes[]` if `counter == 2` assign the value to `latitude[]` and if `counter == 3` assign the value to `longitude[]`, but when I run the following code to test if it properly added the zip code values it becomes an infinite loop and I have to force quit IDLE \r\n\r\n(file can be viewed at [here](_URL_0_))\r\n\r\n zip_code_file = open(&#39;zip_codes.txt&#39;)\r\n zip_codes=[]\r\n latitude=[]\r\n longitude = []\r\n counter = 1\r\n for s in zip_code_file.read().split(&#39;,&#39;):\r\n s = s.strip()\r\n if counter ==1: \r\n zip_codes.append(s)\r\n counter = counter +1\r\n elif counter == 2:\r\n latitude.append(s)\r\n counter = counter+1\r\n elif counter == 3:\r\n longitude.append(s)\r\n counter = 1\r\n print(zip_codes)\r\n\r\nanyone know whats going on here?", "598" ], [ "Summary of probelm: I have a file with all zip codes in the US, the file is in the format \" ;ZIP,LATITUDE,LONGITUDE\\n&#39; I would like to save each line as a model instance of:\r\n\r\n class ZipCode(models.Model):\r\n zip_code = models.CharField(max_length=7)\r\n latitude = models.DecimalField(decimal_places=6, max_digits =12)\r\n longitude = models.DecimalField(decimal_places=6, max_digits =12)\r\n\r\nwithout having to enter each manually by hand as this would take forever.\r\n\r\nMy attempt at a solution:\r\nWriting a view to handle this one time task does not seem like the best way to do this, but it is all I could think of, so I tried the following:\r\n\r\n def update_zipcodes(request):\r\n zip_code_file = open(&#39;zip_codes.txt&#39;)\r\n\r\n #lists to hold zip code, longitude and latitude values:\r\n zip_codes = []\r\n latitude = []\r\n longitude = []\r\n\r\n for line in zip_code_file.readlines():\r\n #example line \" ;00601,18.180555, -66.749961 \" ;\r\n zipcode, lat, lng = line.strip().split(&#39;,&#39;)\r\n zip_codes.append(zipcode)\r\n latitude.append(lat)\r\n longitude.append(lng)\r\n \r\n #convert lat and long to floats\r\n latitude = [float(i) for i in latitude]\r\n longitude = [float(i) for i in longitude]\r\n \r\n counter = 0\r\n for item in zip_codes:\r\n zip_code_object = ZipCode(zip_code=zip_codes[counter],latitude=latitude[counter],longitude=longitude[counter])\r\n zip_code_object.save()\r\n counter= counter+1\r\n \r\n return HttpResponse(&#39;working&#39;)\r\n\r\nand it returned `cannot find file &#39;zip_codes.txt&#39;` even though I put this file in the same folder as views. Clearly I don&#39;t know how to accomplish the goal at hand. Is there anyway to go about connecting to my database and uploading the values as specified? (original values can be seen at _URL_0_ , I copied and pasted this into zip_codes.txt)", "714" ], [ "I am trying to run a one time management command to pre-populate a db.\r\n\r\nHere is the model:\r\n\r\n class ZipCode(models.Model):\r\n zip_code = models.CharField(max_length=7)\r\n latitude = models.DecimalField(decimal_places=6, max_digits =12)\r\n longitude = models.DecimalField(decimal_places=6, max_digits =12)\r\n\r\nand here is the management command:\r\n\r\n from django.core.management.base import BaseCommand\r\n from core.models import ZipCode\r\n \r\n class Command(BaseCommand):\r\n def populate_db(self):\r\n zip_code_object = ZipCode(zip_code=&#39;10566&#39;, latitude = 10.2, longitude= 43.4) #test data to see if I could get it working\r\n ZipCode.save(self)\r\n \r\n def handle(self, *args, **options):\r\n self.populate_db()\r\n\r\nBut when I run `python3.6 _URL_0_ populate_zip_code_db` it returns \r\n\r\n File \" ;/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/db/models/_URL_1_ \" ;, line 741, in save\r\n for field in self._meta.concrete_fields:\r\n AttributeError: &#39;Command&#39; object has no attribute &#39;_meta&#39;\r\n\r\nDoes anyone know how to get this working? I just discovered management commands so I am clueless.", "34" ], [ "I understand that django comes with a `User` model built in and the following code works and properly saves a user to the db, I just don&#39;t understand *why* it works:\r\n\r\n from django.shortcuts import render\r\n from django.http import HttpResponse\r\n from .forms import UserCreationForm\r\n \r\n def index(request):\r\n if request.method == \" ;POST \" ;:\r\n form = UserCreationForm(_URL_0_)\r\n if form.is_valid():\r\n user = form.save()\r\n return HttpResponse(&#39;Saved&#39;)\r\n else:\r\n form = UserCreationForm()\r\n return render(request, &#39;core/index.html&#39;, {&#39;form&#39;:form})\r\n\r\nwhat is the line `form = UserCreationForm(_URL_0_)` saying? is the `(_URL_0_)` the contents of the submitted form? and how does `user = form.save()` save a user to the database? I was thinking that maybe the variable had to be named `user` for django to recognize it as a `User` object but this is not the case as I changed the statement to `test = form.save()`\r\nand it still saved a `User` to my database.", "34" ], [ "I&#39;m trying to implement a `reddit`-like voting system using `jquery`/`ajax`. How can I pass the object `id` of each individual `Post` with the click of the button?\r\n\r\n {% for post in posts %}\r\n < h2 > {{ post.title }} < /h2 > \r\n {{ post.upvotes }} < button type= \" ;submit \" ; > Upvote < /button > \r\n {{ post.downvotes }} < button id= \" ;downvote \" ; type= \" ;submit \" ; > Downvote < /button > \r\n {% endfor %}\r\n \r\n < script > \r\n # Somehow need to distinguish between upvote/downvote and include object id\r\n $(?).click(function () {\r\n var id = id\r\n $.ajax({\r\n url: &#39;/ajax/upvote/&#39;,\r\n data: {\r\n &#39;id&#39;: id\r\n }\r\n });\r\n });\r\n < /script >", "72" ], [ "How do I retrieve and use the data passed to view via **ajax/jquery**? In this example I&#39;m trying to implement a reddit like upvote/downvote system\r\n\r\nhtml/js:\r\n\r\n {% for post in posts %}\r\n < h2 > {{ post.title }} < /h2 > \r\n {{ post.upvotes }} < button data-id= \" ;{{_URL_0_}} \" ; data-vote= \" ;up \" ; class= \" ;vote \" ; type= \" ;submit \" ; > Upvote < /button > \r\n {{ post.downvotes }} < button data-id= \" ;{{_URL_0_}} \" ; data-vote= \" ;down \" ; class= \" ;vote \" ; id= \" ;downvote \" ; type= \" ;submit \" ; > Downvote < /button > \r\n {% endfor %}\r\n \r\n < script > \r\n $( \" ;.vote \" ;).click(function () {\r\n var id = $(this).data( \" ;id \" ;); //get data-id\r\n var vote_type = $(this).data( \" ;vote \" ;); //get data-vote\r\n };\r\n $.ajax({\r\n url: &#39;/ajax/upvote/&#39;,\r\n data: {\r\n &#39;id&#39;: id,\r\n &#39;vote_type&#39;:vote_type,\r\n }\r\n });\r\n < /script > \r\n\r\n_URL_1_:\r\n\r\n url(r&#39;^ajax/upvote/$&#39;, views.upvote, name=&#39;upvote&#39;),\r\n\r\nview:\r\n\r\n def upvote(request):\r\n #how do i use &#39;id&#39; and &#39;vote_type&#39; values here?", "72" ], [ "I&#39;m reading an AJAX tutorial at _URL_0_. Their examples uses php and I only know django. I got most of the conversion done myself but would greatly appreciate someone helping with the rest.\r\n\r\nHere is the php, I think I get down to the `foreach` block without having trouble:\r\n \r\n\r\n < ?php\r\n // Array with names\r\n $a[] = \" ;<PERSON> \" ;;\r\n $a[] = \" ;<PERSON> \" ;;\r\n $a[] = \" ;<PERSON> \" ;;\r\n $a[] = \" ;<PERSON> \" ;;\r\n $a[] = \" ;<PERSON> \" ;;\r\n $a[] = \" ;<PERSON> \" ;;\r\n $a[] = \" ;<PERSON> \" ;;\r\n $a[] = \" ;<PERSON> \" ;;\r\n $a[] = \" ;<PERSON> \" ;;\r\n $a[] = \" ;<PERSON> \" ;;\r\n $a[] = \" ;<PERSON> \" ;;\r\n $a[] = \" ;<PERSON> \" ;;\r\n $a[] = \" ;<PERSON> \" ;;\r\n $a[] = \" ;<PERSON> \" ;;\r\n $a[] = \" ;<PERSON> \" ;;\r\n $a[] = \" ;<PERSON> \" ;;\r\n $a[] = \" ;<PERSON> \" ;;\r\n $a[] = \" ;<PERSON> \" ;;\r\n $a[] = \" ;<PERSON> \" ;;\r\n $a[] = \" ;<PERSON> \" ;;\r\n $a[] = \" ;<PERSON> \" ;;\r\n $a[] = \" ;<PERSON> \" ;;\r\n $a[] = \" ;<PERSON> \" ;;\r\n $a[] = \" ;<PERSON> \" ;;\r\n $a[] = \" ;<PERSON> \" ;;\r\n $a[] = \" ;<PERSON> \" ;;\r\n $a[] = \" ;<PERSON> \" ;;\r\n $a[] = \" ;<PERSON> \" ;;\r\n $a[] = \" ;<PERSON> \" ;;\r\n $a[] = \" ;<PERSON> \" ;;\r\n \r\n // get the q parameter from URL\r\n $q = $_REQUEST[ \" ;q \" ;];\r\n \r\n $hint = \" ; \" ;;\r\n \r\n // lookup all hints from array if $q is different from \" ; \" ; \r\n if ($q !== \" ; \" ;) {\r\n $q = strtolower($q);\r\n $len=strlen($q);\r\n foreach($a as $name) {\r\n if (stristr($q, substr($name, 0, $len))) {\r\n if ($hint === \" ; \" ;) {\r\n $hint = $name;\r\n } else {\r\n $hint .= \" ;, $name \" ;;\r\n }\r\n }\r\n }\r\n }\r\n\r\nAnd here is my python code so far:\r\n\r\n def nameSuggestion(request):\r\n #list of names\r\n names = [ \" ;<PERSON> \" ;, \" ;<PERSON> \" ;, \" ;<PERSON> \" ;]\r\n \r\n #get letters type from URL\r\n q = request.GET.get( \" ;q \" ;)\r\n \r\n #will hold name suggestion\r\n hint = \" ; \" ;\r\n \r\n #lookup all hints from &#39;names&#39; if hint is not \" ; \" ;:\r\n if q!= \" ; \" ;:\r\n q = q.lower()\r\n q_length = len(q)\r\n for character #I get confused at this part???", "762" ], [ "\" ;`Let` allows you to declare variables that are limited in scope to the block, statement, or expression on which it is used. This is unlike the `var` keyword, which defines a variable globally, or locally to an entire function regardless of block scope. \" ; - _URL_3_\r\n\r\nWhich one should be used in modern javascript code? `let` or `var`?\r\n\r\nEdit: \r\nI checked the Google JavaScript Style Guide and it states \" ;Declarations with var: Always \" ; (_URL_1_)\r\n\r\nBut in the tutorial at _URL_2_ (not sure if this is an official JavaScript website or not) it says to use `let` (_URL_0_)\r\n\r\nI&#39;m assuming I should stick to what Google recommends, but am still open to answers.\r\n\r\nSecond Edit: The above is not the most recent Google JavaScript Style Guide. In that one it states: \" ;Declare all local variables with either `const` or `let`. Use `const` by default, unless a variable needs to be reassigned. The `var` keyword must not be used \" ;.(_URL_4_)", "373" ], [ "Summary: I have a job board, a user searches a zip code and all the jobs matching that zip code are displayed, I am trying to add a feature that lets you see jobs within a certain mile radius of that zip code. There is a web API ( _URL_1_ ) that does these calculations and returns zip codes within the specified radius, I am just unsure how to use it.\r\n\r\nUsing _URL_1_ , you enter a zip code and a distance and it returns all zip codes within this distance. The format for API request is as follows: `_URL_0_;`, so if a user enters zip code &#39;10566&#39; and a distance of 5 miles, the format would be `https://_URL_1_/rest/ < api_key > /radius.json/10566/5/miles` and this would return: \r\n\r\n {\r\n \" ;zip_codes \" ;: [\r\n {\r\n \" ;zip_code \" ;: \" ;10521 \" ;,\r\n \" ;distance \" ;: 4.998,\r\n \" ;city \" ;: \" ;Croton On Hudson \" ;,\r\n \" ;state \" ;: \" ;NY \" ;\r\n },\r\n {\r\n \" ;zip_code \" ;: \" ;10548 \" ;,\r\n \" ;distance \" ;: 3.137,\r\n \" ;city \" ;: \" ;Montrose \" ;,\r\n \" ;state \" ;: \" ;NY \" ;\r\n }\r\n #etc...\r\n ]\r\n }\r\n\r\nMy question is how do I send a GET request to the API using django? \r\nI have the user searched zip code stored in `zip = request.GET.get(&#39;zip&#39;)` and the mile radius stored in `mile_radius = request.GET[&#39;mile_radius&#39;]`. How can I incorporate those two values in their respective spots in `_URL_0_;` and send the request? Can this be done with Django or do I have this all confused? Does it need to be done with a frontend language? I have tried to search this on google but only find this for RESTful APIS, and I dont think this is what I am looking for. Thanks in advance for any help, if you couldn&#39;t tell i&#39;ve never worked with a web API before.", "34" ], [ "I have a `Job` object and each one has a `zip_code` field. I am trying to loop through a list of zip codes and get all matching `Job` objects. But with my current query, instead of appending the additional `Job` objects to `jobs_matching_query`, `jobs_matching_query` is reset every time, leading to only the `Job` objects with the last zip code in the list (10564 in the bottom example) being returned. How can I query my db so that all `Job` objects with zip codes in `zip_codes_within_15_mile_radius` are returned?\r\n\r\nmy code:\r\n\r\n zip_codes_within_15_mile_radius = [&#39;10535&#39;, &#39;10579&#39;, &#39;10564&#39;]\r\n for zip_code in zip_codes_within_15_mile_radius:\r\n jobs_matching_query = Job.objects.filter(zip_code__iexact = zip_code) #this query only returns jobs that have &#39;10564&#39; as their zip code", "714" ], [ "Summary: I am trying to build a job site. On index.html the user enters a zip code into a form to see jobs in that zip code, this form is handled with the `job_query` view. This brings them to another page(search.html) where at first you only see jobs in that specific zip code but I am trying to add a filter that lets the user see jobs within X miles. How can I pass the zip code value entered in the from on index.html to the next page?\r\n\r\n\r\nindex.html:\r\n\r\n < h2 > Find a Job < /h2 > \r\n < !--Search Bar-- > \r\n < form method = \" ;GET \" ; action = \" ;{% url &#39;search&#39; %} \" ; > \r\n < div id = \" ;form_grid \" ; > \r\n < input name= \" ;query \" ; type= \" ;text \" ; placeholder= \" ;Zip Code \" ; > \r\n < button type= \" ;submit \" ; > Search < /button > \r\n < /div > \r\n < /form > \r\n\r\nsearch.html: \r\n\r\n < form method = \" ;GET \" ; action = \" ;{% url &#39;search&#39; %} \" ; > \r\n < input class= \" ;search_bar \" ; name= \" ;query \" ; type= \" ;text \" ; placeholder= \" ;Zip Code \" ; > \r\n < button class= \" ;search_btn btn btn-outline-success \" ; type= \" ;submit \" ; > Find Jobs < /button > \r\n < /form > \r\n\r\n < form id= \" ;within_miles_form \" ; method = \" ;GET \" ; action = \" ;{% url &#39;within_miles&#39; %} \" ; > \r\n < input class= \" ;search_bar \" ; name= \" ;miles \" ; type= \" ;text \" ; placeholder= \" ;Within X miles of Zip Code \" ; > \r\n < button type= \" ;submit \" ; > Filter < /button > \r\n < /form > \r\n \r\n < !--code to display jobs-- > \r\n\r\n\r\n_URL_0_:\r\n\r\n def job_query(request):\r\n if request.method == \" ;GET \" ;:\r\n query = request.GET.get(&#39;query&#39;)\r\n jobs_matching_query = Job.objects.filter(zip_code__iexact = query) | Job.objects.filter(city__iexact=query) | Job.objects.filter(state__iexact=query)\r\n number_of_results = 0\r\n for job in jobs_matching_query:\r\n number_of_results = number_of_results + 1\r\n return render(request, &#39;core/search.html&#39;, {&#39;query&#39;: query ,&#39;jobs_matching_query&#39;: jobs_matching_query, &#39;number_of_results&#39;: number_of_results})\r\n def within_miles(request):\r\n miles = request.GET[&#39;miles&#39;]\r\n #how can i use value of the zip code entered?\r\n\r\n_URL_1_:\r\n\r\n url(r&#39;^search$&#39;, views.job_query, name= \" ;search \" ;),\r\n url(r&#39;within_miles&#39;, views.within_miles, name= \" ;within_miles \" ;),\r\n\r\nI think I included all the relevant info but if I am missing something please let me know, thanks in advance for any help.", "1012" ] ]
305
[ 16525, 3452, 16634, 6047, 14151, 9570, 13227, 3108, 12949, 13451, 9954, 18458, 489, 3531, 4334, 8819, 8252, 13765, 13294, 9413, 13654, 5495, 16386, 13601, 7678, 6382, 12267, 16635, 11667, 14898, 5497, 2094, 11113, 12853, 19508, 13474, 3337, 14242, 10483, 19085, 12863, 10957, 935, 13284, 844, 9488, 17556, 14056, 18698, 15391, 15382, 5542, 9743, 14630, 18068, 11086, 11002, 15124, 43, 7301, 8337, 11055, 11786, 13849, 7743, 18454, 15305, 13660, 18438, 1826, 18275, 103, 4269, 15424, 12945, 16755, 9991, 14117, 8957, 17784, 19712, 10161, 12229, 12125, 6591, 19685, 17071, 13692, 12054, 6817, 11041, 19575, 914, 6260, 16509, 15730, 783, 11542, 2774, 7578, 3143, 16421, 4707, 12893, 19468, 15798, 574, 11669, 15156, 717, 2638, 2206, 1142, 13704, 4823, 7805, 5097, 4178, 11480, 16859, 15024, 9525, 6770, 16424, 2390, 17460, 12627, 8379, 2640, 17078, 13321, 14905, 12656, 553, 19684, 19783, 18633, 12794, 17866, 12061, 1214, 18819, 11998, 5233, 17920, 15331, 13462, 18100, 8662, 10096, 1877, 15628, 17141, 18549, 13454, 13423, 9792, 18103, 12082, 12717, 13141, 14875, 4323, 12655, 15928, 2482, 8486, 17407, 2836, 19703, 15353, 13296, 6630, 15132, 10266, 13527, 17327, 6796, 13332, 12693, 18704, 14646, 13934, 10128, 13854, 11924, 5891, 127, 17650, 4275, 7688, 5953, 17639, 7145, 13398, 14742, 14592, 15396, 18111, 15046, 12370, 10833, 17733, 1947, 13368, 13737, 871, 15493, 13348, 13072, 2158, 10664, 8098, 15491, 12220, 5626, 182, 14666, 5442, 57, 16377, 4046, 11151, 15815, 10989, 17854, 15014, 8750, 13872, 8938, 19348, 8106, 14906, 17582, 13289, 14580, 7127, 1664, 17965, 1553, 11674, 2768, 7717, 6534, 9748, 10449, 19751, 14265, 381, 8959, 14999, 12849, 16844, 9880, 5489, 14874, 13235, 598, 9843, 3723, 11453, 14533, 17021, 13079, 16715, 13808, 232, 15256, 9347, 17270, 13329, 9635, 2296, 5999, 14062, 12895, 14787, 17355, 3886, 13778, 9858, 5675, 6615, 8135, 18326, 15427, 11983, 10784, 14103, 12665, 6493, 17288, 2981, 13265, 5455, 1740, 4139, 18126, 14513, 6076, 526, 13427, 16873, 8588, 13659, 4632, 14060, 15328, 10505, 3778, 17892, 14954, 14319, 4340, 6410, 19309, 32, 17164, 19501, 17367, 2799, 5427, 4231, 3654, 7478, 17338, 11632, 4577, 17518, 18534, 14985, 9884, 6094, 15180, 2844, 14838, 242, 11952, 15492, 14656, 17505, 14969, 7661, 12261, 9270, 15050, 9020, 10735, 12384, 2792, 7437, 15685, 10045, 12466, 14938, 18205, 10069, 15110, 15429, 1838, 7281, 160, 11567, 11518, 11251, 5130, 10487, 11346, 8579, 289, 16463, 17910, 1031, 8315, 16319, 15334, 5803, 13863, 8970, 8097, 17815, 17655, 8259, 14468, 14198, 4118, 15108, 1935, 14539, 11003, 17976, 16698, 11126, 11660, 15615, 1540, 13974, 10114, 1825, 14860, 6904, 5067, 8346, 13791, 14615, 980, 18614, 15580, 18488, 10894, 14472, 7784, 17821, 10520, 14025, 19346, 12709, 19522, 11994, 13690, 8609, 1487, 2649, 15828, 12016, 8789, 16621, 5553, 12246, 13301, 15794, 14863, 7460, 5637, 10198, 3630, 6386, 2594, 428, 7994, 17875, 5766, 2684, 450, 5985, 1793, 9801, 12592, 5487, 6624, 10638, 17036, 5711, 11411, 13880, 16630, 4008, 6786, 7443, 13780, 9855, 7677, 6522, 19662, 11341, 5564, 19540, 3781, 1423, 7032, 6879, 19488, 4671, 6255, 6614, 11495, 322, 18612, 14911, 6289, 4330, 2009, 6347, 6520, 3846, 5916, 14523, 17345, 14593, 10354, 3787, 1414, 10212, 7274, 12102, 9059, 63, 17438, 13822 ]
STX_100689.0
[ [ "My questions is related to combining text and math fonts. I am a real fan of Georgia-like \" ;dense \" ; and \" ;no so thin \" ; fonts. It seems that books published by AMS use similar one.\r\n\r\nMy problem is that I cannot find a good math font to fit the text: `newtxmath` seems too thin for Georgia, it fits Times New Roman more. I have tried using `STIX Math Two`, but the `\\bm` package won&#39;t work with it. Also, `mathbb, mathcal` and `mathscr` styled letters look much better in `newtxmath`.\r\n\r\nI am searching for a solution of at least one of these problems:\r\n\r\n - Can I somehow load the symbols I like from `newtxmath` package and make `bm` work? \r\n - What is the font that looks good with Georgia and has good support for math symbols, proper spacing and works with other packages (most prefferable -- loadable with `unicode-math` package)?\r\n\r\n\r\nSome examples:\r\n\r\n**newtxmath** (good `mahtbb`, but font is too thin)\r\n[![enter image description here][1]][1]\r\n\r\n**XITS** (some symbols are awkward)\r\n[![enter image description here][2]][2]\r\n\r\n**STIX math two** (very good, but `mathbb` is strange)\r\n[![enter image description here][3]][3]\r\n\r\nMWE contains a short example of a formula and text. I am including some packages into MWE that sometimes conflict with the font-loading stuff. *I use LuaLaTeX to compile*.\r\n\r\n \\documentclass[a4paper,10pt,openany]{book}\r\n \\usepackage{geometry}\r\n \\geometry{\r\n margin=1in\r\n }\r\n %\r\n\r\n\r\n \\usepackage{mathtools}\r\n\r\n \\usepackage{amsthm}\r\n \\usepackage{thmtools}\r\n\r\n \\usepackage{wasysym}\r\n %\\usepackage{newtxmath}\r\n %\\usepackage[notext,not1,notextcomp]{stix}\r\n %\\let\\coloneqq\\relax\r\n %\\let\\Coloneqq\\relax\r\n %\\let\\eqqcolon\\relax\r\n \\usepackage[math-style=ISO]{unicode-math}\r\n \\setmathfont{STIX Two Math}\r\n %\\setmathfont{XITS Math}\r\n\r\n \\usepackage{bm}\r\n\r\n\r\n \\usepackage{mathrsfs}\r\n\r\n \\usepackage{lipsum}\r\n\r\n \\usepackage[utf8]{inputenc}\r\n \\usepackage{polyglossia}\r\n\r\n \\defaultfontfeatures{Ligatures=TeX}\r\n\r\n \\setmainfont{Georgia}\r\n\r\n \\setmainlanguage{english}\r\n\r\n \\DeclareFontFamily{U}{skulls}{}\r\n \\DeclareFontShape{U}{skulls}{m}{n}{ < - > skull }{}\r\n \\newcommand{\\skull}{\\text{\\usefont{U}{skulls}{m}{n}\\symbol{&#39;101}}}\r\n\r\n %\r\n\r\n \\begin{document}\r\n\r\n If $\\omega$ is a positive linear functional on a $C^{\\ast}$-algebra~$A$,\r\n then we can construct a unique (up to unitary equivalence)\r\n representation~$\\pi_\\omega$ of algebra~$A$ in some Hilbert\r\n space~$H_\\omega$ over field of scalars $\\mathbb{C}$ and\r\n a vector~$\\xi_\\omega$ such that\r\n $$\r\n \\omega(a)=\\left(\\pi_{\\omega(a)}\\xi_\\omega,\\,\\xi_\\omega\\right).\r\n $$\r\n\r\n \\end{document}\r\n\r\n \r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_1_\r\n [3]: _URL_0_", "558" ], [ "I want to create a database consisting of numbered blocks of TeX-code. In particular, I want to do sth like `\\mycommand{counterName}{Some text}` and save a new entry somewhere, to use the `Some Text` later in another part of the document. The `CounterName` is a counter that I can reffer to get the text inserted in the document:\r\n\r\n \\newcounter{a}\r\n \\mycommand{a}{The first line}\r\n \\stepcounter{a}\r\n \\mycommand{a}{The second line}\r\n\r\n .........\r\n\r\n print{2}\r\n\r\nAnd TeX will produce \" ;The second line \" ;.\r\n\r\nI am looking for something like `glossaries` package, but with ability to produce not all list at once, but a specific entry so it looks like the command `\\print{n}` is simply substituted by the text in command `\\mycommand{n}{TEXT}`. \r\n\r\nSearching through _URL_0_ I found some answers about `datatool` package and `Lua` codes, but haven&#39;t found a solution I can apply.\r\n\r\nI would really appreciate a brief explanation on how to use `datatool`, `glossaries` or something similar for this stuff.", "290" ], [ "I have been using LuaLaTex since I got acquainted with TeX, because it can easily work with system fonts, which I really need. Font packages in TeX are not friends of the Russian language, though they are friends of the `Lua` language.\r\n\r\nI have found some examples here: _URL_0_, but I still do not fully understand what can `Lua` do.\r\n\r\nSo, my questions are the following:\r\n\r\n - Was `Lua` specially designed for TeX, or it is just a programming language that can be implemented in TeX? **Answer: It is just a programming language, not specific to TeX.**\r\n - How can it be used in typesetting? Can it somehow substitute any packages?\r\n - Is it OS dependent, i. e. is there anything specific while using it on Windows?\r\n - Can it work with non-latin characters? **Answer: YES.**", "971" ], [ "I am using `pdfpages` package to include a few files into the big one. I want to print the file name, go to new page and include the file. The problem is that when the filename contains `_` LaTeX yelds `missing $ inserted` (because the `_` is allowed in math-mode only, I guess). How can I deal with it?\r\n\r\nUsing sth like `\\def_\\_` didn&#39;t help. I also tried some of the solutions from this site, but didn&#39;t get any result.\r\n\r\nHere is MWE:\r\n\r\n\t\\documentclass{scrartcl}\r\n\t\\usepackage{pdfpages}\r\n\r\n\t\\newcommand{\\INC}[1]{%\r\n\t\\vspace*{\\fill}\r\n\t\\begin{center}\r\n\t\t\\large #1\r\n\t\\end{center}\r\n\t\\vspace*{\\fill}\r\n\t\\newpage\r\n\t\\includepdf[pages=-,nup=1x2,doublepages=true,landscape,frame=true]{#1}\r\n\t}\r\n\r\n\r\n\t\\begin{document}\r\n\t\\INC{file_name.pdf}\r\n\t\\end{document}", "558" ], [ "I am using the `aligned` environment to typeset some mathematical equations. Background was discussed here: _URL_0_. The idea is to typeset equations on the same line with text.\r\n\r\nNow, I want to align equations by more than one position. `aligned` gives me too much space around `=`:\r\n\r\n[![enter image description here][1]][1]\r\n\r\nAs you can see, there is too much space between `AA` and `=`.\r\n\r\nHere is my MWE:\r\n\r\n\t\\documentclass{article}\r\n\t\\usepackage{mathtools}\r\n\t\r\n\t\\begin{document}\r\n\t\r\n\t$\\begin{aligned}\r\n\t & AA & & = a\\\\\r\n\t & B & & = b\r\n\t\\end{aligned}$\r\n\t\r\n\t\\end{document}\r\n\r\n\r\n [1]: _URL_1_", "335" ], [ "I have been using LaTeX for almost two years now and I have understood that the books I read gave me very little experince. The packages and tactics explained there are obsolete, for example,\r\n\r\n - nothing about `xparse` and `expl3` packages, that allow to simply do cool things. \r\n - Not a word about `Xe` or `LuaTeX` and `unicode-math` to use a variety of fonts.\r\n - Nothing about the power of implemented `Lua` language.\r\n - Usually, `Pstricks` or `xy-pic` graphics are discussed, while as I am awared, `TikZ` and `Asymptote` are much more powerful.\r\n\r\nIn fact, all my skills came from this very site, where I can ask a question and some almighty developers answer and get me aquainted with the powerful packages I have never heard before. For example, I discovered `aligned` (instead of `align`), `multlined` (instead of `multline`), etc. after asking a question here.\r\n\r\nAlso, my skills came from skills to read documentations, for example, `datatool` or `enumitem`.\r\n\r\nMy questions are:\r\n\r\n - What literature should I read to begin becoming an advanced user?\r\n - How to hear tools and packages you have never heard about before?\r\n - What is the best way to discover newly released powers of doing something, rather than to continue using obsolete ones? (*speaking shortly: how to be stylish and up-to-date?)*. For example, `xparse` \" ;o \" ; option allows you to evade the hell of `\\def\\YourCommand{\\@ifnextchar[{\\@with}{\\@without}}`\r\n\r\n\r\nP. S. I hope the title of the question is not violating the rule not to go personal.", "971" ], [ "I have created a list using `enumitem` package. The items of the list should be enumerated with multi-line blocks of text, like this\r\n\r\n[![enter image description here][1]][1]\r\n\r\nAs I haven&#39;t found a way to pass `item` more than one argument I just pass a `minipage`. The problem is with the alignement:\r\n[![enter image description here][2]][2]\r\n\r\nI want the text to be aligned with the word \" ;Problem \" ;, i. e. blue line to be aligned with the red one. But passing `[t]` argument to the `minipage` gives me errors. \r\n\r\n**UPDATE.** After passing `[t]` option to minipage the next line of the item is to low and a space is added before the first letter:\r\n\r\n[![enter image description here][3]][3]\r\n\r\n\r\nHere is my MWE\r\n\r\n\t\t\\documentclass[10pt]{article}\r\n\t\r\n\t\\usepackage[margin=1in]{geometry}\r\n\t\r\n\t\\usepackage{enumitem}\r\n\t\r\n\t\\usepackage{mathtools}\r\n\t\r\n\t\\usepackage{xparse}\r\n\t\\usepackage{lipsum}\r\n\t\r\n\t%\\usepackage{lua-visual-debug} %uncomment to test if everything us ok (requires Lua)\r\n\t\r\n\t\\newcounter{problemscounter}\r\n\t\r\n\t\\newlength{\\LABELWIDTH}\r\n\t\r\n\t\\newenvironment{problems}{\r\n\t\t\\begin{list}{}%\r\n\t\t\t{\r\n\t\t\t\t\\usecounter{problemscounter}\r\n\t\t\t\t\\setlength{\\labelwidth}{3cm}\r\n\t\t\t\t\\setlength{\\LABELWIDTH}{\\labelwidth}\r\n\t\t\t\t\\setlength{\\labelsep}{0.5em}\r\n\t\t\t\t\\setlength{\\leftmargin}{\\labelwidth+\\labelsep}\r\n\t\t\t\t\\setlength{\\itemsep}{12pt}\r\n\t\t\t\t\\setlength{\\listparindent}{1em}\r\n\t\t\t\t\\setlength{\\parsep}{1pt}\r\n\t\t\t\t\\setlength{\\topsep}{6pt}\r\n\t\t\t} \r\n\t\t}{ \r\n\t\t\\end{list}\r\n\t}\r\n\t\r\n\t\r\n\t\\NewDocumentCommand{\\TT}{mmm}{\r\n\t\t\t\\item[{%\r\n\t\t\t\t\\begin{minipage}[t]{\\LABELWIDTH}\r\n\t\t\t\t\t\\textbf{%\r\n\t\t\t\t\t\t\\textup{%\r\n\t\t\t\t\t\t\tProblem\\kern.4em\\ignorespaces\\stepcounter{problemscounter}\\arabic{problemscounter}.%\r\n\t\t\t\t\t\t}%\r\n\t\t\t\t\t}\\\\\r\n\t\t\t\t\t\\textit{#1 point#2}.\\\\%\r\n\t\t\t\t\t#3.\r\n\t\t\t\t\\end{minipage}\r\n\t\t\t}]%\r\n\t\t}\r\n\t\r\n\t\r\n\t\\begin{document}\r\n\t\t\r\n\t\t\\begin{problems}\r\n\t\t\t\r\n\t\t\t\\TT{1}{}{Mandatory} \\lipsum[1]\r\n\t\t\t\r\n\t\t\t\\TT{2}{s}{Mandatory} More difficult one.\r\n\t\t\t\r\n\t\t\t\\TT{2017}{s}{Bonus} Good luck solving this.\r\n\t\t\t\r\n\t\t\\end{problems}\r\n\t\t\r\n\t\\end{document}\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_\r\n [3]: _URL_2_", "335" ], [ "I do not get this error, but I get plenty of other errors. For the code to work, change the preamble to `\\documentclass{article}\n\\usepackage{fontspec}\n\\usepackage{polyglossia}\n\\setmainlanguage{hebrew}\n\\defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}\n\\setmainfont{Noto Sans Hebrew}\n\\newfontfamily\\hebrewfont{Noto Sans Hebrew}`.\nDon&#39;t forget to specify `\\newfontfamily\\hebrewfont`. You also don&#39;t have to load `fontspec` explicitely, because `polyglossia` loads it.", "558" ], [ "Not just to scale, but use `includegraphics` instead of `includepdf`, which applies `\\clearpage` first. I would also recommend posting a **complete code** to the answer, i. e. anybody can copy-paste it to work. And at last: you should type @ebo, not \" ;ebo \" ;, if you want to reference a person. An the last thing: names of the packages are usually put in ` signs to look like `this`.", "54" ], [ "Based on the comments, the main problem can be solved with defining new \" ;style \" ; of typesetting. To change everything with one click, we can now edit one line in preamble.\r\n\r\n\t\\documentclass{article}\r\n\t\t\r\n\t\\newcommand{\\mystyle}[1]{\\mathcal{#1}}\r\n\t\\newcommand{\\player}{\\mystyle{P}}\r\n\t\r\n\t\\begin{document}\r\n\t\t\r\n\t\t\\noindent\r\n\t\tHere is calligrafic font.\r\n\t\t$$\r\n\t\t\\player\r\n\t\t$$\r\n\t\tOops, seems like now I want all letters to be Sans Serif.\r\n\t\t\r\n\t\t\\renewcommand{\\mystyle}[1]{\\mathsf{#1}}\r\n\t\t$$\r\n\t\t\\player\r\n\t\t$$\r\n\t\t\r\n\t\\end{document}\r\n\r\nHere is the result.\r\n[![enter image description here][1]][1]\r\n\r\n\r\n [1]: _URL_0_", "681" ], [ "@Al-MotasemAldaoudeyeh **(1)** Please remember, that this is *not* a forum, it is a Q-A community; **(2)** You are member for 9 days and have already posted 8 answers, which is a lot for a newbie. There is absolutely nothing personal, but please keep in mind that the majority of your answers weren&#39;t accepted well and a few of them duplicate comments of other people or even answers already given. If you are confused about usage of this site visit `meta` part, read the rules and investigate the answers of other people. Good luck!", "755" ], [ "While observing new questions I have found this one: _URL_3_. Which, as pointed out in the comments, was already asked by the same user. I have looked the profile of the OP and it seems that s/he asks this question for the third time.\r\n\r\nAnother example: _URL_4_ and _URL_7_ the questions are the same from the same user.\r\n\r\nMoreover, one user provides strange answers (which are sometimes not answers) with screenshots, but no code, which might be very confusing for new users:\r\n\r\n - _URL_1_\r\n - _URL_2_\r\n - _URL_0_\r\n\r\nThe reverse engineering should be applied to the answers (produce `.tex` from `.pdf`).\r\n\r\nMy question may seem vague, but is anything to be done with the users who behave themselves like this?\r\n\r\n**UPDATE:** One user today asked the question they asked two days ago.\r\n_URL_6_ and _URL_5_ .\r\n\r\nSeems like a typical situation I have discussed above, **but** this first one has got the score of **-2**, no answers and is on hold, while the question asked today has **4** upvotes and two answers with score +6 and +7.\r\n\r\nThere are two improvements in the second question: photo of *do-it-for-me* matrix is cleaner and a code was added as an MWE.\r\n\r\nWhy is this difference in up/down voting? The questions are really the same and are duplicates of each other, but have so different score.", "10" ], [ "You have this space because there is something strange with alignment.\r\n\r\nThis code gives a good output. Notice also how I put fullstop after the last equation.\r\n\r\n[![enter image description here][1]][1]\r\n\r\n \\documentclass[10pt]{amsart}\r\n \r\n \\usepackage{mathtools,array}\r\n \r\n \r\n \\begin{document}\r\n \t\r\n \t\r\n \t\r\n \t\\begin{equation*}\r\n \t\\left\\{\r\n \t\\begin{array}{@{} l@{} l@{} l@{} l@{} l@{}}\r\n \ta_{1,1}x_{1,1} & {}+{} a_{1,2}x_{1,2} & {}+{} & a_{1,3}x_{1,3} & {}={} c_{1}, \\\\\r\n \ta_{2,1}x_{2,1} & {}+{} a_{2,2}x_{2,2} & {}+{} & a_{3,1}x_{2,3} & {}={} c_{2}, \\\\\r\n \ta_{3,1}x_{3,1} & {}+{} a_{3,2}x_{3,2} & {}+{} & a_{3,3}x_{3,3} & {}={} c_{3}.\r\n \t\\end{array}\r\n \t\\right.\r\n \t\\end{equation*}\r\n \t\r\n \t\r\n \\end{document}\r\n\r\nWhile I personally prefer using `alignedat` environment:\r\n\r\n\t\\begin{equation*}\r\n\t\\left\\{\r\n\t\\begin{alignedat}{4}\r\n\t & \ta_{1,1}x_{1,1}\t & & \t+a_{1,2}x_{1,2}\t & & \t+a_{1,3}x_{1,3}\t & & \t=c_{1}, \\\\\r\n\t & \ta_{2,1}x_{2,1}\t & & \t+a_{2,2}x_{2,2}\t & & \t+a_{3,1}x_{2,3}\t & & \t=c_{2}, \\\\\r\n\t & \ta_{3,1}x_{3,1}\t & & \t+a_{3,2}x_{3,2}\t & & \t+a_{3,3}x_{3,3}\t & & \t=c_{3}.\r\n\t\\end{alignedat}\r\n\t\\right.\r\n\t\\end{equation*}\r\n\r\nFor more ways of typestting systems, look here: _URL_0_\r\n\r\n [1]: _URL_1_", "335" ], [ "I would advise using `polyglossia` package, which automatically calls `fontspec`, thus requres **XeLaTeX** or **LuaLaTeX** to compile.\r\n\r\n\t\\documentclass{article}\r\n\t\r\n\t\\usepackage{polyglossia}\r\n\t\r\n\t\\setmainfont{Times New Roman}\r\n\t\\setmainlanguage{german}\r\n\t\r\n\t\\begin{document}\r\n\tАлина\r\n\t\\end{document}\r\n\r\n**EDIT:** The reason I have set `Times` as default is that `polyglossia` loads the `Latin Modern` as default, which has no support for Cyrillic.", "558" ], [ "I will show you how to do it via command line on Windows 10. This can be done on Linux and Mac, or through your front-end (if you find out how to do it).\r\n\r\nSo,\r\n\r\n 1. Run pdflatex file.tex (or lualatex or xelatex):\r\n[![enter image description here][1]][1]\r\n 2. Run the file without extension with `makeglossaries`[![enter image description here][2]][2]\r\n 3. Do 1 again.\r\n 4. Enjoy the glossaries.[![enter image description here][3]][3]\r\n\r\nSome explanation: `\\makeglossaries` in the preamble tells TeX to collect all the related stuff and put it to the `.glo` file. When you execute `makeglossaries gl` or `makeglossaries gl.glo` from cmd, the file with extension `.gls` is created, which is used when compiling the main file (that&#39;s why the first run gives you a warning `gl.gls` not found). \r\n\r\n [1]: _URL_0_\r\n [2]: _URL_2_\r\n [3]: _URL_1_", "558" ], [ "I have copy-pasted a part of a code from this site that places `section` inside tikz to achieve the following result:\r\n\r\n[![enter image description here][1]][1]\r\n\r\nI want the rectangle around the text to start from the very gutter, i. e. from the left side of the *paper* on odd pages and finish on the right edge of the *text* (and just opposite for even pages). The name of the section should start from the position it is now in.\r\n\r\nIt is also worth mentioning that I want the rectangle near the gutter to be blue, and to be white near outer edge. \r\n\r\nThe trouble I am facing is that I don&#39;t know the gutter is located because I use `twoside` document. How can this be achieved?\r\n\r\n**MWE**\r\n\r\n\t\\documentclass[twoside]{book}\r\n\t\\usepackage[explicit]{titlesec}\r\n\t\\usepackage{tikz}\r\n\t\\usetikzlibrary{shapes,shadows,calc}\r\n\t\\usetikzlibrary{positioning,calc}\r\n\t\\usepackage{lipsum}\r\n\t\\usepackage[inner=2in,outer=0.5in,bmargin=1in,tmargin=1in]{geometry}\r\n\t\\usepackage{ragged2e}\r\n\t\\usepackage{calc}\r\n\r\n\t\r\n\t\\newcommand\\SecTitle[4]{%\r\n\t\t\\begin{tikzpicture}\r\n\t\t\r\n\t\t\\node (A) [rectangle,left color=blue, right color=white, inner sep=4mm]%\r\n\t\t{%\r\n\t\t\t\\begin{minipage}[c]{\\textwidth-8mm}%\r\n\t\t\t\\LARGE\\bfseries\\raggedright\\thesection\\quad#4\r\n\t\t\t\\end{minipage}\r\n\t\t};\r\n\t\t\r\n\t\t\\end{tikzpicture}\r\n\t\t\r\n\t}\r\n\t\\titleformat{\\section}\r\n\t{\\normalfont}{}{0em}\r\n\t{\\SecTitle{east}{west}{0\\paperwidth}{#1}}\r\n\t\r\n\t\\begin{document}\r\n\t\r\n\t\\chapter{Test}\r\n\t\r\n\t\\section{Test Section One}\r\n\t\\lipsum[2]\r\n\t\\section{Test Section Tt Section Tt Section Tt Section Tt Section Tt Section Tt Section Tt Section Tt Section Tt Section Tt Section Tt Section Tt Section Tt Section Tt Section Tt Section Tt Section Tt Section Tt Section Two}\r\n\t\\lipsum[2]\r\n\t\\clearpage\r\n\t\\section{Test Section Three}\r\n\t\\lipsum[2]\r\n\t\\section{Test Section Four}\r\n\t\\lipsum[2]\r\n\t\r\n\t\\end{document} \r\n\r\n [1]: _URL_0_", "36" ], [ "I would recommend using `unicode-math` to avoid all the font problems.\r\n[![enter image description here][1]][1]\r\n\r\nCompile with `Xe` or `Lua`Latex.\r\n\r\n\t\\documentclass[preview]{standalone}\r\n\t\r\n\t\\usepackage{unicode-math}\r\n\t\\setmathfont{STIX Two Math}\r\n\t%\\DeclareSymbolFont{letters}{OML}{ztmcm}{m}{it}% mathptmx\r\n\t\\DeclareSymbolFont{letters}{OML}{ntxmi}{m}{it}% newtxmath\r\n\t\\SetSymbolFont{letters}{bold}{OML}{ntxmi}{b}{it}% newtxmath\r\n\t\r\n\t\r\n\t\\newcommand{\\bs}[1] {\\ensuremath{\\symbf{#1}}}\r\n\t\r\n\t\\usepackage[noend]{algpseudocode}\r\n\t\r\n\t\\begin{document}\r\n\t \\begin{algorithmic}[0]\r\n\t \\Function{getLocalArrays}{$w$}\r\n\t \\State{$\\left\\{ \\bs k , \\bs f , \\Omega \\right\\} \\gets \\symbf{\\chi}+\\chi+\\symbfup{\\chi} + \\bs w$} \r\n\t \\EndFunction\r\n\t \\end{algorithmic}\r\n\t\\end{document}\r\n\r\n [1]: _URL_0_", "558" ], [ "I have downloaded a font `Vollkorn` from _URL_0_ that features 8 styles: regular, semi-bold, bold, black and each of them italized. There are also fonts with 18 styles, but I guess it is not needed for the illsutration.\r\n\r\nI want to use all these styles, so **I would like** to do something like this:\r\n\r\n\t\\newfontfamily\\voll{Vollkorn-Regular.ttf}%\r\n\t\t[\r\n\t\t\tExtension\t\t\t=\t.ttf,\r\n\t\t\tItalicFont\t\t\t=\tVollkorn-Italic,\r\n\t\t\tSemiBoldFont \t\t=\tVollkorn-Semibold,\r\n\t\t\tSemiBoldItalicFont\t=\tVollkorn-SemiBoldItalic,\r\n\t\t\tBoldFont \t\t\t=\tVollkorn-Bold,\r\n\t\t\tBoldItalicFont\t\t=\tVollkorn-BoldItalic,\r\n\t\t\tBlackFont\t\t\t=\tVollkornBlack,\r\n\t\t\tBlackItalicFont\t\t=\tVollkorn-BlackItalic\r\n\t\t\t\r\n\t\t]\r\n\r\nAnd then somewhere in the document:\r\n\r\n \\textblack{Black Text}, \\textsemibolditalic{Semi-Bold Italized}.\r\n\r\nI don&#39;t know how to do it, so **right now I have defined** to families: `voll` --- for normal font, which bold version is semi-bold and `vollbold`, which normal version is bold, and which bold version is black:\r\n\r\n\t\\newfontfamily\\voll{Vollkorn-Regular.ttf}%\r\n\t\t[\r\n\t\t\tExtension\t\t=\t.ttf,\r\n\t\t\tBoldFont \t\t=\tVollkorn-Semibold,\r\n\t\t\tItalicFont\t\t=\tVollkorn-Italic,\r\n\t\t\tBoldItalicFont\t=\tVollkorn-SemiBoldItalic\r\n\t\t]\r\n\t\\newfontfamily\\vollbold{Vollkorn-Bold.ttf}%\r\n\t\t[\r\n\t\t\tExtension\t\t=\t.ttf,\r\n\t\t\tBoldFont \t\t=\tVollkorn-Black,\r\n\t\t\tItalicFont\t\t=\tVollkorn-BoldItalic,\r\n\t\t\tBoldItalicFont\t=\tVollkorn-BlackItalic\r\n\t\t]\r\n\r\nTo produce the desired output I do\r\n\r\n \\voll\r\n\tThis is normal font\\\\\r\n\t\\textbf{Applying bf to normal font, we get the semibold version}\\\\\r\n\t\\vollbold We now swith to bold version\\\\\r\n\t\\textbf{And now the bold version of bold version, a.\\,k.\\,a. BLACK}\r\n\r\nWhich produces\r\n\r\n[![enter image description here][1]][1]\r\n\r\n**EDIT:** as mentioned in the comments, doing `\\newcommand{\\textblack}[1]{{\\vollbold\\textbf{#1}}}` doesn&#39;t serve the purpose, because if I have more than one font with a lot of styles, I want to use `\\textblack` with all of them, without defining a special command for each of them. \r\n\r\nCan I make my life easier and do what I want to?\r\n\r\nHere is full **MWE** (compilable with LuaLaTeX and maybe, XeLaTeX)\r\n\r\n\t\\documentclass{scrartcl}\r\n\t\r\n\t\\usepackage[no-math]{fontspec}\r\n\t\\usepackage{polyglossia}\r\n\t\r\n\t\\setmainlanguage{english}\r\n\t\\defaultfontfeatures{Ligatures=TeX}\r\n\t\r\n\t\\setmainfont{Vollkorn}\r\n\t\r\n\t\t\\newfontfamily\\voll{Vollkorn-Regular.ttf}%\r\n\t\t\t[\r\n\t\t\t\tExtension\t\t=\t.ttf,\r\n\t\t\t\tBoldFont \t\t=\tVollkorn-Semibold,\r\n\t\t\t\tItalicFont\t\t=\tVollkorn-Italic,\r\n\t\t\t\tBoldItalicFont\t=\tVollkorn-SemiBoldItalic\r\n\t\t\t]\r\n\t\t\\newfontfamily\\vollbold{Vollkorn-Bold.ttf}%\r\n\t\t\t[\r\n\t\t\t\tExtension\t\t=\t.ttf,\r\n\t\t\t\tBoldFont \t\t=\tVollkorn-Black,\r\n\t\t\t\tItalicFont\t\t=\tVollkorn-BoldItalic,\r\n\t\t\t\tBoldItalicFont\t=\tVollkorn-BlackItalic\r\n\t\t\t]\t\r\n\t\t\r\n\t\r\n\t\\begin{document}\r\n\t\t\r\n\t\t\\noindent%\r\n \\voll\r\n\t\tThis is normal font\\\\\r\n\t\t\\textbf{Applying bf to normal font, we get the semibold version}\\\\\r\n\t\t\\vollbold We now swith to bold version\\\\\r\n\t\t\\textbf{And now the bold version of bold version, a.\\,k.\\,a. BLACK}\r\n\t\t\r\n\t\t\r\n\t\\end{document}\r\n\r\n\r\n [1]: _URL_1_", "681" ] ]
94
[ 4940, 16494, 4343, 154, 14055, 13878, 6223, 4992, 15644, 8243, 8829, 15011, 3215, 17530, 5869, 10794, 18036, 17038, 288, 17340, 10751, 10939, 8085, 16316, 13641, 11815, 6871, 3570, 13132, 12914, 10679, 5063, 8761, 2089, 714, 760, 10206, 10382, 9085, 1541, 7237, 3825, 1238, 18883, 18317, 10677, 17489, 654, 14831, 18860, 2700, 7076, 1885, 9241, 6825, 8437, 1042, 18663, 15114, 1806, 8526, 1377, 19459, 6687, 13033, 15034, 6886, 19447, 2407, 2279, 11104, 18130, 14288, 10293, 15859, 18965, 663, 13490, 4071, 3043, 19337, 11257, 68, 8742, 1872, 601, 4433, 15045, 14866, 2667, 2551, 1113, 5150, 1105, 7741, 751, 2734, 2203, 6576, 9227, 19719, 12042, 14041, 16974, 18930, 8617, 12310, 17533, 15784, 12058, 50, 4917, 11204, 3639, 7657, 11522, 18081, 3966, 1157, 5679, 4148, 14485, 3058, 10994, 2238, 8673, 13816, 19452, 3717, 19091, 17459, 13452, 16112, 3421, 9273, 271, 6665, 2780, 7307, 431, 17234, 5397, 17044, 12040, 12515, 4076, 13334, 10745, 10491, 19470, 17086, 13073, 16886, 10945, 17369, 13823, 19503, 6807, 8039, 17465, 2107, 16856, 9856, 705, 19397, 13972, 4583, 9623, 11202, 18910, 13848, 12256, 19193, 8626, 10219, 12771, 14971, 13039, 11990, 82, 14842, 1358, 13745, 6590, 13999, 4529, 9520, 16971, 19209, 5997, 14652, 11042, 17921, 525, 14938, 3352, 6747, 621, 11027, 3626, 12919, 17715, 15553, 17371, 5140, 19655, 4589, 9319, 9537, 16035, 10620, 12746, 10871, 2269, 9783, 14235, 14650, 10634, 5882, 11284, 10104, 7923, 867, 15165, 8191, 16978, 18498, 14035, 9517, 6689, 14558, 11192, 5622, 19249, 1366, 1756, 10243, 788, 8340, 16549, 15709, 10513, 1948, 4923, 1471, 3884, 19095, 13679, 18309, 12139, 9771, 1725, 11927, 7854, 9810, 7518, 9633, 2973, 3271, 7290, 10001, 12213, 9523, 19298, 7332, 1829, 6644, 16611, 18738, 7133, 16242, 3765, 2456, 2880, 13622, 18720, 19267, 3569, 2617, 18866, 19128, 15363, 1505, 14811, 17757, 802, 6670, 10194, 13160, 13967, 4450, 7178, 4624, 4734, 4213, 41, 4031, 19663, 8519, 4775, 6868, 14840, 1520, 3842, 16538, 100, 12539, 1273, 5836, 3209, 19433, 4316, 16337, 18977, 13920, 14620, 7586, 12870, 11944, 10241, 6696, 3679, 3631, 1043, 19022, 19688, 19729, 7781, 13151, 7891, 9322, 16330, 10487, 7034, 18227, 17762, 5385, 17102, 7610, 1024, 3522, 2037, 17956, 3668, 4626, 16652, 6063, 9343, 7559, 12528, 7879, 2167, 4301, 7054, 7221, 16434, 8350, 6303, 18359, 1099, 3496, 19335, 16008, 2898, 9798, 15309, 17297, 2510, 4371, 15441, 13887, 18575, 10952, 18937, 9968, 4745, 1334, 7940, 2671, 12718, 2460, 13277, 4595, 15017, 10199, 19302, 478, 7509, 18924, 14224, 9255, 4274, 4768, 10996, 181, 4519, 19146, 11726, 5775, 12892, 4386, 8708, 17298, 3045, 19574, 18193, 18442, 5393, 18735, 1958, 12109, 3801, 17280, 7814, 5579, 18767, 6791, 11449, 9124, 8053, 11343, 12227, 8057, 6066, 16534, 10839, 9869, 3339, 7593, 5079, 9697, 2303, 589, 16012, 18947, 842, 16644, 4202, 17622, 3177, 1644, 11987, 13485, 7650, 15300, 13867, 4201, 6731, 11681, 10191, 9399, 3980, 4000, 9906, 7447, 523, 5148, 12686, 14759, 5655, 15677, 16854, 13899, 8721, 18428, 9632, 15811, 7104, 14251, 12101, 5618, 4038, 9435, 17731, 19562, 2645, 18811, 12757, 1954, 7521, 5650, 9003, 13494, 5705, 4226, 12110, 15684, 5197, 12275, 10797, 13597, 16166, 1822, 11315, 12958, 4011, 943, 951, 4251 ]
STX_10069508.0
[ [ "I recently started learning ELK and I succeed to parse my XML files locally. But now I would like to have access to my server to get access to all of my XML files (upgrade every 30 seconds)\r\nI have the ip-address of my server and my question is: should I install Filebeat locally and configure my filebeat.yml to get access to the server or I should install the Filebeat in the server and then indicate my locally address?", "483" ], [ "I installed recently filebeat, and I would like to edit the yml file to specify this input: \r\n\r\n filebeat.prospectors:\r\n - input_type: log\r\n paths:\r\n - /path/*.xml\r\n # scan_frequency: 60s\r\n document_type: message\r\n multiline.pattern: &#39;^ < measInfo&#39;\r\n multiline.negate: true\r\n multiline.match: after\r\n\r\nI should edit the file filebeat.yml or filebeat.yml.rpmnew? \r\n\r\nWhen I edit filebeat.yml I get this message error : \r\n\r\n filebeat.service - filebeat\r\n Loaded: loaded (/usr/lib/systemd/system/filebeat.service; enabled; vendor preset: disabled)\r\n Active: failed (Result: start-limit) since Thu 2018-07-19 11:35:40 CEST; 2s ago\r\n Docs: _URL_0_\r\n Process: 4695 ExecStart=/usr/share/filebeat/bin/filebeat -c /etc/filebeat/filebeat.yml -path.home /usr/share/filebeat -path.config /etc/filebeat -path.data /var/lib/filebeat -path.logs /var/log/filebeat (code=exited, status=1/FAILURE)\r\n Main PID: 4695 (code=exited, status=1/FAILURE)", "921" ], [ "I have 3 VMs and I would like to install logstash locally and filebeat in each VM. \r\nI installed filebeat and my filebeat.yml is \r\n\r\n filebeat.prospectors:\r\n - input_type: log\r\n paths:\r\n - /path/*.xml\r\n # scan_frequency: 60s\r\n document_type: message\r\n multiline.pattern: &#39;^ < measInfo&#39;\r\n multiline.negate: true\r\n multiline.match: after\r\n output.logstash:\r\n hosts:[ \" ;my_ip_address:5044 \" ;]\r\n\r\nI did the same thing for 2 others VM\r\nMy logstash.conf (running locally) is:\r\n\r\n input{\r\n beats{\r\n port= > 5044\r\n host= > \" ;ip_address_of_VM \" ;\r\n }}\r\n\r\nI run logstash locally and then the filebeat in the VM1 but I get this message error:\r\n\r\n > Failed to connect: dial tcp my_ip_address:5044: getsockopt: connection refused\r\n\r\nIt&#39;s the correct way? and how I can resolve this problem?", "53" ], [ "solution:\r\n\r\n filter { xml { source = > \" ;message \" ; store_xml = > true target = > \" ;theXML \" ; force_array = > false } }\r\n split { field = > \" ;[theXML][Type] \" ; }\r\n split { field = > \" ;[theXML][Value] \" ; }\r\n split { field = > \" ;[theXML][Value][r] \" ; }\r\n\r\nand then use in the output:\r\n\r\n output{\r\n if [theXML][Type][p]==[theXML][Value][p]{\r\n elasticsearch ....}}\r\nhope that could help someone ;)", "592" ], [ "There is a lot of parameters, alpha, t , k..you should explain what&#39;s mean each an example with explicit value.\r\n\r\nI don&#39;t know if you can do it by using only python, but I think if you have an equation like that: \r\n\r\n R=beta*T*exp(alpha*X)*X\r\n\r\nSupposing that alpha and beta are constant, the easy way is to check if T is a reversible matrix then you will get only this equation\r\n\r\n reverse(T)*R=beta*exp(alpha*X)*X\r\nand using this expression you will get a linear equation and then you can use **np.linalg.solve** to solve it\r\n\r\n[![enter image description here][1]][1]\r\n\r\n\r\n [1]: _URL_0_", "767" ], [ "@app.callback(\r\n dash.dependencies.Output(&#39;graph1&#39;,&#39;figure&#39;),\r\n [dash.dependencies.Input(&#39;my_dropdown&#39;, &#39;value&#39;),\r\n dash.dependencies.Input(&#39;Map1&#39;, &#39;clickData&#39;)],\r\n events=[dash.dependencies.Event(&#39;graph-update&#39;, &#39;interval&#39;)]\r\n )\r\n def Graph1(clickData, USN)\r\n\r\nHere your clickData is the input number 2 so you should use something like that:\r\n\r\n @app.callback(\r\n dash.dependencies.Output(&#39;graph1&#39;,&#39;figure&#39;),\r\n [dash.dependencies.Input(&#39;my_dropdown&#39;, &#39;value&#39;),\r\n dash.dependencies.Input(&#39;Map1&#39;, &#39;clickData&#39;)],\r\n events=[dash.dependencies.Event(&#39;graph-update&#39;, &#39;interval&#39;)]\r\n )\r\n def Graph1(USN, clickData)", "505" ], [ "Your question isn&#39;t really clear, but I will ask your question in the title. If you have a string and you like to search a sub-string you can only use \r\n\r\n if substring in string:\r\n #do what you want to do\r\nanother way is to use regular expression, here the documentations [re python][1]\r\n\r\n\r\n [1]: _URL_0_\r\n\r\nnext time please share your script to help everyone to understand your problem ;)\r\n\r\n\r\n**EDIT**\r\n\r\n\r\n filename = \" ;test.text \" ;\r\n import re\r\n def splitAddresses(data):\r\n addresses=[]\r\n l=[]\r\n pattern=re.compile( \" ;^[GROUP]+[0-9]+[:]$ \" ;)\r\n for element in data:\r\n isAmatch=pattern.match(element)\r\n if isAmatch==None:\r\n l.append(element)\r\n else:\r\n addresses.append(l)\r\n l=[]\r\n addresses.append(l)\r\n return(addresses[1:])\r\n def parseAddress():\r\n with open(filename) as f:\r\n data = f.readlines()\r\n addresses=splitAddresses(data)\r\n for element in addresses:\r\n prefix=element[0][32:36]\r\n length_data=len(element)\r\n for address in element[1:]:\r\n if address.count(prefix)!=2:\r\n element.remove(address)\r\n new_length = len(element)\r\n if new_length==length_data:\r\n print(element[0])\r\n else:\r\n print(element[1:])\r\n parseAddress()\r\n\r\nTried with this file \r\n\r\n GROUP1:\r\n set group address \" ;Private-MT \" ; \" ;ABCD45-48/70-71 \" ;\r\n set group address \" ;Private-MT \" ; \" ;ABCD45-48/70-71 \" ; add \" ;ABCD47 \" ;\r\n set group address \" ;Private-MT \" ; \" ;ABCD45-48/70-71 \" ; add \" ;ABCD48 \" ;\r\n set group address \" ;Private-MT \" ; \" ;ABCD45-48/70-71 \" ; add \" ;ABCD70 \" ;\r\n set group address \" ;Private-MT \" ; \" ;ABCD45-48/70-71 \" ; add \" ;ABCD71 \" ;\r\n GROUP2:\r\n set group address \" ;Private-MT \" ; \" ;ABCD45-48/70-71 \" ;\r\n set group address \" ;Private-MT \" ; \" ;ABCD45-48/70-71 \" ; add \" ;ABCD47 \" ;\r\n set group address \" ;Private-MT \" ; \" ;ABCD45-48/70-71 \" ; add \" ;ABCD48 \" ;\r\n set group address \" ;Private-MT \" ; \" ;ABCD45-48/70-71 \" ; add \" ;XYCD70 \" ;\r\n set group address \" ;Private-MT \" ; \" ;ABCD45-48/70-71 \" ; add \" ;XYCD71 \" ;\r\n\r\nthe Output was :\r\n\r\n set group address \" ;Private-MT \" ; \" ;ABCD45-48/70-71 \" ;\r\n\r\n [&#39;set group address \" ;Private-MT \" ; \" ;ABCD45-48/70-71 \" ; add \" ;ABCD47 \" ;\\n&#39;, &#39;set group address \" ;Private-MT \" ; \" ;ABCD45-48/70-71 \" ; add \" ;ABCD48 \" ;\\n&#39;]\r\n\r\n\r\n\r\n\r\nyou can edit the script and store infos because I did a print to show you that&#39;s works ;)", "349" ], [ "well as you can see there is this information GROUP1, GROUP2... and between two GROUPS There is the data that we need to deal with. So to do that I used regular expression, the pattern can be used to match a string. if you can see I used firstly [GROUP] so if there is a string it should start with GROUP otherwise it isn&#39;t the good word, this word should also contains a number because you have GROUP1,GROUP2 or another GROUP \" ;X \" ; so I used [0-9] and finally if after your group and the number there is a specific character like \" ;: \" ; you can add it like that [:]. Hope it&#39;s clear now", "772" ], [ "I would like to import data from different servers, I used pysftp but it&#39;s working just when I do an ssh to the server and then I ran my script.\r\n\r\nI would like to import data from different server in the same time by using fabric or pysftp if it&#39;s possible. I readied the documentation of fabric and didn&#39;t find a way to that. Waiting for your suggestions or same examples of that. \r\n\r\n**Example**\r\n *\r\n\r\n from fabric.api import*\r\n filename = &#39;path/ip_address.txt&#39;\r\n while True:\r\n with open(filename) as f:\r\n data = f.readlines()\r\n env.hosts= data\r\n env.user= \" ;usr \" ;\r\n env.password= \" ;pwd \" ;\r\n get( \" ;~/path/*.xml \" ;, \" ;localpath/pm_xml \" ;)\r\n\r\nusing this script I got an error message **No hosts found. Please specify (single) host string for connexion!** \r\n\r\nand when I use paramiko this script:\r\n\r\n import paramiko\r\n import os\r\n filename = \" ;/home/test/Desktop/ip_address.txt \" ;\r\n with open(filename) as f:\r\n data = f.readlines()\r\n while True: \r\n for ipAddr in data:\r\n ssh = paramiko.SSHClient()\r\n ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())\r\n ssh.connect(ipAddr,username= \" ;usr \" ;,password= \" ;pwd \" ;)\r\n sftp = ssh.open_sftp()\r\n for element in sftp.listdir( \" ;server_path \" ;):\r\n if element.endswith( \" ;.xml \" ;):\r\n try:\r\n sftp.get( \" ;server_path \" ;+element, \" ;/home/test/Documents/pm_xml/ \" ;+element)\r\n except:\r\n print(Exception)\r\n sftp.close()\r\n ssh.close() \r\nusing paramiko I can only get one file per seconde but each server generate 100 files every minute.\r\nmy **ip_address.txt** contains ip address:\r\n\r\n <IP_ADDRESS>\r\n <IP_ADDRESS>\r\n <IP_ADDRESS> \r\n\r\nAny suggestions to get access in the same time to different server and import data quickly.", "883" ], [ "@MartinPrikryl I think I was not really clear, I will explain my example. Imagine that I have two machine and I could run my script in machine A or machine B; machine A is in lab in France and the other one in Finland. so when I am trying to import data in machineA from servers in Finland there is latency, but when I try to import data from servers in France there is no more latency. So when script and servers are in the same country (in others word the same lab) I can import data 1k files on only 1 minute. I will also check what you said ;)", "199" ], [ "I would like to deploy Elasticsearch, logstash and kibana in 3 different flavors, the characteristics of each one:\r\no 32vCPU, 384Go RAM et 900Go HDD\r\n\r\nI would like to supervise 100 servers so approximately 33 servers in each flavors.\r\n\r\nDo you think it&#39;s a good idea to use this configuration? and it&#39;s not a problem to use this huge capacity of memory?\r\nAnother question how many nodes should I use?", "375" ], [ "Oh I see! so it&#39;s better to use for example a small machine with only 8 vCPUs,64GB RAM, and 250 Go HDD? In fact I would like to store data from different servers each one generate between 1go and 10 go per day, and I would like to store the data 7 days. That&#39;s why I would know if logstash can index data from (5-10 servers) and how many nodes should I use to configure _URL_0_: each server generate between 20-100 files/minutes .", "668" ], [ "I would like to know if we can deploy logstash, elasticsearch and kibana in the same machine and also setting up 2 nodes of elasticsearch in this machine.\r\nThe idea is I want to give 31Go Ram for each node and 4Go Ram to Logstash and let 30Go free.\r\nI have a machine with 8vCPUs,96Go Ram and 250GB HDD.\r\n\r\nDo you think is a good idea? and my logstach could index files from 10 filebeat running on 10 servers?", "375" ], [ "In fact I can&#39;t have to separate machine to made two nodes I can only have one machine so that makes sense to deploy two nodes that shared the same hard disk or just only can handle 30GO of data per day! I would like to store data for 6-7 days. I could have only a large machine with enough RAM and CPU as I want but not having two machines. So you suggest me to deploy one or two nodes? Thanks again", "314" ] ]
483
[ 16588, 11659, 8944, 14894, 99, 8637, 18511, 13092, 2236, 16797, 11239, 260, 6641, 15726, 7967, 19711, 14607, 19638, 14499, 15388, 17602, 7106, 17456, 17721, 10593, 15077, 7729, 14623, 12747, 14314, 14645, 13032, 15760, 14245, 6526, 15297, 19510, 9330, 14034, 12348, 12570, 3866, 6491, 2494, 6197, 15825, 4320, 15012, 687, 17077, 14609, 8094, 11019, 14509, 18815, 15669, 11304, 8351, 17399, 527, 9088, 19, 13057, 726, 16768, 9289, 17127, 14590, 18149, 11419, 19617, 16209, 6613, 18426, 16873, 18071, 12613, 12882, 12075, 5280, 2461, 6166, 12657, 9634, 10765, 10080, 1602, 7311, 6432, 18277, 1611, 16808, 15373, 14842, 9827, 14377, 19327, 17629, 17746, 17052, 5927, 14432, 18785, 9057, 2013, 14864, 15143, 11959, 15198, 4948, 13385, 580, 17852, 19015, 37, 14858, 5383, 17957, 17711, 12860, 16331, 11022, 6842, 19003, 2606, 2276, 16248, 9436, 17872, 4385, 4147, 17777, 10964, 17512, 19784, 9300, 13145, 17947, 1451, 19627, 6407, 8117, 1529, 14296, 5267, 5281, 19700, 16076, 15020, 15490, 15144, 13714, 8535, 17675, 14816, 9618, 15022, 17142, 15718, 14555, 11612, 8189, 2739, 10278, 6244, 781, 13300, 7457, 9483, 16298, 9149, 11457, 12507, 14531, 6529, 19557, 6691, 19574, 6064, 19599, 14489, 14945, 14178, 4853, 9504, 12732, 18310, 12956, 9402, 5778, 18087, 875, 15402, 19454, 9494, 19314, 11348, 5796, 1575, 8100, 10389, 15079, 17962, 16656, 13740, 13688, 14182, 4298, 32, 16046, 10796, 1759, 17233, 10025, 19526, 7839, 10706, 15341, 17457, 230, 13641, 4289, 15036, 13243, 10569, 17685, 8165, 7268, 9969, 14564, 12239, 12028, 13015, 15599, 15866, 8589, 13542, 19734, 11393, 14401, 19225, 15575, 18089, 11908, 14747, 17874, 19433, 10787, 14881, 14780, 14737, 14298, 5102, 4409, 11509, 6911, 15067, 19602, 16625, 2130, 2015, 15048, 7036, 11149, 11851, 86, 17669, 15884, 4829, 2216, 13299, 17943, 14511, 13246, 5478, 10024, 19523, 15455, 6451, 9977, 525, 9000, 12588, 13749, 9616, 7930, 8664, 17548, 15451, 13323, 6090, 16765, 16911, 17491, 16644, 5064, 4968, 5708, 7915, 11498, 196, 11170, 14828, 16255, 7299, 4957, 6995, 11932, 7172, 2933, 5539, 15594, 13360, 391, 15813, 9835, 6152, 15025, 3547, 6031, 15404, 5304, 12205, 9505, 4725, 3882, 13923, 18835, 15629, 7160, 5049, 17187, 10360, 9466, 8880, 2635, 18515, 1520, 15542, 3041, 12600, 873, 17243, 11305, 13191, 17927, 15062, 19726, 18270, 10809, 8580, 2841, 7315, 12958, 2850, 13966, 14422, 16787, 3425, 10603, 11117, 8800, 12540, 2950, 19298, 11714, 2824, 15250, 18366, 16098, 18070, 14959, 123, 197, 1093, 15386, 14456, 14120, 2381, 8339, 12155, 1896, 13879, 15323, 12683, 7166, 12946, 13934, 12016, 4342, 8557, 13313, 7511, 19675, 15034, 17017, 674, 14311, 13388, 14475, 10539, 6266, 6435, 9892, 404, 4599, 14759, 19095, 16205, 18494, 16947, 16419, 13540, 10898, 13820, 16403, 16481, 8371, 1948, 13447, 11730, 16685, 12240, 19607, 9809, 10912, 13799, 4002, 8378, 13407, 6917, 9739, 2020, 12515, 8420, 8698, 16796, 18051, 17365, 12672, 15777, 1603, 12761, 15328, 18189, 594, 14926, 19562, 9640, 19757, 16446, 10952, 18660, 12269, 12875, 16455, 2716, 8169, 5679, 3334, 10896, 11978, 7447, 722, 5912, 16229, 12664, 961, 18291, 17157, 16838, 13764, 290, 15238, 14906, 19102, 17763, 10343, 12259, 15988, 4305, 15959, 14519, 10634, 14015, 7184, 18173, 17172, 280, 5727, 17246, 14195, 14427, 1132, 14969, 9837, 3763, 12905, 13498 ]
STX_10072990.0
[ [ "The path to wifi firmware in android devices is generally: \r\n`\\system\\etc\\firmware\\wifi`\r\n\r\nSome devices have `system\\etc\\wifi` or `\\system\\etc\\firware\\wlan` as the wifi firmware path. If you connect through adb and do `ls` to one of these paths, you should be able to see firmware binary. For Qualcomm wifi, the binary has `wcnss` string in it.\r\n\r\nAs for your actual question, the firmware loading is done by the wifi driver. So if you are enable wifi through `adb shell` or through phone UI, it should load the wifi driver which should load the wifi firmware from the location mentioned above", "117" ], [ "**Some background on active and passive scans:**\r\n\r\nActive scan scans all the non-passive channels actively by sending probe requests so the time spent on each channel is short. Passive scan is used generally for DFS channels where active scanning is not allowed and hence a device has to wait for one beacon interval to find all APs on that channel. Overall scanning passive channels should take more time than scanning active channels\r\n\r\nIn your case, you should be able to use in the android developer API reference to get scan results:\r\n\r\n Request a scan for access points. Returns immediately. The availability of the \r\n results is made known later by means of an asynchronous event sent on \r\n completion of the scan.\r\n\r\n To initiate a Wi-Fi scan, declare the Manifest.permission.CHANGE_WIFI_STATE \r\n permission in the manifest, and perform these steps:\r\n\r\n Invoke the following method: ((WifiManager) \r\n getSystemService(WIFI_SERVICE)).startScan()\r\n Register a BroadcastReceiver to listen to SCAN_RESULTS_AVAILABLE_ACTION.\r\n When a broadcast is received, call: ((WifiManager) \r\n getSystemService(WIFI_SERVICE)).getScanResults()\r\n\r\n`startScanActive` is not an exposed API in android reference. I recommend not using it. If you must use it, refer this - _URL_0_\r\n\r\nRefs:\r\n\r\n_URL_2_()\r\n_URL_1_()\r\n_URL_0_", "666" ], [ "In Pycharm version 2017.3, you can go to Pycharm - > Preferences - > Project - > Project Interpreter - > < project_name > - > settings button on the right of the python interpreter text box - > Add local\r\n\r\nThis will open a new window with virtualenv Environment as one of the options on the left. On Selecting it, you will get an option to make a new virtualenv environment or use an existing virtual environment. Here next to the dropdown text box, you can click \" ;... \" ; and browse to your existing virtualenv created using pyenv and select it. It will select this virtualenv when you start terminal from Pycharm and also use the corresponding python interpreter as set while creating that virtualenv.\r\n\r\n[![enter image description here][1]][1]\r\n\r\n\r\n [1]: _URL_0_", "435" ], [ "e.g. let&#39;s say I have a `master` branch for a repo in Bitbucket and a developer developing in `feature_branch_1` raises a PR to merge into `master`. \r\n\r\nI want to be able to detect a PR has been raised for `master` and then run some tests on it. I think this is possible through some combination of Branch Specification in VCS root, VCS Trigger in TeamCity. Would like some help on the exact values to be used in these fields to achieve this?", "808" ], [ "Most folks have already answered that you need to declare a function to be `virtual` for it to bind at runtime when your code executes. \r\nI want to add that without virtual, the method to be called is decided at compile time and it will pick the method of the class whose variable/pointer type you declared. In your case, `Base` class type.\r\n\r\nAdditionally, would like to provide a good to read link which can help clear your concept of runtime polymorphism in C++ : _URL_0_", "315" ], [ "You can skip passive channel scanning by using the hidden API, startscanActive.\r\nstartScanActive is not an exposed API in android reference; so use it at your own risk. If you must use it, refer this - _URL_0_\r\n\r\nAlso, note that if the API indeed scans only active channels as the name suggests, you will not be able to get APs present on passive channels in your scan results", "666" ], [ "Generally, phone&#39;s software will pick a connection with internet over a connection with no internet. In your case, the higher layer software does not know that no internet wifi connection is needed to be used for your use case. Also, while using 3g/4g internet available connection it seems like Mobile A is not able to reach mobile B. If you want phone to pick wifi over 4G, enable internet connectivity in your wifi connection or disable 3g/4g while you use your (test?) app.", "1004" ], [ "It seems like you want the final output as a 2 dimensional array, something like this [[&#39;input&#39;, &#39;Hello&#39;, &#39;user&#39;], [&#39;a&#39;, &#39;there&#39;, &#39;the&#39;]], for your original example \" ;Hello there, this is a string input given by the user \" ;, Then you get a group of words as a list and access each list separately. You can put \" ;\\n \" ; at the end of each list while printing but the idea is to group the words as one list and create a list of lists ... is that what you want?", "941" ], [ "If you just want to print, you can print it inside the loop itself with a \" ;\\n \" ; at the end of the loop. But if you want to store it in a format where you can use each group of words separately, then you could do something like:\r\n\r\n words_list = [ \" ;Hello \" ;, \" ;there \" ;, \" ;this \" ;, \" ;is \" ;, \" ;a \" ;, \" ;string \" ;, \" ;input \" ;, \" ;given \" ;, \" ;by \" ;, \" ;the \" ;, \" ;user \" ;]\r\n final_list_2 = list()\r\n while(len(words_list) > 5):\r\n final_list = list()\r\n first_word_popped = words_list.pop(-5)\r\n final_list.append(first_word_popped)\r\n second_word_popped = words_list.pop(0)\r\n final_list.append(second_word_popped)\r\n third_word_popped = words_list.pop(-1)\r\n final_list.append(third_word_popped) \r\n final_list_2.append(final_list)\r\n \r\n for final_list in final_list_2:\r\n print ( \" ; \" ;.join(final_list))\r\n\r\nOUTPUT:\r\n\r\n`input Hello <PERSON>\r\n<PERSON> there the`", "761" ], [ "In C++, Automatic storage duration integer variables are not initialized to any particular value, and will contain whatever garbage bit pattern that happens to already be in those memory locations. From the perspective of the language standard, the value of the variable is indeterminate, and using it leads to undefined behavior. If you had defined it as a static variable, it would be auto-initialized to 0 in C++.\r\n\r\nMost likely your compiler will also throw a warning if you try to use a uninitialized variable.\r\n\r\nIn GCC, you will see the warning if you compile with below flag: \r\n`-Wuninitialized` \r\nWarn if an automatic variable is used without first being initialized or if a variable may be clobbered by a setjmp call. In C++, warn if a non-static reference or non-static const member appears in a class without constructors.\r\n\r\nUpdate based on Peter&#39;s comment: \r\nIn the above case, the code creates an automatic storage duration object of that class type. However, since you just declare an object of type `ip` as `ip convert` and you don&#39;t have your own constructor which initializes class objects&#39; member values, compiler&#39;s default constructor will be called. Most compilers (if not all) will not initialize member values for you and hence you see an output corresponding to the bit pattern present in the memory locations where the object got created.", "890" ], [ "@MadPhysicist: I have a link to the docs in my question. I have a read up the docs and did not find an answer to it or atleast that&#39;s what I know based on my understanding of the docs. I have been trying something in my code in last couple of days and might actually have an answer to this question in a day or two. However, IMO, that doesn&#39;t change the fact that the answer to this question would make most sense if given with an example code snippet.", "84" ], [ "I found the answer myself and the answer is `Yes`, it is possible to have multiple custom matchers when using _URL_0_ It&#39;s actually similar to how the VCRPY docs show using a single custom matcher.\r\n\r\nBelow is a general structure on how it can be done:\r\n\r\n def vcr_matcher_1(r1, r2):\r\n # logic for matching r1 and r2 requests\r\n \r\n def vcr_matcher_2(r1, r2):\r\n # logic for matching r1 and r2 requests\r\n\r\nIn your recording code, you can use something like: \r\n\r\n custom_vcr = vcr.VCR()\r\n custom_vcr.register_matcher(&#39;vcr_matcher_1&#39;, vcr_matcher_1)\r\n custom_vcr.register_matcher(&#39;vcr_matcher_2&#39;, vcr_matcher_2)\r\n with custom_vcr.use_cassette(&#39;cassette_name.yml&#39;,\r\n match_on = [&#39;method&#39;, &#39;scheme&#39;, &#39;host&#39;, &#39;port&#39;, &#39;vcr_matcher_1&#39;, &#39;vcr_matcher_2&#39;]):\r\n\r\nThe above example also shows you can mix your custom matchers with default provided matchers by _URL_0_\r\n\r\nRef: \r\n_URL_1_", "952" ], [ " enable_generated_tests_p  cat _URL_1_\r\n import definer\r\n import os\r\n \r\n print(&#39;pid:&#39;,os.getpid(), &#39;definer.value:&#39;,id(definer.value))\r\n \r\n  enable_generated_tests_p  cat _URL_2_\r\n import definer\r\n import os\r\n \r\n print(&#39;pid:&#39;,os.getpid(), &#39;definer.value:&#39;,id(definer.value))\r\n \r\n  enable_generated_tests_p  cat _URL_0_\r\n import firstModule\r\n import secondModule\r\n \r\n  enable_generated_tests_p  python _URL_1_\r\n pid: 73848 definer.value: <PHONE_NUMBER>\r\n \r\n  enable_generated_tests_p  python _URL_2_\r\n pid: 73906 definer.value: <PHONE_NUMBER>\r\n \r\n  enable_generated_tests_p  python _URL_0_\r\n pid: 73964 definer.value: <PHONE_NUMBER>\r\n pid: 73964 definer.value: <PHONE_NUMBER>\r\n\r\n\r\nid() - Return the “identity” of an object. This is an integer which is guaranteed to be unique and constant for this object during its lifetime. Two objects with non-overlapping lifetimes may have the same id() value.\r\n\r\nIn your case, you have been running your firstModule and secondModule using different processes/subprocesses so you get different IDs as seen above.", "738" ], [ "One options if there are no other restrictions could be - Add an attribute `score` to your Question class and use it while calculating the score. Also, you need to calculate/track total possible score separately.\r\n\r\nSomething like below would work:\r\n\r\n _URL_0_\r\n class Question:\r\n def __init__(self, prompt, answer, score):\r\n \r\n self.prompt = prompt\r\n self.answer = answer\r\n self.score = score\r\n \r\n def run(question):\r\n score = 0\r\n total_possible_score = 0\r\n for getInput in question:\r\n total_possible_score += getInput.score \r\n answer = input(getInput.prompt) \r\n if answer == getInput.answer:\r\n score += getInput.score\r\n print( \" ;You got \" ; + str(score) + \" ;/ \" ; + str(total_possible_score) + \" ; correct! \" ;)", "200" ], [ "e.g. Let&#39;s say I have following in tox.ini\r\n\r\n [tox]\r\n envlist = py27, py35, testenv2\r\n \r\n [testenv] \r\n # settings related to \" ;default \" ; testenv - includes deps, commands\r\n \r\n [testenv:testenv2] \r\n # settings related to testenv2 - includes deps, commands\r\n\r\nNow when I run tox command, it invokes `testenv` commands with python 2.7 and 3.5 interpreter but `testenv2` commands only with base python installed on the machine (in my case 2.7). How to get tox to also test a \" ;named \" ; (non-default) test environment like `testenv2` to be tested with multiple python versions?", "435" ], [ "I could get the \" ;named \" ; test environment to be tested with multiple python versions by making multiple \" ;named \" ; test environments, one each for the different python versions I wanted it to be tested with and using the `basepython` option to specify the python version for the test environment to be tested with. Below is the example that works:\r\n\r\n [tox]\r\n envlist = py27, py35, testenv2_py27, testenv2_py35\r\n \r\n [testenv] \r\n # settings related to \" ;default \" ; testenv - includes deps, commands\r\n \r\n [testenv:testenv2_py27]\r\n basepython = python2.7 \r\n # settings related to testenv2 - includes deps, commands\r\n \r\n [testenv:testenv2_py35]\r\n basepython = python3.5 \r\n # settings related to testenv2 - includes deps, commands", "435" ] ]
167
[ 12087, 13011, 19622, 18546, 6821, 14447, 898, 16271, 13193, 8591, 4206, 18342, 8870, 1217, 7207, 13762, 13957, 14411, 372, 15117, 8973, 15037, 8359, 6539, 18229, 17894, 13717, 2756, 8608, 8237, 3242, 6603, 12238, 4851, 13459, 10456, 15044, 16325, 17705, 14222, 2408, 4971, 14429, 10054, 4501, 1424, 15666, 4804, 17273, 6194, 9302, 4055, 10704, 17928, 9633, 1883, 3803, 600, 15602, 826, 2211, 832, 9030, 14406, 2887, 15947, 11707, 16424, 18029, 13339, 14303, 5372, 12197, 1365, 5261, 10724, 6710, 12927, 11098, 11101, 4335, 1057, 8130, 15765, 16641, 11000, 8859, 813, 12103, 6372, 12825, 14616, 13590, 9442, 3716, 4013, 10565, 11092, 13182, 18466, 15260, 17371, 11260, 9722, 3837, 4040, 3472, 10652, 13543, 8945, 9923, 2627, 8142, 17771, 10628, 9670, 13656, 8366, 12367, 3471, 18412, 1622, 5943, 16865, 1871, 16699, 4806, 6085, 16057, 13685, 7842, 10850, 19242, 11460, 17283, 9393, 15230, 12697, 12774, 10728, 2674, 3824, 355, 2391, 3128, 8455, 10320, 4125, 15786, 8334, 11537, 19114, 631, 10771, 1693, 11487, 2684, 14450, 3364, 12917, 15738, 8153, 11884, 13420, 13530, 14676, 18434, 7155, 147, 15159, 6093, 10036, 11319, 1553, 13782, 5232, 10762, 18006, 402, 13741, 12642, 11780, 1121, 15178, 1875, 10417, 7658, 6870, 647, 10135, 13506, 14078, 11921, 10617, 12006, 4444, 18263, 13964, 18906, 2725, 10426, 12185, 12869, 13060, 6310, 17012, 5137, 5871, 15187, 16706, 14372, 8286, 9705, 8438, 4002, 1523, 12099, 11279, 11789, 15361, 1240, 19123, 15098, 1715, 13981, 19597, 5487, 2755, 6160, 13425, 17018, 11621, 13434, 7489, 7495, 14047, 7119, 14226, 12136, 10152, 11880, 8471, 10646, 8461, 1941, 7830, 9189, 10735, 14704, 13728, 16358, 4155, 4826, 2305, 718, 17992, 11618, 10018, 15476, 7913, 18722, 8655, 15334, 19446, 9428, 15679, 4556, 2529, 190, 10930, 8534, 2097, 1476, 9426, 17277, 5770, 3271, 10778, 4245, 14485, 1098, 9132, 17599, 17979, 13392, 10414, 16989, 11824, 14446, 3427, 10682, 6932, 15733, 8053, 15820, 7774, 9939, 12921, 11372, 2583, 16777, 10244, 18822, 7114, 19253, 14712, 4079, 6378, 9650, 9581, 14317, 9829, 1456, 15483, 4029, 8118, 11573, 15993, 15167, 3787, 13702, 8197, 2989, 3851, 13388, 1493, 10834, 17647, 12572, 12120, 1910, 13151, 9804, 17899, 9420, 4825, 7248, 15879, 2426, 8419, 5142, 9007, 17648, 7740, 11300, 2075, 13581, 14038, 9554, 11296, 8849, 17201, 6636, 4933, 19437, 15505, 3410, 9399, 2225, 6681, 13722, 6634, 12262, 8040, 2065, 13258, 1058, 16611, 8756, 6553, 15411, 3855, 18478, 711, 11786, 35, 7388, 17656, 16106, 3591, 7592, 2634, 11373, 2899, 17430, 13269, 9597, 19654, 18120, 8590, 3504, 17407, 16631, 6797, 12608, 6097, 15542, 5506, 9199, 1388, 15059, 14639, 17686, 9502, 11369, 2972, 12230, 19163, 16218, 2562, 16389, 2648, 14319, 16254, 7116, 8067, 17658, 6950, 10789, 7151, 18650, 1040, 4822, 1237, 10418, 7462, 13723, 18700, 3905, 5182, 4817, 14179, 6902, 6601, 13926, 19451, 15154, 10410, 8172, 17402, 15367, 3465, 271, 19655, 7214, 19750, 15766, 15588, 13196, 16062, 12333, 15256, 12001, 11818, 11371, 14028, 366, 4712, 11708, 19779, 3126, 16799, 447, 5434, 17750, 3083, 8946, 15631, 3990, 5751, 16605, 4074, 3004, 6778, 798, 12164, 9014, 15006, 9078, 10346, 9015, 8194, 3094, 11862, 16336, 2638, 2295, 9022, 7441, 17141, 17185, 12599, 416, 8587, 12257, 12350, 18170, 11692, 7993 ]
STX_10073.0
[ [ "Is there a relation between \" ;declarative vs. procedural memory \" ; and \" ;substantive vs. verb \" ;?\r\nFor example, are substantives (as a kind of information entities) stored in the declarative memory whereas verbs define capabilities/behavior and hence stored in the procedural memory?\r\n\r\nExample:\r\n\r\nTree: a substantive, can directly be stored in declarative memory\r\n\r\nto climb: a verb, defines a capability/behavior and can be stored in the procedural memory", "868" ], [ "Someone with Enterprise Edition and a public-facing _URL_0_ Site recently asked How would a developer use custom objects and logic to authenticate Guest Site Users without paying license costs for them? Any ideas? I&#39;m thinking that the answer may be to build a custom visualforce registration page that inputs email and name. Upon submission, an \" ;activate your account link \" ; would be sent to the email address provided. Once the user activates their \" ;account \" ; they would access the public site again (as a Guest User because we don&#39;t pay for licenses) but content (e.g. custom object records / listings of records in some other visualforce page) would be filtered such that the \" ;logged-in \" ; user only see&#39;s custom object records that are deemed presentable to users who have \" ;logged-in \" ; whereas some custom object records would not be viewable.\r\n\r\nI think one flaw in how i&#39;m thinking about this is that Org-Wide-Defaults would probably need to be Public for the custom object that is being presented in the later-half of the scenario above. Additionally, the Guest User Profile would need full access to all of its fields. If that&#39;s the case, then security is a concern because even if a developer managed to create this makeshift login ability, it wouldn&#39;t be secure in that i imagine that a non \" ;logged-in \" ; guest could use API to query all records of the custom object.\r\n\r\nThoughts?\r\n\r\n\r\n(e.g. all of what Guest Site Users can see, or a subset based on what we want to display to the now-logged-in-user) Are there projects out there that solve for this? And is it against Salesforce policy? If so, can you refer to the policy? Thank you!", "528" ], [ "In computer programming, when a program analyzes itself, we call it \" ;reflection \" ; or \" ;introspection \" ;.\r\nExample:\r\nA program has several features. When the program runs, it can analyze itself to determine what features it supports and present it in the user interface. The user could choose one of the features and instruct the program to run it.\r\n\r\nNow, the question:\r\nIs there an equivalent mechanism in the brain? I.e. how can the brain think/reflect about a behavior/capability without executing the behavior/capability? Is there a special \" ;module \" ; in the brain that is responsible for reflection and one responsible for execution? If yes, how does the brain decide which module to use in the specific context (thinking vs. acting)?", "578" ], [ "Sure, in my opinion compressors are an extremely useful tool and not using them at all as a rule is missing out on a lot. \r\n\r\nWhen I&#39;m mixing, one of my goals is to make a cohesive, balanced sound that reflects what the band is playing. However, a microphone or instrument is an open conduit to potentially change that balance. So if a background singer for example is singing louder in some parts of a song than others at random points then that can potentially overpower the lead. \r\n\r\nAlso, a lead vocal or instrument should be in the foreground of the mix definitely but if your singer starts shouting to interact with the audience without a compressor then it can quite possibly cause discomfort since that will have significant more input than singing, just as much as if you were having a conversation and your friend pulls out his megaphone. \r\n\r\nAnd what about dynamics? Well I adjust during a piece to provide that dynamic and pay attention to what parts the band wants to be significantly softer or louder or heavier emphasis on a vocal/instrument. \r\n\r\nSo to answer your question, I use compressors fairly often. It&#39;s a useful tool in our arsenal, especially with the advent of digital mixers.", "588" ], [ "This is easily solved using [sqlcmd.exe and scripting variables][1], if you can call an external utility instead of using `System.Data.SqlClient.SqlCommand`\r\n\r\nYou&#39;d just have this in your Query.sql file:\r\n\r\n`SELECT * FROM table WHERE field = &#39;$(var)&#39;;`\r\n\r\nAnd then you&#39;d call `sqlcmd.exe` like this:\r\n\r\n`sqlcmd -S < your server name > -b -i Query.sql -v var=$var`\r\n\r\n - `-S` names the server to connect to. \r\n - `-b` turns on \" ;batch mode \" ;,\r\n where any error aborts the subsequent commands. \r\n - `-i` runs the SQL from the named file\r\n - `-v` names a variable to substitute\r\n\r\nYou can provide multiple `-v` flags if you need more than one variable to be substituted.\r\n\r\n [1]: _URL_0_", "492" ], [ "Currently lib.gen/sci-hub build an archive of all papers and textbooks. Publishers fight the legal battle to stop the project but it&#39;s highly unlikely that they will stop lib.gen/sci-hub and it&#39;s various mirrors in every country of the world. Elsevier might win the suit in the US but they probably know why they don&#39;t pick the fight in Russia where the lib.gen/sci-hub servers reside.\r\n\r\nThere are applications like IBM&#39;s Watson that work better if they have access to more data. That means that companies like IBM, Google, Baidu and Facebook have an interest to have all the data of all scientific papers.\r\n\r\nIsn&#39;t it expensive to store all that data? No, it isn&#39;t. In 2014 Facebook added [4 petabyte][1] of data per day to it&#39;s database. That&#39;s likely more data than all scientific papers together. All the arxiv PDF&#39;s together are [270 GB](_URL_1_). \r\n\r\n\r\n [1]: _URL_0_", "307" ], [ "@StrongBad : There doesn&#39;t have to be someone who actively tries to \" ;archive \" ; the data. _URL_0_ gives you a list of various parties that do try to host mirrors. There are various machine learning projects that have use for the dataset as training data. But even if you look at people who archive more formally the Internet Archive is currently the main host for the StackExchange dumps.", "307" ], [ "> I would like to know if this is considered one of these goods, which cannot be owned and thus needs no quotation.\r\n\r\nAcademic citation isn&#39;t about ownership. It&#39;s not about copyright. It&#39;s not about intellectual property. It&#39;s about allowing the reader to know where you got your ideas. It&#39;s about recognizing other people for their work.\r\n\r\nIn many cases different people might describe the grammar of a language a bit differently. They might even describe different dialects of the same language. Different dialects of the language might treat the same prepositions as treating a different casus. \r\n\r\n<PERSON> wrote \" ;The Cognitive Perspective on the Polysemy of the English Spatial Preposition *Over* \" ; – a whole book over a single preposition and what it does in different cases.\r\n\r\nIf you cite a specific source for your list then a reader can understand of why your list looks the way it does. If the care they can go to the original source to understand how the list got created.", "541" ], [ "@Zelphir : For academic norms it&#39;s plagarism if you use a source without citing it. There are cases where legal copyright is violated. There are cases like ghostwriting that are academic plagarism but that aren&#39;t violating legal copyright. Academic norms are a distinct category from legal norms. They are based on different values and differently enforced.", "609" ], [ "I basically never want to use the feature. How to? There&#39;s another question here that answers how to disable it in Linux via a command-line option in .bashrc, but I don&#39;t think that can be done in Windows?\r\n\r\nEdit: Additional information:\r\n\r\n- I am on Windows 10\r\n\r\n- No Recovery.xcu anywhere on my C drive. \r\n\r\n- even if I discard recovery data, then the next time I open the same file there is no recovery prompt. But when I shutdown Windows without shutting down LibreOffice first, then I get the prompt the next time I open the file.", "66" ], [ "No such file anywhere on my C drive. I&#39;m on Windows 10 if that matters. BTW, it&#39;s happening to me even if I discard recovery data, then the next time I open the same file there is no recovery prompt. But when I shutdown Windows without shutting down LibreOffice first, then I get the prompt the next time I open the file.", "66" ] ]
73
[ 768, 8621, 18937, 14474, 18748, 17186, 7202, 536, 10966, 1964, 10319, 19162, 10734, 5613, 1345, 9701, 6484, 822, 4068, 4978, 640, 18650, 16012, 3557, 3121, 2493, 1893, 5605, 2561, 18340, 692, 18474, 17155, 7631, 8913, 17421, 14604, 15647, 17356, 18259, 7655, 12826, 10328, 6452, 19470, 15768, 2227, 7584, 8754, 13517, 19393, 17823, 18365, 1908, 6141, 2890, 15821, 4272, 2734, 13933, 16700, 12715, 2889, 5598, 11466, 6617, 11986, 18915, 3177, 14345, 15360, 4226, 15886, 523, 3698, 1393, 6946, 5986, 1990, 13370, 15868, 4153, 1040, 17047, 8559, 1813, 9460, 4745, 711, 11222, 2102, 9053, 811, 13183, 1027, 15890, 10804, 7707, 9023, 1876, 10074, 2006, 17050, 10871, 15587, 2404, 15500, 11572, 761, 5677, 10879, 16617, 19285, 15767, 15210, 12742, 19555, 9697, 2459, 8429, 15222, 2007, 12120, 7622, 5673, 9961, 503, 9287, 9866, 6114, 4515, 314, 2123, 17988, 11749, 2187, 7576, 14098, 13842, 1789, 9368, 9393, 5658, 4106, 2449, 16152, 8784, 3267, 19353, 14219, 3004, 2615, 3372, 9514, 15438, 906, 19656, 6036, 2949, 1554, 2648, 11465, 15272, 15462, 10046, 18119, 15458, 6301, 10844, 13712, 3892, 3066, 13019, 18314, 649, 2879, 8998, 8175, 9193, 11705, 19043, 6514, 19369, 4779, 12112, 13623, 9738, 12315, 6335, 16542, 3631, 6604, 13676, 2657, 2005, 17766, 1095, 4866, 8322, 454, 1647, 19493, 15550, 6422, 4964, 1418, 1070, 1225, 19334, 15913, 6097, 455, 6228, 16277, 11611, 13038, 13839, 16595, 3563, 3658, 1772, 13977, 2355, 11573, 16834, 17935, 894, 18896, 16157, 13567, 11229, 11270, 3240, 19605, 9962, 18055, 9779, 8860, 5960, 5885, 7445, 17484, 476, 1123, 19251, 12148, 17977, 19052, 4273, 13390, 14783, 1827, 602, 16871, 2306, 1978, 1957, 350, 2332, 14994, 3984, 19297, 15996, 19110, 1579, 2902, 12856, 1599, 13550, 18090, 11410, 8533, 7502, 2395, 19012, 16321, 2166, 1239, 9903, 15519, 16347, 6151, 19160, 5269, 7256, 13229, 2744, 8805, 8326, 5082, 14886, 18526, 3398, 16539, 10295, 15934, 15867, 18884, 1812, 4529, 13422, 19414, 3928, 5801, 10747, 9236, 19732, 5347, 5439, 7494, 4513, 18378, 8991, 5894, 6396, 16308, 2967, 2435, 19686, 3953, 16741, 1036, 3621, 16788, 6717, 19258, 8558, 3061, 4431, 2183, 9091, 16640, 15773, 6532, 6315, 10936, 9279, 1005, 10130, 9173, 16554, 6966, 17278, 5162, 18811, 11235, 18461, 5122, 12214, 7636, 15365, 7905, 6954, 11743, 6876, 19177, 2801, 2354, 14459, 2944, 14741, 18880, 7503, 2869, 2770, 1068, 3627, 3206, 12463, 10621, 19319, 4508, 6189, 9409, 3648, 3446, 575, 19226, 14571, 17557, 17321, 9198, 8238, 16245, 468, 16733, 4509, 3031, 4501, 8560, 10388, 5879, 4973, 13718, 19529, 17000, 58, 15667, 16299, 16904, 1771, 4033, 1923, 8182, 10238, 11559, 6579, 1121, 19239, 17332, 17787, 5475, 1024, 6043, 3055, 12493, 559, 7407, 17861, 17907, 113, 9407, 13911, 4447, 7374, 3565, 14028, 17632, 16261, 1994, 5316, 19723, 11313, 17213, 18765, 12115, 6183, 6275, 18411, 1630, 18040, 12844, 13147, 3530, 4255, 12447, 4817, 15324, 3325, 6530, 15606, 11254, 6940, 18376, 11795, 18402, 16097, 6150, 2264, 13606, 657, 7316, 19604, 19112, 16892, 17554, 8927, 11766, 9574, 12442, 9450, 17806, 4630, 2893, 5435, 9745, 18451, 5357, 3731, 7623, 2795, 7679, 3056, 16112, 5530, 14559, 2595, 7585, 11406, 12234, 5729, 8038, 7476, 15303, 14829, 11156, 14948, 12523, 14132 ]
STX_10074.0
[ [ "> And I can&#39;t see &#39;666666&#39; in my command console.\r\n\r\nAssuming you mean the browser console, that is not where you should be looking. Since `_URL_0_` is running on the server, any `print` messages will appear on the server, ie in your `flask run` terminal, not in the browser console. That output can be quite \" ;noisy \" ;; think about making your debug message stand out more something like `print( \" ;XXXXXXXXXX > > > > > > YOU ARE HERE < < < < < < XXXXXXXXXX \" ;)`.\r\n\r\nThis is not the solution to the problem, it is meant to aid your troubleshooting. \r\n\r\nWhat is the \" ;fatal error \" ; you are getting? I don&#39;t think it is \" ;directly logout \" ;, I think that is a side-effect of the problem.", "1008" ], [ "Here&#39;s a hint from the pset7 spec [FAQs][1]\r\n\r\n > OSError: [Errno 98] Address already in use\r\n\r\n > If, upon running flask, you see this error, odds are you (still) have flask running in another tab. Be sure to kill that other process, as with ctrl-c, before starting flask again. If you haven’t any such other tab, execute fuser -k 8080/tcp to kill any processes that are (still) listening on TCP port 8080.\r\n\r\nIf that doesn&#39;t help, restart your workspace (it&#39;s an option in the CS50 tab).\r\n\r\n\r\n\r\n [1]: _URL_0_", "53" ], [ "Here&#39;s a trick that might make the API_KEY/SECRET easier to manage. Create a new file in your sentiments directory (I call mine `twitkeys`). Type or copy/paste the two export commands into this file and save it. Your file will look something like\r\n\r\n`export API_KEY=whatever\r\n export API_SECRET=whatever`\r\n\r\n(of course your KEY and SECRET instead of whatever). \r\n\r\nNow for the trick: before you run tweets run this:\r\n`$ . ./twitkeys`. Yes that is \" ;dot space dot slash twitkeys \" ;. I forget the technical explanation, but the first `.` (dot) will put the stuff in `twitkeys` into your environment. \r\n\r\nAs for the &#39;return outside function&#39; error, could be as simple as a bad indent. Without seeing the code it&#39;s impossible to say.", "915" ], [ "What if the first jpg signature is in the 1001 < sup > st < /sup > block? Or any block past 1000? It will never be detected. And what if the raw file is bigger than 15,360,000 bytes (30000 blocks)? Program will exit prematurely. \r\n\r\nGenerally speaking, a `for` loop is used when you know how many iterations need to be performed. To generalize this program, consider how you might use `while` loop(s) instead. Or get the size of the file and use \" ;dynamic \" ; `for` loop(s). \r\n\r\nThe program needs to work on any file that contains jpegs; check50 doesn&#39;t use the same file included in the distro code.", "295" ], [ "It is possible you have two `finance.db` in different directories. It is very important to run `phpliteadmin finance.db` or `sqlite3 finance.db` in the same directory where you run `flask run`. sqlite will create a database when it doesn&#39;t find the one you have specified. For example, if you were in pset7 directory when you called `phpliteadmin finance.db` (or sqlite3) it created another database there, and that is where the `transactions` table is.", "3" ], [ "First, to properly format the code: edit the question, select the code, click the `{}` icon in the format bar.\r\n\r\nOne major problem is: This program will write each block of a jpeg BLOCK times. Each block in the raw file should either be discarded (if it hasn&#39;t encountered the first sig) or written to a jpg. The `j` loop is unnecessary (read: wrong). \r\n\r\nThere are other problems like: \r\n\r\n - `if(!fread(temp_arr, BLOCK * sizeof(BYTE), 1, inptr))`. This actually does the read, so it could be skipping blocks. It seems to be a test for EOF, but the `i` loop will terminate after it reads the `size_infile`th block. \r\n - this `(temp_arr[0] != 0xff & & temp_arr[1] != 0xd8 & & temp_arr[2] != 0xff & & (temp_arr[3] & 0xf0) != 0xe0)` is not the \" ;opposite \" ; of a jpg signature. If one of the values matches, the whole expression is false. But since you already know it&#39;s not a jpg sig when control reaches the else, `counter > 0` (should be?) a sufficient test.", "295" ], [ "`request.form.get( \" ;var \" ;)` returns a string. \r\n\r\nFrom the [python doc for int()][1]: \r\n\r\n > If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an **integer literal** in radix base. [x being the argument to int()]\r\n\r\nIf a decimal number is entered, then x will not be an \" ;integer literal \" ;. You might want to investigate the python built-in [float()][2].\r\n\r\nFrom the screen shot it looks like &#39;asd&#39; was entered in the form. That&#39;s going to cause an error whether you use int() or float(). To prevent \" ;garbage in \" ; consider using a \" ;numeric \" ; type with a \" ;step \" ; attribute in the html. That way you don&#39;t have to write a whole bunch of python code to parse and cleanse user input. Here is the [MDN doc on & lt;input & gt;][3]. \r\n\r\nExample: ` < input class= \" ;form-control \" ; name= \" ;cash \" ; placeholder= \" ;Cash \" ; type= \" ;number \" ; step= \" ;.01 \" ;/ > \r\n`\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_1_\r\n [3]: _URL_0_", "953" ], [ "Hint 1: This `int buffer[512];` is not a \" ;*512b chunk of memory* \" ;. An int is 4 bytes, so this is a 512 * 4 byte chunk of memory. The buffer should be a \" ;byte \" ; type. You can take a hint from bmp.h in resize. \r\n\r\nHint 2: `sizeof(buffer) < 512` is never true. `sizeof(buffer)` is always the size it was declared (so 2048 if int, 512 if byte type). That explains the endless loop. To check if EOF has been reached, you need to test the *result* [return value] of fread (it will be 0 if eof is reached).\r\n\r\nHint 3: (a bug waiting to happen) `char photo[3];` is not big enough to hold the output file name (and don&#39;t forget the null-byte!).", "893" ], [ "After edit:\r\n\r\nFor reference, here is the pseudocode from the walkthrough:\r\n\r\n > for each row \r\n & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp;for each pixel \r\n & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp;write to array n times \r\n & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp;for n times \r\n & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp;write array to outfile \r\n & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp;write outfile padding \r\n & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp;skip over infile padding\r\n\r\nAs I understand it, `array` is going to hold *one new row* of `RGBTRIPLE`s. The declaration would be `RGBTRIPLE array[newbi.biWidth]`. You do not need `sizeof(RGBTRIPLE)` because it is already a collection of `RGBTRIPLE` objects. \r\n\r\nThis \" ;new row \" ; will be built horizontally ( \" ;*write to array n times* \" ;, which is the `j` loop), and then written vertically ( \" ;*for n times...* \" ;, which is the `l` loop). You always want to start building it at `array[0]` and writing it from `array[0]`. Therefore you need to reset counter3 to 0 before you start the next scanline. \r\n\r\nThere are some problems in the `l` loop. To match the pseudo code it would be more like this:\r\n\r\n for (int l = 0; l < n; l++)\r\n {\r\n fwrite......\r\n write padding\r\n }\r\n fseek....\r\n\r\nThe `fwrite` only needs to write `array` to the outfile. You shouldn&#39;t iterate over the pixels, you already did that in the `j` loop. And you need to write the whole `array`. \r\n `fwrite( & array, sizeof(array),1,outfile)` is more like it. \r\n\r\n\r\n----------\r\n\r\n\r\nBefore edit: This `fwrite(array, sizeof(RGBTRIPLE), newbi.biWidth, outptr);` always writes the calculated number of bytes *from the first byte* in array. Don&#39;t you need to reset `counter3 = 0;` somewhere?", "671" ], [ "The source codes, hello.c and water.c, are in the `workspace` directory, not `workspace/pset1` directory. You can move them to the pset1 directory. At the `~/workspace $` prompt:\r\n\r\n mv hello.c pset1\r\n mv water.c pset1 \r\n\r\nHere&#39;s what the file tree will look like, notice the file names are indented under the directory in which they live. \r\n\r\n[![enter image description here][1]][1]\r\n\r\n\r\n [1]: _URL_0_", "20" ], [ "Those check50 results indicate program fails 5 checks, not just the last two. What happens when you try to move tile 2 in a 3x3 board as in this test `:( 3x3 board, from start try to move tile 2, 4, 5, 6, 7, 8`? It will give a runtime error. There is a problem with this line (the third else if in the move function)\r\n `else if ((c - 1 < d) & & (board[r][c - 1] == 0))`, either a typo or a copy/paste oops.\r\n\r\nThe line mentioned in the other answer is a problem, even though it didn&#39;t fix this problem. And I don&#39;t think it&#39;s the only problem in the won function. Frankly, it&#39;s more complicated than need be. Simple addition is all you need to determine if a tile has the desired value. And it doesn&#39;t seem to take into account that the \" ;last \" ; tile will be 0. I don&#39;t have specific advice for fixing it, maybe debug50 is the way to go.", "839" ], [ "`portfolio` table needs a user_id column, full stop. You need to modify that `CREATE TABLE` call < sup > [1] < /sup > . It does not necessarily need a primary key. Not every table does. Maybe it just needs a non-`UNIQUE` index, as suggested in the spec:\r\n\r\n > Define (non-`UNIQUE`) indexes on any fields via which you will search (as via SELECT with WHERE).\r\n\r\n\r\n----------\r\n\r\n\r\n < sup > [1] < /sup > I would not create the table in the software. Maybe I&#39;m a control freak, maybe I&#39;m old school. Separation of concerns. Use phpliteadmin or sqlite for your DDL (Data Definition Language). Limit the software to DML (Data Manipulation Language).", "480" ], [ "One potential segmentation error, not related to the valgrind results, is in the `magic` function. Apostrophe (`&#39;`) is ascii 39. It will not take the `a == 96` branch and will return a negative number here `a = tolower(a) - 97;` Ascii 96 is the \" ;back-quote \" ;, sometimes called \" ;back-tick \" ;, character. If the program seg faults in load or check, it never will run the `unload` function. \r\n\r\nThis may not be the only problem in the program. If there are more problems, work with the small dictionary and debug50 to narrow them down and post another question.", "56" ], [ "What you are describing is \" ;unpredictable results \" ;. That happens often when you access \" ;unallocated \" ; memory. Each test in the big `if` runs the risk of accessing \" ;unallocated \" ; memory. Remember the board edges. row and column can never be < 0, so `tileX - 1` and `tileY - 1` can go off the edge. row and column can never be > d - 1; `tileX + 1` and `tileY + 1` can go off the edge.", "432" ], [ "Here&#39;s the pseudo code from the walkthrough:\r\n\r\n > psuedocode: \" ;recopy \" ; method\r\n > \r\n > for each row \r\n\t & nbsp; & nbsp; & nbsp; & nbsp; for n-1 times \r\n\t\t & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; write pixels, padding to outfile \r\n\t\t & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; send infile cursor back \r\n\t & nbsp; & nbsp; & nbsp; & nbsp; write pixels, padding to outfile \r\n\t & nbsp; & nbsp; & nbsp; & nbsp; skip over infile padding \r\n\r\nThe `vert` loop more-or-less corresponds to \" ;*for n-1 times* \" ;. Because it is executing n times, one problem comes from \" ;*send[ing] infile cursor back* \" ; an extra time.", "631" ], [ "Here&#39;s the psuedo code from the walkthrough:\r\n\r\n > psuedocode: \" ;recopy \" ; method\r\n > \r\n > for each row \r\n\t * & nbsp; & nbsp; & nbsp; & nbsp; for n-1 times \r\n\t\t & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; write pixels, padding to outfile \r\n\t\t & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; send infile cursor back* \r\n\t & nbsp; & nbsp; & nbsp; & nbsp; write pixels, padding to outfile \r\n\t & nbsp; & nbsp; & nbsp; & nbsp; skip over infile padding \r\n\r\nThe nested `j` and `k` loops will write each row ***scale & #10006; scale*** times.\r\n\r\nAlso notice, the *skip over infile padding* is executed exactly once for each row. \r\n\r\nYou have all the pieces you need. You just need to do them the right number of times in the right order and you will have success.", "1021" ], [ "Using the 5 pyramid as a guide:\r\n\r\n > Height: 5 \r\n & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp;## \r\n & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp;### \r\n & nbsp; & nbsp; & nbsp; & nbsp; & nbsp;#### \r\n & nbsp; & nbsp; & nbsp;##### \r\n & nbsp;###### \r\n\r\nThe psuedocode is straightforward:\r\n\r\n > for *height* times \r\n & nbsp; & nbsp; & nbsp;for *s* times \r\n & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; print space \r\n & nbsp; & nbsp; & nbsp;for *h* times \r\n & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp;print hash\r\n\r\nOf course, calculating `s` and `h` is the tricky part. They can both be calculated based on height. Break out the pencil and paper and make a grid:\r\n\r\n row|spaces|hashes\r\n -----------------\r\n 1 | |\r\n 2 | | \r\n 3 | |\r\n 4 | |\r\n 5 | 0 | 6\r\n\r\nThe pattern should emerge, after that it&#39;s just arithmetic, basically the same arithmetic you will use to fill in the grid. (NB, I started the grid at the last line because counting spaces from the display is hard :).", "221" ], [ "Sounds hard. I *think* you&#39;d have to set up a web server for starters. You can have a look at the phpliteadmin script the next time you&#39;re on the IDE, it&#39;s in `/opt/cs50/bin` (or maybe you can just use that script?). If you are the firefox type, there&#39;s a great plugin called SQLite Manager. (Hint: use \" ;Customize \" ; to add the icon to your toolbar so you can find it again). Perhaps there is something similar for Chrome et. al. If you search around, you&#39;re bound to find lots of interesting options.", "483" ], [ "For `h = 4`, the `space` loop will execute 4 times and the `hash` loop will execute 0 times when `row` is 0. Here&#39;s why:\r\n\r\nspace: `for (space = h - 1; space > = 0; space--)` is the same as `for (space = 3; space > = 0; space--)`. `space > =0` is true for space in {3, 2, 1, 0}, a total of 4 iterations. Since `h` is constant in this loop, it will *always* print `h` spaces. \r\n\r\nhash: `for (hash = 2; hash < = (row + 1); hash++)` is the same as `for (hash = 2; hash < = (0 + 1); hash++)`. Since `2 > 1`, it will not execute; 0 iterations. \r\n\r\nWork the rest of the rows out in your head or on paper, and you will see it matches the results produced. The next step is to figure out the relationship of `space` and `hash` to `row` and `h`. That will help you determine the proper number of iterations for each loop.", "598" ], [ "Review the pseudocode from the walkthrough:\r\n\r\n > psuedocode: \" ;recopy \" ; method\r\n > \r\n > for each row \r\n\t & nbsp; & nbsp; & nbsp; & nbsp; for n-1 times \r\n\t\t & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; write pixels, padding to outfile \r\n\t\t & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; send infile cursor back \r\n\t & nbsp; & nbsp; & nbsp; & nbsp; write pixels, padding to outfile \r\n\t & nbsp; & nbsp; & nbsp; & nbsp; skip over infile padding \r\n\r\n\r\nThe pseudocode for this program:\r\n\r\n\r\n > for each row (`i` *loop*) \r\n\t & nbsp; & nbsp; & nbsp; & nbsp; for factor times (`a` *loop*) \r\n\t\t & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; write pixels to outfile \r\n\t & nbsp; & nbsp; & nbsp; & nbsp; skip over infile padding \r\n & nbsp; & nbsp; & nbsp; & nbsp; write padding to outfile\r\n\r\nIf you follow the walthrough code, you need to \r\n\r\n 1. write the outfile padding at the end of each (new) row (ie each iteration of `a`). \r\n 2. be at the beginning of the line for each iteration of `a` (*send infile cursor back*).\r\n 3. only skip over the infile padding once for each infile row.\r\n\r\n\r\n----------\r\nAFTER CODE EDIT:\r\nA seek too far. The `j` loop reads only pixels (not padding). This `int seek = abs(bi.biWidth) * sizeof(RGBTRIPLE) + padding;` is rewinding over all the pixels plus the new padding.", "631" ], [ "First, especially with python because spaces/indents are crucial, but in general, you need to format your code properly. To that, edit the question, select the code, press the `{}` in the format bar, and it will be done for you. That same trick works on an initial post.\r\n\r\nAn important lesson here: `cs50.get_string` *is* the function. `cs50.get_string()` *executes* the function. You have set plaintext to the function, thus the complaint about `len`. You need to set plaintext to the result of the function: `plaintext = cs50.get_string()`.", "342" ], [ "One common cause of this problem is search returning a nested list instead of a list. A quick way to detect this is doing a call to `search?q=021`. If the result shows nested lists:\r\n\r\n [\r\n [\r\n {\r\n \" ;accuracy \" ;: 4, \r\n \" ;admin_code1 \" ;: \" ;MA \" ;, \r\n\r\n(notice the two `[`) that is the problem. \r\n\r\nIt should show one list like this:\r\n\r\n [\r\n {\r\n \" ;accuracy \" ;: 4, \r\n \" ;admin_code1 \" ;: \" ;MA \" ;, \r\n\r\nIt&#39;s an easy mistake to make. The distro code comes like this `return jsonify([])`. If you put the result of your query (which is itself a list) within the braces (`return jsonify([result])`), you will end up with nested lists.", "652" ], [ "I don&#39;t think this \" ;POST \" ; loop is executing. A couple of clues:\r\n\r\n - This `if not request.form.get( \" ;username \" ;):` and this\r\n `username=request.form.get( \" ;Username \" ;)` have mismatched variable\r\n names, so one or the other of them will fail.\r\n\r\n \r\n\r\n - This `session[ \" ;user_id \" ;] = rows[0][ \" ;id \" ;]` is not going to work. If\r\n control reaches this line, it means `rows` is an empty array, so\r\n `rows[0][ \" ;id \" ;]` is undefined. You probably mean `session[ \" ;user_id \" ;] = result`. From the spec hint:\r\n \r\n > if `str` is an `INSERT`, and the table into which data was inserted contains an autoincrementing `PRIMARY KEY`, then `execute` returns\r\n the value of the newly inserted row’s primary key.\r\n - I also assume that the `else` is indented properly in the actual\r\n code, otherwise it wouldn&#39;t run at all.\r\n\r\nFrom these points, I suspect that program is taking the else branch, the user records are not being created, and program redirects you back to register.html. Are you specifying a `post` method in the ` < form > ` element in register.html?", "103" ], [ "Start with [this short][1] on Variables and Scope. You can only use variables in the scope in which they have been declared. For instance, `key` is declared in `main`, so you cannot access it, it does not exist, in `encrypt`. \r\n\r\nMore generally, variables can only be used in the code block, that is the code between `{}`, in which they have been declared. Maybe `help50` could give you more clues, as in `help50 make caesar`.\r\n\r\n\r\n----------\r\nThe following is totally incorrect, left in to give context to the comments.\r\n\r\n < del > NB, the [edX 2017 version][2] of `caesar` does not take command line arguments. < /del > \r\n\r\n\r\n \r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "373" ], [ "That&#39;s how \" ;unpredictable results \" ; work. The seg fault probably comes here `if ( root - > children[c-97] == NULL)` because of this `while (!feof(fp))`. [This short][1] around the 7:30 mark has a very specific warning against using `feof` to detect end of file and alternative approaches. \r\n\r\nThis \r\n\r\n int a = word[i] - 97;\r\n \r\n if (word[i] == &#39;\\&#39;&#39;)\r\n {\r\n a = 26;\r\n }\r\n\r\nis going to cause heartache once the seg fault is sorted out. Apostrophe is ascii 39. if `word[i]` is an apostrophe, and you subtract 97, it&#39;s not an apostrophe anymore.\r\n\r\n [1]: _URL_0_", "773" ], [ "The difference in the \" ;New York \" ; results is probably this `.....or admin_name1 like :q` from `search` query. It is unlikely that staff version is matching on `admin_name`. Neither \" ;/search?q=New+Jersey \" ; nor \" ;/search?q=Utah \" ; returns any results. That particular select (New York) returns 2153 rows, and actually causes an overflow when sending the results back to the browser which is why the 10001-10009 postal codes don&#39;t show. (at least that&#39;s what firefox does, it gives this message `SyntaxError: JSON.parse: expected &#39;:&#39; after property name in object at line 7916 column 16 of the JSON data`). \r\n\r\n`/search?q=02138` worked perfectly when I tested this code. (BTW `02318` returns a big fat error, so maybe typo?) There is evidence (from [this reddit post][1]) that staff version does not use the same data as gets loaded from US.txt. \r\n\r\nThis pset gives the programmer a lot of latitude when it comes to results. I think it would be very difficult to match staff results exactly. If it wasn&#39;t, there would be a `check50`. IMO, submit it. You have the option to resubmit if you don&#39;t get a perfect score. \r\n \r\n\r\n\r\n [1]: _URL_0_", "652" ], [ "From the [Makefile][1] section of the spec:\r\n\r\n > The net effect of all these lines is that you can compile speller with a single command, even though it comprises quite a few files:\r\n\r\n > `make speller`\r\n\r\n > Even better, you can also just execute:\r\n\r\n > `make`\r\n\r\n > And if you ever want to delete speller plus any core or .o files, you can do so with a single command:\r\n\r\n > `make clean`\r\n\r\n > In general, though, anytime you want to compile your code for this problem, it should suffice to run:\r\n\r\n > `make`\r\n\r\nThose are your choices. You cannot run `make dictionary` because it does not have a `main` function. That&#39;s what all the relocation messages are telling you. \r\n [1]: _URL_0_", "351" ], [ "To properly format your code you should edit the question, select the code and click the `{}` icon in the format bar. This same trick works on an initial post as well.\r\n\r\n\r\nThe start of the problem is `var map = new google.maps.Map(document.getElementById( \" ;map \" ;), mapOptions);`. This is creating a new (*local*) map for each place. Function should be using the global `map` instantiated at the beginning of script.js. If you want to change the options, you can do it there, around line 37. It is unclear from the code post if `myLatLang` is defined. \r\n\r\nLooks like a problem in the search function also, since the 500 errors are reported from script.js line 117.", "985" ], [ "One sure way to get this error is to send a numeric argument to `lookup`. You can try this in python command-line:\r\n\r\n > > > from helpers import lookup\r\n > > > lookup(6540)\r\n\r\nIt returns a TypeError. (If you cast it to a string as with `lookup(str(6540))` you will get results).\r\n\r\nI suspect `places.postal_code` is defined as a numeric (because of the query string `geo=6540`). Conventional wisdom says it should be TEXT. It preserves leading 0 in US postal codes, it handles international postal_codes, and generally speaking, it makes the functions in _URL_0_ easier to write. \r\n\r\nRegardless, make sure the lookup argument is a string, not numeric, in `articles`.", "833" ], [ "Looks like you never tried the game before submitting to check50. The upside to that: now you can try the tests and check your results. Run the game and try to move the blank tile \" ;up twice \" ;. This `move` always returns false, so every attempt will return \" ;Illegal move \" ;. \r\n\r\nWhen `x = i` it can never be `== i + 1` or `== i - 1`. Ditto `y`.\r\n\r\nYou shouldn&#39;t be interested in what the indexes (i and j) are. You should be interested in what the board *contains* at those indexes (ie board[i - 1][j]). \r\n\r\nYou will have to split up the if, because you need to take a different action depending on which condition is true. \r\n\r\nDon&#39;t forget the edges of the board. If i is 0, board[i - 1][j] is not valid.", "364" ], [ "Have a look at `showInfo`. It wraps the content in a & lt;div & gt; for you. And it shows the loading gif when `typeof(content)` is undefined. `ul` is undefined when the `showInfo` function is called; it is declared inside (thus local to) the callback function.\r\n\r\nThis line `&#39; < ul > &#39;` is just hanging out there, not valid syntax.\r\n\r\nYou shouldn&#39;t need `var infowindow = new google.maps.InfoWindow();`. There is a global InfoWindow declared in the distro code, line 8. \r\n\r\nThere are some missing semi-colons. \r\n\r\nI think that putting the articles into an array will not work. `showInfo` is expecting its `content` argument to be straight-up HTML. \r\n\r\nMy jQuery is, ahem, light. But I think this `$(&#39;#ul&#39;).append( articlez.join(&#39;&#39;) );\r\n` is an id selector, and you don&#39;t have an element with `id= \" ;ul \" ;`.", "39" ], [ "One thing that&#39;s wrong: `char filename[1];`. How \" ;big \" ; is a file name? Bigger than 1. (and don&#39;t forget the null-byte, `sprintf` creates a valid string, ie null terminated). That&#39;s not causing this problem, but it&#39;s a memory leak/buffer overflow waiting to happen.\r\n\r\nAn other (bigger) thing is: back-to-back reads. Here `fread(buffer, MEM_BLOCK, 1, input);\r\n` then here `while (fread(buffer, 1, MEM_BLOCK, input) == MEM_BLOCK);`. It&#39;s probably always returning false because it never finds a jpg sig. \r\n\r\nAn other (even bigger) thing is: `int buffer[MEM_BLOCK];`. An int is length 4, so this is reading (and writing) `4 * MEM_BLOCK` bytes. You need to use a `byte` type. Get a hint from `bmp.h` in resize exercise. \r\n\r\nA quick way to properly format your code, whether on initial post or edit: select the code, then click the `{}` icon in the menu bar.", "863" ], [ "This `for holding in holdings:` processes the first element in holding, and then `return`s from the function. The `return` needs \" ;less indent \" ; so it executes when the `for` loop is complete.\r\n\r\nWarning: `stocks` will hold the values of the last `holding` processed. (more later). \r\n\r\n**`symbol` and `shares` are always set to the first element (index 0) in holdings (eg `symbol = holdings[0][&#39;stock&#39;]`).** \r\n\r\nI&#39;m speculating that `index.html` iterates over `stocks`, which has 5 elements, since the output shows 5 rows, but the index route is only sending 1 row. \r\n\r\n`stocks` needs to be some kind of nested object, like a list of dictionaries. Since `holdings` is already a list of dictionaries consider this - if you add new key/value pairs to holdings (eg `holding[&#39;name&#39;] = symbolinfo[&#39;name&#39;]`), you could send *that* to `index.html` and have everything you need.", "604" ], [ "`int` is matching on `in`. `org` is matching on `or`. Why? Because it is checking `is_word` on the second-to-last letter. When `check` process the `t` in `int`, it will not move `crawler` because of `if(word[i+1] != &#39;\\0&#39;)` evaluates to false. When it checks `is_word` it will be looking in the `n` slot and will find `true`. \r\n\r\nThings may get worse before they get better, there is a similar problem in `load`. It will take the `break` on the last letter, because `word[i+1] == &#39;\\n&#39;` is true and therefore `trav` is still pointing to the second-to-last letter.", "615" ], [ "The `for` loop is working and is displaying exactly the data it has. And it technically (theoretically?) is identical to a for loop in C. Perform `this` code `x` times. Syntactically, you (normally) tell C how many times (eg `for (i = 0; i < strlen(somestring); i++)`. The `for stock in stocks` notation is \" ;syntactic sugar \" ;; it knows how long `stocks` is, so it does the routine once for each element. You could also iterate over the list `length-of-list` times. The python syntax would be something like `for i in range(0,length-of-list):`\r\n\r\nHint: if you want to iterate through the `sharesOwned` list in the html, make sure everything you need is in that list. \r\n\r\nAnswers:\r\n\r\n 1. When you request index in the browser, the `index` route will execute and (eventually) call `index.html` at `return render_template()`. \r\n 2. The \" ;difference \" ; between the for loop in the html and the for loop in the python is that they are iterating over different objects (even though both objects are named `sharesOwned`). Each `sharesOwned` object is local to it&#39;s own \" ;environment \" ;. The `sharesOwned` dict object from the index route is passed to the html(flask) as a parameter in the `render_template` call.\r\n 3. In index: The `position` dictionary will only contain values from the last `share` row in the index route. What if sharesOwned had a key called \" ;name \" ; and a key called \" ;pricey \" ;? Something like `share[ \" ;name \" ;] = sharesNow[ \" ;name \" ;]` would do that. If you add a similar key for \" ;pricey \" ; (with the appropriate value, of course), then you only need to pass `sharesOwned` in the render_template call, and you can use `_URL_0_`, `share.pricey` in the html. You could eliminate `position`. (You need to review the code the make sure you understand why it only has the values from the last `share`).", "604" ], [ "Yes, it is necessary to have the `return`, otherwise the program won&#39;t compile, full stop. \r\n\r\nSo why is it \" ;*not printing any output to the terminal* \" ;? Because it is stuck in an infinite loop (when `value` is not found). You know program should be done looking ( \" ;base case \" ;) when `start > end`. This program will never reach that test! If `start` changes or `end` changes, control returns to the `do` loop. \r\n\r\nNotice the difference between `start > end` and `start > = end`. If `start == end` don&#39;t you have one more test?", "326" ], [ "There is a problem in the hash function `{int hash1 = tolower((word[0] - &#39;a&#39;))%26; return hash1;}`. \r\n What will \" ;*Acorn* \" ; return as a hash value (in `check`)? `&#39;A&#39; - &#39;a&#39;` is -32. From `man tolower`\r\n\r\n > If c is not an *unsigned char value*, or EOF, the behavior of these functions is undefined.\r\n\r\nunsigned char is in the range 0 - 127.\r\n\r\n \r\nYou need to get the lowercase value of the first letter and *then* subtract `&#39;a&#39;` to get the alpha index. \r\n\r\nThis may not be the only problem in the code, but it will definitely produce wrong results.\r\n\r\n\r\n\r\n\r\n----------\r\n\r\n\r\nThe downside of assumptions:\r\n\r\nOrder matters? In check, you are hashing the word and *then* converting it to lowercase. Assuming `hash` doesn&#39;t return the alpha index of the lower-cased first letter, this would likely be a problem.", "618" ], [ "It is not complaining about `k` (which is not a \" ;variable sized object \" ;). It is complaining about `grid`. The problem is because you are declaring grid here `int grid[i][j] = k;` by using the keyword `*int*`, with variables as the dimensions. Which I am guessing you added because otherwise the compiler complained about using an \" ;undeclared variable \" ;. Review the supplied code. The playing field is not called `grid`. It is declared at line 27.", "657" ], [ "From the [FAQ][1] section of the spec:\r\n\r\n > **CREATE TABLE places(…​) failed: duplicate column name**\r\n > \r\nIf you see this message upon running `.import` in `sqlite3`, odds are you haven’t run `sqlite3` in the same directory as `mashup.db`. If so, exit `sqlite3` with `.exit`, `cd` to your `mashup directory`, and then re-run `sqlite3 mashup.db`.\r\n\r\n\r\nIt could also mean that you didn&#39;t *create* the table in the same directory that you are running the import from. This would happen if, for instance, you ran `phpliteadmin` or `sqlite3` in the `pset8` directory when you created the table, instead of `mashup` directory.\r\n\r\nA thing to know about sqlite: if you try to access a database (as with `phpliteadmin mashup.db` and it doesn&#39;t exist, sqlite will create it. Bottom line, this means there are two mashup.db in different directories. \r\n\r\n\r\n [1]: _URL_0_", "452" ], [ "First, sounds like the `move` function always returns `false`. That part of the code is not included in the post, but there is no `return true` evident; and that would explain the \" ;illegal move \" ; behaviour. \r\n\r\nSecond, looks like a copy/paste accident in the last `else if` block. It is *testing* the \" ;block right \" ;, but it is *moving* the \" ;block below \" ;. That would explain the \" ;disappearing \" ; tile.", "56" ], [ "Advice only, not an answer: I have never seen a \" ;4 byte \" ; solution work for this pset. Usually it fails when there is a 4 byte sequence in the _middle_ of a jpg that matches the sig. (Spoiler alert: check50 uses such a file). Think about how to approach this the \" ;greedy \" ; way. For each 512 byte block there are 3 options: 1) skip it 2) start a new jpg 3) add to existing jpg. No muss, no fuss, no fseek. And FWIW, memcmp does not return a bool.", "929" ], [ "From the [flask doc (Rendering Templates)][1]: \r\n\r\n > To render a template you can use the render_template() method. All you have to do is provide the name of the template and the **variables** you want to pass to the template engine as keyword **arguments**.\r\n\r\nNotice the plurals. You can send multiple variables to `render_template` like `render_template( \" ;buying.html \" ;, placeholder = buy, var1 = something, var2 = somethingelse)`, then access `var1` and `var2` in the html. \r\n\r\nAnother option is to add the \" ;new \" ; fields as key/value pairs to the `buy` dictionary, like `buy[ \" ;var1 \" ;] = something`.\r\n\r\n\r\n\r\n [1]: _URL_0_", "213" ], [ "There&#39;s a problem here: `line[j + l] = triple;`. \r\n\r\nUsing an infile width of 3 and a factor of 3: When j is 0, this will populate indexes 0,1,2. When j is 1: indexes 1,2,3. When j is 2: indexes 2,3,4.\r\n\r\nBTW a quick way to format code properly: after you paste it, select it (with the mouse) and click the `{}` icon in the format bar. You can also edit the question and do the same thing.", "47" ], [ "Simplify! Think about `init`. You start with some number and *assign* each board location a number. Now think about `won`. It is sort of the opposite. You start with a number and *test* each board location for a number. You should be able to determine \" ;order \" ; using simple arithmetic; testing the value of neighboring tiles is complicating the issue. Don&#39;t forget that the last tile is the \" ;oddball \" ; :)", "364" ], [ "When a string (char*) is initialized like this `char* filename = \" ;000.jpg \" ;;` it is a \" ;string literal \" ;, or *constant*, and is stored in read-only memory. The program will seg fault here `sprintf(filename, \" ;%03d.jpg \" ;, count);` when it tries to change the contents of `filename`. You&#39;ll need to declare `filename` as a char array, or a char* that is allocated with malloc/calloc (**and** make sure you allocate enough room for the null terminator in either case!). \r\n\r\nAnother problem brewing: The comment says `// initialize buffer for 512 bytes of the infile`. But the allocation `int buffer[512];` is 512 *int*s. Review bmp.h (from resize) for hints on how to make the array a \" ;byte type \" ;.", "758" ], [ "Maybe check50 does see the last image, but it is not correct! It likely has some \" ;junk \" ; at the end because of this `while (!feof(inptr));`. Your eyes cannot detect it, but check50 sure can. [This short][1] from last year&#39;s courseware describes the problem with this usage very well, starting around 7:30. As <PERSON> explains:\r\n\r\n > ....the purpose of feof is not to check if the next call to a read function will hit the end of the file, but rather to check whether or not the end of the file has already been reached. In the case of this example, reading the last line of our file goes perfectly smoothly, but the program doesn&#39;t yet know that we&#39;ve hit the end of our file. It&#39;s not until it does one additional read that it counters the end of the file.\r\n\r\n\r\n [1]: _URL_0_", "919" ], [ "Based on the sandbox link, it looks like you are missing the terminating new line as required by the spec:\r\n\r\n > After outputting ciphertext, you should print a newline. Your program should then exit by returning 0 from main.\r\n\r\nsandbox left side: `Expecting the following on standard out —ciphertext:\\s*b\\n`\r\n\r\nsandbox right side: `... but received the following on standard out instead —ciphertext: b`", "56" ], [ "This `/n` is not a new line. From the spec (emphasis added):\r\n\r\n > Your program should print the user’s initials (i.e., the first letter of each word in their name) with no spaces or periods, followed by a newline (**\\n**).\r\n\r\nNotice the two tests that fail with \" ;junk \" ; at the end of the output:\r\n\r\n :( outputs \" ;MB \" ; for \" ; milo banana \" ;\r\n \\ expected output, but not \" ;MB\\u0000/n \" ;\r\n :( outputs \" ;MB \" ; for \" ; milo banana \" ;\r\n \\ expected output, but not \" ;MB\\u0000/n \" ;\r\n\r\nThe thing the inputs have in common is that the last character is a space. That is going to cause a problem here `printf( \" ;%c \" ;, toupper(name[i+1]));` because `name[i+1]` holds the null terminator (which is what `\\u0000` represents: unicode 0).", "50" ], [ "Depending on the draw function, the last row of a 4x4 board will look look like this: `3 | 1 | 2 | 1`. No tile is being set to 0 when the board has an \" ;even \" ; dimension. Let&#39;s join the loops already in progress: \r\n\r\ni = 3, j = 0: place tile 3, set k = 1 \r\ni = 3, j = 1: place tile 1, set k = 2 \r\ni = 3, j = 2: place tile 2, decrement k = > k = 1 \r\ni = 3, j = 3: place tile 1", "221" ], [ "Putting it at the bottom would be bad. From the spec:\r\n\r\n > ... notice how login \" ;remembers \" ; that a user is logged in by storing his or her user_id, an INTEGER, in session. That way, any of this file’s routes can check which user, if any, is logged in. Meanwhile, notice how logout simply clears session, effectively logging a user out.\r\n\r\n`session.clear()` \" ;effectively \" ; logs the user out. It (session data, specifically `session[ \" ;user_id \" ;]`) is not \" ;used \" ; in the login route, it is set there.", "193" ], [ "True. `row` has no element `id` because `row` only contains the columns selected. But do you really need to do another SELECT? From the spec [Hints][1]:\r\n\r\n > If str is an INSERT, and the table into which data was inserted contains an autoincrementing PRIMARY KEY, then execute returns the value of the newly inserted row’s primary key.\r\n\r\nIf _URL_0_ is not autoincrement then you do need to correct the select. \r\n\r\n\r\n [1]: _URL_1_", "480" ], [ "You can send data back to _URL_0_ with a GET method. `url_for` takes arguments that are sent as a query string. From the [flask doc][1]:\r\n\r\n > flask.url_for(endpoint, **values)\r\n\r\n > Generates a URL to the given endpoint with the method provided.\r\n\r\n > Variable arguments that are unknown to the target endpoint are appended to the generated URL as query arguments.\r\n\r\nSo something like `href= \" ;{{ url_for(&#39;buy&#39;,symbol=stock.symbol) }} \" ;`. Then you can access via `request.method.get( \" ;symbol \" ;)` in _URL_0_. There&#39;s a flaw with this however. How will you send the number of shares? That is not known when you build the html.\r\n\r\nAnother approach would be to use a POST method. (Generally speaking use a POST method because you will be doing an update). Here&#39;s an overview of how to accomplish that:\r\n\r\n - Make index a real \" ;form \" ;. Use login.html as your guide\r\n\r\n - add an input element to allow user to enter number of shares. Make sure you use a \" ;name \" ; attribute; that is what is submitted with the form. Example: `input type= \" ;number \" ; name= \" ;{{stock.symbol}} \" ;`\r\n\r\n - make the buttons real button elements, type= \" ;submit \" ;. They can have different formaction attributes as per [this MDN doc][2]. Example: ` < button type= \" ;submit \" ; formaction= \" ;{{ url_for(&#39;buy&#39;) }} \" ; formmethod= \" ;post \" ; > `\r\n\r\n - In the buy||sell route you will need to \" ;analyze \" ; the\r\n `request.form` data. There will be a \" ;key \" ; for each symbol in the list. The one with a \" ;value \" ; (ie not `&#39;&#39;`) will be the number entered by user. It is a string. \r\n\r\n [1]: _URL_1_\r\n [2]: _URL_2_", "706" ], [ "It has to do with `LIMIT` vis-a-vis run time. If `LIMIT` is defined 65536 the check50 fails. If `LIMIT` is defined 65535 check50 passes. Suspect it is timing out, since part of the exercise is \" ;running time \" ; as in:\r\n\r\n > The running time of your implementation must be in O(log *n*), where n is the array’s size.\r\n\r\nEven though changing LIMIT will make the program pass the autograder, it doesn&#39;t make it right as per the spec, because it exceeds the allowable run time. If you notice in the sandbox result, check50 does a `make -s`. The `-s` switch means silent, so there is no report of the clang command you would normally see. That&#39;s part of the check50 \" ;special sauce \" ;. You, the user, cannot know what all is being included; nor can the user know what `find.c` or `Makefile` is being used, since only `helpers.c` is submitted. \r\n\r\nIt would be reasonable to assume that check50 has some kind of time threshold built in, since that is part of the assignment. So for a 3 element array it runs for 3X time units, or a 4 element array, it runs for 4X time units. It just so happens, when LIMIT is 65536, it exceeds the allowable \" ;time units \" ;. It is merely coincidence. \r\n\r\nIt would take a fair amount of reverse engineering to deobfuscate check50. That doesn&#39;t seem like a good use of time. Not to mention, it sounds like a violation of the academic honesty policy.", "56" ], [ "One problem is this syntax `markers += marker;`. That does not add an element to an array in js. The [array method `push`][1] adds elements to an array. \r\n\r\nAnother problem is here `marker.addListener(map, \" ;click \" ;, function()`. That&#39;s not the correct syntax to add a listener to a marker (extraneous argument). Review [the api doc here][2]. \r\n\r\nOnce you get those things sorted, you&#39;ll run into trouble here `showInfo(marker, data[i]);`. `data[i]` is local to the addMarker function, so when it calls the function from the click action, there is no `data[i]` (more specifically, there is no `i`, thus `data[i]` is undefined). You&#39;ll have to sort out what argument to send to `showInfo`. \r\n\r\nSome hints for the `content` argument to showInfo:\r\n\r\nFrom the spec (showInfo):\r\n\r\n > This function opens the info window at a particular marker with particular content (i.e., HTML).\r\n\r\nFrom the spec (addMarker):\r\n\r\n > the contents of which should be an unordered list of links to article for that article’s location\r\n\r\nPutting those two bits together, think about `content` as the HTML for an unordered list of links. \r\n\r\n\r\n\r\n\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "648" ], [ "> \" ;Instance of &#39;set&#39; has no &#39;adds&#39; member \" ; - this is on lines 18 and 28 - the \" ;self.positives.adds(... \" ; lines.\r\n\r\nThe set operator is the singular `add`. Notice Prof is (presumably) having the same error:\r\n\r\n[![enter image description here][1]][1]\r\n\r\nHere&#39;s [python doc on sets][2]. \r\n\r\nThe `load` error mentioned in your comment is because the `load` function is defined to take 3 arguments, the call `load()` is sending 0 arguments.\r\n\r\nBut let&#39;s back up a little. Adding a `load` function to an Analyzer object is much more complicated than it need be. Analyzer is an object (Class), inside of which is data. The data you want it to contain is two lists. It is more analogous to the `_URL_1_` in the lecture. Build those lists inside the `__init__` function, and they will always be available to an Analyzer object. The `analyze` function/method will have access to these sets, so when it is called from `smile`, it can evaluate the word. \r\n\r\nAnd remember you want to `strip` newlines from your input. From the python doc \" ;*If omitted or None, the chars argument defaults to removing whitespace.* \" ;\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_0_", "977" ], [ "The code comment \" ;_Returns true if str is a valid flag (-a, -b, -r, or -s), false otherwise_ \" ; indicates you would use `str` to determine validity. In C, strings cannot be compared directly as in ` if (str == \" ;-a \" ;)` or you will get the error `error: result of comparison against a string literal unspecified (use strncmp instead)` as mentioned in the comment. You would need to use the `strcmp` function, which you can review with `man strcmp`. Or perhaps recall `initials` and `caesar` where strings were processed as individual characters (hint, hint).", "615" ], [ "The problem is with the `fwrite`s. This \r\n \r\n `fwrite( & triple, sizeof(RGBTRIPLE),f,outptr);` \r\n \r\n does not write the same `triple` `f` times. \r\n\r\n It writes `sizeof(RGBTRIPLE) * f` bytes starting at ` & triple`. For a factor of 3, it will write 9 bytes starting at the address of `triple`. The `fread` read only 3 bytes (`sizeof(RBGTRIPLE)`) to the address of `triple`, so the last 6 bytes are \" ;junk \" ;. \r\n\r\nUnder the hood, `fwrite` calculates the total number of bytes (in this case `sizeof(RGBTRIPLE) * f`) and *then* gets that many bytes from the input pointer (` & triple`) and writes them to the ouptut pointer (`outptr`). \r\n\r\n\r\n\r\nSince program needs to write each ` & triple` `f` times, a loop is called for.", "863" ], [ "Are you logging in every time or registering every time? If you are logging in, then register is not called so it is not causing the problem. If you are registering every time, then you need to correct the posted code to match the IDE. This code is not indented properly, and will cause errors, the app will not run. To properly format the code: after it is pasted, select it and click the `{}` icon in the format bar.", "56" ], [ "The `unload` function is intended to do all the `free`ing.\r\n\r\n When this line `free(ptr);` executes in the load function it is freeing the root node. Why? last line feed of last word does this `ptr = root;`. Boom, gone. \r\n\r\nThe `free(ptr)` in check will cause problems when you move on to `unload`. Once the root node is free&#39;d, you do not have access to any other nodes.", "959" ], [ "1. The button does the action defined in the `action` attribute of the & lt;form & gt; tag. `text` is not a valid `type` for a button (see [MDN doc on button][1] and [form][2]) but it doesn&#39;t fail because, well, browsers have to be very (*very*) forgiving because there is a lot of bad code out there. If you validate your code (`type= \" ;text \" ;`) with a code validator (for example [Nu Html Checker][3]), it would report an error because `text` is not a valid button `type`.\r\n 2. Again from [MDN][4], \" ;*Requests using GET should only retrieve data.* \" ; and a POST request \" ;*... results in a change on the server* \" ;. Another (simple) difference: GET shows the query string (eg /search?q=02138) in the address bar, POST does not.\r\n 3. The `USERS` table was not created in the software, it \" ;came that way \" ; in the downloaded `finance.db`. \r\n 4. `finance.db` is \" ;the main database file \" ;. [Here][5] is the technical discussion from _URL_4_. Besides all the header stuff, the data you put into the database ( \" ;INSERT \" ;) is \" ;in there \" ;. Just like a `.xlsx` file has the rows and columns of a spreadsheet. \r\n 5. Last but not least, sorry I don&#39;t know! Does this [reddit post][6] help?\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_3_\r\n [3]: _URL_5_\r\n [4]: _URL_0_\r\n [5]: _URL_2_\r\n [6]: _URL_6_", "858" ], [ "After edit:\r\n\r\nGiving `keyword` it&#39;s own subscript `k` is a step in the right direction. However, it is still tied to *p* in this loop `for (int i = 0, k=0, n = strlen(p); i < n; ++i,++k) `. If `k` is being incremented at the same rate as `i`, well, still the same problem. And the modulus (`keyword[k%n]`) cannot be tied to the length of `p`. In this example it will go way out of bounds.\r\n\r\nThe combination of this `char c[strlen(p)];` and this `n = strlen(c)` is going to give you trouble. When you use a string function (in this case `strlen(c)`), the computer expects the argument `c` to be a real, valid, string. The thing that makes a string a string is the terminating null byte. Here it has been declared a char array, and it has no terminating null byte (nor space for one!). If it is too daunting to make `c` a realio-trulio string, consider saving the length of p in a variable after p is created, and using that for the output iteration. \r\n\r\n----------\r\n\r\n\r\nFrom the spec (emphasis added):\r\n > Your program must only apply Vigen&#232;re’s cipher to a character in *p* if that character is a letter. All other characters (numbers, symbols, spaces, punctuation marks, etc.) must be outputted unchanged. Moreover, if your code is about to apply the *j < sup > th < /sup > * character of *k* to the *i < sup > th < /sup > * character of *p*, but the latter proves to be a non-alphabetical character, **you must wait** to apply that *j < sup > th < /sup > * character of *k* to the next alphabetical character in *p*; **you must not yet advance** to the next character in *k*.\r\n\r\nThe \" ;secret \" ; message here: the plaintext and the key do not \" ;run at the same rate \" ;. `p[i]` will not necessarily be encrypted by `k[i]`!", "758" ], [ "A quick way to format code properly: select the code and click the `{}` in the format bar, to-da. This can be done on initial post or you can edit the question and fix the format.\r\n\r\nHere is the pseudo code from the walkthrough:\r\n\r\n > psuedocode: \" ;recopy \" ; method\r\n > \r\n > for each row \r\n\t & nbsp; & nbsp; & nbsp; & nbsp; for n-1 times \r\n\t\t & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; write pixels, padding to outfile \r\n\t\t & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; send infile cursor back \r\n\t & nbsp; & nbsp; & nbsp; & nbsp; write pixels, padding to outfile \r\n\t & nbsp; & nbsp; & nbsp; & nbsp; skip over infile padding \r\n\r\n*for each row* corresponds to the `i` loop. \r\n*for n-1 times* corresponds to the `eachrow` loop. Uh oh, how many iterations of `eachrow` are there? Therein lies the problem.", "631" ], [ "This definition `def get_user_timeline(screen_name, count=200):` means the function takes one argument *or* two. If the call is `get_user_timeline(katyperry)` it will return 200 tweets. If the call is `get_user_timeline(katyperry,50)` it will return 50 tweets. 200 is the default if count argument is not supplied. So no need to recreate the function, just send the desired count.\r\n\r\n\r\n\r\nYou are not sending a string to `word_tokenize` because tokenizer.tokenize() returns a list.", "639" ], [ "The pseudocode from the walkthrough:\r\n\r\n > psuedocode: \" ;recopy \" ; method\r\n > \r\n > for each row \r\n\t & nbsp; & nbsp; & nbsp; & nbsp; for n-1 times \r\n\t\t & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; write pixels, padding to outfile \r\n\t\t & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; send infile cursor back \r\n\t & nbsp; & nbsp; & nbsp; & nbsp; write pixels, padding to outfile \r\n\t & nbsp; & nbsp; & nbsp; & nbsp; skip over infile padding \r\n\r\nThe pseudocode for this program:\r\n\r\n > for each row \r\n\t & nbsp; & nbsp; & nbsp; & nbsp; for n times \r\n\t\t & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; write pixels, padding to outfile \r\n & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; skip over infile padding \r\n\t\t & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; send infile cursor back \r\n\r\nThere&#39;s also a problem with `fseek(inptr, -bi.biWidth * 3 + padding_new, SEEK_CUR);`. You want to send the infile cursor back to the *beginning of the row*. How could that include the new padding?", "631" ], [ "The problem stems from here:\r\n\r\n int index = ((int) word[i] - &#39;a&#39;);\r\n \r\n //if current letteri \" ;&#39; \" ; then we give to it the last place in the array of pointers\r\n if (((int) word[i]) == 96) index = 27;\r\n\r\nascii 96 is a backtick or backquote character < pre > & #96; < /pre > apostrophe `&#39;` is ascii 39. When the program encounters apostrophe, index is `39 - &#39;a&#39;`, a negative number, and will probably crash here `if (nextNode- > children [index] == NULL)`. The small dictionary does not contain apostrophe. \r\n\r\nMake sure `index = 27` is what you want when you process an apostrophe. Depending on how your node is defined, index 27 may be beyond \" ;*the last place in the array of pointers* \" ;.", "615" ], [ "`check` will only return true for the first word stored in `hashtable` for any `h`. \r\n\r\nProblem in the load function:\r\n\r\n else //if not, insert new node\r\n {\r\n new_node- > next = head;\r\n head = new_node;\r\n }\r\n\r\nAfter this block executes who is `hashtable[h]` pointing to? The first word. \r\nWho is pointing to `new_node`? Nobody. Well, technically, the node(s) called head, which are local to this function, and thus destroyed when function returns.\r\n\r\nHint1: `node *head = hashtable[h];` is unnecessary \r\n \r\nHint2: If `head` is the head of the list, then nothing should point to it.", "959" ], [ "`biSizeImage` will only be correct if padding is 0. Why? `biSizeImage` is measured in bytes. Since `biWidth` is measured in pixels, you need a factor of 3 (`* 3`) to convert it to bytes. But `newPadding` is already measured in bytes. Check the equation here `bi.biSizeImage = ( ( (bi.biWidth * posBiHeight) * 3 ) + (newPadding * 3 * posBiHeight) );`\r\n\r\nThere is another problem, which may not be evident from your testing or check50. What is the value of `posBiHeight;` if `bi.biHeight` is positive? Try this program with clue.bmp from the whodunit exercise to see what happens.", "969" ], [ "The program never finds a jpg signature because this test `(buffer[3] & 0xf) == 0xe0)` is wrong. Suggest you review [this answer][1] by <PERSON> for an excellent explanation.\r\n\r\nAfter you sort that out, there&#39;s other problems brewing with some of the `fwrite`s. After you `fread` into `buffer` and find a signature, this `fwrite(imageFile, 512, 1, img);` will write out *the next 512 bytes in image file*, because that&#39;s where the file pointer is. It will not write the signature block at all (which is sitting in `buffer`, hint hint). Looks like that problem exists multiple times. \r\n\r\n\r\n [1]: _URL_0_", "929" ], [ "The heart of the matter is here: `fwrite(buffer,sizeof(buffer), 1,img);`. `buffer` is a pointer, `sizeof(a pointer)` is 8. [If `buffer` had been declared `byte buffer[512]` that would have worked]. \r\n\r\nOnce that is fixed, there is another problem here `while (!feof(inptr))`. [This short][1] from last year&#39;s courseware describes the problem with that usage better than I ever could. At around 7:30, <PERSON> explains:\r\n\r\n > ....the purpose of feof is not to check if the next call to a read function will hit the end of the file, but rather to check whether or not the end of the file has already been reached. In the case of this example, reading the last line of our file goes perfectly smoothly, but the program doesn&#39;t yet know that we&#39;ve hit the end of our file. It&#39;s not until it does one additional read that it counters the end of the file.\r\n\r\nHere&#39;s a way to avoid `!feof` and incorporate your `result` idea. From man fread:\r\n\r\n > On success, fread() and fwrite() return the number of items read or written. This number equals the number of bytes\r\n transferred only when size is 1.\r\n\r\nYou know that a jpg starts at the beginning of a block (therefore the cruft at the beginning of the file is X number of 512-byte blocks), and you know that \" ;*cameras only write to those cards in units of 512 B* \" ;. Therefore, every `fread(buffer, 512,1, inptr);` will return 1 (if 512 bytes read) or 0 (ie EOF reached). Think about how you can use `fread` as the while condition. (Don&#39;t forget to remove the explicit `fread`). \r\n\r\n\r\n [1]: _URL_0_", "863" ], [ "The query will return data if:\r\n\r\n - user enters postal code (as you already mentioned)\r\n - user enters a place name (as you saw when you tried \" ;Cambridge \" ;)\r\n - user enters a state name (like \" ;New Jersey \" ; or \" ;Utah \" ;; that is the data that admin_name1 holds)\r\n\r\nIt will *not* find a match if you query \" ;Cambridge MA% \" ; because none of those database columns (postal_code, place_name, admin_name1) will match that input (as you saw with the sql test and the query_string test).\r\n\r\nIt will return exactly one row to the app because this `return jsonify(rows[0])` says to return the first element of the rows array; you may want to change that so there are more options in the dropdown list.", "714" ], [ "The autoincrement keys are in a table called `sqlite_sequence`. I do not see a way to access that table through the phpliteadmin GUI, but it can be accessed from the SQL tab (or with sqlite3). It has two columns, `name` which is table name and `seq` which is the last sequence assigned. After you delete all the records in the users table you could `update sqlite_sequence set seq = 0 where name = &#39;users&#39;`. The next key it assigns will be 1.", "480" ], [ "From the [flask doc][1] (The Request Object): \r\n\r\n > What happens if the key does not exist in the form attribute? In that case a special KeyError is raised. You can catch it like a standard KeyError but if you don’t do that, a HTTP 400 Bad Request error page is shown instead. So for many situations you don’t have to deal with that problem.\r\n\r\n`buyq` does not exist in the request object because it is in a different & lt;form & gt; element. Here&#39;s the [MDN doc on form][2]. \r\n\r\nSounds like you don&#39;t want a different \" ;form \" ;, you just want additional input elements in the form, who&#39;s keys/values you can examine in the trade route to determine the user&#39;s intention. \r\n\r\nAs to: \r\n\r\n > I am not sure if request.form returning an empty string is any different from request.form returning nothing at all\r\n\r\nNo difference. \r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "858" ], [ "UPDATE 1 code:\r\n\r\nThis declaration `char* buff[512];` is a problem. Remember, a `char` is in the range of 0 - 127. Use a \" ;byte \" ; type, as in bmp.h from recover.\r\n\r\nProgram *always* writes a block that is not a sig block, therefore it will be writing the \" ;garbage \" ; data from the beginning of the raw file to the first (`000`) jpg. It needs (at least) one more test \r\n\r\n----------\r\n\r\n\r\nFirst a small problem: ` \" ;00%i.jpg \" ;`. This says \" ;pad with 0 to a maximum width of 0 \" ;. So there will be no padding at all. The output will be `1.jpg`, `2.jpg`, etc instead of `001.jpg`, `002.jpg`.\r\n\r\nNow the really big problems: \r\n\r\n - This `while(fgetc(src)!=EOF)` reads one character at a time. The next thing it does is `fread( & tmp,sizeof(JBLK),1,src);`: ie, read the *next* 4 bytes. The chances that it will find a jpg signature at a 512-byte boundary are low (8 out of 50 perhaps?). And it also increases the liklihood that it will find a sig in the middle of a block! The \" ;unit-of-measure \" ; for this assignment is 512-byte blocks because a jpg starts on a block boundary, and occupies X blocks.\r\n - within the while loop, program only reads and writes 4-byte (`JBLK`) chunks. `fgetpos` and `fsetpos` are *file position* functions, they don&#39;t access any data in the file.\r\n\r\nIt might serve you well to watch the walkthrough again. Pay special attention to the psuedocode at 8:00. You need to read the file in 512-byte chunks, and decide what to do with each chunk. There are only 3 choices: \r\n\r\n 1. If no jpg found yet, ignore it.\r\n 2. If it&#39;s a jpg signature, start a new jpg.\r\n 3. Otherwise, write block to current jpg.", "863" ], [ "1. *How does the computer recognize that those few lines inside a JavaScript file is actually html and not JavaScript codes?* It doesn&#39;t. It&#39;s not javascript or html to the function, it&#39;s data. When it is (finally) rendered by the browser, it is \" ;recognized \" ; as html. \r\n 2. *rather than writing part of the program in python and part in JavaScript, have everything written in the same language?*. Absolutely. Remember pset6/7? No JavaScript at all. [Here][1] is one of the 14 million articles Mr. <PERSON> returned when asked \" ;web server vs client languages \" ;.\r\n 3. *Are they just alternatives to each other?*. `addListener` is a function supplied by the Google APIs with prescribed arguments to abstract the DOM manipulation. `onsubmit` is an attribute of a DOM object and `document.getElementByID(‘xxx’).onsubmit = function() {}` is direct manipulation of the object. \r\n 4. *How does it work in the problem set ...... that any open info window closes automatically?*. Maybe `removeMarker` called from `update`?\r\n 5. The simple answer to this complex question is *you, the app developler have **total** control*. You likely have to do much more detailed and intense study of the Google APIs and all the available functions and options. You may have to tweak the selects used to get places. If you don&#39;t want markers from small towns/cities, add a \" ;population \" ; column to places and use it in the query. If you always want a marker on LA, evaluate the returned coordinates to determine if they are within some distance of LA, and add a marker for LA (is there a setting/API for a \" ;sticky \" ; marker?).\r\n(And I disagree that *however you drag the map within Illinois, you always see Chicago*, but that&#39;s a discussion for another day :).\r\n [1]: _URL_0_", "255" ], [ "- The \" ;something like \" ; syntax in [this call][1] for the href attribute was wrong and has been corrected. It is more something like `href= \" ;{{ url_for(&#39;buy&#39;, symbol=stock.symbol ) }} \" ;`. stock.symbol should not be quoted nor escaped with braces. (the quotes make it a literal; the braces are only used to escape the objects from html).\r\n - An `a` element cannot be a descendant of a `button` element. Use an `a` element with the same `class` as the button for styling. \r\n - When using a GET request, the query values are not in `request.form`, which explains why `request.form.get( \" ;symbol \" ;)` returns None. Use `request.args`. From the [flask doc][2]:\r\n\r\n > To access parameters submitted in the URL (?key=value) you can use the args attribute:\r\n\r\n > searchword = request.args.get(&#39;key&#39;, &#39;&#39;)\r\n\r\n - In `buy.html`, you can use the `value` attribute for the symbol field to set the \" ;default \" ; as the symbol that was send in the render_template call. Something like `value= \" ;{{temp.symbol}} \" ;`.\r\n\r\nAddendum after comment:\r\n\r\nHere&#39;s what I would do: send the whole value attribute as an argument to buy.html. Something like \r\n\r\n if not request.args.get( \" ;symbol \" ;):\r\n val= \" ; \" ;\r\n else:\r\n val=&#39;value=&#39; + request.args.get( \" ;symbol \" ;)\r\n\r\nThen in buy.html add `{{val}}` to the input tag (ie instead of `value=...` ). (I tried it and it worked in Firefox, the html is valid).\r\n\r\nI suspect the `/` is coming from the tag close (&#39;/ > &#39;). Move the `value` attribute and it will display whatever follows it. \r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "470" ], [ "The first thing that should get your attention, before valgrind, before help50, is this; `Could not open file`. What does the code do if the file is not found? `return 1;`. Review speller.c again. It calls load here `bool loaded = load(dictionary);`. Then it tests the return value of load here `if (!loaded)`. Remembering that 1 evaluates to true and 0 evaluates to false, what happens next? speller continues on it&#39;s way because `!loaded` evaluates to _false_! So it&#39;s trying to check the text against no dictionary!\r\n\r\nSuggest all the non-successful `returns` from load should be `return false;` to indicate the dictionary did not load properly, since the function returns a `bool`. \r\n\r\nIf you were using a custom dictionary when you called speller, check the file name. If you were using the small dictionary, it should be located in \" ;dictionaries/small \" ;, so the call would be `./speller dictionaries/small textfile`. If you were using no dictionary argument, then make sure your directory layout matches the distribution code.", "1022" ], [ "To get a hint, answer these two questions (the problem should become obvious):\r\n\r\n - How long is `k`?\r\n - How many times will the `increase` loop execute?\r\n\r\nSome unsolicited comments: looping through the key with a `for` loop is going down the wrong road. You only want to 1) increase the key&#39;s index when you use it (which is conditionally) and 2) not let the key&#39;s index go \" ;out of bounds \" ;.", "598" ], [ "Random by design. Review the sql(s) in the `update` function of _URL_0_ and the reason will be revealed. That&#39;s the sql(s) used to populate the data sent to addMarker. \r\n\r\nThe staff&#39;s solution for articles returns 5 rows. The default for google news RSS is 10 rows. So it seems that the staff solution is not using the same version of `_URL_1_` as is supplied in the distro code, or some other unknown (and unknowable) variation in the software. From the spec:\r\n\r\n > Additionally, you can search for location based news by modifying parameters in the URL, like the ones below. For a full list of parameters you can check out [this guide][1].\r\n\r\n\r\n [1]: _URL_2_", "843" ], [ "Sadly, no. In the [walkthrough][1] at around 4:30 <PERSON> advises \" ;*advance to the next letter in keyword **only when** plaintext is a letter* \" ;. It is *conditional*. Conditional suggests an `if` statement. There is no loop (ie no `for` or `while`). \r\n\r\nThis `k = strlen(s) % strlen(key) ` looks like an attempt to handle the wraparound. Be warned, the index of key (assuming `k` here) is *independent* of the plaintext. It only depends on (the length of) the key. Every time you use a letter from the key, increase the index (`k`) by 1. But never let it be greater than the length of the key (that&#39;s where modulo comes in). Review the countoff example in the walkthrough at 6:05. \r\n\r\nThere are other details that will give you trouble; you are going to run into problems with the way you are handling case. Case of the plaintext and case of the key are independent of each other, great hint in walkthrough at 0:14. Think about how you could convert `key[k]` to a \" ;caesar number \" ; *before* you encipher the plaintext letter. Then you need only consider the case of the plaintext. \r\n\r\n\r\nSuggest you rewatch the walkthrough, write the pseudocode as suggested, then attack the problem step-by-step. If you got caesar you can definitely get this.\r\n\r\n [1]: _URL_0_", "467" ], [ "Without seeing code, here&#39;s a scenario I would invent. If all the 143+K words are going into one hash index then it just takes a really really really long time to traverse. Since \" ;Textfile \" ; and \" ;Wiggum \" ; (first fail words) are way down in the alphabet, make sure check starts at the correct hash index. What happens with a one word text file of your own creation against the large dictionary? Does `apple` work fairly quickly, but `zebra` takes forever? There&#39;s always debug50, and valgrind has been known to give excellent hints.", "421" ], [ "On some versions of C, you cannot declare a global variable `index` if you include & lt;string.h & gt;. Apparently the check50 server has such a version (and the IDE does not). There is a comment about it in the answer to [this post][1]. \r\n\r\n > As an aside, some C implementations (BSD-based) define an index function in string.h which may also cause a problem. Use of this function is deprecated and it doesn&#39;t appear in the C standard (use strchr instead) but it may be the cause of problems if you&#39;re running on (for example) Mac OS or OpenBSD (or even Linux under some combination of #define settings, I believe).\r\n\r\nI found a few other references to this problem; I&#39;ll search a while longer to see if I can find something more definitive. Suggest you change the name of the variable. If you view `/usr/include/string.h` you&#39;ll see there is still a definition for a function named `index`. \r\n\r\nFor grins, I sent my vigenere through check50 (it includes string.h), and it passed all tests. I modified it and added a global variable named index, and check50 failed, with a similar error (which references string.h specifically):\r\n\r\n ... but received the following on standard error instead —\r\n \r\n vigenere.c:7:5: error: redefinition of &#39;index&#39; as different kind of symbol\r\n int index;\r\n ^\r\n /usr/include/string.h:485:14: note: previous definition is here\r\n extern char *index (const char *__s, int __c)\r\n\r\nSuspect the different result when compiling speller is because dictionary.c does not have a `main` function. \r\n\r\n [1]: _URL_0_", "667" ], [ "That&#39;s old news. The staff&#39;s output, I mean. All the articles are a month old. It is reasonable to assume that the staff&#39;s solution has \" ;features \" ; that are unknown (and unknowable). As noted in the spec, \r\n\r\n > Additionally, you can search for location based news by modifying parameters in the URL, like the ones below. For a full list of parameters you can check out [this guide][1].\r\n\r\nThis pset is far less prescribed than the earlier ones; there is no imperative to match a specific \" ;data set \" ;, no check50. In fact:\r\n\r\n > You’re welcome to stylize your own app differently, but here’s what the staff’s solution looks like!\r\n\r\nDon&#39;t sweat it. As long as you get articles from the location, you&#39;re good. \r\n\r\n\r\n [1]: _URL_0_", "1012" ], [ "The proximate problem is `free(newNode);`. You are building this `hashtable` with addresses to memory that need to persist for the life of the program. That&#39;s the essential point of a separate `unload` function. Program is assigning the same address to `hashtable[1]` because you just told it to free the memory at address `0x603250`. \r\n\r\nYou will probably run into problems in check too, with `free(cursor)` and `free(cursor- > word)` because, well, you need those nodes to persist. \r\n\r\nLooks like other troubles brewing in the check function, but once you have a good dictionary loaded, debug50 will help you to the finish!", "959" ], [ "The error from this sql `INSERT INTO users (&#39;transaction&#39;) VALUES(:cash)` (quotes or not) is because there is no *column* named `transaction` in the `users` table. \r\n\r\nNow is the perfect time to add a table for transactions, but don&#39;t call it `transaction`, it&#39;s just a pain in the neck. (Generally speaking, in every language, avoid using reserved words to name things.) If you added a `transaction` table but do not see it here, it is likely that you have two `finance.db`. When you call `phpliteadmin finance.db` it will look for the db file in the current working directory, and if it is not found it will be created. So maybe there is a `finance.db` in pset7 directory? In any case, move on, don&#39;t call the table `transaction`, remember to call `phpliteadmin` from the `finance` directory. \r\n\r\nIt looks like the `insert_cash` line is not appropriate for the `buy` method. \r\n\r\nIt looks like you want `listed_cash` to be the amount of cash the user currently has. Therefore, your select will be from the `users` table. (There is no table named `cash`). \r\n\r\nIt looks like `buying` should be updating the `cash` in the users record. Review the sql, there&#39;s a mistake. (There is no table named `cash`).\r\n\r\nUse the [sqlite doc][1] to review the syntax of INSERT, UPDATE and SELECT statements (specifically the use of table names and column names). \r\n\r\nA quick cheat sheet:\r\n\r\n > SELECT column_names FROM table_name \r\n > INSERT INTO table_name (columns) VALUES (values) \r\n > UPDATE table_name set column_name = value\r\n\r\nThe code does not look overly complicated nor long. This method does a lot of verifying, a lot of arithmetic and a lot of updating. \r\n\r\n\r\n [1]: _URL_0_", "452" ], [ "There is no \" ;thing \" ; called `category`. From the [Flask flash documentation][1]:\r\n\r\n {% with messages = get_flashed_messages(with_categories=true) %}\r\n {% if messages %}\r\n < ul class=flashes > \r\n {% for category, message in messages %}\r\n < li class= \" ;{{ category }} \" ; > {{ message }} < /li > \r\n {% endfor %}\r\n < /ul > \r\n {% endif %}\r\n {% endwith %}\r\n\r\n\r\nBased on that code, it looks like `get_flashed_messages` returns a dictionary iterator object (as created with `dict.items()` perhaps). \r\n\r\n`dict.items()` returns a [Dictionary view object][2]. That affords this syntax: \r\n `for key, value in dictview`. It will populate key and value with the key,value pairs in the dictionary. `for category, message in messages` from the doc example indicates that the \" ;key \" ; is category and \" ;value \" ; is message. \r\n\r\nA quick review of bootstrap.css indicates it has 4 alert classes: alert-info (blue), alert-success (green), alert-warning (pale yellow), alert-danger (pale red). Think about sending the pre-defined alert type instead of creating your own. Think about how you can construct your div within a for loop similar to the & lt;ul & gt; created in the example Think about how to use `category` to \" ;apply \" ; the desired tone. Maybe something like & lt;`div class= \" ;alert {{category}} \" ; .....` & gt;\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "812" ], [ "`tokenize` returns a *list*, therefore `tokens` is a list from `tokens = tokenizer.tokenize(text)`. Even if `text` is *only one word*. If text is &#39;cat&#39;, tokens is [&#39;cat&#39;].\r\n\r\nThis `if tokens==self.Pos[A]:` can never be true (nor the analogous test on `sef.Neg[B]`) because you are comparing a list (`tokens`) to one member of a list (ie a single word `Pos[A]`, `Neg[B]`). \r\n\r\nYou do not need to iterate through the word lists. You need to iterate through the words in `tokens`. The previous version was closer:\r\n\r\n for word in text:\r\n tokens = tokenizer.tokenize(text)\r\n y=self.check(tokens)\r\n sum+=y\r\n\r\nThe bug in that code is you want to `check(word)` not `check(tokens)`. Without reintroducing the check function, you could similarly test `if word in self.Pos`.\r\n\r\n----------\r\n\r\n\r\nAnswer for original code: \r\n\r\nThere is no str method named `startwith`. Review the [python doc][1] to check the correct spelling, you&#39;re missing an `s`. \r\n\r\nDid you really mean `text` here? `tokens = tokenizer.tokenize(text)`. Because if `text` is a string of words, then `tokens` is a list of words, and `check` will always return 0.\r\n\r\n\r\n\r\n\r\n [1]: _URL_0_", "296" ], [ "You should be able to find the line that seg faults quite easily with debug50. Set a breakpoint at `check`. Create a small text file, one word will do. Then run `debug50 ./speller small.txt small.txt`. It will stop at `char *cword = NULL`, and as soon it tries to execute the next line, boom, it will seg fault here `strcpy(cword, word);` NULL is a defined *constant*, therefore you cannot copy anything into it.\r\n\r\nYou need to allocate `cword`. If you use malloc or calloc, you know how big it needs to be: the length of `word` plus one for the null byte. If you&#39;d rather declare it a char array, you know how big it needs to be, LENGTH plus one for the null byte.", "511" ], [ "One problem is here: `word[strlen(word) - 1] = &#39;\\0&#39;;`\r\n\r\nYou would need to \" ;null out \" ; the newline if using `fgets`. Not so with `fscanf`, it does not include the newline. From man fscanf:\r\n\r\n > **s** Matches a sequence of non-white-space characters; the next pointer must be a pointer to character array that is\r\n long enough to hold the input sequence and the terminating null byte (&#39;\\0&#39;), which is added automatically. The\r\n input string stops at white space or at the maximum field width, whichever occurs first.\r\n\r\nnewline is considered white space, as per the same doc:\r\n\r\n > A sequence of white-space characters (space, tab, newline, etc.; see isspace(3))", "50" ], [ "It&#39;s not skipping an if. The printf function *does* run. However, it&#39;s \" ;printing \" ; an \" ;unprintable \" ; character. \r\n\r\nCheck your equations. When i,k = 3\r\n\r\n` (((s[i] - 97) + (toupper(argv[1][k]) - 65) % 26) + 97);` = > \r\n\r\n`(((t - 97) + (&#39;O&#39; - 65) % 26) + 97)` = > \r\n\r\n`(((19) + (14) % 26 ) + 97)` = > \r\n\r\nGet rid of the outer parens (personal choice, it&#39;s easier to \" ;read \" ;)\r\n\r\n`((19) + (14) % 26) + 97` = > \r\n\r\nBy operator precedence, it will do `(14) % 26` first = > \r\n\r\n`((19) + 14) + 97` = > 130 = > unprintable (ascii range is 0 - 127)\r\n\r\n\r\n\r\nIf you want to \" ;see \" ; what the computer \" ;sees \" ; you can run `./vigenere bacon | cat -v`. This will pipe the output to `cat -v`; the `v` switch is \" ;show nonprinting \" ;.", "941" ], [ "<PERSON>, Your program _is_ running. It may _seem_ like it&#39;s just sitting there blinking at you, but actually, it is waiting for your first response. Of course the next question is: why isn&#39;t it displaying the \" ;Enter the student... \" ; prompt? Well, it&#39;s also waiting for the stdout buffer to be flushed. More on that later. Alas, even if you flush the buffer you STILL won&#39;t see the prompts if you redirect your program&#39;s output to data.txt. By calling the program this way `./program > data.txt` you are redirecting _everything_ the program outputs to the file data.txt, including your prompts, so you will never see them. \r\n\r\nOne solution to that problem would be to use the linux \" ;tee \" ; command. That allows you to see the output and redirect it at the same time. The syntax is `./program | tee data.txt`. \r\n\r\nNow back to \" ;flushing the buffer \" ;. (full disclosure: I know how to do this programatically, and I understand the concept, but I cannot explain it technically.) If you add `fflush(stdout);` after each of your printf statements, you will see the prompts. More generally, you could add a `setbuf(stdout, NULL);` at the beginning of your main function (then you would not need the fflush). More disclosure: I did test both solutions in this small context and they worked.\r\n\r\nAfter all that, don&#39;t be surprised if data.txt does not contain what you want or expect.\r\n\r\nFinally, **thank you**. I have been wondering all through this course why tee wasn&#39;t working. Today I finally got the answer.", "1008" ], [ "I don&#39;t know if it&#39;ll be quick....\r\n\r\nI think you expect that this while `while(!feof(inptr))` (the \" ;outer while \" ;) will end when the fread in the \" ;do/while \" ;\r\n\r\n do {\r\n fwrite( & compare, 512, 1, outptr);\r\n fread( & compare, 512, 1, inptr);\r\n }\r\n while ((compare[0] != 0xff) || (compare[1] != 0xd8) ||......compare[3] != 0xe1)); \r\n \r\nreaches end-of-file. It won&#39;t. I suspect your program has written out a really huge jpg as a result.\r\n\r\nBe the computer. You are in the do/while. You read the last line in the file. It is not a jpg header, so the while is true. You do the \" ;do \" ; again, read another 512 bytes. It is not a jpg header, so the while is true. You do the \" ;do \" ; again, read another 512 bytes. Ad infinitum.\r\n\r\nThe first adjustment you have to make is in the outer while. Bottom line, !feof is not the proper way to test whether you have reached the end-of-file. See Week 4- > Shorts- > File I/0. <PERSON> discusses this around the 8:15 mark. He&#39;s using fgets in the video, but it applies to fread. Obviously, that change is going to lead to other changes. I leave it to you to decide how to proceed. \r\n\r\n:wq", "1022" ], [ "check50 matches the set specification exactly. The spec says\r\n\r\n > So that we can automate some tests of your code, your program **must** behave per the below. Assumed that the *[italic]* text is what some user has typed.\r\n\r\n > jharvard@appliance (~/Dropbox/pset2): ./caesar 13 < br/ > \r\n*Be sure to drink your Ovaltine!* < br > \r\nOr fher gb qevax lbhe Binygvar!\r\n\r\nEmphasis mine. \r\n\r\nIf you add the printf, your code would output:\r\n\r\n > jharvard@appliance (~/Dropbox/pset2): ./caesar 13 < br/ > \r\nType text for encryption: < br/ > \r\n*Be sure to drink your Ovaltine!* < br > \r\nOr fher gb qevax lbhe Binygvar!\r\n\r\nAs you already know, that does not pass check50.", "348" ], [ "I fought with a similar pathing problem and it turned out that $_SERVER[&#39;DOCUMENT_ROOT&#39;] was the cause. It is set in the apache configuration which might not be totally clear from the php doc.\r\n\r\n > &#39;DOCUMENT_ROOT&#39;\r\n\r\n > The document root directory under which the current script is > executing, as defined in the server&#39;s configuration file. \r\n\r\nOn the appliance,it has a value of /var/www. You can google around for 100&#39;s of different php solutions. I based my path on dirname(\\__FILE__) in my home page.", "406" ], [ "The `if ($row === false)` syntax is used for queries that do not return rows, like an UPDATE or INSERT query. Review the Walkthrough - > login section of the instructions (pages 16-17). This statement is key:\r\n\r\n > an empty array is == to false because of implicit casting\r\n\r\nSince you are testing for an empty array, you need to use `if ($row == false)` syntax. You could also use `if (empty($row))`. This may make your intention clearer.", "419" ], [ "To clarify: the error `/opt/sandbox50/bin/_URL_0_: line 31: 11290 ....` is from check50, not from compile. It happens when check50 tests for \" ;handles lack of argv[1] \" ;. That is because you do `string k = argv[1];` before you know if there *is* an argv[1]. Technically, the segfault comes from the call to strlen(k).\r\n\r\nThe reason you are getting strange output is here: `p[i] = (p[i] + k[j]) % 26;`. You are using the ascii value of p[i] (97 for a) instead of the \" ;alphabet index \" ; of p[i] (0 for a). The result of your equation when p[i] = &#39;a&#39; and k[j] = &#39;a&#39; will be 19. p[i] needs to be in \" ;alphabet index \" ; for this math to work. The result then needs to be transformed to an ascii value for correct output. Don&#39;t forget to keep the correct case of p[i] when you make your corrections.", "56" ], [ "Here are my thoughts on your interesting question. It touches on the broader category of error handling. \r\n\r\n > Any return value != 0, in the main function signals an error. Whatever return (error) value is given is arbitrary? \r\n\r\nTo a large extent the return value is arbitrary. It (usually) only has meaning to the \" ;caller \" ;. Recall the discussion of `$?` (testing the return value at the command line). If a user or another program executes *your* program and needs to know whether it was successful before proceeding, the error status can/should/will tell them that. In this example, the caller needs to know that if your program returns 1 it means memory could not be allocated. You could have returned 69 or 144 or 5862. As long as the caller knows it means memory could not be allocated, they can proceed accordingly.\r\n\r\nTo be more precise, a non-zero return value does **not** have to indicate failure. Once again, the caller needs to know what the return value means. \r\n\r\n\r\n > Will the function not exit without an error (ie except for the printed error message, the program will still run like the function ran successfully)?\r\n\r\nYes. The program that called `allocate();` will print the error message and the function will exit, then hum along and process its (the caller&#39;s) next instruction. Chances of eventual failure might be high :) \r\n\r\n > Will the function not exit without an error and return 1?\r\n\r\nActually, methinks this function will not compile because there is no `return` for the true condition, so let&#39;s assume it returns 0 on success. If there is an error, the message will be printed and the function will return 1 to the caller. It would be up to the *caller* to handle program flow based on the result of `allocate();`", "134" ], [ "Great question! Google gives about 381,000 results for \" ;the history of crlf \" ;, so you&#39;re not the first to wonder. [This post][1] says, among other things:\r\n > This protocol dates back to the days of teletypewriters. CR stands for \" ;carriage return \" ; - the CR control character returned the print head ( \" ;carriage \" ;) to column 0 without advancing the paper. LF stands for \" ;linefeed \" ; - the LF control character advanced the paper one line without moving the print head. So if you wanted to return the print head to column zero (ready to print the next line) and advance the paper (so it prints on fresh paper), you need both CR and LF.\r\n\r\n > If you go to the various internet protocol documents, such as RFC 0821 (SMTP), RFC 1939 (POP), RFC 2060 (IMAP), or RFC 2616 (HTTP), you&#39;ll see that they all specify CR+LF as the line termination sequence. So the the real question is not \" ;Why do CP/M, MS-DOS, and Win32 use CR+LF as the line terminator? \" ; but rather \" ;Why did other people choose to differ from these standards documents and use some other line terminator? \" ;\r\n\r\nNow you know.\r\n\r\n\r\n\r\n\r\n\r\n\r\n [1]: _URL_0_", "50" ], [ "Each school/college/university has a numbering scheme for its courses. From the Harvard University 2013-2014 [Guideline for Courses of Instruction][1]\r\n\r\n > Course Number \r\n\r\n > Courses may have only one number and be listed in full by only one department or committee. The course number includes the two, three or four \r\ndigit number used to identify the course within its course group. They may be numbers only or letters only. Additional letters that signify credit, \r\nduration, etc., may be added to each type. Courses are numbered according to the following scheme: \r\n\r\n > **Explanation of Course Numbers as Numbers**\r\n\r\n > Most courses are numbered with the following general scheme:\r\n\r\n > 1–99 Primarily for Undergraduates\r\n \r\nIf I recall from my college days, the higher the number, the more advanced the course. I would speculate that 50, in the middle of the range, was chosen, so that \" ;easier \" ; or \" ;harder \" ; courses could be appropriately numbered. Or not :)\r\n\r\n [1]: _URL_0_", "197" ], [ "Ah, the dreaded !feof......\r\n\r\nIn [Week 4 - > Shorts - > File I/O][1], <PERSON> discusses the problem with using feof in a while loop (around 7:00). He explains the correct condition (8:40) for checking end of file. Using that logic, you need to change your while condition to test that the output of fread is not NULL. \r\n\r\n`while(fread(block, sizeof(block), 1, file) != NULL)`\r\n\r\nThere may be other bugs lurking in your code. But this is a good place to start. \r\n\r\n\r\n [1]: _URL_0_", "1022" ], [ "I hope you have gotten past this by now, but I&#39;ll chip in my 2 & #162;. \r\nYou and the computer are not seeing eye-to-eye. $string is something like:\r\n\r\n`&#39;SELECT * from places WHEREcountry_codeLIKE %GB%&#39;`\r\n\r\nMay not be what you meant, but it&#39;s what you said. \r\n\r\nIt&#39;s a bad idea to put additional print statements in search.php because the next thing you know *nothing* works. Been there, done that. Here&#39;s something I used to troubleshoot a very similar problem. Added code like this to search.php\r\n\r\n $dbg = isset($_GET[ \" ;dbg \" ;]);\r\n .\r\n .\r\n .\r\n if ($dbg)\r\n\t {\r\n print(json_encode($your_data_here, JSON_PRETTY_PRINT));\r\n }\r\n\r\n\r\n\r\nThen browse to pset8/search.php?geo=xxxxx & dbg=1\r\n\r\nOr maybe it&#39;s a simple as: $piece not quoted (to get &#39;%GB%&#39;). \r\n\r\nI don&#39;t know what all the ramifications are, but the query function might be improved by a simple var_dump($sql) before the call(s) to trigger_error.", "420" ], [ "I don&#39;t think so. The person/group field doesn&#39;t come with a default value field, and even if you were to create an InfoPath form for the list, the default value function is disabled. You may be able to populate it with JavaScript, but you&#39;d still have to resolve it using the check user control manually as far as I know.", "223" ], [ "You can use the Information Management Policy feature in Library A. You would add the retention policy to the content types you have included in Library A (Documents, for example) and set the expiry for 2 months. Once the document &#39;expires&#39;, you can transfer it to another location. \r\n\r\nIn order for this to work, you will need the Content Organizer feature on your site enabled, and use the submission point (which is the Content Organizer Drop off Library) as your transfer location within the policy. You can then set up a rule within the content organizer to direct everything in the drop off library to Library B.", "43" ], [ "I am sorry this pset has been such a struggle for you. I think you are really close to the finish line. Take a deep breath and let&#39;s go through this step by step. The *most important thing* is that you do not lose the code you have worked so hard on. \r\n\r\nThe plan:\r\n\r\n 1. Backup your work. There is no such thing as too much backup.\r\n 2. Restore Makefile, find.c and helpers.h from the distro code\r\n 3. make the \" ;find \" ; executable\r\n 4. Whistle a happy tune\r\n\r\nThe execution:\r\n\r\n 1. In a new terminal window:\r\n\r\n cd pset3\r\n cp -r find SAVEfind \r\n This will create a copy of your find directory in a new directory called SAVEfind. \r\n \r\n 2. Follow the instructions in the Problem Set 3 document to download the distro code, but DO NOT UNZIP. We are going to restore only the 3 files mentioned above. unzip allows you to select the files you wish to retrieve. From your workspace directory:\r\n\r\n \r\n\r\n unzip pset3.zip pset3/find/Makefile\r\n unzip pset3.zip pset3/find/find.c\r\n unzip pset3.zip pset3/find/helpers.h\r\n\r\nNow you have fresh copies of those three files. \r\n\r\n3. Navigate to pset3/find directory and execute `make clean`. This will ensure that make starts with a clean slate. Now execute `make`.\r\n\r\nI hope I hear whistling! :)\r\n\r\nFor the record, here is my thinking from reading through your posts. You originally wrote your routines in helpers.c; you added a \" ;main \" ; loop and variables, so it would be a stand-alone program that you could test. That made it difficult to integrate it back into the find application and it was downhill from there. By now you are very frustrated and it makes it difficult to find your way back to where you were when your routines were working. \r\n\r\nThere&#39;s a great discussion of libraries in [Week 1 Shorts][1]. \r\n\r\n:wq\r\n\r\n \r\n\r\n\r\n [1]: _URL_0_", "879" ], [ "A couple of things going on here. \r\n\r\nYou declare x as an int and initialize it to 0. Your while loop will run as long as x == &#39; &#39;. The computer interprets this as \" ;compare the value of x to the integer value of ascii space \" ;. The integer value of ascii space is 32. So, your while loop never executes, y is never initialized and thus produces junk in your printf.\r\n\r\nDon&#39;t you want to test (iterate over) every character in name to detect all the spaces? A while loop may not be the best approach. You might consider a for loop.\r\n\r\nOnce you get your loop sorted, you might find yourself faced with a problem at `y = name[x] + 1;` This code will add 1 to whatever is the contents of name[x]. My guess is that is not the result you are after. \r\n\r\nAnd remember, you want to display the initials in upper case.\r\n\r\nBack to the drawing board!\r\n\r\n:wq", "22" ], [ "New answer, based on new information. There&#39;s something wrong with your parentheses. That \" ;else \" ; has no \" ;if \" ; preceding it. It isn&#39;t with the outer if because it is inside that code block. It isn&#39;t with the inner if because the curly brace above the else closes the for block. Hopefully color coded braces will help.\r\n\r\n[![matching braces][1]][1]\r\n\r\n\r\n [1]: _URL_0_", "773" ], [ "I was just logging off when the noticed flashed. Good timing. I did not recommend pasting, because that sometimes causes more problems that it fixes, and you may be suffering the consequences of that. You mention at least three different things in your comment. Let&#39;s go one at a time. Did your program compile? By that I mean did make run with no errors. Let&#39;s start there.", "157" ], [ "If you use helpers.h, find.c and Makefile from the original distro code AND in helpers.c declare your search function like this: \" ;bool search(int value, int values[], int n) \" ; you will not have this particular problem. Reread the answer for a strategy to restore helpers.h, find.c and Makefile to their original versions. Don&#39;t forget to backup your work!", "347" ], [ "\" ;multiple definition of MAX \" ; is most interesting because the multiple definitions seem to be self-referential! That could indicate something wrong with your #include statements. Does helpers.c #include \" ;find.c \" ; by any chance? The code pasted in the question might indicate 3 includes in helpers.c (distro code has 2). I am assuming you are working with the distro versions of find.c and helpers.h. The only only changes for this project are in helpers.c. And you should only only add code where you see the //TODO. No other changes to helpers.c are required. Full stop.", "694" ], [ "Review the GDB short in Week 4. At 3:15 <PERSON> explains exactly what your problem is. You have told the program to run, which it does. But you have not told it to stop, or break, anywhere to give yourself a chance to see what&#39;s happening. In your particular case, since the program is giving a seg fault, you want to set a break (eg gdb > break main) *before* you issue the run command.", "992" ], [ "First things first. I assume your program has compiled. You should either enter an answer with a summary of what you did to fix the problem, then \" ;accept \" ; it. Or \" ;accept \" ; my answer. Either way, this question should be considered answered. As for your new question, please search for \" ;unexpected end of input \" ;. It has been asked and answered many times. If that doesn&#39;t help you, you&#39;ll need to ask a new question. Cheers.", "56" ], [ "At the bottom of your code, there is a place where your function will not return anything. That&#39;s probably around line 93 in your program, the line that clang complained about.\r\n\r\n[![enter image description here][1]][1]\r\n\r\nNow you need to follow the logic, either on paper or with gdb, to see what conditions(s) will get you to that spot. One pair of braces in your code stands out because of their alignment. I leave it to you to determine if that is contributing to your problem. And to be clear, adding a return true; or return false; at that point in the program will \" ;fix \" ; the compile error. However, you really need to evaluate all your if/else/else if conditions to make sure the function works as you intend and returns the *correct* result.\r\n\r\n\r\n\r\n [1]: _URL_0_", "56" ], [ "If you&#39;re dealing with that many objects, I would create the term store and use the managed metadata fields. The reason is that once you get past more than 10 items, the lookup field gets a little unwieldy for anyone that uses it. If you use a managed metadata field, you can organize those values within your taxonomy and have a little more structure to the data. The Managed Metadata field also provides your users with an auto-completion functionality that the lookup field doesn&#39;t provide out of the box.", "107" ], [ "Yes it can be done in the IDE. \r\n \r\n You manage the web server with apache50 command. To start the server you might use \r\n `apache50 start ~/workspace/pset7/public` \r\n (NB make sure pset6 server is not running).\r\n\r\nYou manage the database server with mysql50 command. You will find your database credentials by clicking little & #9432; icon in the top-right of the IDE (next to the gravatar). You will have to change the creds in constants.php as well.\r\n\r\nThe web server must be running to access the database with phpMyadmin.", "486" ], [ "Creativity is hindered by stress. When you are trying extremely hard to come up with this great musical masterpiece, you&#39;re going about it all the wrong way. Think about what artists say about their music so often: \" ;It just came to me \" ;. Music (and creativity in general) are linked to inspiration. As you&#39;re going to sleep, your body and brain is shutting down. So you start to forget about the logistics of life (the left side of the brain) and your right side is allowed to think more freely.", "578" ], [ "Check out [this reddit post][1]. It&#39;s from a year ago, (when pset6 was speller). The penultimate comment says:\r\n\r\n > Unfortunately, staff should have modified the instructions in the pset used for edX to remove that option. The auto-grader is not smart enough to know that you have added files and will simply fall over.\r\n\r\n > So yes,you need to roll everything into dictionary.c\r\n\r\n\r\n [1]: _URL_0_", "558" ], [ "You are declaring two nodes named new, one outside the while loop, the other inside. gdb displays the value of the outer new until the first time you declare the new new inside the while loop. Here is a small repro snippet that demonstrates:\r\n\r\n > Breakpoint 1, main (argc=2, argv=0x7fffffffdf88)\r\n at q15570.c:30 \r\n30 printf( \" ;the word is %s\\n \" ;,new- > word); \r\n(gdb) next \r\nthe password is cat \r\n31 index = toupper(new- > word[0]) - &#39;A&#39;; \r\n(gdb) print *new\r\n$1 = {\r\n word = \" ;\\000\\000\\000\\000\\000\\000\\000\\000\\305\\016s\\367\\377\\177\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\210\\337\\377\\377\\377\\177\\000\\000\\000\\000\\000\\000\\002\\000\\000\\000p\\a@\\000 \" ;, \r\n next = 0x0} \r\n(gdb)", "598" ], [ "The `if ($row === false)` syntax is used for queries that do not return rows, like an UPDATE or INSERT query. Review the Walkthrough - > login section of the pset7 instructions (pages 16-17). This statement is key:\r\n\r\n > an empty array is == to false because of implicit casting\r\n\r\nSince you are testing for a non-empty array, you need to use `if ($row == true)` syntax. You could also use `if (!empty($row))`. This may make your intention clearer.", "914" ], [ "I found this happens if you launch the debugger from dictionary.c instead of speller.c. I also found a couple of remedies. \r\n\r\nFirst: set your breakpoints in dictionary.c then launch Debug from speller.c\r\n\r\nSecond: If you *do* launch from dictionary.c, there is a **Command:** field in the debugger tab. Change it from `pset5/dictionary.c` to `pset5/speller.c [arg-1] arg-2` and click Run. This may or may not get past either hang spot. If not, click the Restart swirl (right of the run/stop control). It may take 3 or 4 restarts, or more, before the computer finally does what you want it to. (I&#39;ve had to restart as many as 10 times, your mileage may vary). \r\n\r\nThe upshot is, you have to debug speller.c not dictionary.c.", "992" ], [ "If I understand correctly, your game just \" ;starts \" ;. And you want it to wait for the user to click before the ball is launched. That&#39;s fair. SPL comes with a handy-dandy function called waitForClick(). Try adding that before your main while loop and see if that solves your problem. Also, you might consider using it in the while loop above instead of instantiating a GMouseEvent object and doing the getEventType test. But one thing at a time!", "121" ], [ "This will happen if you click the \" ;Show All \" ; button in phpMyAdmin (either in the Browse or SQL tab). \r\n\r\n[![enter image description here][1]][1]\r\n\r\nThe only way I could clear it was to close then open a new instance of phpMyAdmin. Prof. <PERSON> did mention \" ;The latest version of phpMyAdmin is a bit buggy.. \" ;. You couldn&#39;t see all 43K rows at the same time anyway (unless you have a really, really, REALLY big screen) so don&#39;t do that :)\r\n\r\n [1]: _URL_0_", "668" ], [ "From pset8 instructions:\r\n\r\n > Note that fgetcsv takes an optional **third** argument \r\n\r\nRead the [PHP doc][1] \r\n\r\n\r\n\r\n > length \r\n Must be greater than the longest line (in characters) to be found in the CSV file (allowing for trailing line-end characters). It became optional in PHP 5. Omitting this parameter (**or setting it to 0 in PHP 5.1.0 and later**) the maximum line length is not limited, which is slightly slower.\r\n\r\nIf you do not use the length argument, $line[0] looks like this:\r\n\r\n > [0] = > \r\n string(46) \" ;US 34050 FPO AA Erie 029 41.<PHONE_NUMBER>.6789 \" ;\r\n\r\nIf you use the length argument, $line[0] looks like this:\r\n\r\n > [0] = > \r\n string(2) \" ;US \" ;\r\n\r\nSince you don&#39;t know the length of the longest line, use 0. You won&#39;t notice the \" ;slightly slower \" ;. If you use this syntax for fgetcsv, $line will be the array you want and you won&#39;t need any *sploding.\r\n\r\n\r\n\r\n [1]: _URL_0_", "716" ], [ "You will get this error\r\n \r\n > PHP Fatal error: Column &#39;country_code&#39; cannot be null in /home/jharvard \r\n /vhosts/pset8/includes/functions.php on line 57\r\n \r\n\r\nif you use while(!feof($yourfile)) to iterate over the input file. \r\n\r\nFrom the Week 4 - > Shorts - > File I/O transcript:\r\n\r\n > Thus, a while loop with the condition (!feof(fp)) might seem like a perfectly appropriate solution. \r\nHowever, say we have one line left in our text file. \r\nWe&#39;ll enter our while loop and everything will work out as planned. \r\nOn the next round through, our program will check to see if feof of fp is true, \r\nbut--and this is the crucial point to understand here--\r\nit won&#39;t be true just yet. \r\nThat&#39;s because the purpose of feof is not to check \r\nif the next call to a read function will hit the end of the file, \r\nbut rather to check whether or not the end of the file has already been reached. \r\nIn the case of this example, \r\nreading the last line of our file goes perfectly smoothly,\r\nbut the program doesn&#39;t yet know that we&#39;ve hit the end of our file. \r\nIt&#39;s not until it does one additional read that it encounters the end of the file. \r\n\r\nYour loop processes one \" ;extra \" ; read, which is not actual data, and tries to insert a row, thus provoking the error. My import works with this while condition: ` while ($data = fgetcsv($infile,.....`\r\n\r\nOr you could execute \" ;query \" ; conditionally (something like $row != null or !empty($row))\r\n\r\n\r\n----------\r\n\r\nYou will get this error\r\n > Fatal error: Maximum execution time of 30 seconds exceeded in\r\n /usr/share/phpmyadmin/libraries/DisplayResults.class.php on line 2959\r\n\r\n\r\nif you choose \" ;Show all \" ; in phpMyAdmin. It&#39;s a little buggy. Don&#39;t use that option.\r\n\r\n[![enter image description here][1]][1]\r\n\r\n \r\n\r\n\r\n [1]: _URL_0_", "434" ], [ "This post sounds like it might be what you are looking for _URL_0_ \r\n\r\n > cd to /etc/mysql/conf.d and create a file with extension .cnf (e.g. user_sett.cnf) that looks like this: \r\n < br > < br > [mysqld] \r\nft_min_word_len=2 \r\n < br > and save. Restart the server by rebooting the appliance and that should do it.\r\n\r\nI had a problem with permissions on /etc/mysql/conf.d directory. You could try this approach.\r\n\r\n - In gedit, create the file as described and save it in your home directory. \r\n - From a terminal window, copy it to /etc/mysql/conf.d using \r\n `sudo cp user_sett.cnf /etc/mysql/conf.d`.\r\n - Restart the server as described.", "486" ], [ "Top of mind is San.....I find the los&#39;s, the new&#39;s, the san&#39;s. But they don&#39;t show up first in the dropdown. There are probably too many differences between our indexes, our queries, etc to make a comparison. The first match I get for new is Newagen, ME. Now for some unsolicited, free (as in \" ;you get what you pay for \" ;) advice. If you are getting results from typeahead, move on to the next challenge. In my experience, this is not the most difficult part of the pset.", "152" ], [ "You are missing something, but it is not obvious. There is a mysql setting called ft_min_word_len (the minimum length of words to be indexed), which defaults to 4. MySQL doc is [here][1]. See [this post][2] for details on how to change it. (Of course you would want the minimum to be 2). Also from [MySQL doc][3]:\r\n\r\n > \r\nNote \r\nFULLTEXT indexes on MyISAM tables must be rebuilt after changing this variable. \r\n Use REPAIR TABLE tbl_name QUICK.\r\n\r\n\r\n All other things being equal, this should fix your problem. \r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_2_\r\n [3]: _URL_0_", "312" ], [ "php&#39;s [fopen][1] can take a url for the filename argument. So something like:\r\n\r\n\r\n\r\n $fname= \" ;_URL_0_;;\r\n $handle = fopen($fname,&#39;r&#39;);\r\n while ($csvdata = fgetcsv($handle))\r\n {\r\n // build your query with $csvdata elements\r\n }\r\n fclose($handle);\r\n\r\nshould get you started. Fair warning: A lot might depend on your data source. You may encounter many obstacles along your journey. I did a quick repro with some csv files from _URL_1_ and it worked swimmingly. \r\n\r\n\r\n [1]: _URL_2_", "288" ], [ "There is a problem with this line: \r\n\r\n`int abspathlength=(requesttarget-strchr(requesttarget,63)-sizeof(char))/sizeof(char);`\r\n\r\n[EDIT]: `requesttarget - strchr(requesttarget,63)` will return a negative number because the address of requesttarget \" ;is less than \" ; the address of &#39;?&#39; in requesttarget. Swap the order.\r\n\r\n\r\nTo run server in gdb (or any program that requires command line arguments). \r\n\r\n < pre > < code > $ gdb server\r\n(gdb) set your break point(s)\r\n(gdb) run -p {port} {path-to-root}\r\n < /pre > < /code > \r\n\r\nIn other words, the arguments you would use to call server from the command line. Type `help run` in gdb for more info.", "921" ], [ "This is still not compilable code. The lengh typo still exists. And unless it&#39;s declared in dictionary.h, hasht array appears out of nowhere. Here are some things to look at: \r\n\r\nIf your dictionary is {home, still, tight, video}, \" ;TIGHT \" ; will return false here:\r\n\r\n int hv = hash(word);\r\n nodep = hasht[hv];\r\n if (!nodep ) return false;//Not even a hash node created.\r\n\r\nThis \" ;word \" ; `if (!strcmp(word,temp_word)) {` is the argument to \" ;check \" ;, so \" ;Still \" ; et al will return false. You are not comparing to the \" ;word \" ; in the node.\r\n\r\nYou&#39;d be well served to create a small test dictionary and text file and take this for a spin in gdb.", "618" ], [ "That was my initial approach too. Sweet! Or so I thought.....See the section on \" ;interpret \" ; (around page 8) of the instructions. \r\n\r\n > Odds are you’re unfamiliar with popen. That function opens a \" ;pipe \" ; to a process (php-cgi in our case), which provides us with a FILE pointer via which we can read that process’s standard output\r\n(as though it were an actual file).\r\n\r\nYou cannot use fstat on a pipe (or ftell, fseek etc). It always returns 0. To be more specific, I spent a couple of hours with Mr. <PERSON> and couldn&#39;t find any way to do it. [This post][1] is an interesting discussion on the topic. (And [this post][2] too!)\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "227" ], [ "If you&#39;re in a Custom List, you can go into Advanced Settings and change the Item Level Permissions settings. The options here configure whether your users can see all items, or see just items created by them. You can also set the creation rules here; whether a user can create and edit all items, create items and only be able to edit their own, or not have any create/edit rights. \r\n\r\nYou could then put your &#39;approvers&#39; in their own security group with the &#39;Cancel Checkout&#39; permission so that they can see all items, or even just place them in the approvers group (as long as that group doesn&#39;t have permissions elsewhere).\r\n\r\nThe issue with creating views as <PERSON> mentioned is that any view is accessible through the URL. Unfortunately, you cannot place permissions on views out of the box.\r\n\r\nHope that helps!", "550" ], [ "That error message is coming from `free(content);` later in the code. See [this post][1]. Specifically (from answer 1, emphasis added):\r\n\r\n > This happens when the pointer passed to free() is not valid or **has been modified somehow**. \r\n\r\nYou have modified the pointer to content here: `content = & data;`, since & content is what is passed to the load function. Therefore, as per the instructions: \" ;dereferencing content and storing the address of a BYTE at content. \" ; you might try `*content = data;` instead .\r\n\r\n [1]: _URL_0_", "789" ], [ "Your output needs to be exactly what is asked for in the instructions. \r\n\r\n > username@ide50:~/workspace/pset2 $ ./initials \r\n<PERSON> \r\nusername@ide50:~/workspace/pset2 $ ./initials \r\n<PERSON>\r\n\r\nFor the same example, your output will look like:\r\n\r\n > username@ide50:~/workspace/pset2 $ ./initials \r\nUser complete name: \r\n<PERSON>ZC \r\nusername@ide50:~/workspace/pset2 $ ./initials \r\nUser complete name: \r\n<PERSON> \r\nRTB", "103" ], [ "You are getting that error because line is declared a `const char*`. Review the man page for strtok, specifically [emphasis added]:\r\n\r\n > Be cautious when using these functions. If you do\r\n use them, note that: \r\n\r\n > * These functions modify their first argument.\r\n > * These functions **cannot be used on constant\r\n > strings.**\r\n > * The identity of the delimiting byte is lost.\r\n > * The strtok() function uses a static buffer while\r\n > parsing, so it&#39;s not thread safe. Use strtok_r()\r\n > if this matters to you.\r\n > \r\n\r\nYou will need to decide how best to approach this.", "56" ], [ "The function signature of strstr is \r\n \r\n > char *strstr(const char *haystack, const char *needle) \r\n\r\nSince you have declared needle a `const char*`, you are violating the contract. I recommend further reading in the doc, specifically \r\n > These functions return a pointer to the beginning of the substring, or NULL if the substring is not found.\r\n\r\nin the context of your `if (needle == 0)` statement. \r\n\r\n**PLEASE NOTE:** This answer no longer makes contextual sense because of edits to the orginal question.", "758" ], [ "The PHP parameter session.gc_maxlifetime determines how long a php session will stay alive and is set in your php.ini file. It is probably 1440 [seconds] (24 minutes). The phpMyAdmin setting can be found at Settings - > Features - > General - > Login cookie validity (in phpMyAdmin) and is probably 86400 [seconds] (24 hours). It determines how long a phpMyAdmin session will remain alive. \r\n\r\n You can change either or both to suit your needs. As long as the first is greater or equal to the second, you will not get the warning. You will find php.ini in /etc/php5/apache2. You will need to edit it with sudo. Restart the web server for any change take effect. [apache50 restart].", "434" ], [ "These kinds of problems occur if abs_path is not properly null terminated. You mention in an [earlier post][1] that you are using strncpy. From the man page for strncpy:\r\n\r\n > **Warning:** If there\r\n is no null byte among the first n bytes of src, the\r\n string placed in dest will not be null-terminated.\r\n\r\nYou may be asking How could it work the first time? That&#39;s the magic of a buffer overflow. It depends on what&#39;s in memory. And subsequent calls to parse (not to mention everything else server does) change what&#39;s in memory and you get unpredicitble results.\r\n\r\n [1]: _URL_0_", "863" ], [ "This is bad `abs_path = malloc(sizeof(LimitRequestLine + 1));` (and query too). Remember, parse receives a *pointer* to abs_path, which is already allocated on the stack (implicitly) in main. The malloc gives it a new address on the heap. The strncpy updates the contents at that (new) address. But back in main it will be looking for abs_path at the \" ;original \" ; address, the contents of which have *not* been updated. If I&#39;m understanding properly, it works sometimes (eg /cat.jpg) and not others (eg /cat.exe). Frankly, I&#39;m a little confused by that, and I would say it is due to the vagaries of memory on the stack and the heap. You might consider adding some printfs in parse and after you return from parse. Something like \r\n\r\n printf( \" ;contents....%s < -\\n \" ;,abs_path);\r\n printf( \" ;pointer %p\\n \" ;,abs_path);`\r\n\r\nwould illustrate.", "582" ], [ "For the benefit of future readers, you should start a new question with your new question. The post can only have value to others if the answer goes with the question. Now that you&#39;ve edited the parse code, the original answer is meaningless. I suggest you restore the original parse, and add another question for indexes. When you do, be sure to clarify \" ;weird lines of code as an output \" ;.", "936" ], [ "If it&#39;s only 20 employees and want something quick and easy, I&#39;d just do a Contact or Custom List. Since you only want to show 3 fields (which could actually be rolled into 2), I would lean more towards the custom list with a renamed Title field as your Phone field and then a Person or Group field for both Name and Presence. Set the column order in your view to show the new Person or Group column first, and then the phone number column. \r\n\r\nThis won&#39;t be synced to your AD in any way, so it will need to be maintained, but you will be able to have this set up and running in SharePoint Foundation in less than 5 minutes.", "442" ], [ "What it sounds like to me is that when your closed date field is populated, you want the status to automatically change to &#39;Closed&#39;, and then your items would automatically be grouped into the correct Open/Closed group based upon the status. \r\n\r\nI would build a quick workflow in SPD for this to run on an item change. If you haven&#39;t already, set the default value of Status to &#39;Open&#39;. Then, using the workflow, change the Status to &#39;Closed&#39; when the &#39;Closed Date&#39; field is not blank. \r\n\r\nIn your view, group by the &#39;Status&#39; field, and make sure your Status field is hidden (unchecked) within the view. \r\n\r\nThis way, you&#39;ll have an &#39;Open&#39; and &#39;Closed&#39; group, and when the closed date is populated, the item will automatically move from the &#39;Open&#39; to &#39;Closed&#39; group.", "223" ], [ "At least part of your problem is here: \r\n \r\n file_content[i] = &#39;\\0&#39;;\r\n i++;\r\n\r\nYou are ostensibly changing the actual contents of `content` by adding &#39;\\0&#39;. `content` is not string data, so it does not need to be (read: should not be) null terminated. And even though file_content can be \" ;over-allocated \" ; by as much as 999 bytes, it should `respond()` properly if length is correct. \r\n\r\n\r\n----------\r\n\r\nRegarding indexes: \r\n\r\n - `tolower`: Since Unix is case-sensitive, you should not do this conversion. TEST is a valid directory name and distinct from test. \r\n - `if ((strstr(new_path, \" ;index.php \" ;) != NULL)....` is unnecessary since indexes function is only invoked if path is a dir. \r\n - Since it&#39;s an either (`index.php`) or (`index.html`) condition, you don&#39;t need to allocate separate variables.\r\n\r\n\r\n----------\r\n\r\nFinally, in my experience, \" ;requesting two files in a row \" ; fails if abs_path is not properly null-terminated (in `parse()`).", "1022" ], [ "Try the example of code = \" ;o \" ; and text = \" ;z \" ;:\r\n\r\n | human expects | computer sees\r\n - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \t\t\t\t \r\n code[0]\t\t\t\t\t\t | o | 111\r\n text[0] | z | 122\r\n letter = text[0] + code[0] | n | 233\r\n\r\nUh-oh. The `printf( \" ;%c \" ;,letter)` shows nothing, since ascii 233 is an \" ;unprintable \" ; character. Remember, the lowercase letters are in the ascii range 97 to 122. \r\n\r\nYou don&#39;t want to add &#39;o&#39; to &#39;z&#39;. You want to add &#39;o&#39;s position in the abc...xyz sequence to &#39;z&#39;. Assuming &#39;a&#39; is 0, &#39;o&#39;s position is 14. Not coincidentally, `&#39;o&#39; - &#39;a&#39;` is 14, or `code[0] -&#39;a&#39;` in this example. \r\n\r\nNow the example looks like this:\r\n\r\n | human expects| computer sees\r\n - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \t\t\t\t \r\n code[0]\t- &#39;a&#39;\t\t\t\t | 14 | 14\r\n text[0] | z | 122\r\n letter = text[0] + code[0] - &#39;a&#39; | n | 136\r\n\r\nAlas, that is still outside the range of lower case. One additional test/transform is needed, to &#39;wrap&#39; if the result is greater than &#39;z&#39; (or, of course, &#39;Z&#39;). I leave that to you.\r\n\r\n4-9-14-15 ;)", "567" ], [ "One problem is `int pathend = strcspn(abpathstart, lastspace) + 1;`. strcspn doesn&#39;t work the way you think it does (or wish it did!). From the man page (emphasis added):\r\n\r\n > The strcspn() function calculates the length of the initial segment of s which consists **entirely** of bytes not in reject.\r\n\r\nstrcspn is returning 0, so your pathend is 1. \r\n\r\nWhy, you may ask? Assuming lastspace is \" ; HTTP/1.1\\r\\n \" ;. The bytes in \" ;reject \" ; are H T P / 1 . \\r \\n. The first byte in abpathstart is `&#39;/&#39;`. `&#39;/&#39;` is one of the bytes to reject. Done. strcspn returns 0. \r\n\r\nThe [php doc on strcspn][1] has a clearer description of how this function operates. \r\n\r\nI didn&#39;t read much further in your code, because it&#39;s downhill from here. I did notice this ` abpath[0] = abpathstart[0];` Do you want this loop to operate only on index 0? \r\n\r\n\r\n\r\n [1]: _URL_0_", "968" ], [ "There are a couple of problems in your indexes function, which will be invoked with this request line `GET / HTTP/1.1` because &#39;/&#39; is a directory. \r\n\r\nRecall this line from the spec:\r\n\r\n > this function should dynamically allocate memory on the heap for the returned string\r\n\r\nYou need to use a malloc(calloc/realloc) to do that. This declaration `char newPath[lenOfPath];` allocates memory on the stack. It needs to be on the heap because of how the pointers are set and free&#39;d in the distro code. \r\n\r\nSpeaking of `char newPath[lenOfPath];`. lenOfPath is not enough space to hold the contents of path AND \" ;index.[php | html] \" ;. \r\n\r\nFinally, this is problematic `char* indexPHP = strcat(newPath, \" ;index.php \" ;);` First, you need to append index.* to path. This syntax loses the path part. Second, strcat modifies its first argument, there&#39;s no reason to instantiate a new pointer. You can build your \" ;test \" ; filename with 2 calls to strcat. \r\n\r\nAs an aside, since this function should return *either* path/index.php *or* path/index.html, you don&#39;t need to declare two strings, one string will do.", "814" ], [ "You abs_path is not null terminated (according to your parse function [here][1]). Since the browser is always looking for favicon.ico, abs_path is set to \" ;/favicon.ico \" ;. Now your parse comes along and changes abs_path to, lets say, /cat.jpg. If you do not add the null terminator at index 8, then the contents of abs_path will be /cat.jpgn.ico. More specifically, abs_path will always include the \" ;tail \" ; of the name of the longest file you access, because you haven&#39;t told it where it should end. \r\n\r\n\r\n [1]: _URL_0_", "20" ], [ "The program is functioning exactly as coded. It only ever executes this block of code:\r\n\r\n if (argc != 2) //validate command line input\r\n {\r\n printf( \" ;Please try again later: \\n \" ;);\r\n return 1;\r\n }\r\n else\r\n {\r\n return 0;\r\n }\r\n\r\n`return` returns control to the caller. In this case, the caller is the shell (command line). If argc != 2 message is printed and program is over. Otherwise, program is over. \r\n\r\nYour `return 1;` statements are the right idea as per the spec:\r\n\r\n > one command-line argument\r\nthat contains any non-alphabetical character, your program should complain and exit immediately,\r\nwith main returning 1 (thereby signifying an error that our own tests can detect). \r\n\r\nThe program needs to \" ;do the work \" ; before it does a `return 0;`", "326" ], [ "The info from valgrind is consistent with your estimation that the problem is in check. Since the only thing allocated in your check function is `cursor` it stands to reason that is the source of the leak. But, you may say, I am freeing cursor in unload()! Quite true, to the eyes. However, that is only freeing the memory you allocated to hashtable. The memory you allocated to the pointer called cursor in check() is never freed. But wait, there&#39;s more! Perhaps you shouldn&#39;t allocate new memory to cursor at all. It is a pointer that is pointing to a chunk of memory (hashtable[index]) that has (presumably) already been allocated on the stack.", "975" ], [ "**EDIT** (after code post) \r\nOccam&#39;s razor assumes that the \" ;fewest assumptions \" ; are *correct assumptions*. I assumed that server was returning an exit code of 0, when in fact it is check50. I also assumed, as you did, that if check50 passed a test, then that test worked. Ah, live and learn!\r\n\r\nYour lookup function seg faults. As far as I can tell, every time. You would be able to detect this by testing it with a browser/curl and not depending on check50.\r\n\r\nThe problem lies here:\r\n\r\n char* extension = NULL;\r\n \r\n // storing extension of path at extension\r\n strcpy(extension, strrchr(path, &#39;.&#39;));\r\n\r\nYou have declared a pointer called `extension`. You have not allocated any memory to it. Then you are trying to stuff several bytes into it. The `strcpy` seg faults. \r\n\r\nBefore you go all malloc on it, think about this. You really only need a pointer to the \" ;.extension \" ; part of path. What is `strrchr(path,&#39;.&#39;)`? It is that very thing you need. \r\n\r\nAnother thing to consider: Is ` (extension != NULL)` true if path is \" ;cat.exe \" ;? \r\n\r\nHappy coding!\r\n\r\n----------\r\n\r\n\r\n[Occam&#39;s razor][1] \r\n\r\n > Among competing hypotheses, the one with the fewest assumptions should be selected.\r\n\r\nwould suggest that your lookup function does an `exit 0;` when it doesn&#39;t find one of the listed extensions. It should `return NULL;` as per the distro code. A repro case duplicated this check50 result exactly. If that is not the case, you will need to post some code, starting with lookup, to enable proper troubleshooting. \r\n\r\n\r\n\r\n [1]: _URL_0_", "921" ], [ "Before you go changing cookies and settings, it his most likely that abs_path is not properly created and/or null terminated. [This post][1] has helpful info about viewing abs_path in main(). Ditto [this][2]. Are you using str**n**cpy to create abs_path? Check out [this post][3]. If you are using strspn, read [this post][4] about why you cannot. \r\nAnd make sure you are not doing any kind of malloc on abs_path in parse. ([Here&#39;s why][5]). If none of this info leads you to an answer, consider adding your parse function to your post. Or playing around with cookies and settings. \r\n\r\n\r\n----------\r\n**EDIT**(after code post) \r\nShort answer: abs_path is not null terminated.\r\n\r\nPart of the problem is declaring char arrays (e.g. `char new2[LimitRequestLine + 1];`)\r\n and then using string functions on them. I am not suggesting that you change them to char*, because that is not likely to make things better viz. memory leaks, seg faults etc. \r\n\r\nHere is the crux of the problem: \r\n\r\n for(int o = 0, length = strlen(new2); o < length; o++) \r\n { \r\n abs_path[o] = new2[o]; \r\n }\r\n\r\n 1. `strlen(new2)`: new2 is not string data and is not null terminated, so results are unpredicitble (read: unreliable and very often wrong).\r\n 2. even *if* new2 was valid string data, strlen does NOT include the null terminator, so abs_path is not null terminated. Full stop.\r\n\r\nTo fix this code, you will need to manually add &#39;\\0&#39; at the appropriate spots. You should have all the numbers (positions) you need to do that. When you&#39;re done with abs_path, you will need to make the same corrections to query. Also double check: it looks like in your `q!=0` loop that abs_path will still have the query attached. \r\n\r\nI am not going to comment on why your test program works. You need server.c to work so you can submit it for grading.\r\n\r\nYou will get this working, you&#39;re almost there. Let me suggest that when you are done celebrating your perfect score on pset6, that you take some time to get more knowledge and experience with the string functions. While you certainly can do this pos by pos, you would create more elegant, readable code if you used functions like strcpy, strncpy, strchr, strrchr, strcat, etc. \r\n\r\n\r\n----------\r\n**EDIT** after new code changes. \r\n\r\nThis `strlen(new2+1)` is a problem. I don&#39;t think the parens are where you want them. If you want to loop for one longer than the length of new2, then `strlen(new2) + 1` would be correct. See if that helps.\r\n\r\n\r\n \r\n\r\n [1]: _URL_1_\r\n [2]: _URL_4_\r\n [3]: _URL_0_\r\n [4]: _URL_3_\r\n [5]: _URL_2_", "342" ], [ "**Response to edit#1:** \r\n\r\nNB: The code post turned `char* html = malloc(12);` into this `char html = malloc(12);` which was only confusing for a little while :)\r\n\r\nA major problem you are encountering is your use of strcat. I think you are encountering the segfault right here:\r\n\r\n`path1 = strcat((char*)path, php);`\r\n\r\nAt least in the context of this class, you should never recast a function argument. (Probably never in any context, but my C-world is small).The function author wrote it that way for specific reasons. According to the man page for strcat:\r\n\r\n > The strcat() function appends the src string to the\r\n dest string, \r\n\r\nWhich means it will change the dest string. Therefore you only need to `strcat(path1,php);`, and all things being equal, that will create the path1 you want. Naturally, this applies to path2 too. (Something to contemplate: do you really need two paths?)\r\n\r\nI can&#39;t say that this change will solve all your problems. But you need to start there and see what happens next. \r\n\r\nRe: the `frees`: You should not allocate (`char* php = malloc(11);`) and then set to a literal (`php = \" ;index.php \" ;;`). If you free it, you will get some `munmap_chunk(): invalid pointer:` error. If you don&#39;t free it, you will have a memory leak. `char* php = \" ;index.php \" ;` will suffice, system takes care of allocation/free. (Something else to contemplate: do you really need literals? `strcat(path1, \" ;index.php \" ;);` would accomplish the same thing.)\r\n\r\n\r\n----------\r\n\r\n\r\n----------\r\n\r\n\r\n**Response to original question:**\r\nThis function can be much simpler. You have the crux right here:\r\n\r\n if (access(path, R_OK | X_OK) == -1)\r\n {\r\n error(403);\r\n return NULL;\r\n }\r\n\r\nConsider testing for path/index.php and path/index.html the same way. Of course, you will have to construct some sort of entity that is a concatenation of path and index.php/html. Something like you&#39;ve done here: \r\n \r\n php = \" ;/index.php \" ;;\r\n return strcat((char)path, php);\r\n free (php); \r\n\r\nThere is no need to inspect all the contents of the directory. And remember, `free(php);` will not execute because it is after the return.", "762" ], [ "Your use of memcpy is fine. The problem is the order of these statements:\r\n\r\n *length += temp;\r\n memcpy(*content + *length, buffer, temp); `\r\n\r\nYou are trying to copy buffer _after_ the end of the memory allocated for \\*content. For example, after the first fread, you allocate 512 to *content, then try to memcpy to *content + 512. \r\n\r\nAlso, get rid of the `+ 1` in the realloc and delete this line `*(*content+*length) = &#39;\\0&#39;;`. This is not string data. You do not want to change any of the bytes in content.", "582" ], [ "This can happen if the info50 script is missing from /usr/bin.* You can execute `password50` from a command line to get your mysql password (and similarly, `username50`). \r\n\r\n\r\n----------\r\n*The footnote is much longer than the answer. I could reproduce this by creating a new workspace using the CS50 template. After running update50, the log ($HOME/lib/ide50.log) reports `Reinstallation of ide50 is not possible, it cannot be downloaded.` I also found that `apache50 start....` reports the wrong hostname. It says `Your site is now available at _URL_1_` The site is really available at `_URL_0_` This seems to be a problem with `hostname50`.", "486" ], [ "A couple of things are giving you trouble. Think about this line: \r\n \r\n `int end_of_query= beg_query-lastspace; `. \r\n\r\nFirst, if there *is* a query, this will give you a negative number, since beg_query is *before* (less than) lastspace. That&#39;s trouble. And what if there is no query and beg_query is NULL? The result is meaningless, and not what you want, and that&#39;s trouble too. Which leads to trouble here: \r\n \r\n for (int i=0; i < end_of_query; ++i) \r\n { if (query[i]==&#39; \" ;&#39;)\r\n {\r\n error(400);\r\n return false;\r\n }\r\n }\r\n\r\nSince query is a string, treat it like a string. No reason to check char by char when you could `strchr(query,&#39; \" ;&#39;)`; If that doesn&#39;t return NULL, give your error(400).\r\n\r\nI hope that gets you beyond the 400 problem. Spoiler alert: you are going to have to work on the size argument in your strncpy calls. abs_path, for instance, is going to be *everything* in line from the first &#39;/&#39;.", "615" ], [ "Once I got past reading \" ;TODO \" ; as a placeholder, and realized it was literal (mow the lawn, do laundry, eat more fiber) things got easier. Doh!\r\n\r\nI think the purpose of this project is two-fold:\r\n\r\n 1. Write a \" ;[single-page application][1] \" ;\r\n 2. (eventually) Learn that it&#39;s \" ;easier \" ; and more robust with React than pure javaScript.\r\n\r\nBasically, DOM manipulation means changing what the user sees without reloading a page or loading a new page. I cannot think of an analog from CS50x. An analog from Stack might be adding a comment:\r\n\r\n 1. Enter comment\r\n 2. Save comment\r\n 3. Poof! There&#39;s the comment. The page doesn&#39;t reload, but the edit box disappears and the comment appears.\r\n\r\nI&#39;m a big fan of MDN documentation; here is the doc on [Manipulating documents][2]. \r\n\r\nA (probably) partial list of things you&#39;ll need to create or manipulate in the DOM:\r\n\r\n 1. An input element for todo items.\r\n 2. An input element to check them off.\r\n 3. A \" ;display \" ; element for the list.\r\n 4. Update the counters and display same.\r\n\r\nAnd now I can&#39;t wait to take this course (after the laundry, of course)!\r\n\r\n<PERSON>.\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "285" ], [ "The error is quite literal and unambiguous. There is not table named &#39;stock&#39; in the database *to which flask is connected*. The two main causes of this type of failure:\r\n\r\n 1. Simple misspelling. Verify the table is indeed named `stock`. You can use the `.tables` command in sqlite3 or doublecheck the spelling in phpLiteAdmin.\r\n 2. Two databases named `finance.db`. When you run `sqlite3 finance.db` (or command line `phpliteadmin finance.db`) it will *create* a database named `finance.db` if one is not found. So if you run either in the \" ;wrong \" ; directory, that&#39;s where the database with the `stock` table is.", "548" ], [ "I integrated your addMarker into my app and it added a list of articles to each marker. Does your marker say \" ;undefined \" ; when clicked? The common cause of that is _a list_ of a list of dictionaries. If `article` has `return(jsonify[result])`, where `result` is the result from lookup, it will have an extra list, because `lookup` already returns a list. Or maybe the quotes around the list in the pasted example are significant.", "252" ], [ "The problem seems to be with alphavantage. Staff solution gives the same problem (as of 9:21 am et us, 27-july-2017). \r\n\r\nUpon reading the alphavantage doc, the < span style= \" ;color:green \" ; > High Usage < /span > tag got me wondering....\r\n\r\nI tried a different API, `WEEKLY`, which is not tagged \" ;High Usage. It (seems to) works every time, and it passes check50.\r\n\r\nChanged `_URL_1_` \r\nFrom: `url = f \" ;_URL_0_{os.getenv(&#39;API_KEY&#39;)} & datatype=csv & function=TIME_SERIES_INTRADAY & interval=1min & symbol=symbol \" ;` \r\n \r\nTo: `url = f \" ;_URL_0_{os.getenv(&#39;API_KEY&#39;)} & datatype=csv & function=TIME_SERIES_WEEKLY & symbol={symbol} \" ;` \r\n\r\nWhile I do not usually advocate changing supplied code, I don&#39;t think this change alters the point and value of the exercise. And it keeps things moving along.......\r\n\r\nAnd as of now (9:28 am) the staff solution (seems to be) is working. \r\n\r\nNB: This API will return *yesterday&#39;s closing price*. If your objective is to complete the pset this might be a good solution. It is not a good solution if your objective is to make a killing in the stock market......", "921" ], [ "1. There is no `?` in cs50 `execute`. If you send arguments in addition to the query, they are `bind variables`. The `execute` from [page][1] is *not* the `execute` used in cs50.\r\n 2. This `execute() takes 2 positional arguments but 3 were given` is the error given when the `query` argument has no bound variables, but there are additional arguments sent.\r\n 3. This is single-quote/double-quote/back-tick/parenthesis hell.\r\n\r\nI tried this in 2015 pset8 and gave up (too much typing). And now that you know I&#39;m a quitter, I&#39;ll give you advice. \" ;Begin with the end in mind \" ; (one of the 7 Habits). Write the query you want to execute. For example:\r\n\r\n`query = db.execute( \" ;SELECT * from places where (postal_code like &#39;Cambridge%&#39; OR place_name like &#39;Cambridge%&#39;) OR (postal_code like &#39;MA%&#39; OR place_name like &#39;MA%&#39;) \" ;)`\r\n\r\nThen back into it. Which ` \" ;` are significant? Which `&#39;` are significant? And then there&#39;s `%`. Maybe python `format` will help? \r\n\r\nMethinks you&#39;ll have to create the query *without* bound variables. \r\n\r\n\r\n\r\n \r\n\r\n\r\n [1]: _URL_0_", "67" ], [ "I don&#39;t know of any way to send a 400. And I totally agree that this checking should be done in the UI for a better user-experience. This class is not about UX, however, and the specification for `buy` says:\r\n\r\n > Require that a user input a number of shares, implemented as a text field whose name is shares. Render an apology if the input is not a positive integer.\r\n\r\n Therefore, best to put error checking in the `buy` function.", "858" ], [ "The height should be a non-zero number of pixels (with pset8 styling). When you select the div in the elements pane it should display the size over the element in the browser pane. FYI: I built a document_root with pset8:index.html, pset8.styles.css, this script.js with the 4 errors corrected. Running with apache50 as web server, it renders the map after the 4 corrections to script.js. The four corrections were: comment line 15 (styles: styles,); add `});` at line 28 to terminate `ready`; add `}` line 70 to terminate `configure`; add `}` line 85 to terminate `search`.", "703" ], [ "This ` < main class= \" ;container p-5 \" ; > ` is significant. The `class= \" ;container p-5 \" ;` defines the styling to use. In the context of pset7 it is using styling from bootstrap. Regardless of whether this app is using bootstrap or not, the `main` element (or the `container` class?) needs a `height: 100%;` style.\r\n\r\nThere are many ways to do that including: add it inline in layout.html, add it to the `styles.css`, etc. This will def fix the \" ;map not loading \" ; problem. (Actually, the map is loading, it&#39;s just not \" ;displaying \" ; because the `height` of `main` is 0px).\r\n\r\nThis may or may not solve the search box problem. However, that is absolutely a styling problem too. You probably need an `overflow: hidden` on that element. (Review the first block of pset8 `styles.css`). Of course, any style changes can have unintended consequences on other parts of the app. You are likely to get very familiar with the browser dev tools `Elements` tab during the course of this exercise. Good luck.", "455" ], [ "You need to store (and serve) the image from the `static` directory or a subdirectory thereof. `static` is the default `static_url_path` (and `static_folder`) when the app object is created and configured here `app = Flask(__name__)` in _URL_0_. You can refer to [this doc](_URL_2_) for more detailed information about the application object constructor. For instance:\r\n\r\n > **static_folder** – the folder with static files that should be served at *static_url_path*. Defaults to the &#39;static&#39; folder in the root path of the application.\r\n\r\n(I eventually ended up at the flask documentation after every hit for \" ;flask serve image \" ; mentioned \" ;static \" ;. Doh! It&#39;s similar to \" ;public_html \" ; or \" ;public \" ; in apache.)\r\n\r\nSuggest you create an `images` or similar subdirectory of `static` that contains `image.jpg`. Then the `background-image:` directive will be `url(&#39;/static/images/image.jpg&#39;). \r\n \r\nMake sure you can access the image from the address bar as with: \r\n`_URL_1_` \r\n \r\nIf you cannot access it from the address bar, the flask server will not be able to access it either. It might save troubleshooting time.", "822" ], [ "You could try ctrl-F5 (reload browser page) which will reload the browser cache; that often times will \" ;correct \" ; such a problem. Otherwise, you&#39;re going to need to use the browser tools to troubleshoot. Right click an element that&#39;s not behaving; select \" ;Inspect.. \" ; from the context menu. This will open the browser console with the html highlighted and all the applicable css displayed. That should give you the information you need to troubleshoot the problem.", "861" ], [ "I don&#39;t think this answers the question. By the time I&#39;m talking about Chopin&#39;s Waltz, op. 50, no. 3, that already uniquely identifies the work. So, by your own argument, \" ;In Eb \" ; is redundant. And, sure, naming the key gives some information about what it will sound like, but so would stating the tempo and, as you say, that would be very unusual. So why is stating the key so standard?", "617" ], [ "strcmp does not return a boolean, it returns an int. So your is_rest is always returning true, so it&#39;s not processing any notes. And btw, once you fix it, it will never be true because get_string never includes the delimiter/terminator. The \" ;old \" ; version (`s[0] == &#39;\\0&#39;`) should work. I do not think the macbook is implicated at all. I think the problem is the return values from duration and frequency. It will fail (seg fault) again after you \" ;fix \" ; is_rest. Time to break out debug50, dude.", "326" ], [ "Welcome to the forum!\r\n\r\nNone of the update statements in the debugger view updated *any* rows. None of them found a matching symbol in the `test` table. Notice, `test.symbol` in the database is `goog`, but the `WHERE` clause specifies `GOOG`.\r\n\r\nFrom the [Hints section][1] in the spec:\r\n\r\n > If str is a DELETE or an UPDATE, then execute returns the number of rows deleted or updated by str.\r\n\r\nYou could store the result of the update query in a variable, as with \r\n`result = db.execute( \" ;UPDATE test SET price=:price, total=:total WHERE symbol=:symbol \" ;...`\r\nand then print that result, which you would see in the flask terminal (for debugging purposes). \r\n\r\n[sqlite][2] has both `upper` and `lower` functions that you can use to manage the case issue. (python does too, but I don&#39;t have that doc on hand :)\r\n\r\nI don&#39;t see where \" ;all 4 rows are being updated 4 times \" ;. Perhaps that is not the complete debugger output? This shows exactly 4 updates executed, as one would expect from the `for row in rows` loop. \r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "154" ], [ "As with arithmetic, it might be easiest to unravel this by evaluating from the inside out. \r\n\r\n 1. `urllib.parse.quote(geo, safe= \" ; \" ;)`. `quote` is a `urllib.parse` method, doc found [here][1]. In this example, the (contents of) the variable `geo` are being made \" ;safe \" ; for the url (to prevent mischief, presumably).\r\n\r\n 2. `format` is a python string method doc found [here][2]. In this example, the `{}` in the ` \" ;_URL_0_;` string is being replaced with the result of `urllib.parse.quote.....`\r\n\r\n 3. Finally, `parse` is a `feedparser` method description found [here][3]. It \r\n \" ;goes to the URL \" ; because, well, that&#39;s what it&#39;s built to do. \r\n\r\n [1]: _URL_1_\r\n [2]: _URL_2_\r\n [3]: _URL_3_", "529" ], [ "I added this line `service = new google.maps.places.PlacesService(map);` to my pset8 and it gave this message `TypeError: google.maps.places is undefined` in the browser console. \r\n\r\nInternet search of the error turned up [this stack post][1] which says you need to add a `libraries` option to the Google API URL (more detail in the link).\r\n\r\nBut wait, there&#39;s more!\r\n(5 hours later, including dinner break) I spent more time on this than I shoulda, but I love a puzzle. \r\n\r\n`findPlaceFromQuery` is not the right tool (API) for the job. A \" ;query \" ; is something like \" ;restaurants in london \" ; (try it, it gives a result). I suggest you implement with [`nearbySearch` api][2] instead. \r\n\r\nThis might take a lot of trial-and-error. You may spend a lot of time in the browser dev console. It&#39;s school. That&#39;s how school works :)\r\n\r\nAnd because I cannot help myself....Shhhh! Don&#39;t tell Google you&#39;re accessing their map apis without an API key. It is unlikely your \" ;Google Map runs fine without [an API key] \" ;. It is embedded in the Google API URL in index.html. \r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "537" ], [ "If you want to print something different based on a *condition*, you need to use a conditional like an `if`. As written this program will only ever output (sign) and 5 dashes. Full stop.\r\n\r\nThis does not look like an exercise from CS50x (or CS50ap). This forum focuses specifically on CS50 If you want to work on your skills in the c programming language, [CS50x on the edx platform][1] is a great place to learn. You would find lots of help on this forum for the problems presented in that curriculum. If you choose the audit option, there is no charge (ie free). The sections are divided into \" ;Weeks \" ; to correspond to a school schedule, but this course is self paced; after the first 3 \" ;Weeks \" ; you should be able to write this program with ease. \r\n\r\n\r\n [1]: _URL_0_", "941" ], [ "The only *fact* the spec gives us: A4 is 440 Hz. If I&#39;ve read the code correctly, it&#39;s going to return 440 for C4. \r\n\r\nThe supplied `notes` program is a great debugging tool. If you run `./notes 4` and A is not 440, there&#39;s a problem. \r\n\r\n[This wikipedia page][1] has a note/frequency chart, the I found very helpful in concert with `notes` to verify the output. \r\n\r\nAnd of course, debug50 is a great tool to determine why the function gives the wrong frequencies. \r\n\r\n\r\n [1]: _URL_0_", "478" ], [ "Welcome to the forum. \r\n\r\nThere are a few things you should do before checking your code with check50.\r\n\r\nAfter you *write* the program, you have to compile it. You can [review these notes][1] from Lecture 1 to refresh your memory. You need to fix any compile errors before you move on. \r\n\r\nThe next thing to do before check50 is run the program and evaluate whether the output matches the spec. In the `mario` spec, there are some tests you can run, listed in the [Usage][2] section. It might not be a bad idea to make up tests of your own to verify the output.\r\n\r\nOnce the program compiles and runs (and gives correct results!) then it is time for check50. It may pass all tests, or it may highlight errors that you didn&#39;t catch in your testing. You want a \" ;clean \" ;, ie all passes, from check50 before you submit. \r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "726" ], [ "> Could someone please explain what is actually getting stored in\r\n > ledger?\r\n\r\nDo you mean this ledger `SELECT company, SUM(number_purchased) AS total_shares FROM ledger WHERE.....`. You can view the table structure in phpLiteAdmin (or sqlite3) to see what is stored in ledger table. Rows are (probably) created in the buy function, so review that to get more context. \r\n\r\nOr do you mean this ledger `ledger = db.execute( \" ;SELECT...`? It is a list of dict objects, as described in [Specification - > Hints][1].\r\n\r\n > I know that the db.execute returns a list of some sort but how are the two fields (company and total_shares) related to each other now?\r\n\r\nThey are keys representing the table&#39;s columns as described in [Specification- > Hints](_URL_0_)\r\n\r\n > Also, in the for loop, what is actually being iterated through and being stored where?\r\n\r\nIt is iterating through `ledger` (the variable). At each iteration, the next dict in ledger (ie the data from a row in the ledger table stored as key:value pairs) is stored in the variable `company`. \r\n\r\nAt least one problem is redeclaring company in the for loop.\r\n\r\n for company in ledger: // company is an element from ledger, a dict object\r\n company = company[ \" ;company \" ;] // now company is a string, &#39;GOOG&#39; perhaps?\r\n total_shares = company[ \" ;total_shares \" ;] // BUZZ, TypeError, since company is (now) a string\r\n\r\n [1]: _URL_0_", "546" ], [ "Hi welcome to the CS50 stack!\r\n\r\nLook carefully at the difference between: \r\n`tolower(key[x] - 97)` and `tolower(key[x]) - 97`\r\n\r\nWhen `key[x]` is Z as in the BaRFoo example, this `tolower(key[x] - 97)` (as it is written in the code) evaluates to 249. Say what? Mathematically, \" ;key[x] - 97 \" ; is -7. But, `tolower` takes an unsigned char as it&#39;s argument, so -7 is \" ;recast \" ; to 249. From `man tolower`:\r\n\r\n > RETURN VALUE\r\n The value returned is that of the converted letter, or c if the conversion was not possible.\r\n\r\nSo convert will be 100 when ciphering &#39;o&#39; with &#39;Z&#39;. \r\n\r\nThis same \" ;problem \" ; exists in the `isupper` branch, but obviously it does not provoke the same problem with the test data. I haven&#39;t done the math to figure out what condition will break it.", "947" ], [ "Just to verify: you downloaded the `love-0.10.2-win{32|64}.exe` and ran that to install version 10.2 of LOVE2D. (I only ask because downloading version 11 is a world of hurt viz. application0, and installing from the zip is way beyond my ken).\r\n\r\nI found the easiest way to run the project is creating a shortcut, as described in the [Getting Started wiki page](_URL_0_).\r\n\r\n > You can also launch the game from the command line:\r\n\r\n > \" ;C:\\Program Files\\LOVE\\love.exe \" ; \" ;C:\\games\\mygame \" ; \r\n > \" ;C:\\Program Files\\LOVE\\love.exe \" ; \" ;C:\\games\\packagedgame.love \" ;\r\n\r\n > You can create a shortcut to do this; simply make a shortcut to love.exe, right-click on it and select \" ;Properties \" ;, and then put the command line you want in the \" ;Target \" ; box for the shortcut. \r\n\r\nwhere \" ;C:\\games\\mygame \" ; is the path of your \" ;application0 \" ; directory.", "487" ], [ "Hi and welcome to the forum. A couple of procedural things before we get to the question:\r\n\r\n 1. I assume this question supersedes [the original question.][1] Be sure to delete the original. For future reference, there is an edit option at the bottom of questions which would be the perfect approach in this case.\r\n 2. Pasting the actual code is usually better than screen shots. If someone wants to test out your code, they would not have to re-type it. Your question will get better attention that way. (+1 for improving the look of the code by any means.)\r\n 3. To easily format code that has been pasted into a question (or answer, for that matter), select the code you pasted then click the `{}` in the formatting bar. Ta-da, formatted code. \r\n\r\nNow, to the heart of the matter. What is `argv[1]` in this command `./a.out caesar.c 4`? According to `man atoi`:\r\n\r\n > The atoi() function converts the initial portion of the string pointed to by nptr to int.\r\n\r\nIn this case there is no \" ;integer \" ; portion of `argc[1]`, thus it returns 0. The program is working properly because as called, `argv[1]` is `caesar.c` and `atoi[caesar.c]` returns 0.\r\n\r\nAnd a warning: The checker (check50) and submit (submit50) software will use `make` to compile. If your program does not compile with `make` it will not pass.\r\n\r\n \r\n\r\n\r\n [1]: _URL_0_", "636" ], [ "Hi and welcome to the forum. \r\n\r\nI suspect the problem lies here `or not isinstance(request.form.get( \" ;shares \" ;), int)` in the buy route.\r\n\r\n\r\nFrom the spec [emphasis mine]:\r\n\r\n > Require that a user input a number of shares, **implemented as a text field** whose name is shares. Render an apology if the input is not a positive integer.\r\n\r\nIf you are verifying the input in buy.html, good on ya! Better UX! Users will thank you. check50, on the other hand, may punish you. Alas, this course is not about UX. And since the above is in the buy spec, the black-magic-box that is check50 is somehow ensuring that. This buy function does not explicitly test the \" ;positive integer \" ; condition.\r\n\r\nFWIW I cannot get the `not isinstance` to return anything but False in my repro case. `type(request.form.get( \" ;shares \" ;))` always returns `str` (tested with both Chrome and Firefox). I cannot explain why it works in your environment.", "241" ], [ "welcome to the forum. Be sure to get your first badge by taking the [tour](_URL_0_).\r\n\r\nHere&#39;s a sneak peak:\r\n\r\n > CS50 Stack Exchange is a question and answer site for students of Harvard University&#39;s CS50.\r\n\r\nThis does not sound like a question from the CS50 courseware. This is a great course, and if you are interested in learning C, I strongly recommend it. You can sign up [here](_URL_1_) at _URL_2_. There is an option to audit the course. You won&#39;t get a certificate, but it is free. You will learn the same amount.\r\n\r\n\r\n C is a strongly typed language, and as such it is not possible to create variable names dynamically. You might be able to accomplish the same thing by using an array, which you could allocate based on a user input.", "884" ], [ "I&#39;ve been trying out [Authy](_URL_1_), a Google Authenticator alternative with an optional feature of being able to back up your tokens. They have two types of tokens: Authy-generated tokens and the regular OTP tokens you added by scanning a QR code (like you would in Google Authenticator).\r\n\r\nIf I [understand correctly](_URL_0_), backups of your standard OTP tokens are encrypted with a password before uploading them to Authy. Your backup password isn&#39;t sent to their servers, they just store an encrypted blob of data for you. Sounds good so far.\r\n\r\nHowever, when setting up Authy on a new device I noticed that the Authy-generated tokens don&#39;t seem to benefit from the same level of security. When you set up Authy on a new computer you can get access to your account through SMS verification (something they&#39;ve [criticized](_URL_0_) for being insecure). Entering an SMS passcode will log you in and give you immediate access to your Authy-generated tokens (assuming you&#39;ve enabled multidevice support). The Authenticator tokens are still encrypted at this point, and they can be decrypted if you enter the backup password.\r\n\r\nWhat are the security implications of this? Doesn&#39;t the SMS-based login procedure make Authy-generated tokens quite vulnerable to capture?", "623" ], [ "There is no `?` in cs50x 2018 version of sql; \" ;:bound :variables \" ; are used to mitigate sql injection attacks.\r\n\r\nOf the three \" ;options \" ; this `db.execute( \" ;INSERT INTO users (username, hash) VALUES (:username, :hash) \" ;, username, password)` is closest to correct. But no cigar.\r\n\r\nThe part that&#39;s missing is where you tell the sql what to \" ;substitute \" ; for the bound variable. \r\n\r\nThe [Hints][1] section of the spec directs you to `login` for an example. \r\n ` rows = db.execute( \" ;SELECT * FROM users WHERE username = :username \" ;, username=request.form.get( \" ;username \" ;))`\r\n\r\nNotice the difference in syntax. In the Hints sql, `username` is _set_ to something.\r\n\r\nThis error comes when the number of bound variables in the query argument does not match the number of additional arguments passed to `execute`. \r\n\r\n\r\n [1]: _URL_0_", "817" ], [ "Check developer console for errors? Are `configure` and `search` functions terminated properly?\r\n\r\n--EDIT ADDITIONAL--\r\n\r\nAssuming you have fixed the 4 syntax errors that this script.js produces (3 missing function close, 1 undefined parameter), the remaining problem is style.\r\n\r\nTo see for yourself:\r\nUse the inspector(firefox)/elements(chrome) in the dev console and highlight the `map-canvas` div. What is the height? \r\n\r\nYou need a`map-canvas` styler & agrave; la pset8 styles.css.", "39" ], [ "Yes, there is a problem with names. `index.html` iterates through a set named `purchases` here \r\n `{% for purchase in purchases %}`. \r\n \r\nBut no variable named `purchases` is *sent* to index.html in this call \r\n `return render_template( \" ;index.html \" ;, stock=purchase[ \" ;stock \" ;], usercash=usercash, grandtotal=grandtotal)` \r\n\r\nThere is a mis-match of names in index.html here:\r\n\r\n {% for purchase in purchases %}\r\n \r\n < tr > \r\n < td > {{stock.symbol}} < /td > \r\n < td > {{_URL_0_}} < /td > \r\n < td > {{stock.price}} < /td > \r\n < /tr > \r\n\r\nPick a name and stick to it. In the `return render_template` send `purchase=purchases`. In the ` < td > ` elements use `purchase.`. \r\n\r\nThat will get you closer. Other problems include (but might not be limited to):\r\n\r\n - In the index function, the `purchases` dictionaries only contain `stock` and `sumshares` (from the `db.execute`). If you want to display `purchase.symbol` and `_URL_2_` in the html, you will have to \" ;create \" ; them. (something like `purchase[&#39;symbol&#39;] = purchase[&#39;stock&#39;]` in the `for purchase in purchases:` loop in _URL_1_).\r\n - `index.html` has 5 ` < th > ` but the for loop only outputs 3 ` < tr > `.\r\n - not using `usd` on the $ fields. This will be a problem with check50.\r\n\r\nYou are not that far off. Just remember the computer is very particular about what you \" ;name \" ; things. And when you make changes something, or something else, might/can/will go wrong. Slow and steady wins the race.", "814" ], [ "The problem comes because `cipher` is declared a char array here `char cipher[strlen(plain)];`, but printed out using a `string` (aka `char*`) format here `printf( \" ;ciphertext: %s\\n \" ;, cipher);`.\r\n\r\nRemember, the thing that makes a string a string is the terminating null byte `\\0`. And a string occupies one more byte than `strlen` to accomodate the terminator. \r\n\r\n`cipher` is not null-terminated, therefore the `printf` result is printing everything in memory until it encounters a `\\0&#39;.`", "941" ], [ "One more typo. The `render_template` is not quite right. You need `purchases=purchases` (so that index.html will have all the stocks in an array named `purchases`). The current code says `purchase=purchases`. I know it is _very_ late in the game to offer this hint: When the brain is being bombarded with all these new concepts and languages and curly braces and for loops (!!), it takes whatever shortcuts it can. So it&#39;s very easy for the eyes to miss the difference between `purchase` and `purchases`. Make the variables more visually distinguishable. Like `allPurchases` and `purchase`.", "814" ], [ "welcome to the forum.\r\n\r\nAssuming `new_node` is a struct (which I believe is the premise here), then `new_node` is *not* a string. In the `load` walkthrough, the `node` struct has two elements: `word` which *is* a string, and `next` which is a struct pointer. Therefore, `strcopy(new_node - > word, word);` would be correct.\r\n\r\n<PERSON> gives a much better explanation than I ever could in [this CS50 video on structs](_URL_0_). I think the clarification you seek starts at around 6:40.", "758" ], [ "The `stocks` array is being populated with `symbol` and `shares` keys from the database. That is all that is being sent to `index.html` here `return render_template( \" ;index.html \" ;, stocks = stocks, cash = casha)`. \r\n\r\nThe `for stock in stocks:` loop is not creating new elements in `stocks`. \r\n**EDIT -- > ** Why is that? The loop creates *variables* for each of the elements needed in index.html *but never stores them in stock* (and by extension, never stored in stocks). You need to create new key/value pairs in a `stock` by assigning them. For instance `stock[ \" ;value \" ;] = value`. \r\n\r\nYou have the idea in the edited code. However, it will only work if `rows` is the empty set (ie the SELECT does not return any rows). Why is that? Because this `stock[ \" ;symbol \" ;] = rows[ \" ;symbol \" ;]` will give a `TypeError` if it tries to process a `stock`. There is no rows[ \" ;symbol \" ;] because rows is a list of dictionaries indexed to 0. And fixing that will result in cascading errors, so (free) advice, go back to the original version and populate `stocks` properly. \r\n\r\nAll things being equal, I cannot find a condition where the cash line does *not* display the cash value.", "604" ], [ "The first fail is probably because of the typo in this line `elif request.form.get( \" ;passowrd \" ;) != request.form.get( \" ;confirmation \" ;):`. Check the spelling of your request.form variables carefully. As written, this will always evaluate to true. \r\n\r\nThe second fail is probably because the test for a duplicate is too late. If you successfully insert a user, and then retrieve the user, it will always be there.", "56" ], [ "Remember: when you register a new user, they do not have any stocks yet, so `rows_pt` is the empty set. Therefore, the `for row in rows_pt:` has no rows to process, does not execute, and \" ;falls through \" ;. When that happens, it does not encounter a `return`, as the error message from check50 (and in your flask terminal) is describing. There may be other problems in the code. The flask terminal will give you feedback when errors are encountered. \r\n\r\n**EDIT**: [based on comments and reposted code] I created a repro app with the new index and register functions pasted here. They performed as I expected, did not give an \" ;Internal Server Error \" ; and passed the register tests in check50. Is it possible you tested and check50&#39;d before you saved the changes to _URL_0_? \r\n\r\nA quick primer on the flask log (built from experience).\r\n\r\nYou will see the flask log in the terminal from which you executed\r\n `flask run`. It always starts out with 5 or 6 info lines ending with\r\n ` * Restarting with stat`. Entries generated from the app or the\r\n server will be logged after that. And remember when you save\r\n `_URL_0_` in the editor, it will *automatically* respawn\r\n flask, so the last ` * Restarting with stat` in the output is the\r\n most recent. Warning: when you switch to the `flask` terminal the last line posted to the log may not be the last line you can see on the screeen. Make sure you scroll to the bottom of the terminal to see it all. \r\n \r\n4 types of entries you may encounter in the log are: \r\n\r\n - INFO:werkzeug:{ip} - - [{date time}] \" ;GET / HTTP/1.1 \" ; 302 - This ` \" ;GET / HTTP/1.1 \" ; 302` is saying \r\n *server received a* **GET** *request for app route* **/** *using protocol* **HTTP/1.1** *which returned a status code of* **302**\r\n - DEBUG:cs50:SELECT cash FROM users WHERE id = 26. This displays a `db.execute` call, with appropriate substitution of bound parameters. This can be a great troubleshooting tool, since you could copy/paste the sql into phpLiteAdmin or sqlite3 and review the results. \r\n - ERROR:flask.app:Exception..... This message is followed by a block of information, (the python Traceback) and one will be generated whenever you get an \" ;Internal Server Error \" ;. As with all python Tracebacks, you need to go to the end of the block to find the actual error, and then work backwards to find where the error was generated. \r\n - ERROR:werkzeug:Error on request: I find these errors always accompany (follow) an `ERROR:flask.app:Exception`. It has something to do with the `errorhandler` defined in `_URL_0_` and quite honestly I generally ignore them, since the `ERROR:flask.app:Exception` usually has the info I need to troubleshoot.", "921" ], [ "welcome to the forum. I get the same console message, and a greyed out map with \" ;for development purposes only \" ;. Since you are developing, this really shouldn&#39;t prevent you from making progress on the pset. Everything should still work, it just makes the map itself a little harder to read. In my case, the input box, the markers, the articles are all quite legible and useable.", "871" ], [ "It looks like the immediate problem is that there is no `letter` in \" ;POST \" ;. ie no element with `name= \" ;letter \" ;` in the HTML.\r\n\r\nFrom [Python doc][1] (emphasis mine):\r\n\r\n\r\n > get(key[, default])\r\n > \r\n > Return the value for key if key is in the dictionary, else default. If default is not given, it defaults to None, **so that this\r\n > method never raises a KeyError**.\r\n\r\nThere may be other problems in the code, but this should get things moving ahead.\r\n\r\n\r\n [1]: _URL_0_", "342" ], [ "From the edX version of the course, that source is found on the `Week 1, Continued` page, click the `Source Code` link. It will offer a zip file to download to your computer. It is in that zip file. \r\n\r\nYou will also find it on this page _URL_0_. When you click `capitalize.0` link you can open it on your local computer with Notepad or your favorite text editor.", "177" ], [ "There&#39;s a couple of problems. \r\n\r\nFirst, `height` is essentially a constant after it is entered by the user. It represents the number of rows to print, and as such, shouldn&#39;t be changed by the program. It should control the \" ;main \" ; loop, as you have done here. \r\n\r\nSecond, you want to print and *increasing* number of hashes on each row. Think about which variable is increasing. \r\n\r\nFinally, you want to print `height + 1` characters on each line. That means you need to *vary* the number of spaces that print on each line, which means spaces could (should?) be output in a loop too. \r\n\r\nI have found this pset takes more thinking than coding. It might be helpful to get out the old pencil and paper. Draw the grid you want and evaluate how many spaces, how many hashes in each row. Then determine how each relates to `height` and which row is being processed (`i` in this case). That should give you the \" ;math \" ; you need to control the space loop and the hash loop.", "947" ] ]
29
[ 19385, 13281, 5167, 11297, 564, 453, 6545, 5468, 5290, 15773, 11574, 16289, 9749, 1052, 1985, 1258, 3504, 12675, 8034, 4840, 8879, 11786, 6513, 9663, 17611, 12856, 5986, 18701, 13903, 1553, 8613, 1095, 3971, 8218, 18332, 5039, 10341, 8444, 2344, 9059, 4891, 16592, 16790, 16343, 4058, 1856, 7200, 1768, 15724, 10685, 8512, 14584, 17828, 8462, 11324, 17490, 1054, 11611, 10453, 5322, 6395, 8493, 10784, 10977, 17007, 19359, 5874, 5439, 7842, 634, 5966, 576, 16169, 667, 9091, 9866, 17278, 7071, 15334, 16934, 1141, 16663, 19129, 2705, 1641, 16157, 3663, 12858, 2005, 6789, 17759, 16811, 5475, 5994, 12406, 7345, 12307, 3317, 5071, 14163, 3074, 6017, 6786, 8849, 2871, 6635, 17554, 14219, 14510, 15482, 13064, 9197, 10292, 14357, 15433, 551, 12261, 8575, 17479, 5033, 2529, 9130, 10238, 13399, 19215, 9460, 13661, 17515, 4094, 698, 5340, 17392, 4501, 3942, 4552, 2603, 4699, 10468, 16900, 6452, 16058, 2890, 8747, 2676, 14470, 10588, 2353, 9899, 1786, 17111, 3214, 1978, 12315, 15867, 10938, 2083, 6050, 4157, 863, 13181, 5613, 9988, 8525, 4640, 12447, 14582, 6310, 8862, 3648, 6674, 3372, 6002, 6158, 19712, 17778, 11631, 5389, 18532, 13150, 19586, 2224, 16599, 5041, 632, 1705, 2969, 15820, 14761, 5109, 2932, 768, 3109, 1390, 7142, 6884, 18090, 2583, 14341, 13484, 7251, 675, 7738, 17213, 1933, 3446, 8679, 109, 8943, 209, 3118, 15047, 46, 9997, 11280, 18040, 11261, 14141, 1504, 7143, 15877, 14138, 14382, 3081, 18586, 10997, 12145, 5944, 3698, 2634, 4657, 15519, 3954, 19291, 199, 12268, 10269, 3974, 2506, 13046, 11537, 18823, 14116, 6347, 12706, 7153, 4027, 4466, 7111, 9527, 13264, 4333, 6843, 4802, 13182, 5353, 2199, 5201, 5735, 17155, 2632, 18167, 10966, 8963, 6615, 9142, 1581, 18331, 717, 11823, 9961, 3176, 12463, 9450, 2675, 1387, 17011, 12141, 5732, 8704, 6608, 2919, 3990, 8975, 8676, 13704, 8172, 13384, 16643, 12055, 10734, 14287, 2333, 9023, 8433, 14888, 12235, 6971, 16286, 13870, 16064, 15168, 12090, 18385, 17188, 5217, 9101, 3000, 5526, 13906, 9429, 2762, 5210, 6168, 8326, 14552, 5269, 6068, 1514, 13884, 711, 6114, 18937, 16349, 19753, 16714, 8608, 15186, 14742, 16039, 7473, 328, 2136, 18544, 4586, 17910, 523, 6661, 6604, 13613, 15710, 4068, 3419, 4730, 583, 1368, 10094, 4739, 11484, 5332, 13867, 10319, 8193, 982, 3541, 1651, 6010, 151, 17289, 459, 13508, 7756, 7035, 1929, 7837, 14455, 9962, 9635, 11415, 18985, 9406, 17000, 19069, 9510, 2561, 12110, 7655, 9355, 5094, 620, 5228, 1533, 2310, 19266, 13796, 1674, 5752, 2949, 12336, 6205, 2296, 15303, 4164, 5916, 6734, 16895, 6471, 9694, 9596, 575, 3928, 13880, 2430, 11727, 17936, 10793, 17286, 6475, 6746, 8647, 4249, 14984, 5789, 15737, 1827, 14087, 12831, 14261, 16198, 13146, 9096, 17945, 471, 1040, 5628, 19270, 3905, 15858, 4664, 5636, 10687, 16241, 1295, 1994, 1402, 2227, 1746, 15805, 4727, 9368, 11626, 15579, 10925, 1771, 13480, 10074, 9953, 4337, 3810, 6999, 18402, 11753, 15494, 17697, 1748, 6687, 1, 2846, 11688, 12042, 15391, 377, 8865, 16442, 17183, 10890, 12695, 18165, 7202, 17642, 5162, 6905, 4660, 4401, 1184, 15215, 122, 11460, 156, 17189, 13554, 4494, 5483, 16617, 16640, 3244, 19545, 2415, 2697, 7402, 12023, 11189, 2001, 7175, 1600, 1047, 6258, 16504, 3712, 8040 ]
STX_10075.0
[ [ "## Wild Shape ##\r\n\r\nThe wild shape entry answers most of these questions, but to be brief - \r\n\r\n - Natural Armour bonus to AC is based on new form - if your normal form has natural armour, that goes away for the duration of the wild shape. You gain, however, any natural armour the animal you have turned into possesses.\r\n - Dodge bonuses from some sources (Spells, feats, class abilities) remain. Ex or Na *racial* dodge bonuses, however, will generally go away. This is a grey area, and an edge case - ask your GM.\r\n - Again, racial deflection bonuses may go away depending on type. This is a grey area. Those from spells, feats, class abilities, will stay.\r\n - Magic Items that you are wearing are &#39;melded into your new form and become inactive&#39;. Magic Items that you *take off and put back on after you wild shape*, since every being has &#39;magic item slots&#39; for 2 rings, one necklace, one periapt, one cloak, etc, are presumably active. There&#39;s no errata about this, but by RAW, you as a bear can put on a magical necklace and get +6 to Con. It&#39;s not, though, something that you&#39;d be doing at Combat speed, which sort of balances it out.\r\n - Spells will generally remain active. There&#39;s some argument over what happens if you cast a spell that requires a &#39;person&#39; target (like Charm Person) and then turn into a bear (not a Person anymore), does it still work? Some say that it checks for pre-reqs at casting (which is RAW), and others that it should/would check again when those pre-reqs chance (not RAW). YMMV. But things that don&#39;t specify &#39;a person&#39; or &#39;an elf&#39; or whatever should be fine.", "825" ], [ "## Not by RAW ##\r\n\r\nThere&#39;s no rules for &#39;throwing&#39; traps, or trying to land a trap&#39;s activation trigger on someone&#39;s face with a throw.\r\n\r\nUnder RAW it would likely be treated as just the damage from an improvised thrown weapon, but RAW breaks down in this circumstance because the actual process of setting a trap isn&#39;t elaborated on enough to define what would be happening in this sense.\r\n\r\n## But you&#39;re the GM. ##\r\n\r\nHouserules are the GM&#39;s purview. In a situation like this without clearly defined RAW, it&#39;s not even a huge stretch.\r\n\r\nIf you want to design a monk npc who has a specific fighting style based around tossing traps places. And he has a magical bag or something to store all these specially designed preloaded throwable traps in, then as the GM, that&#39;s your purview. How strong these traps should be and how mobile he is and how many of the traps he can toss per round sound like &#39;balancing the encounter&#39; question that requires a writeup of who is in the party and what tactics the party generally uses.\r\n\r\nMaybe you have players who call bullshit unless it&#39;s pure RAW from a equal CR monster in the bestiary, but in that scenario, that&#39;s a &#39;players vs GM&#39; problem not really a monk related problem and would require it&#39;s own question.", "276" ], [ "Engaging people is rarely a function of &#39;style&#39; of game in the larger sense, like &#39;maps vs descriptions&#39; or &#39;larping vs tabletop&#39;.\r\n\r\nGenerally it&#39;s a matter of creating npcs and situations that fire the imagination of the players, which isn&#39;t exactly easy, and cause them to play their characters in a more engaged manner due to that firing, which then chain reacts.\r\n\r\nThere&#39;s a lot of writing online about this. I personally prefer [The Alexandrian][1]&#39;s game related essays. The advice I would give would be to liberally steal the essence of interesting books, games, movies, and turn them into a reskinned part of your plot line. Similarly npcs. Steal.\r\n\r\nThere&#39;s reams of advice on the topic. Be high energy, do this, betray that, break tropes, play to tropes, etc, but it&#39;s a really large topic, too large to get into here. Every single GM skill feeds into engaging players. To creating narrative importance.\r\n\r\nMy advice would be, play with a lot of different people. Watch them and learn their roleplaying skills, then apply them. Learn to read your players&#39; tells, and find what excites them in the short term (loot, victory, jokes) and in the long term (stories, recurring npcs, foreshadowing and outcomes of long term things). Read a lot, not just online GM advice, but books, psychology texts, even newspapers. And don&#39;t be afraid to make bad things happen to your players&#39; characters. Adversity is always the key to engaging storytelling, in any medium.\r\n\r\n\r\n [1]: _URL_0_", "276" ], [ "The bigger picture here is that in an ordered field with its native absolute\r\nvalue, any similarity between two subsets is affine. (In this setting, \r\ngiven any two points, a third point is uniquely determined by its distances to those points. This provides a way of extrapolating a similarity from its values at two points)\r\n\r\nIn the case of <PERSON> cuts in the rationals as you define them, since\r\nthey are bounded above, but not below, this affine map must also be\r\norder-preserving. Hence it must have the form $f(x) = p + qx$ with \r\n$p \\in \\mathbb{Q}, q \\in \\mathbb{Q^+}$.\r\n\r\nWe have then that a similarity of cuts in $\\mathbb{Q}$ extends uniquely\r\nto an order-preserving self-similarity of $\\mathbb{Q}$, which extends uniquely to an order-preserving self-similarity of $\\mathbb{R}$.\r\nFrom there it seems obvious that $\\alpha, \\beta \\in \\mathbb{R}$ have similar\r\nDedekind cuts in $\\mathbb{Q}$ if and only if there is a rational $p$ and a\r\npositive rational $q$ such that $\\beta = p + q\\alpha$.", "449" ], [ "**Speaking simply, on the high end or the low end.**\r\n\r\nWhen you desperately want to turn something with more HD than you have cleric levels, (aka turning a single high-CR undead), you might not need that much &#39;turning damage&#39; aka &#39;amount of hd turned&#39; but want a higher chance to actually affect it at all. The only real way to calculate this is through metagaming, or a GM who treats knowledge checks as &#39;you know the monster&#39;s stats&#39;.\r\n\r\nOn the low end, when you just don&#39;t want to roll like, a 2, and not be able to turn the low-HD ghouls despite being a higher cleric level than they have HD, you can just take away a few &#39;turning damage&#39; points to push that from &#39;needing to roll a 4 or better&#39; to &#39;needing to roll a 1&#39;. Aka, making the initial turning check a shoe-in.\r\n\r\n**Is the feat any good?**\r\n\r\nNope. Get the ones which give +effective turning levels. Get the one that activates the relic item that does the same. Counting as a higher level cleric makes the turning check relatively pointless, with the amount of etls you can get for the cost of a feat. And if you&#39;re caring about turning, be a Sun Cleric and just straight up burn undead into actual cinders with Greater Turning.\r\n\r\n**Is there a certain build where it&#39;s good**\r\n\r\nSorta. The maxed out charisma turning cleric build. Where you already have all the stuff to make your turning as murderous as possible, in an undead-heavy campaign. The high charisma means you can spend points of &#39;turning damage&#39; without making it useless, so the &#39;high end&#39; undead can be affected by your 1d20+charisma+heighten turning bonus&#39;d check. Since 2d6 is unlikely to roll less than four, you&#39;re effectively going to be making the turning check 1d20+charismax2, with when you&#39;re really going for it, 1d20+charismax2+3 (average roll on 2d6 being 7), and with a charisma of 5 and average of 10.5, pushing the turning check into &#39;very unlikely to get below level+3&#39; territory.", "825" ], [ "So, I think I finally managed to get the right headers for resize.c\r\n\r\nBut now, when I look at the output, I get this random colored bmp file and it&#39;s driving me nuts, as I have no idea why it does that. I have modified my code tons of times, but ultimately decided to recopy paste the original from copy.c, but I&#39;m still getting the color thing. Can anyone clarify what&#39;s going on? Here&#39;s (a bit of) my code:\r\n\r\n // Saving original width and height\r\n int oriwidth = bi.biWidth;\r\n int oriheight = bi.biHeight;\r\n \r\n // Modifying to new width and height\r\n bi.biWidth = bi.biWidth * n;\r\n bi.biHeight = bi.biHeight * n;\r\n \r\n // determine padding for scanlines\r\n int oripadding = (4 - (oriwidth * sizeof(RGBTRIPLE)) % 4) % 4;\r\n int padding = (4 - (bi.biWidth * sizeof(RGBTRIPLE)) % 4) % 4;\r\n \r\n // Modifying sizes\r\n bi.biSizeImage = ((bi.biWidth * abs(bi.biHeight)) * sizeof(RGBTRIPLE)) + (padding * abs(bi.biHeight));\r\n bf.bfSize = bi.biSizeImage + 54;\r\n \r\n // write outfile&#39;s BITMAPFILEHEADER \r\n fwrite( & bf, sizeof(BITMAPFILEHEADER), 1, outptr);\r\n\r\n // write outfile&#39;s BITMAPINFOHEADER\r\n fwrite( & bi, sizeof(BITMAPINFOHEADER), 1, outptr);\r\n\r\n\r\n // iterate over infile&#39;s scanlines\r\n for (int i = 0; i < abs(oriheight); i++)\r\n {\r\n // iterate over pixels in scanline\r\n for (int j = 0; j < oriwidth; j++)\r\n {\r\n // temporary storage\r\n RGBTRIPLE triple;\r\n\r\n // read RGB triple from infile\r\n fread( & triple, sizeof(RGBTRIPLE), 1, inptr);\r\n\r\n // write RGB triple to outfile\r\n fwrite( & triple, sizeof(RGBTRIPLE), 1, outptr);\r\n }\r\n \r\n // skip over padding, if any\r\n fseek(inptr, padding, SEEK_CUR);\r\n\r\n // then add it back (to demonstrate how)\r\n for (int k = 0; k < padding; k++)\r\n {\r\n fputc(0x00, outptr);\r\n }", "682" ], [ "Thank you <PERSON> :-) You are right, \" ;what do you use as your address \" ; should be fine. \n\nAccording to _URL_0_ an invoice must include the customer&#39;s address. But it should be OK if there wasn&#39;t one on some invoices.\n\nSo I would do the work, have template invoices in my case, write the amount on the invoice. Then ask my client to write their name and address on two copies, and keep one of them. Is that right? \nOr by email but that&#39;s a pain.\n\nI&#39;m worried that with many small jobs (1 hour or 2), people would find it a pain to fill it. It&#39;s also be a pain for me, so I&#39;m trying to minimize it.", "190" ], [ "**p315, Core Book**\r\n\r\n > Active spells are linked to their casters,\r\n**spirits are linked to their summoners**, astrally projecting\r\nmagicians are linked to their physical bodies, and foci\r\nand magical lodges are linked to the magicians who activated\r\nthem. **Awakened entities who assense the astral\r\nsignature of these astral forms can track their links\r\nthrough the astral plane back to their sources**. Following\r\nan astral link requires an Assensing + Intuition (5,1\r\nhour) [Astral] Extended Test modified as noted on the\r\nAstral Tracking Modifiers table.\r\n\r\nEmphasis mine.\r\n\r\nSo sure. Your spirit gets observed, or held down and observed, and they now know what your astral signature is and where you are.\r\n\r\nHope you have Masking and a LOT of dice at it (and some way to hide your signature when you&#39;re asleep). Because if you tried to off someone important, spirits are going to be scouring the area for you, and the HTR team will be jetcoptering to that location also.\r\n\r\nOverall, using a spirit anywhere it might be observed by an enemy mage is intensely dangerous, and balances spirit use considerably. With a link to you, they can straight up just kill you with a Ritual. From any range.\r\n\r\nWatcher spirits come with assensing. Mana barriers can hold enemy spirits to use as links, as can (with some degree of fiat) stronger spirits (in the brute-force, held-down sense). 1% of the population is awakened, if low-magic or adepts or unaware of their magic, so even if only 0.1% are employable as wage-mages, that means you can still hire astral security to liaise with your week-per-force force 8 watcher spirits that get refreshed every 2 months or whatever.\r\n\r\nAstrally Projecting mages can respond from across the world to an alarm in seconds. And bring bound spirits with them, or banish/attack/trap dual-natured spirits using mana spells, banishing, or mana barriers from the astral plane using their astral form. Astral travel is extremely fast, and high-initiative.\r\n\r\nSo all you need is an alarm pressed when the spirit first manifests, and soon, astrally projecting mages could be studying it, and 1 hour later your &#39;summoner assassin&#39; has enemy spirits appearing in his bedroom, or just HTR knocking on his door.\r\n\r\nThe actual scary potato is the Ritual assassin, and it&#39;s why anyone who is rich or magical makes sure anything linked to them is burned instead of thrown out.", "271" ], [ "**No, it shouldn&#39;t affect items.**\r\n\r\n*Staves* and *scrolls* are the two major item categories that reference caster level.\r\n\r\nHowever,\r\n\r\n > **Special:** Taking this feat reduces your caster level for all **your** *spells* and *spell-like abilities* by 4.\r\n\r\nWhile the staves and scrolls do contain spells, they are not your spells - they are spells &#39;being cast from the scroll&#39; or &#39;cast from the staff&#39;, wording that endures throughout all uses throughout all the rulebooks. &#39;Your spell&#39; or &#39;spell-like-ability&#39; is conversely only used to describe spells inherent to the character - granted by level, feat, or rarely, by a different spell or ability.\r\n\r\nThere&#39;s no specific text clarifying this, but it&#39;s fairly safe to say that when casting a spell from a stave or a scroll, you do not suffer the -4 penalty to CL.", "796" ], [ "## Yes. ##\r\n\r\nFrom the SRD on critical hits - \r\n\r\n > Exception: Extra damage dice over and above a weapon’s normal damage is not multiplied when you score a critical hit.\r\n\r\nFrom the Combat section of the 3.5e PHB - \r\n\r\n > **Spells and Critical Hits:**\r\n\r\n > A spell that requires an attack roll can score a critical hit. A spell attack that requires no attack roll cannot score a critical hit\r\n\r\nFrom pg72 of Complete Arcane\r\n\r\n > **Feats and Weaponlike Spells**\r\n\r\n > Any spell that requires an attack roll and deals damage functions as a weapon in certain respects. As such, several feats that improve weapon performance can be used to enhance weaponlike spells.\r\n\r\nThe only thing critical hits do not multiply is bonus dice above and beyond the weapon&#39;s normal damage. The spell&#39;s base damage is the &#39;weapon&#39; in this circumstance. Ergo, you would double the damage added from int, from Fiery Spell, from Weapon Specialization (Ranged Spells), etc, you&#39;re fine.\r\n\r\nIn Pathfinder, when you Empower a spell, you roll an additional half-sized die (like a d3, or a d2) for each empowered die. Those would probably be &#39;bonus dice&#39;, and therefore not be multiplied by a critical hit.\r\n\r\nHowever, in 3.5, you just multiply the result of the spell&#39;s rolls by 1.5x, so it would stack with a critical hit.\r\n\r\nKeep in mind how 3.5 handles multiplication, though - 1.5x + 2x = 2.5x, not 3.5x or the result of 1.5x + the result of 2x. \r\n\r\nIf you&#39;re using Sneak Attack to add +3d6 damage to a spell, that extra sneak attack damage would not be multiplied. Similarly extra dice from *dragon fire inspiration* or any other ability that adds &#39;bonus dice&#39;.", "825" ], [ "Extremely Unlikely to Cause Balance Issues\r\n------------------------------------------\r\n\r\nMost Large, Huge, or Tiny playable races in 3.5e come with huge amounts of LA or Racial Hit Dice. The notable exception to this is the Brownie.\r\n\r\nGiven that any character who is playing a Tiny or Huge druid is going to be at least - at least - 4 levels behind, and even the cheapest option for actual Large (a Dragon Magazine template) costs 1 LA, with a more reasonable source costing 4 lost levels, allowing them to have wildshapes of their size will be unlikely to make up for their weaker animal companion and lower CL and spell levels. A human or elven druid of the same ECL will probably still outperform them in every aspect.\r\n\r\nThe Druid is a hugely powerful class because it has three major options that boost it - Spells, Animal Companion, and Wildshape. Wildshape is powerful but not as powerful as the spellcasting with splatbook access, and it does not have the action economy advantages of the buffed Animal Companion. Losing caster levels and animal companion advancement by taking a race with racial hit dice and/or Level Adjustment will not be made up for by a better wildshape, at least without significant cheese.\r\n\r\nIf someone wished to optimize a druid, there are far easier ways, and likely would not even consider this option as powerful.", "825" ], [ "As another workaround I could suggest considering packing huge collections of files into an uncompressed(!) `tar` archive, and then using `archivemount` to mount it as a filesystem. A tar archive is better for sharing than a filesystem image and provides similar performance when backing up to a cloud or another storage. \r\n\r\n-----\r\nIf the collection is supposed to be read-only, `squashfs` may be an option, but it requires certain options enabled in the kernel, and `xz` compression is available for tar as well with the same performance.", "437" ], [ "I&#39;m on the verge of giving up. I&#39;ve been stuck on this problem for weeks. I managed the headers, and I think I set up the loops right to write the pixels correctly. I just can&#39;t wrap my head around **fseek** however. I read the man page, and read stack exchange, but I just don&#39;t get it.\r\n\r\nCan anyone help me, why my code is failing to resize, and what direction should I progress? I&#39;m super frustrated with it.\r\n\r\n // Saving original width and height\r\n int oriwidth = bi.biWidth;\r\n int oriheight = bi.biHeight;\r\n \r\n // Modifying to new width and height\r\n bi.biWidth = bi.biWidth * n;\r\n bi.biHeight = bi.biHeight * n;\r\n \r\n // determine padding for scanlines\r\n int oripadding = (4 - (oriwidth * sizeof(RGBTRIPLE)) % 4) % 4;\r\n int padding = (4 - (bi.biWidth * sizeof(RGBTRIPLE)) % 4) % 4;\r\n \r\n // Modifying sizes\r\n bi.biSizeImage = ((bi.biWidth * abs(bi.biHeight)) * sizeof(RGBTRIPLE)) + (padding * abs(bi.biHeight));\r\n bf.bfSize = bi.biSizeImage + 54;\r\n \r\n // write outfile&#39;s BITMAPFILEHEADER \r\n fwrite( & bf, sizeof(BITMAPFILEHEADER), 1, outptr);\r\n\r\n // write outfile&#39;s BITMAPINFOHEADER\r\n fwrite( & bi, sizeof(BITMAPINFOHEADER), 1, outptr);\r\n\r\n\r\n // iterate over infile&#39;s scanlines\r\n for (int i = 0; i < abs(oriheight); i++)\r\n { \r\n \r\n // temporary storage\r\n RGBTRIPLE triple; \r\n \r\n for (int s = 0; s < n; s++)\r\n {\r\n \r\n fseek(inptr, 54 + ((i + 1) * oriwidth * (sizeof(triple) + oripadding)), SEEK_SET);\r\n \r\n // iterate over pixels in scanline\r\n for (int j = 0; j < oriwidth; j++)\r\n {\r\n\r\n // read RGB triple from infile\r\n fread( & triple, sizeof(RGBTRIPLE), 1, inptr);\r\n\r\n // write RGB triple to outfile\r\n for (int k = 0; k < n; k++)\r\n {\r\n fwrite( & triple, sizeof(RGBTRIPLE), 1, outptr);\r\n }\r\n }\r\n } \r\n // skip over padding, if any\r\n fseek(inptr, padding, SEEK_CUR);\r\n\r\n // then add it back (to demonstrate how)\r\n for (int k = 0; k < padding; k++)\r\n {\r\n fputc(0x00, outptr);\r\n }\r\n }", "682" ], [ "## Paladin Codes ##\r\n\r\nThis is the cause of a lot of arguments. Answers on a website will not resolve fundamental difficulties you are having with other players or a GM about disagreeing about what it means to be a Paladin.\r\n\r\nThat disclaimer aside, what most people think the paladin&#39;s code is, is not what&#39;s actually written in the PHB.\r\n\r\n > **Code of Conduct:** A paladin must be of lawful good alignment and loses all class abilities if she ever willingly commits an evil act. Additionally, a paladin&#39;s code requires that she respect legitimate authority, act with honor (not lying, not cheating, not using poison, and so forth), help those in need (provided they do not use the help for evil or chaotic ends), and punish those who harm or threaten innocents.\r\n\r\n > **Associates:** While she may adventure with characters of any good or neutral alignment, a paladin will never knowingly associate with evil characters, nor will she continue an association with someone who consistently offends her moral code. A paladin may accept only henchmen, followers, or cohorts who are lawful good.\r\n\r\n&#39;Act with honour&#39; is the only thing that might be considered to be breaking a paladin&#39;s code if they backstab a demon. But a demon is an elemental force of evil, it cannot choose right and good - saying that stabbing it in the back is dishonourable is at best an edge case - it&#39;s in no way clear cut. To &#39;betray&#39; a typical demon (there are printed Lawful Good demons, which is yet more evidence for the &#39;it depends; see your GM&#39; line of thinking) is like betraying a forest fire. At no point is it serving the cause of evil to do so.\r\n\r\nNote that &#39;not lying&#39;, &#39;not cheating&#39; etc are examples (NOTE THE BRACKETS), not direct commands. There are situations where the honourable course of action is a white lie, at least by most social standards. Or where cheating is honourable, such as in a game where cheating (as long as you don&#39;t get caught) is the expected mode.\r\n\r\nSo basically, all the people trying to use the code of conduct to straitjacket people playing paladins are actually wrong - the code doesn&#39;t say half of what they claim it does, and interpreting it to the strictest possible set of standards isn&#39;t RAW - it&#39;s a &#39;reading&#39; of the text that ignores both intent and phrasing.\r\n\r\n**And finally** - the Paladin code, as written, has been a source of strife, both by people hiding behind it to cause strife for their party and GMs maliciously enforcing it on players.\r\n\r\nNo GM worth their salt that I have ever met or played with has ever used it in any form. Instead, they&#39;ve simply used their human judgement to decide if the paladin has fallen or not, and it&#39;s generally pretty obvious.\r\n\r\nBad GMs trying to &#39;trick&#39; the paladin into falling because they think it&#39;s a cool story concept, but lack the GMing skills to actually tempt the character in any meaningful sense (by setting up things they want and then setting up situations where to get that thing the paladin is tempted to take the &#39;easy road&#39; to it, which is evil), are bad. If you or anyone else does that, they should not GM games of D & D until they learn not to - it&#39;s that simple.", "276" ], [ "## RAW ##\r\n\r\nRules-as-written, the spell makes you capable of breathing water, not oil.\r\n\r\n## RAI, Rule of Cool, Good GMing, Storytelling, Game logic, Happiness, Fun, Wiz Biz, Awesomeness, rewarding inventiveness, etc ##\r\n\r\nThere&#39;s pretty much no reason other than RAW to refuse to allow the Water Breathing spell to affect all liquids. Sure, water has oxygen in it gills la la but it&#39;s a magical spell and I don&#39;t expect wizards to understand that stuff. They&#39;d just make a spell that lets you breathe liquids.\r\n\r\nBasically, if a GM disallowed this at a group I was in, I wouldn&#39;t be back. If you&#39;re that invested in RAW and that not-invested in storytelling, it&#39;s a massive red flag, like the one that used to be over the kremlin. Just huge. There&#39;d be no point continuing to play that game, because fighting monsters for xp is a very small part of the fun of ttrpgs, and if someone is that invested in the rules and that not-invested in an interesting story, the vast majority of the fun is absolutely drained away.\r\n\r\n**But he&#39;s a full caster so you should enforce RAW on him as hard as possible!**\r\n\r\nThis attitude is really terrible and kills fun. All it forces a caster to do is use the laundry list of win spells to be horrifically powerful while perfectly RAW, instead of trying to use spells in interesting (weaker, invisibility is a 2nd level spell) ways, and be more like a storybook magic user than the dnd &#39;I stand in middle of party and kill everything with glitterdust&#39; wizard.", "271" ], [ "## Antimagic Field + Spells ##\r\n\r\n > An invisible barrier surrounds you and moves with you. The space within this barrier is impervious to most **magical effects**, including spells, spell-like abilities, and supernatural abilities. Likewise, it prevents the functioning of any magic items or spells within its confines.\r\n\r\n > An antimagic field **suppresses** any spell or magical effect **used within**, brought into, or cast into the area, but **does not dispel it**. Time spent within an antimagic field counts against the suppressed spell’s duration.\r\n\r\n > Summoned creatures of any type and incorporeal undead **wink out** if they enter an antimagic field. They **reappear in the same spot once the field goes away**.\r\n\r\nA lot of people think that Antimagic Field stops spells being cast inside it - this is actually untrue.\r\n\r\nWhat it actually does is suppress the effects and &#39;functioning&#39; of magic items and spells that are inside the area of the field - whether they were cast within it or cast outside and entered it.\r\n\r\nThe key part that is interpreted to mean that magic cannot be used at all inside an antimagic field is this - \r\n\r\n > The space within this barrier is impervious to most magical effects\r\n\r\nThis is read to mean that spells cannot be cast or have any effect inside the field, instead of being suppressed. However, a spell effect is not the spell itself - this is spelled out in the &#39;Magic&#39; chapter of the 3.5e PHB. Similarly, &#39;effect&#39; is used consistently throughout 3.5e to refer to the effects, often the continuing effect, of a spell or ability.\r\n\r\nErgo, the most logical reading under RAW is that while you can cast spells inside an antimagic field, the effects of those spells are suppressed. So you could, for example, cast Summon Monster and summon a monster *outside* the area of the antimagic field.\r\n\r\nOr cast Dispel Magic aimed at a person, magic item, or area outside the antimagic field (note that if the area overlapped with the antimagic field, the spell&#39;s ENTIRE effect would not work - not just the bit overlapping the field).\r\n\r\nAntimagic Field does not break line of effect under this reading of what &#39;impervious&#39; means in that context. Ergo, in the above example, someone outside the antimagic fields could aim a mordenkainen&#39;s disjunction at the prismatic sphere. Assuming the MDJ failed to shatter the AMF, though, the question becomes whether or not the prismatic sphere&#39;s &#39;stops all spells&#39; ability would interact with the fact that the MDJ&#39;s &#39;effect&#39; was suppressed by the AMF at the point the MDJ reached it. Would the MDJ&#39;s normal exception to the Prismatic Sphere&#39;s stop spells/effects effect, work while it was suppressed by the AMF (the point at which it makes contact)? Given the prismatic sphere stops the AMF at it&#39;s border, is there a moment where the MDJ stops being suppressed and then has it&#39;s effect of destroying the sphere?\r\n\r\nThat&#39;s purely a GM call at that point, as it&#39;s too much of an edge case.", "271" ], [ "## Nothing. ##\r\n\r\n > **Magic Fang, Greater**\r\n\r\n > [...]\r\n\r\n > Target: \tOne living creature\r\n\r\n > [...]\r\n\r\n > This spell functions like magic fang, except that the enhancement bonus on attack and damage rolls is +1 per four caster levels (maximum +5). \r\n\r\n > [...]\r\n\r\n > **Magic Fang**\r\n\r\n > Magic fang gives one natural weapon of the subject a +1 enhancement bonus on attack and damage rolls. The spell can affect a slam attack, fist, bite, or other natural weapon. (The spell does not change an unarmed strike’s damage from nonlethal damage to lethal damage.) \r\n\r\nIf you have a claw attack, and have *Greater Magic Fang* cast on you, giving your claw attack a +1 enhancement bonus to attack and damage per four caster levels, and then you lose that claw attack, you are still an eligible target (&#39;One living creature&#39;). If you later gain that claw attack (or, technically, any claw attack - as long as it&#39;s the same type of attack, and you&#39;re only providing GMF&#39;s bonus to one attack of that type (&#39;the attack&#39;), NONE of the wording on natural attacks ever differentiates one natural attack of the same &#39;type&#39; from another), according to the text of *Greater Magic Fang*, it would give your claw attack a +X to attack and damage. \r\n\r\nNothing about the spell&#39;s text changes from you gaining or losing a claw attack. It provides one natural attack of one specific type (claw, bite, wing buffet), that you have at the time of casting, with a bonus. If you gain, lose, transmogrify, grow, shrink, dip it in poison, none of that changes the wording of *Greater Magic Fang* in any way. It provides that bonus to the attack. If the attack doesn&#39;t exist, it provides a bonus to nothing, but as long as the attack does exist it provides it with a bonus.\r\n\r\nIt&#39;s worth noting also that you can&#39;t cast a spell on something which is not part of the &#39;Target&#39; entry of a spell. However, nothing stops you polymorphing a lawn chair into a zombie and then casting *undead torch* on it - the spell can only be cast on an undead target but, by RAW, does not stop functioning when the target changes. This gets houseruled at most tables without realizing it, but it&#39;s worth noting that &#39;spells not working anymore&#39; thing is, itself, a houserule rather than something that&#39;s actually existent in the game rules.\r\n\r\n**On a RAI note**\r\n\r\nIf a permanencied magic fang goes away when the wielder changes from his werewolf shape to his human shape, that negates the entire point of casting permanency in the first place. There&#39;s no indication that the authors felt that lycanthropes were too powerful and giving Dire Lions permanent magic fangs was okay but giving to werewolves was broken, or whatever.\r\n\r\nEven if a sorcerer or wizard regularly used polymorph to take the form of a troll to fight in melee, and wished to use *Permanency* and *Greater Magic Fang* to give his troll claws and bite an enhancement bonus when he was in that form, the designers wouldn&#39;t bat an eye. For a start, it&#39;s nowhere near optimal sorcerer/wizard play, and for a second, it&#39;s the entire point of GMF in the first place: making natural weapons stronger in higher level play.", "271" ], [ "## Yes, and that really isn&#39;t weird. ##\r\n\r\nA Half-Green Dragon Red Dragon is a dragon with a green dragon mummy and a red dragon daddy, aka, two dragon parents, just of different hues. A bit stronger than your average specimen (&#39;hybrid vigour&#39;), a bit tougher, a bit higher in CR, has two different breath weapons. Not objectionable in the slightest compared to a werehyena stone giant with grafted mohrg flesh, or a Half-Celestial Illithid.\r\n\r\nIt&#39;s possible to do stupid things with nearly any of the rules in the game. That&#39;s why human intelligence and judgement is meant to be applied to the game by the players.\r\n\r\nThat said, in a game which has literal wizards who do [random crossbreeding experiments][1] *all the time* because apparently magic makes you go mad and live in a tower, I can&#39;t really think of any weird combination that *shouldn&#39;t* come up in some recondite sense.\r\n\r\n[1]: _URL_0_\r\n\r\nYes, even half-mummy. Even Exalted Saint Salt Creature Half-Mummies. That guy.. he just lived a really, really, *really* interesting life.", "135" ], [ "Hm, something still seems to be off. I have removed the parentheses that you have suggested, and then somewhat rewrote the fseek line. It looks like this atm:\n fseek(inptr, 54 + (i * oriwidth * sizeof(triple)) + oripadding * i, SEEK_SET);\nIn my interpretation, this should: Skip over headers - > skip over i * lines (0 in the beginning) and skip over i* padding (0 in the beginning).\nI also relocated the for loop with the fputc in it, but somehting is still off. The image is at least the right color now, but it looks somewhat scrambled.", "773" ], [ "Well, first of all.\r\n\r\n## If you can&#39;t handle it, at all, stop asking her to games. ##\r\n\r\nThe nuclear option is to simply run games for people who *aren&#39;t this person*. This solves the problem.\r\n\r\nSecondly.\r\n\r\n## Ask people who are aware of stuff like this if they concur. ##\r\n\r\nNot everyone pays attention to interpersonal dynamics. Even if it involves them. If there are people in this group that you feel do pay attention, you could have a private word with them about it, to confirm that it&#39;s occurring (you are a fallible human - repeat that in front of the mirror 5 times daily and you&#39;ll live a better life), and to gain allies in dealing with it.\r\n\r\nThirdly.\r\n\r\n## This is a social dynamics situation - office politics, friendship drama, relationship issues, this falls into that paradigm. It&#39;s not unique to roleplaying. ##\r\n\r\nThis person wants a thing that is negatively affecting other people (you, potentially others) and is using manipulative techniques (accusing you of partisanship, requesting special considerations, getting angry, insulting or socially putting down others (negative comparisons to other GMs, etc)) to get that thing in the face of resistance.\r\n\r\nThat&#39;s the main problem. If this person was reasonable about it and not using socially manipulative methods to attempt to acquire it, you could just have a sit down and say &#39;maybe let other people talk more,&#39; instead of getting into half-hour arguments.\r\n\r\nThat the person is female, in a hobby that is male-dominated, is another red flag. The &#39;big fish small pond&#39; situation tends to apply to some people in that scenario - they tend to have social power of a sort because nerds both want to impress and don&#39;t want the &#39;rare female nerd&#39; to leave.\r\n\r\nFourthly, and finally,\r\n\r\n## Talk to this person outside the gaming setting first. ##\r\n\r\nBefore you start the whole talk to others, think about excluding this person, gather allies, plan campaign, subtly introduce storylines that play to this player&#39;s desires so they stop causing trouble, or whatever, just book a time to go chat to this person outside the group setting.\r\n\r\nLay out everything the way you did in the OP. Tell them this is making the game not fun for you. Tell them you had some expectations about the game - players only control one character, players share spotlight time, bad things happen to characters and then players have to escape from that in order to create excitement, the GM has the final say on rules and npc actions, etc. Say that perhaps they didn&#39;t understand those premises, or you didn&#39;t express them clearly, and ask if that person can agree with them.\r\n\r\nExplanation, admittance of fault (even if you don&#39;t feel you were/are at fault), request for agreement of some kind.\r\n\r\nIf that doesn&#39;t work, go on to the next steps, etc. But a lot of the time, simply treating things as a misunderstanding while emphasizing that it&#39;s actually important, will result in the problem being sorted out. Whether it was a misunderstanding in the first place or not.", "276" ], [ "**The answer is to stop thinking of it as superhero.**\r\n\r\nLet&#39;s look at the typical &#39;dnd&#39; campaign. Perhaps one published by Paizo Press. There are the following elements.\r\n\r\n1. A journey. The heroes traverse through various (sometimes fantastical) locations, always for reasons unrelated to simply &#39;traveling&#39;.\r\n\r\n2. Foes. Enemies who have their own goals, such as ending the world, or calling a horror, or resurrecting their dead family. Which, for whatever reason, the heroes must stop. Often due to harm from that cause to innocents, the &#39;means&#39;, the &#39;price&#39;, whatever.\r\n\r\n3. Allies. Forces that wish to stop these evils, often with their own theme, help they can give the heroes, and additionally quirks or things which make it hard for the heroes to simply join their cause - the brotherhood of pelor fights <PERSON>, but will not leave the riverlands to stop the ritual that will embody him - the Rohirrim will ride to Gondor, but they will not leave until the Uruk-Hai of Saruman have been defeated and <PERSON> is safe.\r\n\r\n4. Connections. Some of the enemies work together as groups, and some of the enemies are only enemies due to connections to those with reasons to actually combat the party. There are connections between the party&#39;s allies and enemies too - usually those of antipathy (hatred, enmity), but sympathy (alliance, friendship, blood relation) is not unheard of.\r\n\r\nSo what do you end up with? You end up with a spiderweb of groups, allies, enemies, single actors, double agents, etc, all interacting, and the party of adventurers smashing through them like a cannonball (or ricocheting through them like a pinball).\r\n\r\nDo that, but instead of &#39;wizards&#39; and &#39;fighters&#39; have people with superpowers (and it&#39;s not like they are unlike), and make some of the allies or enemies superpowered also.\r\n\r\nEnemies need motivations, short and long term goals, connections of various kinds, bases, resources, capabilities, ace in the holes, themes, styles, quirks, and in this setting, sweet outfits.\r\n\r\nThis is true of **any story**, ***anywhere***.\r\n\r\n[Worm][1] (caution, really long), is a good example of a superhero story with a realer world.\r\n\r\n\r\n [1]: _URL_0_", "138" ], [ "There&#39;s a whole system of adding CR with how you calculate it and whatnot, which is not just summing up the numbers, but it is important to note that **it is really dumb**.\r\n\r\nIn reality, the vast majority of competent GMs use CR as at-best a rough guide to relative monster power. Parties vary in strength, both in mechanics and in tactics, and will be stronger vs some encounters than others - additionally, elements like terrain, timing, ambush, how many spells the party has left, if the party has all their gear, etc, will vastly change the difficulty level of fights you throw at the party - additionally, sometimes you&#39;ll want to toss an easy fight at the party, to show that these low level <PERSON> family mooks are no big deal, or a hard fight to show the Brotherhood of the Eightfold Dragon is nothing to mess with.\r\n\r\nBasically, **eyeballing encounter strength** is a major GM skill.\r\n\r\nThe only way I can suggest to make it easier is to think about fights before you have them. Fights are relatively modular - the party can fight the <PERSON> goons in the bordello, or when they come to roust the PCs out of the inn they&#39;re staying at, or even at the <PERSON> hideout in the old nightclub near the docks. Wherever the fight happens, the capablities of the <PERSON> enforcers will be the same - you can consider the fight, how much hp they have vs how much damage the party generally does, how much damage the enforcers do vs how much AC and HP the party has, whether the enforcers will know to avoid clustering for area spells and if they have good saving throws, etc, and get a rough idea of how the fight will go, before the party even does that fight.\r\n\r\nThink each fight through before it happens. If it might happen in a way that will hurt the party, such as say in a room next to a bunch of reinforcements, or on a rope bridge over a lava river, consider that as well - remember, your job is largely avoiding auto-TPKs - if they party does something clever and makes the fight easier, that kind of creative thinking is not something you&#39;re seeking to avoid, but rather to enable.", "276" ], [ "> These items appear to be wrist or arm guards. They surround the wearer with an invisible but tangible field of force, granting him an armor bonus of +1 to +8, **just as though he were wearing armor**.\r\n\r\n & nbsp;\r\n\r\n > Target: \t**Armor** or shield touched\r\n\r\n > You imbue a suit of armor or a shield with an **enhancement bonus** of +1 per four caster levels (maximum +5 at 20th level).\r\n\r\n > **An outfit of regular clothing counts as armor that grants no AC bonus for the purpose of this spell.** \r\n\r\n1. This can be implied to work due to the &#39;just as though he were wearing armour&#39; clause of bracers of armour. If it works &#39;just as though wearing armour&#39;, there&#39;s no reason magic vestment shouldn&#39;t work.\r\n\r\n2. Even more simply, bracers are themselves part of a suit of armour. There&#39;s not really an argument that they are ineligible as targets for the spell themselves. If they can&#39;t be an eligible target for Magic Vestment, neither can a Breastplate.\r\n\r\n3. Finally, &#39;enhancement bonus to armour&#39; **explicitly stacks** with regular ol&#39; armour bonus. Casting Magic Vestment on your clothes? Will stack with bracers of armour. Bracers of armour do not grant an enhancement bonus to armour. They grant a normal armour bonus. Exactly the same as wearing armour. Just like the Mage Armour spell. Cast Magic Vestment on your clothes, wear bracers of armour, you get the benefit of both bonuses.\r\n\r\nYou can safely assume any GM that doesn&#39;t allow this is houseruling it rather than using any sort of RAW.\r\n\r\n---\r\n\r\n**Shields and Armour Class**\r\n\r\nYou are correct that a Monk&#39;s Belt is generally the path to maximum AC. However, you are incorrect that shields (animated or otherwise) factor in. An animated shield counts as carrying it - and disables the wisdom-adding effect of the Monk&#39;s Belt, as it works &#39;as a monk&#39;, and monks lose their AC bonus if wearing armour or **carrying a shield**.\r\n\r\nThat&#39;s not really a... big issue, though? Shield, the Sorcerer/Wizard spell, is easily wanded via UMD - it also lasts for minutes/level. There&#39;s also cleric spells that give a shield bonus. All of that said the absolute largest source of AC is Natural Armour. Which is granted by Alter Self, Polymorph, and any number of cleric spells (there&#39;s one with Tortoise in the name). Scintillating Scales will turn it into a Deflection bonus, which is largely better. Various spells will also increase Dex, from the humble Cat&#39;s Grace to regular ol&#39; Grace and Divine Agility (or some such) gives a +10.\r\n\r\nThere&#39;s also stuff like Recitation and so forth that give sacred bonuses to things. Sirine&#39;s Grace is a go-to, although somewhat difficult to cast for a cleric (only from scrolls, it&#39;s a large reason to play a bard actually).\r\n\r\n[Top 10 Divine Persistent Spells (By Level)][1] is a good starting point for buffs, although it&#39;s not exhaustive (as there are some good buffs that are not persistable). Have a read.\r\n\r\nYou can also stack various stats to AC. Getting wisdom four or five times to your AC is rather nice.\r\n [1]: _URL_0_", "825" ], [ "**The answer is already quoted.**\r\n\r\n > The warded creature is immune to the effects of one specified spell for every four levels you have. **The spells must be of 4th level or lower**. The warded creature effectively has unbeatable spell resistance regarding the specified spell or spells.\r\n\r\nIf I have a 5th level Fireball, it is ineligible for Spell Immunity.\r\n\r\nA regular 3rd or even 4th level Fireball will be stopped by it. But by the letter of the ability, the named spell **must** be 4th level or lower in order to be affected by Spell Immunity.\r\n\r\nSevenSidedDie&#39;s answer about &#39;checking for&#39; is not supported by the rules. If the text of the ability said &#39;the selected spell must be 4th level or lower&#39;, it would be unclear, and could be read either way - but it specifically states that the spells must be 4th level or lower - not to be chosen - but absolutely, to be stopped at all. In English, there is no other way to read the sentence.", "271" ], [ "**Generally, the rogue in question must jump through hoops of some kind or another in order to be able to use their sneak attack**.\r\n\r\nWithout flanking, there are few ways to sneak attack without absurd hoop jumping, and most of those are melee (feinting, etc). So you have rogues tossing grease at people, wasting their turn doing some skill trick or hiding, or taking some obscure set of feats or abilities designed around enabling ranged sneak attack, and notable/memorable solely because they do so.\r\n\r\nIn other words, &#39;does he become useless?&#39;.\r\n\r\nWell, yes. Without minmaxing, and optimizing, yes. The fact that people have come to accept this state of affairs and offer all sorts of workarounds doesn&#39;t change that the regular ranged rogue gets a very short schrift.\r\n\r\nEspecially in pathfinder with no backwards compatibility - most of the ways to ensure a ranged sneak attack are 3.5-only.", "600" ], [ "## Yes, you can, but not in that example. ##\r\n\r\nCharnel Touch is a Standard Action to activate - on that turn, you&#39;d already have spent your Standard Action casting Bestow Wounds, and therefore would be unable to activate Charnel Touch - even if you had two standard actions, the touch attack is part of activation, so normally you&#39;d cast Bestow Wounds, touch attack, then second standard action, charnel touch, touch attack.\r\n\r\n**However**.\r\n\r\n > **Touch Spells and Holding the Charge**: In most cases, if you don’t discharge a touch spell on the round you cast it, you can hold the charge (postpone the discharge of the spell) indefinitely. You can make touch attacks round after round. If you cast another spell, the touch spell dissipates. Some touch spells, such as teleport and water walk, allow you to touch multiple targets as part of the spell. You can’t hold the charge of such a spell; you must touch all targets of the spell in the same round that you finish casting the spell.\r\n\r\npp176 PHB, via [Giantitp \" ;Touch spells and Holding the charge?? Help pls \" ;][1]\r\n\r\nYou can hold a Touch spell&#39;s charge, in your hand, and discharge it whenever. If you were careful, you could even walk around in daily life with a touch spell in your hand, just waiting to shock your attacker.\r\n\r\nThere&#39;s a spell, **Spell Flower**, from Spell Compendium, that even allows you to hold touch spells in both hands.\r\n\r\nNote the wording of that rule, though. Casting another spell obviates the charge. That means you can&#39;t, for example, cast Shocking Grasp, hold the charge, and then run up to a guy and cast shocking grasp for DOUBLE ELECTRIC PALMS SNAKE KUNG FU STRIKE. But for Supernatural Abilities, like Charnel Touch, you&#39;re fine. You cast Bestow Wounds, hold the charge, then the next turn walk up and slap someone with charnel touch - they should suffer the effects of both effects.\r\n\r\n [1]: _URL_0_", "600" ], [ "@MatthieuM. - You&#39;re incorrect by RAW. An enhancement bonus to armour class applies to the wearer of any item providing that bonus - it doesn&#39;t stack with other enhancement bonuses, but does do so with several other listed bonuses. The &#39;clothes&#39; themselves are a worn item - they do not have their own AC, except as modified by size for purposes of a <PERSON> attempt. As the spell says to &#39;treat them as armour with a bonus of +0&#39;, they can&#39;t even be Sundered - the <PERSON> rules have an exception for armour.", "825" ], [ "<PERSON> (<PERSON> is an epic leveled character pretending to be a nearly-epic assassin - not exactly the best material to try to copy in 3.5/PF) is a decent assassin but his true power comes when he learns to use magic - power that absolutely dwarfs his previous abilities.\r\n\r\nGiven his various feats in the books, probably the closest you&#39;re going to come to his abilities as a PF character is a single level in rogue (or better, Unchained rogue), largely to get the skills, and then after that levels in Wizard or Sorcerer. The Arcane spell list has all the things he uses (invisibility, spider climbing, dispel magic, strength/dex buffs, teleportation you can fluff as room-crossing backflips, alter self/disguise self etc), and trying to mix in too much rogue will delay the spell progression so much as to be useless at any level where such tricks could be impressive - because keep in mind, <PERSON> seems so cool partially because in his world, his tricks are extremely impressive to those around him - if you&#39;re lagging behind ECL in PF when those tricks come online, it&#39;s not impressive to anyone.\r\n\r\nAnother possible way to represent <PERSON> would be to use the Synthesist archetype of the Summoner class. It grants a bunch of bonuses to physical action while synthed that could be fluffed as the Night Angel form, and offers a decent set of spells on it&#39;s list for being the Night Angel.\r\n\r\nA third option would be to play a Vivisectionist alchemist. Sneak attack progression, poison use, and spells via extracts such as invisibility, alter form, etc. The <PERSON> changes could be the Night Angel form, in this case.\r\n\r\nBoth the Synthesist Summoner and <PERSON> magic are not as impressive as the Wizard or Sorcerer, making that key part of <PERSON> - when he powers up and becomes a wetboy/the Night Angel - less impactful overall, but could work in a game without tier-1 casters.\r\n\r\nA very carefully built <PERSON> might be able to pull off <PERSON>, but it would be somewhat hard to sell, as while <PERSON> gets the whole &#39;good at swordfighting&#39; aspect of <PERSON>, it lags hard on the &#39;good at stealth/disguise/poisons&#39; and &#39;amazing magic&#39; facets.", "51" ], [ "## Whether it&#39;s &#39;okay&#39; largely depends on your players. ##\r\n\r\nThe GM makes the rules at the table, but does so through consent of the players in the group. The nuclear option, &#39;leaving the group&#39;, is generally on the table though generally it doesn&#39;t get employed - people have subtler ways of expressing dissatisfaction, and even in extremis, most people get the message.\r\n\r\nIf your players are okay with you banning all high tier classes (nothing you are describing is outside the realm of possibility of a sorcerer, a favoured soul, a psion, or even a well-built tier 3 character), then it&#39;s &#39;okay&#39;. If they&#39;re not, it&#39;s varying degrees of &#39;not okay&#39;.\r\n\r\n## To solve the larger problem, though. ##\r\n\r\nYour issue is not restricted to if it&#39;s &#39;okay&#39; to ban classes, it&#39;s a dissatisfaction with the playstyle of at least **3** of your players. They clearly want to play powerful characters, and have optimized towards that goal, albeit not with great skill(cleric using righteous might, wizard not knowing his spells/not having condensed his spell list into efficient murder, druid not having preferred forms etc). They want, as many players/GMs do, to play high fantasy where characters are powerful and magical.\r\n\r\n**You clearly do not want to play this style of game.** From this question, I would infer, although not with certainty, that you wish to play a *grittier* genre of fantasy, known as &#39;low&#39; fantasy or &#39;historically realistic&#39;, such as the default setting for ADND and DND 2e.\r\n\r\nFor this reason or others, you also have trouble challenging high-fantasy characters when GMing.\r\n\r\nThe answer to this question is therefore more: **Whether it is &#39;okay&#39; or not depends on whether you feel comfortable forcing others to play the genre of game you want to play, rather than the one they want to play.**\r\n\r\nPostscript: I&#39;ll stress that this isn&#39;t a black and white question - if you have a strong preference and their preference is marginal or ambivalent, it might be perfectly reasonable to enforce a specific kind of game where you will have fun rather than not having fun. Equally, it might be unreasonable to demand that people do something they don&#39;t wish to purely because of your preference.\r\n\r\nI&#39;d additionally suggest that you ask another question on this site related to challenging high-tier parties if you have difficulty creating fights that cause them to be able to use their abilities to the fullest.\r\n\r\nAlso: [Tier-1 Monk][1].\r\n\r\n\r\n [1]: _URL_0_", "276" ], [ "The [Multi-Weapon Fighting Feat][1], has the answers you need.\r\n------------------------------\r\n\r\n > Prerequisites: Dex 13, three or more hands.\r\n\r\n > Benefit: Penalties for fighting with multiple weapons are reduced by –2 with the primary hand and by –6 with off hands.\r\n\r\n > Normal: A creature without this feat takes a –6 penalty on attacks made with its primary hand and a –10 penalty on attacks made with all of its off hands. (It has one primary hand, and all the others are off hands.) See Two-Weapon Fighting.\r\n\r\n > Special: This feat replaces the Two-Weapon Fighting feat for creatures with more than two arms.\r\n\r\nThe &#39;normal&#39; entry is the only place in the SRD that I can find where fighting with more than two hands and more than two weapons is covered. The [Two-Weapon Fighting][2] entry in the Combat section is short and refers only to wielding two weapons at once.\r\n\r\nExtra attacks from **BAB** are not the same as extra attacks that you get from wielding a second (or third) weapon. Those apply even if you are multi-wielding (ergo, a 7th level fighter with 4 arms wielding four shortswords with the Multi-Weapon Fighting feat would have 5 attacks - 4 from multi-wielding, calculated using a base attack bonus of 7, and then another from high-BAB, on his primary hand, calculated using a base attack bonus of 2 (7 - 5)).\r\n\r\nNotably, the eidolon&#39;s limitation on **natural** attacks by RAW does not apply to manufactured weapons, and natural weapons can be used as &#39;secondary natural attacks&#39; (-5 to hit, 1/2 str bonus to damage) even if your main attack routine is with a manufactured weapon.\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "600" ], [ "## You are looking for Contingent Spell. ##\r\n\r\nIt comes in both a [feat][1] (CArcane) form and a [spell][2] form.\r\n\r\n > You can place another spell upon your person so that it comes into effect under some condition you dictate when casting contingency. The contingency spell and the companion spell are cast at the same time. The 10-minute casting time is the minimum total for both castings; if the companion spell has a casting time longer than 10 minutes, use that instead. \r\n\r\n(phb Magic chapter, &#39;Contingency&#39; spell)\r\n\r\n**Revivify** from the Spell Compendium is probably the ideal target. The affected doesn&#39;t lose a level from being revived. A second Contingency (only the Feat can make multiple Contingencies at once), with **Heal**, would bring him back to full health.\r\n\r\nAlternatively, a Delay Spell&#39;d (CArcane) Revivify could be your ticket. Especially if it&#39;s cast using Cloaked Casting (CMage) to disguise what spell has been cast. A psicrown containing **Anticipatory Strike** (CPsi) (GM can explicitly design custom psycrowns), could allow a cleric to cast a delayed revivification as an immediate action right before the last blow is struck.\r\n\r\n\r\nAlternatively, a custom magic item\r\n----------------------------------\r\n\r\nA custom wondrous item of Revivify, costing about 1,000gp, that is exhausted when used and is triggered by the wearer&#39;s death. It&#39;s a custom magic item, but the DM is explicitly allowed to make those, and 1,000gp is about right for a [single-use][3] [use-activated][4] item of a 5th level spell. Add a second effect (+150% cost of that effect) of *Heal* to the item, making it cost around 2500gp all up.\r\n\r\nMake it only work for clerics of that god.\r\n\r\n > *Item Requires Specific Class or Alignment to Use*\r\n\r\n > Even more restrictive than requiring a skill, this limitation cuts the cost by 30%.\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_2_\r\n [3]: _URL_3_\r\n [4]: _URL_0_", "796" ], [ "Yep.\r\n----\r\n\r\n > The subject’s outline appears blurred, shifting and wavering. This distortion grants the subject concealment (20% miss chance). \r\n\r\n-\r\n\r\n > Several illusory duplicates of **you** \r\n\r\n > When you and the mirror image separate, observers **can’t use vision or hearing to tell which one is you and which the image**. \r\n\r\n > The figments mimic your actions, pretending to cast spells when you cast a spell, **drink potions when you drink a potion, levitate when you levitate, and so on.**\r\n\r\nBoth RAW and RAI seem to support the idea that your mirrored images would also be blurred, and enemies attacking them would have to roll any miss chances in order to hit them. They aren&#39;t separate creatures, they are a spell effect that copies anything you do visually. So displacement, etc, would also function for your mirrored images.", "271" ], [ "There&#39;s not a universal standard for this. The precedents that the core Themes are setting are incidental to rebuilding and innovating. They are not by design.\r\n\r\nThey define font families for the Editor in the back end to establish a consistent feeling for content.\r\n\r\nSource: _URL_1_\r\n\r\nWithin the actual main styling of the Theme, there are 37 font family definitions.\r\n\r\nThey implement Normalize, font icons, then they begin setting baseline font families for edge case content. This happens at the beginning of their typography section.\r\n\r\nEdge case styling is important because plugins and user modifications may bring content outside of the expected scope you were styling within, and thus causing inconsistent styling. By setting defaults outside of the normal scopes you can ensure a baseline of consistency.\r\n\r\nSome font family specifications are there because of browser hinderances.\r\nLike here: _URL_0_\r\n\r\nThose specific rules won&#39;t be cross browser compatible unless they are overly verbose.\r\n\r\nThat&#39;s done in many areas.\r\n\r\nIn addition to all of the above, the core Theme developer still has to combat default WordPress core styling. Themes have a requirement around using certain classes and supporting certain class styling, so they need to add styling for that stuff as well.\r\n\r\nAt the end of the day, they through it where they thought they needed it, and some of it might be extraneous and that&#39;s entirely acceptable.", "681" ], [ "Ok, first I&#39;d ditch the output buffering.\r\n\r\nSecond change:\r\n\r\n include(TEMPLATEPATH.&#39;/wp-content/themes/grainandmortar/inc_static/test.php&#39;);\r\n\r\nTo\r\n\r\n include( get_stylesheet_directory() . &#39;/inc_static/test.php&#39;);\r\n\r\nFinally,\r\n\r\nReading the documentation here: _URL_0_\r\n\r\nYou need to return something, if your test.php doesn&#39;t output something in a returnable fashion, you&#39;re going to have a bad time.\r\n\r\nSo make sure that **test.php** does something along the lines of:\r\n\r\n $output = \" ;STUFF \" ;; // a variable you could return after include.\r\n // or\r\n function test() {\r\n // do stuff\r\n return $stuff; // a function that returns a value that you can call after include.\r\n }\r\n\r\nThen after you include your **test.php** file -- you just return `$output` or do something like `return test();`.", "132" ], [ "**cracks knuckles**\r\n\r\nAlright -- so first thing is first.\r\n\r\n# Working w/ WordPress Databases\r\n\r\n 1. Read this: _URL_0_\r\n 2. Avoid write SQL statements outside of the $wpdb object.\r\n\r\nAvoid writing SQL statements like `wp_users` instead do this:\r\n\r\n $users = $wpdb- > get_results( \" ;SELECT FROM $wpdb- > users \" ; );\r\n\r\nThis will help if you ever change the database prefix.\r\n\r\n# Doing this outside of WPDB\r\n\r\nYour pseudo code could read like this:\r\n\r\nGET POSTS > GET EACH POSTS CATEGORIES > GET EACH POSTS META FIELD NAMED X.\r\n\r\nLet&#39;s store all the things in something called ... `$all_the_things = array();`\r\n\r\nGetting posts: \r\n\r\n < ?php\r\n $arguments = array(\r\n \t&#39;posts_per_page&#39; = > -1, // This is a bad idea if you run this on trafficked pages. \r\n \t&#39;post_type&#39; = > array(&#39;product&#39;, &#39;product_variation&#39;),\r\n \t &#39;post_status&#39; = > &#39;publish&#39;\r\n );\r\n $query = WP_Query( $arguments );\r\n ? > \r\n\r\nNow you need to loop:\r\n\r\n < ?php\r\n while( $query- > have_posts() ) {\r\n $categories = get_the_category();\r\n $price = get_post_meta( get_the_ID(), &#39;_price&#39; ); ? > \r\n $stock = get_post_meta( get_the_ID(), &#39;_stock&#39; ); ? > \r\n $all_the_things[get_the_ID()] = array($categories, $price, $stock);\r\n }\r\n ? > \r\n\r\n----\r\n\r\nNow if you want... I can do this within SQL -- but it&#39;s not ideal. You cannot bank on the database structure staying the exact same, or that filters that should be ran being executed on data and so on. Things can get complicated.\r\n\r\nLet me know how this works out and I can provide more detail if needed.", "226" ], [ "## Yes and No ##\r\n\r\nWhile it is legally fine in most countries, even the copyright-paranoid US, to quote parts of copyrighted products under fair use, a significant number of long-term high-volume users of the site are, and feel the need to be seen to be as, staunchly \" ;anti-pirate \" ;. Which is defined as going above and beyond copyright law in order to remove or discourage anything which could remotely be seen as reproducing copyrighted content in any form.\r\n\r\nFurther, there is both a culture of rpg designer/publishers being extreme about copyright issues, fostered in part by WotC, the publisher of DnD&#39;s multiple takedown notices, threats of legal action, etc, and a culture amongst rpg players above the norm of fearing illegal action and wishing to be seen as law-abiding in every possible way, that I have no real explanation for but have witnessed due to long association. The actions of the long-term users may be founded in these two cultural aspects.\r\n\r\nThis makes answering some questions significantly harder, and is likely to result in less quality of answer to the site, but the firmness with which these views are held by these users, some of whom are moderators, others of which post answers or questions on a nearly daily basis, means that attempts to change this status quo are unlikely to result in anything but strife and argument.\r\n\r\nAs a result, rules quotes in answers will be looked on unfavourably, deleted, or otherwise disincentivized, unless they are extremely minimalist. This will result in some rpg questions not being answered in a satisfactory way, but as long as these users hold these opinions, their degree of involvement in the site will give them the ability to enforce them.\r\n\r\nSince I believe the likelihood of them changing their opinions as regards reproducing rules in answers is low, the answer to your question can be summed up as so: **While neither the site rules, the law, or the previous meta questions forbid you from reproducing relevant sections of copyrighted products in order to answer questions about that copyrighted product, in practice, reproducing relevant sections beyond a certain length (a few sentences) or beyond what some individuals consider the most directly relevant rules (no way to predict what will come under this) will likely lead to your answer being deleted and/or mods or other individuals posting to censure both you and others thinking of writing an answer with content they believe is &#39;too much&#39;.**", "609" ], [ "## Sure, but it&#39;s weird. ##\r\n\r\nEidolons have *base forms* - their base set of stats and starting evolutions. You can&#39;t, without fiat or class options I am unaware of, trade out those evolutions.\r\n\r\nSo you can totally have a sword-shaped eidolon, but it&#39;s Medium size (aka the size of a person) and has arms and legs and fangs and stuff. Note that it doesn&#39;t need to necessarily have obvious eyes or anything - it simply must have the evolutions listed on it&#39;s base form. It&#39;s arms or legs could &#39;fold&#39; into it&#39;s body, and it could use disguise to appear like a normal (or magical) Huge-sized greatsword or something, but to function as limbs and use it&#39;s natural attacks, they do need to be.. identifiable as such.\r\n\r\nUsing something that isn&#39;t a listed weapon as a weapon follows the Improvised Weapon rules, nearly always. Improvised weapons are not particularly good weapons. However, [Catch Off-Guard][1] and [Improved Catch Off-Guard][2] (3P), improve improvised weapon use considerably - mostly, though, for rogues. At the very least, if you&#39;re taking this path, you can eliminate the -4 penalty.\r\n\r\nThe simplest solution to wanting to do this is, as always, houserules. Your GM can rule that you can summon the sword, and it can just function as a sword (say with a scaling enhancement bonus like the Bladebound Magus&#39; Black Blade), or that it functions as a sword until it wants to act on it&#39;s own and make natural attacks, or even allow it to make natural attacks using sword damage alongside your attack routine. I will **heavily stress** that this is **not more powerful** than the standard summoner, since it involves the summoner going into melee (a place summoners typically don&#39;t want to go into) and eidolons are already extremely powerful. Even the &#39;natural attacks + summoner&#39;s attacks, using the sword&#39; option isn&#39;t more powerful, as it means there&#39;s a chance the summoner himself could die.\r\n\r\nIf you want to stay within the rules as written, I hesitate to bring it up, but the Synthesist Summoner could be what you&#39;re looking for. It&#39;s a Summoner who wears their summoned eidolon like a suit, becoming a monster when they summon it. If your eidolon is just a sword(or, a copy of you holding a sword), and summoning it just grants you power and skill beyond your norm, you would look like you holding a sword when you summon (&#39;synthesise&#39;) the eidolon. Yet have the strength, speed, slam attacks or whatever that the eidolon has.\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "825" ], [ "**4. Forever contain both DNAs**\r\n\r\nYes, the donor kidney still has (and will remain to have) the donor&#39;s DNA. That is irrelevant to the acceptance and continued functioning of the organ, though.\r\n\r\nThe thing that could make an organ transplant fail is the recipient&#39;s immune system. If it detects the organ as \" ;alien \" ;, it will attack it like any other foreign particle, and the body will reject the transplant.\r\n\r\nTo avoid this, two things are being done:\r\n\r\n- A donor is sought whose organs have similar *protein markers* to those of the recipient. (Those markers, and not the DNA, are what the immune system looks for when trying to tell friend and foe apart. DNA is *inside* the cell, the protein markers are on the *outside*.)\r\n\r\n Similar protein markers are usually found in people with *similar* DNA, which is why close relatives are tested for this kind of compatibility first.\r\n\r\n- The recipient recieves special drugs that partially suppress the immune system.\r\n\r\nIf the recipient&#39;s body does *not* reject the organ, it can continue to function normally despite its different DNA. If, for example, there is a genetic defect in there that will lead to some kidney-related issues at a later time, it will be the *donor&#39;s* defect. If there has been a defect in the *recipients* kidneys that *would* have led to issues later in his life, that defect would be gone with his kidney. Other cells in his body would still carry the same defect, but those cells are not kidney cells, and thus that particular issue will not manifest itself.\r\n\r\nReplication of cells will follow the same pattern: Cells from the recipient will replicate the recipient&#39;s DNA, cells from the donor&#39;s organ will replicate the donor&#39;s DNA.", "179" ], [ "In case this question was inspired by any novel / movie depiction of \" ;his DNA was changed \" ; and suddenly a person undergoing significant changes in appearance, capability, and / or personality (as in e.g. Star Trek or similar franchises), those are (largely) unscientific. Of course a donor organ *could* produce a very different mix of hormones, by- and waste products, with all the effects that could have -- but any \" ;change \" ; would be slow, gradual, and basically indistinguishable from naturally occurring changes in a person. With the exception that, without a donor, the recipient would be dead.", "515" ], [ "You don&#39;t smell carbon monoxide in cigarette smoke. It&#39;s odorless. (And not exactly the part of cigarette smoke I would be worried about.)\r\n\r\nYou smell the *other* components of cigarette smoke. Which are *not* odorless.\r\n\r\nHolding your breath and getting out of the smoke seems the way to go. Even better would be **ex**haling, then holding your breath until you are clear.[1]\r\n\r\nCarbon monoxide, as well as other components of cigarette smoke like nicotine, are very good at getting into your blood stream quickly. Plus, when at rest, we inhale / exhale at only a fraction of our lung capacity. By (deeply) **in**haling (your alternative course of action), you would just get *more* of the smoke into your lungs than you already have.\r\n\r\n---\r\n\r\n[1]: The trick with holding your breath is of course that, if you run out of breath while still in the middle of the smoke, you can&#39;t *help* but inhaling deeply...", "916" ], [ "@Viv: What do you think I should respond? CO is odorless, I said so myself. Exhaling won&#39;t remove any CO already in your blood, that&#39;s true as well. But exhaling will remove (most of) the smoke still *in* your lungs. Besides, the generic advice would be a) a single lungfull of cigarette smoke won&#39;t kill you, and b) don&#39;t go where there is cigarette smoke if you are so worried...?!? Or is there a different, unspoken question underneath all this?", "916" ], [ "@Viv: As I said, exhaling is for getting rid of what&#39;s in your lungs, not yet in your bloodstream. *Not* exhaling gives those molecules *more* time to cross over into your bloodstream, while at the same time lengthening the time until you *need* to *inhale* again, so it&#39;s a situational trade-off. Since you can&#39;t do an ad-hoc chemical scrubbing of your blood, exhaling while getting into fresh air is your best bet.", "916" ], [ "Can anyone give me a hint?\r\n\r\nI&#39;m doing Pset5, and I can&#39;t seem to come up with an answer for \" ;Why do you think we pass before and after by reference (instead of by value) to calculate, even though we’re not changing their contents? \" ; in questions.txt (question 3.).\r\n\r\nThe calculate function is always used as it&#39;s return value is assigned to a variable. So there should be no problem by passing it by value. So then why pass by reference?\r\n\r\nEdit: Wait. Is it only because it takes less steps? Meaning you don&#39;t have to pass a copy but directly doing the calculations via the adresses?", "9" ], [ "Well. Pset5 is a pain so far, but I&#39;m a masochist so no problem there.\r\n\r\nI think my logic is okay, but I have a problem with naming my nodes. I can&#39;t seem to come up with a way to name my nodes differently. This may seem blurry, but let me paste in part of my code for better understanding:\r\n\r\n // iterates through the dictionary\r\n for (int s = fgetc(dic); s != EOF; s = fgetc(dic))\r\n {\r\n \r\n if (s != &#39;\\n&#39; & & reset == 0)\r\n {\r\n s = s - &#39;a&#39;;\r\n \r\n if (root - > path[s] == NULL)\r\n {\r\n node* node1 = malloc(sizeof(node));\r\n root - > path[s] = node1;\r\n }\r\n \r\n reset++;\r\n }\r\n else if (s != &#39;\\n&#39; & & reset > 0)\r\n {\r\n s = s - &#39;a&#39;;\r\n \r\n if (node1 - > path[s] == NULL)\r\n {\r\n node* node2 = malloc(sizeof(node));\r\n node1 - > path[s] = node2;\r\n }\r\n \r\n reset++;\r\n }\r\n else\r\n {\r\n // currentnode - > is_word = true;\r\n reset = 0;\r\n }\r\n\r\n }\r\n\r\n**Logic of this according to me**\r\n\r\nSo what I&#39;m trying to do there is the following:\r\n\r\n 1. I&#39;m trying to get every word from the dictionary character by character, thus iterating through the whole file.\r\n\r\n 2. If the character is the first character of a word, then I check if in my root node that pointer &#39;space&#39; in the array is NULL. If it is, I malloc a new node, and put a pointer to it from the root node.\r\n\r\n 3. If the character isn&#39;t the first char, then I check the same thing, except this time not with the root node, but rather the next node (node1). **and here I think is where the problem lies**\r\n\r\n 4. If the character being read by fgetc is newline, then I reset my counter, so I know a new word is coming, and indicate, that a word has ended (I know I need to refine this).\r\n\r\nIn summary: I have no idea how I could increase the nodecount (so afetr node1 comes a node 2, a node3 etc..)\r\n\r\nAny ideas or hints? I think I smell that my logic is faulty in some way, but can&#39;t seem to see how.\r\n\r\nEdit: Edited a bit cause I modified some var names.", "959" ], [ "Thank you once again @Cliff B! I hope you don&#39;t mind if I leave this thread a bit open still, until I implement the changes you suggested, and try to figure out what you implied.\nThese pset truly are fun, and the more challenging they are, the more satisfaction they bring!\n\\n being part of the string is news to me. I thought first comes the \\0, and then \\n indicates, that \" ;by the way, the line is over too \" ;.", "50" ], [ "Alright, making progress. Fixed the loop,fixed the end of strings thing (now it should correctly read up until \\n) and noticed a major bug with my pointers.\nNow load() and check() are returning misspelled words correctly, however compared to the staff&#39;s implementation, it seems they output more misspelled words than I do. Gonna look into that next!", "56" ], [ "However many people you damage with the [Force] spell.\r\n------------------------------------------------------\r\n\r\n > **If the target takes damage, fails its saving throw, or is moved by your force spell, make a trip check against the target, using your caster level plus your casting ability score bonus**\r\n\r\nThis is the only relevant rules text. If you have a spell with the [Force] descriptor, and the Toppling Spell metamagic applied to it, and you cast that spell, any target that takes damage, that fails a saving throw, or that is moved (a defined rules term) by the spell, is the target of a trip attempt.\r\n\r\nIt doesn&#39;t matter whether you damage them via missiles or lasers or emanations or using Havoc of the Society. It doesn&#39;t matter whether they are making saving throws against mind control, sneezes, falling over, being entangled, whatever. It doesn&#39;t matter if you&#39;re moving them with a [Force][Teleportation] spell or with Bigby&#39;s Bullrushing Hand or whatever. If the triggering conditions are met, you make **a** (aka, a single) trip attempt using different modifiers than the normal trip attempt uses.\r\n\r\nIt doesn&#39;t matter how many times you damage, or how many saves they fail, or whatever. All the effect requires is a single instance of any of those things, caused by a force spell, and then it makes a single trip attempt. There is no point at which multiple trip attempts would be made unless there are multiple targets, by the wording of the ability (if the target [..] by your force spell [...] make **a** trip attempt) and the usage of the &#39;or&#39; list.", "271" ], [ "Aaaaand it works! Compared to the staff&#39;s implementation at least, I got all words. Wow... messed around hours with the return true and return false statements.\nI can hardly believe it works. To be honest, I still don&#39;t understand why one of the return falses was needed at the end of check(), but hey! It works. Once again, many thanks <PERSON>! Your advices were just enough to get me on the right path!", "134" ], [ "Note that wherever possible WoD writers in general have worked to develop an air of mystique about their products. And that writing &#39;mystical&#39; literature while in or through a &#39;trance&#39; or &#39;haze&#39;, often drug-induced, is an extremely common trope amongst certain historical writers that are a large part of the inspirations for world of darkness. Ergo there&#39;s significant support for it being an in-joke.", "96" ], [ "I have a 4.3.2 kernel and OpenRC 0.19.1. After the kernel loads there is no messages from the RC scripts. And then, there is the prompt to log in.\r\n\r\nThere is another system with identical `rc.conf` and it boots with RC messages in place, so I presume this isn’t an openrc issue, and rather, an issue with console&#160;– I’ve read that the same thing may happen if the kernel has a serial console set as primary. But there is no `CONFIG_*` parameter having ‘serial’ that is set:\r\n\r\n # zgrep -i &#39;^config.*serial&#39; /proc/config.gz\r\n #\r\n\r\n`CONFIG_*` parameters that have ‘console’ differ only by `CONFIG_VT_CONSOLE_SLEEP=y` that is present only on the machine that doesn’t show RC messages.\r\n\r\nThere is no `console=` parameter passed via kernel command line:\r\n\r\n # cat /proc/cmdline\r\n BOOT_IMAGE=/vmlinuz-4.3.2 root=LABEL=p_root rootflags=data=journal,errors=remount-ro,barrier=1 elevator=bfq acpi_osi=Linux\r\n\r\nAnd there’s no other tty than tty0 in dmesg.\r\n\r\n # dmesg | grep -i tty\r\n [ 0.000000] console [tty0] enabled\r\n #\r\n\r\nHere’s my rc.conf:\r\n\r\n # grep ^[^#] /etc/rc.conf\r\n rc_parallel= \" ;YES \" ;\r\n rc_interactive= \" ;NO \" ;\r\n rc_shell=/sbin/sulogin\r\n rc_depend_strict= \" ;NO \" ;\r\n rc_hotplug= \" ;* \" ; # !net.*\r\n rc_logger= \" ;YES \" ;\r\n rc_log_path= \" ;/var/log/rc.log \" ;\r\n unicode= \" ;YES \" ;\r\n rc_tty_number=12\r\n\r\nAnother thing probably worth mentioning is that there’s no output on tty12, where the copy of the messages should go. Neither at the RC boot time, not after it. But /var/log/rc.log does exist and has all the messages.\r\n\r\n/etc/inittab files are also identical on both machines. I don’t remember ever editing that file, but here’s its contents, just in case:\r\n\r\n # grep ^[^#] /etc/inittab\r\n id:3:initdefault:\r\n si<IP_ADDRESS>sysinit:/sbin/rc sysinit\r\n rc<IP_ADDRESS>bootwait:/sbin/rc boot\r\n l0:0:wait:/sbin/rc shutdown \r\n l0s:0:wait:/sbin/halt -dhp\r\n l1:1:wait:/sbin/rc single\r\n l2:2:wait:/sbin/rc nonetwork\r\n l3:3:wait:/sbin/rc default\r\n l4:4:wait:/sbin/rc default\r\n l5:5:wait:/sbin/rc default\r\n l6:6:wait:/sbin/rc reboot\r\n l6r:6:wait:/sbin/reboot -dk\r\n su0:S:wait:/sbin/rc single\r\n su1:S:wait:/sbin/sulogin\r\n c1:12345:respawn:/sbin/agetty 38400 tty1 linux\r\n c2:2345:respawn:/sbin/agetty 38400 tty2 linux\r\n c3:2345:respawn:/sbin/agetty 38400 tty3 linux\r\n c4:2345:respawn:/sbin/agetty 38400 tty4 linux\r\n c5:2345:respawn:/sbin/agetty 38400 tty5 linux\r\n c6:2345:respawn:/sbin/agetty 38400 tty6 linux\r\n ca:12345:ctrlaltdel:/sbin/shutdown -r now\r\n x:a:once:/etc/X11/_URL_0_\r\n\r\n---\r\n\r\nUpdate:\r\n\r\nTo @MarkWagner.\r\n\r\n # tty\r\n /dev/tty1\r\n # /etc/init.d/hostname status\r\n * status: started", "1008" ], [ "To output both stdout and stderr from a script to the console and to a log file, I’ve found a beautiful solution with tee:\r\n\r\n exec & > > (tee log.file)\r\n\r\nThe problem is, that sometimes tee seems to be eating newlines. For example, I have a trap on exit that prints a newline and only then exits.\r\n\r\n trap \" ;echo & & exit 55 \" ; EXIT HUP INT QUIT KILL\r\n\r\nIt makes the shell print the prompt from the new line instead of wherever user might have pressed `^C` while the script was running. And it doesn’t work, when there’s such a call to exec.", "227" ], [ "## RAW ##\r\n\r\n > When you make a melee attack with one or more melee weapons (including a standard attack, full attack, or even a strike maneuver), you can make an additional attack at your highest attack bonus. This attack is an unarmed attack that deals damage equal to your base unarmed attack damage + 1/2 your Str bonus. (*Tome of Battle* 32)\r\n\r\n-\r\n > Using a special ability is usually a standard action, but whether it is a standard action, a full-round action, or not an action at all is defined by the ability. (PHB 142)\r\n\r\n-\r\n > You can try to trip an opponent **as** an unarmed melee attack. (PHB 158)\r\n\r\nSo now I have proved that Trip is/can be performed instead of an unarmed melee attack.\r\n\r\n**Snap Kick** gives you an unarmed melee attack. The amount damage it does is irrelevant. The specific rules of Trip trump the general rules of how Snap Kick works, when you are using your unarmed melee attack from Snap Kick to perform a Trip. The general case of Snap Kick, performing an unarmed melee strike for X damage, is superseded by the specific case of <PERSON> (rolling a str check against dex or str to impose the Prone condition on a foe).\r\n\r\nThis rule, specific trumps general, applies to RAW in any situation in DnD rules where one rule is more specific to the situation than another. **It can be assumed that the general case of Snap Kick is the rules under the Snap Kick feat in ToB - and that the Trip rules in the PHB are more specific in the instance of using the Trip special attack as an unarmed attack, even if the attack comes from using the Snap Kick feat (or any other feat, for that matter).**\r\n\r\nIt&#39;s worth noting that the rules for &#39;attacks&#39; on p153 of the PHB indicate that attacks do damage, and note the amount. If you read Trip as being inapplicable to attacks with rules stating they do damage, Trip cannot be used with any attack in the game, or at all. This is clearly ridiculous, and is ancillary evidence that my reading of RAW in this case is the correct one.", "600" ], [ "## Sorta ##\r\n\r\nThere are things you can do make large battle scenes more tolerable in PF/3.5, such as;\r\n\r\n 1. **Grouping Attacks** - Similar units with similar attacks are grouped into &#39;volley&#39; attacks that are dodged with either a saving throw, or are fewer attacks that deal more damage.\r\n 2. **Placing Fights** - creating larger &#39;maps&#39; for fights with terrain that separates groups of combatants allows the players to use terrain and selectively engage enemies, turning a &#39;large fight&#39; into a series of smaller fights.\r\n 3. **Treating Groups of Enemies as a Single Creature**. Roughly what the DMGII&#39;s &#39;Mob&#39; template does, treat a group of weaker creatures as a single creature with it&#39;s own hp and attacks. HP being whittled away kills members of the group, but it still only has one set of stats (although probably a Swarm attack).\r\n 4. **&#39;Battle&#39;**, treating weak enemies as a terrain effect. They&#39;re rough terrain and deal environmental damage to the party, but they&#39;re not units with hp - by moving through them, the party is killing/fighting through them, but the party&#39;s real enemies and real goals in the scene are unrelated to them so they don&#39;t roll dice or do more than hinder the party. Like orcs in a LOTR battle, the party spends it&#39;s actions shooting down oliphants and stuff, killing orcs happens &#39;during&#39; their other actions.\r\n 5. **Waves**, enemies come as relatively discrete encounters with a time pressure of if you don&#39;t wipe them out the next wave is going to arrive. In this case, the papermancer would be origami&#39;ing new monsters as the party cut down the ones he has already made, and doing other things like sending waves of sharp-edged paper birds through the group, sending paper streamers in blue hues to &#39;flood&#39; the party and ruin their footing etc (you can refluff a lot of spells to be origami).\r\n\r\n## But you shouldn&#39;t be hanging everything on a single battle anyway ##\r\n\r\nAny good villain is **foreshadowed**. Paper mantis assassin striking the party in the night, learning about the man who wears a white paper mask and kills with paper knives, thugs wearing paper armour with paper swords (that are made from scrolls, and the thugs can activate them), an ally of the party being killed a paper chain that climbs singing into his mouth and chokes him to death at a dinner party, the climactic fight at the hideout alongside their allies, the papermancer boarding a paper dragon to escape, the final confrontation on the mountain where he defends the diggings of the Jade Lotus society&#39;s attempt to resurrect a dead god, defeating the papermancer who fights to the very last with no advantages to defend a man who isn&#39;t worthy of that loyalty, thereby giving the PCs yet another reason to hate <PERSON>, aka <PERSON>, the Hidden Master of the Cult of the Jade Lotus.\r\n\r\nEtc etc. You introduce, you create importance, you cause confrontation, you (hopefully) escalate the confrontation, and then you add twist to season, either twisting to make the character relatable or sympathetic or to make them even more horrifying than the party ever dared suspect.\r\n\r\nThat&#39;s what makes a memorable villain. Large fight scenes can be story-required, like if you foreshadow that the papermancer if given time can create a paper-army, and then the party gives them time, but they do not create memorable villains or highlight interesting story features.", "276" ], [ "So, I have finished recover.c (2016 edition) and it recovers all 50 of the jpg-s, and labels tham from 000 to 049.\r\n\r\nI have looked at every jpg, and they seem intact, all of them (I opened each of them individually - took forever with the IDE). Yet when I pass my code to check50 I get:\r\n\r\n:) recover.c exists\r\n\r\n:) recover.c compiles\r\n\r\n:) recovers 000.jpg correctly\r\n\r\n:( recovers middle files correctly\r\n\r\n:( recovers last file correctly\r\n\r\nI have no idea what may be wrong. I&#39;m currently trying valgrind to check for leaks (doubt I have any or it counts for check50).\r\n\r\nI&#39;ll post here part of my code. If anyone can shed some light on what may be wrong, that would be superb.\r\n\r\n while (true)\r\n {\r\n //checks if end of the card is reached\r\n if (fread( & buffer, sizeof(BYTE), 512, inptr) != 512)\r\n {\r\n fclose(inptr);\r\n break;\r\n }\r\n \r\n else\r\n {\r\n // finds the start of jpgs\r\n if (buffer[0] == 0xff & & buffer[1] == 0xd8 & & buffer[2] == 0xff & & buffer[3] < = 0xe0 & & buffer[3] > = 0xe0)\r\n {\r\n found = true;\r\n \r\n // creates a jpg file for me to write into\r\n sprintf(title, \" ;%03d.jpg \" ;, piccount);\r\n \r\n // opens file for writing\r\n FILE* image = fopen(title, \" ;w \" ;);\r\n \r\n // writes the first 512 bytes to the outfile\r\n fwrite( & buffer, sizeof(BYTE), 512, image);\r\n fclose(image);\r\n piccount++;\r\n }\r\n \r\n else if (found == true)\r\n {\r\n // appends additional bytes til new jpg is found\r\n FILE* image = fopen(title, \" ;a \" ;);\r\n fwrite( & buffer, sizeof(BYTE), 512, image);\r\n fclose(image);\r\n }\r\n }\r\n }", "249" ], [ "Okay just noticed it also says: \" ; \\ expected 015.jpg to exist \" ;\n\nBut 015.jpg does exist...\n\nAlso: Just ran valgrind, it said: HEAP SUMMARY:\n==47405== in use at exit: 0 bytes in 0 blocks\n==47405== total heap usage: 33,388 allocs, 33,388 frees, 18,964,384 bytes allocated\n==47405== \n==47405== All heap blocks were freed -- no leaks are possible\n==47405== \n==47405== For counts of detected and suppressed errors, rerun with: -v\n==47405== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)", "593" ], [ "## Nope.##\r\n\r\nAfter looking into adding spells to caster lists extensively when building a pathfinder character, I found a few methods to do so, but none that worked at level 1 other than Mystic Past Life.\r\n\r\nTo my knowledge, which is extensive if not absolute, there is no way to add spells to a list as a first level wizard beyond that ability.\r\n\r\nThere may be a way to do whatever it is you want cure spells *for*, but to gain specifically arcane cure spells at first level without just taking a level in one of the classes that gets arcane cure spells, the only way I know of is Mystic Past Life.", "796" ], [ "These things are fun because there are so many possibilities.\r\nI&#39;ll start my series of answers here and you can accept it once we get it right.\r\n\r\nFirst thing, your site is allowing directory listings -- this is bad for security -- but at the moment is helping me see what might be causing the problem :)\r\n\r\nI can see you have the **redirection** plugin installed.\r\n\r\nCould you deactivate that and try hitting your author URL then? That plugin has a nasty little default setting of doing extra work you may not want it to be doing -- and it can sometimes cause problems like this.\r\n\r\nExample of Directory Listing: _URL_0_", "861" ], [ "I believe the issue here is a problem with vernacular.\r\n\r\n`is_active_sidebar ` isn&#39;t page specific -- just checks to see if it has data within it throughout the entire site.\r\n\r\nYou are asking a different question.\r\nSounds like you are asking \" ;does this template reference and sidebars AND do any of those sidebars have data in them,? \" ; it also sounds like you don&#39;t want to reference the sidebar names at all and you&#39;d like this to be a generic question across the board.\r\n\r\nThat last bit makes this difficult and can potentially turn this into an architectural problem -- not a WordPress problem. Think of WordPress as a waiter -- it just takes your orders and gets you results. It wasn&#39;t built for you to ask questions like \" ;is anyone in the restaurant eating steak? \" ; -- so it doesn&#39;t have anything for you there.\r\n\r\nYou COULD tie into _URL_0_\r\n\r\nThen you could set a variable or call a function anytime someone calls a sidebar that has data in it -- this would allow you to react in those moments.", "150" ], [ "This sounded very much like a caching problem. Specifically Browser Caching.\r\n\r\nSometimes your Server may fail to fully serve an asset. Sometimes your Browser may incorrectly store an asset. This could have been a corrupt JavaScript file, or a corrupt CSS file. Either way, it was causing aesthetic problems on the Administration Screen of WordPress\r\n\r\nKnowing that WordPress core, and subsequently Administration Screens should not really be modified ever, there were two options immediately available. Either you were experiencing a bad cache or your WordPress install had \" ;gone bad \" ;.\r\n\r\nCaching was just more likely.\r\n\r\n---\r\n\r\nBut it sounds like you needed to re-install WordPress.\r\nThat&#39;s odd.\r\n\r\nWhat probably happened is that you recently updated and the update went bad. This can happen because of not upgrading plugins first, or sometimes it happens because they do a bad release (that does happen).\r\n\r\nLooks like the solution was to re-install.", "861" ], [ "Pathfinder has a lot of options for inflicting fear on foes from various spells to witch hexes to intimidate-using swashbucklers and rogues.\r\n\r\nBut what is the earliest, effective, unlimited (or relatively unlimited) fear-using character? What is the lowest level this can be done at? Full builds aren&#39;t required for an answer, but at the very least the levels and feats required to make the fear effect work must be listed.\r\n\r\nFor the purposes of this question, no third party content will be accepted in an answer.", "825" ], [ "## Yes. ##\r\n\r\nLacking any exemptions, the normal rules on alignment would apply.\r\n\r\n > All creatures have an alignment and alignment determines the effectiveness of some spells and magic items. [(PFSRD, \" ;Alignment \" ;)][1]\r\n\r\nIt goes on to say this.\r\n\r\n > Animals and other creatures incapable of moral action are neutral. [(PFSRD, \" ;Alignment \" ;)][1]\r\n\r\nSo creatures incapable of moral action are neutral (although some monster entries are mindless yet evil, which I assume is an attempt to indicate the moral considerations of the creatures creating them, rather than the mindless creature itself). However, humanoids are nearly universally considered capable of moral considerations and have alignments. Anything that is a playable character can also have various alignments unless noted in the &#39;race&#39; entry. \r\n\r\nThe &#39;Young&#39; template, the only metric to judge children vs adults in pathfinder, does not specify that the target must be Neutral, or otherwise indicate that the Pathfinder roleplaying game system considers children or adolescents &#39;incapable of moral action&#39;. The GM can decide that specific children or Young monsters have a different alignment than the norm for that monster or race (or class) in the same way they can alter alignment for any individual npc or monster the party might come across, or in the same way they can alter the alignment of any demographic (poor, mercantile, slaves, wealthy, desperate refugees) that might live differently than the &#39;normal&#39; monster or humanoid of that type and therefore have an altered alignment. This is not spelled out in the rules, but can be inferred from the general Alignment and Gamemastery sections of the core rulebook.\r\n [1]: _URL_0_", "276" ], [ "Undefined.\r\n----------\r\n\r\nAs far as I am aware the RAW and FAQ do not answer this question. Wh[ile a forum post claims that an answer has been posted in the FAQ][1], I cannot find it. Apparently, though;\r\n\r\n > sometimes an older Answered in the FAQ note means, instead, No answer needed or The developers have declined to answer, the latter perhaps being the case here (user: HeyICanChan, [this thread on the paizo forums][2])\r\n\r\nErgo, to the best of my knowledge, it is undefined as to what spell level the magus would learn the curse spells as, and therefore it comes down to the GM.\r\n\r\nI&#39;d hazard that if the spell is available on a &#39;6th level casting max&#39; class, it should be added at that level, as the magus is a partial casting class also and that makes the most sense to me. Individual opinions on that matter, though, will vary.\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "796" ], [ "## No. ##\r\n\r\nUnless there&#39;s some third party stuff somewhere, there are no rules for intelligent psionic items in 3.5e. \r\n\r\n**You can, however**\r\n\r\nSimply use the Intelligent Magic Item rules to generate psionic items that are intelligent. The list of abilities available to intelligent magic items can be replaced with same-level psionic abilities in the same school (school/discipline equivalencies can be found [here][1], under each individual discipline) with the same &#39;theme&#39; available the same number of times per day.\r\n\r\nIf you have a lot of experience with the system/fantasy tropes, you might be able to make more ground simply by designing your own intelligent item abilities, as the rules for intelligent items have always been relatively scanty and poorly thought through.\r\n\r\n\r\n [1]: _URL_0_", "796" ], [ "## 5E Mechanics are not compatible with 3.5E mechanics ##\r\n\r\nWhile some of the same words might be used, and you could port monsters if you have a strong understanding of both systems, a lot of people would have trouble doing so. I hesitate to use &#39;experience&#39; as a hallmark of ability to do so - some people play for 10 years and would have no ability to do so, some people could do so innately using other skills they have learned or developed in other circumstances.\r\n\r\n## But that doesn&#39;t mean you can&#39;t use those books in your game ##\r\n\r\nThe lore of Forgotten Realms is similar from 3.5e to 5e. Some changes have been made, but the general theme of the setting is the same. If you substitute the npcs&#39; stats for 5e classes and the monsters for 5e monsters, there is no reason you couldn&#39;t even use published 3.5e adventures set in the forgotten realms.\r\n\r\nHowever, due to there being some differences between the settings, deciding one will be your &#39;primary&#39; source for lore would likely make things a bit simpler. I suggest 3.5e, as there&#39;s more material for it (and you already own a lot of it).\r\n\r\n## Forgotten Realms power level and 5e ##\r\n\r\nA lot of forgotten realms characters, ideas, and adventures are beyond the statted mechanical options for 5e characters. That said.. so are some of the characters and ideas from the 5e books. Even for 3.5e, characters like <PERSON> had specific powers or abilities that were not simply player class abilities but rather special &#39;gifts bestowed on them by gods&#39; or some such. Ergo, there being stupidly powerful npcs that the rules don&#39;t really cover is true in both 3.5e and 5e (although to a greater degree in 5e). To that extent, the logistical challenges of running a FR game (in that there are all these random npcs with stupid powers and you have to keep track of them so you know that when the party goes to somethingport there&#39;s a super powerful ranger or whatever there who the party should try not to piss off) remain roughly the same in 3.5e or 5e, although my usual advice is to try to downplay those aspects of the FR setting as much as possible (unless you have a fan of those characters in your audience), as it takes spotlight away from the PCs and makes &#39;go tell elminster&#39; the answer to a lot of otherwise interesting plot developments.", "825" ], [ "## Undefined. ##\r\n\r\nThe rules as written do not state which state an enchantment is in when it is added to a weapon. Simply that the user can activate or deactivate them with a standard action. Ergo, it is up to the GM what state a weapon is in after being crafted (or after an ability or spell adds that enchantment to a weapon temporarily).\r\n\r\nIf a weapon having that ability added to it by a spell or ability is intended to be used while in-combat (and anything with a duration of 1 minute or less is intended for such use), the in-game utility of that action is lowered by requiring an additional standard action to activate the ability, possibly to the point of making the ability not worth using. Especially if the ability that adds the enchantment to a weapon normally costs *less* than a standard action (in this case, a swift).\r\n\r\nEither way it&#39;s a houserule, and the individual GM will have to make up his or her mind about whether or not they require the character to spend an additional standard action to activate flaming, shock, frost or other [elemental] enhancements after they have been placed upon a weapon by a spell or ability.", "271" ], [ "@HeyICanChan - That&#39;s enough of a stretch that I don&#39;t feel comfortable calling it RAW. The rules mention &#39;learning blah as a blah level spell&#39; enough times that it&#39;s dubious that they count as &#39;different spells&#39;. I think trying to rely on interpretations of raw that stretch that far leads you directly into crazy-land and it&#39;s better to just say that the rules don&#39;t say and the GM should rule on it.", "796" ], [ "## Nope ##\r\n\r\n > A weapon with a special ability must also have at least a +1 enhancement bonus.\r\n\r\nThis is a rule for all magical weapons. Barring a more specific line of text that removes this requirement, it applies to all magical weapons, regardless of source.\r\n\r\nRestrictions on arcane pool, it&#39;s hazy if they would apply to the Fiendblade ability (as while it uses points from the arcane pool, it is it&#39;s own separate ability and not subject to restrictions on that ability, at least, the ones written into the &#39;use a swift action to do blah&#39; bit), but the rule on magic weapons is a global rule that applies to all magical weapons.\r\n\r\nTechnically by the rules on pre-requisites though, if you have a thing but not a pre-req, you lose access to the thing until you get the pre-req. So by a reading of RAW (to &#39;have&#39;, not to &#39;grant&#39;) and (gaining a pre-req means you regain the use of the ability you lost due to losing the pre-req), creating an unholy fiendblade (which has no unholy property due to not having the +1) and then casting Magic Weapon on it would give you the use of a +1 Unholy Fiendblade, at the cost of a swift action on your part and a standard action on your (or someone else&#39;s) part.\r\n\r\n > But the Fiend Blade does have a +1. In fact at 7th level it has a +2. (user: <PERSON>)\r\n\r\n**To clear up any confusion**, the Fiend Blade ability allows tiefling maguses to create a fiendblade with an enhancement bonus - and after level 5 *trade out* that enhancement bonus for a short list of special abilities. There is no limit on this in the text of the Fiendblade ability, allowing a Tiefling Magus to trade out all the +&#39;s and end up with a weapon that cannot &#39;have&#39; the special abilities the fiendblade ability has given it, due to not having the pre-requisite +1 enhancement bonus.", "825" ], [ "## Technically, anything is an appropriate encounter for any level of PC ##\r\n\r\nIt may be **unwinnable**, however, especially if the party charges in and tries to punch the enemies to death with their swords instead of using tactics or strategy of any kind.\r\n\r\nWithout tactics, that encounter is deadly (as in, TPK) for 4 level-3 PCs.\r\n\r\nIf you have a GM willing, however, to introduce situations that can outright kill their party, then either you have a GM who is confident in their skills, or one who has made an error. The best stories are told in situations where encounters cannot purely be solved by hitting them with swords, but also campaigns disintegrate around GMs who are unable to accurately identify threat level - or manage situations with powerful foes without killing off all their PCs.\r\n\r\nGiven the general 5e adventure design paradigm, the fight is vastly too powerful, and likely was not intended to be that powerful or have that form.", "276" ], [ "## By RAW, they are still limited to only 5&#39; from you. ##\r\n\r\nThis is, however, obviously insane.\r\n\r\nA GM should simply houserule this to be the natural (or magically modified natural) reach of the creature.\r\n\r\nOtherwise there&#39;s little (no) reason for a Large or larger (or buffed with a +reach spell) creature to ever have this feat. It&#39;s use is still dubious compared to armour spikes or quick-drawing a one-handed weapon or improved unarmed strikes, but at least the use it has (dealing bow damage with enhancements instead of smaller non-primary-weapon damage from an aoo) is preserved.", "600" ], [ "## Not Particularly ##\r\n\r\nUnless it&#39;s something you want to be doing a lot of, a scroll + UMD, or getting someone else to cast it for you, are going to be the cheapest and easiest ways of getting the animal awakened.\r\n\r\nWhile it&#39;s possible to cast Awaken yourself via shenanigans (a *ring of spell storing* likely won&#39;t cut it due to &#39;spells the user can cast&#39; line), they generally cost feats, prestige class levels, or other nonsense that is far beyond the 3000gp required to buy the scroll. If you don&#39;t have the UMD to activate a 5th-level scroll, that might be an issue, but from your question it sounds like you do, so that is the easiest option in PF as I understand the current rules.\r\n\r\nIf you&#39;re heading down this path, though, you should inform your GM. As it&#39;s an egg you&#39;ve been specifically carrying, it probably came from somewhere notable, and your GM might have plans for it. Not that I am implying those plans conflict or he should fudge things in your benefit - simply that if the egg is plot important, this might cause some npcs to react differently, or reveal some information to the group, or something, which the GM might not have prepped yet, or need to alter now, or so forth. Try to keep your GM in the loop so they can be ready for stuff to happen ahead of time.\r\n\r\nAdditionally, you may consider your magus asking the druid to cast this as a means of creating some roleplayable situations - where the rivalry is intensified due to a &#39;child&#39; (who likes one &#39;parent&#39; due to the spell but is being taken care of by the other &#39;parent&#39;) being part of the relationship between the two characters. Not something you should force, but not something particularly unreasonable to occur, either.", "408" ], [ "## By the RAW, probably, but literally no-one will ever agree with you about this. ##\r\n\r\nCombining the spell description\r\n\r\n > Duration: Instantaneous\r\n\r\n > You hurl a bubble of acid. Choose one creature within range, or choose two creatures within range that are within 5 feet of each other. A target must succeed on a Dexterity saving throw or take 1d6 acid damage. \r\n\r\nwith the rules on &#39;Instantaneous&#39; spell effects\r\n\r\n > The spell **harms, heals, creates, or alters** a creature or an object in a way that can&#39;t be dispelled, because its magic exists only for an instant\r\n\r\nthe absolutely most likely form of the spell is that it creates a bunch of acid that is in motion and is a created object. The description of hurling acid on people doesn&#39;t work with &#39;harms a creature&#39; or &#39;alters a creature&#39; - if it described &#39;burning a creature like acid was poured on it&#39;, sure, that&#39;s a metaphor for the type of damage (harm) the creature is receiving. But it refers to throwing actual acid at people and ergo, it is creating that acid in the first place.\r\n\r\nMagic that only exists **for an instant** is not long enough for people to dodge with Dexterity saving throws and for acid to fly 60&#39; away etc. That amount of time would allow counterspelling or not be &#39;instantaneous&#39;. It is, however, long enough to create some acid-in-motion. And as &#39;creating&#39; an item is explicitly something instantaneous spell effects **do**, it fits the listed facts about Acid Splash a lot better than any other explanation.\r\n\r\nHowever, in general the attitude of the rules of 5e and the most common attitudes amongst it&#39;s players means likely few or no GMs or players of 5e DnD will use this reading or acknowledge it&#39;s relevancy. The entire philosophy of the game is almost directly against this, which would be termed by both the authors of the game and the most outspoken proponents of the system as &#39;an exploit/cheat and against the intent of the rules&#39;. If not simply making an argument that the RAW doesn&#39;t say that in the first place.\r\n\r\nSimply put, if your group is interested in this sort of 3.5e &#39;using abilities in ways they weren&#39;t intended&#39;, then yes, Acid Splash can be stored.\r\n\r\nHowever, most 5e players will disagree strenuously - and what the rules suggest, in that circumstance, is rather irrelevant.", "271" ], [ "## WBL and standard treasure rewards are a guideline, not a hard and fast rule ##\r\n\r\nAs long as it balances out over time, it&#39;s fine to give a lot of &#39;loot&#39; from defeating, say, a well-geared npc and then no loot when a wild beast ambushes the party as they descend into the depths of the volcanic furnace known as &#39;Angstraanggrad&#39; by the dwarves.\r\n\r\nSecondly, how you give out the loot depends on the GM. Either as unrelated to the combat treasure - the contents of someone&#39;s wallet, say, treasure being used in combat - such as the *masterwork* rapiers the street duellists were equipped with when the party defeated them, &#39;hidden&#39; treasure that is not immediately obvious and needs to be found, a payment given by someone for the task the party did (either offered upfront, or given as a gift or reward afterwards), or even unrelated circumstance - a party member could inherit, the party could earn wages for a long sea voyage where they worked as crew, they could even make a shrewd business deal.\r\n\r\nThe **purpose** of the wealth-by-level system is to indicate a level of power in magic items that is appropriate for each level of power in class levels - so the party doesn&#39;t get so &#39;blinged out&#39; that their classes no longer matter, but also so they have the magical gear the game expects them to have to fight tougher foes.\r\n\r\nAs such, if the party spends gold on charity, parties, buying real-estate, building small private armies (of non-CR appropriate soldiers, that is), you can increase the amount of treasure they are able to acquire by roughly that amount (although obviously, not immediately, as you don&#39;t want these things to feel &#39;free&#39; and therefore worthless).", "825" ], [ "## They don&#39;t need to be adjacent. ##\r\n\r\nThe wording just says\r\n\r\n > You can modify an area spell by changing the area&#39;s shape to either a cylinder (10-foot radius, 30 feet high), a 40-foot cone, four 10-foot cubes, a ball (20-foot-radius spread), or a 120-foot line. The sculpted spell works normally in all respects except for its shape. \r\n\r\nAt no point does it mention that the cubes need to be adjacent. The general spell rules on area also don&#39;t mention this in any way, and every ability that requires areas to be adjacent indicates as such by using the word &#39;adjacent&#39; or &#39;contiguous&#39; or so forth. There&#39;s no common logic that &#39;four 10&#39; cubes&#39; must necessarily be adjacent, such that it wouldn&#39;t be mentioned.\r\n\r\nAs for how far apart they can be, anywhere within the spell&#39;s Range. You can&#39;t target an area of effect outside the Range of a spell, which is the only applicable rule, so you could have them equidistant at max range if you felt like it.", "35" ], [ "## &#39;Magical Damage&#39; does not exist ##\r\n\r\nExcept in the sense of a sentence, aka a &#39;magical&#39; source of &#39;damage&#39;.\r\n\r\n**For the purposes of DR/Magic, it is the source of the damage rather than the type that determines whether or not the DR applies.***\r\n\r\nIf struck by a sword with a spell on it that did 1 extra point of damage to the foe struck, and that foe had DR 50/Magic (and the nonmagical sword did less than 50 points of damage), that foe would take 1 point of damage;\r\n\r\n > A creature with this special quality ignores damage from most weapons and natural attacks. Wounds heal immediately, or the weapon bounces off harmlessly (in either case, the opponent knows the attack was ineffective). **The creature takes normal damage from energy attacks (even nonmagical ones), *spells*, spell-like abilities, and supernatural abilities**. A certain kind of weapon can sometimes damage the creature normally, as noted below.\r\n\r\nBecause the *SPELL* is what did that 1 point of damage. The spell is the source of that damage, and &#39;the creature takes normal damage from [...] spells&#39;.\r\n\r\nIn the case of a magical weapon, that is &#39;a certain kind of weapon&#39;, and it is noted below;\r\n\r\n > Some monsters are vulnerable to magic weapons. Any weapon with at least a +1 magical enhancement bonus on attack and damage rolls overcomes the damage reduction of these monsters. Such creatures’ natural weapons (but not their attacks with weapons) are treated as magic weapons for the purpose of overcoming damage reduction.\r\n\r\nOvercomes, in this sense, means &#39;negates completely for that attack&#39;. So you do not apply DR/Magic to the damage from a magical weapon (or from the natural weapon attacks of a creature *with* DR/Magic).\r\n\r\n## Incorporeal Subtype ##\r\n\r\nThis applies equally to **incorporeal** foes.\r\n\r\n > An incorporeal creature has no physical body. It can be harmed only by other incorporeal creatures, **magic weapons**\r\n\r\nSo the source of the damage is still what makes it able to harm the incorporeal creature. The damage is still Piercing or whatever, it doesn&#39;t change damage type.\r\n\r\n > Incorporeal creatures can be harmed only by other incorporeal creatures, by magic weapons, [..] Even when struck by magic or magic weapons, an incorporeal creature has a 50% chance to ignore any damage from a corporeal source—except for a force effect or damage dealt by a ghost touch weapon. \r\n\r\nSource is still something that determines what happens. A Ghost Touch Shortsword still does slashing damage - just due to the wording of ghost touch and the incorporeal entry it does damage to incorporeal creatures.\r\n\r\n--\r\n\r\n*Although, of course, certain types of damage innately ignore all types of DR, such as Fire damage, Electricity, and so on.", "271" ], [ "## WBL for NPCs ##\r\n\r\nThe WBL for NPCs is largely to give NPCs the kind of adventuring gear expected (or required) by adventurers to present a challenge (either to PCs, or as allies when fighting other NPCs). A Wizard without a spellbook, or a Fighter without arms and armour are easy meat and do not correctly reflect their Challenge Rating.\r\n\r\nThe WBL for NPCs is not intended to override the normal treasure guidelines in the WBL entry in terms of loot for encounters/expected WBL, and NPCs receive less WBL than PCs partially due to this concern.", "825" ], [ "## Improve your understanding of interpersonal dynamics. ##\r\n\r\nThis question tacitly assumes that &#39;the rest of the group&#39; are being &#39;unreasonable&#39; in not wanting to discuss same-page dynamics or soft-touch techniques, and that those techniques are a superior means to create an interesting game. In reality, interacting with other people is not simple and relies on inherent and learned skills to a far greater extent than memorized principles of interaction - if an individual approaches a group and tries to improve the game they are all playing and they *refuse*, then that individual is the one who has failed to convince the group, not vice versa.\r\n\r\nThe status quo is the status quo for reasons - assuming those reasons are &#39;rank stupidity&#39; and &#39;unreasonableness&#39; indicates the base root of the problem - a lack of empathy and interpersonal skills that would enable the individual in question to frame the changes in a manner that is considered positive by the group (and to create a set of changes that would actually benefit the group in the first place).\r\n\r\nReading answers on _URL_0_ or articles about interpersonal communication does not mean you are good at it - neither does it mean you can impose positive changes on an activity, or design changes that are genuinely positive in the first place. \r\n\r\nAs for learning interpersonal skills, i&#39;ll give you a piece of advice someone gave to me once. *Assume you know nothing.* Even if you think you know what is happening, especially if that assumption includes your own level of skill being high, assume both that you know nothing and that your skill is not high, and approach the situation with humility and from first-principles. That is the easiest and the fastest way to learn to &#39;deal with&#39; other people who do not necessarily share your groupthink.", "823" ], [ "## Not Really. ##\r\n\r\nThere&#39;s a few Templates that are sort of Good-ey, there&#39;s a few prestige classes that are saint-esque, but there&#39;s nothing with either the mechanical *whammy* or the horrifically extensive roleplaying requirements of the 3.5e *Saint* template.\r\n\r\nA complex mixture of Pathfinder classes, spells, abilities, racial options, could produce something mechanically a bit like the Saint template&#39;s abilities, albeit slower (as there is no direct analogue and the optimizable abilities in pathfinder don&#39;t really mimic the &#39;defensive&#39; nature of the <PERSON> template very well), but there is no good direct analogue. \r\n\r\nPorting it directly might not be possible as the flat bonuses and abilities the <PERSON> template grants (like the Vow of Poverty feat) probably look &#39;too powerful&#39; to GMs with weaker mechanical understanding of the game. Nonetheless, it&#39;s probably the only way to preserve that mixture of flavour and effect.", "825" ], [ "@LegendaryDude - The GM decides what goes in the game. Most pathfinder games do not blanketly allow 3.5e or PF 3rd party material. This question is also not about whether or not Saint can be ported into PF - it&#39;s about whether there is anything like Saint in PF. The last paragraph is a comment on whether a GM following the normal PF mode would allow the Saint template - my guess is that a lot would not.", "982" ], [ "## Sorta. ##\r\n\r\nThere are rules for &#39;jumping in&#39; to CFD-zombies in *Boston Lockdown*. There are, however, no rules for jumping into cyberzombies (or indeed, any rules for cyberzombies at all).\r\n\r\nThat said, there are a lot of things in sr5 with no rules whatsoever that are accomplishable in the fluff or previous editions. My advice is to simply use the existing rules for drones to treat a &#39;controlled&#39; cyberzombie, and have any cyberzombie that has been fitted with a rigger interface to be jumped into by a rigger (who has ownership of them). Treat them as Drones, basically.", "408" ], [ "## Yes ##\r\n\r\nFrom the 3.5e SRD.\r\n\r\n > Magic armor or a magic shield must have at least a +1 enhancement bonus to have any of the abilities listed on Table: Armor Special Abilities and Table: Shield Special Abilities. \r\n\r\nAll of the special abilities with a fixed cost (and all weapon, armour, and shield special abilities full stop) are found in those tables. This is reiterated in a few places (MiC, RC). There are no rules or rulebooks that contradict these rules for special weapon and armour abilities, and to my knowledge, there are no special weapon or armour abilities that have even an exception to this clause.\r\n\r\nDue to the **utter unambiguity**, allowing special abilties to be added to weapons and armour without a +1 enchantment first would be a houserule (although not one i&#39;d personally consider a bad thing).\r\n\r\nNb: If playing purely by RAW, a magical effect or ability (does one even exist?) that removed the +1 bonus from a magical weapon or armour would also remove any special abilities that armour or weapon had. Technically, I believe this would allow a suit of armour or a weapon that when given any spell or effect that gave it a magical enhancement bonus of +1 or greater, to activate special abilities that had been enchanted onto it while consistently under the effect of a +1 or better spell-enhancement, due to previous FAQ answers on the effects of removing (and then reinstating) a prerequisite for an ability.", "825" ], [ "## They only can&#39;t if &#39;control over the storm&#39; is exclusive, which the text does not indicate in any way. ##\r\n\r\nBy a simple english reading, &#39;control over the storm&#39; does not exclude others from also controlling the storm. Control is not an exclusive verb in english, although that&#39;s the more common usage.\r\n\r\nIn situations where a line like that implies an absolute control, it goes on to define the things you can do with your &#39;control over the storm&#39;, such as moving the clouds, water, etc. As it doesn&#39;t do that in this instance, while it is rules text, it does not preclude someone else from casting Call Lightning while under the influence of the same storm, neither does it allow the Call Lightning caster to move the clouds around, increase/lessen the rain, or anything else.\r\n\r\nTo further explain, &#39;control over&#39; is only meaningful in DnD Rules-As-Written if what &#39;control over&#39; does is meaningfully defined or has an extremely clear common-usage meaning (like &#39;swing a sword&#39;). Since it isn&#39;t, you do have &#39;control over&#39; but can&#39;t use it to do anything. If a different ability let you do < something > to &#39;anything you magically control&#39;, say an ability meant to be used with Dominate Person and it&#39;s ilk, then you could use that ability and the line from Call Lightning together to do something (likely something silly). But as is, it doesn&#39;t actually allow you to do anything.\r\n\r\nThat specific situation, though, is the kind of thing that these games have a GM for - to apply sensible houserules to interesting or edge-case situations to help support the narrative structure of the game. Two storm-users struggling to control the storm and rain lightning on their foes is an extremely interesting thing to happen, moreso than simply casting a spell and dealing damage - and the player (intentionally or not) and the GM have added to the game by having that happen.", "271" ], [ "There are a few problems with the code as far as I can see.\r\n\r\n1. Killed by server means that the server shut down your program for some reason. Most likely this is caused by an infinate loop or an unending recursive call.\r\n\r\n2. You can see from check50, that your code fails, where 42 is not among the numbers, so you got a problem with handling when the value is not present.\r\n\r\n3. What you have written, is not really binary search. The first step of it is, but then you just search the two sides lineary. You should try to continue the binary searching whithin the remaining section of your array.\r\n\r\nI hope that helps enough to get you on the right track. Good luck!", "56" ], [ "I use Meta-ijkl as arrows in Emacs, and `M-;` as a backspace, so I want to make the keys in bash represent the same style. Moving and deleting works well, but for some reason I cannot bind `unix-line-discard` to `C-;` that would erase the whole line from the cursor to the beginning into the kill buffer. Since default emacs keys for copy, kill and yank are `C-j`, `C-k` and `C-y`, another C- combination fits there quite well. And `\\e:` (Meta-Shift-;) is already bound to `backward-kill-word`. `C-u` that does `unix-line-discard` by default, works fine, but it’s inconvenient to press. If I rebind this function to, say, `\\C-g`, it works fine, too.\r\n\r\nIn the `~/.inputrc` I have\r\n\r\n \" ;\\C-; \" ;: unix-line-discard\r\n\r\nI’ve also tried\r\n\r\n \" ;\\C-\\; \" ;: unix-line-discard\r\n \" ;\\C-\\x3b \" ;: unix-line-discard\r\n\r\nwith no effect. `C-v C-;` in the shell doesn’t print anything except for the usual semicolon, and `\\C-;` with all its variants only prints it, too, and nothing more.\r\n\r\nI work in Urxvt.", "71" ], [ "## [Levels in a PC class + existing CR (or LA) = CR][1] ##\r\n\r\nHowever, this is a flawed system. Monsters are often stronger than individual PCs, or have factors that cause them to *appear* to be more challenging (or tougher) than an equal level npc does when confronted by 4 PCs with nothing but his elite array and some class levels to protect him.\r\n\r\nAs you are using highly-modular components with vastly varying levels of power, the power of the npc is not a fixed constant either. <PERSON>, the *Majo* of the Northern Dark, 7th level Wizard and his personal retinue of *planar bound* creatures, is probably a tougher challenge than <PERSON>, his older brother, a 7th level Fighter caught alone on a towertop without his Four Pillars to guard him. The damning thing is that with the wrong spells or tactics, that situation reverses. With the right build, <PERSON> is an unstoppable whirlwind, and with the wrong spells or positioning, <PERSON> is a pushover (quite literally, with the right bullrush, a window, and the propensity for wizards to live in towers).\r\n\r\nEven moreso than with monsters, using npcs as challenges depends on the GM&#39;s ability to &#39;judge&#39; a situation and the strength of the individuals and either give the winds of chance a blow to the side that improves the story, or, communicate this to the PCs/have the NPCs realize this and act to try to redress the balance (two different styles of GMing).\r\n\r\nCR isn&#39;t accurate at all when dealing with foes with class levels. There&#39;s a reason why the stronger GMs use npcs as foes a lot more, and it&#39;s because npcs as foes is hard. \r\n\r\n\r\n [1]: _URL_0_", "825" ], [ "## Poison in 3.x ##\r\n\r\nPoison has generally been &#39;considered&#39; evil due to lingering ideas about &#39;honour&#39; from the middle ages when it wasn&#39;t in the interest of the people in power to allow the use of poison (and assassination in general) to go unpunished.\r\n\r\nThis is a bit of a poser for dnd (and other genres of entertainment) trying to incorporate the &#39;cunning hero&#39; archetype into their piece of fiction. Having Poison Use be a special ability you need to be an assassin or Red Mantis Legionnaire or whatever with magical powers and being an 11th level character to be able to put some rat poison in someone&#39;s stew without accidentally eating some is largely due to this conflict.\r\n\r\nThus various authors have used &#39;poison&#39; as an example of an evil act in the same game where Rogues regularly &#39;sneak attack&#39; their foes, and player characters as small groups fighting larger ones entirely rely on confusion, stealth, and guerilla tactics, divorcing some aspects of &#39;cunning&#39; warfare from others to legitimatize it as a hero type without going too far into murky waters. Similarly, the playerbase (and gmbase) has latched onto that and accepted it as read that while poison is evil, knifing a goblin sentry through the throat from behind is just fine.\r\n\r\nPutting poison into someone&#39;s food can be either good or evil. A captive princess putting poison into the food of an evil, psychotic warlord knowing that his followers will kill her in the most horrible ways for her act, even as it saves countless others, is good. Exalted, even. A jealous brother putting poison into the food of his older sibling, in order to steal a princedom, is evil. It could even be neutral - making someone sick so they won&#39;t go to war, because you care about them. \r\n\r\n**Basically, there is no direct RAW indication that using poison is always evil in pathfinder, and even if there was, you should ignore it. Alignment is explicitly - and has always been explicitly - something the GM needs to decide based on the individual situation of the action.**", "416" ] ]
137
[ 10070, 2857, 2803, 12619, 18246, 9644, 8036, 5934, 3587, 7534, 6497, 8075, 9152, 5511, 12211, 672, 1078, 7408, 11820, 8046, 8643, 8677, 5660, 9680, 2822, 8992, 11395, 1431, 3402, 2355, 7240, 10034, 7159, 7642, 3537, 10098, 2881, 6281, 19250, 11452, 10767, 5346, 10019, 18371, 9259, 4108, 8248, 4362, 6323, 4887, 9285, 11584, 5560, 630, 19474, 6361, 9905, 7602, 690, 3106, 7162, 1304, 6102, 19390, 6928, 897, 8784, 7751, 8138, 7803, 7615, 9593, 6302, 12565, 7136, 16444, 2825, 8143, 16017, 7785, 18005, 9205, 11650, 2712, 5687, 7486, 10911, 15189, 7962, 17463, 11445, 14907, 2535, 9354, 1371, 6298, 9515, 11132, 17693, 10052, 10174, 9511, 5861, 9256, 15528, 6246, 3366, 12622, 11652, 4918, 7351, 5307, 7223, 3909, 2086, 6088, 1539, 8401, 1275, 5590, 5577, 3860, 12991, 13693, 11464, 10044, 9299, 11134, 10317, 5781, 9206, 14664, 6087, 8423, 6853, 10087, 13492, 12364, 5853, 9468, 18561, 3230, 11255, 12217, 19145, 19677, 8874, 9972, 12978, 5584, 18556, 8275, 6536, 543, 9530, 7902, 1192, 5669, 6720, 4018, 10397, 9600, 8867, 9151, 184, 916, 9795, 8236, 7825, 9365, 18872, 12938, 16600, 7710, 8681, 18980, 9799, 11361, 17532, 11702, 710, 487, 3406, 7294, 8204, 986, 9978, 14983, 9924, 1615, 12305, 9610, 8311, 2345, 14603, 10348, 11414, 3360, 9586, 3308, 15844, 15508, 18697, 11381, 4233, 16404, 5903, 15233, 5321, 5488, 9631, 18010, 16297, 11974, 4218, 3225, 1767, 5239, 596, 10014, 8611, 16940, 9333, 7737, 9819, 6278, 2248, 18402, 12602, 6963, 13230, 7875, 13917, 14337, 16408, 926, 9994, 18618, 15899, 16593, 8988, 8890, 11311, 2976, 7943, 970, 15809, 13298, 10820, 6117, 8154, 8452, 18419, 3921, 13307, 2673, 16926, 17649, 18046, 3662, 16407, 1869, 7019, 5893, 97, 13871, 9538, 17136, 8968, 3005, 13379, 12390, 12461, 17453, 5178, 7829, 3371, 2891, 8147, 4648, 19035, 12670, 11016, 3320, 14033, 3134, 7469, 12968, 3113, 11379, 635, 13034, 925, 5122, 16732, 9621, 8208, 8160, 17199, 2017, 15674, 913, 8055, 2686, 945, 18039, 3644, 8124, 19206, 17576, 153, 9733, 13059, 6940, 15450, 7621, 8980, 17679, 2055, 613, 19507, 16309, 2730, 14975, 3785, 9620, 18987, 8220, 18539, 10470, 330, 16163, 12388, 2515, 16979, 18225, 5300, 7373, 8624, 7483, 3381, 7018, 5635, 9891, 18314, 7455, 16817, 13734, 1035, 7628, 14114, 17709, 9178, 7850, 4036, 14091, 8956, 575, 19046, 6396, 16326, 3085, 19466, 18535, 7201, 3821, 2912, 17550, 18002, 11280, 18391, 17521, 14707, 10048, 17621, 13807, 10175, 7763, 3698, 3070, 9445, 2023, 8123, 5918, 16133, 4655, 17887, 16725, 5761, 13541, 7572, 12690, 8910, 4260, 19353, 8263, 14449, 3457, 18026, 15617, 1410, 2091, 7530, 9131, 15537, 13003, 3072, 7810, 15767, 8766, 4977, 3383, 9521, 10814, 15457, 1534, 3219, 17330, 568, 1023, 13071, 388, 8648, 3817, 9943, 7233, 1402, 2379, 2683, 5709, 15438, 11605, 8015, 13428, 10499, 16936, 9671, 17692, 16093, 413, 6383, 8229, 7989, 2883, 12222, 11145, 7403, 9574, 2445, 19131, 16161, 19493, 5947, 17930, 0, 396, 19377, 6150, 6344, 5424, 17065, 16909, 5098, 10040, 476, 1714, 9471, 12080, 16489, 2959, 6373, 14783, 8247, 5663, 6605, 14018, 18431, 4867, 16689, 12800, 19614, 16542, 14692, 9176, 16745, 10607, 9529, 4121, 10478, 5411, 5566, 14087, 2405, 17349, 9150, 6134, 977, 9767, 15870 ]
STX_10076.0
[ [ "This is true. Actually, even better, these singularities will be terminal and Gorenstein, so as mild as it can get. Well, at least if we assume that you are working over an algebraically closed field, but otherwise you would have to be more careful about what exactly do you mean by these assumptions and questions, so I&#39;ll assume that that&#39;s what you meant. \r\n\r\nYour assumptions imply that all the fibers are Gorenstein. Since $\\mathbb P^2$ is smooth, this implies that then $X$ is Gorenstein. \r\nFurthermore, your assumptions imply that all the fibers are $1$-dimensional, so $f$ is equidimensional, and hence it is flat by \" ;[miracle flatness][1] \" ;. So, as <PERSON> noted, then $f$ is smooth at every $x\\in X$ such that $x\\neq x_p$ and hence $X$ is smooth at all of those points. \r\nThis also implies that $X$ is normal (it is $S_2$ since it is <PERSON> and its singular locus has at most codimension $2$, so it is also $R_1$).\r\n\r\nNow, looking at one of these $x_p$&#39;s, we still have that $X$ is <PERSON> and we know that a complete intersection curve through this point is a simple node. As an exercise, try to prove directly (say via a direct local computation) that this implies that then $X$ is canonical (of index $1$) at these points. \r\n\r\nIf you get stuck, then use this argument: \r\nLet $C_1$ and $C_2$ be two smooth curves in $\\mathbb P^2$ that intersect transversally at $p$ and let $D_i=f^*C_i\\subseteq X$ for $i=1,2$. (For the record, the $D_i$ are reduced divisors on $X$.) Now, $D_1\\cap D_2 =f^{-1}(p)$, which is a nodal curve, so it has slc singularities. \r\nThen by inversion of adjunction (applied twice) $(X,D_1+D_2)$ is log canonical. Now if you scrape away the $D_i$, this actually means that $X$ is terminal at the points of the form $x_p$. (Note that $(D_1, D_1\\cap D_2)$ is also log canonical, so $D_1$ is canonical. It is locally isomorphic to a cone over a quadric.) \r\n\r\n\r\n\r\n\r\n [1]: _URL_0_", "737" ], [ "**It is mentioned in the Garga Samhita.** [This][1] is what I found:\r\n\r\nGarga Samhita, Canto 10, chapter 61, verses 23, 24, 25, 26:\r\n\r\n > vamanas ca vidih sesah sanako visnu-vakyatah \r\ndharmartha-hetave caite bhavisyanti dvijah kalau\r\n\r\n > visnusvami vamnangsa-statha madhvastu brahmanah \r\nramanujastu sesanga nimbaditya sanakasya ca\r\n\r\n > ete kalau yuge bhavyah sampradaya-pravartakah \r\nsamvatsare vikramasya catvarah ksiti-pavanah\r\n\r\n > sampradaya-vihina ye mantraste nisphalah smritah \r\ntasmacca gamanang hyasti sampradaye narairapi\r\n\r\n > TRANSLATION\r\n > <PERSON>, <PERSON>, <PERSON> and <PERSON> will appear as brahmanas by the order of Visnu, for the preservation of eternal righteousness in kali yuga.\r\n\r\n > <PERSON>, <PERSON>, <PERSON> and <PERSON> will appear respectively as a portion of <PERSON>, <PERSON>, <PERSON> and <PERSON>.\r\n\r\n > These saviours will be the establishers of the four authorised and empowered spiritual channels of disciplic succession in the period calculated from the reign of King <PERSON> in 54 B.C. subsequently through the present era of kali yuga.\r\n\r\n > These four authorised and empowered spiritual channels of disciplic succession are to be fully accepted by all beings; as any word, combination of words or formulation of sounds frequencies, invoked or addressed, audible or inaudible, secret or revealed, ancient or contemporary, outside their auspices prove to have absolutely no efficacy.\r\n\r\n\r\nThe fact that they appeared \" ;by the order of <PERSON> \" ;, and the fact that only mantras taught in their Sampradayas have any effectiveness, clearly implies that what they taught was taught to them by <PERSON>.\r\n\r\n [1]: _URL_0_", "65" ], [ "According to Vishista advaita, individual atmas are many in number, and have a sarira-sariri relationship with the Supreme Brahman. (yasya atma sariram - To whom atma forms the body - Subala Upanishad/Brhadaranyaka Upanishad). The Supreme Lord is still advaita, i.e., one without a second, but what makes Him visishta is He is present along with the prakruti and atmas as His body. He is the sariri, or the possessor and the individual atmas and prakruti form His body (sarira). This relationship is called seshatva-jnanam, or knowledge of being the sesha (part) of the seshi (whole). \r\n\r\nThe prescribed techniques and modes of realizing seshatvam and sustaining this understanding are stated in the Bhagavad Gita. Two popular techniques for realizing this are karma yoga and jnana yoga, and of the two, <PERSON> favors karma yoga since it is more practical for one who is conditioned to work in a specific way. According to the karma yoga, one must perform one&#39;s prescribed duties according to the Vedic injunctions. Such performance should be devoid of three conceptions - that you are the proprietor (sanga), that you are the controller (kartrutva), and that you are the enjoyer of that work (phala). The work should be done simply as a worship of the Supreme Person with the understanding that the injunctions enjoined in the scriptures to different people are His will and by enacting His will, He will be pleased. By this, the Supreme Brahman will be pleased and He will free one from previous sins which stand in the way of sustaining this understanding. By such annulling of sins, one&#39;s mind becomes peaceful. Once the mind becomes peaceful, the senses will be controlled. In such a state of mind, it is possible to get to the stage of sthita-prajnata or sustained understanding of this relationship. (This is the essence of the second and third chapters of Bhagavad Gita). To develop further however, one must advance into bhakti yoga, for, only by bhakti one can reach the Supreme. There are also Sampradaya specific ways, for instance, just chanting certain mantras can help one realize this and sustain this understanding, and for knowing these, one should approach a Guru. Any other way of knowing these may not give good results.", "140" ], [ "OK, so here is a little more on the contents of my comment:\r\n\r\n 1. Regarding <PERSON> theory. The classical result is that if $X$ is a smooth projective variety (or if you like equivalently, a compact complex manifold that can be embedded into $\\mathbb P_{\\mathbb C}^n$ for some $n$), then for any $m\\in\\mathbb N$ one has a direct sum decomposition,\r\n$$\r\nH^m(X,\\mathbb C) \\simeq \\bigoplus_{p+q=m} H^q(X,\\Omega_X^p).\r\n$$\r\nIf $\\dim X=1$, then the relevant $m$&#39;s are $0,1,2$, and the only $p,q$ for which you get anything that&#39;s not obviously $0$ is $p,q=0,1$, so the only non-trivial information you get out of this is that \r\n$$\r\nH^1(X,\\mathbb C) \\simeq H^1(X,\\mathscr O_X) \\oplus H^0(X,\\omega_X).\r\n$$\r\nBy Serre duality the two spaces on the right are dual to each other and that&#39;s why you get that singular cohomology is essentially equivalent to coherent cohomology. \r\nIf $\\dim X > 1$, then you have more terms and more independent data which accounts for the defect of this \" ;equivalence \" ; in that case. \r\nIn any case, it should be easy to find references for <PERSON> theory which nowadays goes way further than what I mentioned above. If you just google the phrase you&#39;ll see the abundance. A very good reference is a couple of books written by [Voisin][1], though it is a bit tough, but it is just the nature of the subject. \r\n 2. Branched covers, or ramified covers. A recent, good reference for this is [Koll&#225;r&#39;s][2] book on singularities (see the link). It has a section called \" ;ramified covers \" ;, but this is also discussed at many places. The main idea is that if you have a divisor $D$ on $X$ such that some large multiple $aD$ has an effective representative which itself is smooth (e.g., if $D$ is ample), then taking a cover $f:Y\\to X$ ramified along this representative connects the cohomology of $Y$ to the cohmologies of the powers of $-D$. More precisely, what you get is that for any $i$\r\n$$\r\nH^i(Y,\\mathscr O_Y) \\simeq \\bigoplus_{j=0}^{a-1} H^i(X,\\mathscr O_X(-jD)).\r\n$$\r\nSo ultimately you get that the coherent cohomology groups of $\\mathscr O_X(-D)$ are direct summands of the singular cohomology of $Y$. So, there is indeed a link between these, but not as straightforward as in the curve case. \r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "737" ], [ "I would like to draw explicit attention to the fact that while animal sacrifices themselves may not be condemned according to the sutra, clearly most of the current day animal sacrifices are deficient in procedure, purity and purpose and are therefore unequivocally voiced brutal. When pure Brahmanas perform such sacrifices as Agnisomiya, no real violence is caused to the animal (Agnisomiyaadishu cha na himsa pasoh). The Yajur Veda (<IP_ADDRESS>) declares that the animal will pass through the happy paths to the realms of the demigods such as Savita, where the pious alone reach and not the sinful.", "140" ], [ "-1 May I mention that you are understanding these verses out of context. The context is \" ;doing one&#39;s enjoined duty \" ; vs \" ;giving up \" ;. <PERSON> was inclined to give up, and <PERSON> insists that even if one is qualified for jnana yoga ( a later stage of stable-mindedness), one should still perform one&#39;s duties so as not to lead common people (people not yet qualified for jnana yoga, but only qualified for karma yoga) astray from their duties. What then is the relation between doing one&#39;s duties and worshiping some random human? The duties here are referring to Varnasrama duties.", "140" ], [ "I have three fixes for this, with different results:\r\n\r\n 1. As I am in the USA, my phone number has been on the Do Not Call list as long as the list has existed. I used to get good results reporting callers, but I think all the call centers have moved out of the USA, so this is no longer effective.\r\n 2. As suggested in earlier responses \" ;Please hold \" ;, put the phone down, get on with life, and hang up about 5 minutes later. Reasonably effective.\r\n 3. The one that could completely solve the problem if more people used it: I keep a list of companies I am boycotting. Any business whose products or services are advertised during a cold call to me goes on the list for a year. During that period, I try very hard to avoid doing business with them **even if I was a customer before the call**. If more people did this, cold calling would result in a reduction in business, and companies would stop doing it.", "683" ], [ "[Europe PMC have been displaying it on the site since 2013][1]. Nature also started in 2013 - [click on <PERSON> in this article and you&#39;ll see his ORCID ID][2]. There are plenty of other examples out there, [Springer][3], [Wiley][4] etc etc.\r\n\r\nORCID adoption by journals is increasing day by day. Most major journals now accept it upon submission. [Many of the big publishers are on the board][5]. Many funders ask for it. [Wellcome mandates it.][6]\r\n\r\nSome publishers display ORCID IDs on their article pages or author pages, others have not yet got round to it. Even if they are not yet displaying it on their article pages, the ID is often propagated to Crossref or Datacite via DOI metadata. This helps discoverability and disambiguation and also allows for [auto updating of ORCID records][7].\r\n\r\n\r\n [1]: _URL_3_\r\n [2]: _URL_0_\r\n [3]: _URL_5_\r\n [4]: _URL_6_\r\n [5]: _URL_4_\r\n [6]: _URL_1_\r\n [7]: _URL_2_", "307" ], [ "The only limit is ability. I&#39;ve seen skaters who can do dozens and dozens of double toe-loops in a row. I myself have easily done combinations of five or six jumps, and I&#39;m not on championship level by far. But the harder to do the jump, the harder it is to chain it. The reason professional skaters don&#39;t do these combinations is because they won&#39;t get anything for them in competitions: Because of the rules they can only do two combinations of two jumps and one combination of three jumps in their programs, and there is a limited amount of total jumps in a program. If this limit didn&#39;t exist, skaters would just jump as many times as possible during the program and not do anything else to rack up their score, and thats not figure skating, thats endurance speed jumping.", "553" ], [ "The answer itself is this: on the ice you create rotation the same way you do on normal ground - by spinning yourself (by creating angular momentum). < br/ > \r\n\r\nEver heard of \" ;*an object in motion stays in motion*? \" ; That applies to angular momentum (rotation), too. It means that once you&#39;ve created rotation you&#39;ll keep spinning - until you create rotation in the opposite direction to stop it. < br/ > \r\n\r\nEverything in higher-level skating revolves around these physics, around creating, killing and handling momentum. That&#39;s how you skate in a curve - you just skate forward while possessing a controlled amount of angular momentum. The ability to to easily skate in curves and to control their radius is called edgework. < br/ > \r\n\r\nHow to create and manipulate this momentum? Free skating techniques, in essence, let you use your arms, shoulders, free leg, hips and torso rotation for this exact purpose by moving them in particular ways. It&#39;s a whole-body, whole-mind affair that is very complex and, in my experience, takes more than ten years to master. Not even all championship skaters have mastered it (jumps are more important for winning). < br/ > \r\n\r\nNow, I assume that what you want is not a curvy series of rockers and counters, but a simple curve, or, say, a little three-turn. Know how those trainers always tell you to hold your arms up? The reason for that is not aesthetic. Turn your outstretched arms left, complete with your shoulders, like you&#39;re a windmill facing up, and that&#39;ll create rotation left. Same for right. If you&#39;re wondering why high-level skaters don&#39;t hold their arms up all the time for things like three-turns: Their movements are much more efficient, so they can turn themselves using only their shoulders in an almost unnoticeable way.", "242" ], [ "Short answer: You don&#39;t need stretching to learn skating.\r\n\r\nYou don&#39;t need 180 degrees for a mohawk! That will not be a good mohawk and defies the reason for learning to do one. Figure skating doesn&#39;t work in straight lines, and that is the very thing beginning skaters have trouble learning and understanding. < br/ > \r\n\r\nFirst off all, mohawks are easiest when done on a circle. One of those big red hockey circles is perfect. Now make your foot turn into the circle just before changing feet. The trick is this: Your body moves evenly around the circle (it could go in a straight line for all it matters), but the feet make their own curves. Into the circle, out of it, in, out. Imagine a car that turns into a parking lot forwards and drives out backwards the other way. You should also watch your arms and shoulders - they shouldn&#39;t change orientation during the transition. It&#39;s also important to learn not to jump, to smoothly put down one leg and then lift the other.", "382" ], [ "It is an individual thing, but lack of discipline tends to be the problem most people can&#39;t overcome. To learn them quickly, you need to balance your schedule between \" ;as often as possible \" ; and \" ;getting lasting pain \" ; (injuries are bad!). That&#39;s about an hour or two per day for most beginners. Warming up helps preventing injuries, so don&#39;t get lazy on that. The longer you hold the splits, the better and faster the result. Tv, tablets, books are your best friends there.", "382" ], [ "It is hard to say - so many factors. Jumps aren&#39;t uniform, all trainers teach differently and all skaters jump differently, hence it&#39;s impossible to give precise numbers on a question like this. I&#39;ll try to answer according to the techniques that my trainer taught me and that I&#39;m teaching to my pupils.\r\n\r\nI&#39;d like to mention that I don&#39;t allow my pupils to think about pre-rotating on the ice at all. It misses the mark because it doesn&#39;t aid in learning the jump. Also, the answers given below are for single jumps done correctly, even expertly at high speeds - not the pre-rotation a beginner learning them or just having learned them can do or should try to do. \r\n\r\nWhy does pre-rotation on the ice occur at all? It is because all jumps are jumped in a circle, from an edge curving into the circle. The closer you get to the jump, the more rotation you create in preparation for it, and the stronger the edge curves, ending in a sort of hook before take off. That&#39;s where most of the *pre-rotation of the foot/skate* happens. Note that the torso may pre-rotate more than the foot, or even less, depending on the jump. The Lutz jump is the only exception - you skate in a circle/curve the other way than you are going to rotate, and pre-rotating the foot/skate on the ice is impossible. Unless you&#39;re doing it wrong.\r\n\r\nIn a salchow, the left foot usually leaves the ice 1/4 into the first revolution, still on its edge (*not* on its toepick) with the shoulders having done 1/2 and already facing forwards.\r\n\r\nThe toeloop is the most pre-rotated jump of all. The right foot can be as far as 1/3 into the turn, though still skating backwards, as it leaves the ice. The shoulders are about 1/2 into the turn ad facing forwards when the left toepick leaves the ice. Many beginners learn the toeloop as a waltz jump from the toe pick, that&#39;s wrong. The toe pick should only leave the ice after the right foot has skated (not swung) past it.\r\n\r\nNow to your loop. The right foot leaves the ice about 1/5 to 1/4 into the turn. But here&#39;s the thing: the torso and hips are actually under-rotated, still facing at most forwards at take off! You did have your shoulders face into the circle before jumping, right? As to helping you do this, it&#39;s all about the curved edge you&#39;re skating on. It&#39;s probably too straight. Making their circle smaller often helps beginners.\r\n\r\nThe flip is the \" ;straightest \" ; of the jumps. The left foot leaves the ice almost completely backwards, at the very most 1/8 into the turn. The right toepick will turn some more, perhaps 1/4 of a revolution. The shoulders will be between backwards and 1/8.\r\n\r\nNow the Lutz is a complete anomaly. It&#39;s very different. Beginners might first stand on their right foot and then do a loop from there, resulting in pre-rotation, but in a real lutz, where the left leg on the edge does the jumping, there is no pre-rotation. Quite the opposite: the left leg leaves the ice up to 1/8 *under*-rotated because of the edge curve turning in the other direction than the rotation of the jump. The shoulders will still face forwards at take off. The right toepick might get 1/8 into the turn before it gets off the ice, but still: In a single lutz you actually have to do the entire revolution, usually even more, in the air.", "1010" ], [ "Take an arbitrary surface which has lots of non-nef effective curves. In particular, take one that has two non-nef effective curves on \" ;opposite \" ; sides of the cone of effective curves. Then some linear combination of these two curves will lie in the interior of the cone and will be ample.\r\n\r\nIn particular, take a K3 surface with at least 2 smooth rational curves on it. This will satisfy the above condition.\r\n\r\nFor an explicit example take a general quartic surface in $\\mathbb P^3$ that contains a (smooth) plane conic. It is relatively easy to see that the intersection of this quartic with the plane containing the given conic is the union of two smooth conics (the original and another one), so you have two $(-2)$-curves whose sum is the hyperplane class of this embedding to $\\mathbb P^3$. Voil&#224;.", "59" ], [ "It&#39;s important to look at the terms of your sequence for large $k$&#39;s. If you can bound the terms e.g. by a geometric sequence, like $a_k \\leq C q^k$, with some $q < 1$, you know that your sequence converges. Now, you know that the factorial grows faster than any exponential, so you can bound it e.g. by $C_1 4^k > k!$ for large enough $k$. Further, you can omit the additional terms $+k$ and $+2$ in the numerator and denominator (why?). So, in the end you can bound the term by something like $a_k \\leq C_2 (3/4)^k$, which show you that the series will converge.\r\n\r\nI left out some of the details, but I think you can work them out yourself. BTW, of course, you could replace the 4 in the argument above with any other real number strictly larger than 3. That just changes a little bit the constant involved.", "543" ], [ "Way no. \r\n\r\nJust take a degree $d$ hypersurface in ordinary projective space: $X\\subset \\mathbb P^n$. Then $$\\Omega_X^{\\dim X}(\\dim X)=\\omega_X(n-1)\\simeq \\mathscr O_X(d-2),$$ so as soon as $d\\geq 2$, i.e., it&#39;s not a projective space itself, then this sheaf will have non-zero global sections. If you increase the degree you will start to see sections of other $\\Omega_X^q(q)$&#39;s. The best you can hope for is a statement such that depending on the degree of the defining equations you might get some vanishing in some range of $q$&#39;s.", "1" ], [ "Any $(-2)$-curve on a K3 surface can be contracted and the corresponding divisor is globally generated (hence nef) and big: Let $C$ be the $(-2)$-curve and $A$ an arbitrary ample divisor. Then \r\n$$D=2A+(A\\cdot C)C$$\r\nis a nef and big divisor. It&#39;s big, because it is (ample)+(effective) and it is nef, because it could potentially be not nef only on $C$ (any irreducible curve with a different support will intersect $A$ positively and $C$ non-negatively) and \r\n$$ D\\cdot C= 2A\\cdot C + (A\\cdot C)(-2) =0 .$$\r\n\r\nThis also shows that an appropriate multiple of $D$ defines a birational morphism that contracts $C$ and nothing else. \r\n\r\nOn the other hand, if the K3 surface does not contain any $(-2)$-curves, then every effective curve has non-negative self-intersection. Those with self-intersection $0$ define an elliptic fibration and those with positive self-intersection are ample. This implies that any nef and big divisor is ample. So we obtain:\r\n\r\n > **Claim** A K3 surface admits a nef and big but not ample divisor if and only if it contains a smooth rational curve.", "737" ], [ "> > **Lemma** Let $\\alpha: \\mathscr F\\hookrightarrow \\mathscr G$ be an injection of $\\mathscr O_Y$-modules such that \r\n > > \r\n - $Y$ is normal,\r\n - $\\alpha$ is an isomorphism in codimension $1$, \r\n - $\\mathscr F$ is reflexive, and\r\n - $\\mathscr G$ is torsion-free.\r\n > > \r\nThen $\\alpha$ is an isomorphism.\r\n\r\n**Proof:** Since $\\mathscr G$ is torsion-free, it embeds into its reflexive hull: $\\mathscr G\\hookrightarrow \\mathscr G^{**}$. Since $Y$ is normal, a reflexive sheaf is determined by its restriction to any big open set (i.e., one with a codimension $2$ complement). This and the rest of the conditions imply that the composition $\\mathscr F\\hookrightarrow \\mathscr G\\hookrightarrow \\mathscr G^{**}$ is an isomorphism, but then so is $\\alpha$. $\\square$ \r\n\r\n\r\n**Note** Actually, somewhat less than $Y$ being normal is enough...", "1" ], [ "There are definitely some typos in that proof, but for your question you may assume that $S=\\{s\\}$ which will take care most of them.\r\n\r\nIf you write down the restriction of differential forms sequence (the dual of the normal bundle sequence) for both $\\Gamma\\subset X$ and $\\Gamma&#39;\\subset X&#39;$ and compare them, then you get the following short exact sequence:\r\n$$\r\n0\\to \\gamma^*(I/I^2) \\to \\gamma&#39;^*(I&#39;/I&#39;^2) \\to \\gamma&#39;^*\\left(\\Omega_{X&#39;/X}\\right)\\to 0 \r\n$$\r\n\r\n$\\Omega_{X&#39;/X}$ is explicitly computable (HW!), but you only need that it is a rank $r=\\dim X-1=\\mathrm{codim}(\\Gamma, X)=\\mathrm{rank}(\\gamma^*(I/I^2))$ vector bundle on the exceptional divisor of $X&#39;\\to X$. So, this pull-back is a (sort of) skyscraper sheaf $k^{\\oplus r}$ sitting at the intersection of $\\Gamma&#39;$ with that exceptional divisor. Comparing this to the short exact sequence above shows that the first sheaf is just the ideal sheaf of this intersection times the second sheaf.\r\n\r\nAt this point one can also answer the question in your last sentence. There are some more typos in the proof. As you can see what we get is not exactly what is claimed, but rather that \r\n$$\r\n\\gamma&#39;^*(I&#39;/I^{&#39;2})\\simeq \\gamma^*(I/I^2)\\otimes \\mathcal{O}_{C_s}(p(s))\\simeq f_s^*\\Omega_{Y_s}\\otimes I_{B_s}^*.\r\n$$\r\nHence when at the end you take the dual you do get what is claimed in the statement of the theorem, so the world is back to order.", "278" ], [ "Let&#39;s think about this...\r\n\r\nTo get out of the issue raised by *<PERSON>*, let us assume that $f\\in R[x]\\setminus R$.\r\n\r\nNext let $\\mathfrak m\\subset R$ be an ideal and consider $I=\\mathfrak m+(f)\\subset R[x]$ and observe that $R[x]/I\\simeq (R/\\mathfrak m)[x]/\\left(\\bar f\\right)$, so if $\\mathfrak m$ is a maximal ideal in $R$, then the maximal ideals in $R[x]$ containing $\\mathfrak m$ and $f$ are exactly those corresponding to maximal ideals of $(R/\\mathfrak m)[x]$ containing $f$, so this is the case covered in the question.\r\n\r\nNext let&#39;s consider a maximal ideal $\\mathfrak M\\subset R[x]$ and let $\\mathfrak m=\\mathfrak M\\cap R$. In order to get some traction, we&#39;d like this to be maximal, so let&#39;s assume that $R$ is a *<PERSON> ring*. (Finitely generated algebras over a <PERSON> ring are also <PERSON>, and so are fields, and $\\mathbb Z$, so many of the most obvious rings are such.) In that case $\\mathfrak m$ is also a maximal ideal and we&#39;re winning. Obviously, if $\\mathfrak M$ contains $f$, then it also contains $\\mathfrak m+ (f)$, so we&#39;re in the situation described above.\r\n\r\nSo we can conclude the following:\r\n\r\n > > **Claim:** Let $R$ be a <PERSON> ring and $f\\in R[x]\\setminus R$. Then the maximal ideals $\\mathfrak M$ of $R[x]$ containing $f$ are exactly those for which the image of $\\mathfrak M$ in $\\left(R/(\\mathfrak M\\cap R)\\right)[x]$ is generated by a prime factor of the image of $f$ in that ring. \r\n\r\n**Note:** \r\n\r\n 1. I don&#39;t think one can say more than this.\r\n 2. One can get a similar description without the *Jacobson* assumption, assuming instead that $R$ has finite Krull dimension and using the above process to give a recursive description of these ideals based on the dimension.", "967" ], [ "James Hastings&#39; (ed), *[Dictionary of of Christ and the Gospels][hd]* (1906) says the following:\r\n\r\n > TALITHA CUMI (for Greek ταλιθὰ κούμι, which, in turn, is a transliteration of the Aram. Aramaic טְלִיחָא קוּמִי ‘Maiden, arise’).—The words occur in Mark 5:41, and were uttered by our <PERSON> over the daughter of the Jewish ruler, <PERSON>. The Aram. Aramaic noun is טַלַי = ‘lamb.’ This has its emphatic form, masc. טַלְיְתִא, fem. טַלְיְתָא; or, according to the analogy of <PERSON>. Aramaic preserved in the ̣̣̣Peshitta, טְלְיחָא. It is interesting to note that in Palestinian Aram. Aramaic the word טְלֵי passes from meaning ‘lamb’ to being a term of endearment for a ‘child.’ We thus reproduce the words of <PERSON> accurately, if we render them, ‘<PERSON>, arise.’ In the Gr. of Mark 5:41 the Aram. Aramaic words are translated τὸ κοράσιον, ἔγειρε. The ‘articular nominative’ is in NT used sixty times for the vocative case (<PERSON>, Gram. of NT Gr. p. 70). In Luke 8:54 we have ἡ παῖς, ἔγειρε. \\[J.T. Marshall\\]\r\n\r\nMany sources I&#39;ve read online seem to suggest that <PERSON> is calling the girl **lamb** or **pet lamb**, which is a term of endearment. Mark&#39;s interprets the term of endearment to actually refer to the little girl. It&#39;s not a literal translation, but it gets to the actual meaning of what <PERSON> said.\r\n\r\n[hd]: _URL_0_", "508" ], [ "In Acts 9:1-22, we see Paul&#39;s conversion and his subsequent ministry in Damascus. In Acts 9:23, the ESV says, \r\n\r\n > When many days had passed, the Jews plotted to kill him. \r\n\r\nAfter this, <PERSON> escaped and went to Jerusalem.\r\n\r\nThere seems to be general agreement between scholars (at least according to <PERSON> and the editors of the ESV Study Bible and Reformation Study Bible) that Paul&#39;s visit to Jerusalem in Acts 9:26 is the same event <PERSON> speaks of in Galatians 1:18. However, Galatians 1:18 says that this occurred three years after his conversion.\r\n\r\nTherefore, my question is, can the Greek for \" ;many day \" ;s (ἡμέραι ἱκαναί) represent three years of time? Does the expression in Greek have that kind of connotation?", "719" ], [ "Indeed, this condition is equivalent to $C$ being CM (Regardless of $X$ as long as it is also CM). This \" ;dual \" ; is called the $\\omega$-dual in [Kol13][1]. You might be interested in reading section 2.5, or just the part directly dealing with this on pp.80-83. In particular, the statement you need is Cor. 2.70. Furthermore, if $X$ is not necessarily CM, then you get the same result using the dualizing complex instead of the dualizing sheaf.\r\n\r\nAs *<PERSON>* points out, the first dual will only be isomorphic to $\\mathscr O$ if its own dualizing sheaf is trivial. Then again, why would you want that? That&#39;s a freak accident and doesn&#39;t give you too much mileage. Reflexivity is a (or \" ;the \" ;) natural condition.\r\n\r\n\r\n [1]: _URL_0_", "1" ], [ "I don&#39;t know what you mean by \" ;the cycle $f^{-1}(D)\\subset Y$ \" ; (and not just because $f^{-1}(D)\\subset X$), but for your question you don&#39;t need it to be a \" ;cycle \" ;, so let&#39;s just assume you want the set. \r\n\r\nThe answer depends on $f:X\\to Y$. For instance, if $X=X_1\\cup X_2$ where $X_i$ are irreducible and closed in $X$, $Y=Y_1\\cup Y_2$ where $Y_i$ are irreducible and closed in $Y$, $Y_1\\cap Y_2=\\{P\\}$ is a single point, $f_1=f|_{X_1}: X_1\\to Y_1$ is the blowing-up of $Y_1$ at $P$, \r\n$f_2=f|_{X_2}: X_2\\to Y_2$ is the blowing-up of $Y_2$ at a subvariety of dimension $d$ contained in $Y_2$ and containing $P$, and \r\nthen if $D\\subset Y_1$ is a divisor which contains $P$, then $f^{-1}(D)$ will be a divisor on $X_1$, but will have dimension $\\dim Y_2-d$ on $X_2$. So, even assuming that $Y$ is equidimensional $f^{-1}(D)$ might have different dimensional irreducible components. \r\n\r\nSo perhaps you&#39;d want to assume that $X$ and $Y$ are irreducible, but I think even then you can get funny behaviour. Let $f:X\\to Y$ be a small morphism, for example contracting a single curve on a threefold. Since your $X$ and $Y$ are projective, so is $f$ and let $H$ be a relatively very ample divisor that does not contain the entire special fiber (for simplicity let&#39;s assume that $f$ has only one non-trivial fiber) and let $D=f(H)$. Then $f^{-1}(D)=H\\cup \\text{special fiber}$, so again you can have irreducible components of (almost) arbitrary dimension.\r\n\r\nOne case when $f^{-1}(D)$ has only codimension $1$ components is if $D$ is a $\\mathbb Q$-Cartier divisor.", "1" ], [ "I would like to use a custom text search configuration with `tsvector_update_trigger` to be able to update tsv field with french dictionary and `unaccent`.\r\n\r\nSo I did that :\r\n\r\n CREATE TEXT SEARCH CONFIGURATION fr ( COPY = french );\r\n ALTER TEXT SEARCH CONFIGURATION fr ALTER MAPPING FOR hword, hword_part, word WITH unaccent, french_stem;\r\n\r\nand then created trigger :\r\n\r\n CREATE TRIGGER TS_tsv BEFORE INSERT OR UPDATE ON books FOR EACH ROW EXECUTE PROCEDURE tsvector_update_trigger(tsv, &#39;pg_catalog.fr&#39;, title, authors, descriptionText);\r\n\r\nbut unfortunately when I want to create or update a row I get an error telling me that fr does not exist.\r\n\r\nHow I can use this configuration with a trigger ?", "310" ], [ "Actually, I think that the phenomenon <PERSON> is describing is very much due to using a finite morphism, so there is something intelligent one could say about this.\r\n\r\nOf course, as stated there is no chance that simply assuming something nice about $f$ would induce the desired result, because $f_*L$ could easily be zero. So one needs to assume something about $L$ as well. \r\n\r\nSo we probably need something like $L$ is \" ;sufficiently ample \" ;. Once we allow that then experience shows that it is usually more tractable if we can compare our bundle to the canonical bundle. In other words, let us write $L=\\omega_{X/S}\\otimes M$ for some $\\mathbb Q$-line bundle $M$ (so in particular assume that $\\omega_{X/S}$ is a $\\mathbb Q$-line bundle).\r\n\r\nFor simplicity let us assume that $M$ is actually a line bundle, which is the case if $f$ is a <PERSON> morphism, so in particular if $X$ and $S$ are non-singular.\r\n\r\nNow if $M$ is very ample (or in characteristic zero generated by global sections) then Let $D$ be the zero locus of a general section of $M$. This will not be much more singular than $X$ is, for instance if $X$ is smooth, then so is $D$. If, say, $X$ has no worse than canonical singularities, then $(X,D)$ is log canonical and by the assumption that $L$ is ample and assuming that $f$ is flat with connected fibers it follows that $f$ is a family of stable log varieties and it should also follow that it has maximal variation in moduli. \r\n\r\nUnder these conditions it follows that $\\det (f_*L^q)$ is big by 7.1 of [arxiv:1503.02952][1]. Since the conditions survive after restricting to any closed subvariety of the base, this implies that it is actually ample. \r\n\r\nOne could make this a little more general by allowing more singularities, but the spirit would remain the same.\r\nI suppose this might seem far from what you asked for, but I doubt that one can have a much more general statement than this.\r\nOne could say that since there are many theorems that say that certain push-forwards are ample or big, this is likely a hard problem, although, truth be told, those theorems usually do not assume that $L$ is ample, but, say that it is $f$-ample. In that case without additional assumption, such as a relation to the relative canonical sheaf, there is clearly no chance for anything like this to be true (think if Mohan&#39;s example and make $B$ very negative). \r\n\r\n\r\n [1]: _URL_0_", "209" ], [ "Since $S$ is finite, $X$ being projective is a red herring, so is anything about the (global) cohomology of $\\mathscr O_X$, and \r\n(to some extent) it being a surface, or regular.\r\n\r\nIf $X$ is $S_2$, and $\\dim X\\geq 2$, then the sheaf version of Exercise III.2.3 in [Hartshorne] (or the exercise itself noting that by $S$ being finite one may start with restricting to affine schemes) implies that there is a long exact sequence\r\n$$\r\n0\\to \\mathscr H_S^0(\\mathscr O_X) \\to \\mathscr O_X \\to j_*\\mathscr O_{X\\setminus S} \\to \\mathscr H_S^1(\\mathscr O_X) \\to \\\\ \\to \\mathscr H_{\\emptyset}^1(\\mathscr O_X) \\to R^1j_*\\mathscr O_{X\\setminus S} \\to \\mathscr H_S^2(\\mathscr O_X) \\to \\mathscr H_{\\emptyset}^2(\\mathscr O_X) \\to \\dots\r\n$$\r\nSince $X$ is $S_2$, $\\mathscr H_S^0(\\mathscr O_X) =\\mathscr H_S^1(\\mathscr O_X) =0$ and $\\mathscr H_{\\emptyset}^i(\\mathscr O_X) =0$ for all $i > 0$, so this falls apart to the isomorphisms\r\n$$\r\nj_*\\mathscr O_{X\\setminus S}\\simeq \\mathscr O_X\r\n$$\r\nand\r\n$$\r\nR^ij_*\\mathscr O_{X\\setminus S} \\to \\mathscr H_S^{i+1}(\\mathscr O_X)\r\n$$\r\nfor all $i > 0$. (In particular $R^ij_*\\mathscr O_{X\\setminus S}$ is supported on $S$). \r\nSince $S$ is finite, $R^ij_*\\mathscr O_{X\\setminus S}$ is the sheaf associated ot its own global sections, in particular $R^ij_*\\mathscr O_{X\\setminus S}\\neq 0$ if and only if $H^0(X,R^ij_*\\mathscr O_{X\\setminus S})\\neq 0$. \r\n\r\nBy <PERSON> vanishing $H_x^{d}(\\mathscr O_X)\\neq 0$ for $d=\\dim \\mathscr O_{X,x}$ for any $x\\in X$, which shows that if $\\dim X=d$ near $S$ (e.g., $X$ is equidimensional, or at least that the dimension of the union of irreducible components of $X$ containing $S$ is $d$), then $H^0(X,R^{d-1}j_*\\mathscr O_{X\\setminus S})\\neq 0$.", "1" ], [ "You should really make this question more clear. What do you mean by a \" ;partial resolution \" ;? For instance, is it normal, or at least $S_2$? \r\nIs it $\\mathbb Q$-factorial? Or is at least the canonical divisor $\\mathbb Q$-Cartier? You need some assumption for the question to make sense.\r\n\r\n---\r\n\r\nConsider the crepant resolution $\\pi:Y\\to X$. (By the way if a surface has a crepant resolution it must be the minimal resolution and hence it is unique). Next, let&#39;s blow up a point on a $\\pi$-exceptional curve $E\\subset Y$ (say one that&#39;s not contained in any other exceptional curves) $\\sigma: Z\\to Y$. Now $Z$ is smooth and $F=\\sigma^{-1}_*E$ has self-intersection $F^2=-3$ and $F\\simeq \\mathbb P^1$, so it can be contracted to a normal surface $Z\\to W$. By construction we get a proper birational morphism $W\\to X$. This is a partial resolution, but it is not crepant. \r\n\r\n---\r\n\r\nSo, perhaps you mean a partial resolution that&#39;s partial to the crepant resolution. I mean that it is an intermediate partial resolution. That kind of partial resolutions are also crepant by the following Lemma (but let&#39;s do a definition first).\r\n\r\n > **Definition** Let $\\alpha:X\\to Y$ be a proper birational morphism between normal varieties. Assume that $K_Y$ is $\\mathbb Q$-Cartier, then $\\alpha$ will be called *crepant* if $K_X\\sim \\alpha^* K_Y$.\r\n\r\n-\r\n\r\n > **Lemma** Let $\\alpha:X\\to Y$ and $\\beta:Y\\to Z$ be two proper birational morphisms and assume that $X,Y,Z$ are normal algebraic surfaces such that $K_Y$ and $K_Z$ are $\\mathbb Q$-Cartier. then if $\\beta\\circ\\alpha$ is crepant, then so are $\\alpha$ and $\\beta$.\r\n\r\n\r\n\r\n**Proof:** \r\nWrite $$K_X=\\alpha^*K_Y+\\sum a_iE_i$$ where $E_i$ are $\\alpha$-exceptional irreducible divisors and $$K_Y=\\beta^*K_Z+\\sum b_jF_j$$ where $F_j$ are $\\beta$-exceptional irreducible divisors. It follows that then \r\n$$K_X=\\alpha^*\\beta^*K_Z+\\sum a_iE_i+\\sum b_j\\alpha^* F_j.$$\r\nIf $\\beta\\circ\\alpha$ is crepant, then $$\\sum a_iE_i+\\sum b_j\\alpha^* F_j\\sim 0.$$\r\nHowever, for each $j$, we have that $\\alpha^*F_j= \\widetilde F_j +\\sum a_{ij}E_i$ where $\\widetilde F_j$ is the strict transform of $F_j$ on $X$, so we get that for some other set of coefficients we have\r\n$$\\sum c_iE_i+\\sum b_j\\widetilde F_j\\sim 0.$$\r\nThe $E_i$ and $\\widetilde F_j$ together are all $\\beta\\circ\\alpha$ exceptional and hence linearly independent. Therefore $b_j=0$ for all $j$ and then \r\n$$\\sum a_iE_i\\sim 0$$\r\nwith the original $a_i$&#39;s. The same reasoning says that then the $a_i=0$ which proves the statement.$\\square$\r\n\r\n > **Remark** \r\nIt seems to me that the same proof works in arbitrary dimension, so one does not need to limit to surfaces for the Lemma.", "1" ], [ "**EDIT:** *I&#39;ve just realized that this holds under somewhat weaker assumptions. It is not necessary that the fibers of $g$ are connected.*\r\n**EDIT#2:** *Apparently, in my previous edit I weakened the conditions too far... properness of $g$ is back as it is needed, but connectivity of fibers is not as it is not. I think it is OK now. :)* \r\n\r\nCool question. Actually, I think this is true! \r\n\r\n > **Generalized Rigidity Lemma** Let $X,Y,Z$ be (irreducible) varieties, $f:X\\rightarrow Y$ a morphism and $g:X\\rightarrow Z$ a surjective proper morphism whose fibers are of the same dimension $n$. Then \r\n$f(g^{-1}(z))\\subseteq Y$ has the same dimension for any $z\\in Z$.\r\n\r\n*Proof* [This proof is inspired by the proof of the original Rigidity Lemma given in[ \\[Koll&#225;r-Mori][1], 1.6]]\r\nLet $z_0\\in Z$ and $k=\\dim f(g^{-1}(z_0))$. Further let $W=\\mathrm{im}(f\\times g)\\subseteq Y\\times Z$ with projection $p:W\\to Z$. Let $h=f\\times g: X\\to W$.\r\nNotice that since $g$ is proper, and $g=p\\circ h$, so $h$ is also proper and hence $W=\\mathrm{im}\\, h\\subseteq Y\\times Z$ is closed and so it is a variety. \r\n Then for all $z\\in Z$, $p^{-1}(z)=h(g^{-1}(z))$ and hence $\\dim p^{-1}(z_0)=k$. By semi-continuity of fiber dimension there exists a non-empty open set $z_0\\in U\\subseteq Z$ such that for all $z\\in U$ $\\dim p^{-1}(z_0)\\leq k$. \r\n\r\nThis implies that $p^{-1}U\\subseteq W$ is a non-empty open set (in fact, since $g$ is surjective, this is dense) such that for all $w\\in p^{-1}U$, $\\dim h^{-1}(w)\\geq n- k$. However, then by semi-continuity of fiber dimension again the same is true for all $w\\in W$. \r\n\r\nNow fix a $z\\in Z$ and consider the morphism $h:g^{-1}(z)\\to p^{-1}(z)$. By assumption $g^{-1}(z)$ is $n$-dimensional and we have just observed that the fibers of this map have dimension at least $n-k$, so the image has dimension at most $k$.\r\n\r\nIn other words, we proved that for any $z\\in Z$, $\\dim h(g^{-1}(z))\\leq k$. Finally, observe that if there was a $z_1\\in Z$ for which $\\dim h(g^{-1}(z_1)) < k$, then by repeating the same proof with $z_0$ and $z_1$ exchanged we would get that for any $z\\in Z$, $\\dim h(g^{-1}(z)) < k$, but this would contradict the assumption that $\\dim h(g^{-1}(z_0))= k$. Therefore we must have equality for every $z\\in Z$. $\\square$\r\n\r\n\r\n\r\n [1]: _URL_0_", "1" ], [ "@FedorPetrov: I don&#39;t think that&#39;s what He means. It sounds more like thinking of the curve as we usually draw one: there is a point where we start drawing and there is one where we end. Those are the two sides. If they meet, the curve \" ;comes back to itself \" ; if they don&#39;t, then you could keep continuing with drawing in either direction= \" ;both sides \" ;.\n\nBy the way, this sounds like an argument over the reals. Over the complex numbers every algebraic curve \" ;goes to infinity \" ;....", "367" ], [ "*Edited after Mark&#39;s comment. Also after ACL&#39;s comment. Cheers.*\r\n\r\nTake a resolution $g:Y\\to X$ and \r\nlet $Y&#39;=X\\times_{f,g} Y$ with projection maps $f&#39;:Y&#39;\\to Y$ and $g&#39;:Y&#39;\\to X$. Next let $Y&#39;&#39;=X\\times_{f^{-1},g&#39;} Y&#39;$ with projection maps $f&#39;&#39;:Y&#39;&#39;\\to Y&#39;$ and $g&#39;&#39;:Y&#39;&#39;\\to X$ and $Y&#39;&#39;&#39;=X\\times_{f,g&#39;&#39;} Y&#39;&#39;$ with projection maps $f&#39;&#39;&#39;:Y&#39;&#39;&#39;\\to Y&#39;&#39;$ and $g&#39;&#39;&#39;:Y&#39;&#39;&#39;\\to X$.\r\n\r\nObserve that $Y&#39;&#39;=X\\times_{f^{-1},g&#39;} Y&#39;= X\\times_{f^{-1},g&#39;}(X\\times_{f,g} Y)\\simeq X\\times_{\\mathrm{id}_X ,g}Y\\simeq Y$ where the last isomorphism is given by $f&#39;\\circ f&#39;&#39;$ and also, clearly, $g&#39;&#39;=g$.\r\nSimilarly $Y&#39;&#39;&#39;=X\\times_{f,g&#39;&#39;} Y&#39;&#39;\\simeq X\\times_{f,g&#39;}(X\\times_{f^{-1},g} Y&#39;)\\simeq X\\times_{\\mathrm{id}_X ,g&#39;}Y&#39;\\simeq Y&#39;$ where the last isomorphism is given by $f&#39;&#39;\\circ f&#39;&#39;&#39;$ and also, clearly, $g&#39;&#39;&#39;=g&#39;$ and then $f&#39;&#39;&#39;=f&#39;$.\r\n\r\nSo we get that for an arbitrary resolution $g:Y\\to X$ there is another resolution $g&#39;:Y&#39;\\to X$ such that $f&#39;:Y&#39;\\to Y$ is an isomorphism with inverse $f&#39;&#39;:Y\\to Y&#39;&#39;$.\r\n\r\nNow if we choose $g:Y\\to X$ to be a functorial resolution of $X$ (as in 3.4 of [Koll&#225;r&#39;s book][1]), then it follows that $g&#39;=g$ and so $f&#39;$ is the required lift. Functorial resolutions exist by 3.36 of [Koll&#225;r&#39;s book][1].\r\n\r\n\r\n [1]: _URL_0_", "1" ], [ "Come on, *ACL*, this is not an article, you can&#39;t possibly expect me to properly attribute every single notion in an MO answer. The question was not \" ;Who came up with this idea first? \" ;. When I write [reference] I mean that you can click on it, it tells you a place where it is stated. I thought it was useful to tell people what I actually mean by that word. I didn&#39;t say the result was Koll&#225;r&#39;s just that it can be found in that book.", "541" ] ]
427
[ 1073, 8307, 12999, 7742, 16740, 17422, 12012, 14576, 16111, 6016, 14076, 1247, 13194, 16015, 5012, 8465, 4767, 6405, 8653, 8080, 13875, 10991, 4831, 4454, 10260, 4300, 16060, 12050, 3602, 15665, 12328, 782, 18759, 22, 6562, 11301, 2704, 9956, 1857, 1848, 18463, 1462, 15163, 1250, 11539, 2878, 539, 17366, 14764, 11435, 17019, 7892, 2400, 8076, 12492, 4623, 8863, 979, 7058, 1340, 8544, 9016, 8057, 8362, 19060, 8701, 19616, 17613, 6231, 6198, 19517, 11663, 6810, 7480, 8940, 16420, 2990, 1053, 6457, 7440, 15203, 1945, 7520, 6004, 17429, 3173, 18769, 628, 18398, 19421, 16116, 16066, 883, 13107, 17452, 11947, 17031, 3087, 7579, 7800, 5599, 6182, 2335, 5135, 3822, 7258, 7021, 3558, 16379, 16489, 15934, 4616, 5614, 9121, 6362, 1827, 3552, 105, 8725, 6271, 1177, 16067, 6841, 4847, 7026, 12415, 19343, 2093, 6849, 3412, 12758, 18789, 3132, 12789, 6945, 2566, 3903, 7356, 4043, 3684, 4955, 18624, 6116, 16955, 10046, 18961, 18140, 4908, 15708, 12685, 15400, 4883, 3620, 6355, 1101, 8489, 3462, 6575, 3453, 7379, 7453, 8928, 11085, 12137, 386, 11010, 18878, 15556, 3115, 8264, 9885, 9133, 2991, 462, 18805, 7696, 7338, 7466, 7776, 451, 8494, 16500, 4690, 2282, 7594, 19563, 10670, 13103, 7397, 4636, 12059, 378, 19117, 7217, 17494, 6459, 19648, 17993, 11638, 9238, 3388, 10223, 3415, 2036, 7000, 18112, 8458, 8597, 17504, 8044, 15896, 19604, 5371, 1679, 5910, 1946, 9243, 445, 5344, 5418, 12182, 9653, 4504, 8738, 8434, 7761, 17738, 420, 11275, 8825, 4173, 9950, 3060, 4110, 16569, 11914, 332, 4686, 17377, 858, 15603, 840, 6943, 13812, 10932, 7926, 19533, 16037, 4877, 3706, 10079, 8344, 6510, 7102, 12649, 4509, 2589, 3993, 7491, 18970, 11586, 11615, 17088, 923, 17410, 5576, 1667, 2929, 7231, 6485, 8481, 4759, 10121, 4766, 8491, 6054, 2966, 5824, 19326, 655, 3250, 7791, 2514, 9061, 1815, 12129, 16729, 18379, 14887, 17969, 15855, 16112, 8059, 17339, 4053, 6354, 13197, 11121, 3447, 8386, 3783, 1554, 4513, 9480, 6218, 18853, 18066, 8593, 2475, 7432, 5241, 15590, 2089, 3467, 9564, 7988, 17359, 15423, 6098, 18359, 19512, 17229, 740, 8431, 13519, 3239, 1401, 4066, 15933, 9164, 9268, 18577, 16918, 8361, 6028, 10358, 5415, 6392, 773, 4160, 4828, 966, 4153, 5532, 3445, 5002, 13525, 10688, 14082, 17546, 3163, 3035, 9224, 16134, 7459, 18344, 6237, 7084, 8016, 3769, 17221, 872, 19300, 11326, 19651, 12127, 4654, 9697, 1149, 2463, 5738, 9439, 10961, 6345, 7108, 9211, 16770, 1467, 5952, 19373, 6390, 2105, 790, 8703, 10363, 3131, 16129, 10154, 8746, 5540, 7135, 4054, 8939, 8934, 18286, 13157, 8064, 7296, 8303, 812, 8805, 8109, 8128, 12150, 8755, 1722, 12142, 11962, 558, 890, 5854, 15819, 2839, 1312, 8430, 16677, 704, 7124, 14272, 10842, 15861, 18994, 5931, 1854, 8831, 4467, 16665, 2030, 11157, 16585, 7952, 397, 9102, 18138, 12766, 7912, 6880, 712, 3142, 7029, 2908, 7552, 1687, 2874, 6480, 13514, 9076, 11699, 14193, 18891, 1711, 1447, 8360, 7008, 3949, 8632, 13771, 5572, 16317, 19411, 11784, 8873, 14125, 5856, 14937, 4162, 9886, 6324, 8714, 10623, 928, 7309, 7318, 17946, 3589, 2179, 5908, 9856, 2885, 7843, 1517, 14814, 1161, 10806, 5124, 6558, 8454, 5659, 17165, 3423, 12140, 5176, 8791, 5311, 855, 12987, 7722, 17028, 11769 ]
STX_10076557.0
[ [ "I added some comments in my answer. Basically the flow is: firstVC perform a segue to secondVC, in prepareForSegue you want to check if the id matches that segue (you could have more than one segues) and you want to check if the destination is kind of secondVC. If it is so, then you want to set some property of your destinationVC. Let me know if my answer helped you!", "246" ], [ "Just to clarify:\r\n\r\n - **Parameter**: \r\n \r\n\r\n mealTime: String\r\n\r\nThis string could be a key in your dictionary.\r\n\r\n - **Function** (how it works): this function wants to check if this key exists and if it is so, it returns the value (that is a Meal object).\r\n\r\n - **What did you do?**\r\n\r\n \r\n if let a = meals[mealTime] {\r\n return a\r\n } else {\r\n return nil\r\n }\r\n\r\nYou are checking (if let) if there is a value with that string key and you are assigning that value to your constant (a). Eventually you return that value. If no value has that key in your array then you return nil.\r\n\r\n\r\n - **What is the right answer about**?\r\n\r\nBecause this function returns an Optional Meal, you can skip checking if it exists, that&#39;s why the right answer is just:\r\n\r\n func logging(mealTime: String) - > Meal? {\r\n return meals[mealTime]\r\n }\r\n \r\nThis function returns **nil** if there is not value with that key and returns **the value** if it has that key.", "241" ], [ "**Edit**\r\n\r\n > I want to set border from left to right\r\n\r\nYou need to change gradient.startPoint and gradient.endPoint\r\n \r\n enum Direction {\r\n case horizontal\r\n case vertical\r\n }\r\n\r\n class View: UIView {\r\n \r\n init(frame: CGRect, cornerRadius: CGFloat, colors: [UIColor], lineWidth: CGFloat = 5, direction: Direction = .horizontal) {\r\n super.init(frame: frame)\r\n \r\n self.layer.cornerRadius = cornerRadius\r\n self.layer.masksToBounds = true\r\n let gradient = CAGradientLayer()\r\n gradient.frame = CGRect(origin: CGPoint.zero, size: self.frame.size)\r\n gradient.colors = colors.map({ (color) - > CGColor in\r\n color.cgColor\r\n })\r\n \r\n switch direction {\r\n case .horizontal:\r\n gradient.startPoint = CGPoint(x: 0, y: 1)\r\n gradient.endPoint = CGPoint(x: 1, y: 1)\r\n case .vertical:\r\n gradient.startPoint = CGPoint(x: 0, y: 0)\r\n gradient.endPoint = CGPoint(x: 0, y: 1)\r\n }\r\n\r\n let shape = CAShapeLayer()\r\n shape.lineWidth = lineWidth\r\n shape.path = UIBezierPath(roundedRect: self.bounds.insetBy(dx: lineWidth, \r\n dy: lineWidth), cornerRadius: cornerRadius).cgPath\r\n shape.strokeColor = UIColor.black.cgColor\r\n shape.fillColor = UIColor.clear.cgColor\r\n gradient.mask = shape\r\n \r\n self.layer.addSublayer(gradient)\r\n }\r\n \r\n required init?(coder aDecoder: NSCoder) {\r\n fatalError( \" ;init(coder:) has not been implemented \" ;)\r\n }\r\n\r\nAs you can see, I added some extra parameters. I solved this issue by adding inset to the roundedRect: \r\n\r\n shape.path = UIBezierPath(roundedRect: self.bounds.insetBy(dx: lineWidth, \r\n dy: lineWidth), cornerRadius: cornerRadius).cgPath\r\n\r\n**How to use it:**\r\n\r\n let myView = View(frame: CGRect(x: 0, y: 0, width: 200, height: 50), cornerRadius: 25, colors: [UIColor.red, .orange, .yellow], lineWidth: 2, direction: .horizontal)\r\n myView.center = view.center\r\n view.addSubview(myView)\r\n\r\n**Screenshot:**\r\n\r\n[roundedViewWithGradient][1]\r\n\r\n\r\n [1]: _URL_0_", "386" ], [ "You should use this UIButton&#39;s method \r\n\r\n button.setAttributedTitle(uiText, for: .normal)\r\n\r\nHere&#39;s the code (I created two dummy buttons with dummy attributes)\r\n \r\n\r\n let text = \" ;Hi \" ;\r\n \r\n let attributesFirst = [NSAttributedStringKey.font: UIFont.boldSystemFont(ofSize: 17), NSAttributedStringKey.foregroundColor: UIColor.lightGray,\r\n NSAttributedStringKey.strokeColor: UIColor.orange]\r\n let attributesSecond = [NSAttributedStringKey.font: UIFont.boldSystemFont(ofSize: 20), NSAttributedStringKey.foregroundColor: UIColor.red,\r\n NSAttributedStringKey.strokeColor: UIColor.blue]\r\n\r\n \r\n let button = UIButton(frame: CGRect(x: 0, y: 0, width: 100, height: 50))\r\n button.backgroundColor = .red\r\n button.center = view.center\r\n \r\n let button2 = UIButton(frame: button.frame)\r\n button2.backgroundColor = .orange\r\n button2.center = CGPoint(x: button.center.x, y: button.center.y + 200)\r\n \r\n let uiText = NSAttributedString(string: text, attributes: attributesFirst)\r\n let uitext2 = NSAttributedString(string: text, attributes: attributesSecond)\r\n\r\n button.setAttributedTitle(uiText, for: .normal)\r\n view.addSubview(button)\r\n \r\n button2.setAttributedTitle(uitext2, for: .normal)\r\n view.addSubview(button2)\r\n\r\n[screenshot][1]\r\n\r\n\r\n [1]: _URL_0_", "930" ], [ "**EDIT**\r\n\r\nYou are setting all the time the same string here\r\n\r\n > self.postingID = testingkey\r\n\r\nso it is equal to the last element in the for cycle. For this reason in your if condition\r\n\r\n > id == self.postingID\r\n\r\nis true just for the last node\r\n\r\nMaybe you want to change your self.postingID in an Array (or Set if the id is not already unique) and have something like:\r\n\r\n var self.postingIdArray = [String]()\r\n\r\nThen in you first function you want to append each key to this array\r\n\r\n for testingkey in postsDictionary.keys {\r\n\r\n self.postingID = testingkey\r\n\r\n }\r\n\r\nEventually, you want to check if your node&#39;s id is in the array, like\r\n\r\n if let id = snap.childSnapshot(forPath: \" ;id \" ;).value as? String, self.postingIdArray.contains(id) { self.posts.insert(snap, at: 0) }\r\n\r\nOLD ANSWER\r\n\r\n let databaseRef = Database.database().reference().child( \" ;main \" ;)\r\n let query = databaseRef.queryOrderedByKey()\r\n\r\n query.observeSingleEvent(of: .value) { (snapshot) in\r\n if snapshot.exists() {\r\n for child in snapshot.children {\r\n let snap = child as! DataSnapshot\r\n if snap.hasChildren() {\r\n if let id = snap.childSnapshot(forPath: \" ;postId \" ;).value as? String, id == idToCompare {\r\n print(id)\r\n }\r\n }\r\n }\r\n }\r\n }", "226" ], [ "There are few things in your code you want to change.\r\n\r\n1) This view&#39;s frame causes that strange behavior:\r\n\r\n UITextView(frame: CGRect(x:0, y:0, width:view.bounds.width, height:view.bounds.height))\r\n\r\n2) The reason why you make this mistake is because you are confusing \r\n\r\n .inputAccessoryView\r\n .inputView\r\n\r\n3) The gif you posted is based on navigationBar buttons. Basically, it by tapping on the cell it presents a detailedViewController with two items set in navigationBar", "386" ], [ "It is not clear how RegisterViewController is linked to SideMenuVC in your question.\r\n\r\nAnyway one possible solution is using a Singleton.\r\n\r\nHere&#39;s an example:\r\n\r\n**Singleton**\r\n\r\n struct DummySingleton {\r\n static var shared = DummySingleton()\r\n var string = String()\r\n }\r\n\r\n**Set Singleton**\r\n\r\n //In your RegisterViewController you set the singleton\r\n DummySingleton.shared.string = \" ;I am a string \" ;\r\n\r\n**In viewDidLoad in your SideMenuVC...**\r\n\r\n label.text = DummySingleton.shared.string\r\n\r\n**Conclusion**\r\n\r\nIt is not the better solution, using Singleton is not always a good solution in terms of memory handling, but it is the only thing I can suggest you so far with the information you provided in your question.", "735" ], [ "It is easier to get it with an example. Here&#39;s I get some places from an API:\r\n\r\n func getPlaces(onSuccess: @escaping(_ places: [Place]?) - > Void, onFailure: @escaping(Error, _ title: String?, _ message: String?) - > Void) {\r\n //perform API request...\r\n //[...]\r\n //...\r\n // Session\r\n session.dataTask(with: requestURL) { (data, response, error) in\r\n guard error == nil else {\r\n \r\n //handling Error\r\n onFailure(error!, \" ;Error \" ;, error?.localizedDescription)\r\n group.leave()\r\n return\r\n }\r\n //...\r\n //handling succes\r\n else {\r\n var places: [Place] = []\r\n \r\n places = responseJson.places!\r\n onSuccess(places)\r\n }\r\n group.leave()\r\n }.resume()\r\n }\r\n group.wait()\r\n return\r\n }\r\n\r\nAs you can see I want to handle success and error. Here&#39;s how I use it:\r\n\r\n APIManager.shared.getPlaces(onSuccess: { (places) in\r\n //handling success\r\n }\r\n }) { (error, title, message) in\r\n DispatchQueue.main.async {\r\n self.present(getAlertFromError(title: title, message: message), animated: true)\r\n }\r\n }", "537" ], [ "**Edit 2 - Now I see the code**\r\n\r\nAdd this in viewDidLoad of your ViewController and forget what we said so far.\r\n\r\n if Auth.auth().currentUser != nil {\r\n if let name = Auth.auth().currentUser?.displayName {\r\n LB_username.text = name\r\n }\r\n }\r\n\r\n\r\n**Edit - \" ;where and how should I declare userName? Short answer \" ;**\r\n\r\n class AppDelegate: UIResponder, UIApplicationDelegate, GIDSignInDelegate {\r\n\r\n var window: UIWindow?\r\n var userId: String?\r\n var userName: String?\r\n //...\r\n\r\n \" ;I don&#39;t know how to handle optionals \" ; - In this case, do this:\r\n\r\n class AppDelegate: UIResponder, UIApplicationDelegate, GIDSignInDelegate {\r\n\r\n var window: UIWindow?\r\n var userId = String()\r\n var userName = String()\r\n //...\r\n\r\n**Old Answer**\r\n\r\nYour answer is not clear, so I try to guess what you want to achieve:\r\n\r\n - Assuming you already have your name stored in `userName`, as I can see here:\r\n \r\n `Database.database().reference().child( \" ;Users \" ;).child(userID).setValue([ \" ;Name \" ;: userName])`\r\n \r\nwhat you want to do is to pass this string in your \" ;HomeSegue \" ; segue.\r\nTo do this you need to implement prepare for segue method\r\n\r\n _URL_0_\r\n\r\nHere&#39;s an example:\r\n\r\n override func prepare(for segue: UIStoryboardSegue, sender: Any?)\r\n {\r\n \r\n if segue.identifier == \" ;HomeSegue \" ; {\r\n let destinationVC = segue.destination as! MySecondViewController\r\n destinationVC.myLabel.text = userName\r\n }\r\n }\r\n\r\nNote: \r\n - userName needs to be global\r\n - myLabel is a property of MySecondViewController", "103" ], [ "**EDIT 2**: you were not setting the clothes property of the instance of the class the segue is performed (but you were setting a new instance). Change like this:\r\n\r\n override func prepare(for segue: UIStoryboardSegue, sender: Any?) {\r\n //check if the performed segue has \" ;wardrobemove \" ; id\r\n if segue.identifier == \" ;wardrobemove \" ; {\r\n //check if the destination is kind of WardrobeTableViewController\r\n if let destinationVC = segue.destination as? WardrobeTableViewController {\r\n //if it is so, then set its property clothes\r\n destinationVC.clothes = returncolumns()\r\n }\r\n }\r\n }\r\n\r\n**EDIT**\r\n\r\nIn your second vc, you want to reload your tableView every time you set the array of clothes:\r\n\r\n var clothes = [String]() {\r\n didSet {\r\n self.tableView.reloadData()\r\n }\r\n }\r\n\r\n**Old answer**\r\n\r\n var clothes = ViewController().returncolumns()\r\n\r\nYou have everything in your **FirstVC** and you want to set *clothes* in the **SecondVC** based on the value returned by the method *returncolumns()*\r\n\r\nIf it is so, you might want to perform a segue between FirstVC and SecondVC, and implement **prepareForSegue** to set clothes. Something like:\r\n\r\n override func prepare(for segue: UIStoryboardSegue, sender: Any?) {\r\n if segue.identifier == \" ;segueIdentifier \" ; {\r\n if let destinationVC = segue.destination as? SecondViewController {\r\n destinationVC.clothes = returncolumns()\r\n }\r\n }\r\n }", "735" ], [ "It is a good question. See, you declare two constants inside `sign` function, that means that `userId` and `userName` cannot be used outside that function. In your AppDelegate you can find `var window: UIWindow?` is an optional but it is declared outside any function, that means you can access from anywhere to it. So, what you want to do is to declare your constants as var (or optional) strings outside any functions", "730" ], [ "If I got it, you want your car not to be effected by gravity.\r\nIf it is so you might want to setup the physics of your \" ;world \" ;, like:\r\n\r\n func setWorld() {\r\n self.backgroundColor = UIColor.white\r\n \r\n //This should do the trick!\r\n physicsWorld.gravity = CGVector(dx:0, dy:0)\r\n \r\n //This is useful if you want to create wall along the borders \r\n let frame = CGRect(x: self.frame.minX, y: self.frame.minY, width: self.frame.width, height: self.frame.height)\r\n //here you set the borders as walls\r\n physicsBody = SKPhysicsBody(edgeLoopFrom: frame)\r\n\r\n physicsBody?.friction = 0\r\n physicsBody?.restitution = 1\r\n physicsBody?.linearDamping = 0\r\n }\r\n\r\nand call this function in didMove", "845" ] ]
35
[ 18231, 14993, 5183, 19515, 14002, 7702, 11118, 18682, 15527, 13074, 19171, 17718, 8289, 6291, 11585, 4107, 225, 7604, 12236, 14959, 8306, 15392, 1347, 8339, 4280, 18960, 9721, 13097, 905, 4239, 12454, 7509, 9258, 13042, 14012, 12941, 10576, 17747, 5993, 9937, 2447, 13845, 15612, 4367, 9063, 5399, 5858, 730, 12880, 7120, 16591, 14766, 16501, 15480, 16452, 16594, 4592, 10460, 4294, 5890, 1015, 9719, 14577, 9202, 17952, 16423, 7512, 9814, 13645, 2184, 1532, 10625, 5070, 15648, 12918, 12861, 10968, 18316, 4797, 10304, 5426, 9809, 12955, 13018, 6018, 9709, 13720, 8733, 1916, 3827, 17109, 11383, 14640, 5647, 13711, 320, 18599, 11896, 17785, 15152, 3264, 3135, 12286, 7941, 14228, 19064, 11609, 4498, 18077, 14252, 3393, 14045, 9436, 10676, 10580, 11675, 12434, 17879, 1819, 15653, 16380, 14187, 2077, 14671, 13290, 12634, 1174, 11082, 3272, 10823, 12556, 14821, 16033, 10950, 14528, 8210, 1544, 17128, 10324, 1382, 517, 13025, 4645, 5031, 16818, 14020, 10852, 16090, 15402, 19675, 7081, 610, 5049, 10593, 13043, 15912, 3666, 2321, 2051, 7055, 7787, 4366, 10609, 14992, 4800, 11853, 15225, 315, 19357, 13283, 13691, 3008, 7884, 4480, 9326, 11300, 15385, 8294, 3188, 465, 12723, 6133, 874, 1723, 14106, 14489, 14654, 3044, 11645, 11783, 13569, 4320, 12469, 17662, 4603, 11062, 5522, 15206, 3314, 547, 14633, 14213, 4266, 7457, 17873, 8815, 12996, 15214, 2193, 11305, 17548, 14296, 14683, 17813, 11693, 1578, 5957, 14667, 16933, 15972, 13714, 5689, 11918, 16400, 12956, 6944, 6948, 6435, 9252, 4903, 15909, 12969, 3754, 15455, 14913, 12594, 16296, 12605, 14639, 10086, 16962, 10635, 13629, 19635, 5602, 16302, 8664, 7353, 17301, 6922, 14713, 12673, 14202, 18446, 11060, 9, 14507, 11494, 10952, 10003, 17013, 7570, 13802, 6911, 14215, 13088, 19475, 37, 11402, 7674, 13487, 13314, 15596, 14386, 8663, 18070, 6266, 17077, 13026, 1782, 10895, 8880, 11834, 7648, 2202, 17543, 15976, 7214, 9072, 3258, 19093, 11776, 10111, 11908, 11424, 166, 14972, 12747, 17559, 3073, 6460, 13753, 10025, 14743, 7783, 4622, 642, 12100, 6764, 18623, 11581, 18751, 5820, 10073, 15000, 13831, 5187, 1405, 6599, 1491, 19562, 8017, 13091, 155, 11358, 9113, 16403, 13092, 18198, 18933, 8570, 14645, 12005, 17972, 1162, 10898, 19461, 12522, 12186, 580, 10425, 15077, 10849, 11304, 9623, 12387, 6067, 4881, 8782, 14816, 8875, 17053, 10846, 12411, 15515, 8090, 2461, 4599, 8578, 5267, 8619, 18514, 12064, 5982, 12521, 1575, 17947, 12580, 13923, 16512, 16488, 3084, 12788, 4289, 13094, 4352, 6528, 18971, 13299, 12732, 11117, 3969, 12757, 13145, 2071, 1430, 8492, 1298, 10783, 16110, 586, 14914, 13770, 12210, 15507, 12264, 16578, 7260, 9933, 13191, 12846, 10147, 16625, 17675, 11458, 4979, 10045, 6613, 19409, 14182, 19076, 9783, 18087, 19765, 10291, 10745, 10487, 11459, 5064, 6118, 5976, 17542, 6507, 5819, 2635, 11777, 11331, 7644, 12683, 15198, 10385, 13953, 11752, 14538, 8909, 8240, 12356, 13494, 11022, 6813, 3753, 12657, 862, 14377, 1093, 15121, 9850, 15718, 12215, 11479, 13545, 12628, 11661, 14808, 44, 11709, 10316, 5552, 9660, 13682, 17744, 91, 2013, 1354, 51, 18361, 18568, 17726, 17187, 19528, 18156, 17380, 14982, 13767, 16674, 10484, 1199, 18547, 13698, 6077, 12515, 10912, 10693, 14499, 8061, 6391, 11314, 3064, 6197, 19722, 12838, 18146, 19189, 14188, 15813, 13274, 15323, 12786, 17398 ]
STX_1008596.0
[ [ "import numpy as np\r\n import IPython.display as ipd\r\n import librosa\r\n import soundfile as sf\r\n import io\r\n from google.cloud import storage\r\n \r\n BUCKET = &#39;some-bucket&#39;\r\n \r\n # Create a Cloud Storage client.\r\n gcs = storage.Client()\r\n \r\n # Get the bucket that the file will be uploaded to.\r\n bucket = gcs.get_bucket(BUCKET)\r\n \r\n # specify a filename\r\n file_name = &#39;some_dir/some_audio.wav&#39;\r\n \r\n # read a blob\r\n blob = bucket.blob(file_name)\r\n file_as_string = blob.download_as_string()\r\n \r\n # convert the string to bytes and then finally to audio samples as floats \r\n # and the audio sample rate\r\n data, sample_rate = sf.read(io.BytesIO(file_as_string))\r\n \r\n left_channel = data[:,0] # I assume the left channel is column zero\r\n \r\n # enable play button in datalab notebook\r\n ipd.Audio(left_channel, rate=sample_rate)", "361" ], [ "I wish to rewrite the values for a text column in a table I have. The particular field has entries like \" ;cat \" ;, \" ;dog \" ;, \" ;mouse \" ;, etc. I wish to rewrite the values in this field as \" ;dog \" ; or \" ;not_a_dog \" ;\r\n\r\nCurrently I have a query, with commented out portions. I un-comment a line, run it. Comment it back and then un-comment the next line, run it. etc.\r\n\r\nI&#39;m sure there is a way to do this programatically.\r\n\r\nHere is what I have done so far:\r\n\r\n UPDATE some_dataset.some_table SET label=&#39;not_a_dog&#39; WHERE label=&#39;cat&#39;\r\n #UPDATE some_dataset.some_table SET label=&#39;not_a_dog&#39; WHERE label=&#39;mouse&#39;\r\n #UPDATE some_dataset.some_table SET label=&#39;not_a_dog&#39; WHERE label=&#39;moose&#39;\r\n\r\nNote I am using standard SQL in BigQuery. I tried playing with a stored procedure but I am not sure if my failure was because I don&#39;t really know stored procedures or if they are not compatible with standard SQL in BigQuery on Google Cloud Platform.", "346" ], [ "I am trying to create a scatter plot with a query result which looks something like this:\r\n\r\n --------+------------+--------\r\n label | feature_1 | feature_2\r\n --------+------------+--------\r\n &#39;dog&#39; 0.23 -0.8\r\n &#39;dog&#39; 0.26 0.01\r\n &#39;not_dog&#39; -0.5 0.2\r\n &#39;not_dog&#39; -0.8 0.67\r\n\r\nWhen I examine this data in Data Explorer it auto picks the label column as &#39;Dimension&#39; which is good. It also picks Metric X and Metrix Y as the two feature columns. However, the metrix X and metric Y values all have aggregation as the available options. ie., you can pick, sum, average, min, max, etc. I would prefer to simply have the raw values. ie. for a given label, show a dot for a feature_1 and feature_2.\r\n\r\nI&#39;ve noticed that if I do a few things, it seems to actually do this. Here is what I have to do to get a proper scatter plot.\r\n\r\n 1. go to style and modify the min and max values of the x and y axis to\r\n be [-1,1]\r\n 2. also in style, modify \" ;Color By \" ; to be dimension values. This makes a red dot for dog labels and a blue dot for not_dog labels.\r\n 3. In the main screen set a filter value to have min and max values of one of the fields to be feature_1 -1 - 1 (this is setting range\r\n [-1,1])\r\n 4. Also in the main screen, specify the Metric X and Metric Y to use the Avg for the aggregation.\r\n\r\nThis seems kind of weird to me. Is there a better way to do this?", "505" ], [ "This might help. Consider a numpy array of floating point values foo.\r\n\r\n import numpy as np\r\n foo=np.array([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8])\r\n\r\nfoo yields\r\n\r\n array([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.8, 0.8])\r\n\r\nThis is how you get the values in foo > 0.3\r\n\r\n foo[np.where( foo > 0.3)]\r\n\r\nyields\r\n\r\n array([0.4, 0.5, 0.6, 0.7, 0.8])\r\n\r\nThis is how to do the same with multiple conditions. In this case, values > 0.3 and less than 0.6.\r\n\r\n foo[np.logical_and(foo > 0.3, foo < 0.6)]\r\n\r\nyields\r\n\r\n array([0.4, 0.5])\r\n\r\n**Alternatively using boolean mask array**\r\n\r\n mask_1 = foo > 0.3\r\n mask_2 = foo < 0.6\r\n mask_3 = np.logical_and(mask_1, mask_2)\r\n mask_3\r\n\r\nYields a boolean mask array\r\n\r\n array([False, False, False, True, True, False])\r\n\r\nWhich you can then use to slice the array via\r\n\r\n foo[mask_3]\r\n\r\nYields\r\n\r\n array([0.4, 0.5])", "656" ], [ "regarding \" ;As a side note, all of the samples on this page show reading files from GCS. \" ;, is this true? It seems all these samples copy the files from gs: to a local file in the datalab vm and then read the file from local file system. I found this post because I am trying to read binary files from gs: to my GCP hosted datalab notebook.", "919" ], [ "For what its worth. I also had problems reading files, in particular binary files from google cloud storage inside a datalab notebook. The first way I managed to do it was by copying files using gs-utils to my local filesystem and using tensorflow to read the files normally. This is demonstrated here after the file copy was done.\r\n\r\nHere is my setup cell\r\n\r\n import math\r\n import shutil\r\n import numpy as np\r\n import pandas as pd\r\n import tensorflow as tf\r\n \r\n tf.logging.set_verbosity(_URL_0_)\r\n pd.options.display.max_rows = 10\r\n pd.options.display.float_format = &#39;{:.1f}&#39;.format\r\n\r\nHere is a cell for reading the file locally as a sanity check. \r\n\r\n # this works for reading local file\r\n audio_binary_local = tf.read_file( \" ;100852.mp3 \" ;)\r\n waveform = tf.contrib.ffmpeg.decode_audio(audio_binary_local, file_format=&#39;mp3&#39;, \r\n samples_per_second=44100, channel_count=2)\r\n # this will show that it has two channels of data\r\n with tf.Session() as sess:\r\n result = sess.run(waveform)\r\n print (result)\r\n\r\nHere is reading the file from gs: directly as a binary file. \r\n\r\n # this works for remote files in gs:\r\n gsfilename = &#39;gs://proj-getting-started/UrbanSound/data/air_conditioner/100852.mp3&#39;\r\n # python 2\r\n #audio_binary_remote = tf.gfile.Open(gsfilename).read()\r\n # python 3\r\n audio_binary_remote = tf.gfile.Open(gsfilename, &#39;rb&#39;).read()\r\n waveform = tf.contrib.ffmpeg.decode_audio(audio_binary_remote, file_format=&#39;mp3&#39;, samples_per_second=44100, channel_count=2)\r\n # this will show that it has two channels of data\r\n with tf.Session() as sess:\r\n result = sess.run(waveform)\r\n print (result)", "948" ], [ "I tried various answers above and could not get any to work. However, this method did work.\r\n\r\n0. This was tested using a github repo. I had to turn off two-factor authentication to get this to work. You can switch that off and on if its a problem. \r\n\r\n1. Connect GCP source repo to your github account. Click new repo. Select connect to external repo. Follow the wizard.\r\n\r\n2. Create a datalab instance. Use the `create datalab your-dl-instance` method.\r\n\r\n3. In the repo browser on cloud console, display the method for showing how to clone the repo. It should looke something like this: `gcloud source repos clone github_yourusername_someproj --project=someproj` To be honest, I am not sure if this is valuable or not but this process will mirror your github repo in GCP. Later when I push changes to remotes, I magically see this repo updated when the github repo is updated. Perhaps \r\n\r\n4. Connect to datalab.\r\n\r\n5. Create a notebook, name it. I called mine add_repo. Create a cell that uses bash magic. Have it clone the repo. Use https to clone the github repo. If you use the gcloud command shown above it will print a message about this being a mirror. It will tell you to do the following. Do this instead \r\n \r\n %%bash\r\n\r\n git clone _URL_0_\r\n\r\n6. Now, you have a git repo inside your large datalab notebook git repo. \r\n\r\n7. Open ungit inside datalab notebook using the top right menubar icon.\r\n\r\n8. You will see a new directory which you can not push changes to at this point.\r\n\r\n9. In ungit, click the `submodules` pull down and select `add submodule`.\r\n\r\n10. For path enter `yourgithubrepo` which corresponds to the directory you see in your datalab notebook after you did the clone. It should not be prefixed with anything like /content/datalab/notebooks or such. Just use the repo name which matches the new directory.\r\n\r\n11. For URL, enter the clone url used above after the `git clone` command.\r\n\r\n12. When you click `ok` you will see .gitmodules is updated in ungit. Commit these changes to your /content/datalab/notebooks repo.\r\n\r\n13. Create a test notebook in the sub dir for your github repo. Save it. Ungit should show a change in the dir corresponding to the module but not the notebook itself. ie. ungit shows `yourgithubrepo` as modified. If you hover your mouse over the change, the tooltip will say that the subproject is dirty.\r\n\r\n14. Click the pulldown for `submodules` and select `yourgithubrepo`. Now ungit changes to `/content/datalab/notebooks/yourgithubrepo`. It will also show a yellow banner saying \" ;This is a submodule \" ;. Commit and push your change. It will prompt you for a login and password to github. Assuming you have disabled two factor authentication this push will show up in github and google cloud. If you have two factor authentication enabled, ungit not be able to handle it. You will get an error message saying authentication failed.", "441" ], [ "Using this [guide][1] there is a section on how to ssh to the instance. In order to do that you need to start the compute instance associated with the datalab notebook. You can use the console to start it or simply connect to your datalab notebook. Either way will start the compute engine so you can ssh to the instance.\r\n\r\n 1. Do the ssh command listed in step one of the guide.\r\n \r\n 2. Do the docker command listed in step two of the guide.\r\n \r\n 3. Open the interactive shell in the container listed in step three of\r\n the guide.\r\n \r\n 4. Change directory to the root of the notebooks git repo as listed in\r\n step four of the guide.\r\n \r\n 5. An editor is not included. I was able to apt-get install vim.\r\n\r\nEdit the .gitignore file. It should have some entries already there. My code is in top-level directory named mine and my models are in model_trained so I added model_trained to the gitignore file. Without the leading or trailing directory slash it matches the model output dirs where ever they appear in the git file system.\r\n\r\nThe is the resulting .gitignore.\r\n\r\n root@b28d8cf57173:~/datalab/notebooks# cat .gitignore \r\n .ipynb_checkpoints\r\n *.pyc\r\n model_trained\r\n\r\n\r\nAfterwards, I trained the model, and checked with ungit. \r\n\r\n [1]: _URL_0_", "441" ], [ "I am using google cloud platform datalab and I have the following \" ;install_sw \" ; notebook. \r\n\r\n %%bash\r\n apt-get update\r\n apt-get -y install --allow-unauthenticated libsndfile1 librosa\r\n\r\nand\r\n\r\n !pip install librosa soundfile google-cloud-storage\r\n\r\nEverytime I restart work on my notebooks, I have to run the install software notebook before I work on my regular notebook.\r\n\r\nI tried to ssh to the compute instance and then connect to the docker container using the docker exec command. Once I am in the docker container I tried to apt-get install and pip install and the will install, but they do not change the notebook environment.\r\n\r\nI do not how to configure dockers. Do I need to do something at the docker level to get this to work?", "707" ], [ "When I start tensorboard via datalab it uses the google syntax which is described [here][1]. This document only mentions start, stop and list. However, there is a debugger pane which I can not use.\r\n\r\n[This][2] document describes how to use tensorboard debugger with a tf.estimator but it uses a different syntax.\r\n\r\nIs there someway to blend the two so the debugger is usable with datalab?\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "948" ], [ "I don&#39;t think you can run tfdbg in datalab. You can take the code and run it at the console like so using this [guide][1]:\r\n\r\n0. I am using the datalab notebook which uses a _URL_2_ and _URL_3_. My code originally was modeled after this [file][2].\r\n\r\n1. Make this change to the `_URL_2_` code as shown in the guide mentioned above.\r\n\r\n from tensorflow.python import debug as tf_debug\r\n # for debugging\r\n hooks = [tf_debug.LocalCLIDebugHook()]\r\n\r\nThen in the `train_and_evaluate(args)` routine add a reference to the hooks in the parameter list for the `EvalSpec()` call. Like so:\r\n\r\n # .. also need an EvalSpec which controls the evaluation and\r\n # the checkpointing of the model since they happen at the same time\r\n eval_spec = tf.estimator.EvalSpec(\r\n input_fn = read_dataset(\r\n args[&#39;eval_data_paths&#39;],\r\n batch_size = 10000, # original 10000\r\n mode = tf.estimator.ModeKeys.EVAL),\r\n steps=None, # evals on 100 batches\r\n start_delay_secs = args[&#39;eval_delay_secs&#39;], # start evaluating after N secoonds. \r\n throttle_secs = args[&#39;min_eval_frequency&#39;], # eval no more than every N seconds.\r\n exporters = exporter,# how to export the model for production.\r\n hooks = hooks) # for the debugger \r\n\r\n\r\n\r\nThen using your pereferred virtual python environment, do the following: (I am using anaconda)\r\n\r\n1. Open a python 2.7 environment with anaconda\r\n \r\n $ . ~/bin/_URL_4_\r\n\r\n\r\n2. Activate the tensorflow python2.7 anaconda environment\r\n\r\n $ conda activate tensorflow\r\n\r\n\r\n\r\n3. get the gcloud environment\r\n \r\n $ . ~/progs/datalab-notebooks/bin/setenv_google.sh\r\n\r\n\r\n \r\n4. For this model, set a python path to find modules\r\n\r\n cd ~/progs/datalab-notebooks/tf-debug\r\n export PYTHONPATH=${PYTHONPATH}:${PWD}/taxisimple\r\n\r\n\r\n\r\nThen this to train: --train_steps=1000. appears to be max steps.\r\n\r\n python -m trainer.task \\\r\n --train_data_paths= \" ;${PWD}/taxi-train* \" ; \\\r\n --eval_data_paths=${PWD}/taxi-valid.csv \\\r\n --output_dir=${PWD}/taxi_trained \\\r\n --train_steps=1000 --job-dir=./tmp\r\n\r\nThis will give you a tftdbg prompt. From here you can explore the model using tfdbg.\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "948" ] ]
426
[ 10334, 11285, 11160, 18024, 8007, 10998, 19265, 16698, 14368, 6025, 16148, 11278, 12485, 17342, 11720, 15534, 9347, 19354, 1953, 8199, 17833, 18289, 16102, 15335, 13824, 10201, 1881, 13778, 17674, 13635, 1729, 4438, 16424, 176, 9700, 2393, 10884, 12220, 15977, 6057, 7273, 18572, 2158, 9050, 17895, 15068, 13434, 14278, 11868, 2152, 9185, 1004, 313, 16421, 6372, 14151, 2047, 126, 19194, 10822, 18733, 13156, 5523, 16525, 3274, 1284, 7717, 9712, 17779, 10337, 17920, 10473, 10801, 4952, 10247, 3217, 19072, 11148, 93, 2295, 6770, 12936, 13681, 8847, 8228, 232, 13294, 6129, 1523, 18669, 19737, 9075, 10565, 3126, 328, 15193, 16715, 4823, 4334, 17854, 8232, 8859, 7333, 458, 17764, 10721, 160, 3944, 19712, 12806, 12547, 8181, 16875, 19068, 5774, 6859, 18886, 3169, 6668, 18458, 13915, 13182, 19689, 19728, 5142, 10534, 15706, 2640, 7074, 7841, 1540, 7680, 8565, 5711, 17567, 13529, 11003, 16006, 103, 7743, 5236, 14885, 18111, 18426, 17570, 15434, 10762, 3942, 14644, 4109, 11371, 13445, 4717, 2756, 4904, 526, 14198, 129, 10843, 18073, 9426, 18704, 13976, 17272, 1817, 6047, 10628, 11884, 15006, 3482, 7388, 14742, 9232, 9292, 9858, 7462, 1390, 15467, 6681, 14159, 3271, 2462, 10664, 6616, 9597, 18831, 11674, 10685, 10277, 938, 6907, 13068, 17990, 7658, 18054, 13193, 3337, 11621, 11757, 14450, 3564, 9286, 11392, 7030, 3768, 6664, 17891, 844, 8456, 5421, 8702, 19214, 12443, 19305, 14934, 10989, 11211, 19339, 14487, 3842, 5589, 5062, 18032, 19488, 10288, 1825, 15724, 8106, 16463, 9591, 211, 6451, 4046, 8712, 1740, 6905, 8194, 1526, 14820, 12577, 5131, 8177, 9625, 11194, 16153, 6404, 16529, 8724, 16389, 9277, 2739, 14694, 13963, 18924, 14039, 4625, 3463, 9223, 10163, 17430, 4267, 2155, 19774, 2684, 12125, 2310, 2378, 15816, 4896, 12473, 18004, 5766, 10951, 16365, 13166, 19762, 8346, 9768, 5881, 10821, 17411, 18487, 11067, 17868, 11256, 10724, 6586, 5449, 15529, 8337, 4340, 2821, 309, 19378, 15922, 2688, 5275, 6491, 4547, 16884, 5222, 12298, 1542, 12835, 15786, 7292, 12989, 18488, 13904, 4327, 3567, 12709, 16977, 6632, 708, 13584, 16353, 19232, 9458, 4742, 6411, 7994, 19225, 4609, 11860, 13777, 16635, 16369, 8120, 8557, 12191, 5842, 3148, 9734, 14954, 11858, 9661, 17328, 14078, 10984, 3446, 4673, 731, 19413, 18340, 15100, 5502, 18115, 14884, 12008, 19309, 18455, 16503, 4079, 7522, 17523, 4330, 698, 19227, 12621, 14658, 3344, 1838, 13602, 10616, 615, 16081, 8655, 1840, 15037, 402, 11116, 15447, 5717, 1142, 15676, 8587, 12084, 10305, 4088, 2638, 3297, 4019, 19312, 13762, 17189, 13301, 19010, 9758, 7515, 10809, 10690, 6855, 9987, 9541, 5383, 14382, 17801, 14624, 9030, 997, 19271, 8647, 15886, 7559, 12351, 6085, 896, 5427, 17389, 8400, 4552, 8870, 13297, 3778, 5742, 19215, 18257, 16185, 399, 8735, 15278, 8030, 14550, 18191, 14397, 2296, 19783, 12317, 1483, 2438, 19791, 13793, 19508, 17648, 9740, 13670, 1046, 14060, 13934, 18297, 1693, 8630, 6160, 13386, 11910, 15928, 2239, 7439, 6591, 19228, 18243, 10529, 16351, 13665, 11879, 15820, 1957, 152, 7541, 6683, 5261, 7220, 9481, 11746, 11484, 10424, 944, 10497, 5795, 12689, 4989, 19433, 8271, 10516, 7758, 13495, 3629, 14144, 7695, 6139, 4798, 3872, 14660, 7460, 13256, 15391, 7105, 6076, 3670, 3341, 16461, 2360, 15228, 7311, 1136, 2105, 12828, 8591 ]
STX_100861.0
[ [ "let $\\mu^{*} (A)$ be an outer measure and define $\\nu^{*}$ as the next &#39;outer measure&#39;. Are $\\mu^{*}$ and $\\nu^{*}$ equal?\r\n\r\n\r\nchose an $\\epsilon > 0$. we define $\\nu_{\\epsilon}^{*}$ exactly the same as $\\mu^{*} (A)$, but with the restriction that each covering we use to cover A, must have a minimal length of $\\epsilon$. After that we let $\\epsilon \\rightarrow 0$. like this:\r\n\r\n$\\nu (A) = \\lim_{\\epsilon \\rightarrow 0} \\nu_{\\epsilon}^{*}(A)$ \r\n\r\nAre $\\nu(A)$ and $\\mu^*(A)$ the same?\r\n\r\nI don&#39;t seem to see how this fails to work, but maybe there is a sneeky little counterexample that lets this fail.\r\n\r\nI was thinking about the lesbesque measure and an interval which is smaller then epsilon say $[a,b)$ with $\\mu([a,b)) = b-a < \\epsilon$. But i don&#39;t seem to see how to make a smart covering any hints?\r\n\r\n<PERSON>", "301" ], [ "suppose we have a collection $F$ and a countable subcollection $G$ of $F$. suppose $\\sigma(G)$ is the sigma algebra generated by $G$. prove the following statement:\r\n\r\nthe union of all sigma algebra&#39;s generated by countable sub-collections of F is again a sigma algebra.\r\n\r\ni) $X \\in \\sigma(G) \\space \\forall G \\subset F \\text{ and } \\#G = \\#\\mathbb{N}$. So in particular $X \\in \\cup \\sigma(G)$.\r\n\r\nii) suppose $A \\in \\cup \\sigma(G)$. Is it true that $A^c \\in \\cup \\sigma(G)$?\r\n\r\nIf all countable subsets G of F are disjoint this is obviously true. I don&#39;t see how this is true when A is in a union of sigma algebra&#39;s where the intersection is not empty.\r\n\r\niii) Suppose $A_i \\in \\cup \\sigma(G)$, then $\\cup_{i\\in \\mathbb{N}} A_i \\in \\cup \\sigma(G)$?.\r\n\r\nSuppose $A_i \\in \\cup \\sigma(G_i)$, where $G_i$ is a countably subset of $F$. Then we see that $\\cup A_i \\in \\cup_{i\\in\\mathbb{N}} \\cup \\sigma(G_i)$. I know one can&#39;t say that $\\cup_{i\\in\\mathbb{N}} \\cup \\sigma(G_i) = \\cup \\sigma(\\cup_{i\\in\\mathbb{N}} G_i)$. So i get kind of stuck here too.\r\n\r\nany tips or hints to solve ii, iii ?\r\n\r\n<PERSON>", "576" ], [ "Is the measure space $(\\mathbb{R}, B(\\mathbb{R}),\\mu)$ complete where $\\mu$ is the <PERSON> measure?\r\n\r\nI know that when a measure space is complete, all subsets of null sets must be measurable with measure $0$. For finite sets this is definitely true. I think that for subsets of uncountable null sets, like the <PERSON> set, this will be false. But I can&#39;t seem to find a specific subset of the <PERSON> set which is not measurable. On top of that, how do non-measurable sets look like in this particular case?\r\n\r\n<PERSON>", "301" ], [ "Suppose $p = 1 \\bmod 3$, prove the following statements:\r\n\r\n1. prove that $x^2 + x + 1 = 0 \\mod p$ has a solution\r\n2. Prove that $\\left(\\frac{-3}{p}\\right) = 1$ if $p = 1\\mod 3$\r\n3. Determine the discriminant of $x^2 + x + 1$\r\n4. Prove using 2,3 that $\\left(\\frac{-3}{p}\\right) = -1$ if $p = -1\\mod 3$\r\n\r\nThis is what I&#39;ve tried by each question:\r\n\r\n1. prove $x^2 + x = -1 \\mod p$ has a solution, i tried to find an x such that: $x^2 + x = a^{\\frac{p-1}{2}} = -1 \\mod p$, where we use that a is equal to a quadratic non-residue and use Euler. I don&#39;t seem to see why this is true though.\r\n2. Note the following:\r\n$(2x+1)^2 = 4x^2 + 4x + 4 = 4(x^2 + x + 1) - 3 = -3 \\mod p$. So this solution exist and thus $-3$ must be a quadratic residue mod p.\r\n3. -3\r\n4. ?", "258" ], [ "Let $p$ and $q = 2p + 1$ be odd primes. Show that $(−1) ^{\\frac{p−1}{ 2}} 2$ is a primitive root modulo q.\r\n\r\n\r\nWe see that our number must have order $q-1$ to be a primitive root. If we check the divisors which are $1,2,p,2p$ and see that $\\left((−1) ^{\\frac{p−1}{ 2}} 2\\right)^\\frac{q-1}{d} \\equiv 1 \\pmod{q}$ we are finished.\r\n\r\nObviously $1$ and $2$ fail so we need to check $p$.\r\n\r\n$p = \\frac{q-1}{2}$, so we see $\\left((−1) ^{\\frac{p−1}{ 2}} 2\\right)^\\frac{q-1}{d} \\equiv \\left((−1) ^{\\frac{p−1}{ 2}} 2\\right)^2 \\equiv 4 \\pmod{q}$. So this fails as well. The only one to check is $2p$ but that is equal to $q-1$ so we are finished.\r\n\r\n<PERSON>", "258" ], [ "Let $p > 7$, prove that $\\left(\\frac{2}{q}\\right) = (-1)^{\\frac{q^2-1}{8}}$. with $q$ an odd prime. We can by using the following verifications:\r\n\r\n\r\n > $$\\left(\\frac{2}{p}\\right) = \\left(\\frac{8-p}{p}\\right) = \\left(\\frac{p}{p-8}\\right) = \\left(\\frac{2}{p-8}\\right)$$\r\n\r\nI don&#39;t see how to use these verifications for the proof to be honest and how to prove these verifications. \r\n\r\nSuppose $p \\equiv 1,3 \\pmod 4$. \r\n\r\nIf $p \\equiv 1 \\pmod {4}$ we get that:\r\n\r\n$p-8 \\equiv 1 \\pmod {8}$ or $p-8 \\equiv 5 \\pmod {8}$. \r\n\r\nif $p \\equiv 3 \\pmod {4}$, we get that:\r\n\r\n$p-8 \\equiv 3 \\pmod {8}$ or $p-8 \\equiv -1 \\pmod {8}$. \r\n\r\n So we see that the second equation works only if $p-8 \\equiv p \\equiv 1 \\pmod{4}$. But what about the other case. I am quite confused here, can i get a hint in the right direction please?\r\n\r\n<PERSON>", "258" ], [ "prove that for all primes p, the roots of $(x^2+1)(x^4-4) \\in (\\mathbb{Z}/p\\mathbb{Z})[x]$ have roots in $(\\mathbb{Z}/p\\mathbb{Z})$.\r\n\r\nI thought that if this polynomial has roots, we have two cases:\r\n\r\n$x^2 + 1 = 0$ or $x^4 - 4 = 0$. \r\n\r\nI guess a root in $(\\mathbb{Z}/p\\mathbb{Z})$ is of the form $0 \\pmod{p}$.\r\n\r\nSo i think that we need to prove that for all primes:\r\n\r\n$x^2 \\equiv -1 \\pmod{p}$ has a solution and:\r\n\r\n$x^4 \\equiv 4 \\pmod{p}$. \r\n\r\nFor the first equation we see $\\left(\\frac{-1}{p}\\right) = 1 \\iff p \\equiv 1 \\pmod {4}$.\r\n\r\nFor the second equuation we see:\r\n\r\n$x^4 \\equiv 4 \\pmod{p} \\implies x^2 \\equiv 2 \\pmod{p}$ or $x^2 \\equiv -2 \\pmod{p}$. \r\n\r\nthus we see $\\left(\\frac{2}{p}\\right) = 1 \\iff p \\equiv +- 1 \\pmod 8$\r\nand :\r\n\r\n$\\left(\\frac{-2}{p}\\right) = \\left(\\frac{2}{p}\\right) \\left(\\frac{-1}{p}\\right) = 1 \\iff p \\equiv 1 \\pmod 4$ or $p \\equiv 3 \\pmod{8}$.\r\n\r\nCombining these together we get all primes in the form: $1,3,7 \\pmod{8}$ will have roots. but how about $2$ and the primes of the form $5 \\pmod{8}$.\r\n\r\nMaybe i am doing this completely wrong, so could someone hint me in the right direction :)\r\n\r\n<PERSON>", "258" ], [ "Prove that $a^{N-1} = 1 \\mod N$ with $\\gcd(a,N) = 1$ is equivalent to $N$ is square free and $p-1|N-1$ for all primes $p|N$.\r\n\r\ni tried from left to right by looking at primitive roots. So suppose $N = p^e * m$, where $p$ are odd primes and $e \\geq 2$. we see that if $r$ is a primitive root:\r\n\r\n$r^{\\phi(p^e)} = 1 \\mod p^e$.\r\n\r\nBecause $\\gcd(p^e,m) = 1$ we see for all $a \\in \\mathbb{Z}$:\r\n\r\n$a^{N-1} = 1 \\mod N$.\r\n\r\nSo particulary $r^{N-1} = 1 \\mod N$. So with this info:\r\n\r\n$r^{N-1} = 1 \\mod p^e$.\r\n\r\nBut then $\\phi(p^e) | N-1$ so we see:\r\n\r\n$p^e - p^{e-1} = (p^e * m -1) * k$. for $k \\in \\mathbb{Z}$.\r\n\r\nThis is the part where i am stuck. How do i go further, and how do i prove this for N which have an even prime divisor?\r\n\r\n<PERSON>", "258" ], [ "Suppose we have the measure space $(\\Omega,F)$ and the map $T:(\\Omega,F) \\rightarrow (\\Omega&#39;,F&#39;)$, where $A_1,A_2, \\dots$ is a partition of $\\Omega$ such that $A_i \\in F$. The restriciton of $F$ to $A_i$ we call $F_i$ and the map restricted to $A_i$ we call $T_i$. Prove the following statement:\r\n\r\n$T$ is $F-F&#39;$ measurable iff $T_i$ is $F_i-F&#39;$ measurable.\r\n\r\nI think i proved from right to left, but the other side seem to bother me:\r\n\r\nsuppose $T_i$ is $F_i - F$ measurable, then $T_i^{-1} (F&#39;) \\subset F_i \\subset F$. Because this holds for all $i \\in \\mathbb{N}$ we see that $T^{-1}(F&#39;) \\subset \\cup F_i \\subset F$. Hence T is measurable.\r\n\r\nFor the other implication i&#39;m kind of stuck. Any hints on how to start?\r\n\r\n<PERSON>", "301" ], [ "let $p$ be prime a prime with $p = 5 \\mod 8$. furthermore $r \\in (\\mathbb{Z}/p\\mathbb{Z})^*$ of order 4 and let $a$ be a quadratic residue mod $p$. Prove the following:\r\n\r\na solution of $x^2 = a \\mod p$ is given by $x = a^{\\frac{p+3}{8}}$ or $x = r\\cdot a^{\\frac{p+3}{8}}$.\r\n\r\nI tried the following:\r\n\r\nSuppose $x = a^{\\frac{p+3}{8}}$, then we see:\r\n\r\n$x^2 = a^{\\frac{p+3}{4}} = a^\\frac{1}{2} \\cdot a^\\frac{p+1}{4} = (a \\cdot (a^\\frac{p+1}{2}))^{\\frac{1}{2}} = (a \\cdot (\\frac{a}{p}))^\\frac{1}{2}$. If I can prove that $(a \\cdot (\\frac{a}{p}))^\\frac{1}{2} = a$, This would be a solution but i don&#39;t see why that should be true.\r\n\r\nfor the other solution I don&#39;t see what to do, any hints/tips/tricks would be much appreciated :)\r\n\r\n<PERSON>", "258" ], [ "suppose $A$ is a measurable set where $x \\in A \\iff x + T \\in A$ and $\\mu$ denotes the lesbesque measure. prove that $\\mu(A\\cap[0,T]) = \\mu(A\\cap[a,a+T])$\r\n\r\ni know that the lesbesque measure is translation-invariant: $\\mu(B) = \\mu(x+B)$.\r\n\r\ni tried doing the following:\r\n\r\n$\\mu(A\\cap[a,a+T]) = \\mu(A) + \\mu([a,a+T]) - \\mu(A\\cup[a,a+T]) = \\mu(A) + \\mu([0,T]) - \\mu(A\\cup[a,a+T]$.\r\n\r\nSo we can also prove $\\mu(A\\cup[a,a+T] = \\mu(A\\cup[0,T])$. the main problem here is that i can&#39;t specifically can use the translation-invariation of $\\mu$ unless $A$ and $[a,a+T]$ are disjoint. \r\n\r\nI tried using the fact that $A = A + T$ as wel, which gives us: $\\mu(A \\cup \\{a\\}) = \\mu(A \\cup \\{0\\})$. But i don&#39;t know for sure if this step is valid.\r\n\r\nAny hints for this problem?\r\n\r\n<PERSON>", "301" ], [ "I have been working with measurable function etc, but i get quite confused if we look at a function which goes from a propability space to say the borel sifma algebra. For example:\r\n\r\n$f: (\\Omega,P(\\Omega)) \\rightarrow (\\mathbb{R},B(\\mathbb{R}))$.\r\n\r\n$\\Omega = \\{((j,k): 1 \\leq j, k\\leq 6\\}$, So we describe here throwing two dices. \r\n\r\nsuppose $f(j,k) = j + k$. how do we check this is a measurable map?\r\n\r\nI thought of taking a generator in B(\\mathbb{R}) and checking whether the inverse lies in $P(\\Omega)$. \r\n\r\nSo $f^{-1}(a,b) = \\emptyset$ if $2,3,....,12 \\notin (a,b)$.\r\n\r\nIf we have that one or more elements of {2,.....,12} is in (a,b), the inverse is just the union of all sets in the form $(j,k)$ where $j+k = c \\in(a,b)$. This is in the power set of $\\Omega$, so this funtion is measurable.\r\n\r\nIs this the right way to prove that the function is measurable or have i forgotten something?\r\n\r\n<PERSON>", "301" ], [ "Solve the diophanic equation $y^2 = x^4 -4x^3 + 6x^2 -2x +5$.\r\n\r\nMethods I know:\r\n\r\n1) look modulo p for some prime p, when using this method I almost always conclude there are no solutions, so i don&#39;t think it is handy to use this in this particular case.\r\n\r\n2) Combinations of factorization and estimation: factorize your specific function and Search for an upper bound.\r\n\r\nI used 2), and i get in a little bit of trouble.\r\n\r\nI tried factorize the right hand side, but did not come any further then:\r\n\r\n$y^2 - 10 = (x-5)(x^3 + x^2 - x - 3)$. \r\n\r\nI don&#39;t seem to get an upper bound here..... :(.\r\n\r\nAny hints on going to the right direction or on using a new method trying to solve this probelem?\r\n\r\n<PERSON>", "965" ], [ "prove that if there exist a pythogarian triangle whose area is the square of an integer that there exist $x,y,z \\in \\mathbb{N}$ such that:\r\n\r\n$x^4-y^4 = z^2$\r\n\r\nI tried to look at a pythogarian triple $(a,b,c)$ with this property, so we see $\\frac{1}{2}ab = k^2$ for some $k \\in \\mathbb{N}.$\r\n\r\nI see that $(x^2 + y^2)(x^2-y^2) = z^2$, so proving that both terms on the left are squares will help me solve the problem.\r\n\r\nI tried using primitive Pythagorean triangles, which can be gained by dividing al integers by the gcd, so we can get a new pair (x,y,z) where, $x = 2pr$, $y = p^2-r^2$ and $z = p^2 + r^2$. because $pr(p^2 -r^2)= k^2$, we see that $p^2 - r^2$ is a square, but how do i know that $p^2 + q^2$ is square?\r\n\r\nany hints woud be much appreciated :)\r\n\r\n<PERSON>", "35" ], [ "Let a ∈ Z and suppose that the congruence\r\n$x ^ 2 ≡ a \\mod p$ can be solved (in x ∈ Z) for all primes p except possibly finitely many, then a\r\nis a square in Z (i.e. a = b\r\n2\r\nfor some b ∈ Z).\r\n\r\nI tried solving the contrapositive and look at two cases:\r\n\r\n$a = 2$ and $a \\neq 2$.\r\n\r\nFor the first case i have proven that there are infinitly many primes that have a negative legendre symbol. So that has been proven. \r\n\r\nI get stuck at the second case, i got a hint but i don&#39;t see how it can help me it says:\r\n\r\nlet a = $2^eq_1.....q_n$ and $L = \\{l_1.....l_k\\}$ be a set with primes that are odd and distinct of $q_i \\forall i$. Let $s$ be a quadratic non-residue $\\pmod{q_n}$. Argue that there exist a $b \\in \\mathbb{Z}$ such that:\r\n\r\n$b \\equiv 1 \\pmod{l_j} \\space \\forall l_j \\in L$\r\n\r\n$b \\equiv 1 \\pmod{q_i} \\space i \\in \\{1,....,n-1\\}$\r\n\r\n$b \\equiv 1 \\pmod{8}$\r\n\r\n$b \\equiv s \\pmod{q_n} \\forall i$\r\n\r\nand prove that $\\left(\\frac{a}{b}\\right) = -1$. which also worked.\r\n\r\nThe next hint was proving that there exist a $p|b$ with $\\left(\\frac{a}{p}\\right)$ and $p \\notin \\{2,l_1,.....,l_k\\}$\r\n\r\nI think that such $b$ exist by the chinese remainder theorem, i dont see how the last statement is true and how it helps me to prove this equality.......\r\n\r\n<PERSON>", "258" ], [ "Show that the abc conjecture implies that there are at most finitely many solutions to the following diophantine equation:\r\n\r\n$x^5-y^2z^3 = 1$ , where $x,y,z \\in \\mathbb{Z}$ and $yz \\neq 0$.\r\n\r\nI tried using the following conjecture in my book:\r\n\r\n$\\forall \\epsilon > 0$ we have for all but finitely many $(a,b,c) \\in \\mathbb{Z}^3$ with $a+b+c = 0$ and $\\gcd(a,b,c) = 1$ that:\r\n\r\n$\\max\\{\\log|a|,\\log|b|,\\log|c|\\} < (1+\\epsilon) \\log(|rad(abc)|)$.\r\n\r\nwith this information we see:\r\n\r\n$\\max\\{5\\log|x|,3\\log|z|+2\\log|y|,0\\} < (1 + \\epsilon) \\log(|rad(-x^5y^2z^3)| = (1 + \\epsilon) \\log(|rad(xyz)|$.\r\n\r\nWhere the last equation follows form the fact that $\\gcd(a,b,c) = 1$\r\n\r\nI think i am supposed to get a contradiction at the equation so that we get with the contra-positive all but infinitly many $(a,b,c)$, but i don&#39;t see how to do this...\r\n\r\nMaybe i am using the wrong theorem here, so hints in the right direction would be much appreciated as well :)\r\n\r\n<PERSON>", "316" ], [ "let $k$ be a field with characteristic $0$ and $n \\in \\mathbb{Z}_{\\geq6}$.\r\n\r\nProve that if $f,g,h \\in k[x]$ with:\r\n\r\n$f^2 + g^3 = h^n$ and $\\gcd(f,g,h)= 1$\r\n\r\nthen $f,g,h$ are all constant.\r\n\r\nI have seen a few of these questions in my textbook, and i think i need to use the <PERSON> conjecture or the contrapositive of maher stohers theorem. \r\n\r\nmaher stohers theorem:\r\n\r\nlet k be a field of characteristic $0$, then for all $a,b,c \\in k[x]$ not all constant and $a+b+c = 0$ and $\\gcd(a,b,c) = 1$ we have:\r\n\r\n$\\max (\\deg(a),\\deg(b),\\deg(c)) \\leq \\deg(rad(abc))-1$.\r\n\r\nso in our case we get:\r\n\r\n$\\max(\\deg(f^2),\\deg(g^3),\\deg(h^n)) \\leq \\deg(rad(f^2g^3h^n))-1$.\r\n\r\nAm i supposed to try all degrees out and contradict this inequality?\r\n\r\nI already tried two inequalities:\r\n\r\nsuppose $\\max \\deg = \\deg(g^3)$, then:\r\n\r\n$\\deg(g^3) = 3 \\deg(g)$.\r\n\r\nbut also $\\deg(rad(f^2g^3h^n)) = \\deg(rad(fgh)) \\leq \\deg(fgh) < 3deg (g)$. so $3 deg(g) < 3deg(g)$ which is a contradiction!\r\n\r\nsuppose $\\max \\deg = \\deg(h^n)$, With a same reasoning we get:\r\n\r\n$n\\cdot \\deg(h) < 3 \\cdot \\deg(h)$. which is a contradiction since $n \\geq 6$\r\n\r\nI can&#39;t apply the same trick to $f$, so i am still thinking how to consider the case when deg (f^2) is the highest?.\r\n\r\nCan one say that $f^2 = h^n - g^3$ so $\\deg f^2 \\leq \\max \\deg(h^n,g^3)$. Because then we get \r\n\r\n<PERSON>", "403" ], [ "i just started solving mordell&#39;s equations and get a little bit stuck. For example:\r\n\r\n$ y^2 = x^3 - 3$.\r\n\r\nI know that $x$ must be odd, for if $x$ is even $y^2 \\equiv 5 \\pmod{8}$. So $x \\equiv \\{1,3\\} \\pmod{4}$. Now note the following if we add 4 at both sides:\r\n\r\n$y^2 + 4 = (x+1)(x^2 -x +1)$. The right hand side is the same as $(x-1)^2 + x$\r\n\r\nI now know $(x^2 -x +1)$ is divisible by a prime divisor $3 \\pmod{4}$ if $x \\equiv 3 \\pmod {4}$ and divisible by $1 \\pmod{4}$ if $x \\equiv 1 \\pmod{4}$.\r\n\r\nSo we get $y^2 + 4 \\equiv 0\\pmod{p}$, which is solvable if $\\left(\\frac{-2}{p}\\right)$ = 1. (I don&#39;t think this step is valid). this is only true if the following occurs:\r\n\r\n$p \\equiv 1 \\pmod{4}$ and $p \\equiv +- 1\\pmod{8}$.\r\n\r\nor\r\n\r\n$p \\equiv 3 \\pmod{4}$ and $p \\equiv +- 3\\pmod{8}$.\r\n\r\n\r\nso $p \\equiv \\{1,3\\}\\pmod{8}$\r\n\r\nbut $y^2 + 4$ is either $4 \\pmod{8}$ or $5 \\pmod {8}$, so there are no solutions?\r\n\r\nAm i solving this the correct way or is there a shorter path?\r\n\r\n<PERSON>", "258" ], [ "Let $p \\equiv 3\\pmod{4}$ be prime and denote $n := \\frac{p − 1}{2} \\in \\mathbb{N}$. Suppose that $a\\in \\mathbb{Z}$ such that $a − 1, a, \\text{and } a + 1$ are all quadratic residues modulo $p$.\r\n\r\nShow that $y^n = x^2 + a$ has no solutions.\r\n\r\nMy thoughts:\r\n\r\ni thought about using a few facts and trying to combine them. For example:\r\n\r\n1) $\\left(\\frac{a}{p}\\right) \\equiv a^{\\frac{p-1}{2}} \\pmod p$\r\n\r\n2) $a$ is a quadratic residu modulo $p$, so $x^2 = a \\pmod{p}$ has a solution.\r\n\r\nI don&#39;t see how to combine these thoughts to prove this. I tried looking at modulo $p$, so we see:\r\n\r\n$y ^ n \\pmod{p} \\equiv x^2 + a \\pmod {p} \\equiv \\dots$.\r\n\r\nWhat do i want to get at the dots for a contradiction is solutions?\r\n\r\n\r\n<PERSON>", "258" ], [ "show that the abc-conjecture implies that $x! + 1 = y^2$, $x \\in \\mathbb{N}$ has at most finitely many solutions.\r\n\r\nI tried to look at $a= x!, b=1, c=y^2$. \r\n\r\nThe hints i got:\r\n1)$\\Pi_{p\\leq n} \\text{ } p \\leq 4^n$ where $p$ is prime.\r\n\r\n2) Note that $1 + \\frac{y-1}{2} = \\frac{y+1}{2}$\r\n\r\nWhat i tried:\r\n\r\n$rad(x!)rad(y) \\leq x!y < y^3$. So if we look at the quality we get:\r\n\r\n$q(x!,y,1) = \\frac{2\\log(y)}{\\log(rad(x!y))} > \\frac{2\\log(y)}{3\\log(y))} = \\frac{2}{3}. $\r\n\r\nI am curious if the quality can help us solve the problem but i dn&#39;t thinks so.\r\n\r\nso looking at $rad(x!)$, we see that this is equal to the product of all primes smaller then $x$, so $rad(x!) \\leq 4^x$ by the hint i got.\r\n\r\nSo $rad(x!)rad(y^2) \\leq 4^x y^2$. if i can prove that $4^x \\leq y^k$ for some $k \\in \\mathbb{N}$, i can probably just use the abc conjecture. But the main problem is that i don&#39;t see how to get there, any tips?\r\n\r\nPS: I have seen a solution with <PERSON> formula, but i want a solution which uses the hint to have more insights on this question :)\r\n\r\n<PERSON>", "258" ], [ "> Prove that for $\\alpha > 0$, the function $e^{-x^{\\alpha}}$ is $\\mu$-integrable on $[0,\\infty)$, where $\\mu$ is the one-dimensional <PERSON> measure.\r\n\r\nObviously we want to make an upper bound for the function on this interval and use the dominated convergence theorem, I tried the following: $e^{x^{\\alpha}} \\leq 1$ for $x\\leq 1$ because we have $e^{−x^{\\alpha}} \\le \\dots$. In my exercise class I saw that $x^{-2}$ is an integrable function on $(1,\\infty)$, so if I can prove that: $e^{−x^{\\alpha}} \\leq Mx^{−2}$ for some suitable constant $M = M_\\alpha < \\infty$, I can easily use the dominated convergence theorem. The main problem is that I don&#39;t see how this inequality is actually true. Any hints on proving this?\r\n\r\n<PERSON>", "647" ], [ "With measure theory I am experimenting with Tonelli&#39;s theorem and it is going just fine, but I always get stuck at proving absolute convergence of integrals.\r\n\r\nExamples are:\r\n\r\n1) $$\\int_{0}^{\\infty} \\int_{0}^{\\infty} |e^{-xy}\\sin(x)\\sin(y)|\\, dxdy$$\r\n\r\n2) $$\\int_{-1}^{1} \\int_{-1}^{1} \\left|\\frac{xy}{\\left(x^2+y^2\\right)^2}\\right|\\,dxdy$$\r\n\r\nI think using substitutions can do the trick in 2) but I don&#39;t seem to see how to make one. Furthermore, I think estimations will help a lot.\r\n\r\nIs there any literature or information on the web on how to look at these kind of problems?", "949" ], [ "Solve the following equation in $\\mathbb{Z}$:\r\n\r\n$$y^2 = x^4 +x + 2 $$\r\n \r\n\r\nI think I need a good estimation, but I don&#39;t see how to get that... \r\nI obviously see that $(1,\\pm2)$ does work but how do I solve it for all $\\mathbb{Z}$?\r\n\r\nIs it smart to estimate or to try to factorize? I see that $y$ must always be even so that will work out fine I guess, but how can one make a bound for $y$?", "765" ], [ "Prove that $3x^2 + 6y^6 + 1 = 8xy^3$ has no solutions in $\\mathbb{Q}$.\r\n\r\nI know two kind of ways of solving these kind of problems:\r\n\r\n1. look at $\\mathbb{R}$\r\n\r\n2. look at $\\mathbb{Z}$, if you can&#39;t find any solutions there and $\\gcd (x,y) \\neq 1$, then $(0,0,0)$ can be your only solution\r\n\r\nThe problem is that I used 2. only on homogeneous functions so I don&#39;t know for sure if one can use it here as well.\r\n\r\nI tried using option 1., and I noted that $x$ and $y$ must be strictly positive for if not the right hand side is negative and the left hand side is positive.\r\n\r\nCan I get a hint on how to proceed?\r\n\r\n<PERSON>", "316" ], [ "> Suppose $f: [0,1] \\rightarrow [0,1]$ is a Borel measurable function. Suppose $G = \\{(x,y)\\mid f(x) = y\\} \\subset [0,1] \\times [0,1]$. Use Fubini to prove that \r\n$$\r\n(\\mu \\times \\mu)(G) = 0.\r\n$$\r\n\r\n---\r\nWhat I&#39;ve tried:\r\n\r\n$$(\\mu \\times \\mu)(G) = \\iint_{G}\\ d\\mu d\\mu = \\iint 1_G(x,y)\\ d\\mu d\\mu.$$\r\n\r\nI kind of get stuck here, how am i supposed to go further, is it for example smart to take the rieman integral, or can i say the following thing:\r\n\r\n$$G \\subset \\{ 0\\leq x \\leq1, f(x)\\leq y \\leq f(x) \\}$$ so we see that\r\n\r\n$$\\iint 1_G(x,y) d\\mu d\\mu \\leq \\iint 1_{\\{ 0\\leq x \\leq1, f(x)\\leq y \\leq f(x) \\}} = \\int_{[0,1]} \\int_{\\{f(x)\\}} 1_G(x,y) d\\mu d\\mu = 0.$$\r\n\r\nSince $\\{f(x)\\}$ is a singleton...?\r\n\r\n<PERSON>", "647" ], [ "suppose $H$ is a hilbert space and $a,b \\in H$, where $(a,b) > 0$. Prove there exists a unique $x \\in H$ of minimal norm such that:\r\n\r\n$(x,a) \\geq 1$ and $(x,b) \\geq 1$\r\n\r\nI thought of using something like Riesz lemma, but i couldn&#39;t quite get the result partly because this lemma is mainly used for norms. Any hints,tips or tricks i can use for this question.\r\n\r\nPS:\r\n\r\nThe only thing i know about Hilbert spaces is that they are complete with respect to the metric associated with the norm induced by the inner product.", "647" ], [ "I&#39;m currently developing a solar powered data logger that sits outside in direct sunlight for a good chunk of its life. Preliminary testing has shown that the inside of the enclosure can get up to 70&#176;C on a hot day in the Australian Sun.\r\n\r\nMy first prototype iteration used a single 5000mAh 3.7v prismatic lithium polymer cell. This met the power requirements perfectly but on moderately hot days the 50&#176;C over-temperature cutoff would kick in and the cell would stop charging from the solar panel and the board would fail to stay on when removed from the sun. I also have concerns about the lifespan of these cells under heat-stress and using potentially flammable li-poly cells in hot conditions.\r\n\r\nThe device requires 2-3000mAh of capacity with a board Vcc of 3v, the average current draw is < 100mA. I&#39;d prefer not to vent the enclosure as the device is used in pretty dusty conditions and I&#39;d like to keep it as a sealed unit. By better insulating the enclosure, I may be able to bring the inside down to around 60&#176;C if that makes things easier. The battery needs to be less than 12mm thick.\r\n\r\nFor my next iteration I&#39;m considering different chemistries to address this issue. So far the only cells rated for such temperatures I&#39;ve found are the SAFT high-temperature lithium ion cells (_URL_0_) that are rated up to 125&#176;C, but they don&#39;t come as a flat cell and they&#39;re not readily available in small quantities.\r\n\r\nI&#39;ve also read mixed literature about what temperatures LiFePO4 cells can be used at.\r\n\r\nWhat options have those of you who&#39;ve needed batteries in high ambient temperatures found?\r\n\r\nIf anyone could point me in the direction of some other chemistries or specific cells that might meet my requirements I would be very appreciative.\r\n\r\nThanks!", "632" ], [ "@Dave, the battery needs to have enough juice to be able to search for a WiFi network every couple of minutes until it finds one then upload its logs while packed away from sunlight, this may be a couple of days. Realistically a smaller cell would do but it&#39;s nice to have the headroom and physical size is not a huge issue.\n\nA peltier is an interesting idea, I&#39;ll keep it in mind.", "632" ], [ "@RobhercKV5ROB, A heat sink could work, but the device is a quite thin foam mat with heat from the sun beating down on the top and possibly heat from hot tarmac cooking the bottom. I&#39;m not sure if there&#39;s much opportunity for cool air to sink heat into.\n\nInterestingly, we tried putting the battery and PCB under the solar panel (which is bonded to the top of the foam enclosure), but they actually got hotter as the backside of the solar panel re-readiated the thermal energy.", "846" ], [ "Suppose $\\{f_n(x)\\}$ is a sequence in $C[a,b]$ such that for every $x \\in [a,b]$ there exists a $M_x$ such that $|f_n(x)| < M_x, n\\in \\{1,2,3,\\cdots\\}$\r\n\r\nProve that there exist a $c,d \\in [a,b]$ with $c < d$ and $M \\geq 0$ such that $|f_n(x)| \\leq M$ for all $x \\in [c,d]$.\r\n\r\nI think i need to use Baire&#39;s category theorem but i don&#39;t seem to see how to use it...\r\n\r\nAny hints?\r\n\r\n<PERSON>", "268" ], [ "suppose S is a metric space and $B(S)$ is the set of bounded functions and $C_b(S)$ is the set consisting of bounded continuous functions.\r\n\r\nProve that $C_b(S)$ is a closed subspace of $B(S)$.\r\n\r\nI thought of looking at the complement $B(S) \\backslash C_b(S) = \\{f| \\text{ f is bounded and not continuous}\\}$ and proving this is open. \r\n\r\nBut how does one check that for each element $f \\in B(S) \\backslash C_b(S)$, there exists an $\\epsilon$ such that $B_f(\\epsilon) \\subset B(S) \\backslash C_b(S)$?", "15" ], [ "tl;dr\r\n-----\r\nHow to place the equation number on the last line of an `{aligned}[t]` environment? \r\n(Similar questions have been asked in _URL_0_ and _URL_2_, but the situation I describe here is more complicated and not easily solved by the answers posted there.)\r\n\r\nThe situation\r\n-------------\r\nConsider the following situation: The `tbtags` option for the `amsmath` package is in use, i.e., tags on the right hand side should always be placed on the bottommost line of each eqution. I have multiple equations in a single `align` environment. All the relation symbols need to be aligned. In each equation I may need additional alignment points. (In the following example the opening parentheses will be aligned.) The secondary alignment points will not be at the same horizontal position. (I.e., `alignat` can&#39;t be used here.) The equations are typeset by nesting `aligned` inside `split` and `align`.\r\n\r\nThe example\r\n-----------\r\n\r\n \\documentclass{article}\r\n \\usepackage[tbtags]{amsmath}\r\n \\begin{document}\r\n \\begin{align}\r\n x & = 1234[\\!\\begin{aligned}[t]\r\n & (a+b)\\\\\r\n & (c+d+e)\\\\\r\n & (f+g)]\\end{aligned}\\\\\r\n \\begin{split}\r\n y & = 5[(h+i)+j]\\\\\r\n & = 6[\\!\\begin{aligned}[t]\r\n & (k+l)\\\\\r\n & (m+n+o)]\\end{aligned}\r\n \\end{split}\r\n \\end{align}\r\n \\end{document}\r\n\r\n![compiled example](_URL_1_)\r\n\r\nIn the image the black font shows the output when compiling the example code. The equations themselves are typeset exactly as I want, but I disagree with the position of the equation numbers. The red numbers show where I want the tags to be positioned.\r\n\r\nThe problem\r\n-----------\r\nThe equation numbers are *not* placed on what would mathematically be considered the last line of the equations, i.e., lines 3 and 6. Instead they are placed on lines 1 and 5. (I think this happens because LaTeX-internally only lines 1, 4 and 5 are actually considered lines.)\r\n\r\nThe solution?\r\n-------------\r\n1. Don&#39;t use `aligned` at all. (Don&#39;t use `split` either.) Use `\\notag` on lines 1, 2, 4 and 5. Use something like `\\hphantom{{}=prefactor[}` on lines 2, 3 and 6.\r\n2. Put each equation in a `split` and use something like `\\end{aligned}\\\\[-XXpt] & \\end{split}\\\\[YYpt]`, thus introducing a new line that LaTeX considers worthy of a number but move it upwards so that the printed tag appears not on its own line but the previous one.\r\n3. I hate soultions 1 and 2. Solution 1 requires duplication the prefactor many times (The best I can do is store it in a macro for each equation and call that on every line that needs the leading whitespace), solution 2 requires finetuning the vertical spaces XX and YY (I have no idea whether those could be measured and inserted automatically). Both are tedious, might have unintended side effects that I don&#39;t know of, it will be very annoying when typesetting a large number of equations, and it might fail if a tag has to be moved from its default position because of a long line.\r\n\r\nCan anyone think of a better, more automatic or more elegant solution?\r\n\r\nBonus question\r\n--------------\r\nIf you have a good solution for the problem above then you might also be able to answer this: How to solve the same problem when `cases` is used (instead of `aligned`), i.e., how to place the tag on the line with the last case? In this situation solution 1 cannot be used and the calculation for solution 2 becomes more complicated.\r\n\r\n\r\nBonus bonus question\r\n--------------------\r\nHow to tackle the same problem if you have `aligned` inside `cases` inside `split` inside `align`?", "335" ], [ "I have been pointed to `\\pdfsavepos` and then found the `zref-savepos` package. I tried to construct an alternative solution based on this functionality. It works (at least somewhat) for `aligned` and `cases`. The implementation basically measures the difference in position of the center and the bottom line and then `\\raisebox`es everything except the ampersand token.\r\n\r\n1. In the case of long lines the equation number is sometimes (but not always) a bit too far off. It seems to depend on the surrounding equations. (I don&#39;t understand this behavior at all.)\r\n2. If the lines are big then the tag is on the desired baseline.\r\n3. It works inside `split`.\r\n4. My alternative to `cases` does not work properly if the last case is `aligned`.\r\n\r\nI am quite unhappy with the syntax of my new commands. It is not flexible and also it is very unlike the standard environments, but this is the best I can come up with right now.\r\n\r\nIs there any way to move math content vertically without having to resort to `\\raisebox{len}{$inline-math$}`? Is there any way to raise or lower the position of the ampersand token? (It cannot be put in inline math.) \r\n\r\n \\documentclass{article}\r\n \\usepackage[tbtags]{amsmath}\r\n \\usepackage{zref-savepos}\r\n \r\n \\newcounter{index}\r\n \r\n % Three arguments:\r\n % #1 terms left of the relation symbol\r\n % #2 relation symbol and prefactors\r\n % #3 content to be put in aligned/cases\r\n \r\n \\newcommand{\\myaligned}[3]{%\r\n \\stepcounter{index}%\r\n \\raisebox{\\dimexpr\\zposy{c\\theindex}sp-\\zposy{b\\theindex}sp}{$\\displaystyle#1$}%\r\n & %\r\n \\raisebox{\\dimexpr\\zposy{c\\theindex}sp-\\zposy{b\\theindex}sp}{$\\displaystyle{}#2\\zsaveposy{c\\theindex}\\!\\begin{aligned}[t]#3\\zsaveposy{b\\theindex}\\end{aligned}$}%\r\n }\r\n \r\n \\newcommand{\\mycases}[3]{%\r\n \\stepcounter{index}%\r\n \\raisebox{\\dimexpr\\zposy{c\\theindex}sp-\\zposy{b\\theindex}sp}{$\\displaystyle#1$}%\r\n & %\r\n \\raisebox{\\dimexpr\\zposy{c\\theindex}sp-\\zposy{b\\theindex}sp}{$\\displaystyle{}#2\\zsaveposy{c\\theindex}\\begin{cases}#3\\zsaveposy{b\\theindex}\\end{cases}$}%\r\n }\r\n \r\n \\begin{document}\r\n \\begin{minipage}{.4\\textwidth}\r\n \\begin{align}\r\n % uncommenting this somehow fixes the too large separation of the first tag\r\n % a & =a\\\\\r\n \\myaligned{x}{=1234[}{\r\n & (a+b)\\\\\r\n & (c+d+e)\\\\\r\n & (f+g)loooooooong]\r\n }\\\\\r\n \\begin{split}\r\n y & =5[(h+i)+j]\\\\\r\n \\myaligned{}{=6[}{\r\n & \\biggl(k+l\\biggr)\\\\\r\n & \\biggl(m+n+o\\biggr)]\r\n }\r\n \\end{split}\r\n \\end{align}\r\n \r\n \\begin{align}\r\n x & =1\\\\\r\n \\begin{split}\r\n y & =first\\ line\\ in\\ split\\\\\r\n \\mycases{}{=prefactor}{\r\n blah\\\\\r\n blah\\\\\r\n blah\\\\\r\n blah\r\n }\r\n \\end{split}\\\\\r\n z & =3\r\n \\end{align}\r\n \r\n \\begin{align}\r\n \\mycases{y}{=2}{\r\n blah\\\\\r\n blah\\\\\r\n aligned\\!\\begin{aligned}[t] & first\\\\ & second\\end{aligned}\r\n }\r\n \\end{align}\r\n \\end{minipage}\r\n \\end{document}\r\n\r\n[![enter image description here][1]][1]\r\n\r\n\r\n [1]: _URL_0_", "335" ], [ "I am reading the book &#39;Rational points on elliptic curves&#39; of <PERSON> and Silverman, where they discuss this result. They say this is true because if a quadratic polynomial $ax^2 + bx + c$ has a rational root, the other root must be rational too, which is very trivial.\r\n\r\nBut i don&#39;t seem to get that if we look at the intersection of a line and a conic:\r\n\r\n$ax^2 + by^2 + cxy + dx + ey + f = gx + hy + i = 0. \\qquad a,b,...,i \\in \\mathbb{Q}$\r\n\r\nHow do we reduce this in the form $ax^2 + bx + c$? \r\n\r\nWith kind regards,\r\n\r\n<PERSON>", "965" ], [ "One thing that stands out to me is the lack of flyback diodes across your FETs. As your motor is an inductive load, it can very easily generate high voltages across your FETs when there is a change in current (V = L dI/dT in an inductor). These voltages can easily exceed the breakdown rating of the source-drain junction in your FETs.\r\n\r\nTo solve this, a diode is normally put in parallel with the junction to keep the voltage in check like so:\r\n\r\n[![H bridge diodes][1]][1]\r\n\r\n\r\n [1]: _URL_0_\r\n\r\n(Image from: _URL_1_)\r\n\r\nThis \" ;clamps \" ; the voltage across the FET.", "274" ], [ "Proof that $T: l^2 \\rightarrow l^2$ is compact with $T(x) = \\left(\\frac{x_1}{1},\\frac{x_2}{2},\\dots\\right)$\r\n\r\nI think that i need to prove that this function is continous and then look whether compact sets stay compact under the image. But i get stuck on two things:\r\n\r\n1) how do closed/open sets in $l^2$ look like. I can probably take the open and closed balls and look at the inverses, but are these balls always closed/open in a metric space?\r\n\r\n2) which definition of compactness is better to use here. The fact that every open cover of some set A has a finite subcovering or the fact that every sequence $\\{x_n\\}$ in $l^2$ has a subsequence that converges in $l^2$?\r\n\r\nKees", "356" ], [ "$(X,||.||)$ a Normed space, prove that when we got the property $\\sum x_n$ converges in $X$ if $\\sum||x_n||$ converges in $\\mathbb{R}$, that X is a Banach Space.\r\n\r\nSo far i have this:\r\n\r\nLet $\\{x_n\\}$ be a cauchy sequence, then we can construct a sequence such that for $n,m > N_k$:\r\n\r\n$||x_n - x_m|| < \\frac{1}{2^k}$.\r\n\r\nChoose a subsequence $y_k = \\{x_s\\}_{s \\geq N_k}$.\r\n\r\nThen\r\n\r\n$\\sum ||y_k|| \\leq \\sum \\frac{1}{2^k} + ||x_m|| \\leq \\infty$ \r\n\r\nSo we know that $\\sum y_k$ is convergent in X.\r\n\r\nI know that if a sub sequence of a Cauchy sequence is convergent, the Cauchy sequence is convergent as well.\r\n\r\nBut how does one now conclude that $y_k$ is a convergent sequence if its sum is convergent...?", "268" ] ]
389
[ 8514, 4364, 12129, 1263, 10496, 5822, 9677, 10236, 18752, 6537, 7630, 8596, 8425, 5570, 8073, 8149, 6836, 7492, 3870, 10861, 8399, 13372, 475, 14899, 932, 7645, 8292, 9166, 4065, 8644, 10416, 4452, 2641, 10826, 3659, 7912, 9501, 6723, 11785, 7952, 11249, 8107, 7339, 3656, 15175, 18405, 7109, 390, 6937, 1190, 13511, 10731, 17105, 10614, 19343, 4876, 3481, 9548, 8058, 2678, 5592, 4451, 3807, 4312, 14347, 2991, 19517, 4489, 5651, 14813, 10744, 6485, 4446, 16677, 1898, 7070, 10290, 8905, 11628, 15743, 19442, 7575, 9942, 8494, 10172, 6654, 16317, 12299, 1364, 6326, 5273, 3046, 2074, 7627, 18982, 11988, 10883, 19060, 934, 18479, 18540, 3447, 16119, 6369, 8966, 4651, 3173, 4196, 12204, 6193, 15837, 5257, 10339, 17087, 7567, 11360, 5510, 1855, 11741, 17499, 10623, 3205, 17376, 8298, 19141, 8769, 8198, 10239, 12957, 17429, 704, 10605, 3412, 5810, 4429, 6466, 13519, 3068, 2150, 2567, 16569, 6131, 7843, 6889, 3552, 7477, 8112, 12798, 8658, 4490, 8962, 16740, 6714, 5662, 13960, 5532, 18943, 1131, 7577, 13180, 7951, 5043, 8312, 386, 6233, 10993, 16402, 4175, 4767, 11587, 5249, 5371, 11034, 3684, 8487, 10699, 18106, 12296, 11893, 4215, 19487, 1850, 1219, 776, 7811, 9653, 8660, 8019, 15556, 6996, 2145, 19117, 19709, 8406, 3045, 936, 16744, 11620, 4483, 12987, 3986, 8767, 17625, 6672, 10218, 18308, 12993, 3923, 8597, 4605, 2885, 18236, 15498, 6124, 12182, 7693, 6240, 2282, 11971, 389, 6787, 10870, 14979, 7822, 18995, 9061, 8195, 8901, 6967, 6701, 8022, 8775, 6235, 7632, 7520, 1805, 19646, 6942, 2749, 7761, 4119, 12974, 12379, 3632, 16116, 9349, 8245, 12368, 8723, 4883, 10154, 12137, 12332, 18789, 18525, 8713, 10992, 11096, 14125, 8325, 1634, 482, 6992, 11734, 7491, 8217, 7008, 8179, 5599, 3388, 10428, 17969, 13598, 14349, 10653, 8057, 326, 7586, 5828, 6782, 11759, 7662, 5657, 11943, 15861, 10358, 19717, 11401, 8066, 13520, 19124, 2605, 6418, 7234, 144, 9572, 4110, 18418, 3567, 14003, 11985, 17563, 3099, 18825, 11821, 6841, 2555, 16505, 3889, 14128, 14988, 4105, 10688, 14557, 8852, 4043, 8064, 18112, 7873, 3943, 12492, 7652, 6896, 5517, 9946, 3575, 18359, 1315, 19036, 6602, 7163, 2536, 1675, 4085, 11053, 7113, 17057, 7041, 10383, 869, 4053, 9035, 7004, 6265, 8363, 12789, 1022, 13615, 7903, 7800, 11326, 6075, 681, 7482, 8282, 5278, 8544, 3769, 15603, 52, 7436, 8416, 12441, 2650, 7939, 5390, 7221, 10405, 17728, 4863, 1109, 119, 15665, 14107, 39, 5415, 1524, 10948, 16606, 10363, 1247, 14943, 5862, 4911, 4051, 7108, 2373, 11947, 16142, 2809, 7745, 15343, 2587, 9105, 6177, 14661, 14576, 10142, 8667, 2851, 12581, 8847, 462, 8950, 2079, 8488, 4582, 14784, 16112, 10707, 9740, 1687, 4570, 721, 451, 4882, 5376, 5910, 7029, 11867, 8321, 8522, 15983, 367, 3453, 17019, 9238, 17751, 15264, 17738, 8714, 3009, 8114, 6368, 13816, 5576, 872, 16015, 12101, 407, 15545, 5012, 8889, 8367, 9472, 17551, 1824, 979, 7809, 14995, 13357, 6563, 11435, 8562, 1983, 12741, 18961, 3757, 115, 8394, 11615, 2151, 14669, 8593, 5670, 15277, 18245, 8939, 7386, 10502, 9568, 1177, 15590, 18788, 10530, 4858, 2425, 14076, 13514, 4054, 18577, 18215, 19105, 18970, 11058, 19130, 8839, 9016, 13194, 11938, 4132, 15400, 10210, 15347, 18891, 17994, 12050, 13562, 6182 ]
STX_100880.0
[ [ "Due to limitations in my GIS software, I need to write select queries for each of my 200+ tables in my database. The queries need to select all columns, except for one, the SHAPE column.\r\n\r\nIs there an efficient way to get all the field names for each table - for the purpose of writing select queries?\r\n\r\nWhat I&#39;ve tried:\r\n\r\n1. I think this is possible with SQL Developer(free). But unfortunately, I don&#39;t have SQL Developer, due to I.T. challenges.\r\n\r\n2. I&#39;m aware that when I create a `SELECT *` view on a table in Oracle, the query is translated to explicitly select individual fields. So I could a) create a `SELECT *` view for each table, b) get the view definition, and c) write the query for each table. This is probably quicker than manually typing each field name, but not by a lot.\r\n\r\nHow can I efficiently write select queries for tables with lots of columns?", "346" ], [ "For the record, this is how I implemented <PERSON> in an `ESRI SDE.ST_GEOMETRY` Oracle database:\r\n\r\n SELECT\r\n a.REGISTRATION_ID \r\n ,a.TABLE_NAME\r\n ,b.QUERY_NO_SHAPE\r\n ,LENGTH(b.QUERY_NO_SHAPE) AS QUERY_LENGTH\r\n FROM \r\n SDE.TABLE_REGISTRY a\r\n LEFT JOIN \r\n (\r\n SELECT TABLE_NAME, &#39;SELECT &#39; || COL_LIST || &#39; FROM ENG.&#39; || TABLE_NAME || &#39;;&#39; QUERY_NO_SHAPE\r\n FROM\r\n (\r\n SELECT DISTINCT TABLE_NAME\r\n , LISTAGG(COLUMN_NAME, &#39;, &#39;) WITHIN GROUP (ORDER BY COLUMN_ID) OVER (PARTITION BY TABLE_NAME) COL_LIST\r\n from ALL_TAB_COLS\r\n WHERE OWNER = &#39;ENG&#39;\r\n AND COLUMN_NAME NOT LIKE &#39;SYS_%&#39;\r\n AND COLUMN_NAME < > &#39;SHAPE&#39;\r\n )\r\n ) b\r\n ON a.TABLE_NAME = b.TABLE_NAME\r\n WHERE \r\n a.OWNER=&#39;ENG&#39;\r\n\r\nThere are a bunch of **system tables** in the database that I don&#39;t need to generate queries for. So I join from `SDE.TABLE_REGISTRY` to `Joe&#39;s query` so that I only generate queries for *real* tables. Additionally, there are **system columns** within the tables that are eliminated from the query.\r\n\r\nThe longest query length is 900 characters, so the query generates/runs successfully.", "346" ], [ "I have an `ASSET_SUMMARY_VW` view:\r\n\r\n +-----------------------+---------------+\r\n | ASSET_TYPE | COST |\r\n +-----------------------+---------------+\r\n | TRANSPORTATION | 1,000,000,000 |\r\n | TRANSPORTATION | 500,000,000 |\r\n | TRANSPORTATION | 500,000,000 |\r\n | ACTIVE TRANSPORTATION | 100,000,000 |\r\n | ACTIVE TRANSPORTATION | 50,000,000 |\r\n | STORMWATER MANAGEMENT | 500,000,000 |\r\n +-----------------------+---------------+\r\n\r\nI want to GROUP BY, and calculate the percentage of each `ASSET_TYPE` compared to the total cost:\r\n\r\n +-----------------------+---------------+------------------+\r\n | ASSET_TYPE | COST | PERCENT_OF_TOTAL |\r\n +-----------------------+---------------+------------------+\r\n | TRANSPORTATION | 2,000,000,000 | 75.4 |\r\n | ACTIVE TRANSPORTATION | 150,000,000 | 5.6 |\r\n | STORMWATER MANAGEMENT | 500,000,000 | 18.8 |\r\n +-----------------------+---------------+------------------+\r\n\r\nI can divide the `COST` by a subselect that gets the total cost:\r\n\r\n SELECT \r\n ASSET_TYPE\r\n ,SUM(COST) AS COST\r\n ,SUM(COST/(\r\n SELECT \r\n SUM(COST) \r\n FROM \r\n USER.ASSET_SUMMARY_VW)\r\n ) AS PERCENT_OF_TOTAL\r\n FROM \r\n USER.ASSET_SUMMARY_VW\r\n GROUP BY \r\n ASSET_TYPE\r\n\r\nBut using a subselect seems inefficient. Is there a faster way of doing this?\r\n\r\n**Update:**\r\n\r\nSorry. I made a mistake in the original question.\r\n\r\nI&#39;ve added rows to the `ASSET_SUMMARY_VW`. The query now needs to GROUP BY.\r\n\r\n\r\n [1]: _URL_0_", "195" ], [ "I have a `ROAD` table:\r\n\r\n +----+------------+\r\n | ID | ROAD_CLASS |\r\n +----+------------+\r\n | 1 | ARTERIAL A |\r\n | 2 | ARTERIAL B |\r\n | 3 | ARTERIAL B |\r\n | 4 | ARTERIAL C |\r\n | 5 | ARTERIAL C |\r\n | 6 | ARTERIAL C |\r\n | 7 | COLLECTOR |\r\n | 8 | COLLECTOR |\r\n | 9 | LOCAL |\r\n | 10 | LOCAL |\r\n +----+------------+\r\n\r\nThe data type for the `ROAD_CLASS` field is `NVARCHAR2`.\r\n\r\nI would like to create a view that groups all arterial roads in to a single `ARTERIAL` category, but leaves the other road classes as-is:\r\n\r\n +------------+\r\n | ROAD_CLASS |\r\n +------------+\r\n | ARTERIAL |\r\n | COLLECTOR |\r\n | LOCAL |\r\n +------------+\r\n\r\nHow can I do this?\r\n\r\n**What I&#39;ve tried:**\r\n\r\nI&#39;ve successfully done part of it:\r\n\r\n SELECT\r\n (CASE \r\n WHEN ROAD_CLASS = &#39;ARTERIAL A&#39; THEN &#39;ARTERIAL&#39;\r\n WHEN ROAD_CLASS = &#39;ARTERIAL B&#39; THEN &#39;ARTERIAL&#39;\r\n WHEN ROAD_CLASS = &#39;ARTERIAL C&#39; THEN &#39;ARTERIAL&#39;\r\n --ELSE ROAD_CLASS\r\n END) AS ROAD_CLASS_GROUPED\r\n FROM\r\n USER.ROAD\r\n GROUP BY\r\n CASE \r\n WHEN ROAD_CLASS = &#39;ARTERIAL A&#39; THEN &#39;ARTERIAL&#39;\r\n WHEN ROAD_CLASS = &#39;ARTERIAL B&#39; THEN &#39;ARTERIAL&#39;\r\n WHEN ROAD_CLASS = &#39;ARTERIAL C&#39; THEN &#39;ARTERIAL&#39;\r\n END\r\n\r\n +--------------------+\r\n | ROAD_CLASS_GROUPED |\r\n +--------------------+\r\n | null |\r\n | ARTERIAL |\r\n +--------------------+\r\n\r\nHowever, instead of the other road classes being output as `null`, I&#39;d like to get their field values (`COLLECTOR` and `LOCAL`). \r\n\r\nWhen I try adding `ELSE ROAD_CLASS` to the CASE statement (as demonstrated in the SQL comment) I get an `ORA-12704: character set mismatch` error.", "38" ], [ "I have a bird entity that needs different update rules when it&#39;s moving or dying (among potentially other states).\r\n\r\nI want to avoid making my `Update` method a clutter of if-else branches like this:\r\n\r\n void Update() {\r\n if(state == movingState) {\r\n // Do moving logic.\r\n else if(state == dyingState) {\r\n // Do dying logic.\r\n else if...\r\n\r\nInstead, I thought I could make a base class for all my bird behaviours, then derive classes for each state with their own update functions, and use the appropriate derived version based on the current state.\r\n\r\n\r\n public class BirdBaseModel : MonoBehaviour\r\n {\r\n void Update()\r\n {\r\n // ...\r\n }\r\n }\r\n \r\n public class BirdMoving : BirdBaseModel\r\n {\r\n void Update()\r\n {\r\n // ...\r\n }\r\n }\r\n \r\n public class BirdDying : BirdBaseModel\r\n {\r\n void Update()\r\n {\r\n // ...\r\n }\r\n } \r\n \r\nMy `BirdBaseModel` is attached to the bird game object. Based on game states, I want to dynamically reference it in the `GameController` class.\r\n \r\n BirdBaseModel b;\r\n\r\n if(State == 1)\r\n {\r\n b = new BirdMoving();\r\n }\r\n else if(State == 2)\r\n {\r\n b = new BirdDying();\r\n }\r\n\r\nBased on the above logic, I want to call the Update function of that particular class. How do I invoke the Update of the subclass?", "970" ], [ "The game objects move from the right to the left, via a separate, working script. I want them to be destroyed when they cross the left side of the camera. How do I delete instantiated game objects when they move off the left side of the camera?\r\n\r\n----\r\n\r\nI am using this script to spawn game objects:\r\n\r\n // Use this for initialization\r\n void Start () \r\n {\r\n \tInvokeRepeating ( \" ;spawnObject \" ;, this.spawnInterval, this.spawnInterval);\r\n }\r\n \r\n void spawnObject() \r\n {\r\n \t\tfloat y = Random.Range(objectMinX, objectMaxX);\r\n\r\n \t\tGameObject newObject = Instantiate (this.prefabToSpawn, \r\n this.transform.position + new Vector3(30,y,-30), Quaternion.identity);\r\n\r\n if (newObject.transform.position.x < Camera.main.transform.position.x)\r\n {\r\n // neither the print nor Destroy gets called\r\n print( \" ;destroy \" ;);\r\n Destroy(newObject); \r\n }\r\n \t}", "85" ], [ "I just came across a coroutine in my project, which does few calculation, which could have been done using normal function.There is no loop in that coroutine and contains `yield return null;` in the last line. Is there any specific reason to use coroutine rather than normal function?\r\n\r\n void Init(){\r\n RenderObject();\r\n \r\n }\r\n \r\n \r\n IEnumerator Init(){\r\n RenderObject();\r\n yield return null;\r\n }\r\n\r\nEDIT:\r\n\r\nInside the `RenderObject` function, they are calling another coroutine which has two yield instructions `yield return true;` and `yield return new WaitUntil(() = > ` based on certain condition, calling to server takes place primarily.", "134" ], [ "I have a `roads` table:\r\n\r\n +---------+---------+\r\n | ROAD_ID | MEASURE |\r\n +---------+---------+\r\n | 1 | 1000 |\r\n | 2 | 100 |\r\n | 3 | 500 |\r\n | 4 | 9000 |\r\n +---------+---------+\r\n\r\n\r\nAnd I have a related [linear referencing][1] table called `projects`:\r\n\r\n +------------+---------+--------------+------------+\r\n | PROJECT_ID | ROAD_ID | FROM_MEASURE | TO_MEASURE |\r\n +------------+---------+--------------+------------+\r\n | 101 | 1 | 0 | 50 |\r\n | 102 | 1 | 100 | 500 |\r\n +------------+---------+--------------+------------+\r\n | 103 | 2 | 0 | 100 |\r\n +------------+---------+--------------+------------+\r\n | 104 | 3 | 100 | 200 |\r\n | 105 | 3 | 400 | 500 |\r\n +------------+---------+--------------+------------+\r\n\r\n\r\n\r\n\r\nUsers manually enter projects into application&#39;s [attribute editing environment][2] (more [here][3]).\r\n\r\nThe workflow for entering new projects is:\r\n\r\n 1. The user creates a blank new record.\r\n 2. The `FROM_MEASURE` has a default value of `0`.\r\n 3. The user enters the `ROAD_ID` manually.\r\n 4. The user enters the `TO_MEASURE` **manually**.\r\n\r\nYou can&#39;t tell from the sample table, but 9 times out of 10, projects pertain to an entire road (not just a portion of the road). An example is `PROJECT #103`.\r\n\r\nRather than make the user manually enter the `TO_MEASURE` when imputing new projects, would it be possible to get these values automatically once the `ROAD_ID` is entered?\r\n\r\n--------------\r\n\r\n**Example:**\r\n\r\n 1. The user creates a blank new record.\r\n\r\n 2. The `FROM_MEASURE` has a default value of `0`.\r\n\r\n---------\r\n\r\n \r\n +------------+---------+--------------+------------+\r\n | PROJECT_ID | ROAD_ID | FROM_MEASURE | TO_MEASURE |\r\n +------------+---------+--------------+------------+\r\n | 106 | | 0 | |\r\n +------------+---------+--------------+------------+\r\n\r\n\r\n 3. The user enters the `ROAD_ID` manually.\r\n\r\n 4. The `TO_MEASURE` is **automatically** retrieved:\r\n\r\n--------------\r\n\r\n +------------+---------+--------------+------------+\r\n | PROJECT_ID | ROAD_ID | FROM_MEASURE | TO_MEASURE |\r\n +------------+---------+--------------+------------+\r\n | 106 | 4 | 0 | 9000 | < -- Magic!\r\n +------------+---------+--------------+------------+\r\n\r\n`After ROAD_ID is updated, automatically get the related road&#39;s MEASURE value as the TO_MEASURE`.\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_\r\n [3]: _URL_2_", "821" ], [ "I have a `projects` table:\r\n\r\n +------------+-----+\r\n | PROJECT_ID | ... |\r\n +------------+-----+\r\n | LC000001 | |\r\n | LC000002 | |\r\n | LC000003 | |\r\n | LC000004 | |\r\n | LC000005 | |\r\n +------------+-----+\r\n\r\n\r\nAs you can see, the `PROJECT_ID` column has a text datatype (`NVARCHAR2`) and it has a prefix (`LC`). \r\n\r\nI&#39;m guessing that creating an ID with a prefix might have been a been a poor design choice. But, right or wrong, this is how my organization has set up it&#39;s business.\r\n\r\nI&#39;ve written a trigger that automatically inserts the next `PROJECT_ID` when a new row is created in the application&#39;s [attribute editing environment][1] (more [here][2]). \r\n\r\n CREATE OR REPLACE TRIGGER \" ;PROJECTS_PROJECT_ID_TRIG \" ; BEFORE INSERT ON PROJECTS\r\n FOR EACH ROW\r\n BEGIN\r\n SELECT &#39;LC&#39; || LPAD(TO_CHAR(CAST(SUBSTR(MAX(PROJECT_ID),-6) AS NUMBER(15,0)) + 1),6, &#39;0&#39;)\r\n INTO :NEW.PROJECT_ID\r\n FROM PROJECTS;\r\n END;\r\n\r\n\r\n\r\nHowever, this is literally the **very first trigger I have ever written**. The fact that it deconstructs the textual ID, get&#39;s the next number, and then reconstructs the textual ID, seems overly complicated to me. I can&#39;t help but think Oracle might have a more sophisticated way of handling this.\r\n\r\nIs there a better way?\r\n\r\n--------------\r\n\r\n < sup > *I have a subsequent, related question here: [Can an Oracle IDENTITY column be nullable?][3]* < /sup > \r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_2_\r\n [3]: _URL_1_", "480" ], [ "Put larger relays in between , on each branch circuit, that can handle it , <PERSON>. Your thermostat controls a huge compresser/condenser and it can do it with a tiny relay. Same thing , just more branches of control, with a PLC. And if you need a contactor at the end of each one , use a contactor. The main thing here, is that you have control. Industrial control. The guy who asked the question should just contract it out to someone who has the necessary skills, for his own safety.", "955" ], [ "For the record, I used Phil&#39;s trigger, but changed it to a `before update` trigger, rather than a `before insert` trigger (`line #2`):\r\n\r\n 1 create or replace trigger projects_btrig\r\n 2 before update on projects\r\n 3 for each row\r\n 4 declare\r\n 5 v_measure number;\r\n 6 begin\r\n 7 select measure \r\n 8 into v_measure\r\n 9 from roads \r\n 10 where road_id = :new.road_id;\r\n 11 \r\n 12 :new.to_measure := v_measure;\r\n 13 end;\r\n\r\nI had originally suggested an edit to Phil&#39;s answer, but the edit was declined (probably for good reason).", "310" ], [ "I want to create an `ID` column that automatically generates unique ID numbers by default. \r\n\r\nUsers won&#39;t be inserting rows via `INSERT` statements, rather, they&#39;ll create rows using an out-of-box [application][3] (using the [attribute editing environment][1]).\r\n\r\nI&#39;ve heard that auto-generated IDs can be achieved by creating an [Oracle IDENTITY column][2]\r\n (hint: to find the relevant section in the linked page, search for this text: `Use this clause to specify an identity column.`).\r\n\r\n--------------\r\n\r\n\r\nAnd so, I have successfully created a table with an `IDENTITY` column:\r\n\r\n CREATE TABLE A_TEST_TABLE (ID NUMBER GENERATED BY DEFAULT ON NULL AS IDENTITY);\r\n\r\nHowever, I see that the field is not nullabe:\r\n\r\n SELECT ID FROM ALL_TAB_COLUMNS WHERE TABLE_NAME = &#39;A_TEST_TABLE&#39;\r\n \r\n NULLABLE = N\r\n\r\nThis is a **problem** because my application tries to \" ;do users a favor \" ;. If a field is not nullable, the application automatically inserts a zero as a dummy value. This **overwrites** the auto-generated ID (which of course, is not what I want). I&#39;m guessing that it does this to avoid getting an error message from the database if a null value is committed.\r\n\r\nTo avoid this issue with my application, is it possible to make the field **nullabe**?\r\n\r\nWhen I read the documentation, it says:\r\n\r\n > If you specify ON NULL, then Oracle Database uses the sequence\r\n > generator to assign a value to the column when a subsequent INSERT\r\n > statement attempts to assign a value that evaluates to NULL.\r\n\r\nDoes this imply that an `IDENTITY` field can be nullable? If so, how?\r\n\r\n-------------------------\r\n\r\n*I recognize that I have no idea what I&#39;m doing. I don&#39;t even think I would ultimately want an ID field that is nullable. I&#39;m just trying to make sense of all this, and I&#39;m failing.*\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_1_\r\n [3]: _URL_0_", "480" ], [ "I have a sequence and trigger that provide auto-incrementing IDs to a `PROJECT_ID` column:\r\n\r\n PROJECTS\r\n +------------+-----+\r\n | PROJECT_ID | ... |\r\n +------------+-----+\r\n | LC000001 | |\r\n | LC000002 | |\r\n | LC000003 | |\r\n | LC000004 | |\r\n | LC000005 | |\r\n +------------+-----+\r\n\r\n CREATE SEQUENCE SEQ_PROJECT START WITH 1 INCREMENT BY 1\r\n\r\n CREATE OR REPLACE TRIGGER \" ;PROJECTS_PROJECT_ID_TRIG \" ; BEFORE INSERT ON PROJECTS\r\n FOR EACH ROW\r\n WHEN (NEW.PROJECT_ID IS NULL) \r\n BEGIN\r\n :NEW.PROJECT_ID := &#39;LC&#39; ||to_char(SEQ_PROJECT.NEXTVAL,&#39;FM000000&#39;); \r\n END;\r\n\r\n < sup > Source: [Trigger to get next prefixed ID: Is there a better way?][1] < /sup > \r\n\r\nThe sequence and trigger work just fine under normal circumstances. \r\n\r\nHowever, the [editing environment][2] in my [application][3] is **far from normal**. Users edit the data by accessing the entire table; it&#39;s almost as if the table is treated like big spreadsheet or something (which is kind of frightening when I think about it). Anyway, the scenario is called \" ;editing in the attribute table window \" ;. Users can manually edit any column in any row, which means they can override the IDs that are generated by the sequence and trigger.\r\n\r\nFor example:\r\n\r\n 1. A user creates a new row. The sequence and trigger provide an ID of `LC000006`. \r\n 2. A user then goes and manually changes `LC000001` to `LC000007`. (I can&#39;t think of a good reason why a user would do this, but they have the ability, which means it will probably happen.)\r\n 3. A user creates another new row. The sequence and trigger attempt to provide an ID of `LC000007`, but it throws an error:\r\n\r\n `Database Row Change: An unexpected failure occured. Underlying DBMS error [ORA-00001: unique constraint (USER1.PROJECT_ID_IDX) violated][USER1.PROJECTS]`\r\n\r\nThe error is caused by the **unique index** on the field.\r\nThere are can&#39;t be duplicate values.\r\n\r\nPractically speaking, I could live with the fact that my users would get an error like this (if someone on the team was unwise enough to manually override one or two `PROJECT_IDs`). All users need to do is try again, and the sequence/trigger just magically skips to the next number. \r\n\r\nBut of course, there&#39;s the possibility that there are 10&#39;s or 100&#39;s of IDs that are out-of-sequence (not just one or two). Believe it or not, this is a real possibility, due to the existence of a tool called [the field calculator][4]. With this in mind, getting an error message for 10&#39;s or 100&#39;s of out-of-sequence IDs doesn&#39;t seem so practical.\r\n\r\nSo, I&#39;m curious, can I avoid this problem somehow?\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_\r\n [3]: _URL_2_\r\n [4]: _URL_3_", "480" ], [ "@Raj To be clear though, when I got the error, I wasn&#39;t trying to manually update an `ID`. I was simply trying to create a new record. I think I got the error because the application tried to insert a zero into the `ID` field, which, now that I&#39;ve specified it as `GENERATED ALWAYS`, it won&#39;t allow this.", "789" ], [ "I have a `road_age_test` table:\r\n\r\n create table road_age_test (\r\n surface_year int,\r\n base_year int\r\n );\r\n \r\n insert into road_age_test (surface_year, base_year) values (10,20);\r\n insert into road_age_test (surface_year, base_year) values (30,null);\r\n insert into road_age_test (surface_year, base_year) values (null,40);\r\n insert into road_age_test (surface_year, base_year) values (null,null);\r\n insert into road_age_test (surface_year, base_year) values (50,50);\r\n \r\n commit;\r\n \r\n select * from road_age_test;\r\n\r\n SURFACE_YEAR BASE_YEAR\r\n ------------ ----------\r\n 10 20\r\n 30 null \r\n null 40\r\n null null\r\n 50 50\r\n\r\nI would like to select the greatest value from each column, even if one of the values is null:\r\n\r\n GREATEST_YEAR\r\n -------------\r\n 20\r\n 30\r\n 40\r\n null\r\n 50\r\n\r\nWhat&#39;s the simplest way to do this?\r\n\r\n--------------\r\n\r\nNote: Where both values are `null`, I want to return `null`, **not `0`**.", "914" ], [ "@KonradRudolph: Not only that. It also communicates that other sites _are secure_ when in fact they are not (all that&#39;s there is a certificate which you can buy for 2-3 currency, or meanwhile get for 100% free), and web browsers, this one included, do nearly everything to promote a maximally _insecure_ web. Before worrying that the NSA might track what mostly uninteresting stuff you read on SO or on Facebook, one should worry why every darn website _must_ run a dozen scripts in your browser, and why browsers need to allow scripts to do things that actually nobody wants them to be able to do.", "230" ], [ "That&#39;s not what happens at all.\r\n\r\nAs can be clearly seen in the video, the recording at 120k fps is done with **512*320** resolution, which is less than 8% of the bandwidth for 1080p. At 170k fps, the resolution is only **256*256**, and the 340k recording is done at again half that resolution, which is only 3% of the bandwidth you&#39;re talking about. \r\nThe final video on youtube is 1080p, sure, but the _source_ videos (at least the high-speed ones) are not, they&#39;re upscaled after the fact.\r\n\r\nSo, while it&#39;s still _quite some_, it&#39;s not nearly what you think it is.\r\n\r\nThe smallest model of these cameras has 72GB of RAM, and they go up to 288GB of RAM. Assuming the lowest of the resolutions they&#39;ve used in the video, and the largest model of the camera, the camera would be able to store about 2 million full-chroma frames, or about 5.8 seconds of video in RAM just like that, no need to ever write something. \r\nBut it _doesn&#39;t_ do that, it stores frames which are about 1/10 that size. So really, it can record almost one minute without ever writing out something. Add to that a fast storage medium (of which even the cheaper ones are capable of taking 100+MB/s nowadays, and top notch is more like 1GB/s), and there&#39;s little surprise how it could work. \r\nNote that thanks to parallel writes, even with a slow-ish medium which can&#39;t quite keep up with sustaining the writes indefinitely, you can greatly increase the total recording capacity so it&#39;s virtually unlimited (you don&#39;t do 2-hour high-speed recordings anyway).\r\n\r\nAs for processing/compression, ProRes 422 is not comparable to typical video compression. It is a dead simple chroma subsampling followed by a DCT, strictly constrained to a single frame. No movement estimation, prediction, interframe-dependency, none of that kind.\r\nSo basically it&#39;s a kind of sub-sampled single-frame [JPEG](_URL_1_) compression, which is well-researched for 25+ years, an [embarrassingly parallel](_URL_0_) problem, and for which dedicdated, cheap hardware that has the whole transform _hard-wired_ is readily available. Doing this fast is no technical challenge. Storing compressed data is just as fast as storing uncompressed data.", "640" ], [ "**I&#39;m trying to find rows in a table where there are line breaks.**\r\n\r\nI found some [sample code][1] that lets me do this:\r\n\r\n`where dump(f1) like &#39;%,10%&#39; and Not (dump(f1) like &#39;%100%&#39;)`\r\n\r\n---------------\r\n\r\nHowever, I&#39;m getting an unexpected result.\r\n\r\n \r\n create table test1 (f1 varchar(25));\r\n \r\n insert into test1(f1) values (&#39;Note&#39;);\r\n insert into test1(f1) values (&#39;Nota&#39;); -- < -- Slight spelling difference\r\n \r\n select * from test1 where dump(f1) like &#39;%,10%&#39; and Not (dump(f1) like &#39;%100%&#39;)\r\n\r\n F1 \r\n -------------------------\r\n Note\r\n\r\n**Why does the query return a record, if there isn&#39;t a carriage return? And why does it only return a single record?**\r\n\r\n*Prediction: I&#39;m having a brain fart and/or I have no idea what I&#39;m doing. It is Monday morning, after all.*\r\n\r\n [1]: _URL_0_", "914" ], [ "**How can I select strings that have line breaks in them?**\r\n\r\nI can think of these possibilities when it comes to line breaks in strings:\r\n\r\n create table test1 (\r\n id number(4,0),\r\n f1 varchar(25));\r\n \r\n insert into test1(id,f1) values (1,&#39;a&#39;);\r\n insert into test1(id,f1) values (2,chr(10) || &#39;a&#39;);\r\n insert into test1(id,f1) values (3,&#39;a&#39; || chr(10));\r\n insert into test1(id,f1) values (4,&#39;a&#39; || chr(10) || &#39;a&#39;);\r\n insert into test1(id,f1) values (5,&#39;a&#39; || chr(10) || chr(10) || &#39;a&#39;);\r\n insert into test1(id,f1) values (6,chr(10));\r\n commit;\r\n\r\n`chr(10)` is the value for line breaks.\r\n\r\n\r\nThere might be more possibilities that I haven&#39;t thought of.", "349" ], [ "[Dump()][1]:\r\n\r\n > DUMP returns a VARCHAR2 value containing the datatype code, length in\r\n > bytes, and internal representation of expr. The returned result is\r\n > always in the database character set.\r\n\r\n\r\n select \r\n id,\r\n f1,\r\n dump(f1)\r\n from \r\n test1 \r\n where \r\n dump(f1) like &#39;%: 10,%&#39; --Selects #2\r\n or dump(f1) like &#39;%,10&#39; --Selects #3\r\n or dump(f1) like &#39;%,10,%&#39; --Selects #4,5\r\n or dump(f1) like &#39;%: 10&#39; --Selects #6\r\n order by\r\n id\r\n\r\nAll rows with line breaks are selected. Row #1 is not selected, because it does not have a line break.\r\n\r\n\r\n[![enter image description here][2]][2]\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "761" ], [ "Two days ago, one of the Barracudas in my Synology (3 disks as RAID-5) triggered some \" ;bad sector \" ; warnings. No data lost. They&#39;re not many (62 over 24 hours, then none more) and according to SMART info, the drive is \" ;just fine \" ;. But still, it is enough for me to replace the disk. Your mileage may vary, but for me, anything non-zero in terms of bad sector is NG.\r\n\r\nSo... thanks to a large online bookstore which also sells harddrives, I got same-size replacement disks (Ironwolf) literally over night.\r\n\r\nFirst plugged one in the 4th slot, and changed the array type to RAID-6 while the old disk is still alive and kicking, to add some extra redundancy. Better be on the safe side, just in case. Once that&#39;s done, next step will be replacing the old disks one by one.\r\n\r\nSo... it&#39;s currently resyncing.\r\n\r\nI&#39;ve changed settings from \" ;less impact \" ; to \" ;resync faster \" ;, which apparently meddles with IO priorities. The impact is very noticeable, trying to access a share is very, very slow now (but of course still works). That&#39;s fine, after all we want the resync to finish soon before something more drastic may happen. Still, disk usage is only 60-56% on each disk in resource monitor. Well, that&#39;s not so bad, I guess.\r\n\r\nThe new disk is able to sustain sequential 150 MB/s writes and the old disks shouldn&#39;t have any trouble delivering that while reading sequentialy (even moreso as there&#39;s three of them, cutting down necessary bandwidth). 60% of that is something around 90 MB/s. They&#39;re 4TB disks.\r\n\r\nLet&#39;s be pessimistic and assume we _only_ get 50 MB/s throughput total. So, that is `4*(1024*1024)/50` seconds to perform the resync, or just about a little more than 23 hours.\r\n\r\nI&#39;ve left the thing alone doing its work over night, and it is meanwhile running for 26 hours. Looking at the status window, it shows 11% complete.\r\n\r\nNot like there&#39;s anything I could do about it anyway, but seriously... what&#39;s wrong? 11% after 26 hours means it&#39;s going to take almost two weeks. What the?\r\n\r\nThis is beyond my comprehension. Is there any technical reason why it would take that long?", "437" ], [ "@djsmiley2k: Sure, but restoring from backup takes _forever_, too. Plus, I&#39;d have to set up all the shares again, etc etc. Because, well, the only way to do this _without_ a resync happening anyway is by low level formatting the disks. Which, of course, also kills the whole setup. The plan (and the obvious, straightforward way) was to just plug in a new disk, wait a day, preferrably only a few hours, and be done. That&#39;s why we have the \" ;R \" ; in RAID and why such a thing as hot-plug was invented. We have these only so things _just work_ and keep running.", "437" ], [ "Restoring from backup is not a solution because it will take just as long copying data (probably much longer). If you just toss in 3 new disks (or 4 of them, doesn&#39;t matter) you need to reinstall the firmware (which is mirrored on every disk in the array), then restore all settings, and then copy over all data. Which happens while the system is performaing a background resync (no way to avoid), so it is excrutiatingly slow. To top it off with sugar, during those, whatever, 2 days, the thing is \" ;unusable \" ; because data is incomplete. Letting the RAID susbsystem do the lifting \" ;just works \" ;.", "437" ], [ "##tl;dr What font do I need for being able to read hangul on Windows 7 Professional?\r\n\r\nBack in the good old days, I&#39;ve removed everything Asian from my Windows 7 install using NTLite since it&#39;s good for nothing anyway (the stuff is huge, and I can&#39;t read it!) and it reduces the total install size by about 50%.\r\n\r\nNow, 5 years later it turns out that this was a really, really ingenious idea because I&#39;m planning to learn Korean and guess what... hangul characters show as \" ;unknown character \" ; boxes. That&#39;s immensely helpful, isn&#39;t it.\r\n\r\nTo clarify, I&#39;m not interested in localizing the UI, I need no language bar, no keyboard / input methods, none of that. I just want to be able to read hangul characters in the web browser (or, in general).\r\n\r\nSo the reason this isn&#39;t working is, of course, a system font is missing. I could probably extract that one from the install image manually, or if nothing helps just copy it over from a pristine, non-stripped Windows install in a virtual machine. No problem there.\r\n\r\nOnly just... _which font_?", "681" ], [ "So after some experimentation, it turns out that all that is missing to \" ;work \" ; (somehow) is `batang.ttc`, although Batang isn&#39;t very nice and readable at small sizes.\r\n\r\nIn order to get nice results with small text sizes as well, `gulim.ttc`as well as `malgun.ttf` are needed, too.\r\n\r\nAll of these can just be copied from and to the `Windows/Fonts` directory, done.", "558" ], [ "There is a misconception. Trimming does not cause extra writes, it **decreases** them.\r\n\r\nA SSD, or rather its NAND, has two notions of \" ;blocks \" ; of which one is actually called _block_ (usually something 128k to 512k), and the other one that is much closer to what you mean when you talk of \" ;block \" ; in terms of your filesystem is called _page_ (usually something around 4k). You can _write_ out a complete page at a time, just as you would on an old harddisk, no problem. Things just work as expected.\r\n\r\nHowever, you cannot _overwrite_ a page, they are write-once. You can thereafter only _erase_ it, making it once-writable again. This is what counts towards the NAND&#39;s lifetime. The problem is just... in reality you _cannot_ erase pages. You can only erase _blocks_ (i.e. clusters of 32-64 pages at a time). \r\n\r\nThis means that when you overwrite a page ( \" ;block \" ; in terms of filesystem), the controller has to:\r\n\r\n1. read in the complete block\r\n2. if a \" ;virgin \" ; or already erased block exists, use that one\r\n3. otherwise _clear_ the same block\r\n4. write out the complete block, having accordingly modified the contents of the overwritten page\r\n5. do some unspecified \" ;magic \" ; so the erase cycles are somewhat evenly distributed over all blocks, preventing premature death\r\n\r\nThis is somewhat simplified, but the principle is like that. A _smart_ controller might do something slightly different (e.g. remap pages logically, fill all pages until none are left, and somehow \" ;remember \" ; which ones are good and which ones are stale, etc, etc), but in principle the workflow is as outlined above. \r\n\r\nThis is a problem insofar as small writes are a common thing, so soon you have every block on your disk having been written to at least once. Now what can the controller do? Not much. It doesn&#39;t really know what the filesystem is doing or what is expected, so it has to work on the most conservative assumption. That is, everything and anything that was once written must be preserved.\r\n\r\nTRIM solves this problem. It tells the controller that a such-and-such large range _is not being used_, so the controller can as well discard it. It doesn&#39;t write anything. If at all, it will only erase blocks (though, only once, not every time). \r\nSince you told the controller that you aren&#39;t using that data, it can risk to throw it away without harm. Now suddenly there are writeable blocks available again without the need of copying around data and repeatedly erasing blocks. Which not only makes writes _faster_ but also decreases the number of erases that must happen.", "437" ], [ "Did you run `eventvwr.msc` and look under \" ;Windows Protocols \" ; -- > \" ;System \" ;? There might be information there. The log viewer is a bit of a nuisance, admittedly, but you should be able to find an entry that says \" ;system was shut down \" ; somewhere, and there might be another one (like \" ;power event <PERSON> received \" ;) nearby, probably the line above. That might give a clue as to where the problem might be located.", "401" ] ]
29
[ 14939, 6524, 16307, 19718, 6545, 2697, 3240, 12425, 14448, 4980, 2884, 894, 16907, 5981, 17941, 10925, 6706, 13510, 442, 2744, 12701, 6646, 15197, 11751, 7143, 3109, 2296, 4586, 841, 18880, 1396, 18724, 16948, 9866, 2506, 1027, 9899, 2703, 3928, 1258, 6742, 15710, 1600, 18997, 17490, 15255, 15867, 12315, 1990, 5642, 246, 6503, 4285, 4891, 12097, 16900, 1645, 11800, 1772, 2227, 12463, 18655, 6010, 16286, 2025, 5752, 2632, 805, 3335, 13922, 7256, 9498, 10124, 1954, 967, 18962, 6866, 9165, 1641, 583, 5713, 19353, 7494, 6971, 11324, 5109, 13811, 17831, 16194, 10715, 5389, 6285, 8642, 18786, 8433, 1074, 12183, 10344, 11753, 18678, 2066, 9997, 2888, 4357, 11559, 11611, 488, 6623, 17069, 145, 9417, 17766, 9595, 5692, 3733, 14835, 9461, 3856, 6017, 15820, 12432, 3610, 13623, 1040, 982, 472, 6635, 1500, 9988, 5867, 11705, 11475, 13093, 15805, 16504, 17554, 768, 14459, 6445, 17804, 15357, 5789, 3342, 10238, 12128, 12234, 575, 14027, 1123, 6784, 14559, 18116, 10046, 14798, 16268, 6608, 18444, 4414, 453, 15356, 2671, 4068, 7415, 4273, 2717, 5525, 15925, 14165, 9146, 10966, 16012, 2603, 6544, 17030, 11272, 5474, 5732, 7153, 17754, 7028, 3663, 6864, 12529, 5581, 17249, 4212, 17007, 1779, 5677, 238, 9168, 14180, 2863, 11529, 2934, 4466, 2595, 15303, 12110, 18332, 2293, 2890, 11786, 5485, 1141, 2676, 6494, 11297, 2542, 3698, 7385, 677, 19285, 10430, 5138, 2865, 6021, 11712, 1237, 1108, 3955, 3999, 12475, 17186, 13124, 18646, 16645, 5041, 9142, 13867, 10857, 7733, 16921, 10959, 19078, 15215, 19058, 18421, 15519, 6999, 17888, 13809, 12731, 3127, 8711, 19110, 7819, 17278, 1551, 9760, 822, 5203, 19291, 4764, 6502, 17155, 1, 2615, 17050, 9359, 9935, 16359, 11626, 10468, 10074, 7916, 16963, 1245, 4840, 18040, 2517, 3541, 16617, 15319, 912, 12255, 18090, 12447, 14474, 2695, 5966, 13384, 1933, 1432, 7446, 3814, 17492, 19334, 1440, 18748, 3317, 7954, 16508, 7918, 16338, 9627, 3712, 10333, 12442, 1538, 15767, 780, 1978, 15587, 2845, 1072, 6062, 19545, 13064, 19215, 18937, 1213, 6065, 14455, 4384, 14141, 18701, 17453, 4164, 13203, 13433, 6258, 15799, 16241, 5906, 4412, 1670, 13399, 9713, 6513, 2734, 8861, 16157, 38, 9917, 891, 13013, 8840, 7402, 6422, 12831, 19398, 10113, 9961, 1876, 192, 1459, 4683, 7766, 8405, 16454, 9953, 10687, 1416, 10051, 16632, 13087, 13183, 1184, 2201, 10442, 19248, 1412, 12114, 5448, 5530, 6424, 3722, 14721, 8218, 156, 9019, 14584, 9429, 7655, 18578, 13466, 15857, 10844, 972, 14166, 16967, 17642, 4773, 9491, 2784, 536, 18402, 6471, 6328, 8242, 4589, 19125, 14783, 2816, 12804, 5091, 6462, 17913, 1771, 1207, 11311, 2169, 8982, 5706, 8336, 14495, 4581, 16036, 2361, 16138, 19753, 9962, 2123, 5860, 15728, 10760, 1923, 2199, 5896, 634, 952, 14465, 15054, 19310, 19129, 9807, 9611, 17945, 3140, 8326, 2375, 5353, 17479, 12612, 14189, 18665, 14552, 10341, 5107, 17047, 6609, 7837, 2550, 12856, 7894, 8342, 3748, 2713, 3177, 16733, 17737, 720, 6735, 576, 14568, 18135, 6155, 2073, 5340, 4694, 5322, 3773, 4272, 5073, 13666, 19750, 3192, 17289, 1758, 19069, 13701, 13214, 1079, 2262, 19165, 2001, 18391, 985, 8068, 8635, 15066, 11235, 16726, 18708, 6843, 8038, 14098, 19242, 10536, 16256, 5889, 1648, 8175, 8269, 15095, 10453, 551, 1428 ]
STX_1009.0
[ [ "Albeit questions about translation are offtopic on this site, here&#39;s the way how to identify the language by yourself.\r\n\r\nFirst, note that **it is Khmer**. *In the future, you should always provide with some information where the scan came from.* This will help you limit your search.\r\n\r\nThe image is rotated upside-down. Here&#39;s the correct orientation:\r\n\r\n[![enter image description here][1]][1]\r\n\r\nThe first line reads something like:\r\n\r\n > ខំុពេញចិកូនេះដៃទៃន។\r\n\r\n**Note:** I&#39;m not familiar with Khmer, so mistakes are very possible.\r\n\r\nTo type the entire text, you may experiment with [online Khmer keyboard](_URL_2_) plus some online translator (like Google or Bing) to get a meaningful result.\r\n\r\nYou may also refer some basic reference for Khmer [consonants](_URL_1_) and [vovels](_URL_4_) to know how to read it.\r\n\r\nNote, your browser may not show the fonts properly (or, let me say, the most nice ones). It depends on the fonts used to display StackExchange. See how it looks in my browser (above) versus the [Lexilogos Web site](_URL_2_) (below).\r\n\r\n[![enter image description here][2]][2]\r\n\r\n\r\n [1]: _URL_3_\r\n [2]: _URL_0_", "270" ], [ "Well, because in most cultures, given names are not just random words. If you check their etymology, you&#39;ll notice that given names represent some virtue like *power, glory, luck, beauty*, or other dignities. For instance, <PERSON> < Heb. `hanna`, \" ;gracious \" ;. Since the number of virtues is naturally limited, the same applies to given names. This number is however multiplied if the same word comes from different languages, consider Hebrew *Anna* vs. Latin *Grace* vs. Slavonic *Milla*.", "495" ], [ "@aml, welcome to _URL_0_. While your post may answer the question, the way it&#39;s written it rather looks like a hypothesis based on common sense. Here we prefer more scientific approach. It would be great if you provided with some credible references, citing some researches, etc. Note, the question itself is very challenging, but during three years since it has been asked, nobody posted any answer. Likely, because such researches are rare to find or even inexistent. If you have one, please edit your answer.", "686" ], [ "In this problem, I&#39;m first given `n` number of values which I have to store in a space efficient manner. Then I&#39;m given `m` number of values which I have to check if they were added to the data structure before (such that after the operation, I know which value was a member, and which weren&#39;t).\r\n\r\nI could use a Bloom Filter and simply iterate through `m`, but because `m` is considerably large, I wanted to see if there are more efficient ways. One potentially exploitable property of the data is that most values will not be present. I&#39;m thinking I could construct an \" ;aggregated query \" ; which tells me if any of the value is present or not in one operation, and do something like a binary search, but wanted to see if there is already something out there.\r\n\r\nSome additional details:\r\n\r\n - I can tolerate both false positives and false negatives (with predictable error rate)\r\n - `n` is very large (trillions)\r\n - `m` is considerably large (millions)\r\n - Only very few values in `m` will be members (ca. 1 in 100K)\r\n - The data structure can be immutable (no need for frequent writes)", "712" ], [ "You have actually answered your question.\r\n\r\nAccording to the examples given, possessive is formed with the following pattern:\r\n\r\n* 3 < sup > rd < /sup > person Singular: `s` + root + `be`\r\n* 2 < sup > nd < /sup > person Plural: `s` + root + `lu`\r\n* Plus, voiced `b/d/g` in the 1st syllable of the root becomes voiceless `p/t/k`.\r\n\r\nYou must be confused with unability to tell whether or not the vowel matters here. The examples *do not provide* sufficient information to judge whether or not the vowel plays any role. Simply because there are no consistency: `pa*/ta*/ku:*` cant be compared to `be*/do*/ge*`.\r\n\r\nIn order to make sure, ask your teacher to provide with samples starting with:\r\n\r\n* `pe*/po*/pu:*`,\r\n* `te*/to*/tu:*`,\r\n* `ka*/ke*/ko*`,\r\n* `ba*/bo*/bu:*`,\r\n* `da*/de*/du:*`,\r\n* `ga*/go*/gu:*`, respectively.\r\n\r\nHence, all possible initial consonants (6 ones) and all possible vowels (4), minus six existing combinations = 6 * 4 - 6 = 18.\r\n\r\nHaving 18 additional examples, you will be able to tell whether or not the vowel matters.\r\n\r\nWith only 6 examples, the simplest rule applies, *vowel does not matter*.", "868" ], [ "<PERSON>, I understand your point. \" ;Do this \" ; is usually not the best type of answer within StackExchange, because it will not serve future readers who come here with **similar** (but not equivalent) problems. Instead, and this is what I did, explain what **factors** impact the answer and let you decide. And the definitive answer: if I were you, I would stick to ISO 639 and use \" ;Filipino \" ; for texts and `tl.yml` or `tgl.yml` for file naming.", "971" ], [ "Yes, there are such languages.\r\n\r\nHere&#39;s an excerpt from the annotation to <PERSON> [„A Consideration Of Feminine Default Gender“](_URL_0_) (2005):\r\n\r\n > Languages with gender assignment must also deal with ambiguous and unknown gender. \r\nThe gender used for an unknown or ambiguous gender is the default gender. \r\nIn some languages all nouns must be assigned a gender. \r\nIf the gender is unknown or ambiguous, however, then the language **defaults** to one of the existing genders. \r\nIn the great majority of the languages with such a system, **the default gender** will be either **the neuter** (if it is available) or **the masculine** gender.\r\n\r\n > “While the use of the feminine is possible, it is nevertheless the masculine which occurs in most languages reported on”. \r\nSome examples of this exception are **Maasai** in Kenya and Tanzania, **Mohawk** in North America, and **Welsh** in Britain and it is on these languages I concentrate.\r\n\r\n > In Maasai demonstrative pronouns use a feminine default, \r\nMohawk uses a feminine default gender in personal pronouns, \r\nand Welsh in cases where a non-referential overt subject is needed, the feminine form is used.\r\n\r\nScroll down the page for View/Download link (PDF).\r\n\r\n---\r\nFurther reading: _URL_1_", "133" ], [ "@RLG yes, if I understood your Q correctly. The logic is the following: default grammatical gender (GG) make only sense if an object is unknown. This only occurs for pronouns, not for nouns (as they have their own certain GG). However, pronouns may have different roles in different languages. An therefore, you are to decide if a certain example is useful for your research or not. The way you described it, Welsh may not be the best match to this purpose. On the other hand, you may still consider Welsh since it is the only European language in a list, and may be well-perceived by your readers.", "133" ], [ "Consider the following:\r\n\r\n* *Filipino* (register) is a [standardized](_URL_1_) register/dialect of Tagalog (language). \r\nMeaning, there are other, non-standard, dialects of Tagalog.\r\n* *Tagalog* (language) is the native language of *Tagalog* ([ethnic group](_URL_3_))\r\n* *Tagalog* (people) are one of many ethnic groups in *Philippines* (country). \r\nThere are other ethnic groups who have their own languages, and some of these languages are also official/regional in the country.\r\n\r\nHence, a text can be written in **Filipino**, while verbal services (e.g., phone support) is in **Tagalog** (assuming that the Web site does not support any other language of Philippines).\r\n\r\nHere&#39;s yet another view of the problem:\r\n\r\n > *In practical terms, Filipino is the official name of Tagalog, or even a synonym of it. Today&#39;s Filipino language is best described as \" ;Tagalog-based \" ;.*\r\n\r\n > *Use of term **Filipino** in this context is a metalepsis which suggests metaphorically that that the national language is based on an amalgam of Philippine languages rather than on Tagalog alone.*\r\n\r\n > *The language is usually called Tagalog within the Philippines and among Filipinos to differentiate it from other Philippine languages, but it has also come to be known as Filipino to differentiate it from the languages of other countries; the former implies a regional origin, the latter a national.* — [Wikipedia — Filipino language — Filipino v. Tagalog)](_URL_2_)\r\n\r\n---\r\n\r\nAs per Chinese, 中文 `[zhōng w&#233;n]` may be preferred versus 汉语 `[h&#224;n yǔ]`.\r\n\r\nThis question seems to be relevant: \r\n[中文 vs. 汉语: What&#39;s the difference?](_URL_0_)", "133" ], [ "O Hibernate pode executar SQL Nativo.\r\n\r\nSegue um exemplo:\r\n\t\r\n\r\n String sql = \" ;select sum(TOTAL_MERCADORIA_BRL) from PROCESSO group by PERIODO like &#39;DEZ-15&#39; \" ;;\r\n SQLQuery query = sessionFactory.getCurrentSession().createSQLQuery(sql);\r\n BigDecimal result = query.uniqueResult();\r\n\r\n\r\nAgora o mesmo exemplo usando HQL(Hibernate Query Language).\r\n\r\n String hql= \" ;select sum(bean.totalMercadoria) from Processo bean where bean.periodo = &#39;DEZ-15&#39; group by bean.periodo \" ;;\r\n Query query = sessionFactory.getCurrentSession().createQuery(hql);\r\n BigDecimal result = query.uniqueResult();\r\n\r\n`Processo` na HQL &#233; o nome da Entidade mapeada e o `bean` &#233; o ali&#225;s que criei, mas voc&#234; pode colocar o nome que voc&#234; quiser. O `bean.periodo` faz refer&#234;ncia ao nome do atributo da entidade mapeada, <PERSON> em considera&#231;&#227;o que o `PERIODO` &#233; do tipo varchar agora se for do tipo Date voc&#234; pode fazer desta forma\r\n\r\n Query q = sessionFactory.getCurrentSession().createQuery( \" ;select sum(bean.totalMercadoria) from Processo bean where bean.periodo = :data group by bean \" ;);\r\n q.setParameter( \" ;data \" ;, variavelData, TemporalType.DATE);\r\n\r\n\r\nO objeto `sessionFactory` &#233; do tipo [SessionFactory][1].\r\n\r\n\r\n [1]: _URL_0_", "147" ], [ "As @user6726 said in their comment, double negation is a fairly common feature of many languages.\r\n\r\nAnswering, \" ;What is the reason? \" ;, there are two aspects:\r\n\r\n1. \" ;What is the reason? \" ; in meaning, \" ;why does it present in Bulgarian, but is absent in some other languages? \" ; — because modern Bulgarian is on a different Phase of **Jespersen&#39;s Cycle**.\r\n1. \" ;What is the reason? \" ; in meaning of \" ;how it is used? \" ; — in languages with double-negation, single-negation also has meaning, but a different one.\r\n\r\n---\r\n\r\nIn his work, [Negation in English and Other Languages](_URL_1_) (1917), <PERSON> has discovered a pattern that describes how linguistic **negation** shifts between several Phases:\r\n\r\n 1. Negation is expressed by a single negative marker (**NEG1**);\r\n 1. Negation is expressed by **NEG1** in a combination with a negative adverb or noun phrase (**NEG2**);\r\n 1. **NEG2** takes on the function of expressing negation by itself; **NEG1** becomes optional;\r\n 1. **NEG1** becomes extinct and **NEG2** expresses negation on its own.\r\n\r\nSo, Bulgarian is on a Phase 2 of **Jespersen&#39;s Cycle**, while, for example, English is in Phase 4 (thanks @StoneyB for correction). It is well possible that in some distant future Bulgarian [shifts](_URL_0_) to Phase 1 or Phase 3, we don&#39;t know.\r\n\r\n---\r\n\r\nChapter VII \" ;Double Negation \" ; (page 62 in the referenced document) reviews many examples of double negation in various languages, including those belonging to Slavonic family. One of the nice ideas stated there is that even in a language with double negation, single-negation phrases are valid, and they convey a meaning, different to double-negation ones.\r\n\r\nTo give a hint (a bit stretched because it is English), think for a difference between * \" ;nobody has spoken \" ;*, * \" ;everyone has not spoken \" ;*, and * \" ;somebody has not spoken \" ;*. \r\nOr yet another example, * \" ;I didn&#39;t go nowhere \" ;* (a normal double negation) vs. * \" ;I didn&#39;t go somewhere \" ;* (I&#39;m not willing to discuss where specifically I was planning to go).", "133" ], [ "Let me [play the devil&#39;s advocate](_URL_1_) a bit. Sorry if it looks too informal.\r\n\r\nYou have not lost your English. Instead, **you have acquired a new language** (well, a dialect). \r\nAnd its name is [Simple English](_URL_0_).\r\n\r\n---\r\nLiving in your home country, you naturally communicate using your local dialect. Be it American English, British English, etc. Note that another, non-local dialect still may cause a bit of problem, e.g. for different idiomatic constructs.\r\n\r\nLiving in a foreign country, you are surrounded with people who use **Simple English**, obviously because English is L2 for them. This makes you to change your habits of using your own language, otherwise they would misunderstand you too often. Ability of *&#171;speaking rather slowly, using simple words&#187;* is essentially what is meant here.\r\n\r\nSo, you have really acquired another language. \r\n**And you have not lost your L1**. Simple proof is that you still comprehend it when listening or reading.\r\n\r\nThe real challenge is obtaining an ability to quickly **switch between the languages (dialects)**, and this is where you should probably point your efforts to.", "133" ], [ "The answer would be, **Definitely, Yes**.\r\n\r\nThe entire science of Etymology and Historical Linguistics is based on this very principle.\r\n\r\nSome linguists even consider the principle of regular changes to be a key, **fundamental discovery** of 19th century&#39;s Historical Linguistics.\r\n\r\nIf you take a modern word and you need to know its origin, you always trace an *regular, unbreakable chain of transitions* this word underwent. But you can scientifically prove these transitions only if **the whole set of words** having a certain sound **underwent exactly the same change**, not only this single word.\r\n\r\nEach phoneme transition is considered uniform (regular) *in a certain language on a certain period of time*. These changes, being combined, can drive you straight to the etymological origin of a certain word.\r\n\r\n---\r\n\r\nSay, you are curious to know how Latin `[faktum]` became modern French `[fɛ]`. You then build the following chain of transitions. Note, each transition has occurred not just in `[faktum]`, but in entire set of words having corresponding phonemes (or combinations of phonemes):\r\n\r\n* `[faktum]` — original word;\r\n* `[faktu]` — losing trailing `[m]`;\r\n* `[fak&#39;tu]` — in French territories of Latin, `[k]` weakens (almost palatalized, but not yet);\r\n* `[fajtu]` — yet further palatalization;\r\n* `[fa͡itu]` — `[aj]` transition into a diphthong `[a͡i]`;\r\n* `[fa͡it]` — fall of trailing vowel (probably, due to being unstressed/weakening);\r\n* `[fɛt]` — simplification of a diphthong into a simple vowel;\r\n* `[fɛ]` — losing trailing `[t]`, modern French.\r\n\r\nOnce again, all changes happened not with `[faktum]` only, but with entire set of words having corresponding changes.\r\n\r\n---\r\n\r\nBy using these fundamental laws, we can trace etymology of words that don&#39;t look similar at all. For instance, the word, * \" ;two \" ;* in Ukrainian is `[dva]`, while in Armenian it is `[erku]`. \r\n**Paradoxically, these two words are phonetically equivalent**, to within a set of regular transitions. \r\nFor both of them, we are able to trace them *step-by-step* back to same PIE root, because every single transition in both languages happened not with this single word, but with entire sets of words per each transition.\r\n\r\n---\r\n\r\n[Wikipedia article on Sound Change](_URL_0_) defines several core principles of these changes:\r\n\r\n1. *Sound change is exceptionless*. In other words, it is **regular**;\r\n1. *Sound change has no memory* — just like in your examples, if words obtained `[u:]` as in * \" ;good \" ;* and * \" ;book \" ;*, they will undergo **further changes** together, even if their history was completely different;\r\n1. *Sound change ignores grammar*. Instead, grammar follows them. This is why we see many words with **irregular grammar**, like * \" ;blood \" ;* versus * \" ;book \" ;* in English, weak double consonants in Ukrainian, and so forth.\r\n\r\n---\r\n\r\nSo, back to the question. To see why exactly * \" ;blood \" ;* became different to * \" ;book \" ;*, trace the chains of sound transitions for both words. Sooner or later you&#39;ll find a fundamental difference that caused these words to have different phonemes.", "202" ], [ "*(Comm. Wiki because it&#39;s not an answer but a wordy comment, sorry)*\r\n\r\nWhat you&#39;re trying to do is called `sentence generator`. Googling for this phrase shows up quite a few ready-made services on the Internet. Some of them are **open-source**, developed on a variety of platforms, programming languages, and libraries; some are using freeware word corpus.\r\n\r\nInstead of re-inventing a wheel, I suggest you to review the existing solutions to see what dictionaries, grammar libraries, and tools they are using. Or you maybe even want to **join an existing project team**. Then you may add a relatively small piece of code to make the **existing** project do what you need.\r\n\r\nIn any case, we are unable to suggest a dictionary with unknown characteristics, especially considering that you need not only a dictionary, but also some set of grammar rules of conjugation, verb governance, phrase structures, and this is multiplied by a requirement of supporting different languages. We simply can&#39;t develop the entire (!) architecture of your software, hence we can&#39;t answer this question.\r\n\r\nWhen you are started with some architecture and come back with more narrow questions, we will be happy to answer.", "421" ], [ "I recommend deleting this answer. As comment above notices, this answer mixes **intonation** and **lexical tone**. The latter is a feature when different tone makes different word. E.g. intonated \" ;home! \" ; or \" ;home? \" ; still means \" ;home \" ;, but Thai phrase /khai-khai-khai/ (High, Rising, and Low tones, correspondingly) literally means, \" ;who sells eggs \" ;. Different tone → different meaning.", "202" ], [ "In Thai, calling people as they were your relatives, is a linguistic norm. Here are some details first:\r\n\r\n1. There are **two distinct words** for \" ;brother/sister \" ;:\r\n 1. พี่ `[pʰîː]` — elder brother/sister;\r\n 4. น้อง `[nɔ́ːŋ]` — younger brother/sister;\r\n\r\n One can also use ชาย or สาว suffix to clarify *brother* vs. *sister*, e.g., น้องชาย = \" ;younger brother \" ;\r\n\r\n1. There are **four distinct words** for uncle/aunt:\r\n 1. ลุง `[luŋ]` — elder brother of either your mother or father;\r\n 1. ป้า `[pâː]` — elder sister of your mother/father;\r\n 1. อา `[ʔaː]` — younger brother/sister of your mother;\r\n 1. น้า `[náː]` — younger brother/sister of your father;\r\n\r\n1. There are also **four distinct words** for paternal/maternal grandmother/grandfather:\r\n 1. ปู่ `[pùː]` — paternal grandfather;\r\n 1. ย่า `[jâː]` — paternal grandmother;\r\n 1. ตา `[taː]` — maternal grandfather;\r\n 1. ยาย `[jaːj]` — maternal grandmother;\r\n\r\n---\r\n\r\nAs I said, using family member pronouns is very common in modern Thai. It is also considered pretty much polite (politeness is an important aspect of the language).\r\n\r\n1. If a stranger&#39;s age and social status looks like he/she could be your elder brother/sister, call them พี่ `[pʰîː]`. If their age is equal to yours, use the same word for politeness.\r\n > Note, however, that in Russian, calling a stranger \" ;brother \" ; is somewhat excessively vulgar. Unlike in Thai, where people effectively use \" ;brother/sister \" ; instead the word \" ;friend \" ;.\r\n\r\n1. If a stranger is certainly younger than you, use น้อง `[nɔ́ːŋ]`;\r\n1. If they are in the age of your parents, use ลุง `[luŋ]` for males and ป้า `[pâː]` for females.\r\n 1. Sometimes, people use constructs like คุณลุง `[kʰun luŋ]` \" ;mister uncle \" ;.\r\n 1. The same applies if you are talking to an official (e.g., a police officer). It is polite to call them \" ;Mr. Name \" ; or \" ;Mr. officer \" ;, not \" ;brother \" ;.\r\n 1. You can also use แม่ `[mɛ̂ː]` \" ;mother \" ; or พ่อ `[pʰɔ̂ː]` \" ;father \" ; to show some warmness if your friendship lasts longer.\r\n1. If they are in the age of your grandparents, yet again, they use paternal word for \" ;grandfather \" ; ปู่ `[pùː]` and maternal word for \" ;grandmother \" ; ยาย `[jaːj]`.\r\n1. Addressing someone who is in age of your children in not an exception, either. Use ลูก `[lûːk]` \" ;child \" ;.\r\n\r\n---\r\n\r\nFor further details, I would recommend this great lesson by <PERSON>: [Not Just You and Me - Getting past Khun คุณ Phom ผม and ดิฉัน DiChan in Thai](_URL_0_) (Youtube)\r\n\r\n---\r\n\r\n**Other languages**. There are many dialects of Thai, and all they have dialectal forms of family member pronouns. And they do use them just the way I described above. So I suppose that many languages from Asian/Pacific region take similar approach for addressing strangers. I haven&#39;t checked specifically, however.", "495" ], [ "[**Boustrophedon**](_URL_0_) is a kind of bi-directional text, mostly seen in ancient manuscripts and other inscriptions. Every other line of writing is flipped or reversed, with reversed letters. Rather than going left-to-right as in modern English, or right-to-left as in Arabic and Hebrew, alternate lines in boustrophedon must be read in opposite directions. Also, the individual characters are reversed, or mirrored. \r\n\r\n[![Boustrophedon][1]][1] \r\n < sup > (image courtesy of Wikipedia) < /sup > \r\n\r\n[Egyptian hieroglyphs](_URL_4_) are also known to be read in LTR or RTL directions, but I think, no document contained both directions at the same time.\r\n\r\n---\r\n\r\nAll modern writing systems have *some* order in which the symbols are aligned. However, there are systems where each symbol carries a \" ;bigger \" ; or \" ;smaller \" ; unit of information. Compare letter-based Latin script to ideographic writing systems like Chinese and Japanese.\r\n\r\nHence, albeit you can&#39;t completely eliminate losing track of symbols, the probability that you **trackback within the same row** can be higher or lower.\r\n\r\nYour question also seems to be related to **Rapid Reading** techniques (RR). If you take classes of RR, you will be taught to overcome several factors that commonly reduce your reading performance. Here are some of these:\r\n\r\n * Replacing a sequential word-by-word reading to **seeing a whole page at once** (or, actually, square blocks of text).\r\n * **Avoiding linear reading**. Alphabetic writing systems imply the words aligned horizontally. Your eyes follow a word and it requires training to follow several lines at once.\r\n\r\nFurther details: [this answer](_URL_2_) at _URL_1_.\r\n\r\n---\r\n\r\nIdeographic writing systems can also be written right-to-left and left-to-right. Here&#39;s a nice proof:\r\n\r\n<PERSON>, a first century Chinese poet, wrote a poem in the form of a 29 by 29 character grid. Her poem can be read forwards, backwards, horizontally, vertically, or diagonally, allowing for 2,848 different readings. \r\n\r\n[![poem][2]][2]\r\n\r\n\r\n [1]: _URL_3_\r\n [2]: _URL_5_", "773" ], [ "I take my chance to answer here because I&#39;ve seen many questions asked by the OP, and, to my opinion, many of these questions are language-specific.\r\n\r\nClosing questions as \" ;Language-specific \" ; has pretty straightforward reasons. This reason is, **whether or not this question is answerable in this very site**.\r\n\r\nIn order to answer questions that only apply one language, this requires having someone who&#39;s *also* familiar with this very language. Which is not given for granted.\r\n\r\nIn addition, these narrow questions seem to be hardly useful for further visitors who come here in the future.\r\n\r\n---\r\n\r\nSo, to avoid our questions being closed as \" ;language-specific \" ;, we maybe should ask ourselves:\r\n\r\n* Is there anyone in _URL_0_ who may answer this question?\r\n* How possible it is that this very question would also serve future visitors to the site?\r\n\r\nP.S. As I mentioned in [another answer](_URL_1_), **we the users shape this community**. If you can find several prominent people who would be able to answer your questions, the community may turn much more loyal to this kind of questions.", "1018" ], [ "This is actually a good question, although a bit misformulated. (1) Every script is excessive to reduce mistakes when [reading it handwritten](_URL_1_); (2) Every character is defined not by pixels, but **by strokes**, their locations, and relative positions; (3) Reducing stroke number is possible. See, or example, [PalmOS Graffiti™](_URL_0_) stroke recognition system which reduces each symbol of Latin script in no more than 3 strokes. I&#39;m pretty sure there must be no more than 5 strokes for <PERSON>.", "947" ], [ "The study is called Phrase Word Oder, or simply, [Word Order](_URL_0_), and it is an essential tool for many languages. English also uses W.O. heavily: for example, a phrase * \" ;Word order is a language tool an English speaker is familiar **with** \" ;* also looks unusual for a Slavonic language speaker due to highlighted word (we keep * \" ;with \" ;* close to the object or pronoun). When just studying a foreign language (unlike running a deep research), it&#39;s just a matter of memorizing.", "133" ], [ "I guess, you simply misunderstood.\r\n\r\nUsing spoken language naturally requires **both** abilities, hearing and talking. Therefore, a person who has difficulty with any of these abilities (or both) is forced to use sign language.\r\n\r\nFrom the medical standpoint, hearing impairment at birth leads to inability to learn how to talk, so such people, even though their vocal tract is fully functional, may have difficulty to reproduce sounds of speech. However, there are modern training techniques simplifying the process of learning.", "133" ] ]
508
[ 14672, 13646, 9407, 7935, 1619, 9236, 16321, 16595, 13636, 6696, 8191, 9985, 700, 1501, 6335, 16497, 5914, 15710, 5621, 16012, 6590, 12924, 2967, 4000, 2006, 19645, 19242, 18771, 13440, 8927, 1954, 6063, 2665, 13444, 7415, 6982, 1123, 7886, 5919, 16971, 4274, 2455, 10844, 2123, 6954, 3116, 11504, 12195, 4745, 10255, 1415, 19022, 7191, 9953, 7269, 18811, 2615, 7728, 16359, 7290, 12894, 13811, 17113, 9438, 19555, 13431, 3215, 2037, 5775, 14288, 16753, 3686, 12046, 19579, 2734, 9431, 811, 5397, 307, 12109, 8568, 16967, 18735, 5206, 7263, 17484, 12347, 6665, 9227, 12313, 16924, 38, 11444, 3018, 4992, 19503, 7563, 3177, 17856, 14662, 1577, 19226, 19297, 11939, 7749, 18016, 17988, 867, 6694, 122, 3627, 4314, 1416, 11329, 4465, 13334, 7846, 9571, 2983, 1005, 3149, 12110, 2154, 10620, 7153, 4436, 14832, 6360, 15811, 15170, 9866, 11705, 9869, 11843, 11986, 16948, 12258, 841, 15550, 801, 9310, 2038, 4589, 5046, 17409, 19386, 5789, 6980, 17211, 17020, 3928, 6700, 15441, 6175, 13867, 11987, 15309, 17554, 12584, 17617, 5148, 16316, 17026, 19731, 6689, 6273, 6301, 14558, 4817, 9127, 10583, 2339, 11188, 9633, 2805, 14971, 1198, 4493, 15913, 18578, 4450, 10871, 13554, 4878, 16390, 3674, 14223, 17757, 2138, 2923, 5705, 5410, 6735, 10994, 19065, 9535, 8607, 2671, 10491, 784, 19160, 1844, 10794, 7763, 16788, 10966, 14474, 16372, 2427, 8526, 14604, 9975, 18241, 4660, 3352, 2506, 660, 6877, 15011, 16847, 3715, 3647, 6747, 1796, 9736, 12701, 16140, 1367, 17129, 6731, 6670, 4011, 6946, 17656, 18041, 4031, 5169, 17621, 19470, 18937, 3765, 11551, 17167, 7178, 12612, 19393, 2532, 4076, 11350, 9427, 6488, 19369, 9810, 16434, 9342, 1225, 2066, 13496, 1472, 6947, 9498, 1500, 16371, 12624, 1572, 16733, 7879, 8062, 10925, 19069, 4326, 6746, 19417, 5798, 4472, 18314, 18227, 2227, 1958, 3892, 3109, 6897, 8693, 3506, 14734, 3797, 18713, 6062, 4703, 3732, 12653, 2559, 7790, 212, 441, 13591, 16972, 16308, 12310, 19152, 3043, 894, 756, 9533, 5885, 246, 13229, 9684, 14831, 15625, 940, 5525, 4735, 18786, 16059, 4921, 15996, 19642, 1765, 14495, 534, 198, 7576, 145, 9547, 13706, 7781, 18406, 5677, 14355, 2140, 8818, 6017, 503, 5251, 9878, 238, 16261, 2813, 12744, 5302, 16651, 10219, 4615, 3494, 5176, 1927, 10936, 5017, 19590, 14345, 3209, 988, 16645, 6229, 5533, 1943, 19655, 2306, 7772, 2517, 13374, 19485, 5189, 5618, 18478, 2888, 2413, 18482, 11100, 361, 12183, 7636, 12528, 4509, 1341, 10824, 18130, 17604, 8045, 14984, 11287, 4075, 601, 8451, 17207, 17276, 297, 1024, 12475, 8322, 19012, 8242, 8350, 15300, 71, 17416, 1207, 12496, 17754, 12771, 9523, 19750, 5652, 15906, 10899, 15841, 12931, 7375, 11272, 13651, 17440, 4301, 10937, 14928, 50, 15805, 8304, 14665, 2125, 16133, 17664, 11900, 1237, 19057, 15440, 10104, 692, 850, 10113, 1972, 14821, 1166, 4226, 14921, 7392, 16336, 15768, 2471, 18036, 5375, 9404, 17723, 10165, 5351, 2034, 13285, 435, 7579, 9386, 7087, 7850, 1772, 3023, 9266, 9430, 12042, 10758, 13168, 17580, 17599, 5906, 19718, 9124, 883, 9299, 15133, 18967, 13945, 3649, 5899, 6462, 4866, 1319, 565, 8536, 5203, 536, 16576, 17465, 14840, 18063, 4679, 4193, 11512, 11862, 15463, 319, 10945, 800, 8342, 4814, 3687, 12004, 3406, 9194, 16708, 18138, 17010 ]
STX_100917.0
[ [ "I get that the gravitational pseudotensor is generally only used for asymptotically flat spaces (aka quasi-Minkowski). In these cases, conserved *total* energy momenta can often be found for some system (and the various pseudotensors out there tend to agree with one another).\r\n\r\nI recently came across <PERSON> (Gravitation and Cosmology p.167) who states the reason for choosing quasi-Minkowski coordinates is to ensure convergence of the integral for energy and momenta. If this is the sole reason, then can&#39;t I utilize the gravitational pseudotensor in a finite space? (The <PERSON> universe being the simplest example I can think of)", "106" ], [ "There is the standard definitive statement of the conservation of energy momentum:\r\n\r\n$$\\nabla_{\\mu}T^{\\mu\\nu}=0$$\r\n\r\nWhich one expects to be upheld everywhere on some spacetime region M i.e four-volume (covariant divergence if not flat).\r\n\r\n$$\\intop_{M}\\nabla_{\\mu}T^{\\mu\\nu}dM=0$$ This has been shown, for the covariant (non-flat) case, (The theory of Relativity, <PERSON>, section 126) to be equivalent to the statement:\r\n\r\n$$\\partial_{\\mu}\\left(T^{\\mu\\nu}+\\tau^{\\mu\\nu}\\right)=0$$\r\n\r\nWhere $\\tau$ is the gravitational stress-energy-pseudotensor. Which allows one to apply Gauss&#39;s theorem, bringing our integral to some bounding *three*-surface $\\partial M_{\\nu}$:\r\n\r\n$$\\intop_{M}\\partial_{\\mu}\\left(T^{\\mu\\nu}+\\tau^{\\mu\\nu}\\right)=\\intop_{\\partial M}\\left(T^{\\mu\\nu}+\\tau^{\\mu\\nu}\\right)d(\\partial M)_{\\mu}=0$$\r\n\r\nFor a non compact spacetime and spacelike boundary (choosing $\\nu=0$) one will in general, have two spacelike surfaces of infinite extent ( $\\partial M_{1}$,$\\partial M_{2}$) at different times to bound some 4-region, leading to either the conclusion that energy momentum is the same over each surface, cancelling to zero over both, due to opposite surface normals (energy momentum conserved), or that it vanishes on each surface individually (energy still conserved). \r\n\r\nFor the compact case, one can enclose a region M with one hypersurface (think a comoving frame at one moment in cosmological time in the closed FRW universe for instance).\r\n\r\nleading to the conclusion that the total energy momentum of a closed universe is always zero. I&#39;ve seen arguments both ways for the closed case, is this a valid argument?", "450" ], [ "@Bob_Bee Again thank you; I would hope however that for constant R > 0 there is no spatial infinity, since this would correspond to the 3-sphere. I definitely hadn&#39;t planned on stereographically projecing it to the plane. the finite region of integration was why I asked the question, it seems there would be no issues of convergence. As <PERSON> states, the pseudotensor is lorentze covariant, so I should be able to choose the comoving coordinates and go from there integrating over the three sphere?", "59" ], [ "In general there may be different excited states the nuclei can be in, In this case one would expect the condensate to have components in these differing states. There is a reason to expect (see below reference)that, even here, there would be a type of stimulated emission leading the condensates to tend to merge toward the same state (what I think you were asking about).\r\n\r\n\r\nThere is an interesting paper (_URL_0_) about stimulated emission of massive particles using such a setup. Look into reference {1} contained therein. They have a discussion of the theoretical possibility of stimulating the transitions between nuclear states. \r\n\r\n\r\nAll of this would rely on the stimulating nuclei indeed being in a single state. Hope this helps!", "775" ], [ "For the simplest example consider the particle trapped within a box. Beginning with the ground state (n=1 lowest energy), there are an infinite number of states the particle can be in:\r\n\r\n[![enter image description here][1]][1]\r\n\r\nBecause fermions, aren&#39;t allowed to share the same state with one another, if you add more particles to the box, they each must lie in a different state. A higher energy state means the particle has more kinetic energy/ momentum.\r\n\r\nSay for simplicity, we have four particles in the box. If they were bosons, in the lowest energy state for the system, all four would have n=1. For four fermions however, they would (at the lowest energy) occupy states 1 through 4. This means that the fermions would have a higher average momentum than would four bosonic particles of the same mass. Interestingly as you add more fermions to the box, (even at the lowest energy state) the average momentum for the particles increases (which isn&#39;t necessarily the case for the bosonic particles)\r\n\r\nBecause pressure is simply (to use a classical analogue) the average momentum times the average number of particles hitting some cross sectional area of the wall, this immediately corresponds to a higher pressure for the fermions than the bosons (to put it in reverse order of your question).\r\n\r\nIn essence, I believe your question (as stated in the title) boils down to the Pauli exclusion principle.\r\n\r\n\r\n [1]: _URL_0_", "775" ], [ "Suppose we make many very small clocks such that they&#39;re subject to thermal motion. \r\n\r\nTo make things simple suppose at some moment $t_0$ all of their times are synced (yes they&#39;re in close proximity). We then check on them at some later time and graph the distribution of the various time measurements.\r\n\r\nIt seems evident that a clock not moving at all (in our reference frame) will record the greatest time change, and there will be a distribution of others that record various lesser time intervals. Clearly such a distribution will be dependent upon the mass and temperature of the clocks, but I was curious about the general shape of such a distribution. Any thoughts or places I could look? \r\n\r\nThis is a classical system, I get that quantum theory would generally come into play here\r\n\r\n**EDIT:**\r\n\r\nThis should be solvable utilizing the Maxwell-Boltzmann distribution:\r\n\r\n$$f(v)=\\left(1/2\\pi a\\right)^{3}4\\pi v^{2}e^{\\frac{-1}{2}\\left(\\frac{v}{a}\\right)^{2}}$$\r\n\r\nwhere $a=\\sqrt{kT/m}$ (T and m being the temperature and mass of our clocks respectively). The time measured by a randomly chosen clock is then:\r\n\r\n$$\\Delta t=\\int_{t_{2}}^{t_{1}}dt\\gamma^{-1}$$\r\n\r\nWhere dt is the observers&#39; (non moving clocks&#39;) proper time and the Lorentz factor gamma is going to depend upon the probablity of the particle having a particular speed at some particular time. I&#39;m not sure how to proceed with this, but already it seems like an interesting problem if one considers that our consituent parts are continually getting “smeared” out in time. Surely there&#39;s a physically measureable consequence of this. Or maybe I should use the random walk?\r\n\r\n**EDIT 1**\r\n\r\nTo address Rennie&#39;s comments below, it is claimed that the clocks will go toward the same time. ie. all of their individual time-average velocities will converge. The issue with this is that for Any arbitrarily large (but non-infinite) random walk in velocity space, the average need not fall on zero, and in fact there&#39;s always a finite probability of it falling quite far from zero (the more steps in the walk the further it could possibly be, but yes that probablity also goes down). \r\n\r\nFurthermore, if the clocks were in equilibrium prior to syncing their times (a reasonable proposition), the origin of each clocks random walk (in velocity space) would vary by a probablity depending upon the initial (Maxwell-Boltzmann) velocity distribution, such that even after an infinite amount of time the clocks would be *very* out of sync.\r\n\r\n\r\nI&#39;m asking about the shape of such a distribution for a purely thermal system as it pertains to the time interval experienced by such a body relative to another having maintained an inertial frame consistently. What is the distribution of the clocks measurements in time. I have trouble believing they would all be synced as <PERSON> says, such behavior goes against a maximal entropy state", "146" ], [ "I&#39;m just going to give a quick pointer and address your first question (Qmechanic already addressed the second in the above comment). \r\nLooking at your expression, you can write the scalar curvature as:\r\n\r\n$$R=g^{ab}R_{ab}=g^{ab}\\left[\\partial_{\\rho}\\Gamma_{ba}^{\\rho}-\\partial_{b}\\Gamma_{\\rho a}^{\\rho}+\\Gamma_{\\rho\\lambda}^{\\rho}\\Gamma_{ba}^{\\lambda}-\\Gamma_{b\\lambda}^{\\rho}\\Gamma_{\\rho a}^{\\lambda}\\right]$$\r\n\r\nIt would appear (on first glance) that the second derivatives of the metric in your expression may cancel out leaving something like:\r\n\r\n$$T_{ef}=g_{ef}g^{ab}\\left[\\Gamma_{\\rho\\lambda}^{\\rho}\\Gamma_{ba}^{\\lambda}-\\Gamma_{b\\lambda}^{\\rho}\\Gamma_{\\rho a}^{\\lambda}\\right]$$\r\n\r\nThis does indeed bear a semblence to the stress-energy-pseudotensor in it&#39;s various incarnations (it&#39;s reminding me of the <PERSON> complex which I suggest you look up) and has the requirement that it only contains first derivatives of the metric (mind you I just glanced, you would have to show the second derivative terms do indeed cancel out). Note there is no unique expression for the pseudotensor of a given system (indeed there are an infinite number of them).", "450" ], [ "@JohnRennie If course there will be some average of the distribution, but even in thermal equilibrium, there is a distribution of velocities (or speeds here for simplicity. I could simply consider the \" ;rest/inertial frame \" ; clock to be a larger one following the center of mass motion of the ensemble or one of the small clocks kept very cold. I dont believe you could claim all the clocks would have the same time.", "146" ], [ "I originally obtained something like this myself, but consider If we initially sync our clocks as stated and wait till MUCH later and measure them again they will be synced still according to the your answer, this is like starting the experiment over again. If we abruptly measure them yet again, according to the above they will have a distribution of (yes very small) fluctuations in time. But we could have skipped the second measurement in which case they should still be synced? This seems to indicate that there should always be a distribution", "518" ], [ "+1 and accepted; however my above comment remains unresolved to my point of view (maybe I&#39;m wrong about that). Ultimately, I&#39;d planned to use the notion of the clocks remaining synced over large times to draw up a distribution of allowable worldlines from $t_1$ to $t_2$ as the syncing of the times places a tight constraint on possible paths traveled between the two events. I thought it was interesting in that some paths (that would otherwise seem reasonable) are strictly forbidden by such a constraint. This in turn made me wonder if there was indeed such a constraint", "146" ], [ "The Ricci scalar may be zero, as is the Ricci tensor, but the Riemann tensor from which they both come wont be. Consider an analogy: In electristatics one says the divergence of the electric field is equal to the charge density. That doesn&#39;t mean that there is no electric field where the charge density is zero. Likewise the gravity \" ;field \" ; is measured in first derivatives of the metric whereas the Ricci scalar is measured in second derivatives (of course even the first derivatives must locally vanish for geodesic motion)", "450" ], [ "+1 for a good question. When I consider two large bodies merging, intuition says the energy for the gravitational waves comes from the relative kinetic energies and gravitational energy of the bodies (in the same way quadrapole radiation from a set of charges doesn&#39;t violate baryon number. That is just intuition however, with nothing to back it up.", "1000" ], [ "Consider a stationary charge whose electric field follows coulombs law. If we integrate the energy flux of the electric field through a bounding surface at infinity we obtain zero. \r\n\r\n\r\nNow perform a Lorentz transformation on that problem akin to that in your question, one should still obtain zero. \r\n\r\n\r\nI believe the ambiguity here lies in the fact that the electric field is essentially infinitely \" ;thin \" ; in the z-direction which makes the flux of the 1/r field still yield zero. (apologies, my phone isn&#39;t equation friendly) For example Gauss&#39; law still applies here normally as one just integrates over a closed loop with element rdtheta (zero everywhere else)\r\n\r\nAlso note that is an asymptotic expression for the limit of light speed, in reality such a situation is physically impossible.", "891" ], [ "I read a proposal (by real particle physicists) for a steerable neutrino beam source that could feasably destroy nuclear weapons anywhere on the planet from a single location [here.][1]\r\n\r\nI believe the principle was based on a the greater interaction cross section of the produced neutrinos with unstable nuclei. Such a beam would be able to travel straight through the earth to any desired location. I believe the source was based on a muon storage ring, the decay of which produced the neutrinos.\r\n\r\nAny advances or papers related to this that anyone knows of? \r\n\r\n\r\n [1]: _URL_0_", "535" ], [ "How do I get my users to upgrade in my app which has 4 screens < br > \r\n1. menu, settings, list and note page. < br > \r\n2. I don&#39;t want to be obnoxious neither pushy for them to upgrade < br > \r\n3. I hate ads so the only revenue source would be premium features < br > \r\n\r\nMy solutions were < br > \r\n1. Show premium features/buttons but when they tap on it say - \" ;Only for PRO members \" ; < br > \r\n2. Promote discount as popup < br > \r\n3. Give free 1 month membership automatically with a popup if the user is a regular user < br > \r\n4. have option to upgrade on the menu ALL THE TIME < br > \r\n\r\nI&#39;m confused.", "1009" ], [ "While the answers above are great, I Felt it was lacking what The question asked regarding an equation analogous to the Schrodinger (or <PERSON>) equation.\r\n\r\n\r\nThere is a quantity called the Riemann-Silberstein vector ( _URL_0_ ), First used by infamous <PERSON> to demonstrate a concise formulation of Maxwell&#39;s equations. \r\n\r\nThis “vector” has the form:\r\n\r\n$$\\vec{F}=\\vec{E}+ic\\vec{B}$$\r\n\r\nA quick search online, demonstrates that classical electrodynamics written in this form can be quite useful in solving problems. \r\n\r\nIn the quantum realm, a quantity analogous to the wavefunction can be written for a single photon. Such a quantity has the form:\r\n\r\n$$i\\hbar\\partial_{t}\\vec{F}=c\\left(\\vec{S}\\cdot\\frac{\\hbar}{i}\\vec{\\nabla}\\right)\\vec{F}$$ Which can be written simply in the form:\r\n\r\n$$i\\hbar\\partial_{t}\\vec{F}=c\\left(\\vec{S}\\cdot\\hat{P}\\right)\\vec{F}$$\r\n\r\nThis can be a useful quantity for examining the properties of a single photon. Start with the Wikipedia page, it&#39;s actually quite an interesting and useful quantity.", "661" ], [ "In Physics we say we have a conserved entity $\\vec{P}$ (to use a common example) if we can write:\r\n\r\n$$\\frac{\\partial}{\\partial x^{\\mu}}P^{\\mu}=P^{\\mu},_{\\mu}=0\\tag{1}$$\r\n\r\nWhere \" ;, \" ; denotes the partial derivative. Such a formulation allows us to apply Gauss&#39;s law and say that the change of our entity within some volume is equal to the rate of flux of that entity (momentum here) through a bounding surface. This can be simply written:\r\n\r\n$$\\vec{\\nabla}\\cdot\\vec{P}=0\\tag{2}$$\r\n\r\nThe situation is changed in General Relativity, as we take covariant derivatives such that the above expression becomes:\r\n\r\n$$P^{\\mu};_{\\mu}=0\\tag{3}$$\r\n\r\nMany claim that this essentially rules out a general integral conservation law in General Relativity (<PERSON>, theory of relativity pg 337; <PERSON>, gravitation and inertia pg 44; Fock space time and gravitation 163). However; a vector can be written in terms of arbitrary basis $\\hat{e}$ as:\r\n\r\n$$\\vec{P}=P^{\\mu}\\hat{e}_{\\mu}\\tag{4}$$\r\n\r\nAnd the covariant derivative can be simply written as:\r\n\r\n$$\\vec{P};_{\\alpha}=\\frac{\\partial P^{\\mu}}{\\partial x^{\\alpha}}\\hat{e}_{\\mu}+P^{\\mu}\\frac{\\partial\\hat{e}_{\\mu}}{\\partial x^{\\alpha}}\\tag{5}$$\r\n\r\nWhere the latter term (involving derivatives of the basis) is most commonly re-written in terms of <PERSON> symbols. This expression can clearly be written in the form:\r\n\r\n$$\\left(\\vec{P}\\right),_{\\alpha}=\\left(P^{\\mu}\\hat{e}_{\\mu}\\right),_{\\alpha}\\tag{6}$$\r\n\r\nThe same is true of of the standard covariant expression for the stress energy tensor in General Relativity:\r\n\r\n$$T^{\\mu\\nu};_{\\mu}=0\\tag{7}$$\r\n\r\nWhich can be written as:\r\n\r\n$$\\left(T^{\\mu\\nu}\\hat{e}_{\\mu}\\hat{e}_{\\nu}\\right),_{\\mu}=0\\tag{8}$$\r\n\r\nI don&#39;t see why this isn&#39;t a conservation law, as it only deals with the partial derivative, could someone please point me in the right direction? much appreciated", "450" ] ]
317
[ 306, 5166, 14193, 4511, 15498, 2266, 7012, 16994, 16721, 3002, 5195, 14111, 96, 16770, 11931, 18717, 3703, 2772, 12617, 19752, 7308, 17138, 4938, 17094, 10458, 5498, 19205, 10398, 18592, 3087, 15435, 18030, 11431, 6420, 16032, 18766, 19491, 16973, 2953, 11439, 10349, 7217, 17963, 4828, 5532, 15397, 10267, 13065, 2357, 5360, 16259, 7611, 10629, 19373, 15623, 9090, 6596, 1375, 13746, 15157, 3740, 5851, 9575, 9213, 7857, 11759, 5493, 8431, 4173, 9642, 17295, 5657, 16221, 16220, 16406, 15668, 19609, 14099, 5259, 17982, 12070, 13810, 1155, 17727, 4995, 6013, 3035, 3157, 11604, 4110, 7420, 1102, 8491, 5311, 12020, 10695, 18099, 12096, 18280, 13347, 7425, 8734, 7883, 2624, 491, 2930, 10887, 6541, 4083, 15288, 4827, 14944, 12368, 136, 5538, 2708, 9454, 9795, 16502, 7789, 11058, 18536, 14692, 17309, 12809, 16475, 11085, 5576, 8775, 716, 739, 3268, 13771, 5296, 19066, 8651, 17765, 4085, 4236, 4054, 7258, 4566, 295, 14814, 18129, 12621, 11203, 5118, 18123, 748, 4215, 19130, 5910, 18562, 12340, 18846, 16116, 18552, 9346, 1420, 10413, 3783, 10645, 11560, 19483, 16866, 1402, 18112, 8494, 16207, 18957, 9908, 11014, 13712, 19659, 18026, 17562, 7022, 11842, 3625, 2323, 6098, 17858, 6447, 17614, 10554, 17751, 13870, 3233, 8501, 15660, 14856, 19274, 16507, 1296, 6869, 2105, 6896, 4702, 18343, 15781, 15990, 8258, 828, 10991, 17761, 8044, 18105, 17550, 4483, 2666, 4729, 6452, 367, 6469, 3369, 19677, 15433, 6876, 8983, 5524, 8865, 17525, 19584, 4140, 10056, 14865, 7745, 15185, 9104, 9135, 8335, 18867, 3903, 858, 10948, 812, 1426, 10046, 7575, 18638, 5050, 15423, 14272, 5821, 16610, 12219, 12355, 6161, 10924, 5750, 2514, 15087, 9886, 4944, 16869, 10155, 15545, 8791, 8597, 7002, 378, 11640, 6198, 18034, 696, 380, 7591, 14916, 4431, 18527, 3420, 15665, 16391, 3606, 9472, 13896, 5196, 5795, 18657, 18740, 5517, 3231, 966, 2662, 1769, 13696, 4324, 18508, 17009, 462, 19709, 4750, 5309, 10107, 17192, 14410, 8328, 18180, 2823, 18805, 8855, 5286, 287, 6193, 12430, 11222, 15504, 1212, 657, 8489, 7607, 18878, 6563, 4066, 19533, 1751, 15994, 11764, 6126, 19400, 16533, 4651, 13379, 2776, 15819, 18010, 3396, 1286, 17587, 6793, 14293, 17551, 6843, 1799, 14396, 8745, 9600, 16150, 19343, 3793, 11893, 593, 373, 4904, 5080, 11103, 1219, 8836, 9105, 18388, 17442, 10908, 15934, 14947, 3077, 16539, 17057, 16261, 2341, 10605, 5275, 2591, 7645, 2991, 13003, 6593, 7356, 1720, 3597, 2548, 18002, 12643, 3700, 10806, 10239, 3234, 4754, 19148, 15907, 7748, 7696, 18974, 8755, 4429, 302, 8710, 2840, 6421, 19138, 16955, 15203, 2815, 8928, 1960, 15902, 6714, 18710, 19716, 16604, 8555, 18868, 247, 14209, 11845, 4247, 7477, 9284, 13827, 19141, 14247, 18470, 12659, 2183, 1068, 10506, 9994, 4242, 3687, 11565, 2735, 17221, 1003, 4693, 6457, 10747, 16995, 2513, 14887, 7231, 14978, 3247, 9891, 5591, 16357, 16617, 1588, 4648, 16700, 4476, 3171, 18788, 2561, 15893, 17451, 14114, 8925, 3419, 16133, 12302, 413, 18018, 12898, 3412, 17973, 2685, 6296, 10556, 7594, 8208, 5373, 4739, 16290, 2212, 3759, 17133, 12741, 15399, 16916, 6466, 17107, 11326, 6265, 13758, 2908, 8167, 19558, 3931, 17391, 5160, 5030, 339, 5923, 2503, 17994, 1919, 4427, 16096, 15809, 17697, 19117, 12499, 2616, 18493, 16108, 3079, 18836, 4509, 17284 ]
STX_10092.0
[ [ "Welcome and thanks for answering! ... If someone asked you in your class what word X means, your answer would \" ;it means Y here \" ; and then lecture them for several minutes on how words in general have multiple meanings? Doesn&#39;t seem very helpful in any setting, and definitely isn&#39;t here... The main focus of your answer should be how you decide which meaning of λόγος applies in this case.", "69" ], [ "In 2 Timothy 2:16-18 (ESV) <PERSON> writes:\r\n\r\n > But avoid irreverent babble, for it will lead people into more and more ungodliness, and their talk will spread like gangrene. Among them are <PERSON> and <PERSON>, who have swerved from the truth, saying that the resurrection has already happened. They are upsetting the faith of some. \r\n\r\nWhat does he mean exactly by \" ;the resurrection has already happened? \" ; First of all, all commentators see this as some of teaching about the resurrection of the dead. How can we be sure the teaching was not about Jesus&#39; resurrection?\r\n\r\nThe consensus of commentators seems to be that <PERSON> means something along the lines of \" ;there is no resurrection of the dead, \" ; perhaps because \" ;the resurrection \" ; is purely a spiritual thing, according to this teaching, that happens upon baptism/conversion. If this is correct, then why the odd phrasing? What not write something like \" ;saying that there is no resurrection of the dead \" ; or, even more direct, \" ;saying there is no afterlife \" ;? One suggestion is that these false teachers were saying you only got one chance at forgiveness (at baptism or whatever) which \" ;resurrects \" ; the soul, and thus subsequent sin kills it again, but this seems to be a stretch to me.\r\n\r\nCould there instead be an allusion to the dead who came out of their tombs on Jesus&#39; death (<PERSON> 27:52-3) in this teaching? That is, something like \" ;the only resurrection of the dead that will happen already did. \" ;\r\n\r\nSome other (speculative) options occur to me: Maybe, <PERSON> and <PERSON> were mockingly saying \" ;the dead came back to life, \" ; knowing they did not, as a way to doubt the legitimacy of the teaching? Or perhaps even they were teaching reincarnation?\r\n\r\nWhat teaching, then, is <PERSON> referring to?", "719" ], [ "Nice answer and welcome to Stack Exchange. When you have a chance, be sure to check out the [site tour](_URL_0_) and read up on how this site is [a little different](_URL_1_) than other sites around the web. *This is not a comment on the quality of your answer, but rather a standard welcome message.* Two minor comments on your answer: 1) it might be helpful to add a brief conclusion; 2) we aren&#39;t a Christian site per se, so try to avoid \" ;preaching. \" ;", "862" ], [ "You kind of just state that <PERSON> and <PERSON> were teaching a \" ;spiritual resurrection \" ; and resulting Earthly benefit, whereas my question is more how can we know (i.e guess) what they were teaching. A \" ;spiritual resurrection \" ; is indeed one of the ideas how they could be teaching that there is no (physical) resurrection because \" ;the resurrection has already happened \" ;, but I&#39;m looking for analysis on how we can pick that (or another) hypothesis as the correct one.", "745" ], [ "You don&#39;t necessarily have to rule out the alternatives, but I would expect more of an argument for you position than \" ;It also appears to be the view that the author of 2 Timothy attributes to <PERSON> and <PERSON> \" ;. Why do you think this is the meaning the author had in mind? Is it because no other explanation makes sense, or is there a positive case to be made for this interpretation? Basically, I am saying I don&#39;t think you&#39;ve justified your answer properly.", "897" ], [ "I want an explanation for why it \" ;seems \" ; or \" ;appears \" ; to be the case. The commentators I read didn&#39;t really provide one and that is why I came here - to hopefully get a more in depth explanation. My question is ***why*** should I trust this interpretation? Or phrased another way, ***how*** does one arrive at this conclusion? Your conclusion may well be right. I am not disputing the conclusion; I am asking for an explanation at how it is arrived at. Just telling me what you think the words mean doesn&#39;t help me understand why you think they mean that.", "727" ], [ "Welcome to Stack Exchange. We are glad you stopped by and hope you stay. When you have a minute, be sure to check out the [site tour](_URL_1_). In particular, see the section on what constitutes a good answer and revise your post to either cite references that back your position or to more thoroughly explain how you get this interpretation from the text itself. Please note that \" ;showing your work \" ; is [required](_URL_0_) on this Stack Exchange.", "862" ], [ "Welcome to Stack Exchange, we are glad you are here. When you have a minute, be sure to check out the [site tour](_URL_0_) and read up on how this site is [a little different](_URL_1_) than other sites around the web. *This is not a comment on the quality of your answer, but rather a standard welcome message.* That said, the question asked was off-topic, so don&#39;t take it as a guide for what kinds of questions are valid here.", "862" ], [ "Welcome to Stack Exchange. We are glad you stopped by and hope you stay. We generally are looking for in depth analysis here, preferably with citation to reliable sources. In other words, we want to know how you know something. Don&#39;t just tell us the \" ;answer \" ;, show us why we should believe your answer is correct. Please note that \" ;showing your work \" ; is [required](_URL_0_) on this Stack Exchange.", "862" ], [ "Welcome to Stack Exchange, we are glad you are here. Please consider [registering an account](_URL_0_) to fully take advantage of what this site has to offer. Also, be sure to check out the [site tour](_URL_1_) and in particular what constitutes a good answer. We aren&#39;t a discussion board, so answers are expected to 1) answer only the question asked and 2) do more than just state your opinion. Don&#39;t just tell us what you know, show us know you know it.", "862" ], [ "In I Corinthians 3:16-17, <PERSON> writes:\r\n\r\n > Do you not know that you are God’s temple and that God’s Spirit dwells in you? If anyone destroys God’s temple, God will destroy him. For God’s temple is holy, and you are that temple. (ESV)\r\n\r\nIt occurred to me today that <PERSON> might be contrasting the faith of Christians (in whom God lives) with the Jerusalem Temple (where God was thought to live) and its rituals in these verses. I checked a few commentaries and while a couple mentioned the Temple, most did not. \r\n\r\nSo my question is, how likely is it that <PERSON> was referencing The Temple, as opposed generic/Gentile temples, here?", "719" ], [ "> Πίστει καὶ αὐτὴ Σάρρα δύναμιν εἰς καταβολὴν σπέρματος ἔλαβεν καὶ παρὰ καιρὸν ἡλικίας, ἐπεὶ πιστὸν ἡγήσατο τὸν ἐπαγγειλάμενον (Hebrews 11:11, <PERSON> and <PERSON>)\r\n\r\nThe traditional translation of Hebrews 11:11 implies that it was (at least partially) Sarah&#39;s faith that allowed her to conceive. For example ESV:\r\n\r\n > By faith <PERSON> herself received power to conceive, even when she was past the age, since **she** considered him faithful who had promised. \r\n\r\nHowever, I came across [an argument](_URL_0_) that it is more likely Abraham&#39;s faith is in view of the writer. The crux of the argument, I think, is that δύναμιν εἰς καταβολὴν σπέρματος ἔλαβεν (roughly \" ;received power to conceive/deposit seed \" ;) more naturally refers to the male role of reproduction than the female role. \r\n\r\nThe NIV footnotes offer a not-very-literal translation that captures this alternative understanding:\r\n\r\n > By faith <PERSON>, even though he was too old to have children—and <PERSON> herself was not able to conceive—was enabled to become a father because **he** considered him faithful who had made the promise\r\n\r\nLikewise the NET Bible has:\r\n\r\n > By faith, even though <PERSON> herself was barren and he was too old, he received the ability to procreate, because **he** regarded the one who had given the promise to be trustworthy. \r\n\r\nThere is a significant textual variant,\r\n\r\n > Πίστει καὶ αὐτὴ Σάρρα **στεῖρα** δύναμιν εἰς καταβολὴν σπέρματος ἔλαβεν καὶ παρὰ καιρὸν ἡλικίας, ἐπεὶ πιστὸν ἡγήσατο τὸν ἐπαγγειλάμενον\r\n\r\nlisted in NA27 and elevated to the main reading in NA28 that might lend support to the alternate understanding. Textus Receptus (<PERSON>) has a ἔτεκεν after ἡλικίας, which probably does not affect much.\r\n\r\nWhat is the original reading and whose faith is more likely to be in view of the author? Is there any evidence about which sex a phrase like δύναμιν εἰς καταβολὴν σπέρματος ἔλαβεν would be more refer to in period writing? How likely is it that the writer of Hebrews would attribute a miracle to Sarah&#39;s faith based on the rest of the letter, the Genesis account, and the culture in which he wrote?", "393" ], [ "(+1) Good argument. [This paper](_URL_0_), however, suggests it is not so cut-and-dry: \" ;Not only was “the so-called Attic second declension . . . dying\nout in the Hellenistic vernacular,” but the feminine form of the\nadjective changed, often conflating with the masculine forms.\nThis would lead us to expect γνήσιε for the feminine vocative form,\nand, as we shall see, several early Christian commentators who\nwere native speakers of Greek took this passage to be the feminine\nform. \" ;", "566" ], [ "Welcome to Stack Exchange. We are glad you are here. Can you please explain how you feel this interpretation resolves the apparent conflict between the verses, because I am don&#39;t understand why the nature of the \" ;staff \" ; would enter into explaining why one account says \" ;take only a staff \" ; and in another \" ;don&#39;t take a staff \" ;. In general, don&#39;t just us what you believe, show us why you believe it to be true. Please note that \" ;showing your work \" ; is [required](_URL_0_) on this Stack Exchange.", "862" ], [ "We currently have [tag:translation-philosophy] described as:\r\n\r\n > The philosophical basis that grounds the work of translators. Questions about specific translation problems should instead be tagged hebrew, aramaic, or greek as appropriate.\r\n\r\nIt has two synonyms, [tag:translation] and [tag:translation-approaches]. We also have [tag:translation-methodology] which has no description. There is an active [proposal](_URL_0_) to merge the two. \r\n\r\nIgnoring that both tags are probably on questions they shouldn&#39;t be, is there a reason to have two tags or should they be merged? \" ;approaches \" ; would seem to be more of a synonym for \" ;methodology \" ; than \" ;philosophy \" ; so that perhaps suggests \" ;yes \" ; based on precedent. However, I am not convinced they are really the same thing.\r\n\r\nThat is, I&#39;m not sure \" ;philosophy \" ; is really the best all-encompassing term, if that is indeed the way we want to go. Perhaps we can come up with a better term to capture all the \" ;meta aspects \" ; of translation?\r\n\r\nThoughts?", "423" ], [ "I could be interested, but I think you are going to have a hard time finding a scope that both works and doesn&#39;t overlap too much between here, _URL_4_ and _URL_3_. All your examples on \" ;meta \" ; questions, but 90%+ of interest not covered by _URL_2_ would be application questions. That is, \" ;how do I apply this passage to my life. \" ; Such questions can be asked at _URL_1_ or, in principle _URL_5_ (but only if phrased as \" ;how does denomination X interpret this \" ;), depending on the religion of asker.\r\n\r\nIt is not so much a BH thing that list/opinion questions don&#39;t work well, but rather a Q-and-A format thing, because there are no objectively right answers for the OP to select. That is not to it can&#39;t work - sites like parenting and workplace have a lot of advice questions - but it will be very tricky. _URL_4_ started out allowing opinion questions, but Christians are a very diverse group so it led to many problems with extended comment arguments and popularity-based voting. Still, many of these questions such as:\r\n\r\n* Is saying “Oh My God” really using God&#39;s name in vain?\r\n* What happens to people who have never heard about <PERSON>?\r\n* Will suicide keep me out of Heaven?\r\n\r\nremain among the [most popular all-time questions](_URL_0_) despite being closed for years.\r\n\r\nSo, there is potential interest, but many pitfalls. I suggest you think carefully about these issues before proceeding.", "684" ], [ "The only thing the OP asked was \" ;what does &#39;everlasting possession&#39; mean in the context of a belief system that doesn&#39;t believe in an afterlife. \" ; That is, when <PERSON> dies, how does he \" ;retain \" ; possession of the land forever... I guess your answer is through his descendants, although that is not explicitly stated... I don&#39;t see how pointing out the doublet adds anything to the answer. As such, I am asking why you think the information is relevant to *this* question. That is, what does it say about the meaning of the phrase \" ;everlasting possession \" ;?", "37" ], [ "Welcome to the Hermeneutics Stack Exchange. If you haven&#39;t done so already, check out the [site tour](_URL_1_). In particular, be sure to read the section on what constitutes a good answer and revise your post to either cite references that back your position and to more thoroughly explain how this information answers the question asked. Please note that \" ;showing your work \" ; is [required](_URL_0_) on this Stack Exchange.", "262" ], [ "An anonymous editor attempted to add the the following: \" ;There may be no mention of Ezra&#39;s movements to restore the temple because many years had passed by. By the time <PERSON> entered the scene it was already the 20th year of <PERSON>. <PERSON> is mentioned in the book of <PERSON> in chapter 8:1 vice versa <PERSON> is mentioned in Ezra 2:2. The fact that it only took <PERSON> 52 to rebuild the walls of Jerusalem show Ezra&#39;s activity and zerubabel. In <PERSON> you read that the foundations of the walls were laid; yet the walls still remained mostly broken until Nehemiah&#39;s work. \" ;", "393" ], [ "Did you happen to see [my answer](_URL_0_) to a different question posted last night? Although not the main thrust of my argument on that question, I do conclude <PERSON> has in mind spiritual maturity when referring to \" ;the perfect \" ;. If this gets reopened, I&#39;ll post an answer explaining more fully, or otherwise I&#39;ll post that same answer on the \" ;duplicate \" ; question.", "189" ], [ "Could you maybe summarize the material in the quote? I don&#39;t mind the length, but an answer that is almost entirely a long quote from another source doesn&#39;t really fulfill the SE mission of freely reproducible answers since this will carry the publisher&#39;s copyright rather than a CC-BY-SA license intended in the SE model.", "541" ], [ "Welcome to Stack Exchange. Please consider [registering an account](_URL_0_) to fully take advantage of what this site has to offer and taking the [site tour](_URL_1_) to learn what we are about. This is a good start, but to be a good answer you need to revise your post to either cite references that back your position or to more thoroughly explain how you get this interpretation from the text itself.", "862" ], [ "Welcome to Stack Exchange. We are glad you are here. When you have a minute, be sure to check out the [site tour](_URL_1_). In particular, be sure to read the section on what constitutes a good answer and revise your post to either cite references that back your position or to more thoroughly explain how you get this interpretation from the text itself. Please note that \" ;showing your work \" ; is [required](_URL_0_) on this Stack Exchange.", "862" ], [ "Welcome to Stack Exchange, we are glad you are here. Please consider [registering an account](_URL_0_) to fully take advantage of what this site has to offer. Also, be sure to check out the [site tour](_URL_1_) to learn what we are about. This is a good start top an answer, but we generally expect a bit more than an opinion here. If you could, please revise your post to either cite references that back your position or to more thoroughly explain how you get this interpretation from the text itself.", "862" ], [ "@enegue Natural language is not logic. The rules of grammar dictate what a sentence means, not some idea of what the \" ;simplest \" ; translation is... For example, the \" ;distributed negative \" ; ( \" ;I don&#39;t like no animals \" ;) is usually considered bad English, but in some languages it is required. If one didn&#39;t understand that and tried to apply \" ;logic \" ; based on a word-for-word translation, they would likely get the exact opposite meaning out of the sentence compared to what it actually means.", "836" ], [ "[Strong&#39;s is a concordance, not a lexicon](_URL_0_). As such it only tells you how the King James translated a word. It provides zero independent witness as to a word&#39;s meaning. Saying a word \" ;means \" ; X based on Strong&#39;s is simply incorrect. To then conclude from that (and another concordance) that \" ;The original language offers little to support the idea that <PERSON> was relieving himself \" ; is highly flawed. All you can actually conclude is that the KJV translators didn&#39;t see compelling evidence for it.", "148" ], [ "Welcome to Stack Exchange, we are glad you are here. Please consider [registering an account](_URL_0_) to fully take advantage of what this site has to offer. Also, be sure to check out the [site tour](_URL_1_) and read up on how this site is [a little different](_URL_2_) than other sites around the web. Your answer is OK, but keep in mind this is not a religious site, but rather a secular academic one.", "862" ], [ "Twice in Exodus <PERSON> declares that he has \" ;uncircumcised lips. \" ;\r\n\r\n > But <PERSON> said to the LORD, “Behold, the people of Israel have not listened to me. How then shall <PERSON> listen to me, for I am of uncircumcised lips?” (Exodus 6:12, <PERSON>)\r\n\r\n > But <PERSON> said to the LORD, “Behold, I am of uncircumcised lips. How will <PERSON> listen to me?” (6:30)\r\n\r\nIt is clear enough from the context, that <PERSON> means he is \" ;unskilled at speaking \" ; (and some translations take it that way). However, the question remains why use this expression to say so? \r\n\r\nA couple commentaries I checked seemed to think it was unlikely to have been a pre-existing idiom, but rather one coined by <PERSON> (or Exodus&#39; author). Either way, it seems unlikely to me that it means *simply* \" ;unskilled, \" ; but rather has a slightly different connotation in some way. Historically, some commentators thought it was used to refer to a physical impediment. Is that option still viable? What other viable explanations have been offered?", "719" ], [ "Welcome to Stack Exchange, we are glad you are here. When you have a chance, be sure to check out the [site tour](_URL_0_) and read up on how this site is [a little different](_URL_1_) than other sites around the web... This is an OK answer, but would be greatly improved by referencing reliably sources. In general, don&#39;t just tell us what you know, show us how you know it.", "862" ], [ "##Firmament##\r\n\r\nThe primary reason the word \" ;firmament \" ; has been updated in modern translation (using the term \" ;changed \" ; is incorrect - new translations start with the original language, not the KJV text) is because language changes. While the word was an ordinary one in 1611 meaning something like\r\n\r\n > The arch or vault of heaven overhead, in which the clouds and the stars appear; the sky or heavens. (*Oxford English Dictionary*)\r\n\r\nit is now used almost exclusively in connection with the Biblical account of creation. As such, the word has taken on connotations of what people *think* the Bible authors meant. With such connotations often derived from ideas expressed by other Ancient Near East cultures, ideas which were not necessarily shared by the Hebrew people.\r\n\r\nThe Hebrew word in question is [רָקִיעַ][raqiya] (*raqiyaʿ*; root רקע, *rqʿ* ). It literally means something more like \" ;expanse \" ; or \" ;extended surface \" ;, deriving from the verb [רָקַע][rq’] (*raqa*) which means \" ;to beat, stamp, or spread out \" ;. Figuratively it is used for \" ;the vault of Heaven. \" ; (Brown-Driver-Briggs)\r\n\r\n##Heaven##\r\n\r\nThe word translated as \" ;Heaven \" ; by the King James and \" ;sky \" ; by some modern translations is [שָׁמָיִם][shamayim] (*shamayim*). The word usually means \" ;sky \" ; or \" ;heavens \" ;, but sometimes the abode of God (i.e. \" ;Heaven \" ;). (Brown-Driver-<PERSON>)\r\n\r\nModern translators correctly understand that God is not creating his abode here, but rather the sky, as the context makes it clear the creation of the parts of the Earth is what is being described. The King James translators probably understood this too, but were influenced by the theology of their day which did not see a difference between the place beyond the visible sky and Heaven. Thus, they chose the more powerful word choice. \r\n\r\nThe modern understanding of Heaven not being \" ;up there in the sky \" ; makes \" ;Heaven \" ; an inaccurate translation of the Hebrew, which is clearly talking about the physical sky in some sense. (Not all modern translations have chosen to make this update, though, as \" ;heaven(s) \" ; can still mean \" ;sky \" ; in some usages.)\r\n\r\n##Verse meaning & translation##\r\n\r\nIn Hebrew, then, verses 7 and 8 are basically saying God created the sky-like stuff and called it sky, but it a much more elegant way. Translators are tasked with translating this in an intelligent way that both retains a distinction between the creation action and what the creation was then called and uses sufficiently elegant language. In 1611, firmament was a good choice because it was a normal, semi-poetic word for arch of the sky. In 2015, firmament is a poor choice because the word is mostly archaic and has connotations that the Hebrew does not support. Thus, translators have variously picked \" ;expanse, \" ; \" ;vault, \" ; or \" ;space \" ; to express the idea conveyed in the creation act, believing such words capture the idea without the confusing (to a modern reader) use of an archaic word.\r\n\r\n[rq’]: _URL_0_\r\n[raqiya]: _URL_1_\r\n[shamayim]: _URL_2_", "148" ], [ "@Ricky I&#39;m not sure what logic you refer to - my only argument is that the meaning of words change. I did not attempt to describe the nature of sky, nor does the Hebrew original. The Hebrew word is an ordinary one and was translated as an ordinary word in 1611 and by modern translations. The technical connotations that the word \" ;firmament \" ; has taken on are due to its usage in the Bible, not something inherent to (or denied by) the Hebrew.", "148" ], [ "Genesis 1:20 reads:\r\n\r\n > וַיֹּ֣אמֶר אֱלֹהִ֔ים יִשְׁרְצ֣וּ הַמַּ֔יִם שֶׁ֖רֶץ נֶ֣פֶשׁ חַיָּ֑ה וְעֹוף֙ יְעֹופֵ֣ף עַל־הָאָ֔רֶץ עַל־פְּנֵ֖י רְקִ֥יעַ הַשָּׁמָֽיִם׃ (WLC)\r\n\r\nWhich translates as:\r\n\r\n > And <PERSON> said, “Let the waters swarm with swarms of living creatures, and let birds fly above the earth עַל־פְּנֵ֖י רְקִ֥יעַ of the heavens.” (ESV)\r\n\r\nThe phrase עַל־פְּנֵ֖י רְקִ֥יעַ, literally something like \" ;on the faces of the expanse, \" ; seems to be especially difficult to translate without referencing some outside cosmology since it doesn&#39;t make a lot of sense literally. (To clarify, when I say literally, I am thinking of \" ;face \" ; as the surface of something solid. E.g., walking on the face of the earth. Thinking of something like \" ;fish swimming on the face of the waters \" ; will perhaps clear up why I have trouble understanding the phrase literally.)\r\n\r\nThe King James chooses \" ;in the open firmament \" ; which is updated in the NASB to \" ;in the open expanse. \" ; However, other most translations render is rather differently. The ESV and NET have \" ;across the expanse \" ; while the NIV has \" ;across the vault [of the sky] \" ; and the \" ;across the dome [of the sky]. \" ;\r\n\r\nPresumably ancient people has eyes and could see birds (or \" ;flying creatures \" ;) flew up and down and thus not *on* the \" ;face \" ; (surface) of a possibly firm barrier that divided the waters (see Gen 1:6-8). As such, the phrase, it seems, must be idiomatic, as all translations take it. But, what clues do we have as to how the phrase is being used? I would prefer an answer that doesn&#39;t presuppose the account backs a certain cosmology - either the modern one of the \" ;typical \" ; Ancient Near East one. (I would also consider an alternate argument that the phrase is using \" ;poetic license \" ; and thus not an idiom *per se*.)", "508" ], [ "@BlessedGeek Um, \" ;my \" ; apostle <PERSON> has nothing to do with this question. I already knew it was a figurative usage of the term and the question states as much. The question is **WHY** did <PERSON> use the term, not what it means. Are you so eager to discredit Christianity that you can&#39;t be bothered to read what a question is actually asking? In reality, this has ZERO to do with Christianity. It is a question SOLELY about authorial INTENT, not word meaning, nor theology.", "684" ], [ "@engeugue Your are right. I don&#39;t downvote something merely for being \" ;not useful, \" ; as there are many many question/answers I find not useful (i.e. not worthy of an upvote), but also not worthy up a downvote... I will be less tactful and more explicit. I downvote posts for being *worthless* - either because they don&#39;t answer the question (the vast majority of my DVs, most of which are quickly deleted), because they show zero effort (for example link/quote only posts), or because they are blatantly wrong. Effort is a consideration, but no amount of effort alone is not enough to avoid a DV.", "641" ], [ "The placement of the genealogy of <PERSON> and <PERSON>, beginning at Exodus 6:14, appears to be a bit odd at first glance. One might expect it to be placed at Moses&#39; birth or maybe his death, but instead it is placed just before <PERSON> and <PERSON> meet with <PERSON> for the first time. Was the author of Exodus making a point by placing it where he did? \r\n\r\n(Positing multiple authors for Exodus is itself insufficient explanation. All that does is shift the question to \" ;Was the redactor of Exodus making a point by placing it where he did? \" ;)", "393" ], [ "I didn&#39;t downvote, but I do find this to be a pretty weak reasoning. It basically amounts to \" ;it seemed like a good place to put the material \" ; which would be a valid, but very vague explanation under any authorship theory... I am surprised that the \" ;break \" ; would be at 6:2, as 6:14 is the \" ;odd \" ; transition for me - if there is continuous authorship from 6:2-7:7, then that doesn&#39;t really help answer the question about the genealogy placement at all, because it is at a seemly odd place considering just that snippet in isolation. (Incidentally, your \" ;Exodus 6:2-7:7 \" ; link doesn&#39;t mention it.)", "148" ], [ "Also, I don&#39;t think your statement that P generally preferred to insert large amounts of material at once is accurate. First, the normal way the DH works is that a redactor combined multiple sources, not that each source \" ;inserted \" ; their material into an established document. Second, the scholars who \" ;decide \" ; such things quite often assign 2 or less consecutive verses to P (while of course disagreeing with each other on some points). The linked table is the \" ;major episodes \" ;, but many smaller passages are generally also assigned to P to make the hypothesis \" ;work \" ;.", "541" ], [ "@RevelationLad (+1) Are you saying there are three different events in mind? That seems a rather unnecessary conclusion. Also, in regards to source criticism, see my answer - source criticism that doesn&#39;t pre-decide the conclusion does not back Dick&#39;s answer. Invalid assumptions (e.g. Two Source Hypothesis explains all) lead to bad conclusion, source criticism does not inherently require such bad conclusions.", "686" ], [ "Welcome to Stack Exchange, we are glad you are here. Please consider [registering an account](_URL_0_) to fully take advantage of what this site has to offer. Also, be sure to check out the [site tour](_URL_1_) to learn what we are about... I think you&#39;ve answered the question, but I&#39;m not really seeing what your conclusion is. Can you better explain what these thoughts have to do with \" ;When the first day of Genesis began \" ;?", "684" ], [ "Welcome to Stack Exchange. We are glad you stopped by and hope you stay. When you have a chance, be sure to check out the [site tour](_URL_0_) and read how this site is [a little different](_URL_1_) than other sites... Your answer seems to relying on Christian theology, which is fine, but what we are really looking for is what the author had in mind. Thus, you need to explicitly connect these passages to 1 <PERSON> to show how they influenced <PERSON>.", "684" ], [ "Welcome to Stack Exchange. We are glad you stopped by and hope you stay. If you haven&#39;t done so already, check out the [site tour](_URL_1_). In particular, be sure to read the section on what constitutes a good answer and revise your post to either cite references that back your position or to more thoroughly explain how you get this interpretation from the text itself. Please note that \" ;showing your work \" ; is [required](_URL_0_) on this Stack Exchange.", "862" ], [ "This barely answers the question... The Code of Hammurabi was presumably also based on cultural norms, and if we assume Genesis is accurate history, then all people would be descendant of <PERSON> and thus perhaps retain some knowledge of \" ;proto-law \" ;. As such, saying 10C is based on proto-law doesn&#39;t really answer the question as to whether the author of Exodus used CoH as part of his knowledge base.", "393" ], [ "Your answer was fine until I got to the part about \" ;use an interlinear \" ;. An interlinear chooses how to translate the words just as much as any other translation, but doesn&#39;t \" ;fix \" ; (i.e. adjust to proper English) the grammar for you, which can give you very wrong impressions about what the Greek (or Hebrew) means if you don&#39;t understand the grammar yourself. There is no such thing as a \" ;bias-free \" ; translation or a \" ;literal \" ; translation - all translation is interpretation. Human language is not computer code.", "148" ], [ "@BruceAlderman The text provides no evidence of multiple shared sources here. To postulate a second shared source is to do so against the evidence. If <PERSON> was written by the apostle (or a disciple of the apostle), there is no reason to believe he isn&#39;t relying on his own memory. Why must any vague similarity mean <PERSON> vastly changed <PERSON>? That is merely an assumption. As to <PERSON>, I never said his source was oral, just that it was not shared with <PERSON>. Whether it is oral or written makes no difference.", "686" ], [ "The other answers are poor too - that is my they have a score of zero - so don&#39;t use them as a guide to what a good answer looks like. FYI, two of them have a downvote which was balanced out by an upvote for net zero.... To answer your question directly, the others all state what \" ;brother \" ; means in context - they don&#39;t support it well, so they are poor answers, but they do state it. Your answer states what brother is based on theology in general and doesn&#39;t even mention a Johnanine passage. The way this site works, we don&#39;t assume different authors mean the same thing in their writings.", "684" ], [ "No, it is not \" ;I don&#39;t LIKE the answer \" ; as I personally have no problem with the theology/approach. However, the community decided that _URL_0_ is not about \" ;Bible Study \" ; since it is open to people of all persuasions. As such, I am trying to help you understand what the site wants, not what I personally want. Please see [the link](_URL_1_) I provided in the first post which explains the difference between a religious site and this site.", "684" ], [ "Welcome to Stack Exchange. We are glad you stopped by and hope you stay. This has the makings of a good answer, but would be much improved if your revise your post to cite references that back your position. In general, don&#39;t just tell us what you know, show us why we should trust your information. Please note that \" ;showing your work \" ; is [required](_URL_0_) on this Stack Exchange.", "862" ], [ "@WoundedEgo What part of *How the OT defines marriage would itself be a long answer* did you not understand? I cannot answer the question in detail in comments. Nor is the definition of marriage relevant here. Try doing a Google search for \" ;Jewish marriage contract Bible \" ; if you actually want to know. I have extensively explained why I feel the author of Genesis is referring to marriage. (I also note you haven&#39;t asked any of the other answers which say the passage alludes to marriage what they mean.)", "126" ], [ "@WoundedEgo My answer says what the grammar of the text supports/doesn&#39;t support and how ancient translators and commentators took the text. It is in no way circular to say the passage means marriage because that is what the grammar supports & that is how ancient translators took it. My not defining marriage in my answer is irrelevant. The passage assumes the reader knows what marriage means. It does not seek to define it, but instead gives a justification for the practice of marriage. Through marriage, man and woman return to their natural state of one united being.", "126" ], [ "@WoundedEgo Notice that my answer does not take a stance on what marriage is precisely, only that marriage is what the author had in mind. I only told you what it is in the comments because you asked. The nature of marriage does not enter into my argument - I am NOT using Gen 2:24 itself as justification for a contractual covenant and thus it is not part of my actual answer... I do notice at least one answer says Gen 2:24 is a covenant and yet, interestingly, you haven&#39;t criticized their answer, but only mine, and for something I did not even say in my answer. Amazing.", "126" ], [ "@WoundedEgo I would say Gen 2:24 says that two become one through marriage but does not itself specify what marriage is precisely. For the answer to that, one must look elsewhere (which is why I didn&#39;t include it in my answer)... As to your answer, your memory is mistaken. While I do comment on/criticize some of your answers, this isn&#39;t one of them that I did so. Your answer of \" ;don&#39;t know \" ; is indeed a valid answer to this question and thus didn&#39;t generate any comment from me.", "126" ], [ "But on what basis do you decide *this* usage means \" ;messenger \" ;? Clearly in some cases the word does mean something special, so I think you really need to justify from the context the chosen translation each time the word is used. You sort of allude to that, but don&#39;t really explain why you think \" ;In Greek, the idea is that <PERSON> is being commissioned by <PERSON> to be a minister to the church in Philippi. \" ;", "69" ], [ "`Luke&#39;s Gospel was written after Marcion&#39;s.` That is a VERY bold assertion (I am not aware of a single scholar that believes that), and needs to be backed up, not just taken as a fact. Based on the rest of your answer, I think you are confusing the Gospel of Mark with Marcion&#39;s gospel. <PERSON> was a second century heretic who (according to all extant accounts) used an edited version of Luke&#39;s gospel + Paul&#39;s letters as his only scripture. None of Marcion&#39;s actual writing survives... Other than that error, your answer is just thoughts on the reliability of <PERSON>, which is not what was asked.", "148" ], [ "I do agree none of the answers address the question properly (probably because of a combination of it being from the early days of the site and being edited after discussion)... I don&#39;t think YEC or OEC are \" ;hermetical approaches \" ;, rather they are hypothesis about the nature of creation. (Framework is a \" ;hermetical approach. \" ;) A hermetical approach would be something like \" ;assuming something that sounds like history is intended to be literal history \" ; (YEC) or \" ;using internal clues (like a day before there is a sun) to conclude the author did not mean to convey history \" ; (OEC).", "686" ], [ "Genesis 7:21 reads:\r\n\r\n > וַיִּגְוַ֞ע כָּל־בָּשָׂ֣ר ׀ הָרֹמֵ֣שׂ עַל־הָאָ֗רֶץ בָּעֹ֤וף וּבַבְּהֵמָה֙ וּבַ֣חַיָּ֔ה וּבְכָל־הַשֶּׁ֖רֶץ הַשֹּׁרֵ֣ץ עַל־הָאָ֑רֶץ וְכֹ֖ל הָאָדָֽם׃ (WLC)\r\n\r\nThe ESV translation is fairly typical:\r\n\r\n > And all flesh died that moved on the earth, birds, livestock, beasts, all swarming creatures that swarm on the earth, and all mankind.\r\n\r\nI have been picking @Susan&#39;s brain on this verse for several days in [The Library](_URL_0_) chat room, so I thought I&#39;d go ahead and make this into a question so the results of those thoughts are more visible and to possibly also gain additional insight...\r\n\r\nThe phrase \" ;all swarming creatures that swarm on the earth \" ; is a bit strange in English, not just because of the \" ;swarming \" ; repetition (which I understand to be somewhat normal in Hebrew) but also because it is conjoined with several simple nouns. A basic principle of English (and as far as I know all language&#39;s) syntax is that you can only conjoin like with like. While both \" ;birds \" ; and \" ;all swarming creatures that swarm on the earth \" ; are noun phrases and thus conjoining them does create a grammatical sentence, it is a combination that gives the reader a different impression because the phrase \" ;sticks out \" ;. \r\n\r\nThe sentence is certainly grammatical and doesn&#39;t *need* explanation, the construction makes me think the author was doing something that would be obvious to native speakers but is opaque in English. There is also the repetition of \" ;on the earth, \" ; which may or may not provide a clue. \r\n\r\n**What, if anything, is the author of Genesis 7:21 doing with the phrase \" ;all swarming creatures that swarm on the earth \" ;?**\r\n\r\nSome suggestions:\r\n\r\n* Nothing, it would be a normal, idiomatic phrase in ancient Hebrew. Paraphrasing, something like:\r\n > And all creatures on the earth died: birds, livestock, beasts, swarmers, and mankind.\r\n* Using the phrase to make the verse more poetic\r\n* (My own unlikely suggestion, inspired by YLT&#39;s use of \" ;teeming \" ; which meant prolific in Young&#39;s day) Summing up the previous conjuncts (finishing the thought bracketed by \" ;on the earth \" ;) back into the first to emphasize all the animals died. \r\n > And all creatures on the earth died, the birds, the livestock, and the beasts, that is all of the many the abundant/prolific creatures, and mankind also.\r\n* (Susan&#39;s solid suggestion) Bracketing off the animals from mankind. That is, putting them in separate classes\r\n > And all flesh on the earth died: all the animals - birds, livestock, beasts, and swarmers - and all of mankind.\r\n* (<PERSON> suggestion) Specifying it is only the land swarmers in mind (Lev 11:10 talks of שֶׁ֣רֶץ הַמַּ֔יִם, potentially \" ;swarmers in the water \" ; although not usually translated that way).\r\n > And all creatures on the earth died: birds, livestock, beasts, land swarmers, and mankind.\r\n* Some other form of emphasis", "508" ], [ "Welcome to Stack Exchange, we are glad you are here. Please consider [registering an account](_URL_0_) to fully take advantage of what this site has to offer. Also, be sure to check out the [site tour](_URL_1_) and in particular what constitutes a good answer. While a quote from a reliable source is good *part* of an answer, we generally expect at least some original content too (e.g. analysis or summary).", "862" ], [ "Welcome to Stack Exchange, we are glad you are here. Please consider [registering an account](_URL_0_) to fully take advantage of what this site has to offer. Also, check out the [site tour](_URL_1_) and read up on how this site is [a little different](_URL_2_) than other sites around the web. This is an OK answer, but would be greatly improved by citing a reference to back what you \" ;think \" ; is true.", "862" ], [ "Welcome to Stack Exchange, we are glad you are here. When you have a chance, be sure to check out the [site tour](_URL_0_) and in particular what constitutes a good answer. We aren&#39;t a discussion board, so answers are expected to 1) answer only the question asked and 2) do more than just state your opinion. This sort of speculation isn&#39;t usually well received here - instead of just stating what you think the text means, you should show us how you derive such an interpretation from the text", "862" ], [ "You have some very nice research here, and this is a pretty good answer. However, it would be better to summarize this works and/or only quote the most relevant sections. Stack Exchange is primarily about creating original content which can be freely shared under the CC-BY-SA license. Answers that are mostly quotes don&#39;t meet that goal as the original authors retain their copyrights, making the answer not freely reusable.", "862" ], [ "Grammatical gender (in this case feminine) is not (usually) related to human gender. Most words have a single gender that is used in all sentences regardless of whether it belongs to a man or woman. \r\n\r\nThe possessive pronoun in the English of I Corinthians 11:4 does not come from the word for head itself, but rather is \" ;added \" ; to make the English grammatical. (Which is indicated by the brackets on Biblehub.) The Greek says simply \" ;having on head \" ; but that doesn&#39;t make any sense in English, so it becomes \" ;having [anything] on [his] head. \" ; \r\n\r\nAs to why it is \" ;his \" ; instead of \" ;her \" ;, in English the possessive corresponds to human gender. The subject of the sentence in I Corinthians 11:4 is \" ;every man, \" ; so the corresponding possessive pronoun must be masculine. Think of it this way - if \" ;head \" ; was say \" ;hands \" ; you wouldn&#39;t be asking why it says \" ;his \" ; (singular) instead of \" ;their \" ; (plural). Grammatical gender works the same way.", "868" ], [ "Welcome to Stack Exchange, we are glad you are here. When you have a chance, be sure to check out the [site tour](_URL_0_) and in particular what constitutes a good answer. We aren&#39;t a discussion board, so answers are expected to 1) answer only the question asked and 2) do more than just state your opinion. Additionally, answers that stem from theology don&#39;t usually go over well here, as we prefer answers that stem from the text. It is fine if that leads to a religious conclusion, but the direction should always be text- > conclusion, not theology- > text.", "684" ], [ "Welcome to Stack Exchange. We are glad you stopped by and hope you stick around. This looks like the start to a good answer, but we are generally looking for a bit more here. Specifically, you answer would be improved if you edit your post to either cite references that back your position. Please note that \" ;showing your work \" ; is [required](_URL_0_) on this Stack Exchange. In general, don&#39;t just tell us what you know - show us why we should believe it.", "862" ], [ "Welcome to Stack Exchange. We are glad you stopped by and hope you stick around. When you have a chance, check out the [site tour](_URL_1_). In particular, be sure to read the section on what constitutes a good answer and revise your post to either cite references that back your position or to more thoroughly explain how you get this interpretation from the text itself. Please note that \" ;showing your work \" ; is [required](_URL_0_) on this Stack Exchange.", "862" ], [ "Leviticus 27:2-8 gives the \" ;valuations \" ; of people vowed to God. For example,\r\n\r\n > If anyone makes a special vow to the LORD involving the valuation of persons, then the valuation of a male from twenty years old up to sixty years old shall be fifty shekels of silver, according to the shekel of the sanctuary. (27:2b-3, ESV)\r\n\r\nMost commentators seem to assume that these numbers are the redemption price of the person. That is, the price that must be paid instead of the vowed object becoming property of the Temple. For example, [Matthew Henry](_URL_0_):\r\n\r\n > Some persons who thus dedicated themselves might be employed as assistants; in general they were to be redeemed for a value. \r\n\r\nThis interpretation is based on the latter half of the chapter, where it is clear that objects can be \" ;bought back \" ; after being vowed. For example,\r\n\r\n > And if the donor wishes to redeem his house, he shall add a fifth to the valuation price, and it shall be his. (27:15)\r\n\r\nHowever, there is no \" ;if he wishes to redeem \" ; language in 27:2-8 and verse 8 adds a provision for people who are unable to afford the valuation being given an alternative one. This would suggest something different is going on here. In a comment on a [related question](_URL_1_), SE member [disciple](_URL_2_) suggests that this is because the redemption of the person is not optional. This idea explains lack of redemption language in the passage, but creates other problems: It seems to make the vow pointless (why not just donate the money or equivalent to begin with instead of vowing oneself and then redeeming oneself) and also removes the possibility of actually offering a person for Temple service in contrast to, for example, I <PERSON>.\r\n\r\nAn alternate interpretation has occurred to me: that the valuation could be a fee given in addition to the service. That is, it is money given in recognition of the privilege of getting to serve the Lord in an official capacity. This would explain why it does not seem to be optional and also explain why the poor person is allowed to pay a lower price. It would also make some sense in that the person would be \" ;paying their own way. \" ;\r\n\r\nSo which is correct? **Is the \" ;valuation \" ; an (optional) redemption price to get out of the vow, a mandatory redemption, or a fee for the privilege of participating in the Temple service?**", "719" ], [ "The first part of this answer is excellent, so +1. If the answer ended at \" ;`Connecting the genealogy to the second message serves to reinforce the significance of this message` \" ; you would probably have gotten the accept as well. However, you lost me when you started talking about the Bible as a whole. I don&#39;t understand what you are trying to say and especially don&#39;t understand the graphic. How is it \" ;understood \" ; that the genealogy comes first? How is this an example of making the last first?", "684" ], [ "I&#39;m trying to change the exit relay node of Tor to the UK, temporarily ([as advised here][1]). The advice is to add a bit of code in torrc. \r\n\r\nNow, I can find only the files \" ;old \" ; torrc, torrc.orig (empty) and torrc.defaults on my machine, none of which seem to do the job - they are very small files and don&#180;t contain much code. What am I missing? \r\nNote, I&#39;m completely uneducated in this field and just trying to follow instructions posted on this forum, apologies for the naive question. Apologies and appreciations in advance. \r\n\r\n\r\n [1]: _URL_0_", "1013" ], [ "Enoch is only fully extant in Ge&#39;ez, but it is also known form Aramaic, Greek, and Latin fragments which means at one time it existed in all of these languages. The original language is debatable, but it is certain <PERSON> was extant in Greek during the New Testament period (for example, it is quoted by church fathers). As such, I think your argument about Luke&#39;s audience being unaware of <PERSON> falls apart.", "216" ], [ "Thanks, much clearer now. I don&#39;t think it is necessary - that Moses&#39; mother was introduced when necessary and that his full genealogy is introduced when his life really \" ;begins \" ; is a sufficient and strong explanation. It is somewhat distracting and might be the reason mine is the only upvote, but I&#39;ll leave it up to you whether you prefer to leave the material or not.", "596" ], [ "Welcome to Stack Exchange, we are glad you are here. Please consider [registering an account](_URL_0_) to fully take advantage of what this site has to offer. Also, be sure to check out the [site tour](_URL_1_) and in particular what constitutes a good answer. We aren&#39;t a discussion board, so answers are expected to 1) answer only the question asked and 2) do more than just state your opinion. This contains some thoughts on related matters, but no answer to the actual question - why were the women included?", "862" ], [ "Actually, the difference is substantial. A lexicon/dictionary seeks to define how a word is used in all contexts. A translator then chooses a word to translate a specific context. A concordance lists only how it was translated, and thus provides no independent information about meaning. Although you are correct, that people often confuse the two, you&#39;ll find that around here we are pretty insistent on not treating Strong&#39;s as providing independent evidence of word meaning. See [this meta post](_URL_0_) for more information.", "133" ], [ "Welcome to Stack Exchange, we are glad you are here. Please consider [registering an account](_URL_0_) to fully take advantage of what this site has to offer. Also, be sure to check out the [site tour](_URL_1_) to learn what we are about. As a question-and-answer site, we expect answers to directly address the question and not use it as a \" ;discussion starter \" ; to talk about related matters. Also, are you intending to quote something? (You used quote formatting.) If so, please state your source.", "862" ], [ "Proverbs 30:17 describes the fate of those who disobey their parents, concluding they will have an unnatural death and be eaten by birds of prey:\r\n\r\n > The eye that mocks a father and scorns to obey a mother will be picked out by the ravens of the valley and eaten by the vultures. (Proverbs 30:17, ESV)\r\n\r\nMy question is why does the author refer to two different kinds of birds - first the raven, then the eagle. Is this done for emphasis or do the two different birds have different symbolic importance? (It is probably safe to conclude the author is not intending this to be read as literally a case of one bird removing the eye only to have a different bird eat it.)", "508" ], [ "Welcome to Stack Exchange, we are glad you are here. If you haven&#39;t done so already, you may want to read up on how this site is [a little different](_URL_0_) than other sites around the web. *This is not a comment on the quality of your answer, but rather a standard welcome message.* That said, in general it is not a good idea to start an answer with \" ;I believe \" ; - instead of telling us what you believe, show us (through detailed analysis or via references) why we should believe it.", "862" ] ]
56
[ 5975, 17168, 5743, 10208, 6698, 11589, 4227, 9580, 7267, 5284, 2229, 2363, 19150, 5321, 14097, 1023, 5401, 16376, 5402, 14014, 11344, 4255, 7818, 12908, 337, 11127, 5037, 12598, 3193, 987, 8247, 17033, 11937, 9927, 6318, 18920, 4544, 15854, 4260, 10102, 5635, 6330, 5122, 2159, 12994, 4614, 12283, 6137, 6276, 11381, 8956, 19262, 10524, 18046, 14390, 8311, 0, 14680, 640, 1030, 9099, 10348, 11795, 10683, 703, 18373, 7943, 12034, 1879, 9539, 15804, 11770, 2207, 3363, 550, 17769, 11332, 12233, 2870, 8810, 6222, 5462, 2630, 16712, 688, 7080, 10115, 921, 3381, 15739, 16373, 18002, 847, 9965, 9478, 3811, 11467, 19250, 7230, 16868, 10156, 1066, 3371, 4389, 9117, 16149, 5519, 14818, 59, 19079, 18601, 710, 16003, 2399, 5940, 13184, 5085, 5435, 1124, 6913, 2770, 18787, 12018, 3644, 18658, 1574, 2208, 4946, 13071, 1589, 12738, 14968, 12382, 3805, 8055, 6452, 14886, 9469, 725, 4333, 2429, 6230, 10330, 18400, 16814, 14416, 18353, 16262, 620, 10202, 17241, 7914, 15351, 7721, 279, 1714, 8160, 18432, 10090, 16593, 19541, 6171, 8559, 11177, 2133, 4209, 16103, 2067, 10577, 9574, 16178, 14975, 13445, 1339, 16261, 11436, 1304, 1956, 795, 16824, 10556, 6890, 15898, 5089, 18365, 4648, 8144, 7621, 1571, 15439, 5307, 3910, 9023, 19230, 16496, 3697, 4807, 9845, 16944, 9569, 12670, 9190, 10911, 5857, 18004, 19043, 4999, 3134, 6593, 16617, 6874, 2868, 5308, 1215, 4344, 16132, 8856, 2686, 98, 512, 11379, 12896, 13479, 8916, 17822, 635, 2714, 4128, 5893, 5123, 7079, 331, 16309, 15623, 5026, 17930, 15674, 6275, 2976, 10270, 15579, 19111, 13623, 4752, 19054, 2765, 15508, 1039, 8505, 2773, 13896, 10470, 16287, 16834, 5121, 13136, 17654, 4153, 396, 4944, 6344, 16487, 11665, 1453, 769, 10696, 15902, 15819, 9337, 13561, 2405, 1402, 2914, 19026, 5557, 6141, 5185, 7989, 2379, 11843, 1820, 16063, 18107, 6246, 5324, 10258, 13468, 11327, 8908, 6547, 4512, 11887, 5421, 2701, 3360, 6468, 17363, 7622, 2108, 18832, 6383, 8923, 13059, 9701, 3793, 477, 9169, 8560, 1125, 8558, 19251, 596, 2564, 657, 13933, 4242, 7179, 7531, 7995, 16804, 4272, 10472, 16489, 925, 10766, 3426, 3867, 929, 19500, 16444, 10841, 97, 2728, 15719, 1802, 11841, 16679, 8922, 11916, 2731, 9303, 19569, 9600, 14516, 2322, 362, 7519, 1652, 6290, 1974, 66, 18877, 9100, 613, 10251, 8429, 15302, 9439, 9073, 8881, 8244, 14952, 15438, 7875, 6709, 2355, 17796, 6930, 8752, 11125, 2012, 17136, 1277, 12805, 6087, 4101, 13599, 18039, 3404, 2947, 10295, 3232, 1324, 8263, 4179, 18224, 8309, 9767, 12523, 4250, 3523, 4142, 8766, 1801, 17730, 12080, 16581, 14098, 18485, 4527, 2173, 4018, 17968, 7798, 4491, 15667, 12573, 4221, 12308, 6396, 568, 12816, 9380, 10716, 7850, 3441, 19651, 5098, 6024, 3621, 1800, 15923, 724, 14783, 1691, 7373, 3895, 13693, 6421, 13541, 18452, 2673, 12473, 19507, 3839, 2188, 2803, 524, 18611, 4358, 10812, 11228, 1390, 19466, 2782, 5493, 8082, 117, 4106, 4885, 4532, 16788, 14571, 7022, 7810, 4222, 13275, 1503, 8892, 14966, 19035, 19786, 13349, 19315, 933, 5394, 16404, 1865, 14658, 9620, 14498, 17945, 2801, 2475, 9411, 1992, 9480, 2254, 4794, 2472, 5960, 13921, 18297, 12564, 3307, 18230, 10107, 906, 5444, 13970, 6100, 9961, 11229, 10804, 7199, 18564, 11903, 7167, 8584 ]
STX_10092067.0
[ [ "I have to bind Grid Drop Event and PreviewMouseLeftButtonDown event in ViewModel. I have a RelayCommand. But it is done only for passing the object, I have to pass the routed event by using the command and also for MouseButtonEventArgs. my sample code is as below, please give any suggestion for using the routed event args and MouseButtonEventArgs in viewmodel.\r\n\r\n < Grid\r\n x:Name= \" ;mainGrid \" ; \r\n AllowDrop= \" ;True \" ;\r\n Background= \" ;#F0F0F0 \" ; > \r\n < i:Interaction.Triggers > \r\n < i:EventTrigger EventName= \" ;Drop \" ; > \r\n < cmd:EventCommandExecuter Command= \" ;{Binding GridDrop} \" ; / > \r\n < /i:EventTrigger > \r\n < /i:Interaction.Triggers > \r\n < /Grid > \r\n < Grid Background= \" ;LightBlue \" ; PreviewMouseLeftButtonDown= \" ;Grid_PreviewMouseLeftButtonDown \" ; > \r\n\r\n < /Grid > \r\n\r\n**EventCommandExecuter** \r\n\r\n public class EventCommandExecuter : TriggerAction < DependencyObject > \r\n {\r\n #region Constructors\r\n\r\n public EventCommandExecuter()\r\n : this(CultureInfo.CurrentCulture)\r\n {\r\n }\r\n\r\n public EventCommandExecuter(CultureInfo culture)\r\n {\r\n Culture = culture;\r\n }\r\n\r\n #endregion\r\n\r\n #region Properties\r\n\r\n #region Command\r\n\r\n public ICommand Command\r\n {\r\n get { return (ICommand)GetValue(CommandProperty); }\r\n set { SetValue(CommandProperty, value); }\r\n }\r\n\r\n public static readonly DependencyProperty CommandProperty =\r\n DependencyProperty.Register( \" ;Command \" ;, typeof(ICommand), typeof(EventCommandExecuter), new PropertyMetadata(null));\r\n\r\n #endregion\r\n\r\n #region EventArgsConverterParameter\r\n\r\n public object EventArgsConverterParameter\r\n {\r\n get { return (object)GetValue(EventArgsConverterParameterProperty); }\r\n set { SetValue(EventArgsConverterParameterProperty, value); }\r\n }\r\n\r\n public static readonly DependencyProperty EventArgsConverterParameterProperty =\r\n DependencyProperty.Register( \" ;EventArgsConverterParameter \" ;, typeof(object), typeof(EventCommandExecuter), new PropertyMetadata(null));\r\n\r\n #endregion\r\n\r\n public IValueConverter EventArgsConverter { get; set; }\r\n\r\n public CultureInfo Culture { get; set; }\r\n\r\n #endregion\r\n\r\n protected override void Invoke(object parameter)\r\n {\r\n var cmd = Command;\r\n\r\n if (cmd != null)\r\n {\r\n var param = parameter;\r\n\r\n if (EventArgsConverter != null)\r\n {\r\n param = EventArgsConverter.Convert(parameter, typeof(object), EventArgsConverterParameter, CultureInfo.InvariantCulture);\r\n }\r\n\r\n if (cmd.CanExecute(param))\r\n {\r\n cmd.Execute(param);\r\n }\r\n }\r\n }\r\n }\r\n\r\nI want to pass object and RoutedEventArgs like below in viewmodel. Please help \r\n\r\n public void Grid_Drop(object sender, RoutedEventArgs e)\r\n {\r\n }", "690" ], [ "I have a mainGrid in Mainwindow. The mainGrid have a context menu. That context menu is binding to the ViewModel. When the user clicks the context menu item, new View is adding to the maingrid at runtime. Before I added the view from ViewModel when the context menu item is a click. But now only I know view type using in ViewModel is a violation. Please, anyone gives a simple example or links to refer how to add the view without from ViewModel. \r\n\r\n < Grid x:Name= \" ;mainGrid \" ; > \r\n < Grid.ContextMenu > \r\n < ContextMenu > \r\n < MenuItem Header= \" ;Add new Grid \" ; > \r\n < i:Interaction.Triggers > \r\n < i:EventTrigger EventName= \" ;Click \" ; > \r\n < i:InvokeCommandAction Command= \" ;{Binding Path=AddNewGridCommand} \" ; CommandParameter= \" ;{Binding ElementName= \" ;mainGrid \" ;} \" ;/ > \r\n < /i:EventTrigger > \r\n < /i:Interaction.Triggers > \r\n < /MenuItem > \r\n < /ContextMenu > \r\n < /Grid.ContextMenu > \r\n < /Grid > \r\n\r\n**ViewModel**\r\n\r\n private ICommand addNewGridCommand;\r\n public ICommand AddNewGridCommand = > addNewGridCommand ?? (addNewGridCommand = new RelayCommand(addGrid, canAddGrid));\r\n\r\n private void addGrid(object obj)\r\n {\r\n // Some UI like below\r\n Grid newGrid = new Grid()\r\n {\r\n Height = 100, Background = Brushes.Gray\r\n }\r\n ((obj) as Grid).Children.Add(newGrid);\r\n }", "21" ], [ "I have an `ItemsControl`. That `ItemsControl` has a context menu. My requirement is to get the content of the `DataTemplate` on menu item&#39;s click. I want to delete the data template item. My sample code is as below:\r\n\r\n < ItemsControl > \r\n < ItemsControl.Resources > \r\n < ContextMenu x:Key= \" ;listItem \" ; > \r\n < MenuItem\r\n Command= \" ;{Binding DataContext.ListRemoveCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl, AncestorLevel=2}} \" ;\r\n CommandParameter= \" ;{Binding PlacementTarget, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}} \" ;\r\n Header= \" ;Delete Panel \" ; / > \r\n < /ContextMenu > \r\n < /ItemsControl.Resources > \r\n < ItemsControl.ItemTemplate > \r\n < DataTemplate > \r\n < StackPanel Background= \" ;White \" ; > \r\n < Label Content= \" ;{Binding MyLabelContent} \" ; / > \r\n < /StackPanel > \r\n < /DataTemplate > \r\n < /ItemsControl.ItemTemplate > \r\n < /ItemControl > \r\n\r\nMy current `CommandParameter` passes the `ContentPresenter`. By using the content presenter I get the `DataTemplate`. I have also tried `DataTemplate.FindName()`, But that is also not working. Please give me a suggestion.", "690" ], [ "@dymanoid, Thanks for your reply, I want to drop the list content inside the data template. At the runtime I want to delete the item by using the context menu. Before I have set the context menu stackpanel(indise the datatemplate). But menuitem command is not fired in viewmodel because it datacontext is set as model. So I have change the context menu to Itemcontrol resources. Now I want to delete the content of the datatemplate at runtime.", "721" ], [ "By using the above code it will shows the binding error in the output window. Cannot find source for binding with reference &#39;RelativeSource FindAncestor, AncestorType=&#39;System.Windows.Controls.ItemsControl&#39;, AncestorLevel=&#39;3&#39;&#39;. BindingExpression:Path=DataContext.ListRemoveCommand; DataItem=null; target element is &#39;MenuItem&#39; (Name=&#39;&#39;); target property is &#39;Command&#39; (type &#39;ICommand&#39;). It is not hitting the command in viewmodel.", "690" ], [ "My command is located in viewmodel class. Without specifying the AncestorLevel it will search the ListRemoveCommand in Model class. But ListRemoveCommand is located in viewmodel class. I have also tried like this, < MenuItem Command= \" ;{Binding DataContext.ListRemoveCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type vm:ViewModelClass}}} \" ; Header= \" ;Delete Panel \" ; / > But it also not hitting the command event in viewmodel.", "721" ], [ "Use below code, so you don&#39;t need to import Xamarin.Forms in your ViewModel:\r\n\r\n**ButtonBehavior**\r\n\r\n public class ButtonBehavior : Behavior < Button > \r\n {\r\n protected override void OnAttachedTo(Button bindable)\r\n {\r\n base.OnAttachedTo(bindable);\r\n bindable.Clicked += Bindable_Clicked;\r\n }\r\n \r\n private void Bindable_Clicked(object sender, EventArgs e)\r\n {\r\n //Use you logic here\r\n }\r\n \r\n protected override void OnDetachingFrom(Button bindable)\r\n {\r\n base.OnDetachingFrom(bindable);\r\n bindable.Clicked -= Bindable_Clicked;\r\n }\r\n }\r\n\r\n**View** \r\n\r\n \r\n\r\n < Button Text= \" ;Click Me \" ; HeightRequest= \" ;50 \" ; WidthRequest= \" ;80 \" ; > \r\n < Button.Behaviors > \r\n < behavior:ButtonBehavior/ > \r\n < /Button.Behaviors > \r\n < /Button >", "479" ], [ "I want to drag the listbox selected item. Dragging function is working fine. My requirement is dragging should not happen while drag started from any other location in listbox. I have did like this, but that is not working. Please anyone suggest me to achieve this,\r\n\r\n private bool IsDragging { get; set; }\r\n private Point _startPoint { get; set; } \r\n \r\n protected override void OnAttached()\r\n { \r\n this.AssociatedObject.PreviewMouseLeftButtonDown += AssociatedObject_PreviewMouseLeftButtonDown;\r\n this.AssociatedObject.PreviewMouseMove += AssociatedObject_PreviewMouseMove;\r\n \r\n }\r\n \r\n private void AssociatedObject_PreviewMouseMove(object sender, MouseEventArgs e)\r\n {\r\n if (e.LeftButton == MouseButtonState.Pressed & & !IsDragging)\r\n {\r\n \r\n Point position = e.GetPosition(null); \r\n \r\n if (Math.Abs(position.X - _startPoint.X) < = SystemParameters.MinimumHorizontalDragDistance & & \r\n Math.Abs(position.Y - _startPoint.Y) < = SystemParameters.MinimumVerticalDragDistance)\r\n {\r\n StartDrag(sender);\r\n }\r\n }\r\n }\r\n \r\n private void AssociatedObject_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)\r\n {\r\n _startPoint = e.GetPosition(null);\r\n }\r\n \r\n \r\n \r\n private void StartDrag(object sender)\r\n {\r\n \r\n IsDragging = true;\r\n \r\n if (sender is ListBox)\r\n {\r\n var listBox = (sender as ListBox);\r\n if (listBox != null)\r\n {\r\n var selectedMember = listBox.SelectedItem;\r\n if (selectedMember != null)\r\n {\r\n DragDrop.DoDragDrop(listBox, selectedMember, DragDropEffects.Copy);\r\n }\r\n }\r\n }\r\n \r\n IsDragging = false;\r\n \r\n }\r\n\r\n[Please refer the screenshot][1]\r\n\r\n\r\n [1]: _URL_0_", "940" ], [ "Try like this,\r\n\r\n DateTime startTime = DateTime.Parse( \" ;2018/07/28 11:54 \" ;);\r\n DateTime endTime = DateTime.Parse( \" ;2018/08/01 09:28 \" ;); \r\n \r\n\r\n private static double DateDurationCalculate(DateTime startTime, DateTime endTime)\r\n {\r\n startTime = new DateTime(startTime.Year, startTime.Month, startTime.Day, startTime.Hour, startTime.Minute, 0);\r\n endTime = new DateTime(endTime.Year, endTime.Month, endTime.Day, endTime.Hour, endTime.Minute, 0);\r\n TimeSpan span = endTime.Date.Subtract(startTime.Date);\r\n return span.TotalDays;\r\n }", "627" ], [ "I have a simulator Diagram. I want to place the label above the simulator. I have used canvas for aligning the label, but when I resizing the window the label alignment is changed. My code is like this, Please give any suggestion to place the label on the grid image when normal and resizing the window.\r\n\r\n < Grid > \r\n < Image Source= \" ;/Image/SimulatorDiagram.png \" ;/ > \r\n < Canvas > \r\n < Label \r\n Canvas.Left= \" ;100 \" ; \r\n Canvas.Top= \" ;35 \" ;\r\n Content= \" ;Monitor \" ;\r\n Width= \" ;95 \" ;\r\n Height= \" ;43 \" ;/ > \r\n < Label \r\n Canvas.Left= \" ;150 \" ; \r\n Canvas.Top= \" ;75 \" ;\r\n Content= \" ;100 % Circulation \" ;\r\n Width= \" ;60 \" ;\r\n Height= \" ;73 \" ;/ > \r\n < /Canvas > \r\n < /Grid > \r\n\r\nPlease refer the screenshot for more clarification about my question. I have highlighted the label placement on the screenshot using red color box. [![Screenshot][1]][1]\r\n\r\n\r\n [1]: _URL_0_", "57" ], [ "In my project I have a Mainwindow. In that mainwindow there is a button to open the modal window. In that Modal window there is a button to open another modal window in the same view. I have used Keybinding for closing the modal window. When two modal window is opened condition when I pressed the escape key background model window is first closed. I have to close the current window. Please anyone suggest me to done this.\r\n\r\n**ShellWindow**\r\n\r\n < Grid > \r\n < Grid > \r\n < ContentControl prism:RegionManager.RegionName= \" ;SessionView \" ; / > \r\n < /Grid > \r\n < Grid > \r\n < ContentControl prism:RegionManager.RegionName= \" ;AddNewSessionView \" ; / > \r\n < /Grid > \r\n < /Grid > \r\n\r\nIn Shell window there is a button to open the \" ;SessionView \" ; Modal window. In the SessionView there is a one button to open the \" ;AddNewSessionView \" ; Modal window. Both are registered in Shell window. When AddNewSessionView is opened condition, when I click the esc button the Background SessionView is closed first.", "504" ] ]
49
[ 6736, 6001, 12395, 15027, 8265, 1797, 18890, 9306, 14732, 15294, 56, 10855, 14750, 15140, 14203, 10380, 13010, 11948, 13743, 12986, 10371, 3590, 11102, 5465, 11011, 2925, 17210, 294, 8214, 8404, 16189, 16564, 9162, 12291, 10840, 15354, 10481, 11803, 18660, 9385, 5476, 8919, 14090, 13546, 16890, 15638, 17666, 7726, 607, 1019, 15771, 18780, 17900, 4541, 14673, 5643, 15028, 1944, 5491, 12094, 17299, 13155, 13438, 3982, 6280, 6071, 1955, 16197, 13482, 19173, 19457, 8287, 13021, 15369, 7094, 3252, 5047, 11637, 15063, 6822, 11857, 19438, 3511, 12786, 17261, 7595, 16224, 13325, 13939, 12911, 18522, 2065, 4850, 14204, 12178, 5221, 15679, 16642, 10450, 11510, 12739, 13892, 3824, 12922, 3578, 9087, 6474, 12607, 5153, 1325, 12249, 4045, 5784, 14475, 11456, 14946, 14130, 10006, 17023, 15134, 9664, 13775, 12886, 5793, 16908, 14017, 16139, 8777, 10689, 2572, 5568, 6252, 5040, 3885, 19612, 16151, 17568, 191, 18849, 4192, 17225, 11296, 6839, 12029, 16381, 6154, 9325, 14827, 7598, 19106, 17795, 3340, 15486, 14425, 11380, 274, 5708, 11469, 8768, 14300, 13083, 16192, 14677, 6465, 14976, 12116, 10725, 6804, 13818, 3486, 19122, 17384, 11312, 12548, 5737, 13671, 17826, 10099, 13640, 18045, 17462, 10875, 13749, 10955, 3692, 6634, 18719, 9363, 6916, 13632, 11932, 19272, 7747, 7877, 16946, 3444, 12708, 11131, 10228, 15842, 7845, 7799, 13961, 11345, 14998, 15187, 8906, 11911, 3689, 5684, 16190, 11364, 12358, 16839, 6814, 18553, 12532, 31, 8460, 8189, 5434, 15526, 15672, 8212, 7533, 6511, 15000, 18196, 10940, 18283, 14257, 7451, 12196, 9249, 16876, 8685, 2225, 14608, 9318, 13539, 18790, 15172, 14547, 12897, 13233, 14064, 9496, 582, 16057, 18007, 3182, 18117, 13432, 448, 14297, 15920, 13851, 5009, 17717, 11683, 11593, 1159, 16816, 15518, 15221, 16799, 9097, 14990, 707, 3049, 11995, 11488, 8946, 6441, 15485, 9751, 604, 17089, 2989, 19287, 4838, 15572, 11031, 14262, 834, 17971, 15555, 18098, 6594, 18861, 13115, 13389, 18170, 6663, 11268, 10475, 17329, 7300, 2381, 15733, 14238, 11788, 12052, 9546, 2010, 8907, 10287, 13207, 4104, 15016, 13306, 13112, 18921, 14430, 1348, 1493, 6553, 13944, 15565, 5727, 16662, 4561, 14860, 19657, 12940, 17542, 15260, 18918, 4135, 6891, 14167, 4373, 2318, 9860, 14889, 9753, 11777, 13642, 9138, 2222, 9113, 17423, 14454, 17860, 10437, 11372, 9781, 17992, 8256, 15018, 17934, 8002, 5208, 14230, 17149, 16951, 9199, 15499, 10109, 11780, 7166, 11369, 631, 15198, 17719, 11710, 6806, 9126, 195, 2646, 10244, 384, 4826, 12620, 12360, 10357, 14642, 3837, 150, 13981, 14085, 12013, 14271, 12437, 14686, 17018, 10250, 7262, 5416, 16425, 12697, 7666, 9047, 12468, 14511, 8116, 8048, 15060, 17583, 5503, 2304, 17995, 9668, 15478, 2469, 11317, 129, 16609, 18144, 15442, 3747, 4067, 7151, 7365, 16802, 18278, 147, 15468, 15101, 18584, 125, 5450, 10448, 4979, 9678, 15871, 3280, 10533, 11756, 16462, 13402, 17949, 11393, 19017, 13262, 9502, 4456, 579, 5382, 6093, 1058, 13886, 12963, 12648, 2698, 5873, 18181, 3591, 9873, 10404, 10923, 9311, 14554, 2899, 12996, 12024, 5268, 15061, 7495, 17218, 11870, 142, 2627, 16342, 16276, 14446, 9235, 3454, 11554, 13483, 9857, 15333, 14386, 7844, 7317, 15405, 15130, 8706, 11806, 19107, 9000, 1594, 14639, 7447, 8669, 14074, 12554, 14758, 14361, 7966, 12392, 11707, 14586, 10988, 10126, 13581, 13723, 16957, 15166 ]
STX_10092089.0
[ [ "I&#39;m not used to SQL a lot, so maybe my question is so dumb, don&#39;t be hard with me guys ;)\r\n\r\nSo, this is my table PEOPLE, and what i want is with a query is find the people that are not in an expecific age, but im getting an error. \r\n\r\n PEOPLE\r\n +-------+------+---------+\r\n | NUMPOL| MCT | PRODNUM|\r\n +-------+------+---------+\r\n | 98552 | 1054 | 9704 | \r\n +-------+------+---------+\r\n | 89854 | 0985 | 5014 | \r\n +-------+------+---------+\r\n | 78542 | 1054 | 9704 | \r\n +-------+------+---------+\r\n | 98552 | 0965 | 9704 | \r\n +-------+------+---------+\r\n | 98552 | 4222 | 9704 | \r\n +-------+------+---------+\r\n\r\nI&#39;m trying to run this query \r\n\r\n SELECT NUMPOL, MCT, PRODCO\r\n FROM PEOPLE \r\n WHERE MCT NOT IN (1054,0965) AND PRODNUM=&#39;9704&#39;\r\n GROUP BY NUMPOL\r\n\r\n \r\nAnd this is the error that I&#39;m getting, I tried to solve it googling but never could find an answer because I can&#39;t find why it told me that the select list is not valid:\r\n\r\n SQLCODE = -122, ERROR: COLUMN OR EXPRESSION IN THE SELECT LIST IS\r\n NOT VALID", "38" ], [ "If you don&#39;t post your code is so hard to give you a proper answer, but I could say you that you should open the CSS code about your theme and find the two columns tag or id or whatewer the theme uses, then you could use margin or padding property to make the gap between both bigger.\r\n\r\nUse of margin and padding (Because you said you&#39;re a newbie hahahaha)\r\n\r\n - Margin: _URL_0_ \r\n - Padding: _URL_1_", "990" ], [ "You can easy do it with HTML and CSS code. This is called Floating Placeholder and you need to:\r\n\r\nHere&#39;s the example and at the end of the answer is the link to a Video Tutorial if you have any more doubt, but the main thing is the `class:focus` .\r\n\r\n < !-- begin snippet: js hide: false console: true babel: false -- > \r\n\r\n < !-- language: lang-css -- > \r\n\r\n body\r\n {\r\n margin: 0;\r\n padding: 0;\r\n font-family: sans-serif;\r\n background: url(college.png);\r\n background-repeat: no-repeat;\r\n background-size: cover;\r\n }\r\n\r\n .container\r\n {\r\n position: absolute;\r\n top: 50%;\r\n left: 75%;\r\n transform: translate(-50%,-50%);\r\n width: 700px;\r\n background: #fff;\r\n padding: 45px;\r\n box-sizing: border-box;\r\n border :1px solid rgba(0,0,0,.1);\r\n box-shadow: 0 5px 10px rgba(0,0,0,.2);\r\n }\r\n\r\n .container h1\r\n {\r\n text-align: center;\r\n margin: 0 0 40px;\r\n padding: 0;\r\n color: rgb(66,133,244);\r\n letter-spacing: 2px;\r\n }\r\n\r\n .container input\r\n {\r\n padding: 5px;\r\n margin-bottom: 30px;\r\n width: 55%;\r\n box-sizing: border-box;\r\n box-shadow: none;\r\n outline: none;\r\n border:none;\r\n border-bottom: 2px solid #999;\r\n }\r\n\r\n .container input[type= \" ;submit \" ;]\r\n {\r\n border-radius: 25px;\r\n font-size: 20px;\r\n height: 40px;\r\n cursor : pointer;\r\n background: rgb(66,133,244);\r\n color: #fff;\r\n margin-bottom: 0;\r\n }\r\n .container input[type= \" ;submit \" ;]:hover\r\n {\r\n background: #34F458;\r\n color: #fff;\r\n }\r\n\r\n .container form div\r\n {\r\n position: relative;\r\n }\r\n .container form div label\r\n {\r\n position: absolute;\r\n top: 3px;\r\n pointer-events: none;\r\n left: 0;\r\n transition: .5s;\r\n }\r\n\r\n .container input:focus ~label,\r\n .container input:valid ~label\r\n {\r\n left: 0;\r\n top: -20px;\r\n color: rgb(66,133,244);\r\n font-size: 12px;\r\n font-weight: bold;\r\n }\r\n .container input:focus,\r\n .container input:valid\r\n {\r\n border-bottom: 2px solid rgb(66,133,244);\r\n }\r\n\r\n < !-- language: lang-html -- > \r\n\r\n < html > \r\n < body > \r\n < div class= \" ;container \" ; > \r\n < form > \r\n < div > \r\n < input type= \" ;email \" ; name= \" ; \" ; required= \" ; \" ; > \r\n < label > Email id < /label > \r\n < /div > \r\n < div > \r\n < input type= \" ;password \" ; name= \" ; \" ; required= \" ; \" ; > \r\n < label > Password < /label > \r\n < /div > \r\n < div > \r\n < input type= \" ;password \" ; name= \" ; \" ; required= \" ; \" ; > \r\n < label > Re-Enter Password < /label > \r\n < /div > \r\n < input type= \" ;submit \" ; value= \" ;Register \" ; name= \" ; \" ; > \r\n < /form > \r\n < /div > \r\n < /body > \r\n < /html > \r\n\r\n < !-- end snippet -- > \r\n\r\n[VIDEO TUTORIAL][1]: _URL_0_\r\n\r\n\r\n [1]: _URL_0_", "115" ], [ "I dont know if I understand what you want, but if the only thing is Header on the right and Test on the left you need to make an other float, becasue you&#39;re applying the same float to both of them.\r\n\r\n\r\n\r\n < !-- begin snippet: js hide: false console: true babel: false -- > \r\n\r\n < !-- language: lang-css -- > \r\n\r\n .div-table { \r\n display: table; \r\n width: 100%; \r\n background-color: #eee; \r\n border: 1px solid #666666; \r\n border-spacing: 5px; }\r\n \r\n .div-table-row { display: table-row; width: auto; clear: both; }\r\n\r\n .div-table-col2 { float: left; display: table-column; width: 50%; background-color: #ccc; }\r\n \r\n .div-table-col { float: right; display: table-column; width: 50%; background-color: #ccc; }\r\n\r\n < !-- language: lang-html -- > \r\n\r\n < div class= \" ;div-table \" ; > \r\n < div class= \" ;div-table-row \" ; > \r\n < div class= \" ;div-table-col \" ; align= \" ;right \" ; > \r\n Header: \r\n < /div > \r\n < div class= \" ;div-table-col2 \" ; align= \" ;left \" ; padding-left= \" ;5px \" ; > \r\n Test\r\n < /div > \r\n < /div > \r\n < /div > \r\n\r\n < !-- end snippet -- >", "115" ], [ "It&#39;s working for me when I change to `table-layout: fixed;`\r\n\r\n tbody{\r\n width: 100%;\r\n display:table;\r\n table-layout: fixed;\r\n }\r\n p {\r\n font-family: Lato;\r\n }\r\n .employment {\r\n border-collapse: collapse;\r\n box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);\r\n transition: 0.3s;\r\n font-family: &#39;Roboto&#39;, &#39;Helvetica Neue&#39;, sans-serif;\r\n font-size: 12px;\r\n font-weight: 500;\r\n margin: 1%;\r\n }\r\n .employment tr:nth-child(even) {\r\n background: #fafafa;\r\n }\r\n \r\n .emp {\r\n width: 50%;\r\n white-space: nowrap;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n }\r\n\r\n\r\n[![Result][1]][1]\r\n\r\nHope my answer helps you! :)\r\n [1]: _URL_0_", "749" ], [ "you&#39;re using Gmaps.js so you will need to find documentation about this javascript, as the webpage says you need to use `setZoom` that allows an integer of your desired zoom, also you will need to use `setCenter` to center the map on your desired marker.\r\n\r\nHere&#39;s the GMaps.js website: [GMaps.js][1]\r\n\r\nHere&#39;s where you cand find all the parameters that allows:\r\n[Documentation][2]\r\n\r\nYou can also set the zoom when you create your Gmaps, so this is the main code you need to edit in your example:\r\n\r\n map = new GMaps({\r\n el: &#39;#ourmaps&#39;,\r\n lat: 15, \r\n lng: 15,\r\n scrollwheel: true,\r\n zoom: 15 //Your desired zoom\r\n });\r\n\r\nAlso I find a note on a blog that if you use more than 1 marker you may be using<IP_ADDRESS> \r\n\r\n map.setZoom((map.getBoundsZoomLevel(bounds))); //To rezoom the map\r\n map.setCenter(bounds.getCenter()); //To center the map\r\n\r\n[Reference about using more than one marker][3]\r\n\r\nHope my answer helps you!!\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_0_documentation.html#GMaps-setZoom\r\n [3]: _URL_1_", "985" ], [ "I will recommend you to use the `display:flex`, you just need to create an horizontal class and a vertical class an assign it to the divs of the image depending of the orientation you want to give it.\r\n\r\nIt&#39;s easy and simple, I write you the snippet, you just need to change the margins, and I also changed the image.\r\n\r\n < !-- begin snippet: js hide: false console: true babel: false -- > \r\n\r\n < !-- language: lang-css -- > \r\n\r\n div.horizontal {\r\n display: flex;\r\n justify-content: center;\r\n margin-bottom: 15px;\r\n }\r\n\r\n div.vertical {\r\n display: flex;\r\n flex-direction: column;\r\n justify-content: center;\r\n margin-right: 15px;\r\n }\r\n\r\n\r\n < !-- language: lang-html -- > \r\n\r\n < div class= \" ;row horizontal \" ; > \r\n < div class= \" ;col vertical \" ; > \r\n < img class= \" ;center-block image-center \" ; width= \" ;150 \" ; src= \" ;_URL_0_;\r\n < /div > \r\n\r\n < div class= \" ;col vertical \" ; > \r\n < img class= \" ;center-block image-center \" ; width= \" ;150 \" ; src= \" ;_URL_0_;\r\n < /div > < div class= \" ;col vertical \" ; > \r\n < img class= \" ;center-block image-center \" ; width= \" ;150 \" ; src= \" ;_URL_0_;\r\n < /div > < div class= \" ;col vertical \" ; > \r\n < img class= \" ;center-block image-center \" ; width= \" ;150 \" ; src= \" ;_URL_0_;\r\n < /div > \r\n < /div > \r\n\r\n < div class= \" ;row horizontal \" ; > \r\n < div class= \" ;col vertical \" ; > \r\n < img class= \" ;center-block \" ; width= \" ;150 \" ; src= \" ;imagery/5.png \" ;/ > \r\n < /div > < div class= \" ;col vertical \" ; > \r\n < img class= \" ;center-block \" ; width= \" ;150 \" ; src= \" ;imagery/6.png \" ;/ > \r\n < /div > < div class= \" ;col vertical \" ; > \r\n < img class= \" ;center-block \" ; width= \" ;150 \" ; src= \" ;imagery/7.png \" ;/ > \r\n < /div > < div class= \" ;col vertical \" ; > \r\n < img class= \" ;center-block \" ; width= \" ;150 \" ; src= \" ;imagery/8.png \" ;/ > \r\n < /div > \r\n < /div > \r\n\r\n < !-- end snippet -- > \r\n\r\nHope it helps you.", "70" ], [ "So as I asked you, you&#39;re using a database to store the data from the cards right? So all you need is create the connection to the database, then fetch the result with a loop to display one by one the cards.\r\n\r\n // Here you need to create your connection to the database with your values\r\n < ?php\r\n include &#39;connection.php&#39;;\r\n //Here write your SQL query to get the data from your cards database\r\n $sql = \" ;SELECT * FROM cards \" ;;\r\n $result = $conn- > query($sql);\r\n ? > \r\n \r\n // Then we start with the html code to get the data and show the cards\r\n < !doctype html > \r\n < html > \r\n < body > \r\n < h1 align= \" ;center \" ; > CARDS < /h1 > \r\n < ?php\r\n //Fetch Data form database\r\n if($result- > num_rows > 0){\r\n while($row = $result- > fetch_assoc()){\r\n ? > \r\n \t\t\t < div class= \" ;scrolling-wrapper \" ; > \r\n \t\t\t < div class= \" ;card \" ; > \r\n \t \r\n \t\t\t < img id= \" ;card-shopping-cart-icon \" ; src= \" ;images/cart.png \" ; alt= \" ; \" ; > \r\n \t\t\t < img id= \" ;card-wishlist-icon \" ; src= \" ;images/heart.png \" ; alt= \" ; \" ; > \r\n \t\t\t < img id= \" ;card-image \" ; src= \" ;images/ < ?php echo $row[&#39;RowNameYouWannaGet&#39;]; ? > \" ; alt= \" ;Motorola \" ; class= \" ;contain \" ; > \r\n \r\n < div class= \" ;card-text-body \" ; > \r\n \t\t\t < p class= \" ;card-clock-deals-title \" ; > < ?php echo $row[&#39;RowNameYouWannaGet&#39;]; ? > < /p > \r\n \t\t\t < p class= \" ;card-clock-deals-detail \" ; > < ?php echo $row[&#39;RowNameYouWannaGet&#39;]; ? > < /p > \r\n \t\t\t < p class= \" ;card-clock-deals-discounted-price \" ; > < ?php echo $row[&#39;RowNameYouWannaGet&#39;]; ? > < /p > \r\n \t\t\t < p > \r\n \t\t\t\t < table class= \" ;card-clock-deals-timer \" ; > \r\n \t\t\t\t < tr > \r\n \t\t\t\t\t < td id= \" ;hours \" ; > < ?php echo $row[&#39;RowNameYouWannaGet&#39;]; ? > < /td > \r\n \t\t\t\t\t < td > : < /td > \r\n \t\t\t\t\t < td id= \" ;minutes \" ; > < ?php echo $row[&#39;RowNameYouWannaGet&#39;]; ? > < /td > \r\n \t\t\t\t < /tr > \r\n \t\t\r\n \t\t\t\t < /table > \r\n \t\t\t < /p > \r\n \t\t\t < p class= \" ;card-clock-deals-original-price \" ; > < ?php echo $row[&#39;RowNameYouWannaGet&#39;]; ? > < /p > \r\n \t\t\t < p class= \" ;card-clock-deals-timer-text \" ; > < ?php echo $row[&#39;RowNameYouWannaGet&#39;]; ? > < /p > \r\n \t\t\t < p class= \" ;card-clock-deals-like-image \" ; > < img src= \" ;images/heart.png \" ; alt= \" ; \" ; > < ?php echo $row[&#39;RowNameYouWannaGet&#39;]; ? > < /p > \r\n < /div > \r\n \t < /div > \r\n < ?php\r\n }\r\n }\r\n else\r\n { echo \" ;No data found \" ; } ? > \r\n < /body > \r\n < /html > \r\n\r\n Hope it helps, you can also find info on Google searching-- > Dynamic Tables PHP, MySQL", "589" ], [ "The Android emulator needs sometimes hardware acelleration features, so that&#39;s why it prompts the error.\r\n\r\nYou have here all the documentation about the Hardware Acelleration and a full explanation how to install it:\r\n\r\n[Documentation Configure Emulator graphics rendering and hardware acceleration][1]\r\n\r\nIf you dont wan&#39;t to read the full doc, here&#39;s what you need to do:\r\n\r\n 1. Open Android SDK Manager and install ** \" ;*Intel x86 Emulator Accelerator* \" ;**\r\n 2. Find the folder path where you just download it (You can find it on the top)\r\n 3. Once open the path open the subfolder `extras\\intel\\Hardware_Accelerated_Execution_Manager` and install `intelhaxm-android.exe`*\r\n 4. Restart Android Studio and try to run the emulator.\r\n\r\n*If it prompts an error about virtualization technology you should enable it on your BIOS, there&#39;s a lot of tutorials on internet depending on your O.S\r\n\r\nHope it helps you\r\n \r\n\r\n\r\n [1]: _URL_0_", "477" ], [ "The problem was on the align-self, if you want two columns and you know each column is about 400px you make the container div of 800px and they will fit perfectly as the code below\r\n\r\n \r\n\r\n < !-- begin snippet: js hide: false console: true babel: false -- > \r\n\r\n < !-- language: lang-css -- > \r\n\r\n .container {\r\n \t\t\twidth: 800px;\r\n \t\t\tdisplay: flex;\r\n \t\t\tflex-wrap: wrap;\r\n \t\t\talign-content: flex-start;\r\n \t\t}\r\n \t\t\r\n .row {\r\n \t\t\twidth: 400px;\r\n \t\t\theight: auto;\r\n \t\t\tbackground-color: red;\r\n \t\t}\r\n\r\n < !-- language: lang-html -- > \r\n\r\n < div class= \" ;container \" ; > \r\n < div class= \" ;row \" ; > \r\n TEST1\r\n < /div > \r\n < div class= \" ;row \" ; > \r\n TEST2 < br > \r\n TEST2\r\n < /div > \r\n < div class= \" ;row \" ; > \r\n TEST3 < br > \r\n TEST3 < br > \r\n TEST3\r\n < /div > \r\n < div class= \" ;row \" ; > \r\n TEST4 < br > \r\n TEST4 < br > \r\n TEST4 < br > \r\n TEST4\r\n < /div > \r\n < /div > \r\n\r\n < !-- end snippet -- > \r\n\r\n\r\nIf you also want rows not to be merged use `margin` in the row css as you want.\r\n\r\nBy the way I add you a FlexBox tutorial that is so helpful because you can see what class you can add to the container or the rows. \r\n\r\n[Flex Box Guide][1]\r\n\r\nHope it helps you!! :)\r\n\r\n\r\n [1]: _URL_0_", "70" ], [ "As I can see in your CSS there&#39;s propierties for the head of the table but then in the code you dont specify where&#39;s the head you just used ` < tbody > ` for the hole table.\r\n\r\nThe code you posted about CSS is with PHP and the HTML you posted is a little bit dirty in one line so all i&#39;m saying are speculations because I can&#39;t test it.\r\n\r\nBut the answer could be to use ` < thead > ` for the row you want to be the head of the table. So the code will look like this.\r\n\r\n < table class= \" ;table table-bordered \" ; > \r\n \t < thead > \r\n \t\t < tr > \r\n \t\t\t < th > Height (mm) < /th > \r\n \t\t\t < th > Width (mm) < /th > \r\n \t\t\t...\r\n \t\t < /tr > \r\n \t < /thead > \r\n \t < tbody > \r\n \t\t...\r\n \t < /tbody > \r\n < /table > \r\n\r\nTry this and tell me if you can solve it :)\r\nHope it helps you.", "626" ], [ "Hellow Guys,\r\n\r\nI&#39;m creating a loading animation with HTML and CSS. As I&#39;m not really skilled in responsive front-end, I&#39;m really struggling with making the text and the circle responsive.\r\n\r\nWhat I really want is to attach the div with the background image and the text to the bar and make them responsive in order not to move and remain at the same position.\r\n\r\nThis is what I want to achieve:\r\n[![Loading][1]][1]\r\n\r\nHere&#39;s the code of what I have at the moment. I&#39;ve tried attachment fixed and stuff like that, but the main problem is that the image keeps scaling when I use a max height/width and the text moves to the right depending on the width of the website.\r\n\r\nHope you can help me, thanks in advise.\r\n\r\n < !-- begin snippet: js hide: false console: true babel: false -- > \r\n\r\n < !-- language: lang-css -- > \r\n\r\n body {\r\n background: #111 url( \" ; \" ;);\r\n background-size: 25vmin;\r\n background-repeat: no-repeat;\r\n background-position: center 40%;\r\n height: 100vh;\r\n margin: 0;\r\n }\r\n\r\n .logo {\r\n background: url( \" ;_URL_1_;);\r\n background-size: 25vmin;\r\n background-repeat: no-repeat;\r\n position: absolute;\r\n left: 28%;\r\n bottom: 10vh;\r\n height: 25vh;\r\n width: 100px;\r\n max-width: 150px;\r\n }\r\n\r\n h1 {\r\n color: #fff;\r\n position: absolute;\r\n bottom: 20vh;\r\n left: 35%;\r\n }\r\n\r\n .progress {\r\n width: 400px;\r\n max-width: 85vw;\r\n height: 8px;\r\n position: absolute;\r\n bottom: 20vh;\r\n left: 50%;\r\n background: rgba(255, 255, 255, 0.5);\r\n transform: translate(-50%, -50%);\r\n overflow: hidden;\r\n }\r\n\r\n .progress:after {\r\n content: &#39;&#39;;\r\n display: block;\r\n width: 100%;\r\n height: 8px;\r\n background: #fff;\r\n animation: load 5s linear;\r\n }\r\n\r\n @-moz-keyframes load {\r\n 0% {\r\n width: 0%;\r\n }\r\n 100% {\r\n width: 100%;\r\n }\r\n }\r\n\r\n @-webkit-keyframes load {\r\n 0% {\r\n width: 0%;\r\n }\r\n 100% {\r\n width: 100%;\r\n }\r\n }\r\n\r\n @-o-keyframes load {\r\n 0% {\r\n width: 0%;\r\n }\r\n 100% {\r\n width: 100%;\r\n }\r\n }\r\n\r\n @keyframes load {\r\n 0% {\r\n width: 0%;\r\n }\r\n 100% {\r\n width: 100%;\r\n }\r\n }\r\n\r\n < !-- language: lang-html -- > \r\n\r\n < div class= \" ;logo \" ; > < /div > \r\n < h1 class= \" ;title \" ; > Loading < /h1 > \r\n < div class= \" ;progress \" ; > < /div > \r\n\r\n < !-- end snippet -- > \r\n\r\n\r\n [1]: _URL_0_", "455" ] ]
481
[ 13299, 4599, 14182, 13714, 580, 17077, 8880, 19726, 9436, 37, 17755, 10593, 13189, 14034, 19675, 11304, 14377, 11022, 17978, 12732, 18070, 18087, 9300, 12956, 14422, 7930, 11846, 8894, 14816, 19557, 15490, 13191, 18189, 10025, 17711, 13144, 16818, 16229, 14489, 16419, 17285, 16808, 14881, 47, 14215, 19013, 14338, 10180, 14645, 18290, 14607, 7783, 14613, 19722, 19454, 17662, 6911, 19294, 6435, 15882, 11305, 7457, 9088, 2466, 16797, 12186, 6197, 14609, 15025, 10264, 2051, 17962, 14499, 1451, 11908, 2013, 18104, 12613, 17943, 17548, 10898, 10386, 14590, 14926, 14178, 17380, 11805, 6944, 10765, 10145, 1575, 16255, 6691, 12570, 11483, 17706, 11398, 5868, 13770, 4993, 19644, 13300, 4603, 4123, 18511, 14509, 5064, 16105, 8815, 10372, 4793, 14575, 7268, 4320, 2494, 14152, 12259, 4853, 13137, 645, 13767, 18179, 15772, 11498, 12882, 8492, 15077, 13698, 7604, 2202, 19528, 15198, 15802, 11627, 18494, 12326, 3498, 15048, 18231, 14012, 3254, 17172, 17744, 10461, 16765, 14456, 17053, 5158, 14925, 15029, 12588, 13053, 11730, 15402, 19602, 6801, 14256, 13283, 12916, 19694, 15777, 11659, 13032, 10676, 13784, 17468, 13228, 594, 9072, 14623, 9892, 8155, 18815, 16911, 17605, 19059, 13313, 11459, 9326, 12947, 11661, 4147, 13923, 17853, 11331, 16331, 19245, 11037, 16477, 7260, 527, 8294, 120, 8260, 7161, 5280, 6130, 9836, 17127, 10611, 10849, 10474, 6266, 15436, 13092, 15575, 13890, 5708, 1578, 12431, 17600, 15297, 14298, 4968, 8097, 11709, 17843, 13494, 6817, 12657, 5814, 17957, 19607, 15591, 10286, 9863, 10528, 15113, 13042, 10832, 12600, 12666, 17503, 15652, 12174, 16947, 16296, 18446, 5982, 7946, 14015, 14894, 15020, 16071, 7792, 13145, 9660, 722, 13105, 14945, 6516, 8339, 11670, 16250, 820, 1433, 9648, 7974, 15959, 9968, 16314, 9865, 19734, 5304, 10302, 15775, 10080, 13409, 19673, 6875, 11001, 16425, 6842, 9483, 3866, 17072, 14858, 12747, 7496, 12930, 6948, 11457, 7701, 11419, 10674, 14517, 16787, 7711, 9295, 16696, 12016, 8637, 18568, 11019, 874, 118, 12348, 14296, 17675, 3754, 2267, 3098, 9980, 9640, 17873, 7729, 12067, 7287, 17794, 15032, 10705, 14828, 14906, 1224, 15067, 16838, 13365, 12507, 15596, 7171, 5237, 3763, 2130, 13764, 3969, 17456, 14959, 19, 14864, 13088, 12254, 10166, 6613, 1381, 5456, 13887, 7587, 6641, 9057, 12672, 9118, 18971, 14808, 11164, 12306, 13638, 13045, 4948, 11596, 6308, 12580, 8848, 14106, 2477, 12245, 13610, 15191, 14311, 2309, 6125, 17097, 2464, 17066, 15373, 16624, 10791, 236, 17021, 15404, 14737, 8351, 9108, 13542, 6351, 5267, 17187, 10706, 17631, 13688, 18984, 17017, 11509, 6118, 6152, 17399, 17150, 17786, 1591, 13629, 15507, 13385, 8240, 17142, 8028, 14074, 11873, 1473, 1317, 15311, 8277, 14080, 14702, 18117, 9634, 11449, 15299, 12077, 32, 10756, 15328, 9618, 4385, 2071, 14969, 1218, 18777, 11397, 15455, 14870, 14862, 7663, 1118, 7581, 14250, 8851, 18785, 16512, 4266, 11645, 7300, 19700, 15810, 7970, 14042, 72, 12155, 14238, 15726, 15876, 264, 10773, 404, 155, 10580, 14213, 4520, 7036, 15102, 16124, 7272, 146, 17533, 2312, 12846, 3753, 3566, 12075, 2015, 7609, 11382, 12088, 18861, 13290, 674, 14834, 10896, 13128, 14555, 10702, 16597, 10912, 2804, 12105, 10481, 10952, 7038, 15649, 17947, 5844, 17721, 9893, 18807, 14733, 16076, 14872, 139, 4219, 14563, 6244, 7644, 17872, 17919, 17331, 10440, 10788, 14251, 10050, 5667, 17934 ]
STX_10092411.0
[ [ "While uploading Apache log file to oracle database NULL values are getting uploaded. This code was working fine when i run it first time but later it is uploading NULL values.\r\n\r\n < !-- begin snippet: js hide: false console: true babel: false -- > \r\n\r\n < !-- language: lang-html -- > \r\n\r\n < ?php\r\n $conn = oci_connect(&#39;USR1&#39;, &#39;Root1zed&#39;, &#39;ufhdhdh/DBAY&#39;);\r\n if (!$conn) {\r\n $m = oci_error();\r\n echo $m[&#39;message&#39;], \" ;\\n \" ;;\r\n exit;\r\n }\r\n else {\r\n print \" ;Connected to Oracle! \" ;;\r\n }\r\n $myfile = fopen( \" ;access.txt \" ;, \" ;r \" ;) or die( \" ;Unable to open file! \" ;);\r\n while(!feof($myfile)) {\r\n \t$content= fgets($myfile);\r\n \t$carray=explode(&#39; &#39;,$content);\r\n \t\r\n\r\n \t$stdii = &#39;INSERT INTO LOGS(IP_ADDRESS, USER_IDENTIFIER, USERID , REQUEST_TIME , CLIENT_REQUEST ,RESPONSE_CODE ,SIZEOFOBJECT, COOKIES)&#39;.\r\n \t&#39;values(:IP_ADDRESS, :USER_IDENTIFIER, :USERID , :REQUEST_TIME , :CLIENT_REQUEST ,:RESPONSE_CODE ,:SIZEOFOBJECT, :COOKIES)&#39;;\r\n \t$compiled1 = oci_parse($conn, $stdii);\r\n \toci_bind_by_name($compiled1, &#39;:IP_ADDRESS&#39;, $IP_ADDRESS);\r\n \toci_bind_by_name($compiled1, &#39;:USER_IDENTIFIER&#39;, $USER_IDENTIFIER);\r\n \toci_bind_by_name($compiled1,&#39;:USERID&#39;, $USERID);\r\n \toci_bind_by_name($compiled1, &#39;:REQUEST_TIME&#39;, $REQUEST_TIME);\r\n \toci_bind_by_name($compiled1, &#39;:CLIENT_REQUEST&#39;, $CLIENT_REQUEST);\r\n \toci_bind_by_name($compiled1, &#39;:RESPONSE_CODE&#39;, $RESPONSE_CODE);\r\n \toci_bind_by_name($compiled1, &#39;:SIZEOFOBJECT&#39;, $SIZEOFOBJECT);\r\n \toci_bind_by_name($compiled1, &#39;:COOKIES&#39;, $COOKIES);\r\n \toci_execute($compiled1, OCI_COMMIT_ON_SUCCESS);\r\n }\r\n oci_close($conn);\r\n fclose($myfile);\r\n ? > \r\n\r\n < !-- end snippet -- >", "768" ], [ "I am generating daily Apache log files. Now i need to insert this file data to oracle database on daily basis. I wrote a code for uploading file to database manually for one file. However i need a script/code which will pick the file automatically from the location or just increase the filename by date and then insert data into database(My filename is by date which is changing daily. Example : access.2018.07.24.txt). Can someone please assist.\r\n\r\n < !-- begin snippet: js hide: false console: true babel: false -- > \r\n\r\n < !-- language: lang-html -- > \r\n\r\n < ?php\r\n $conn = oci_connect(&#39;usr1&#39;, &#39;dfdfdf1SS&#39;, &#39;sdsdfdg/XEBH&#39;);\r\n if (!$conn) {\r\n $m = oci_error();\r\n echo $m[&#39;message&#39;], \" ;\\n \" ;;\r\n exit;\r\n }\r\n else {\r\n print \" ;Connected to Oracle! \" ;;\r\n }\r\n $myfile = fopen( \" ;access.2018.07.24.txt \" ;, \" ;r \" ;) or die( \" ;Unable to open file! \" ;);\r\n while(!feof($myfile)) {\r\n \t$content= fgets($myfile);\r\n \t$carray=explode(&#39;,&#39;,$content);\r\n \tlist($IP_ADDRESS, $USER_IDENTIFIER, $USERID , $REQUEST_TIME , $CLIENT_REQUEST ,$RESPONSE_CODE ,$SIZEOFOBJECT, $COOKIES)=$carray;\r\n \t\r\n\r\n \t$stdii = &#39;INSERT INTO LOGS(IP_ADDRESS, USER_IDENTIFIER, USERID , REQUEST_TIME , CLIENT_REQUEST ,RESPONSE_CODE ,SIZEOFOBJECT, COOKIES)&#39;.\r\n \t&#39;values(:IP_ADDRESS, :USER_IDENTIFIER, :USERID , :REQUEST_TIME , :CLIENT_REQUEST ,:RESPONSE_CODE ,:SIZEOFOBJECT, :COOKIES)&#39;;\r\n \t$compiled1 = oci_parse($conn, $stdii);\r\n \toci_bind_by_name($compiled1, &#39;:IP_ADDRESS&#39;, $IP_ADDRESS);\r\n \toci_bind_by_name($compiled1, &#39;:USER_IDENTIFIER&#39;, $USER_IDENTIFIER);\r\n \toci_bind_by_name($compiled1,&#39;:USERID&#39;, $USERID);\r\n \toci_bind_by_name($compiled1, &#39;:REQUEST_TIME&#39;, $REQUEST_TIME);\r\n \toci_bind_by_name($compiled1, &#39;:CLIENT_REQUEST&#39;, $CLIENT_REQUEST);\r\n \toci_bind_by_name($compiled1, &#39;:RESPONSE_CODE&#39;, $RESPONSE_CODE);\r\n \toci_bind_by_name($compiled1, &#39;:SIZEOFOBJECT&#39;, $SIZEOFOBJECT);\r\n \toci_bind_by_name($compiled1, &#39;:COOKIES&#39;, $COOKIES);\r\n \toci_execute($compiled1, OCI_COMMIT_ON_SUCCESS);\r\n }\r\n oci_close($conn);\r\n fclose($myfile);\r\n ? > \r\n\r\n < !-- end snippet -- >", "705" ], [ "I am trying to insert my daily Apache logs to Oracle database. I did the following configuration file coding, however i am getting error - Couldn&#39;t find any output plugin. I have done testing on 6.3.2 & 5.6.0 versions of logstash. In short my input will be a text file and output will be my database(in this case Oracle). Can someone please help with the code. I did research but i couldn&#39;t find any correct answer.\r\n\r\n < !-- begin snippet: js hide: false console: true babel: false -- > \r\n\r\n < !-- language: lang-html -- > \r\n\r\n input\r\n {\r\n file\r\n {\r\n path = > \" ;C:\\Users\\ssn\\logstash\\Input\\access.log \" ;\r\n start_position = > \" ;beginning \" ;\r\n }\r\n }\r\n output\r\n {\r\n\r\n jdbc{\r\n jdbc_connection_string = > \" ;jdbc:oracle:thin:xyz/Helloxyz1@xyz1000:PORT:1521 \" ;\r\n statement = > [ \" ;INSERT INTO LOGS (IP_ADDRESS, USER_IDENTIFIER, USERID, REQUEST_TIME, CLIENT_REQUEST, RESPONSE_CODE, SIZEOFOBJECT, COOKIES) \r\n VALUES(?, ? , ?, ?, ? , ?, ?, ?) \" ;, \" ;IP_ADDRESS \" ;, \" ;USER_IDENTIFIER \" ;, \" ;USERID \" ;, \" ;REQUEST_TIME \" ;, \" ;CLIENT_REQUEST \" ;, \" ;RESPONSE_CODE \" ;, \" ;SIZEOFOBJECT \" ;, \" ;COOKIES \" ;]\r\n }\r\n\r\n }\r\n\r\n < !-- end snippet -- >", "436" ], [ "People who are giving negative badges, could you please give a simple answer to my simple question. I have asked 3 questions in last 3 days. Everyone is suggesting some solutions but nothing is working out. So i just asked a simple question. it doesn&#39;t mean i have not done any research. I have gone through almost every question related to this question.", "755" ], [ "Can someone please help me with setting rules such that i get only the data which is being posted using POST. I have a form where i am submitting name and email id. I want to save just that part to be saved in the log file. In my scenario i just want below data in my log file:-\r\n\r\n < !-- begin snippet: js hide: false console: true babel: false -- > \r\n\r\n --29000000-C--\r\n name1=ssn & email1=ssn%_URL_0_\r\n --29000000-F--\r\n HTTP/1.1 200 OK\r\n X-Powered-By: PHP/7.2.4\r\n Content-Length: 16\r\n Keep-Alive: timeout=5, max=100\r\n Connection: Keep-Alive\r\n Content-Type: text/html; charset=UTF-8\r\n\r\n < !-- end snippet -- > \r\n\r\nMy present mod_security looks like:-\r\n\r\n < !-- begin snippet: js hide: false console: true babel: false -- > \r\n\r\n < IfModule security2_module > \r\n #Enable the module.\r\n SecRuleEngine On\r\n SecAuditEngine on\r\n\r\n #Setup logging in a dedicated file.\r\n SecAuditLog C:/wamp64/bin/apache/apache2.4.33/logs/website-audit.log\r\n\r\n #Allow it to access requests body.\r\n SecRequestBodyAccess on\r\n SecAuditLogParts ABIFHZ\r\n\r\n #Setup default action.\r\n SecDefaultAction \" ;nolog,noauditlog,allow,phase:2 \" ;\r\n\r\n #Define the rule that will log the content of POST requests.\r\n SecRule REQUEST_METHOD \" ;^POST$ \" ; \" ;chain,allow,phase:2,id:123 \" ;\r\n SecRule REQUEST_URI \" ;.* \" ; \" ;auditlog \" ;\r\n\r\n < /ifmodule > \r\n\r\n < !-- end snippet -- >", "132" ], [ "I found a solution to my question. We can set below field as per our requirement:-\r\n\r\nSecAuditLogParts ABIFHZ\r\n\r\nIn my case i set the field as:-\r\nSecAuditLogParts C\r\n\r\nhowever it will display as:-\r\n\r\n < !-- begin snippet: js hide: false console: true babel: false -- > \r\n\r\n < !-- language: lang-html -- > \r\n\r\n --84670000-A--\r\n [29/Aug/2018:14:49:58 +0200] W4aWdqHJuCcOQzTIgCiEqAAAAD8 <IP_ADDRESS> 60735 <IP_ADDRESS> 80\r\n --84670000-C--\r\n name1=red & email1=red%_URL_0_\r\n --84670000-Z--\r\n\r\n < !-- end snippet -- >", "219" ], [ "In below code i have created an array which contains the value which matches some particular string pattern. In this array, i am trying to fetch only those values of the array which has POST keyword and save it in another array. It should return 1 array of size 2. However, when i am trying to do so, it is resulting in creation of two arrays. One array of size 1 and another array of size 2. However i want just one array. Can someone please guide where i am wrong.\r\n\r\n\r\n\r\n < pre > < ?php\r\n$array = array();\r\n\t\r\n\t$fh = fopen( \" ;website-audit.2018.08.30.log \" ;, \" ;r \" ;);\r\n\t$started = false;\r\n\twhile (!feof($fh)) {\r\n\t $line = fgets($fh);\r\n\t if($started) {\r\n\t\t$temp .= $line;\r\n\t\tif(strpos($line, \" ;-- \" ;) === 0 & & strpos($line, \" ;-Z- \" ;) > 0) {\r\n\t\t $started = false;\r\n\t\t $array[] = $temp;\r\n\t\t}\r\n\t }\r\n\t if(strpos($line, \" ;-- \" ;) === 0 & & strpos($line, \" ;-A- \" ;) > 0) {\r\n\t\t$started = true;\r\n\t\t$temp = $line;\r\n\t }\r\n\t}\r\n\tfclose($fh);\r\n\t\r\n\t\r\n\t$keyword = &#39;POST&#39;;\r\n\tforeach($array as $index){\r\n if (strpos($index, $keyword) !== FALSE){\r\n\t\t\t$val = array($index);\r\n var_dump($val);\r\n\t }\t\r\n }", "762" ], [ "After struggling with every possible way to resolve my query, i found that are two php.ini files. One is for the command line execution which is located at C:\\wamp\\bin\\php\\php5.4.16 , while one is for PHP inside Apache located at C:\\wamp\\bin\\apache\\Apache2.4.4\\bin. You can check the locations of php.ini files via php -i (for the CLI) and < ?php phpinfo() ? > (for the web server). So when you want to run your script through command line you need to make configuration changes in the one located at php folder. \r\nJust uncomment or add below line:\r\nextension_dir = \" ;c:/wamp64/bin/php/php7.2.4/ext/ \" ;\r\nextension=php_oci8_12c.dll", "517" ], [ "While running below code array_diff is returning only one value. However it should return two values. My first array holds:\r\n\r\n access.2018.08.09.log\r\n access.2018.08.10.log\r\n access.2018.08.12.log\r\n\r\nMy second array holds:\r\n\r\n access.2018.08.09.log\r\n\r\n`array_diff()` is returning only: `access.2018.08.12.log` \r\n\r\nCan someone please guide why is it happening.\r\n\r\n\r\n < ?php\r\n $files = scandir(&#39;C:\\wamp64\\www\\MyLogs\\logsfiles&#39;);\r\n foreach($files as $file) {\r\n if($file == &#39;.&#39; || $file == &#39;..&#39;) continue;\r\n \t\t\t\r\n $S1=array($file.PHP_EOL);\r\n \tprint_r($S1);\r\n }\r\n $S2 =explode( \" ;\\n \" ;, file_get_contents(&#39;uplodedregistry.txt&#39;));\r\n $result = array_diff_assoc($S1, $S2);\r\n \t\t\r\n print_r($result); \r\n ? >", "762" ], [ "I want to use just the filename from each file for my further coding. How can i do that. I used substr but it is working just on the first line. Array $S2 holds:\r\n\r\n access.2018.08.09.log|201808101105\r\n access.2018.08.12.log|201808101105\r\n access.2018.08.13.log|201808101105\r\n\r\nI want just the text before &#39;|&#39; :-\r\n\r\n access.2018.08.09.log\r\n access.2018.08.12.log\r\n access.2018.08.13.log\r\n\r\nCode:-\r\n < !-- begin snippet: js hide: false console: true babel: false -- > \r\n\r\n < pre > < ?php\r\n\r\n $files = scandir(&#39;C:\\wamp64\\www\\MyLogs\\logsfiles&#39;);\r\n foreach($files as $key = > $file) {\r\n if($file == &#39;.&#39; || $file == &#39;..&#39;) unset($files[$key]);\r\n }\r\n\r\n $S2 = explode( \" ;\\n \" ;, substr(file_get_contents(&#39;uplodedregistry.txt&#39;),0,21));\r\n\r\n $result = array_diff($files, $S2);\r\n print_r($result);\r\n\r\n ? > \r\n\r\n < !-- end snippet -- >", "879" ], [ "I have one php page which connects to the oracle database and fetches some data based on some user input. Here in this case Once the user will enter the user_id, and submit it, my code will fetch some more data (REQUEST_TIME,WORKFLOW_NAME,EVENT_MESSAGE) of that user. I am running below code and i am not sure if i am doing it correct. I am getting below error:\r\n\r\n**Warning: oci_execute(): ORA-00904: \" ;USER_ID \" ;: invalid identifier in D:\\SVN\\TOOLBOX_WEB\\WEBContent\\admin\\V2\\public\\ssn\\index2.php on line 36**\r\n\r\ncan someone please guide, how to proceed.\r\n\r\nThis is my php page:\r\n\r\n < !-- begin snippet: js hide: false console: true babel: false -- > \r\n\r\n < pre > < ?php\r\n\r\n include(&#39;mypage.php&#39;);\r\n class logAgent\r\n {\r\n \tconst CONFIG_FILENAME = \" ;data_config.ini \" ;;\r\n \r\n private $_dbConn;\r\n private $_config;\r\n \r\n \tfunction __construct()\r\n {\r\n $this- > _loadConfig();\r\n \r\n \r\n $this- > _dbConn = oci_connect($this- > _config[&#39;db_usrnm&#39;],\r\n $this- > _config[&#39;db_pwd&#39;],\r\n $this- > _config[&#39;hostnm_sid&#39;]);\r\n }\r\n \tprivate function _loadConfig()\r\n {\r\n // Loads config\r\n $path = dirname(__FILE__) . &#39;/&#39; . self<IP_ADDRESS>CONFIG_FILENAME;\r\n $this- > _config = parse_ini_file($path) ;\r\n }\r\n \tpublic function fetchLogs() {\r\n \t\t$uid =$_POST[ \" ;USER_ID \" ;];\r\n \t\t \r\n \t\t$sql = \" ;SELECT REQUEST_TIME,WORKFLOW_NAME,EVENT_MESSAGE\r\n FROM AUTH_LOGS WHERE USER_ID = &#39; \" ;.$uid. \" ;&#39; \" ;;\r\n \t\t\r\n \t\t//Preparing an Oracle statement for execution\r\n $statement = oci_parse($this- > _dbConn, $sql);\r\n \t\t\r\n \t\t//Executing statement\r\n oci_execute($statement);\r\n \t\twhile (($row = oci_fetch_row($statement)) != false) {\r\n \t\t\tforeach ($row as $item) {\r\n \t\t\t\techo $item . \" ; \" ;;\r\n \t\t\t}\r\n \t\t\techo \" ;\\n \" ;;\r\n \t\t}\r\n \t}\r\n }\r\n ? > \r\n\r\n < !-- end snippet -- > \r\n\r\nmypage.php\r\n\r\n < !-- begin snippet: js hide: false console: true babel: false -- > \r\n\r\n < !-- language: lang-html -- > \r\n\r\n < !DOCTYPE html > \r\n < html > \r\n < head > \r\n < title > User_Logs < /title > \r\n < /head > \r\n\r\n < body > \r\n \t < ?php\r\n \t\tif ($_SERVER[ \" ;REQUEST_METHOD \" ;] == \" ;POST \" ;){\r\n \t\t\t$uid =$_POST[ \" ;USER_ID \" ;];\r\n \t\t\t$logAgent = new logAgent();\r\n \t\t\t$logAgent- > fetchLogs();\r\n \t\t}\r\n \t\t? > \r\n < form method= \" ;POST \" ; id= \" ;form-add \" ; action= \" ;index2.php \" ; > \r\n \t\t\tUSER_ID: < input type= \" ;text \" ; name= \" ;USER_ID \" ;/ > < br > \r\n \t\t\t < input type= \" ;submit \" ; name= \" ;submit \" ; value= \" ;Get_Logs \" ;/ > \r\n < /form > \r\n < /body > \r\n < /html > \r\n\r\n < !-- end snippet -- >", "768" ] ]
292
[ 12181, 2304, 6280, 809, 5656, 6892, 16344, 14740, 14300, 14946, 9097, 10153, 12422, 14520, 17384, 8256, 834, 5499, 15485, 13481, 15061, 13155, 6173, 14190, 14990, 5730, 19163, 11317, 13291, 4373, 13640, 12029, 4850, 10099, 8797, 19106, 6594, 17826, 9163, 6511, 12986, 9363, 15140, 11323, 17291, 14673, 17971, 3689, 9657, 1944, 9138, 13741, 13723, 13010, 6822, 9235, 17883, 15187, 15139, 219, 8987, 14073, 15442, 8212, 4220, 7595, 11265, 12779, 12532, 9125, 4805, 15234, 7983, 12102, 9325, 17899, 5268, 5793, 17089, 6465, 19101, 16802, 17163, 2122, 19388, 17225, 15018, 14891, 10109, 14547, 15454, 17719, 5434, 12319, 10005, 18722, 6474, 416, 16381, 18719, 9664, 7317, 10244, 13717, 18283, 16057, 14860, 11772, 9722, 1456, 9939, 11141, 15565, 4278, 11857, 15294, 13912, 2572, 12603, 14438, 15733, 19531, 4192, 13325, 10875, 9546, 14642, 13981, 5142, 1106, 11279, 11621, 142, 19612, 3242, 14370, 2989, 17137, 3280, 7451, 6719, 17299, 15572, 11637, 11243, 13170, 9860, 12358, 16706, 13306, 2065, 5954, 7598, 13112, 14503, 7774, 6814, 8214, 5153, 15468, 16462, 6950, 8349, 14038, 6994, 16766, 7533, 13420, 9728, 150, 17358, 9249, 19438, 7365, 16395, 11756, 15354, 13851, 13546, 13818, 17900, 17758, 10357, 2948, 129, 17261, 12739, 13966, 18822, 17666, 16271, 6821, 11372, 9999, 9311, 5486, 17018, 15966, 12921, 15112, 12697, 13939, 11369, 7762, 11911, 17705, 11373, 12116, 17783, 10374, 3465, 14674, 14437, 7966, 8859, 16816, 3340, 2859, 6736, 3511, 15134, 9246, 13482, 10725, 16189, 11788, 17658, 18181, 5240, 9064, 3049, 2295, 13339, 3591, 9293, 18640, 6553, 14297, 17950, 15679, 18098, 4933, 12708, 16139, 5491, 17992, 12548, 11233, 5583, 7236, 7799, 10840, 9508, 19451, 2674, 10082, 10955, 17795, 10234, 16197, 7300, 15063, 366, 17218, 14230, 12249, 13632, 7964, 6806, 19727, 7074, 14998, 9668, 11777, 9518, 18871, 6378, 14226, 14204, 15788, 836, 16276, 7119, 14372, 14361, 14388, 2549, 10135, 8685, 11011, 14511, 10838, 8777, 16609, 18849, 4733, 13559, 6816, 11625, 16358, 8870, 15016, 6085, 2706, 579, 2659, 8534, 13743, 14010, 19524, 14445, 14677, 9087, 56, 17934, 6154, 12360, 19660, 8919, 7342, 6247, 13961, 17386, 14064, 18921, 4606, 6634, 14447, 7747, 19457, 14130, 2211, 14271, 731, 7726, 18045, 6867, 8071, 18906, 14732, 9481, 15793, 19221, 16514, 12395, 16716, 15542, 15027, 411, 11108, 14124, 6441, 9678, 15672, 19755, 9026, 6804, 11144, 12052, 14612, 16840, 10287, 15486, 14587, 15166, 6932, 13652, 9581, 384, 14399, 12599, 14639, 12911, 14903, 13568, 4052, 11948, 11511, 9428, 6312, 5298, 2222, 14421, 14203, 8706, 8241, 11533, 17329, 15028, 8882, 186, 10054, 2225, 5019, 2694, 19123, 15172, 17612, 2646, 11803, 9199, 8237, 14924, 7877, 15765, 12620, 4144, 19173, 14415, 14411, 9751, 16183, 16642, 17949, 17827, 10902, 7322, 17379, 10187, 11345, 14790, 13397, 15154, 14940, 7262, 14446, 9746, 10393, 14017, 19595, 4758, 1795, 12604, 17905, 17308, 10877, 1493, 5740, 10410, 9301, 11380, 16780, 6773, 10450, 7511, 14476, 3982, 5873, 4342, 17647, 1883, 9387, 12284, 3037, 1485, 31, 10878, 7495, 6195, 9830, 3128, 15369, 12572, 16342, 8002, 13781, 4676, 14158, 12940, 14160, 11359, 1955, 5055, 9426, 12554, 13341, 10652, 14889, 19028, 9804, 12963, 7062, 6001, 12013, 10178, 17771, 2417, 8402, 17055, 5643, 12262, 17073, 3824, 1058, 2075, 9158, 12094, 16426, 19287 ]
STX_1009270.0
[ [ "You should begin by running some sample code and seeing how they work. There are lots of examples that display images in various ways. Step through them to see if you can understand what each step does.\r\n\r\nTry to write a simple \" ;Hello world! \" ; app in Qt. Then try adding an image display to it. The solution to the task you describe should become straightforward as you develop knowledge of Qt.", "114" ], [ "Pointers take a while to get straight, don&#39;t worry.\r\n\r\nIn myf your pointers point to a single double so the assignment statement can only copy the contents of where the &#39;a&#39; is pointing to the place where the &#39;b&#39; is pointing. \r\n\r\nWhen I was starting out I found it helpful to draw out memory as blocks on graph papers. Number each &#39;location&#39; on the graph paper. Now what are pointers and variable names in the paper world?", "638" ], [ "The purpose of optionals in Swift is to reduce the number of runtime errors. It allows the code to recognize when a variable has no value. &#39;no value&#39; is different from nil and all other values.\r\n\r\nWhen you reference an optional type you can force the compiler to get the value from the variable by adding an ! to the name. This should only be done when you are absolutely certain that there is a value to access. If you do this and no value is defined, your app will have a runtime error (crash). The optional can also be tested with an if to see if it has a value.\r\n\r\nThink of this error message as a warning to you to check for a possible failure point.", "365" ], [ "Do you need help with the SQL or the ios framework? \r\nThe SQL is pretty straightforward;\r\n\r\n select id, name, date, height from mytablename where name = \" ;tt \" ;;\r\n\r\n delete from mytablename where name == \" ;tt \" ;; \r\n\r\nPractice the commands on the command line so you see how they work. \r\n\r\nFor processing your data look at the great examples by <PERSON>;\r\n\r\n_URL_0_", "290" ], [ "A variable of type char* is actually a pointer to memory. Your struct contains data which is of type char* so it is a pointer to memory. (I suggest writing char* data instead of char *data, to help keep this clear.)\r\n\r\nSo you can use it as a starting point to look at your data. You can use another pointer to walk over the buffer.\r\n\r\n char* bufferInspectorPointer;\r\n bufferInspectorPointer = buffer.data;\r\n\r\nbufferInspectorPointer will now point to the first byte of the buffer&#39;s data and\r\n\r\n *bufferInsepectorPointer\r\n\r\nwill return the contents of the byte.\r\n\r\n bufferInspectorPointer++\r\n\r\nwill advance the pointer to the next byte in the buffer.\r\n\r\nYou can do arithmetic with pointers in C++, so \r\n\r\n bufferInspectorPointer - buffer.data \r\n\r\nwill tell you how many bytes you have covered. You can compare it to buffer.size to see how far you have left to go.", "638" ], [ "Since you are creating a new string, there is no need to do it backwards. Processing from the front will be clearer. Despite being homework you should strive for general code and avoid magic numbers in your code (like 49).\r\n\r\nAsk yourself what&#39;s the longest possible output string. How can you compute it? Can you write code which can deal with any input string, or handle failures in a graceful manner (not crash)?", "157" ], [ "Use the class function &#39;screens&#39; to get an array of all the screens you have. From the array, pick the screen you want your window to appear on. Use the co-ordinates on that window (which are relative to the main window) to make a rect for your new window like this;\r\n\r\n [self.window setFrame:CGRectMake(pos.x, pos.y, [mywindow frame].size.width \r\n , [mywindow frame].size.height) display:YES];\r\n\r\nwhere pos is computed from the array of screens and your selectoin.", "102" ], [ "I&#39;m pretty sure that CloudKit will be useful for storing your users&#39; data but can&#39;t provide app updates.\r\n\r\nYou could consider use REST apis to access the different levels on a server that you provide. This would be relatively simple and you can find lots of examples online. You could start with a single service; getLevelN etc.", "510" ], [ "Your main problem is that your table function must identify the column that you wish to display. Look for some simple example code. \r\n\r\nEach call to tableView will have to check for the column and the row. Your code can only return the name because it doesn&#39;t check for the column. The column&#39;s are identified by the name you assign them in IB (interface builder).\r\nHere&#39;s an example\r\n\r\n if (tableColumn!.identifier == \" ;name \" ;)\r\n {\r\n return artistSet!.itemAt(row,key: \" ;name \" ;)\r\n }\r\n else if (tableColumn!.identifier == \" ;image \" ;)\r\n {\r\n // etc\r\n }", "870" ], [ "Separate your computations which are not part of the database from the query. Then build up your query from simpler parts to get what you want. \r\n\r\nYour computations include things like the start date. It has nothing to do with what&#39;s in the database, so do that computation first.\r\n\r\nFor queries, try these;\r\n\r\n - select today&#39;s data\r\n - select yesterday&#39;s data\r\n - select yesterday and today\r\n - select the current months data\r\n - select the previous month&#39;s data\r\n - select the previous and current month\r\n\r\nYou should be able to see your solution by working out these simpler cases.", "733" ], [ "The code makes two calls because it breaks the problem into two parts and each part is solved the same way. Each part is in some sense simpler than the original problem and the same method is used to solve each individual problem. As pointed out by others, there may be situations in which there are more than two parts.\r\n\r\nYou have likely seen examples with one call where one part of the problem is solved and the single recursive call solves the &#39;remainder&#39; of the problem.", "847" ], [ "One way to do it is to have an answer table. The answer table would be something like;\r\n\r\nid, userId, testNumber, questionNumber, answer, time\r\n\r\nAt any time you can look up the answers to the questions by any user on any test. You can sort them by the time. You will then have access to the last one, the last 5, you can find which are missing, if they are all done etc.", "215" ], [ "That is correct. Your sample code does not use MITK at all. It&#39;s just straight Qt. The QImage load method cannot read a DICOM image. Using a framework like MITK requires a very large learning curve. To start I would recommend writing some code which loads non DICOM images and does some of the operations you require. Next use a simpler framework to learn how to load DICOM images. (GDCM for example) The most important things to know are 1- DICOM files have a lot of meta data that other image formats do not have, 2 - DICOM image data itself is often different from other image formats.", "929" ], [ "Here are some code fragments. You should be able to build the script you need from these.\r\n\r\n tell application \" ;Image Events \" ;\r\n launch\r\n set countDisplays to count displays\r\n quit\r\n end tell\r\n\r\n tell application \" ;QuickTime Player \" ;\r\n --set the bounds of the first window to {-20, 0, 1280, 920}\r\n activate\r\n tell application \" ;System Events \" ; to keystroke \" ;f \" ; using {command down, control down}\r\n end tell", "602" ], [ "If you have a SC system installed, then under to Tools menu you should see it listed. In mine, for example, Git appears as an option. When you select Git, the submenu has an option to Create Repository. When selected it asks you to select the folder for the respository.\r\n\r\nYou need to install external tools and then configure Qt creator to use those tools. Under Preferences, select Version Control then the Git tab. Make sure that the Git tools are in the Path. Look here for the tools; _URL_0_.", "441" ], [ "It&#39;s been a while since I wrote tiff code, but you can build the image manually without trouble. Be sure to be aware of different formats, compression, separate planes etc, unless you know that all your sources will be in one format. For &#39;what to do next&#39;, build an entire line of the image then use TIFFWriteScanline(....).", "111" ], [ "<PERSON> is correct about endian problems. You must know your file&#39;s format to be able to read it correctly.\r\n\r\nTo answer the other part of your question, you need to use Qt&#39;s QIOStream class in order to access the file at a more granular level. You can also tell QUIStream which endian format a file has and it will fix numbers for you.", "412" ], [ "I went back and looked at my old code. It turns out that I didn&#39;t use libtiff. Nevertheless you are on the right track. You want something like;\r\n\r\n lineBuffer = (char *)malloc(width * 3) // 3 bytes per pixel\r\n for all lines\r\n {\r\n ptr = lineBuffer\r\n // modify your line code above so that you make a new line\r\n for all pixels in line\r\n {\r\n *ptr++ = newRed;\r\n *ptr++ = newGreen;\r\n *ptr++ = newBlue\r\n }\r\n // write the line using libtiff scanline write\r\n write a line here\r\n }\r\n\r\nRemember to set the tags appropriately. This example assumes 3 byte pixels. TIFF also allows for separate planes of 1 byte per pixel in each plane.\r\n\r\nAlternately you can also write the whole image into a new buffer instead of one line at a time.", "682" ], [ "Either the build is faulty or you need a different version of Qt installed to run it. Usually the app has the Qt libraries that it needs wrapped up in the app itself. If it&#39;s not in there it will search your mac for it. The message says that QtCore can&#39;t be found in either place. If you look inside Google&#39;s Google Earth, you can see where the libraries are stored. You can also copy a version of QtCore into your Marble to see if it will work.", "852" ], [ "QGeoServiceProvider expects a plugin for the service that you want to use. If you have a plugin for \" ;Here \" ; then you just use the Qt class methods to access the provider.\r\n\r\nI expect that you don&#39;t have a plugin, though. In that case you should just consider using the REST api for the \" ;Here \" ; service. To use that you want to look at their REST api instructions and QNetworkAccessManager and QNetworkRequest examples.", "88" ], [ "If I understand your question, you want to write code to write your own dicom files. This is an excellent exercise if you want a deep understanding of the dicom format. What you need to do is read over the spec first or another explanation like this one _URL_0_.\r\n\r\nNext I would get a binary editor and look at a few dicom files to see how some files look and compare them to the spec notes.\r\n\r\nThen write some code to output some tags. Get a couple of files and try to replicate an existing file from your own code. Finally build a dicom dump utility or get one. Then you can dump your own tests along with an existing file to make sure they match.", "992" ], [ "Parallel requires the use of Yield calls to allow different threads to run. Review the documentation and add Yield calls to allow other threads to run. The most common way to do this is to add them once per loop. If your tunnel func yields once per loop then the screen process can run. The screen process will have to yield each time to allow the tunnel func to resume.", "739" ], [ "I would suggest that you start by writing a simple &#39;hello world&#39; application in the language you want to use OpenCV with and the platform that you plan to use. Next read up on the details of how that worked. The main thing that you have to know to clear up the mystery is this; programs are compiled in individual pieces. The individual pieces are combined into an application by the process of &#39;linking&#39;. Using things like OpenCV requires that you link together your program&#39;s parts with parts made by others (like OpenCV).", "884" ], [ "Yes you can access the websql database with Qt. The websql database is just a sqlite database so there is no problem accessing it with Qt.\r\n\r\nThe tricks are finding the location and name of the file. In Chrome on my Mac, for example, the database is at\r\n \r\n ~/Library/Application Support/Google/Chrome/Default/Databases/mysite/1\r\n\r\nthere is a master database of the other databases at \r\n\r\n ~/Library/Application Support/Google/Chrome/Default/Databases/Databases.db\r\n\r\nIt is also sqlite and you can read it to find the other databases.", "573" ], [ "The main thing to realize is that you have to first search for a first character match and then check for the match of the rest of the string. Use a second set of counters for matching the rest of the string so that you don&#39;t loose your position in the main string. To clarify the process you could even use a second function for matching the rest of the string and capitalization", "615" ], [ "Here&#39;s how to start, if you are using firebase, build a basic firebase app. Look at the javascript code provided by BTCQuote here; \r\n\r\n_URL_0_\r\n\r\nand add their code to get the data. You can modify it to fit the needs of your app.\r\n\r\nIf you are not using firebase, you can build a standard OS X app with swift and then use javascriptcore. There is an intro here;\r\n\r\n_URL_2_\r\n\r\nand a small example here;\r\n\r\n_URL_1_\r\n\r\nYou can use the javascriptcore to execute the example code provided by BTCQuote or a modified version.", "483" ], [ "You have not included any code to extract the text from the web page. When you run \" ;dataWithContentsOfURL \" ; and it&#39;s a web page, then, as you have seen, you get the whole page.\r\n\r\nTo extract the data you need to process the results. In a simple case you can get the text with some string manipulation. In more complex cases you should look for a library which will parse the whole page for you. You can then access the parsed structure to get the content that you want.\r\n\r\nLook here for an example of the simple case;\r\n\r\n_URL_0_\r\n\r\nThere are libraries for the more complex case.", "417" ], [ "I generally put the cp command into the background (put an & at the end of the line). Then you can just go to the designation folder and look to see if the files are being added. \r\n\r\nfwiw; I regularly had to move folders with hundreds of thousands of files a few years ago and cp did indeed hang up occasionally. I haven&#39;t had to do this recently so i don&#39;t know if it has improved or not.", "859" ], [ "Sometimes you have to build the different views. For example if you have a CT image set which are axial to the subject, then you can make your own slices for coronal and sagittal views by sampling the image set appropriately. I would start by writing code to simply display the data you have as is as a starting point. By the time that&#39;s working you&#39;ll have a deeper understanding of the issues.", "13" ], [ "First create a custom view in your xib file. This will be where the various view controllers will put their own views. In your the code which will navigate between the view controllers create a variable to reference the custom view in your xib file;\r\n\r\n var masterView : NSView!\r\n\r\nBack in interface builder, connect the custom view to your variable. masterView now refers to the custom view and gives you the means to change it.\r\n\r\nYou can replace that view with the view of the view controller that you want to be active at any given time.\r\nFor this example, assume that I have three view controllers (as examples);\r\n\r\n var pDemog : patientDemographicsController!\r\n var pExams : patientExamsListController!\r\n var pReports : patentReportsViewController!\r\n\r\nThe first view controller can be set up as follows;\r\n\r\n masterView.addSubview(pDemog.view)\r\n\r\nLater when needed you can replace the view with the view of a different view controller\r\n \r\n masterView.replaceSubview(pDemog!.view with: pExams!.view)\r\n\r\nand back again;\r\n\r\n masterView.replaceSubview(pExams!.view with: pDemog!.view)\r\n\r\nor to another;\r\n\r\n masterView.replaceSubview(pExams!.view with: pReports!.view)\r\n\r\nThat&#39;s the mechanism for changing the view. You can add animations as referenced above, but it&#39;s not necessary. Also, you should prepare the views in the view controllers as follows; (this is just one example, you need it for each view controller)\r\n\r\n pDemog.view.setFrameOrigin(NSPoint(x:0, y:0))\r\n pDemog.view.setFrameSize(masterView.frame.size)\r\n\r\ndo this before you start setting the views in the masterView.", "735" ], [ "To iterate QTreeWidget child items use QTreeWidget<IP_ADDRESS>topLevelItem() to access top level items and then recursively use QTreeWidgetItem<IP_ADDRESS>child() to iterate over lower-level children and their children.\r\n\r\nAre you loading this dicom file yourself? You can also look at the source code for gdcmdump. Modify that code to output csv instead of its standard output. That would be straightforward.", "318" ], [ "This is not a MySQL problem. You should store file references in your MySQL tables and handle the file encryption yourself. IOW, your app should encrypt and decrypt the images at the application level and only these encrypted files should be moved around and stored. Only the app can then display the contents of an image file. No plain readable form of the image appears anywhere else.", "287" ], [ "If the images that you are supplying are fixed in the app (ie- not changing over time) then you simply add the images to the app itself. They are stored in the app bundle and can be accessed as follows (with sample names);\r\n\r\n let imagePath = NSBundle.mainBundle().pathForResource( \" ;myImage \" ;, ofType: \" ;jpg \" ;) \r\n let splashImageURL = NSURL.fileURLWithPath(imagePath!)\r\n anImage = NSImage(contentsOfURL:splashImageURL)\r\n \r\nYou can create a folder in the project to hold the images. This is not used in the final image path, only for convenience in the project. You can use the File menu or drag and drop image files directly into the project. Make sure to check the &#39;copy files&#39; option to move the images from your source location into the project itself.", "696" ], [ "Compiling converts your source files to binary. This phase does not involve the libraries. So, when you compile, missing libraries are not noticed and you get no errors.\r\n\r\nLinking is the second phase where your binaries and the libraries you referenced are put together into an executable file. In this phase, if the libraries you referenced cannot be found, the executable cannot be built. This is the error that you are getting here. The linker cannot find apr-1. Look for the folder /usr/local/apr/lib/ and see if the library files are there. If not either put them there or change the make file to tell the linker where they actually are.", "289" ], [ "First, if you want to build your year and month dictionaries for storing events, you don&#39;t want to re-create them each time an event comes in. You need to create the dictionaries (one year and twelve month dictionaries I assume) outside of the event processing loop. You also want to create an empty array to store the events Then you want to add each event into the array for the appropriate month and appropriate year.", "926" ], [ "Download the library you need for your project here;\r\n\r\n_URL_0_\r\n\r\nRead section 4 and the first part of section 8 on the page you reference above.\r\n\r\nYour problem is that the library has not been linked into the application.\r\nYou will have to add two lines to the PRO file of your Qt project to tell Qt where to find the library that you downloaded and the headers for the library. They will look like this;\r\n\r\nINCLUDEPATH += /Users/sysadmin/programming/alglib/includes/????\r\nLIBS += -L/Users/sysadmin/programming/alglib/libs -l?????\r\n\r\nwhere you will use names for your system, not mine, and replace the ??? with the library names.", "289" ], [ "It&#39;s complicated but you can test the concept by hard coding. Your application support folder is called /Users/YOURUSERNAME/Library/Application Support/APPLICATIONBUNDLEIDENTIFIER/ and you can make a test file in there by hand. You can find the application bundle identifier in the project settings under Build Settings then Packaging. In my work it is like com.creativemedicalsystems.myApplicationName So you can either make usr.txt right in there, or make a folder called Data and put it in there. The path then needs /Data/usr.txt after your application name.", "483" ], [ "Your question is a bit unclear. What do mean by &#39;in the background&#39;? Do you want the app to monitor a data source over time and notify the user? You can, of course, run a process from time to time to get the data and check for conditions that merit the alert. You can set a timer to run the process as frequently as you like and run the process in a different thread or as an NSOperation.", "666" ], [ "I recommend the following process; \r\nFigure out a tool for segmentation. This is the process whereby you will build a 3d model of subset of the data depending on density. For example, you will build a model of the ribs of a chest CT. You should do this outside of Android and then figure out how to move it later. You can use tools like ITK and VTK to learn how to do this stage.\r\n\r\nIf you want to avoid the ITK/VTK learning curve, use GDCM (grass roots dicom) to learn how to load a DICOM series. With this approach you can have a 3D array of density points in your app in a few hours. At this point you can forget about the DICOM and just work on the numbers. You still have the segmentation problem.\r\n\r\nYou can look at the NIH app ImageVis3D which has source code and see what there approach is.\r\n\r\nOnce you have a segmented dataset, conversion to a standard format is not too hard and you will be on your way.\r\n\r\nWhat is the &#39;detected marker&#39; you refer to? If you have a marker in the image set to aid in segmentation, you can work on detection from the 3d dataset you get back from loading the dicom data.\r\n\r\nOnce you have the processes worked out, you can then see how to apply it all to Android.", "117" ], [ "Yes, CloudKit can provide the service you need. Your app can store data in private and public databases. You can control the data in the public database so that your users can access only the parts shared by a particular user. CloudKit will require that users allow the service to share their identity with other users. However, I expect that you could share data with revealing identity inside CloudKit by exchanging a key value.", "756" ], [ "Define your new window&#39;s layout in a form file with name to match your dialog.\r\nCreate a new C++ class with a base type of QDialog, called, for example, mySpecialDialog. It should refer the form file as follows;\r\nPrivate: \r\n UI<IP_ADDRESS>mySpecialDialog ui;\r\n\r\nThen in your main code, when you want the dialog,...\r\n\r\n mySpecialDialog *msd;\r\n\r\n msd = new mySpecialDialog();\r\n\r\n if (msd- > exec() == QDialog<IP_ADDRESS>Accepted)\r\n {\r\n ... code \r\n }\r\n else\r\n {\r\n\r\n }\r\n\r\nvoila.", "996" ], [ "Look at the documentation for file opertions; fopen, fread, and fclose.\r\nThese let your code access the contents of a file.\r\n\r\nOnce you have read the data, or as part of reading, you can get the individual numbers. \r\n\r\nYou can learn by breaking the task down into smaller parts, for example, pretend that you have already read the file into a string and just work on the part to get the numbers out of that.", "782" ], [ "You need to buy a copy of OS X Server. You need to configure it to host your web services.\r\n\r\nThen you need to set up the A record for the site with domain registrar (who you registered the domain with). This will put the address lookup for your domain name to your machine out on the internet. As a result of this step users who type in your domain name will have their traffic routed to your machine. If you haven&#39;t done the first step, the traffic will go no where and they will not get a response.", "628" ], [ "tell us what you know. Did you open the output file with an editor to see if the input/write is working? Here&#39;s a tip; separate the input of data from the insert operation. Now you can test the insert operation with test code that doesn&#39;t need user input. you can call one or more inserts with known values. to test its operation.", "326" ], [ "You can download a web site directly into an NSData object as in this example (Objective-C);\r\n\r\n NSURL *tutorialsUrl = [NSURL URLWithString:@ \" ;_URL_0_;];\r\n NSData *tutorialsHtmlData = [NSData dataWithContentsOfURL:tutorialsUrl];\r\n \r\nSwift example;\r\n\r\n let aString = \" ;_URL_2_;\r\n let url = NSURL(string: aString)\r\n let data = NSData(contentsOfURL: url!)\r\n\r\nRay has a great tutorial here;\r\n\r\n_URL_1_", "381" ], [ "I am creating an window with a significant initialization process and I would like to keep the window hidden until init finishes. Right now at the beginning of my js code I hide the window right after it is created and then show it when init is complete. But this creates a less than pleasing flash when the app is launched as the window appears, disappears and then re-appears.\r\n\r\nIs there a way to keep the window invisible while the init runs?", "504" ], [ "Build the string like this;\r\n \r\n NSAppleScript *appleScriptGetHH = [[NSAppleScript alloc] initWithSource:\r\n [[NSString alloc] initWithFormat:@\\\r\n \" ;tell application \\ \" ;System Events\\ \" ;\\n \\\r\n tell process \\ \" ;Grabee\\ \" ;\\n \\\r\n with timeout of 0 seconds\\n \\\r\n get value of attribute \\ \" ;AXValue\\ \" ; of text area 1 of scroll area 1 of window \\ \" ;%@ \" ; \\n \\\r\n end timeout \\n \\\r\n end tell \\n \\\r\n end tell \" ;, windowName]\r\n ];\r\n\r\nor build the string as a separate step for a bit more readability.", "819" ] ]
329
[ 1095, 9888, 5994, 14039, 9334, 17871, 9075, 12491, 14083, 11494, 7030, 8575, 13796, 6482, 6852, 3074, 126, 15038, 3810, 9742, 2710, 13240, 9565, 14578, 2011, 13567, 5391, 4246, 11060, 2563, 19080, 14357, 17412, 1780, 4174, 13906, 3655, 10685, 16484, 8391, 11221, 2762, 17498, 10907, 15367, 8111, 9745, 12317, 13281, 13173, 2389, 4936, 5749, 17313, 13182, 16289, 12856, 17806, 13846, 5605, 15206, 14163, 8729, 5554, 5128, 4661, 18199, 14198, 11597, 9531, 15630, 15885, 12706, 13077, 711, 5328, 829, 14634, 11611, 15174, 4501, 15059, 18855, 6514, 2821, 4739, 1430, 4200, 15201, 19699, 14188, 9269, 14739, 14671, 11907, 1662, 3213, 5163, 1786, 11189, 2927, 7261, 14408, 15409, 3284, 642, 5986, 3463, 570, 3258, 9130, 1232, 1496, 8655, 345, 8014, 15989, 8991, 8419, 17315, 3624, 12675, 257, 2415, 649, 9764, 6786, 8879, 8317, 3235, 10319, 4959, 16343, 3446, 2869, 18915, 10254, 2960, 10295, 5613, 19693, 8181, 3992, 1699, 2435, 4431, 12945, 10497, 6371, 1647, 4515, 19495, 17813, 15379, 3004, 7202, 10762, 16442, 10125, 14931, 14581, 13311, 5395, 4282, 4157, 13066, 3963, 13342, 13171, 4302, 15745, 3618, 16990, 1696, 8782, 9406, 4913, 2087, 4484, 5629, 18514, 1585, 6359, 16592, 3553, 2112, 12257, 18054, 16906, 4248, 14742, 13903, 15365, 1642, 2936, 3731, 1984, 12414, 4612, 2862, 16892, 3482, 4186, 13982, 1322, 18944, 11123, 7541, 16617, 11858, 3710, 8142, 11465, 16121, 5039, 16807, 8570, 13947, 1651, 3629, 8835, 4333, 12734, 5108, 3654, 4781, 5825, 10473, 9393, 10038, 9510, 18166, 15334, 3648, 5475, 9949, 2409, 19479, 75, 1526, 7164, 14378, 2231, 412, 10335, 17444, 3314, 15209, 15, 6780, 9460, 14441, 16282, 9450, 2022, 19159, 14752, 9542, 3794, 1491, 11891, 5439, 4475, 16069, 15068, 13751, 1054, 3061, 16081, 5733, 9756, 3418, 17845, 11581, 9107, 11248, 17128, 14923, 2000, 1004, 12826, 768, 14247, 15459, 15517, 1135, 14219, 1838, 18083, 14543, 6990, 11750, 18073, 717, 2185, 16542, 9651, 10059, 15303, 9252, 15917, 5946, 2892, 698, 2166, 4840, 10930, 2561, 10734, 8040, 17477, 16961, 10863, 11617, 13362, 761, 8139, 12641, 9223, 13665, 12489, 3088, 10648, 8809, 11720, 4997, 13264, 4904, 1390, 17772, 17360, 2669, 399, 14825, 12635, 18700, 5776, 6206, 2024, 1320, 11256, 1222, 6164, 10134, 2319, 5526, 10173, 520, 4499, 6114, 9454, 110, 1930, 8366, 14781, 3681, 11017, 18455, 13295, 15232, 8704, 465, 10209, 7655, 1036, 1350, 17824, 9441, 552, 7333, 10696, 8792, 1893, 5267, 10747, 19494, 615, 4308, 18922, 19605, 24, 3298, 17213, 8034, 7088, 14628, 3031, 15904, 8726, 10493, 3983, 19076, 16102, 4447, 12667, 9234, 12844, 13274, 8556, 9712, 19342, 17009, 567, 8984, 2183, 15749, 6228, 13915, 5982, 6168, 18886, 17926, 2264, 6808, 9059, 15210, 12917, 11918, 10425, 17535, 12724, 6598, 8875, 2148, 9083, 104, 828, 17966, 9663, 11834, 2401, 10304, 350, 5309, 12250, 14236, 5096, 7347, 4642, 10946, 11778, 9355, 1607, 10332, 16586, 8180, 13164, 18554, 5696, 16072, 17566, 4852, 6660, 9813, 19261, 7525, 338, 18034, 4682, 8405, 9714, 9412, 4565, 19020, 12647, 1504, 18441, 1444, 6452, 19027, 16412, 4458, 15737, 15675, 7732, 14913, 6573, 6965, 6008, 10041, 1408, 18473, 8877, 12202, 9091, 2890, 1284, 17120, 8462, 16917, 14572, 8849, 10740, 9015, 9729, 2340, 2083, 9307, 15927 ]
STX_10094.0
[ [ "> Can I submit an article just for the sake of useful feedback?\r\n\r\n**Yes and no.** Of course nothing stops you from sending an article just to get feedback, and this is indeed a suggestion that I sometimes see given to young researchers when they are unsure about their paper.\r\n\r\nHowever, there are a few issues that, in my opinion, makes this approach not overly effective.\r\n\r\n - You will get feedback, but you may not get *useful* feedback. Reviews fundamentally tend to assess the current state of a research project. It should not be like that, but many reviews focus on what&#39;s wrong with a paper, and not on how it could be fixed. Think of it as an evaluation more than a feedback procedure.\r\n - Additionally, there is little incentive for the PC to be overly constructive. My impression has always been that the anonymity of peer review leads people to be more dismissive than what they would ever be if they talked to you personally.\r\n - The turnaround time of good conferences is so long that you need to expect to wait a few months for your reviews. This is wasted time if you are already pretty sure that the paper won&#39;t be accepted.\r\n - As you say yourself, an argument can be made that submitting a paper that you yourself are not sure is ready for publication to be an unethical abuse of the peer review system. I would consider this a fairly mild problem myself, but it is obvious that the peer review system would break down (even more?) if many people started to adopt your approach.\r\n\r\nMore promising may be to find a collaborator who is aware of community standards of wherever you want to publish to take on board for finishing and publishing this work. Such a person can not only help you writing a paper using the conventions of the field, (s)he will also be able to point you and help you with any additional work that may make your work stronger in the eyes of your targeted community. Most importantly, this person has then skin in the game and will strive to be constructive rather than just telling you that your work isn&#39;t going to cut it.\r\n\r\nThis of course leaves the question how to find such a person. I am sad to say that personal connections (of you, your supervisor, or other friends or fellow faculty) are by far the best approach, but failing that you can try to establish ties by attending workshops or working conferences, as proposed by lighthouse keeper in his answer.", "827" ], [ "Questions of ethicality usually don&#39;t have a clear-cut answer, and this is no exception. Fundamentally, you should of course retain a say in what happens to the research that you produced as a grad student. On the other hand, it also seems completely fair and natural to include your work in reports to the funding agency that sponsored your work. Objecting against this may be an ethical violation in and of itself. Strictly speaking, and I am definitely not a lawyer, *not* reporting work that has been done in the context and using the money of an EU project may be a breach of the contract that your home institution has with the European Union (one would need to know the terms of the framework programme that the institution needs to sign when joining a project).\r\n\r\nHowever, your main problem seems to be (from a comment):\r\n\r\n > EU Project deliverables are usually published and a citable piece of work and they are different from NSF progress report. If it was a progress report or a poster it was totally fine with me, but when a major part of the paper now is published in the report I cannot submit my manuscript to a venue anymore unless I make a major revision.\r\n\r\nBased on my experience in 3 EU projects, this is, in the generality you describe, just not true. Deliverables per themselves can be public or confidential, which is described in your *Description of Work*. Even if they are public, that usually just means that they are uploaded to your project&#39;s website (and maybe some third-party project result aggregator, depending on what clusters and collaborations your project is part of). While these deliverables *do* get the occasional citation, they are *not* formally published and should really not preempt further publication, even in verbatim. I would see this in the same way as a preprint - for most journals, uploading a preprint to arXiv or PeerJ does *not* mean that you can&#39;t submit to a journal, so why would your text appearing in an un-reviewed project report?\r\n\r\nIt is also my practical experience that most scientific reports consist largely, or at least to a significant part, of copied papers, some of them published and some unpublished at the time of submission. Hence, your ex-advisor&#39;s behavior is at least completely in line with what other PIs do and expect in such projects.\r\n\r\nThat all being said, I have once worked in a project that, by default, published a book volume once a year with Springer which collected all reports of the project. This would indeed count as formal publication. However, even if this or a similar arrangement is the case for you, a compromise could be found that your work appears in the \" ;official \" ; report to the EU and is retracted from the resulting book publication.", "827" ], [ "I feel the first step is to calm down, and to stop exaggerating. Seeing this as an * \" ;evil mistake \" ;* and a * \" ;predicament \" ;* that&#39;s * \" ;embarassing \" ;* is really, really over the top for just having published a paper that&#39;s correct but uninteresting at a low-competition conference from a reputable publisher. As you say yourself - \" ;when the time is ripe \" ; you will start publishing better papers, and then nobody (including you) will care anymore about this weak one. And before that time you have at least gotten some experience in writing papers.\r\n\r\nNow to answer your actual question:\r\n\r\n > How to distance me from this evil mistake hanging in IEEE explore with my name on it forever. \r\n\r\nThe only way to \" ;distance yourself \" ; from a paper is to retract it, and that&#39;s not really an option given that the results are not wrong. That is, you or one of your co-authors have submitted this paper under your name, and now you need to live with it. However, note that it \" ;hanging in IEEE explore with your name \" ; is much less of a big deal than you may think it is. The internet is a big place, and a paper in a small, non-competitive conference is virtually invisible as long as it does not get cited frequently or otherwise gets viral (which, if it is boring as you say, is very unlikely to happen).", "827" ], [ "Suppose an American citizen is engaged to a Russian citizen. The couple would like to be able to live in America together. They do not particularly need to live together in Russia, although the Russian would like to be able to return from time to time to visit family etc.\r\n\r\nIn order for the Russian to come to the US, the American needs to approve a visa for the Russian to travel to the US, where they have 90 days to get married and the Russian can file for a change of status.\r\n\r\nThe part I don&#39;t understand is, what do we need from Russia? The Russian is obviously going to have to tell them \" ;hey I&#39;m going to the US to marry a guy, and I will be there indefinitely (though I am planning on coming back to visit family etc.) \" ;.\r\n\r\nWhat process do they have to do on the Russian side?", "606" ], [ "> Is the fact that I couldn&#39;t find any enough? When do I know that I put enough effort into searching?\r\n\r\nObviously, there is no way to \" ;prove \" ; that something does not exist, so on a fundamental level that you did not find anything *has to* be enough. Of course, you need to make evident that you searched in a reasonable way. The guidelines of structured literature reviews have some rules on how to do this, but essentially it boils down to (1) searching all reasonable sources, and (2) searching for all the terms that could reasonably be used to describe what you are looking for.\r\n\r\n > how to phrase it?\r\n\r\nThe usual phrase is * \" ;to the best of our knowledge, this methodology has not been used before to (...) \" ;*.", "5" ], [ "Why don&#39;t you just list the grants that you have received, optionally with some measure of how competitive the funding scheme is (e.g., acceptance rates etc.)? I would assume a selection committee to understand that acquiring external funding is different from country to country, and that you were previously able to acquire funding will be a positive even if the amount sounds small in US$ terms.", "622" ], [ "I think this is a fairly bad idea, for the following reasons:\r\n\r\n - **It&#39;s largely shouting in the woods.** Let&#39;s face it, while you may feel that your thesis is the only piece of work that&#39;s \" ;truly yours \" ;, it will likely also be the least-read piece of your career. More to the point, your (presumed) target audience (young physicists in other departments) are very unlikely to ever come across your statement. How many PhD dissertations of people you don&#39;t know personally have *you* read to the end?\r\n - **It has a non-zero chance of annoying somebody in your committee.** Again, a physics thesis nowadays is mostly there to appease your committee (as few to none outside of the committee will ever read it), so a section that does not contribute to or actively hurts this goal seems like a bad idea. And I would argue that there *is* a real danger that *somebody* in your committee is not thrilled about the unconventional political statement in your thesis, as:\r\n - **You may be unable to write it in a way that it does not come across as preachy.** I think the pure existence of such a section will be perceived preachy, so no matter how you phrase it, it may always be perceived as such.\r\n\r\nSo if your thesis (and formal papers, obviously) are bad places to communicate your opinion on science politics, how *can* you communicate these matters? Most people I know with strong opinions on political matters of science (be they about career models for young scientists, open access, reproducibility, ...) tend to primarily communicate their thoughts over various social media (blogs, Twitter, Facebook), with the occasional invited opinion piece on the topic in a journal or magazine editorial. Every now and then, they are also invited to talk about the issues they care about in seminars or as invited speakers in conferences. Presumably, in some cases, they have just been invited in general and have decided on their own that politics is what they are going to talk about. This strategy reaches substantially more people (even if your blog entry never jumps across 100 views, that&#39;s probably still more than your thesis will get in the next 50 years), and from a blog or Facebook entry, people *expect* opinionated content, so there is much less reason to think less of you (unless they vehemently disagree with your opinion, but in this case no way of communicating your thoughts will help).", "76" ], [ "> While a reviewer has mentioned \" ;major revision \" ;, is this decision advising for resubmit after revising the paper? Does this mean \" ;Reject and resubmit \" ;?\r\n\r\nYes, this means your manuscript is rejected, but you are free to submit a new version once you addressed the mentioned problems.\r\n\r\nNote that whether one of the reviewers voted for Major Revision rather than Reject is completely irrelevant - it&#39;s the editor&#39;s decision that counts.", "827" ], [ "As I understand it, the main difference is not *per se* that you need a better record for promotion in the UK, but that the system is different. In the UK, there should be *one* professor per university and research area (with arbitrarily many lecturers and readers), while no such restriction exists in the US and in other places (i.e., an US university may elect to have multiple professors with largely overlapping research competencies).\r\n\r\nThat means that in the US you can be promoted largely based on your own merits, while in the UK promotion is often tied not only on your CV being strong enough, but also on the previous professor leaving the post (either due to retirement, or relocation). Of course you will usually also need an exceptionally strong CV, as there will often be other readers or senior lecturers in a similar field competing for an opening on professor level.\r\n\r\nAs I understand it, the system is comparable to the German \" ;Lehrstuhl \" ; (research chair) system, with the important difference that German universities are free to appoint full professors that happen to not (yet) occupy their own research chair.\r\n\r\nEvidently, in practice some leeway exists in how narrow or wide a university defines fields, but the general practice seems indeed to be that a reader or senior lecturer can only be appointed professor if the previous holder leaves the post or an explicit decision is made to create a professor position in a suitable field.", "906" ], [ "I think it&#39;s an interesting question,\r\nThe way I see it is your satellite stays in orbit because of it&#39;s high speed but it also burns up because of it&#39;s high speed. If you can get it traveling slow enough by the time it reaches the atmosphere you should be able to use atmospheric drag without burning up. So you would need a way to slow it between the orbit height and speed and the atmosphere. \r\n\r\nI think it could be interesting do the math for trying to slow a chipsat by using a collection of tethers using drag generated by geomagnetically induced current, so using the magnetic field of the earth to slow down before hitting the atmosphere. But I wouldn&#39;t know where to begin with running those sorts of calculations.", "991" ], [ "In short, orthogonalization of the Krylov vectors occurs with respect to the operator, but not with respect to the preconditioner.\r\n\r\nAlright, so say we want to solve $Ax=b$ with preconditioner $B$. the preconditioned-CG iteration is basically:\r\n\r\n\\begin{align*}\r\n\\hat{v}_1=\\tilde{v}_1 = & Bb\\\\\r\nv_1 = & \\tilde{v}_1 / c_1\\\\\r\n\\\\\r\n\\hat{v}_i = & BAv_{i-1}\\\\\r\n\\tilde{v}_i= & \\hat{v}_i-\\sum\\limits_{j=1}^{i-1} \\langle Av_k,\\hat{v}_i\\rangle v_k\\\\\r\nv_i = & \\tilde{v}_i/c_i\\\\\r\nc_i = & \\sqrt{\\langle \\tilde{v}_i,\\tilde{v}_i\\rangle}\r\n\\end{align*}\r\nIn other words\r\n\r\n - $\\hat{v}_i$ - New Krylov vector\r\n - $\\tilde{v}_i$ - Orthgonalized Krylov vector\r\n - $v_i$ - Normalized Krylov vector\r\n\r\nNow, what&#39;s interesting from this is that we get a number of properties. The two that really matter for you are\r\n\r\n 1. $\\textrm{span}\\{v_i\\}_{i=1}^m = \\textrm{span}\\{(BA)^{i-1}(Bb)\\}_{i=1}^m$\r\n 1. $V^TAV = I$\r\n\r\nThe first property follows from how $\\hat{v}_i$ is generated. We&#39;re subtracting things from it and normalizing, but we&#39;re basically just getting a bunch of $BAv_{i-1}$ where $v_1$ is a scaling of $Bb$. The second property follows from $\\tilde{v}_i$. Here, we do *not* use $B$ in the orthogonalization. Orthogonalization depends purely on $A$ being symmetric positive definite.\r\n\r\nNow, say we want to solve the system $Ax=b$. If we choose $x$ in our Krylov space, we solve for $\\beta$ in\r\n$$\r\nAV\\beta = b\r\n$$\r\nHowever, this is probably overdetermined. Hence, we solve the normal equations, so that\r\n$$\r\nV^TAV\\beta = V^Tb\r\n$$\r\nFrom above, we know that $V^TAV=I$, so we really have that\r\n$$\r\n\\beta = V^Tb\r\n$$\r\nor that\r\n$$\r\nx = VV^Tb.\r\n$$\r\nNote, this holds regardless of the preconditioner $B$. In fact, we could take random vectors and $A$-orthogonalize them against each other and the same would hold. Really, the only thing that $B$ affects is the <PERSON> space. As long as $B$ helps cluster the eigenvalues of $A$, the algorithm performs well. Though, if $B$ is nonsymmetric, we may have to look at something like the pseudospectra to figure that out. I&#39;m not entirely sure. Mostly, cluster the spectra.\r\n\r\nDo we lose anything with a nonsymmetric $B$? Probably. Normally, in CG, we have properties like $\\langle Br_i,r_j\\rangle = 0$ for all $i\\neq j$. I&#39;m pretty sure that no longer holds. Also, we normally have $\\langle BAv_i,Av_j\\rangle=0$ for $|i-j|\\geq 2$. That may or may not hold. Really, any result that has $B$ I&#39;d be suspicious of.\r\n\r\nAnyway, I&#39;m pretty sure it&#39;s possible to code CG in a way that&#39;d break everything with a nonsymmetric $B$. However, if we code it using the equations above, there&#39;s nothing that really prohibits it from working with a nonsymmetric $B$. I do it all the time and it seems to work fine.", "344" ], [ "Two possible workarounds. \r\n\r\n 1. On the object create a formula field or two that adds them together. You still might not be able to reference the other formulas and get it all on one field. But then you could add them up in the flow much more easily.\r\n 2. In the flow use an assignment element. Set a variable called varTotal and then each row of the assignment can add one of your values to the total. You might need to use multiple assignment elements depending on how many rows are allowed.", "654" ], [ "*(my experience is in Computer Science, but I assume the following to hold true at least for the sciences in general)*\r\n\r\n > Which questions are commonly asked in an interview for a faculty position (W2/W3 professor) in Germany (German \" ;Berufungsverfahren \" ;)\r\n\r\nYour milage my vary, but classics are the following:\r\n\r\n - Questions that target how your research will fit into the current research strategy. Who can you collaborate with? What strengths of the program will you foster, which holes will you fill? Your goal here is to convince the committee that you are both, related to existing professors enough that you won&#39;t be the odd (wo)man out, and different enough not to be redundant.\r\n - Questions that target your teaching, most importantly which courses you could take over, which new courses you would introduce, and how these would enrich the current specializations and programmes. It&#39;s possible that they already have a concrete (set of) courses that they need you to teach, and then they may outright ask you if you would do that, and if so how.\r\n - Questions that target your funding acquisition plans. Which grants would you apply for initially? How much funding do you expect to be able to acquire? Are there any funds that you would bring with you? What group size would you expect to be able to maintain?\r\n - Questions regarding your package. You won&#39;t need to say a concrete salary figure at this point, but the committee will likely ask how many research staff you will ask for, and whether you have any particularly expensive other needs (e.g., a compute cluster, other equipment). Note that W3 professorships in Germany tend to be **large**, asking for at least 3+ staff as package to start negotiations with should be seen as normal.\r\n - Questions regarding your intentions w.r.t. this position. Would you be moving fulltime? Can you see yourself living in this place for the foreseeable future? Why is this position even attractive to you? The main point here is to figure out whether you just want to negotiate with your home (or some other) institution, which is incredibly common in Germany ( \" ;Rufabwehrverfahren \" ;).\r\n\r\nIt&#39;s also possible that you get some \" ;content \" ; questions regarding your research, but I think it&#39;s rather rare. Most importantly, note that the interview is not an exam - typically nobody will assume that you don&#39;t know how to do your research, but they will want to know whether you and your research are the best fit for their needs. This includes doing a fair bit of background preparation to figure out what their needs actually are. In a way, during a \" ;Berufungsverfahren \" ; you are pitching your detailed area of research as much as your person.\r\n\r\n > Who is usually in the panel (dean, student respresentative)\r\n\r\nThis varies, but both the dean and a student representative are at least likely members. Note that \" ;being present \" ; is not the same as \" ;having impact on the decision \" ;. In my experience, the number of people who actually make the decision is usually 2 or 3.", "906" ], [ "To give a counterpoint to astronat&#39;s view, in **Computer Science** funding usually, but not always, comes (in one way or another) from a budget of the prospective advisor (e.g., her/his grants, startup package, etc.). So if (s)he really wants to work with you and funding is available (not all professors have funding to start with), you will likely be offered funding. This is often formally independent of admission into the PhD school (i.e., a professor promising you funding does not formally guarantee admission), but in all places I am aware of the *de facto* rule is that candidates that professors wish to spend money on are also admitted as long as they fulfill the formal admission requirements.\r\n\r\nNote that in many places in Europe the inverse is also true - candidates that no professor agrees to fund are often *not* admitted, independent of CV and letters.\r\n\r\nSo to answer your specific question:\r\n\r\n > I was wondering how much influence a professor at a competitive university in the UK has in PhD admissions, when he/she really wants to work with somebody.\r\n\r\nAssuming it&#39;s computer science, I would assume that the professor has a **very large** influence on admission.", "906" ], [ "If this is in the context of **double-blind reviewing**, the correct response to this situation is to alert the handling editor or PC chair to this situation. Different venues are differently strict about double blind reviews, so the response to the situation may vary between \" ;well, we don&#39;t care if the authors *wants* to reveal himself \" ; to a reject and resubmit (without the incriminating statement and a new set of reviewers). However, which of those it is is not your decision as a reviewer.\r\n\r\nIf this is **not** in the context of double-blind reviewing, you are aware of the identity of the authors anyway, and this statement gives you no additional information.\r\n\r\nIf you are just **reading** the paper (and not reviewing), as implied by the wording of your question, then I don&#39;t understand the issue. Published papers generally have publicly visible authors, and it is not clear that the incriminating wording was already visible during review. For instance, in many software engineering venues that nowadays use double-blind reviewing, it is customary to \" ;blank \" ; self-citations and to slightly change the phrasing for the review version to make sure that identities are not, or at least not obviously, revealed. This can then be changed back for the camera-ready version.", "827" ], [ "Dogmatically speaking, your co-authors clearly acted unethically. You claim to have made clear that you oppose including this data, and they did anyway. Independently of whether it is ok to add more data at the proof stage, all co-authors need to sign off on a paper or changes that are being made, and you did not.\r\n\r\nThat being said, there is always a pragmatic angle to these arguments. As much as we would like otherwise, miscommunications and differences of opinion happen in collaborations, so there will often be aspects that one or more of the co-authors are not fully on board with (and papers get published anyway). As such, you need to decide for yourself **how important this issue is to you**:\r\n\r\n - Is this issue important enough to you to go into a, potentially lengthy, argument with your co-authors and the journal editor (who may not be thrilled to be sucked into what is effectively an internal quarrel between you and your collaborators)?\r\n - Is this issue important enough to permanently sour the relationship with your co-authors?\r\n - Is this issue important enough to just not have the paper published?\r\n\r\nOnly you know the answer to this questions, but if the root of the problem really is that your co-authors wish to include data that \" ;does not contribute to the story of the paper \" ; then the answer may easily be * \" ;no \" ;* if you think about it calmly.", "827" ], [ "One solution that isn&#39;t really advised. If your flow has screen elements, then most of the flow limits will reset when it reaches that screen. What this means is you can loop through a collection and use an assignment element to just count the number of records that have been looped through. Then have a decision element at the end of the loop that looks for count=50. Only then have it redirect to a screen where you just have to click next. And make sure to reset the counter back to 0.\r\n\r\nIf you have 1000 records in your collection and you can do 50 or 100 at a time that is great. If your flow is too complex and you can only do 2 at a time, then that&#39;s less great. You can run it from a button or directly from the flow screen. But you can&#39;t have process builder run a flow with screens.", "246" ], [ "Another option that requires flow, process builder, and data loader. This is best for big one time updates, not a routine process. \r\n\r\nMake a flow that works on an individual contact. Make a checkbox field on contact called \" ;Run Flow \" ;. Make a process builder that launches the flow if \" ;Run Flow \" ; = true (make sure the process or the flow sets \" ;Run Flow \" ; to false). Using data loader you can upload in batches in the settings. Then you can import a list as large as you want and they will be updated in batches.", "510" ], [ "**No, realistically a list of external projects will *not* make up for not having letters.**\r\n\r\nLetters are typically not, or not primarily, used as a description of projects you have done, but as a subjective evaluation of your potential as a < strike > PhD < /strike > graduate student. Letters *may* include a discussion of undergraduate research, but will also include a discussion of your personality, especially your strengths and weaknesses as a researcher. It is evident that this cannot be learned from a description of projects alone, especially given that this list is curated by yourself.\r\n\r\nIncidentally, this is also the reason why senior professors are considered the \" ;best \" ; references - admission committees assume that the best judge of prospective grad students are those you have seen many grad students succeed and fail, i.e., senior professors.\r\n\r\n**Edit:** as <PERSON> correctly notes, the question is about master rather than PhD applications, but at least for a master by research, this does not change the spirit of my answer. For masters by coursework, I think most universities don&#39;t really employ a competitive selection procedure anyway (at least the ones I know don&#39;t).", "906" ], [ "Yes this can be done with flows. You need a flow and a button. The button will launch the flow and it can also send in variables just like you do with the URL hacking. The flow would start with a lot of variables being sent in, then probably contain a screen to get any additional values and then a record create element. \r\n\r\nSo overall, it&#39;s still big and clunky, but it&#39;s now in a supported feature.", "68" ], [ "That&#39;s an interesting guideline. I wonder how many actual survey studies really follow all of that. Based on my experience in Software Engineering, I would wager less than 50%. Specifically the OP&#39;s approach of mining GitHub repos of addresses of potential invitees is not at all uncommon, although I agree that this practice already leans very strongly towards \" ;spam \" ;.", "76" ], [ "<PERSON> If this was meant in response to my comment - I agree that it can be considered spam, and it most definitely is \" ;unsolicited email \" ;. However, the OP is not using Github to \" ;upload, host, or transmit \" ; this mailing, but rather just extracts a list of recipients. From a legal point of view, this matters. As I said, when it comes to ToS and such things, technicalities are important.", "503" ], [ "In principle, everything that has a *research contribution* can become a publication. Especially in computer science, a research contribution is very roughly defined as knowledge that is useful independently of the concrete implementation technology.\r\n\r\nThat means that * \" ;look at my nice draft for an UI / syntax \" ;* isn&#39;t a research contribution, but showing (e.g., through a user study) that a given design is better than the currently prevalent design in one or more dimensions is. Of course this means that you will need to do more than just propose the new design: firstly you need to be quite intimately aware what the current state of the art is (and the reasoning behind the current design), and secondly you will need to conduct a useful study.\r\n\r\nAs a sidenote, as soon as you are asking yourself ...\r\n\r\n > Which way of doing research can make those works look more academics?\r\n\r\n.. you are almost certainly doing it wrong. You should not conduct some work and afterwards think about how to make it \" ;seem more academic \" ;. You should think from the beginning what the research question of your work is, and if you can&#39;t find any, question whether you *should* be conducting this work in the first place. Any attempt to make work \" ;seem academic \" ; after the fact is typically hard to publish, as reviewers are, at least usually, not stupid and able to look beyond simple deceptions.", "827" ], [ "I found the answer. The contact I was testing with has the same email as my salesforce login. \r\n\r\nI don&#39;t remember where I found it, but if the email address that would be entered into the \" ;To \" ; field is an address that you can email FROM, then SF puts the email address in the BCC field, rather than the To field.\r\n\r\nSolution: Test with different email addresses, not associated with your salesforce login.", "190" ], [ "I am extremely confused by this question, but here goes.\r\n\r\n > Is this a good place for beginners\r\n\r\nYes, definitely. I would say most of our questions are asked by relatively junior academics (assuming that this is what you mean with \" ;beginners \" ; - if you mean beginner in another sense, you should clarify).\r\n\r\n > to seek information as they learn\r\n\r\nIsn&#39;t that what most questions are about? Of course, as per Stack Exchange standard rules, you will need to do some basic research on the topic yourself first, the question needs to be generalizable to others, it needs to be in scope topic-wise, and it cannot be a duplicate of an existing question.\r\n\r\n > or is that type of discussion completely (or mostly) discouraged?\r\n\r\n*All* \" ;discussions \" ; are discouraged here. This isn&#39;t a forum. It is not supposed to be a back-and-forth between the OP and the community.", "862" ], [ "Why do you think that cheating, or more generally any breach of academic integrity, has to be of direct and immediate detriment to *each* involved person? The basic idea, to my understanding, of academic integrity is that by violating it, the *system as a whole suffers*, which is clearly not the same as *there are direct negative consequences for each involved individual*.\r\n\r\nIn your example, cheating on a test* can easily be very positive for the individual that is cheating (assuming (s)he is not caught, and also ignoring that (s)he probably did not learn what (s)he was supposed to learn, which may lead to trouble down the road). Of course, for the academic system in total, cheating students are pretty bad, as they severely undermine the value of examinations. \r\n\r\nSimilar arguments can also be made for other cases of academic honesty - as a young researcher, it *may* be quite positive for me to build a great career on manipulated data and forged experiments, but for science as a whole this would clearly be terrible.\r\n\r\nThis of course leads to the question what incentives rational individuals have to not act against academic honesty. Those fall into two basic categories: fear of repercussion and ethics. Both categories are easy to understand. Clearly, it *may* work out great for me to cheat on tests and forge my data, but it *may also* easily be discovered and backfire on me - and if it happens, the consequences are typically dire enough that overall it is not worth the risk for most. Further, as academics we are nurtured in the thought that academic honesty is the foundation of science. Hence, many (most?) academics would not want to violate academic honesty for personal advantage even if they knew for sure that they would not get caught. It is simply our understanding that the entire system is based on academic honesty. \r\n\r\n-------------------\r\n\r\n*By the way, your scenario would not *ubiquitously* be considered cheating. For instance, in my old alma mater in central Europe, sharing test questions with the next year of students is completely normal and a widely accepted practice among faculty and students. Goes to show that what is considered ethical also differs among regions and institutions.", "197" ], [ "I am having trouble understanding all of the different parts of a service console. I&#39;ve followed the guides online and still have questions. At this stage I&#39;ve tried to turn everything off, in the app, in the case feed view, case Custom Console Components, and case Layout Properties. None of the changes I make seem to ever take effect whenever I reload. Even if I sign out and sign back in. \r\n\r\nOne change will show, if I change the fields visible in the case header. None of the other changes, like the header itself, or any of the panes will change.\r\n\r\nAm I totally missing something basic?", "858" ], [ "I agree with @traindriver. A simple immediate solution is to have more TAs watch the students more carefully. I cannot imagine that it is infeasible to watch 70 students (a laughably small crowd, all things considered) in a way that it is not practically possible that they use their cellphones during exams, at least not to the extend that it actually impacts exam results. However, it certainly needs more than one person per room - the minimum is usually 3 (1 for the front, 1 for the back, one that answers questions etc.).", "197" ], [ "That&#39;s all great information. I should also say that for an ACM fellowship, being \" ;brilliant \" ; and kind is by itself not enough. One also needs to be (very) accomplished in one&#39;s field of research, and the proposers / endorsers themselves also need to be rather high-profile. It&#39;s not really appropriate as a sort of \" ;thank you note \" ; to a good mentor, as the OP seems to envision.", "605" ], [ "I am trying to write an answer here, but I am sort of failing, so just a quick comment - to me, the entire situation sounds a bit awkward the more I think about it. If the student did something that could be published, why would (s)he *not* be on the final paper? If (s)he did something that is insignificant outside the project (e.g., some random programming), how would (s)he publish it? I understand that it is not always clear to a student which of those cases he falls in, but can one not tell / show them?", "827" ], [ "* \" ;It can be difficult to convince people, that the work they did belongs to someone else \" ;* - yes, it&#39;s hard to explain because it inherently feels unfair and exploitative, especially if the person was not paid. I think the OP needs to move away from the \" ;all your work belongs to us \" ; mentality, and start considering a research project like an open source project: many people contribute and their individual contributions will always remain theirs, but not everybody does so regularly and impactful enough to be a maintainer (or co-author).", "622" ], [ "<PERSON> Well, I typically assume I can trust our teaching staff to do their basic duties. I still maintain that if you can&#39;t prevent a group of 70 students to commit relatively easy-to-spot cheats (texting in-exam, reading from smartphones), you have a problem to which the answer is not \" ;sophisticated technology \" ;. The answer may be \" ;get sufficient TAs \" ;, or \" ;get TAs that actually do their job \" ;, but I am sure it is not \" ;electronic sniffers \" ; or \" ;metal detectors \" ;.", "197" ], [ "For a respectable journal (which I would assume an Elsevier journal to be), this behavior seems so weird and unacceptable that I am tempted to assume that you are only telling us parts of the story here.\r\n\r\nSpecifically, the part about \" ;but they gave no real explanation for what happened \" ; is curious - what *was* the reason they gave? This will very much influence the advise you get here.\r\n\r\nIf, for instance, they said that the previous accept mailing was sent out in error and the new reject notification is correct based on review results, well ... then it would definitely suck for you, but I see no way to fight this decision. You are then basically in the crowded boat of people that feel like their journal paper was rejected even though the reviews were not that bad. That you received an accept notification first does not fundamentally change this. I also do not share the hope of <PERSON> that you could potentially sue for compensation - as far as I know, journals typically reserve the right to cancel publishing a manuscript at any point in the process, so legally they should be fine to change their mind even at a very unusually late point.\r\n\r\nIf they said that they have in the meantime learned that parts of your paper are already under copyright elsewhere, then you can either clear up the misunderstanding (if it is one) or alternatively propose to revise the paper.\r\n\r\nIf they *really* give *literally* no useful explanation (don&#39;t answer your mail, or answer with no actual information), then I would fall back to the answer of Wrzlprmft and contact Elsevier.", "827" ], [ "In addition to Massimo&#39;s excellent answer:\r\n\r\n**How often a journal appears has *nothing* to do with how long the review process will take. Those are completely disconnected things.**\r\n\r\nGenerally speaking, TSE is an *excellent* journal. 9 months of review time is even on the low side. I think 1 to 2 years is more common. 2 months is completely out of the question. Furthermore, the fact that you assume it *could* be done in 2 months leads me to believe that your chances of getting accepted at TSE without a much more experienced co-author are very slim.", "827" ], [ "I think this answer is written with a bit of a Swedish hat on and does not necessarily apply in full to the OP&#39;s situation - for instance, in principle, working for free is as far as I know quite possible in the US. Similarly, not having insurance is per se not illegal afaik. That being said, the general tone is entirely correct - the OP is being ripped off, so the OP should fight back, hard.", "174" ], [ "I think you are looking at this from the wrong side. Funding agencies typically won&#39;t care so much *what kind* of costs your project accrues, but rather how large those costs are in the end. That is, if there are two scientifically comparable projects, but one is much more expensive than the other, this will make the cheaper project more attractive to fund than the expensive one. Whether this cost discrepancy is due to higher personnel costs, or due to other factors, won&#39;t be central to the decision.\r\n\r\nHowever, multiple factors make your question whether you want to ask for equipment and travel less important than what you might think:\r\n\r\n - At the end of the day, the costs of equipment and travel are typically very small in comparison to personnel costs, so this is unlikely to make a big difference for most grant types.\r\n - The case that two projects are so similar in terms of scientific merit that relatively modest equipment and travel costs have an actual impact *and* the agency cannot fund both projects is not very common.\r\n - Many agencies (at least here in Europe) reserve the right to cut down on your budget if they think it is over the top. That is, if your project would be ok without equipment and travel, they *may* end up just funding the project but not granting the equipment and travel money. This is particularly common if your proposal does not make it clear enough how this money is essential to the execution of the project. At the end of the day, everything that kind of seems like a \" ;nice to have \" ; cost is very likely to not be granted.\r\n\r\n**Summary**: worry about your proposal. Don&#39;t worry about equipment and travel costs.", "0" ], [ "As usual, rules on this sort of thing will vary from country to country and from grant agency to agency.\r\n\r\nHowever, all three options that you mention sound plausible to me. To go over them:\r\n\r\n > Decline the grant (...)\r\n\r\nSure. Nobody can fault you for declining a grant that pays so much below standard salaries. Honestly, unless I had *no* other options, this is likely what I would do. I am not sure I would call it \" ;wasteful \" ; to decline a grant that, honestly, sounds like a terrible option to begin with.\r\n\r\n > Convince the department to co-finance (...)\r\n\r\nThis is indeed not unheard of. Of course, whether you will be able to convince the department to do so largely depends on how much they want you to be there, what their regulations are, and if they have money to spare. I have seen this sort of co-financing mostly in cases where the department and the applicant were already in longer contact, and the public grant was mostly acquired as a way to make a move that was happening anyway cheaper for the department (that is, it was planned that the candidate joins them anyway, but now a part is paid via an external grant). If the department had no intentions to hire you without the grant it becomes substantially less likely that they will be willing or able to chip in.\r\n\r\n > (...) obtain another grant (...)\r\n\r\nThis sounds like another plausible option, but check the regulations of both grant agencies. In many cases, full-time personal grants are exclusive - that is, you can have only one at a time, even if the stipend is very low. However, it may still be an option to apply not for a second personal grant, but for a regular research project that allows you to pay a salary supplement for yourself. Whether this is possible again depends on the grant agency. For instance, the SNF in Switzerland as a rule never allows to pay any money to yourself as part of a regular research project. The FWF in Austria, on the other hand, is perfectly fine with this as long as the rules of the host institution (regarding, for instance, maximum employment), are followed. That being said, with this option you should probably expect to live off the 60% stipend for a while, as the application procedure for grants tends to take a while.", "605" ], [ "*Disclosure: we actually bought pretty expensive Bose Noise Cancelling headphones for our students recently, for the reasons you mentioned.*\r\n\r\nI think there is a very easy answer to this - will your funds cover the expenses if the purpose is reported truthfully, or will some \" ;creative \" ; cost reporting be required?\r\n\r\nIn the **first case**, I have a hard time seeing an ethical issue - as you say, equipment is equipment, and if whoever funds your research is ok with spending some of it on \" ;potentially productivity-increasing even if ultimately not absolutely necessary \" ; equipment, then why should you be ethically required to not make use of this option? The only case I would see where this would become an issue if you, for instance, would not actually be planning to be using the headphones much at all in the office, and are mainly looking to use them for a private purpose (but then again, if you wrote this in your expense report, whoever funds your research would probably *not* be ok with this expense anyway, making this more similar to the second case).\r\n\r\nIn the **second case**, it is pretty clearly not ethical to hack around whatever the criteria given out by your funding agency (e.g., pretending like you will need noise cancelling for a specific experiment so that it counts as costs for conducting a specific experiment rather than equipment costs, etc.).", "605" ], [ "Despite being the accepted answer, I actually feel this does not answer the question that has been asked. The question was * \" ;should I as an individual PI consider it ethical to buy X \" ;*, while you focus very strongly on * \" ;should a funding agency fund X \" ;*. Those are to me very different questions. If I am your one PI who \" ;with motivation pure as snow \" ; can say that he would buy X for research purposes only (and the agency has allowed the purchase), then why does the fact that my motivation is not true for other people make *my* purchase unethical?", "932" ], [ "My impression is that how strictly the policy of \" ;paper needs to be presented in-person by an author \" ; is interpreted really depends on the quality of the conference. Third-grade IEEE conferences often accept no presentation at all (as long as the registration is being paid), second-grade conferences often require some sort of presentation, but make due with some \" ;hacks \" ; (let a friend present the paper, play a recorded presentation, allow a Skype presentation). All of those are marginally better than no presentation at all, but they actually go against the spirit of having a conference in the first place (as a conference is mainly meant as a meeting and discussion place for like-minded researchers). Hence, top conferences (which are in no shortage of good submissions) usually do not allow for any compromises and just retract papers where none of the authors can show up.\r\n\r\nHence, I would not say that it is uncommon for a strong conference to be relatively inflexible about this rule, and it is probably not extremely likely that you will be able to make them re-consider. Of course, there is no danger in asking, but be prepared that the answer may simply be \" ;no \" ;. The organisers understand that this policy will lead to individual hardships, but they have to be primarily concerned about the quality of the conference - and, as everybody who has ever seen a presentation by a non-author can confirm, being lenient about this is often really detrimental to the scientific quality of the programme.", "827" ], [ "I am making some stochastic training ensemble classes in Python, and I want to get hyperparameters values. Grid search will take too long for moderate data sets, because in my stochastic training I train different learners on different dropouts, as in cross-validation, then I average or weight-average on best error for dropout. Having this set, I want to get best parameter values at every iteration, so I thought to use a genetic algorithm approach. \r\n\r\nI found one example on Github, but failed to install, and I am looking for more references of genetic algorithms for doing this. Can anyone help me?", "13" ], [ "I&#39;m currently working on Humanoid robot. I&#39;ve solved the Forward & Inverse Kinematic relations of the robot, and they turn out to be fine. Now I want to move onto Walking. I&#39;ve seen tons of algorithms & research papers but none of them make the idea clear. I understand the concept of ZMP & what the method tries to do, but I simply can&#39;t get my head around all the details that are required to implement it in a real robot. Do I have to plan my gait & generate the trajectories beforehand, solve the joint angles, store them somewhere & feed it to the motors in real-time? or Do I generate everything at run-time(a bad Idea IMO)? Is there a step-by-step procedure that I can follow to get the job done? or Do I have to crawl all my way through those Research papers, which never make sense(at least for me).", "238" ], [ "I am having trouble with problem set 1 and could use some help please!\r\n\r\nSpecifically, I am having problems generating the blocks in a pyramid. I have watched the walk through but am having trouble translating my ideas to code. \r\n\r\nI understand that I need to print x number of spaces based on the user input but cannot figure out how to get x spaces to print. Can someone please help!\r\n\r\nIs it ok that I paste my code in here?\r\n**Edit:** \r\nhere is my code thus far thanks for your help!!\r\n\r\n #include < stdio.h > \r\n #include < cs50.h > \r\n #include < string.h > \r\n\r\n int main (void)\r\n \r\n {\r\n \r\n //asks user for the number of blocks\r\n printf( \" ;Please specify the number of blocks to be printed\\n \" ;);\r\n \r\n \r\n //declares a variable t to store the users input (number of blocks)\r\n int t;\r\n \r\n \r\n //retrieve block number from user\r\n do\r\n {\r\n t = GetInt();\r\n }\r\n while (t > 23 & & t < 0)\r\n \r\n \r\n \r\n //confirms to the user that the input has been accepted\r\n \r\n if (t < 23 & & t > 0)\r\n {\r\n printf( \" ;Thank you %i blocks with be generated, t \" ;); //error message here \" ;error: more &#39;%&#39; conversions than data arguments \" ; need help with this please \r\n printf( \" ;\\n \" ;);\r\n }\r\n \r\n //pyramid generation (my hashes always come out in a straight line one space apart)\r\n for (int i = 0; i < t, i++)\r\n {\r\n printf( \" ;%c, t \" ;); //(How do I represent x number of spaces that corresponds to the t variable that is based on user input??\r\n printf( \" ;# \" ;);\r\n printf( \" ;\\n \" ;);\r\n }\r\n \r\n }\r\n\r\nOther issues:\r\nany input is accepted even if it is above 23 or below 0 I am not sure what is wrong with my do while loop at the beginning\r\n\r\n\r\nI know there is a lot here but if someone could spare a few minutes to help me out it would be greatly appreciated and I will be happy to do the same once I know what I am doing!\r\n\r\nThank you so much!\r\n\r\n<PERSON>", "941" ], [ "**For postdocs @ ETH:**\r\n\r\nIf this is not said specifically in the job text, you can safely assume that *no* knowledge of German will be required, although it may or may not count as a plus depending on the PI. There will almost certainly be no statement in your contract that you will need to learn German within a time frame, as postdocs are not \" ;career \" ; positions in the first place (and neither are they particularly teaching oriented, which is the only place where ETH potentially cares about you speaking German).\r\n\r\n**For professors @ ETH:**\r\n\r\nUnlike most other European universities, ETH is actually fairly international. I would be surprised if all of the faculty from around the world teaching there speaks German, although many that I know do (as you say, learning the local language is generally helpful if you stay in a foreign country for a longer period of time). German language skills will almost certainly not be required at time of appointment, but it *may* become part of your contract that you are obliged to be able to teach in German within a given number of years. This requirement may be negotiable, with the main concern from ETH&#39;s side being that this would limit what courses you will be able to teach. However, honestly, I would not worry about this too much at this stage.\r\n\r\n**For other European universities:**\r\n\r\nAs usual, customs vary a lot across other European universities. For instance, I have seen announcements for German universities where *PhD students* were required to be able to speak German. That being said, the rules from above are good guesses in the absence of contradicting further information - don&#39;t worry about it for postdocs (unless the announcement specifically says that you need to speak the local language), and don&#39;t worry too much for faculty positions, but be prepared that you *may* be obliged to learn the local language.", "906" ], [ "Reporting for \" ;you&#39;ll likely not revolutionize physics \" ; will probably get you either a blank stare or hysterical laughter from whoever you report to. Reporting that the figure of speech \" ;one in a million men \" ; is sexist has a higher chance of being taken seriously, but frankly do you really believe that what the prof. wanted to say is that \" ;for the men there is a tiny chance, for you girls the chance is 0 \" ; - as opposed to \" ;for all of you the chance is tiny \" ;?", "686" ], [ "There certainly is no \" ;correct \" ; answer to this question, as it depends on two factors: (1) the company (some will see it as useful, most probably won&#39;t), and (2) the type of postdoc (with or without management tasks? project lead? PI on a small project? independent or highly dependent of a professor?).\r\n\r\nHowever, at least here in Switzerland and for Computer Science, the rule of thumb is that as soon as you are 100% that you won&#39;t stay in academia, every further month spent as a postdoc is inefficient in terms of career development. Yes, some companies *may* count your years as postdoc as some sort of relevant leadership experience, but most won&#39;t, and even those that do will consider a similar candidate with the same number of years working in industry to be much more attractive.\r\n\r\nThere is also another angle to look at this - you are currently looking to move into industry, and you have differing opinions from people that are *already working in industry* and people that *are not*. In absence of any other information, you should probably give more weight to the information provided by the insiders.", "906" ], [ "At my institution the default way to handle this is *(3 Stick with the 0 for this question)*. Essentially, every student is required to handle the teaching language well enough to be able to work on the test. In practice, many teachers will fall back to *(2 Give them some consolation points)* if giving 0 points seems too harsh. If *(1 Give them another stab at it with more language context)* is an actual option, that seems like a senseful way, too (e.g., in a short verbal exam). However, in practice this is often not possible in my courses, either because it would be very impractical or because the course regulations do not allow it.\r\n\r\nBoth, *(4 Grade the question they answered and not the question asked)* and *(5 Give him / her the lowest grade anyone else got for this question)*, seem like relatively weird ways to handle this situation. With (5), you are essentially decoupling the grades for the student from what (s)he has actually written on the test. (4) breaks a fundamental exam concept, i.e., that the instructor chooses the question that the student should be answering, and not vice versa.\r\n\r\nAs for this:\r\n\r\n > The student is on an important grade boundary and it could make a difference to their final grade even a difference to if they have to take the class again / can graduate on time / or even stay in the major.\r\n\r\nAs bad as you may feel if \" ;your \" ; grade is the tip of the iceberg that leads to bad consequences for the student, you should be aware that it is the sum of bad performances that has gotten the student into troubles. Your grade is just the last in a series, and your grade is as much \" ;at fault \" ; as any other bad grade the student received. Hence, I feel you are not required to take the larger picture into account.", "197" ], [ "> Pseudocode, in a paper, is figure or table?\r\n\r\nStrictly speaking, both \" ;Figure \" ; and \" ;Table \" ; are wrong, given that code is neither. However, there is sort of a tradition of using \" ;Figure \" ; for program code (see for instance [here][1] or [here][2] for examples from the programming languages community in computer science, which unsurprisingly needs to deal with code often). Alternatively, especially short one- or two-line listings are often just inserted without label.\r\n\r\nYour supervisor is hence \" ;correct \" ; in the sense that it is at least not uncommon to use \" ;Figure \" ;, and nobody should fault you for it. Using \" ;Table \" ;, on the other hand, would indeed look strange to me. There is no tradition for using \" ;Table \" ; in this context, and, well, it&#39;s certainly not a table.\r\n\r\nAn alternative that most styles at least seem to tolerate is to use \" ;Listing \" ;. I see it rarely being used in other papers, but I have been using Listing for years without it ever being commented on.\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "546" ], [ "As a relatively newfangled academic editor of [PeerJ Computer Science][1], I can tell you that actually finding suitable reviewers is **substantially** more difficult than what I used to give it credit for. For many papers that I get on my virtual desk I am not actually an expert, so I need to invest some time to look over the literature of the area to figure out who actually *are* suitable reviewers. My current \" ;acceptance rate \" ; for reviews is substantially below 20%, and it would be even much lower if I did not have a reasonable personal network (that is to say, at least 75% of all reviewers that actually accept are people I know personally). Approximately 50% of those that do not accept never respond, so you can&#39;t really tell whether they accept or not until you waited a week or so. And - particularly annoyingly - it is not unheard of that people accept a review but then never get back to you.\r\n\r\nAll in all, I would say taking one month to find reviewers is long, but not outrageous.\r\n\r\nSmall nitpick:\r\n\r\n > I believe the effort required to review a manuscript is much greater than the effort to find a reviewer.\r\n\r\nWhile this is certainly true, an editor also typically handles many more manuscripts than a reviewer...\r\n\r\n [1]: _URL_0_", "827" ], [ "@BeniCherniavsky-Paskin I can&#39;t speak for PeerJ CS in total, but my manuscripts typically take substantially longer than 22-24 days to first decision. Not close to the 5 - 6 months of other journals, but definitely more around the 1.5 - 2 months range. The one time I asked a reviewer for a review in two weeks (the default in the PeerJ system), the answer was a short * \" ;surely you are kidding? \" ;*.", "827" ], [ "I agree with <PERSON> that this question would be *much* easier and better to answer if you gave more evidence about why you think 37% \" ;utilization \" ; is too low. 37% is just a number - it can be great, terrible, or just usual utilization. Equipment usage depends on many things including (a) whether the machines you have are sufficient for the planned research, (b) how allocation policies etc. currently work, (c) whether the equipment is general-purpose or extremely specific, (d) to what extend your institution is even allowed to use hardware bought with a specific grant in other contexts, etc.", "76" ], [ "In addition to the excellent answers given already, you should also consider that even those professors that do answer emails during the holidays will usually do so based on perceived priority - and I doubt that your cold-call \" ;professional opportunity \" ; email is important enough to many professors to answer between visits to relatives and stuffing them with whatever their traditional holiday food is.\r\n\r\nYou should try resending again when the holiday period is over.", "605" ], [ "I am with ff524 on this one. To me, one useful rule of thumb for \" ;too localized \" ; is if we could easily end up with an array of near-identical questions that differ only in the subject. This could happen if we encouraged questions about individual journals (* \" ;Is journal A legit? \" ;*, * \" ;What about journal B? \" ;* etc.), and the same is also true for individual honour societies. This is no real danger for the likes of Google Scholar or ACM. There simply are not all that many of these systems or organisations out there. This is, I think, also what <PERSON> meant with his \" ;Holy Grail or some other famous cup \" ; statement.\r\n\r\nI do agree that not all of the questions that you cite above are great questions - I would have no issue with some of them being closed. However, SE is not case law - just because you found one or more comparable examples that kind of slipped through (and not all that you mention qualify, in my opinion) does not mean that your question also becomes fine. I agree with closing your question.", "76" ], [ "*I think a lot of confusion in the question comments stems from <PERSON> and <PERSON> both being called \" ;faculty \" ; employed at universities while still looking for PhD positions. I am interpreting the situation as follows - if this is fundamentally incorrect tell me, and I will update or delete:*\r\n\r\n**Both <PERSON> and <PERSON> currently hold a bachelor or master&#39;s degree only. Yet they are employed in some capacity by presumably lower-ranked universities. Their job title may be something like assistant professor and they are considered faculty with job security, but the job is essentially a permanent teaching / research assistant position. They currently are not PhD students or on any sort of track to a \" ;better \" ; position, so they are considering applying to a PhD programme in a different, presumably better university, likely in a country that it not familiar with their current situation.**\r\n \r\n*(this understanding is based on a few incoming students from East Asia that were in similar situations before coming to our university - it used to confuse the heck out of us when they said that they were permanent faculty back home, but the key to understanding the situation is that in some weaker universities in Asia one can essentially be a permanent research or teaching assistant, which are officially called something like \" ;pre-PhD professors \" ;)*\r\n\r\nWith this understanding, I think @user2898391&#39;s answer is out of scope - it focuses on academics applying to *faculty* positions, not people that are currently on a faculty position of sorts which are now applying for PhD student positions.\r\n\r\n----------\r\n\r\nAfter this lengthy introduction, my answer is to a large degree similar to the answer by <PERSON>.\r\n\r\n > What can <PERSON> do to prove that she can be a way more better researcher given time and opportunity?\r\n\r\nAt the end of the day, **<PERSON> does not yet know that she will \" ;be a way better researcher \" ; than <PERSON>**. The fact that she gets great feedback on her teaching shows that she is good at teaching. It does not mean that she will certainly be a great researcher. As you say yourself, <PERSON> is indeed one step farther \" ;away \" ; from a great research position than <PERSON> simply by the fact that <PERSON> already is on a research position (and, presumably, is currently learning the trade and improving, even if the position may not be optimal) while <PERSON> in her current position is not.\r\n\r\n > Is there any \" ;<PERSON> \" ; who is ready to give that chance?\r\n\r\nI assume Alice&#39;s best bet is to apply to PhD student positions with a stronger teaching focus. For such a position, her current CV makes her a competitive candidate versus <PERSON>. At least in central Europe, such positions *do* exist. I know that because I had a position like that for the better part of my studies. Another example is the web page of a [former colleague of mine][1] who is doing a PhD financed via a lot of semi-independent teaching (note the job title \" ;University Assistant \" ; - this is what this is called in Austria). However, there are two further challenges: (1) for such PhD student positions, strong knowledge of the local language is often required for undergrad teaching, and (2) those positions are not numerous and they are often not widely announced. \r\n\r\n > If you are \" ;<PERSON> \" ; (a member of an admission committee), would you give that chance to <PERSON>? If you would, under what conditions?\r\n\r\nOnly if I have a position that requires a lot of teaching. To be blunt, I see very little reason to hire <PERSON> on a pure research position over <PERSON>.\r\n\r\n [1]: _URL_0_", "906" ], [ "There are so many ways we can use opportunity, I&#39;m trying to find out what is the best for our situation. We keep track of multiple contacts using multiple products. And they have to renew their use of each product every year. We have a focus more on the contact than on the account, but that doesn&#39;t even have to be the case.\r\n\r\nOption 1. Only one opportunity per account. Create an Opportunity Product for each contact (custom field) using each product each year they use it.\r\n\r\nOption 2. One Opportunity for each product. For each Opp create an Opportunity Product for each contact using that product each year.\r\n\r\nOption 3. One Opportunity each year (or time unit). Create an Opportunity product for each contact using any product. Repeat for each time unit.\r\n\r\nOption 4. One Opportunity for each Contact. Create an Opportunity Product for each\r\nproduct and each year.\r\n\r\nI&#39;m sure there are more options. Then I can do any sort of combination of the above. One opp for each product each year, then record the contact. One opp for each product for each contact, then record the year.\r\n\r\nWe need to track some relation between contacts, products, and time. What is the best way to do this? Or, more realistically since every org is different, some good advice to help with making this decision.", "442" ], [ "This is very useful, thank you. So your suggestion is to have the Opportunity linked to a particular contact for a particular time period, then use some sub object to say which specific products. 2 Questions. Would it make sense to create new Opportunity Products each year instead of new Opportunities? Is there any benefit to having one opportunity being linked to two contacts instead of just one?", "670" ], [ "> Do universities/departments ever a formal policy in place about the use of \" ;non-official \" ; email accounts?\r\n\r\nYes, at least in Europe most universities seem to at least frown upon using gmail etc. in professional contexts. Whether there is a formal policy against it will differ from place to place. I would not even be able to tell in my current university, as the thought has not really crossed my mind so far. However, our department head is occasionally reminding people informally that they are expected to be using their official mail addresses.\r\n\r\nThat being said, whether universities with a formal policy *exist* isn&#39;t overly important for you. You should primarily care whether *your* university has such a policy, and this we cannot answer for you.\r\n\r\n > Do people find it personally bothersome when colleagues don&#39;t use their university account for professional correspondence?\r\n\r\nYes, I personally find it somewhat unprofessional, although I have no particularly strong feelings on this. I do occasionally wonder why people who clearly *have* an official account of my university specifically choose to send emails to collaborators and students via an account like <EMAIL_ADDRESS>. It can&#39;t be that they prefer the gmail user experience, because, as you say yourself, it is very easy to use gmail also with non-gmail accounts.\r\n\r\nHowever, note that even *using* the gmail web client as a frontend for your regular university accounts may already be a breach of policy. At least here in Switzerland, universities are not happy about the mailings of their employees being uploaded to Google (but then again they certainly wouldn&#39;t use Windows Live either, so maybe your universities care less about data privacy than the ones over here).\r\n\r\n > Is there anything I absolutely should not send via a \" ;non-official \" ; account? (There&#39;s a good chance FERPA could be involved here...)\r\n\r\nI&#39;m not in the US, so I cannot comment on FERPA, but in my university basically everything that has to do with students, assignments, tests, or grades needs to be sent encrypted with the certificate that is bound to our university identity. This also automatically excludes sending it over a different mail address. Every \" ;official \" ; communication needs to at least be sent digitally signed using said certificate, which again excludes other mail accounts.", "465" ], [ "I have covered this very recently in the answer to a [related question][1].\r\n\r\nFirstly, there is is [_URL_0_][2]. It is a free service that should have you covered to a large extend. As a bonus, it is not *strictly* for offers in Germany, but also has some professorships in neighbouring countries (although coverage for those is rather spotty).\r\n\r\nThe most complete list is the newsletter sent out monthly by the [ \" ;deutschen Hochschulverband \" ;][3], which is the union of German university teachers. This list is pretty much complete for Germany, but it does not have any info on professorships anywhere else. You need to be a member to receive this newsletter, and one can only become a member by having been employed in an academic post at a German university before. If you currently work in Germany (e.g, as a PhD student or postdoc), you are either already a member or can easily become one.\r\n\r\n [1]: _URL_3_\r\n [2]: _URL_1_\r\n [3]: _URL_2_", "906" ], [ "I am not sure about EE, but for Computer Science, most of the venues you would usually want to track are listed in [DBLP][1]. DBLP itself does, as far as I know, not offer a subscription service, but (behold the beauty of open data) somebody else has built [RSS feeds for DBLP][2].\r\n\r\nThis would allow you to use your favorite newsreader to keep up with conference publications the same way you are already tracking journals.\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "307" ], [ "I really don&#39;t think there is a tried and true solution to this problem, but in the end it boils down to asking:\r\n\r\n - *Why does the student want to do a PhD?* \r\n\r\nMost students that apply with us don&#39;t have a very good sense of what a PhD is, so there really is no \" ;wrong \" ; answer here. However, I consider it a red flag if I get the impression that the student really arrived at the decision to do a PhD via exclusion (don&#39;t want to do or is scared of \" ;real \" ; work, need some money to pay rent). I also am very sceptical of students that do a PhD because they hope for better career opportunities afterwards - my experience is that those students too often end up putting in the minimal hours needed to get the degree.\r\n\r\n - *Is the student interested in staying in research, or do they know right from the start that they will go back to industry after finishing?* \r\n\r\nSimilar to before, students that foresee at least the possibility of staying in research tend to be more motivated to go beyond what they perceive as the minimum requirements for getting a PhD. What you don&#39;t want is a student that constantly talks about that one guy many years back that graduated with two weak conference papers, and asks why (s)he should be investing all this weekend work into A+ papers if that&#39;s apparently not strictly required to graduate.\r\n\r\n - *What do they expect from doing research?* \r\n\r\nAgain, most applicants have no very clear idea about research at this point, but the answer to this question can tell you something about what the student values in a job / career. This will allow you to judge how likely it is that they find what they want in your lab, and hence be motivated. For instance, I have found that \" ;I really like to travel to exotic places \" ; is a surprisingly good motivator for students to put in work for this paper to a conference in Hawaii. \" ;I like flexibility \" ; or \" ;I like to work on my own ideas and projects \" ; is also a good motivator for academia, up to a point. However, I tend to remind people that present-day academia, at least in science and engineering, is no ivory tower where people are completely protected from outside pressure and forces. What&#39;s not great is if the student apparently values job security or high salary, because both is typically not available in academia for a long time from the moment you start your PhD.\r\n\r\nA tricky but important point is also judging how well the student will \" ;fit in \" ; with the current team. It is important here to not end up discriminating based on nationality, age, gender, or marital status, but there is no arguing that being the \" ;odd person out \" ; in an otherwise tightly knitted team will not be great for the motivation of the student. Of course it is your task to manage your team in a way that they will integrate whoever you end up hiring, but at the end of the day you cannot force your team to like somebody and/or invite them to private outings etc.", "906" ], [ "As <PERSON> mentions, whether the postdoc legally *can* be assigned to a customer project really depends on the funding source. For instance, we have recently explicitly hired a postdoc to lead a transfer project (essentially a \" ;development project \" ; that will hopefully end in a real product). The funding we use allows and supports this so I see no issues at all. Of course, if we used money that was given to us for some other cause (e.g., to conduct some fundamental research) it would be a different story.\r\n\r\nHowever, I have the impression that the issue here is something else entirely. Notably, I suspect that the OP got hired under the pretense of a regular postdoc (i.e., on a position that is usually considered a stepping stone for a professorship) and is now pushed into what is essentially an industry development job due to her/his specific skills. Such situations are not uncommon in industry - people get reassigned to different roles based on changing company needs all the time. However, in academia, this (while maybe legal) is a rather shady move. Given how competitive academia is, there are strong career implications in working for a substantiated time in a specific role that does not progress the metrics that are typically required for the next career step (publications and acquired funding, typically).\r\n\r\n**As such, the OP should definitely discuss her/his career plan with whoever wants her/him to work on this customer project, and decide whether these career goals are consistent with the management goals of the lab. In the worst case, a move to a different lab may be a better option than working on a project that ends up a negative factor in the career progression.**\r\n\r\n > You know, a postdoc is usually paid less than industrial employees, it results in relatively lower costs of the system than software companies.\r\n\r\nI am not sure whether this is correct (I certainly make more than many entry-level professionals), but anyway it does not seem to be the important issue here.\r\n\r\n > At the same time, is it possible to publish?\r\n\r\nMaybe? This is impossible for us to tell from the outside. But anyway, the question should not be \" ;can I publish anything at all? \" ;, but rather \" ;how much *less* am I publishing, and how much weaker are my scientific contributions, because I work on this product rather than on my science? Essentially, what are the opportunity costs in terms of scientific productivity for working in a developer role?", "906" ], [ "> I&#39;m quite frustrated that people do not see (or don&#39;t want to see, or don&#39;t care) significant potential benefits of some new ways in doing research and/or scientific software development in academia.\r\n\r\nHave you considered that those benefits may simply not be there, at least not to the extent that you hoped for them? One PhD student building a scientific prototype for a conference is not the same as building a product, and many ideas, concepts, and processes that are great for building a collaborative product on Facebook scale may simply be dead weight or even counter-productive for a PhD student in his daily development work. Frankly speaking, if people actually tried your new way of doing things but then went back to \" ;the old way \" ;, this is at least some serious indication that there may actually be merit to the old way beyond pure inertia. People typically don&#39;t revert to an inferior way of working on purpose after trying something new and better. Have you actually talked to people why they went back?\r\n\r\nAnyway, if you wanted to sell your agile ideas to me, the core question to answer would be:\r\n\r\n**What are concrete, plausible scenarios how your ideas would help *me* personally?**\r\n\r\nStay away from lofty but abstract concepts such as code quality, reproducibility, code reuse, etc. Explain how each researcher individually can profit. What sort of embarrassing bugs and mistakes can be prevented? In what sense can each researcher individually save time? What new papers can be written that we could not easily write the old way?\r\n\r\nThis requires you to understand extremely well how your colleagues are currently working and what their current pain points are. If whatever way they currently build software is efficient and reasonably bug-free for them, I highly question you will be able to convince them to do e.g., TDD \" ;because that&#39;s what industry does \" ;. If they are usually able to reproduce their experiments well enough, you won&#39;t be able to convince them to set up Docker containers for everything in the future, just because Docker is the current hot shit.\r\n\r\nIf you actually have access to them, explain cases of * \" ;lost opportunity in research productivity and other aspects, when such innovative methods/tools are not used \" ;*. The important part here is that those cases are (a) real, or at least plausible based on the experience of your colleagues, and (b) damaging to me personally. For instance, it will be hard to convince PhD students to invest time setting up a code based / infrastructure purely for the sake o the next generation of students.\r\n\r\n*(and, of course, stay far away from ever implying that my scepticism for your ideas is because you see the bigger picture and I don&#39;t)*", "795" ], [ "Having a rather short CV when applying to grad school is not particularly uncommon. Moreover, I find the general academic trend to focus on the \" ;length \" ; of the CV somewhat misguided. Nobody cares whether your CV is 0.5, 1, or 5 pages *per se*. That is, padding your CV with unrelated chaff ( \" ;worked as barista at Starbucks from A to B \" ;, \" ;plays the flute and gitarre on XY level \" ;) is not getting your anywhere. What admission commitees etc. care about are mainly two things:\r\n\r\n - What relevant experiences do you have for grad school? What specific jobs, service work, special courses, papers, etc. did you do that are relevant?\r\n - What *distinguishes* you from other candidates? What makes you better / more suitable for grad school than all the other applicants with reasonable undergrad schools and grades?\r\n\r\nNote that I am not saying that a CV without undergrad research experience, no previously published papers, no relevant extracurricular activities, and no strong research letters will get you into a great grad school. **However, it is important to recognise that the problem here is not the CV document. It is that you do not have those experiences, and no way of formatting your CV will fix these problems.**", "906" ], [ "I would like a form on our website that people can fill out and indicate which of our products they are interested in. Can I create a form that will then create contacts and Opportunities in Salesforce that will require approval before they are counted in any of our statistics? Will this use the API in some way?\r\n\r\nI currently use some web to lead forms and have created flows that process the information to where it is needed, but our product offerings is getting to the point where this isn&#39;t feasible for leads.", "1009" ], [ "> Q: So, is it worth the space to mention about the contribution for GRE learners?\r\n\r\nI see no difference in this matter between US and European schools. If you felt it was worth the space for the US, keep it in. Your \" ;community service \" ; was to create a Anki deck for a common test. Whether the school you are applying to is using this specific test or not does not change the value of your contribution.\r\n\r\nIf you are worried that the admission committee reading your application does not know the GRE, you can always add a short sidenote that explains what it is.", "197" ], [ "Stephan&#39;s answer is generally correct, but I get the feeling that this is not what the OP has in mind:\r\n\r\n > Is it possible to write a proposal to ask for a professorship position?\r\n\r\nI take this to mean whether it makes sense to essentially do a \" ;blind application \" ; for a professor position (i.e., send to a university that is not currently conducting a suitable search an application to the extend of \" ;here are my credentials and a research proposal, please create me a position \" ;). The answer to this question is a pretty resounding **no**. This will only make you seem out of touch with how academia works.", "605" ], [ "> Suppose you have a manuscript and you have just missed the deadline for an A* conference. Should I submit to the next tier A conference or wait until for the A* conference to come around again?\r\n\r\nThis depends on a number of factors:\r\n\r\n - How likely do you think your paper is to be accepted in the A* conference? If this is your absolute best, cream-of-the-crop paper and you are confident it will go through, then submitting to a weaker conference just because you did not want to wait will feel like waste down the road. If the A* conference felt like a long shot anyway, go ahead and submit now.\r\n - How likely are you to get scooped? If you are doing cutting-edge research in a trending topic, you may want to go for the A conference simply because you are afraid that somebody else may publish before you if you don&#39;t.\r\n - How important is timely publishing for your content? Many great research papers are in essence timeless, but occasionally one has produced a paper that is of value to the community right now, but which may be much less interesting in a year (e.g., some empirical studies in fast-moving fields are like that). In that case you should submit to the A conference now, because there is a very real danger that the paper will not be good enough for the A* paper in a year anyway.\r\n - How important is having the paper out soon for your career progression? E.g., if you are handing in your PhD in a year, or plan to be on the job market in a year, or plan to hand in this selective personal grant in the next year, then having another published A paper may be better than a potential A* paper that comes \" ;too late \" ;.\r\n - How much value is (in your field and your circles) placed on the \" ;esteem \" ; of the venue? That is, what do you estimate how much more valuable the same paper will be for your career if published in an A* venue rather than an A venue? In a perfect world, it would not matter. In the real world, as for instance in my field, the venue a publication appeared in is ultimately more important in career decisions on all levels than the actual content.", "827" ], [ "> Is there any similar service for Europe?\r\n\r\nUnfortunately the answer to this question is **no**. The closest equivalent, at least in the German-speaking area, is [_URL_0_][1]. I am not aware of a similarly complete portal for the rest of Europe.\r\n\r\nAdditionally, the most complete list for the German-speaking area is definitely the newsletter sent out monthly by the [ \" ;deutschen Hochschulverband \" ;][2] (essentially the union of German university teachers). This list has rather official character and is pretty much complete for the area. However, you need to be a member to receive this newsletter, and one can only become a member by having been employed in an academic post at a German university.\r\n\r\n*(or you know a member and ask him to forward you the newsletter each month)*\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_2_", "307" ], [ "@ff524 This is a bit long for a comment, but my impression is that the difference is pretty significant. For starters, salaried PhD students around here usually don&#39;t even consider themselves students, more like entry-level professionals. This also includes that people often take comp time after working longer hours before deadlines, and generally people are rather resistant towards doing things that are not in their job profile. I think the mentality is actually quite different from what I see with students in the US.", "906" ], [ "> After A is reached, HR will say, this is now my proposal; department still has to approve my proposal! Then comes the department head, which reduces the compensation further, to proposal B, likely to be the MIN value! The department head states that this is the final offer and cannot be negotiated.\r\n\r\nI would treat this offer from HR as what it is, a non-commital, non-binding declaration, but nothing more. To me, this has the same character as an applicant stating that \" ;he is certainly interested but needs to clarify with [whomever] \" ;. Just like the department would be asking for a stronger commitment, you are in the right to ask for an actual offer before accepting anything. It is **not** stalling to say that you will not be making a final decision until you have a final offer - it is just good sense to do so. I would not consider it unethical to renege from the negotiation in the second stage, if HR presents the first offer as fixed and the department head later on does not come through.\r\n\r\n > The department head states that this is the final offer and cannot be negotiated.\r\n\r\nPeople like to state this a lot. It is usually not true. Also, if you actually have other offers (like you assume you do), *every* offer gives you at least 2 choices - take it, or go for another school. It is not like you have to accept whatever \" ;final \" ; offer they give you.", "605" ], [ "One part of the issue is likely that I do not have the impression that volunteer editors and authors are considered \" ;customers \" ; by <PERSON> et al. in the same sense that you are considered a customer by Amazon. I have no idea what would be a more fitting comparison, but likely some sort of farm animal. The reason for that is that Amazon is afraid that you take your money elsewhere. <PERSON> knows that often there is realistically nowhere to go for their authors and editors.", "622" ], [ "It&#39;s a high-profile example for something that various people on this Stack Exchange have been preaching for a a long time - **authorship norms differ from field to field**. This is essentially just a specific case of the _URL_0_ mantra of \" ;academia varies more than you think it does \" ;.\r\n\r\nYour interpretation of \" ;author \" ; seems to be mostly in the strict word sense, as in * \" ;a person that co-wrote the paper \" ;*. This is indeed the norm in many fields, but as you say, in high-energy physics, authorship really has little to do with \" ;authoring the manuscript \" ;, and is more related to \" ;involvement with the research that led to the paper \" ;. I would speculate that in an research attempt such as the LIGO one, the effort of writing the actual paper seems miniscule in contrast to the work that went into the research, so the question whether somebody contributed words to the manuscript or not will not seem like a particularly relevant one for acknowledging hers or his contribution.\r\n\r\nNote that high-energy physics is not the only field with authorship norms that may seem strange to outsiders. In many experimental fields, the lab head / PI is customary the last author on any paper from her/his lab, whether (s)he is involved with the work or not. In some fields, authors are ordered by perceived contribution, in others more or less by seniority, while others don&#39;t order at all or do so alphabetically.\r\n\r\n > why should (or shouldn&#39;t) it happen?\r\n\r\nThe important thing to keep in mind is that *it is after all just a norm*. Having a long list of co-authors with one or a few designated PIs, project leaders, or contact authors really is not different in practice than having a short list of authors and a long section \" ;Contributions by: A, B, C \" ;, as long as everybody has the same understanding. Coming from the outside and telling the physicists that they \" ;are doing it wrong \" ; because their notion of co-authorship isn&#39;t the same as in your field seems misguided to me. If it&#39;s working for them, let them continue doing it like that.", "827" ], [ "My supervision is (in Computer Science, although I think that this is likely not particularly field-dependent) in the beginning usually quite tight (meaning meetings once a week for about one hour each, although for other fields \" ;tight supervision \" ; may mean something different). At the beginning of the project, the student is usually not yet fully caught up on the literature in his field and does not yet fully understand her/his topic. Hence (s)he is still unsure about where the project is going, and often has a hard time deciding on tactical issues, such as what to try and work on next. In this phase I usually have a weekly jour fixe.\r\n\r\nAs the project progresses, I more and more retreat to the background and give the student the freedom to decide more individually how to conduct her/his research. This naturally also means that meetings become less frequent, and the jour fixe becomes more an on-demand meeting. I still try to catch up with the student approximately every three weeks (again, concrete frequency may vary for you), mostly to check that the student is progressing and that her/his research is not completely derailing into a track that I consider dangerous or wrong (I will let the student make smaller, tactical mistakes, such as wasting some time on an approach that I suspect may fail, but I will step in if the student embarks on a detour that I consider bad enough that it may seriously threaten the success of her/his thesis).\r\n\r\nTowards the end, meetings tend to become more frequent again, mostly because I like to give students quick feedback on individual sections of their thesis while they are writing. No point in letting them make the same 15 standard mistakes through their entire document before I get to suggest improvements. In this phase, and especially if time is already running out, I sometimes have quick feedback meetings almost every other day.", "19" ], [ "I see very little danger in putting those documents onto your website, and indeed I encourage my students to upload everything they produce and that may be of *any* value. My line of thinking is that we are after all paid by taxpayer money, so it seems only fair to make as much of what we do available in some way if possible.\r\n\r\nOf course, the elephant in the room is how those \" ;others interested in this work \" ; will actually find your notes if you just upload them to your website as PDFs ...\r\n\r\n > What would the cons/risks be?\r\n > So far my main concern that I have thought is that it might make me look bad by making available, less than perfect work. Some of these may lack suitable referencing for example.\r\n\r\nI do not think that there is a real danger in \" ;looking bad \" ; as long as it is clear that whatever you upload there is just quick, informal work (and, of course, as long as the work does not contain, e.g., hate speech, but I guess this goes without saying). Lacking suitable referencing may be a more real problem, and I would likely put in the few extra minutes to add appropriate attributions for every text that I put online somewhere. However, even if you decide not to do this, it is very unlikely that somebody down the road would get agitated over not being properly cited in a document called \" ;Some Informal Notes on [A] \" ;. The key here is that you make clear that this is *not* a preprint of a paper or even a technical report in the traditional sense, but \" ;only \" ; an informal note. Hence, it should be clear that the content isn&#39;t meant as a scientific publication. This should alleviate most concerns that you are passing off other&#39;s work as your own.", "827" ], [ "The usual process is that *you* actively approach those that you think will write you the best letter. In practice, you will want to engage the advisors that are the best trade-off between the following, sometimes conflicting, criteria:\r\n\r\n - Prefer **people that know you, your work, and your skills in detail** over people that you don&#39;t know that well. Specifically prefer people that know you from research projects or other \" ;outside the classroom \" ; activities. Letters that only say \" ;ASimonis01 had an A in my class \" ; are not worth much. \r\n - Prefer **people that are willing to write you a very strong letter** over people that may write a more lukewarm recommendation. This should be obvious, but keep in mind that everybody does that, so the overall level of enthusiasm in letters is *very* high. Even a well-reasoned positive-ish letter with some negative aspects may already be a kiss of death for your application.\r\n - Prefer **people that are in a position to write a plausible recommendation**. In practice, this usually means that more senior and/or more well-known recommenders are better than less experienced ones, simply because a statement like \" ;among the best student I have had \" ; means much more if the writer is a senior professor than an assistant prof. in his first year.\r\n - Prefer **people who know how to write a recommendation letter**. Especially if you are currently located in a different cultural region, it is well possible that your letter writers are not overly familiar with how a recommendation letter is *supposed* to be written. The end result may be a letter that is *meant* to be positive, but which is perceived as lukewarm or unprofessional. In the same context, avoid like the plague people that you suspect may just submit a stock letter.\r\n - Prefer **academics over pretty much anybody else**. That is, don&#39;t get recommendations from your boss in industry, your coworkers, or your childhood friend. The reason is the same as above - you want letters from people that are able to judge whether you will be a good grad student. Your boss in industry can&#39;t do that. Researchers in industry research labs may qualify, but I would still prefer a professor in almost all cases.\r\n\r\nAlso note that at least in the US one generally does not get to *see* the written letters, they are uploaded by the recommender directly. This means that you need to be very careful in your selection, as you cannot pivot after receiving a suboptimal letter from one of your references.", "605" ], [ "> Does Germany require a Habilitation or W1 before hiring someone for a W2 position if they are coming from outside of Germany?\r\n\r\nNot generally, and often not even for people from \" ;within \" ; Germany. The strict Habilitation requirement is in the decline, also and and particularly in the best universities in Germany.\r\n\r\nWhat *is* required though is a \" ;habilitation-like \" ; career stage / qualification. That is, there should not be any doubt that you would be able to receive habilitation easily if you applied for it with your current CV. This is generally no problem for candidates that already hold a position comparable to a W2 professorship (say, an associate professor in the US or a Senior Lecturer in the UK), but if you are currently a postdoc it is important that you underline your independence in research and teaching, your standing in your community, as well as your ability to acquire grants and external funding (i.e., the criteria among which habilitation is usually decided).\r\n\r\nAnother factor may be academic age - in many cases academically older candidates will find it easier to communicate that they are in a career stage comparable to W2 professor than excellent younger ones. I have the impression that in Germany many commissions either do not, or fail to, properly normalize qualifications based on academic age; that is, they will often prefer more modestly qualified senior candidates over very promising younger ones.\r\n\r\nFinally, another challenge may be language. You may still find a requirement to be able to teach in German in many job postings for positions in Germany.\r\n\r\n > If so, is this rare? What&#39;s the standard trajectory in German academe for someone that has done postdocs elsewhere?\r\n\r\nI think the German trajectory for most people from within and the outside is like that:\r\n\r\nPhD student - > postdoc (sometimes for many, many years) - > [optionally] W1 / junior professorship - > either W2 or \" ;bad \" ; W3 professorship, depending on experience - > W3\r\n\r\nIn most cases, none of the steps after PhD student - > postdoc happens automatically or based on a tenure clock. The usual way to e.g., get one&#39;s W2 position upgraded to W3 is by getting a competitive offer for a W3 position at another university. Also note that traditionally many academics in Germany never held a W1 position, but rather did extensive postdocs and/or one or more \" ;Vetretungsprofessuren \" ; (akin to a visiting professor). \r\n\r\n > is this rare?\r\n\r\n*(I am assuming the question is whether it is rare that a postdoc from the outside gets hired at a W2 position)*\r\n\r\nIt&#39;s not rare, but it is also not insanely common. While full professors do commonly get hired from the outside (especially at the top institutions), my impression is that most *are* already in a professor-like position before making the move. This naturally also means that most outside hires seem to be on W3 rather than W2 level. As always, when one is trying to break in from the outside, you are in a slightly disadvantageous position in comparison to somebody who is already \" ;in the system \" ;.", "906" ], [ "Generally speaking, it is possible to use a \" ;pen name \" ; for academic writing, or really for your entire academic career. I think using a different last name would be considered somewhat strange, but assuming your last name is common enough not to be an issue ( \" ;<PERSON> \" ;) you could easily just use \" ;Karl Bob Smith \" ; rather than \" <PERSON> \" ; for all your academic affairs (except official statements) without raising too many eyebrows. This should largely alleviate your immediate problems, as long as your \" ;unconventional topics \" ; are not also linked to your face (if it is - think porn starlet - your problems are bigger; in this case I would suggest dropping all hopes of keeping it a secret for any amount of time and being super upfront with your past / side project).\r\n\r\nHowever, be prepared that it&#39;s likely going to be a leaky secret anyway. Using a vastly different first name will divert the casual name googler and your random conference acquaintance, but I would assume your cohort in grad school is going to find out at some point. There just are places where you pretty much *need* to use your legal name, such as some forms. And once a few persons know, the message is going to spread with a speed proportional to how raunchy your secret is. Another problem is going to be that the places where you maybe would *really* want to keep things secret, such as grad school or job applications, are also the ones where you sooner or later really need to use your legal name. In that sense I am wondering how much you will actually win by using an academic pen name.", "495" ], [ "* \" ;If few authors choose to pay the fee, then the publisher can use this as evidence that there is little demand to change their business model. \" ;* I long feared that this is really the main reason behind the existence of this model, similarly to how some players in the music industry initially wanted to curb digital music sales with overtly *terrible* offers.", "622" ], [ "* \" ;This (at least to me) is a substantial amount of money per paper. \" ;* This is of course in the eye of the observer. In Computer Science we often publish in conferences, which requires us to travel there, which in essence means that we commonly pay northwards of 2000 USD for a paper (in hotel fees, flights, and conference tickets). Of course there are added benefits and the \" ;feel-good factor \" ; is better, but the matter of the fact is still that each published paper incurs costs in a similar dimension to us - and then the paper isn&#39;t even open access.", "0" ], [ "> The call I&#39;m submitting to wants know if the project budget is higher than the amount of the grant, what other sources of funding the PI will use, presumably to ensure the success of the project.\r\n\r\nAlmost certainly the answer to that is not \" ;my private money \" ;. I can see three \" ;correct \" ; answers from the point of view of the funding agency:\r\n\r\n 1. The PI will make sure that this does not happen. Optimally, you will attach a detailed cost planning that is well within the grant amount to substantiate this point.\r\n 2. The host institution is co-funding the project. This is often quite popular with funding agencies, as it shows commitment from side of the host institution.\r\n 3. Another funding agency is (potentially) paying for it (see info on other submitted or accepted grants). This one is a bit iffy, as relying on another submitted grant is high-risk. Also, depending on the concrete setup, you may involuntarily raise the suspicion that if your current project is not accepted, the \" ;other \" ; agency may fund it in full - and as you can imagine this is an impression you want to avoid at all costs.\r\n\r\n > For example, if a piece of equipment costs $4000 and I only have $3950 left, can I supplement it with personal funds?\r\n\r\nYou can definitely do that, and in practice this can sometimes happen (maybe subtly - for instance by going on self-paid conference travels, using your own laptop, etc.). However, the project proposal is certainly not the right place to mention this.", "605" ], [ "What exactly is this tool? Here is what I know. I want to make a Decision Split in a Journey. In order to have fields from my Data Extension show up in the Decision Split, I need to create an Attribute List in Contact Builder, set it as 1 to 1, and use it as root. \r\n\r\nI don&#39;t really understand what I am doing when linking a data extension and mapping some sort of fields across each other. I&#39;m not sure if I should be linking the email fields together or not.\r\n\r\nI have several journeys that use different Data Extensions each. Should I have a different Attribute List for each one, or can I combine them all by linking the Data Extensions in an attribute list, or should I really try to have them all work from one Data Extension (this is doable). \r\n\r\nI can&#39;t find any good documentation that explains this very clearly, everything seems to be so convoluted. Any good documentation you can link me to would be great if answering these basic questions are too much.", "442" ], [ "@BillBarth I was not aware of NSF&#39;s stance on this, but it&#39;s definitely not uncommon here in Switzerland. Not so much for the NSF-equivalent, but for various smaller foundations. The grants they provide are usually not that big, so by themselves they are not sufficient to fund ambitious projects. Hence, commonly one proposes a big project, says the host uni finances 50% of it, and only asks for the other half from the foundation.", "76" ], [ "so I was using chrome to do research on subatomic particles and the website got taken down so I&#39;m on my C Drive under the path users username app that a local Google Chrome user data default and there are just a lot of folders and files I was just wondering which one of these files or folders could I open and using what software to read the articles that I have no access to", "439" ], [ "The value that is placed on explicitly discussing the research methodology varies from field to field. Many more systems-oriented papers have a methodology that basically goes \" ;problem - > proposed solution - > evaluation [rinse and repeat until results are ok] \" ;, but that is usually more implied than explicitly discussed. I guess you could call it a \" ;case study \" ;, but the authors probably wouldn&#39;t consider it like that.", "76" ], [ "I am running 3 different Journeys in Marketing Cloud based on different segments of our contact list in Salesforce. Is it better to create one Data Extension that basically contains all of my SF Contacts, and then set filters on the entry event into the Journey to grab the specific contacts I want? Or should I have a different Data Extension for each Journey that each updates separately?\r\n\r\nI&#39;m trying to understand the pros and cons of this but I&#39;m having difficulty.", "442" ], [ "I&#39;ve been working on Humanoid Robot, and I face the problem of finding the Center of Mass of the Robot which will help in balancing the biped. Although COM has a very simple definition, I&#39;m unable to find a simple solution to my problem.\r\n\r\nMy view: I have already solved the Forward and Inverse Kinematics of the Robot with Torso as the base frame. So, if I can find the position(and orientation) of each joint in the base frame, I can average all of them to get the COM. Is this approach reasonable? Will it produce the correct COM?\r\n\r\nCan anyone offer any series of steps that I can follow to find the COM of the biped? Any help would be appreciated. \r\n\r\nCheers!", "1010" ], [ "I am not convinced that the right mind set to think about a typical NSF-style funding agency is that they are handing out \" ;their free money \" ;. Firstly, it&#39;s really not \" ;their \" ; money in any way, shape, or form. Secondly, their entire raison d&#39;etre is to distribute this money following some defined policy, so we should expect them to do so properly. Thirdly, it&#39;s not really free either, as there usually *are* contractual obligations of what to produce with the money. Granted, those obligations may be things you wanted to do produce anyway (e.g., papers or dissertations), but still ...", "76" ], [ "I am not going to lecture you on the ethicality of taking sick leave to go to a conference. Not that it sounds like a great idea to me, but let&#39;s focus on your actual question.\r\n\r\n > How do I politely ask the convenor of my session to hide my name or alter it in some form? Withrawal is not an option.\r\n\r\nWhat is the problem with just sending them an email, and saying that you \" ;for personal reasons \" ; don&#39;t want to show up as a presenter? It will seem slightly weird, but I can&#39;t really imagine them saying no to this, and \" ;personal reasons \" ; is generally accepted code for \" ;I have my reasons, but I would rather not tell \" ;.\r\n\r\nThat being said, you should be aware that the Internet does not forget. If the web page is currently online with your name, there are definitely tools that will allow inquiring (and dedicated!) minds to later on find out that you actually *were* listed as a speaker at some point, even if they remove your name at some point.", "701" ], [ "If googling \" ;acceptance rate < confname > \" ; does not yield a response, it&#39;s a good bet that the data is not online. If you are desperate about this information, you can still try to reach out to previously accepted authors, as sometimes the acceptance rate is communicated as part of the acceptance / rejection letter.\r\n\r\nThat being said, I really wonder why this info would be so essential to you that you go through great lengths to unearth it.", "827" ], [ "> This made me wonder: is there some sort of implicit sexism at play here, and do some of these young female researchers feel the need to impress other researchers (both male and female) with their appearance?\r\n\r\nIt is certainly possible that this is because of some sexist problems in this specific society / community that are not present in the international community. However, given [Occam&#39;s Razor][1], I think we should assume that the more simple and straightforward answer is that this is just a regional peculiarity of these meetings, and that we should not extrapolate too much from this without further evidence. \r\n\r\nIt is not at all uncommon for individual conferences or communities to develop their own standards and behavioral patterns. Basically, this is true for each event where students are likely to attend over multiple years, hence can learn from their experience in the year past. Assume, for instance, that you are a young female PhD student that attends such a meeting for the first time in casual wear, and you see many other students in a similar career phase dressing more formally. Would you not bring more formal clothing next time? I don&#39;t think that this should be qualified as \" ;feeling the need to impress \" ;, or as any problem that needs addressing.\r\n\r\nIt is also not overly weird to see more senior people wear differently - they have been attending this meeting for a long time, and (a) don&#39;t care much about the current dress code culture, and (b) have probably been nurtured at a time when the dress code was completely different anyway. These things change over time.\r\n\r\nAlso keep in mind that your own expectation of what is \" ;normal \" ; wear in conferences has also likely not been set in stone from day 1, but is the product of what you have seen in \" ;other conferences \" ;. There is no god-given law that jeans are more natural to wear to a conference than nice dresses, heels, or suits.\r\n\r\n*(Actually, in most non-science conferences, it is normal to dress rather formally, so one can argue that what you have seen in your conference is closer to \" ;normal \" ; than what you are used to)*\r\n\r\n\r\n\r\n [1]: _URL_0_", "76" ], [ "> How would one go about this assuming no contacts are known a priori.\r\n\r\nLikely you can&#39;t go for this without any contacts at all. You are thinking about this in the wrong order - you can&#39;t get money from industry first and use this to build up contacts to industry; rather, you would build up contacts to industry to achieve a level of trust so that you would be later on in a position to receive industry funding. This also means that getting direct industry sponsorship as a PhD student is at least uncommon - typically, companies are more interested in sponsoring a professor or chair that they have positively interacted with over a sustained period of time.\r\n\r\n**Slightly longish story short, your planned approach (acquiring industry funding) is not a suitable means to your stated goal (landing a job in industry).**", "906" ], [ "There is substantial divergence between fields and individuals to what extend twiddling with the original hypotheses post-hoc should be tolerated. Defensible positions range from * \" ;it&#39;s not a big deal if the experiment / write-up still makes sense with the new hypothesis \" ;* to * \" ;hypotheses shall never be changed \" ;*. Only you can tell what your and your field&#39;s methodological stance on this is.\r\n\r\nAs <PERSON> says, the main issue to avoid is \" ;p-value hacking \" ;. That is, it should not be that the authors decide that whatever they find support in their data is redefined to have been their hypothesis all along - while *exploratory research* per se is not bad, it is distinctly different from hypothesis-driven research and should methodologically not be sold as such. You will need to evaluate whether this has happened for your manuscript. If the answer is \" ;yes \" ;, this is certainly grounds for rejection.\r\n\r\nHowever, from your explanation, it sounds to me like the authors did more of a technical refinement of their hypothesis, without changing the nature of it. If that is true, it sounds somewhat nit-picky to reject a paper on this grounds. I tend to be of the opinion that methodology should be considered a means to an end, not a strict rulebook that needs to be followed to the letter even if there appears to be no reason for some of its details in a specific case.", "827" ], [ "<PERSON> As somebody who thinks this rule (“actual problems that you face”) makes sense, let me explain myself. This rule aims at making sure that SE remains useful for readers, by preventing questions on purely rhetorical or philosophical topics or clearly unrealistic scenarios. In this light, I would say that most of your questions have been ok for me personally, but I am sure there were a few that I also downvoted. This would have been because they asked for \" ;data on this and that \" ; more than for a concrete, useful *information*.", "727" ], [ "> It seems that many universities are rotating professors who teach a subject. Why do schools apply such strategy?\r\n\r\nOne instance why this may happen is for core courses that *need* to be taught, and for which no clearly matching faculty is available. My department, for instance, has a very clear focus on applied and practical computer science. For some fundamental courses, we simply *do not* have obviously matching faculty, and no plans to hire people for this profile either. This leaves us with the options of either finding external people to teach the course (preferred if said people exist and funding for paying the external person is available), or making one of our faculty from a different field teach the course, fully knowing that (a) the faculty will not be happy and (b) that (s)he will probably not do an outstanding job either. Part of convincing said faculty is usually also a promise that (s)he needs to teach this \" ;foster \" ; course only one or two times, before passing the token on to somebody else.\r\n\r\nAn alternative reason for rotating teachers is that there *is* more than one faculty that can teach a course, but the course is highly disliked and an agreement was established that multiple people take turns teaching it. I have seen this happen for courses such as \" ;Introduction to Programming \" ;, that many people are in principle qualified to teach, but few really *want* to teach.\r\n\r\nFinally, it may be that the school (correctly or incorrectly) assumes that rotating a course will indeed improve the quality of the course or add in some way to it. For instance, in my old alma mater, we had the concept of \" ;AK courses \" ; ( \" ;selected topics in SOMETHING \" ;). These courses were advanced courses with no fixed content, only a sort of framework or direction. Every year, a different professor would be teaching it, and give it a completely different spin depending on his own current research interests. You could do the same AK multiple times, assuming that the professors agreed that those years were indeed sufficiently different.", "197" ], [ "I can&#39;t really say that I \" ;get \" ; the concern of the co-author here, but I am aware that different people have dramatically different views on privacy than I do.\r\n\r\nIn general, this is definitely a question that you can ask the Editor-in-Chief without concern. However, depending on how many submissions the journal in question gets, it is possible that the EiC may be rather uncompromising upfront. For some top-level journals, submissions are a dime a dozen, and I have seen editors that see little need to engage in potentially time-consuming discussions with authors prior to even seeing an acceptable manuscript. Hence they may just point to an existing policy if there is one, without much further thought.\r\n\r\nHence, another possibility would be to just submit the paper regularly, and delay the problem until the paper proofing phase. If your paper is deep enough into the process that the question actually becomes urgent, it seems exceedingly likely that the editor and/or responsible persons from the publisher&#39;s side will be willing to compromise over such a triviality rather than reject the paper. For instance, they could allow your co-author to have a placeholder rather than his photo, and/or have a very short bio text along the lines of \" ;Dr <PERSON> is currently a research engineer at GoodStuff Inc. For privacy reasons, no other information is given. \" ;", "827" ], [ "+1 I think this is a great question, even though it is not fundamentally about academia but about the relationship of teaching and grading in general. I don&#39;t really have a comprehensive answer, but one practical issue on the advanced level is that if you want the teacher and the grader to be independent persons, this requires you to have *two* subject experts in your faculty. Many, especially smaller, faculties don&#39;t have this kind of redundancy.", "197" ], [ "When I ask the question * \" ;why do you want to study towards a PhD? \" ;*, the very last thing I want to hear is something entirely unrelated to studying towards a PhD. Not because I fear that you get sidetracked (I don&#39;t necessarily worry much about that), and certainly not because I have some inherent bias against piano players, but because I worry that you actually *don&#39;t* know why you want to do a PhD. This is true for a surprisingly large percentage of applicants, and typically a fairly bad sign.\r\n\r\nConsequently, if you get this question, I suggest that you explain why you want to do a PhD, and nothing else. If the question is why you want to do a PhD *at exactly this university*, this can be part of your answer, but it should not be the only, or even the main, answer to that question either. Quite frankly I would imagine this to be largely ignored - playing piano is not memorable enough to make you stick out from the applicant pool, and unrelated enough to virtually all fields of research that I won&#39;t count particularly positively either.", "906" ], [ "In my experience the attitude towards expressing uncertainty and hyperbole in manuscripts varies a lot between disciplines. Some fields (notably math, as far as I know) tend to be extremely conservative, while in other fields a certain level of confidence in your own experimental design and results is basically expected by peers and reviewers. In my field (applied CS), uncertainty about methods is virtually never explicitly mentioned in papers (that is, it is very rare that an author would write a variation of \" ;we used method A, but method B would be promising as well but we did not try it \" ;). Expressing a certain caution about results is common, though ( \" ;the results appear to support hypothesis C, but further research may be required \" ;). My community is also very big on describing limitations of experimental design in a dedicated section, but many other CS fields don&#39;t do this either.\r\n\r\nIt is very honorable that you try to be truthful and conservative, but I suggest that you trust your advisor&#39;s experience on the expectations of the life science community on how manuscripts are typically written. Note that this does not mean that you need or should throw scientific rigor out of the window, but as a PhD student, you are most likely not in a position to change the general culture of how the community likes to write papers. Frankly, it&#39;s also not like a lot of harm is done by not describing obvious alternative methods or limitations. A qualified reader will typically be able to read between the lines - if you don&#39;t write anything about alternative method B, they will infer that you did not do B and judge your results accordingly. \r\n\r\nIf you are *really* unsure about this, you can get feedback from a trusted second senior person in the community, but in general, in the context of a PhD study, it is correct to trust your advisor&#39;s experience more often than not, and learn what you can until you have your own lab. This is the time to enact larger changes that you would like to see in your community.", "827" ], [ "Your answer is certainly morally correct, but pragmatically Alice&#39;s answer seems more helpful. I certainly wouldn&#39;t in good faith recommend a student to submit a paper without knowledge of their advisor. Sure, in an ideal world, the advisor wouldn&#39;t mind, but in practice they very easily might take offense, and the downside is so much higher than the potential upside ...", "605" ], [ "As <PERSON> correctly points out, **most** instructors won&#39;t be able or willing to \" ;pre-grade \" ; homework, but some may. So if you feel strongly about it, you can certainly ask.\r\n\r\nThat said, it&#39;s probably more fruitful to ask one or more targeted question(s) about the things that you are unsure about. Note that \" ;please run my program and tell me if it works \" ; *isn&#39;t* a targeted question, nor is \" ;here is my code, will I get all points for this \" ;. A targeted question may include a succinct summary of your approach and the parts that you are unsure about, and asking if you are on the right track. I imagine that most instructors will be more than willing to give you feedback on that.\r\n\r\nAs a rule of thumb: if a question would be closed on Stack Exchange (particularly, if it would be closed as lacking prior research or being too localized), there is a good chance that an instructor would also not be happy about it. Incidentally, this is one of the core reasons why I strongly support my students being active on Stack Exchange - it trains them how to productively ask for feedback better than any other way that I know of.", "197" ], [ "To be fair, if the question is *too simple* it may also count against your chances of receiving an answer. I frequently get questions (from students and others) that at least to me appear very boring and mundane, but where an answer takes a fair bit of time to type up. These have a much lower chance of getting answered than questions that require some thinking/research but much less time to explain or type out.", "359" ], [ "I don&#39;t think there is *per se* an ethical problem with you being listed as a co-author, given that the lead authors think you have reached the level of contribution required in their community. I can see some practical problems, though:\r\n\r\n - If you feel like you are \" ;padding \" ; your CV with a paper that you, following the norms of your own community, don&#39;t really deserve, you *may* want to explicitly denote in your CV that this paper is in a different field. I have seen some people (especially in theoretical CS, but I assume this should also be possible in other fields) add a separate subsection in their publication list \" ;Contributions in other Fields \" ;, where they added their \" ;non-standard \" ; papers.\r\n - If this is a longer collaboration, you *may* run into an expectation problem, when you write a paper that you are leading. Your collaborators may assume that they will also be on your paper when they make similarly small contributions, despite not meeting the standards required in your field. Really the only way to address this is through very open and honest communication. However, more realistically, if you plan to write such a paper, it may indeed be better to insist not to be part of their paper upfront, otherwise it may be difficult to avoid hard feelings on the side of your collaborators if they always write you on their papers but you don&#39;t add them to yours, for the same levels of contribution.", "827" ], [ "I think Bryan&#39;s answer gives a nice perspective on the issue. A perfect system does not exist, and different continents have developed different (imperfect) ways of dealing with the fundamental recruiting problem that it is hard to judge whether a specific student (or employee) will perform or not.\r\n\r\nWhat I want to add is that, if you peek behind the covers, the European and American systems don&#39;t actually differ all that much. You assert that in Europe \" ;your CV is all that counts \" ;. That is, unfortunately, quite naive. The CV of your average student is simply not expressive enough to be \" ;all that counts \" ; - good grades are at best a weak indicator of research potential, and (despite your counterexample from France), also in many places in Europe many students have very good grades, to the extent of being low-value as a discriminator in hiring. Grades also do little to measure the soft factors such as motivation or being a good team player, which ultimately matter more than whether a student had an A or a B for some largely unrelated undergrad course.\r\n\r\nHow professors in Europe largely have dealt with this uncertainty is by personally asking the professors that the student worked with before what their impression of the student was - so you still have your \" ;recommendations \" ;, but not through written letters but through informal email or telephone exchanges. This was possible because traditionally, students in (at least central) Europe were not particularly mobile - most prospective PhD students did their undergrad in the same university, a close-by university, or a different university where the professors are already in close contact. Applicants from other places were often rejected outright. Now times are (slowly) changing and more and more PhD students come from abroad - and, lo and behold, suddenly formal recommendation letters are becoming important as well.\r\n\r\nAnother aspect that I am missing in your question that at least central and southern Europe has historically had a problem with *rampant* nepotism in academia. So I find it particularly curious that you draw Europe as a haven of objective hiring strategies.", "906" ], [ "Your implementation needs to be good enough to evaluate the concept you want to evaluate - no more, but certainly no less. What this means in practice is largely dictated by *what kind* of evaluation or experiments you want to do. I have basically seen four broad classes in Computer Science:\r\n\r\n - **Proof-of-Concept (PoC)**: you only want to show that your idea *can* be implemented, so you only implement your idea (often in a fairly naive or bare-bones manner). Note that this is often good enough for a quick demo, but not good enough for a paper (because reviewers usually feel that the conclusion that something can be implemented is not satisfactory by itself).\r\n - **Evaluation Prototype**: in addition to the PoC, you want to evaluate *how well* your idea works in some quantitative manner. For instance, if you are building some novel file system, you probably want to not only show that it can be implemented, but also that it works better in some dimension (e.g., faster) than existing systems. Your prototype can still be bare-bones, but you presumably need to build the core parts *well* because otherwise your evaluation may end up showing primarily that your prototype sucks. In a way, your prototype results show a sort of lower bound on how your idea works - that is, if your results are good your idea is validated, but if your results are not good, it may be because they idea does not work or your code is too bad of an implementation.\r\n - **User Study Prototype**: in addition to quantitatively evaluating your prototype, you may want to run one or more case or user studies with it, or conduct a controlled experiment. Now you need to improve your evaluation prototype with at least a limited amount of bells and whistles, because it is hard to run an expressive user study if your system is almost unusable to anybody but yourself. In this stage you may be adding a GUI and a bunch of features that are unrelated to your science, but which may be needed even in trivial practical usage.\r\n - **(Simple) Product**: the final stage is that you plan to actually release your implementation in some manner to the public. Maybe as part of an open source project, as a consulting delivery to a company, or even in the context of a spin-off company. You will now need to add many more bells and whistles unrelated to your science. Further, now you need to start caring about documentation, a release cycle, not doing breaking changes, etc., all of which are basically irrelevant as long as you are just building a prototype for your science.\r\n\r\nSo what does this mean for your project?\r\n\r\n > For example, if a \" ;novel \" ; work requires a persistence layer and a researcher uses a file based method e.g. csv. Will that be wrong? Will his architecture point to a database or a file system ?\r\n\r\nI generally suggest my students to follow a lean approach:\r\nwhat kind of experiment do you plan to do? Will it matter what kind of persistence layer the prototype has? If no, then build whatever you can do quickest and where you are most confident that it will work correctly - but keep in mind that even the simplest prototype can sometimes run through all the phases above, so at least plan for the possibility that you may need to swap out your persistence layer for something a little more state-of-the-art than a flat text file later on.", "726" ], [ "While the comments (and also Lyndon&#39;s answer) give you some ideas that you can try, I suspect the most realistic answer will be that converting a 2-column paper into a format that&#39;s slightly easier to read for you will not be worth the (considerable) effort on a consistent basis. So, unless you actually have a disability that makes this impractical, I am afraid you will have to get used to reading papers in this way.", "704" ], [ "I am working on an apex trigger. I have a list that I need to sort by a date field, do some processing, then sort by another date field, and do more processing etc 5 times. When I do the initial SOQL query I can sort by Date1 using ORDER BY. I can even sort by Date2 by using a wrapper class as outlined in the apex help documentation [here][1]. But I&#39;m not sure how to then a Date3, Date4, Date5 etc. \r\n\r\nI&#39;m thinking I need to modify the wrapper class so that it will accept some inputs and output different types of sorts, but I&#39;m not sure how to do this.\r\n\r\nThe wrapper class where I tried making the field to be sorted on an input\r\n\r\n global class CustomWrapper implements Comparable {\r\n\r\n public Custom_Object__c CO1;\r\n public String sortField;\r\n \r\n public CustomWrapper(Custom_Object__c CO) {\r\n CO1 = CO;\r\n }\r\n \r\n global Integer compareTo(Object compareTo) {\r\n CustomWrapper compareToOppy = (CustomWrapper)compareTo;\r\n \r\n Integer returnValue = 0;\r\n if(sortField==&#39;Date1&#39;){ \r\n if (CO1.Date1 == compareToOppy.CO1.Date1) {\r\n returnValue = 0;\r\n } else if (CO1.Date1 > compareToOppy.CO1.Date1) {\r\n returnValue = 1;\r\n } else if (CO1.Date1 < compareToOppy.CO1.Date1) {\r\n returnValue = -1;\r\n }\r\n }\r\n //...More of the same for different sortFields\r\n return returnValue; \r\n \r\n }\r\n }\r\n\r\n\r\n [1]: _URL_0_", "837" ], [ "I don&#39;t think there are \" ;best practices \" ; for that. For those to develop, this would first need to be a somewhat widespread issue (nowadays), which I am not aware to be the case. In principle, non of the examples would prevent *publication* of the research, although your second example (faked credentials) would certainly lead to high scrutiny of the manuscript. If a researcher were known to have pretended to have a PhD in the first place, I assume a reviewer or editor would not take his data and reported results in quite the same good faith as we usually do with other researchers. \r\n\r\nIt should also be noted that how the community would *react* to a paper is a different question - in your murder example, maybe a manuscript could still be *accepted* in principle after this, but it is difficult to imagine that the community would give the axe-wielding author much recognition for being first to publish their analysis.", "827" ], [ "I should say that mistakes seem to have been made, and not (only) by you: putting a student with (as you say) limited programming skills and no experience in deep learning on a topic as notoriously hard to get into as deep learning when the advisor also has little understanding of the topic seems to me like a recipe for desaster. That said, it happens to all of us occassionally.\r\n\r\nYour advisor&#39;s proposal to move forward with a simpler algorithm seems smart - this is also what I generally do if the original plan turns out not to be feasible. That said, your general approach to \" ;find codes \" ; that implement your algorithm for your use case would worry me, to be honest. Extrapolation is a fairly simple principle - simple enough that if I told a student to try extrapolation for a given problem, I would expect that they can come up with a solution themselves in fairly finite time (that is not to say that you shouldn&#39;t use an existing solution if one is already out there, but in the absence of an existing library just writing it yourself should totally be doable).\r\n\r\nIf that is outside your reach, actually changing topics may really be the most sensible thing to do for you, but I suggest having this conversation with your advisor.", "795" ], [ "This is strictly speaking *not an answer*, since <PERSON> was asking about the US, but I felt sharing a European perspective may be of interest here as well. Flag if you feel I am straying off topic too much, and I will happily delete the answer.\r\n\r\nETH Zurich, presumably the premiere technical university in Europe (and one that often follows US procedure pretty closely), actually has an official policy on this.\r\n\r\n > The academic age of assistant professors (e.g. without the time period of maternity leave, industry experience, military service, etc.) should be 35 years or under at the time of appointment.\r\n\r\n[Source][1]\r\n\r\nNote that they explicitly speak about \" ;academic age \" ;, not biological age. Time spent as a postdoc counts against you, but time in industry or in maternity leave does not. Given that, there is (in theory) no biological limit to become assistant professsor if you have been doing \" ;something else \" ; before in your life, but I suspect in practice there is: at Swiss universities, there is mandatory retirement at age 65, and ETH presumably is not overly interested in investing into young professors that don&#39;t have too long until retirement anymore.\r\n\r\nIn Germany, a rule that I sometimes hear is that you need to become professor before the age of 40 or get out (where \" ;professor \" ; usually means W2 or W3 professor according to the German system). However, this is more of a guideline than a formal rule - I have certainly seen cases of people who got appointed with their first professorship after 40. \r\n\r\n [1]: _URL_0_", "906" ], [ "It&#39;s a pity to see you leave, but as somebody who has been around this community (at times more, at times less) for a few years now, I feel you are misjudging the intentions of the community.\r\n\r\nParticularly, I am talking about this paragraph:\r\n\r\n > I also do not like how quickly sincere questions of (new) participants are downvoted or labelled as a duplicate because a couple of years ago a similar question was asked. These responses are mostly targeted at questions that criticise (or question) current practices in science.\r\n\r\nThe reason why these questions tend to be closed as duplicates isn&#39;t that people hate to challenge the status quo (I would wager that the average community member here is significantly more progressive than most of our colleagues), but that we **literally had all of these questions before**, usually multiple times.\r\n\r\nYou may respond that some of these questions are important enough that they should be revisited every so often, but that&#39;s unfortunately not at all how a Stack Exchange works. Once a question is asked and answered, the topic is done. I would argue that this is primarily what differentiates a Stack Exchange from a forum. I agree that this does not work well for certain types of questions, but those tend to not be overly well-suited for a Stack Exchange in the first place.\r\n\r\nYou may also respond that the fact that the person asking the question is a minority makes it a different question which should not be closed. This is *absolutely* a fair comment. If the circumstances of the poster are made clear in the question (ideally already in the title), and these circumstances actually make the situation and likely answers differ from previous questions, I would personally be more than happy to leave a question open or vote for re-opening it. In fact, I would argue that questions related to problems minorities face in academia are generally handled pretty well. Take, as a recent example, [this question about whether not being able to apply for state funding is a problem on the academic job market][1].\r\n\r\n**Personal attacks in answers or comments are of course not ok. These can and should be flagged and removed.** However, closing a question as duplicate or downvoting a question is not a personal attack, even if you disagree with the closing or voting (not saying that this is what you meant with \" ;indirect personal attacks \" ;, but I have seen cases where posters were offended when their question was closed).\r\n\r\n\r\n [1]: _URL_0_", "10" ], [ "> I&#39;m wondering how valuable is to have a short paper in a top conference?!\r\n\r\nThat depends a bit on what you define as \" ;valuable \" ;. As <PERSON> says, having a presentation and presence at a top conference is certainly very valuable in terms of visibility in the community and opportunity to make connections (never underestimate the importance of those!).\r\n\r\nHowever, in my experience, as a line in your CV, everything that&#39;s not a full paper counts for very little, even if it&#39;s a short paper at a top conference. In other words, if that is intended to be the main paper of your PhD and you intend to go onto the job market with this work, you *need* to get it accepted as a full paper. If it&#39;s just a side project, or just one in a longer string of papers that together form your PhD, leaving it as a short paper and taking the opportunity to attend the conference and get your name out there may be worth it.\r\n\r\nI should also say that, assuming your reviewers are right and all it needs for this work to become excellent is some presentation-level cleanup, it feels like a pity to not do this small additional work and try again at the next deadline for a top venue, rather than downgrading it to a short paper.", "827" ], [ "As I wrote in an answer to your previous question, I think a short paper is fairly useless in terms of CV building, so a B+ conference would presumably be more valuable. I don&#39;t know your concrete examples, so it&#39;s hard for me to tell how these \" ;B+ \" ; conferences would appeal to a grading or hiring committee.\r\n\r\n > Also, is it necessary to emphasize in the CV whether the papers were accepted as a full or short version?\r\n\r\nIn my opinion it is, if you like being taken seriously. I am currently in a hiring committee, and I see *many* candidates passively or actively hiding the fact that some of their papers have been in side or short paper tracks rather than at the main conference. This never works, because I will (for all good candidates) actively seek out their best papers to look at them (not necessarily to check if they are full papers, more because I want to see what kind of research the candidate does). If I then find that what I thought was their strongest paper is actually some short paper, my opinion of the candidate deteriorates quickly.\r\n\r\nIn my experience having your lesser works blend in with your most important papers actually works against you - you presumably have a limited number of papers that you actually want people to check to get an impression of you as a researcher, and having your weak work mingle with your best work is detrimental to this goal. Nowadays I actively highly the < 10 best works in my CV, to make sure an evaluator understands which papers I consider to be the best representation of the work I want to do.", "304" ], [ "@AustinHenley I have seen exactly the same at top software engineering conferences. A good chunk of poster / short papers are actually rejected full papers that got rejected at the research track and got \" ;invited \" ; to publish a reduced version as short paper or poster. OP&#39;s original questions sounds exactly like this case, and I can assure you that people will not see these as equivalent in quality to the full papers.", "827" ], [ "The sad reality is that the answer to * \" ;should I appeal about a journal decision \" ;* is always * \" ;no \" ;*. Cut your losses and move on. In your case, this means submitting again to a different journal. Given that the reviews were fairly positive I would not downgrade the venue, I would just try a similarly-competitive journal again. Any issues that the reasonable reviewers brought up should of course be fixed. If possible, I would see if the paper could also fit a slightly different community, to lose the weird academic stalker that your paper seems to have picked up.\r\n\r\nAlso, if you can afford it, never submit to this journal again, because this certainly does not seem like something an ethical academic journal would pull. An editor in a strong journal certainly does not hide behind \" ;informal feedback \" ; and fuzzy, undisclosed methodological problems. Note that this does not mean that a good journal never rejects papers despite positive reviews, but if they do that the editor should take responsibility and clarify why the paper is rejected (even if the reason is just \" ;the paper is good, but I think not high-impact enough for our grand journal \" ;).", "827" ], [ "@Bob Also, acceptance rates can be very deceiving. You need to know what is *submitted* to a conference or track to say whether a specific acceptance rate is good or bad. I know one notorious conference which has always had an acceptance rate of about 16%, and the papers are generally not great. Contrary, FSE, an A* conference, usually has acceptance rates of 20+%. The difference is that most people don&#39;t even *try* to submit horrendous papers to FSE, while everybody seems to submit every crap they have to the other conference.", "76" ], [ "In your case, what&#39;s wrong with a decision along the lines * \" ;This is a good paper (see reviews), but the following ethical concerns have come to our attention: X, Y. Consequently, we are unable to accept this submission. \" ;* To me, \" ;sources we trust say that at least one co-author does not approve of the submission \" ; is a perfectly valid reason to reject. Why is there a need to not tell the authors why their paper was rejected?", "827" ], [ "I have seen TAs do this, but generally don&#39;t ask my own TAs to do it. As you say, it&#39;s a (very) time-consuming way to solve the coordination problem. I personally prefer to just sit with the TAs for a few minutes ( < 30 minutes) every so often to coordinate, which in my experience has been completely adequate. Of course this means that I have to invest a little of *my own* time, but I find it completely appropriate to invest a few minutes of my own time every so often to save my TAs quite a lot of time - but of course your milage may vary with other professors. I certainly wouldn&#39;t find it strange if a TA sat in the lecture, I just don&#39;t find it necessary.\r\n\r\nHowever, I *do* strongly suggest that the TAs take some time to go over the teaching material, so that they get a sense for what I am covering in the lecture, and how far I have gotten by the time their tutorial or supervision session rolls around.\r\n\r\nFinally, we have also used a joint Slack channel where TAs can ask questions and expect a fairly immediate response. This has been useful for me to communicate if I, for instance, needed to skip a section due to time reasons, or if I felt through in-class exercises (or blank stares) that a certain topic needs deeper exploration in the supervision sessions.", "197" ], [ "All the existing answers point in the same correct direction, but are in my opinion *too mild*.\r\n\r\n**This is an horrendous idea. Don&#39;t do it.**\r\n\r\nIt&#39;s irrelevant whether your chair / department / university / funding source formally allows it. It does not matter if your family member is the most qualified candidate. You *will* run into suspicions of nepotism, which are virtually impossible to ever fully get rid of. People will talk. You don&#39;t want any of that at a place that you quite likely will spend the rest of your working career at, and you *most definitely* don&#39;t want any of that so early in your career and prior to getting tenure.\r\n\r\nIf your family member is qualified and in need for a job like this, strongly recommend them the next time of your colleagues is hiring for a similar role. Don&#39;t take them on yourself.", "605" ], [ "<PERSON> I don&#39;t understand this reasoning. <PERSON> did not propose to clean up the code for the authors and send a pull request, he only suggested to provide actionable feedback rather than just saying the code is messy and needs to be improved. If we go by the reasoning that we can&#39;t give any helpful feedback at all, we could get rid of peer review and just do yes/no decisions on papers.", "84" ], [ "I don&#39;t think this is a bot. It looks more like a (somewhat misguided) real human, who may or may not be operating under a pseudonym. Based on what I think is their [LinkedIn profile][1] they seem to be a reasonably well-educated person with extensive experience working for IBM (or so they claim), so not your average [crank][2]. That said, their contributions to vixra seem fairly cranky to me, especially since said contributions mostly consist of extensive compilations of existing material, without a lot in terms of attribution. \r\n\r\nNote that there is also a [website][3] apparently written by a \" ;Rich <PERSON> \" ; praising <PERSON> as * \" ;a mouthpiece of the possible \" ;*. <PERSON> claims to be an \" ;artist \" ; of some sort, who has also written some books published by \" ;Standing Dead Publications \" ; (owned by <PERSON>). The over-the-top praise, strangely flowery language, and the unstructured list of what appears to be pretty much the entirety of <PERSON> work makes me think that there is a connection of some sort between <PERSON> and <PERSON>. Maybe they are the same person, but it may also be a case of a fringe artist being intellectually attracted to a fringe scientist.\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_1_\r\n [3]: _URL_0_", "135" ], [ "Exactly. This is not a typical example, but was created to serve a specific need: so that we don&#39;t have to answer each \" ;how do I get admitted \" ; question individually. I can see having a similar question for the UK, but that only makes sense if the answers would be substantially different to the US version. I personally don&#39;t think this is the case, but I don&#39;t know the UK admission system enough to be able to tell.", "727" ], [ "It depends on the conference or workshop, of course. In my field (Computer Science), it is uncommon but not unheard-of for workshops to have what is called \" ;post-proceedings \" ;. That is, authors submit an initial version of their manuscript, present at the workshop, and then have a chance to revise for the actual published paper. In this case it is possible, maybe expected, that you actually improve your paper based on the comments you received (although usually no additional review happens at this point).\r\n\r\nHowever, most venues don&#39;t have that. The more usual case is that you submit a paper and the proceedings are already published when the conference starts. In this case, you obviously have no chance to revise your paper, because by the time the conference happens the paper is already available on archival sources. The advantage, of course, is that the paper is available for people to read during, or even before, the conference.\r\n\r\n > Aren&#39;t workshops/conference mechanisms to get feedback? \r\n\r\nFor conferences in CS, this is most certainly *not* what conferences are for. In this field, conferences are a means to *communicate* the result of finished studies, not to get input on how to do them. Sure, you can get ideas for future work, but it will pretty much by definition be too late to change what you have already done. For workshops, things are a bit muddier, but in practice authors usually use the feedback they receive at workshops to improve the larger study that they are usually working on (which will be submitted to a conference or journal), not so much to improve the workshop paper itself.", "827" ], [ "I wholeheartedly agree with JWH2006 that you should not immediately jump to assuming malice, but instead of forgetfulness the root of the issue could also be a *misunderstanding*. You don&#39;t really provide enough details that this can be judged by us, but often I have seen \" ;verbal agreements \" ; that both sides understood quite differently. For instance, you may have asked for \" ;help with finding a postdoc position \" ; and expected that your advisor would poke his colleagues, sit down with you and prepare your application material, and train you for the interviews, while he thought it just meant writing a nice letter for you. That is, maybe you are in a situation where your advisor *thinks* they are doing everything they agreed to do, while you see it has them reneging on their promise.\r\n\r\nThe solution to this problem is similar to what JMH2006 proposed - contact them and ask, very concretely, what kind of help you would like to get. Never go into accusations that they broke their promise (this won&#39;t end well, *especially* if they think they actually did everything they promised to do). Maximally, I would remind them of all the unpaid help you did for them, but more in a \" ;I did a favor for you, can you please do a favor for me now \" ; way, again not in an accusatory way.\r\n\r\nIf, after that, they still maintain that they can&#39;t or won&#39;t provide whatever help you feel you have been promised, I suggest the <PERSON> option. You realistically have no leverage to enforce the deal, and there is no way that pressing the issue will bring you good mentoring (or goodwill for your upcoming thesis defense, for that matter).", "605" ], [ "Not sure I understand. In Europe it&#39;s fairly normal to hire people onto tenured positions if they have already proven themselves elsewhere. Or at least they are given special positions where they, for instance, hold a full professorship which is initially time-limited to 5 years with a lightweight review at the end to convert into a regular position. If a person who is tenured elsewhere is expected to downgrade to an Assistant Professor again I can understand why many people assume that it is hard to move after tenure.", "906" ], [ "**Answer 1:**\r\n\r\nAsk for explicit feedback (maybe after the deadline is passed and crunch time is over). Giving feedback on your work is part of the implicit deal that a senior person enters when enlisting the help of a PhD student on things like that.\r\n\r\n**Answer 2:**\r\n\r\nIn addition, *re-engineer* what they did to your text. You sent a full page of content and little of it made the cut. That is valuable information: apparently your text was, for one reason or another, not suitable. Read *very* carefully what the seniors decided to write instead: did they focus on different aspects? is their writing more polished in terms of language? is the tone different? was your original draft not aligned well enough with the rest of the proposal? is there anything else that reads notably different?\r\n\r\nWhat I did when I was learning the ropes (actually, I still do this sometimes when I work with somebody better than me at grant writing) is to very carefully re-construct how they build their argument, what they write, and what they *don&#39;t* write. If in doubt, I ask them directly, but I feel the exercise of figuring this out myself is a better learning experience than simply asking for feedback.\r\n\r\nAnother thing to keep in mind of this happens regularly is that maybe you need to ask more, or better, questions *before* starting to write the text. If the PI asks you to write about related work, discuss in advance what fields you should cover and in what detail. If you should describe a specific work package, run your thoughts on what it should entail briefly by the PI before writing it all down. A quick meeting is usually more productive than multiple iterations of text writing, and being efficient is usually very important when writing a grant.\r\n\r\nFinally, figure out whether *anything* related to your text actually made the cut. Sometimes, one just finds out when putting it all together that a specific section that sounded like a good idea during planning simply does not fit the proposal after all (for content or space restriction reasons). This is unfortunate, but still happens sometimes. In that case, maybe your writing was perfect, but your section simply still did not make the cut. In this case, move on.", "605" ], [ "Let me be clear: **you don&#39;t want to move back into academia; you see academia as a stepping stone in a lateral move to a different country.** I think this difference matters, because most of the conventional problems that people have when moving back into academia (is my track record good enough? are my connections still active? etc.) don&#39;t apply to you, given that you already have an offer. For your ultimate goal it matters little if you are successful or not in your postdoc. Consequently, I am not sure what good advice we can give you: if you want to move to the US, and this is a way to move to the US, what more is there to say?\r\n\r\n-----\r\n\r\nThat said, I can&#39;t help but wonder if there are not much more direct ways to achieve what you try to achieve. If you are employable now for an US company, can&#39;t you find a job remote and move directly to industry? If you are *not* employable for an US company, will a postdoc really change this? If you don&#39;t mind a pay cut, would an internship not be a better way to get into companies? Have you fully understood the visa implications? What will you do if at the end of your postdoc no industrial positions are forthcoming?\r\n\r\nAll in all, this seems like a fairly contrived way to achieve your goal. I am not saying it&#39;s necessarily a bad idea (there may be industries were \" ;being around \" ; is required for job hunting, although my field - IT - is certainly not one of them), but it feels you should still explore alternatives before committing to this plan.", "906" ], [ "I am not sure what you are asking. Hard-money faculty, soft-money staff (i.e., temporary contracts), and peripherals are usually funded from completely different types of funds. An university cannot decide to hire more hard-money faculty rather than temporary staff because for the former they need to guarantee funding long-term, while the latter comes from projects which may only exist for a few years. A new building is an investment that you have to do every so often, because at some point your old building just isn&#39;t good enough anymore.", "906" ], [ "This seems like an unreasonable request. Frankly, it *does not matter* if you paper has been proof-read by a native speaker or not. If, after revision, your English presentation is still bad, the editor won&#39;t accept it even if you include proof that it was read by a native speaker.\r\n\r\nI would personally be prone to just ignore this request, make sure that the English language is as good as it can be, and resubmit the paper.", "827" ], [ "Get counselling. Really.\r\n\r\n**There is no shame in that**, and you don&#39;t need to have full-blown burnout to get support from a therapist.\r\n\r\nAside from that, what has worked for me is to schedule private things I like to do (including simple and \" ;obvious \" ; things, such as spending time with my family, watching TV, playing video games, etc.) in exactly the same manner as work tasks. At the very least this makes it explicit that you are actually making a trade-off when you burn the midnight candle at work. Keep in mind that, hopefully, other non-work things are important to you as well, so if you decide to burn 20 more hours on a paper that&#39;s basically done you are effectively trading off one thing you want to do for another. If you look at it this way it basically becomes an optimization problem - do I really want to proof-read this paper three more times to make sure that there are no typos in it, or do I rather want to spend this time on something else that is also important to me?\r\n\r\nA second thing I do is rigorous time keeping and time budgeting. I actually learned this during the teacher&#39;s seminar that our university mandates for all tenure-track faculty, but it&#39;s actually applicable to all aspects of academic work. Basically, one can always invest an infinite amount of time into every activity, so it is important to assign a budget of how much time one practically has for a specific activity (say \" ;I can only spend 6 hours to prepare a single lecture \" ;), and then do the best that is possible in that time. This may mean that you can&#39;t make the fancy flipped classroom work that you had in mind, or it may mean that this really interesting data analysis will need to wait for the next paper, but time is finite and ultimately a great paper that is never submitted is worse than a good paper that is.\r\n\r\nBut, again - if you feel like you can&#39;t bring yourself to make these trade-offs on your own, get **professional help** before you burn out completely and/or drop out of academia.", "605" ], [ "Yes, this is completely ok, even recommendable. You want your letter writers to know how you function in a research context. It does not matter if this was as part of a university research project (such as a thesis) or some other project that you worked in for some reason.\r\n\r\nThe main reason why most applicants use their former research advisors is because this is the primary way how undergrads get in touch with professors in a research (as opposed to a classroom) context.", "605" ], [ "@BalazsToth Yes, with reservations. I think for people who are just feeling a \" ;normal \" ; amount of stress family support works well, but if you start to cross over into clinical mental health issues (which may or may not be true for OP, obviously) you really, really need professional support, not the advise of family (or random strangers on the Internet). \" ;Common sense advise \" ; is really dangerous when dealing with clinical levels of stress.", "916" ], [ "An important concept that every aspiring writer should be aware of is [Genre Theory][1]. Genre Theory deposits that for every field and purpose, one or multiple different \" ;genres \" ; (types of text pieces) exist, each geared towards a specific audience and with a structure that has emerged to serve a specific purpose. Writing a thesis proposal in your field is one such genre. Before writing, it is key to understand what exactly your genre is. This includes:\r\n\r\n - The typical outline (not just the section headers, but what *content* and line of argument is actually expected below each header)\r\n - Typical terminology and phrasing\r\n - The purpose of the text\r\n - The target audience\r\n\r\nThe best way to understand your genre is through text analysis. Go over existing proposals (both, good and bad examples can be useful), and carefully examine not only what they write, but also how the argument is structured, what recurring phrases there are, in which order content is presented, and towards what audience they write.\r\n\r\nIn your case, it sounds like you have some misconceptions regarding, at least, the target audience and purpose of the text. A thesis proposal is *not* written for the general public. The goal of such a text is not to communicate to the general public, but to your advisor and/or committee.\r\n\r\n [1]: _URL_0_", "827" ], [ "It&#39;s a common problem, not only in mathematics but in all fields of research. Oftentimes, we feel that there *should* be a term to describe a specific concept or method, but we sure don&#39;t know what it is or how to find it if it exists. Scouring the literature for a term we don&#39;t know is very difficult, if not impossible, as long as we don&#39;t have at least a direction to look for.\r\n\r\nBasically, the best thing to do in that case is to do due diligence (e.g., ask colleagues in a suitable field, look over papers that you suspect may have used this concept or method, check some text books), but if that ends up being unfruitful you can either coin your own term or not use a specific term at all. For the former, an academic&#39;s favorite cop-out phrase ( \" ;to the best of our knowledge ... \" ;) may come in handy.\r\n\r\nThe good news is that, if an established term actually exists, you may very easily be pointed towards it during peer review.", "76" ], [ "How well do explicit Runge-Kutta \" ;tableau \" ; methods compare to the state of the art ODE solvers and when do they fail? I&#39;ve been reading Butcher&#39;s ODE book and he does a good job at introducing tableaus to represent different Runge-Kutta methods. This includes methods with built-in error estimates for adaptive steps sizes like <PERSON>, <PERSON>, or Dorman-Prince. \r\n\r\nWhat I don&#39;t understand is how these methods compare to the current state-of-the-art in ODE solvers. Are these methods ever really used or are they simply discussed for historical reasons? If they are used, what&#39;s their general limitation or domain of use?\r\n\r\nAs a minor aside, I noticed that [DifferentialEquations.jl][1] appeared to implement just about every known tableau method. That said, they don&#39;t appear to be the default methods used, which also caused me to question whether or not they&#39;re still of modern use.\r\n\r\n\r\n [1]: _URL_0_", "767" ], [ "@DavidKetcheson Sorry for the confusion. I&#39;m unfamiliar with these methods and it&#39;s not my intention to minimize their impact. <PERSON> made a nice figure on page 90 of his book of different strategies for ODE solvers such as using past values (multistep), more calculations per step (Runge-Kutta), y derivatives (Taylor series), or f derivatives (Rosenbrock). He also introduced Almost Runge-Kutta (ARK) that appeared to be a hybrid method. I&#39;m trying to understand whether taking RK coefficients and implementing them directly is &#39;good enough&#39; or if there&#39;s some trick or hybrid that&#39;s better.", "767" ], [ "These central repositories exists - they are called a (digital) library. What we typically mean with \" ;doing literature review \" ; is going into one or more digital libraries and retrieving all information on the subject. Given how heterogenous research questions, approaches, and scientific results are, it seems fundamentally impossible to provide much more structured information than that across disciplines. That said, for some fields (notably medicine, as I understand it), more fine-grained repository structures have emerged, which allow researchers to query for specific data sets etc.", "76" ], [ "I did not find the question particularly unclear, but there were certainly some problems that led to it getting closed. A wish of our members to censor this discussion was certainly not one of them, as we have many questions in similar spirit that were highly upvoted:\r\n\r\n - It&#39;s a duplicate. Notably [this question][1] contains more or less the same discussion.\r\n - It sounds like a discussion prompt rather than question with a clear answer. Stack Exchange is not a discussion forum, and questions in the style of * \" ;I identified this problem with academia, what can we do? \" ;* are not in scope of this website.\r\n - Somewhat relatedly, it probably triggered the \" ;rant alarm \" ; of many of our community members. In this Stack Exchange, many members are wary of questions that are asked in bad faith, or meant to provoke or trigger discussions. Again, Stack Exchange is not a discussion forum. It&#39;s simply not the right place to brainstorm alternative ideas to academic publishing. It certainly *is* the right place to ask why the publishing model is the way it is, as the question linked in the first bullet item shows, but your question did not sound like that.\r\n - You are asking a number of questions at the same time. The question of why to choose a journal over arxiv has already been answered, but you also ask about publishing a blog post instead. You also ask why it&#39;s not better to not care so much about scientific rigor and try to get it out of the door quickly, and there is also something related to IPR and patenting in there. The Stack Exchange model really only works well if you ask one, fairly narrow and specific, question at a time. \r\n\r\nIt&#39;s an unfortunate reality that one really should not read too much into the specific closing reason here. Oftentimes, what exact reason the community members choose to close a question on is a bit random. Going over the comments in the question (or asking a meta question, as you have done) is more instructive in learning how the question can be salvaged.\r\n\r\nFurther, note that putting a question on hold does not mean that people want to kill it with fire. It purely means that we think the question needs some editing before it becomes a good fit to the site. Oftentimes, fairly small editing to the question is sufficient to bring it in scope, at which point it will be re-opened.\r\n\r\n [1]: _URL_0_", "862" ], [ "In addition to Buffy&#39;s answer, another important aspect to consider is whether you expect to be paid for this research assistantship. At least in the universities I have worked at, it&#39;s fundamentally impossible to hire a student who is, and wants to remain at, a different university. There are so many administrative procedures and details that would need to be sorted out (will they pay out the money or send it to your university, which then handles payment? will their university pay overheads to your university to cover your workspace and other utilities? how will taxation work? etc.). Further, my impression is that administrators may also not be happy about it in general, as it would feel like university money is being drained to support research elsewhere.\r\n\r\nThat said, an acquaintance in the US actually sat up a paid undergraduate research programme with India, where the undergrads were hired in and stayed in India for the duration of the programme (with remote supervision and one or two on-site visits of their mentor). But this was a significant administrative process, and he ended up funding it entirely through external sponsors. It is unlikely that this could be set up on an individual basis for just one student.", "906" ], [ "The work mode of an industry lab (or, even worse, of a group of day-to-dat software engineers in industry who just happened to become involved with a paper) is typically different to your average academic lab. To wit:\r\n\r\n**Academic project** (simplified, of course):\r\n\r\nSomebody (a PI, the student themselves, or somebody in between) has an idea for a research paper. A person (often, but not necessarily, a student) takes responsibility for executing it, and collaborates with their advisor and, maybe, one or two other students on executing it. Importantly, for this \" ;driver \" ; of the project it is usually of high importance (because it goes into their thesis in the case of a student), and they invest a significant portion of their time on it. The other collaborators usually only invest time in specific roles (giving feedback, doing specific analyses, helping with paper writing, etc.). In short, there is often *one person responsible for bringing the project all the way*.\r\n\r\n**Industrial project** (particularly in the case when a software company is reporting on aspects of their practice, as in many of your examples):\r\n\r\nSomebody (often a member of the research division of the company, sometimes an academia-affine practitioner) has an idea for a paper. They start working on it, but they *cannot* commit more than a fraction of their time on it (because even for industrial researchers, writing papers is often much less a core focus of their job profile than for students or academic staff), so they gather collaborators, who likewise cannot put more than a few hours here and there on the project. Additionally, for such \" ;report of a practice \" ; kind of papers, *many* people have typically contributed to establishing the practice, and it is bad tone to leave out key players (unless they don&#39;t want to contribute to the paper). In short, while there may be a coordinating person as well, nobody really has the time to work on this paper full-time, and many people have somehow contributed to the work being reported on, so automatically the author list swells.\r\n\r\n**TL;DR:** results in industrial practice are often much more of a product of team work, rather than the \" ;every student works on their own thesis \" ; model that we usually have in academia. This is also reflected in the length of author lists.", "76" ], [ "As somebody who has, for years, hosted assignments publicly I feel that you are *vastly* overestimating the threat case here. If all you do is make your assignment and material public on GitHub, it is *extremely* unlikely that somebody will just browse by, do it out of fun, and then make the solution available to your students.\r\n\r\nI often analyse GitHub data as part of my research, and the number of repositories out there is downright staggering, and by far most of them get no traction at all. In order to make a repository visible, quite a bit of active marketing is necessary. If you don&#39;t go out of your way to advertise your assignment, and if your assignment is not somehow extremely intriguing so that a random developer would really *want* to work on it, it is very likely to just sit there, all in the public, without getting any kind of attention at all.\r\n\r\nAdditionally, even if somebody would solve your assignment and make a solution public, so what? You presumably do some sort of plagiarism check on the solutions your students submit anyway (otherwise, how do you ensure that different students or teams did not copy from each other?) - this is just one more existing solution to compare your student&#39;s solution to.\r\n\r\nIn my experience, by far the most \" ;rampant \" ; type of cheating is student teams copying from each other, and this is really unaffected by how you decided to host your assignment.", "605" ], [ "I think you are reading this wrong. It&#39;s not that you are not *allowed* to make something open access before this time span, it&#39;s that you *have to* after it when public money has been used. This is called [Delayed Open Access][1] (thanks to <PERSON>, who mentions this in a comment).\r\n\r\nSpecifically note that the journal is free to open up the paper earlier:\r\n\r\n > The publishing contract may provide for a shorter period than that set paragraph 1.\r\n\r\n(for instance, if you paid the open access fee). I think the most salient point is this:\r\n\r\n > The right provided for in paragraph 1 can not be waived.\r\n\r\nThat is, you cannot sign a copyright transfer to a closed-access journal that gives them the right to not make it open access even after the closing period is over.\r\n\r\nIf you are asking why they don&#39;t require immediate open access, you are back at Najib&#39;s answer - publishing is a business, and presumably the Belgian legislation has decided that Delayed Open Access is an acceptable compromise between the publisher&#39;s interests and the public&#39;s interest in free access to scientific information.\r\n\r\n [1]: _URL_0_", "827" ], [ "I don&#39;t think it matters so much *where* you mention your potential advisor, as long as you do it **very, very prominently**. From what I understand the fact that you already have an advisor in mind is a key fact in the application procedure, and you should never assume that the evaluation committee reads your letter with care. That is, format / write it in a way that even an evaluator who only glances over your letter will understand this fact.\r\n\r\nWith that in mind, I suggest to bring up your advisor (at least) in your cover letter, in the introduction, and maybe in the conclusions of your research statement. You don&#39;t need to be heavy-handed about this - it is ok if you add something along the lines of \" ;I am very much looking forward to work with Prof. <PERSON> on Y \" ; in a few places, although at least once in your statement you probably want to have a small dedicated paragraph where you discuss that you have been encouraged by Prof. <PERSON> to apply to work with them.", "605" ], [ "@ArnaudD. You are right about the whole <PERSON> thing. I just deleted this part of the answer. As for the rest, I have re-read the English translation, and I still can&#39;t see how the text can be interpreted in the way that you and <PERSON> did. Granted, it&#39;s possible that the translation is wrong in a key way, but from the English text I really can&#39;t see a requirement to wait for a specific time until open access is granted.", "755" ] ]
25
[ 11570, 2365, 3947, 19393, 17347, 17276, 12460, 11541, 16191, 10936, 18224, 12177, 12679, 7794, 19295, 19264, 14315, 10742, 17745, 503, 906, 2601, 11377, 14345, 16702, 5148, 11848, 4031, 17207, 1171, 7910, 18139, 500, 5295, 12381, 6759, 1041, 18138, 15768, 9456, 6171, 18396, 14276, 1021, 6484, 17421, 19251, 18713, 19177, 310, 3563, 3112, 559, 2073, 850, 17226, 19579, 3347, 7546, 18259, 1640, 2828, 13523, 9688, 16373, 7350, 18391, 1950, 1501, 16833, 1453, 13522, 19311, 10297, 98, 9116, 18608, 2123, 5885, 15924, 10584, 4078, 5132, 530, 2514, 7519, 678, 15212, 19004, 4153, 9143, 19297, 3403, 1393, 1827, 17823, 602, 2517, 11513, 7502, 19230, 1207, 11156, 2332, 11841, 2890, 19706, 7896, 12331, 15767, 15934, 1503, 10527, 10202, 1876, 19112, 13183, 6183, 3793, 11843, 4982, 1801, 5893, 4578, 8558, 18501, 5037, 10276, 9716, 4033, 18039, 8429, 16576, 1345, 10966, 15550, 18526, 4348, 11171, 16245, 9279, 15647, 18805, 6898, 3500, 10470, 476, 1239, 8825, 7655, 2793, 10536, 8913, 9006, 5308, 6946, 3275, 11997, 1979, 7778, 6717, 17410, 17697, 811, 8263, 15819, 11465, 18658, 7283, 15088, 16168, 18748, 15893, 4516, 10556, 8949, 18105, 1527, 949, 10328, 14166, 7296, 141, 18848, 16089, 4626, 4509, 8163, 6353, 6452, 6940, 213, 19458, 8150, 4864, 3796, 18453, 4690, 18353, 10046, 1800, 12328, 18094, 15374, 12711, 19151, 8715, 5968, 9574, 17186, 9303, 682, 16012, 3109, 5397, 2172, 16489, 18677, 13486, 1035, 16466, 7493, 18829, 6617, 12222, 4291, 9730, 19353, 16133, 3928, 9401, 18527, 3957, 2038, 17912, 7696, 12112, 16617, 4001, 1554, 575, 17323, 1114, 17608, 16261, 17557, 1360, 9779, 13422, 15923, 7574, 6459, 18523, 16152, 11229, 640, 12223, 14467, 18786, 19285, 3565, 7132, 3627, 16287, 9845, 19747, 6275, 13400, 9547, 19313, 19753, 9697, 5075, 7932, 11476, 14599, 883, 3240, 18220, 12148, 13379, 206, 297, 5572, 17356, 10991, 7115, 16443, 17621, 17062, 10734, 15438, 8948, 10844, 7072, 812, 3984, 14814, 15500, 18314, 17047, 11046, 2101, 1813, 7445, 3116, 8216, 19160, 19420, 18765, 3880, 710, 8559, 13285, 2006, 6396, 16318, 17984, 15814, 2227, 8326, 3557, 2, 6775, 9612, 6036, 9350, 14953, 1772, 6864, 6398, 14048, 2784, 4932, 18821, 3466, 15360, 7665, 1986, 16262, 18119, 14234, 16504, 10095, 10420, 11177, 2622, 5864, 4226, 3373, 18967, 18836, 5311, 5122, 19493, 13869, 2717, 19544, 9961, 13008, 13163, 9701, 364, 2770, 9866, 10075, 16309, 18272, 1957, 8988, 17694, 714, 19414, 468, 1992, 558, 6790, 16082, 5856, 9198, 9997, 14269, 1292, 16886, 2757, 767, 8322, 3202, 9950, 12316, 4272, 19555, 15886, 19048, 11685, 4068, 15719, 17050, 1786, 19530, 2397, 11245, 16788, 1701, 1802, 7415, 7153, 4655, 4120, 5519, 16311, 6127, 11986, 4745, 19580, 14886, 4420, 3514, 430, 5052, 5007, 16924, 18498, 19152, 10695, 7742, 13355, 12715, 887, 3208, 1771, 7882, 5277, 18709, 19398, 12479, 536, 3415, 4461, 1051, 13069, 5605, 15522, 3236, 3838, 4250, 12120, 12802, 12255, 4900, 14424, 17155, 2561, 19759, 5377, 4470, 10272, 16431, 8755, 8560, 8928, 13942, 17945, 12221, 16259, 3639, 14856, 12758, 10121, 6416, 3488, 16485, 9921, 2140, 13623, 16542, 9569, 16533, 17346, 13871, 18524, 15868, 5764, 13774, 9342, 12530, 4817, 806, 378, 18369, 6530, 5669, 19545, 18090, 3312, 8344, 16134, 6834, 17750 ]
STX_100940.0
[ [ "There is sometimes a grey area between \" ;home drive \" ; and the user \" ;profile \" ;. These are a few environmental variables to keep in mind:\r\n < pre > \r\n < b > User with \" ;network \" ; home drive AND a \" ;local \" ; profile < /b > \r\nHOMEDRIVE=Y:\r\nHOMEPATH=\\\r\nUSERPROFILE=C:\\Users\\Snoopy\r\nHOMESHARE=\\\\SERVER\\Home$\\Snoopy\r\n\r\n < b > User with \" ;network \" ; home drive AND a \" ;roaming \" ; profile < /b > \r\nHOMEDRIVE=Y:\r\nHOMEPATH=\\\r\nUSERPROFILE=C:\\Users\\Snoopy\r\nHOMESHARE=\\\\SERVER\\Home$\\Snoopy\r\n\r\n < b > User without \" ;network \" ; home drive < /b > \r\nHOMEDRIVE=C:\r\nHOMEPATH=\\Users\\Snoopy\r\nUSERPROFILE=C:\\Users\\Snoopy\r\n < /pre > \r\n\r\nNotice that: < br > \r\n1) USERPROFILE is the same for all 3 user types < br > \r\n2) For a user WITHOUT a network home drive, the USERPROFILE is the same as the (Homedrive + Homepath) and that there is no \" ;HOMESHARE \" ; envar. < br > \r\n\r\nThere are 3 kind of profiles: local, roaming, mandatory. < br > \r\nAll 3 varities of windows profiles use a local profile path, but they each use it in different ways. < br > \r\nEven for users with roaming profiles, USERPROFILE is still always C:\\Users\\... < br > \r\nFor all these reasons, you cannot prevent the creation of C:\\Users\\Name. < br > \r\n\r\nYou can control the default path for \" ;cmd \" ; (on a per shortcut basis) by setting the \" ;start in \" ; option of the cmd shortcut, or for all cmd the user starts by setting a registry key:\r\n\r\n GPO path: UserConf/Prefs/Windows/Registry\r\n Key = HKEY_CURRENT_USER\\Software\\Microsoft\\Command Processor\r\n Type = REG_EXPAND_SZ\r\n Name = Autorun\r\n Value = CD /d %HOMEDRIVE%%HOMEPATH%\r\n\r\n[![cmd Start Path][3]][3]\r\n\r\nYou can use GPO&#39;s to redirect any of the \" ;MyX \" ; folders to a network path, so that clicking on a MyX item in a file dialog goes to that path, but if someone manually navigates to C:\\Users\\Name\\somePlace nothing can or will stop them from writing to the local path.\r\n\r\n MyDocuments folder redir:\r\n GPO path: UserConf/Policies/Windows/FolderRedir/Documents\r\n\r\nEvery group policy has 2 branches: computer, user. < br > \r\nYou don&#39;t want to use the COMPUTER branch to control USER home drives. \r\nI think your \" ;Computer/.../Set user home folder \" ; GPO may be causing your Y back to C problem.\r\nYou don&#39;t need to use GPO to map the home drive letter. It&#39;s best to control that with user account properties, and when done that way, its mapped automatically by the OS.\r\n\r\n PS C:\\ > set-aduser snoopy -homeDrive \" ;Y \" ; -homeDirectory \" ;\\\\server\\home$\\snoopy \" ;\r\n\r\n[![user Home][2]][2]\r\n\r\nRegarding your \" ;asynchronous \" ; goal - Some of the files within your profile (ntuser.dat) are locked while logged in and can only be copied during the login/logout process. < p > \r\n\r\n [2]: _URL_0_\r\n [3]: _URL_1_", "740" ], [ "Sounds like this hotfix may help you\r\n_URL_1_\r\n\r\nAssume that you&#39;re running Microsoft DNS Services on Windows Server 2012 R2-based computers in an Active Directory Forest. You notice that the DNS service on Windows Server 2012 R2-based DNS servers consumes increasing amounts of memory, and then memory leak occurs. Additionally, the memory leaks by DNS may affect the performance of other components, services, and applications that are running on the same computer.\r\n\r\nDNS hotfix has this prerequisite\r\n_URL_0_", "160" ], [ "You can also distribute certificates to the trusted roots store (and other stores) via GPO. Using this method has the advantage of the proper certs being in place on new machines as they are built and joined to the domain.\r\n\r\nRight click the store name, import the public key file, link the GPO, wait 90 minutes for GPO to refresh on the targets.\r\n\r\n[![GPMC][1]][1]\r\n\r\n\r\n [1]: _URL_0_", "11" ], [ "Kerberos depends on time being in sync. Are you sure the time & date are both correct? I&#39;ve seen problems where hours & minutes are correct, but people overlook the date part which is not correct.\r\n\r\nFrom comptuer1 invoke\r\n\r\n w32tm.exe /stripchart /computer:computer2 /samples:1 /dataonly\r\n\r\nIt will report the clock difference between the two machines. < br > \r\nSounds as if you have a GPO to disable registry mods? What else is in this GPO? Anything to restrict file sharing? If you a some kind of lockdown GPO, remove it and see if that is causing the problem. < br > \r\nWhat are the results of \" ;dcdiag \" ; from each server? Edit original post to show the results.", "518" ], [ "You can do this if you enable the Software Inventory function in your client settings.\r\nBy default SINV disables scanning of < code > C:\\Windows < /code > so you need to re-enable the Powershell path < code > %windir%\\System32\\WindowsPowerShell\\v1.0 < /code > < br > \r\nAfter that, you can create Queries or Collections that leverage the \" ;Softare Files \" ; attribute class to see what you have. So far I&#39;ve mapped out the following values & version numbers.\r\n\r\n v1,2 Less Than 6.2\r\n v3 Like 6.2.%\r\n v4 Like 6.3.%\r\n\r\n[![Clientsettings][1]][1]\r\n[![ClientSettings2][2]][2]\r\n[![QueryCriteria][3]][3]\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_\r\n [3]: _URL_2_", "651" ], [ "I&#39;m unaware of a way to do that with WMI, but you can use the reporting functions of SCCM to get the same info. < br > \r\nNavigate to < code > \\Monitoring\\Overview\\Reporting\\Reports\\Software Updates - A Compliance < /code > \r\nLaunch the < code > Compliance 5 -Specific Computer < /code > report. Fill out the fields. Sort on the < code > Installed < /code > column.\r\nStar(*) in the column means it has been installed, blankSpace in the column means its missing. For some reason they did not use True/False for column values.\r\n\r\n[![reports][1]][1]\r\n[![c5sc][2]][2]\r\n[![details][3]][3]\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_2_\r\n [3]: _URL_1_", "859" ], [ "The nameserver/dc is in \" ;_URL_1_ \" ; zone, but the image is showing us the properties for the \" ;_URL_3_ \" ; zone. < br > \r\nDid you edit any of the names in the image you posted? < br > \r\nHow many forward lookup zones exist on the server, and what are they? < br > \r\nHow is DCDIAG failing? If you&#39;re experiencing other system issues that prevent that command from running, those issues may also be causing DNS to not operate normally.\r\n < p > \r\nI don&#39;t recall if the IP on that tab comes from the A record directly or through the NS record (and then the A record).\r\nWhen you&#39;re experiencing the problem, what is returned by these commands?\r\n < code > \r\nnslookup -type=NS _URL_3_\r\nnslookup -type=NS _URL_1_\r\n < /code > \r\n < p > \r\nIs this OS 2012 R1 or R2? < br > \r\nIs the DC name the only name that sometimes has a resolution problem? < br > \r\nIf many names fail after a time, and OS is 2012 R2, your DNS service may be dying due to a memory leak.\r\nSee the following: < br > \r\n_URL_0_;\r\n_URL_2_\r\n < p > \r\n**Edit Dec 03** < p > \r\nYou seem to have a hard disk controller problem that needs attention. I would fix that first. Did your DNS problems start around the same time those errors started? Review system log for controller error history. < br > \r\nIf your domain is named \" ;_URL_1_ \" ; why are you showing us properties of \" ;_URL_3_ \" ; zone? Very hard to troubleshoot DNS issues if you posting edited command output. What is \" ;mysite.local \" ; if you domain is named \" ;_URL_1_ \" ;? < br > \r\nThat looks like only a small part of DCDIAG output. Could you post full output of DCDIAG < br > \r\nWhen the problem is occuring, what is the output of \" ;NLTEST /dsquerydns \" ;? < br > \r\nWhat kind of pattern does the problem follow, are there hours/days/weeks between the problem recurrance? Rebooting DC fixes problem? < br > \r\nDid you try applying the hotfix from my first response?", "160" ], [ "I&#39;ve seen errors like that before caused by one of the account options being set (in a non AWS environment) but I do not recall which exact property. Do the users created with < code > ADTool < /code > have any extra \" ;options \" ; set compared to the users created with MMC? I&#39;m not sure how to show these options with < code > LDAPSearch < /code > . Two methods I do know how to use shown. You can also use < code > -prop * < /code > with < code > Get-Aduser < /code > to show ALL properties.\r\n\r\n[![acctOptions][1]][1]\r\n\r\n PS C:\\temp > get-aduser mbe998 -prop DoesNotRequirePreAuth,UseDESKeyOnly\r\n \r\n DistinguishedName : CN=Mary Brown,OU=Junk,DC=acme,DC=com\r\n DoesNotRequirePreAuth : True\r\n Enabled : False\r\n GivenName : Mary\r\n Name : Mary Brown\r\n ObjectClass : user\r\n ObjectGUID : f7f30ebe-f91d-41de-b38e-ae29853b7291\r\n SamAccountName : mbe998\r\n SID : S-1-5-21-3362165994-992225803-2260058754-129428\r\n Surname : Brown\r\n UseDESKeyOnly : True\r\n UserPrincipalName : <EMAIL_ADDRESS><PERSON>,OU=Junk,DC=acme,DC=com\r\n DoesNotRequirePreAuth : True\r\n Enabled : False\r\n GivenName : Mary\r\n Name : <PERSON>\r\n ObjectClass : user\r\n ObjectGUID : f7f30ebe-f91d-41de-b38e-ae29853b7291\r\n SamAccountName : mbe998\r\n SID : S-1-5-21-3362165994-992225803-2260058754-129428\r\n Surname : Brown\r\n UseDESKeyOnly : True\r\n UserPrincipalName : mbe998@acme.com\r\n\r\n\r\n [1]: _URL_0_", "103" ], [ "You could get the when part by looking at `C:\\Windows\\Debug\\netsetup.log` This log shows domain join, disjoin, and rename.\r\n\r\nThe 6011 event does not report the the who part. That event is only written upon the reboot after the rename. And unless you are actively retaining events from the targets to long term archive with something like Splunk, those events may no longer appear on the individual target event logs. If you are collecting events, do a test rename and look to see if there is a different event written after you rename with your user ID before you reboot.", "651" ], [ "Your code is vbScript, but this is much easier to accomplish in powershell, and you did post in the powershell forum.\r\n\r\nThis will provide what you&#39;re looking for. Sometimes I prefer to use canonicalname over DistinguishedName.\r\n\r\nThis will require RSAT to be installed, or run from a domain controller.\r\n\r\n import-module ActiveDirectory\r\n get-adcomputer -Filter &#39;Name -like \" ;* \" ;&#39; -SearchBase \" ;OU=starthere,DC=yourdom,DC=com \" ; | select DistinguishedName\r\n get-adcomputer -Filter &#39;Name -like \" ;* \" ;&#39; -SearchBase \" ;OU=starthere,DC=yourdom,DC=com \" ; -prop canonicalname | select canonicalname", "351" ], [ "If you&#39;re passing a null arg like that, you&#39;re just going to have to look at the total number of args within the batch. Try making the sometimes null the last arg \" ;%3 \" ; otherwise you&#39;ll have trouble deciding which arg $(eventid) is. Why are you still using batch?! Use powershell or vbscript, much better support for arg parsing.", "241" ], [ "You may be able to get more information about this kind of problem if you enable trace option for the WSMan provider (on the source server at the least, possibly also the remote). Without this, not very much is logged. To enable trace logging:\r\n\r\n Import-Module PSDiagnostics\r\n Enable-PsWsmanCombinedTrace\r\n < run your script > \r\n Disable-PsWsmanCombinedTrace\r\n\r\nReview the the powershell event log (Applications and Services Logs/Microsoft/Windows/PowerShell/Operational) < br > \r\nIf WinRM were using SSL, the cert should be in the computer account personal strore. < br >", "11" ], [ "Create a New Pacakge < br > \r\nSource Folder: \\\\\\\\server\\here\\there < br > \r\nStandard Program < br > \r\nCommand Line: installThis.bat < br > \r\nEtc... < br > \r\n\r\nSource Folder should also contain \" ;installThis.bat \" ; < br > \r\nMinimum contents of InstallThis.bat\r\n\r\n REM *** Get the \" ;UninstallString \" ; of the old version from this registry locaton\r\n REM *** HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\r\n REM *** Replace the first MSIEXEC here with that UninstallString\r\n MsiExec.exe /X{071c9b48-7c32-4621-a0ac-3f809523288f}\r\n MsiExec.exe newVersion.msi /this /that /other", "487" ], [ "Too many unknowns for a comment... < br > \r\nWhat version OS are the DNS severs? the clients? < br > \r\nDo the failing clients all belong to one domain, or is the problem cross domains? < br > \r\nDoes the problem also occur machines with static addresses? < br > \r\nAre you in the process of moving clients from oldDom to newDom? < br > \r\nWhat else is unique about 50% of the clients that do not have DNS records? < br > \r\nClients only register the DDNS once per 24 hours. If you&#39;re just waiting for it to happen, be patient... < br > \r\nDDNS actions first query the zone SOA (start of authority). Are the zone names dissimilar (_URL_2_, _URL_4_) or similar (_URL_2_, grass._URL_2_, _URL_0_)? If similar, do you have a zone delegation setup? The registration will fail if it is not sent to the right DNS server and you have similar namespaces without a zone delegation. < br > \r\nDo you have any DNS related GPO&#39;s in place? There is a GPO option to disable Dynamic DNS registration. This is typically used when the DHCP server is configured to register DNS names on behalf of clients it issues addresses for. < br > \r\n\r\n < b > Edit 1/16 < /b > \r\n\r\nWhy are clients in newDom still being serviced by DHCP servers in oldDom, getting DHCP options with oldDom&#39;s suffix, and being told to use oldDom DC&#39;s for DNS resolution? That could all work, but it also adds complexity that could lead to problems. Even if you have a reason, try doing a test on a small client base with a new DHCP server in newDom that does not reference oldDom in any way (suffixes, dns resolvers, etc). < p > \r\n\r\nCan you answer <PERSON> question about DHCP Option 81? < p > \r\n\r\nA couple things you can try to help narrow down the source of the problem. Do each on a small sample (say 6-10) different machines: < p > \r\n\r\n 1. Shrink one of your DHCP scope by 6-10 addresses, delete DNS records for those 6-10 machines, and then assign static to those machines.\r\n\r\n 2. Delete DNS records for a different 6-10 machines, move them to an OU where there are no group policies being applied.\r\n\r\nIf problem does not repro for first group of clients, problem is probably DHCP related. < br > \r\nIf problem does not repro for second group of clients, problem is probably GPO related.\r\n\r\n < b > Edit 1/27 < /b > \r\n\r\nTry enabling both of these event logs:\r\n\r\n - \" ;Microsoft-Windows-DNS Client Events/Operational \" ;\r\n - \" ;Microsoft-Windows-DHCP Client Events/Operational \" ;\r\n\r\nBelieve it or not, Dynamic DNS registration is actually performed by the DHCP client service. Invoke \" ;ipconfig /registerdns \" ;. Review each of these logs for something that looks out of place. This is what a successful registration looks like:\r\n\r\n Log Name: Microsoft-Windows-Dhcp-Client/Operational\r\n Source: Microsoft-Windows-Dhcp-Client\r\n Date: 1/27/2016 8:42:01 AM\r\n Event ID: <PERSON>\r\n Task Category: DNS State Event\r\n Level: Information\r\n Keywords: \r\n User: LOCAL SERVICE\r\n Computer: _URL_5_\r\n Description:\r\n Dns registration has happened for the adapter 12. Status Code is 0x0. DNS Flag settings is 10.\r\n \r\n\r\n [![dnsCliEvt][1]][1]\r\n\r\n\r\n [1]: _URL_1_", "160" ], [ "Each Windows update patch will write several events in the Setup event log. < br > \r\n\r\n - Event ID 1 - Initiating changes for package KB####\r\n - Event ID 4 - A reboot is necessary before package KB#### can be changed to installed state\r\n - Event ID 2 - Package KB#### was successfully changed to the\r\n Installed state\r\n\r\nOne way to determine all patches had been applied would be to loop a check on Event ID 4. Compare the time of that event to the current time. If no event ID 4&#39;s had been written for 5 or 10 minutes, then all pataches are probably done, and ready to reboot. < p > \r\nI&#39;m not clear if you want to do the first reboot when patches are done installing (event4), or the second reboot after they are done configuring (event 2). This code does the former. Simply change the filterHashTable to event id 2 for the other reboot before your step 10.\r\n\r\n $target = \" ;<PERSON> \" ;\r\n $found = $false\r\n while (-not $found) {\r\n \t$lastEvent4 = (get-winevent -comp $target -maxEvents 1 -filterHashTable @{ Logname=&#39;Setup&#39;; id = &#39;4&#39;;}).timeCreated\r\n \tif (((get-date) - $lastEvent4).totalMinutes -gt 10) {\r\n \t\t \" ;do reboot \" ;\r\n \t\trestart-computer -comp -$target\r\n \t\t$found = $true\r\n \t} else {\r\n \t\t \" ;wait \" ;\r\n \t\tstart-sleep 60\r\n \t}\r\n }", "66" ], [ "Contents within single quotes are literal, variables are not expanded. Use double quotes on things that contain vars and need expansion. Replace the single quotes on the outside of your filter with double quotes. Used escaped double quotes (backtick double quote) on the inside for that parts with vars. You can use single quotes on the inside for params that are not vars.\r\n\r\n\r\n[PS C:\\ > help about_quoting_rules][1]\r\n\r\n [1]: _URL_0_\r\n\r\n PS C:\\ > $var = \" ;quick brown fox \" ;\r\n PS C:\\ > write-host \" ;$var \" ;\r\n quick brown fox\r\n PS C:\\ > write-host &#39;$var&#39;\r\n $var\r\n PS C:\\ > write-host \" ;` \" ;$var` \" ; \" ;\r\n \" ;quick brown fox \" ;", "67" ], [ "**You wrote:** < br > \r\n...they automatically generate a certificate request used for the... < br > \r\n**But then you ask:** < br > \r\nIs there any way to get around this without generating a certificate request on the server...\r\n\r\n 1. Are you trying to install the same cert on multiple servers?\r\n 2. Are you taking steps locally on your server to initiate the cert req?\r\n 3. Or are you initiating the req through the vendors web portal?\r\n 4. Are you looking for a method to generate the local request?\r\n 5. Or a method to install the completed cert they send you?\r\n\r\nIf you&#39;re looking for #3 and #5 (possibly #1)... < br > \r\n\r\nUse < code > CERTUTIL.EXE < /code > < br > \r\n_URL_0_\r\n\r\n CertUtil -addstore CertificateStoreName InFile\r\n CertUtil -addstore My C:\\certpath.cer\r\n certutil -addstore -?\r\n\r\nCertutil -addstore My defaults to the Computer Personal store. Add \" ;-user \" ; to install it the cert to the current User&#39;s Personal store. < p > \r\n\r\nOr use the < code > Import-Certificate < /code > cmdLet, for servers with an OS that has a new enough version of powershell where that cmdLet is available. < br > \r\n_URL_1_", "11" ], [ "PwdLastSet is a restricted attribute that cannot be set manually or individually. Only domain controllers can update that attribute when the user changes their password. < br > Sounds like MS designed ADSync to work this way for accounts with the \" ;must change \" ; flag set. < p > \r\n_URL_0_\r\n > When you reset the user&#39;s password, make sure that the User must change password at next logon check box isn&#39;t selected.", "323" ], [ "The < code > ICACLS < /code > usage explains how to use SID&#39;s but it could be better... The end of the usage shows an example that does NOT work. The /GRANT section shows the proper way that DOES work. You also need to take care with Powershell as the < code > ICACLS < /code > arguments include asterisks, colons, and parentheses that < code > CMD < /code > handles without issue, but Powershell treats differently, so you need to escape them with backticks to pass them through to the EXE.\r\n\r\n $sid = (get-adgroup \" ;group name \" ;).sid.value\r\n $sid\r\n S-1-5-21-444444444-5555555555-666666666-77777\r\n icacls \" ;c:\\temp\\sid \" ; /Inheritance:r /T /Grant:R `*$sid`:`(R`)\r\n processed file: c:\\temp\\sid\r\n Successfully processed 1 files; Failed processing 0 files", "112" ], [ "When a user logs on, they get a Kerberos ticket. That ticket contains a list of all the groups the user belongs to < i > at that time < /i > . If you add them to the group after they&#39;ve logged on, they need to logoff/logon to get a new ticket with the new group list.\r\n\r\nWhen you access the share by DNS name, that connection is authenticated with Kerberos. When you access the share by IP, NTLM is used to authenticate the connection (not Kerberos). NTLM does not use tickets, and membership is evaluated in a more dynamic manner. However, Kerberos is a an industry standard auth method that is more widely used and offer other advantages that NTLM does not offer.", "528" ], [ "Are you determined to continue using WMIC? If you&#39;re using powershell you may find it more useful to use the native powershell cmdLets to obtain the same information.\r\n\r\nDepending on what you&#39;re doing with the file, this may allow you to skip the file. You could also pipe the WMI query results to < code > | foreach { } < /code > \r\n\r\n get-wmiobject Win32_NetworkAdapter -filter &#39;NetEnabled = True&#39; | select-object Name,MacAddress,Speed | format-list | out-file dataRate.txt", "113" ], [ "You can use XPath to make specific event queries, with many event tools (Event MMC, Powershell, and Wevtutil). I&#39;m comfortable with XML structures in other cases, SCOM management packs, HTML, etc, but I find XPath a little harder to get just right. A few points to remember are that:\r\n\r\n 1. You need to make the query with Universal time because that&#39;s how the event subsystem records time. Time also needs to formatted as sortable ISO 8601 like < b > 2016-01-10T18:47:34 < /b > .\r\n 2. You need to surround the time in single quotes for the query, and also escape those quotes for powershell, because powershell treats things within un-escaped single quotes as literals, which meanns variables within single quotes are not expanded unless escaped.\r\n 3. Other times I&#39;ve used XPath, it required greater/less than as & gt ; / & lt ; but here that would not work. Only the actual > < symbols worked.\r\n 4. The beginning of the Xpath query contains \" ;System \" ;, this does NOT refer to the event log type, it refers to the System branch of the event XML (screen shot below for an event from the Application log)\r\n\r\nSample\r\n\r\n $time1 = ((get-date).toUniversalTime()).addHours(-22)\r\n $time2 = ((get-date).toUniversalTime()).addHours(-24)\r\n $newest = get-date($time1) -f s\r\n $oldest = get-date($time2) -f s\r\n $newest\r\n $oldest\r\n foreach ($logName in \" ;Application Security System Setup \" ;.split( \" ; \" ;)) {\r\n \tWEVTUTIL.EXE EPL $logName \" ;C:\\temp\\my$logName.evtx \" ; \" ;/q:*[System[TimeCreated[@SystemTime < =`&#39;$newest`&#39; and @SystemTime > =`&#39;$oldest`&#39;]]] \" ; /ow:true\r\n }\r\n\r\n[![eventXML][1]][1]\r\n\r\n\r\n [1]: _URL_0_", "532" ], [ "AD Partitions and DNS zones are different things. Zones (configured as type Active Directory Integrated) are stored in the AD partition, similar to how files are stored within an NTFS partition. MSDCS can be a zone or a sub zone, Microsoft has used different defaults for different OS versions over the years, but is not a partition.\r\n\r\nZones can also be configured as type \" ;primary \" ; which is simply a file on the filesystem, that you can also open with notepad. However, most Windows DNS installations use AD Integrated DNS because it allows each DNS server to be a DNS master and accept Dynamic DNS update requests from clients.\r\n\r\nYou can enumerate DNS zones with < code > DNSCMD.EXE /enumzones < /code > < br > \r\nYou can enumerate AD partitions with < code > DSQUERY.EXE partition < /code > \r\n\r\n dsquery partition\r\n \" ;CN=Configuration,DC=acme,DC=com \" ;\r\n \" ;CN=Schema,CN=Configuration,DC=acme,DC=com \" ;\r\n \" ;DC=acme,DC=com \" ;\r\n \" ;DC=DomainDnsZones,DC=acme,DC=com \" ;\r\n \" ;DC=ForestDnsZones,DC=acme,DC=com \" ;\r\n\r\nYou can use the ADSIEdit MMC to connect to the partitions and see which partitions the MSDCS zone is stored in. If you domain was upgraded from Win2000 you need to take steps to move the MSDCS data from the Domain DNS partition to the Forest DNS partition. _URL_0_ If MSDCS has not been moved to Forest DNS, it will not be listed with DNSCMD /enumzones. The MSDCS records are still there, you can find the MSDCS node in the DNS MMC tree beneath _URL_1_.", "160" ], [ "This does not require any exotic knowledge of Powershell. All you need is to have Active Directory PowerShell Module installed and then use < code > Set-ADAccountPassword < /code > cmdLet. Works for users with or without \" ;must change password on next logon \" ;\r\n\r\n $env:userdnsdomain\r\n _URL_0_\r\n Set-ADAccountPassword -id eFudd -server _URL_1_\r\n Please enter the current password for &#39;CN=<PERSON>,OU=Users,DC=green,DC=com&#39;\r\n Password: ********\r\n Please enter the desired password for &#39;CN=Elmer Fudd,OU=Users,DC=green,DC=com&#39;\r\n Password: ********\r\n Repeat Password: ********", "740" ], [ "> I copied the old policy to a new name and unlinked the default policy. \r\n\r\nYou link disabled the Default Domain Policy? < br > \r\nNot a best practice, not recommended, probably not even supported. Would explain why it is missing from RSOP and your erratic results.\r\n\r\nYou may want to use the < code > DCGPOFix < /code > tool to repair the DDP.\r\n_URL_0_\r\nNotice what is says should and should not be included in DDP:\r\n\r\n > As a best practice, you should configure the Default Domain Policy GPO < b > only < /b > to manage the default Account Policies settings, Password Policy, Account Lockout Policy, and Kerberos Policy.\r\n\r\n1. Back up both GPO&#39;s - ideally you already did this before your first attempt to fix.\r\n2. Remove settings in those areas from your \" ;New \" ; GPO. You do not want to apply those settings defined in multiple GPO&#39;s.\r\n3. Either use < code > DCGPOFix < /code > tool, or manually remove all settings from other areas from the DDP GPO.\r\n4. Re-enable the link for DDP GPO.\r\n5. Cross your fingers", "628" ], [ "You said you were putting the DC_NAME in the GPO as the hardened UNC. The examples in the KB are < code > \\\\\\\\*\\Netlogon < /code > and < code > \\\\\\\\*\\Sysvol < /code > . Probably not a good idea to use DC names, because those change, and clients may also use < code > \\\\\\\\DOMAIN_NAME\\Sysvol < /code > . If you are still using specific DC names in the UNCH GPO settings, that may be the problem.\r\n\r\nYour original post never mentioned that you have a mix of 2012 and 2003 DC&#39;s. Sounded like you had only 2012 DC&#39;s. UNCH was never made avail for the 2003 OS. < br > \r\nRead the KB _URL_0_\r\n > We determined that implementing these changes in Windows Server 2003 SP2 would require such comprehensive architecture changes that it would destabilize the system and result in application compatibility problems. We continue to recommend that customers who are security-conscious upgrade to our latest operating systems to keep pace with security threats and benefit from robust, modern operating system protection.", "206" ], [ "Some attributes are are owned by the system and can never be updated through other methods. _URL_0_. That is the cause of your first \" ;lastLogon \" ; error. < br > \r\nThe other error looks like an access denied message (0x5), 4003 is another error for INSUFF_ACCESS_RIGHTS. Try making the change with a more powerful account to modify the target object. Manually tweaking the UAC bitmask value can be complicated. Most of the time you change these values through the \" ;Account Properties \" ; field on the \" ;Account \" ; tab in ADUC (Active Directory Users & Computers) tool.", "384" ], [ "Try using WinRS from your workstation to invoke WinRM on the remote target with the new Trusted Host list. Works for me, but I don&#39;t have a workgroup only setup like yours to test that respect.\r\n\r\n winrs -r:_URL_0_ winrm set winrm/config/client @{TrustedHosts= \" ;*._URL_1_,<IP_ADDRESS>,localhost \" ;}\r\n OR\r\n winrs -r:_URL_0_ -u:administrator -p:P4$$word winrm set winrm/config/client @{TrustedHosts= \" ;*._URL_1_,<IP_ADDRESS>,localhost \" ;}", "166" ], [ "I am writing my PhD dissertation in LaTeX and want to include a bibliography, obviously. However, I&#39;m having problems making this work at all. Instead of trying to make it work in my multiple dissertation LaTeX files, I made a minimum working example of it, but not even that works! Can anybody please help me with telling me what I&#39;m doing wrong? I want an author year citation style, by the way. No numbers, just citations of author year in the text and a reference list sorted alphabetically at the end.\r\n\r\nThis is my minimum working example, `example.tex`:\r\n\r\n \\documentclass{article}\r\n \\usepackage[utf8]{inputenc}\r\n \\usepackage[backend=biber,style=alphabetic,citestyle=authoryear]{biblatex}\r\n \\addbibresource{library.bib}\r\n \r\n \\begin{document}\r\n This is a test \\cite{bakerstair}.\r\n \r\n \\printbibliography\r\n \\end{document}\r\n\r\n\r\n\r\nHere&#39;s the content of my `library.bib` file:\r\n\r\n @Article{bakerstair,\r\n author = {<PERSON>, Doran J. and <PERSON>, A. T.},\r\n title = {Rocket measurements of the altitude distributions of the hydroxyl airglow},\r\n journal = {Physica Scripta},\r\n year = {1988},\r\n volume = {37},\r\n pages = {611-622},\r\n }\r\n\r\n\r\n\r\nError messages I get after running PdfLaTeX + Bib(la)tex + PdfLaTeX(x2) + View Pdf in TeXMaker:\r\n\r\n > example.tex. Warning. line 9. Citation &#39;bakerstair&#39; on page 1 undefined.\r\n > example.tex. Warning. line 11. Empty bibliography.\r\n > example.tex. Warning. line 1. There were undefined references.\r\n > example.tex. Warning. line 1. Please (re)run Biber on the file: example and rerun LaTeX afterwards.\r\n\r\nI have no idea what I&#39;m doing wrong and it&#39;s driving me crazy.", "783" ], [ "Thanks for the comment! You are rigth, TeXMaker didn&#39;t run Biber. I have now followed the instructions in the link, but I still get an error: \" ;ERROR - Cannot find control file &#39;example.bcf&#39;! - did you pass the \" ;backend=biber \" ; option to BibLaTeX? INFO -ERRORS:1.! How do I pass the backend=biber option to BibLaTeX?", "783" ], [ "Yes, I had the \" ;build subdirectory \" ; option enabled. Now I&#39;ve disabled it, but I got new error messages in addtion to the ones I&#39;ve already seen before: ! Use of \\sortlist doesn&#39;t match its definition. \\sortlist{\n! Extra }, or forgotten \\endgroup. \\sortlist{anyt}\n! Undefined control sequence.\\entry ...ata@\\the \\c@refsection @\\blx@slist@name@\\abx@field@entrykey }\\csu... \\entry{bakerstair}{article}{}\n! Undefined control sequence. < argument > ...equal \\expandafter {\\blx@slist@type}{entry} {\\listcsxadd {blx... \\endentry\netc...", "824" ], [ "Many ways to do this... just some simple scripting. Even a Python response in the question you referenced.\r\n\r\n - Invoke DIG multiple times instead of just once with bulk file. That returns 1 line fail, 2 or more lines good. Echo name based on pass/fail.\r\n\r\n - Use you favorite script language&#39;s DNS lookup method and evaluate return code. I like powershell, and for that you would use < code > [_URL_0_.Dns]<IP_ADDRESS>GetHostByAddress( \" ;_URL_1_ \" ;) < /code > \r\n\r\n - Invoke DIG once with bulk file, and regex the output (regular expressions). Sample below, again in powershell. If you&#39;re a unix guy, regex is there too. I used SED many many years ago, but there are probably easier ways these days.\r\n\r\nzz\r\n\r\n [string]$digout = dig +noall +answer +question goodname1 goodname2 badname1 goodname3 badname2\r\n $digout = $digout -replace ( \" ;\\r\\n \" ;, \" ; \" ;)\r\n $digout.split( \" ;; \" ;) | select-string -notmatch \" ;\\d\\s+IN \" ;\r\n\r\nWill return:\r\n\r\n badname1. IN A\r\n badname2. IN A\r\n\r\n1st line assigns DIG output to a var as a string NOT an array. This is needed because regex works on strings and not arrays. 2nd line removes CR/LF from that var. Part 3A line splits var so that each question and it&#39;s answer appears on same line. Part 3B filters that text so that only questions without an answer are shown.", "879" ], [ "I can&#39;t find this setting documented anywhere, but last week I found this key on a test server I manage.\r\n\r\n < code > HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\DNS\\Parameters\\AllowUpdate < /code > \r\n\r\nIf this key exists and it has a value of 0, dynamic updates from clients are refused. I am not sure if how it would affect updates from a DHCP service on the same server, but you could try it out and see if it may be an alternative to the firewall block.", "259" ], [ "Strictly speaking, I don&#39;t think its possible as iLO does not support the clipboard. But you may be able to save some keystrokes...\r\n\r\nYou can use the iLO virtual media to mount a folder from the client. Put a text file with the commands you want to use in that folder. Open that file from within the remote session (notepad, nano, grep) to get it on the screen of the remote host. Then copy and paste the lines you want with the clipboard of the remote host to a prompt or other window.", "363" ], [ "> fetch all users that have a certain OU in their DN\r\n\r\nUnfortunately, searches with wildcards for the Distinguised Names values are not permitted in Microsoft AD.\r\nAlso, the \" ;OU \" ; attribute is not auto populated for user objects. The OU attribute is only auto popluated on OU objects.\r\n\r\nTo reach your goal you need to either\r\n\r\n 1. Query all users in the entire domain and filter that full result set on the client side or\r\n 2. Make multiple queries with a scripted query tool.\r\n 3. If you know there is only one OU you want to query, and that will never change, you can make a single query with < code > searchbase < /code > set.\r\n\r\nPart 1 of the multi query method enumerates OU&#39;s with the desired name. Part 2 runs a second query where the < b > search base < b > is each of those paths, and the filter is (objectCategory=user). In Powershell you could do it like this:\r\n\r\n Import-Module -name ActiveDirectory\r\n get-adobject -ldapFilter \" ;( & (objectCategory=organizationalUnit)(ou=SOMENAME)) \" ; | foreach {\r\n get-aduser -searchscope oneLevel -searchbase $_.distinguishedName -ldapfilter \" ;(objectCategory=user) \" ;\r\n }", "215" ] ]
65
[ 5404, 10332, 6826, 19019, 15316, 19682, 10465, 12022, 9312, 12412, 14404, 5658, 17903, 7077, 10150, 1294, 11648, 13658, 6415, 16976, 4771, 4299, 4639, 14678, 3745, 10979, 14255, 10786, 13149, 19063, 4569, 2902, 13700, 10042, 8175, 15800, 5720, 18758, 16442, 4462, 15136, 19350, 8113, 108, 18408, 11591, 5865, 15745, 6340, 9381, 4936, 3499, 10403, 9245, 13803, 16243, 3635, 16530, 3515, 12202, 5641, 16069, 8014, 19547, 10454, 9484, 13507, 15917, 8964, 10648, 7160, 4737, 2995, 19277, 17707, 17799, 19005, 2444, 17075, 9554, 4673, 1971, 7010, 1982, 3066, 5673, 3918, 17909, 5144, 7131, 11446, 9364, 11499, 17360, 3140, 19098, 16912, 18988, 15209, 9288, 14850, 7095, 10662, 12795, 2348, 18913, 19495, 14189, 5015, 17477, 207, 4174, 554, 1682, 13240, 6981, 9636, 8018, 15409, 14614, 1600, 15981, 5485, 16587, 4186, 19316, 18088, 11601, 13705, 1732, 15870, 16267, 3385, 15324, 17663, 9602, 5106, 9966, 10892, 12889, 16137, 12404, 13889, 3145, 1060, 17846, 14161, 11907, 19708, 8078, 17030, 19032, 18588, 2702, 15872, 14535, 5346, 17249, 13437, 9019, 5714, 16394, 1778, 3655, 8254, 7683, 16638, 3900, 3681, 14727, 12455, 18448, 15663, 15867, 19304, 14219, 15848, 5964, 6941, 2952, 14156, 807, 14180, 1930, 2260, 11324, 12844, 18337, 13171, 19256, 19353, 4848, 17766, 17911, 10500, 1624, 16741, 19029, 10710, 14550, 14695, 18948, 10685, 17304, 16550, 16025, 11105, 11611, 14647, 14805, 6540, 11698, 8813, 13062, 19556, 19469, 19061, 9772, 2911, 19680, 14144, 5330, 17248, 10406, 13857, 11065, 3999, 11649, 11882, 5815, 718, 4346, 1739, 11966, 15862, 2288, 14237, 7180, 9499, 3067, 14428, 13880, 15791, 10085, 17933, 5316, 4246, 472, 5645, 8711, 8921, 8483, 11122, 17869, 18873, 7895, 9922, 9473, 12826, 387, 18528, 1185, 10485, 11080, 4295, 3794, 17000, 7409, 4843, 12493, 6975, 5163, 8642, 6412, 17251, 13947, 9744, 13826, 1990, 3240, 9902, 16280, 8687, 12021, 1213, 10691, 2415, 7499, 5454, 7548, 54, 2016, 693, 5728, 10039, 13084, 13232, 9210, 10543, 8524, 6132, 12414, 16480, 649, 2693, 7129, 12715, 1677, 9764, 9423, 16842, 9179, 1095, 10944, 1703, 104, 4396, 10100, 3237, 10134, 18473, 6514, 2226, 4913, 10338, 5990, 10835, 4330, 6742, 15426, 689, 7121, 2404, 12654, 1607, 17378, 8302, 18517, 17413, 9021, 13056, 13489, 8840, 11475, 11415, 18416, 10110, 19334, 711, 8008, 2166, 13477, 19075, 110, 10263, 2579, 4013, 17681, 6336, 19068, 3313, 5654, 11807, 14381, 9209, 14197, 15638, 5683, 7655, 16961, 10885, 16904, 9222, 16989, 622, 2928, 10698, 8716, 5320, 13164, 16617, 14955, 10277, 16941, 6679, 6829, 17328, 17567, 11217, 14047, 2354, 8021, 6693, 2762, 19260, 16405, 18011, 12983, 9543, 11961, 12720, 13087, 9134, 9890, 12917, 9018, 6633, 18591, 11521, 11716, 10173, 1324, 12338, 11134, 15997, 12612, 3963, 4956, 453, 4273, 19113, 7439, 8902, 13587, 10919, 7235, 19088, 10632, 7973, 15847, 19715, 15877, 12856, 7490, 13212, 8862, 1064, 10763, 2713, 15954, 17250, 7434, 18318, 12724, 7266, 8778, 3716, 1195, 5159, 10789, 817, 19001, 8991, 19154, 16004, 1145, 2313, 5628, 15398, 15694, 944, 13188, 7460, 17838, 7009, 15953, 14083, 5918, 732, 5448, 2936, 12669, 18080, 16688, 3052, 5816, 18821, 16580, 8861, 3235, 9433, 14752, 328, 13322, 16054, 12193, 3394, 16870, 924, 12024, 10295, 3192, 18903, 11596, 2452, 9025, 1617, 13798, 1540 ]
STX_10095872.0
[ [ "I am developing an app in which there is authentication which means I am able to manage users and store them in database. Now I have items to be purchased from inside the app (Which I am trying to implement using the new play billing library).\r\n\r\n\r\n**What I tried:**\r\n\r\nThe first thing I tried is to listen to the purchase and when complete I save the user ID along with the item he/she paid for in the database. But this is not safe because if a user made an account and paid for all items then he/she might pass this account to other users so that they can use it and access the items for free.\r\n\r\n**Another way:**\r\n\r\nI don&#39;t know much about in app billing but from what I learned, in app purchases are tracked by the primary account on the device that the user logged in, so now if I used this logic to query for user purchases per their primary account using the google play console. Then also any user might pay and pass their primary account to other users to log in through and they can access the products for free.\r\n\r\n**Problem:**\r\n\r\nIn both ways users will be able to buy and pass accounts to other users so they access stuff for free.\r\n\r\n**Question:**\r\n\r\nI want a possible way that forces every user to pay for the items without having to worry about users passing accounts to each other.\r\n\r\nThanks for all your help.", "855" ], [ "In my android app I use firebase authentication (email/password) to authenticate users.\r\n\r\nThe app works in a way that when a user logs in I add to the database under his/her UID a flag called `logged_in` and set it to `true`, and when logged out I change the flag to `false`.\r\n\r\nThe structure ends like this:\r\n\r\n Users\r\n |\r\n |----userID\r\n |\r\n |---name=.....\r\n |---logged_in = true\r\n\r\n**Problem**\r\n\r\nNow if I logged in to my app and uninstalled the app without signing out, and then reinstalled the app. I noticed that the user will be automatically signed out, and if this is the case I will end up with a user that signed out with his `logged_in` flag in the database set to `true`.\r\n\r\nIn others words I never had the chance to set the flag to `false`, because the user never signed out from the app.\r\n\r\n**My question:**\r\n\r\nHow to overcome this problem, to always update the database when a user is automatically signed out (like my example case: where user uninstalls the app while still logged in)?\r\n\r\nThanks all.", "119" ], [ "Thanks for the answer <PERSON>, I just want to ask you this question: I am trying to allow only one user to login at a time so I save his/her status in the database as (true for logged in), and when he/she signs out I update the status to (false). When someone now try to log in from another device I will query the value of the status (if false I allow the login and if no I stop the user from logging in).....But the problem comes when one user logs in and uninstalls the app, because now the value is not updated and no one will ever login from this account again......any suggestion for my problem.", "981" ], [ "I am trying to manage users in my firebase app in a way that one account wont be able to be accessed on multiple devices at the same time, but I found a problem in this method:\r\n\r\n**The way that I am trying:**\r\n\r\n1) UserA signs in with email (`<EMAIL_ADDRESS>`).\r\n\r\n2) Database is updated to show that (`<EMAIL_ADDRESS>`) is logged in by device id.\r\n\r\nlike this:\r\n\r\n Users\r\n |\r\n |UserA_uid\r\n |--------device_id= \" ;A_CERTAIN_DEVICE_ID \" ;\r\n\r\n3) UserB attempts to sign in using (`<EMAIL_ADDRESS>`), during that I overwrite the device_id of the userA_uid according to the account.\r\n\r\n4) UserA listens to the change **IF HE/SHE WAS CONNECTED TO THE INTERNET**, and according to the device_id change I sign userA out of the app.\r\n\r\n5) and so on.\r\n\r\nNow All of the above seems to be a clean solution, that allows one account to be opened only once at a time (By kicking off the other user).\r\n\r\n**Problem:**\r\n\r\nI noticed a problem while testing, and that is:\r\n\r\nIf users are clever enough,they will do this:\r\n\r\n1) UserA signs in with email (`<EMAIL_ADDRESS>`).\r\n\r\n2) Database is updated to show that (`<EMAIL_ADDRESS>`) is logged in by device id.\r\n\r\nlike this:\r\n\r\n Users\r\n |\r\n |UserA_uid\r\n |--------device_id= \" ;A_CERTAIN_DEVICE_ID \" ;\r\n\r\n3) **User A shuts the wifi or internet off.**\r\n\r\n4) UserB attempts to sign in using (`<EMAIL_ADDRESS>`), during that I overwrite the device_id of the userA_uid according to the account.\r\n\r\n5) User A never listens to the change, because he/she is not connected.\r\n\r\n6) I end up with user A and user B logged in.\r\n\r\n**If you are wondering (my app works offline).**\r\n\r\n**Question:**\r\n\r\nCan I manage to solve this issue?\r\n\r\nThanks.", "855" ], [ "In android there is a library called **Exoplayer** that has to do with streaming a video from a given url.\r\n\r\nNow according to [this][1] firebase doesn&#39;t support video streaming, eventhough you can pass a uri from the url to the videoview (and it will actually stream).\r\n\r\n**Question:**\r\n\r\nCan exoplayer be used to stream a video from firebase storage?\r\n\r\nWhy firebase states streaming is not possible eventhough it can be done with a videoview?\r\n\r\n\r\n [1]: _URL_0_", "261" ], [ "I have been searching a lot about this by now and I got nothing:\r\n\r\nI am trying to play a video from firebase storage and trying to be able to see its progress on the player as it loads and to be able to seek it backward and forward (stuff that any player does while streaming a video).\r\n\r\n**The problem:**\r\n\r\nFirebase team say that it is not possible to stream a video from the cloud storage (it is not supported).\r\n\r\nEventhough I was able to do this:\r\n\r\n String url = \" ;my_url_at_firebase_storage \" ;;\r\n \r\n video_View.setVideoUri(Uri.parse(url));\r\n video_View.start();\r\n\r\nand I was able to load the video from firebase storage into a video view.\r\n\r\n**I checked:**\r\n\r\nI checked [this link][1] that has an answer that says you have to transcode the video to chunks and save the chuncks to firebase storage and then load them:\r\n\r\nBut I am lost here:\r\n\r\n1) What are chunks of video?\r\n\r\n2) How would you stream these chunks if firebase doesn&#39;t support streaming?\r\n\r\n**My question:**\r\n\r\nAs this topic is rarely documented and the link above doesn&#39;t provide enough info about how to acheive it:\r\n\r\nI ask:\r\n\r\nIf firebase doesnt support streaming how come we are able to load video directly to videoview?\r\n\r\nTried the same with exoplayer and didn&#39;t work?\r\n\r\nThanks for your efforts.\r\n\r\n\r\n [1]: _URL_0_", "261" ], [ "I am making an app for Android and iOS and I have authentication for my users. My users must update the database once they log in or log out from the app.\r\n\r\n**Problem:**\r\n\r\nAn user might uninstall the app before he/she log out of the app, thus the user won&#39;t be able to make the update.\r\n\r\n**Possible Solution:**\r\n\r\nI think that Firebase will allow me to trigger a function on the `app_remove` event from Firebase analytics. But I don&#39;t know if it is precise. For example, if the user uninstalls while offline he/she won&#39;t trigger the function.\r\n\r\n**Question:**\r\n\r\nAny clean solution that will help me do a database update for users after they uninstall my app?", "119" ], [ "In my app I have a set of topics that I retrieve from a database, now each topic has a set of data including a (`timestamp`).\r\n\r\n**timestamp: is the time when the topic was posted to the database.**\r\n\r\nNow I only allow users to enter the topic if and only if the difference between the `timestamp` and the `currentTime` of the device is greater than 2 weeks.\r\n\r\n**Problem:**\r\n\r\nI noticed a problem where a user can change the time of the device and then enter the topic, and then he can change the time back.\r\n\r\nWhat should I do to solve this?\r\n\r\nThanks.", "518" ], [ "cron job will trigger on a time base, not on demand or request......Sorry if my question is not clear..... all I want is a simple way to get current time from firebase instead of getting current time from android device.....But it seems that with firebase I need to write the timestamp to database and then it will be calculated on the server so I can retrieve it, and I don&#39;t want a 2 way method to get the time?", "496" ], [ "So I have a database that looks like this:\r\n\r\n Posts\r\n |\r\n |\r\n |----post_id_1\r\n |\r\n |---post_title = \" ;.... \" ;\r\n |---post_body = \" ;.... \" ;\r\n |---post_time = \" ;ServerValue.TIME_STAMP \" ;\r\n |\r\n |----post_id_2\r\n |.......\r\n |.......\r\n\r\n**What I want to do:**\r\n\r\nI want to prevent a user to read a post that is greater than or equal a month from the day that it was posted?\r\n\r\n**What I tried:**\r\n\r\nI tried to use this method by android:\r\n \r\n //current time of device\r\n long current_time = System.currentTimeMillis();\r\n //month in millisecond\r\n long month = .....;\r\n \r\n if(curent_time - post_time > = month){\r\n \r\n //this post was there for a month from the time that it was posted.\r\n \r\n }\r\n\r\n**Problem:**\r\n\r\nIf I use the above method then if a user was smart enough he/she will change the time of the device to enter a post (when they shouldn&#39;t).\r\n\r\n**Question:**\r\n\r\nAny stable way of doing this?\r\n\r\nThanks.\r\n\r\n**NOTE: WITHOUT GETTING THE TIME STAMP FROM THE SERVER.**", "602" ], [ "**These are my current dependencies and they work fine:**\r\n\r\nThese dependencies in my build.gradle (app):\r\n\r\n compile &#39;com.google.firebase:firebase-database:11.4.2&#39;\r\n compile &#39;com.google.firebase:firebase-auth:11.4.2&#39;\r\n compile &#39;com.google.firebase:firebase-ui-database:3.1.0&#39;\r\n compile &#39;com.google.firebase:firebase-storage:11.4.2&#39;\r\n\r\nAnd this dependency in my build.gradle (project_name):\r\n\r\n classpath &#39;com.google.gms:google-services:3.2.0&#39;\r\n\r\n**But when I update to new versions of firebase I get multidex error:**\r\n\r\n\r\nThese dependencies in my build.gradle (app):\r\n\r\n compile &#39;com.google.firebase:firebase-core:16.0.1&#39; \r\n compile &#39;com.google.firebase:firebase-database:16.0.1&#39;\r\n compile &#39;com.google.firebase:firebase-auth:16.0.2&#39;\r\n compile &#39;com.google.firebase:firebase-ui-database:4.1.0&#39;\r\n compile &#39;com.google.firebase:firebase-storage:16.0.1&#39;\r\n\r\nAnd this dependency in my build.gradle (project_name):\r\n\r\n classpath &#39;com.google.gms:google-services:4.0.1&#39;\r\n\r\n**Problem**\r\n\r\nSo my problem is getting multi dex error when trying to build my project with the updated dependecies.\r\n\r\nI have `android studio (3.1.3)`.\r\n\r\nWhy is it happening?\r\n\r\nThanks.", "477" ], [ "Firebase allows us to test phone numbers without using real phone numbers (by white listing the numbers from the console).\r\n\r\nBut firebase states this in the docs:\r\n\r\n > Make sure you use fictional numbers that do not already exist. Firebase Authentication does not allow you to whitelist existing phone numbers used by real users. One option is to use 555 prefixed numbers as US test phone numbers, for example: <PHONE_NUMBER>.\r\n\r\n**Question:**\r\n\r\n1) If I added real phone number in the white list, does it mean that it might be possible to send an sms to this device?\r\n\r\n2) I don&#39;t know how I can provide a fake number in my country, so following what firebase recommends:\r\n\r\nThey state that we use 555 prefixed numbers, now I don&#39;t know what this means. I think that in this number <PHONE_NUMBER>):\r\n\r\n+1 : country code for US.\r\n\r\n650 : Area code.\r\n\r\n555 : A number that should be there to make the number fake.\r\n\r\n3434 : Any random number that I can provide.\r\n\r\nIs this the meaning of a fake number?", "683" ], [ "There is multiple examples of how we could retrieve contacts in android the most common type is using `ContactsContract` like this:\r\n\r\n ContentResolver resolver = getContentResolver();\r\n Cursor cursor = resolver.query(ContactsContract.contacts.CONTENT_URI,null,null,null,null);\r\n \r\n while(cursor.moveToNext){\r\n //get contact details\r\n .........\r\n \r\n }\r\n\r\n**My Question:**\r\n\r\nIf users can save their contacts in three places `phone`, `SIM`, `google_account`. Then how I am able to use a method that retrieves all numbers that a user have on the phone?\r\n\r\nAlso as the contact list in the phone duplicates contacts how can we avoid getting a contact twice or 4 times or 5 times?\r\n\r\nWhat would be the method that one must use to cover all possible contacts once?", "442" ], [ "So I know by now that I can use `ContactsContract` class to list all contacts available on an android device. Something like this:\r\n\r\n private void getContacts(){\r\n \r\n ContentResolver resolver = getContentResolver();\r\n Cursor cursor = resolver.query(ContactsContract.contacts.CONTENT_URI,null,null,null,null);\r\n \r\n while(cursor.moveToNext){\r\n \r\n //get contact id\r\n .....\r\n //get contact name\r\n ....\r\n \r\n }\r\n \r\n }\r\n\r\n**What do I mean by `contact` above:**\r\n\r\nA `contact` according to my understanding is a set of `raw_contacts`. Example:\r\n\r\nThese are 2 `contacts` in the phone book:\r\n\r\n [ User A ]\r\n ----------- \r\n [ User B ]\r\n\r\nUpon clicking User A I will get this:\r\n\r\n | User A |\r\n | phone 1: 0000 mobile | \r\n | phone 2: 1111 home |\r\n | phone 3: 2222 work |\r\n | |\r\n | linked :google , sim, phone, viber, whatsapp|\r\n\r\n**From my understanding:**\r\n\r\n - Contacts = User A or User B.\r\n\r\n - raw_contacts = User A (phone) or User A (SIM) or User A (google) or User A (viber)....\r\n\r\n**My question is:**\r\n\r\nIf I looped through all `contacts` and then looped through all `raw_contacts` in a `contact` **keeping in mind that raw_contacts can be alot**, and then looped through phone number (home, mobile, work...) of each raw contact...Then wouldn&#39;t it be bad for performance?\r\n\r\nWhat should I do to only loop through mobile numbers that are stored on phone (sim, or device) without having to loop through `raw_contacts` that are generated by custom apps?\r\n\r\nIt makes no sense to loop through all `raw_contacts`.\r\n\r\nApps like whatsapp or viber or telegram or any phone app get these contacts fast and efficiently.\r\n\r\nThanks.", "442" ], [ "example: In whatsapp if a contact has multiple numbers (mobile, home, ...) and all these numbers exist in whatsapp server then whatsapp will show them in your contacts as the same contact, but they will add Moblie, Home, or Work beside the number.......But if these numbers are the same number meaning duplicates whatsapp will ignore them.......but anyway how is whatsapp pushing the numbers in the local database if they refer to the same unique contact id.....why HOME, WORK , MOBILE in whatsapp are not overwritten if they refer to same contact id?", "683" ], [ "So I am using room database to persist users locally, now users have this entity class:\r\n\r\n @Entity\r\n public class Users{\r\n \r\n public string name;\r\n public string email;\r\n @PrimaryKey\r\n public string id;\r\n \r\n ......\r\n \r\n }\r\n\r\nI retrieve all these users with a DAO that looks like this:\r\n\r\n @DAO\r\n public interface UsersDAO{\r\n \r\n @Query( \" ;select * from Users \" ;)\r\n public List < Users > getAllUsers();\r\n \r\n \r\n }\r\n\r\nThe above DAO will read all users in the order they were added to the database.\r\n\r\n**Question:**\r\n\r\nIs it possible to query users by the `name` field in `Users` entity alphabetically?\r\n\r\nThanks.", "215" ], [ "So I know by now that Contacts are saved in three tables:\r\n\r\n - Contacts table.\r\n - Raw contacts table.\r\n - Data table.\r\n\r\n**The table that I am using:**\r\n\r\nI am using the data table to read users with all their phone numbers according to and thanks to <PERSON> in this [answer][1].\r\n\r\n**What I got from the solution in the above link:**\r\n\r\nUsing the answer provided by <PERSON> in the above link I was able to query (for all contacts in the phonebook) a `contact_id` mapped to a `set of phone numbers` for this specific contact.\r\n\r\n**Defining contact_id & set of phone numbers:**\r\n\r\n \r\n\r\n - `contact_id`: Is the id of a contact in the phone book that can contain multiple types of linked accounts.\r\n\r\n - `set of phone numbers`: Is a set containing all phone numbers of a specific contact_id.\r\n\r\nProblem:\r\n-------\r\n\r\nLet&#39;s say I have two users X and Y :\r\n\r\nuser x has a contact_id = 0.\r\n\r\nuser y has a contact_id = 1.\r\n\r\nNow let&#39;s say user x has these numbers linked: +1111-xxx and +2222-xxx\r\n\r\nAnd let&#39;s say user y has these numbers linked: +3333-xxx and +2222-xxx\r\n\r\nNow I decide to save all these numbers to the local database on the phone:\r\n\r\n**case 1:**\r\n\r\nIf I used the numbers of these users as the main id to save into database then +2222-xxx in user x will overwrite +2222-xxx in user y.\r\n\r\n**case 2:**\r\n\r\nIf I used the contact_id as the main id to save into database then +1111-xxx and +2222-xxx that corresponds to the same user_id (0) will both be overwritten so one will win.\r\n\r\n**case 3:**\r\n\r\nIf used a combination of phone number + contact_id as the main id to save into database then as it might work it seems not the very clean solution and not stable.\r\n\r\n**Question:**\r\n\r\nIs it possible to get a unique id that identifies each number found in the contact_id?\r\n\r\nThanks.\r\n\r\n\r\n\r\n\r\n [1]: _URL_0_", "442" ], [ "In apps that use phone authentication like whatsapp:\r\n\r\nWhen any user opens to check his/her contacts, whatsapp will show **only the contacts from your phone that are using whatsapp (like they filter your contacts).**\r\n\r\n**My thoughts on implementing something similar:**\r\n\r\nI can save all users in a database (when they authenticate with my app), now when I load contacts in an activity I check to see if the contact exist in the database, and if the user exist then I add him/her to the list.\r\n\r\n**Problem:**\r\n\r\nIf I used the above method:\r\n\r\nThen lets say I have 10,000 users in the database, then it wont make sense to loop through 10,000 users every time I want to show contacts of a user inside my app.\r\n\r\n**Question:**\r\n\r\nHow do you think apps like whatsapp implement such a thing?", "888" ], [ "In apps like WhatsApp, when a user signs up with his/her mobile number on a certain device (they should be assigned by a certain UID that will be added to the database in order to detect these users).\r\n\r\n\r\n\r\nLet&#39;s say a user A signs up with this mobile number (1234) on his device A, then when he/she start a chat the chat thread should be tracked by the database like this:\r\n\r\nusers database\r\n--------------\r\n\r\n Users\r\n |\r\n |\r\n |-----UID-1:\r\n |\r\n ---phone_number : 1234\r\n ---name : user A\r\n |\r\n |-----UID-2\r\n |\r\n ---phone_number : 4567\r\n ---name : user B\r\n\r\nChats\r\n-----\r\n\r\n Chats\r\n |\r\n |\r\n |---UID_1\r\n |\r\n |--UID-2\r\n |......\r\n |\r\n |--UID-3\r\n |.....\r\n\r\nAs you can see user A has 2 chats with UID-2 AND UID-3 (2 threads).\r\n\r\nWhen user A&#39;s number expires someone else (user x) with another device (device x) will get user A&#39;s number and will use it in his new device.\r\n\r\n**My question is:**\r\n\r\nIf this user x gets his hand on the phone number then when he/she tries to login with this number then he/she should load the threads of user A because he will be assigned with the same UID of user A, because they share the same number.\r\n\r\nSo how to secure this? Or in other words how WhatsApp and similar popular apps handle this issue?", "683" ], [ "In some paint apps or note taking apps, they will allow you to add text and images in addition to drawing stuff.\r\n\r\nNow I know that I can create a custom view and override on touch events and build paths and draw them on canvas.\r\n\r\nBut what I don&#39;t know is this: In apps like mentioned above I am confused if they add images as image views or they add images directly drawn on canvas.\r\n\r\nI mean do they create new imageview and set the gallery image to it, or they simply add the image directly to the canvas.\r\n\r\nAny thoughts?\r\n\r\nThanks.", "114" ] ]
415
[ 6266, 19773, 3188, 11709, 16296, 11305, 874, 5976, 8815, 14213, 16962, 13753, 9358, 19538, 4622, 18222, 2453, 6417, 7210, 6944, 8294, 14914, 17873, 10340, 7260, 1575, 12245, 1715, 9103, 264, 4270, 3754, 11382, 15455, 13283, 6507, 1433, 15449, 9326, 14042, 1376, 18494, 10676, 15521, 12846, 8909, 15402, 6948, 13023, 5049, 10693, 12628, 11022, 12431, 13393, 10025, 17072, 167, 11664, 4881, 10555, 15191, 5989, 18971, 6911, 17548, 16818, 4603, 12958, 14808, 13979, 12683, 13035, 13052, 10391, 13314, 178, 12073, 2325, 4599, 9088, 14509, 5280, 674, 14713, 5982, 14499, 13678, 47, 3212, 14925, 13015, 18894, 15082, 9796, 12186, 12956, 11538, 14254, 19461, 10199, 13629, 8807, 10385, 13088, 13788, 3969, 2077, 3020, 12133, 7667, 12103, 11627, 14012, 8492, 2051, 11806, 17662, 11149, 2613, 13026, 18361, 7299, 8240, 8339, 6125, 11682, 12411, 8736, 17919, 13207, 16625, 13045, 15021, 18201, 4971, 19644, 15153, 19040, 10477, 17175, 7681, 13722, 14005, 95, 13145, 5957, 3763, 18815, 17172, 14377, 11019, 4320, 14251, 15320, 10625, 6244, 19675, 6585, 15707, 9436, 17565, 19697, 7997, 14106, 6130, 8025, 1451, 18366, 17178, 17306, 15035, 16392, 15121, 1162, 10460, 11384, 13547, 8576, 13711, 17233, 12947, 4549, 3549, 17718, 5426, 2560, 9126, 18023, 6932, 10851, 1578, 13091, 11777, 11645, 10126, 17995, 14780, 14029, 15993, 13956, 2225, 15451, 15718, 17957, 8848, 14894, 13134, 15034, 798, 13964, 13092, 4993, 3882, 18736, 3868, 13890, 14969, 4367, 6722, 4948, 4587, 6197, 17638, 14074, 594, 15020, 15761, 5282, 12971, 9291, 12449, 404, 7970, 2317, 102, 8337, 6669, 13698, 11268, 8976, 15211, 16087, 3272, 17785, 19095, 8184, 14862, 10253, 3314, 11609, 905, 11783, 2391, 15626, 13323, 17040, 8370, 9064, 16704, 14215, 15025, 18104, 19520, 14555, 15055, 7666, 16242, 10833, 2804, 15495, 12916, 9349, 17915, 8669, 14554, 14640, 10520, 37, 155, 12515, 8664, 11715, 6895, 2267, 5187, 8993, 15323, 17651, 13545, 8356, 13494, 14489, 3064, 10180, 15725, 12356, 13426, 13191, 7454, 4853, 16331, 17706, 1290, 10461, 7844, 10569, 12969, 17345, 11730, 18716, 4266, 14507, 19575, 3334, 17872, 11545, 44, 14847, 12757, 1456, 15515, 13470, 12196, 15065, 9022, 10778, 16213, 15238, 14787, 18861, 19607, 8320, 14387, 11168, 16838, 11714, 10372, 18887, 12016, 197, 9508, 16570, 5038, 11498, 2690, 19748, 5312, 4541, 13369, 5267, 13720, 256, 12380, 12620, 605, 15254, 6988, 10580, 17265, 14365, 9690, 9399, 5842, 610, 8985, 1657, 8061, 17978, 7839, 16455, 745, 10386, 11419, 5055, 18362, 9618, 17098, 19700, 18933, 12708, 1895, 16263, 9971, 11001, 17491, 13201, 14749, 15772, 2013, 11955, 6891, 391, 8256, 11983, 10947, 19409, 17843, 1379, 14926, 15527, 13950, 11117, 14422, 17560, 15328, 14464, 6870, 9002, 12930, 729, 19368, 2755, 10705, 14613, 19000, 13042, 13074, 15666, 3440, 13969, 13729, 411, 16825, 17894, 14906, 1544, 13900, 17398, 15410, 10167, 10080, 19490, 12006, 17896, 13043, 17675, 296, 18065, 12786, 13493, 15912, 14256, 10320, 15361, 13060, 14959, 3228, 727, 12840, 12732, 15555, 9330, 15090, 9258, 10278, 10532, 78, 10525, 18682, 6015, 8420, 12768, 17187, 13559, 19034, 14980, 2875, 9721, 10952, 14311, 9584, 12047, 17053, 19557, 2752, 17943, 14536, 9641, 15101, 10702, 3671, 10404, 4436, 16076, 10757, 11000, 7979, 9640, 14670, 9968, 4793, 7725, 5090, 9202, 14816, 17605, 17004, 9517 ]
STX_10096.0
[ [ "@mug&#233; The guy is still refusing to have a written a contract, i know he didn&#39;t signup a written contract infact i never did that with any of my client before. but his point seems to be invalid because he wanted me to work for 4 months. i knew all those areas where i had been working on. he would have said beforehand \" ; look we are bankrupt and we can&#39;t afford your services so please stop working \" ; so it doesn&#39;t make sense here. i given gave him a discount of $1k and asked him to pay in $3k into 2 installments. i did favor but what a jerk", "692" ], [ "What are the ways of protecting your income while working as a freelancer?\r\n\r\nI did contract work for a company day and night for 4 months, full-time.\r\n\r\nThey were supposed to pay those 4 months of fees when everything was finished.\r\nI took care of every single detail on their website, a TV commercial, designing, SEO and social media. And it takes a while to do the final touches.\r\n\r\nAfter 4 months, when I sent an invoice for $4000, they responded by locking me out of their FTP, cPanel and client portal and stopped responding to my emails.\r\n\r\nI don&#39;t have any other way to generate my revenue. I am married, I have a family to support, and so on. I am under a great of stress.\r\n\r\nWe didn&#39;t sign a physical contract, but instead worked under spoken agreement; the company is from Arizona, USA and I reside in Pakistan. This company was introduced to me through an established contact.\r\n\r\nWhat can I do here to defend myself, and get my funds from them?\r\n\r\nI know I can always hurt their company reputation through google, reviews and probably launch a website against them but what I&#39;m looking for are the funds which I worked for.", "174" ], [ "I appreciate all your comments on this but i am stuck , i don&#39;t see a solution of getting myself paid. i can&#39;t afford my daughter&#39;s doctor fees, its getting so complicated. do you think if i submit my case to the court of arizona, is there any chance they would take this seriously? what are the chances? i have written emails from the employees who was always asking me to make the changes and promised to pay the payroll one he is back from his tour but he never released the funds. but i don&#39;t have a written contract from him.. please advise", "174" ], [ "There are couple of things that i would like to point out which i think would bring up the new ways to think of it,\n\nFirst of well, as soon as the company started, everything was provided to me and i was said to have payroll by their representative of the computer, who was very nice. but as soon as this representative left. new representative took her and never cared to pay at the end. which is ofcourse even after 4 months. but the old representative had the agreement with me, it was spoken agreement. but by keeping all the things in mind, i worked for the company not for the individual.", "622" ], [ "woow this is getting so complicated then i thought.. the last representative agrees that he had the oral contract with me and he is ready to testify this infront of all. he is a very good dude but this new doesn&#39;t even reply to my emails. i guess i will need to find a good lawyer from Arizona on contingency fees who could handle this smoothly. you seem to have alot of knowledge about this area, could you please redirect to some of the relevant website where i could find an honest lawyer?", "174" ], [ "@mug&#233; , Hi <PERSON>, finally writing to BBB , client agreed to pay $2k , which i agreed on , however here is the another problem , i use Western Union only for my transaction and i don&#39;t have any other way to get paid for years. i find Western Union very much reliable but client has no time to go their store and so he asked for paypal account and paypal doesn&#39;t provide its service for my country. so i gave him my friend&#39;s paypal but after receiving $1k through paypal , paypal froze his account and rejected his document and its taking forever. is there any way to get the funds out of paypal?", "687" ], [ "I can get the right return of the program,but the check50 keeping saying something went wrong, here is my code,can anyone help me check what&#39;s wrong,thank you!\r\n\r\n #include < stdio.h > \r\n #include < cs50.h > \r\n #include < math.h > \r\n\r\n int main(void)\r\n {\r\n float f;\r\n int n;\r\n int a;\r\n int b;\r\n do\r\n {\r\n printf( \" ;how many change owened \" ;);\r\n f= GetFloat();\r\n }\r\n while(f < 0);\r\n \r\n n=round(f*100);\r\n a=n/25;\r\n b=n%25;\r\n \r\n if(b == 0)\r\n {\r\n printf( \" ;%d\\a \" ;,a);\r\n }\r\n else if(b > 0)\r\n {\r\n a=a+b/10;\r\n b=b%10;\r\n if(b == 0)\r\n {\r\n printf( \" ;%d\\a \" ;,a);\r\n }\r\n else if(b > 0)\r\n {\r\n a=a+b/5;\r\n b=b%5;\r\n if(b == 0)\r\n {\r\n printf( \" ;%d\\a \" ;,a);\r\n }\r\n else if(b > 0)\r\n {\r\n a=a+b;\r\n printf( \" ;%d\\a \" ;,a);\r\n }\r\n }\r\n }\r\n }", "636" ], [ "Trying to create a periodic table that shows \" ;where \" ; elements are made. For example big bang, cosmic rays, stars, supernovae etc...but reading a lot about gold,and other heavy neutron rich elements, being formed in colliding neutron stars. Is there a definitive list of elements that may have been formed in neutron stars?", "556" ], [ "Websites can detect that you are using Tor because there are lists of every Tor exit node (just compare IP Addresses and *voila!*) Because Gmail (i.e. Google) knows you are using Tor, they know you are not really the client you say you are. When Google sends you the email about a login from a different location, and you don&#39;t reset the password, you are confirming that the login was you.\r\n\r\nCookies are only cross browser if they are [Local Share Objects (LSO)][1] (i.e. Flash cookies). If the Tor Browser does not allow Flash, the cookies will not carry over to the browser. Look at [your Flash Player settings][2] to see and manage your flash cookies.\r\n\r\nI hope this answers your question.\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "620" ] ]
327
[ 237, 7823, 15966, 18175, 646, 16586, 12360, 10005, 9064, 4100, 11772, 6881, 12155, 12019, 4016, 18570, 2694, 15067, 14399, 5280, 14388, 8031, 2656, 7322, 10178, 955, 13503, 14063, 17052, 5298, 3878, 7496, 6719, 186, 14476, 16716, 3844, 4805, 2175, 15299, 15238, 15020, 3051, 15882, 13603, 16395, 14780, 2824, 10532, 5955, 11141, 1456, 13537, 12740, 9249, 17326, 6086, 4777, 10569, 2992, 7663, 14891, 1593, 7435, 15473, 13640, 11547, 15421, 19476, 18822, 17943, 19510, 6005, 19531, 10555, 3288, 10528, 11670, 14862, 2380, 14547, 15828, 7984, 9118, 9778, 12532, 18245, 6822, 9728, 17218, 4948, 13818, 17386, 15032, 12563, 16597, 15490, 12157, 17950, 11788, 15289, 14412, 15976, 6266, 14430, 10737, 4793, 5820, 12490, 3866, 7930, 5224, 13330, 14509, 7949, 17758, 6351, 12963, 19660, 11265, 8987, 15599, 7418, 15451, 13137, 19489, 605, 18949, 6404, 1685, 10700, 13432, 19, 15629, 18951, 11233, 31, 6244, 11775, 13998, 11398, 12240, 17978, 3709, 14903, 7511, 16873, 19675, 7971, 15254, 12603, 12349, 13781, 14152, 17934, 167, 9158, 8256, 3314, 19700, 11317, 12267, 1783, 4342, 834, 12779, 9678, 6567, 12170, 15495, 13144, 8882, 7844, 7300, 10916, 6267, 12604, 7236, 11804, 14361, 3333, 10343, 11268, 15070, 4012, 13323, 12882, 7674, 10880, 2549, 2336, 14910, 5583, 3960, 8241, 19294, 10448, 10580, 14925, 2122, 12672, 17175, 14708, 10391, 1909, 15727, 5392, 16514, 11001, 6173, 16327, 2933, 11161, 12013, 13438, 15140, 14073, 2309, 16986, 19543, 9125, 5268, 280, 4210, 6891, 9666, 11682, 16839, 411, 13265, 19017, 12228, 14518, 17552, 9508, 14440, 11277, 12554, 17178, 5220, 19757, 14969, 14311, 10234, 15139, 4850, 12946, 11511, 7966, 17719, 13952, 6594, 15058, 14506, 7964, 11646, 727, 11791, 12433, 13927, 9029, 18071, 17872, 12600, 13993, 4156, 11510, 13341, 19542, 13741, 9947, 14010, 14596, 2130, 3082, 7442, 18673, 5745, 13186, 6522, 6280, 6365, 18179, 12102, 14370, 7128, 19364, 10360, 15065, 7740, 324, 8286, 9496, 15568, 14192, 16255, 13969, 10187, 1795, 17782, 16070, 1087, 15672, 6283, 15091, 16903, 16189, 18894, 18117, 10450, 14168, 8231, 7583, 15123, 18043, 10481, 12358, 13559, 14462, 17462, 7597, 87, 11149, 3037, 19287, 11760, 17703, 6309, 11886, 14108, 10549, 1797, 11488, 2841, 16947, 8127, 17711, 16048, 5886, 17597, 9246, 17708, 6501, 18887, 17763, 14717, 19451, 669, 17379, 13705, 13045, 13743, 7272, 18807, 5055, 3021, 18640, 14926, 809, 18899, 11873, 745, 14740, 14258, 4441, 19627, 961, 17834, 7166, 15514, 15983, 236, 7171, 6923, 5954, 5793, 16355, 13711, 3442, 9634, 17918, 15061, 17619, 12016, 15771, 13912, 8165, 15390, 17647, 12116, 12724, 8035, 3795, 11715, 14391, 17548, 15751, 5679, 3422, 17962, 9126, 10372, 15645, 214, 18045, 14124, 15429, 14511, 9746, 4473, 10942, 16808, 10099, 11135, 5097, 15112, 17399, 2225, 9641, 9847, 14906, 9301, 12683, 10520, 17773, 14642, 19657, 14203, 18934, 12057, 2716, 13828, 19773, 12392, 1322, 19028, 5066, 196, 9883, 3911, 11627, 18087, 13007, 9829, 19595, 6892, 11325, 6922, 2304, 15166, 14548, 15375, 14217, 15265, 9318, 19780, 4993, 11710, 5667, 12249, 2376, 12911, 13481, 13016, 8777, 7820, 158, 19427, 7735, 10109, 7423, 11352, 1626, 14677, 16642, 8848, 12610, 14415, 16696, 14297, 15021, 19690, 13663, 16228, 17666, 19438, 1603, 13775, 15354, 5029, 13710, 9349, 10540, 14998, 14967, 14401, 12860, 13282, 14182 ]
STX_1009606.0
[ [ "maybe, but this site is as much about teaching as is it is about answers. <PERSON> gave a good explanation to the same solution which caused <PERSON> to go read about `group by` statement. <PERSON> will gain much more from that than simply implementing a solution and not understanding it. Also, this not providing an explanation will not benefit people who are looking for a similar answer in the future.", "727" ], [ "**Goal 1:** To change a subfolder \" ;thumbs \" ; to \" ;thumb \" ; if only one level deep.\r\n\r\n**Example Input:**\r\n \r\n ./foo1/thumbs\r\n ./foo2/thumbs\r\n ./foo2/thumbs\r\n\r\n**Solution:**\r\n\r\n find . -maxdepth 2 -type d | sed &#39;p;s/thumbs/thumb/&#39; | xargs -n2 mv\r\n\r\n**Output:**\r\n\r\n ./foo1/thumb\r\n ./foo2/thumb\r\n ./foo2/thumb\r\n\r\n**Explanation:**\r\n\r\nUse `find` to give you all \" ;thumbs \" ; folders only **one** level deep. Pipe the output to `sed`. The `p` option prints the input line and the rest of the `sed` command changes \" ;thumbs \" ; to \" ;thumb \" ;. Finally, pipe to `xargs`. The `-n2` option tells `xargs` to use **two** arguments from the pipe and pass them to the `mv` command.\r\n\r\n**Issue:**\r\n\r\nThis will not catch deeper subfolders. You can&#39;t simple not use depth here because `find` prints the output from the top and since we are replacing things with `sed` before we `mv`, `mv` will result in a error for deeper subfolders. For example, ./foo/thumbs/thumbs/ will not work because `mv` will take care of ./foo/thumbs first and make it ./foo/thumb, but then the next output line will result in an error because ./foo/thumbs/thumbs/ no longer exist.\r\n\r\n**Goal 2:** To change **all** subfolders \" ;thumbs \" ; to \" ;thumb \" ; regardless of how deep.\r\n\r\n**Example Input:**\r\n \r\n ./foo1/thumbs\r\n ./foo2/thumbs\r\n ./foo2/thumbs/thumbs\r\n ./foo2/thumbs\r\n\r\n**Solution:**\r\n\r\n find . -type d | awk -F&#39;/&#39; &#39;{print NF, $0}&#39; | sort -k 1 -n -r | awk &#39;{print $2}&#39; | sed &#39;p;s/\\(.*\\)thumbs/\\1thumb/&#39; | xargs -n2 mv\r\n\r\n**Output:**\r\n\r\n ./foo1/thumb\r\n ./foo2/thumb\r\n ./foo2/thumb/thumb\r\n ./foo2/thumb\r\n\r\n**Explanation:**\r\n\r\nUse `find` to give you all \" ;thumbs \" ; subfolders. Pipe the output to `awk` to print the number of &#39;/&#39;s in each path plus the original output. `sort` the output numerically, in reverse (to put the deepest paths on top) by the number of &#39;/&#39;s. Pipe the sorted list to `awk` to remove the counts from each line. Pipe the output to `sed`. The `p` option prints the input line and the rest of the `sed` command finds the **last** occurrence of \" ;thumbs \" ; and changes only it to \" ;thumb \" ;. Since we are working with sorted list in the order of deepest to shallowest level, this will provide `mv` with the right commands. Finally, pipe to `xargs`. The `-n2` option tells `xargs` to use **two** arguments from the pipe and pass them to the `mv` command.", "879" ], [ "Here&#39;s a way using split:\r\n\r\n start_desc = &#39;hello&#39;\r\n end_desc = &#39;bye&#39;\r\n str = &#39;hello 12345\\nabcd asdf\\nqwer qwer erty\\n bye&#39;\r\n\r\n print str.split(&#39;hello&#39;)[1].split(&#39;bye&#39;)[0]\r\n\r\nThe first split will result in:\r\n\r\n (&#39;&#39;, &#39; 12345\\nabcd asdf\\nqwer qwer erty\\n bye&#39;)\r\n\r\nSo feed the second element to the second split and it will result in:\r\n\r\n (&#39;12345\\nabcd asdf\\nqwer qwer erty\\n &#39;, &#39;&#39;)\r\n\r\nUse the first element.\r\n\r\nYou can then use `strip()` to remove the surrounding spaces if you wish.", "349" ], [ "If I understand your question correctly, you don&#39;t needed anything more than `scp`, `ssh` and a couple of shell scripts.\r\n\r\nLet&#39;s say you want to deploy your code from **serverA** to **serverB**.\r\n\r\nOn **serverB**, create a directory with you `Dockerfile`. Also, create a shell script, let&#39;s call it `build_image.sh`, that runs your docker build command using `sudo`.\r\n\r\nAlso, on **serverB**, create a shell script that builds your code from source (if necessary).\r\n\r\nFinally, on **serverB**, create a shell script that calls your code build script, your docker build script and at the end runs your new docker image. Let call this script `do_it_all.sh`.\r\n\r\nMake sure that you `chmod 755` all shell scripts.\r\n\r\nNow, on **serverA**, you have a directory with the source code. `scp` that directory to **serverB** into the directory with the `Dockerfile`.\r\n\r\nNext, from **serverA** use `ssh` to call `do_it_all.sh` on **serverB**. This will build your code, build your image and deploy a container without the need for extra software, packages, git, DNS records, etc.\r\n\r\nYou can even automate this process using cron or something else to have nightly deployments, if you wish, or deployments under other conditions.\r\n\r\n**Example scripts/commands:**\r\n\r\nOn **serverB:**\r\n\r\nbuild_image.sh:\r\n\r\n #!/bin/bash\r\n sudo docker build -t my_image\r\n\r\nbuild_code.sh (optional, adjust to your code):\r\n\r\n #!/bin/bash\r\n cd /path/to/my/code\r\n ./configure\r\n make\r\n\r\ndo_it_all.sh:\r\n\r\n #!/bin/bash\r\n cd /path/to/my/dockerfile\r\n sudo docker stop my_container #stop the old container\r\n sudo docker rm my_container #remove the old container\r\n sudo docker rmi my_image #remove the old image\r\n ./build_code.sh #comment out if not needed\r\n ./build_image.sh\r\n sudo docker run -d --name my_container my_image\r\n\r\nOn **serverA:**\r\n\r\n scp -r /path/to/my/code serverB:/path/to/my/dockerfile\r\n ssh serverB &#39;/path/to/my/dockerfile/do_it_all.sh&#39;\r\n\r\nThat should be it. Adjust for your system.\r\n\r\nTo deploy to a brand new system, just write a script on **serverA** that uses `ssh` to copy create necessary directories on **serverB** `ssh serverB &#39;mkdir /path/to/dockerfile&#39;`. Next, copy your `Dockerfile` and your build scripts and your code from **serverA** to **serverB** using `scp`. Then run `do_it_all.sh` on **serverB** from **serverA** using `ssh`.", "324" ], [ "**Solution:**\r\n\r\n 1[5-9][0-9]|200|7[0-4][0-9]|750\r\n\r\n**Explanation:**\r\n\r\nSince you have a very well defined ranges, the regex is fairly simple.\r\n\r\nIt can be broken up into two parts:\r\n\r\n 1. 150 **through** 199 **OR** 200\r\n 2. 700 **through** 749 **OR** 750\r\n\r\nSo, put together the regex will read as \r\n\r\n((150 **through** 199 **OR** 200) **OR** (700 **through** 749 **OR** 750))\r\n\r\nYour first number is 150, so we will have to match a &#39;1&#39; for the first digit followed by the range for the second digit which could be 5 though 9 (you don&#39;t want anything less that 150, so 4 and less are out) and also followed by the range for the third digit which could be anything from 0 to 9. This captures all numbers from 150 to 199.\r\n\r\nThe last number in the first range is 200, so we can just look for that. It is too different from the rest of the possibilities in the range, thus it is easier to look for specifically for it instead of trying to think of a complex way of including it in a regex range.\r\n\r\nThe second range follows the same patten but with different numbers. Again, we are looking for most of the numbers by using the regex range and looking for the last number, 750, specifically since it is too different -- has a number 5 in the middle. If we include 5 in the middle regex range, it will go up to 759, which is outside of the scope.\r\n\r\nFinally, **OR** both parts and the regex is ready.\r\n\r\nAdjust for your input. You may need to surround it with ^ and $ for the beginning and the end of the line or if your input has other text surrounding the number in question, expand your regex to deal with it appropriately.", "772" ], [ "Your JSON is not valid.\r\n\r\nIssues:\r\n\r\n - `None` should become `null`\r\n - `True` should become `true`\r\n - `False` should become `false`\r\n - URLs cannot have double-quotes within them. Change them to single-quotes or escape.\r\n - ` \" ;source \" ;: \" ; < a href= \" ;_URL_1_; rel= \" ;nofollow \" ; > SNS Analytics < /a > \" ;` should become ` \" ;source \" ;: \" ; < a href=&#39;_URL_2_; rel=&#39;nofollow&#39; > SNS Analytics < /a > \" ;`\r\n - You have a long in there that ends in an `L` - `660902084456288256L`. Remove the `L` and make it just `660902084456288256`.\r\n - Also, when you parse it, make sure there are no u&#39;s in front of any strings, but this may be just because of how it printed out unicode, so just make sure.\r\n\r\nHere is the valid JSON: _URL_0_\r\n\r\nIn the future, you can use JSONLint to validate your data: _URL_4_\r\n\r\nCheck out _URL_3_. On the right side there is a white rectangular focus block that specifies the correct syntax and all valid types.", "652" ], [ "Here&#39;s one way using `tr` and `sed`:\r\n\r\n tr &#39;\\n&#39; &#39; &#39; < file.xml | sed &#39;s/ > [ \\t]* < / > < /g&#39; | sed &#39;s/ < \\/root > < root > / < \\/root > \\n < root > /g&#39;\r\n\r\nSo, basically, you are replacing all new lines with a regular space using `tr` because it handles multiple lines better then `sed`. Then you are using `sed` to trim down the extra spaces and finally separate `root` elements by a new line.\r\n\r\n**UPDATE**: the command now removes both spaces and tabs.", "112" ], [ "how about this:\r\n\r\n for word in inaugural:\r\n\r\n word = word.lower().replace(&#39;,&#39;, &#39;&#39;).replace(&#39;;&#39;,&#39;&#39;).replace(&#39;.&#39;,&#39;&#39;))\r\n if len(word.strip()) > 0:\r\n if word in stopwords:\r\n w_stp.update([word])\r\n else:\r\n wo_stp.update([word])\r\n\r\nadd more punctuation as needed.\r\n\r\n**EXPLANATION**:\r\n\r\nWhile processing each `word`, check if it has punctuation. If it does, remove it. Next, check if the entire word was a punctuation. If it was, the length will be 0 and there is not need to further process it. Otherwise, process the rest of the words.\r\n\r\n**ORIGINAL SUGGESTION**\r\n\r\n def content_text(inaugural):\r\n inaugural = inaugural.replace(&#39;,&#39;, &#39;&#39;).replace(&#39;;&#39;,&#39;&#39;).replace(&#39;.&#39;,&#39;&#39;))\r\n (... the rest of the method...)\r\n\r\nThis was wrong since `inaugural` isn&#39;t a string. @Sam noticed this error.", "829" ], [ "@ArtOfWarfare if there are spaces there already, then removing punctuation won&#39;t name the text one long string. if there are, then perhaps it was intended this way. replacing punctuation with spaces changes the integrity of the original text. now we&#39;re making assumptions and they are typically prone to error. if we introduce new spaces into the text, they may affect future text manipulation.", "655" ], [ "The problem is that you are using a wildcard - `*` in your Popen command. You need to use `shell=True` in your Popen statement to execute the command through a shell interpreter and allow the use of the wildcards.\r\n\r\n p1 = subprocess.Popen(vars, stdout = open ( \" ;/tmp/test.txt \" ;, \" ;a \" ;), shell=True)\r\n\r\nThat will get rid of the ` md5sum: folder1/check*.md5: No such file or directory` error.\r\n\r\nHowever, I think you should really be using Python&#39;s native methods described here\r\n\r\n_URL_1_\r\n\r\nor here\r\n\r\n_URL_0_", "227" ], [ "You need to set the field separator to a space.\r\n\r\n OIFS=$IFS #save the original\r\n IFS=$ \" ;\\ \" ; #set to space\r\n current_dir= \" ;some dir with spaces \" ;\r\n scp_current_dir= \" ;some\\\\ dir\\\\ with\\\\ spaces \" ;\r\n dir_name= \" ;another dir with spaces \" ;\r\n scp_dir_name= \" ;another\\\\ dir\\\\ with\\\\ spaces \" ;\r\n if ssh user@ip -i key test -d $current_dir; then\r\n echo \" ;Directory exists. Ready to copy $dir_name. \" ;\r\n scp -i key -r \" ;$current_dir/$dir_name \" ; user@$ip: \" ;$scp_current_dir/$scp_dir_name \" ;\r\n else\r\n echo Directory doesn\\&#39;t exist. Making a new directory.\r\n ssh user@$ip -i key mkdir $current_dir\r\n scp -i key -r \" ;$current_dir/$dir_name \" ; user@$ip: \" ;$scp_current_dir/$scp_dir_name \" ;\r\n fi\r\n IFS=$OIFS #reset it back to the original", "883" ] ]
411
[ 17272, 16280, 7756, 17438, 14142, 13635, 6366, 14470, 19601, 15068, 12443, 11858, 16858, 11484, 12896, 11125, 8679, 7842, 18841, 13124, 15482, 471, 13963, 9541, 17674, 2474, 10721, 4401, 1937, 944, 2344, 6483, 19039, 5825, 17183, 309, 6986, 17655, 15477, 3107, 17328, 2170, 5857, 2155, 6475, 3942, 2095, 15494, 15437, 15529, 18513, 211, 11720, 14087, 8943, 13445, 14028, 10497, 9321, 8271, 10376, 19791, 3780, 6025, 377, 6668, 3274, 3720, 3804, 526, 6258, 6329, 9712, 7522, 17948, 5487, 3300, 1390, 1251, 13701, 2634, 15774, 4807, 17990, 4673, 5459, 8218, 10768, 18485, 8512, 5483, 13196, 10973, 17810, 14078, 5223, 15334, 4134, 4657, 9513, 14742, 19129, 3310, 5290, 6815, 702, 4267, 18360, 16977, 15732, 13885, 13510, 3735, 4896, 11280, 12485, 17448, 13090, 15724, 16285, 8393, 4333, 17779, 11786, 14818, 2121, 11285, 1514, 9654, 10359, 1090, 4380, 18377, 19260, 9834, 10201, 11686, 109, 13853, 13733, 2434, 1817, 7114, 11809, 4487, 12298, 1237, 480, 8648, 15904, 2379, 9791, 10444, 13399, 3148, 1712, 832, 6068, 5966, 12856, 6786, 16895, 9987, 18975, 19094, 17110, 17245, 14722, 14785, 13702, 13104, 10997, 10282, 18988, 8040, 11353, 301, 15969, 2632, 12913, 10149, 17986, 8849, 12036, 16909, 18297, 17936, 399, 10529, 1515, 5236, 1040, 2747, 3336, 5859, 11003, 16953, 1540, 3990, 6129, 3027, 2821, 6615, 328, 9171, 14884, 5423, 14541, 2415, 17125, 10123, 8712, 9018, 14290, 19265, 17415, 4737, 15365, 9900, 17910, 7638, 16537, 8792, 15319, 5409, 16834, 5867, 8587, 5500, 25, 9185, 3864, 5874, 11910, 17824, 14761, 12084, 12775, 641, 6525, 2296, 6414, 5162, 8072, 7178, 1077, 12710, 2115, 2310, 15858, 3663, 13480, 16106, 10588, 17996, 12706, 14606, 3074, 8486, 11688, 8382, 15820, 16405, 11187, 9555, 19232, 13874, 15384, 3371, 8007, 6991, 9960, 16382, 9683, 8676, 14382, 18244, 6437, 17997, 13289, 12928, 1054, 15886, 6642, 3151, 6930, 15431, 675, 5711, 4330, 7613, 6264, 6388, 12351, 13281, 19385, 14658, 7647, 5770, 16912, 6336, 7760, 1881, 18775, 9681, 11056, 16643, 402, 12854, 9929, 18103, 14580, 2705, 17854, 5906, 2047, 18414, 19488, 9234, 14773, 10377, 11537, 2714, 10269, 10822, 10311, 12862, 17573, 10685, 176, 8930, 17288, 8232, 11611, 15879, 18528, 2889, 7717, 18701, 12965, 9928, 18661, 14783, 4823, 10469, 14405, 5448, 9633, 8164, 8975, 16684, 18073, 1288, 6168, 13509, 1553, 9888, 18351, 1581, 6044, 7775, 18646, 16415, 8565, 19068, 348, 2114, 5233, 126, 14033, 16822, 1949, 10160, 6609, 372, 13681, 12034, 6220, 6347, 17891, 2557, 16062, 2315, 14341, 16343, 3169, 12090, 8172, 1671, 8444, 17895, 4269, 9734, 13657, 3429, 1516, 14275, 9909, 1446, 19737, 8572, 17395, 8741, 8359, 16267, 1468, 13275, 17430, 12307, 19194, 17766, 13611, 18532, 9040, 5316, 18700, 10465, 2669, 6796, 1653, 1818, 10743, 3006, 14543, 5611, 1184, 9630, 12945, 13288, 18254, 9232, 2792, 2676, 16503, 6083, 8177, 17283, 10341, 18408, 15338, 10473, 10642, 4275, 3914, 8485, 711, 17506, 5964, 9635, 13903, 13294, 1985, 2931, 9881, 7655, 275, 15631, 14156, 14866, 13446, 8794, 19469, 10453, 14404, 7140, 6981, 18167, 8964, 17670, 9745, 9411, 8470, 19372, 9021, 6734, 8068, 18, 14644, 12793, 9912, 1632, 12220, 1320, 2444, 7167, 487, 18012, 5071, 9379, 3787, 10526, 13080, 3617, 938, 17188, 9331, 14214, 3905, 18733 ]
STX_1009922.0
[ [ "Here is a way to do it without a regular expression: \r\n\r\n value.toLocaleString( \" ;en-US \" ;, { maximumFractionDigits: 2 })\r\n\r\n\r\n < !-- begin snippet: js hide: false console: true babel: false -- > \r\n\r\n < !-- language: lang-js -- > \r\n\r\n function formatValue() {\r\n var source = document.getElementById( \" ;source \" ;);\r\n var output = document.getElementById( \" ;output \" ;);\r\n var value = parseFloat(source.value);\r\n output.innerText = value.toLocaleString( \" ;en-US \" ;, { maximumFractionDigits: 2 });\r\n }\r\n\r\n\r\n < !-- language: lang-html -- > \r\n\r\n < input id= \" ;source \" ; type= \" ;text \" ; / > \r\n < button onclick= \" ;formatValue() \" ; > Format < /button > \r\n < div id= \" ;output \" ; > < /div > \r\n\r\n\r\n < !-- end snippet -- >", "933" ], [ "If the image is already loaded when you call `pic.addEventListener( \" ;load \" ;, ...)`, the load event handler will not be triggered. You should call it if `pic.complete` is true, as suggested in [this answer][1].\r\n\r\n < !-- begin snippet: js hide: false console: true babel: false -- > \r\n\r\n < !-- language: lang-js -- > \r\n\r\n var pics = document.querySelectorAll( \" ;img \" ;);\r\n var pic;\r\n\r\n for (i = 0; i < pics.length; i++) {\r\n pic = pics[i];\r\n if (pic.complete) {\r\n // The image is already loaded, call handler\r\n checkImage(pic);\r\n } else {\r\n // The image is not loaded yet, set load event handler\r\n pic.addEventListener( \" ;load \" ;, function() {\r\n checkImage(this);\r\n })\r\n }\r\n }\r\n\r\n function checkImage(img) {\r\n if (img.naturalHeight > img.naturalWidth) {\r\n img.classList.add( \" ;portrait \" ;)\r\n } else {\r\n img.classList.add( \" ;landscape \" ;)\r\n }\r\n }\r\n\r\n < !-- language: lang-css -- > \r\n\r\n img {\r\n border: 1px solid;\r\n }\r\n\r\n .landscape {\r\n border-color: red;\r\n }\r\n\r\n .portrait {\r\n border-color: blue;\r\n }\r\n\r\n < !-- language: lang-html -- > \r\n\r\n < img src= \" ;//_URL_0_;\r\n < img src= \" ;//_URL_2_;\r\n\r\n < !-- end snippet -- > \r\n\r\nThanks to <PERSON>. I borrowed the image links and the style attributes from his answer.\r\n\r\n\r\n [1]: _URL_1_", "285" ], [ "The following method generates a new random number in the [min, max] range and makes sure that this number differs from the previous one, without looping and without recursive calls (`Math.random()` is called only once):\r\n\r\n - If a previous number exists, decrease max by one\r\n - Generate a new random number in the range\r\n - If the new number is equal to or greater than the previous one, add one < br/ > \r\n(An alternative: If the new number is equal to the previous one, set it to max + 1)\r\n\r\nIn order to keep the previous number in a closure, `getNumber` can be created in an IIFE:\r\n\r\n < !-- begin snippet: js hide: false console: true babel: false -- > \r\n\r\n < !-- language: lang-js -- > \r\n\r\n // getNumber generates a different random number in the inclusive range [0, 4]\r\n var getNumber = (function() {\r\n var previous = NaN;\r\n return function() {\r\n var min = 0;\r\n var max = 4 + (!isNaN(previous) ? -1 : 0);\r\n var value = Math.floor(Math.random() * (max - min + 1)) + min;\r\n if (value > = previous) {\r\n value += 1;\r\n }\r\n previous = value;\r\n return value;\r\n };\r\n })();\r\n\r\n // Test: generate 100 numbers\r\n for (var i = 0; i < 100; i++) {\r\n console.log(getNumber());\r\n }\r\n\r\n < !-- language: lang-css -- > \r\n\r\n .as-console-wrapper {\r\n max-height: 100% !important;\r\n top: 0;\r\n }\r\n\r\n < !-- end snippet -- > \r\n\r\nThe [min, max] range is made [inclusive][1] by adding 1 to `max - min` in the following statement:\r\n\r\n var value = Math.floor(Math.random() * (max - min + 1)) + min;\r\n\r\nThis is not a requirement in the question but it feels more natural to me to use an inclusive range.\r\n\r\n [1]: _URL_0_", "418" ], [ "**Method 1 - Parse with regular expression, format output with toLocaleString**\r\n\r\nIn this code snippet, the `string.match` method is used to parse the date string. A date object is then created with the date parts, and `toLocaleString( \" ;en-US \" ;)` is used to get the US date format:\r\n\r\n < !-- begin snippet: js hide: false console: true babel: false -- > \r\n\r\n < !-- language: lang-js -- > \r\n\r\n function convertDate(regdate) {\r\n var m = regdate.match(/(\\d+)-(\\d+)-(\\d+)\\s+(\\d+):(\\d+):(\\d+)/);\r\n var date = new Date(m[3], m[2] - 1, m[1], m[4], m[5], m[6]);\r\n return date.toLocaleString( \" ;en-US \" ;);\r\n }\r\n\r\n < !-- language: lang-html -- > \r\n\r\n Date: < input id= \" ;txtDate \" ; type= \" ;text \" ; value= \" ;<PHONE_NUMBER>:00:00 \" ; / > \r\n < button onclick= \" ;console.log(convertDate(document.getElementById(&#39;txtDate&#39;).value)) \" ; > Convert < /button > \r\n\r\n < !-- end snippet -- > \r\n\r\n**Method 2 - Parse and replace with regular expression**\r\n\r\nIn the second code snippet, the `string.replace` method is used to modify the date string: a regular expression parses the original date string, and a replacement function recombines the various parts:\r\n\r\n < !-- begin snippet: js hide: false console: true babel: false -- > \r\n\r\n < !-- language: lang-js -- > \r\n\r\n function convertDate(regdate) {\r\n return regdate.replace(/(\\d+)-(\\d+)-(\\d+)\\s+(\\d+):(\\d+):(\\d+)/,\r\n function(m, v1, v2, v3, v4, v5, v6) {\r\n var hour24 = parseInt(v4, 10);\r\n var hour12 = hour24 % 12 || 12;\r\n var ampm = hour24 < 12 ? \" ;AM \" ; : \" ;PM \" ;;\r\n return `${v2}/${v1}/${v3} ${hour12}:${v5}:${v6} ${ampm}`;\r\n });\r\n }\r\n\r\n < !-- language: lang-html -- > \r\n\r\n Date: < input id= \" ;txtDate \" ; type= \" ;text \" ; value= \" ;<PHONE_NUMBER>:00:00 \" ; / > \r\n < button onclick= \" ;console.log(convertDate(document.getElementById(&#39;txtDate&#39;).value)) \" ; > Convert < /button > \r\n\r\n < !-- end snippet -- > \r\n\r\n**Method 3 - Parse with datejs library, format output with toLocaleString**\r\n\r\nIf you don&#39;t mind using an external library, you can convert the string to a date with [datejs][1] and use `date.toLocaleString( \" ;en-US \" ;)` to format the output:\r\n\r\n < !-- begin snippet: js hide: false console: true babel: false -- > \r\n\r\n < !-- language: lang-js -- > \r\n\r\n var date = Date.parse( \" ;<PHONE_NUMBER>:00:00 \" ;);\r\n console.log(date.toLocaleString( \" ;en-US \" ;));\r\n\r\n < !-- language: lang-css -- > \r\n\r\n .as-console-wrapper {\r\n max-height: 100% !important;\r\n top: 0;\r\n }\r\n\r\n < !-- language: lang-html -- > \r\n\r\n < script src= \" ;_URL_0_;\r\n\r\n\r\n < !-- end snippet -- > \r\n\r\n\r\n [1]: _URL_1_", "764" ], [ "If the display logic is in a service injected in the component, you can call the service from the template to add the toggled class. Additionally, if you want to turn on block display after clicking the button, you can put that logic in the component or in the service (in the example below, that code is in the component).\r\n\r\n**The component:**\r\n\r\n class MyComponent {\r\n private displayBlock = false;\r\n private turnOnBlockDisplay() {\r\n this.displayBlock = true;\r\n }\r\n private getBlockClass() {\r\n return this.displayBlock ? \" ;block \" ; : \" ; \" ;;\r\n } \r\n constructor (private myService: ToggleClassService, ...) {\r\n ...\r\n }\r\n ...\r\n }\r\n\r\n**The service:**\r\n\r\n class ToggleClassService {\r\n private fadeIn = false;\r\n public toggleClass() {\r\n this.fadeIn = !this.fadeIn;\r\n }\r\n public getClass() {\r\n return this.fadeIn ? \" ;fadeInRight \" ; : \" ;fadeOutRight \" ;;\r\n }\r\n }\r\n\r\n**The template:**\r\n\r\n < div [ngClass]= \" ;[&#39;basket&#39;, &#39;animated&#39;, myService.getClass(), getBlockClass()] \" ; > ... < /div > \r\n < button (click)= \" ;myService.toggleClass(); turnOnBlockDisplay(); \" ; > Toggle < /button > \r\n\r\n**The CSS:**\r\n\r\n .basket {\r\n display: inline-block;\r\n ...\r\n }\r\n .basket.fadeInRight {\r\n background-color: red;\r\n }\r\n .basket.fadeOutRight {\r\n background-color: blue;\r\n }\r\n .basket.block {\r\n display: block;\r\n }\r\n\r\nYou can test the code in [this codepen][4] (note: the \" ;service \" ; is not injected).\r\n\r\n\r\n [1]: _URL_3_\r\n [2]: _URL_0_\r\n [3]: _URL_1_\r\n [4]: _URL_2_", "993" ], [ "The very useful book [Numerical Recipes][1] provides a method to fit data to a straight line, with uncertainties in both X and Y coordinates. It can be found [online][2] in these two versions:\r\n\r\n - [Numerical Recipes in C][3], in section 15-3\r\n - [Numerical Recipes in Fortran 77][4], in [section 15-3][5]\r\n\r\nThe method is based on minimizing the & chi; < sup > 2 < /sup > (chi-square) which is similar to the least-square but takes into account the individual uncertainty of each data point. When the uncertainty & sigma; < sub > i < /sub > is on the Y axis only, a weight proportional to 1/ & sigma; < sub > i < /sub > < sup > 2 < /sup > is assigned to the point in the calculations. When the data has uncertainties in the X and Y coordinates, given by & sigma; < sub > xi < /sub > and & sigma; < sub > yi < /sub > respectively, the fit to a straight line\r\n\r\n > y(x) = a + b & middot; x\r\n\r\nuses a & chi; < sup > 2 < /sup > where each point has a weight proportional to\r\n\r\n > 1 / ( & sigma; < sup > 2 < /sup > < sub > <PERSON> < /sub > + b < sup > 2 < /sup > & middot;\r\n > & sigma; < sup > 2 < /sup > < sub > xi < /sub > )\r\n\r\nThe detailed method and the code (in C or Fortran) can be found in the book. Due to [copyright][6], I cannot reproduce them here.\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_0_oldverswitcher.html\r\n [3]: _URL_1_\r\n [4]: _URL_4_\r\n [5]: _URL_3_\r\n [6]: _URL_0_deeplinking.html", "170" ], [ "As suggested by <PERSON>, you can use the `pattern` attribute to validate the input (specify `\\d` to allow only digits), in addition to `required`. The `validity.valid` property of the text field can then be used to enable/disable the button in the `input` event handler:\r\n\r\n < form name= \" ;form1 \" ; > \r\n < input id= \" ;txtPhone \" ; type= \" ;text \" ; name=&#39;text1&#39; pattern= \" ;\\d{9} \" ; required maxlength= \" ;9 \" ; class= \" ;phone-input \" ; > \r\n < input id= \" ;btnSubmit \" ; type= \" ;button \" ; value= \" ;submit \" ; disabled= \" ;disabled \" ; / > \r\n < /form > \r\n < script > \r\n document.getElementById( \" ;txtPhone \" ;).addEventListener( \" ;input \" ;, function () {\r\n document.getElementById( \" ;btnSubmit \" ;).disabled = !this.validity.valid;\r\n });\r\n < /script > \r\n\r\n < !-- begin snippet: js hide: true console: true babel: false -- > \r\n\r\n < !-- language: lang-js -- > \r\n\r\n document.getElementById( \" ;txtPhone \" ;).addEventListener( \" ;input \" ;, function () {\r\n document.getElementById( \" ;btnSubmit \" ;).disabled = !this.validity.valid;\r\n });\r\n\r\n < !-- language: lang-html -- > \r\n\r\n < form name= \" ;form1 \" ; > \r\n < input id= \" ;txtPhone \" ; type= \" ;text \" ; name=&#39;text1&#39; pattern= \" ;\\d{9} \" ; required maxlength= \" ;9 \" ; class= \" ;phone-input \" ; > \r\n < input id= \" ;btnSubmit \" ; type= \" ;button \" ; value= \" ;submit \" ; onclick= \" ;alert(&#39;Submit!&#39;); \" ; disabled= \" ;disabled \" ; / > \r\n < /form > \r\n\r\n < !-- end snippet -- >", "560" ], [ "The problem may be caused by the [ID mangling][1] performed by _URL_1_. Since the modal div is a server control (as specified by `runat= \" ;server \" ;`), its ID in the rendered HTML is not `seasonInfoModal` but something like `MyControl1_seasonInfoModal`. As a result, the Javascript selector `$(&#39;#seasonInfoModal&#39;)` cannot find it.\r\n\r\nYou can change the startup script code, and pass the value of `seasonInfoModal.ClientID` to the jQuery selector, to account for the ID mangling:\r\n\r\n protected void OnSelectedIndexChanged(object sender, GridViewEventArgs e){\r\n ScriptManager.RegisterStartupScript(this, \r\n this.GetType(), \r\n \" ;seasonInfoModal \" ;, \r\n string.Format( \" ;$(&#39;#{0}&#39;).modal(); \" ;, seasonInfoModal.ClientID),\r\n true);\r\n }\r\n\r\n < hr/ > \r\n\r\nOther alternatives to avoid ID mangling would be:\r\n\r\n1. To remove the `runat= \" ;server \" ;` attribute if you don&#39;t need to access the div control in code-behind\r\n2. To add `clientidmode= \" ;static \" ;` to the div.\r\n3. To use a class name (with the corresponding jQuery class selector) instead of an ID for the modal div. \r\n\r\nThese 3 solutions, however, would not behave correctly if several instances of the user control are present in the form. The modal of the first instance would always be used, and in cases 1 and 2, several controls of the form would have the same ID.\r\n\r\n [1]: _URL_0_", "39" ], [ "You can use [Andibioticum&#39;s workaround][1] to get the same behavior in Internet Explorer as in Chrome and Firefox. He inserts a dummy character in the empty selected range, performs the action, and then removes the dummy character.\r\n\r\nI adapted it to your case, using the [IE browser detection technique][2] suggested by <PERSON>, combined with checking for `document.all` for older IE versions. You can see the result in [this jsFiddle][3] and in the code snippet below.\r\n\r\n\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_\r\n [3]: _URL_3_\r\n\r\n\r\n\r\n < !-- begin snippet: js hide: true console: true babel: false -- > \r\n\r\n < !-- language: lang-js -- > \r\n\r\n var range = null;\r\n\r\n document.addEventListener(&#39;selectionchange&#39;, function(event) {\r\n var taget = event.target;\r\n if (_URL_4_ == &#39;main-input&#39;) {\r\n range = getSelectionRange();\r\n }\r\n });\r\n\r\n function isIE() {\r\n return document.all || (!!window.MSInputMethodContext & & !!document.documentMode);\r\n }\r\n\r\n function execBoldCommand() {\r\n if (document.getSelection() != \" ; \" ;) {\r\n document.execCommand(&#39;bold&#39;);\r\n } else {\r\n var s = null;\r\n if (window.getSelection) {\r\n s = window.getSelection();\r\n } else {\r\n s = document.getSelection();\r\n }\r\n\r\n if (isIE()) {\r\n var selRange = s.getRangeAt(0);\r\n\r\n //Insert node with dummy text &#39;d&#39;\r\n var newNode = document.createTextNode(&#39;d&#39;);\r\n selRange.insertNode(newNode);\r\n s.removeAllRanges();\r\n s.addRange(selRange);\r\n\r\n //Execute command on dummy\r\n document.execCommand(&#39;bold&#39;);\r\n\r\n //Delete dummy from range\r\n selRange.setStart(newNode, 0);\r\n selRange.setEnd(newNode, 1);\r\n selRange.deleteContents();\r\n\r\n s.removeAllRanges();\r\n s.addRange(selRange);\r\n } else {\r\n if (range == null) {\r\n range = document.createRange();\r\n }\r\n s.removeAllRanges();\r\n s.addRange(range);\r\n document.execCommand(&#39;bold&#39;);\r\n }\r\n }\r\n }\r\n\r\n function getSelectionRange() {\r\n var sel;\r\n if (window.getSelection) {\r\n sel = window.getSelection();\r\n if (sel.rangeCount) {\r\n return sel.getRangeAt(0);\r\n }\r\n } else if (document.selection) {\r\n return document.createRange();\r\n }\r\n\r\n return null;\r\n }\r\n\r\n $(document).on(&#39;click&#39;, &#39;.icon-bold&#39;, function() {\r\n $(&#39;#main-input&#39;).focus();\r\n execBoldCommand();\r\n });\r\n\r\n\r\n < !-- language: lang-html -- > \r\n\r\n < script src= \" ;_URL_2_;\r\n < div id= \" ;main-input \" ; contenteditable= \" ;true \" ; > Hello world! < /div > \r\n < button type= \" ;button \" ; class= \" ;icon-bold \" ; > Bold < /button > \r\n\r\n < !-- end snippet -- >", "933" ], [ "The flexbox model works if a single column is adjustable, as shown in [**this jsfiddle**][1] (you can modify the right panel width to test the behavior). The code is adapted from [this answer][2] given by [Blender][3]. As specified in your question:\r\n\r\n - The grid is as wide as possible, to fill the container width\r\n - The text column width is adjustable; other column widths are fixed\r\n - The text is truncated when necessary to avoid wrapping\r\n - No Javascript or jQuery code is involved, only HTML and CSS \r\n\r\n < hr/ > \r\n\r\nThe HTML markup is as follows:\r\n\r\n < div class= \" ;wrapper-div \" ; > \r\n < div class= \" ;icon-div \" ; > \r\n < div class= \" ;icon \" ; > < /div > \r\n < /div > \r\n < div class= \" ;text-div \" ; > Lorem ipsum dolor < /div > \r\n < div class= \" ;icon-div \" ; > \r\n < div class= \" ;icon \" ; > < /div > \r\n < /div > \r\n < div class= \" ;number-div \" ; > 24 < /div > \r\n < /div > \r\n < div class= \" ;wrapper-div \" ; > \r\n < div class= \" ;icon-div \" ; > \r\n < div class= \" ;icon \" ; > < /div > \r\n < /div > \r\n < div class= \" ;text-div \" ; > < strong > I_am_the_long_trouble_maker_that_stretches < /strong > < /div > \r\n < div class= \" ;icon-div \" ; > \r\n < div class= \" ;icon \" ; > < /div > \r\n < /div > \r\n < div class= \" ;number-div \" ; > 8 < /div > \r\n < /div > \r\n ...\r\n\r\nThe flexbox is set with this CSS:\r\n\r\n .wrapper-div {\r\n display: flex;\r\n align-items: center;\r\n }\r\n \r\n .icon-div {\r\n flex: 0 0 auto; /* Width adjusted to content, not allowed to grow or shrink */\r\n padding: 4px 6px;\r\n }\r\n \r\n .text-div {\r\n text-align: left;\r\n white-space: nowrap;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n min-width: 0;\r\n flex: 1 0 0px; /* Adjustable width, will grow to take available space */\r\n }\r\n \r\n .number-div {\r\n flex: 0 0 32px; /* Width set to 32px, not allowed to grow or shrink */\r\n }\r\n \r\n .icon-div .icon {\r\n background: #8da2b5;\r\n border-radius: 3px;\r\n display: block;\r\n height: 23px;\r\n width: 23px;\r\n }\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_\r\n [3]: _URL_2_", "70" ], [ "@brillout.com - Here are a few unofficial documents which explain when the page layout is up to date and methods to force a repaint: (1) [<PERSON> list](_URL_1_), (2) [an article by <PERSON>_), (3) the \" ;classic \" ; [offsetHeight call](_URL_0_). As I understand it, making a call to get an element position or size will force a repaint if necessary.", "395" ], [ "According to various sources, getting the position or size of a DOM element will trigger a repaint of the output if necessary, so that the returned values are correct. As a matter of fact, reading the `offsetHeight` of an element has become a way to force a repaint, as reported by [<PERSON>] and [<PERSON>].\r\n\r\n\r\n[<PERSON>] gives a list of several actions that cause a repaint or a reflow. Among them are these element box metrics methods and properties:\r\n\r\n > - elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, \r\n > - elem.offsetParent elem.clientLeft, elem.clientTop, elem.clientWidth,\r\n > - elem.clientHeight elem.getClientRects(), elem.getBoundingClientRect()\r\n\r\n[<PERSON>] describes strategies used by browsers to optimize repaints (e.g. queueing DOM changes and performing them in batches), and adds the following remark:\r\n\r\n > But sometimes the script may prevent the browser from optimizing the\r\n > reflows, and cause it to flush the queue and perform all batched\r\n > changes. This happens when you request style information, such as\r\n > \r\n > 1. offsetTop, offsetLeft, offsetWidth, offsetHeight\r\n > 2. scrollTop/Left/Width/Height \r\n > 3. clientTop/Left/Width/Height\r\n > 4. getComputedStyle(), or currentStyle in IE\r\n > \r\n > All of these above are essentially requesting style information about\r\n > a node, and any time you do it, the browser has to give you the most\r\n > up-to-date value. In order to do so, it needs to apply all scheduled\r\n > changes, flush the queue, bite the bullet and do the reflow.\r\n\r\n\r\n [1]: _URL_3_\r\n [2]: _URL_2_\r\n [3]: _URL_0_\r\n [4]: _URL_1_", "703" ], [ "You probably found that there is a flag called `keyboardDisplayRequiresUserAction` in [Cordova project options][1]. It can be set to `false` to lift the restrictions on the use of `focus()` in native iOS applications. For normal Web applications, however, I haven&#39;t seen any official documentation about these restrictions in iOS browsers.\r\n\r\nAfter many unsuccessful attemps to make `focus()` work with the `select` element in iOS, the only workaround that I found is to use a replacement control, for example jQuery&#39;s [select2][2], as illustrated in **[this jsfiddle][3]**. The CSS attributes could be refined to make it look more similar to the native select element.\r\n\r\nThe call to `myTextInput.focus()` can be made in the `mouseup` event handler of the list items, that handler having been set the first time the dropdown list was opened:\r\n\r\n var firstOpen = true;\r\n \r\n $(mySelect).select2({\r\n minimumResultsForSearch: Infinity\r\n }).on(&#39;change&#39;, function(e) {\r\n console.log( \" ;change event was fired \" ;);\r\n }).on(&#39;select2:open&#39;, function(e) {\r\n if (firstOpen) {\r\n firstOpen = false;\r\n $(&#39;.select2-results ul&#39;).on(&#39;mouseup&#39;, function(e) {\r\n myTextInput.focus();\r\n });\r\n }\r\n });\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_1_\r\n [3]: _URL_0_", "52" ], [ "You can take a look at **[this jsfiddle][1]**. The `.get-oc-c` container shows the scroll bar if needed:\r\n\r\n .get-oc-c {\r\n overflow: auto !important;\r\n }\r\n\r\nand the SVG chart element is wrapped in a div that is resized to accomodate the full chart:\r\n\r\n function wrapChart() {\r\n ...\r\n $( \" ;svg \" ;).wrap( \" ; < div id=&#39;svgContainer&#39; > < /div > \" ;);\r\n ...\r\n }\r\n\r\n #svgContainer {\r\n overflow: visible;\r\n }\r\n\r\nThe `wrapChart` method is called in the `updatedEvent`. The chart move option is disabled to remove the arrows on the sides and to prevent panning:\r\n\r\n var orgChart = new getOrgChart(peopleElement, {\r\n enableMove: false,\r\n ...\r\n });\r\n\r\nThe original display seems to work but getting the correct size values for the wrapper element is difficult (the expression used in the jsfiddle is very empirical), and it gets even more complicated when the window is resized, when the links are expanded/collapsed and when the chart is zoomed. Some resizing uses animations, so the calculations would have to account for the delay before getting the final values.\r\n\r\nThe jsfiddle shows some simple code to restore the scroll position after expanding/collapsing nodes but it would need to be improved. I haven&#39;t written code to account for window resizing and for zooming.\r\n\r\nGiven the amount of work needed to make the scroll bars behave correctly, it is probably better to use the panning and moving features supplied by the component. You could also contact the creators of the component and ask them to add the scroll bar option.\r\n\r\n\r\n [1]: _URL_0_", "882" ], [ "Here is a function that you could call every time new inputs are added to your layout. It assigns a `tabIndex` to each input, without any gap, and accommodates tables of various sizes, where each cell can have any number of input elements. You can test it in **[this jsfiddle][1]**.\r\n\r\nThe input elements are stored in a Map object, where each key is a combination of table, column, and row indices. The keys are then sorted, and the `tabIndex` property is set in the order of the sorted keys.\r\n\r\n function setTabIndices() {\r\n var tableIndex, rowIndex, colIndex, inputIndex;\r\n var table, row, cell, inputs;\r\n var map = new Map();\r\n var tables = document.getElementsByTagName( \" ;table \" ;);\r\n for (tableIndex = 0; tableIndex < tables.length; tableIndex++) {\r\n table = tables[tableIndex];\r\n for (rowIndex = 0; rowIndex < table.rows.length; rowIndex++) {\r\n row = table.rows[rowIndex];\r\n for (colIndex = 0; colIndex < row.cells.length; colIndex++) {\r\n cell = row.cells[colIndex];\r\n inputs = cell.getElementsByTagName( \" ;input \" ;);\r\n for (inputIndex = 0; inputIndex < inputs.length; inputIndex++) {\r\n // Define key based on table, column, and row indices\r\n map.set(format(tableIndex, 4) + format(colIndex, 6) +\r\n format(rowIndex, 6) + format(inputIndex, 3), \r\n inputs[inputIndex]);\r\n }\r\n }\r\n }\r\n }\r\n var input;\r\n var sortedKeys = [...map.keys()].sort(); // Not supported in IE11\r\n for (var tabIndex = 1; tabIndex < = sortedKeys.length; tabIndex++) {\r\n input = map.get(sortedKeys[tabIndex - 1]);\r\n input.tabIndex = tabIndex;\r\n }\r\n }\r\n \r\n function format(value, digits) {\r\n return ( \" ;0000000000 \" ; + value.toString()).slice(-digits);\r\n }\r\n\r\n < hr/ > \r\nNote: the following line causes trouble in IE, which does not support [the spread syntax][2]:\r\n\r\n var sortedKeys = [...map.keys()].sort();\r\n\r\nIf you must support IE, you can call `map.forEach` to populate the unsorted array, as shown in [this modified jsfiddle][3].\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_2_\r\n [3]: _URL_1_", "142" ], [ "You can create a service which can send a notification to other components that will handle the command. The service could look like this:\r\n\r\n import { Injectable } from \" ;@angular/core \" ;;\r\n import { Subject } from \" ;rxjs/Subject \" ;;\r\n \r\n @Injectable()\r\n export class DataSavingService {\r\n\r\n private dataSavingRequested = new Subject < void > ();\r\n public dataSavingRequested$ = this.dataSavingRequested.asObservable();\r\n\r\n public requestDataSaving(): void {\r\n this.dataSavingRequested.next();\r\n }\r\n }\r\n\r\n... and should be registered in the `providers` section of the module. Note: if data must be passed in the notification, you can declare a non-void parameter type for the `dataSavingRequested` Subject (e.g. `string`).\r\n\r\nThe service would be injected in the component with the textarea element and called in the handler of the < kbd > Enter < /kbd > keypress event:\r\n\r\n import { DataSavingService } from \" ;./services/data-saving.service \" ;;\r\n ...\r\n\r\n @Component({\r\n template: `\r\n < textarea (keypress.enter)= \" ;handleEnterKeyPress($event) \" ; ... > < /textarea > \r\n `\r\n })\r\n export class ComponentWithTextarea {\r\n constructor(private dataSavingService: DataSavingService, ...) {\r\n ...\r\n }\r\n\r\n public handleEnterKeyPress(event: KeyboardEvent): void {\r\n event.preventDefault(); // Prevent the insertion of a new line\r\n this.dataSavingService.requestDataSaving();\r\n }\r\n ...\r\n }\r\n\r\nThe component with the Save button would subscribe to the `dataSavingRequested$` notification of the service and save the data when notified:\r\n\r\n import { Component, OnDestroy, ... } from \" ;@angular/core \" ;;\r\n import { Subscription } from \" ;rxjs/Subscription \" ;;\r\n import { DataSavingService } from \" ;../services/data-saving.service \" ;;\r\n ...\r\n \r\n @Component({\r\n ...\r\n })\r\n export class ComponentWithSaveButton implements OnDestroy {\r\n \r\n private subscription: Subscription;\r\n \r\n constructor(private dataSavingService: DataSavingService, ...) {\r\n this.subscription = this.dataSavingService.dataSavingRequested$.subscribe(() = > {\r\n this.saveData();\r\n });\r\n }\r\n\r\n public ngOnDestroy(): void {\r\n this.subscription.unsubscribe();\r\n }\r\n\r\n private saveData(): void {\r\n // Perform data saving here\r\n // Note: this method should also be called by the Save button\r\n ...\r\n }\r\n }\r\n\r\n < hr/ > \r\n\r\nThe code above assumes that the saving must be performed in the component with the Save button. An alternative would be to move that logic into the service, which would expose a `saveData` method that could be called by the components. The service would need to gather the data to save, however. It could be obtained with a Subject/Observable mechanism, or supplied directly by the components as a parameter to `saveData` or by calling another method of the service.", "769" ], [ "As explained in this [MDN article][1], you can catch Javascript runtime errors in a `window.onerror` event handler, and catch resource loading errors in a capturing event handler defined with `window.addEventListener( \" ;error \" ;, fn, true)`.\r\n\r\nA service could set these event handlers and record the errors in an array. You would send the content of the array to the server when you want. The service could look like this:\r\n\r\n export class ErrorLogService {\r\n\r\n private errors = new Array < any > ();\r\n\r\n constructor() {\r\n let that = this;\r\n window.onerror = function (msg, url, lineNo, columnNo, error) {\r\n let string = msg.toLowerCase();\r\n let substring = \" ;script error \" ;;\r\n if (string.indexOf(substring) > -1) {\r\n console.log( \" ;Script Error: See Browser Console for Detail \" ;);\r\n } else {\r\n that.errors.push({\r\n message: msg,\r\n url: url,\r\n line: lineNo,\r\n column: columnNo,\r\n error: error\r\n });\r\n }\r\n return false;\r\n };\r\n window.document.addEventListener( \" ;error \" ;, (event: ErrorEvent) = > {\r\n if (event.target & & (event.target as any).src) {\r\n let url = (event.target as any).src;\r\n this.errors.push({\r\n message: \" ;Resource not found \" ;,\r\n url: url\r\n });\r\n } else {\r\n this.errors.push({\r\n message: \" ;Unknown error \" ;,\r\n error: event\r\n });\r\n }\r\n }, true);\r\n }\r\n }\r\n\r\n\r\nThe error detection mechanism can be tested in **[this jsfiddle][2]**.\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "516" ], [ "I cannot see the problem when I run [your jsfiddle][1] in Firefox 53 (on Windows 7). The ghost image and the dragged image have the same URL and the ghost image is always displayed when dragging. However, I can reproduce the problem with a ghost image that has a different URL.\r\n\r\nYou could add a hidden `img` control to preload the ghost image. Something like this:\r\n\r\n < div class= \" ;parent container \" ; > \r\n < img class= \" ;element \" ; draggable= \" ;true \" ; src= \" ;_URL_2_; / > \r\n < img class= \" ;imgGhost \" ; src= \" ;_URL_3_; / > \r\n < /div > \r\n\r\nAccording to my tests, these settings prevent the image preload in Firefox:\r\n\r\n- Hiding the element with `display: none`\r\n- Setting a null size (`width: 0px` or `height: 0px`)\r\n- Moving it outside of the viewport (e.g. `left: -10000px`)\r\n\r\nI also did not have much success with [link prefetching][2]. However, `visibility: hidden` seems to work. The style of the hidden image element could be defined as:\r\n\r\n .imgGhost {\r\n position: absolute;\r\n left: 0px;\r\n top: 0px;\r\n visibility: hidden;\r\n }\r\n\r\nThe method can be tested for two draggable images in [**this jsfiddle**][3]. In the `dragstart` event handler, the image URL is retrieved from the hidden element:\r\n\r\n img.src = this.parentNode.querySelector( \" ;.imgGhost \" ;).src;\r\n\r\nbut it could be hard coded. If you prefer, you could set the `src` attribute of the hidden image dynamically when the page is loaded. When testing in the jsfiddle, you can change the ghost image names (e.g. 225x225) before running it again, to make sure that the image was not cached.\r\n\r\n < hr/ > \r\nAccording to your comment, preloading the image is not an option. And you are using the same image URL for the dragging ghost image. In that case, you could check [this page][4] to see if any option is preventing the reload of the image.\r\n\r\nYou could also force a repaint of the layout after adding the `div` control to the `body` in the `dragstart` event handler. This can be achieved by calling `div.offsetHeight`:\r\n\r\n div.appendChild(img);\r\n document.body.appendChild(div);\r\n div.offsetHeight; // Force repaint\r\n\r\n\r\n [1]: _URL_4_\r\n [2]: _URL_5_\r\n [3]: _URL_1_\r\n [4]: _URL_0_", "822" ], [ "When I apply the CSS attribute `pointer-events: none` to the `fa-circle` elements on your Web page, the carousel works correctly. That tells me that the event handler on these circle elements is not needed and only causes problems. Therefore, you can remove it completely and keep only the event handler on the `owl-dot` elements:\r\n\r\n $( &#39;.owl-dot&#39; ).on( &#39;click&#39;, function() {\r\n owl.trigger(&#39;to.owl.carousel&#39;, [$(this).index(), 300]);\r\n $( &#39;.owl-dot&#39; ).removeClass( &#39;active&#39; );\r\n $(this).addClass( &#39;active&#39; );\r\n })\r\n\r\n // Remove this event handler\r\n //$( &#39;.owl-dot span .fa-circle&#39; ).on( &#39;click&#39;, function() {\r\n // owl.trigger(&#39;to.owl.carousel&#39;, [$(this).index(), 300]);\r\n // $( &#39;.owl-dot&#39; ).removeClass( &#39;active&#39; );\r\n // $(this).parent().parent().addClass( &#39;active&#39; );\r\n //})", "648" ], [ "Since the SweetAlert2 dialog is processed asynchronously, you have to trigger another button click programmatically when the promise is resolved. Instead of creating a hidden button, you can reuse `btnDelete` by setting a flag to indicate that the action was already confirmed. That flag will be detected when the second click is processed, and the button click will be allowed to proceed and to trigger the server event.\r\n\r\n < asp:Button ... OnClientClick= \" ;return sweetAlertConfirm(this); \" ; OnClick= \" ;btnDelete_Click \" ; / > \r\n\r\n < !-- -- > \r\n\r\n function sweetAlertConfirm(btnDelete) {\r\n if (btnDelete.dataset.confirmed) {\r\n // The action was already confirmed by the user, proceed with server event\r\n btnDelete.dataset.confirmed = false;\r\n return true;\r\n } else {\r\n // Ask the user to confirm/cancel the action\r\n event.preventDefault();\r\n swal({\r\n title: &#39;Are you sure?&#39;,\r\n text: \" ;You won&#39;t be able to revert this! \" ;,\r\n type: &#39;warning&#39;,\r\n showCancelButton: true,\r\n confirmButtonColor: &#39;#3085d6&#39;,\r\n cancelButtonColor: &#39;#d33&#39;,\r\n confirmButtonText: &#39;Yes, delete it!&#39;\r\n })\r\n .then(function () {\r\n // Set data-confirmed attribute to indicate that the action was confirmed\r\n btnDelete.dataset.confirmed = true;\r\n // Trigger button click programmatically\r\n btnDelete.click();\r\n }).catch(function (reason) {\r\n // The action was canceled by the user\r\n });\r\n }\r\n }", "479" ], [ "As you noted, the CSS selector `.ac-container label` has higher precedence than the `.trueValue` selector. You can give the `.trueValue` selector a higher precedence by making it more specific:\r\n\r\n .ac-container label.trueValue\r\n\r\nIt will override the default label selector when the `trueValue` class is applied. \r\n\r\nMore details about CSS Specificity can be found in [this article][1].\r\n\r\n [1]: _URL_0_", "231" ], [ "**Method 1**\r\n\r\nTo simplify the template code, you can declare the list of tabs in the component class:\r\n\r\n public tabList: Array < string > = [ \" ;Example Tab 1 \" ;, \" ;Example Tab 2 \" ;];\r\n\r\nand generate the `li` elements with the `*ngFor` directive:\r\n\r\n < li *ngFor= \" ;let tab of tabList \" ; [ngClass]= \" ;{&#39;active&#39;: activeTab === tab} \" ; (click)= \" ;switchActiveTab(tab); \" ; role= \" ;presentation \" ; > \r\n < a > {{tab}} < /a > \r\n < /li > \r\n\r\n < hr/ > \r\n\r\n**Method 2**\r\n\r\nTo keep the code more declarative, each item could refer to itself with a [template reference variable][1] instead of using the tab caption (as illustrated in [this plunker][2]):\r\n\r\n < div class= \" ;buttonLine \" ; > \r\n < ul class= \" ;nav nav-pills \" ; > \r\n < li #tab1 [ngClass]= \" ;{&#39;active&#39;: activeTab === tab1} \" ; (click)= \" ;switchActiveTab(tab1); \" ; role= \" ;presentation \" ; > \r\n < a > Example Tab 1 < /a > \r\n < /li > \r\n < li #tab2 [ngClass]= \" ;{&#39;active&#39;: activeTab === tab2} \" ; (click)= \" ;switchActiveTab(tab2); \" ; role= \" ;presentation \" ; > \r\n < a > Example Tab 2 < /a > \r\n < /li > \r\n < /ul > \r\n < /div > \r\n\r\nThe code would be modified accordingly:\r\n\r\n activeTab: HTMLElement;\r\n \r\n switchActiveTab(newTab: HTMLElement) {\r\n this.activeTab = newTab;\r\n } \r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "993" ], [ "I reproduced your problem in [this plunker][1]. In order to make the tooltip visible outside of the md-tab container, I had to do the following (see [this corrected plunker][2]):\r\n\r\n1. In the Component decorator, I set the encapsulation to `ViewEncapsulation.None`:\r\n\r\n < !-- -- > \r\n\r\n import {ViewEncapsulation} from &#39;@angular/core&#39;;\r\n\r\n @Component({\r\n ...\r\n styleUrls: [ \" ;./tabs-overview-example.css \" ;],\r\n encapsulation: ViewEncapsulation.None\r\n })\r\n\r\n2. In the CSS file, I set the `overflow` attribute as follows:\r\n\r\n < !-- -- > \r\n\r\n md-tab-group,\r\n md-tab-body,\r\n .mat-tab-body-wrapper,\r\n .mat-tab-body-content\r\n {\r\n overflow: visible !important;\r\n }\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "908" ], [ "I made a test to see if running an OOB Silverlight application requires a hidden browser process. On Windows and Mac, it appears that no instance of a browser is needed (no iexplore.exe appears in the Windows Task Manager, and no Safari process appears in the list given by \" ;ps aux \" ; on the terminal on Mac OS X). \r\n\r\nSince we know that the installation can be done on Windows without the browser, it should work on that OS even if no browser supports Silverlight (as long as the Silverlight component itself is available to the client users).\r\n\r\nThe question that remains: can we make an installer for the Mac, so that the browser is not involved at any point in the installation process? There is a [procedure to build such an installer][1] but it requires the Silverlight application to run in the browser first, to get the \" ;.app \" ; file.\r\n\r\nA possible workaround: an installer can be made while Safari still supports Silverlight. The application included in the installer will become out-of-date as its code evolves but since the installed OOB application has a build-in mecanism to update itself from the server, the latest version will be available when running it the second time. Maybe that could save us?\r\n\r\n\r\n [1]: _URL_0_", "852" ], [ "I agree. We may need some time to rewrite, however, so a temporary solution can save our life. It is the case for the company where I work... As for the rewrite, I thought that developping a large application in Javascript would not be realistic; now I think it can be done. I am writing one at the moment, to learn the best practices, and I am having a pretty good time, actually.", "330" ], [ "I haven&#39;t tried it but I found* this piece of code to switch to a different query:\r\n\r\n SqlDataSource1.SelectCommand = \" ;SELECT x FROM MyTable \" ;;\r\n SqlDataSource1.Select(DataSourceSelectArguments.Empty);\r\n SqlDataSource1.DataBind();\r\n GridView1.DataBind();\r\n\r\nI notice the DataBind() command on the SqlDataSource, before the one on the GridView. Would that make a difference for you?\r\n\r\n*Source: _URL_0_", "653" ], [ "Hmmm. We don&#39;t see the same behavior. I assume that you searched \" ;namespace \" ; in your code and did not find any occurrence. In my own code, if I type \" ;Me \" ; in the code and hover on it, I just see the form name (e.g. frmReport). By the way, is your problem specific to that \" ;foo \" ; form or is it present with any form in your project? One thing I tried: I typed the namespace of the project, followed by the dot, and IntelliSense showed me the list of the forms in the project (among other things). You may try that, it may bring something to your attention.", "343" ], [ "I did not add \" ;Public \" ; to the partial class declaration. When I go to another form and say \" ;Dim f as New frmReport() \" ;, it compiles without a problem. I am in VS 2010 and my project is an _URL_0_ WebForms project (I first assumed that this was also your case but I don&#39;t know if _URL_0_ MVC also has ASPX form files). For the moment, I cannot find a way to make the form class not visible in another one. As for the namespace of the project, I define it in (right click on the project in Solution Explorer) | Properties | Application. I think there is one by default but I can set it as I want.", "787" ], [ "@Ayman - I am as surprised as you are. Is the GridView in an UpdatePanel? If not, you can check in the debugger what happens when you bind the data after deleting the row. If you monitor the DataBound event, you can see if the content of the grid has actually changed or not. You will know if the problem is the display not being refreshed or if the deleted row is still in the grid.", "653" ], [ "You can try this:\r\n\r\n < tr > \r\n < td rowspan= \" ;2 \" ; > \r\n < asp:Image ID= \" ;Image1 \" ; ImageUrl= \" ;~/Images/pushpinred.png \" ; runat= \" ;server \" ; Width= \" ;32 \" ; Height= \" ;32 \" ; / > \r\n < /td > \r\n < td > X: < /td > \r\n < td > \r\n < %# Eval( \" ;Lon \" ;) % > \r\n < /td > \r\n < td rowspan= \" ;2 \" ; > \r\n < input type= \" ;button \" ; id= \" ;ddd \" ; value= \" ;B \" ; style= \" ;height: 30px; \" ; / > \r\n < /td > \r\n < /tr > \r\n < tr > \r\n < td > Y: < /td > \r\n < td > \r\n < %# Eval( \" ;Lat \" ;) % > \r\n < /td > \r\n < /tr > \r\n\r\nAnd if you want an empty row between items, you can define a SeparatorTemplate with:\r\n\r\n < tr > \r\n < td colspan= \" ;4 \" ; > & nbsp; < /td > \r\n < /tr >", "626" ], [ "You could use the IF statement (_URL_0_):\r\n\r\n IF EXIST File1.ext DEL File2.ext\r\n\r\nUPDATE - To address the specific problem mentioned in the question:\r\n\r\n set FileNames= \" ;File 1abc (*).bin \" ;\r\n set LastVersion= \" ; \" ;\r\n <IP_ADDRESS> Find last version\r\n for %%f in (%FileNames%) do (\r\n if \" ;%%f \" ; GTR %LastVersion% SET LastVersion= \" ;%%f \" ;\r\n )\r\n <IP_ADDRESS> Delete old versions\r\n for %%f in (%FileNames%) do (\r\n if \" ;%%f \" ; LSS %LastVersion% DEL \" ;%%f \" ;\r\n )\r\n\r\nThere is one catch: if the version (X or Y in your example) is a number, it should be specified with a fixed number of digits (e.g. (009), (010), ...), because (9) is considered greater than (10).", "879" ], [ "You can add a PlaceHolder to your Panel:\r\n\r\n < asp:Panel ID= \" ;Panel1 \" ; runat= \" ;server \" ; > \r\n < asp:Button ID= \" ;Button1 \" ; runat= \" ;server \" ; Text= \" ;Button \" ; OnClick= \" ;Button1_Click \" ; / > \r\n < asp:Label ID= \" ;Label1 \" ; runat= \" ;server \" ; > < /asp:Label > \r\n < asp:PlaceHolder ID= \" ;ph \" ; runat= \" ;server \" ; / > \r\n < /asp:Panel > \r\n\r\nand insert the button in it, making sure that it is recreated on each postback:\r\n\r\n protected void Button1_Click(object sender, EventArgs e)\r\n {\r\n CreateDynamicButton();\r\n ViewState.Add( \" ;Button2 \" ;, \" ;Yes \" ;);\r\n }\r\n\r\n protected void CreateDynamicButton()\r\n {\r\n Button button2 = new Button();\r\n _URL_0_ = \" ;button2 \" ;;\r\n button2.Text = \" ;Dynamic Button \" ;;\r\n button2.Click += new EventHandler(button2_Click);\r\n ph.Controls.Clear();\r\n ph.Controls.Add(button2);\r\n }\r\n\r\n protected override void CreateChildControls()\r\n {\r\n base.CreateChildControls();\r\n if (ViewState( \" ;Button2 \" ;) == \" ;Yes \" ;)\r\n {\r\n CreateDynamicButton();\r\n }\r\n }\r\n\r\n void button2_Click(object sender, EventArgs e)\r\n {\r\n Label1.Text = \" ;working \" ;;\r\n }", "479" ], [ "The FOR XML PATH syntax allows your query to group several values in a single one:\r\n\r\n SELECT \r\n E.EmployeeId, \r\n E.FirstName,\r\n \tREPLACE(STUFF((\r\n \t\tSELECT \r\n \t\t\tCOALESCE(&#39;&#182;&#39; + V.Dates, &#39;&#39;)\r\n \t\tFROM \r\n \t\t\tVacation V \r\n \t\tWHERE \r\n \t\t\tV.EmployeeId = E.EmployeeId AND V.Dates > = @Start AND V.Dates < = @End\r\n \t\tFOR XML PATH(&#39;&#39;)), 1, 1, &#39;&#39;), &#39;&#182;&#39;, &#39;, &#39;) AS VacationDates\r\n FROM \r\n Employee E\r\n\r\nYou can replace the `&#39;, &#39;` separator by something else if you want.\r\n\r\nNote: Sorry for the multipe edits. I am just not sure how you connect the employees, vacations and dates. This piece of code basically shows the idea for the FOR XML PATH syntax.", "532" ], [ "The field VacationDates will be output as a character string. So you cannot convert it to date. It should look like this for a given employee: \" ;2016-03-18, 2016-03-17, 2016-03-16 \" ;. As for why that data column is empty... I can see that it will be empty for some employees (that can be corrected easily) but I thought there would be data for others. I assume that you gave appropriate values to \" ;@Start \" ; and \" ;@End \" ; when you tried it... Oh, I just removed a redundant WHERE in the query; did you see that in your test?", "338" ], [ "Can you put an alert or console.log statement in the Javascript function to check if it is actually called? The client validation is triggered when leaving the TextBox. I don&#39;t see a Text property in your validator. What do you expect to see if the validation fails? As for the ErrorMessage, I think it is displayed in a ValidationSummary when trying to submit the form.", "560" ], [ "You can pass several key/value pairs of strings in the URL:\r\n\r\n hyperLnk.NavigateUrl = \" ;~/Sub1/frmMyForm1.aspx?key1=value1 & key2=value2 & key3=value3 \" ;\r\n\r\nIt can be done like this:\r\n\r\n hyperLnk.NavigateUrl = String.Format( \" ;~/Sub1/frmMyForm1.aspx?key1={0} & key2={1} & key3={2} \" ;, myStr, myInt, myDouble)\r\n\r\nIn code behind, you can retrieve the values like this:\r\n\r\n Dim var1 as string = Request.QueryString( \" ;key1 \" ;)\r\n Dim var2 as Integer = CInt(Request.QueryString( \" ;key2 \" ;))\r\n Dim var3 as Double = CDbl(Request.QueryString( \" ;key3 \" ;))\r\n ...", "706" ], [ "It will work if:\r\n\r\n1. You don&#39;t put the creation code in `if (!IsPostBack)`: the dynamic controls must be recreated on every postback\r\n2. You add to the UpdatePanel a control that triggers a PostBack, like a Button (as mentioned by <PERSON>)\r\n3. You register that control with `ScriptManager1.RegisterAsyncPostBackControl(btn1)`, instead of registering the UpdatePanel itself", "510" ], [ "You could use a RadioButtonList instead of two separate RadioButtons:\r\n\r\n < asp:RadioButtonList ID= \" ;rblGender \" ; runat= \" ;server \" ; > \r\n < asp:ListItem Text= \" ;Male \" ; Selected= \" ;True \" ; / > \r\n < asp:ListItem Text= \" ;Female \" ; / > \r\n < /asp:RadioButtonList > \r\n\r\n In code-behind, you could get the SelectedValue of the list:\r\n\r\n String gender = ((RadioButtonList)PreviousPage.FindControl( \" ;rblGender \" ;)).SelectedValue;", "302" ], [ "You could use a PlaceHolder and add your ImageButtons to it. First, replace:\r\n\r\n < td > \r\n < %# GetRecordLinks(Eval( \" ;Records \" ;)) % > \r\n < /td > \r\n\r\nwith:\r\n\r\n < td > \r\n < asp:PlaceHolder ID= \" ;phRecords \" ; runat= \" ;server \" ; / > \r\n < /td > \r\n\r\nThen in code-behind:\r\n\r\n void Student_OnItemDataBound(object sender, ListViewItemEventArgs e)\r\n {\r\n ...\r\n PlaceHolder phRecords = e.Item.FindControl( \" ;phRecords \" ;) as PlaceHolder;\r\n ImageButton imgButton = new ImageButton();\r\n // Set the ImageButton properties here\r\n ph.Controls.Add(imgButton);\r\n }\r\n\r\nThat would add a single button. You can put the ImageButton creation code in a loop to add several of them in the same cell.\r\n\r\nYou would also have to recreate those ImageButtons on every postback, so you may need to bind your data in the Page_Load method.", "479" ], [ "You must turn off AutoGenerateColumns and create the bound fields in the markup:\r\n\r\n < asp:GridView ID= \" ;gvCustomers \" ; runat= \" ;server \" ; AutoGenerateColumns= \" ;false \" ; ShowHeader= \" ;true \" ; ShowHeaderWhenEmpty= \" ;true \" ; > \r\n < Columns > \r\n < asp:BoundField DataField= \" ;eid \" ; HeaderText= \" ;ID \" ; / > \r\n < asp:BoundField DataField= \" ;ename \" ; HeaderText= \" ;Name \" ; / > \r\n < asp:BoundField DataField= \" ;edesignation \" ; HeaderText= \" ;Designation \" ; / > \r\n < /Columns > \r\n < /asp:GridView > \r\n\r\nIf you want to have access to `edept` and `esal` in code-behind, you can add these fields to the `DataKeyNames` attribute of the GridView.", "653" ], [ "You could display the content of the footer in a separate table. Something like this:\r\n\r\n < FooterTemplate > \r\n < tr > \r\n < td colspan= \" ;7 \" ; > \r\n < asp:UpdatePanel ID= \" ;UpdateHardwareLine \" ; updatemode= \" ;Conditional \" ; runat= \" ;server \" ; ChildrenAsTriggers= \" ;true \" ; > \r\n < Triggers > \r\n < asp:AsyncPostBackTrigger ControlID= \" ;AddProduct \" ; EventName= \" ;SelectedIndexChanged \" ; / > \r\n < /Triggers > \r\n < ContentTemplate > \r\n < table style= \" ;width:100%; \" ; > \r\n < tr > \r\n < asp:HiddenField ID= \" ;AddCategory \" ; Value= \" ;Hardware \" ; runat= \" ;server \" ;/ > \r\n < td > < telerik:RadComboBox runat= \" ;server \" ; ID= \" ;AddProduct \" ; ClientIDMode= \" ;static \" ; Filter= \" ;Contains \" ; EnableLoadOnDemand= \" ;true \" ; AutoPostBack= \" ;true \" ; OnSelectedIndexChanged= \" ;ProductSelected \" ; OnDataBinding= \" ;LoadProductsByCategory \" ;/ > < /td > \r\n ...\r\n < /tr > \r\n < /table > \r\n < /ContentTemplate > \r\n < /asp:UpdatePanel > \r\n < /td > \r\n < /tr > \r\n < /FooterTemplate > \r\n\r\nThe challenge would be to get that inner table aligned properly with the outer one. You would probably need to set `CellPadding= \" ;0 \" ;` and `CellSpacing= \" ;0 \" ;` for both tables as a first step.", "626" ], [ "**Solution 1:**\r\nIt can be done with a `ButtonField` in the GridView:\r\n\r\nAdd the row-specific info to the `DataKeyNames` of the GridView (e.g. if the fields \" ;name1 \" ; and \" ;age2 \" ; of your data source are needed to view with your Silverlight viewer):\r\n\r\n < asp:GridView ID= \" ;gvClients \" ; DataKeyNames= \" ;name1,age2 \" ; ... > \r\n\r\nAdd a ButtonField to the GridView:\r\n\r\n < asp:ButtonField ButtonType= \" ;Button \" ; CommandName= \" ;View \" ; Text= \" ;View \" ; / > \r\n\r\nSet the RowCommand event handler (can be done in markup or in code):\r\n\r\n gvClients.RowCommand += new GridViewCommandEventHandler(gvClients_RowCommand);\r\n\r\nAnd process the command:\r\n\r\n void gvClients_RowCommand(object sender, GridViewCommandEventArgs e)\r\n {\r\n int rowIndex = Convert.ToInt32(e.CommandArgument);\r\n string name1 = (string)gvClients.DataKeys[rowIndex].Values[ \" ;name1 \" ;];\r\n int age2 = (int)gvClients.DataKeys[rowIndex].Values[ \" ;age2 \" ;];\r\n\r\n // Open docName with the viewer\r\n ...\r\n }\r\n\r\n**Solution 2:** An alternative, which avoids a postback, would be to use a a HyperLinkField:\r\n\r\n < asp:HyperLinkField Text= \" ;View \" ; DataNavigateUrlFormatString= \" ;Viewer.aspx?Name={0} & Age={1} \" ; DataNavigateUrlFields= \" ;name1,age2 \" ; / >", "653" ], [ "By creating the report object before the loop and reusing it repeatedly, you insert a reference to that same object multiple times in your list.\r\n\r\nYou should create the report object inside your loop:\r\n\r\n SqlDataReader reader = cmd.ExecuteReader();\r\n while (reader.Read())\r\n {\r\n reports report = new reports();\r\n _URL_0_ = Convert.ToInt32(reader[ \" ;id \" ;]);\r\n report.title = reader[ \" ;title \" ;].ToString();\r\n report.description = reader[ \" ;description \" ;].ToString();\r\n report.anonymous = (bool)reader[ \" ;anonymous \" ;];\r\n report.location = reader[ \" ;location \" ;].ToString();\r\n report.status = reader[ \" ;status \" ;].ToString();\r\n report.category = reader[ \" ;category \" ;].ToString();\r\n report.date = (DateTime)reader[ \" ;date \" ;];\r\n report.picture_url = reader[ \" ;picture_url \" ;].ToString();\r\n report.admin_id = Convert.ToInt32(reader[ \" ;admin_id \" ;]);\r\n repers.Add(report);\r\n }\r\n return repers;", "905" ], [ "In order to \" ;group \" ; several columns in a common header (with subheaders), I use a TemplateField. For 2 subcolumns, it would look like this:\r\n\r\n < asp:TemplateField HeaderStyle-HorizontalAlign= \" ;Center \" ; > \r\n < HeaderTemplate > \r\n < table runat= \" ;server \" ; class= \" ;leafCommonHeader \" ; align= \" ;center \" ; cellpadding= \" ;0 \" ; cellspacing= \" ;0 \" ; > \r\n < tr class= \" ;multiColumnMainHeader \" ; > \r\n < td colspan= \" ;2 \" ; > \r\n < asp:Label runat= \" ;server \" ; CssClass= \" ;leafHeader \" ; Text= \" ;Leaf Details \" ; / > \r\n < /td > \r\n < /tr > \r\n < tr runat= \" ;server \" ; > \r\n < td class= \" ;leafNameField \" ; > \r\n < asp:LinkButton runat= \" ;server \" ; CssClass= \" ;leafHeader \" ; OnCommand= \" ;gvLeavesColumnSort \" ; CommandArgument= \" ;LeafName \" ; Text= \" ;Name \" ; / > \r\n < /td > \r\n < td class= \" ;leafNameField \" ; > \r\n < asp:LinkButton runat= \" ;server \" ; CssClass= \" ;leafHeader \" ; OnCommand= \" ;gvLeavesColumnSort \" ; CommandArgument= \" ;LeafCode \" ; Text= \" ;Code \" ; / > \r\n < /td > \r\n < /tr > \r\n < /table > \r\n < /HeaderTemplate > \r\n < ItemTemplate > \r\n < table runat= \" ;server \" ; class= \" ;leafCommonItem \" ; cellpadding= \" ;0 \" ; cellspacing= \" ;0 \" ; > \r\n < tr > \r\n < td class= \" ;leafNameField \" ; > \r\n < asp:Literal runat= \" ;server \" ; Text=&#39; < %# DataBinder.Eval(Container.DataItem, \" ;LeafName \" ;)) % > &#39; / > \r\n < /td > \r\n < td class= \" ;leafCodeField \" ; > \r\n < asp:Literal runat= \" ;server \" ; Text=&#39; < %# DataBinder.Eval(Container.DataItem, \" ;LeafCode \" ;) % > &#39; / > \r\n < /td > \r\n < /tr > \r\n < /table > \r\n < /ItemTemplate > \r\n < /asp:TemplateField > \r\n\r\nThe link buttons in the subheaders are there to implement the sort of the subcolumns. I included a few `CssClass` attributes that allow to customize the cells and labels. The CSS classes `leafNameField` and `leafCodeField` can set the with of their column, for example.\r\n\r\nDisclaimer: this code was not tested with paging turned on.", "990" ], [ "You can increase the executionTimeout in Web.config:\r\n\r\n < configuration > \r\n < system.web > \r\n < httpRuntime executionTimeout= \" ;600 \" ; ... / > \r\n < /system.web > \r\n < /configuration > \r\n\r\nThe value is expressed in seconds.\r\n\r\n**UPDATE**\r\n\r\nAccording to your exception message, one solution would be to increase the timeout of the SQLCommand object:\r\n\r\n SqlCommand command = new SqlCommand(queryString, connection);\r\n command.CommandTimeout = 600;\r\n\r\nOther suggestions for a similar problem are given here: _URL_0_", "966" ], [ "You can keep track of the ID of each row by adding the field to the `DataKeyNames` of the GridView. Before you refresh the grid in code-behind, you remember the ID of the selected row (assuming here that the relevant ID is a field called ClientID):\r\n\r\n int savedClientID = (int)gvClients.DataKeys[gvClients.SelectedIndex].Values[ \" ;ClientID \" ;];\r\n\r\nYou can then look for it after binding the data and select the corresponding row:\r\n\r\n void gvClients_DataBound(object sender, EventArgs e)\r\n {\r\n gvClients.SelectedIndex = -1;\r\n\r\n foreach (GridViewRow row in gvClients.Rows)\r\n {\r\n int clientID = (int)gvClients.DataKeys[row.RowIndex].Values[ \" ;ClientID \" ;];\r\n\r\n if (clientID == savedClientID)\r\n {\r\n gvClients.SelectedIndex = row.RowIndex;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n**UPDATE**\r\n\r\nIf paging is turned on in the GridView, you may have to use the method suggested in this post: _URL_0_", "653" ], [ "Your solution will still make the calculation if one of the first two errors is found. Here is an alternative:\r\n\r\n var isErrorFound = false;\r\n\r\n if (isNaN(theMilesDriven) || theMilesDriven < = 0) {\r\n theMilesDrivenError.firstChild.nodeValue = \" ;Please enter a number greater than 0 for the miles driven. \" ;;\r\n isErrorFound = true;\r\n }\r\n\r\n if (isNaN(theGallonsUsed) || theGallonsUsed < = 0) {\r\n theGallonsUsedError.firstChild.nodeValue = \" ;Please enter a number greater than 0 for the gallons of gas used. \" ;;\r\n isErrorFound = true;\r\n }\r\n\r\n if (isNaN(thePriceGallon) || thePriceGallon < = 0) {\r\n thePriceGallonError.firstChild.nodeValue = \" ;Please enter a number greater than 0 for the price per gallon. \" ;;\r\n isErrorFound = true;\r\n }\r\n\r\n if (!isErrorFound) {\r\n //Perform the calculations and write the results to the page\r\n var milesPerGallon = theMilesDriven / theGallonsUsed;\r\n var theMPG = document.getElementById( \" ;mpg \" ;);\r\n theMPG.firstChild.nodeValue = \" ;Your MPG is: \" ; + milesPerGallon.toFixed(2);\r\n\r\n var cost = theGallonsUsed * thePriceGallon;\r\n var theCost = document.getElementById( \" ;cost \" ;);\r\n theCost.firstChild.nodeValue = \" ;Your cost for this trip is: $ \" ; + cost.toFixed(2);\r\n }", "839" ], [ "Could you do something like this:\r\n\r\n < form ... > \r\n < fieldset id=&#39;fields&#39; > \r\n ...\r\n < input onclick= \" ;showOutput() \" ; type= \" ;submit \" ; value= \" ;SEND \" ; / > \r\n < /fieldset > \r\n < div id=&#39;formOutput&#39; style=&#39;display: none;&#39; > \r\n < /div > \r\n < /form > \r\n \r\n function showOutput() {\r\n /* Fill formOutput */\r\n ....\r\n document.getElementById(&#39;fields&#39;).style.display = &#39;none&#39;;\r\n document.getElementById(&#39;formOutput).style.display = &#39;&#39;;\r\n }\r\n\r\nBut since the SEND button is a submit button, I don&#39;t know if you want to do all the processing in the Javascript code.\r\n\r\nAlso, if you want to allow toggling between the two views, the \" ;toggle \" ; button would have to be outside of the fieldset (or a button would be needed inside of formOutput to go back to the input view).", "300" ], [ "You can try this:\r\n\r\n < ol id= \" ;phoneList \" ; class= \" ;list-b \" ; > \r\n < li onmouseover= \" ;phoneChanged(&#39;firstPhone&#39;); \" ; > < span class= \" ;title \" ; > First Box < /span > <PERSON>. < /li > \r\n < li onmouseover= \" ;phoneChanged(&#39;secondPhone&#39;); \" ; > < span class= \" ;title \" ; > Second Box < /span > <PERSON>. < /li > \r\n < li onmouseover= \" ;phoneChanged(&#39;thirdPhone&#39;); \" ; > < span class= \" ;title \" ; > Third Box < /span > <PERSON>. < /li > \r\n < li onmouseover= \" ;phoneChanged(&#39;fourthPhone&#39;); \" ; > < span class= \" ;title \" ; > Fourth Box < /span > <PERSON>. < /li > \r\n < li onmouseover= \" ;phoneChanged(&#39;fifthPhone&#39;); \" ; > < span class= \" ;title \" ; > Fifth Box < /span > <PERSON>. < /li > \r\n < li onmouseover= \" ;phoneChanged(&#39;sixthPhone&#39;); \" ; > < span class= \" ;title \" ; > Sixth Box < /span > <PERSON> sit dolor. < /li > \r\n < li id= \" ;phoneChange \" ; > < /li > \r\n < /ol > \r\n\r\nAnd the code:\r\n\r\n < script > \r\n function phoneChanged(className) {\r\n document.getElementById(&#39;phoneChange&#39;).className = className;\r\n }\r\n < /script > \r\n\r\nThis code reacts to the mouse hovering on each item. To react to clicks, replace \" ;onmouseover \" ; by \" ;onclick \" ;.", "683" ], [ "And what id value do you get? Is it the value of another row? The preferred way to get a value associated with a GridView row is to use DataKeyNames (in markup), instead of parsing the cell content. You can set DataKeyNames= \" ;id \" ; (you can add more values if you want, separated with commas), then you can retrieve the value in code behind with GridView1.DataKey(row.RowIndex).Values( \" ;id \" ;).", "653" ], [ "I don&#39;t understand the last 3 lines of your RowDataBound handler. Each column needs to be shown/hidden while processing every record? If so, the final result will depend only on the last data row. You could do that just after binding you data, I think, since the check box is not in the grid (if I am not mistaken). As for your main question, if these 3 lines are not there, do you see all your data?", "653" ], [ "My suggestion: if you columns are to be shown/hidden depending on a CheckBox outside of the grid, you could do this in the markup:\r\n\r\n < asp:CheckBox ID= \" ;chkBox \" ; runat= \" ;server \" ; AutoPostBack= \" ;true \" ; ... / > \r\n\r\nAnd process the event in code-behind:\r\n\r\n Private Sub chkBox_CheckedChanged(sender As Object, e As System.EventArgs) Handles chkBox.CheckedChanged\r\n gvTags.Columns(removedByColumnIndex).Visible = chkBox.Checked\r\n gvTags.Columns(removedDateColumnIndex).Visible = chkBox.Checked\r\n gvTags.Columns(descriptionColumnIndex).Visible = (Not chkBox.Checked)\r\n gvTags.DataSource = GetTags()\r\n gvTags.DataBind()\r\n End Sub", "653" ], [ "You can create the columns in the GridView this way:\r\n\r\n < asp:GridView ID= \" ;GridView1 \" ; runat= \" ;server \" ; ShowHeader= \" ;true \" ; ShowHeaderWhenEmpty= \" ;true \" ; AutoGenerateColumns= \" ;False \" ; > \r\n < Columns > \r\n < asp:BoundField DataField= \" ;EmployeeID \" ; HeaderText= \" ;EmployeeID \" ; / > \r\n < asp:BoundField DataField= \" ;FirstName \" ; HeaderText= \" ;FirstName \" ; / > \r\n < asp:BoundField DataField= \" ;LastName \" ; HeaderText= \" ;LastName \" ; / > \r\n < asp:BoundField DataField= \" ;Monday \" ; HeaderText= \" ;Monday \" ; / > \r\n < asp:BoundField DataField= \" ;Thuesday \" ; HeaderText= \" ;Thuesday \" ; / > \r\n < asp:BoundField DataField= \" ;Wednesday \" ; HeaderText= \" ;Wednesday \" ; / > \r\n < asp:BoundField DataField= \" ;Thursday \" ; HeaderText= \" ;Thursday \" ; / > \r\n < asp:BoundField DataField= \" ;Friday \" ; HeaderText= \" ;Friday \" ; / > \r\n < asp:BoundField DataField= \" ;Saturday \" ; HeaderText= \" ;Saturday \" ; / > \r\n < asp:BoundField DataField= \" ;Sunday \" ; HeaderText= \" ;Sunday \" ; / > \r\n < /Columns > \r\n < /asp:GridView > \r\n\r\nIf no data is expected in the days of the week columns, you could use TemplateFields:\r\n\r\n < asp:GridView ID= \" ;GridView1 \" ; runat= \" ;server \" ; ShowHeader= \" ;true \" ; ShowHeaderWhenEmpty= \" ;true \" ; AutoGenerateColumns= \" ;False \" ; > \r\n < Columns > \r\n < asp:BoundField DataField= \" ;EmployeeID \" ; HeaderText= \" ;EmployeeID \" ; / > \r\n < asp:BoundField DataField= \" ;FirstName \" ; HeaderText= \" ;FirstName \" ; / > \r\n < asp:BoundField DataField= \" ;LastName \" ; HeaderText= \" ;LastName \" ; / > \r\n < asp:TemplateField HeaderText= \" ;Monday \" ; / > \r\n < asp:TemplateField HeaderText= \" ;Thuesday \" ; / > \r\n < asp:TemplateField HeaderText= \" ;Wednesday \" ; / > \r\n < asp:TemplateField HeaderText= \" ;Thursday \" ; / > \r\n < asp:TemplateField HeaderText= \" ;Friday \" ; / > \r\n < asp:TemplateField HeaderText= \" ;Saturday \" ; / > \r\n < asp:TemplateField HeaderText= \" ;Sunday \" ; / > \r\n < /Columns > \r\n < /asp:GridView >", "653" ], [ "With the event set in the markup:\r\n\r\n < asp:CheckBox ID= \" ;CB1 \" ; runat= \" ;server \" ; OnCheckedChanged= \" ;CB1_CheckedChanged \" ; / > \r\n\r\nYou can use the NamingContainer property to make the connection between the two checkboxes:\r\n\r\n protected void CB1_CheckedChanged(Object sender, EventArgs e)\r\n {\r\n CheckBox cb1 = sender as CheckBox;\r\n Control container = cb1.NamingContainer;\r\n CheckBox cb2 = container.FindControl( \" ;CB2 \" ;) as CheckBox;\r\n cb2.Checked = cb1.Checked;\r\n }", "254" ], [ "In order to get the behavior that you report, I had to set :\r\n\r\n`EnableViewState= \" ;false \" ;` \r\n\r\nat the page level (or on a container of the CheckBox). If you set: \r\n\r\n`EnableViewState= \" ;true \" ;` \r\n\r\neverywhere, it works for both check and uncheck actions.\r\n\r\nAn even simpler solution is to remove all EnableViewState and ViewStateMode attributes from your markup and use the default values.\r\n\r\n\r\nUPDATE\r\n\r\nIf you want to disable the ViewState at the page level and enable it for individual controls, you can set this at the page level:\r\n\r\n ViewStateMode= \" ;Disabled \" ;\r\n\r\nAnd this for each control that needs the ViewState:\r\n\r\n ViewStateMode= \" ;Enabled \" ;\r\n\r\nIn that case, you should not use EnableViewState in the markup, since using both attributes can make things more confusing...", "52" ], [ "I assume that the code-behind that you want to execute is on the destination page. If it is some initialization code that depends on a value in the GridView, you can append it as a parameter to the URL. For example, if the GridView has a \" ;LastDate \" ; field:\r\n\r\n < asp:TemplateField > \r\n < ItemTemplate > \r\n < asp:HyperLink ID= \" ;EditLink \" ; runat= \" ;server \" ; Text= \" ;Edit \" ;\r\n NavigateUrl=&#39; < %# \" ;~/EditCustomer.aspx?Date= \" ; & Databinder.Eval(Container.DataItem, \" ;LastDate \" ;) % > &#39; / > \r\n ...\r\n < /ItemTemplate > \r\n < /asp:TemplateField > \r\n\r\nThen you can retrieve the parameter in the destination page and use it as you want to initialize the page before showing it:\r\n\r\n Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load\r\n If Not Page.IsPostBack Then\r\n If Not IsNothing(Request.QueryString( \" ;Date \" ;)) Then\r\n InitPageWithDate(CDate(Request.QueryString( \" ;Date \" ;)))\r\n ...\r\n End If\r\n ...\r\n End Sub", "706" ], [ "You could set a class name to the controls of the inner FormView:\r\n\r\n < asp:FormView ID = \" ;ChildFormView1 \" ; runat= \" ;server \" ; > \r\n < ItemTemplate > \r\n < asp:TextBox ID= \" ;MyTextBoxInChildFV \" ; runat= \" ;server \" ; CssClass= \" ;childTextBox \" ; > < /asp:TextBox > \r\n < asp:CheckBox ID= \" ;MYCheckBoxInChildFV \" ; runat= \" ;server \" ; CssClass= \" ;childCheckBox \" ; > < /asp:CheckBox > \r\n < /ItemTemplate > \r\n < /asp:FormView > \r\n\r\nAnd retrieve them with that class name:\r\n\r\n var childFV = document.getElementById(&#39; < %=ParentFormView.FindControl( \" ;ChildFormView1 \" ;).ClientID % > &#39;);\r\n var childTextBoxes = childFV.getElementsByClassName(&#39;childTextBox&#39;);\r\n var childCheckBoxes = childFV.getElementsByClassName(&#39;childCheckBox&#39;);", "318" ], [ "It appears that binding the `title` property of the child element will override the parent `title`, even when `input` is `null` or `undefined`. However, according to [**this stackblitz**][1], binding the title attribute with `[attr.title]` allows to inherit the parent `title` when `input` is `null` or `undefined`:\r\n\r\n < div [attr.title]= \" ;input \" ; > ABC < /div > \r\n\r\nwith\r\n\r\n @Input() input: string; // undefined by default\r\n\r\n\r\n [1]: _URL_0_", "318" ], [ "You can give simple names to the [template reference variables][1], and refer to them as usual. The variables are defined for each iteration of the `ngFor` loop and are available in the context of that iteration (see [this stackblitz][2] for an example). If the markup is used in a `form` tag, make sure that each `input` field has a unique `name`.\r\n\r\n < div *ngFor= \" ;let p of model; let i=index \" ; > \r\n \r\n < input \r\n type= \" ;text \" ; \r\n required \r\n [(ngModel)]= \" ;p.ti \" ; \r\n #ti= \" ;ngModel \" ; \r\n #tiRef \r\n [name]= \" ;&#39;ti&#39; + i \" ; > \r\n \r\n < div class= \" ;counter \" ; > \r\n {{ tiRef.getAttribute(&#39;maxlength&#39;) - tiRef.value.length }}\r\n < /div > \r\n \r\n < div *ngIf= \" ;ti.touched & & !ti.valid & & ti.errors & & ti.errors.required \" ; > \r\n Please enter a title.\r\n < /div > \r\n \r\n < /div > \r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "730" ], [ "You can be notified that a new `input` element was created by subscribing to the `QueryList.changes` event, where the `QueryList < ElementRef > ` is obtained with `ViewChildren`. Every time the event is triggered, you can then focus the last element of the list. See [**this stackblitz**][1] for a demo.\r\n\r\n import { Component, ViewChild, ViewContainerRef, ElementRef, AfterViewInit, ViewChildren, QueryList } from &#39;@angular/core&#39;;\r\n ...\r\n \r\n export class AppComponent {\r\n @ViewChild(&#39;emailTmpl&#39;) emailTmpl;\r\n @ViewChild(&#39;furtherEmails&#39;, { read: ViewContainerRef }) furtherEmails;\r\n @ViewChildren(&#39;email&#39;) email: QueryList < ElementRef > ;\r\n \r\n public clone(): void {\r\n this.furtherEmails.createEmbeddedView(this.emailTmpl);\r\n }\r\n \r\n ngAfterViewInit() {\r\n this.email.changes.subscribe(() = > {\r\n this.email.last.nativeElement.focus();\r\n });\r\n }\r\n }\r\n\r\n\r\n [1]: _URL_0_", "318" ], [ "It can be done by assigning the method to a class member property in `ngOnInit`. In the code below, I define the method as an arrow function, to make sure that `this` refers to the instance of the component in the body of the method. See [**this stackblitz**][1] for a demo.\r\n\r\n export class AppComponent implements OnInit {\r\n\r\n public onButtonClick: (event: Event) = > void; // Member property will refer to the method\r\n \r\n ngOnInit() {\r\n\r\n let data = \" ;And this comes from the closure! \" ;; // Can be used inside of onButtonClick\r\n\r\n // Assign the method to the member property\r\n this.onButtonClick = (event: Event): void = > {\r\n console.log( \" ;The button was clicked! \" ;, data);\r\n ...\r\n };\r\n\r\n }\r\n }\r\n\r\nThe method can then be used as an event handler:\r\n\r\n < button (click)= \" ;onButtonClick($event) \" ; > Click me! < /button > \r\n\r\n\r\n\r\n [1]: _URL_0_", "516" ], [ "The event handler should call the function. The markup would be:\r\n\r\n < input (input)= \" ;funcVar($event) \" ; / > \r\n\r\nfor the `funcVar` member defined as:\r\n\r\n public funcVar = (e) = > {\r\n console.log(e.target.value)\r\n }\r\n\r\nIf another method is assigned to `funcVar` later, that new method will be executed when the `input` event is triggered:\r\n\r\n someMethodExecutedLater() {\r\n this.funcVar = (e) = > {\r\n // From now on, this new function will be called by the event handler\r\n ...\r\n }\r\n }", "516" ], [ "You can use `ViewChildren` and the `QueryList.changes` event to be notified when the button is added to or removed from the view. If the `QueryList` contains the button element, you can set the focus on it. See [**this stackblitz**][1] for a demo. Suggestion: you may want to do something similar to set the focus on the input field when it becomes visible.\r\n\r\n import { Component, ViewChildren, ElementRef, AfterViewInit, QueryList } from &#39;@angular/core&#39;;\r\n ...\r\n\r\n export class AppComponent implements AfterViewInit {\r\n \r\n @ViewChildren( \" ;durationButton \" ;) durationButton: QueryList < ElementRef > ;\r\n\r\n enteringDuration = false\r\n \r\n ngAfterViewInit() {\r\n this.durationButton.changes.subscribe((button) = > {\r\n if (button.length > 0) {\r\n button.first.nativeElement.focus();\r\n }\r\n });\r\n }\r\n \r\n enterDuration() {\r\n this.enteringDuration = true\r\n }\r\n \r\n setDuration() {\r\n this.enteringDuration = false\r\n }\r\n }\r\n\r\n [1]: _URL_0_", "479" ], [ "You don&#39;t need to give a different name to the [template reference variable][1] in each iteration of the `ngFor` loop. Just give it a normal name, like `#durationTime`. The `ngClass` binding and the `ngIf` condition will use the instance of the variable specific to the iteration of the loop.\r\n\r\n < div *ngFor= \" ;let item of items; let i = index \" ; class= \" ;row \" ; > \r\n < div class= \" ;col-md-7 \" ; > \r\n < select \r\n class= \" ;form-control form-control-sm \" ; \r\n name= \" ;durationTime{{i}} \" ; \r\n required \r\n [(ngModel)]= \" ;item.durationTime \" ;\r\n #durationTime= \" ;ngModel \" ;\r\n [ngClass]= \" ;{&#39;is-valid&#39;: durationTime.valid & & durationTime.touched, &#39;is-invalid&#39;: durationTime.invalid & & durationTime.touched} \" ; > \r\n < option [ngValue]= \" ;null \" ; disabled selected > <PERSON> < /option > \r\n < option *ngFor= \" ;let item of durationTimes \" ; [ngValue]= \" ;item \" ; > {{item}} < /option > \r\n < /select > \r\n < small *ngIf= \" ;durationTime.invalid & & durationTime.touched \" ;\r\n class= \" ;form-text text-muted-error \" ; > \r\n !Debes seleccionar una opci&#243;n!\r\n < /small > \r\n < /div > \r\n < /div > \r\n\r\n\r\n [1]: _URL_0_", "196" ], [ "When using the following syntax, you are setting the cell content in two different ways at the same time. Apparently, the value bound to `innerHTML` overrides the literal content of the element.\r\n\r\n < td [innerHtml]= \" ;dropdown | safeHTML \" ; > \r\n Alert\r\n < /td > \r\n\r\nYou can have the text appended to the value of `dropdown` with this syntax:\r\n\r\n < td [innerHtml]= \" ;dropdown + &#39;Alert&#39; | safeHTML \" ; > \r\n < /td > \r\n\r\nSee [**this stackblitz**][1] for a demo.\r\n\r\n\r\n [1]: _URL_0_", "470" ], [ "In your service, you can define `companySubject` as a `ReplaySubject` instead of a `Subject`. The buffer size can be set to 1, so that it \" ;replays \" ; only the last emitted value.\r\n\r\n private companySubject = new ReplaySubject < Company > (1);\r\n\r\nA new view will be notified as soon as it subscribes to the observable, if `CompanyState` has already emitted a value. As a consequence, you can remove the direct call to `getSomeData()` in your component initialization code.\r\n\r\nSee [this answer][1] for details about the various `Subject` classes.\r\n\r\n [1]: _URL_0_", "769" ], [ "You can use a [template reference variable][1] to achieve what you want. Please note that the `ngModel` directive must be set on the input element in order to make it work.\r\n\r\n < input #textInput type= \" ;text \" ; ngModel > \r\n < button [disabled]= \" ;textInput.value !== &#39;yes&#39; \" ; > Delete < /button > \r\n\r\nSee [this stackblitz][2] for a demo.\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "479" ], [ "I have a problem with the `line-height` style in paragraphs filled with a `span`, when the font size in the `span` is smaller than that of the paragraph.\r\n\r\nMy Angular application has an editable `div` element, and I use the [Froala editor][1] API commands to allow formatting. I added my own custom commands to modify the `line-height` in paragraphs.\r\n\r\nThe CSS sets a default font size and line height for the editor:\r\n\r\n div {\r\n font-size: 20px;\r\n line-spacing: 1.25;\r\n }\r\n\r\nThe initial markup is something like this:\r\n\r\n < div > \r\n < p > Some long text that wraps here... < /p > \r\n < p > Some long text that wraps here... < /p > \r\n < p > Some long text that wraps here... < /p > \r\n < /div > \r\n\r\nAfter setting the font size and line height with the editor, the markup becomes:\r\n\r\n < div > \r\n < p style= \" ;line-height: 1; \" ; > < span > Some long text that wraps here... < /span > < /p > \r\n < p style= \" ;line-height: 1; \" ; > < span style= \" ;font-size: 8px; \" ; > Some long text that wraps here... < /span > < /p > \r\n < p style= \" ;line-height: 1; \" ; > < span style= \" ;font-size: 40px; \" ; > Some long text that wraps here... < /span > < /p > \r\n < /div > \r\n\r\nAs long as the font size in the `span` is equal or larger than the font size of the paragraph (in the present case, `20px`), the line height scales correctly. However, when the font size in the `span` is smaller than that of its paragraph, the line height does not scale as it should. The problem can be seen in **[this jsfiddle][2]**.\r\n\r\nIf I set `display: inline-block` on the `span` elements, the line height scales properly but that display setting messes up the wrapping in the editor. Otherwise, the only workaround that I can think of is to use data binding to set the line height with pixel units, after retrieving the font size inside of the paragraph. Is there a simpler way to force the line height to adjust to `span` elements with a smaller font size?\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "30" ], [ "You can make the two check boxes modify the same variable by binding each one to a getter/setter property that interprets the variable differently. In the template below, two different properties are used:\r\n\r\n < div > \r\n < input type= \" ;checkbox \" ; [(ngModel)]= \" ;isLeftAligned \" ; > Left\r\n < /div > \r\n < div > \r\n < input type= \" ;checkbox \" ; [(ngModel)]= \" ;isRightAligned \" ; > Right\r\n < /div > \r\n < div > \r\n Alignment: {{strAlignment}}\r\n < /div > \r\n\r\nBut, in the code, `isLeftAligned` and `isRightAligned` both depend on the variable `alignment`:\r\n\r\n enum Alignment {\r\n None,\r\n Left,\r\n Right,\r\n }\r\n \r\n < !-- -- > \r\n\r\n export class AppComponent {\r\n \r\n private alignment = Alignment.None;\r\n \r\n get isLeftAligned(): boolean {\r\n return this.alignment === Alignment.Left;\r\n }\r\n set isLeftAligned(value: boolean) {\r\n if (value) {\r\n this.alignment = Alignment.Left;\r\n } else {\r\n this.alignment = Alignment.None;\r\n }\r\n }\r\n \r\n get isRightAligned(): boolean {\r\n return this.alignment === Alignment.Right;\r\n }\r\n set isRightAligned(value: boolean) {\r\n if (value) {\r\n this.alignment = Alignment.Right;\r\n } else {\r\n this.alignment = Alignment.None;\r\n }\r\n }\r\n\r\n ... \r\n }\r\n\r\nSee [**this stackblitz**][1] for a demo.\r\n\r\nAn alternative is to use radio buttons instead of check boxes.\r\n\r\n [1]: _URL_0_", "894" ], [ "The `ngSwitch` directive is similar to the `switch` statement. It displays the element for which the `ngSwitchCase` value is equal to the `ngSwitch` variable. Here is an example taken from [this _URL_1_ article][1]:\r\n\r\n < div [ngSwitch]= \" ;tab \" ; > \r\n < app-tab-content *ngSwitchCase= \" ;1 \" ; > Tab content 1 < /app-tab-content > \r\n < app-tab-content *ngSwitchCase= \" ;2 \" ; > Tab content 2 < /app-tab-content > \r\n < app-tab-content *ngSwitchCase= \" ;3 \" ; > Tab content 3 < /app-tab-content > \r\n < app-tab-content *ngSwitchDefault > Select a tab < /app-tab-content > \r\n < /div > \r\n\r\n < hr/ > \r\n\r\nIn your case, an expression gives a boolean value for each `ngSwitchCase`. You end up with the equivalent of:\r\n\r\n\r\n < li class= \" ;b-inBoxItem \" ; *ngFor= \" ;let item of uploader.queue \" ; > \r\n < div [ngSwitch]= \" ;_URL_3_ \" ; > \r\n < span *ngSwitchCase= \" ;true \" ; class= \" ;ic ic-file-image \" ; > < /span > \r\n < span *ngSwitchCase= \" ;false \" ; class= \" ;ic ic-file-image \" ; > < /span > \r\n < span *ngSwitchCase= \" ;false \" ; class= \" ;ic ic-file-stats \" ; > < /span > \r\n .\r\n .\r\n .\r\n < span *ngSwitchDefault class= \" ;ic ic-file-empty \" ; > < /span > \r\n < /div > \r\n < /li > \r\n\r\nThe default `span` is displayed because `_URL_3_` is not equal to `true` or `false`.\r\n\r\n < hr/ > \r\n\r\nTo make it work, specify the file extension in `ngSwitch` and test the possible values:\r\n\r\n < li class= \" ;b-inBoxItem \" ; *ngFor= \" ;let item of uploader.queue \" ; > \r\n < div [ngSwitch]= \" ;getFileExtension(_URL_3_) \" ; > \r\n < span *ngSwitchCase= \" ;&#39;png&#39; \" ; class= \" ;ic ic-file-image \" ; > < /span > \r\n < span *ngSwitchCase= \" ;&#39;jpeg&#39; \" ; class= \" ;ic ic-file-image \" ; > < /span > \r\n < span *ngSwitchCase= \" ;&#39;doc&#39; \" ; class= \" ;ic ic-file-stats \" ; > < /span > \r\n .\r\n .\r\n .\r\n < span *ngSwitchDefault class= \" ;ic ic-file-empty \" ; > < /span > \r\n < /div > \r\n < /li > \r\n\r\nwith the method (see [this post][2]):\r\n\r\n getFileExtension(filename: string): string {\r\n return filename.split(&#39;.&#39;).pop();\r\n }\r\n\r\n < hr/ > \r\n\r\nAn alternative solution is to use `ngIf`:\r\n\r\n < li class= \" ;b-inBoxItem \" ; *ngFor= \" ;let item of uploader.queue \" ; > \r\n < div > \r\n < span *ngIf= \" ;_URL_3_.includes(&#39;.png&#39;) \" ; class= \" ;ic ic-file-image \" ; > < /span > \r\n < span *ngIf= \" ;_URL_3_.includes(&#39;.jpeg&#39;) \" ; class= \" ;ic ic-file-image \" ; > < /span > \r\n < span *ngIf= \" ;_URL_3_.includes(&#39;.doc&#39;) \" ; class= \" ;ic ic-file-stats \" ; > < /span > \r\n .\r\n .\r\n .\r\n < span *ngIf= \" ;!_URL_3_.includes(&#39;.png&#39;) & & !_URL_3_.includes(&#39;.jpeg&#39;) & & !_URL_3_.includes(&#39;.doc&#39;) \" ; class= \" ;ic ic-file-empty \" ; > < /span > \r\n < /div > \r\n < /li > \r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_0_", "196" ], [ "One way to access the newly created element is to set a [template reference variable][1] on the `div`:\r\n\r\n < div *ngIf= \" ;groupedPatchGroups \" ; > \r\n < div #externalEvents > \r\n stuff here\r\n < /div > \r\n < br / > \r\n < /div > \r\n\r\nand to subscribe to the `QueryList.changes` event in `ngAfterViewInit`. You can also check if the element is already present in the DOM before subscribing.\r\n\r\n @ViewChildren( \" ;externalEvents \" ;) externalEvents: QueryList < ElementRef > ;\r\n \r\n ngAfterViewInit() {\r\n console.log( \" ;Before changes \" ;, this.externalEvents.first); // Maybe already present\r\n this.externalEvents.changes.subscribe((elements) = > {\r\n // Do something with elements or with this.externalEvents\r\n let element = this.externalEvents.first;\r\n console.log( \" ;Changes detected \" ;, element);\r\n ...\r\n }\r\n }\r\n\r\nSee [this stackblitz][2] for a demo.\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "454" ], [ "You can extend the `CurrencyPipe`:\r\n\r\n import { Pipe } from &#39;@angular/core&#39;;\r\n import { CurrencyPipe } from &#39;@angular/common&#39;;\r\n \r\n @Pipe({\r\n name: &#39;usdCurrency&#39;\r\n })\r\n export class UsdCurrencyPipe extends CurrencyPipe {\r\n transform(value: number, digitsInfo: string = \" ;1.0-0 \" ;): any {\r\n return super.transform(value, \" ;USD \" ;, \" ;symbol \" ;, digitsInfo); }\r\n }\r\n\r\nand apply that custom pipe in your template:\r\n\r\n < p > {{amount1 | usdCurrency }} < /p > \r\n < p > {{amount2 | usdCurrency }} < /p > \r\n < div > {{amount3 | usdCurrency }} < /div > \r\n < h1 > {{amount4 | usdCurrency : \" ;1.2-2 \" ; }} < /h1 > \r\n\r\nIn the example above, `digitsInfo` is available as an optional parameter. The other parameters could be made available if needed (`currencyCode`, `display`, `locale`).\r\n\r\nSee [this stackblitz][1] for a demo.\r\n\r\n\r\n [1]: _URL_0_", "835" ], [ "In the markup, you can define a hidden first option with the default selected value, and set a handler for the `(change)` event:\r\n\r\n < select (change)= \" ;onSelectChange($event) \" ; > \r\n < option hidden value= \" ;+1 \" ; > +1 < /option > \r\n < option value= \" ;+1 \" ; > USA: +1 < /option > \r\n < option value= \" ;+66 \" ; > THA: +66 < /option > \r\n < option value= \" ;+56 \" ; > CHL: +56 < /option > \r\n < option value= \" ;+84 \" ; > VN: +84 < /option > \r\n < /select > \r\n\r\nEvery time an option is selected:\r\n\r\n- The value of the hidden option is set to the selected value\r\n- The text of the hidden option is set to the selected value\r\n- The hidden option is selected\r\n\r\n < !-- -- > \r\n\r\n onSelectChange(event: Event) {\r\n let select = event.target as HTMLSelectElement;\r\n select.options[0].value = select.value;\r\n select.options[0].text = select.value;\r\n select.selectedIndex = 0;\r\n }\r\n\r\nSee [this stackblitz][1] for a demo.\r\n\r\n\r\n [1]: _URL_0_", "645" ], [ "The `hidden` attribute sets the style:\r\n\r\n display: none;\r\n\r\nBut the `fxLayoutAlign` directive [overrides it][1] with:\r\n\r\n display: flex;\r\n\r\n < hr/ > \r\n\r\nIn order to hide the element, you can define a class style in which the `display` attribute is given a higher priority with the `!important` flag:\r\n\r\n .not-visible {\r\n display: none !important;\r\n }\r\n\r\nand apply that class conditionally to the element:\r\n\r\n < div [class.not-visible]= \" ;this.days.length > 0 \" ; fxLayoutAlign= \" ;center center \" ; > \r\n\r\nSee [this stackblitz][2] for a demo.\r\n\r\n < hr/ > \r\n\r\nAn alternative is to use `*ngIf= \" ;!days.length \" ;`, as suggested by [PierreDuc][3] in a comment. The result is somewhat different however: instead of just being hidden, the element is not present in the DOM at all when the `ngIf` condition is `false`.\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_2_\r\n [3]: _URL_0_", "619" ], [ "You should monitor the creation of the table cell with `ViewChildren` and the `QueryList.changes` event. In the markup, set a template reference variable on the `td` elements:\r\n\r\n < td #cells *ngFor= \" ;let item of items; \" ; > \r\n\r\nIn the code, use `ViewChildren` to get the list of these elements, and subscribe to the `QueryList.changes` event in `ngAfterViewInit`. If a new cell was added, do the scrolling. In the code below, I set a flag to make sure that automatic scrolling is performed only when desired.\r\n\r\n @ViewChildren( \" ;cells \" ;) cells: QueryList < ElementRef > ;\r\n\r\n private shouldScrollRight = false;\r\n ...\r\n\r\n addItem() {\r\n this.shouldScrollRight = true;\r\n this.items.push(item);\r\n }\r\n\r\n ngAfterViewInit() {\r\n this.cells.changes.subscribe((cellList) = > {\r\n if (this.shouldScrollRight) {\r\n this.shouldScrollRight = false;\r\n this.scrollRight();\r\n }\r\n });\r\n }\r\n\r\nSee [this stackblitz][1] for a demo.\r\n\r\n\r\n [1]: _URL_0_", "870" ], [ "Instead of [property binding][1], you can use [attribute binding][2]:\r\n\r\n < progress-bar [attr.value]= \" ;value \" ; > \r\n\r\n < !-- -- > \r\n\r\n export class ProgressBar {\r\n \r\n constructor(private elementRef: ElementRef < HTMLElement > ) {}\r\n \r\n get value() {\r\n const element = this.elementRef.nativeElement;\r\n return element.getAttribute( \" ;value \" ;);\r\n }\r\n }\r\n\r\nSee [this stackblitz][3] for a demo.\r\n\r\n < hr/ > \r\n\r\nA simpler solution is to set a class conditionally on the component with `HostBinding`:\r\n\r\n export class ProgressBar {\r\n\r\n private currentValue;\r\n\r\n @Input()\r\n get value() { return this.currentValue; }\r\n set value(value: number) { this.currentValue = value; }\r\n\r\n @HostBinding( \" ;class.has-value \" ;) get hasValue(): boolean {\r\n return !!this.currentValue;\r\n }\r\n }\r\n\r\nand to apply the styling according to the class selector:\r\n\r\n progress-bar {\r\n ...\r\n & .has-value { \r\n ...\r\n }\r\n & :not(.has-value) { \r\n ...\r\n }\r\n }\r\n\r\nSee [this stackblitz][4] for a demo.\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_3_\r\n [3]: _URL_1_\r\n [4]: _URL_0_", "118" ], [ "If the element has an absolute position, you can set the `left` and `top` style attributes:\r\n\r\n this.draggableElement.nativeElement.style.left = \" ;100px \" ;;\r\n this.draggableElement.nativeElement.style.top = \" ;200px \" ;;\r\n\r\nAn alternative is to move it with a CSS transform:\r\n\r\n this.draggableElement.nativeElement.style.transform = \" ;translateX(100px) \" ;;\r\n this.draggableElement.nativeElement.style.transform = \" ;translateY(200px) \" ;;\r\n this.draggableElement.nativeElement.style.transform = \" ;translate(100px, 200px) \" ;;", "455" ], [ "Calling the [Date constructor][1] with a string argument creates a UTC date. If you are in GMT-0400 (Eastern), calling `new Date(&#39;2018-08-23&#39;)` results in:\r\n\r\n Eastern: 2018-08-22 20:00:00\r\n GMT: 2018-08-23 00:00:00\r\n\r\nWhen you call `Date.setHours(19)`, you set the hours [according to local time][2], which results in:\r\n\r\n Eastern: 2018-08-22 19:00:00\r\n GMT: 2018-08-22 23:00:00\r\n\r\n < hr/ > \r\n\r\nYou could create a date for local time with the [Date constructor][3] that accepts multiple arguments:\r\n\r\n let date = new Date(2018, 7, 23); // Note: the month index starts at zero\r\n\r\nwhich gives:\r\n\r\n Eastern: 2018-08-23 00:00:00\r\n GMT: 2018-08-23 04:00:00\r\n\r\nThen call `Date.setHours(19)` to get:\r\n\r\n Eastern: 2018-08-23 19:00:00\r\n GMT: 2018-08-23 23:00:00\r\n\r\nSee [this stackblitz][4] for a demo.\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_0_/setHours\r\n [3]: _URL_0_#Syntax\r\n [4]: _URL_2_", "813" ], [ "Your `*ngFor` loop is probably inside a `form` tag. Since the input elements in the loop have the same name, they display the last value in the array, as shown in [this stackblitz][1].\r\n\r\nTo bind the correct item values, make sure that the input names are unique by appending the loop index to each name (see [this stackblitz][2]):\r\n\r\n < div class= \" ;row-place \" ; *ngFor= \" ;let seat of reservation.seats; let i = index \" ; > \r\n < input [(ngModel)]= \" ;seat.xrow \" ; [name]= \" ;&#39;row&#39;+i \" ; type= \" ;number \" ; min= \" ;0 \" ; class= \" ;place form-control signup-row \" ; > \r\n < input [(ngModel)]= \" ;seat.yplace \" ; [name]= \" ;&#39;place&#39;+i \" ; type= \" ;number \" ; min= \" ;0 \" ; class= \" ;place form-control signup-row \" ; > \r\n < /div > \r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "604" ], [ "When you use this statement:\r\n\r\n console.log(archive);\r\n\r\na reference to the `archive` object is shown in the console (see [the MDN documentation][1]). The content of the object can be different when you inspect it in the console (by clicking on the arrow) from what it was when the `console.log` statement was executed.\r\n\r\nIn order to see what the actual content is at a specific moment, you should output a string representation of the object:\r\n\r\n console.log(archive.toString());\r\n console.log(JSON.stringify(archive));\r\n\r\nYou can expermiment with [this stackblitz][2] to see the various console outputs.\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "436" ], [ "A valid `LoggedInUser` object that includes the `isAdmin()` method can be obtained with `new LoggedInUser()`. In the present case, you must supply such an object as the initial value for the `BehaviorSubject` and also as an argument to the `next` method.\r\n\r\nYou can define a class constructor with optional parameters:\r\n\r\n export class LoggedInUser {\r\n \r\n constructor( \r\n public name?: string,\r\n public id?: string,\r\n public isGlobalAdmin?: boolean,\r\n public currentRole?: string) {}\r\n \r\n isAdmin() {\r\n return this.isGlobalAdmin || this.currentRole == Roles.Owner || this.currentRole == Roles.Administrator;\r\n }\r\n }\r\n\r\nThe `BehaviorSubject` can then be initialized with `null` or with a default `LoggedInUser` object:\r\n\r\n new BehaviorSubject < LoggedInUser > (null);\r\n new BehaviorSubject < LoggedInUser > (new LoggedInUser());\r\n\r\nand the `Behavior.next` method can be called with:\r\n\r\n this.currentUserSubject.next(\r\n new LoggedInUser(\r\n _URL_0_, \r\n _URL_1_, \r\n decodedJwtData.isGlobalAdmin === \" ;True \" ;, \r\n decodedJwtData.currentRole)\r\n );", "315" ], [ "You can detect the presence of the div elements, and disable the button if any of them is present in the view. To detect these elements, set a template reference variable on them:\r\n\r\n < div #existingItem *ngIf= \" ;_URL_2_ !== _URL_1_ \" ; > \r\n\r\nand monitor the presence of the elements with `ViewChildren` and `QueryList`. A flag can be set if at least one element is present in the view.\r\n\r\n @ViewChildren( \" ;existingItem \" ;) existingItems: QueryList < ElementRef > ;\r\n public disabledButton = false;\r\n\r\n constructor(private changeDetector: ChangeDetectorRef) {}\r\n\r\n ngAfterViewInit() {\r\n // Check if an element is initially present\r\n this.disabledButton = this.existingItems.length > 0;\r\n this.changeDetector.detectChanges();\r\n\r\n // Monitor the addition/removal of elements\r\n this.existingItems.changes.subscribe((existingItems) = > {\r\n this.disabledButton = existingItems.length > 0;\r\n this.changeDetector.detectChanges();\r\n });\r\n }\r\n\r\nFinally, the button is disabled if the flag is set:\r\n\r\n < button type= \" ;submit \" ; [disabled]= \" ;disabledButton \" ; > Submit < /button > \r\n\r\nSee [this stackblitz][1] for a demo.\r\n\r\n\r\n [1]: _URL_0_", "479" ], [ "As suggested in [this answer][1], you can detect the document `click` events with `HostListener`. To make sure that mouse clicks don&#39;t reach the document when the menu is clicked, you should stop the propagation of the event in the `click` event handler set on the `aside` element:\r\n\r\n < aside [hidden]= \" ;!menu \" ; (click)= \" ;handleAsideClick($event) \" ; > \r\n\r\n < !-- -- > \r\n\r\n @HostListener(&#39;document:click&#39;, [&#39;$event&#39;]) clickout(event) {\r\n // Click outside of the menu was detected\r\n ...\r\n }\r\n\r\n handleAsideClick(event: Event) {\r\n event.stopPropagation(); // Stop the propagation to prevent reaching document\r\n ...\r\n }\r\n\r\n [1]: _URL_0_", "940" ], [ "In order to \" ;set the variables back to the state they were before they got values \" ;, set them to `undefined`:\r\n\r\n this.foo$ = undefined;\r\n this.bar = undefined;\r\n\r\nIn [the stackblitz][1] that you took for your tests, the Observable `heroes$` is used with the `async` pipe:\r\n\r\n < li *ngFor= \" ;let hero of heroes$ | async \" ; > \r\n\r\nIf `heroes$` is then set to `undefined`, the list disappears from the view and the Observable stops working. The `async` pipe [unsubscribes automatically][2] when the component is destroyed; it appears to do the same when the Observable variable becomes `undefined`.\r\n\r\nExcept for the case where the Observable is used with the `async` pipe, setting the variable to `undefined` does not stop the Observable from working, as shown in [this stackblitz][3].\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_1_\r\n [3]: _URL_0_", "730" ], [ "You can check if a property is defined in `mapToSearch` with [hasOwnProperty][1] (see [this stackblitz][2]):\r\n\r\n < ng-container *ngIf= \" ;mapToSearch.hasOwnProperty(keyToFind) \" ; > \r\n Hello world\r\n < /ng-container > \r\n\r\n`hasOwnProperty` will return `true` if the property exists, even if the associated value is falsy. This is different from `mapToSearch[keyToFind]`, which will return `false` in the following cases:\r\n\r\n prop: \" ; \" ;\r\n prop: 0\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "241" ], [ "You can associate a template reference variable to the `select` element, and test if `selectedIndex` corresponds to the last option index:\r\n\r\n < select #fruitList ... > \r\n ...\r\n < option *ngFor=&#39;let choice of fruitChoices&#39; > {{choice}} < /option > \r\n < /select > \r\n\r\n < div *ngIf= \" ;fruitList.selectedIndex === fruitList.options.length - 1 \" ; > \r\n ...\r\n < /div > \r\n\r\nSee [**this stackblitz**][1] for a demo.\r\n\r\n\r\n [1]: _URL_0_", "645" ], [ "The `slidesPerView` property of `SwiperConfigInterface` expects a value of type `number` or a value of type `&#39;auto&#39;`:\r\n\r\n slidesPerView?: number | &#39;auto&#39;,\r\n\r\nAccording to the error message, Typescript considers `&#39;auto&#39;` as of type `string` in this object:\r\n\r\n return {\r\n observer: true,\r\n direction: &#39;vertical&#39;,\r\n slidesPerView: &#39;auto&#39;,\r\n freeMode: true,\r\n ...\r\n };\r\n\r\nYou can force the compiler to see it as a value of type `&#39;auto&#39;` by casting it:\r\n\r\n slidesPerView: &#39;auto&#39; as &#39;auto&#39;,", "343" ], [ "You can filter the rows in the template by using an `ng-container` for the `ngFor` loop, and by applying an `ngIf` condition on the `tr` elements. Please note that the `ng-container` itself is not rendered in the HTML output.\r\n\r\n < tbody > \r\n < ng-container *ngFor= \" ;let boat of boats \" ; > \r\n < tr *ngIf= \" ;boat.status === &#39;Accepted&#39; \" ; > \r\n < td > {{ boat.boatType }} < /td > \r\n < td > {{ boat.service }} < /td > \r\n < td > {{ boat.location }} < /td > \r\n < td > {{ boat.jobType }} < /td > \r\n < td > {{ boat.status }} < /td > \r\n < /tr > \r\n < /ng-container > \r\n < /tbody > \r\n\r\nSee [**this stackblitz**][1] for a demo.\r\n\r\n\r\n [1]: _URL_0_", "305" ], [ "Instead of a boolean, you can define a `selectedFeeds` array:\r\n\r\n selectedFeeds = new Array < Feed > ();\r\n\r\nIn the template, you add the feed that has been clicked to `selectedFeeds`:\r\n\r\n < a href= \" ;javascript:void(0) \" ; class= \" ;mr-5 \" ; (click)= \" ;selectedFeeds.push(feed) > Comment button < /a > \r\n\r\nand you filter the comments according to the selected feeds:\r\n\r\n < div *ngIf= \" ;selectedFeeds.indexOf(feed) > = 0 \" ; class= \" ;ed-card-feed--comments \" ; >", "645" ], [ "You can define a variable that points to the current list of choices:\r\n\r\n export class AppComponent{\r\n choicesA = [ \" ;option 1 \" ;, \" ;option 2 \" ;, \" ;option 3 \" ;];\r\n choicesB = [ \" ;option A \" ;, \" ;option B \" ;, \" ;option C \" ;];\r\n currentChoiceList: string[];\r\n \r\n processBackendData() {\r\n this.currentChoiceList = condition ? this.choicesA : this.choicesB;\r\n }\r\n }\r\n\r\nand use it in the template:\r\n\r\n < select > \r\n < option *ngFor= \" ;let choice of currentChoiceList \" ; > {{choice}} < /option > \r\n < /select >", "645" ], [ "Since the check boxes are not bound to a property (which could be reset to uncheck the box), you can use a template reference variable (e.g. `#checkboxes`):\r\n\r\n < input #checkboxes type= \" ;checkbox \" ; ... > \r\n ...\r\n < button type= \" ;button \" ; (click)= \" ;uncheckAll() \" ; > < /button > \r\n\r\nto retrieve the check boxes with `ViewChildren` in the code and uncheck each one:\r\n\r\n @ViewChildren( \" ;checkboxes \" ;) checkboxes: QueryList < ElementRef > ;\r\n\r\n uncheckAll() {\r\n this.checkboxes.forEach((element) = > {\r\n element.nativeElement.checked = false;\r\n });\r\n }\r\n\r\nSee [**this stackblitz**][1] for a demo.\r\n\r\n\r\n [1]: _URL_0_", "318" ], [ "The standard way to be notified that the content of a `QueryList` has changed it to subscribe to its `changes` event in `ngAfterViewInit`:\r\n\r\n @ViewChildren( \" ;internals \" ;) internals: QueryList < InternalComponent > ;\r\n \r\n ngAfterViewInit() {\r\n this.internals.changes.subscribe((list: QueryList < InternalComponent > ) = > {\r\n // The updated QueryList is available here (with list or with this.internals)\r\n this.doSomethingWithInternals(list);\r\n this.doSomethingWithNewInternal(list.last);\r\n ...\r\n });\r\n }\r\n\r\n < hr/ > \r\n\r\nThe event handling above may be all you need. If you still want to implement the `afterViewInit` event in `InternalComponent`, you can pass a reference to the component as a parameter of the event:\r\n\r\n export class InternalComponent implements AfterViewInit {\r\n @Output() afterViewInit = new EventEmitter < InternalComponent > ();\r\n \r\n ngAfterViewInit() {\r\n this.afterViewInit.emit(this);\r\n }\r\n \r\n }\r\n\r\nand retrieve the component in the event handler:\r\n\r\n (afterViewInit)= \" ;onAfterViewInit($event) \" ;\r\n\r\n onAfterViewInit(component: InternalComponent) {\r\n this.useNewInternalComponent(component);\r\n ...\r\n }", "970" ], [ "You can make your code work by forcing change detection before resetting the bound value. This probably ensures that the change made in the `select` element is processed before we then set it to an empty value. See [this stackblitz][1].\r\n\r\n logNoteSelectionChange(obj) {\r\n this.Otherlogs = obj;\r\n this.changeDetectorRef.detectChanges();\r\n this.selectedLog = &#39;&#39;;\r\n }\r\n\r\n < hr/ > \r\n\r\nAlternatively, you could remove the `[(ngModel)]` data binding on the `select` element:\r\n\r\n < select #select ngModel (ngModelChange)= \" ;logNoteSelectionChange(select, $event) \" ; > \r\n < option *ngFor= \" ;let log of logCol \" ; > \r\n {{log.logMessage}}\r\n < /option > \r\n < /select > \r\n\r\nand reset the selected value in the `(ngModelChange)` event handler:\r\n\r\n logNoteSelectionChange(select: HTMLSelectElement, obj: string) {\r\n this.Otherlogs = obj;\r\n select.value = \" ; \" ;;\r\n }\r\n\r\nSee [this stackblitz][2] for a demo.\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "645" ], [ "You can use the [local variables available][1], for example `even` and `odd`, in `*ngFor` to alternate the order of the columns with two `ngIf` directives. One of them makes `titulo` the first column for rows with an even index, the other one makes it the last column for rows with an odd index.\r\n\r\n < div class= \" ;row \" ; *ngFor= \" ;let servicio of servicios; let even=even \" ; > \r\n < div *ngIf= \" ;even \" ; class= \" ;col-lg-5 \" ; > \r\n {{ servicio.titulo }}\r\n < /div > \r\n < div class= \" ;col-lg-7 \" ; > \r\n < img src= \" ;{{ servicio.imagen }} \" ; alt= \" ; \" ; > \r\n < /div > \r\n < div *ngIf= \" ;!even \" ; class= \" ;col-lg-5 \" ; > \r\n {{ servicio.titulo }}\r\n < /div > \r\n < /div > \r\n\r\nSee [**this stackblitz**][2] for a demo.\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "743" ], [ "To make sure that you always get the width of the container, you can pass that element as an argument to `changePosition`, with the help of a [template reference variable][1]:\r\n\r\n < div #container class= \" ;player-progress-container \" ; (click)= \" ;changePosition($event, container) \" ; > \r\n ...\r\n < /div > \r\n\r\n < !-- -- > \r\n\r\n changePosition(event: MouseEvent, container: HTMLElement) {\r\n console.log( \" ;event.layerX = \" ; + event.layerX);\r\n console.log( \" ;clientWidth = \" ; + container.clientWidth);\r\n }\r\n\r\nSee [**this stackblitz**][2] for a demo.\r\n\r\n < hr/ > \r\n\r\nAs an alternative, you could pass `layerX` and `clientWidth` directly to `changePosition`:\r\n\r\n < div #container (click)= \" ;changePosition($event.layerX, container.clientWidth) \" ; ... > \r\n ...\r\n < /div > \r\n\r\n < !-- -- > \r\n\r\n changePosition(layerX: number, clientWidth: number) {\r\n console.log( \" ;layerX = \" ; + layerX);\r\n console.log( \" ;clientWidth = \" ; + clientWidth);\r\n }\r\n\r\nSee [**this stackblitz**][3] for a demo.\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_2_\r\n [3]: _URL_0_", "703" ], [ "You can use the `nativeElement` property of the `ElementRef` given by `ViewChild` to get the corresponding HTML element. From there, standard DOM methods and properties give access to its children:\r\n\r\n- element.children\r\n- element.querySelector\r\n- element.querySelectorAll\r\n- etc.\r\n\r\nFor example:\r\n\r\n @ViewChild( \" ;parent \" ;) private parentRef: ElementRef < HTMLElement > ;\r\n\r\n public getChildren() {\r\n const parentElement = this.parentRef.nativeElement;\r\n const firstChild = parentElement.children[0];\r\n const firstImage = parentElement.querySelector( \" ;img \" ;);\r\n ...\r\n }\r\n\r\nSee [**this stackblitz**][1] for a demo.\r\n\r\n\r\n [1]: _URL_0_", "318" ], [ "You can handle the `input` event on the last line:\r\n\r\n < div *ngFor= \" ;let header of headers; let i = index; let isLast = last \" ; fxLayout= \" ;row \" ; fxLayoutGap= \" ;25px \" ; > \r\n < mat-form-field fxFlex= \" ;25 \" ; > \r\n < input matInput placeholder= \" ;Name \" ; type= \" ;text \" ; name= \" ;name-{{i}} \" ; value= \" ;{{_URL_1_}} \" ; \r\n (input)= \" ;addInput(isLast) \" ; > \r\n < /mat-form-field > \r\n < mat-form-field fxFlex > \r\n < input matInput placeholder= \" ;Value \" ; type= \" ;text \" ; name= \" ;value-{{i}} \" ; value= \" ;{{header.value}} \" ; > \r\n < /mat-form-field > \r\n ...\r\n < /div > \r\n\r\nwith the `addInput` method, which adds a new record the first time the input content changes:\r\n\r\n export class DynamicformComponent implements OnInit {\r\n \r\n public headers: any[] = [];\r\n \r\n ngOnInit() {\r\n this.headers = [\r\n { name: &#39;Accept-Encoding&#39;, value: &#39;gzip&#39; },\r\n { name: &#39;Accept-Charset&#39;, value: &#39;utf-8&#39; },\r\n { name: &#39;User-Agent&#39;, value: &#39;&#39; },\r\n { name: &#39;Accept&#39;, value: &#39;text/plain&#39; },\r\n { name: &#39;Cookie&#39;, value: &#39;&#39; },\r\n { name: &#39;&#39;, value: &#39;&#39; }\r\n ];\r\n }\r\n \r\n addInput(isLast: boolean) {\r\n if (isLast) {\r\n this.headers.push({ name: &#39;&#39;, value: &#39;&#39; });\r\n }\r\n }\r\n \r\n removeInput(index) {\r\n this.headers.splice(index, 1)\r\n }\r\n }\r\n\r\nSee [**this stackblitz**][1] for a demo.\r\n\r\n\r\n [1]: _URL_0_", "516" ], [ "To apply a CSS style to a child component, use `<IP_ADDRESS>ng-deep`. See [this stackblitz][1] for a demo.\r\n\r\n :host <IP_ADDRESS>ng-deep .test {\r\n margin-top: 50px;\r\n }\r\n\r\n\r\nAccording to [Angular documentation][2]:\r\n\r\n > Component styles normally apply only to the HTML in the component&#39;s\r\n > own template.\r\n > \r\n > Use the /deep/ shadow-piercing descendant combinator to force a style\r\n > down through the child component tree into all the child component\r\n > views. The /deep/ combinator works to any depth of nested components,\r\n > and it applies to both the view children and content children of the\r\n > component.\r\n > \r\n > Use /deep/, > > > and <IP_ADDRESS>ng-deep only with emulated view encapsulation.\r\n > Emulated is the default and most commonly used view encapsulation.\r\n\r\n > ...\r\n > <IP_ADDRESS>ng-deep should be preferred for a broader compatibility with the\r\n > tools.\r\n\r\n < hr/ > \r\n\r\nAn alternative solution is to set the [view encapsulation][3] of the component to `ViewEncapsulation.None`.\r\n\r\nAnother alternative is to define the style globally in `styles.css`, as shown for the second panel in the [stackblitz][1].\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_0_\r\n [3]: _URL_1_", "318" ], [ "To make sure that the font-awesome icon does not catch the click event, define the following style in the component CSS:\r\n\r\n fa-icon {\r\n pointer-events: none;\r\n }\r\n\r\nWith that style attribute, the button receives the click event, which can then be handled correctly.\r\n\r\nSee [this stackblitz][1] for a demo.\r\n\r\n < hr/ > \r\n\r\nAn alternative solution is to handle the click event on the host element, and to stop the propagation. As a consequence, all the click events reaching the document are outside the host element: \r\n\r\n @HostListener(&#39;click&#39;, [&#39;$event&#39;])\r\n public onHostClick(event: Event) {\r\n event.stopPropagation();\r\n }\r\n \r\n @HostListener(&#39;document:click&#39;, [&#39;$event&#39;])\r\n public onDocumentClick(event: Event) {\r\n this.clickOutside.emit(null);\r\n }\r\n\r\nSee [this stackblitz][2] for a demo.\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "648" ], [ "Radio buttons are grouped according to their `name` property. In order to group them by column, give the radio buttons a `name` that is specific to each column:\r\n\r\n < tr *ngFor= \" ;let elem of group.axes \" ; > \r\n < td > {{elem}} < /td > \r\n < td > < mat-radio-button name= \" ;groupX \" ; > < /mat-radio-button > < /td > \r\n < td > < mat-radio-button name= \" ;groupY \" ; > < /mat-radio-button > < /td > \r\n < td > < mat-radio-button name= \" ;groupZ \" ; > < /mat-radio-button > < /td > \r\n < /tr > \r\n\r\nSee [this stackblitz][1] for a demo.\r\n\r\n\r\n [1]: _URL_0_", "302" ], [ "You can read [this blog post][1] by <PERSON> for a good explanation of what is happening.\r\n\r\nThe scope of a [template reference variable][2] is the template in which it is defined. In your second code sample, where no `ngIf` condition is applied, the variable `input2` is available everywhere in the template.\r\n\r\nWhen an `*ngIf` directive is used however, the variable `input` is actually defined inside an inner template created by the directive. Here is the desugared markup corresponding to your first example:\r\n\r\n < ng-template [ngIf]= \" ;bool \" ; > \r\n < mat-form-field > \r\n < input matInput #input placeholder= \" ;Enter 1st input \" ; > \r\n < /mat-form-field > \r\n < /ng-template > \r\n < button click=someMethod(input?.value) > Submit < /button > \r\n\r\nYou see that the definition of the variable `input` is inside of the inner template, but the button is trying to access it outside of that template, where it is undefined.\r\n\r\n[This stackblitz][3] shows the limited scope of a variable defined in a conditional directive.\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_2_\r\n [3]: _URL_0_", "373" ], [ "Since the `div` is inside an `ngIf` conditional block, it may not be available in `ngAfterViewInit`. You can protect the code against that possibility by monitoring the presence of the element with `ViewChildren` and the `QueryList.changes` event:\r\n\r\n @ViewChildren(&#39;container&#39;, { read: ViewContainerRef }) containers: QueryList < ViewContainerRef > ;\r\n\r\n ngAfterViewInit() {\r\n if (this.containers.length > 0) {\r\n // The container already exists\r\n this.addComponent();\r\n };\r\n\r\n this.containers.changes.subscribe(() = > {\r\n // The container has been added to the DOM\r\n this.addComponent();\r\n });\r\n }\r\n\r\n private addComponent() {\r\n const container = this.containers.first;\r\n const factory = this.resolver.resolveComponentFactory(ChildComponent);\r\n container.createComponent(factory);\r\n }\r\n\r\nSee [this stackblitz][1] for a demo.\r\n\r\n\r\n [1]: _URL_0_", "454" ], [ "You can bind the `disabled` property of the text input to the checkbox state with the help of a [template reference variable][1]. In order for the binding to work, the `ngModel` directive should also be applied to the checkbox.\r\n\r\n < ng-container *ngIf= \" ;showRowTextBox \" ; > \r\n < td > \r\n < input type= \" ;text \" ; [disabled]= \" ;!chkEnable.checked \" ; ... / > \r\n < /td > \r\n < td > \r\n < input #chkEnable ngModel type= \" ;checkbox \" ; / > \r\n < /td > \r\n < /ng-container > \r\n\r\nSee [this stackblitz][2] for a demo.\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "894" ], [ "Since the `chkAll` variable is defined in a separate template (created by the `ngFor` loop of the header), it is not available in the markup of the table body.\r\n\r\nYou can call a component method when the header checkbox value changes, to perform the check/uncheck of the checkboxes in the rows:\r\n\r\n < table > \r\n < thead > \r\n < th *ngFor= \" ;let column of columnNames \" ; > \r\n < ng-container *ngIf= \" ;column === &#39;Column6&#39;; else normalColumns \" ; > \r\n {{column}} < input type= \" ;checkbox \" ; ngModel (ngModelChange)= \" ;checkAllBoxes($event) \" ; / > \r\n < /ng-container > \r\n ...\r\n < /th > \r\n < /thead > \r\n < tbody > \r\n < tr > \r\n < td *ngFor= \" ;let model of columnValues \" ; > \r\n < ng-container *ngIf= \" ;model === &#39;Value6&#39;; else normal \" ; > \r\n {{model}} < input type= \" ;checkbox \" ; #chkBox / > \r\n < /ng-container > \r\n ...\r\n < /td > \r\n < /tr > \r\n < /tbody > \r\n < /table > \r\n\r\nThe `checkAllBoxes` method uses the `QueryList` provided by `ViewChildren` to access the checkboxes:\r\n\r\n @ViewChildren( \" ;chkBox \" ;) private chkBoxes: QueryList < ElementRef > ;\r\n\r\n checkAllBoxes(value: boolean) {\r\n this.chkBoxes.forEach(chk = > {\r\n chk.nativeElement.checked = value;\r\n });\r\n }\r\n\r\nSee [this stackblitz][1] for a demo.\r\n\r\n\r\n [1]: _URL_0_", "254" ], [ "It should work if you delay slightly the call to `focus()`. You can avoid using `getElementById(id)` with the help of a template reference variable `txt` associated to the `textarea` element and passed as a parameter to the click event handler:\r\n\r\n < textarea #txt class= \" ;x \" ;\r\n [disabled]= \" ;!data & & !editable \" ;\r\n [readOnly]= \" ;!editable \" ;\r\n [(ngModel)]= \" ;data \" ;\r\n placeholder= \" ;sample input \" ; > < /textarea > \r\n\r\n < button (click)= \" ;editable = true; focusOnText(txt) \" ; > Edit text < /button > \r\n\r\nIn the code, use `setTimeout()` to delay the call to `focus()`.\r\n\r\n focusOnText(txt: HTMLTextAreaElement) {\r\n setTimeout(() = > {\r\n txt.focus();\r\n });\r\n }\r\n\r\nIf needed, you can set a delay. The example above doesn&#39;t specify any delay, but the call is asynchronous nonetheless.\r\n\r\nSee [this stackblitz][1] for a demo.\r\n\r\n\r\n [1]: _URL_0_", "263" ], [ "You can call `console.log` inside of the \" ;success \" ; callback:\r\n\r\n this.dataService.getData().subscribe(data = > {\r\n this.localData = data; \r\n console.log(this.localData);\r\n });\r\n\r\nIf you want to do it in the \" ;complete \" ; callback (assuming that the Observable does complete):\r\n\r\n this.dataService.getData().subscribe(\r\n data = > { this.localData = data; },\r\n error = > {},\r\n () = > { console.log(this.localData); });", "769" ], [ "What you can do:\r\n\r\n 1. When the element is focused, save the current value\r\n 2. When the element loses focus, compare the current value to the saved\r\n value\r\n 3. Do the processing if the value has changed\r\n\r\n < !-- -- > \r\n\r\n < input (focus)= \" ;saveValue() \" ; (blur)= \" ;processChange() \" ; [(ngModel)]= \" ;someValue \" ; ... / > \r\n\r\n < !-- -- > \r\n\r\n someValue = \" ;nice \" ;;\r\n prevValue = this.someValue;\r\n \r\n saveValue() {\r\n this.prevValue = this.someValue;\r\n }\r\n \r\n processChange() {\r\n if (this.someValue !== this.prevValue) {\r\n console.log( \" ;The value has changed!!! \" ;);\r\n // Do some additional processing...\r\n }\r\n }\r\n\r\nSee [this stackblitz][1] for a demo.\r\n\r\n < hr/ > \r\n\r\nIf you don&#39;t want to change the component code, save the value in an attribute of the element:\r\n\r\n < input #txt type= \" ;text \" ; name= \" ;field \" ; \r\n (focus)= \" ;txt.setAttribute(&#39;data-value&#39;, someValue) \" ; \r\n (blur)= \" ;txt.getAttribute(&#39;data-value&#39;) !== someValue ? processChange() : &#39;&#39; \" ; \r\n [(ngModel)]= \" ;someValue \" ; / > \r\n\r\nSee [this stackblitz][2] for a demo.\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "970" ], [ "In order for the input element to be considered in the form validation, you should remove the `standalone` option and give a `name` attribute to the element:\r\n\r\n < input type= \" ;text \" ; name= \" ;nameInput \" ; [(ngModel)]= \" ;_URL_2_ \" ; #name= \" ;ngModel \" ; required ... > \r\n\r\nSee [this stackblitz][1] for a demo.\r\n\r\n < hr/ > \r\n\r\nHere is a description of the `standalone` option given in the [Angular documentation][2]:\r\n\r\n > standalone: Defaults to false. If this is set to true, the ngModel\r\n > will not register itself with its parent form, and will act as if it&#39;s\r\n > not in the form.\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "560" ], [ "The value may be reset too quickly, when Angular has not completed the change detection cycle triggered by the click. It works if we reset the value asynchronously with `setTimeout` (see [this stackblitz][1]):\r\n\r\n handleData(data: TestData) {\r\n console.log(data.isActive);\r\n setTimeout(() = > {\r\n data.isActive = false;\r\n });\r\n }\r\n\r\nor if we call `ChangeDetectofRef.detectChanges()` before resetting the value (see [this stackblitz][2]):\r\n\r\n handleData(data: TestData) {\r\n console.log(data.isActive);\r\n this.changeDetectorRef.detectChanges();\r\n data.isActive = false;\r\n }\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "970" ], [ "The `ngFor` loop is on the `div` elements. Since these are block elements, you end up with a vertical stack of `div` containers, each one containing a button.\r\n\r\nTo get one block with all the buttons inside, put the `ngFor` loop on the `button` element:\r\n\r\n < div class= \" ;groups \" ; > \r\n < h3 > Groups: < /h3 > \r\n < div class= \" ;group \" ; > \r\n < button *ngFor= \" ;let group of groups; let i = index \" ; (click)= \" ;changeGroup(i) \" ; > {{group}}{{i}} < /button > \r\n < /div > \r\n < /div >", "604" ], [ "If you check in the development tools (F12 tools), you will see that the new input control actually gets the `autofocus` attribute, but it does not get the focus. That is because `autofocus` sets the focus on an element [when the page loads][1]. In your case, the page is already loaded when the new element becomes visible.\r\n\r\nWhat you can do instead is to set the focus programmatically on the new input element. In order to do that, you can define a common template reference variable for the two input elements having an `ngIf` condition:\r\n\r\n < input #inputElement *ngIf= \" ;selection === 1 \" ;\r\n [(ngModel)]= \" ;myForm.secondInpElem \" ;\r\n name= \" ;secondInpElem \" ;\r\n placeholder= \" ;secondInpElem \" ; > \r\n\r\n < input #inputElement *ngIf= \" ;selection === 2 \" ;\r\n [(ngModel)]= \" ;myForm.thirdInpElem \" ;\r\n name= \" ;thirdInpElem \" ;\r\n placeholder= \" ;thirdInpElem \" ; > \r\n\r\nand monitor the presence of these elements with `ViewChildren` and the `QueryList.changes` event. Each time one of the input element becomes visible, you set the focus on it:\r\n\r\n @ViewChildren( \" ;inputElement \" ;) inputElements: QueryList < ElementRef > ;\r\n \r\n ngAfterViewInit() {\r\n this.inputElements.changes.subscribe(() = > {\r\n this.inputElements.last.nativeElement.focus();\r\n });\r\n }\r\n\r\nSee [this stackblitz][2] for a demo.\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "285" ], [ "You can define two getter/setter properties, one for each part of the timestamp variable:\r\n\r\n private timestamp: string;\r\n \r\n public get datePart(): string {\r\n // Extract the date part of this.timestamp\r\n return ...\r\n }\r\n public set datePart(value: string) {\r\n // Set the date part of this.timestamp\r\n ...\r\n }\r\n \r\n public get timePart(): string {\r\n // Extract the time part of this.timestamp\r\n return ... \r\n }\r\n public set timePart(value: string) {\r\n // Set the time part of this.timestamp\r\n ...\r\n }\r\n\r\nIn the template, you can then bind each property to an HTML element:\r\n\r\n < input type= \" ;text \" ; name= \" ;date \" ; [(ngModel)]= \" ;datePart \" ; / > \r\n \r\n < select name= \" ;time \" ; [(ngModel)]= \" ;timePart \" ; > \r\n ...\r\n < /select > \r\n\r\nSee [this stackblitz][1] for a demo. Please note that a simpler alternative would be to have two distinct variables, `date` and `time`, each one bound to an element, and to define a `timestamp` getter property to combine the two parts.\r\n\r\n\r\n [1]: _URL_0_", "49" ], [ "You can use an `ngIf ... else` directive to select which parent element is displayed in the view. To avoid repeating the markup for the list items, put them in an `ng-template` and insert that template in the parent with an `ngTemplateOutlet` directive.\r\n\r\n < ul *ngIf= \" ;condition else dropdown \" ; class= \" ;custom-breadcrumb nav nav-fill \" ; > \r\n < ng-container *ngTemplateOutlet= \" ;listItems \" ; > < /ng-container > \r\n < /ul > \r\n < ng-template #dropdown > \r\n < ul *dropdownMenu class= \" ;dropdown-menu \" ; > \r\n < ng-container *ngTemplateOutlet= \" ;listItems \" ; > < /ng-container > \r\n < /ul > \r\n < /ng-template > \r\n < ng-template #listItems > \r\n < li > Item 1 < /li > \r\n < li > Item 2 < /li > \r\n < li > Item 3 < /li > \r\n < li > Item 4 < /li > \r\n < li > Item 5 < /li > \r\n < /ng-template > \r\n\r\nSee [this stackblitz][1] for a demo.\r\n\r\n\r\n [1]: _URL_0_", "318" ], [ "You can allow/prevent navigating to a route with a `canActivate` route guard, and you can allow/prevent navigating away from a route with a `canDeactivate` route guard (see [the Angular documentation][1]).\r\n\r\nIf you want to prevent a user from going back to a page that has already been visited, use a `canActivate` route guard. In [this stackblitz][2], a confirmation is asked before going back to the `Login` page. As a bonus, it also contains an example of a `canDeactivate` route guard for the `Home` route.\r\n\r\nHere is the code for the `canActivate` route guard of the `Login` route:\r\n\r\n**activate-guard.ts**\r\n\r\n import { Injectable } from \" ;@angular/core \" ;;\r\n import { CanActivate, CanDeactivate, ActivatedRouteSnapshot, RouterStateSnapshot } from \" ;@angular/router \" ;;\r\n import { Observable } from \" ;rxjs \" ;;\r\n import { LoginActivateService } from \" ;./login-activate.service \" ;;\r\n \r\n @Injectable()\r\n export class ActivateGuard implements CanActivate {\r\n \r\n constructor(private loginActivate: LoginActivateService) { }\r\n \r\n canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable < boolean > | Promise < boolean > | boolean {\r\n return this.loginActivate.canActivateLogin || confirm( \" ;Do you really want to go back to login? \" ;);\r\n }\r\n \r\n }\r\n\r\n**app-routing.module.ts**\r\n \r\n ...\r\n imports: [\r\n RouterModule.forRoot([\r\n {\r\n path: &#39;login&#39;, component: LoginViewComponent,\r\n canActivate: [ActivateGuard]\r\n },\r\n {\r\n path: &#39;home&#39;,\r\n component: HomeViewComponent,\r\n canDeactivate: [DeactivateGuard]\r\n },\r\n ...\r\n ])\r\n ],\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "357" ], [ "You can use route guards to prevent navigation from a route (`canDeactivate`) or to a route (`canActivate`), but I don&#39;t think they can distinguish between using the back button and other navigation means. If, after leaving a page, you don&#39;t want the user to go back to that page (with or without the back button), it can be done with a `canActivate` route guard.", "357" ], [ "Instead of binding `_URL_1_`, you can bind `categoryModel`. To make it work, set the option values to `category` and make sure that the radio buttons have the same `name`.\r\n\r\n < div class= \" ;btn-group \" ; > \r\n < div *ngFor= \" ;let category of categories \" ; class= \" ;btn btn-outline-secondary \" ; > \r\n < input\r\n type= \" ;radio \" ;\r\n name= \" ;category \" ;\r\n [value]= \" ;category \" ;\r\n [(ngModel)]= \" ;categoryModel \" ; > \r\n {{_URL_0_}}\r\n < /div > \r\n < /div > \r\n\r\nSee [this stackblitz][1] for a demo.\r\n\r\n\r\n [1]: _URL_2_", "302" ], [ "To use `ng-bootstrap` components and directives in Angular templates, you need to import the `NgbModule`. In your case, you should import it in the `SharedModule`. Also, in order to use the shared components in other parts of the application, you should export them from the `SharedModule` and import the `SharedModule` in the modules when the components are to be used.\r\n\r\n**shared.module.ts**\r\n\r\n ...\r\n import { NgbModule } from &#39;@ng-bootstrap/ng-bootstrap&#39;;\r\n\r\n @NgModule({\r\n imports: [\r\n CommonModule,\r\n NgbModule\r\n ],\r\n declarations: [\r\n NavbarComponent,\r\n FooterComponent,\r\n TermsComponent,\r\n PageNotFoundComponent,\r\n PrivacyPolicyComponent\r\n ],\r\n exports: [\r\n NavbarComponent,\r\n FooterComponent,\r\n TermsComponent,\r\n PageNotFoundComponent,\r\n PrivacyPolicyComponent\r\n ]\r\n })\r\n export class SharedModule { }\r\n\r\n**app.module.ts**\r\n\r\n import { SharedModule } from &#39;./shared/shared.module&#39;;\r\n ...\r\n \r\n @NgModule({\r\n imports: [\r\n SharedModule,\r\n ...\r\n ],\r\n ...\r\n })\r\n\r\nNote: if you want to use `ng-bootstrap` components and directives in templates outside of the `SharedModule`, you should add `NgbModule` to the `exports` of the `SharedModule`.", "7" ], [ "In order to bind a style property to a CSS variable in the HTML template, the CSS variable expression `var(...)` must be sanitized. You can define a custom pipe:\r\n\r\n import { Pipe, PipeTransform } from &#39;@angular/core&#39;;\r\n import { DomSanitizer, SafeStyle } from &#39;@angular/platform-browser&#39;;\r\n \r\n @Pipe({\r\n name: &#39;safeStyle&#39;\r\n })\r\n export class SafeStylePipe implements PipeTransform {\r\n \r\n constructor(private sanitizer: DomSanitizer) { }\r\n \r\n transform(value: string): SafeStyle {\r\n return this.sanitizer.bypassSecurityTrustStyle(value);\r\n }\r\n }\r\n\r\nand use it in the HTML template:\r\n\r\n < div [style.background-color]= \" ;&#39;var(--some-css-var)&#39; | safeStyle \" ; > < /div > \r\n < div [style.background-color]= \" ;bkColor | safeStyle \" ; > < /div > \r\n\r\n < !-- -- > \r\n\r\n bkColor = \" ;var(--some-css-var) \" ;;\r\n\r\nSee [this stackblitz][1] for a demo.\r\n\r\n\r\n [1]: _URL_0_", "811" ], [ "Your question was about setting the color with a CSS variable. The only way to make it work is to sanitize the value (with a pipe or in code). Other answers give alternatives to avoid setting the color with a CSS variable. You can obviously set the color in several ways but I tried to answer the question as it was asked, assuming that you had reasons to use CSS variables.", "574" ], [ "You put code in a lifecycle hook if you want it to be executed when an event occurs in the life of an Angular component or at various stages of the change detection cycle. The principle is somewhat similar to handling DOM events. The decision is based on **when** you want to execute the code, rather than **what** kind of code will be executed.\r\n\r\nThe complete list of lifecycle hooks is given in [the Angular documentation][1]. Here are a few examples:\r\n\r\n - ngOnInit() - When the component is initialized \r\n - ngAfterViewInit() - When the component view is initialized \r\n - ngOnDestroy() - When the component is about to be destroyed \r\n - ngOnChanges() - When data bound input properties are changed \r\n - etc.\r\n\r\nIn other cases, like DOM events, Observables, or Promises, you should execute the code in the callback to these events instead of trying to run it in a lifecycle hook.\r\n\r\n [1]: _URL_0_", "586" ], [ "To get the mouse position relative to the outer `div`, subtract the client position of the outer `div` from the client position of the mouse. A template reference variable `outerDiv` can be used to pass the outer element to the event handler.\r\n\r\n < div #outerDiv (mousemove)= \" ;onMouseMove($event, outerDiv) \" ; > \r\n < div class= \" ;innerDiv \" ; > \r\n < /div > \r\n < /div > \r\n\r\nIn the event handler, the client mouse position is obtained with `event.clientX` and `event.clientY`, and the outer `div` client position is obtained with `outerDiv.getBoundingClientRect()`.\r\n\r\n onMouseMove(event: MouseEvent, outerDiv: HTMLElement) {\r\n const bounds = outerDiv.getBoundingClientRect();\r\n const posX = event.clientX - bounds.left;\r\n const posY = event.clientY - bounds.top;\r\n console.log(posX, posY);\r\n }\r\n\r\nSee [this stackblitz][1] for a demo.\r\n\r\n\r\n [1]: _URL_0_", "940" ] ]
280
[ 16244, 10566, 5640, 8751, 10124, 8251, 4564, 3586, 16313, 7082, 13448, 13891, 7880, 9359, 14324, 3096, 1573, 12270, 19713, 18738, 16144, 3024, 7043, 1641, 2169, 2244, 778, 9562, 10586, 5799, 4613, 11178, 8895, 2134, 10856, 1396, 14895, 5198, 12658, 14721, 5146, 16580, 6502, 8689, 17208, 15483, 18655, 9220, 12574, 4621, 6623, 12760, 16849, 298, 12719, 18757, 6232, 5138, 4675, 6689, 3814, 4074, 15105, 8068, 498, 6347, 6027, 3588, 3269, 4990, 3080, 14798, 2460, 2763, 16294, 1808, 3914, 15416, 17503, 967, 3813, 8897, 13338, 12710, 2069, 6999, 1130, 7392, 9305, 7686, 16853, 5867, 5681, 10925, 13701, 8671, 964, 12312, 15309, 3147, 12812, 15357, 10834, 12552, 6453, 4871, 6706, 10341, 8383, 14791, 18724, 15974, 3194, 5823, 6984, 9039, 7551, 5331, 17723, 1638, 805, 4384, 11407, 17302, 2557, 18240, 2488, 8958, 3129, 18962, 8973, 10301, 7558, 11611, 15319, 8686, 19215, 13409, 1027, 3941, 6941, 7916, 1649, 7521, 4776, 9660, 15109, 10262, 13377, 4969, 4581, 7140, 4412, 13687, 18306, 10123, 7361, 11933, 2554, 3748, 969, 11729, 7879, 18425, 11201, 18492, 6545, 12097, 19678, 1369, 6494, 3497, 4891, 460, 13215, 8898, 4039, 19463, 17941, 13668, 13923, 978, 13466, 10089, 11735, 9112, 1703, 15303, 19341, 14211, 9040, 241, 11450, 6168, 12687, 18786, 6878, 675, 577, 13655, 10672, 9571, 19254, 17937, 18444, 17574, 13910, 18678, 12804, 16092, 13614, 9065, 18645, 15746, 8336, 8409, 5713, 18854, 12457, 275, 16726, 1770, 903, 4586, 15066, 13811, 2696, 17748, 17426, 1403, 3768, 5250, 12175, 13922, 5389, 7766, 17240, 17725, 6646, 2035, 5203, 5896, 4113, 8233, 10959, 9165, 3125, 5165, 19018, 248, 7927, 10103, 6866, 16895, 6019, 16411, 11481, 12496, 10216, 4296, 5053, 16286, 2001, 12856, 9558, 10160, 17216, 16182, 10359, 2697, 6642, 15471, 11590, 104, 14088, 8405, 9960, 9267, 9253, 14216, 4801, 3335, 8763, 1740, 17516, 2510, 3253, 486, 9122, 19253, 10687, 12184, 12387, 12578, 11900, 8079, 7415, 15279, 747, 5526, 17338, 2121, 8783, 15031, 6258, 3550, 11018, 19110, 12386, 4772, 16681, 4589, 143, 822, 6609, 4305, 1074, 1555, 19649, 660, 16948, 19306, 15964, 9899, 16058, 246, 4135, 4495, 11033, 7664, 12637, 3660, 4551, 18239, 9904, 15464, 387, 12859, 12851, 9227, 5759, 780, 17616, 15717, 4939, 19746, 11564, 17538, 5735, 8606, 4093, 17510, 10715, 10497, 13337, 10032, 5825, 14878, 19051, 12271, 4688, 1406, 791, 11553, 10243, 15281, 19231, 17595, 19291, 15334, 8050, 14290, 19528, 9992, 1771, 1933, 12609, 8635, 12888, 912, 1423, 7182, 14141, 10463, 15008, 11214, 14385, 18565, 5874, 14465, 598, 3955, 2703, 17375, 10344, 7518, 1892, 5485, 14574, 9194, 19721, 8483, 6422, 8676, 6492, 11504, 6636, 2426, 5715, 16822, 9771, 2238, 15092, 4660, 1054, 7279, 2669, 982, 9988, 5756, 4288, 4151, 17288, 2004, 2431, 7256, 1331, 15389, 4377, 16668, 1500, 9414, 156, 14580, 17188, 12180, 15181, 403, 5107, 8032, 5789, 895, 4097, 19372, 942, 2498, 18544, 14524, 13078, 19718, 8741, 13576, 14263, 2634, 395, 5692, 10548, 471, 6991, 13887, 4727, 2563, 729, 14054, 4295, 10922, 12114, 250, 4764, 4225, 18096, 3663, 16022, 10211, 2788, 4833, 1188, 13911, 14052, 5654, 17743, 9692, 3317, 16658, 13318, 12139, 13234, 2092, 16447, 9917, 5487, 6303, 16844, 820, 4759, 4721, 13510, 12396, 4838 ]
STX_10099225.0
[ [ "$printArr = recursive($newArray); //calls recursive function\r\n $data = [];\r\n var_dump($data);\r\n var_dump($printArr);\r\n function recursive($array, $level = 0)\r\n {\r\n $searchingValue = &#39;tableName&#39;;\r\n foreach($array as $key = > $value)\r\n {\r\n //If $value is an array.\r\n if(is_array($value))\r\n {\r\n recursive($value, $level + 1);\r\n } \r\n else\r\n {\r\n //It is not an array, so print it out.\r\n if($key == $searchingValue)\r\n {\r\n echo \" ;[ \" ;.$key . \" ;] = > \" ; . $value, &#39; < br > &#39;;\r\n $data[] = $value;\r\n }\r\n }\r\n }\r\n }\r\n\r\nSo I have this function and I am trying to save $value value into $data[] array. But it always returns it empty and I don&#39;t know why I can&#39;t get $value saved outside the function.\r\nIf i echo $value I get what i need but like I&#39;ve mentioned the variables doesn&#39;t get saved in this case - table names.", "142" ], [ "Hello so I have many to many relation between Question [table name: **tblquestion**, id: **que_id**] and Agecategory [table name: **tblagecategory**, id: **aca_id**]. They have shared table named QuestionAgecategory [table name: **tblquestionagecategory**, id: **qac_id**]. \r\n\r\n*I want to note that all the IDS and table names are custom named and not according to typical Laravel syntax.*\r\n\r\nAnd I am trying to relate them in Laravel. So far it returns null when I try to look $question- > agecategories;\r\n\r\n > > > $question- > agecategories;\r\n= > null\r\n\r\nBut it has records in it and returns this after $question = App\\Question<IP_ADDRESS>find(1);\r\n\r\n > > > $question = App\\Question<IP_ADDRESS>find(1);\r\n= > App\\Question {#2901\r\n que_id: 1,\r\n que_name: \" ;hello \" ;,\r\n\r\n## Question model ##\r\n\r\n < !-- language: php -- > \r\n\r\n class Question extends Model\r\n {\r\n protected $table = &#39;tblquestion&#39;;\r\n protected $primaryKey = &#39;que_id&#39;;\r\n protected $keyType = &#39;integer&#39;; \r\n public $incrementing = true;\r\n public $timestamps = false;\r\n \r\n public function agecategories() \r\n {\r\n return $this- > belongsToMany(&#39;App\\Agecategory&#39;);\r\n }\r\n }\r\n\r\nAgecategory model\r\n-----------------\r\n\r\n < !-- language: php -- > \r\n\r\n class Agecategory extends Model\r\n {\r\n protected $table = &#39;tblagecategory&#39;;\r\n protected $primaryKey = &#39;aca_id&#39;;\r\n protected $keyType = &#39;integer&#39;; \r\n public $incrementing = true;\r\n \r\n public function questions() \r\n {\r\n return $this- > belongsToMany(&#39;App\\Question&#39;);\r\n }\r\n }\r\n\r\nQuestionAgecategory model\r\n----------\r\n\r\n < !-- language: php -- > \r\n\r\n class QuestionAgecategory extends Model\r\n {\r\n protected $table = &#39;tblquestionagecategory&#39;;\r\n protected $primaryKey = &#39;qac_id&#39;;\r\n protected $keyType = &#39;integer&#39;; \r\n \tpublic $incrementing = true;\r\n }\r\n\r\nMigrations\r\n----------\r\n\r\n < !-- language: php -- > \r\n\r\n Schema<IP_ADDRESS>create(&#39;tblquestion&#39;, function (Blueprint $table) {\r\n $table- > increments(&#39;que_id&#39;);\r\n $table- > string(&#39;que_name&#39;, 128);\r\n });\r\n \r\n \r\n Schema<IP_ADDRESS>create(&#39;tblagecategory&#39;, function (Blueprint $table) {\r\n $table- > increments(&#39;aca_id&#39;);\r\n $table- > timestamps();\r\n });\r\n \r\n Schema<IP_ADDRESS>create(&#39;tblquestionagecategory&#39;, function (Blueprint $table) {\r\n $table- > increments(&#39;qac_id&#39;);\r\n $table- > integer(&#39;qac_que_id&#39;)- > unsigned();\r\n $table- > integer(&#39;qac_aca_id&#39;)- > unsigned();\r\n $table- > foreign(&#39;qac_que_id&#39;)- > references(&#39;que_id&#39;)- > on(&#39;tblquestion&#39;);\r\n $table- > foreign(&#39;qac_aca_id&#39;)- > references(&#39;aca_id&#39;)- > on(&#39;tblagecategory&#39;);\r\n });", "452" ], [ "Yeah I know. And I really can&#39;t do much about it because I am getting these table names and all the details from the yaml file so that&#39;s why the table names are not usual to Laravel syntax.\n\nAlso I messed a bit with the ID&#39;s (first I tried your solution and then I tried adding ID from the Questions table and connect it with the ID in the tblquestionagecategory&#39;s ID\n\n `public function questions() \n {\n return $this- > belongsToMany(&#39;App\\Question&#39;, &#39;tblquestionagecategory&#39;, &#39;aca_id&#39;, &#39;qac_aca_id&#39;);\n }`\n\nBut that also didn&#39;t work.", "280" ], [ "Hey I have been reading some PHP class documentation and how to create classes. But I haven&#39;t seen any examples of properties inside the properties. I will give an example what I want to do:\r\n\r\n class Properties {\r\n public property1;\r\n public nestedProperty1;\r\n public nestedProperty2;\r\n }\r\n\r\nand I want to assign properties like this:\r\n\r\n $Property = new Properties();\r\n $Property- > property1 = \" ;foo \" ;;\r\n $property1- > nestedProperty1 = \" ;bar \" ;;\r\n\r\nSo I could access data like:\r\n\r\n $property1- > nestedProperty1;\r\n\r\nIs this possible? I need this because I&#39;m working with a dynamic multidimentional array.", "118" ], [ "In a **model** I have created custom timestamps:\r\n\r\n const CREATED_AT = &#39;fil_ts&#39;;\r\n const UPDATED_AT = &#39;fil_ts&#39;;\r\n\r\nBasically the idea is that **CREATED_AT** timestamp will get updated whenever record is changed (***in other words: I would have just one timestamp which acts as created and updated timestamp***). \r\n\r\n*How do I make these custom timestamps appear in the database&#39;s table trough migrations? Do I need to create them in the migration file when I create the table?*\r\n\r\n\r\n----------\r\n\r\n\r\n**1. Do i need to define custom timestamps in migration like this**\r\n\r\n $table- > timestamp(&#39;fil_ts&#39;);\r\n $table- > timestamp(&#39;fil_ts&#39;);\r\n\r\n**2. or like this** \r\n\r\n $table- > timestamps();\r\n\r\nSo far neither of these methods worked. With the first method I get an error that I can&#39;t have same named variables (which is logical, but I don&#39;t know other way how to make SINGLE timestamp act as CREATED_AT and UPDATED_AT).\r\n\r\nIf I use the second method it just creates default timestamps.\r\n\r\n**My end goal**: a single custom timestamp that acts like created_at and updated_at. First it gets creation timestamp and then it keeps updated.\r\n\r\n\r\n----------\r\n\r\nUpdate\r\n------\r\n\r\nEven if the custom timestamps names are different I still get error when I run php artisan migrate:\r\n\r\n**Timestamps in the model:**\r\n\r\n const CREATED_AT = &#39;file_created&#39;;\r\n const UPDATED_AT = &#39;file_updated&#39;;\r\n \r\n**Timestamps in the migration:**\r\n\r\n $table- > timestamp(&#39;file_created&#39;);\r\n $table- > timestamp(&#39;file_updated&#39;);\r\n\r\n > Doctrine\\DBAL\\Driver\\PDOException<IP_ADDRESS>( \" ;SQLSTATE[42000]: Syntax error or\r\n > access violation: 1067 Invalid default value for &#39;file_updated&#39; \" ;)\r\n\r\nSolution\r\n--------\r\n**Code in the model:**\r\n*Need to disable default timestamps*\r\n\r\n public $timestamps = false; \r\n const CREATED_AT = &#39;fil_ts&#39;;\r\n const UPDATED_AT = &#39;fil_ts&#39;;\r\n\r\n**Code in the migration**\r\n\r\n $table- > timestamp(&#39;fil_ts&#39;);", "154" ], [ "I need this for a php script and this approach won&#39;t work for me. Because I would need to script different cases for string and every integer. That&#39;s why I define them like that `$table- > tinyInteger(&#39;que_id&#39;)- > autoIncrement();` instead of `$table- > tinyIncrements(&#39;que_id&#39;);`\n\n**My parsing data looks like that (YML file):**\n\n`que_id: { type: integer(4), primary: true, autoincrement: true }`", "480" ], [ "So I get this error:\r\n > Illuminate\\Database\\QueryException : SQLSTATE[HY000]: General error:\r\n > 1005 Can&#39;t create table `yamldb`.`#sql-3928_6ea` (errno: 150 \" ;Foreign\r\n > key constraint is incorrectly formed \" ;) (SQL: alter table `tblquestion`\r\n > add constraint `tblquestion_que_csd_id_foreign` foreign key\r\n > (`que_csd_id`) references `tblcsdomain` (`csd_id`))\r\n\r\nTable 1\r\n-------\r\n\r\n Schema<IP_ADDRESS>create(&#39;tblquestion&#39;, function (Blueprint $table) {\r\n \t$table- > increments(&#39;que_id&#39;);\r\n \t$table- > string(&#39;que_name&#39;, 128);\r\n \t$table- > string(&#39;que_identifier&#39;, 128);\r\n \t$table- > string(&#39;que_version&#39;, 50);\r\n \t$table- > char(&#39;que_content&#39;);\r\n \t$table- > char(&#39;que_answers&#39;);\r\n \t$table- > integer(&#39;que_grd_id&#39;)- > unsigned();\r\n \t$table- > integer(&#39;que_quf_id&#39;)- > unsigned();\r\n \t$table- > integer(&#39;que_lan_id&#39;)- > unsigned();\r\n \t$table- > boolean(&#39;que_mandatory&#39;, false);\r\n \t$table- > char(&#39;que_thisisinformatics&#39;);\r\n \t$table- > char(&#39;que_translations&#39;);\r\n \t$table- > char(&#39;que_explanation&#39;);\r\n \t$table- > char(&#39;que_background_info&#39;);\r\n \t$table- > integer(&#39;que_cou_id&#39;)- > unsigned();\r\n \t$table- > boolean(&#39;que_allow_share&#39;, false);\r\n \t$table- > integer(&#39;que_source_cou_id&#39;)- > unsigned();\r\n \t$table- > integer(&#39;que_source_que_id&#39;);\r\n \t$table- > mediumInteger(&#39;que_csd_id&#39;)- > unsigned();\r\n \t$table- > string(&#39;que_token&#39;, 32);\t\r\n });\r\n\r\n**Table 2**\r\n\r\n Schema<IP_ADDRESS>create(&#39;tblcsdomain&#39;, function (Blueprint $table) {\r\n $table- > increments(&#39;csd_id&#39;);\r\n \t$table- > string(&#39;csd_name&#39;, 128);\r\n \t$table- > string(&#39;csd_token&#39;, 128);\r\n });\r\n\r\nMigration\r\n---------\r\n\r\n \r\n\r\n Schema<IP_ADDRESS>table(&#39;tblquestion&#39;, function (Blueprint $table) {\r\n \t$table- > foreign(&#39;que_csd_id&#39;)- > references(&#39;csd_id&#39;)- > on(&#39;tblcsdomain&#39;);\r\n }\r\n\r\n\r\n\t\t\t\r\nAlso I am trying to add FK to already existing columns. And Laravel adds the FK but on rollback it doesn&#39;t remove them.\r\n\r\n Schema<IP_ADDRESS>table(&#39;tblquestion&#39;, function (Blueprint $table) {\r\n \t$table- > dropForeign([&#39;que_csd_id&#39;]);\r\n }", "1001" ], [ "So I&#39;ve been digging around for a couple days in the broadcasting/streaming grounds and I encountered so many questions, especially with the encoders and decoders.\r\n\r\nI need to find the **cheapest** and best solution for live streaming/ broadcasting. So far I am using OBS as my encoder, but as far as I know it encodes in the RMTP protocol and it uses flash players to stream the broadcast. And I do not want that. I want to use the HTML5 player (like the ones WOWZA, nanoCosmos) uses and I need the latency to be as low as possible. My questions would be:\r\n\r\n 1. Can I use OBS for low latency? Because I have tested out OBS with wowza streaming cloud and the latency was **huge**.\r\n 2. How to get rid of the flash players using OBS? If it is not possible what other cheap/free encoders there are, that would do the job?\r\n 3. What other things I need to think about it? So right now I need a proper encoder, CDN and a player (but if I am using one of the commercial players, usually they provide their Cloud CDN).\r\n\r\n\r\nEDIT:\r\n----\r\nSince it should be an auction house live streaming I need the latency to be as low as possible.\r\n\r\n - The latency I need to achieve is no more then 2s. \r\n - Audience: up to 500\r\n people.", "361" ], [ "I edited my post, but here&#39;s more details: Since it should be an auction house live streaming I need the latency to be as low as possible.\nThe latency I need to achieve is no more then 2s.\nAudience: up to 500 people. So far I also tested out nanoCosmos services but they are really pricey but so far the best I tried. So maybe someone who has more experience in this field and knowledge can advice me if there&#39;s other options.", "966" ], [ "I know all about the streaming protocols and what they are good for. But what confuses me is the protocols the video stream is encoded. Because the encoders use usually RTMP or RTSP protocols and then it is up to the service provider or decoder how the video/stream is delivered (in which protocol: HLS, WebRTC, HDS, MPED-DASH etc). \r\n\r\nSo it might be a silly question but is there a way to change the encoding protocols from RTMP or RTSP? When I record a video/live-stream with a software. Right now I am using OBS. And my main goal is findign a solution how to stream one-to-many with as low latency as possible ( > 2s).\r\n\r\n\r\n----------\r\nAlso as far as I know the difference between RTSP and RTMP is one uses iOs and the other Windows OS.", "79" ], [ "I am trying to add via script primary keys and I have variables which says if it&#39;s primary key and if it is inc. The problem is that I can&#39;t find a way to easily define the primary key that increments. \r\n\r\nWith this migration Laravel only adds primary key, but it isn&#39;t inremented:\r\n\r\n $table- > tinyInteger(&#39;taxable&#39;)- > primary();\r\n\r\nthis only added primary key without incrementation\r\n\r\n----------\r\n\r\n\r\n $table- > tinyInteger(&#39;taxable&#39;)- > primary()- > increments();\r\n\r\nDidn&#39;t add auto-inc.\r\n\r\n\r\n----------\r\n\r\n\r\n \r\n\r\n $table- > tinyInteger(&#39;taxable&#39;, true);\r\n\r\nTried this method which instantly applies primary key and auto-inc, but I want it to be flexible for my script. (I don&#39;t want that it would add primary key and auto-inc both instantly I want to define it myself).\r\n\r\nSo I tried different variations but none of them gave me the result I wanted - to easily define if it is a primary key and if it is auto-incremented.\r\n\r\n $table- > tinyInteger(&#39;taxable&#39;, true, true);\r\n $table- > tinyInteger(&#39;taxable&#39;, false, true);\r\n $table- > tinyInteger(&#39;taxable&#39;, true, false);\r\n $table- > tinyInteger(&#39;taxable&#39;, false, false);\r\n\r\nIt seems that the second false doesn&#39;t do anything at all and I thought the first true - defines if it is primary key and the second true if it is auto-incremented.\r\n\r\n\r\n----------\r\n\r\n\r\nI found the best solution for me (*because I wanted to find an easy way to define primary keys in my script*):\r\n\r\n $table- > tinyInteger(&#39;taxable&#39;)- > autoIncrement(); //Adds primary key and auto-inc\r\n $table- > tinyInteger(&#39;taxable&#39;)- > primary(); //adds just primary key", "480" ], [ "Like I tried to explain that I am writing a script and it would be easier for me to find a way to define primary keys and their auto-inc in a simple way, for example **IF IT WORKED but it doesn&#39;t**:\n\n`$table- > tinyInteger(&#39;taxable&#39;, true, false);`\n\nIt would ease my scripting if I could define primary keys like that. First **true** - defines if it is a primary key and the second - defines if it is auto-inc. I hope I made it clear now.", "467" ], [ "So I have custom primary keys and I am not sure If I need to define the incrementation in both eloquent and migrations? \r\n\r\nEloquent\r\n----------\r\n\r\n\r\n class Question extends Model \r\n {\r\n protected $primaryKey = &#39;que_id&#39;;\r\n protected $keyType = &#39;tinyInteger&#39;; \r\n public $autoincrement = true;\r\n }\r\n\r\nMigration\r\n---------\r\n\r\n public function up()\r\n {\r\n Schema<IP_ADDRESS>create(&#39;questions&#39;, function (Blueprint $table) {\r\n $table- > tinyInteger(&#39;que_id&#39;)- > autoIncrement();\r\n $table- > timestamps();\r\n });\r\n }\r\n\r\nOr it is just enough to define it like this? \r\n\r\n public function up()\r\n {\r\n Schema<IP_ADDRESS>create(&#39;questions&#39;, function (Blueprint $table) {\r\n $table- > tinyInteger(&#39;que_id&#39;)- > primary();\r\n $table- > timestamps();\r\n });\r\n }", "480" ] ]
374
[ 13890, 8615, 5145, 605, 5811, 10525, 12947, 11498, 722, 9634, 10025, 13128, 12016, 214, 15876, 17954, 10867, 5844, 14816, 18177, 16242, 17842, 10372, 6197, 11265, 10050, 2804, 9485, 12969, 13688, 17021, 19207, 8260, 11645, 17943, 17548, 10528, 8420, 10705, 7855, 14969, 11730, 17627, 3763, 5868, 13736, 11022, 11305, 14906, 14074, 12971, 14620, 14106, 19734, 17605, 6325, 5038, 17306, 17150, 11846, 8576, 16655, 6391, 7715, 4587, 2531, 19562, 7792, 15777, 7609, 19368, 9525, 14925, 19722, 3545, 14251, 3123, 18494, 1034, 5158, 17957, 10199, 10207, 7271, 10674, 8848, 17485, 6351, 11840, 11549, 12700, 18815, 1355, 13454, 17172, 15102, 13105, 14042, 16843, 10558, 139, 1575, 15599, 10702, 7289, 15151, 12930, 2013, 15514, 15979, 6255, 15690, 19245, 17675, 2738, 19034, 14650, 1439, 14010, 13323, 8698, 14321, 9748, 17974, 4190, 7970, 6435, 7307, 13535, 4320, 18047, 2216, 4445, 11029, 4968, 12588, 8920, 10952, 5381, 1093, 44, 14938, 3098, 12846, 14862, 9954, 2477, 15978, 17927, 16625, 15517, 7038, 37, 32, 15235, 18790, 9505, 16315, 47, 16202, 91, 8345, 370, 17785, 15797, 11627, 15052, 7774, 17638, 14765, 5288, 12824, 16263, 2466, 7368, 16392, 8447, 13583, 19773, 9208, 9801, 10198, 12958, 17601, 7979, 17690, 10593, 19557, 3016, 8384, 2094, 3868, 17017, 13969, 6895, 16876, 155, 12910, 17225, 18179, 14338, 19294, 17668, 13542, 8880, 16609, 15323, 19666, 14834, 19240, 14282, 12840, 14870, 18104, 6806, 14296, 12661, 11135, 120, 2494, 197, 745, 19629, 10625, 6417, 11264, 6911, 9546, 1591, 14412, 961, 11805, 13900, 11382, 8097, 12593, 18861, 14115, 5304, 12265, 17987, 15507, 4473, 4993, 11726, 9493, 10532, 17157, 14512, 15455, 13993, 10777, 13191, 17233, 15034, 14057, 14311, 13037, 13145, 19100, 726, 17706, 6817, 1567, 12580, 17280, 4671, 14489, 10580, 18753, 6988, 674, 15020, 18616, 13335, 158, 8103, 4923, 7299, 13239, 18087, 6410, 2895, 16797, 13201, 8337, 16255, 13568, 12966, 18795, 12946, 3846, 19000, 6522, 1697, 11664, 7281, 18515, 17873, 5661, 14073, 11714, 17187, 1664, 19694, 18117, 5953, 12732, 14515, 1118, 14256, 2096, 8981, 19244, 11630, 13189, 5009, 11709, 10140, 19673, 19733, 3787, 8339, 12119, 14377, 17718, 3429, 7783, 13478, 16859, 12768, 15828, 13092, 9064, 16076, 7578, 11670, 16019, 10407, 9317, 3969, 9399, 9003, 9158, 17257, 17127, 3285, 11984, 14881, 580, 19644, 14422, 17704, 7701, 7300, 13715, 729, 296, 11149, 6266, 1132, 12880, 10520, 19095, 875, 14034, 6090, 11981, 17175, 13144, 264, 4796, 18682, 10180, 13365, 11667, 15866, 17512, 1456, 6130, 7315, 15341, 10898, 12073, 2015, 1209, 11908, 14499, 13336, 1179, 7839, 17072, 7644, 3754, 17631, 19582, 19575, 11506, 10081, 17916, 11594, 14475, 2350, 15850, 14586, 14181, 12174, 15067, 10706, 11873, 10171, 15116, 11483, 7272, 19688, 9640, 14021, 10590, 15428, 17711, 14745, 9618, 11951, 1451, 18023, 12845, 14733, 14910, 6613, 15429, 14555, 14227, 7184, 196, 13045, 6765, 5224, 8815, 10080, 15265, 12875, 10203, 6516, 11019, 8277, 19221, 7784, 5466, 15836, 19317, 2859, 14747, 9149, 10825, 14509, 5989, 9004, 12714, 289, 12567, 12155, 645, 14195, 11998, 14808, 15311, 15366, 14250, 15297, 6585, 16425, 12483, 9132, 14737, 17763, 14728, 12886, 4725, 10569, 12060, 4606, 1138, 9590, 10181, 11661, 17503, 11199, 2453, 9967, 12740, 10152, 5426, 15081, 1214, 12237, 18426, 9041, 12657, 12089 ]
STX_100999.0
[ [ "No, Boron still bonds to 4 Si atoms. Since Boron has only 3 valence electrons, it can only form three covalent bonds with Si. This leaves one of the four silicon atoms with an unsatisfied bond. To compensate, a nearby electron (from an Si-Si bond) will \" ;jump \" ; to complete the B-Si bond leaving the Si-Si bond with a net positive charge (the hole). To fill that broken bond, another nearby electron will jump to fill in the vacancy etc... Thus the \" ;hole \" ; is highly mobile and can conduct when a voltage is applied. The Boron atom does become negatively charged, but that additional negative charge cannot conduct because it takes place in the bonding.", "748" ], [ "Perhaps you could explain what exactly led you to question your understanding...\r\nThe physical meaning of coordinate invariance is pretty simple. It&#39;s just that the laws of physics cannot depend upon your choice of coordinates as long as the reference frame you&#39;re working in is inertial. So if you were to perform a coordinate transformation from one inertial frame to another, the mathematical form of your equations of motion will not change and are said to be coordinate invariant.", "106" ], [ "With a constant current, the magnetic (dipole) moment is simply\r\n$\\bf{m} = \\it{I}\\bf{a}$ where $\\bf{a}$ is the vector area\r\n$\\bf{a} = \\oint\\bf{r} \\times d\\bf{l}$ where $d\\bf{l}$ is the differential element around the boundary of the area. \r\n\r\nWhere the torque \r\n$\\bf{\\tau} = \\bf{m} \\times \\bf{B} $\r\n\r\nSo for example if the loop is flat like yours above, the direction will be normal to area as per the standard right hand rule. If it is some other shape then the direction will be given by the integral.\r\n\r\nThis is discussed nicely in Griffiths&#39; E/M", "891" ], [ "Remember the direction of the torque vector is always normal to the direction of rotation so if the torque vector is pointed out of the page (like it is in the picture), the loop rotates around it counterclockwise, grab the vector with your thumb in the direction of $\\bf{M}$ the loop rotates in the direction your fingers are curled (counter-clockwise). The dipole moment wants to align with the field so $\\bf{p_m}$ and $B$ are in the same direction.", "892" ], [ "$m \\times \\bf{B}$ is in the direction of $M$. I have a feeling I&#39;m just misunderstanding what you mean. Could you maybe draw a picture of what you think is correct. Maybe it&#39;ll be more clear to me where your confusion is coming from. Also when you say ampere force do you mean Lorentz force? Because the ampere force is the force between two wires, not the force on a wire in a mangetic field.", "891" ], [ "When you use a matrix for cross products, you don&#39;t actually put the i&#39;s, j&#39;s and k&#39;s in the matrix, except for the first line. So the matrix you want to take the determinant of is the same except remove the unit vectors in the second and third rows. Remember the whole matrix thing is simply a mnemonic and not really mathematically rigourous.", "877" ], [ "Yes the electric field remains the same in the presence of the negative charge. Apply gauss&#39; Law inside of the cavity. The enclosed charge is the same therefore the field is the same. In a conductor, charge redistributes itself to kill off any field inside. If you bring a $-q$ charge close to the surface there will be redistribution of charge on the outer surface of the sphere and inner surface of the cavity. However remember that the field at a point inside determined only by the total flux through the appropriate gaussian surface which is determined only by the charge distribution inside. The presence of the conductor completely eliminates the effects of outside charges.", "891" ], [ "1. For a particle-field system the only way to define a gauge invariant energy is to consider the energy carried by the field as well, in the form of the energy momentum tensor $T^{\\mu\\nu}$ in the presence of charges. $T^{\\mu\\nu}$ is a manifestly gauge invariant quantity. To derive this use Noether&#39;s theorem and the maxwell equations in the presence of charges. This gives a conserved energy for the system \r\n\r\n2. So the answer to this would be no, it does not correspond to the total energy as you must also consider the field energy to attain a conserved quantity. Intuitively, if we choose some gauge where $\\phi = 0$, then the change in the energy of particle is compensated for by a change in the energy carried by the fields. Thus resulting in the same total energy for the system.", "779" ], [ "It&#39;s really just index gymnastics. In the second term we have no $\\nu$ index. To get one we insert the metric tensor $\\eta^{\\mu\\nu}$ since we know $A^{\\mu} = \\eta^{\\mu\\nu}A_{\\nu}$. The thing to remember is that the choice of indices is irrelevant as long as they are summed over (i.e. exist in upper-lower pairs) for example we could have just as easily said $A^{\\mu} = \\eta^{\\mu\\alpha}A_{\\alpha}$. The metric tensor gives you the ability to obtain the desired indices in the right place. This is often necessary for instance if you want to define some new tensor quantity from existing ones (see for example, the energy momentum tensor in SR) and need the indices to agree on all sides.\r\n\r\nSo we can get the right indices in the right place with a judicious choice of metric tensor placement.\r\n\r\n$\\frac{1}{2}(\\partial_{\\mu}A^{\\mu})^2 = \\frac{1}{2}(\\partial_{\\mu}\\eta^{\\mu\\nu}A_\\nu)^2 = \\frac{1}{2}(\\eta^{\\mu\\nu}\\partial_{\\mu}A_\\nu)^2$\r\n\r\n$\\eta^{\\mu\\nu}$ is just a matrix of constants so the derivative does not act on it.\r\n\r\nSo if we differentiate the last term we get \r\n$(\\eta^{\\mu\\nu}\\partial_{\\mu}A_\\nu)\\eta^{\\mu\\nu}$\r\n\r\nWe want this to look like the answer but a potential confusion may arise which is whether we should act $\\eta^{\\mu\\nu}$ on $\\partial_{\\mu}$ or $A_\\nu$. In this case since $\\eta^{\\mu\\nu}$ is symmetric, it won&#39;t matter and we will emerge with either \r\n$\\partial^{\\nu}A_{\\nu}$ or $\\partial_{\\mu}A^{\\mu}$. Now remember that the index in both of these expressions is irrelevant so we can simply call it $\\rho$ instead. Further since these are both <PERSON> scalars, the upper-lower choice is irrelevant and we get the desired result.\r\n\r\n\r\nFor the first term lets just expand the derivative so we have:\r\n\r\n$-\\frac{1}{2}(\\partial^{\\mu}A^{\\nu} + \\partial_{\\mu}A_{\\nu}\\frac{\\partial(\\partial^{\\mu}A^{\\nu})}{\\partial(\\partial_{\\mu}A_{\\nu})})$\r\n\r\nNow in the second term in this expression we can just exchange upper and lower indices because they are still being summed over\r\n\r\n$-\\frac{1}{2}(\\partial^{\\mu}A^{\\nu} + \\partial_{\\mu}A_{\\nu}\\frac{\\partial(\\partial^{\\mu}A^{\\nu})}{\\partial(\\partial_{\\mu}A_{\\nu})}) = -\\frac{1}{2}(\\partial^{\\mu}A^{\\nu} + \\partial^{\\mu}A^{\\nu}\\frac{\\partial(\\partial_{\\mu}A_{\\nu})}{\\partial(\\partial_{\\mu}A_{\\nu})}) = -\\partial^{\\mu}A^{\\nu} $\r\n\r\nSorry if this was pedantic but i hope it cleared a few things up.", "344" ], [ "From your code it seems like that you are binding a click event on `$( \" ;.icon \" ;)` when the ajax completes.\r\n \r\nHowever, you are not making another call after completion of first, but instead making a call on `$( \" ;.icon \" ;)`.\r\n\r\nif you dont want to put ajax call here then you can bind icon with on function with parent selector like below:\r\n\r\n`$( \" ;#parentDiv \" ; ).on( \" ;click \" ;, \" ;.icon \" ;, function() {\r\n //make ajax call\r\n});`\r\n\r\nmore info on this [here][1]\r\n\r\nyou can get help for this from \r\nYou should improve your code&#39;s clarity to reflect its purpose.\r\n\r\n\r\n [1]: _URL_0_", "648" ] ]
261
[ 4236, 5050, 18129, 14111, 18592, 4511, 13810, 16721, 380, 18766, 16994, 12219, 13347, 16973, 19752, 2503, 16221, 3703, 83, 7857, 17138, 13065, 3233, 6541, 17858, 2513, 1420, 7012, 18123, 2624, 3002, 16150, 2953, 8431, 16220, 19491, 5166, 5360, 2772, 13746, 6098, 9090, 2776, 8597, 12499, 17057, 11014, 9105, 2266, 3268, 9104, 5498, 3077, 16207, 5195, 10629, 16306, 15881, 10413, 17982, 14193, 17765, 11604, 16922, 3369, 15399, 10349, 12368, 15668, 5923, 3931, 12617, 5296, 6758, 16770, 5910, 4483, 17562, 8836, 7112, 15157, 14978, 17009, 2708, 18957, 3247, 17751, 18909, 7887, 13562, 5532, 17428, 15435, 5851, 828, 6596, 11640, 18717, 3659, 7231, 19558, 16041, 11759, 15660, 18388, 11931, 7432, 9983, 19148, 15423, 18562, 679, 10267, 18657, 4651, 1155, 2930, 8245, 12809, 306, 1467, 19584, 324, 19483, 16329, 11985, 9135, 19190, 7611, 8185, 8775, 14293, 14916, 4175, 5292, 13555, 7745, 3740, 4828, 11439, 15397, 5933, 17963, 18479, 19130, 11157, 4140, 869, 1517, 1939, 3087, 5657, 1687, 7883, 17727, 462, 12070, 2971, 8865, 2100, 5576, 19255, 8491, 6469, 16866, 12129, 3412, 3597, 6457, 9213, 11212, 6466, 15498, 18961, 4215, 6233, 8434, 17525, 6248, 7645, 10398, 5311, 11203, 3800, 2885, 6193, 17094, 3171, 19116, 10887, 339, 18280, 966, 8544, 10154, 18344, 15556, 7575, 6447, 8651, 2341, 9454, 8022, 12898, 7217, 16317, 16533, 6161, 11085, 11842, 19137, 4767, 8258, 6054, 14099, 17221, 18099, 7258, 11893, 11096, 10458, 19141, 16032, 18878, 644, 15583, 15301, 7809, 7308, 16916, 6835, 8710, 13771, 3783, 3467, 6869, 7004, 2903, 8755, 12020, 247, 2647, 16096, 19567, 11845, 16259, 18912, 10948, 11058, 19563, 18345, 4612, 18536, 177, 8494, 8044, 6714, 2823, 2591, 6723, 8360, 12137, 10837, 840, 19236, 4427, 4053, 7898, 11739, 7123, 3420, 4750, 5118, 389, 14937, 2991, 8831, 17628, 7008, 17364, 8954, 6013, 3769, 2323, 173, 18470, 11764, 4827, 15288, 18112, 8441, 367, 17019, 12150, 475, 19060, 18105, 6293, 10116, 5196, 7904, 2369, 15722, 19373, 4080, 2183, 5908, 18540, 4883, 11431, 4959, 373, 4704, 625, 3079, 18715, 10695, 3599, 4938, 8791, 10056, 8386, 6126, 7627, 3035, 10605, 1219, 18868, 14247, 7873, 890, 8335, 6028, 15343, 8667, 13380, 16467, 5605, 19180, 7607, 8246, 8057, 4065, 17494, 19355, 18638, 12355, 17309, 3173, 6943, 10618, 19553, 9042, 3923, 10121, 958, 7482, 15412, 14347, 17643, 6510, 4882, 8120, 6420, 12974, 14979, 14557, 15277, 19249, 379, 3552, 17162, 8816, 13096, 17739, 8823, 1824, 4995, 6369, 4054, 9284, 16507, 3453, 7412, 9936, 5309, 8790, 16116, 16677, 3175, 8361, 5651, 3132, 16357, 17429, 16236, 4085, 8109, 23, 19326, 4509, 4247, 17192, 8514, 9803, 16406, 8769, 15623, 12165, 7356, 10209, 12512, 10806, 2387, 19477, 9740, 10182, 10020, 9594, 7319, 19709, 15934, 19205, 10554, 7591, 4276, 7030, 6563, 7586, 16740, 16402, 5824, 716, 8889, 11838, 1799, 7791, 5344, 4110, 18523, 18799, 19140, 15861, 19646, 721, 16391, 8019, 7113, 6745, 8952, 14944, 2861, 3807, 7491, 9548, 8725, 17445, 11930, 7742, 3157, 11326, 19533, 3729, 7924, 9035, 15430, 17808, 8285, 19380, 3943, 15302, 10142, 5672, 9243, 4282, 17105, 9324, 9885, 11679, 8563, 9082, 11222, 215, 8863, 3693, 240, 13041, 3706, 6368, 5614, 16569, 14865, 19609, 7804, 6562, 16112, 8905, 11620, 10037 ]
STX_101.0
[ [ "It has been widely reported that the constitutional amendments approved by the April 2017 referendum will allow <PERSON> to stay in office until 2029:\r\n\r\n > Turkish President <PERSON> has narrowly won a referendum to expand presidential powers, which could keep him in office until 2029.\r\n\r\n > < sub > [ \" ;Turkey referendum: <PERSON> wins vote to expand presidential powers. \" ;](_URL_0_) BBC News. BBC, 16 Apr. 2017. Web. 18 Apr. 2017. < /sub > \r\n\r\nHowever, apparently the new constitution limits the president to two five-year long terms:\r\n\r\n > The president will have a five-year tenure, for a maximum of two terms.\r\n\r\n<PERSON> is, of course, currently serving his first term. Assuming he wins in 2019, that will be his second and last term. \r\n\r\nHow can he stay in office until 2029 then? Is there an exception in the new constitution that would allow him a third term, or does his current term simply not count?", "634" ], [ "<PERSON> has insisted numerous times that she would not call for an early general election. One of the main reasons she cited for this is that the instability of an election could derail the complex Brexit process.\r\n\r\nYet, yesterday she [announced a plan][1] to call a snap general election, explaining that this would \" ;remove the risk of uncertainty and instability \" ;.\r\n\r\nAs a complete outsider to UK politics, I am confused. Why the dramatic change of heart?\r\n\r\n [1]: _URL_0_", "634" ], [ "First, the comments on my [<PERSON> question][1]:\r\n\r\n[![enter image description here][2]][2]\r\n\r\nJonathanReez&#39;s comment, which I&#39;m assuming is the one you are referring to, is an attempt to answer the question ( \" ;the old terms were under the previous rules so they don&#39;t count \" ;). This is not ok, [comments are _not_ meant for answers][3], and this alone would be reason enough to remove it.\r\n\r\nNevertheless, I only deleted it after Panda posted [their answer][4], which basically says the same thing (but in a much more informative way). After the answer was posted, JonathanReez&#39;s comment was obsolete, therefore I saw no good reason to keep it around. Their characterization of <PERSON>, although a tad annoying, wasn&#39;t a factor in the comment&#39;s removal.\r\n\r\nNow, for the alleged \" ;comments denying the holocaust with links pointing to neo-nazi sites \" ;. I took a quick look at your flagging history and did not find any such comments. In the future, if you spot comments you feel do not belong on the site please let us know by flagging them. We cannot remove comments we don&#39;t know about.\r\n\r\nAs for your recent question, I&#39;m sorry but I simply don&#39;t see how it&#39;s an honest question, presented from a neutral point of view. You don&#39;t just call <PERSON> a dictator, you spend three paragraphs - the majority of the text of your question - to do so. That&#39;s not a question, that&#39;s a blog post at best, a very [loaded rant][5] at worst. The fact that you added a sentence with a question mark at the end does not magically transform your rant to a question. \r\n\r\nI do not see how the question is salvageable, and I agree with Philipp&#39;s decision to delete it. That said, nothing stopping you from editing it if you feel you can tone it down and present it in a (somewhat) neutral point of view. If you do so, please flag it for moderation attention so we can review your edits.\r\n\r\nLastly, using the word \" ;dictator \" ; is not taboo on this site. A [simple search][6] is all it takes to show that we do not remove content simply because it contains the word \" ;dictator \" ;. \r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_5_\r\n [3]: _URL_3_\r\n [4]: _URL_0_\r\n [5]: _URL_4_\r\n [6]: _URL_2_", "792" ], [ "<PERSON> I disagree that your 3 paragraphs \" ;developed the issue \" ;. You very strongly and very one-sidedly presented an controversial opinion, not much development there. Your \" ;question \" ; does not make any sense outside the very narrow limits you&#39;ve set; namely that <PERSON> is a ruthless dictator with absolute power. You are asking us \" ;why he didn&#39;t cheat more \" ;, without first establishing that he actually did cheat in the first place. I don&#39;t see any way to salvage that simply by editing. If you do, please go ahead and edit it.", "402" ], [ "<PERSON> Again: Your question only makes sense if you blindly accept the premise that <PERSON> is a ruthless dictator with absolute power. That is _not_ something everyone agrees on. More importantly, that is not something that can be proven at this time. \" ;why didn&#39;t he cheat \" ; only works if you unquestionably agree that <PERSON> has both the means, the reason _and_ a will to cheat. If you think <PERSON> is a dictator, so be it. And, to be perfectly honest, I don&#39;t necessarily disagree with you. But please realise that this is just an opinion, not exactly solid ground to build questions upon.", "402" ], [ "I&#39;ve not printed my ticket for years. I either have it on my phone, or I just hand over my ID at the checkin counter and tell them the flight I&#39;m on. Zero issues.\r\n\r\nIn the past two months I&#39;ve done this for flights from Sydney, Melbourne, Tauranga, Christchurch, Auckland, Bangkok, and Krabi, and they didn&#39;t flinch - just looked me/us up and printed out the boarding pass.\r\n\r\nIf you&#39;re concerned, take the faded version to the airport with you as a backup, and if the ticket machines / kiosks exist for your airline, re-print, or go up to the counter and ask for them to re-print. Also check if you can check-in on line first, as it might make the process a little faster.", "587" ], [ "Not an answer, but a lot of us ex-South Africans actually were unaware of the law to return on SA passports until recently, and I know many who have gone back with say, a NZ or Aus or UK passport and nobody batted an eyelid. All entered on their foreign passport as a tourist. I *suspect* the law is not policed, but like I said, this is just from word of mouth from several dual passport holders that I know.", "606" ], [ "Technically yes, adding a comment helps and we normally do, but there does appear to be a bug in the system. I&#39;ve noticed it quite often - that sometimes when you delete an answer it pops up the usual &#39;reason for delete&#39; auto text box which we can choose to comment with. Other times that doesn&#39;t appear and if you&#39;re not careful, it&#39;ll just delete it without a comment, and then you have to manually go find the post on the main site and add a comment, if you even noticed it. I assume that&#39;s all that&#39;s happened here, but I&#39;ll leave it to Rofl to respond.", "494" ], [ "Some options for you to consider:\r\n\r\n\r\n\r\n - [The Hamilton Institute at the National University of Ireland][1], Maynooth The Hamilton Institute is a multi-disciplinary research centre at the National University of Ireland\r\n\r\n - [Hamilton Mathematics Institute][2] The HMI is a mathematics institute in Trinity College, Dublin, the University where <PERSON> studied and worked.\r\n\r\n([source and more information][3])\r\n\r\nThe first time he came up with the formula for quaternions, he was crossing the [Broome Bridge][4] in Dublin, and scratched the formula in the stone.\r\n\r\nTo this day it&#39;s commemorated by a plaque on the north-west corner under the railing on the bridge. There&#39;s an annual commemorative walk over the bridge on October 16.\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_3_\r\n [3]: _URL_0_\r\n [4]: _URL_1_", "661" ], [ "Let me try to explain how recommender systems work in production, as intuitively as possible:\r\n\r\nLet&#39;s say we want to build a rec sys. for a restaurant discovery product, where users can rate restaurants, add reviews, photos, etc and also order food from there.\r\n\r\nSo, the user&#39;s feed will have a list of restaurants in his/her area. But, as I gain money from restaurants in the $-per-click model, I need to maximize the number of times a user clicks on a restaurant.\r\n\r\nAlso, it is obvious that a user is more likely to click on a restaurant if he tends to like it the most. [Restaurant features being Cost-for-two, cuisines, ratings, etc]\r\n\r\nSo here, a user is a data point and so is the restaurant. So, let&#39;s say the distance between the user vectors and the restaurant is the \" ;likeability \" ; of the user for the restaurant.\r\n\r\nLet&#39;s say the vector is in the form [Japanese Spanish Mexican Chinese Indian Thai Turkish Lebanese]\r\nLet&#39;s say a restaurant&#39;s vector is: `A = [0 0 0 1 1 0 0 0]`\r\n\r\nand the user&#39;s is: `B = [2 23 4 53 43 21 2 45]`\r\n\r\nEach number being a particular cuisine. For restaurant, it is yes or no (1 or 0), a.k.a whether the cuisine is served or not.\r\n\r\nFor user, it can be the number of clicks he/she did on restaurants with that cuisine. (I am over-simplifying here. But, this can be as complex as a weighted score for clicks+transactions+content_generated like review, ratings, etc)\r\n\r\nNow, the the cosine similarity measure between the 2 vectors in an 8-dimensional space (length of the vector) is the *likeability score*.\r\n\r\nNow, the system uses these scores while doing it&#39;s [feed ranking][1] for each user. \r\n\r\nThis can be near-realtime to being updated hourly/daily, depending on the servers the company can afford.\r\n\r\n\r\n [1]: _URL_0_", "753" ], [ "Let me re-frame your question before answering:\r\n\r\n > Can augmented reality be a training system for computer vision?\r\n\r\nYes, why not! Also, I&#39;m pretty sure the big companies who have their aug. reality products out there are secretly optimizing their CV algorithms(although we&#39;ll have no proof).\r\n\r\nA very similar(but a different) example would be how _URL_0_&#39;s app pays users for recording their driving, and then uses it to train their own self-driving cars.\r\n\r\nSo, if that can be done, I don&#39;t see why augmented reality cannot be used to train CV algos. In fact, it&#39;s a much more richer, localized dataset.", "13" ], [ "@DavidRicherby heh, I meant about the annual commemorative thing, but just realised that was in his single-word link too. Ah well, edited a bit. The source website was a fan site of <PERSON> and he links to the center, and was included as I&#39;d asked in a comment about where he worked. It&#39;s an interesting question - I&#39;ve weirdly been reading a bit about <PERSON> since, so might add more if I find it, but current that&#39;s about it :/", "897" ], [ "&#161;S&#237;! Had to learn how to make google search Spanish (latin america) pages first.\r\n\r\nHere&#39;s a news article about it: [Argentina devolver&#225; IVA por hotel para atraer turistas extranjeros](_URL_0_)\r\n\r\nAnd here&#39;s the official bulletin from the government: [Administraci&#243;n Federal de Ingresos P&#250;blicos\r\ny Ministerio de Turismo\r\nIMPUESTO AL VALOR AGREGADO](_URL_1_).\r\n\r\nHopefully those two articles should be enough to explain it to him in Spanish.", "237" ], [ "It very much depends on which area of Vietnam you&#39;re talking about. Mountains, coastal flows, even rivers and [caves can have their own climate](_URL_0_).\r\n\r\nFrom at least [one travel guide online](_URL_1_), you can see how it differs from region to region.\r\n\r\n**Northern** - November to April seems to have more chance of cloud, and rain\r\n\r\n**Central** - similar with monsoon type weather from Nov to March, although it can depend on the town (see link)\r\n\r\n**Southern** - May to November is raining season (note how it&#39;s almost the opposite of the north).\r\n\r\nAt the bottom of the linked page are charts for climate, rainfall for each month for the regions, followed by links to weather for individual cities.", "591" ], [ "Unfortunately, no.\r\n\r\n[From the State Department](_URL_0_):\r\n\r\n > If you are a foreign citizen temporarily in the United States, and you\r\n > lose your U.S. visa, you can remain for the duration of your\r\n > authorized stay, as shown on your admission stamp or paper Form I-94,\r\n > Arrival/Departure Record.\r\n\r\nSo at least you can stay, get a new passport, and still depart on that new passport, but when you next leave the country you&#39;ll need to replace the visa to be allowed back in.\r\n\r\nNote that on that page, there are several steps you should follow as well, in terms of contacting the police, your embassy and that you&#39;ll need copies of these discussions when applying for the replacement visa:\r\n\r\n > For replacement of a visa, you must apply in person at a U.S. Embassy\r\n > or Consulate abroad. When applying for the replacement of a visa, you\r\n > will need to provide a written account documenting the loss of your\r\n > passport and visa. Include a copy of the police report.", "606" ], [ "> identify pattern in my CSV file without user specifying any conditions\r\n\r\nYou want to do [unsupervised learning][1] here. The Wikipedia definition of the same is:\r\n\r\n > Unsupervised machine learning is the machine learning task of\r\n > inferring a function to describe hidden structure from \" ;unlabeled \" ;\r\n > data (a classification or categorization is not included in the\r\n > observations).\r\n\r\nAs you were unclear about the (kind of)data your csv has, I shall recommend you to go through the list of unsupervised learning algorithms [here][1] and use the one which would fit your need.\r\n\r\n[If you&#39;re starting out, then I would recommend starting with learning the [K-means clustering algorithm\\]][2]\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "13" ], [ "Generally speaking, Craft doesn&#39;t care where those files live, but I generally put all assets like CSS/SCSS, JS, etc in my `craft/templates` folder. If you&#39;re using `gulp` then you would compile your files out to the `public` folder and link to them appropriately. If you&#39;re not compiling those, then they would need to live in the `public` folder.\r\n\r\nYou can read more about templating here:\r\n\r\n_URL_1_\r\n\r\n_URL_0_\r\n\r\nAs far as how I organize my `scss` and `js` I just drop those into an assets folder like so:[![JS setup[![\\]\\[1\\]\\]\\[1\\]][1]][1]\r\n\r\nI hope this helps! Craft is extremely flexible with almost no restrictions on what it can do.\r\n\r\n\r\n [1]: _URL_2_", "811" ], [ "The song has many verses, some of which varied in different performances. Even sticking to the \" ;canonical \" ; verses used in the <PERSON> version, however, there&#39;s demonstrably no one consistent \" ;you \" ; being referred to between verses. This can be shown by the fact that the \" ;you \" ; in the second verse seems to be a composite of <PERSON> and <PERSON> himself, whereas the first verse refers to <PERSON> in the third person.\r\n\r\nGiven that, the answer is ambiguous, but the most natural reading to me is to assume the first, third, fourth (and arguably the fifth) verses are all directed to the narrator&#39;s lover, who seems to be a somewhat distanced and indifferent figure (with the second verse taking a detour to directly address the subject of the first). The narrator seems to idolize [her], with the first and fourth verses somewhat blasphemously conflating her with God. \r\n\r\nUnder that reading, we can picture the narrator (<PERSON>?), a songwriter writing a song for his girlfriend. He pictures himself charming her with his song, like King <PERSON> pleased the Lord with a \" ;secret chord. \" ; But he know that in real life, she&#39;s not even a fan of his music, or really any music. There&#39;s no secret key to her heart, or at least, not one that he knows (compare the similar themes in <PERSON>Songs For Women](_URL_0_)*, which directly references this line).\r\n\r\nEDIT: [This source](_URL_1_) indicates that all the best-known verses come from two separate recordings by <PERSON>, a 1984 version with more religious imagery, and a 1988 version more focused on the relationship with a lover. The <PERSON> version includes verses from both, although not the single verse shared between versions. It&#39;s only the second verse from the first version, however, that clearly addresses someone other than the narrator&#39;s lover.", "189" ], [ "The concept of divine inspiration, where the artist is not the creator of the art, but rather a conduit for something originating with God, is an ancient one, perhaps most cogently formulated in [Plato&#39;s *Ion*](_URL_0_). It would almost have certainly been familiar to someone as [well-educated](_URL_1_) as <PERSON> when he wrote *Hallelujah*. \r\n\r\nIt further seems clear that the only way one could discover a \" ;secret chord \" ; sacred or pleasing to God would be via divine inspiration, which, in the *Ion*, is depicted as a somewhat [baffling](_URL_2_) and mysterious process. Since <PERSON> immediately goes on to reveal the secret chord (or rather, chord progression), he is explicitly comparing himself to <PERSON>, and arguably autobiographically describing how baffling the creation process feels to *him*. After all, this is an artist who famously said [ \" ;If I knew where the good songs came from, I&#39;d go there more often. \" ;](_URL_3_) \r\n\r\nThere&#39;s also a sly suggestion here that only divine inspiration and/or a secret chord would be enough to please his picky lover, who doesn&#39;t \" ;really care for music. \" ;", "229" ], [ "Boa parte dos atalhos podem ser obtidos em [PDF criado pela comunidade][1]. Mas n&#227;o tem o que precisa. Tem uma [p&#225;gina da Wiki de vers&#227;o mais antiga com todos atalhos][2]. N&#227;o deve ter mudado muito. Especificamente o que deseja para PC/Mac:\r\n\r\n > Collapse (hide) a block Ctrl + Minus Cmd + Minus\r\n > Collapse (hide) a block \t Ctrl + NumPad Minus \r\n > Collapse (hide) all code blocks Ctrl + Shift + NumPad Minus Cmd + Shift + Minus\r\n > Expand a Collapsed Block (expand-fold) Ctrl + Plus Cmd + Plus\r\n > Expand a Collapsed Block (expand-fold) Ctrl + NumPad Plus \t\r\n > Expand a Collapsed Block (expand-fold) Ctrl + Equals \t Cmd + Equals\r\n > Expand all code blocks (expand-all-folds) Ctrl + Shift + NumPad Plus \t\r\n > Expand all code blocks (expand-all-folds) Ctrl + Shift + Plus Cmd + Shift + Plus\r\n > Expand all code blocks (expand-all-folds) Ctrl + Shift + Equals Cmd + Shift + Equals\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "832" ], [ "Photos and sources don&#39;t always make it better ;) It&#39;s one of those things, if they&#39;re the same # of votes, it&#39;ll present answers in a random order, but once one is &#39;winning&#39; it appears at the top, unless another is accepted, in which case that one appears at the top.\r\n\r\nYou could try sharing directly to your answer on twitter or reddit etc, but it&#39;s up to voters to choose which they vote for.\r\n\r\nEDIT: Yours also has more votes than the other now anyway ;)", "474" ], [ "I&#39;ve done it before at other airports, and I&#39;d consider doing it there too, it&#39;s Singapore. I mean if they do raise an eyebrow and ask what took so long, you could just tell the truth. It&#39;s not like there are signs saying \" ;you must exit in 45 min \" ; - you could have gone to the bathroom or had a shower even before exiting. I would have raised luggage as the only potential issue ,but you&#39;ve said carry-on. The passport control folk don&#39;t know what time your flight arrived, after all.", "587" ], [ "I was on Vancouver Island for Canada Day weekend in 2014. On Canada Day we drove back from Tofino to catch the ferry at Nanaimo.\r\n\r\nSomewhere along the way was a river on the left side of the road. We hopped off the road and onto the rocks, and I took this photo:\r\n\r\n[![enter image description here][1]][1]\r\n\r\nI&#39;m trying to figure out where it was. All I have is that I referred to it as &#39;cascades&#39; but not sure if it was officially called that, and that it was on the left side of the road, heading to Nanaimo. We took the road through Port Alberni, if I remember correctly.\r\n\r\nCan anyone locate it?\r\n\r\n [1]: _URL_0_", "464" ], [ "As is always the way, I finally asked on here and then my next search located the answer for it. The answer is [Kennedy River Cascade](_URL_0_):\r\n\r\n > It is a popular stopping point about half way between Port Alberni and\r\n > Ucluelet/Tofino and a place to take a break before Highway 4 begins to\r\n > wind its way down to Kennedy Lake. On the west side of the Sutton\r\n > Pass, the Kennedy River falls down through a cascade of boulders that\r\n > look like they’ve been tossed there by giants. The water here has worn\r\n > the rock into smooth sculptures and the unique, and accessible,\r\n > landscape is popular with tourists.\r\n\r\nThe image on the linked page almost perfectly matches the angle of the mountains in the distance.", "464" ], [ "Basta tirar o fechamento expl&#237;cito da conex&#227;o, afinal est&#225; fazendo certo com o `using` que vai fechar a conex&#227;o.\r\n\r\n public ActionResult Index(ViewModel model, string returnUrl) {\r\n var query = \" ;UPDATE Table SET Status = &#39;C&#39; WHERE Id = @Num \" ;;\r\n using (var connection = new SqlConnection(ConfigurationManager.ConnectionStrings[ \" ;ConnectionString \" ;].ConnectionString))\r\n using (var command = new SqlCommand(query, connection)) {\r\n command.Parameters.Add( \" ;@Num \" ;, _URL_1_).Value = model.Numero;\r\n connection.Open();\r\n command.ExecuteNonQuery();\r\n }\r\n return RedirectToAction( \" ;Page \" ;, \" ;Account \" ;);\r\n }\r\n\r\n[Coloquei no GitHub para refer&#234;ncia futura][1].\r\n\r\n\r\n [1]: _URL_0_", "147" ], [ "&#201; poss&#237;vel usando o operador [`typeof`][1]. Veja a [diferen&#231;a para o `GetType()`][2].\r\n\r\nN&#227;o sei se realmente precisa fazer isso, o c&#243;digo fica t&#227;o simples que nem precisaria desse m&#233;todo, menos ainda de outra classe. Claro que pode desejar fazer uma abstra&#231;&#227;o, mas precisa ter um motivo pra fazer.\r\n\r\n using System;\r\n using System.Reflection;\r\n \r\n public class Program {\r\n public static void Main(string[] args) {\r\n \t\tvar pessoa = new Pessoa { id = 1, Nome = \" ;Nicola Bogar Uccio \" ;, DataNascimento = new DateTime(1988, 08, 24) };\r\n \t\tPropertyInfo[] properties = Entities < Pessoa > .GetPropertiesComoEUQuero();\r\n }\r\n }\r\n \r\n public class Pessoa {\r\n public int id { get; set; }\r\n public string Nome { get; set; }\r\n public DateTime DataNascimento { get; set; }\r\n }\r\n \r\n public static class Entities < TEntidade > where TEntidade : class {\r\n public static PropertyInfo[] GetPropertiesComoEUQuero() { \r\n return typeof(TEntidade).GetProperties();\r\n }\r\n }\r\n\r\nVeja [funcionando no .NET Fiddle][3]. E [no Coding Ground][4]. Tamb&#233;m [coloquei no GitHub para refer&#234;ncia futura][5].\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_3_\r\n [3]: _URL_1_\r\n [4]: _URL_0_\r\n [5]: _URL_4_", "147" ], [ "Use [`raw_input()`][1] para ler *strings* no Python 2:\r\n\r\n name = raw_input( \" ;tell me your name: \" ;)\r\n print &#39;Hello&#39;, str(name), &#39;!&#39;\r\n\r\nVeja [funcionando no ideone][2]. E [no Coding Ground][3]. Tamb&#233;m [coloquei no GitHub para refer&#234;ncia futura][4].\r\n\r\nNo Python 3 elas s&#227;o sin&#244;nimos, por isso funciona com `input()`.\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_0_\r\n [3]: _URL_1_\r\n [4]: _URL_3_", "147" ], [ "Divide and conquer may work. It may not. Imagine test T1 fails when T77 and T952 are run in order in a set of T2-T1000. A divide and conquer scheme may divide T77 into a group T2-T500 and and place T952 in a group T501-T999... and neither subgroup when executed by itself will show the failure. In theory, you may have to identify an arbitrary subset. For N tests, that&#39;s 2^N possible subsets; for 1000 tests, that&#39;s 2^1000 which is way larger than the number of protons in the visible universe.", "585" ], [ "Depends a little on whether they&#39;re Schengen, who it was issued by (in this case Italy), and what the countries you want to travel to think about your country.\r\n\r\n[The Refugee Travel Document](_URL_0_) is like a faux passport, allowing you to exit and return to the country that issued it. You&#39;re not a citizen (usually) so can&#39;t get a passport. Makes sense.\r\n\r\nNow of course you&#39;ll enter another country with this document instead of a passport, so they have to decide whether to recognise it. Not all will, especially some Middle East and SE Asian countries. Instead of listing them all out, as they may change, I&#39;ll refer you to this:\r\n\r\n[ Convention Relating to the Status of Refugees](_URL_1_) - has a map of the (currently) 145 states which are parties to the 1951 Convention Relating to the Status of Refugees and are obliged to issue travel documents to refugees lawfully resident in their territory, as well as ones who only signed the 1967 Protocol.\r\n\r\nEven if they do recognise and will issue documents, you may still need to meet the regular requirements for a visa (eg tourist visa for Cuba, or invitation for Russia), that nationals of your country do, or indeed, potentially additional requirements that the destination country may impose on you, given your refugee status.\r\n\r\nAs a result, t&#39;s always best to check with your state department equivalent before you travel, to ensure your eligibility, as international politics and policies do change.", "128" ], [ "D&#225; pra fazer um pouco melhor, mas a pergunta n&#227;o d&#225; detalhes. Precisa pegar at&#233; o limite estabelecido onde tiver espa&#231;o. Tem fun&#231;&#227;o pronta para isto ([`LastIndexOf()`][1]).\r\n\r\n Imports System\r\n \t\t\t\t\r\n Public Module Module1\r\n \tPublic Sub Main()\r\n \t\tFor Each texto in CropText( \" ;Avenida luis de camoes, travessa de santa rita numero 588 \" ;, 50)\r\n \t\t\tConsole.WriteLine(texto)\r\n \t\tNext\r\n \t\tFor Each texto in CropText( \" ;Avenida luis de camoes, travessa de santa rita \" ;, 50)\r\n \t\t\tConsole.WriteLine(texto)\r\n \t\tNext\r\n \t\tFor Each texto in CropText( \" ;Avenidaluisdecamoes,travessadesantaritanumero588teste \" ;, 50)\r\n \t\t\tConsole.WriteLine(texto)\r\n \t\tNext\r\n \tEnd Sub\r\n \r\n \tPublic Function CropText(text As String, limit As Integer) As String()\r\n \t\tIf text.Length < limit\r\n \t\t\tReturn New String() {text}\r\n \t\tElse\r\n \t\t\tDim position As Integer = text.LastIndexOf( \" ; \" ;, limit)\r\n \t\t\tIf position = -1\r\n \t\t\t\tReturn New String() {text}\r\n \t\t\tElse\r\n \t\t\t\treturn New String() {text.Substring(0, position), text.Substring(position + 1)}\r\n \t\t\tEnd If\r\n \t\tEnd If\r\n \tEnd Function\r\n End Module\r\n\r\nVeja [funcionando no **.NET Fiddle**][2]. E [no **Coding Ground**][3]. Tamb&#233;m [coloquei no **GitHub** para refer&#234;ncia futura][4].\r\n\r\n\r\n [1]: _URL_3_\r\n [2]: _URL_1_\r\n [3]: _URL_0_\r\n [4]: _URL_2_", "147" ], [ "what to see - subjective and off-topic. Too many possible answers. How to get from A to B? Yes. What visa? Yes. What ticket options with a particular discount card - sure. Basically anything objectively answerable that matches the [help] is fine. If it&#39;s subjective/after recommendations or you just want to chat - join the [chat] and we&#39;ll be happy to help :)", "262" ], [ "H&#252;rriyet Daily News reports that 1080 people have been convicted in <PERSON> \" ;insult \" ; cases in Turkey in 2016. This isn&#39;t particularly interesting; there have been several rounds of purges since the failed 2016 coup attempt. However, this time, it appears children as young as 12 years old are amongst the accused: \r\n\r\n > A total of 4,750 people aged over 18 years old, 36 foreign nationals, and two legal entities were accused of “insulting” <PERSON>. Some 102 people aged between 12 and 15, as well as 138 people aged between 15 and 18, were accused on charges of “crimes against the sovereignty of the state and its bodies.”\r\n\r\n > The courts acquitted 679 people accused of these charges and suspended the pronouncement of the judgement for 867 others. “Insulting the president” is a crime in Turkey punishable by up to four years in jail. \r\n\r\n > < sub > H&#252;rriyet Daily News. 1,080 convicted in <PERSON> \" ;insult \" ; cases in Turkey last year - _URL_0_ [Accessed 28 Jun. 2017]. < /sub > \r\n\r\nUnfortunately, the article doesn&#39;t go into any more detail. Do we know What specific crimes these children allegedly commit? Is there a real possibility children will end up in jail for \" ;insulting \" ; <PERSON>?", "273" ], [ "Several years ago, I read a memorable short story included as an example (of what, I don&#39;t recall) in a book about writing. The story was set in a historical era of France. I believe it was translated from the French, and written in the era it depicted, although I&#39;m not sure about either of those facts.\r\n\r\nThe plot concerned a group of poor soldiers who pool all their money to purchase one of them a night with a famous prostitute -- possessor of the \" ;dearest charms in all France. \" ; They determine the lucky beneficiary by lottery. When he tells the lady in question his story, she declares she can be as generous as his comrades and that he will not pay a \" ;single sou \" ; for the privilege of her time. \r\n\r\nThe punchline is that she refunds him, not the entire amount, but just the few coins he used to buy into the lottery! I haven&#39;t been able to find or identify either this story, or the book that quoted it. Anyone have any thoughts?", "180" ], [ "A lot of our standard language encodes subconscious in-group, out-group preferences. As theorist <PERSON> explored in his work *[Black Skins, White Masks](_URL_5_),* the probable origin is the psychological desire to distance oneself from non-desired traits by displacing them onto a group readily distanced from the target audience.\r\n\r\nSince racial examples can be controversial, and tend to garner instinctive resistance, let&#39;s start with a non-racial example. The word *dexterous* is a positive adjective meaning \" ;[skillful and competent with the hands](_URL_2_) \" ; whereas \" ;sinister \" ; is a negative adjective meaning \" ;[singularly evil or productive of evil](_URL_0_) \" ; (see also *[gauche](_URL_4_)*). Yet, the words originate in ones meaning \" ;right-handed \" ; and \" ;left-handed. \" ; The fact that a significant majority of people are right-handed has resulted in a distinct semantic preference for right-handedness being encoded into language that is used commonly, and without any malicious intent.\r\n\r\nSimilarly, the advent of positive/negative word pairs in European languages contrasting white and black is at least arguably related to the formation of a unified European racial identity privileging lighter skin, perhaps as a reaction to increased collective competition with the darker-skinned cultures of the Middle East and Africa. Recent literature that counters this trend often does so as [a direct and explicit response](_URL_1_) against the perceived [subconscious racism in the color-coding of older fantasy works](_URL_3_).", "937" ], [ "Yes, and [there are great articles online detailing travelling with condoms](_URL_0_). They&#39;re not liquids, flammable or on any of the TSA unapproved lists, so you&#39;re totally fine to take them. However, remember they&#39;re meant to be stored at room temperature as they are still medical devices you don&#39;t want to take risks with damaging them. Don&#39;t store them with sharp items in your carry-on (even pens etc). If your laptop or phone gets really warm, it&#39;s best not to have them side-by-side either.\r\n\r\nHowever, there are also stories of travellers being detained [because of the condoms in their luggage](_URL_1_), where they were accused of being working girls(!), so ... all things considered, it might be better to just get some at the destination.", "565" ], [ "According to the documentation:\r\n\r\n > package-directory-list&#39;s value is \r\n > ( \" ;/usr/local/share/emacs/24.4/site-lisp/elpa \" ;\r\n > \" ;/usr/local/share/emacs/site-lisp/elpa \" ;\r\n > \" ;/usr/share/emacs/24.4/site-lisp/elpa \" ;\r\n > \" ;/usr/share/emacs/site-lisp/elpa \" ;)\r\n > \r\n > \r\n > This variable may be risky if used as a file-local variable.\r\n > \r\n > Documentation: List of additional directories containing Emacs Lisp\r\n > packages. Each directory name should be absolute.\r\n > \r\n > These directories contain packages intended for system-wide; in\r\n > contrast, `package-user-dir&#39; contains packages for personal use.\r\n > \r\n > You can customize this variable.\r\n > \r\n > This variable was introduced, or its default value was changed, in\r\n > version 24.1 of Emacs.\r\n > \r\n\r\n\r\n\r\nAnother [documentation](_URL_0_):\r\n\r\n > In addition to package-user-dir, Emacs looks for installed packages in\r\n > the directories listed in package-directory-list. These directories\r\n > are meant for system administrators to make Emacs packages available\r\n > system-wide; Emacs itself never installs packages there. \r\n\r\nSo, for site wide install, I suggest you to, as a system administrator, manually install the packages inside /usr/local/share/emacs/site-lisp/elpa. Or you can also do as suggested by @Stefan", "71" ], [ "Johannesburg has improved in recent years crime-wise, but it&#39;s still not particularly safe. However, remember that a lot of people who live there are &#39;white&#39;. You&#39;ll learn reasonably fast that there are areas that you don&#39;t go into, but places like Sandton or Morningside and other affluent suburbs are (relatively) fine. Yes, you&#39;ll be in a house with &#39;burglar guards&#39; (bars on the window) and likely a security system, but it&#39;s sort of part of life, and strange as it sounds, you get used to it.\r\n\r\nThere&#39;s common sense new &#39;rules&#39; you will find yourself applying - always drive with the windows up and doors locked, keep an eye on people walking near your car and the like, but again, for the most part like anywhere in the world, people are good. Unfortunately a large percentage of people are poor, and a small percentage of these people are opportunistic and see a way to gain money easily through crime. Try and minimise these opportunities. Talk to your colleagues / fellow students when you arrive and they&#39;ll give you advice and tips about the latest types of crimes in vogue and what to watch out for.\r\n\r\n(Disclaimer: not all criminals are poor, and not all poor people are criminals. The same applies to any demographic or race of people).\r\n\r\nSource: I lived in South Africa for 13 years, and have visited Johannesburg twice since. I also have relatives in Pretoria.", "565" ], [ "Achei uma [fun&#231;&#227;o pronta no SO][1] que parece resolver o que deseja.\r\n\r\n\tpublic static DateTime AddBusinessDays(DateTime date, int days) {\r\n\t\tif (days < 0) {\r\n\t\t\tthrow new ArgumentException( \" ;days cannot be negative \" ;, \" ;days \" ;);\r\n\t\t}\r\n\t\tif (days == 0) return date;\r\n\t\tif (date.DayOfWeek == DayOfWeek.Saturday) {\r\n\t\t\tdate = date.AddDays(2);\r\n\t\t\tdays -= 1;\r\n\t\t}\r\n\t\telse if (date.DayOfWeek == DayOfWeek.Sunday) {\r\n\t\t\tdate = date.AddDays(1);\r\n\t\t\tdays -= 1;\r\n\t\t}\r\n\t\tdate = date.AddDays(days / 5 * 7);\r\n\t\tint extraDays = days % 5;\r\n\t\r\n\t\tif ((int)date.DayOfWeek + extraDays > 5) {\r\n\t\t\textraDays += 2;\r\n\t\t}\r\n\t\treturn date.AddDays(extraDays);\r\n\t}\r\n\r\nVeja [funcionando no dotNetFiddle][2].\r\n\r\nNote que os feriados n&#227;o s&#227;o considerados. Mas &#233; poss&#237;vel adaptar para que sejam. N&#227;o &#233; algo t&#227;o simples por causa dos feriados m&#243;veis e regionais. Mas &#233; fact&#237;vel se estabelecer bem as regras.\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "147" ], [ "*Pure* grammar driven editors were a popular idea in the 80s. They failed because people aren&#39;t driven by the grammar; they are opportunists. This means the \" ;structure editor \" ; has to be able to not only suggest structure/grammar rules (yes, that part is still useful), but it has to be tolerant to arbitrary edits and programs that aren&#39;t syntactically legal most of the time. There aren&#39;t many tools/IDEs that do this, that are available now. There was a bunch of work on this at Berkely back in the 90s.", "836" ], [ ".... I doubt you will be able to do this with just pixel editing (direct2d); you need a *lot* of machinery to process grammars (that&#39;s actually a lot harder than it looks) and people also want \" ;code completion in context \" ; ,e.g, suggest something based on the identifiers already defined in the code. That&#39;s *way* harder than just parsing. I don&#39;t intend to rain on your parade; just be realistic about what you can build in a time frame you are willing to tolerate.", "157" ], [ "I used to use Skyscanner for weekend searches, but can&#39;t seem to find their feature for it any more.\r\n\r\nHowever, [Kayak](http://_URL_0_) does this now. For example, [a search for all weekend flights from Sydney to Canberra for Feb 2016][1].\r\n\r\nTo do, go to _URL_0_, choose flights, put in your details and select &#39;Show Flexible Dates&#39;, and then &#39;Weekends&#39;, and follow the instructions.\r\n\r\n\r\n [1]: https://www._URL_0_.au/flights/SYD-CBR,nearby/weekend/2016-02-Fri-PM-Sun", "377" ], [ "[Pressurenet](_URL_0_) might be what you&#39;re after. It&#39;s still growing, but it allows people to report live stats via their phone of the weather where they are. I&#39;m in Sydney at present and there&#39;s usually a few around me being reported at any given moment - although it&#39;s definitely not huge at time of writing.\r\n\r\nNot sure of its coverage for India, but may be worth a try. Let us know.", "307" ], [ "Yes. It&#39;s breaking the terms of the agreement between you and the country of the United States of America.\r\n\r\nGetting out won&#39;t be a problem - there&#39;s no exit immigration, so she&#39;ll be able to leave. However, overstaying is usually frowned upon, especially by the US, and it could cause her to have problems getting future visas for the US, or for other countries if they share the information.\r\n\r\nBest option is to change the ticket, or apply for a longer visa than the 90 day VWP option.", "606" ], [ "O `Int32.Parse(valor)` s&#243; converte conte&#250;do vindo de *string*. O `Convert.ToInt32()` tem sobrecargas para trabalhar com v&#225;rios tipos. Esta &#233; a principal diferen&#231;a.\r\n\r\nMas a melhor forma &#233; ver como ele &#233; internamente:\r\n\r\nParse:\r\n\r\n public static int Parse(string s)\r\n {\r\n return System.Number.ParseInt32(s, NumberStyles.Integer, NumberFormatInfo.CurrentInfo);\r\n }\r\n \r\n internal static unsafe int ParseInt32(string s, NumberStyles style, NumberFormatInfo info)\r\n {\r\n byte* stackBuffer = stackalloc byte[1 * 0x72];\r\n NumberBuffer number = new NumberBuffer(stackBuffer);\r\n int num = 0;\r\n StringToNumber(s, style, ref number, info, false);\r\n if ((style & NumberStyles.AllowHexSpecifier) != NumberStyles.None)\r\n {\r\n if (!HexNumberToInt32(ref number, ref num))\r\n {\r\n throw new OverflowException(Environment.GetResourceString( \" ;Overflow_Int32 \" ;));\r\n }\r\n return num;\r\n }\r\n if (!NumberToInt32(ref number, ref num))\r\n {\r\n throw new OverflowException(Environment.GetResourceString( \" ;Overflow_Int32 \" ;));\r\n }\r\n return num;\r\n }\r\n\r\nConvert:\r\n\r\n public static int ToInt32(string value)\r\n {\r\n if (value == null)\r\n {\r\n return 0;\r\n }\r\n return int.Parse(value, CultureInfo.CurrentCulture);\r\n }\r\n\r\nRetirado [dessa resposta do SO][1].\r\n\r\nMas voc&#234; pode ver o c&#243;digo fonte real: [`Convert`][2] e [`Parse`][3].\r\n\r\nPrefira o [`TryParse()`][4]\r\n\r\nRelacionada: _URL_0_\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_3_\r\n [3]: _URL_2_\r\n [4]: _URL_4_", "147" ], [ "Fazer n&#227;o &#233;, resolver tudo o que isto implica pode ser um pouco mais. Para te passar tudo o que &#233; necess&#225;rio seria muito longo. Voc&#234; pode ir fazendo perguntas espec&#237;ficas. Para te dar uma base para come&#231;ar eu achei uma [resposta no SO][1] que pode fazer um teste.\r\n\r\n static class Program\r\n {\r\n /// < summary > \r\n /// The main entry point for the application.\r\n /// < /summary > \r\n [STAThread]\r\n static void Main()\r\n {\r\n Application.EnableVisualStyles();\r\n Application.SetCompatibleTextRenderingDefault(false);\r\n \r\n Application.Run(new MyCustomApplicationContext());\r\n }\r\n }\r\n \r\n \r\n public class MyCustomApplicationContext : ApplicationContext\r\n {\r\n private NotifyIcon trayIcon;\r\n \r\n public MyCustomApplicationContext ()\r\n {\r\n // Initialize Tray Icon\r\n trayIcon = new NotifyIcon()\r\n {\r\n Icon = Resources.AppIcon,\r\n ContextMenu = new ContextMenu(new MenuItem[] {\r\n new MenuItem( \" ;Exit \" ;, Exit)\r\n }),\r\n Visible = true\r\n };\r\n }\r\n \r\n void Exit(object sender, EventArgs e)\r\n {\r\n // Hide tray icon, otherwise it will remain shown until user mouses over it\r\n trayIcon.Visible = false;\r\n \r\n Application.Exit();\r\n }\r\n }\r\n\r\nUm [tutorial mais completo][2].\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "147" ], [ "I&#39;m attempting to finish my first `fieldtype` plugin (how exciting!) but having an issue with displaying options in a `select` dropdown in an `entry`.\r\n\r\nMy `ColumnWidth_WidthsFieldType` has this:\r\n\r\n < ?php\r\n \r\n namespace Craft;\r\n \r\n /**\r\n * Widths Fieldtype\r\n *\r\n * Allows entries to select associated widths\r\n */\r\n class ColumnWidth_WidthsFieldType extends BaseFieldType\r\n {\r\n /**\r\n * Get the name of this fieldtype\r\n */\r\n public function getName()\r\n {\r\n return Craft<IP_ADDRESS>t(&#39;Column Widths&#39;);\r\n }\r\n \r\n /**\r\n * Get this fieldtype&#39;s column type.\r\n *\r\n * @return mixed\r\n */\r\n public function defineContentAttribute()\r\n {\r\n // \" ;Mixed \" ; represents a \" ;text \" ; column type, which can be used to store arrays etc.\r\n return AttributeType<IP_ADDRESS>Mixed;\r\n }\r\n \r\n /**\r\n * Get this fieldtype&#39;s form HTML\r\n *\r\n * @param string $name\r\n * @param mixed $value\r\n * @return string\r\n */\r\n public function getInputHtml($name, $value)\r\n {\r\n // call our service layer to get a current list of widths\r\n $widths = craft()- > columnWidth_widths- > getAllWidths();\r\n \r\n // create an array for the widths \r\n $widthsOptions = array();\r\n \r\n // populate the $widthsOptions array with $widths\r\n foreach ($widthsOptions as $widths )\r\n {\r\n $widthsOptions[$widths- > id] = $widths- > name;\r\n }\r\n \r\n return craft()- > templates- > render(&#39;columnwidth/_fieldtypes/widths&#39;, array(\r\n &#39;name&#39; = > $name,\r\n &#39;values&#39; = > $value,\r\n ));\r\n }\r\n }\r\n\r\nMy `columnwidth/_fieldtypes/widths` has this:\r\n\r\n {% import \" ;_includes/forms/ \" ; as forms %}\r\n ​\r\n {% set widths = craft.columnwidth.getAllWidths %}\r\n \r\n {{ forms.selectField({\r\n instructions: \" ;Select the width of your column \" ;|t,\r\n id: &#39;columnWidth&#39;,\r\n name: &#39;columnWidth&#39;,\r\n options: widths\r\n }) }}\r\n\r\nBut I&#39;m getting this error:\r\n\r\n`Craft\\ColumnWidth_WidthsModel and its behaviors do not have a method or closure named \" ;optgroup \" ;.`\r\n\r\nThe only post I found was here:\r\n\r\n_URL_0_\r\n\r\nI&#39;m sure I&#39;m missing something and any help is appreciated!", "824" ], [ "Pelo que entendi o problema &#233; outro. O m&#233;todo n&#227;o est&#225; sendo chamado porque n&#227;o h&#225; evento para ele na defini&#231;&#227;o da p&#225;gina, ficaria assim:\r\n\r\n < %@ Page Language= \" ;C# \" ; AutoEventWireup= \" ;true \" ; CodeBehind= \" ;_URL_0_ \" ; Inherits= \" ;Teste.WebForm2 \" ; % > \r\n < !DOCTYPE html > \r\n < html xmlns= \" ;_URL_1_;\r\n \r\n < head runat= \" ;server \" ; > \r\n < title > Clickount < /title > \r\n < link rel= \" ;stylesheet \" ; href= \" ;bootstrap.css \" ; / > \r\n < /head > \r\n \r\n < body > \r\n < form runat= \" ;server \" ; > \r\n < center > \r\n < h1 > Click counter < /h1 > \r\n < asp:Label ID= \" ;Label1 \" ; runat= \" ;server \" ; Text= \" ; \" ; > < /asp:Label > \r\n < br / > & nbsp;\r\n < asp:Button ID= \" ;btn \" ; runat= \" ;server \" ; Text= \" ;Add \" ; OnClick= \" ;btn_Click \" ; CssClass= \" ;btn btn-primary \" ; > < /asp:Button > \r\n < /form > \r\n < /body > \r\n \r\n < /html >", "147" ], [ "Just some clarifications: BCE stanads for _Before Common Era_, not \" ;Christian Era \" ; as you have quoted. BC commonly stands for _Before <PERSON>_ which, it should be noted, it quite different than saying \" ;Before Christian \" ;. According to Christianity, Christ&#39;s coming was fortold and expected long before his actual coming, so the date marker is in the middle of Christian history, not at the beginning. If you just want to count after Christ&#39;s coming that&#39;s up to your definition of Christianity, but it is not Christianity&#39;s definition and by any account you&#39;d have to decide where Judaism fits.", "684" ], [ "As written (in any of the recent edits) this would be better suited for [_URL_0_]. As it is you&#39;re basically just presenting your theory using your own definitions and ... what ... looking for somebody to say \" ;yes you&#39;re right \" ;? That&#39;s not much of a question. Better to set your terms as far as what you mean by \" ;still practiced \" ; and just straight up ask what the oldest is. You&#39;re going to find that it&#39;s harder to define \" ;a religion \" ; than you might think.", "684" ], [ "So three years ago, [RyanAir sort of implied they might do standing seats](_URL_2_) if allowed. The world looked on in horror, shock, half contemplated if they&#39;d do it for one hour flights, and then it went away.\r\n\r\nExcept it didn&#39;t. Airlines have half-mentioned it since then, including [both RyanAir and SpringAir](_URL_0_).\r\n\r\nAgain, this is just talk at this stage, until it wasn&#39;t, when AirBus filed their [saddleseat](_URL_1_) patent, which was almost standing seats. You perch on the seats instead of reclining. [Here&#39;s the official patent](_URL_3_).\r\n\r\nA study in Malaysia then showed that [on a 737-300, a standing cabin would lead to a 21% increase in capacity and drop tickets up to 44%](_URL_0_).\r\n\r\nAnd then this year, not to be outdone, Boeing filed a patent for an [upright sleep support system](_URL_4_) on planes, which could in theory reduce the need to recline seats, and some argue could be combined with other formats to allow standing too. The more the merrier, perhaps?\r\n\r\nWhile no airline has actually offered this *yet*, given the experiments in seating (see AirNZ&#39;s cuddle class) and the ever increasing demand to fit more people on flights for less money, many people (including that aforementioned study) predict standing class might not be that far away.", "463" ], [ "Algu&#233;m vai dar uma solu&#231;&#227;o com RegEx, mas eu prefiro assim:\r\n\r\n var texto = \" ;<PHONE_NUMBER> \" ;;\r\n foreach (var chr in new string[] { \" ;( \" ;, \" ;) \" ;, \" ;- \" ;, \" ; \" ; }) {\r\n texo = texto.Replace(chr, \" ; \" ;);\r\n }\r\n\r\nVeja [funcionando utilizando m&#233;todo de extens&#227;o][1].\r\n\r\nObviamente se quiser guardar isto na vari&#225;vel precisa armazenar de novo o resultado do m&#233;todo na vari&#225;vel.\r\n\r\nD&#225; para fazer de forma mais otimizada. Exemplo:\r\n\r\n public static class StringExt {\r\n \tpublic static string Replace(this string str, string newValue, params char[] chars) {\r\n \t\tvar sb = new StringBuilder();\r\n \t\tforeach (var chr in str) {\r\n \t\t\tif (!chars.Contains(chr)) {\r\n \t\t\t\tsb.Append(chr);\r\n \t\t\t} else {\r\n \t\t\t\tsb.Append(newValue);\r\n \t\t\t}\r\n \t\t}\r\n \t\treturn sb.ToString();\r\n \t}\r\n }\r\n\r\nVeja [funcionando no dotNetFiddle][2].\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "147" ], [ "[**<PERSON>_) would appear to be what you&#39;re after.\r\n\r\nIt&#39;s a 500m hill, in Sha Tin, where the Tao Fong Shan Christian Centre is located.\r\n\r\nFrom the wiki:\r\n\r\n > \" ;A 12-metre-high cross, facing Sha Tin, is the hallmark of the Centre.\r\n > The cross is a popular among visitors and is a place for outside\r\n > gatherings and meetings. \" ;\r\n\r\nIt includes a photo that seems to pretty much exactly match where yours is taken from.\r\n\r\n[![enter image description here][1]][1]\r\n\r\n(taken from the linked wiki page)\r\n\r\nAnd for location:\r\n\r\n[Google Map of location](_URL_2_)\r\n\r\nand\r\n\r\n[Google preview of cross at location](_URL_0_)\r\n\r\n [1]: _URL_3_", "464" ], [ "**Yes**. I only arrived at night and was leaving at like 3pm the next day on a new train, but was able to explore around the river, some of the old streets and beautiful buildings, look for the keyboard sculpture (a bit worn down but geeky), and then stroll along to the station with my bags. \r\n\r\nNote that there&#39;s also a small metro, so if your hostel is close to the metro it&#39;d help a lot. I stayed in some weird hotel/hostel that seemed to be basically dozens of middle-aged men, but hey, the bed was comfy and it was only one night. Unfortunately I can&#39;t remember the name or exact location.\r\n\r\nFor reference, I had a backpack and a day-pack with me, so wasn&#39;t walking too far!\r\n\r\nOn [this map of the city](_URL_1_) - place locator number 8 is basically where the Central station is, and as you can see, it&#39;s very central.\r\n\r\nYou [can also get around](_URL_0_) by metro, bus, tram, trolley and mashrutka.", "377" ], [ "A quick google shows that while rare, hate crimes have occurred in Singapore too. They just don&#39;t tend to get reported very often.\r\n\r\nHowever, what you realise the more you travel, however, is that the news goes with what sounds scary. Most people the world over are generally good, and will bear no ill will towards you. If you&#39;re referring to the police shooting black Americans, the numbers I can find are 324 in 2014. That&#39;s 324 too many, but regardless, out of 320 million people in the US, it&#39;s pretty rare (literally one in a million, if those numbers are correct). The same goes for other ones you mention.\r\n\r\nYes, dumb stuff happens. Yes crime occurs and yes there are prejudiced people. When you arrive in a new area, strike up friendships, and they&#39;ll warn you what areas of a city to avoid, what to not do, and what to do, to stay safe(r than normal).\r\n\r\nBe aware, don&#39;t wander down dark alley-ways, avoid crime spots, and trust your instinct and generally you&#39;ll be fine. Of course, even if you do everything right there&#39;s still a chance of crime in any country, but for the most part, you&#39;ll be fine.\r\n\r\nsource: have travelled to many countries, have had one or two bad experiences, but have shared and compared experiences with people from dozens and dozens of countries, and almost all share the same view.", "565" ], [ "Easy, since I&#39;ve done this trip.\r\n\r\nIn Yekaterinburg, go to the markets and get some base food. Whatever drinks you want, but vodka will be good to share if you&#39;re the sharing type (especially in platzkart class). Water too, especially in summer.\r\n\r\nYou&#39;ll want snacks, try and not take anything smelly (Strong cheese, fish that might smell in heat). I highly recommend &#39;fistashkis&#39; (ok I&#39;m awful at transcribing cyrillic from memory) but basically that&#39;s pistachio nuts. They take a good long time to eat, which is great for such a long trip.\r\n\r\nIf you&#39;re like me, you&#39;ll stop in Novosibirsk for 4 hours. I can&#39;t remember if that was my choice, or if that was compulsory, but I&#39;d been there before and wanted to see what I remembered. Immediately outside the train station you turn right up the hill and there is a supermarket a couple of blocks up on the left for resupply. \r\n\r\nNow, the two things nobody told me which would have been handy.\r\n\r\nTake a mug, for making tea on the train. There&#39;s usually a place near the provodnik where you can do this.\r\n\r\nAlso next to their room is a sign indicating each stop, and how long you have there. This is invaluable. Look for the stops that are 10 minutes or longer, and be ready to hop off. Almost inevitably, there&#39;ll be a crowd of sellers with drinks, snacks and the like to resupply you on your journey. You&#39;ll get to try all sorts of random foods that you won&#39;t know the name of - but it&#39;s totally worth doing. And good to share with people in your carriage!\r\n\r\nBonus: Randomly just over the bridge from the station (and about 3 more blocks) in Irkutsk is a Papa John&#39;s pizza. Go figure!", "377" ], [ "Nope. You use the one you intend to travel with/as.\r\n\r\nEg, I have dual NZ and South African citizenship. The South African passport is awful to travel on, and I can get ESTA for the US. So I apply for the ESTA, and travel, using my NZ passport. I&#39;ve done this regularly.\r\n\r\n[From the US ESTA page](_URL_0_):\r\n\r\n > If you have dual citizenship and have registered with ESTA, you should\r\n > use your VWP-eligible passport to board the plane when you leave your\r\n > country of departure and when you arrive in the U.S. If both your\r\n > countries of citizenship are VWP-eligible, then we strongly recommend\r\n > you choose which one you want to claim for purposes of travel to the\r\n > U.S., and use that country&#39;s passport each time you travel. One person\r\n > with two different ESTA authorizations creates confusion that will\r\n > only delay your travel.", "606" ], [ "This also irritates me on iOS 9 which more aggressively tries to &#39;convert&#39; urls to apps. Which is especially annoying on the iPad pro as the YouTube app cannot run partial screen at all, whereas a YouTube tab in Safari can. So the app is a worse experience.\r\n\r\nThe workaround of **tapping cancel to the &#39;open this in the YouTube app&#39; prompt then refreshing the tab** does work for me, though.\r\n\r\nIf there is a better way to handle this in iOS 9 or later leave a comment and I can edit this answer to improve it -- or suggest an edit.", "923" ], [ "Yes, of course. There are four main requirements:\r\n\r\n - You&#39;ll need a flight from India to Singapore. That&#39;s easy to find - I did that with Air India in August, and there are a ton of other airlines that do that.\r\n - visa requirements - as mentioned, a visa is not required.\r\n - a flight OUT of Singapore already booked, as they may want evidence that she is actually planning on leaving Singapore.\r\n - a valid passport, which I assume she has, as she&#39;s travelling in India.", "587" ], [ "Yeah, there are a few options, but air travel is still likely to be the cheapest, as it&#39;s a long way to go by ferry. However, for comparison:\r\n\r\n[Hong Kong to Taipei on Rome2Rio](_URL_0_)\r\n\r\nshows options including combinations of bus, train, ferry and flights. It still unfortunately looks like a flight is the likely cheapest option.", "377" ], [ "*I&#39;d guess that the faculty assume the students should be able to solve the most difficult problems in these books, while many students assume they are doing fine if they can solve the average problems, which may be quite a bit easier.* This sounds quite plausible to me. I&#39;ve witnessed this kind of mismatch causing problems from precalculus classes through PhD qualifying exams. I&#39;ve learned to tell my students that problems on my exams will be comparable to the most difficult homework problems, and that the easier homework problems should be thought of as warm-ups.", "197" ], [ "@user568458 Just putting \" ;Travelling \" ; or \" ;accommodation \" ; in the title doesn&#39;t meant it&#39;s valid. For starters, \" ;how can two people survive cheaply... \" ; is really broad - if you follow digital nomads, travel bloggers and even hobos, you&#39;ll realise there are many, many different ways of surviving. It changes in each country, often by season (can&#39;t really camp in Canada in winter easily), and as such I wouldn&#39;t be surprised if it were closed. I&#39;d personally prefer the OP reads the [help], and edits the question to be a bit more specific, with more information about their situation / plans.", "565" ], [ "Voc&#234; criou um m&#233;todo que retorna uma `string`, mas n&#227;o retornou nada. Ent&#227;o causa um erro.\r\n\r\n #include < string > \r\n #include < iostream > \r\n \r\n using std<IP_ADDRESS>string;\r\n using namespace std;\r\n \r\n class Connection {\r\n public:\r\n Connection();\r\n string conexao;\r\n string getConexao();\r\n };\r\n \r\n Connection<IP_ADDRESS>Connection() {\r\n conexao = \" ;sete de setembro \" ;;\r\n }\r\n \r\n string Connection<IP_ADDRESS>getConexao() { \r\n cout < < conexao < < endl;\r\n return conexao;\r\n }\r\n \r\n int main(void) {\r\n \tConnection con;\r\n con.getConexao();\r\n \treturn 0;\r\n }\r\n\r\nVeja [funcionando no ideone][1].\r\n\r\n\r\n [1]: _URL_0_", "147" ], [ "It looks like you&#39;re using Polymer 0.5 syntax, but you&#39;ve probably got Polymer 1.0 installed.\r\n\r\nTry this:\r\n\r\n\r\n < !DOCTYPE html > \r\n < html > \r\n < head > \r\n < meta charset= \" ;utf-8 \" ; > \r\n < title > My First polymer web APP < /title > \r\n < script src= \" ;bower_components/webcomponentsjs/webcomponents.min.js \" ; > < /script > \r\n < link rel= \" ;import \" ; href= \" ;bower_components/polymer/polymer.html \" ; > \r\n < /head > \r\n < body > \r\n < dom-module name= \" ;x-foo \" ; > \r\n < template > \r\n < h1 > HELLO FROM x-foo < /h1 > \r\n < /template > \r\n < script > \r\n window.addEventListener(&#39;WebComponentsReady&#39;, function() {\r\n Polymer({is: &#39;x-foo&#39;});\r\n });\r\n < /script > \r\n < /dom-module > \r\n < x-foo > < /x-foo > \r\n < /body > \r\n < /html > \r\n\r\nThe `window.addEvetnListener` part is only necessary if you&#39;re declaring your element in the main HTML file of your application rather than in an HTML import.", "454" ], [ "You&#39;ll have to get individual users of the various static analysis tools to tell you if they have built-in rules to detect your specific set of circumstances. Some might; you will probably have odd code in your system for whatever reason that such rules won&#39;t detect, and now you need scriptability. I don&#39;t think those tools are very scriptable. None of them will help you actually fix the code.", "726" ], [ "Legally, probably. Sounds iffy, but that&#39;s the state of the law at present - it&#39;s evolving and is &#39;iffy&#39;. A US Appeals Court has determined [that this is protected by First Amendment Rights](_URL_0_), and that:\r\n\r\n \" ;It is clearly established in this circuit that police officers cannot, consistently with the Constitution, prosecute citizens for violating wiretapping laws when they peacefully record a police officer performing his or her official duties in a public area, \" ; the appeals court said. \r\n\r\nThe [ACLU has published Rights for Photographers](_URL_2_) and states that:\r\n\r\n > When in public spaces where you are lawfully present you have the\r\n > right to photograph anything that is in plain view. That includes\r\n > pictures of federal buildings, transportation facilities, and police.\r\n > Such photography is a form of public oversight over the government and\r\n > is important in a free society.\r\n\r\nand in regards to your camera/phone:\r\n\r\n > Police officers may not confiscate or demand to view your digital\r\n > photographs or video without a warrant. The Supreme Court has ruled\r\n > that police may not search your cell phone when they arrest you,\r\n > unless they get a warrant. Although the court did not specifically\r\n > rule on whether law enforcement may search other electronic devices\r\n > such as a standalone camera, the ACLU believes that the constitution\r\n > broadly prevents warrantless searches of your digital data.\r\n\r\nThe Huffington Post has an article - [It&#39;s Perfectly Legal To Film The Cops](_URL_1_) which confirms that it&#39;s legal in all 50 states:\r\n\r\n > “There’s no law anywhere in the United States that prohibits people\r\n > from recording the police on the street, in a park, or any other place\r\n > where the public is generally allowed,” <PERSON> said.\r\n\r\nHowever, conflicting state laws might still find you in hot water - they might go after you with another sneaky rule, for example, from the same article, according to Massachusetts law, citizens are permitted to record police officers in public, but only if the police have been informed that a recording is taking place. You&#39;re more likely to run into problems if your recording interferes with police business, or if you&#39;re being a nuisance.\r\n\r\nSo if in doubt - ask the officers that you&#39;re filming first, and avoid the complications of offense, arrest and trial (if not worse) if possible.", "465" ], [ "(I&#39;m the guy behind DMS). Why do you think these are \" ;oversized \" ;? C++ is an incredibly complex language. If you want to manipulate it mechanically, the mechanism has to somehow handle all the complexity, or it won&#39;t do what you want, or it will do it wrong. How would you propose that a simpler mechanism exist? [PS: DMS allows you to write source-to-source transformation rules and run them in an repeateable order; that&#39;s essentially what you are looking for as \" ;macro recording \" ;]", "711" ], [ "I had to take a suit backpacking to a wedding in Iran this year. I was introduced to the [Skyroll Garment bag](_URL_0_), which I was allowed to use as carry on OR checked luggage on several airlines.\r\n\r\nThe bag unrolls to have my shirt and suit inside, and has pockets on either end for accessories and shoes. Very impressed with it, and there was virtually no creasing after a couple of weeks in the bag!", "798" ], [ "I absolutely agree that using a complex tool has a price, and it is good that you understand that. All other things being equal you want to avoid it. The bottom line question is whether you have a correspondingly difficult problem with sufficient justification. Feel free to explore the alternatives. If your problem involves any explicit code manipulation I doubt will be able to avoid something like DMS, and so what is left is deciding how important it is to implement your vision.", "704" ], [ "Uma das bibliotecas mais conhecidas que faz isso &#233; [Commons.CLI][1]. Com ela &#233; poss&#237;vel tratar argumentos da forma como o AP deseja. Com ela estabelece quais as op&#231;&#245;es poss&#237;vel, o formato e depois processa o que veio pela linha de comando, determinando o que executar. &#201; bem intuitivo e possui boa abstra&#231;&#227;o para se ater ao resultado final e n&#227;o ao mecanismo de leitura dos argumentos.\r\n\r\nExemplo da documenta&#231;&#227;o:\r\n\r\n // create the command line parser\r\n CommandLineParser parser = new DefaultParser();\r\n \r\n // create the Options\r\n Options options = new Options();\r\n options.addOption( \" ;a \" ;, \" ;all \" ;, false, \" ;do not hide entries starting with . \" ; );\r\n options.addOption( \" ;A \" ;, \" ;almost-all \" ;, false, \" ;do not list implied . and .. \" ; );\r\n options.addOption( \" ;b \" ;, \" ;escape \" ;, false, \" ;print octal escapes for nongraphic \" ;\r\n + \" ;characters \" ; );\r\n options.addOption( OptionBuilder.withLongOpt( \" ;block-size \" ; )\r\n .withDescription( \" ;use SIZE-byte blocks \" ; )\r\n .hasArg()\r\n .withArgName( \" ;SIZE \" ;)\r\n .create() );\r\n options.addOption( \" ;B \" ;, \" ;ignore-backups \" ;, false, \" ;do not list implied entried \" ;\r\n + \" ;ending with ~ \" ;);\r\n options.addOption( \" ;c \" ;, false, \" ;with -lt: sort by, and show, ctime (time of last \" ; \r\n + \" ;modification of file status information) with \" ;\r\n + \" ;-l:show ctime and sort by name otherwise: sort \" ;\r\n + \" ;by ctime \" ; );\r\n options.addOption( \" ;C \" ;, false, \" ;list entries by columns \" ; );\r\n \r\n String[] args = new String[]{ \" ;--block-size=10 \" ; };\r\n \r\n try {\r\n // parse the command line arguments\r\n CommandLine line = parser.parse( options, args );\r\n \r\n // validate that block-size has been set\r\n if( line.hasOption( \" ;block-size \" ; ) ) {\r\n // print the value of block-size\r\n System.out.println( line.getOptionValue( \" ;block-size \" ; ) );\r\n }\r\n }\r\n catch( ParseException exp ) {\r\n System.out.println( \" ;Unexpected exception: \" ; + exp.getMessage() );\r\n }\r\n\r\n\r\n\r\n\r\n\r\n [1]: _URL_0_", "351" ], [ "@RoboKaren&#39;s advice is good for many fields, and the basic point that you should know something about the departments you&#39;re applying to certainly applies in mathematics & mdash; you don&#39;t want to, for example, say it&#39;s your dream to study number theory in an application to a department which has no number theorists. However, mathematics is extremely specialized, and incoming PhD students (in the US, at least) are not expected to have a very specific idea of what they will work on. Most likely, you wouldn&#39;t even understand the abstract of your PhD thesis if you were to read it now. This is true even for the exceptional few students who have done truly substantial undergraduate research; typically their PhD research is only very loosely related to it.\r\n\r\nThe implication of this for which schools you should apply to is that you should generally aim for departments which are strong in a broad spectrum of fields. Fortunately, there are lots of them.\r\n\r\n\r\nIt&#39;s good to say *something* about your research interests in general terms, but the admission committee understands that by the time you start on your thesis they may have changed radically (say, from group theory to mathematical biology). If you yourself clearly don&#39;t understand that, it can create the impression that you don&#39;t know some basic things about how the field works. (And of course you don&#39;t; you haven&#39;t even been to graduate school yet! But nevertheless, you don&#39;t want to draw attention to that ignorance unnecessarily.) Bringing up research interests is more important for demonstrating that you&#39;ve been exposed to some substantial mathematics than for indicating why you&#39;re interested in a particular department.\r\n\r\nSo, to finally come to your actual question:\r\n\r\n > I&#39;m applying to math graduate programs at the moment. How important is it to tailor the personal statement to the different departments to which I&#39;m applying?\r\n\r\nUnless you&#39;ve already discussed possible thesis topics with someone in the department & mdash; which is extremely rare in mathematics and not at all expected & mdash; I would say, not much. Mentioning broad categories like \" ;geometric analysis \" ; is sufficient & mdash; again, as long as there actually are geometric analysts on the faculty!\r\n\r\nAll of this is intended as general advice for \" ;typical \" ; prospective PhD students in mathematics in the US (where \" ;typical \" ; includes even most successful applicants to top programs). The exceptional few who have substantial research as undergraduates and want to continue in the same direction presumably have research mentors who can give them advice tailored to their personal situations.", "906" ], [ "Isto resolve de forma mais simples e sem riscos de [condi&#231;&#227;o de corrida][1].\r\n\r\n $comment = trim(strip_tags($_POST[&#39;comment&#39;]));\r\n $insert = \" ;INSERT into tb_comment (id_mark, id_user, comment, up_c, down_c, rate, active) VALUES (:post_id, :idLogged, :comment, 0, 0, :star, NOW()) \" ;;\r\n $result = $conexao- > prepare($insert);\r\n $result- > bindParam(&#39;:post_id&#39;, $post_id, PDO::PARAM_INT);\r\n $result- > bindParam(&#39;:idLogged&#39;, $idLogged, PDO::PARAM_INT);\r\n $result- > bindParam(&#39;:star&#39;, $star, PDO::PARAM_INT);\r\n $result- > bindParam(&#39;:comment&#39;, $comment, PDO::PARAM_STR);\r\n if($result- > execute()){\r\n echo &#39; < div class= \" ;alert alert-success \" ; role= \" ;alert \" ; > \r\n < strong > <PERSON><IP_ADDRESS>PARAM_INT);\r\n $result- > bindParam(&#39;:idLogged&#39;, $idLogged, PDO<IP_ADDRESS>PARAM_INT);\r\n $result- > bindParam(&#39;:star&#39;, $star, PDO<IP_ADDRESS>PARAM_INT);\r\n $result- > bindParam(&#39;:comment&#39;, $comment, PDO<IP_ADDRESS>PARAM_STR);\r\n if($result- > execute()){\r\n echo &#39; < div class= \" ;alert alert-success \" ; role= \" ;alert \" ; > \r\n < strong > Sucesso! < /strong > avalia&#231;&#227;o cadastrada.\r\n < /div > &#39;;\r\n } else {\r\n echo &#39; < div class= \" ;alert alert-danger \" ; > \r\n < strong > Erro ao cadastrar! < /strong > N&#227;o foi poss&#237;vel cadastrar a avalia&#231;&#227;o.\r\n < /div > &#39;;\r\n }\r\n\r\n\r\n [1]: _URL_0_", "147" ], [ "It&#39;s highly recommended you bring gear, not only for yourself, but to leave behind for the local Cubans.\r\n\r\n[_URL_0_](_URL_1_), [PlanetMountain](_URL_2_) and others all pretty much say the following:\r\n\r\n > To sustain the local climbers, please pack extra climbing gear and\r\n > leave it all behind. The Cubans need climbing equipment, as it&#39;s\r\n > impossible to get it locally. The majority of visitors now follow the\r\n > tradition initiated by the first visiting climbers, who left their\r\n > rack, ropes, shoes and harnesses in Cuba. Try it—you will feel very\r\n > gratified. Some suggestions: Most useful are the basics: shoes,\r\n > harnesses, ropes, chalk, pads and packs. However, the single biggest\r\n > need to propel Cuban climbing forward is bolts and hangers.\r\n\r\nSo, basically, don&#39;t assume anything is available, and bring all you need.\r\n\r\nSources above, and also I was in Cuba earlier this year. Incidentally, it&#39;s changing very, very quickly so for future readers, do actually check those sites as the information may update/change soon.", "750" ], [ "[From Australia&#39;s Department of Border and Immigration&#39;s website](_URL_0_):\r\n\r\n > **What if I hold dual or multiple passports when using arrivals\r\n SmartGate?**\r\n > \r\n > **Non-Australian citizens**\r\n > \r\n > If you are a dual passport holder – aged 16 years or older and hold an\r\n > ePassport from an eligible country – you can use arrivals SmartGate.\r\n > At the kiosk, be sure to use the same ePassport you presented when\r\n > checking in to your flight to Australia.\r\n > \r\n > **Australian citizens**\r\n > \r\n > If you are an Australian citizen, you must use your Australian\r\n > passport to enter Australia. If you are aged 16 years or older* and\r\n > hold an Australian ePassport, you can use arrivals SmartGate. At the\r\n > kiosk, be sure to use your Australian ePassport.\r\n > \r\n > *Australian children aged 10 to 15 years (inclusive) can use arrivals SmartGate if they hold an ePassport and are accompanied by a minimum\r\n > of two adults.", "606" ], [ "@RovingRichard guess it depends on the visitors. You get quite a mix of visitors in Cuba at present, from people trying to get in &#39;before America does&#39;, to hippie travellers who want the culture, to medical tourists. I think the best option is to bring everything you might need, unless you can guarantee access to them. Perhaps a climbing message board might help you find others going, and you could distribute the gear requirements between you?", "750" ], [ "I regularly do it. In fact I&#39;m usually alert when booking my seat to try and pick the one most likely to have spare seats around it, for this very purpose!\r\n\r\nThen once aboard, if people sit next to me, I&#39;m eagerly watching the other rows and will totally jump there if possible, provided another passenger doesn&#39;t beat me to it. And yes, I get beaten to it on a regular basis - so it&#39;s a common thing.\r\n\r\nI&#39;ve had air crew tell me as long as I&#39;m buckled in, so I have a seatbelt around me even when lying down, but otherwise never had a problem.", "463" ], [ "Well, you can&#39;t do it **out** of the United Kingdom:\r\n\r\nWe have precedence, where [security in Cardiff airport confiscated a frozen turkey from luggage](_URL_0_), as \" ;perishable goods cannot be transported abroad without permission. \" ;. \r\n\r\nNow this was for an international flight, but within the EU region, so I wouldn&#39;t be surprised if it applied domestically as well. However, as the article itself points out at the end, for unusual items like this, it&#39;s always best to call the airline in advance.", "587" ], [ "I get emailed a lot about this now that I&#39;ve asked this question AND answered a few similar ones, after going to/from Canada too.\r\n\r\n**Conclusion**: You can re-enter on the same ESTA as many times as you want in the two years, provided you meet the other criteria. These include, but are not limited to:\r\n\r\n - a maximum of 90 days in US, Canada, Mexico in a row\r\n - if you&#39;re a resident of Mexico or Canada, the above rule doesn&#39;t matter\r\n - you need a return ticket / ticket out of the US\r\n - you may be subject to several questions about how you plan to support yourself\r\n - you may be asked to provide evidence of your initial accommodation plans\r\n - your passport must still be valid\r\n - if you arrive by land, you might need to apply for a land visa, as the ESTA is for arrival by flights (some exceptions apply, if you did recently fly in less than 90 days ago)", "606" ], [ "The easiest cheap way is BC Ferries, from Tsawwassen or Horseshoe Bay.\r\n\r\nSteps: \r\n\r\n([Tsawwassen ferry][1])\r\n\r\n- Skytrain to Bridgeport station, bus to Tsawwassen ferry.\r\n- Take ferry to Duke Point, Nanaimo.\r\n\r\n([Horseshoe Bay ferry][2])\r\n \r\n - Skytrain (2 zone ticket) from Vancouver airport to Vancouver Central City station.\r\n - Bus to Horseshoe Bay\r\n - Ferry to Departure Bay, Nanaimo\r\n\r\n(source: I&#39;ve been to both Vancouver terminals, and taken the ferry to Nanaimo and back twice, both times from Horseshoe Bay).\r\n\r\nThere are flights (check [_URL_0_][3]) but the ferry will be considerably cheaper.\r\n\r\n\r\n [1]: _URL_3_\r\n [2]: _URL_1_\r\n [3]: http://_URL_0_/", "377" ], [ "[The London Underground and buses will be operating](_URL_1_):\r\n\r\n > On Monday 28 December, Tuesday 29 December, Wednesday 30 December, New\r\n > Year&#39;s Eve **and New Year&#39;s Day, the Tube will run a Saturday service**\r\n > with disruptions to some lines due to planned engineering works, so\r\n > check before travelling. Don&#39;t forget, there&#39;s free travel on New\r\n > Year&#39;s Eve from 11.45pm to 4.30am.\r\n\r\nSo you just need to visit [TFL](_URL_2_), plug in where you&#39;re going from and to Gatwick, and voila, you&#39;ll have the routes.\r\n\r\nFailing that, you could bus, or Easybus (who [claim weaselly that some trains aren&#39;t running, but that they will be!](_URL_0_)).", "377" ], [ "From many, many countries and borders, I find that it&#39;s often just down to the customs officer. \r\n\r\nSometimes they&#39;re incredibly precise, opening to the first spare page and clearly and carefully stamping the page.\r\n\r\nOther times they just open, stamp, and hand it over.\r\n\r\nI&#39;ve got visas on both pages, back to back, facing both directions, in multiple passports.\r\n\r\nMost likely, some just find it easier, but your passport has 25/48/50/100 pages for a reason - all can, and do get used.\r\n\r\n(although some countries require you have x spare pages left, but that&#39;s a different story).\r\n\r\nRelated:\r\n\r\n - _URL_2_\r\n\r\n - _URL_1_\r\n\r\n - _URL_0_", "606" ], [ "It doesn&#39;t make much difference if the name, photo and passport number are still readable - see the following from the [Embassy of India](_URL_2_):\r\n\r\n > Damaged passport is classified further based on the extent of damage,\r\n > i.e.:\r\n > \r\n > - Damaged Passport - Passport number is readable, name is legible and photo is intact\r\n > - Damaged beyond recognition\r\n > \r\n > To apply for duplicate passport in case of lost or damaged passport,\r\n > you need to apply for \" ;Re-issue \" ; of passport.\r\n\r\nTo apply for a re-issue of a passport, like you&#39;ll need to - you follow the same steps as any person getting a new passport. _URL_0_ has [the application page with instructions](_URL_1_) - note that:\r\n\r\n > If you ever held a passport in the past, no matter how much long back\r\n > or at what age, you should choose the Re-Issue category only.", "606" ], [ "<PERSON> well, for example, years ago when my family emigrated, we brought a gun with us on the plane. There was a process for it back then with Singapore airlines, to give it to the pilot, be last on, last off etc. Nowadays that isn&#39;t possible, but if we were emigrating now...so had a real reason for needing to bring it (moving countries!), whether there is still a process for this, just presumably stricter. (For reference, it was a target pistol)", "587" ], [ "We have an actual &#39;route&#39; now from one of the races, thanks to an article in the Telegraph:\r\n\r\n[How to do the Tube Challenge - Here’s how to visit all 270 London Underground stations in a single day](_URL_0_)\r\n\r\nPictures and charts are in the link, but for the route itself:\r\n\r\n > START 6:20am\r\n > \r\n > Chesham – take the Metropolitan line to Amersham, then Watford, then\r\n > North Harrow.\r\n > \r\n > Run 0.7 miles to Rayners Lane.\r\n > \r\n > Rayners Lane - take the Piccadilly line to Ealing Common, then the\r\n > District line to Ealing Broadway, then the Central line to East Acton\r\n > and then to West Ruislip.\r\n > \r\n > Run 0.7 miles to Ickenham. \r\n > \r\n > ckenham - take the Metropolitan line to Uxbridge then Preston Road,\r\n > then Northwick Park.\r\n > \r\n > Run 0.3 miles to Kenton.\r\n > \r\n > Kenton - take the Bakerloo line to Harrow and Wealdstone, then to\r\n > Elephant and Castle. Then take the Northern line to London Bridge, the\r\n > Jubilee line to Southwark and then West Ham, and the District line to\r\n > Upminster and then Tower Hill.\r\n > \r\n > Tower Hill - take the Circle line to Aldgate, then Sloane Square, then\r\n > Victoria. Then take the Victoria line to Brixton, then to Stockwell,\r\n > then the Northern line to Kennington and then Morden.\r\n > \r\n > Run 1.6 miles to Wimbledon. \r\n > \r\n > Wimbledon - take the District line to Kensington (Olympia).\r\n > \r\n > Run 0.9 miles to Shepherd&#39;s Bush.\r\n > \r\n > Shepherd&#39;s Bush - take the Central line to Woodford (via Hainault),\r\n > then to Epping, then to Snaresbrook.\r\n > \r\n > Run 2.2 miles to Walthamstow Central. \r\n > \r\n > Walthamstow Central - take the Victoria line to Warren Street, then\r\n > the Northern line to Goodge Street and then Edgware.\r\n > \r\n > Run 1 mile to Canons Park.\r\n > \r\n > Canons Park - take the Jubilee line to Stanmore, then Baker Street,\r\n > then the Circle line to Moorgate, then the Northern line to High\r\n > Barnet (including a detour to Mill Hill East).\r\n > \r\n > Run 2.3 miles to Cockfosters.\r\n > \r\n > Cockfosters - take the Piccadilly line to South Kensington, then the\r\n > Circle line to Edgware Road, then the District line to Richmond, then\r\n > Acton Town.\r\n > \r\n > Finally, take the Piccadilly Line to Heathrow Terminal 5 (via 4, and\r\n > 1, 2, & 3).\r\n > \r\n > FINISH 11:04pm.", "377" ], [ "What you&#39;re after is [**Low country cuisine**](_URL_0_) - the cooking associated with the area.\r\n\r\n > **Appetizers, soups, and salads**\r\n > \r\n > Benne-Oyster Soup\r\n > Cooter Soup (Turtle Soup)\r\n > She-crab soup\r\n > Sweet Potato & Crab Soup\r\n > Gumbo (Okra Soup)\r\n > Brunswick Stew\r\n > \r\n > **Meat and seafood**\r\n > \r\n > Catfish stew\r\n > Lowcountry Boil\r\n > Country Captain\r\n > Frogmore Stew\r\n > Shrimp and grits\r\n > Shrimp Kedgeree\r\n > Oyster Roast\r\n > Crab cake\r\n > \r\n > **Rice**\r\n > \r\n > Charleston Red Rice\r\n > Perlau or chicken bog\r\n > Salmon and rice\r\n > \r\n > **Sides**\r\n > \r\n > Hoppin&#39; <PERSON>\r\n > Fried Cabbage\r\n > Baked Mac-n-Cheese\r\n\r\nWikipedia goes on to explain that the geography is the main factor in distinguishing the region&#39;s culinary identity from other areas of the South. There&#39;s an abundance of shrimp, fish, crabs, and oysters in the estuary system, and the marshlands of South Carolina are also conducive to growing rice, and that grain has become a major part of the everyday diet over time.", "1002" ], [ "Yes, it&#39;s possible.\r\n\r\nFor example, [Getting To Mexicali](_URL_0_) has a final sentence:\r\n\r\n > While there are taxis that will take you across the border, it is only\r\n > a 5 minute walk and you can catch a taxi on the other side of the\r\n > border.\r\n\r\nSo for most people, doing the walk makes sense, but for you with your stuff, it does appear to be possible.\r\n\r\n[MexicaliMaryann](_URL_1_) also comments on her site:\r\n\r\n > If you take a taxi into Mexicali from the US side of the border, it\r\n > will cost about $60 more.\r\n\r\nindicating once more that it is possible, for a price.", "377" ], [ "It may lead to additional questioning, but provided you have the appropriate visas / right to access in both countries, there&#39;s no theoretical reason you can&#39;t.\r\n\r\nIt&#39;s very common at Victoria Falls, where people hop back and forth between Zimbabwe and Zambia on the bridge at the border crossing for photo opportunities, or to get to the bungy jump in the middle of the bridge.\r\n\r\nI&#39;ve spent less than a couple of hours in Paraguay, and less than that in Brazil twice (getting to a border town there from Argentina).\r\n\r\nI&#39;ve walked across to the US from Canada to get dinner, and then walked back a couple of hours later too (that one raised eyebrows but was fine).\r\n\r\nI&#39;ve also bussed into Mexico merely to fly out to Cuba, and I&#39;ve spent a couple of hours in Lithuania once between flights.\r\n\r\nSo it&#39;s not uncommon, I&#39;ve never had problems, and legally there&#39;s nothing stopping you, unless your reasons for doing so raise concerns with the border guard / officer.", "565" ], [ "Generally it&#39;s advised to carry these items in carry-on, so that they can be inspected, which is why Export Certificates are issued post check-in at immigration.\r\n\r\nOf course, as you mention, you might want to check this luggage item, which makes it tricky to present.\r\n\r\nIn this case, your best bet is to contact the airport and ask them for their Export Certificate, and submit it well in advance of the flight, and ask for where the goods can be inspected at the airport, given that you&#39;re checking in the luggage.\r\n\r\nFor example, Bangalore airport has [instructions for this](_URL_0_), with the Export Certificate form that you fill out, an email to send it to, and phone numbers which you can contact about the process.", "587" ], [ "Pode fazer isto:\r\n\r\n class MinhaClasse {\r\n var $foo = &#39;ola mundo&#39;;\r\n var $bar = &#39;teste para o stack&#39;;\r\n public function index($fn = a)\r\n {\r\n $result = $this- > $fn(); // < -- &#233; isso que eu quero\r\n }\r\n private function a()\r\n {\r\n return $this- > foo;\r\n }\r\n private function b()\r\n {\r\n return $this- > bar;\r\n }\r\n }\r\n $classe = new MinhaClasse();\r\n $classe- > index();\r\n $classe- > index(b);\r\n\r\nVeja [funcionando no ideone][1].\r\n\r\nPrefiro esta forma por n&#227;o ficar usando *strings*, voc&#234; passa o pr&#243;prio s&#237;mbolo da fun&#231;&#227;o.\r\n\r\n\r\n [1]: _URL_0_", "147" ], [ "**Twitter**. Seriously, twitter.\r\n\r\nI&#39;ve not done it a lot, but have had to complain to a few airlines in my time travelling.\r\n\r\n - Phone: they didn&#39;t care, usually, just wanted to end the call.\r\n - Email: sometimes no response, sometimes automated. Sometimes helpful.\r\n - Facebook: I&#39;ve not done this, but friends have had better responses here as it&#39;s also pretty public, and others usually chime in with your complaint.\r\n - Twitter: within hours/minutes, a response to take your query offline/private, and to help deal with it. They do NOT like complaints being aired on twitter, so they try to help ASAP with that outlet.\r\n\r\n(Disclaimer: currently a contractor at an airline)\r\n\r\nedit: \r\n\r\n - twitter - apart from Jetstar, when I tweeted that they were no help and I&#39;d had to buy a ticket with Virgin instead, replied \" ;have a good flight \" ;.", "587" ], [ "Something more for expats but along this line is Expatistan.\r\n\r\nFor example: Comparing [Sydney, Australia to Christchurch, New Zealand](_URL_0_).\r\n\r\nIt looks at thousands of data points submitted by users, and produces stats on transportation, food etc.\r\n\r\nWhile housing may not be that useful to you, it at least gives you a good reference point for the other aspects of existing in that city.", "307" ], [ "It depends. I&#39;ve entered it several times. Inevitably I&#39;m asked about my travel plans, and I explain my trip. Sometimes they&#39;ve asked how and when I&#39;m leaving Canada. Only on two occasions have they asked to see evidence of said trip. \r\n\r\nBut they have asked, and have the right to ask.\r\n\r\nIn addition, many airlines will refuse to carry you to a country (eg Canada) if you don&#39;t have an exit ticket as well.\r\n\r\nSimple solution if you don&#39;t have one yet - buy a refundable plane ticket, or a megabus/greyhound ticket from Vancouver to Seattle or Toronto to Buffalo.", "606" ], [ "According to the documentation:\r\n\r\n > `default-directory` is a variable defined in ‘C source code’. Its value\r\n > is \" ;~/ \" ; Local in buffer \\*scratch\\*; global value is nil\r\n > \r\n > Automatically becomes permanently buffer-local when set. This\r\n > variable is safe as a file local variable if its value satisfies the\r\n > predicate &#39;stringp&#39;.\r\n > \r\n > Documentation: Name of default directory of current buffer. To\r\n > interactively change the default directory, use command ‘cd’.\r\n\r\nSo, the `default-directory` variable, is the \" ;current \" ; directory, for the current buffer. And visiting any file or any directory, changes the `default-directory` for that buffer.\r\n\r\n__EDIT__\r\n\r\nYou can achieve what you want by:\r\n\r\n- adding `(cd \" ;/some/dir/ \" ;)` in yout init file.\r\n\r\n- using a hook: `(add-hook &#39;find-file-hook #&#39;(lambda () (setq default-directory (expand-file-name \" ;/some/dir/ \" ;))))`\r\n\r\n- writing a custom function that will `(cd \" ;/some/dir/ \" ;)` before finding file.", "20" ], [ "I second JeffE&#39;s comment. There are some departments where nobody will even notice whether you&#39;re in town over the summer, because no one else is in their offices either, and as long as you get work done nobody will know or care exactly when you did it. There are other departments where every closed office door will raise eyebrows, no matter how productive you are.", "622" ], [ "Um, yeah, the USA [also decided the whole world was worth a travel alert](_URL_0_), but if you travel, you&#39;ll find for the most part, the world and people in it are safe. State departments and media have to over-hype it, or if something rare does happen people will complain they weren&#39;t warned.\nYes there&#39;s a heightened risk of something happening in Amsterdam compared with normal, but it&#39;s still very low. You&#39;re still more likely to die in a car crash than by terrorism.", "565" ], [ "@AlexanderWoo: I don&#39;t know about Cambridge, but MIT is famous for having many pure mathematicians in its division (not a separate department) of applied mathematics. Of course \" ;applied mathematics \" ; is an ambiguous term, but in my experience, there is very little overlap between people who describe *themselves* as \" ;applied mathematicians \" ; and people who describe themselves as \" ;mathematical physicists \" ;. Also of note: NSF&#39;s Division of Mathematical Sciences has a policy that applications of mathematics to physics do not count as \" ;broader impacts \" ; in mathematics grant proposals.", "76" ], [ "I think this can be objectively answered, hopefully.\r\n\r\nApparently the most photographed building in the southern hemisphere is the Sydney Opera House. Makes sense, pretty popular, scenic location etc.\r\n\r\nHowever, [numerous results on google](_URL_0_) point to the Dunedin Train Station as being the second most photographed.\r\n\r\nI was there years ago, and again this week. It&#39;s...a nice building, but it&#39;s nothing spectacular. Is there a reason I&#39;m missing as to why it&#39;s second? Or is this just a story made up to try and make it more popular?", "464" ], [ "The cost is 2 Malaysian Ringits to get between terminals ([source](_URL_2_)).\r\n\r\nUnfortunately, you can&#39;t buy the transfer tickets [on their website](_URL_0_), like the other journeys, you have to buy at the counter.\r\n\r\nIf you have some left over Singapore money, you could go to a money exchange place and swap it (presumably there&#39;s a minimum), and use the remainder to buy a nasi lemak or a coffee.\r\n\r\nAlternatively, while [their FAQ page](_URL_1_) states that they don&#39;t accept foreign currency, they do accept Visa and Mastercard payments.\r\n\r\nOr ask another tourist to swap some coins, make a friend and buy them coffee in exchange!", "377" ], [ "The standalone < a href= \" ;_URL_0_ Metrics Tool < /a > from my company, Semantic Designs can do this.\r\n\r\nIt provides a variety of metrics at method level, including cyclomatic complexity, as well as roll-up summaries for every \" ;container \" ; above the method (class, file, package, subdirectory).\r\n\r\nA text report is shown < a href= \" ;_URL_1_;. Generally it produces an < a href= \" ;_URL_2_ Report < /a > that can be used with XSLT to provide any format you desire; HTML is pretty easy.\r\n\r\nIt is Windows native, but runs just fine under Wine on Linux, even as a scriptable command.\r\n\r\nSince this is my company, dont take this as a recommendation. I&#39;m just documenting its existence.", "153" ], [ "I went through Uzbekistan, Tajikistan, then flew to Kyrgyzstan instead of doing the rest of the Pamir (I went up the M41 to Khorog) as I ... [ran out of medicine](_URL_0_). Then up to Siberia and across to Mongolia. Highly recommend - Uzbekistan will be the tourist mecca in a few years when people realise just how incredible it is, seriously. And I loved the food in Kyrgyzstan, and you can&#39;t not gape at the mountains in every direction in Tajikistan.", "377" ], [ "Uma forma simples seria esta:\r\n\r\n import java.util.Scanner;\r\n \r\n class Ideone {\r\n public static void main(String[] args) {\r\n \t Scanner sc = new Scanner(_URL_0_);\r\n \t System.out.println( \" ; Tres n&#250;meros: \" ;);\r\n \t int a = sc.nextInt();\r\n \t int b = sc.nextInt();\r\n \t int c = sc.nextInt();\r\n \t int <PERSON> = a;\r\n \t int <PERSON> = a;\r\n \r\n \t if (b > <PERSON>) {\r\n \t \tmaior = b;\r\n \t }\r\n \t if (c > <PERSON>) {\r\n \t \tmaior = c;\r\n \t }\r\n \t if (b < menor) {\r\n \t \tmenor = b;\r\n \t }\r\n \t if (c < menor) {\r\n \t \tmenor = c;\r\n \t }\r\n \t System.out.println( \" ; <PERSON>: \" ; + <PERSON> + \" ; Menor: \" ; + menor);\r\n }\r\n }\r\n\r\nVeja [funcionando no ideone][1].\r\n\r\nObviamente tem outras formas de fazer isto, mas essa &#233; simples.\r\n\r\n [1]: _URL_1_", "147" ], [ "Not yet, and it might never apply - but to keep tabs on it:\r\n\r\n[H.R.158 - Visa Waiver Program Improvement Act of 2015](_URL_0_) - the bill&#39;s current state.\r\n\r\nIt&#39;s passed the house, and has been received by the Senate, but hasn&#39;t been voted on there yet.\r\n\r\n[As many have observed](_URL_1_), let alone tourists to the US, it may create two classes of US citizens, for those who have visited Iran.\r\n\r\nAs a result, it might be ruled unconstitutional, but we&#39;ll see. Stranger things have happened.\r\n\r\nAs a NZ citizen who visited Iran last year, I&#39;m also watching it with interest and alarm.", "606" ], [ "@user102008 please re-read and consider your vote. 1) I didn&#39;t say it hasn&#39;t passed. It&#39;s in progress - if you&#39;d clicked the link, you&#39;d see that too. It might well pass! 2) if you followed the second link, and read what it said, it can actually affect them if they&#39;re dual nationals. I specifically said \" ;let alone tourists to the US... \" ;.", "606" ], [ "Our < a href= \" ;_URL_1_ Software Reengineering Toolkit < /a > with its < a href= \" ;_URL_0_; front end can be used to do this.\r\n\r\nDMS is a general purpose program analysis and transformation tool based on compiler technology. It parses source code based on the front end it is using, to compiler data structures such as ASTs stampled with source location information, symbol tables and control flow graphs. It provides a variety of libraries and DSLs for specifying actions over those compiler data structures, including walking ASTs, pattern matching over ASTs using surface syntax patterns, modifying the ASTs, and finally prettyprinting any modified code back to compilable source form with comments.\r\n\r\nTo handle OP&#39;s task, one would configure DMS to \" ;just \" ; parse the source code (you can skip name resolution and flow analysis for this task) to build ASTs for the files of interest. Then using the line numbers, one could walk the AST looking for nodes that match the line numbers, pick out the function subtree corresponding to the node, and prettyprint just those subtrees to see the entire function definition, or prettyprint just the function signature. Voila.\r\n\r\nAn alternative approach would parse the files and then do name resolution. Traversing the symbol table is easy and provides access to the function signature, and location by virtue of references to the function&#39;s AST.\r\n\r\nIn either case, rather than just printing function names/signatures/bodies, one could use DMS to implement the static analyses of choice.\r\n\r\nDMS has been in use analyzing and transforming large C++ code bases for over a decade.\r\n\r\nI&#39;m the author, so don&#39;t consider this as a recommendation. I&#39;m documenting its existence as a solution.", "363" ], [ "Agreed you don&#39;t want to manipulate source code *text*. The point of the tool I mentioned is that it provides programmatic aspect to the code *structure* (as an AST) and (out of the box) to all the facts you might consider asking in a reflection world *as data structures*. For more exotic questions about the code, they can be implemented as custom analyzers in that framework. Of course, there&#39;s always the question of what do you want to *do* with the answers you get; often it is \" ;modify the behavior of the code \" ;, which can be done by source transformation.", "84" ], [ "Three brief comments: 1) The fact that I know (roughly) what both those theorems say probably means that the intended readers of the paper really don&#39;t need their statements. 2) I find the referee&#39;s suggestion of giving an explicit statement without reference bizarre. More typical practice would be the opposite, in my experience. 3) I would advise the student to follow the referee&#39;s suggestion to leave out explicit statements (assuming my comment #1 is correct). It&#39;s just not important enough an issue to make a big deal out of.", "686" ], [ "1) What exactly do you mean by \" ;resource \" ;? I don&#39;t think you are talking about Java source files. How are the resource elements named, and how are they referenced from the Java code? From each other? 2) A more general solution moves the resources up the source directory tree n=1,2,... steps (if n=depth of resource, you get your picture). 3) If you move several resources up to depth D from different subtrees, named resources may conflict. How do you expect that to be handled?", "473" ], [ "A related issue is that at some institutions, like mine, reference letters for promotion and tenure are supposed to come from people \" ;at arm&#39;s length \" ; from the candidate. My dean, being an experimental particle physicist, often points out that in certain fields, one is forced to be flexible, since virtually everyone familiar with your work is a collaborator.", "906" ], [ "Uma das possibilidades seria adicionar isto ao `web.config`:\r\n\r\n < configuration > \r\n < system.web > \r\n < httpRuntime maxRequestLength= \" ;10000 \" ; / > \r\n < /system.web > \r\n < /configuration > \r\n\r\nTamb&#233;m &#233; poss&#237;vel configurar isso no IIS:\r\n\r\n < system.webServer > \r\n < security > \r\n < requestFiltering > \r\n < requestLimits maxAllowedContentLength= \" ;10000 \" ; / > \r\n < /requestFiltering > \r\n < /security > \r\n < /system.webServer >", "147" ], [ "Trying to clarify your requirements: I think what you are looking for is \" ;side effects of a function F \" ;. One can determine that by inspecting F for its direct side effects (if it stores via a parameter p of type int, arguably any int in the system could be effected) and combining that with the side effects of everything it calls (recursive/fixpoint). Do you effects on sytem resources? e.g., you do an fseek; the position of the file is side effected, yes or no? A variation is \" ;side effects of F in context \" ;; then only the entities pointed to by the parameter p can be effected.", "366" ], [ "Our < a href= \" ;_URL_1_ Software Reengineering Toolkit < /a > with its < a href= \" ;_URL_0_ Front End < /a > could be easily used to do this.\r\n\r\nDMS parses and builds ASTs for a langauge defined to it. The C Front end defines a variety of C dialects to DMS, including C99. The result of applying the C Front end with DMS to a C file (complete with preprocessor directives/expansion, etc.) is an AST with every node stamped as to its grammar rule type, with source file, line, and column.\r\n\r\nGiven such a tree, one can use DMS&#39;s ASTInterface to start at the root, walk over the tree until a node with line number 4 is found. Under the presumption that is inside a function (it may not be), you can easily walk up the tree to a node which is a function declaration, and then down one node to the function id, and then print the string associated with that node.\r\n\r\nThe code to accomplish with DMS looks like:\r\n\r\n (define FindFunctionName\r\n (lambda (function natural [FileName (reference string)] [target_line_number natural])\r\n (local (;; (= [my_tree AST:Node] (C~GCC4:ParserComponent:Parse FileName)\r\n (= [current_node AST:Node] (AST:FindInSubtree my_tree\r\n (lambda (function boolean AST:Node)\r\n (== (AST:GetLineNumber ?) target_line_number)\r\n )lambda )=\r\n );;\r\n (= current_node (AST:FindParent current_node\r\n (lambda (function boolean AST:Node)\r\n (== (AST:GetNodeType ?)\r\n C~GCC4:ParserComponent:TokenNumber:function_declaration)\r\n )lambda )=\r\n (return (AST:GetStringLiteral (AST:GetNthChild current_node 2)) ; id node under function_declaration\r\n )local\r\n\r\nDMS uses a lisp-syntax style parallel programming language named PARLANSE for its metaprogramming language. I think what the above does is pretty clear. I&#39;ve left out all the error checking (although PARLANSE exceptions will do most of it for the programmer) for expository reasons.\r\n\r\nDMS is unique in the sense that you don&#39;t necessarily have to expand all the preprocessor directives to parse the text. The C Front end has one mode in which \" ;well-structured \" ; PP directives are simply parsed and retained in the tree; it can&#39;t handle PP conditional that span C nonterminals. You can still find the function name the same way, but you might have to worry that the identifier found in the function declaration is actually a macro, or might be wrapped in a conditional. The C front has another experimental mode (we think it works but are still checking) in which PP directives can be parsed in spite of arbitrary placement. You still have to worry about PP directives affecting the function name. But these two modes let one manipulate many C programs without having to configure the preprocessor correctly or even at all.\r\n\r\nI&#39;m sure you can configure Clang to do this line number extraction; AFAIK, it can only do this by do full preprocessing. Clang is designed to be used for tasks like this, but mostly only for C and C++.\r\n\r\nYou can probably do this with GCC, but GCC wasn&#39;t designed to be helpful, so the effort to do this is probably a lot more than you&#39;d expect.\r\n\r\nThe EDG front end can parse C, and I&#39;m sure you do something similar with it after expanding the preprocessor declarations.\r\n\r\nI don&#39;t have a lot of experience with the latter 3 although I&#39;ve been tracking their evolution for literally decades.", "884" ], [ "Wwhere in your post is it clear that you mean something other than UML (class diagrams)? Its the only \" ;model \" ; you name explicitly and the other \" ;models \" ; you hint at are all compatible with UML. Your example of a model in your first paragraph implies that models only about data. Yet model really means \" ;abstraction \" ;; you can/should model the beheviour of your system too or you will not be able generate all the code for it. I&#39;ve seen way too many systems of the latter kind.", "26" ], [ "O motivo &#233; simples, uma busca bin&#225;ria, conforme diz a documenta&#231;&#227;o, s&#243; pode ser realizada em uma sequ&#234;ncia de dados previamente classificados. Sem essa condi&#231;&#227;o ser atendida o resultado &#233; determinado como negativo, conforme a documenta&#231;&#227;o. No caso apresentado claramente falta uma classifica&#231;&#227;o.\r\n\r\n > Searches an entire one-dimensional **sorted array** for a specific element, using the IComparable < T > generic interface implemented by each element of the Array and by the specified object.\r\n\r\nRetorno:\r\n\r\n > The index of the specified value in the specified array, if value is found; otherwise, a negative number. If value is not found andvalue is less than one or more elements in array, the negative number returned is the bitwise complement of the index of the first element that is larger than value. If value is not found and value is greater than all elements in array, the negative number returned is the bitwise complement of (the index of the last element plus 1). **If this method is called with a non-sorted array, the return value can be incorrect and a negative number could be returned, even if valueis present in array**.\r\n\r\nSe compensa fazer a classifica&#231;&#227;o antes de fazer a busca vai depender de uma s&#233;rie de fatores, entre eles, quantas vezes precisar&#225; fazer a busca, o tamanho do *array*, recursos dispon&#237;veis, etc.\r\n\r\nEspero que esteja usando a [vers&#227;o gen&#233;rica do m&#233;todo][1].\r\n\r\nMoral da est&#243;ria: antes de usar qualquer coisa, leia a documenta&#231;&#227;o.\r\n\r\n\r\n [1]: _URL_0_", "147" ], [ "I am planning on doing some awfully heavy-handed updates to an old 1.4 store that is in production. The site is not really used for selling anything, but mostly used as an information library for each \" ;product \" ; being sold at a brick and mortar. There are Gift Cards being sold, but these are uncommon and they only sell once every handful of days or so, if this stopped working for a few days, it&#39;s not a big deal.\r\n\r\nI would like to implement a data freeze on the site so that the database gets frozen for (most likely) a day or two while I migrate content/entities/etc over to another server instance. Putting the store in maintenance mode is not desirable, as I still want customers to be able to browse the site/product pages/etc, but I don&#39;t want anyone changing records during migration.\r\n\r\nWhile I suspect some hard-editing of `index.php` will be in order, I&#39;d prefer to not have to edit any application files, and would rather freeze things at a server level.\r\n\r\n**With this in mind, what are some effective strategies for implementing a data freeze necessary for migrating entities?**", "555" ], [ "OP seems to want a tool that produces for each variable, what functions can read it, and what functions can write it.\r\n\r\nThat&#39;s equivalent to a tool that computes, for each function, what variables it might right, and what variables it might write. I&#39;m going to call this information the \" ;side effects \" ; of the function. \r\n\r\nIf you think about this carefully, you&#39;ll realize that you actually want to know what side effects it has in the context of the specific call chain from the root method (if A calls B with an parameter that points to C, but B doesn&#39;t have any direct reference to C, then B might side-effect C in the context of a call from A. If P calls B with a pointer to X, B can&#39;t affect C in the call context of P.\r\n\r\nA more conservative answer provides side effects for all possible call chains back to the root. In the more conservative version, because B can be called from either A or P, and in some call it can modify C, we say the side effects ( \" ;with no call context \" ;) of B are (writes-to) C.\r\n\r\nOur < a href= \" ;_URL_2_ Software Reengineering Toolkit < /a > with its < a href= \" ;_URL_1_ Front End < /a > can compute the side effects with full calling context for a large set of linked C sources.\r\n\r\nUsing the C front end, DMS parses the source code (expanding preprocessor directives with the C front end preprocessor) and builds ASTs for the set of compilation units in question. Each CU is name resolved, and each function than analyzed for control and data flows. The resulting data flows are used to estimate a conservative upper bound on how pointers can be copied by the functions. DMS can then compose the direct calls graph, with the indirect possibly-calls graph, and the local side-effects information and computes a transitive closure. That transitive closure provides the reads and writes analysis for each function as a set of named declarations that *may* be read or *may* be written by the function.\r\n\r\nThis is a fairly complex exercise to set up and run, and it can be expensive to compute for big applications (We ran this on 50,000 functions in a 16 million line C system; it ate 90Gb VM; fortunately, its page behavior was remarkably local and we got by with 16Gb physical).\r\n\r\nAt present, DMS parses C++, and can compute the control flow information, and < a href= \" ;_URL_0_ data flow information and side effects < /a > . We don&#39;t yet collect sufficient interprocedural data flow facts to feed the transitive closure engine. SO DMS cannot do this for C++ yet taking full calling context into account.", "711" ], [ "Maybe I wasn&#39;t clear enough, but the main concern is updates by employees during migration. What I will probably end up doing is just telling people, \" ;don&#39;t make any site changes \" ;, as I am essentially going to be unifying multiple data entry points (old point of sale system and related tools for updating product info) into a single API that I will be moving outside of Magento. \" ;Single source of truth \" ; means that at some point I need to shut off old data storage points, one of which is Magento.", "510" ], [ "Replacing your bed is the safest option, especially if you have a heated bed. Cracks and chips in the glass create an uneven surface for your prints, and can become a safety hazard; additionally, while borosilicate glass is very resistant to thermal shock, it can continue to crack or shatter when subjected to rapid/uneven temperature variations after damage. Borosilicate glass tends to break in large pieces rather than shattering (snap instead of splintering), but it&#39;s still a safety hazard. \r\n\r\nIt sounds like you have the Kickstarter version of the Robo3D R1; the current glass bed on the Robo3D uses magnets to hold the bed in place, so you&#39;d probably need to replace your Y axis rails along with the bed. I would contact Robo3D support to see what options you have available for upgrading the bed and rails through them. \r\n\r\nAside from Robo3D, you have a few options:\r\n - If you plan to continue using the bed, Kapton tape is an effective surface application for general printing. It&#39;s very thin, but provides an effective surface for ABS & PLA adherence, works with heated beds, and is compatible with secondary adherence items (blue masking tape, PVA glue, ABS slurry, etc). Kapton tape can be damaged after several prints, so plan on having several sheets on hand.\r\n - You can replace your current borosilicate glass with a new sheet of borosilicate glass from a secondary source\r\n - Aluminum plates are an effective replacement\r\n - Lexan sheets also make an effective replacement, but I wouldn&#39;t recommend applying heat to them.", "214" ], [ "You specifically state, *and produce a working application without writing code*. OK, you just told KMF doesn&#39;t do that, but you want KMF. It seems your requirements are inconsistent. If you are willing to settle for just \" ;classes \" ; (you mean classes only, or classes plus method signatures?) then it doesn&#39;t seem like KMF offers anything over the dozens of UML modelers out there, so why is KMF special?", "360" ], [ "I&#39;m sure many of you have aging parents; some very hard of hearing, some deaf. Phones and spoken conversations can be difficult or impossible. But voice recognition technology seems to be improving fast.\r\n\r\nI&#39;m looking for one (or perhaps more) applications that:\r\n\r\n* Can convert voice-via-microphone to a text window in near real time\r\n* Is independent of the speaker\r\n* Can run on Android phones or laptop PCs (both would be ideal)\r\n carried by the HoH person\r\n* Are very easy to operate by the HoH user\r\n\r\nIn the interest of broader utility of answers, solutions for Apple devices would be OK to list; my personal interest is for non-Apple devices.\r\n\r\nIt is relatively easy to search the web for \" ;speech to text app for deaf \" ;\r\nand a number of applications come up. They have very few, if any, reviews. I&#39;d prefer to hear from people with personal experience with these. You don&#39;t get many chances to install/try this for an elderly person; they don&#39;t have the expertise, so you the family tech geek have to do it, and if one or two tries fails, they may reject further attempts.\r\n\r\nBonus points if:\r\n\r\n* One can add a directional microphone to allow this to be used in public lecture contexts (this gets us perhaps to hardware recommendations but capability may be important, and maybe there is some need to configure directional microphones)\r\n* It can handle mobile phone calls in and out on an Android phone\r\n\r\nPhones and PCs have Bluetooth capability. I don&#39;t know if this provides\r\nany additional options or choices. \r\n\r\nI don&#39;t care if it is free or paid; I want the best results.\r\n\r\nAny additional thoughts on how to approach this problem may be a bit off topic but much appreciated, by me and others with the same problem.", "153" ], [ "You&#39;re building a source code analyzer, and you need a source code analyzer? ... By library, I assume you mean \" ;jar file \" ;, or do you just mean any source files imported but not part of the project? What if the \" ;project \" ; already includes jar files? I assume that if one library uses another, you want to find and list those, too?", "289" ], [ "It is *always* possible to repair a broken program if you allow a large enough patch. (Joke) Proof: delete all the text in a file, insert \" ;main(){} \" ; and compile. (There have been a few student-compilers constructed over the years that did a better job of agressive-repair-until-compilable as empirical proof points). The hard part is not even fixing the syntax; you still have to get the types right. Still possible. I&#39;ll agree you likely can&#39;t repair a student&#39;s program and have any hope of executing the student&#39;s intent, but you can&#39;t prove that because you don&#39;t know the student&#39;s intent.", "795" ], [ "@JulienLachal People being taught a \" ;different version of English \" ; need to understand that the version they were taught is incorrect! English has rules, and regional differences in spelling shouldn&#39;t account for someone&#39;s lack of proper usage. Changing \" ;will \" ; to \" ;who \" ; is simply not correct no matter what \" ;version \" ; of English you know.", "836" ], [ "&#201; s&#243; criar um contador:\r\n\r\n import java.util.*;\r\n \r\n class InstanciaDe {\r\n \tpublic static void main( String[] args ) {\r\n \t\tint contaF = 0;\r\n \t\tint contaJ = 0;\r\n \t ContaF <PERSON> = new ContaF();\r\n \t ContaJ <PERSON> = new ContaJ();\r\n \t ContaJ <PERSON> = new ContaJ();\r\n \t ArrayList < Conta > lista = new ArrayList < Conta > (); \r\n \t lista.add(Rafael);\r\n \t lista.add(Roberto);\r\n \t lista.add(Carlos);\r\n \t for(int i = 0 ; i < lista.size() ; i++) {\r\n \t if (lista.get(i) instanceof ContaF) {\r\n \t contaF++;\r\n \t } \r\n \t if (lista.get(i) instanceof ContaJ) {\r\n \t contaJ++;\r\n \t }\r\n \t }\r\n \t System.out.println(contaF);\r\n \t System.out.println(contaJ);\r\n \t}\r\n }\r\n class Conta {}\r\n class ContaF extends Conta {}\r\n class ContaJ extends Conta {}\r\n\r\nVeja [funcionando no ideone][1].\r\n\r\n\r\n [1]: _URL_0_", "147" ], [ "I agree that the instructor is almost certainly wrong here. But, absent more details, I&#39;m inclined to give the instructor more benefit of the doubt and guess that they are not so much unreasonable as confused. Some institutions make a very big fuss to instructors about confidentiality of grades (my institution has sent several such almost threatening messages to faculty recently), and an inexperienced instructor may get the mistaken impression that even the students themselves are not allowed to reveal their grades.", "197" ], [ "You said \" ;can not only tell you whether each branch has been executed but also which branches have been executed? \" ; Um, how are these two parts of your question different? If a tool knows whether a specific branch has been executed, it knows the set of all branches that have been executed, trivially by enumerating every branch and asking if it has been executed. Here is a tool that knows exactly what branches have been covered; there&#39;s even a tab to select exactly that list. _URL_0_ Is this what you are looking for?", "753" ], [ "If a tool knows whether a specific branch has been executed, it knows the set of all branches that have been executed, trivially by enumerating every branch and asking if it has been executed. \r\n\r\nHere is a tool (from my company) that knows exactly what branches have been covered; there&#39;s even a tab to select exactly that list. \r\n\r\n_URL_0_\r\n\r\nIt can also produce a list of covered branches, and the associated line numbers for each covered branch.", "753" ], [ "Looks like there&#39;s nothing like detailed documentation for this behavior but a little amount of blackbox testing shows that this behavior is on at all times and can only be suppressed by blocking the connection between the server and the CA infrastructure with a firewall rule. Here&#39;s how it can be done for Azure Web Roles with `osFamily=3` (Windows Server 2012):\r\n\r\n 1. In the .csdef don&#39;t list the intermediate certificate under ` < Certificates > ` element.\r\n 2. Deduce on which IP addresses range the CA infrastructure responds. To do this inspect your certificate and find some AIA or OCSP URI in the certificate properties, then use `ping` to find the IP address.\r\n 3. Create a *network security group* in Azure with a firewall rule allowing inbound connections from any addresses (so that you can access your service and validate SSL functioning) and disallowing outbound connections to the IP range of the CA (that&#39;s the key to the experiment).\r\n 4. Create a *virtual network* in Azure and inside it create a subnet and bind the subnet to the network security group above.\r\n 5. Change you .cscfg by adding a ` < NetworkConfiguration > ` instructing to deploy the service into the previously created virtual network and (the key point) to deploy your web role into the previously created subnet. Set instance count to 1 for easier testing.\r\n\r\nNow you&#39;re ready. Deploy your service and observe third-party tools reporting that the intermediate certificate is not being served. Change the firewall rule to \" ;allow \" ; and *reimage* the role instance - once it restarts the third party tools report that the intermediate is now served. Change the rule to \" ;deny \" ; and *reimage* the instance - the intermediate is no longer served.\r\n\r\nThis blackbox test proves that certificate installation process can make use of CA online infrastructure. If CA online infrastructure is inaccessible then the intermediate certificates will not be fetched online. It&#39;s unclear if it&#39;s part of IIS or part of Windows but that perhaps doesn&#39;t matter.\r\n\r\nThis is why Azure cloud services should always have all the intermediate certificates listed in the .csdef to ensure that they are deployed onto the instance no matter if CA infrastructure is accessible or not at the moment of deployment.", "220" ], [ "I am working on migrating an old 1.4 site. Part of this migration is building a feature that moves tons of product information into a dedicated \" ;product library \" ; module (a custom entity not related to products).\r\n\r\nThe API is pretty restricting in 1.4 as there are a number of calls I can do to pull information, but they each require a handful of SOAP requests for each \" ;product \" ;. This is incredibly slow.\r\n\r\nWhat I am hoping to try (or at least explore to see if it will be worth it) is to instantiate a different instance of Mage.app inside my module&#39;s controller/helper/etc that would connect to the remote store&#39;s database directly so that I would be able to call the collections myself.\r\n\r\nI am thinking it would be something such as:\r\n\r\n < ?php\r\n // inside my local install module&#39;s controller or helper or wherever I decide to place it\r\n $remote = new Mage;\r\n\r\n // Load different local.xml config???\r\n $remote- > setConfig(&#39;...path to custom local.xml?&#39;);\r\n $remote- > setStore(1);\r\n $remote- > getModel(&#39;catalog/product&#39;)- > getCollection();\r\n // Do things with my collection ...\r\n\r\n\r\n**How can I connect to a remote install of Magento using a different configuration from within a local development install?**", "136" ], [ "Yes. Manila, Philippines (so Philippines ) took me under armed guard out of the &#39;transit&#39; zone to identify my bag, and have it manually rechecked, before returning me to the box of &#39;transit&#39; passengers. This happened to every passenger in the box, at 3am. It was a bizarre experience.\r\n\r\nI also had to do it in Madrid, Spain several times before exiting Europe or entering Europe. I suspect it&#39;s the EU border, but anyway, I had to do it during LGW- > MAD- > JNB and JNB- > MAD- > LHR, and LGW- > MAD- > EZE as well.", "587" ], [ "Tourism? I *LOVE* travelling by train, and do so when I have time available - you get to see so much during the day!\r\n\r\nAlso, we can&#39;t run all trains at night, some schedules connect with others, or you have more people who can only travel during the day (shift work), some don&#39;t like sleeping on a train at night - many, many reasons.\r\n\r\nAlso, if a train takes 6 hours to get somewhere, if it goes back immediately, you can get 3-4 runs in during a 24 hour period. If you have to run them all at night, firstly, you reduce the available services, and secondly, might sell out that service every time, while you could have been getting money during the day as well.\r\n\r\nAlso some countries require you pay more for night workers, and unions have various rules about night time work, councils have noise laws about trains running through certain areas at night, and so on.\r\n\r\nLong story short - there are many good reasons, and you should really try a long day time trip - it&#39;s fun!", "377" ], [ "I am simply wondering if there are additional side-effects of turning on Demo Store Mode. Aside from the notice that is displayed on the front and backend, is there any ordering functionality that is disabled as well?\r\n\r\nI&#39;d like to use the demo store notice to add a global message to the site (I will change the wording) and want to make sure this won&#39;t disable some other feature that I am not aware of.", "858" ], [ "There are many pictures online of [train surfing](_URL_0_) - where you ride on top of the train, and it hasn&#39;t always been illegal in some countries (you&#39;d certainly get arrested here in Sydney).\r\n\r\nI&#39;ve found at least [one article](_URL_1_) claiming that it&#39;ll likely get outlawed in India after health and safety has stepped in, but a colleague from India claims it still happens on the older trains in smaller towns - but wouldn&#39;t happen in say, Mumbai.\r\n\r\nIs there somewhere in India where it&#39;s still commonplace (ideally between Goa and Mumbai as I&#39;m headed there, but would accept anywhere as an answer, if evidence is shown)?", "565" ], [ "Create a grid. Treat it like a graph; every neighbor is connected to 4 other neighbors except at the edges and corner. Pick a random cell, Build a spanning tree with this cell as the starting place; when expanding the spanning tree, choose random edges. Place walls on every graph edge not used by the spanning tree. Done.", "108" ], [ "According to [this answer][1] *IIS can use Authority Information Access certificate extension to retrieve missing issuer certificate*.\r\n\r\nHere&#39;s the scenario. There&#39;s an IIS installation with an HTTPs endpoint which has an SSL certificate. Normally the IIS owner must also install all the intermediate certificates into the local \" ;Intermediate Authorities \" ; ( \" ;CA \" ;) store so that when a client connects the server can send all the chain except the root certificate. However IIS owner may forget to install the intermediate certificate. Then according to that answer IIS will use AIA and retrieve the intermediate certificate and continue serving it to all clients.\r\n\r\nLooks like this is the default behavior and I cannot find how it can be changed.\r\n\r\nCan I prohibit IIS from fetching intermediate certificates? Are there any settings for that?\r\n\r\n [1]: _URL_0_", "635" ], [ "@CryptoGuy I want this to have reproducible behavior. The current guess is that it all worked for years even without the intermediate installed because IIS used AIA and retrieved it \" ;for convenience \" ;. Then something happened and IIS no longer could get the intermediate and the clients started failing to validate the site certificate. So I want to disable this \" ;AIA fetch \" ; at least for testing purposes.", "635" ], [ "Generally, whaling on a commercial level is frowned upon, and [mostly banned by 88 member states of the International Whaling Commission][1]. There is a whale sanctuary in the Southern Ocean, and even when Japan or South Korea takes some whales for &#39;scientific&#39; purposes, it&#39;s widely condemned.\r\n\r\nHowever, even Greenpeace, one of the staunchest supporters of anti-whaling movements, was the [first to congratulate an Inuit group recently when they did some traditional whaling again](_URL_1_).\r\n\r\nIndeed, [since 1991, the Inuit have been allowed to hunt under a strict quota](_URL_0_).\r\n\r\nSo while generally you&#39;re unlikely to find legal, publicized hunting trips, if you could - bonding with or contacting an Inuit group and asking to go along with them on one of their traditional hunts may give you an appreciation for their culture, without adding unnecessarily to the death count of whales worldwide.\r\n\r\n\r\n [1]: _URL_2_", "750" ], [ "I noticed that the ***GO*** standard library has some really nice functions for performing AES encryption / decryption in various modes. However, I couldn&#39;t (yet) find anything for Diffie-Hellman key exchange.\r\n\r\nI&#39;m not sure if I should proceed by searching more carefully, switching to a different language with a more extensive crypto library, or trying to implement the key exchange protocol myself.\r\n\r\nThe protocol \" ;seems \" ; implementable:\r\n\r\n* Alice sends $g^a \\mod p$ to <PERSON>\r\n* <PERSON> sends $g^b \\mod p$ to <PERSON>\r\n* We need to choose $g, a, b, p$ appropriately\r\n\r\nBut I&#39;d bet that there are a **lot** of subtleties buried in that \" ;straightforward protocol \" ; (for example, we need some out-of-band mechanism to defend against man in the middle attacks).\r\n\r\nPlus, one of the first lessons of crypto is *don&#39;t implement cryptographic primitives yourself*, and I don&#39;t know if this warrants an exception to that lesson.\r\n\r\nAre developers generally expected to implement Diffie-Hellman key exchange themselves? If so, what are the primitives that I should be using, and where can I find a good reference for some of the subtleties that should be considered?", "260" ], [ "As, presumably, this can change from year to year, and also depend on the types of crime you&#39;re concerned about, it&#39;d be useful to see maps of crime in the various suburbs and neighbourhoods of the city. Therefore:\r\n\r\n - [Crime Baltimore](_URL_1_) - part of SpotCrime, shows where particular crime events and types occurred. Interesting but doesn&#39;t compare suburbs.\r\n\r\n - [Neighbourhood Scout](_URL_0_) shows the various neighbourhoods, indicating crime level by colour. This is probably the easiest view of the most crime-ridden areas, although you&#39;ll need to click through to see and distinguish the types of crimes that occurred.\r\n\r\n -", "307" ], [ "Why should that be the case? A local translation result may be affected by context from far away based on language semantics and desire to produce good code. This costs inference time, and mental design effort to define that inference. Why should a DCG make it \" ;surprisingly easy \" ; to write even *one* translator? (I will grant that Prolog makes it easier to build symbolic computations than a conventional compiler. Regarding DMS: it isn&#39;t conventional; it has a lot of symbolic manipulation machinery built in). Proof of concepts don&#39;t count; real translators count. Details are tough.", "907" ], [ "Your comment was: \r\n\r\n > I just want to point out, for the sake of saving @indigochild some work, that \" ;none of this provides a clear factual answer to the question \" ;.\r\n\r\nGiven that your [response][1] to [indigochild&#39;s comment][2] in your answer was not particularly friendly, I read your comment as snarky and removed it. \r\n\r\nIn any case, comments are ephemeral. Don&#39;t get overly attached to them, they may get removed at any time. Especially if they were posted for any reason other than to ask for clarifications.\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_0_", "936" ], [ "Google Street View [does work in Hyderabad][1], however, only in certain regions.\r\n\r\n[Example near the Central University][2].\r\n\r\nUnfortunately Google tends to have the most extensive version of this technology. OpenStreetMaps doesn&#39;t have the power or scope. Panoramio used to be fantastic for looking at locations, but they&#39;ve closed as well.\r\n\r\nUnfortunately, you&#39;re probably restricted to looking at images on flickr, google maps / images, or other photo sharing services.\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_", "176" ], [ "It seems from the [CDC&#39;s details page on DR](_URL_0_) that their concerns boil (sorry) down to two main issues, both of which you should be ok with if you&#39;ve had your vaccinations - Hep A, and Typhoid. \r\n\r\nIt&#39;s worth noting that the [Australian Smart Traveller website](_URL_1_) has a concern about cholera as well:\r\n\r\n > Cholera and other infectious diseases\r\n > \r\n > Confirmed cholera cases continue to be reported in the Dominican\r\n > Republic. Cholera causes diarrhoea and vomiting and can be fatal if\r\n > left untreated. Correct food hygiene and preparation are essential to\r\n > minimise the risk of contracting cholera. Water-borne, food-borne,\r\n > parasitic and other infectious diseases (including hepatitis,\r\n > filariasis, and leptospirosis) are prevalent, with serious outbreaks\r\n > occurring from time to time.\r\n > \r\n > Drink only bottled or boiled water.\r\n > Avoid ice cubes.\r\n > Avoid uncooked and undercooked food.\r\n > Ensure correct food hygiene and preparation.", "572" ], [ "What you need is a tool that can parse (*real*) C code, compute side effects of functions (and check to see if the parameters are in that list), can modify the parameter lists and regenerate the source code.\r\n\r\nOur < a href= \" ;_URL_1_ Software Reengineering Toolkit < /a > can do all of these tasks. It has < a href= \" ;_URL_2_ C front end < /a > , does control and data flow analysis on C which is used to compute side effects, and can apply < a href= \" ;_URL_0_ transformations < /a > to change the code where necessary.\r\n\r\nOPs solution isn&#39;t off the shelf. Instead one configures DMS to implement that analysis and code changes desired.\r\n\r\nWhether this is cost effective will depend on the size of OP&#39;s code base.", "157" ], [ "Clarendon Campground might be your only option, that I can find.\r\n\r\nFindaCamp literally only shows one within 25km of the city - [Clarendon](_URL_1_). A permit is required, however.\r\n\r\nThere used to be no camping signs up, but from comments on [this list of sites](_URL_0_), these signs have been removed.\r\n\r\nFurther, on [the same australiancaravans page](_URL_0_), locals have listed a bunch of their favourite free camping sites.", "464" ], [ "In my experience at several RyanAir airports, no.\r\n\r\nOften it&#39;s the same staff that arrive, check people in, and then reappear at the gate to board you. It&#39;s all done as part of an operation to have fewer staff costs. So them being there the night before? *Maybe* if there&#39;s another RyanAir flight at the same time. But most airline in my experience also won&#39;t check you in the previous day. I&#39;ve also tried a few times ;)\r\n\r\nPresuming it&#39;s this one, [this link on sleeping in airports may help](_URL_0_) on where you could at least rest your head.", "587" ], [ "Note that an invitation letter is not technically required, but it can almost certainly help. [From the US Embassy website][1]:\r\n\r\n > An invitation is not required and cannot guarantee visa issuance. In\r\n > fact, there are no required documents for tourist/business visa\r\n > applications.\r\n\r\nIt&#39;s more about documenting your reasons for visit, and evidence that you&#39;ll leave in a timely manner, etc.\r\n\r\n > For tourist/business visas, the most commonly applied for visa class,\r\n > applicants must be able to demonstrate to the satisfaction of the\r\n > consular officer that their travel plans fall within the parameters of\r\n > the requested visa class – limited travel for pleasure or business\r\n > (but not employment) of short durations. Applicants must also be able\r\n > to demonstrate that they will depart the United States in a timely\r\n > manner to return to their residence abroad.\r\n > \r\n\r\nAs a result, email or letter won&#39;t matter, it&#39;s not &#39;official&#39; it&#39;s just additional useful documentation. It should contain useful information that can be checked. From [_URL_0_](_URL_1_):\r\n\r\nthe following should be in the letter of invitation.\r\n\r\n > Your letter should include the following information about the person\r\n > being invited:\r\n > \r\n > Complete name.\r\n > Date of birth.\r\n > The person’s address and telephone number.\r\n > Your relationship to the person being invited.\r\n > The purpose of the trip.\r\n > How long the person you are inviting intends to stay in the United States of America.\r\n > Details on accommodation and living expenses.\r\n > The date the person you are inviting intends to leave the USA.\r\n > \r\n > Your letter should also include the following information about the\r\n > person writing the letter:\r\n > \r\n > Complete name.\r\n > Date of birth.\r\n > Address and telephone number in the United States.\r\n > Occupation.\r\n > Your status in the United States\r\n > A photocopy of a document proving your status in the United States.\r\n\r\n\r\n [1]: _URL_2_", "606" ], [ "If you&#39;re eligible for a tourist visa, yes. However, you&#39;ll want to be very clear and upfront, especially if your ancestral visa is in your passport, as [attempting to enter earlier than the date specified *may* cause your visa to be cancelled](_URL_0_).\r\n\r\nI&#39;d recommend having your channel-hopping tickets printed out, evidence of accommodation and make it very clear that you will definitely be leaving before your ancestral visa is due to start, and returning then.", "606" ], [ "From [FlyBE&#39;s requirements][1] (much less strict for Domestic travel):\r\n\r\n > **Children and domestic travel**\r\n > \r\n > Children under the age of 16 do not need to show ID on domestic\r\n > routes. The adult they are travelling with can vouch for the\r\n > infant&#39;s/child&#39;s identification, providing the relevant photo ID is\r\n > shown (by the adult). On International routes a passport will be\r\n > required.\r\n > \r\n > If the child is traveling unaccompanied and aged between 12-16 years,\r\n > they will be required to produce photographic ID.\r\n\r\nSo it seems like they&#39;re register that there was a child travelling with you, but would rely on you for the identification. No other document is required.\r\n\r\nAgain, this is for domestic only.\r\n\r\n [1]: _URL_0_", "606" ], [ "The UAE [doesn&#39;t have an online Blacklist available](_URL_1_).\r\n\r\nHowever, [suggested courses of action include][1]:\r\n\r\n > the quickest course of action is to ask a friend in the UAE to visit a\r\n > police station with a copy of your passport, and ideally a letter of\r\n > authority, to enquire if there are any cases or complaints registered.\r\n > They will not be told details, just if there are any cases on file.\r\n\r\n\r\n [1]: _URL_0_", "606" ], [ "&#201; s&#243; user o `uppercase`:\r\n\r\n #include < iostream > \r\n using namespace std;\r\n \r\n int main(void) {\r\n int n; \r\n cin > > n; \r\n cout < < uppercase < < hex < < n < < endl; \r\n }\r\n\r\nVeja [funcionando no **ideone**][1]. E [no **Coding Ground**][2]. Tamb&#233;m [coloquei no **GitHub** para refer&#234;ncia futura][3].\r\n\r\n[Documenta&#231;&#227;o][4].\r\n\r\n\r\n [1]: _URL_3_\r\n [2]: _URL_2_\r\n [3]: _URL_1_\r\n [4]: _URL_0_", "832" ], [ "Sometimes, but it&#39;ll depend on the airlines.\r\n\r\nFor example on Qantas domestic flights, 737s have 2 toilets at the rear for economy and 1 at the front for business class. It&#39;s announced this way.\r\n\r\nHowever, every flight you observe at least a couple of passengers from economy using the front ones. Sometimes the crew will just ignore it, but it depends on the rule and probably (although I don&#39;t know) on the passenger and how they&#39;re doing it, to some extent. Asking first probably wouldn&#39;t go amiss.", "587" ], [ "@agc No. You went through the trouble of posting a very specific complaint about SE moderators. If there&#39;s anything of substance to this, point me to the right direction and I&#39;ll gladly dig up deleted comments and post them in an answer here. But I&#39;m not going to waste my time looking for comments that \" ;might apply \" ; to your hypothetical. Especially since I very strongly doubt that your hypotethical is anything close to accurate.", "101" ], [ "Short answer (I was born there): Britain won the wars there (eventually). Longer: There were a lot of laws made pushing English (and Afrikaans) as the leading languages, and as such it&#39;s become the language of the day. Historically, the English speaking people had the money too. However, there are IIRC 11 official languages now. Look up wiki articles on Apartheid, Afrikaans, <PERSON> and the Voortrekkers for some history :)", "853" ], [ "@user4012 If it was a big deal, then people would put some actual effort in doublechecking diamond actions, and help us course correct when they spot something they didn&#39;t like. Constructively. All I&#39;ve seen in the years I&#39;ve been around - with only a handful of notable exceptions - is people randomly ranting. It&#39;s extremely hard to take someone seriously when all they seem interested in is venting. Term limits for moderators might be the greatest idea ever; this discussion isn&#39;t how we&#39;ll get them.", "101" ], [ "I do not think the response to your [political theory meta discussion](_URL_0_) was adequate to update the help centre. I&#39;m very much against laundry lists, and I see no value in explicitly mentioning that political theory is on topic, especially since people had no issue asking and answering political theory questions on the site. That said, if you wish I could add a [featured] tag to the discussion and get some fresh eyes on it.", "423" ], [ "There are several &#39;services&#39; you could use to help you get a visa.\r\n\r\nHowever, as a potentially complicated candidate (born in South Africa, NZ citizen, living in Australia, can&#39;t get an ESTA after visiting Iran), applying via [the official Indian government visa website](_URL_0_) was still a reasonably straightforward process.\r\n\r\nUnless you have an exceptional circumstance, or other complication, I&#39;d recommend just applying via the government website.\r\n\r\nThe official site also states:\r\n\r\n > Services of e-Visa involves completely online application for which no\r\n > facilitation is required by any intermediary / agents etc. It is\r\n > advised not to believe or fall in trap of any such unscrupulous\r\n > elements who claim speedy/express grant of e-Visa and charge money for\r\n > it.\r\n\r\nThe visa fee can change, but according to [Wikipedia](_URL_1_) (Policy of India), the latest cost as of June would be around US$80.", "606" ], [ "When I lived in London and did frequent trips to Europe, a friend in a similar position tired of all the landing cards.\r\n\r\nAs a result, he found a copy online, typed in his details as much as they wouldn&#39;t differ from flight to flight, and printed himself out several copies.\r\n\r\nHe continued to use them for years, at various UK airports without a comment, apart from a raised eyebrow or too at the fact he went to the effort of printing them :)\r\n\r\nAs a result, filling out an old one won&#39;t be a problem unless they change them, in which case they&#39;ll more than likely say something along the lines of &#39;oh that&#39;s out of date, not sure where you got it, please fill this one out instead.&#39;.", "587" ], [ "Easily, the best way to tell is often to go to the airport&#39;s website, as indicated in the comments, or to [Sleeping in Airports](_URL_0_) - from this:\r\n\r\n - Foreign nationals are not allowed to remain in the airport for more than three hours, and overnight stays are not allowed (this wouldn&#39;t include transit)\r\n - there are pay per use airport lounges which might be of use to you\r\n - The Safir hotel is directly accessible from the runway and is for transit passengers. This might be the easiest option if you wanted some sleep as well.\r\n\r\nThe airport is also listed as being open 24 hours, so hopefully you&#39;ll be able to at least get a coffee.", "587" ], [ "All trains in Russia for years have operated on Moscow time.\r\n\r\nIt&#39;s only slightly unsettling when you get to your train in Yekaterinburg and find out it&#39;s not there, but the upside is most of Russia is ahead of Moscow in terms of timezones, so worst case you&#39;ll arrive early, rather than late.\r\n\r\nHowever, it now appears that is changing as of August 1, 2018 ([source][1]):\r\n\r\n > Tickets for journeys from 1st August, which can be purchased from 4th\r\n > May, will be printed to display arrival and departure times in local\r\n > times, however, tickets before this date will still show arrival and\r\n > departure times in Moscow time. \r\n > \r\n > Train stations will continue to have clocks that display both Moscow\r\n > and local time for the current time.\r\n\r\n[Seat61 confirms this](_URL_0_):\r\n\r\n > RZD (Russian Railways) has announced that for travel dates from 1\r\n > August onwards it will abandon the long-standing practice of using\r\n > Moscow Time for trains throughout Russia. It will finally switch to\r\n > using local time, with the difference from Moscow Time in brackets,\r\n > for example (MCK +5), in its timetables and on its website. Phew!\r\n\r\nThis is for intercity trains. Local commuter / suburban trains (eg in Novosibirsk, Yekaterinburg) operate on local time.\r\n\r\n [1]: _URL_1_", "377" ], [ "When I was offered a job by the same department where I had earlier gotten my PhD, the department chair told me I needed to have an official transcript sent to the university. My response was, \" ;Really? Even though you gave me the degree, you need me to pay $5 to another office on the same campus to officially tell you that you did it? \" ; The department chair was apparently embarrassed enough by this that he spent weeks jumping through administrative hoops in order to avoid inflicting that trivial inconvenience on me.", "605" ], [ "It&#39;s Melbourne, so fortunately the airport isn&#39;t too big (compared to the separate terminals for Sydney several km from each other).\r\n\r\nIf it&#39;s on the same ticket, no need to worry, Qantas will help you out. You&#39;ll land from Adelaide at Terminal 1 (Qantas), and will need to walk off the plane, out the gates, and across to the International departures. \r\n\r\nIf you&#39;re already checked in from Melbourne, you&#39;ll have a boarding pass already. If not you&#39;ll need to get one.\r\n\r\nThen you go through passport control (3-5 min if you are able to use Smartgate - ie if your passport has a chip), and security (metal detector etc) - 5-10 min. At that point it&#39;s just a matter of walking to your gate - which in a hurry shouldn&#39;t be more than 5-10 minutes.\r\n\r\nIf you&#39;re going to miss it because of a late arrival, speak to the crew on the flight, and they may be able to advise. If it&#39;s on the same ticket, Qantas will help out and rebook you and make sure your luggage doesn&#39;t get misplaced. In theory ;)", "587" ], [ "Depends on the hotel. Many require an official **government-issued** form of identification. So while a lax/kind hotel clerk may let you off with just the student ID, it&#39;s highly likely that they could reject it, and you&#39;d probably have no legal recourse, lose your money (if in their terms) and be without a bed for the night :/\r\n\r\nFor an example, here&#39;s a [random one from a quick google][1]:\r\n\r\n > According to government regulations, a valid Photo ID has to be\r\n > carried by every person above the age of 18 staying at the hotel. The\r\n > identification proofs accepted are Drivers License, Voters Card,\r\n > Passport, Ration Card. Without valid ID the guest will not be allowed\r\n > to check in. Note- PAN Cards will not be accepted as a valid ID card.\r\n\r\nAgain, it&#39;ll depend on the hotel, and sometimes the laws of the country.\r\n\r\n [1]: _URL_0_", "606" ], [ "Certainly most decent hotels could either help you organise one, or let you know where to. \r\n\r\nThe distance is around 200km, and a shared taxi would be a reasonably economical way of doing it.\r\n\r\nPrices vary, but a quick google search for &#39;taxi manali ladakh&#39; is very easy to find a bunch of sites that let you organise them, for example - [_URL_1_](_URL_0_) - they have a phone and email contact details. I suspect, however, that it&#39;d be cheaper to organise once you get there, based on experience travelling in the area and other countries that have shared taxis.", "377" ], [ "We stayed in Oakhurst, just near the Southgate. It was very easy access, had facilities around the area, and is close the the giant redwood grove, as well as easy access to the main Yosemite valley.\r\n\r\nSaw a coyote (alive, finally), and spectacular views in October. Loved our trip, and several of my favourite photos are from that weekend. Highly recommend that area for accommodation. It&#39;s also only a few hours from San Fran - we flew into SFO and drove from downtown San Francisco.", "464" ], [ "Think of check-in as having morphed in meaning a little. Now it&#39;s more like say, committing to the flight, saying \" ;yes I&#39;ll be there, lock it in \" ;.\r\n\r\nSaying that, I&#39;ve checked in for a flight with 45 min to go, and then with 15 min to go, realised I couldn&#39;t travel, and cancelled my check in. It just helps them with numbers.\r\n\r\nAnother factor is loading. Some flights in Australia, for example, might be an overloaded 737, and then they switch in a larger A330. Check in rates if lower than normal, give them an indication that perhaps it won&#39;t be full and a 330 isn&#39;t required. (This is hypothetical, but I&#39;ve seen tails/regos change mere minutes before a flight too)\r\n\r\n*Source - I&#39;ve flown a lot this year for work, contracting at an airline.", "587" ], [ "I was about to message you about reposting that answer. Please do not do that. Three [trusted members](_URL_0_) of the community decided your answer was of extremely low quality. You are free to challenge their decision here on Meta. You are not, however, free to ignore the community and repost your answer. You may find more information in our help center: [How do I write a good answer?](_URL_1_) & [Why and how are some answers deleted?](_URL_2_)", "792" ], [ "Apparently, the most recent data for Syria exposed in [IMF&#39;s World Economic Outlook Database](_URL_1_) is from 2010. For example, see [this query on inflation][1], for all the countries you mention, from 2000 to 2020. The report&#39;s notes on Syria are:\r\n\r\n > Syria: Inflation, average consumer prices (Index)\r\n\r\n > Source: National Statistics Office \r\n > Latest actual data: 2011 \r\n > Harmonized prices: No \r\n > Frequency of source data: Monthly \r\n > Base year: 2000 \r\n > Primary domestic currency: Syrian pound \r\n > Data last updated: 08/2015 \r\n\r\n \r\n\r\n\r\n\r\n [1]: _URL_0_", "980" ], [ "Na linha anterior ao erro est&#225; transformando em *string* vazia se o que encontrar **n&#227;o** for nula, o que n&#227;o faz sentido. Faz todo sentido fazer essa transforma&#231;&#227;o se for nula. Mudando isto resolve o problema. Melhorei algumas coisas, mas acho que d&#225; para melhorar mais. Tem coisa que realmente n&#227;o &#233; ideal, mas pode ser requisito.\r\n\r\n using static System.Console;\r\n \r\n public class Program {\r\n public static void Main(string[] args) {\r\n \t\t var client = new string[7, 7];\r\n \t\t InsertData < ClientHeader > (client);\r\n \t\t InsertData < ClientHeader > (client);\r\n \t\t AlunoLista(client);\r\n \t }\r\n \tstatic int getInsertIndex(string[,] matrix) {\r\n \t\tfor (int j = 0; j < matrix.GetLength(0); j++) if (string.IsNullOrEmpty(matrix[j, 0])) return j;\r\n \t\treturn -1;\r\n \t}\r\n \tprivate static void InsertData < T > (string[,] matrix) {\r\n \t\tint n = getInsertIndex(matrix), id = 1;\r\n \t\tmatrix[n, 0] = (id++).ToString();\r\n \t\tint x = matrix.GetLength(1) - 1;\r\n \t\tmatrix[n, x] = \" ;true \" ;;\r\n \t\tfor (var j = 1; j < matrix.GetLength(1); j++) {\r\n \t\t\tdo {\r\n \t\t\t\tWrite($ \" ;\\nInsert {GetHeader < T > (j)}: \" ;);\r\n \t\t\t\tmatrix[n, j] = ReadLine();\r\n \t\t\t} while (string.IsNullOrEmpty(matrix[n, j]));\r\n \t\t}\r\n \t}\r\n \t\r\n \tprivate static string GetHeader < T > (int i) = > System.Enum.GetName(typeof(T), i);\r\n \t\r\n \tstatic void AlunoLista(string[,] lista)\t{\r\n \t\tvar <PERSON> = new string(&#39;-&#39;, 49);\r\n \t\tint[] <PERSON> = new int[] { 4, 10, 10, 20, 10, 10, 10 };\r\n \t\tfor (int i = 0; i < lista.GetLength(1); i++) {\r\n \t\t\tWriteLine($ \" ;{linha}| \" ;);\r\n \t\t\tfor (int j = 0; j < lista.GetLength(0); j++) {\r\n \t\t\t\tlista[j, i] = lista[j, i] ?? \" ; \" ;; // < ===================== mudei aqui\r\n \t\t\t\tvar espa&#231;o = new string (&#39; &#39;, tamanho[j] - lista[j, i].Length);\r\n \t\t\t\tWrite($ \" ;{lista[j, i]}{espa&#231;o}| \" ;);\r\n \t\t\t}\r\n \t\t\tWriteLine();\r\n \t\t}\r\n \t\tWriteLine(linha);\r\n \t}\r\n enum ClientHeader { Id, Name, Surname, Addres, CodPostal, Telephone, Email, State };\r\n }\r\n\r\nVeja [funcionando no **.NET Fiddle**][1]. E [no **Coding Ground**][2]. Tamb&#233;m [coloquei no **GitHub** para refer&#234;ncia futura][3].\r\n\r\n\r\n [1]: _URL_0_\r\n [2]: _URL_1_\r\n [3]: _URL_2_", "147" ], [ "There&#39;s nothing inherently wrong with the second comment. That, however, doesn&#39;t mean it has to stay around forever. Comments are ephemeral and may be removed at any time, for a variety of reasons. If they&#39;ve outlived their purpose, for example, or even if they&#39;re cluttering the interface, pushing more helpful comments out of the way.\r\n\r\nThe golden rule here is that anything of actual value should be in an answer, not in comments. \r\n\r\n > These moderators argue that Laurel is commenting on a comment, which is in of itself a misuse of comments and therefore should be deleted. Hardy&#39;s incorrect comment will stand however.\r\n\r\nThis sounds outright bizarre. Are you sure that is an accurate representation of what happened? Do you have a reference to the discussion?", "792" ], [ "In most cases, a debate is preferable to outright deletion. \r\n\r\nHowever, that answer is hardly the first time your behaviour has caused concern. In fact, you have posted more than several outright racist comments & posts. The community has tried several times, through comments, Meta, moderator messages and suspensions to help you understand that racism will not be tolerated on this site. To this, you&#39;ve often responded with [racial slurs and personal attacks][2]. At one point, you&#39;ve even had the audacity to add [antisemitic remarks in your profile page][3]. \r\n\r\nIs it really that surprising that people aren&#39;t interested in debating with you anymore? \r\n\r\n\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_0_\r\n [3]: _URL_1_", "734" ], [ "@MathematicsStudent1122 Your answer makes a lot of very strong claims. It does, however, very little to back up those claims. To make matters worse, the little that it does is just a link to a ...controversial source. You have been asked in comments to substantiate the claims in your answer. A random link is not enough. If you insist at using the source, at the very least quote the exact portion of the article that backs up your claim. Also, consider using additional sources. If your points are as uncontroversial and well known as you seem to think, then this should be easy.", "686" ], [ "... However, your example insists that you have union that has an an associated tag variable (you happened to put them both in a single struct) and that accesses to the union must only match the state of the tag variable. How is such a tool supposed to know where the tag variable instance is, for an instance union? How is it supposed to know which states of the tag variable, correspond to which union members? We assume such a tool isn&#39;t going to read your comment line.", "816" ], [ "From [Wikivoyage][1]\r\n\r\n\r\n > It&#39;s a little-known fact that the Vatican has its own train station; it is rarely ever used. Historically, it has been used by the Pope for special travel on Italian rail or to send off papal remains. By special arrangement with the Italy State railway, ordinary people (usually train enthusiasts) can arrange to arrive and leave the Vatican via the Vatican Station. This requires quite some time to arrange and is not remotely cheap.\r\n\r\nConsider me interested. However Wikivoyage is lacking info on *how* to achieve this? Can anyone else provide some information on this?\r\n\r\n [1]: _URL_0_", "377" ], [ "Your account was automatically banned from posting questions. No moderators, far-left or otherwise, were directly involved. This site is a shared resource, asking questions here is a privilege. The system reacted to what it considered to be an abuse of this privilege. \r\n\r\nOf the ten questions you have asked, only three were positively received from the community. The rest were heavily downvoted, closed and deleted: \r\n\r\n- (0) [What are the causes of American political polarization?][1]\r\n- (-7) [Why do many Jews tend to be hypocritical in their support for open borders?][2]\r\n- (-4) [What were the negative effects of the Civil Rights Act, if any?][3]\r\n- (-6) [What would be the logistical implications of using the US military to deport illegal aliens?][4]\r\n- (-9) [Does the influence Mexican nationals have on US politics constitute a form of foreign interference?][5] \r\n- (-6) [Are modern Western countries the most “equal” with respect to ethnicity in human history?][6]\r\n- (-7) [Why aren&#39;t whites in the United States allowed to express their collective political interests?][7]\r\n\r\nI think it&#39;s clear that the community does not welcome your questions. You can, of course, claim that the only reason for this is your politics. If that is what you believe, I won&#39;t try to convince you otherwise. \r\n\r\nIf, on the other hand, you are interested in contributing positively to this site in the future, I invite you to examine your past questions and ask yourself: \r\n\r\n- Are my questions within the [scope defined by the community][8]?\r\n- Are my questions clear and to the point?\r\n- Have I done a good job of documenting my research? \r\n- Have I done a good job supporting any non-trivial claims? \r\n- Is my tone as neutral as possible?\r\n- Was I responsive to feedback and requests for clarification?\r\n\r\n--- \r\n\r\nFurther reading: \r\n\r\n- [What topics can I ask about here?][8]\r\n- [What types of questions should I avoid asking?][9]\r\n- [How do I ask a good question?][10]\r\n- [Why are questions no longer being accepted from my account?][11]\r\n- [Help! I am being oppressed! Why do people keep downvoting my opinions?][12]\r\n- [A full and objective description of good faith?][13]\r\n- [Should we encourage questions to be rewritten in nonpartisan terms?][14]\r\n\r\n--- \r\n\r\nPS. You mention your answers. Although your answers suffer from several issues, they are not relevant to your question ban. At this time you are not blocked from posting answers.\r\n\r\n\r\n [1]: _URL_12_\r\n [2]: _URL_3_\r\n [3]: _URL_4_\r\n [4]: _URL_7_\r\n [5]: _URL_8_\r\n [6]: _URL_10_\r\n [7]: _URL_9_\r\n [8]: _URL_0_\r\n [9]: _URL_11_\r\n [10]: _URL_2_\r\n [11]: _URL_13_\r\n [12]: _URL_5_\r\n [13]: _URL_6_\r\n [14]: _URL_1_", "980" ], [ "Same as anywhere else in the world, in terms of the space-based GPS system and receiving the signals from those satellites.\r\n\r\nThe main difference would be with A-GPS (assisted GPS) which can use wifi networks or cell towers to accelerate the location determination algorithm. The lack of these in the Mongolian desert would presumably slow you down a bit, however as long as you can pick up a few of the satellites&#39; signals, you&#39;ll get it.\r\n\r\nSource: I&#39;ve been to Mongolia and used GPS on my old smartphone.", "398" ], [ "Moderators cannot invalidate votes. This can happen either by an automated process or by a Stack Exchange employee. You may find more details in the [help centre][1]. \r\n\r\nIn this instance, I noticed that you had received an inordinate amount of upvotes from a new-ish account. Investigating further, I found two more accounts that seemed to exist primarily to upvote your posts. Your main account shared IP addresses with all three accounts. You all also shared login times. \r\n\r\nI alerted Stack Exchange, shared what I&#39;ve found and asked them to take a closer look and invalidate any suspicious votes they find. They did and decided to invalidate a number of votes between the four accounts. I&#39;m afraid this is all the information I can share. If you wish to find out more or to challenge my actions and Stack Exchange&#39;s decision to invalidate the votes, feel free to [contact them][2] directly. You may use [this link](_URL_1_) as a reference (the link will only work for people with diamond access to the site).\r\n\r\nAs for your last paragraph, again feel free to contact Stack Exchange directly. They take accusations against moderators very seriously, and I&#39;m sure they&#39;d be very interested to see any evidence of my misconduct you have collected.\r\n\r\nPS. The site has a lot more [active voters][3] than you think.\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_0_\r\n [3]: _URL_3_", "101" ], [ "Para o *array* tem isso:\r\n\r\n Array.IndexOf(array, \" ;Elefante \" ;)\r\n\r\nPara lista &#233;:\r\n\r\n list.IndexOf( \" ;Elefante \" ;)\r\n\r\nExemplo:\r\n\r\n using System;\r\n using static System.Console;\r\n using System.Collections.Generic;\r\n \r\n public class Program {\r\n \tpublic static void Main() {\r\n \t\tvar list = new List < string > () { \" ;Le&#227;o \" ;, \" ;<PERSON> \" ;, \" ;Elefante \" ; };\r\n \t\tvar array = new string[3] { \" ;Le&#227;o \" ;, \" ;<PERSON> \" ;, \" ;<PERSON> \" ; };\r\n \t\tWriteLine(list.IndexOf( \" ;Elefante \" ;));\r\n \t\tWriteLine(Array.IndexOf(array, \" ;Elefante \" ;));\r\n \t}\r\n }\r\n\r\nVeja [funcionando no **.NET Fiddle**][1]. E [no **Coding Ground**][2]. Tamb&#233;m [coloquei no **GitHub** para refer&#234;ncia futura][3].\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_1_\r\n [3]: _URL_0_", "147" ], [ "If the airline is a part of an alliance (as in your first question), there *might* be some recompense in that other alliance partners might still recognise the points. But that&#39;s up to them and their individual terms with you in the ticket.\r\n\r\nAs far as the points themselves - you&#39;ll likely lose them. A prime local example in Australia was Ansett, which went under in 2001, and [even years later people were wringing their hands over their lost points](_URL_0_).\r\n\r\nSimilarly to a coffee shop - many give you a rewards card where the 10th coffee is free. If they went under - no free coffee. This is just on a bigger scale.", "587" ], [ "`syn.sol.sol.sol.sol.` certamente &#233; um dos maiores absurdos que eu j&#225; vi em c&#243;digo e algo me diz que n&#227;o deve parar por a&#237;, mas acho que &#233; isto que deseja:\r\n\r\n var qry = db.User.Join(db.Solicitation, user = > user.UserID, sol = > sol.UserID, (user, sol) = > new { user, sol })\r\n .Join(db.Payments, sol = > sol.sol.SolicitationID, py = > py.SolicitationID, (sol, py) = > new { sol, py })\r\n .Join(db.RefundKM, sol = > sol.sol.sol.SolicitationID, km = > km.SolicitationID, (sol, km) = > new { sol, km })\r\n .Join(db.Refund, sol = > sol.sol.sol.sol.SolicitationID, re = > re.SolicitationID, (sol, re) = > new { sol, re })\r\n .Select(syn = > new {\r\n EmployeeID = syn.sol.sol.sol.user.EmployeeID,\r\n EmployeeStatus = syn.sol.sol.sol.user.EmployeeStatus,\r\n EmployeeFirstName = syn.sol.sol.sol.user.EmployeeFirstName,\r\n Grade = syn.sol.sol.sol.user.Grade,\r\n SolicitationID = syn.sol.sol.sol.sol.SolicitationID,\r\n StatusSolicitation = syn.sol.sol.sol.sol.StatusSolicitation,\r\n DateFinancing = syn.sol.sol.sol.sol.DateFinancing,\r\n Manufacturer = syn.sol.sol.sol.sol.Manufacturer,\r\n Chassi = syn.sol.sol.sol.sol.Chassi,\r\n Model = syn.sol.sol.sol.sol.Model,\r\n ValueProperty = syn.sol.sol.sol.sol.ValueProperty,\r\n ValueGranted = syn.sol.sol.sol.sol.ValueGranted,\r\n PaymentStatus = _URL_1_.PaymentStatus,\r\n ValuePayment = _URL_1_.ValuePayment,\r\n ValueInterest = _URL_1_.ValueInterest,\r\n ValuePayment = _URL_2_.ValuePayment,\r\n ValuePaymentRe = _URL_0_.ValuePayment\r\n });", "147" ], [ "<PERSON> was reportedly laughed at by delegates while addressing the United Nations General Assembly: \r\n\r\n > In one of the more remarkable moments in the history of the annual UN summit, the chamber broke out in spontaneous laughter at <PERSON>’s claim that “in less than two years, my administration has accomplished more than almost any administration in the history of our country”.\r\n\r\n > Clearly taken aback, <PERSON> said: “I didn’t expect that reaction, but that’s OK.”\r\n\r\n > < sub > <PERSON>, J. (2018). <PERSON> urges world to reject globalism in UN speech that draws mocking laughter. Retrieved from _URL_0_;\r\n\r\nI am not entirely familiar with UN protocol, but from what I gather this was rather uncommon and perhaps even a first. Is it? Has something similar ever happen before?", "402" ], [ "Segunda [essa resposta no SO][1]:\r\n\r\n if (!IsAdministrator()) {\r\n // Restart program and run as admin\r\n var exeName = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;\r\n ProcessStartInfo startInfo = new ProcessStartInfo(exeName);\r\n startInfo.Verb = \" ;runas \" ;;\r\n System.Diagnostics.Process.Start(startInfo);\r\n Application.Current.Shutdown();\r\n return;\r\n }\r\n private static bool IsAdministrator() {\r\n WindowsIdentity identity = WindowsIdentity.GetCurrent();\r\n WindowsPrincipal principal = new WindowsPrincipal(identity);\r\n return principal.IsInRole(WindowsBuiltInRole.Administrator);\r\n }\r\n\r\nMas sugeriram [algo <PERSON>] em [outra resposta][3].\r\n\r\n\r\n [1]: _URL_1_\r\n [2]: _URL_2_\r\n [3]: _URL_0_", "147" ], [ "Isso?\r\n\r\n public static string HashedString(string text) {\r\n var sha512 = new SHA512Managed();\r\n byte[] hash = sha512.ComputeHash(Encoding.UTF8.GetBytes(text));\r\n var result = new StringBuilder();\r\n foreach (byte b in hash) result.Append($ \" ;{b:x2} \" ;);\r\n return result.ToString();\r\n }\r\n\r\nVeja [funcionando no **.NET Fiddle**][1]. E [no **Coding Ground**][2]. Tamb&#233;m [coloquei no **GitHub** para refer&#234;ncia futura][3].\r\n\r\nPrecisa dizer que quer em hexadecimal se &#233; isto que deseja. Veja _URL_1_.\r\n\r\n\r\n [1]: _URL_2_\r\n [2]: _URL_3_\r\n [3]: _URL_0_", "147" ], [ "1. Select what you want to change, or `C-x h` to select the whole buffer.\r\n2. Then: `M-x flush-lines RET` followed by `^$ RET` or `^[[:space:]]*$ RET`\r\n\r\n`^[[:space:]]*$` contain the meta-characters:\r\n \r\n- `^` for beginning of string, \r\n- `$` for end of string, \r\n- `[[:space:]]*` zero or more spaces. \r\n\r\nErgo, if the first two meta-characters are next to each other or if there is one or more spaces between them, it must be a blank line. [Source](_URL_1_)\r\n\r\nYou may eventually be interested by [shrink-whitespace](_URL_0_)", "50" ] ]
418
[ 10470, 350, 14098, 18402, 4272, 7283, 15438, 1, 15767, 7622, 476, 1802, 18039, 5122, 6940, 18431, 16834, 3240, 3698, 15519, 9961, 12715, 17945, 710, 16261, 2890, 10074, 18998, 822, 19493, 7655, 7374, 16373, 2355, 11229, 3712, 18040, 18259, 2123, 4068, 1771, 5893, 12222, 6344, 9701, 13623, 8991, 6275, 2198, 11916, 6617, 17554, 16407, 11356, 3134, 10966, 2561, 18001, 17050, 1393, 1801, 9600, 16031, 3984, 3381, 13734, 7810, 18314, 10046, 18224, 8784, 3928, 536, 17356, 18391, 3514, 16489, 19507, 19420, 9023, 14345, 1410, 3953, 17766, 10361, 6912, 13871, 5519, 6396, 15867, 575, 18360, 16944, 8326, 7115, 0, 3603, 7446, 6913, 7875, 9574, 8311, 12331, 1171, 1402, 19621, 620, 9767, 18248, 6230, 3821, 4226, 10879, 9287, 10328, 1145, 19414, 1125, 19251, 4817, 3004, 11465, 12968, 9912, 4578, 16617, 13204, 16504, 3644, 6340, 184, 14416, 9866, 10812, 8856, 850, 15351, 4348, 17346, 8558, 17953, 14114, 14617, 14197, 12856, 18601, 1913, 16309, 16133, 497, 13496, 16691, 12800, 9198, 1873, 1919, 711, 16120, 16979, 12751, 4036, 15768, 18748, 14783, 15226, 6157, 1071, 17831, 5901, 4273, 1772, 14571, 4667, 17463, 19054, 3371, 18376, 15452, 16900, 5918, 16600, 10926, 11633, 19353, 640, 6545, 12447, 10155, 17493, 4544, 2322, 442, 3880, 12234, 8559, 17252, 1056, 9610, 5357, 7350, 9620, 16159, 18915, 11171, 17787, 13183, 1304, 14680, 3299, 15222, 13379, 18557, 1453, 18453, 13523, 16287, 7636, 3426, 13896, 14337, 16152, 15956, 17453, 1908, 15642, 17913, 13390, 16941, 15224, 16466, 12690, 6759, 7621, 17323, 9569, 7679, 12573, 17822, 16089, 9450, 11228, 16679, 6150, 10536, 10562, 18419, 12670, 1318, 2227, 19285, 1964, 16195, 10925, 2229, 9403, 613, 16892, 16508, 11700, 4469, 7097, 5406, 10300, 18474, 18467, 4212, 780, 5635, 5677, 8244, 2816, 7452, 13809, 3733, 9011, 12612, 17155, 10911, 6970, 13184, 3860, 9840, 1324, 10348, 14628, 2, 972, 18293, 19334, 4250, 19500, 16587, 5185, 19177, 11986, 16542, 8175, 18993, 2719, 14886, 8737, 3523, 3282, 17215, 19319, 3971, 657, 16788, 14234, 12463, 7943, 1923, 2514, 2353, 9529, 18353, 14962, 3793, 6580, 4313, 8038, 9444, 6353, 1507, 5752, 9694, 5894, 2458, 5947, 1207, 2404, 12294, 13970, 5889, 2853, 1277, 2006, 5864, 18090, 17684, 18400, 15500, 12742, 12523, 2770, 9233, 1123, 3177, 19239, 2472, 4204, 1035, 14273, 1876, 5162, 18844, 6604, 17941, 14744, 1765, 2262, 8238, 13285, 17278, 16435, 2067, 12158, 19376, 310, 5735, 3257, 13008, 9048, 18626, 8490, 11475, 8988, 471, 18916, 17136, 14028, 6452, 18010, 5322, 19392, 9463, 13087, 14027, 18002, 18411, 5321, 15731, 15617, 12826, 9807, 11134, 17621, 19605, 12283, 6659, 3267, 596, 19079, 2379, 9845, 9547, 7143, 15158, 5307, 2459, 1922, 15457, 7020, 602, 4468, 11573, 11280, 1800, 2297, 1278, 768, 14944, 12223, 10747, 10683, 9131, 2697, 8647, 8704, 785, 9997, 8916, 9621, 1030, 8560, 6635, 3557, 8229, 2055, 17330, 15579, 10148, 12901, 15975, 11177, 3325, 2784, 3662, 3838, 12701, 2711, 6897, 2493, 18197, 17697, 8322, 17065, 2415, 12112, 1670, 19686, 13870, 18026, 13541, 8263, 17391, 9962, 16708, 1933, 8881, 6422, 9938, 16869, 10556, 2782, 5082, 4548, 1767, 14357, 910, 8913, 17709, 948, 4673, 11156, 11125, 18138, 3970, 16012, 9265, 967, 12430, 18978, 5300, 13308, 8754, 5030, 1023, 15870 ]
STX_1010.0
[ [ "Yep, cause that is the way to do it if you want an \" ;official \" ; copy: you order it directly from the publisher. If they don&#39;t have it, probably nobody does (you could try eBay etc but it is unlikely). Caution though, you may have to pick your jaw up off the floor when you see the price they quote you. Otherwise, you find a library that has a subscription, and either photocopy their print copy, or download and print the PDFs.", "177" ], [ "Personally, I don&#39;t think that COPE&#39;s principles are dogma, and I don&#39;t see a problem with consulting a colleague on a limited basis, as in this case. Of course, the whole issue can be avoided by asking the permission of the journal: it is hard to imagine they would say no, because if they did, presumably you would refuse to complete the review, on the basis of insufficient expertise.", "827" ], [ "I disagree with your proposed strategy. The marginal added workload of one additional student is usually negligible, and the average grade for the term is not usually something that reflects well or poorly on a professor to a significant degree. These aren&#39;t usually the main issues.\r\n\r\nI would expect the professor to make the decision by trying to balance the benefits to you of taking the course, versus the negative effects on the other students from having the course be more crowded. Your case will be more compelling if you can show that:\r\n\r\n1. Not being able to take the course would represent a major hardship for you. Something on the level of delaying your graduation. If the only effect is that taking it later is somewhat less convenient, means a fuller schedule, means getting up at 8am, etc, that won&#39;t be compelling.\r\n\r\n2. The fact that you couldn&#39;t register for the course normally is due to circumstances beyond your control, and not a result of inadequate planning on your part.\r\n\r\n3. You are adequately prepared for the course, and are reasonably likely to pass it. Being a \" ;good student \" ; overall means something here, but more to the point is showing that you have done reasonably well in all prerequisite courses. If your preparation is marginal, the professor might think there&#39;s not much point in giving you permission to take a class you would be likely to fail.\r\n\r\nThere isn&#39;t much you can do about the negative effects from crowding; let the professor evaluate that. Don&#39;t make suggestions like \" ;I could skip all the lectures so that there will still be enough seats \" ;. That tends to counteract #3 above.\r\n\r\n**Definitely do not** attempt to bribe the professor with money, favors, etc, in exchange for being allowed to take the class. (This should go without saying, but I have known it to happen.)", "605" ], [ "I disagree with aparente&#39;s suggestion that filing a petition is a good way to get the department to improve. \r\n\r\nGenerally speaking, an instructor has a lot of latitude to determine how grades are determined in their class. You can challenge your grade by a petition, but whoever considers the challenge will be inclined to defer to the instructor&#39;s judgement, unless the grading was blatantly unfair or unreasonable (some universities use the standard \" ;arbitrary and capricious \" ;), such that the grade wasn&#39;t really related to the quality of the students&#39; work. A grading scheme that is just \" ;too harsh \" ; or \" ;too picky \" ; isn&#39;t likely to meet that standard.\r\n\r\nIt also isn&#39;t really a good way to bring the issue to the attention of the department, due to the adversarial nature of such cases. If the grade is upheld, as I suspect it would due to the required standard of proof, people may tend to view it as \" ;the instructor is right and the student is just whining \" ;. It will also focus the attention on you personally, instead of on the fact that this is a general problem affecting many students.\r\n\r\nI would suggest instead that you mention this issue in your course evaluations, and encourage other affected students to do the same. Explain the issue in detail and as objectively as you can, keeping the focus on how this affected the quality of the course, rather than on how it impacted your own grade. If the department cares about teaching quality, this will encourage the instructor to work on this. If they don&#39;t, then there is probably nothing you can do about it in any case.", "605" ], [ "It doesn&#39;t seem too unusual to me, and I don&#39;t think very many people will share your view that it is \" ;immoral \" ;.\r\n\r\nAt least in US universities, the professor has quite wide discretion to determine the grading policy, so long as it is clearly described in the syllabus and applied equally to all students. This seems well within the realm of acceptability. Schemes based on some weighted average of assignments and exams are the most common, but I&#39;ve certainly seen schemes where you have to have a minimum grade on certain components to pass. \r\n\r\nAs far as \" ;legal \" ;, laws tend to avoid micromanaging academic matters, so I would be very surprised if there is any law that would forbid this. University policy is more likely to address it, but again, I&#39;d be surprised if what you describe wasn&#39;t allowed. I don&#39;t think you will have any success trying to fight this at a higher level.\r\n\r\nAs far as it being unfair to students who are poor test takers, bear in mind that in many educational systems, it is common for the course grade to be determined *entirely* by a single exam. Rightly or wrongly, there&#39;s a long history of evaluating students by exams, with the attitude that students who aren&#39;t good at taking tests need to find a way to get better at it. (Accommodations may be made for students whose test-taking difficulties are due to a diagnosed learning disability, but this usually means adjusting the exam conditions rather than de-emphasizing exams in general.)\r\n\r\nYou are certainly free to express your disagreement with this policy, either directly to the professor or in anonymous evaluations, but it may not be possible for her to change it after the course has started. This could be seen as unfair to students who have been setting their priorities accordingly.", "605" ], [ "Some institutions have an honor code whereby students are required to report instances of cheating by other students. Does yours? If so, then at least theoretically, you yourself are liable for punishment if it is ever discovered that you knew and didn&#39;t report. One possible course of action, which at some places would be standard, is to tell this student that she needs to report herself, and that you will if she doesn&#39;t..", "605" ], [ "In many cases, they might think it is clear from the job title. In the US, job titles with the words \" ;Lecturer \" ;, \" ;Instructor \" ;, \" ;Adjunct \" ;, \" ;Visiting \" ;, \" ;Clinical \" ; are almost always non-tenure-track.\r\n\r\nThe job title \" ;Assistant Professor \" ; is *usually* tenure-track, though with some exceptions: \" ;named \" ; assistant professorships like \" ;John Doe Assistant Professor \" ; may be effectively postdocs. But it does not hurt to ask for clarification.\r\n\r\nAs <PERSON> says, talk to someone in the department instead of HR. The HR office is usually not closely involved in a faculty search and isn&#39;t likely to be the best source of information.", "906" ], [ "No, leave it out. \r\n\r\n- It&#39;s redundant, because obviously any paper that claims to solve a major open problem should not be accepted by the community unless it has been carefully checked. You don&#39;t have to tell people that.\r\n\r\n- It&#39;s arrogant, because it&#39;s not up to you to tell experts what to do. They will decide for themselves if the paper has enough merit to be worth their time to check carefully. The vast majority of such papers are actually just garbage, and they do *not* need to be checked by experts.\r\n\r\n- It makes even less sense in a manuscript being submitted for publication. Just by submitting it, you are asking for it to be checked by reviewers; and when it is published, it will have been checked (though the community may still expect further checking before they really believe it).", "827" ], [ "Note that the fact that someone failed to cite a paper containing the same work isn&#39;t inherently plagiarism, unless it can be shown they had read the paper and intentionally passed off its work as their own. It happens all the time that someone rediscovers and publishes previous work without knowing it. They don&#39;t get punished for plagiarism; at most they have to publish an \" ;acknowledgment of priority \" ;. And their claim of innocence would hold all the more weight if your journal was known not to be widely read (because of its cost or any other reason).", "827" ], [ "I&#39;ve read [this question][1], and I have I have been successfully SSHing into raspberry pi from my computer terminal, which are both on the same LAN and connected to router with LAN wire.\r\nBut today, I am getting following message.\r\n\r\n ssh_exchange_identification: read: Connection reset by peer\r\n\r\nRaspberry is set to allow password login as well as SSH key login. It now always says\r\n\r\n Server unexpectedly closed network connection\r\n\r\nWhat can be the problem and how can I solve it?\r\n\r\nFollowing the suggestion, I&#39;ve tried:\r\n\r\n ssh -vv\r\n\r\nAnd I get:\r\n\r\n Olivier@Corsair /usr/bin # ssh -vv pi@<IP_ADDRESS>\r\n OpenSSH_7.3p1, OpenSSL 1.0.2j 26 Sep 2016\r\n debug2: resolving \" ;<IP_ADDRESS> \" ; port 22\r\n debug2: ssh_connect_direct: needpriv 0\r\n debug1: Connecting to <IP_ADDRESS> [<IP_ADDRESS>] port 22.\r\n debug1: Connection established.\r\n debug1: identity file /home/Olivier/.ssh/id_rsa type 1\r\n debug1: key_load_public: No such file or directory\r\n debug1: identity file /home/Olivier/.ssh/id_rsa-cert type -1\r\n debug1: identity file /home/Olivier/.ssh/id_dsa type 2\r\n debug1: key_load_public: No such file or directory\r\n debug1: identity file /home/Olivier/.ssh/id_dsa-cert type -1\r\n debug1: key_load_public: No such file or directory\r\n debug1: identity file /home/Olivier/.ssh/id_ecdsa type -1\r\n debug1: key_load_public: No such file or directory\r\n debug1: identity file /home/Olivier/.ssh/id_ecdsa-cert type -1\r\n debug1: key_load_public: No such file or directory\r\n debug1: identity file /home/Olivier/.ssh/id_ed25519 type -1\r\n debug1: key_load_public: No such file or directory\r\n debug1: identity file /home/Olivier/.ssh/id_ed25519-cert type -1\r\n debug1: Enabling compatibility mode for protocol 2.0\r\n debug1: Local version string SSH-2.0-OpenSSH_7.3\r\n ssh_exchange_identification: read: Connection reset by peer\r\n\r\nIt hangs out a very long time here `debug1: Local version string SSH-2.0-OpenSSH_7.3`. If I try again I get sometimes:\r\n\r\n Olivier@Corsair /usr/bin # ssh -vv pi@<IP_ADDRESS>\r\n OpenSSH_7.3p1, OpenSSL 1.0.2j 26 Sep 2016\r\n debug2: resolving \" ;<IP_ADDRESS> \" ; port 22\r\n debug2: ssh_connect_direct: needpriv 0\r\n debug1: Connecting to <IP_ADDRESS> [<IP_ADDRESS>] port 22.\r\n debug1: connect to address <IP_ADDRESS> port 22: Connection timed out\r\n ssh: connect to host <IP_ADDRESS> port 22: Connection timed out\r\n Olivier@Corsair /usr/bin #\r\n\r\n\r\n [1]: _URL_0_", "53" ], [ "Yes, this is a potential concern, particularly with regard to financial aid.\r\n\r\nUS financial aid sources are commonly restricted to be used only for education that is leading toward a particular degree. You can&#39;t take random courses indefinitely and expect the government to keep paying for it.\r\n\r\nMy institution&#39;s financial policy has the following clause:\r\n\r\n > Only course work that is required for my degree will count towards my enrollment status. Once I complete the requirements for a single degree, even if I haven&#39;t applied for graduation, I am no longer eligible for aid for that program. The fact that I might be getting a dual degree and haven’t completed the requirements for the second degree doesn&#39;t change this. \r\n\r\nSometimes this can be \" ;gamed \" ; by completing the actual degree requirements very slowly while taking lots of other courses in the meantime; but there are likely to be limits in place.\r\n\r\nYou should discuss your plan of study carefully with both an academic advisor and a financial aid officer at the university you plan to attend. (The academic advisor might not be an expert on financial aid details, and vice versa, so it is important to consult both.)", "906" ], [ "(This applies to US universities; not sure if the rest of the world is similar.)\r\n\r\nTextbook decisions are, by default, made by the individual professor teaching the course, based on what they feel is most suitable for the course. They would of course consider how the course fits into the degree program(s) that require it, but there usually isn&#39;t a concerted effort to have consistent textbooks across all courses in a degree program.\r\n\r\nFor \" ;standard \" ; courses that are taught regularly by many different professors, the department may choose to adopt a standard textbook. This decision would typically be made at the department level, led by the professors who teach the course most frequently, with input from others in the department, other departments whose students often take the course, etc. For courses in which a particular piece of software is central, the choice of software might be similarly standardized.\r\n\r\nHigher administration usually has little or no direct role in such decisions.\r\n\r\nSupplemental materials (additional software tools, videos, extra reading, etc) are usually selected by individual professors, and are not usually \" ;standardized \" ; like the main textbook can be.\r\n\r\nBookstores will by default stock all books and other materials that are listed as \" ;required \" ; or \" ;optional \" ; for the course. Everything beyond that is at the discretion of the bookstore manager, based on whether they feel it makes business sense.", "197" ], [ "The way this is usually handled is that you list University Y as your affiliation, and in the acknowledgements of the paper, include a sentence that says something like:\r\n\r\n > Much of this paper was written while the second author was visiting University X; he would like to thank the X Department of Mathematics for their hospitality and support.\r\n\r\nIf you end up doing significant further work on the paper after you start your job at X (e.g. major revisions in response to peer review), then you could list both universities as your affiliation.", "827" ], [ "I think this is a case where math is special - the MathSciNet database is comprehensive and almost universally used. I&#39;ve *always* been able to paste BiBTeX entries directly from it, and use them without any revisions. Journals invariably provide BiBTeX style files that process those entries as the journal prefers - but I think any math journal where you couldn&#39;t paste from MathSciNet would find its authors really annoyed.", "971" ], [ "Note carefully the word *scholarly* in that description. It refers to works whose intended audience is experts in the field, and which either present novel research or interpret existing results in a novel way. Books can fit that description; often they will have been published by an academic publisher and reviewed for academic merit by expert editors or referees, prior to publication. Scholarly books are sometimes called *monographs*, especially in the sciences.\r\n\r\nThe books you mentioned by <PERSON> and <PERSON> are not *scholarly* books. They are intended for a non-expert popular audience, and they don&#39;t present new research or expand the state of the art. The same goes for the online sources you listed; they are newspaper articles or blog posts intended for a popular audience.\r\n\r\nA literature review is how you show that you are familiar with the state of the art. It convinces the reader that they should believe you when you say that your proposed project is feasible, novel, and interesting. You want to show that you are an expert, or are on your way to becoming one. Citing a popular book won&#39;t achieve that; it puts you at the same level as any random person interested in science who can read a bestseller list.", "76" ], [ "Every published paper or thesis in your field will have one - where the authors discuss previous work on the topic. As a random example, the first two paragraphs of _URL_0_. To be very honest, if you have never written or even seen a literature review before, I do not think it will be very possible to draft a successful research proposal for a PhD application, and you may not be well prepared for graduate study. Have you discussed your application with a faculty mentor at your institution?", "827" ], [ "If you&#39;ve checked the paper to the best of your ability, particularly those parts with which you were closely involved, and you have no criticisms or concerns, then just say so. There isn&#39;t any special wording to use - just be clear that you consent to submitting the paper in its current form (it would be unethical for them to submit without your consent).\r\n\r\nFor instance, you could say:\r\n\r\n > I read through the paper and it looks good to me. I think it is fine to submit. Thanks everybody!\r\n\r\nJust don&#39;t delay - it sounds like you&#39;ve made your decision that the paper is okay, and your co-authors will be very frustrated if the submission of the paper is held up while you agonize over how to draft your email.", "827" ], [ "A very rough rule of thumb for US copyright law is that everything published in 1923 or later is protected by copyright. That means you can&#39;t make a copy without the permission of the copyright holder. Making a copy is precisely what you want to do. There are certain \" ;fair use \" ; exceptions, such as for quoting short passages, but they don&#39;t appear to apply here.\r\n\r\nYou&#39;d have to get the permission of the copyright holder; that might be the authors, or their publisher, or some other persons to whom the copyright might have been transferred. They could refuse permission, or demand an arbitrary amount of money; that would be their right.\r\n\r\nA nice general overview of US copyright law is at _URL_0_. It&#39;s a good thing for anyone in the US to become familiar with, especially an academic who is likely to publish copyrighted works. See also _URL_1_ for a discussion of \" ;public domain \" ; which refers to works which are not copyrighted or whose copyright has expired.", "609" ], [ "Yes, as you say, it is common that a university will refuse to issue a diploma or transcripts until you have paid them what you owe.\r\n\r\nHowever, I&#39;ve never heard of them making you take more classes if requirements change in the meantime. Most universities have a policy that what you have to fulfill are the requirements as they were listed in the catalog of the year that you first entered the university / degree program. The university can&#39;t change them retroactively.\r\n\r\nBut you&#39;d better read your university&#39;s policies to be sure. This should be explained in the course catalog.", "605" ], [ "If your paper truly contains \" ;nothing novel \" ; then it should not be published. But I am not really sure what you mean by that. I would ask yourself this question: does this paper contain results that were not previously published in the literature, and that could be of some value, even if slight, to future research? If yes, I think it is worth publishing somewhere, and with your name. Your grades don&#39;t have anything to do with this decision.", "827" ], [ "I am not sure this really answers the question. My impression is that it&#39;s common for US grad school admissions to be conditional on maintaining good grades, without explicitly stating a required minimum; it would be reviewed on a case-by-case basis. So reading the offer won&#39;t resolve the OP&#39;s question. Personally I don&#39;t think OP&#39;s situation would be likely to lead to rescission, but I am not the one making the decision.", "605" ], [ "We cannot know the answer to this as it applies to your department. Talk to the program director again and ask for clarification as to what kind of justification would be acceptable for a waiver. Ask him what should be addressed in a recommendation. You might also be able to talk to other faculty who are on the graduate admission committee. Then talk to one or more faculty members who know you well and ask if they could write you a recommendation on that basis.", "605" ], [ "I think this is one of those things that \" ;you know it when you see it \" ;.\r\n\r\nVery roughly, the distinction in my mind is that a full paper ( \" ;original contribution \" ;) should actually advance the state of the art in a specific, intentional way. A note is more along of the lines of \" ;I noticed this thing, it seems interesting and I think the community might like to know about it too. \" ; Maybe it doesn&#39;t fit neatly into a larger research program, or its implications aren&#39;t immediately clear, but you think it is worth having in the permanent literature.\r\n\r\nAs you&#39;ve observed, an original contribution can be short, if you have made a significant advance that just doesn&#39;t take that much space to write. So the distinction isn&#39;t really about length per se. Notes do tend to be short, mostly because the author may not want to spend a lot of time writing something massive (thus distracting from their real research program), and also because the simplicity or brevity of the result may be part of its appeal. \r\n\r\nI think the distinction becomes more clear with experience. So if you are not sure about your paper, try showing it to someone more senior in your subfield and asking their opinion.", "827" ], [ "> Why are such lists maintained?\r\n\r\nTo recognize and express gratitude to the reviewers, who contribute a substantial amount of their time to review papers, typically without pay or any other direct reward. It might also serve to help readers see that reviewers really are well-known experts in the field (assuming that they are).\r\n\r\n > Does this compromise the anonymity of the peer-review process?\r\n\r\nMaybe a little bit. As you say, it makes it somewhat easier to guess who your reviewer might have been. But the reviewers still have plausible deniability - nobody except the editors has *proof* that any given reviewer worked on any given paper. In small subfields, it is often not too hard to guess who reviewed your paper anyway.\r\n\r\nIt&#39;s a judgment call by the editors to decide whether this risk outweighs the benefits. Some journals decide to do it one way, others the other way.", "827" ], [ "@Thomas: Well, normally there is no reason for anyone to need to verify this, and it&#39;s considered \" ;honor system \" ;. Anyway there are still plenty of journals that don&#39;t publish these lists, so the public doesn&#39;t really expect to be able to verify. In case of a situation where it really does need to be verified, like an internal review at your institution, you can provide the review invitation you received from the editor, with the understanding that it will be kept confidential.", "827" ], [ "It&#39;s not nearly as complicated and formal as it sounds. Usually what it means in practice is you email a copy of the agreement to the other authors and ask if it&#39;s okay with them. If they all say yes, then that is your authorization to sign on their behalf. \r\n\r\nAs <PERSON> says, the publisher doesn&#39;t usually require you to prove that you have the authorization of the other authors; but if you sign without their authorization, you could in principle be sued later.", "609" ], [ "Certainly there would be many benefits to having a TA assigned to assist with your project, and in a perfect world that would be great. The main problem is most likely: **money**.\r\n\r\nTAs need to be paid, and typically a university allocates assistantships based on the number of courses that need to be taught. TAs for independent studies are almost certainly not in the budget.\r\n\r\nYou might argue that the cost would be offset by savings in the professor&#39;s time. Ah, but professors are salaried, and very often they are asked to supervise independent studies on top of their regular teaching and research duties, for no additional pay. So that savings in time may not translate into any savings in money.\r\n\r\nYou can certainly ask a graduate student if they would like to help you, just out of the goodness of their heart, but unless your project is exceptionally interesting, I think they&#39;d likely say no. Grad students have lots of responsibilities that are directly tied to getting paid and staying on track toward finishing their degrees, and your project isn&#39;t one of them.\r\n\r\nIf there is a grad student with particularly relevant expertise, you could ask to have just a single meeting with them. Requests like that are more likely to be accepted, when a limited amount of time is involved. Or, you could offer to pay them by the hour (out of your own pocket), as for private tutoring.\r\n\r\nIn any of these cases, before requesting any kind of help from a grad student, make sure the professor advising you knows and approves. They may give you guidelines on how to make sure your work remains your own, and that your consultation isn&#39;t considered to be cheating.", "605" ], [ "I am on a committee tasked with advising my university&#39;s Information Technology office on institutional needs and issues regarding IT. They are pretty knowledgeable about how to support the university&#39;s general administrative IT requirements (office applications, business IT infrastructure, securing personal data, etc) as well as instructional technology (smart classrooms, learning management systems, etc). But they have less insight into the needs of academic research.\r\n\r\nI try to bring up issues that I face in my own research, but I am only in one discipline (math), and I am sure there are many things I am missing. It would help to be able to anticipate some of these issues, rather than reacting after discovering problems or omissions.\r\n\r\n**What special IT resources or support are commonly needed for academic research?** \r\n\r\nI am looking for issues that are fairly unique to research, that wouldn&#39;t be as commonly encountered in other generic large organizations, or in other university business. (So no need to mention general things like email, wifi, etc.) It needn&#39;t be limited to STEM disciplines, though I imagine they will have the most.\r\n\r\nIt would be especially great if there are lists developed by professional societies or the like; this would be more \" ;authoritative \" ; than general suggestions from the community. Especially if it explains the rationale for the benefit of non-researchers.\r\n\r\nA few that I thought of, to get started:\r\n\r\n- Specific operating systems that might not match the organization&#39;s \" ;standard \" ; OS\r\n\r\n- Installing third-party and open-source software without waiting for administrator intervention\r\n\r\n- Storing and backing up unusually large amounts of data\r\n\r\n- Transferring large amounts of data between institutions, through firewalls\r\n\r\n- Access to a variety of communication and conferencing tools that might not match the organization&#39;s \" ;standard \" ; conferencing solution\r\n\r\n- Remote login access to work computers", "76" ], [ "This is certainly a safe approach, but maybe unnecessarily cautious. If one institute offers you partial funding, I think they would assume the rest is probably coming from some other institution. Typically you sign a form saying you are not being doubly reimbursed and that is the end of it. Of course, you should save the records of your expenditures and reimbursements just in case anyone asks in the future.", "605" ], [ "For graduate programs with this kind of structure, there is usually an expectation that your core courses (algebra and analysis) will be your main focus for the first year. So you should not necessarily expect to have much extra time to spend on other topics during that year, nor will the program be expecting you to do so.\r\n\r\nIf you find that you are able to handle those courses pretty easily and have a significant amount of extra time and energy, then you could consider:\r\n\r\n- studying additional topics on your own\r\n\r\n- enrolling in other courses, if there are some that don&#39;t have the core courses as prerequisite\r\n\r\n- approaching an individual professor in an area of your interest about a reading course or independent study\r\n\r\nBut if not then don&#39;t worry about it. There will be plenty of time after your first year to explore other areas of math, and having a thorough grounding in core areas will make that exploration much more productive.", "644" ], [ "Overriding answer: **ask your advisor**.\r\n\r\nIn expository work like this, what I&#39;ve usually seen done is that you start the section with a note saying something like \" ;The material in this section is primarily drawn from *Handbook of Reticulated Splines* by P. Smith [47]. \" ; After that, you don&#39;t bother to decorate every sentence with \" ;[47] \" ; or \" ;as <PERSON> states \" ;, except where you feel it is particularly important for clarity or the reader&#39;s convenience (e.g. you want to quote Smith&#39;s exact words, or point the reader to something on a specific page of the book, or you want to discuss Smith&#39;s approach in contrast to someone else&#39;s).\r\n\r\nBut again, **ask your advisor** in case they have some other ideas as to how you should handle it.", "541" ], [ "Your experience is rather different from mine (US, math). I&#39;ve never heard of a faculty interview process that involved more than one campus visit per candidate - organizing one is hard enough! And on that one visit, meeting with the dean is nearly universal and doesn&#39;t indicate anything special. One would meet with the provost at a school that is small enough that the provost has many dean-like duties, or if the job is more of a leadership role (e.g. department chair).", "605" ], [ "I&#39;m not sure how postdoc salaries fit in here, since it sounds like the loan will be due before you finish your PhD. Whether you can repay it out of your PhD salary would of course depend on how much money you spend on everything else (which in turn depends on the cost of living where you study, etc). So it&#39;s hard to answer for sure but in any case it sounds like it would be very difficult. Is there any possibility of refinancing the loan after three years?", "906" ], [ "@Supermario: Ah, I misunderstood - I thought you meant you had to *finish* repaying the loan by three years after your bachelor&#39;s. If this gets reopened, or reposted somewhere else, please clarify that in the question. Also, by \" ;refinance \" ; I meant taking out a new loan to pay off the original one - so it wouldn&#39;t be described in the loan documents, it&#39;s more about what other loans might be available in your country.", "512" ], [ "<PERSON> I personally could appreciate your comment more, if <PERSON> was in fact easier to understand. `ls *gif | while read i do` is six different things to teach, as opposed to `for f in *gif; do` being three things to teach. It removes `f=\\`basename $i .gif\\`` which is just unneeded, and adds ` \" ;$f \" ;` _which everyone who uses shells should know_. IDK 5 things is easier to teach then what like 10 things.", "252" ], [ "Not really. You should just grow accustomed to the fact, that English has Germanic roots, and Spanish is part of the Romance languages. There are things which cannot be directly translated word for word.\r\n\r\n > Hey, how are you?\r\n\r\nWould be in a direct translation: \r\n\r\n\r\n > !Ay&#161;, &#191;C&#243;mo est&#225;s?\r\n\r\n > !Ay&#161;, &#191;C&#243;mo est&#225; (Usted)?\r\n\r\nalso contextually correct:\r\n\r\n > !Ay&#161;, &#191;Qu&#233; tal est&#225;s?\r\n\r\n > !Ay&#161;, &#191;Qu&#233; tal est&#225; (Usted)?\r\n\r\n > !Ay&#161;, &#191;Qu&#233; hay de ti?\r\n\r\n > !Ay&#161;, &#191;Qu&#233; hay de Usted?\r\n\r\nand about a dozen more such phrases.\r\n\r\nAnd even more such phrases in the English speaking countries if you take a glance once in a while at *urbandictionary*, or travel or consume global, English media.\r\n\r\n`Hombre` means `man`, transcending more than just one singular contextual usage scenario, just like in English.\r\n\r\nSometimes it is important to keep and guard the cultural idiosyncrasies and sometimes not. At the time of entertainment you might strip them.\r\n\r\nAt the time of certain studies such a translating document for the European Parliament, you may be doing a disservice. As words are power, shape minds, shape people, shape peoples up to the point of shaping cultures. And culture implies social evolution. And the human rights lay out equality for all, and that equality therefore also has to do with our language.\r\n\r\nI hope, you understand what I am trying to say, and that the SE community can forgive my divulgence at the end.", "237" ], [ "Nothing you&#39;ve described sounds like a serious *academic* problem. Taking weeks to understand a paper, and working on a problem for weeks without results, are entirely normal in research mathematics. And there is always a large gap between what you learn in coursework and what you need for research. \r\n\r\nTrying to get better by just working harder or longer can be counterproductive. It is important to spend time on other things, even when you feel like you&#39;re way behind.\r\n\r\nClearly you have some problems with mental health right now. I&#39;m not qualified to advise you on that, but it&#39;s good that you&#39;re getting professional help, and it&#39;s only been 1.5 months - such issues don&#39;t usually get \" ;cured \" ; as quickly as that. Even if it takes time to get better and delays your academic progress, that&#39;s not a major problem. Academia works on very long timescales and several months of low productivity is nothing in the big picture.\r\n\r\nAt the end of the day, maybe you&#39;ll decide you just don&#39;t like doing mathematics research. That&#39;s okay too, there are lots of other things you can do with your life. Math is particularly difficult in this regard, in that math coursework has a very different flavor from doing research (exercises with short elegant solutions, versus long messy problems with awkward solutions that only accomplish half of what you really want). Liking coursework is not necessarily a good indication of the same for research, so a lot of people do leave the field at this stage. Again, there is nothing wrong with that.\r\n\r\nProfessional mathematicians tend to be people who really do enjoy doing mathematics research, and they tend to describe the work in terms that make it sound like it is *inherently* enjoyable and anyone that doesn&#39;t like it must be broken somehow. But that&#39;s not true. If you get better and discover that you enjoy it, great. If not, that&#39;s great too.", "644" ], [ "The expressions H = {a[0] = true, .. , a[n-1] = true} and A[0,..,n-1] don&#39;t make any sense to me. When using a hash function the array must not even be sorted. But algorithms using hash function uses some pseudorandom properties of hash function. In the worst case all items will map to the same hash value and the algorithm is quadratic. I don&#39;t know what are the requirements of the OP.", "569" ], [ "The \" ;catch-22 \" ; you describe seems to be specific to your attempt to \" ;publish \" ; on Wikipedia. And that&#39;s simply because Wikipedia [is not, and was never intended to be, a place to publish original research](_URL_0_). There is nothing stopping you from publicizing your work on your own blog, or on viXra, or anyplace else whose policies permit posting such material. Nor do academic journals have any requirement that your work be \" ;cited \" ;; indeed they will specifically refuse to publish anything that has already appeared in another journal.", "827" ], [ "I am not surprised that the review times would be similar. Review times in math fields tend to be dominated by \" ;how long until the referee gets around to it \" ;, and after that, checking a proof is checking a proof, regardless of the type of result. Sometimes a note will use particularly novel or unusual techniques that might take the referee longer to understand. I think the point here is just that this journal is willing to publish papers of both types (not all journals are) but they want you to tell them which kind yours is to help them evalute it more efficiently.", "827" ], [ "It is certainly fine to ask for clarification of what you were told about the salary and other financial details. Keep in mind that nothing is certain until you have an offer in writing.\r\n\r\nSee _URL_0_ regarding negotiation of postdoc salaries. My guess is that the salary would be negotiable only within a narrow band, if at all. If you get offered the tenure-track job, you shouldn&#39;t expect the postdoc employer to try to match it.\r\n\r\nThe main reason to choose the postdoc over the tenure-track job is if you think that the additional years of full-time research will help you get a better job afterwards, or improve your research success over the long run, and if you think this will compensate you for a couple years of a lower salary. It very well might.\r\n\r\nKeep in mind that a position that \" ;focuses on teaching \" ; will likely have teaching loads that leave you very little time or energy for research, and may also not give you much funding for that research. I think people who take teaching-oriented positions very often overestimate the amount of research they will actually be able to get done.", "906" ], [ "I think this is the most simplest algorithm (with $O(n^3$) time, $n$ length of strings)\r\n\r\nLoop through `string1` and `string2`, for every character check how often it can be found in `string1` and `string2`. I a character is more often in one string than in the other one, it is not a permutation. If the frequencies of all characters are equal then the strings are permutations of each other.\r\n\r\nHere is a piece of python to make this precise\r\n\r\n s1= \" ;abcaba \" ;\r\n s2= \" ;aadbba \" ;\r\n\r\n def check_if_permutations(string1, string2):\r\n for string in [string1, string2]:\r\n # string references string1 \r\n # string2, it is not a copy\r\n for char in string:\r\n count1=0\r\n for char1 in string1:\r\n if char==char1:\r\n count1+=1\r\n count2=0\r\n for char2 in string2:\r\n if char==char2:\r\n count2+=1\r\n if count1!=count2:\r\n print(&#39;unbalanced character&#39;,char)\r\n return()\r\n print ( \" ;permutations \" ;)\r\n return()\r\n \r\n check_if_permutations(s1,s2)\r\n\r\nThe program needs some pointers to strings (`string`, `string1`, `string2`, `char`, `char1`, `char2`) and variables of size $O(\\log n)$ for counting (`count1`, `count2`). It needs to check if characters are equal or not but it dows not need any order on these characters. Maybe it needs some variables for small integers (e.g. to hold boolean values or to represent the postition of `string` in `[string1, string2]`.\r\n\r\nOf course you don&#39;t even need the count variables but can use pointers.\r\n\r\n s1= \" ;abcaba \" ;\r\n s2= \" ;aadbba \" ;\r\n\r\n def check_if_permutations(string1, string2):\r\n for string in [string1, string2]:\r\n # string references one of string1 \r\n # or string2, it is not a copy\r\n for char in string:\r\n # p1 and p2 should be views as pointers\r\n p1=0\r\n p2=0\r\n while (p1 < len(string1)) and (p2 < len(string2)):\r\n # p1 > =len(string1): p1 points to beyond end of string\r\n while (p1 < len(string1)) and (string1[p1]!=char) :\r\n p1+=1\r\n while(p2 < len(string2)) and (string2[p2]!=char):\r\n p2+=1\r\n if (p1 < len(string1)) != (p2 < len(string2)):\r\n print(&#39;unbalanced character&#39;,char)\r\n return()\r\n p1+=1\r\n p2+=1\r\n print ( \" ;permutations \" ;)\r\n return()\r\n\r\n check_if_permutations(s1,s2)\r\n\r\nThis second program needs similar variables as the first one except that it does not need the $O(\\log(n))$-size variables for holding the count values.\r\n\r\nSo it actually does not depend of $n$ or the size of the alphabet.", "615" ], [ "Personally, I don&#39;t think it&#39;s even meaningful to speak of \" ;deserving \" ; admission to a college or the like; it&#39;s not a prize or reward. The college just tries to decide which students to admit based on their judgment of what will be most beneficial to the college (and maybe to the student). If they decide \" ;wrong \" ; it&#39;s on them, not you. Conversely, you make your decision as to which offer to accept based on what you think is most beneficial to **you**.", "605" ], [ "This sentence is said when someone achieves a great success and the other person is giving compliment or credit for the effort which led to that person&#39;s success.\r\n\r\nHere&#39;s a scenario.\r\n\r\nPerson A wasn&#39;t born with a singing talent. Person B was born with an amazing singing talent. Both Person A and Person B participated in a singing contest.\r\n\r\nPerson A practiced hard everyday because he knows he doesn&#39;t have much talent to win in that competition.\r\nPerson B didn&#39;t practice much as he trusted his natural-born talent and was sure he would win in that competition.\r\n\r\nIn the end, Person A won the award for Best Singing Talent from the singing contest instead of Person B.\r\n\r\nIn this case, Person B says to Person A with admiration :\r\n\r\n > \" ;I must follow the example of your (hard) effort \" ;\r\n\r\n > 나는 네가 노력한 것을 닮아야만 한다.", "536" ], [ "I would say it&#39;s certainly inconsiderate, but I don&#39;t know if I&#39;d go so far as to say \" ;unethical \" ;, as long as you are credited in the talk itself.\r\n\r\nRather than telling your coauthor it&#39;s \" ;unacceptable \" ; to leave it out, he would be able to save face if you treat it as a simple oversight, whether or not you really believe that it is. (Even careful people make mistakes, and I am always in favor of applying [Hanlon&#39;s razor](_URL_0_).)\r\n\r\n > Hey, I saw your abstract for conference XXX. It looks like a very nice venue to discuss our work. One thing: it looks from the other abstracts like this conference follows the usual convention of mentioning coauthors in the abstract ( \" ;this is joint work with... \" ;) and it looks like this is missing from yours. If it isn&#39;t too much trouble, would you still be able to add it? I would really appreciate it.", "827" ], [ "You might be overthinking this. Not every part of an interview is carefully designed for a particular effect. None of the academics I know think that deeply about such things. It could be as simple as the room that was available and where its furniture happened to be set up. Anyway, we can certainly give speculation and opinions, but without reading minds, we can&#39;t know what your particular interviewers intended, or if they intended anything at all.", "304" ], [ "Part of the issue is that there are a few different things called \" ;liberal arts \" ;. The term can refer to a set of fields of study (humanities, social sciences, etc) though the composition of this set is not really well defined. It also shows up in the phrase *liberal arts college* (LAC) which is a particular model for an institution of higher education, usually a small private institution. Despite the names, which are more historical than anything, it is no longer necessarily true that LACs focus mainly on studies in the \" ;liberal arts \" ;...", "76" ], [ "The last paragraph is a little confusingly worded. At some institutions (not all), you may by default have a legal right to view the letter (often this requires a formal written request that takes a long time to process). But you can permanently waive this right, and if you do then you will not be allowed to see the letters even if you later change your mind. And many professors may refuse to write the letter unless you do waive this right.", "605" ], [ "Don&#39;t do it. A statement of purpose is an opportunity to demonstrate your formal writing abilities. Jokes like this make it sound like you are not taking the application seriously. (And I don&#39;t really think this one is funny, anyway.)\r\n\r\nAlso, be concise and to the point. I don&#39;t see how the name of the town where you moved, nor the number of miles between it and your university, has any relevance to your application - people who are reading large numbers of such statements really don&#39;t want to spend time on unnecessary text. Stick to information about what you have accomplished and how you believe it is relevant to your preparation for graduate study.\r\n\r\nYou can certainly highlight the fact that you graduated from this university, and perhaps mention any particular aspects of it that make it a good fit for you. But you can do that in a serious and professional tone.", "605" ], [ "Nothing is ever 100%. Trying to parse minuscule details to make guesses about your chances is pointless and will only stress you out. You&#39;ve submitted your application so your role in this process is done for now. Set it aside and spend your time and mental energies thinking about something more productive. Wait patiently for the result, and deal with it when it comes.", "304" ], [ "I think it depends on what kind of \" ;depth \" ; you are talking about.\r\n\r\nYou&#39;ll certainly want to learn at least one of those systems, to a level of competence that allows you to produce documents that are of comparable quality to your field&#39;s standards, and that meet the specifications that journals in your field require.\r\n\r\nThis does not necessarily require \" ;mastery \" ;, just comfort with basic features. Indeed, knowing too much about the system and how to tune it to create very specific and/or unusual effects is probably not helpful. It&#39;s much more important to be *standard* than to be fancy. When very specific formatting or effects are required, journals will often either provide templates and/or style files, or simply do their own formatting.\r\n\r\nSome features of these applications are not so much aimed at producing particular effects, but at making it more convenient for you to use them (e.g. citation managers, packages for formatting particular kinds of diagrams, etc). These are things you can pick up to the extent you find they are helpful.", "827" ], [ "This \" ;answer \" ; is really speculation - if you truly want to know their motivations, you have to ask them.\r\n\r\nBut I think the simplest and most likely explanation is that they don&#39;t consciously believe they will need that many DOIs; they just had to pick some format, and arbitrarily chose a number of digits that seemed more than adequate (as well as perhaps allowing for DOIs to be assigned in some other way than just serially; e.g. someday the DOI could identify volume, year, page number, etc). \r\n\r\nThey probably didn&#39;t even think about people needing to transcribe them by hand - and to be fair, in this age of electronic distribution and copy/paste, it&#39;s a pretty rare use case.", "754" ], [ "Perhaps you should consider not trying to do all the problem sets.\r\n\r\nIf you only spent, say, 20 hours on each problem set, what would the consequences be? Maybe you could still complete 75% of the problems, and skip the most difficult or time-consuming ones. And maybe you&#39;d still learn the material almost as well.\r\n\r\nIt sounds like you&#39;re not terribly concerned about the material in this class with regard to your research (though I would get a second opinion from your advisor on that - there could be connections that you simply don&#39;t know about). If so, then your motivation for taking the class is just because it&#39;s required. So try to estimate the minimum amount of work needed to pass the class, and make sure you&#39;re doing at least that much; but perhaps it&#39;s not worth it to push for a perfect grade.\r\n\r\nIn many graduate classes, one could skip a large fraction of the coursework and still get a grade of B. People will know you didn&#39;t do a great job in the class, but it won&#39;t get you kicked out of the program. And unlike the situation in undergrad programs, where every GPA point can seem critical in the race for grad school or a good job, in many contexts graduate GPA means practically nothing. People will look at your thesis, your papers, your advisor&#39;s opinion of your work - but your transcript gets only a cursory glance.\r\n\r\nGiven the difficult circumstances and the lack of other good options, I think this might be worth seriously considering. Of course you will have to set aside your \" ;machismo and refusal to fail \" ; - but these traits, taken to an extreme, can be a serious **detriment** to success in grad school, academic life, careers, etc. So you&#39;re going to want to learn how to temper them anyway, the sooner the better. Keep in mind that a B is not a failure; it&#39;s a strategic decision to prioritize other things. A good general doesn&#39;t try to win every battle; sometimes retreat is the best option in the long run.", "197" ], [ "@ybakos: Okay, but if you get 75% of the problem set points, that&#39;s only an 8% reduction in your final grade. Graduate courses often have a lot more grade inflation than people realize, so the overall effect may not actually be so great. There&#39;s a cold-hearted calculation to be made here - I know you want to give this your best effort, but it may not actually be worth the rewards.", "197" ], [ "One thing that hasn&#39;t been addressed yet:\r\n\r\n > I further asked if he can provide me a copy of a completed version of the recommendation but he refused.\r\n\r\nYou seem to view this as a danger sign, but I would not. Practices regarding letters of recommendation vary around the world (and you haven&#39;t said where you are), but at least for the US, the custom is that a letter is sent confidentially from the writer to the recipient, and the candidate (about whom the letter is written) never sees it. The idea is that this makes it more possible for the writer to speak freely.\r\n\r\nI&#39;d expect your advisor to refuse such a request even if your relationship was great and he was writing you the awesomest letter ever. It would be very unusual for him to agree to show you the letter, under any circumstances. I don&#39;t think it was an appropriate request for you to have made.\r\n\r\nOf course, it is possible that he is planning to write an unfavorable letter, but there is really no way to know without reading his mind. To my mind, this particular fact (that he wouldn&#39;t show you the letter) isn&#39;t really evidence one way or the other.", "304" ], [ "Actually, the system you describe seems to be the norm (for the US), in my experience. I think there is a conscious deference to the advisor, as the person who is best qualified to judge the quality of the student&#39;s work; the advisor would likely be overruled only if they were utterly out of line. You may not like this system, but I don&#39;t think you&#39;ll be able to shame your institution into changing it, since everyone else is doing the same thing.", "197" ], [ "A few years ago when I was applying for tenure track jobs (math, US), there were certainly a few that required an undergrad transcript. Not the majority. I also don&#39;t know what they actually did with them - it could be that once upon a time, they had an otherwise promising applicant who turned out to have lied about his/her undergrad degree, so they started requiring transcripts to avoid a future occurrence. It&#39;s quite possible they don&#39;t actually look at GPA. I would say it&#39;s still worth applying to schools that require transcripts, if they&#39;re otherwise a good fit.", "906" ], [ "I think my issue still stands. Between \" ;public service \" ; and \" ;professional service \" ;, each institution gets to set its own priorities. When you ask whether higher education \" ;is considered \" ; to be one or the other: higher education as a whole contains too many disparate elements to be clearly one or the other. The answer also will depend on who&#39;s doing the considering.", "906" ], [ "I&#39;m not so sure the last sentence is good advice. I think not having a letter from your department chair, or at least someone in your current department who knows you well, could seriously hurt your chances of getting another job. People you know from conferences will not be able to say anything about your teaching or your general ability to carry out the duties of a faculty member. A letter from your department is the best evidence that you are being successful at your current job; without it, other prospective employers might assume the worst.", "605" ], [ "This is true for many private universities, but generally not US public universities. For example, the [Regents of the University of California](_URL_0_), who are the highest governing body of the University, are appointed by the governor of California, who in turn is elected by the voters of the state. Alumni don&#39;t have any particularly special role, except insofar as they can influence university administrators or regents.", "605" ], [ "Unless your colleague is concealing the fact that one paper was a translation of the other, it seems to me that it is up to your department and its standards to decide how they \" ;count \" ; and how much \" ;credit \" ;, teaching release, etc, should be awarded. I don&#39;t see any dishonesty if the colleague is just asking for release based on both papers; if the department doesn&#39;t think they merit it, the department can just say no.", "827" ], [ "You can check the expiration date of the letter on MathJobs; it will be very awkward if it expires partway through the application process. Also, note that your advisor will be able to remove or update the letter at any time, which could be a problem if he is really vindictive - he could replace the letter with something unfavorable. So in short, regardless of how an old letter looks to the committee, it may not be wise to use the letter against your advisor&#39;s wishes.", "692" ], [ "It&#39;ll never work.\r\n\r\nI have a hard time believing that any attempt to sue the university for copyright infringement would stand up in court. I think one could make an argument that by handing in the assignment, you implicitly grant the university a license to copy it for internal use. \" ;Fair use \" ; permissions might also come into play.\r\n\r\nIf somehow you got the university to take your legal threats seriously, you can expect the immediate effect to be the following: all course syllabi would start to contain a clause saying something like \" ;To take this course, you must consent to the university making and indefinitely storing copies of your work. \" ;\r\n\r\nI think most academics would also consider that you would be acting unethically by trying this strategy. It&#39;s generally accepted that university instructors have the ultimate right to set the parameters of their courses. If those parameters include \" ;you may not hand in work already submitted in previous courses \" ;, then I would consider that this policy is binding on you, and that if you won&#39;t abide by it, you shouldn&#39;t take the course. Your proposed strategy seems like a transparent attempt to weasel your way out of abiding by them. If you attempt to use it to get away with forbidden duplicate submissions, and you do eventually get caught, expect the full weight of academic dishonesty sanctions. Short of that, expect a very bad relationship with your university and instructors, no letters of recommendation, etc.", "605" ], [ "Talk to your advisor, now. Dealing with funding and finances are a significant part of academic life; they aren&#39;t some shameful taboo thing.\r\n\r\nMost academics don&#39;t pay for professional travel, including conferences, out of their own pockets; often funds are available from your institution, or from any grants that may be funding your project, or from the conference itself. It&#39;s entirely reasonable to ask your advisor about funding sources that might be able to pay the cost for you attending this conference; you should also research possible funding sources yourself.\r\n\r\nIf funding isn&#39;t available, or can&#39;t cover the full cost, it&#39;s up to you to decide whether you want to spend your own money to go. If you decide that you can&#39;t, that&#39;s okay; you just won&#39;t go. I don&#39;t think people would see this as stinginess on your part, but rather a misfortune that no other funds were available.\r\n\r\nHowever, by the same token, if your advisor tells you that he doesn&#39;t have any funds available to pay, you shouldn&#39;t expect him to dip into his own pocket. \r\n\r\nIdeas like your \" ;50/50 split \" ; don&#39;t usually come up, unless there are multiple outside funding sources that could pay, and the question is how to apportion the costs between them.", "605" ], [ "They are really not very similar at all.\r\n\r\n(This answer describes common structures at US universities.)\r\n\r\nThere are a number of very significant differences between \" ;promotion \" ; in academia and in industry.\r\n\r\n- The vast majority of faculty members will be promoted at most twice in their entire career. Once from Assistant Professor to Associate Professor, and once from Associate Professor to Professor. \r\n\r\n- Promotions cannot be granted unilaterally by a single manager. Either of the two promotions mentioned above typically requires something like: a majority (or supermajority) vote of the faculty in the department, the recommendation of the department chair, the approval of a dean and a provost (and maybe a Promotions Committee), and often the university president and the board of trustees. *All* of these are required for the promotion to take place.\r\n\r\n- Promotions cannot be sped up. University policies usually require a fixed minimum (and sometimes maximum) number of years of service at one rank before being eligible for promotion. In some cases a candidate may be able to negotiate to adjust these timelines at the time of hiring, but usually not afterward.\r\n\r\n- Entering management isn&#39;t the \" ;normal \" ; path. The Professor ranks described above are not really management positions, and the duties of each rank are roughly the same: teach, do research, engage in institutional service. The most common \" ;management \" ; position for a professor would be department chair, and in many cases this is a fixed-term position, after which the professor resumes their previous duties. A professor could also try to become a dean; but since this typically means the effective end of their research and teaching career (or at least a drastic reduction or long hiatus), it&#39;s not something they do lightly.\r\n\r\n- Management structures in academia are relatively flat. A department chair may supervise up to 40-50 tenure-line faculty members or more, and perhaps a larger number of non-tenure-line faculty, postdocs, etc. A dean may supervise a similar number of departments. At my medium-sized university, there are only three levels of \" ;middle management \" ; between an ordinary assistant professor and the university president. As a result, there are relatively few \" ;management \" ; positions available, compared to the number of \" ;rank-and-file \" ; professors.\r\n\r\n- Universities are to some extent run from the bottom rather than the top. Significant decisions are often made (or recommended) by vote of the rank-and-file faculty, rather than by an executive; this concept is called \" ;shared governance \" ;. As such, management has less power than they would in a company, and professors don&#39;t need to move into management to have some influence on the overall direction of the institution.\r\n\r\nAs such, the sort of things that are commonly recommended when seeking promotion in business (showing value to the organization, currying favor with management, demonstrating ability to supervise others, etc) are not nearly as effective for advancement within academia.", "906" ], [ "<PERSON>: I understand that the asker says it is intended as a form of protest, and I know what the word means. I disagree that it is effective as a protest, since nobody reading the paper will have any way of knowing that one of the authors is fake - the whole point of a protest is to publicly air grievances. This instead seems to be a private passive-agressive measure that might make the asker feel a little better, but won&#39;t actually solve the problem.", "932" ], [ "I think the last sentence is a good point. Conference participants are in some sense purchasing a product. In general, you don&#39;t see sellers providing a cost accounting to justify the prices they ask. They charge what they think the market will bear, and consumers decide if that price makes the product worth buying for them, considering their other options. Consumers really don&#39;t care how the producer sets a price, nor how the price relates to the costs.", "313" ], [ "An actual letter is generally required at all levels in the US. It&#39;s a lot easier for a committee to read letters from 100 applicants, instead of actually contacting even 10 references.\r\n\r\nI actually think writing a letter is likely to be easier for your referee than being available as a reference. They can write a single letter in their spare time, and send copies to as many employers as needed (perhaps customizing where need). If you just list them as a reference, they need to be available to respond to contacts on short notice, possibly setting up phone calls with employers in distant time zones, etc. To me, that seems like the \" ;bigger ask \" ;.", "304" ], [ "As a general comment: don&#39;t conflate the famousness of the faculty with the quality of the courses. They are not necessarily correlated. Also, I would guess that under either of these programs, you will be able to take courses and attend seminars, but I wouldn&#39;t count on being able to work on research under the faculty - this may well be restricted to formally enrolled degree-seeking students.", "906" ], [ "This is a private business transaction between you and the student. Neither the university nor the professor was a party to that transaction, so they&#39;ll have no interest in interfering, and it would be inappropriate to try to involve them.\r\n\r\nAnyone who provides services to clients for money will eventually find that some of them don&#39;t pay. You can see many examples, and suggestions for ways to collect, on [_URL_0_](_URL_1_). To say more here would be off-topic, I think. I&#39;d just keep in mind that pursuing your non-paying client will require more of your valuable time - make sure it doesn&#39;t become disproportionate to the amount of money at stake. At some point, the most cost-effective approach may be to just let it go.", "605" ], [ "Interesting. In my field (math, US) this tradition has not been replaced. Having been through several job application cycles in the last 7 years, and submitting probably over 200 applications total, I can only remember a few who just wanted names - all the rest wanted letters sent at the same time as the application. Of course, since we have the central MathJobs clearinghouse, this is very easy to do, since the writer just has to upload the letter once, and the employers receive it automatically.", "793" ], [ "This is generally good advice, but I think it is definitely important to determine the significance. If the work is pretty trivial, even though it may be interesting to the other authors, it will sound silly if you go into this discussion of co-authorship. And insisting on co-authorship on *any* publication that incorporates the result is extreme: the result itself may not be enough of a contribution to warrant authorship, and it&#39;s not clear whether the OP would be qualified to contribute in other ways. In many cases a simple acknowledgement would be fine.", "827" ], [ "A note is that a three-year degree in New Zealand may very well be equivalent to a four-year US degree. This is not because US students are stupid or slow, but because US bachelor&#39;s degree programs require a significant amount of \" ;general education \" ; coursework outside the major field. So a person earning a BS in Engineering might have to take about 1/3 of their courses in English, history, art, biology, etc. Thus even if the amount of engineering coursework is similar, the US student would take longer.", "906" ], [ "In a [comment][1] @MithleshUpadhyay [links to a document][2] which is part of the [book][2b]\r\n \r\n Graphs \r\n An Introductory Approach \r\n by <PERSON> and <PERSON> \r\n John Wiley & Sons, Inc. 1990\r\n\r\nIt seems that the [site you are referencing to] [3] does cite this book incompletely. Here is the complete text from the book:\r\n\r\n\r\n\r\n > On the other hand, the complete bipartite graph $K_{3,3}$ is not planar, since\r\nevery drawing of it contains at least one crossing. To see why this is, note that\r\n$K_{3,3}$ has a cycle of length $6$ (namely, $uavbwcu$) which must appear in any plane\r\ndrawing as a hexagon (not necessarily regular).\r\n > [![enter image description here][4]][4] \r\n > We must now insert the edges $ub$, $vc$, and $wa$. Only one of them can be\r\ndrawn inside the hexagon, since two or more would cross. Similarly, only one of\r\nthem can be drawn outside, since two or more would cross.\r\n\r\nThe paragraph following the picture is missing in the text you read.\r\nI think the proof from the original text is completely clear.\r\n [1]: _URL_3_\r\n [2]: _URL_1_\r\n [2b]: _URL_4_\r\n [3]: _URL_2_\r\n [4]: _URL_0_", "805" ], [ "Based on my job search experience from a couple of years ago, there are three kinds of communications you might get by snail mail:\r\n\r\n1. Equal-opportunity questionnaires, asking your race, gender, etc, for statistical purposes (usually not shared with the search committee). Responding to these is optional, and certainly not time-critical.\r\n\r\n2. Rejection letters. Obviously these don&#39;t need any response at all, and they usually don&#39;t tell you anything you didn&#39;t already know; often they aren&#39;t sent until long after the search was obviously finished.\r\n\r\n3. Formal offer letters. You&#39;ll know when these are coming, because you&#39;ll already have been informally offered the job by phone or email. (And in some cases, you might have also had to negotiate what the offer letter will contain, though for postdocs it&#39;s more likely to be \" ;this is our offer, take it or leave it \" ;.) At that stage, you could ask the employer to be sure to send the letter to your home address.\r\n\r\nAll communications that are actually relevant to whether you get hired or not will take place by email, phone, Skype, or in-person interview. Time is of the essence in hiring, and nobody wants the delay of snail mail for something that needs a quick response.", "304" ], [ "In deciding who to list as the author of the paper, I wouldn&#39;t pay any attention to the copyright line. Academic standards are not concerned with who *owns* the paper legally, but who actually *made* it.\r\n\r\nFor a recent paper I co-wrote, we signed over the copyright to the publisher. So if you look at its copyright line, you&#39;ll see \" ;American Mathematical Society \" ;. That doesn&#39;t mean you should cite the paper as having been authored by the American Mathematical Society.\r\n\r\nWhat name(s) appear on the article&#39;s title page, right under the title itself? That&#39;s who you should credit as the author of the paper.", "827" ], [ "Hint1:\r\n\r\nTry to figure out by hand the invocations of binomial1 for similar, but smaller numbers, e.g. `binomia1l(4,2,p)`, `binomial1(10,5,p)`, or for not so similar number pairs like `binomial1(10,7,p)`.\r\n\r\n\r\nHint2:\r\n\r\nYou don&#39;t need a formal analysis to answer the question how often binomal1 is called when you invoke binomial1(100,50). You can write a program to calculate this value. This program must be more efficient than binomial1, e.g. by remembering the values already calculated.", "82" ], [ "@YuvalFilmus: If the OP asks \" ;how to minimize this without using calc \" ; then using calculus is not an option. But I read the question again and now I think the OP wants a proof without calculus as phrased in the last paragraph of th OP. And this &#39;proof&#39; described in the last paragraph is what you call the &#39;trick&#39;. I must think about this &#39;trick&#39;.", "847" ], [ "This answer is my personal opinion. I believe that high performance numerical solvers are not a good place to use MVC pattern. Additional layers and specific data flow will not help to get a better performance. MVC and MVVM (Model-View-ViewModel) are commonly used for GUI developing. If you want to develop pre/post processor where performance is not such important thing, architectural patterns can help you organize a project and make it easier to develop (especially if you work in a team). I believe that GUI for numerical software should be always separated from computational core. Not only by using multi-threading, but it should be located in a separate program. That kind of architecture is commonly found in many commercial numerical softwares like Abaqus or Ansys. If GUI crashes it will not to affect calculations. Solver can run separately on HPC machine where graphical interface is not available. Moreover, GUI can be written using almost any language which provide suitable sets of widgets - Java, C#, or C++ (QT). It depends on target platform and your skills in programming. You can even use some general purpose post/pre processors like GMSH, Paraview or GiD and combine it with your solver. High performance numerical solvers are almost always written in some low level languages like C, C++, Fortran which do not support MVC/MVVM patterns in the same way how Java or C# does.\r\n\r\nIn case of my PHD thesis I decided to write my own preprocessor using C# and MVVM pattern and separated numerical solver using C++ which consumes input file generated by preprocessor. Such architecture was easier to develop and maintain.", "895" ], [ "(at least the plural of basis is correct now) An algorithm to find a basis (a minimal set but not necessarily the smallest that generates all propositions) is rather simple (see wiki candidate keys). The problem to decide if there is a basis with the number of elements smaller then a given number seems to be NP hard. An algorithm that calculates all bases that is polynomial in the number of different bases and the number of propositions can be found in the wiki entry for the candidate key. But the number of bases may be large so this algorithm is not polynomial in the number of propositions.", "293" ], [ "At _URL_0_ you can see a nice one-page poster entitled \" ;Avoiding Gender Bias in Reference Writing \" ;. Its suggestions generally echo points already mentioned in other answers, but it&#39;s a convenient and concise source. \r\n\r\nOne common theme is to focus on the person&#39;s achievements rather than their effort, potential, or emotional or personal traits.", "541" ], [ "@Wrzlprmft: The story is certainly unusual but hardly impossible. There certainly have been people who have done very impressive work at early ages. And if you&#39;ll note, the concern is not with the *publisher&#39;s* reaction, who as you say would not know the student&#39;s age, but with the reaction of the community in general. A student who seems to be a \" ;prodigy \" ; would very likely have experienced such \" ;circus clown \" ; treatment and I can understand them wanting to avoid it. So I think the question is plausible, though not something that happens every day.", "391" ], [ "Well, of course, you absolutely cannot publish the student&#39;s work under your own name, so take that off the table right away. You can explain to the student that a fundamental principle of academic ethics is that one absolutely does not take credit for the work of another, and that doing so would jeopardize your entire career. So whatever the resolution of this situation is, it can&#39;t be that.\r\n\r\nEthically, the student could publish under a pseudonym, but I don&#39;t think it is a great idea. If the work really is that significant, researchers in the field are going to want to talk to the author: contact him to ask questions about the paper, invite him to conferences and seminars, suggest collaborations. In principle he could refuse it all, or decline to give any contact information, but this would ultimately limit the impact of his work, and it seems that it&#39;s important to him that his work should have an impact. Moreover, I think using a pseudonym would actually divert the attention away from the work and toward the mysterious author, and when his identity eventually is discovered (as I think it must), the result would only be more of the unwanted \" ;circus clown \" ; treatment.\r\n\r\nNow, I think I can understand the student&#39;s fear. I think many people in fields like math and physics have had the experience of laypeople saying \" ;I don&#39;t have any understanding of what you do, but you must be really smart. \" ; It may be meant as complimentary, but it can be very frustrating - there&#39;s an implication of \" ;You are different from me, I cannot relate to you, and I don&#39;t want to try \" ;. It&#39;s emotionally uncomfortable. So for a person who not only works in a specialized field, but shows unusual talent at an early age, this effect must be greatly magnified, and I can sympathize with the wish to avoid it.\r\n\r\nThe difference, though, is that people *within* the field really don&#39;t behave like that. Their attention really will be on the work itself. There may be just a little bit of extra amazement at the author&#39;s age (since physicists are human too), but it won&#39;t overshadow the work. It seems that you&#39;ve tried to reassure the student of this, but he&#39;s not convinced. \r\n\r\nSo perhaps you should try to put the student in touch with one or more people in your field who has had the experience of being a \" ;prodigy \" ;, and gone on to be a successful, mature researcher. This person should hopefully be able to better relate to your student&#39;s concerns, share their experience of what it is actually like to enter the field from such a background, and offer guidance for managing unwanted attention or similar issues. This might help the student understand that his fears are unfounded, and encourage him to go ahead with publishing under his own name, which I think we can agree is ultimately what&#39;s best.", "605" ], [ "\" ;there&#39;s a lot of restrictions on using costly instruments in private colleges whereas we get a lot of liberty to get hands-on lab experience in public ones \" ;: I&#39;m not sure this is an *inherent* difference between private and public institutions. Couldn&#39;t it be that the institutions in your experience simply had different policies or cultures, that just happened to coincide with their public/private status?", "76" ], [ "If you&#39;re interested in history of mathematics, then Latin would very likely be helpful; until the 18th century or so, most mathematics done in Europe was written in Latin.\r\n\r\nFor studying modern mathematics, Latin isn&#39;t so useful. I&#39;m a mathematician and have studied a little Latin, and it hasn&#39;t really been directly useful. Sometimes it helps a little in understanding a word&#39;s roots, but not much beyond that.\r\n\r\nOn the other hand, I do fairly often need to read a paper in French; there&#39;s a signficant amount of current and recent mathematics research written in French. However, this isn&#39;t too hard even though I&#39;ve never formally studied French. The vocabulary and language used in mathematical writing, while specialized, is quite limited. And I know some Spanish, which is helpful in figuring out the grammar where needed. \r\n\r\nSo for mathematics, neither one is strictly needed, but given the choice I&#39;d choose French.", "216" ], [ "@DavidRicherby: Yes, indeed. I did my math PhD at a top-30 US university in the last 10 years, and one of the requirements was to pass a \" ;language exam \" ; in the student&#39;s choice of French, German or Russian. The level required is not very high, though. I chose French; the professor pulled a random French textbook off her shelf, marked a few pages, and told me to go home and translate them and come back in a week. I was allowed to use dictionaries, etc. At the end of a week she read my translation and quizzed me on a few specific sentences, and that was it.", "836" ], [ "@DavidRicherby: I had no trouble with it, even though I had never studied any French. The goal is to ensure that students have some ability to read the literature in other languages. Of course, as English takes over, this is becoming less important, so it&#39;s also partly just a historical relic. Before I entered the program, students had been required to pass exams in *two* of the three languages, but this had since been reduced to one. My impression is that language requirements like this are very common in US math PhD programs.", "836" ], [ "Moreover, in nearly all cases, a professor is going to need to see a note from a mental health professional before making any major adjustments to your grades, deadlines, exam schedules, etc. Professors are not qualified to judge your mental health status by themselves. So, in addition to your own well-being (which of course must come first), seeing a professional will also be necessary from an academic standpoint. **Do that first.**", "605" ], [ "[Caveat: personal interpretation]\r\n\r\nThe lesson is that Fate reigns supreme over mortals and that you can&#39;t escape it. It also acts as a meta-rule for other myths.\r\nSince prophecies are bestowed by the gods, it&#39;s about remembering one&#39;s place in the universe and not questioning it.\r\n\r\nIt&#39;s a recurring theme in myths involving prophecies across western cultures, as well as in stories that involve characters breaking customs or not respecting rituals. If you agree that one of the purposes of myths is to reinforce norms, this kind of story is about the power of the myths themselves, how they shouldn&#39;t be dismissed. I can&#39;t think of a single instance of a classical protagonist who defied Fate and profited from it.", "984" ], [ "Some expressions that uniquely identify an entity are always used with \" ;the \" ;, for example \" ;the untyped lambda calculus \" ; or \" ;the South Pole \" ;. Is the article a part of the name? In particular, when I want to write a link to such an expression, should the link include \" ;the \" ; or not? As in\r\n\r\n > The [**Geographic South Pole**](_URL_0_) should not be confused with the [**South Magnetic Pole**](_URL_1_).\r\n\r\nvs\r\n\r\n > [**The Geographic South Pole**](_URL_0_) should not be confused with [**the South Magnetic Pole**](_URL_1_).", "754" ], [ "I wouldn&#39;t say evidence but it&#39;s a recurring theme in myths involving prophecies across all cultures, as well as in stories that involve characters breaking customs or not respecting rituals. If you agree that myths are about propagating norms, this kind of story is about the power of the myths themselves, how they shouldn&#39;t be dismissed. I can&#39;t think of a single instance of a classical protagonist who defied Fate and profited from it.", "96" ], [ "+1 for \" ;claim ownership \" ;, though I think it can be done with less drama. The Claim Ownership form just asks you to list the paper(s) in question, there&#39;s not even any space for comments or explanation. So the OP (or another coauthor with an established arXiv account) can simply try to claim the paper, without involving the arXiv moderators in the gory details. If successful, OP gets the paper password, which can then be used to upload a corrected manuscript and/or edit the metadata, and all is well unless the rogue coauthor tries to object.", "609" ], [ "In that case, or if the moderators don&#39;t grant ownership to the OP, then OP can explain the situation to them. But this has the advantage that if it is simply a mistake on the part of the rogue author, it corrects it without accusing them of anything. Likewise, even if it was intentional, it lets the rogue author save face by saying it was a mistake and thanking OP for fixing it.", "734" ], [ "In addition to what <PERSON> said, I think many PIs take the point of view that in hiring a postdoc, they are not only getting someone to work for/with them for a couple years, but also training a future independent researcher. At some point in your sequence of postdocs, it would become clear to everyone that you are not likely to become an independent researcher anytime soon, so your likelihood of getting hired for that many postdocs would probably be very slim.", "906" ], [ "\" ;It means exactly the same thing in both languages \" ;: I disagree. At least in US English, as used within academia, \" ;tutor \" ; is used to refer to a person who teaches students *individually*. It would not be used for a person who teaches students in a classroom setting, as in the OP&#39;s question. Note that in general, the linguistic origins of a word are not necessarily an accurate indication of how it is used in practice, and how it is likely to be understood by readers.", "69" ], [ "@DanRomik: I don&#39;t know about that. Assuming the supervisor participated, I think it would be unethical to share it without his consent. Even an honest supervisor could get very annoyed at a student sharing their joint work before they feel it is ready for public consumption. I&#39;ve known cases where this led to the supervisor firing the student.", "605" ], [ "Not exactly an answer, but a couple things to note.\r\n\r\nLetters on MathJobs expire eventually; I think you can see the expiration date on the \" ;cover sheet \" ; page. It will be very awkward if it expires partway through the application process. \r\n\r\nAlso, note that your advisor will be able to remove or update the letter at any time, which could be a problem if he is really vindictive - he could replace the letter with something unfavorable. \r\n\r\nSo in short, regardless of how an old letter looks to the committee, it may not be wise to use the letter against your advisor&#39;s wishes.", "692" ], [ "There isn&#39;t any way to guess your \" ;chances \" ; of admission, and it&#39;s not productive to try. Just wait patiently; when the decision is made, you&#39;ll be notified. In the meantime, spend your mental energy on something more useful than trying to predict the result.\r\n\r\nAt most US universities, graduate admission decisions are made by a committee of faculty. You had an interview with one professor, but she probably doesn&#39;t get to decide for herself whether or not to admit you. Rather, she will report her impressions to her colleagues on the admission committee. After they have reviewed all the applications, they will discuss them and decide who will be admitted. This takes time, certainly more than two days. I&#39;d expect it will be at least several more weeks before you hear anything. So be patient!", "605" ], [ "Off topic, but you may want to look into ways to address your concentration problems - perhaps with the aid of a counselor or mental health professional. Graduate programs, especially at the masters level, often have high-stakes exams - you pass or you don&#39;t get a degree. And likewise, even just for admission, they may want to see evidence that you are addressing this issue - whatever your other abilities, no program wants to admit a student who won&#39;t be able to finish.", "906" ], [ "Yes, you can ask your former professor. No, it&#39;s almost certainly not required that all referees be current academics. There&#39;d be no sensible reason for a graduate program to require that.\r\n\r\nYour professor can use her best judgment as to whether to fill the form with her current position or something like \" ;Professor (former) \" ;. In the letter, she should explain what her position was at the time that she worked with you.", "605" ], [ "I have two parts, which need to be meshed. One part is located inside another. To simplify the problem, imagine two cubes: one inside another.\r\n[![enter image description here][1]][1]\r\n\r\nGeometries are stored in STL files. From CAD point of view, one file contains an internal cube, another contains cube with a hole for an internal cube. All dimensions fits (there are no intersections). My task is to create a conformal tetrahedral mesh suitable for mechanical FEM analysis - without duplicated nodes on shared faces. Each element should contain information to which part it belongs. File format does not matter but Abaqus is preferred. \r\n\r\nI decided to use gmsh, but I cannot mesh both parts together.\r\nI tried the following commands:\r\n\r\n 1. File - > Open Internal cube \r\n 2. Add volume to internal cube \r\n 3. File - > Merge External cube\r\n 4. Add volume to external cube\r\n\r\nThis produces mesh but elements in internal cube are duplicated. It looks like gmsh does not treat hole (in external cube) as a void. I also tried to use Coherence in gmsh but it failed with error:\r\n\r\n > Error : Self intersecting surface mesh, computing intersections (this could take a while)\r\n\r\n > Error : Surface mesh is wrong, cannot do the 3D mesh\r\n\r\nI assume, that my geometries are fine:\r\n\r\n - Internal cube: _URL_1_\r\n - External cube: _URL_0_\r\n\r\nHow to create such a mesh which satisfy my requirements? \r\n\r\n [1]: _URL_2_", "414" ], [ "This is an interesting idea in principle, but I wonder how effective it would be in practice. Have you had experience with people who actually do this? I would wonder whether a random external expert is going to have the time or motivation to evaluate the work of random grad students. I would also wonder about political considerations. If the external person gives an opinion of the work that is much higher or lower than the advisor&#39;s, that seems likely to lead to tension between the two of them - and academic research communities are often small...", "76" ], [ "@rpax: [*Journal of Irreproducible Results*](_URL_0_) is/was a parody of scientific journals, publishing articles similar in form to scientific papers but with humorous content. It still exists, but after a schism in 1994, many of the editorial staff of *JIR* left to form [*Annals of Improbable Research*](_URL_1_), which now focuses on reporting on real scientific research that happens to be funny.", "76" ], [ "You learn to evaluate these kind of things by experience. You read the papers published in the conferences, form your own opinion of their quality, see how they impact the field over time, see how they are viewed by others, and revise your opinions. Eventually you get a general sense of how \" ;good \" ; a paper should be in order to be published in this conference, and you compare it with your evaluation of your own paper&#39;s quality.\r\n\r\nYou bootstrap the process by drawing on your advisor&#39;s experience.\r\n\r\nSo: **Ask your advisor.**", "827" ], [ "Well, if you express interest in Problem Y that&#39;s related to the work of Dr. <PERSON>, the interviewer can say \" ;Hey, that&#39;s great, Dr. <PERSON> works on that. You should definitely come here. \" ; (Remember, interviews serve for them to recruit you as well as to help decide if you should be admitted.) Conversely, if you appear dead-set on working on Y, and nobody in this department works on that, they can let you know that this department is not a good fit for you. But I don&#39;t think there&#39;s anything wrong with saying that you want to try some things before making a decision.", "304" ], [ "I know of no blanket policy stating that PhDs from Iran are \" ;invalid \" ;, so I think your friend has misunderstood the issue. There are some postdocs which are funded by the US government to increase US science capabilities, and therefore are limited to US citizens and/or people who got their PhDs from US universities. There are other possible reasons why she didn&#39;t get hired, and I am not sure how we will read minds to guess what they were.", "906" ], [ "Note that \" ;presenting the paper at a conference \" ; can mean various things. If the paper is going to be published in proceedings, you should certainly be an author. However, if the professor is merely giving a talk about the project, some conferences just list the name of the person making the presentation, regardless of who else was involved. In that case the professor should acknowledge other contributors as part of the talk.", "827" ], [ "No, that isn&#39;t how it works. A letter of recommendation should be:\r\n\r\n1. tailored to the recipient, or at least to the type of recipient (grad school, job, internship, etc)\r\n\r\n2. written (or updated) by the professor at the time it is sent\r\n\r\n3. sent directly from the professor to the intended recipient, without passing through your hands\r\n\r\nYour suggestion would fail all three of these.\r\n\r\n1 is pretty self-explanatory: internships, jobs, grad schools, scholarships, etc, are all looking for different things. You want the professor to be able to focus on what&#39;s relevant. A grad school might need to know about your skills in long-term theoretical research; an industry employer might only care about your ability to turn out satisfactory practical work on short deadlines. A letter that addresses the wrong aspects will be useless or worse. The professor doesn&#39;t want irrelevant letters going out under his name, either; he&#39;ll look like an idiot.\r\n\r\nFor 2, every recipient of a letter wants to know what you have done *lately*; usually (hopefully) that will be your best work. You don&#39;t want an outdated letter that misses your latest and greatest accomplishments, and a letter that&#39;s several months old won&#39;t be taken very seriously by anyone. Moreover, if the professor gives you a \" ;generic \" ; or undated letter, it&#39;s a blank check: even if you flunk all your classes, or get thrown out for cheating, you&#39;ll still have a letter with his name saying \" ;SquarerootSquirrel is doing great! \" ; \r\n\r\n\r\nFor 3, these days, most grad schools / employers / etc will want a letter sent directly from the professor, usually submitted via an online form. Everyone will feel more comfortable that they&#39;re getting the professor&#39;s honest opinion if you never have any opportunity to read (or alter) it. Based on this alone, I think most professors would simply refuse to put their letter in your hands, even if it were sealed.\r\n\r\nBut what you *can* do is to talk to the professor, tell him about your long-term plans for jobs or grad school or whatever, and say that you may be asking him for a letter of recommendation at some point. Ask him if that&#39;s something he&#39;d consider, and if there&#39;s anything in particular you need to know or do (he may want a copy of your resume / transcript / etc). Then he can start paying closer attention to your work and thinking about what to write, or even start drafting a letter.\r\n\r\nWhen the time comes for you to actually apply somewhere, tell him about it (at least several weeks before the deadline). Then he can just update the letter with your latest achievements, edit to focus on what&#39;s relevant for this recipient, and send it off. That part is very little trouble, even if you are applying to many different places.", "605" ], [ "Obviously it depends on an institution&#39;s specific policies.\r\n\r\nI expect in most cases, starting a program like this would start with the faculty in an existing department; probably a psychology department in this case. The faculty would come up with a program they believe would be beneficial, and identify the resources they would need in order to offer it (additional course offerings, new faculty hiring to get the necessary expertise, new or reassigned faculty lines if necessary, lab resources, external grant funding, etc). They would write syllabi for any new proposed courses, create a description of the program for the college&#39;s catalog, and specify the requirements for the degree (which courses are required, which electives could be taken by students, etc). The department&#39;s faculty might need to vote on the proposal before submitting it for further review.\r\n\r\nThe proposal would then be reviewed by various groups and administrators within the university, who would weigh its academic suitability, impact on existing programs, probable demand, financial costs, tangible and intangible benefits to the institution and/or society, availability of resources, and so on. Usually the new program would need final approval by a dean and/or a provost.\r\n\r\nThere are many possible obstacles to creating a new program. In your example, if a department doesn&#39;t currently have any faculty specializing in I-O psychology, they would have to hire them. This might be done by replacing retiring faculty who have other specialties, but this can be politically touchy, as faculty groups in other subspecialties might feel that they are losing needed resources. It can also be done by creating new faculty lines, but this is a major long-term financial commitment for the university, and such a proposal has to compete for resources with other departments who may be proposing new programs of their own. It may be hard to justify the need to higher administration, particularly as the institution cannot necessarily be confident as to how many students will be attracted to the program (and to what extent this may simply \" ;cannnibalize \" ; demand from other programs within the institution).\r\n\r\nSo there is a very long road between recognizing that a program might be desirable, and actually having one.", "605" ], [ "I think it&#39;s pretty standard that \" ;travel expenses \" ; include all meals purchased from the time you leave home until your return.\r\n\r\nSome institutions do meal reimbursement on a \" ;per diem \" ; basis, where you get a flat amount per day for meals, regardless of how much you actually spend. In some cases there is a slightly lower rate for the first and last day of your journey, reflecting the fact that you might have been at home for part of those days.\r\n\r\nIf you are unsure, you might get in touch with the administrative person in the department who handles travel reimbursements and ask them about their policies. This person is typically not involved with the hiring process, so there&#39;s no need to worry about making a bad impression.\r\n\r\nSide comment: You are probably worrying about this a bit more than you need to. If you&#39;re on the job market, this is probably one of the first times you&#39;ve had people paying your travel expenses, and it&#39;s normal to be a little sensitive about that. But paying travel expenses is a very standard part of academic life, and for the most part, the people paying for you are not going to notice these sort of financial details or let them affect their perception of you. It&#39;s just an academic chore for them, and it isn&#39;t their personal money you&#39;re spending! Just use your own best judgment, and unless you do something outrageous, like asking to be reimbursed for strippers and champagne, you&#39;ll be fine.", "587" ], [ "In general, academic research that isn&#39;t peer reviewed gets far less attention than research that is. Also, for the medical field in particular, I would wonder about ethical oversight. You generally can&#39;t publish in a peer-reviewed journal unless your research was conducted with the oversight of some sort of independent ethics board; if your work didn&#39;t have that kind of oversight, it&#39;s probably going to be impossible for anyone to make use of it.", "827" ], [ "One issue that occasionally comes up at US universities is that in order to transfer credits, the previous university has to send an official transcript to the new one. Many universities require that before they will send the transcript, you have to have paid all tuition and fees you owe them (or have financed them with a student loan). So if you are behind on tuition payments or even owe library fines, you may not be able to get the transcript you need.", "605" ], [ "One issue that occasionally comes up at US universities is that in order to transfer credits, the previous university has to send an official transcript to the new one. Many universities require that before they will send the transcript, you have to have paid all tuition and fees you owe them (or have financed them with a student loan). So if you are behind on tuition payments or even owe library fines, you may not be able to get the transcript you need.\r\n\r\nOther than that, in my experience, there isn&#39;t any particular permission that you need in order to transfer.", "605" ], [ "> This seems like an impossible task.\r\n\r\nYou&#39;re right, it is impossible. One can really never hope to gain a \" ;complete \" ; knowledge of a field, or even a subfield. You just have to do the best you can, in the time you have, to identify the most significant basic work related to your area of interest, and work that specifically addresses the questions you are studying.\r\n\r\nPart of your advisor&#39;s job is to help with this; they should have a broader knowledge of the field, and be able to help direct your literature search and point out any glaring gaps. But despite your combined best efforts, there will almost certainly end up being significant work that you overlook, or whose relevance you don&#39;t recognize. That is just part of doing research. Someday you&#39;ll learn about it and wish you had known it earlier, but all you can do is move on from there.", "906" ], [ "See _URL_0_. Yes, if you disclose it now, there is a slight risk that they might change your admission decision. That might set back your plans for grad school. If you conceal it, you&#39;re taking a *much* greater risk: you could in principle be kicked out of the program, or even have your degree revoked years later. That would wreck your academic career.", "605" ], [ "The part about \" ;most preferred scientific name \" ; deserves emphasis. In particular, when somebody changes their legal name, they don&#39;t necessarily change their scientific name. It&#39;s possible that although the OP&#39;s friend has changed his name for legal / social purposes, he may still be using the previous name for professional purposes, and for instance, intends to continue publishing under that name. The OP should check with their friend to see what he plans to use as a *professional* name.", "495" ], [ "You did the work you were contracted to do, in good faith. I don&#39;t see a problem with you keeping the money, and providing the code. But you could also contact his institution and let them know what is going on. Optionally, you could tell the student you are doing so, giving him a chance to put together something on his own. Or not, maximizing the chance he&#39;ll get caught, if this doesn&#39;t feel too much like entrapment.", "605" ], [ "The instructor&#39;s expecting you to use poorly written code with known bugs that you might have to work around? Sounds like he&#39;s doing a good job of preparing you for real-life programming work. \r\n\r\nI&#39;m only about 25% joking - while I wouldn&#39;t think he&#39;s inserted the bugs intentionally, having to work with existing buggy codebases is something that every programmer faces routinely, whether in academia or industry or elsewhere. So it&#39;s certainly not unreasonable to expect students to be able to handle it, or learn to do so.\r\n\r\nEvidently the professor has decided that having you work with this code, although it has issues, will be a better educational experience than an alternative. That&#39;s a matter of his professional judgment, and we here on this site are in no position to second-guess it. We have no way of knowing what alternatives exist, what their pros and cons might be, and what other constraints the professor has. On the basis of what we know from your post, I think it would be irresponsible of any academic to judge someone \" ;lazy \" ;.\r\n\r\nIf you think you can improve the code, or know of alternatives that would be better, this could be a great opportunity for you to contribute. You might be able to earn independent study credit, or money, by working on the code or helping adapt the curriculum to some alternative software. At a minimum, you can write useful bug reports for the professor, which should make it easier for him to fix them, and save some hassle for future students.", "197" ], [ "Were your absences due to circumstances clearly beyond your control (illness, death in family, etc), and do you have documentation to confirm this? If so, you might be able to argue that you should be allowed to make up those points somehow. If not, I don&#39;t think you have much chance. Attendance policies like this are fairly common in academia and I don&#39;t think higher administrators are likely to think the policy is unfair.", "605" ], [ "One theory is that it serves as additional motivation for students to attend class, which in turn helps increase their success in the course. It gives them a short-term incentive to do something which is hopefully also in their long-term best interest.\r\n\r\n > If attendance is so crucial to doing well in the class, wouldn&#39;t the students who don&#39;t attend do poorly in the exams anyway?\r\n\r\nIn many cases the instructor has found from experience that this is true. But the student (who has less experience) may not be as convinced. \r\n\r\nConsider a student who wakes up in the morning and doesn&#39;t feel like going to class. In a class with no explicit attendance requirement, the student may rationalize: \" ;I will just study harder tomorrow to learn the material that I missed, and I&#39;ll still be able to do well on the exam, so skipping class will have no consequences. \" ; But they overestimate their ability to do that, and end up not learning it as well. Or tomorrow they put off the studying until the next day, and so on, and fall behind. As an eventual result, they do not do well on the exam.\r\n\r\nIn a class with an attendance requirement, the student knows *for sure* that not attending class will have negative consequences. The biggest consequence (failing the exam) is very likely but not guaranteed, and the student may not be able to impartially evaluate just how likely it is. But loss of attendance points is guaranteed. So the student cannot pretend that skipping class is harmless. Thus the student is more likely to actually attend, which is in their long-term best interest anyway.\r\n\r\nHopefully, the ultimate result is that a higher percentage of students are able to meet the standards of the class. The flip side is that some students who have good attendance but poor performance otherwise may get better grades than they \" ;deserve \" ;, but the instructor may feel that this tradeoff is justified.", "197" ], [ "\" ;extra credit, an additional paper covering the subject discussed on the days missed, etc \" ;: Bear in mind that if such an option is possible, it should be disclosed in the course syllabus, so that all students are aware of it. You can still ask, in case there is some opportunity you missed. But if the professor invented a grade-improvement opportunity just for you, that really *would* be unfair - you&#39;ll want to ask in a way that makes it clear you are not requesting special treatment.", "605" ], [ "@BenVoigt: In my opinion, giving the option of using the final exam as the final course grade is a HUGE <PERSON>-Krueger trap. Students can say \" ;I&#39;m smart, why waste my time going to class? I&#39;ll just study in the last week and do great on the final, and then none of the other stuff I missed will matter. \" ; And more often than not, they&#39;ll be wrong.", "197" ], [ "@Luaan: It&#39;s a fair philosophical question: is the purpose of a university to deliver education only to those already strongly motivated to participate in it, or is it appropriate to encourage or gently coerce participation by students who might not do so on their own? I&#39;ll just say that in US academia, the rates of retention and timely graduation are generally viewed as an important measure of quality for an institution. Thus if a student doesn&#39;t pass a class, it reflects poorly on the student but also on the institution, program, and instructor.", "197" ], [ "There are two independent tetrahedral FEM grids. Second grid is subset of the first. By subset, I mean: nodes from the second grid are exactly in the same positions as some nodes from the first grid. The numbering of nodes is completely different in both grids. I need to renumber nodes from the second grid according to nodes from first one to properly transfer the solution. To do it I need to create some kind of map between nodes ids. Most naive solution is to create a dictionary where the keys contain nodes positions and value is node &#39;id&#39;. But using arrays of doubles as a keys is not a great idea due to floating point math (precision issue).", "108" ], [ "At my institution, this planning is done separately by each department, which reduces the number of courses from \" ;hundreds \" ; to \" ;dozens \" ;.\r\n\r\nIn my department, it&#39;s done by hand, by the chair and a couple other experienced faculty members, with the aid of some spreadsheets. They are familiar with the requirements of the degree programs offered within the department, and some of the most common conflicts with other departments. (For example, calculus is taken by many first-year physics majors, so we try not to schedule it at the same time as the intro physics lab.) \r\n\r\n\r\nOver time, various courses have settled into \" ;traditional \" ; time slots which are known to work reasonably well together, so we use caution when deviating from tradition.\r\n\r\nThis does mean that students with more unusual programs (double majors, etc) may find conflicts between required courses which can be difficult or impossible to resolve. These have to be handled case-by-case; in some cases the department may waive or modify requirements that can&#39;t reasonably be satisfied.", "197" ], [ "One thing to try: since postdocs in math often involve teaching, they are often treated as term-limited faculty positions, and the postdoc gets a faculty job title like \" ;visiting assistant professor \" ;. As such, if your institution has a general policy of providing funds for faculty travel, or some sort of (semi-)competitive internal travel grants, it is worth checking if the postdoc could be eligible.", "906" ], [ "Plagiarism is when you use other people&#39;s ideas *and fail to give them credit*. So if you make it clear that an idea came from someone else, and credit them appropriately (with a formal acknowledgement or a citation), you will avoid plagiarism.\r\n\r\nOf course, in order to be acceptable for a degree, your thesis will still have to contain a sufficient proportion of ideas that are your own.\r\n\r\nBefore discussing the details of your work with others online, you should ask your advisor whether it&#39;s a good idea to do so. It&#39;s possible that your advisor specifically wants you to work out certain parts for yourself. Another concern is that sharing your ideas increases the risk that someone else will carry out your research before you do - in most cases, this risk is outweighed by the benefits of sharing, but your advisor needs to agree.", "609" ], [ "@gnometorule: The university where I got my PhD has a general policy that students will not be admitted to a PhD program if they already have a PhD in *any* field. Exceptions are possible but they require special permission. See _URL_0_ under \" ;Duplication of Advanced Degrees \" ;. As <PERSON> says, I think this is pretty common, though maybe not universal.", "906" ], [ "I know I&#39;m late to this but better late than never. There are a number of sources, static lists as well as APIs that redistribute the official USPS zipcode data. That data is then available for any use you like (within reason). It is no longer subject to the USPS Terms of Service. Here is the Jan2016 data file: _URL_0_. Most current version always available upon request (no charge). [Full disclosure - I work for an address validation company called SmartyStreets, so I deal with this kind of question all the time)", "307" ], [ "A does sound impossibly difficult to me. The first few years of a masters/PhD sequence are usually based on coursework. You will need to attend classes regularly on weekdays, which seems like it would probably be incompatible with a paramedic&#39;s work schedule. Even beyond coursework, particularly in lab sciences, you may find that parts of your research have to be done on a particular schedule.\r\n\r\nMoreover, at all stages of graduate study, you should expect that your coursework and/or research will require a time commitment at least comparable to a full time job (40 hours per week), likely substantially more. Many graduate students struggle with the workload, even without added commitments. Adding a full time job, especially one with as much stress, long hours, and sleep disruption as a paramedic must have, seems to me like a burden well beyond what any human could be expected to successfully bear.", "906" ], [ "@JonCuster: I can think of lots of reasons. Audits to see if admission procedures were correctly followed. Statistics on the applicant pool. Analysis of factors related to applicant success. Generic legal record-keeping requirements. And, in the era of electronic records, the simple fact that deleting data requires more work than keeping it.", "304" ], [ "> Days ago I contacted a professor from one of the universities I am going to apply, sending him my thesis and asking to work under him in some project he may assign. He turned me down, [...]\r\n\r\nI&#39;m not surprised. It&#39;s rare for a professor to assign or supervise a project for a student who&#39;s not already enrolled at the professor&#39;s university. They already have plenty of other work to do, and working with outside students isn&#39;t part of their expected duties, so there&#39;s no real incentive for them to take on such a task.\r\n\r\n > Should I contact more professors? \r\n\r\nIt&#39;s unlikely to be successful, for the reasons I just mentioned. So I don&#39;t think this is a good approach.\r\n\r\n > I mean if he accepts me, gives me some project and ultimately I do not go to his university, would it make him angry?\r\n\r\nThis isn&#39;t the issue. First, it&#39;s unlikely that any professor would accept an outside student for a project in the first place. But if they did, they realize that students have many factors affecting their choice of graduate institution, and are not likely to be angry if they go somewhere else.\r\n\r\n > And is the chance of I having a LoR from a famous professor in this way high?\r\n\r\nNo, it is not. This is not an effective way to get a letter of recommendation.\r\n\r\n > This leads me to another option. I can go to my current university and strengthen my research with a professor there to get a stronger LoR. One drawback is that he is not as good as professors I may contact via email and he works in a different area, so basically I have to learn from scratch (my area and his are both algebra, though).\r\n\r\nThis is a much better approach.", "605" ], [ "@user71659: Likewise, national boundaries could be important in many contexts that aren&#39;t explicitly political. Say you have data on widget ownership rates by country. You might like to illustrate it with a map where countries are colored differently according to widget ownership rates. So you need to show national borders, and you have to put them somewhere...", "167" ], [ "There&#39;s wide variation in when people settle on a dissertation topic. I don&#39;t think you can specify a particular time to panic or not.\r\n\r\nHowever, it sounds like it&#39;s certainly time to sit down with your supervisor and negotiate. You should agree on answers to the following questions:\r\nWhat exactly are your supervisor&#39;s expectations for what needs to be in your finished thesis? What are the \" ;must haves \" ; and \" ;nice to haves \" ;? How long will it take to accomplish those goals? What difficulties could potentially arise, and do you have plans to overcome them, or contingency plans in case of unexpected failures? When do you expect to defend? What other publications do you expect to produce along the way? How does this relate to the timing of job applications?\r\n\r\nIn this process, you may have to be more assertive than you have been in the past. Don&#39;t settle for vague answers. If possible, put a plan in writing and get your supervisor to agree.", "605" ], [ "In some cases the award committee or sponsoring organization may describe its procedures on its official website. Otherwise, you can write to the award committee chair and ask.\r\n\r\nI don&#39;t think there&#39;s any more general way to know. In particular, I doubt that there is any central place where you can find this information for many different awards. (It would be a pain for someone to collect it and keep it up to date.)", "307" ], [ "If the university decides one of the payments was made in error, they will almost certainly demand it back, and if you don&#39;t repay it promptly, they&#39;ll likely take steps that you won&#39;t enjoy (e.g. withholding from your paycheck, suing you, firing you, etc; specifics will depend on their policies and local law). So don&#39;t spend the extra money until the situation is clarified. Keep it in your bank account. If they&#39;re paper checks, don&#39;t cash or deposit them.\r\n\r\nContact your advisors in both departments and explain the situation. If somehow you&#39;re entitled to both payments, you&#39;ll get explicit confirmation and then you&#39;ll know you can keep all the money. If not, they can negotiate between themselves as to where the money should go, and they&#39;ll tell you how much to repay, to whom, and how.", "687" ], [ "I see. Are you sure this isn&#39;t just a misunderstanding? My experience with math journals is that they always ask for \" ;first author \" ;, \" ;second author \" ;, etc. But if the authors want alphabetical order, then you&#39;re expected to put the alphabetical first author in the \" ;first author \" ; blank, and so on. If so then Postdoc is doing it exactly right. And even if that&#39;s not what the journal intends, it could be an honest mistake on Postdoc&#39;s part.", "827" ], [ "It might be informative to go through a dummy submission and see what the form looks like. I haven&#39;t submitted a multi-author paper to JFA myself, but again, my experience is that to a journal, \" ;first author \" ; just means \" ;who should be listed first \" ;, nothing more. It&#39;s up to the authors to decide on their own who gets listed first, whether it be alphabetical or something else.", "827" ], [ "I think you&#39;ve misunderstood the situation. It appears to me that this is being handled properly by your co-authors, and any action on your part would be inappropriate.\r\n\r\nAs you&#39;ve clarified, you and your co-authors are following the usual authorship convention for pure math, which is that authors are listed alphabetically, with the corresponding assumption that all authors contributed equally to the paper. (Of course, this is often a polite fiction, but you&#39;re on board with it now and so it doesn&#39;t behoove you to denigrate their contributions.) You say the alphabetical order here is Postdoc, RecentStudent (that&#39;s you), Supervisor.\r\n\r\nFrom the journal&#39;s point of view, \" ;first author \" ; just means literally that: whose name should be printed first on the title page? And since you&#39;ve decided to use alphabetical order, Postdoc is indeed the \" ;first author \" ; in that sense. So it is absolutely correct that he&#39;s identified as \" ;first author \" ; in the journal&#39;s paperwork. **Nobody is playing any funny games here.**\r\n\r\nAny significance attached to the ordering of the authors, or who comes first, is in the minds of the authors and the readers. The journal doesn&#39;t want to get involved in the question of who is the \" ;primary \" ; author, or who did the most work, and they really don&#39;t care. They just want all the authors to agree on what should go on the title page, and which name should be printed first, second, third, etc. Any way is fine with them so long as the authors all approve.\r\n\r\nIf it helps, the submission form for JFA has a section that looks like this:\r\n\r\n[![enter image description here][1]][1]\r\n\r\nYou click the little arrows to change the order. Note that \" ;First Author \" ; is automatically attached to whoever is first on the list.\r\n\r\nYou definitely should *not* tell the journal that you&#39;re the \" ;actual \" ; first author. They&#39;ll interpret this as a sign that you want to be *listed* first, and thus the authors are not in agreement about what should appear on the title page. They&#39;ll put the whole submission on hold until they can be assured that the three of you have worked it out. This will greatly annoy your co-authors, especially since it seems to have already been understood that alphabetical order was to be used.\r\n\r\nIf you really wanted to be listed first (i.e. out of alphabetical order), in principle you could open that discussion with your co-authors, but I think it would reflect poorly on you, especially at this late date. I don&#39;t advise that. In any case they&#39;d have to agree. The journal won&#39;t settle such disputes for you.\r\n\r\nAs a side remark, your co-authors really should have asked you before submitting to a new journal. It sounds like it&#39;s not worth making a fuss about it now, but you might ask them politely to involve you in the journal selection process in case it needs to be done again (which is not unlikely; JFA is pretty selective). They may have assumed that, since you&#39;re no longer in academia, you wouldn&#39;t really care and would rather not be bothered - not really a valid assumption, but perhaps understandable. As for the boycott, it&#39;s a fine point to bring up in a discussion, but I think most people feel it would be poor form to insist if your co-authors don&#39;t feel the same - especially if, as in the Postdoc&#39;s case, they&#39;re at a career stage where \" ;getting published in the best journal \" ; has to take precedence over idealistic considerations.\r\n\r\n\r\n [1]: _URL_0_", "827" ], [ "@Phoenix87: I don&#39;t think your interpretation is correct. The journal does not **have** any way to specify an \" ;actual first author \" ;. The form is to allow you the freedom to have the authors listed in a different order than alphabetical, if that is what the authors have decided. Alphabetical order is widely followed in math, but it isn&#39;t mandatory, and if the authors choose something else the journal will allow it.", "827" ], [ "At least in US academic culture, the fact that P is applying for a given position, or is applying for jobs at all, should be considered confidential. As such, if you&#39;re the recruiter, you should not contact S or T or anyone else regarding P&#39;s candidacy, unless you first get permission from P. (Obviously, you have implicit permission to contact A, B, C, since they were listed on the application.)\r\n\r\nAsking S or T for a general assessment of P&#39;s abilities, without saying that they&#39;re applying for a job, is a gray area. I would advise against it, since people will tend to infer that your reason for asking is because P is a job candidate.\r\n\r\nIf you&#39;re the candidate, on the other hand, you should be prepared for the possibility that the employer might contact S or T anyway, even though they&#39;re not supposed to.\r\n\r\nExpectations might be different in different cultures.", "304" ], [ "On another note: \" ;I would not be allowed to utilise my affiliation with my current research institute for submission to a journal after the expiration of my tenure \" ; - this is *not* fine. The usual rules for affiliation is that it should describe the institution where you did the work, even if you no longer work there by the time you submit the paper. To omit it would mislead the journal&#39;s editors and readers, and likely violate their rules.", "827" ], [ "@GlenO First of all, you didn&#39;t write \" ;the bad literal translation \" ;, you wrote \" ;the literal translation \" ;. and Secondly, you could call it a literal translation up to a point, but since it adds \" ;They Are Beasts \" ;, that is not translating, that is fabricating, and you only mention it in a note at the end, when the rest of your entire post from start to just before that last paragraph, has been affirming that that english in the question is \" ;the literal translation \" ;.", "836" ], [ "Talking to a *dean* is probably not the place to start. Independent study should normally be arranged directly between a student and a professor, so it&#39;d be best to start by identifying a professor you&#39;d like to work with - typically this should be someone who&#39;s taught the course before - and asking them whether they&#39;d be willing to supervise you in an independent version of the course.\r\n\r\nHowever, independent study is typically not \" ;compensated \" ; the same as regular teaching. This varies between institutions, but it&#39;s quite possible that the professor would have to work with you on top of all her existing teaching, research and service responsibilities, without it increasing her pay or performance ratings. As such, don&#39;t be too surprised if no professor will agree to do it - it&#39;s not that they&#39;re being mean or uncaring, just that the incentive structure does not make it worthwhile.\r\n\r\nIf you can&#39;t find any professor willing, then you could consider approaching a dean or department chair who may be able to pressure them a little. But I still wouldn&#39;t be too hopeful. Using independent study to compensate for cancelled courses is a pretty unsustainable model for the university.\r\n\r\nAt this point, it would be wise to look into the possibility of doing your masters somewhere else, and seeing if at least some of your credits can be transferred. A program this small may be at risk of being cancelled altogether before you can finish.", "605" ], [ "> Given the initial enthusiasm of the supervisor and the silence since she took my draft should I accept my proposal must be horribly wrong and must be binned. \r\n\r\nNo, that&#39;s not a reasonable inference. Students often seem to think that professors use silence as a form of implicit rejection, but I&#39;ve never actually seen this, and it would be unprofessional in this context.\r\n\r\nIt&#39;s vastly more probable that she has just been too busy to reply, especially if she had planned to write something relatively complex, or hasn&#39;t been able to finish reading your proposal. (And honestly, your initial response about throwing it all out may have complicated it more, since now she probably wants to write something that will not only express her opinion but also reassure you.) She may also be ill, out of the office, on vacation, traveling to a conference, etc. July is a major travel period for many professors.\r\n\r\nI would suggest that you try to set up a meeting in person, if possible. It should be much faster for her to reply to that message, since she only needs to check her calendar, rather than trying to articulate in words her response to your proposal. And having a meeting scheduled will create a deadline for her to have her response ready. It&#39;s best if you suggest a few times when you are available, to minimize the number of back-and-forth emails needed to agree on a time.", "605" ], [ "@Lisa: I&#39;m a professor, and I can tell you what often happens to me: I promise optimistically to do something by a certain date. Stuff comes up and I can&#39;t get it done. The person emails me asking for an update. Rather than respond right away and say it isn&#39;t done, I plan to get the task done quickly so I can respond that it is done. Stuff comes up and I can&#39;t get it done. Repeat. It&#39;s not good, but it happens, and it&#39;s no reflection on the person I&#39;m (not) communicating with.", "605" ], [ "I think this is a good description. The way I think about it is that you can choose what to work on in the short term, and be judged based on the results in the long term - does it eventually result in valuable contributions to the research community? You could choose to work on squaring the circle, and you wouldn&#39;t be told to stop - but after a while, when it didn&#39;t result in publishable papers, there&#39;d be negative consequences for your career. Same for teaching - you can choose your own methods, but if they don&#39;t work out, there&#39;ll eventually be pressure to do something else.", "197" ], [ "> I had assumed that since my tuition would be covered anyways in a PhD program, there was no advantage to being in-state. \r\n\r\nThere&#39;s no financial advantage to *you*. There might be one to the department.\r\n\r\nI believe that one common arrangement is that the department&#39;s budget is charged for the normal amount of your tuition, whether in-state or out-of-state. Although it&#39;s just money moving between internal university accounts, it makes a difference to the department. \r\n\r\nI went to grad school at a University of California campus, and there was a rule that if you had come from another state, you had to establish California residency within your first year, so that the department only had to pay the out-of-state rate for one year. So if you plan to attend a California university, you&#39;ll likely have to go through that bureaucratic hassle eventually anyway; might as well get started now.\r\n\r\nBeing in-state also means that the department gets to pay the lower rate from the beginning, so you&#39;d be a bit cheaper to support than an out-of-state student. I don&#39;t know whether departments actually make this an explicit factor in admissions, and I would guess that they don&#39;t, but it could make a very slight difference at the margin.", "906" ], [ "A related situation: in the US it&#39;s quite common that if a professor wants to quit her job at University X to go work at University Y, then X will let her go on unpaid leave for a year instead of resigning. Thus for the first year she is on leave from X and employed by Y. If at some point during the year, she decides she liked X better after all, she can just go back there, without having to reapply for her previous job. This doesn&#39;t seem to cause any particular problems, though I don&#39;t know if there are special arrangements involved.", "605" ], [ "If the research is of sufficient quality, you can write papers and submit them for publication in peer-reviewed journals / conferences.\r\n\r\nCheck to see if your institution has specific rules about publishing material from a thesis. Also, if your advisor or any other person made significant intellectual contributions to the work in the thesis, they may be entitled to co-authorship and you&#39;ll need their approval before submitting any papers. (It is probably a good idea to consult with them anyway about whether the work is of appropriate quality, and what revisions should be made before publishing.)", "827" ], [ "> I am interested in retracting my old journal articles. Would it have any negative effects on my academic career?\r\n\r\n**Yes, it would have severe negative effects. Don&#39;t do this.**\r\n\r\nRetraction is intended for two main types of situations:\r\n\r\n1. The paper contains serious errors that completely invalidate its conclusions and can&#39;t be fixed just by publishing a correction.\r\n\r\n2. The author is guilty of serious unethical behavior: plagiarism, fake data, mistreatment of animal subjects, studies on humans without their consent, etc. \r\n\r\nAs I understand it, 1 isn&#39;t applicable here: your results aren&#39;t false, they just don&#39;t go as far as they could. And the missing reference, especially if you didn&#39;t omit it intentionally, should be fixed by a correction or addendum. And 2 certainly isn&#39;t applicable.\r\n\r\nHowever, if the paper is retracted, people will assume that it was retracted for one of the above reasons, either of which would be a serious black mark for a researcher. (You might like to browse _URL_1_ to see what kind of company you&#39;d be keeping.) As such, it very well might completely destroy your chances of further academic study or employment.\r\n\r\nMoreover, a retracted paper doesn&#39;t just drop out of sight. The publisher won&#39;t take it down from their website - they&#39;ll leave it there with a big RETRACTED stamped across it. It&#39;ll continue to be found in searches, and people who find it will assume that you&#39;re guilty of 1 or 2 above. Also, there&#39;s an argument to be made that [ethically, you&#39;d have to continue listing it on your CV, marked as \" ;retracted \" ;](_URL_0_).\r\n\r\n(As others have mentioned, you don&#39;t have the right to retract a paper unilaterally. The journal has to make that call, and they should only do it if there&#39;s convincing evidence of 1 or 2 above. So the whole thing is probably moot. But even so, if you *ask* them to retract the paper, they&#39;re likely to think that you&#39;re confessing to 1 or 2, and you don&#39;t want to give that impression, even if it&#39;s cleared up before anything happens.)\r\n\r\nThe solution for having used low quality methods in the paper is just to do better work in the future. You could, if you want and as <PERSON> suggests, go back and study the same question with better methods. But I don&#39;t feel you&#39;re obligated to do that - if you are interested in other topics now, feel free to do that. People don&#39;t generally judge researchers harshly just because their early papers were less than outstanding. Indeed, the fact that a paper from a bachelors thesis got published at all will be a plus. In the long run, the focus will be: how good is your best recent work?\r\n\r\nThe solution for the missing reference is, as mentioned, to keep pushing the journal to print a correction or addendum. (If their editors were responsible for dropping the reference, they should admit that in the correction.) If they won&#39;t, you can post one on your own website.", "827" ], [ "@JessicaB: The US version of the question talks about what factors are considered to be important for admission, how they are typically weighted, and what a student should prioritize if they want to be a stronger candidate. It&#39;s meant as a general way to address the flood of questions of the form \" ;my GPA is x.xx, I have n publications, what are my chances of getting into University Z? \" ; I think those would be useful to discuss for the UK as well.", "197" ], [ "I propose that any such question should be rephrased as follows:\r\n\r\n > **Where can one find** salary data for job type X / country Y / field Z?\r\n\r\nIf the question is just \" ;What is the salary range? \" ;, then what would an answer look like? If it just gives specific figures, then it can&#39;t be expected to be valid into the future. If it comes from someone&#39;s personal experience or guess, then it&#39;s purely anecdotal. What you really want are statistics based on large-scale data from a reliable source. So if such a source exists, then why not simply link to it? That way, people will be able to find well-referenced data into the future (assuming the source continues to update their data, which many do).\r\n\r\nAlso, if the source turns out to give a broader range of data (covering multiple job types / fields / countries) then the question can be broadened retroactively, so that people searching for any relevant combination can find their source in this question, and not have to ask separately.\r\n\r\nThis way, instead of giving people fish, we&#39;re teaching them to fish, or at least telling them how to get to the river.", "793" ], [ "Keep in mind that the number of questions on this site doesn&#39;t give any indication of how common such issues are, since people usually only post when something is wrong. We don&#39;t hear about all the cases where everything is fine.\r\n\r\nI don&#39;t know any reason why math advisors should inherently be better people than in any other field, and I don&#39;t know of any empirical data that attempts to measure this. However, a few of the specific issues you mention are perhaps less likely to arise in mathematics, due to cultural and structural reasons.\r\n\r\n > \" ;my advisor has stopped funding me \" ;\r\n\r\nIn the US, at least, the main avenue of funding for math graduate students is through teaching assistantships, since math departments teach a large number of service courses. Faculty who have grants can sometimes offer their students a research assistantship instead, so that the student doesn&#39;t have to teach. But a student really isn&#39;t completely reliant on their advisor for funding. Moreover, there typically aren&#39;t major expenses for the research itself (no expensive equipment, etc), so as long as the student is getting paid, research can continue.\r\n\r\n(This is not necessarily the case in other countries.)\r\n\r\n > \" ;my advisor wants to be 1st author, when I did the majority of the work! \" ;\r\n\r\nThe general practice in mathematics is that all authors are listed alphabetically, and the concept of \" ;first authorship \" ; does not exist. As such, people don&#39;t bother to keep track of who did the \" ;majority \" ; of the work. So this particular issue doesn&#39;t arise in mathematics.\r\n\r\n > \" ;my advisor is stealing my ideas! \" ;\r\n\r\nWhile individual departments may vary, I think there&#39;s a general sense in mathematics that a joint paper \" ;counts \" ; about the same as a solo paper. As such, if a student has contributed to a project, the advisor has no particular incentive *not* to include them as an author on the paper.\r\n\r\n > \" ;my advisor wants to add another student to the paper and this is unfair! \" ;\r\n\r\nAs above, it isn&#39;t any particular disadvantage to a student if another student is added.", "644" ], [ "Many, if not most, universities have policies that would forbid this, or require extra scrutiny.\r\n\r\nSearch your university&#39;s hiring, HR, and conflict-of-interest policies to see if they address this (it could be under \" ;nepotism \" ;). Even if you don&#39;t find anything forbidding it, don&#39;t go ahead yet - check with your department chair and/or HR administrators. Make sure you can make a clear case as to why your family member is qualified, and why the direct hire would be better than an open application process. Don&#39;t go ahead with the hire until you have explicit informed approval from someone who has the authority to approve it.\r\n\r\nIf the money for this position comes from an external grant, you should repeat the above steps with \" ;university \" ; replaced by \" ;funding agency \" ;.", "605" ], [ "@JeffE: Certainly. On the other hand, funding isn&#39;t tied to any *particular* advisor, which makes it *somewhat* more possible to switch to a new advisor if the relationship with the current one isn&#39;t good - without having to worry about whether the new advisor has funding available. There are still issues involved in doing this - potentially having to start over with a new project, time limits, willingness of new advisor to spend time working with you - but taking funding off the table at least removes one complicating factor.", "622" ], [ "One reason to \" ;disallow \" ; results not yet studied is that it helps to avoid circular logic. A standard example: student is asked to show that lim_{x - > 0} sin(x)/x = 1. Student applies L&#39;H&#244;pital&#39;s rule, taking advantage of the fact that the derivative of sin(x) is cos(x). However, the usual way of proving that the derivative of sin(x) is cos(x) requires knowing the value of lim_{x - > 0} sin(x)/x. If you \" ;forbid \" ; L&#39;H&#244;pital&#39;s rule in solving the original problem, you prevent this issue from arising.", "388" ], [ "I second [<PERSON>] of writing explicitly in the question that X technique must be used.\r\n\r\nAs to the concern that they will get a mistaken impression as to the usefulness of X: don&#39;t rely on the exam to convey this idea! My philosophy is that an exam is just to assess the student&#39;s knowledge and understanding. I don&#39;t find that it works well to assign an \" ;interesting \" ; exam problem from which the student is supposed to learn something new. An exam setting is too stressful to be a good time to acquire new knowledge.\r\n\r\nPresumably there are examples that illustrate the full power of technique X, where simpler techniques don&#39;t work well. You can still have the students work those examples; just not on an exam. Maybe as a homework assignment, or a term project, or whatever. Hopefully by the end of the course, they&#39;ve done enough of them that one \" ;toy \" ; example on the exam is not going to distort their impression of the technique&#39;s power.\r\n\r\n(If your educational system uses exams as the sole graded element of the class, so that you can&#39;t realistically assign projects and such - my condolences. I don&#39;t have any brilliant ideas in that case.)\r\n\r\n\r\n [1]: _URL_0_", "197" ], [ "This answer kind of gives the sense of \" ;academics are all perfectly fair unbiased people, it&#39;s only governments that cause problems \" ;. I think that&#39;s overly rosy. Academics are people and certainly can be affected by biases, including favorable or unfavorable views of universities based on country or culture. If you&#39;re claiming that those biases don&#39;t significantly affect decisions like hiring, I&#39;d like to see that claim backed up by data.", "76" ], [ "Predictions are hard, especially about the future, and I think this is at risk of being closed as \" ;opinion based \" ;. That said, you have a lot of unjustified assumptions and oversimplifications here. Improvements in teaching can allow people to learn more material in less time. Also, research tends to become more specialized: 500 years ago, a \" ;proper researcher \" ; could be expected to understand all of known mathematics. Today, that is impossible for any one person, but a \" ;proper researcher \" ; is only expected to understand a sub-subfield, so they can still get to that point in reasonable time.", "644" ], [ "As I see it, the reviewers and editors don&#39;t have an obligation to redo the literature search. However, the reviewer should be someone who is sufficiently familiar with the topic that they would be reasonably likely to know about relevant prior work, and should be able to identify serious omissions in the literature search. A reviewer who doesn&#39;t have that level of expertise should not be assigned, and if assigned should probably decline to review the paper.\r\n\r\nOf course, if the reviewer does know about prior work that duplicates the paper under review, then they should require the authors to cite it, and evaluate the paper based on its novel contributions only, if any (or as an independent simultaneous discovery, if the timing makes that a possibility).\r\n\r\nFinal responsibility for the content of the paper always rests with the authors alone. However, if the paper is accepted and later found to be a rediscovery, a common course of action is to print an \" ;acknowledgement of priority \" ;, a short note citing the previous paper and acknowledging that it was first. Typically it wouldn&#39;t be retracted. (Of course this only applies if the editors believe the paper is really an honest independent rediscovery; if it is plagiarism then it should be retracted.)", "827" ], [ "I would expect that the applications are processed in such a way that the committee who makes the decisions doesn&#39;t know whether or not the fee was waived, though I don&#39;t know for sure. Maybe someone with firsthand knowledge can confirm. Of course, if the GRE was waived then the committee will certainly see that you don&#39;t have a GRE score. How this would affect their decision is hard to judge, since different departments may weigh GRE scores in very different ways.", "605" ], [ "There is no universal standard for \" ;papers published by a university in the US \" ;. Many different styles exist, and different journals may prefer different styles. This may be the case even for different journals published by the same university press. You&#39;ll have to check each journal for the style they want. It will often be on their website, under \" ;instructions for authors \" ; or something similar.\r\n\r\nIt&#39;s also possible that the journal doesn&#39;t particularly care what style is used in an initial submission, and will only ask for their style to be used after the paper is accepted. Or they may reformat it for you at that point.", "827" ], [ "Whether he wants to work with you or not, you&#39;re certainly entitled to a response. It&#39;d be deeply unprofessional for a professor to intentionally \" ;ghost \" ; a student at their own institution. That doesn&#39;t mean it&#39;s impossible, but there are lots of mundane explanations that seem much more plausible: he&#39;s overwhelmed by other work, he&#39;s on vacation, he&#39;s ill, he&#39;s disorganized, he&#39;s dealing with personal issues, he&#39;s at a conference, he&#39;s thinking about how to respond, your email went in a spam filter. In all cases, the solution is to either wait or else try to contact him by other means.", "605" ], [ "It&#39;s also worth noting that conventions on citing and quoting are not universal, and can vary between academic communities. For example, in mathematics, it is quite common to copy definitions or statements of theorems verbatim, or nearly verbatim, from other papers. The precise wording and notation can be critical, so wholesale paraphrasing is risky. However, the convention in this field is that quotation marks are not used in such cases, though a citation should usually appear. Likewise, if a definition or statement is \" ;common knowledge \" ;, it might be that every paper discussing it uses almost identical wording (maybe without citations), even though they have not consciously copied from each other.\r\n\r\n(I don&#39;t really know how this practice arose, but one point is that it often happens that you want to state a theorem almost verbatim, but modify the notation to match what you&#39;re using in the present paper. Now it&#39;s not an exact quote anymore, so you can&#39;t strictly use quote marks, and noting your amendments with brackets could be very confusing when mathematical notation is involved.)\r\n\r\nThis can add up to several paragraphs or pages of \" ;copied \" ; text over the course of a paper. A newcomer to the field might see this and be horrified by the blatant \" ;plagiarism \" ;, but within the field it&#39;s regarded as perfectly proper.\r\n\r\nAdditionally, it&#39;s completely normal in mathematics to write things like \" ;The material in this section comes mainly from [3] \" ; without adding [3] to every other line. It&#39;s more about common sense than following rules.\r\n\r\nSo, the moral is to make sure you&#39;re calibrating your standards properly to the specific discipline in which you&#39;re working.", "541" ], [ "> I thought that a grader would solely be responsible for grading homework.\r\n\r\nThen it appears you misunderstood the expectations of your job.\r\n\r\nJob titles like \" ;grader \" ; are loose and don&#39;t necessarily describe the complete set of duties expected of a person holding that role. (A \" ;professor \" ; does much more than just \" ;professing \" ;!) It&#39;s certainly very common for a student to be hired for a job which includes both grading and helping students with questions, and sometimes other duties besides. It seems that at your school, this job is simply called \" ;grader \" ; for convenience. The assumption is that both grading and helping students require a certain level of expertise with the course material, so somebody qualified for one should also be qualified for the other.\r\n\r\nIf they assigned you to spend time in the skills center, the implicit expectation is that you are to spend this time assisting students who come to the center looking for help. In particular, you should not plan to spend this time working on grading (unless no students show up). Grading time would be on top of this and you should plan accordingly. So no, there isn&#39;t any kind of \" ;protection \" ; from doing what is simply part of your job.\r\n\r\n\r\nAssisting students at the center may *also* be one of the duties of a TA, but that doesn&#39;t mean that you can&#39;t be asked to do it too. It seems clear that there&#39;s plenty of this work to go around.\r\n\r\nNote that *assisting* doesn&#39;t necessarily mean *answering questions* - if a student just asks you \" ;what&#39;s the answer to problem 6 \" ;, you should not answer that question directly! But you should work with the student to help them learn what they need in order to solve the problem on their own. There is a fine line between helping and giving away answers, and you&#39;ll get better at it with experience. You can also talk with the professor or TAs to get some guidance.\r\n\r\nIf you really don&#39;t like this task, you have the right to quit your job (unless you have some sort of binding contract). But many people find working with students to be valuable experience, especially if you have any interest in a career involving teaching. It also helps develop your communication skills, and tends to help deepen your understanding of the topic of the course.\r\n\r\n(If you have some sort of written contract that specifies that a grader is required *only* to grade homework/exams and nothing else, then you might have some remedies through HR or a union or some similar structure. But I doubt that this is the case.)", "197" ], [ "There&#39;s (at least) four aspects of learning a language: reading, writing, listening, speaking; and one might find it valuable to learn different languages in different ways. For instance, I found it very helpful to learn to read French, because there are important papers in French in my field, but I only ever had minimal need to write it (I once had to write an abstract for a bilingual journal). As far as speaking or listening, so far, German would have been more useful to me than French.", "133" ], [ "@IanSudbery: I think the point is that in the US system a \" ;studentship \" ; isn&#39;t a contract that binds both parties. It&#39;s analogous to employment in the US, which generally works the same way: either employee or employer may end it at any time with few restrictions. The parties could in principle agree on a binding contract, but they generally don&#39;t.", "605" ], [ "[Berkeley offers the following rationale for their policy](_URL_0_):\r\n\r\n > The Graduate Council views academic degrees as evidence of broad research training, not as vocational training certificates; therefore, applicants who already have academic graduate degrees should be able to take up new subject matter on a serious level without undertaking a graduate program, unless the fields are completely dissimilar.\r\n\r\nAlthough this is rather vague, it does suggest that they believe that when one already has a PhD, it is pointless to enter another graduate program in a similar field, as one has already demonstrated \" ;broad research training \" ; and shouldn&#39;t need more. And since PhD program spaces are a limited resource, and involve a considerable investment of faculty time and university resources, they don&#39;t want to spend it in ways that they consider pointless.\r\n\r\nThat&#39;s my interpretation, anyway.", "906" ], [ "If the reviewers feel that the paper generally has merit, but is in need of certain reasonable corrections or revisions, they will often write a list of specific changes or improvements that are needed, and recommend acceptance subject to those revisions. This is what people mean when they talk about getting a \" ;minor revisions \" ; or \" ;major revisions \" ; decision on their paper.\r\n\r\nAnother possibility is \" ;revise and resubmit \" ;, where the reviewers aren&#39;t convinced whether the paper has merit, or if the errors are fixable, but they explain their concerns and are willing to take another look if you&#39;re able to fix the paper to address them.\r\n\r\nIf they doubt that the paper can be salvaged, or if they don&#39;t think the results are interesting enough even if they were corrected, or the paper is generally not up to an appropriate level of rigor and clarity, it&#39;ll be rejected. In this case they may not give you very detailed feedback. After all, their goal is to help get good papers published, and if they don&#39;t think your paper is ever going to get there, why should they spend time on it? \r\n\r\nGenerally, it isn&#39;t the reviewer&#39;s job to help you write a good paper, and you can&#39;t use the peer review process as a substitute for your own learning.", "827" ], [ "It&#39;s very strange that the professor would ask *you* to find this out. It depends entirely on the rules of his institution, and so he&#39;s the one best placed to talk to administrators and find the answer. But even if it&#39;s not allowed to hire you as a postdoc, it may be possible to hire you with some other job title instead - and it&#39;s the professor who would have to make the decision as to whether to do that.", "906" ], [ "You don&#39;t need to use a specific template to submit your paper to this journal.\r\n \r\n_URL_0_\r\n\r\n > As part of the Your Paper Your Way service, you may choose to submit your manuscript as a single file to be used in the refereeing process. This can be a PDF file or a Word document, **in any format or lay-out that can be used by referees to evaluate your manuscript**.\r\n\r\nSo any generic format would be fine, e.g. the basic LaTeX `article` class. If your paper is accepted, either you or they will redo the formatting for publication, and they&#39;ll give you the correct template if necessary. But there is no point spending any time on that now.", "827" ], [ "I strongly recommend that you share your paper, not only with your friends and family but also with the entire academic community. Upload your paper as a preprint to [arXiv](_URL_0_). This is the major way for papers to be shared before publication (and after), so that other researchers can learn about your results without waiting for the peer review process (which in mathematics is particularly slow).\r\n\r\n(Of course, you&#39;ll need to make sure your co-authors agree before you do this.)\r\n\r\nSee _URL_1_\r\n\r\nYou may want to double-check that your intended journal will still publish papers when their preprints are on arXiv, but I&#39;ve never heard of any reputable publisher in mathematics having a problem with this.\r\n\r\n > If you share a paper before it has been submitted, it is theoretically possible that other people could steal your work, etc, before you submit it. What about after you have submitted your paper?\r\n\r\nI would not worry about it. The journal has a record that you submitted it, which would be powerful evidence in case of a priority dispute. Posting to arXiv is an even stronger form of evidence, since it&#39;s automatically visible to the public.\r\n\r\nIn most cases, \" ;stealing work \" ; is a minimal risk, compared to the much larger risk of not getting sufficient attention for your work. It&#39;s usually best to err to the side of sharing.", "827" ], [ "I don&#39;t know how appeals work in your academic system, but usually a successful appeal requires you to show that something in the professor&#39;s grading was objectively incorrect - e.g. you got something right and it was marked as wrong. If it was a judgment call, e.g. you got the question wrong but you disagree as to the amount of partial credit you received, that is much less likely to be changed on appeal.", "605" ], [ "Ultimately, you can&#39;t make someone collaborate or communicate with you if they don&#39;t want to. I think your only option is to either abandon the project, or rewrite it to remove the parts that your collaborator contributed and then publish it as solo work. I don&#39;t see how union representation could help in any way.\r\n\r\nI&#39;m pretty surprised that this would happen twice, and would wonder if there&#39;s something about your interactions that might be causing it. People usually don&#39;t voluntarily drop all contact with a collaborator unless something has happened that makes them uncomfortable to continue working with them - ethical concerns, abusive behavior, severe inability to communicate, etc. If you have a colleague who works in the field, and you trust them to be honest with you, you might want to show them the history of your communications and see if they observe any red flags which you might not be aware of.\r\n\r\n\r\n\r\nIf you have any common acquaintances with this collaborator, they might also be able to give you some idea as to what is going on.\r\n\r\nNormally I&#39;d wonder if there is some involuntary reason for lack of communication - illness, personal problems, death, spam filters - but here it sounds like you&#39;ve ruled those out.\r\n\r\nRegardless of what initially caused the breakdown, I don&#39;t think your strategy of \" ;weekly emails/calls for a year \" ; was a good one. I would probably send a maximum of about three messages / calls, with longer periods in between each, and the last one being an ultimatum of sorts: \" ;if I don&#39;t hear back from you by date X, then I am going to do Y \" ; (where Y could be stopping work on the project, or removing their contributions and proceeding, or whatever). And then if they don&#39;t respond, you do Y, and move on with your life. Persistence can be a virtue, but in this case I&#39;m reminded of the saying about how insanity is when you keep doing the same thing and expect different results. \r\n\r\nAnother tip for the future is to have multiple projects going on with multiple different collaborators, so that if one of them falls apart (either for scientific or interpersonal reasons) you still have some publications.", "976" ], [ "Indeed, as mentioned in Pieter&#39;s answer, the university will have an office that is supposed to help you with this (often called International Scholars Office or something of the sort).\r\n\r\nIt does happen that administrative offices are not always as helpful or responsive as they ought to be. As a postdoc you presumably have a mentor or PI at the university whom you will be working with, and they have a vested interest in making sure you can start work on time. So I would reach out to your mentor and let them know you are having trouble getting what you need from the international office. If there are specific deadlines that have to be met, include that information, to give a sense of the urgency. They are likely to be able to prod the people in that office and help move the process along. \r\n\r\nKeep in mind that this is usually the same office that handles visas and other matters for international students, and the school year is just about to start at most US universities, so the office may well be flooded with issues related to incoming students. As such, they may be able to be more responsive after the first couple weeks of the school year, once the flood eases. But it&#39;s not clear if you can afford to wait that long.", "605" ], [ "> Could such professors who signed the letter be at risk of losing their tenure, because the letter could now constitute a form of retaliation and defamation of the victim (the male student)?\r\n\r\nAny answer to this question would be pure speculation at this stage.\r\n\r\nLike most US universities, NYU&#39;s tenure policies are publicly available. Their [Statement in Regard to Academic Freedom and Tenure](_URL_0_) describes what is considered cause to revoke tenure, but as is common at most institutions, the language is very general:\r\n\r\n > VI 2 a) [Adequate cause] Adequate cause includes (but is not limited to) one or more of the following: incompetent or inefficient service; neglect of duty; repeated and willful disregard of the rules of academic freedom as set forth in this statement; physical or mental incapacity; or any other conduct of a character seriously prejudicial to his or her teaching or research or to the welfare of the University. [Cf. University Bylaws, Section 92, Removal of Tenured Faculty and Tenured Librarians.]\r\n\r\nThere is no specific mention of \" ;retaliation \" ; or \" ;defamation \" ; as causes. So, the question would be whether signing this letter constitutes \" ;conduct of a character seriously prejudicial to his or her teaching or research or to the welfare of the University \" ; (or one of the other things listed). That decision would be up to the administration, the Faculty Tenure Committee, and very likely the Tenure Appeal Committee. I don&#39;t think we have any way of guessing what they will do. However, the sheer number of [layers of procedure](_URL_1_) needed to revoke tenure would at least suggest that a lot of people would have to be awfully motivated to make it happen.", "605" ], [ "\" ;We&#39;ve all been in a similar situation when transitioning from undergrad to grad classes. \" ; Though that&#39;s hardly the only time. I think most mathematicians can attest that the feeling of \" ;I don&#39;t know as much as I should \" ; will be pretty much permanent from here on out. You can live with it and be successful, but only if you don&#39;t let it get in the way of interacting with people and doing what you need to do.", "644" ], [ "> And if I only ask a native speaker for proofreading without any certificates, how should i provide the proof?\r\n\r\nHave the proofreader write a short letter to the editor, describing who they are, where they learned English, and stating that they have proofread your paper. They can also state their opinion of the quality of the English after proofreading. Have them sign it, and forward it to the editor.\r\n\r\nWhile of course such a letter could be faked, I doubt that the editor would desire any more proof than this.", "827" ], [ "First, as <PERSON> says, make sure to discuss this with your supervisor / PI and any other collaborators who are involved in your research. Ask them about how much detail they are comfortable with sharing, and show them a draft of your statement before submitting it.\r\n\r\nHowever, in general, you want to give enough details so that it is clear what you are working on. You want to show that you have a deep understanding of the overall project as well as your specific tasks. \r\n\r\nIt is pretty unlikely that an admissions committee member would try to scoop you. First, it&#39;s generally agreed that student / job / grant applications are confidential, and it would be highly unethical for a committee member to use such information for their own benefit. Second, researchers usually don&#39;t lack for ideas of what to work on, so they don&#39;t need to steal them; usually the limiting factor is the time and resources to work on the ideas they have already.\r\n\r\nSo, err to the side of more details. The risk is small, and it is far outweighted by the benefits.", "605" ], [ "Did they specifically ask for change tracking to be turned on? If so, then you should contact the editor and send in an updated version that meets their requirements. If not, then don&#39;t worry about it.\r\n\r\nHaving to handle additional versions due to an author&#39;s mistake could be a little irritating to an editor or reviewer, but if they&#39;re expecting change tracking, then it would be more irritating not to have it. Anyway, administrative issues like this, which do not affect the content of the paper, should not be a reason for rejection.", "827" ], [ "I haven&#39;t heard of this happening, but I suspect what would happen in your example is that the author would write an \" ;extended \" ; version of the article, perhaps including a few additional results or more details. They could submit it to *Science* or wherever, which would review it like any other paper. It&#39;s not duplicate publication because it&#39;s a different paper, and *Science* would likely still consider it \" ;novel \" ; because it hasn&#39;t been published in an academic journal.\r\n\r\nThey should certainly inform *Science* of the previous publication, but I don&#39;t think it&#39;d be a barrier to republication if the paper really was good, and if the additional content was substantial.\r\n\r\nIn practice, it&#39;d be necessary to rewrite the paper anyway, because the audiences and the expectations of the outlets would be completely different. The *New York Times* wouldn&#39;t want a paper full of technical details, and *Science* would insist on having the technical details.\r\n\r\nIf there were copyright issues (e.g. the *Times* held the copyright and wouldn&#39;t give permission to publish an adapted version in *Science*), then the author could rewrite the text of the paper. This makes it a different work for copyright purposes even if they both describe the same results.\r\n\r\nI&#39;ve never heard of any system of \" ;certifying \" ; a previously published article as peer reviewed, like you suggest. However, there is the somewhat related concept of an [overlay journal](_URL_0_), in which the journal effectively \" ;certifies \" ; a preprint. The journal provides the peer review, while arXiv provides the hosting.", "827" ], [ "@JonCuster: Some people might consider a benefit if the search engine can learn from your past searches and direct you to content that is more likely to be of interest to you personally. In most cases, this would likely be more helpful than reproducibility of search results. I&#39;m not sure why that should make the engine \" ;not trusted \" ;. But it would mean that you&#39;d need to take special steps to get a reproducible search when you specifically need one.", "282" ], [ "arXiv has [guidelines for how to publish a translation of someone else&#39;s work](_URL_0_), and I assume this would be similar.\r\n\r\nYou, as editor, should submit with your name in the \" ;Author \" ; field, but include the original author&#39;s name in the title; e.g. \" ;Lise Meitner&#39;s Notes on Uranium Decay \" ;.\r\n\r\nOf course, there is a separate issue of making sure that either the copyright has expired, or that you have permission of the original author (or their estate), which is also mentioned on the link above.", "827" ], [ "I think you&#39;re going to need to talk to someone local, who&#39;s familiar with your specific university&#39;s culture and also your country&#39;s employment laws. Internet people are not really going to be able to help you here - we don&#39;t even know what country you&#39;re in. Another relevant question, which you haven&#39;t really explained, is *why* they are demanding that you leave.", "605" ], [ "There is no point in guessing. Contact the professor directly. Express your interest in working with him, and ask if he is planning to be back at the \" ;home \" ; university next year (or whenever you&#39;d be starting), and if he would be looking to take on graduate students.\r\n\r\nA likely scenario is that he is visiting the other university while on sabbatical, which would typically last one year or less. However, there are many other possible scenarios and no way to know the true situation without asking.", "605" ], [ "Note that there&#39;s a definite economic cost to staying in grad school longer - although you&#39;re funded, you&#39;ll make more as a postdoc or professor, and the sooner you start on that path, the more you&#39;ll be earning in each successive year. Of course you can certainly decide to trade off money for something that&#39;s more important to you, but you should know what you&#39;re giving up.", "906" ], [ "Frankly, the whole thing seems like a terrible idea - a guaranteed way to sabotage your rapport with your students and ensure complaints on your evaluations. If you&#39;re trying to get tenure, this seems like a good way to make sure you don&#39;t get it.\r\n\r\nI suspect that the \" ;if you don&#39;t like it, withdraw \" ; clauses won&#39;t have the desired effect of weeding out all the problem students. Rather, they&#39;ll weed out everyone except those who have no choice but to take the class (required for their major, can&#39;t wait another semester, other sections don&#39;t fit their schedule). Neither you nor the remaining desperate students are going to be happy to be stuck with each other.\r\n\r\nBut I&#39;ll comment on #5 specifically. I believe this is unethical, and probably contravenes your university&#39;s disciplinary rules. While obviously there is wide variation in how cheating cases are handled, I would say that a common principle is that the student has \" ;due process \" ; rights. You can&#39;t unilaterally impose a punishment (and I would say that a more difficult exam is certainly a punishment) based solely on your suspicions. The student has a right to see the evidence against them, defend themselves, and appeal to a higher authority.", "605" ], [ "> I&#39;m not sure if I&#39;m reading too much into it.\r\n\r\nI think you are.\r\n\r\nMy guess is that Professor <PERSON>2 received your email, saw that it contained information for your letter, remembered that he had already told you he would write the letter, and set the email aside, planning to read it in detail when he got around to actually writing the letter. He probably didn&#39;t read far enough to see the part where you asked him to acknowledge the email.\r\n\r\nSo, if you&#39;re concerned, simply send a second email:\r\n\r\n > Dear Dr, #2,\r\n > \r\n > I just wanted to make sure you had received my email of August XX with the information for my letter of recommendation. Please let me know if it looks okay, or if there is anything else you need. As a reminder, the deadline to submit the letter is October XX.\r\n > \r\n > Thanks very much for writing a letter for me!\r\n > \r\n > Sincerely,\r\n > \r\n > <PERSON>\r\n\r\nAs to your other question:\r\n\r\n > I accidentally called this second professor \" ;Professor \" ; in my email even though he&#39;s technically a lecturer so I always address him as \" ;Dr. So-and-so \" ; in my emails.\r\n\r\nDon&#39;t worry about that. It happens all the time and most professors eventually just stop noticing. It&#39;s certainly not the kind of thing that would offend someone so much as to affect their decision to write a letter.", "605" ], [ "I wouldn&#39;t phrase it in terms of \" ;effective prerequisites \" ;. But it&#39;s certainly fine to discuss with the professor whether you are adequately prepared. You could visit their office hours, or send an email:\r\n\r\n > Dear Professor <PERSON>:\r\n > \r\n > I am interested in taking your course MATH 4321. I see that no prerequisites are listed, but I was wondering what background knowledge is expected, and whether I&#39;d be ready for this course. I&#39;ve taken related courses X, Y, Z and feel comfortable with the material from those courses, and have also had some experience with topic Q. Does this seem sufficient? If you can recommend specific topics to review, or additional reading, I would appreciate it. Or, if there are other courses I should take first, that would also be helpful to know.\r\n\r\nIf you like you can attach a copy of your transcript.", "605" ], [ "There&#39;s a widespread belief that shorter lines (fewer characters per line) are easier to read, because the eye doesn&#39;t have to move as far horizontally from the end of one line back to the start of the next. The left edge of the text (assuming left-to-right languages) may already be in your peripheral vision. Thus it&#39;s easier to visually find the correct line to read next, and avoid accidentally rereading the same line or skipping lines.\r\n\r\nThis is the justification for the extremely wide margins that LaTeX uses by default in one-column styles, for instance.\r\n\r\nI don&#39;t know offhand if there is research supporting this belief, but maybe someone can fill me in if they know.\r\n\r\nTwo columns makes it easier to have short lines, without resorting to small paper size, large font sizes, or huge margins. Thus you still get a high density of text per page, and it keeps page counts down (and the associated costs).", "655" ], [ "Hm, this doesn&#39;t reflect the situation in the US, as I&#39;ve seen it. Students are generally required to register for the class (and pay, if applicable). Audits may be allowed (you don&#39;t get a grade and you pay nothing or a nominal amount) but almost always require the instructor&#39;s permission. The instructor is often not allowed to let non-registered, non-auditing students attend, nor non-students (though sometimes it happens anyway). It would basically be giving away the university&#39;s expensive product for free.", "605" ], [ "- A variant on \" ;free book \" ; is \" ;store credit with the publisher \" ;. This gives you the flexibility to offer a smaller amount. Or it can be something like \" ;X% discount on purchases from the publisher. \" ;\r\n\r\n- If there is a prominent conference in your field that many of your reviewers attend, you can have a special reception at the conference, with free food and drinks. This may also be a good way to make connections with them and get feedback.", "827" ], [ "So, what you want to do is take a year off from your studies and get a non-academic job to earn some money? That&#39;s a reasonable thing to want to do, but please don&#39;t call it a \" ;paid sabbatical leave \" ; - that&#39;s very confusing. \" ;Sabbatical \" ; is a very specific process that&#39;s normally reserved to faculty, and when you add \" ;paid \" ; it makes it sound like you want to be paid by your home university.", "605" ], [ "Maybe you shouldn&#39;t use the word \" ;can \" ; in your title, since it seems clear that you *can* use the system - nobody can stop you, and it&#39;s not unethical or illegal in any way. It sounds like the real question is whether it is *common* to use it for a thesis. Perhaps you can rephrase your question to make this more clear.", "605" ], [ "If the paper has been submitted, then of course you can list it as \" ;submitted \" ;, whether it&#39;s public or not.\r\n\r\nOtherwise, I think that about all you can do is to say \" ;in preparation \" ;, but this won&#39;t really have much impact. My impression is that \" ;in preparation \" ; means about as much to a search committee as \" ;I had this idea for a paper \" ;, i.e. practically nothing. They aren&#39;t really likely to believe a candidate&#39;s estimate that the paper is \" ;99% done \" ;, since it&#39;s obviously self-serving. And anyway, the last 1% is often where you discover a critical gap that takes months to fix, or can&#39;t be fixed at all.\r\n\r\nIf the paper really is done or nearly done, your best bet is to work hard and try to get it submitted or posted publicly (preferably both) before you send in your job applications.\r\n\r\nIf you can&#39;t get to that point, then the next best thing is to make sure that at least one of your recommendation writers is familiar with the project. (If you have co-authors, ask one of them to write you a letter.) They can write about how awesome it is and assure the committee that it really is practically done. In this case you still say \" ;in preparation \" ; on the CV, but you have some third-party backup.", "827" ], [ "In the US, in general, universities do offer the student a fancy paper *diploma* when they complete a degree. This is such a strong tradition that I would be pretty surprised if there are any universities that don&#39;t do it at all. I don&#39;t think that JeffE meant to imply that there were.\r\n\r\nHowever, in this culture, this diploma is usually considered to be purely ceremonial in function, and isn&#39;t normally used as proof of the degree. For one thing, diplomas usually don&#39;t have meaningful anti-forgery security features. \r\n\r\nAnd there are various circumstances in which a student who had completed a degree might not have a physical diploma. Maybe they didn&#39;t attend their graduation ceremony, and the university didn&#39;t have their current address to mail it; or maybe they used to have it but lost it at some point. Since it&#39;s a ceremonial document, some people might not go to the trouble to obtain or replace it.\r\n\r\nAs such, in the US, if <PERSON> needs to prove to <PERSON> that she holds a certain degree, the standard method is that <PERSON> sends a request to the university that they send <PERSON> a copy of her *transcript*, which not only records her degree but also her grades in all the courses she took. This will normally be printed on security paper, sealed with an official seal, and mailed directly from the University to <PERSON>, so that <PERSON> has no opportunity to tamper with it. (There could still be ways for <PERSON> to have a fake transcript sent to <PERSON>, but it&#39;s harder, and so this process is usually considered adequate.)\r\n\r\nFor privacy reasons, Alice&#39;s transcript can only be sent upon Alice&#39;s request (and she&#39;ll have to authenticate the request somehow, e.g. by giving her university student ID number which isn&#39;t normally known to anyone else). <PERSON> can&#39;t get it without Alice&#39;s cooperation.\r\n\r\n<PERSON> may have overstated the case when he said this was the *only* way to prove it, but it&#39;s by far the most common in the US higher education system, and other forms of proof are much less likely to be accepted by <PERSON>.\r\n\r\n(I think <PERSON> was also objecting to the term \" ;PhD title \" ; since this term isn&#39;t used in the US to refer to a physical document confirming a degree. So if you asked someone for their \" ;PhD title \" ;, they would not know what you were talking about.)", "605" ], [ "I would apply Hanlon&#39;s Razor here: \" ;Never attribute to malice that which is adequately explained by stupidity. \" ;\r\n\r\nThis sort of mistake is easy to make when filling out journal forms: there is a lot of information to keep straight. In particular, the UI is not always designed so as to make it clear how author order will be interpreted (some forms might always want the corresponding author entered first, even if they will not be the first author). So it&#39;s not too hard to believe that someone could innocently mess it up twice.\r\n\r\nIt would also be an ineffective way for your supervisor to try to \" ;steal \" ; first authorship. For most journals, if the paper is accepted, every author will eventually be asked to sign a consent form agreeing to publication, and in particular, agreeing to the author ordering. You&#39;d eventually find out and make a fuss. \r\n\r\nBut it would be fine to ask your supervisor to contact the editor and request the change, \" ;just so that we don&#39;t forget later, \" ; or, as <PERSON> suggests, to do it yourself. After all, your supervisor has agreed, in writing, that you are meant to be the first author.\r\n\r\n > Addition: I think perhaps the author list inputted in the online fields may be used for citations but the paper itself will have me as first author. So perhaps my supervisor wants their name to be that cited?\r\n\r\nNo, it doesn&#39;t work like that. The journal is going to want one and only one author ordering, to be used both on the paper itself and for all metadata and citations. They should always match. If there is a discrepancy between the manuscript and the online fields, the journal will insist that the authors resolve it before publication.", "827" ], [ "@JibbityJobby: I agree it would have been nice for him to just do it, but in the big scheme of things, it&#39;s really a minor bureaucratic issue, which I think may seem more significant to you because you haven&#39;t been through the process so many times. And I would view \" ;corresponding author screwed up the form \" ; as an exceptional circumstance, especially since the discrepancy between form and manuscript will make it clear that something is not right.", "827" ], [ "A contributed paper session is a session where anyone can submit a talk (rather than having to be specially invited). The criteria for approval are usually not selective and mostly just involve a check that your topic is appropriate for the session / conference.\r\n\r\n > If I register for a contributed paper session, can I register with the paper that has already been published before in a journal (I am the author of the paper)?\r\n\r\nYes, it is fine to give a talk on work that is already published. You should include a citation of your paper in your presentation.\r\n\r\n > Can I use my paper that has not been published yet?\r\n\r\nYes, this is also fine. If you have a preprint that is publicly available (e.g. on arXiv), it would be good to give a link in your presentation. You can even give a talk on work for which the paper is not yet finished, but this is a bit risky, as someone in the audience may decide to work on it, and get their paper submitted before yours.\r\n\r\n > Does the title/abstract of such a talk need to be the same as the title/abstract of the paper the talk is based on?\r\n\r\nNot necessarily, but it&#39;s a good idea if the titles are similar. That way, someone who attends the talk or sees the abstract will have an easier time finding the corresponding paper. For the abstract, your abstract should describe what you will actually speak about, and so the abstract from your paper may not be directly suitable. For instance, your paper probably contains lots of details that you won&#39;t have time to address in your talk.\r\n\r\n > If I am not the only author of the paper, but I am the only speaker at the conference, should I list only myself as the author of the abstract?\r\n\r\nFor the Joint Meetings, all the authors of the paper should be listed as authors in the abstract. (For projects not yet published, list everyone who is expected to be an author of the paper when it is finished.) There is an option to indicate which author is actually giving the talk. \r\n\r\nOther conferences might have different practices. If coauthors are not listed explicitly as authors, they should be acknowledged within the abstract, i.e. \" ;This is joint work with Name and Name. \" ;", "827" ] ]
132
[ 7519, 7778, 4982, 15923, 19230, 2622, 9303, 16373, 5037, 6171, 906, 18658, 11841, 310, 5308, 9716, 15351, 1021, 10527, 1934, 8892, 2793, 16149, 530, 4221, 1701, 11377, 3381, 1652, 1453, 7943, 12908, 9539, 15647, 10202, 9439, 3947, 19251, 18524, 16262, 16191, 5089, 18224, 1691, 15719, 9320, 7995, 18396, 396, 11570, 6547, 19177, 847, 13721, 16868, 8923, 1041, 500, 9076, 3910, 4208, 19500, 12598, 0, 13522, 14345, 18467, 10297, 15779, 17033, 5635, 11770, 5211, 17608, 10472, 16132, 18695, 6760, 7910, 3621, 10258, 10683, 4614, 2475, 6353, 3462, 11916, 4885, 19393, 10348, 6276, 10584, 9811, 3363, 16309, 1503, 2497, 10090, 1023, 18877, 14276, 1277, 4834, 6759, 2900, 949, 6832, 12382, 11665, 1125, 19262, 16120, 15344, 19079, 1527, 9574, 9569, 18763, 2773, 17769, 1239, 5401, 13178, 16310, 206, 1171, 2770, 14416, 4250, 6149, 7179, 16134, 1324, 16804, 18002, 1802, 3970, 19295, 2113, 12283, 19111, 16485, 11025, 14680, 13136, 2008, 725, 89, 11145, 5528, 4491, 8249, 10048, 5435, 5295, 2229, 8327, 10330, 17817, 12331, 19786, 12670, 9456, 640, 18557, 6527, 17276, 5132, 9767, 7794, 59, 17136, 16617, 14917, 1513, 16489, 18832, 8584, 16702, 8020, 9006, 4553, 2395, 9131, 19264, 12036, 430, 11165, 6930, 15674, 16833, 13071, 7931, 18848, 8908, 12994, 613, 14014, 19466, 6396, 10470, 13523, 5893, 9993, 6053, 7350, 14744, 15302, 16287, 1030, 608, 6940, 6671, 11229, 10599, 9190, 2332, 15767, 11493, 710, 18801, 6558, 4153, 18039, 10556, 3514, 6484, 8705, 7888, 17410, 15819, 3360, 16558, 14777, 12523, 13349, 2828, 3838, 2379, 13185, 9840, 6183, 18154, 8037, 13183, 17730, 14953, 9099, 14722, 11848, 1402, 1800, 2263, 11656, 11356, 5004, 8825, 8558, 15212, 18139, 1801, 16944, 925, 11771, 8309, 18259, 7621, 703, 13248, 13896, 2250, 15740, 12148, 2682, 6912, 8916, 13604, 7679, 18391, 706, 17997, 12280, 3415, 9401, 16435, 18985, 3821, 9909, 19651, 5519, 17241, 4272, 12460, 1640, 18431, 19256, 3873, 415, 18138, 331, 12177, 8120, 2642, 17924, 12222, 14048, 11273, 19507, 12223, 14617, 8344, 16496, 8311, 7546, 2420, 19374, 19026, 6084, 4057, 2701, 19614, 1876, 2363, 1956, 4033, 17463, 17645, 1727, 17008, 3473, 10966, 213, 2365, 13616, 1865, 512, 4347, 13599, 6383, 3670, 4405, 1905, 3193, 16103, 16495, 6230, 14390, 16404, 18010, 5717, 6763, 10270, 1879, 3466, 4512, 1124, 7540, 18254, 4946, 16261, 1767, 11258, 11366, 6913, 2769, 8810, 476, 1318, 2254, 4754, 7000, 18040, 4333, 19311, 8881, 11754, 5782, 3231, 13623, 3560, 18353, 16600, 11379, 524, 16712, 14098, 18314, 10876, 5968, 5321, 14209, 437, 18999, 7875, 5118, 13428, 1919, 5743, 16053, 15439, 12253, 6454, 8055, 1039, 15551, 10920, 12952, 16824, 503, 17356, 3938, 15537, 2912, 13184, 16200, 7173, 14516, 97, 15934, 18220, 8956, 7366, 4944, 11327, 17421, 4179, 1574, 6486, 6754, 279, 3796, 9164, 15408, 14281, 18852, 2870, 8263, 2397, 3861, 10511, 1304, 11290, 7397, 10562, 18251, 18879, 13445, 299, 18601, 18920, 2115, 5122, 1517, 5856, 3805, 19285, 12233, 3301, 3178, 6222, 13355, 4187, 10192, 1056, 4348, 19417, 14884, 7110, 14783, 16153, 8326, 3976, 14887, 2868, 7403, 17047, 8668, 1863, 11711, 6970, 9564, 14477, 17722, 7881, 18481, 8936, 12464, 2910, 2463, 1763, 17573, 2076, 14932, 1897, 3697, 18058, 11171, 13480, 4898 ]
STX_10100222.0
[ [ "I need to create a table with an auto increment primary key so I do:\r\n\r\n String sql = \" ;CREATE TABLE Home \" ; +\r\n \t \" ;(id INTEGER not NULL AUTO_INCREMENT PRIMARY KEY, \" ; +\r\n \t \" ; name VARCHAR(255), \" ; + \r\n \t \" ; value DOUBLE PRECISION, \" ; + \r\n \t \" ; data DATE \" ; + \r\n \t \" ; ) \" ;; \r\n\r\nThe problem is that when I executee this query I obtain:\r\n\r\n Syntax error AUTO_INCREMENT\r\n\r\nAnyone can help me?", "480" ], [ "My purpose is create a Filter to handle the exception that are throwed in the servlet.\r\n\r\nSuppose I have this filter:\r\n\r\n public class FiltroAccess implements Filter{\r\n \r\n \tpublic void destroy() {\r\n \t\t// TODO Auto-generated method stub\r\n \t\t\r\n \t}\r\n \r\n \tpublic void doFilter(ServletRequest arg0, ServletResponse arg1, FilterChain arg2)\r\n \t\t\tthrows IOException, ServletException {\r\n \t\t//handle exception\r\n \t\t\r\n \t}\r\n \r\n \tpublic void init(FilterConfig arg0) throws ServletException {\r\n \t\t// TODO Auto-generated method stub\r\n \t\t\r\n \t}\r\n }\r\n\r\nand in my `servlet` I throws the `Exception`\r\n\r\nHow can I must do to handle in my filter the Exeception ?\r\n\r\nAnyone can help me?", "759" ], [ "In my maven project I obtain this exception:\r\n\r\n > AVVERTENZA: Failed to retrieve JNDI naming context for container\r\n > [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/EE]]\r\n > so no cleanup was performed for that container\r\n > javax.naming.NamingException: No naming context bound to this class\r\n > loader \tat\r\n > org.apache.naming.ContextBindings.getClassLoader(ContextBindings.java:268)\r\n > \tat\r\n > org.apache.catalina.deploy.NamingResourcesImpl.cleanUp(NamingResourcesImpl.java:993)\r\n > \tat\r\n > org.apache.catalina.deploy.NamingResourcesImpl.stopInternal(NamingResourcesImpl.java:976)\r\n > \tat\r\n > org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:226)\r\n > \tat\r\n > org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5476)\r\n > \tat\r\n > org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:226)\r\n > \tat\r\n > org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:264)\r\n > \tat\r\n > org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:856)\r\n > \tat\r\n > org.apache.catalina.core.ContainerBase.destroyInternal(ContainerBase.java:1038)\r\n > \tat\r\n > org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:297)\r\n > \tat\r\n > org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:856)\r\n > \tat\r\n > org.apache.catalina.core.ContainerBase.destroyInternal(ContainerBase.java:1038)\r\n > \tat\r\n > org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:297)\r\n > \tat\r\n > org.apache.catalina.core.StandardService.destroyInternal(StandardService.java:585)\r\n > \tat\r\n > org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:297)\r\n > \tat\r\n > org.apache.catalina.core.StandardServer.destroyInternal(StandardServer.java:883)\r\n > \tat\r\n > org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:297)\r\n > \tat org.apache.catalina.startup.Catalina.start(Catalina.java:685) \tat\r\n > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) \tat\r\n > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\r\n > \tat\r\n > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n > \tat java.lang.reflect.Method.invoke(Method.java:498) \tat\r\n > org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:353) \tat\r\n > org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:493)\r\n\r\n\r\nAnyone can help me to understand why?", "788" ], [ "In my application I need to print the log in the console and then I have to put them in db. My apllication prints the log in the console but it doesn&#39;t put the log in db. This is my `logback.xml`:\r\n\r\n < configuration > \r\n \t < !-- Appenders -- > \r\n \t < appender name= \" ;console \" ; class= \" ;ch.qos.logback.core.ConsoleAppender \" ; > \r\n \t\t < encoder > \r\n \t\t\t < pattern > %d{yyyy-MM-dd HH:mm:ss} [%-5level - %class.%method :\r\n \t\t\t\t%line]%msg %n < /pattern > \r\n \t\t < /encoder > \r\n \t < /appender > \r\n \t < appender name= \" ;db \" ; class= \" ;ch.qos.logback.classic.db.DBAppender \" ; > \r\n \t\t < connectionSource\r\n \t\t\tclass= \" ;ch.qos.logback.core.db.DriverManagerConnectionSource \" ; > \r\n \t\t\t < driverClass > org.postgresql.Driver < /driverClass > \r\n \t\t\t < url > jdbc:postgresql://localhost:5432/postgres < /url > \r\n \t\t\t < user > postgres < /user > \r\n \t\t\t < password > admin < /password > < !-- no password -- > \r\n \t\t < /connectionSource > \r\n \t < /appender > \r\n \r\n \t < !-- Logger for my project -- > \r\n \t < logger name= \" ;com.myproject \" ; > \r\n \t\t < appender-ref ref= \" ;console \" ; / > \r\n \t\t < appender-ref ref= \" ;db \" ; / > \r\n \t < /logger > \r\n \t < root level= \" ;info \" ; > \r\n \t\t < appender-ref ref= \" ;console \" ; / > \r\n \t\t < appender-ref ref= \" ;db \" ; / > \r\n \t < /root > \r\n < /configuration > \r\n\r\nI had these depencies to my `pom.xml`:\r\n\r\n < dependency > \r\n \t\t\t < groupId > ch.qos.logback < /groupId > \r\n \t\t\t < artifactId > logback-core < /artifactId > \r\n \t\t\t < version > 1.2.3 < /version > \r\n \t\t < /dependency > \r\n \t\t < dependency > \r\n \t\t\t < groupId > ch.qos.logback < /groupId > \r\n \t\t\t < artifactId > logback-classic < /artifactId > \r\n \t\t\t < version > 1.2.3 < /version > \r\n \t\t < /dependency > \r\n \t\t < dependency > \r\n \t\t\t < groupId > ch.qos.logback < /groupId > \r\n \t\t\t < artifactId > logback-access < /artifactId > \r\n \t\t\t < version > 1.2.3 < /version > \r\n \t\t < /dependency > \r\n \t\t < dependency > \r\n < groupId > org.slf4j < /groupId > \r\n < artifactId > slf4j-api < /artifactId > \r\n < version > 1.7.25 < /version > \r\n < /dependency > \r\n\r\nThis is MyClass.java:\r\n\r\n Logger logger=(Logger) LoggerFactory.getLogger(MyClass.class);\r\n \t\t\t\t\t_URL_0_( \" ;HOME \" ;);\r\n\r\nThe problem is that the output in console it prints, but the output in db is not printed. Anyone can help me?", "436" ], [ "I have a JSTL page and I want to print a value. This is my jstl page\r\n\r\n < %@ taglib uri= \" ;_URL_0_; prefix= \" ;c \" ; % > \r\n \r\n < html > \r\n < head > \r\n < title > Application < /title > \r\n < /head > \r\n \r\n < body > \r\n < c:if test= \" ;${parameter!=null} \" ; > \r\n \t < br > \r\n \t\t < label > < c:out value= \" ;${parameter} \" ; / > < /label > \r\n \t < /c:if > \r\n < /body > \r\n\r\nThe problem is that I don&#39;t read anything in the page because the code is not print. This is my pom.xml\r\n\r\n < dependency > \r\n \t\t\t < groupId > <PERSON> < /groupId > \r\n \t\t\t < artifactId > <PERSON> < /artifactId > \r\n \t\t\t < version > 1.2 < /version > \r\n \t\t < /dependency > \r\n \t\t < dependency > \r\n \t\t\t < groupId > taglibs < /groupId > \r\n \t\t\t < artifactId > standard < /artifactId > \r\n \t\t\t < version > 1.1.2 < /version > \r\n \t\t < /dependency > \r\n\r\nServlet\r\n\r\n String parameter= \" ;hello \" ;;\r\n \r\n request.setAttribute( \" ;parameter \" ;, parameter);\r\n RequestDispatcher dispatcher = request.getRequestDispatcher( \" ;/index.jsp \" ;);\r\n \t\t\tdispatcher.forward(request, response);\r\n\r\nThis is where index.jsp is located in my project:\r\n\r\n -src\r\n -main\r\n -java\r\n -resources\r\n -webapp\r\n -WEB-INF\r\n -web.xml\r\n -index.jsp\r\n\r\nAnyone can help me?", "885" ], [ "Suppose I want to save remove two element in two different table, so I must create transaction. My problem is where I must put `PreparedStatement` elements? I must put in this way (I mean in the transaction)\r\n\r\n connection_database.setAutoCommit(false);\r\n connection_database.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);\r\n PreparedStatement p1.......\r\n PreparedStatement p2;\r\n p1.execute();\r\n p2.execute();\r\n connessione_db.commit();\r\n connessione_db.setAutoCommit(true);\r\n\r\nOr can I put it in this way?\r\n\r\n PreparedStatement p1.......\r\n PreparedStatement p2;\r\n connection_database.setAutoCommit(false);\r\n connection_database.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);\r\n \r\n p1.execute();\r\n p2.execute();\r\n connessione_db.commit();\r\n connessione_db.setAutoCommit(true);\r\n\r\n 1. the first way creates the `PreparedStatement` is in the transaction\r\n 2. the second way create the `PreparedStatement` is out the transaction.\r\n\r\nAnyone can help me?", "3" ], [ "I want know if it is possibile create two connection different connections in one transaction, So suppose to have this code( I do a create operation in table \" ;employe \" ; and I create a log in table \" ;log \" ;):\r\n\r\n\r\n \t\r\n\r\n \ttry {\r\n InitialContext initialContext = new InitialContext();\r\n \t\t\tDataSource datasource = (DataSource) initialContext.lookup( \" ;java:/comp/env/jdbc/postgres \" ;);\r\n \r\n \t\t\tConnection connection_db= datasource.getConnection();\r\n PreparateStatement p1 //Preparate statement to put the employe parameter\r\n \r\n connessione_db.setAutoCommit(false);\r\n \t\t connessione_db.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);\r\n p1.execute();\r\n //This create another connect \r\n LOGStatic.createLog( \" ;CREATE EMPLOYE \" ;); \r\n \r\n connessione_db.commit();\r\n \t\t\t\tconnessione_db.setAutoCommit(true);\r\n }catch(....){\r\n connection_db.rollback();\r\n }\r\n\r\nThis is the method `LOGStatic.createLog( \" ;CREATE EMPLOYE \" ;);` \r\n\r\n public static void creaLogException(String messaggio) {\r\n \t\tConnection connection_db= null;\r\n \r\n \t\tInitialContext initialContext;\r\n \t\ttry {\r\n \t\t\tinitialContext = new InitialContext();\r\n \t\t\tDataSource datasource = (DataSource) initialContext.lookup( \" ;java:/comp/env/jdbc/postgres \" ;);\r\n \r\n \t\t\tconnection_db= datasource.getConnection();\r\n \t\t\t// the code continues with the save operation\r\n \t\t\t\r\n \t\t} catch (NamingException n) {\r\n \t\t\t\r\n \t\t}\r\n \t\t// actual jndi name is \" ;jdbc/postgres \" ;\r\n \t\tcatch (SQLException s) {\r\n \t\t\t\r\n \t\t}\r\n\r\nMy question if is it possible this behavior and there aren&#39;t problem with commit and rollback operatio or it is not possible to have another connection?\r\nAnyone can help", "397" ], [ "Suppose to have 3 date in input, data1 and data2 are the interval and data3 is a generical input dates. data1 and data2 can be null, data3 is not null. So I can have 3 situtation :\r\n\r\n 1. data3 > data1 (data2 is null)\r\n 2. data3 < data2 (data1 is null)\r\n 3. data1 < data3 < data2\r\n\r\nI don&#39;t want create a different if with different queries. I want create a query that handles these cases. \r\n\r\nSuppose to have a table empolyes(id primary key, registration_date), suppose I have two Dates in input, how I must do to resolve my problem?", "338" ], [ "I have an input number and I must acept vlaue with 34,34 two decimal number so my code is:\r\n\r\n\r\n < %@ taglib uri= \" ;_URL_0_; prefix= \" ;c \" ;% > \r\n < %@ taglib prefix= \" ;fmt \" ; uri= \" ;_URL_1_;\r\n < %@ page isELIgnored= \" ;false \" ;% > \r\n < input type= \" ;number \" ; min= \" ;0 \" ; name= \" ;price \" ; pattern= \" ;0.00 \" ;\r\n \t\t\t\t\tstep= \" ;.01 \" ; required\r\n \t\t\t\t\tvalue= \" ; < fmt:formatNumber type = \" ;number \" ; \r\n \t\t\tpattern= \" ;0.00 \" ; value = \" ;${home.price} \" ; / > \" ;\r\n\r\nThe problem is that the inpput is empty is not loaded the value, because if I do \r\n\r\n < label > < fmt:formatNumber type = \" ;number \" ; \r\n \t\t\tpattern= \" ;0.00 \" ; value = \" ;${home.price} < /label > \r\n\r\nthe number is printed in the correct form. Anyone can help me?", "341" ], [ "I need to create a class that handles connection methods. But I read online different ways to implement this.There are\r\n\r\n 1. Singleton\r\n 2. static method\r\n\r\n1) Singleton like this example:\r\n\r\n public SingletonHome{\r\n private static SingletomHome s=null;\r\n \r\n private SingletonHome(){\r\n }\r\n public static SingletongHome getInstance(){\r\n //return instance s\r\n }\r\n \r\n public Connection getConnection(){\r\n //return connection;\r\n }\r\n }\r\n\r\n2) Use static method\r\n\r\n \r\n\r\n public class Example{\r\n \r\n public static Connection getConnection(){\r\n //return connection;\r\n }\r\n }\r\n\r\nWho is the best solution in an enviroment that uses connection pool, I get connection from the connection pool and after I need to handles these.Anyone can help me?", "315" ], [ "I need to create a filter that handles exception. In details when and exception occurres in my program with jersey filter I must return a 500 error.\r\nThis is my Filter.class:\r\n\r\n\r\n @Provider\r\n public class Filter implements ContainerResponseFilter {\r\n \r\n \r\n \t@Override\r\n \tpublic void filter(ContainerRequestContext request, ContainerResponseContext response) throws IOException {\r\n \t\t\r\n \t\r\n \t}\r\n }\r\nHow can I specify that when an exception is throwed this method is called and it return a 500 code error? Anyone can help me?", "759" ], [ "I need to understand which is the best transaction isolation that I can use to do this 2 things:\r\n\r\n 1. Save a row in table A\r\n 2. Save a row in table B\r\n\r\nI know that if I use like transaction isolation `SERIALIZABLE`, it works fine, but I need to know if it is possibile that I can use `READ_COMMITED`, or `REPEATEBLE_READ`. I save only two rows in two different table so I&#39;m not doing READ operation, so I think that READ_COMMIT is the best solution? Anyone can help me?", "519" ], [ "I&#39;m newbie about Angular so I need to pass value from component to another in a with a ngFor. Suppose to have two components: logs and log.\r\nmy `logs.component.html` is:\r\n\r\n \r\n\r\n //iterane on a list that I have created \r\n < app-log *ngFor= \" ;let log of listLog;let i= index \" ; > < /app-log > \r\n\r\nin my log.component.html:\r\n\r\n //Something like this\r\n < p > The server timestamp {{ log[i] }} < /p > \r\n\r\nHow is it possible pass log value in the log.component.html and how I cna print it?", "7" ] ]
483
[ 6641, 11239, 4829, 19638, 17456, 12747, 14590, 15012, 17721, 9057, 14645, 12348, 14623, 726, 2494, 4409, 11419, 19003, 13032, 72, 18511, 15079, 687, 14858, 6197, 527, 19617, 17127, 14314, 19602, 4289, 2461, 15669, 12657, 15388, 9300, 12956, 8637, 6613, 11304, 14377, 10593, 10765, 5102, 16797, 15726, 8944, 14607, 6911, 5280, 9149, 14034, 15297, 12075, 14509, 10389, 11019, 13092, 8094, 2013, 15198, 14245, 8664, 17947, 16656, 19574, 11509, 14609, 10539, 9436, 11170, 13145, 16588, 9330, 12028, 16787, 5064, 11348, 16481, 9827, 11630, 15077, 16734, 14588, 17457, 14816, 16331, 1575, 11659, 15490, 17629, 9618, 19314, 13300, 10025, 17957, 580, 17077, 14499, 14894, 16076, 4320, 525, 17777, 13714, 14298, 13688, 15760, 7839, 14780, 5060, 12588, 8371, 18815, 16387, 5049, 7646, 8189, 15020, 17675, 16209, 11932, 4853, 6244, 6529, 12570, 18277, 444, 15402, 11022, 2236, 10080, 7539, 7036, 9783, 14864, 15144, 14747, 15067, 8117, 17852, 9616, 2850, 14881, 12882, 13879, 18089, 6432, 12860, 1611, 14489, 11709, 6491, 5267, 4948, 7268, 404, 16911, 19454, 15575, 19711, 2015, 17052, 13015, 781, 6435, 13057, 9640, 16768, 1602, 4599, 8339, 1451, 14564, 2781, 10706, 14808, 6691, 13042, 5785, 4385, 5989, 6944, 17927, 17172, 14401, 11959, 17399, 16818, 17512, 10702, 11851, 15025, 11393, 12613, 7915, 15451, 17602, 17872, 8351, 5708, 370, 11498, 3425, 3882, 17467, 6842, 19157, 14945, 16752, 17873, 15373, 6407, 2381, 18149, 13299, 18785, 5539, 7457, 9402, 5927, 17962, 2386, 9739, 14475, 11908, 10748, 9967, 10024, 9327, 6152, 5281, 7166, 9634, 15034, 16890, 11305, 16838, 1759, 10912, 12419, 9567, 9289, 12732, 16403, 17746, 15455, 16648, 11117, 15718, 13385, 12905, 1093, 7106, 9088, 6090, 14531, 14511, 14507, 7315, 3245, 14842, 19510, 37, 2130, 7527, 17711, 8576, 8100, 13330, 4298, 4957, 645, 8760, 13246, 5288, 13074, 5796, 18179, 5304, 6166, 6806, 15048, 18071, 14251, 14182, 2202, 4796, 260, 9951, 18189, 9753, 9809, 16876, 3264, 9717, 7930, 19700, 15029, 2453, 18424, 7107, 18231, 15599, 881, 1591, 14432, 14015, 10360, 8420, 17669, 11714, 19240, 9505, 13749, 16625, 3334, 17662, 18087, 13545, 19327, 15813, 9072, 18270, 13792, 19607, 13115, 10180, 16046, 16920, 13769, 14296, 86, 15022, 4725, 1736, 7967, 5187, 16242, 15323, 2950, 7447, 10952, 12683, 12948, 12016, 14839, 5383, 3486, 7184, 14422, 10347, 14311, 5009, 18660, 13764, 5088, 4341, 10264, 16873, 4603, 16419, 17187, 19549, 7729, 11783, 6064, 13923, 12259, 19726, 5727, 15143, 4968, 17548, 391, 17685, 19, 13283, 875, 15062, 6031, 8195, 19557, 14959, 8580, 13191, 17142, 5478, 2267, 13966, 17896, 15401, 12958, 16796, 14656, 8909, 19734, 7368, 5926, 12232, 17491, 13360, 4038, 15488, 14106, 16808, 11645, 8116, 19784, 411, 12539, 10849, 15825, 17627, 15118, 14178, 11981, 12971, 9466, 1578, 19015, 13641, 14967, 7970, 8155, 8097, 17040, 6266, 44, 1520, 2051, 14555, 13740, 19482, 10676, 594, 874, 4622, 19757, 10896, 12686, 19562, 16843, 12897, 3866, 17827, 6664, 9892, 11612, 8589, 17978, 13540, 18070, 14074, 118, 13239, 15884, 120, 12304, 13027, 18366, 4575, 10481, 6516, 7610, 14007, 18494, 14325, 8617, 18515, 19207, 6938, 14737, 5912, 18291, 3008, 8815, 19688, 15959, 6451, 14365, 1603, 3899, 8028, 15842, 16255, 7997, 17150, 17943, 11011, 15594, 19722, 7225, 8698, 6751, 10898, 18426, 14906, 18047 ]