prompt
stringlengths
12
7.84k
context
stringclasses
0 values
response
list
response-suggestion
stringlengths
15
17.7k
response-suggestion-metadata
dict
external_id
stringclasses
0 values
metadata
stringlengths
113
129
Can brain cells move? By movement I mean long distance migration (preferably within the brain only).
null
[]
The question is relatively broad and one should take into account that the brain not only consists of neurons, but also glial cells (supportive cells) and pre-mitotic neuronal stem cells. Furthermore, as critical fellow-scientists have indicated, developmental stage is very important, as the developing embryonic brain is very different from the adult brain. However, after sifting through various publications, the answer to the question is actually remarkably simple: Yes, brain cells migrate. In the adult brain glial cells migrate in the brain (Klämbt, 2009). Glial cells are involved in a myriad of functions, but a notable example of migrating glial cells are the oligodendrocytes that migrate relative long distances to find their target axons onto which they wrap themselves to form the insulating myelin sheath (Tsai and Miller, 2002). Neuronal stem cells migrate over long distances in response to injury (Imitola et al., 2004) and they migrate from specific stem-cell locations (e.g., hippocampus and subventricular zone) to other regions (Clarke, 2003). Post-mitotic, but non-differentiated neurons have been shown to migrate in the adult brain in fish (Scott et al., 2012), and in mammals and non-human primates as well (Sawada et al., 2011). Not surprisingly, glial cells, stem cells and neurons also migrate during embryonic development. Most notably, post-mitotic neurons destined to fulfill peripheral functions have to migrate over relatively long distances from the neural crest to their target locations (Neuroscience, 2nd ed, Neuronal Migration).
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 85, "passed_quality_check": "True", "flesch_reading_ease": 82.39000000000001, "entropy": 0.4352176404374839}
In our computer systems lecture we were introduced to the MIPS processor. It was (re)developed over the course of the term and has in fact been quite easy to understand. It uses a RISC design, that is its elementary commands are regularly encoded and there are only few of them in order to keep the wires simple. It was mentioned that CISC follows a different philosophy. I looked briefly at the x86 instruction set and was shocked. I can not image how anyone would want to build a processor that uses so complex a command set! So I figure there have to be good arguments why large portions of the processor market use CISC architectures. What are they?
null
[]
There is a general historical trend. In the olden days, memories were small, and so programs were perforce small. Also, compilers were not very smart, and many programs were written in assembler, so it was considered a good thing to be able to write a program using few instructions. Instruction pipelines were simple, and processors grabbed one instruction at a time to execute it. The machinery inside the processor was quite complex anyway; decoding instructions was not felt to be much of a burden. In the 1970s, CPU and compiler designers realized that having such complex instructions was not so helpful after all. It was difficult to design processors in which those instructions were really efficient, and it was difficult to design compilers that really took advantage of these instructions. Chip area and compiler complexity was better spent on more generic pursuits such as more general-purpose registers. The Wikipedia article on RISC explains this in more detail. MIPS is the ultimate RISC architecture, which is why it's taught so often. The x86 family is a bit different. It was originally a CISC architecture meant for systems with very small memory (no room for large instructions), and has undergone many successive versions. Today's x86 instruction set is not only complicated because it's CISC, but because it's really a 8088 with a 80386 with a Pentium possibly with an x86_64 processor. In today's world, RISC and CISC are no longer the black-and-white distinction they might have been once. Most CPU architectures have evolved to different shades of grey. On the RISC side, some modern MIPS variants have added multiplication and division instructions, with a non-uniform encoding. ARM processors have become more complex: many of them have a 16-bit instruction set called Thumb in addition to the “original” 32-bit instructions, not to mention Jazelle to execute JVM instructions on the CPU. Modern ARM processors also have SIMD instructions for multimedia applications: some complex instructions do pay after all. On the CISC side, all recent processors are to some extent RISC inside. They have microcode to define all these complex macro instructions. The sheer complexity of the processor makes the design of each model take several years, even with a RISC design, what with the large number of components, with pipelining and predictive execution and whatnot. So why do the fastest processors remain CISC outside? Part of it, in the case of the x86 (32-bit and 64-bit) family, is historical compatibility. But that's not the whole of it. In the early 2000s, Intel tried pushing the Itanium architecture. Itanium is an extreme case of complex instructions (not really CISC, though: its design has been dubbed EPIC). It even does away with the old-fashioned idea of executing instructions in sequence: all instructions are executed in parallel until the next barrier. One of the reasons Itanium didn't take is that nobody, whether at Intel or elsewhere, could write a decent compiler for it. Now a good old mostly-sequential processor like x86_64, that's something we understand.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 538, "passed_quality_check": "True", "flesch_reading_ease": 80.92500000000003, "entropy": 3.931978186259446}
View tabular file such as CSV from command line, having horizontal and vertical scrolling would be great.
null
[]
Sure, please take a look at csvkit. It provides a set of tools that adhere to the UNIX philosophy (meaning they are small, simple, single-purposed and can be combined). Here is an example that extracts the ten most populated cities in Germany from the free Maxmind World Cities database and displays the result in a console-readable format: ```$ csvgrep -e iso-8859-1 -c 1 -m "de" worldcitiespop | csvgrep -c 5 -r "\d+" | csvsort -r -c 5 -l | csvcut -c 1,2,4,6 | head -n 11 | csvlook ----------------------------------------------------- | line_number | Country | AccentCity | Population | ----------------------------------------------------- | 1 | de | Berlin | 3398362 | | 2 | de | Hamburg | 1733846 | | 3 | de | Munich | 1246133 | | 4 | de | Cologne | 968823 | | 5 | de | Frankfurt | 648034 | | 6 | de | Dortmund | 594255 | | 7 | de | Stuttgart | 591688 | | 8 | de | Düsseldorf | 577139 | | 9 | de | Essen | 576914 | | 10 | de | Bremen | 546429 | ----------------------------------------------------- ``` Csvkit is platform independent because it is written in Python.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 89, "passed_quality_check": "True", "flesch_reading_ease": 60.19176470588238, "entropy": 0.41496820745515073}
Slater type orbitals (STO) are considered to be more accurate than gaussian type orbitals (GTO) for atomic and molecular QM calculations because - among other reasons - they decay with $e^{-\alpha r}$ as $r \to \infty$. But GTOs are more popular because they are easier to calculate with. GTOs decay with $e^{-\alpha r^2}$, so its adequate to sometimes add diffuse functions to the GTO basis set to compensate for gaussian decay behaviour. Also, exact hydrogen wavefunctions decay exponentially, so the motivation for STOs. I understand that the only boundary requirement for solving the Schrödinger equation for atoms and molecules in free space is that the wavefunction goes zero as $r \to \infty$, but there are no a priori requirements for the way it decays as it does so. My question is: do we have theoretical (ab initio) and/or experimental reasons to believe that all atomic and molecular wavefunctions decay like $e^{-\alpha r}$ as $r \to \infty$.
null
[]
I'll answer this question from the theoretical side. The exponential behavior follows simply from the Schrödinger equation. Consider the one-electron Schrödinger equation: $$ (-\frac{1}{2}\nabla^2 + V(\mathbf{r}))\psi(\mathbf{r}) = \epsilon\psi(\mathbf{r}), \epsilon < 0 $$ At spatial points that are very far away from the nucleus, $V(\mathbf{r})\approx 0$, so that the asymptotic solution is given by $$ -\frac{1}{2}\nabla^2\psi(\mathbf{r}) = \epsilon\psi(\mathbf{r}), \epsilon < 0 $$ This differential equation has basic solutions of the form $$ \psi(\mathbf{r}) = Ce^{-\sqrt{-2\epsilon}\mathbf{k}\cdot\mathbf{r}} $$ for some unit vector $\mathbf{k}$. The real asymptotic behavior of $\psi(\mathbf{r})$ is thus a linear combination of these basic solutions. The linear combination may bring a polynomial prefactor to the exponential, but will never alter the exponent. Thus we have not only proved the exponential behavior, but also derived the correct exponent $\alpha = \sqrt{-2\epsilon}$. For a multi-electronic, non-interacting system, the overall decay rate is governed by the slowest decaying orbital, i.e. the HOMO. Of course, the real wavefunction can only be described by a multi-electron Schrödinger equation. But we can work on the equivalent Kohn-Sham system and show that the Kohn-Sham wavefunction decays at a rate given by the Kohn-Sham HOMO energy. By Janak's theorem, the Kohn-Sham HOMO energy is just the negative of the ionization potential of the exact system. To see this, consider a huge ensemble of $N$ identical, non-interacting molecules. If we remove one electron from the ensemble and let the hole delocalize evenly between all the molecules, then as $N\to +\infty$, the electron removal has a negligible impact on the electron density of any molecule (and therefore the Kohn-Sham potential of each molecule). Therefore under the Kohn-Sham framework we see that removing such an electron costs an energy of $-\epsilon_{\mathrm{HOMO}}$ (it does not matter whether the HOMO refers to that of the ensemble or that of a molecule, since their orbital energies are equal), since the electron is taken from an energy level whose energy is $\epsilon_{\mathrm{HOMO}}$ and the Hamiltonian is not changed in this process. On the other hand, from the perspective of the real system it is clear that the energy cost is equal to the first ionization energy of one of the molecules, $I$. Therefore we have $\epsilon_{\mathrm{HOMO}} = -I$, which means that the Kohn-Sham wavefunction decays like (again up to a possible polynomial prefactor; the precise determination of this polynomial prefactor is a much more difficult question) $$ \psi(\mathbf{r}) = Ce^{-\sqrt{2I}\mathbf{k}\cdot\mathbf{r}} $$ Although the Kohn-Sham wavefunction is fictional, its density is equal to the true multielectronic density, and in order for the true density to have the same asymptotic behavior as the Kohn-Sham density, the true wavefunction must have the same asymptotic behavior as the Kohn-Sham wavefunction. Q.E.D.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 804, "passed_quality_check": "True", "flesch_reading_ease": 42.43434355828222, "entropy": 4.0899169183897515}
Explain what "git reset" does. I come from a SVN background and Git is a whole new paradigm. I got mercurial easily, but Git is much more technical. I think ```git reset``` is close to ```hg revert```, but it seems there are differences. Please include detailed explanations about: * the options ```--hard```, ```--soft``` and ```--merge```; * the strange notation you use with ```HEAD``` such as ```HEAD^``` and ```HEAD~1```; * concrete use cases and work flows; * consequences on the working copy, the ```HEAD``` and your global stress level.
null
[]
Remember that in ```git``` you have: * the ```HEAD``` pointer, which tells you what commit you're working on * the working tree, which represents the state of the files on your system * the staging area (also called the index), which "stages" changes so that they can later be committed together > Please include detailed explanations about: ```--hard```, ```--soft``` and ```--merge```; In increasing order of dangerous-ness: * ```--soft``` moves ```HEAD``` but doesn't touch the staging area or the working tree. * ```--mixed``` moves ```HEAD``` and updates the staging area, but not the working tree. * ```--merge``` moves ```HEAD```, resets the staging area, and tries to move all the changes in your working tree into the new working tree. * ```--hard``` moves ```HEAD``` and adjusts your staging area and working tree to the new ```HEAD```, throwing away everything. > concrete use cases and workflows; * Use ```--soft``` when you want to move to another commit and patch things up without "losing your place". It's pretty rare that you need this. ``` # git reset --soft example touch foo // Add a file, make some changes. git add foo // git commit -m "bad commit message" // Commit... D'oh, that was a mistake! git reset --soft HEAD^ // Go back one commit and fix things. git commit -m "good commit" // There, now it's right. ``` -- * Use ```--mixed``` (which is the default) when you want to see what things look like at another commit, but you don't want to lose any changes you already have. * Use ```--merge``` when you want to move to a new spot but incorporate the changes you already have into that the working tree. * Use ```--hard``` to wipe everything out and start a fresh slate at the new commit.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 463, "passed_quality_check": "False", "flesch_reading_ease": 80.29591491841494, "entropy": 3.3348391710428453}
I am looking to use Java to get the MD5 checksum of a file. How is it done?
null
[]
The com.google.common.hash API offers: * A unified user-friendly API for all hash functions * Seedable 32- and 128-bit implementations of murmur3 * md5(), sha1(), sha256(), sha512() adapters, change only one line of code to switch between these, and murmur. * goodFastHash(int bits), for when you don't care what algorithm you use * General utilities for HashCode instances, like combineOrdered / combineUnordered Read the User Guide (IO Explained, Hashing Explained). For your use-case ```Files.hash()``` computes and returns the digest value for a file. For example a sha-1 digest calculation (change SHA-1 to MD5 to get MD5 digest) ```HashCode hc = Files.asByteSource(file).hash(Hashing.sha1()); "SHA-1: " + hc.toString(); ``` Note that crc32 is much faster than md5, so use crc32 if you do not need a cryptographically secure checksum. Note also that md5 should not be used to store passwords and the like since it is to easy to brute force, for passwords use bcrypt, scrypt or sha-256 instead. For long term protection with hashes a Merkle signature scheme adds to the security and The Post Quantum Cryptography Study Group sponsored by the European Commission has recommended use of this cryptography for long term protection against quantum computers (ref). Note that crc32 has a higher collision rate than the others. What part of Files.hash as stated above does not cover Files.hash ?
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 59, "passed_quality_check": "False", "flesch_reading_ease": 103.68723684210525, "entropy": 0.8201050799144105}
What are the primary objections Democrats have to a border wall?
null
[]
It's not clear to me that Democrats are opposed to border-wall construction (your one source suggests they are fine with border walls/fences where necessary), so much as they opposed to some of the plans for full-border walls that have been put forth so far. Recently, in response to reports that the spending bill would include funding for a border wall, 5 Democratic senators released a letter voicing concerns over the cost, the effectiveness, and the legal issues of constructing it. We are also concerned with reports that there may be an effort to include funding for a very expensive new wall along the southern border with Mexico and a “deportation force.” According to non-partisan experts, the proposed new border wall could cost as much as $25 million per mile and raises considerable issues that have not been resolved by the Congress or the Department of Homeland Security. First, many experts believe that such a border wall will not work. Second, there is real concern that the Administration, put simply, has no plan to build the border wall. For example, the Administration has not detailed how to 1) use eminent domain and other procedures to acquire land from private landowners and Native American tribes, 2) design the wall, 3) locate the wall, 4) construct the wall, and 5) require Mexico to pay for the wall given the President’s clear and repeated promises that he would force Mexico to do so. Finally, there are objections to the construction of a wall from Democratic and Republican members of Congress that represent border states. Given these and other concerns, we believe it would be inappropriate to insist on the inclusion of such funding in a must-pass appropriations bill that is needed for the Republican majority in control of the Congress to avert a government shutdown so early in President Trump’s Administration. [...] Senator Charles Schumer Senator Richard Durbin Senator Patty Murray Senator Debbie Stabenow Senator Patrick Leahy Based on this letter, it appears their main objections to a full border wall are currently the cost-benefit ratio and the legal issues of taking land from Americans to build it on; objections that may not be unique to Democrats.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 54, "passed_quality_check": "True", "flesch_reading_ease": 80.30636363636367, "entropy": 0.3577953965491265}
I'm converting a video to GIF file with ```ffmpeg```: ```ffmpeg \ -i input.flv \ -ss 00:00:00.000 \ -pix_fmt rgb24 \ -r 10 \ -s 320x240 \ -t 00:00:10.000 \ output.gif ``` It works great, but output gif file has a very low quality. Any ideas how can I improve quality of converted gif?
null
[]
If you would prefer to avoid intermediate image files, the commands provided by LordNeckBeard can be piped between ```ffmpeg``` and ImageMagick's ```convert``` so that no intermediate files are required: ```ffmpeg -i input.flv -vf scale=320:-1 -r 10 -f image2pipe -vcodec ppm - | convert -delay 10 -loop 0 - output.gif ``` The ```-f image2pipe``` tells ffmpeg to split the video into images and make it suitable to be piped out, and ```-vcodec ppm``` specifies the output format to be ppm (for some reason if the format is png, either ```convert``` does not read all the images from the pipe, or ffmpeg does not output them all). The ```-``` for both commands specifies that a pipe will be used for output and input respectively. To optimize the result without saving a file, you can pipe the output from ```convert``` to a second ```convert``` command: ```ffmpeg -i input.flv -vf scale=320:-1 -r 10 -f image2pipe -vcodec ppm - | convert -delay 10 -loop 0 - gif:- | convert -layers Optimize - output.gif ``` The ```gif:-``` tells ```convert``` to pipe its output as gif formatted data and ```-layers Optimize``` tells the second ```convert``` to perform ```optimize-frame``` and ```optimize-transparancy``` methods (see the ImageMagick Introduction to Animation Optimization). Note that the output from the ```-layers Optimize``` may not always provide a smaller file size, so you may want to try converting to a gif without optimization first to be sure. Remember that during this whole process everything is in memory so you may need sufficient memory if the images are quite large.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 243, "passed_quality_check": "False", "flesch_reading_ease": 64.08676470588239, "entropy": 0.972318343420335}
Tor can only handle TCP connections, but DNS is a UDP protocol. How does Tor route DNS requests over its TCP based network? Why can the same approach not be used to route all UDP traffic over Tor?
null
[]
Tor clients do not, in general, directly do DNS requests. When you open a connection through the tor network you usually ask your client (on its socks ports) to connect you to a hostname and port, say www.example.com:80. Your tor client, once it has created a circuit, will send that hostname and port to the exit node in its RELAY_BEGIN cell. The exit node will then do a DNS resolve and open a TCP connection to the target. Once that's established it will tell your client that the connection is open, and for informational purposes will also tell your client what address that hostname resolved to. Tor, in addition to that, has some sort of "remote DNS resolve" protocol built in. This support allows clients to query for certain resource types, like IPv4 or IPv6 addresses. Here too, the exit node does the actual DNS packet sending and receiving and just relays the answer to the client. No UDP packets are actually ever routed from the client. There's also a proposal to add more full featured DNS support to Tor. So far it hasn't been implemented. Tor Protocol Specification references * 6.2. Opening streams and transferring data * 6.4. Remote hostname lookup * Proposal 219 - Support for full DNS and DNSSEC resolution in Tor
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 159, "passed_quality_check": "True", "flesch_reading_ease": 96.02043859649125, "entropy": 0.8163104643214635}
Why does this throw ```NullPointerException``` ```public static void main(String[] args) throws Exception { Boolean b = true ? returnsNull() : false; // NPE on this line. System.out.println(b); } public static Boolean returnsNull() { return null; } ``` while this doesn't ```public static void main(String[] args) throws Exception { Boolean b = true ? null : false; System.out.println(b); // null } ``` ? The solution is by the way to replace ```false``` by ```Boolean.FALSE``` to avoid ```null``` being unboxed to ```boolean``` --which isn't possible. But that isn't the question. The question is why? Are there any references in JLS which confirms this behaviour, especially of the 2nd case?
null
[]
The difference is that the explicit type of the ```returnsNull()``` method affects the static typing of the expressions at compile time: ```E1: `true ? returnsNull() : false` - boolean (auto-unboxing 2nd operand to boolean) E2: `true ? null : false` - Boolean (autoboxing of 3rd operand to Boolean) ``` See Java Language Specification, section 15.25 Conditional Operator ? : * For E1, the types of the 2nd and 3rd operands are ```Boolean``` and ```boolean``` respectively, so this clause applies: If one of the second and third operands is of type boolean and the type of the other is of type Boolean, then the type of the conditional expression is boolean. Since the type of the expression is ```boolean```, the 2nd operand must be coerced to ```boolean```. The compiler inserts auto-unboxing code to the 2nd operand (return value of ```returnsNull()```) to make it type ```boolean```. This of course causes the NPE from the ```null``` returned at run-time. * For E2, types of the 2nd and 3rd operands are `````` (not ```Boolean``` as in E1!) and ```boolean``` respectively, so no specific typing clause applies (go read 'em!), so the final "otherwise" clause applies: Otherwise, the second and third operands are of types S1 and S2 respectively. Let T1 be the type that results from applying boxing conversion to S1, and let T2 be the type that results from applying boxing conversion to S2. The type of the conditional expression is the result of applying capture conversion (§5.1.10) to lub(T1, T2) (§15.12.2.7). * S1 == `````` (see §4.1) * S2 == ```boolean``` * T1 == box(S1) == `````` (see last item in list of boxing conversions in §5.1.7) * T2 == box(S2) == `Boolean * lub(T1, T2) == ```Boolean``` So the type of the conditional expression is ```Boolean``` and the 3rd operand must be coerced to ```Boolean```. The compiler inserts auto-boxing code for the 3rd operand (```false```). The 2nd operand doesn't need the auto-unboxing as in ```E1```, so no auto-unboxing NPE when ```null``` is returned. This question needs a similar type analysis: Java conditional operator ?: result type
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 603, "passed_quality_check": "False", "flesch_reading_ease": 79.433370125092, "entropy": 2.6997410863531037}
How do DOS games like DOOM benefit from a PCI graphics card?
null
[]
DOOM itself doesn’t do anything special to benefit from PCI graphics cards. It runs faster with PCI graphics cards (and VLB, AGP, and PCI Express cards) than with ISA graphics cards because the supporting bus is faster, so reads from and writes to video memory take less time. PCI goes to great lengths to preserve backwards compatibility with ISA-based VGA, providing support for “VGA compatible” adapters so that they can appear in memory at the same locations and use the same I/O ports as ISA VGA cards. So accesses to the VGA registers and to the VGA buffer (at 0xA0000) go directly to the main PCI VGA compatible adapter in the system, with no change required in the operating system or programs running on it. (This is the reason why there’s a specific “VGA compatible controller” device type in PCI. Such shenanigans are impossible for other device types in PCI, which is why PCI sound cards have so much trouble providing compatibility with programs written for ISA sound cards.) A faster bus and/or faster video memory immediately leads to higher performance in video-intensive programs because software doesn’t need to be careful about how it accesses video memory (except on CGA, and on all platforms with vertical blank synchronisation if it cares about tearing). So ```REP MOVSW``` or ```REP MOVSD``` with no waiting in software, once the program decides to write a frame, is perfectly fine, and will go faster and faster as the underlying hardware improves. On platforms where this can’t work in hardware (e.g. on an 8088 with a VGA card), the hardware takes care of specifics — for example on an 8088 the bus unit will split up 16-bit accesses. Your question is specific to DOOM but other DOS games are in a similar situation. Later games tended to rely on VBE (often using UniVBE) to access video modes beyond those provided by VGA, but they mostly didn’t use anything beyond video-mode setup and framebuffer configuration (see also Were any DOS games (or software) known to use VBE/AF?), so improved video speed came mostly from bus speed increases, faster video memory, and speed increases in the cards themselves (which was already a factor in the ISA era, compare most Trident cards to Tseng cards for example). For an excellent explanation of the intricacies of VGA programming and its memory layout, see Fabien Sanglard’s Game Engine Black Book series. The DOOM update loop is shown on page 185 of the DOOM book; it doesn’t use any assembly language (unlike the renderer, see pp. 290 and following), but it does have one perhaps surprising feature given the 32-bit nature of the code: VGA updates are done 16 bits at a time. Section 2.3 of the same book, pp. 59 and following, describes some of the improvements to VGA adapters around the time DOOM was released, in particular the switch to the VESA Local Bus on 486s. The benchmark table on page 287 shows the importance of the bus.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 49, "passed_quality_check": "True", "flesch_reading_ease": 88.905, "entropy": 0.18034159082028078}
I need to be able to open a document using its default application in Windows and Mac OS. Basically, I want to do the same thing that happens when you double-click on the document icon in Explorer or Finder. What is the best way to do this in Python?
null
[]
```open``` and ```start``` are command-interpreter things for Mac OS/X and Windows respectively, to do this. To call them from Python, you can either use ```subprocess``` module or ```os.system()```. Here are considerations on which package to use: * You can call them via ```os.system```, which works, but... Escaping: ```os.system``` only works with filenames that don't have any spaces or other shell metacharacters in the pathname (e.g. ```A:\abc\def\a.txt```), or else these need to be escaped. There is ```shlex.quote``` for Unix-like systems, but nothing really standard for Windows. Maybe see also python, windows : parsing command lines with shlex * MacOS/X: ```os.system("open " + shlex.quote(filename))``` * Windows: ```os.system("start " + filename)``` where properly speaking ```filename``` should be escaped, too. * You can also call them via ```subprocess``` module, but... For Python 2.7 and newer, simply use ```subprocess.check_call(['open', filename]) ``` In Python 3.5+ you can equivalently use the slightly more complex but also somewhat more versatile ```subprocess.run(['open', filename], check=True) ``` If you need to be compatible all the way back to Python 2.4, you can use ```subprocess.call()``` and implement your own error checking: ```try: retcode = subprocess.call("open " + filename, shell=True) if retcode < 0: print >>sys.stderr, "Child was terminated by signal", -retcode else: print >>sys.stderr, "Child returned", retcode except OSError, e: print >>sys.stderr, "Execution failed:", e ``` Now, what are the advantages of using ```subprocess```? * Security: In theory, this is more secure, but in fact we're needing to execute a command line one way or the other; in either environment, we need the environment and services to interpret, get paths, and so forth. In neither case are we executing arbitrary text, so it doesn't have an inherent "but you can type ```'filename ; rm -rf /'```" problem, and if the file name can be corrupted, using ```subprocess.call``` gives us little additional protection. * Error handling: It doesn't actually give us any more error detection, we're still depending on the ```retcode``` in either case; but the behavior to explicitly raise an exception in the case of an error will certainly help you notice if there is a failure (though in some scenarios, a traceback might not at all be more helpful than simply ignoring the error). * Spawns a (non-blocking) subprocess: We don't need to wait for the child process, since we're by problem statement starting a separate process. To the objection "But ```subprocess``` is preferred." However, ```os.system()``` is not deprecated, and it's in some sense the simplest tool for this particular job. Conclusion: using ```os.system()``` is therefore also a correct answer. A marked disadvantage is that the Windows ```start``` command requires you to pass in ```shell=True``` which negates most of the benefits of using ```subprocess```.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 202, "passed_quality_check": "True", "flesch_reading_ease": 78.24633333333335, "entropy": 1.9278350360793501}
Why does PRC devalue its currency on purpose, but Turkey is worried about the devaluation of its currency?
null
[]
Trade surplus/deficit Devaluing one's currency means mostly one thing: It becomes more expensive to import products from abroad, while one's own products become comparably cheaper to buy on the world market. That means a country which exports lots of goods wants to devalue their currency while a country which imports lots of goods does not. In 2016, Turkey imported goods worth US $186 billion and exported goods worth US $156 billion. That means they had a trade deficit of 19%. However, China only imported goods worth US $1.23 trillion and exported goods worth US $2.27 trillion in 2016. That means they had a trade surplus of 84%. Which is why China wants to devalue their currency while Turkey does not. Debt management Another reason to devalue one's currency is that it reduces any debts denoted in that currency. If a country has a problem of too much public and private debt, then an easy way to get rid of it is to cause a hyperinflation. China happens to have a debt-to-gdp ratio of 47.6% while Turkey only has one of 28.3%. When you look at the private debt (debt of private citizens and companies in the country), you see the same picture. Private debit in Turkey was 170% of GDP, while China's is rumored to be over 300%. Which is why reducing debt through causing inflation seems more attractive to China than to Turkey. Foreign investor relations So why don't all countries get rid of their debt by adding a few zeroes to their bank notes? Because inflating your currency is a surefire way to drive away any foreign investors. Nobody will invest money into your country when that money might be worth nothing in a few years. Investors want stable currencies. Again, we observe the same difference in motivation between Turkey and China here. Turkey is actively inviting foreign investors, but China is quite reluctant to allow foreign economic influence in their country.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 89, "passed_quality_check": "True", "flesch_reading_ease": 66.36500000000001, "entropy": 0.45035559065728015}
Is it worth patenting an algorithm if I don't have the money to defend against infringements?
null
[]
This is a great question, with no one right answer. The strength of a patent comes from the ability to enforce it. If the patent owner cannot enforce it for whatever reason (such as a lack of funding), the patent is effectively toothless. But your competitors will likely not know that. They may therefore be dissuaded from infringing simply by the existence of a patent and the assumption that you would sue. Such a chilling effect on competition may be valuable to you. In addition, if there is infringement, you may be able to get a licensing agreement without the need for litigation. This can be a very lucrative business model, and so may justify the cost of patenting. And if litigation seems likely, there is a nascent field of litigation funding. While your funders will take quite a great deal of the damages, you may at least get something out of the end of it. Finally, even if you can't sue, someone else could. You might therefore get quite some value from selling it off at some point. There are a number of tech businesses where most of their value comes from their IP portfolio. On the whole therefore it depends how you see yourself proceeding. If you're unsure, it may pay to err on the side of patenting: once you disclose or use your invention publicly, you're generally barred from patenting it later (but for a short grace period in some countries), whereas it's easy to abandon a patent (or application) later down the track if you wish.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 78, "passed_quality_check": "True", "flesch_reading_ease": 74.27000000000001, "entropy": 0.4957702890016263}
"I have a ```String[]``` with values like so: ```public static final String[] VALUES = new String[] {""AB"",""BC"",""CD"",""AE""}; ``` Given ```String s```, is there a good way of testing whether ```VALUES``` contains ```s```?" How do I determine whether an array contains a particular value in Java?
null
[]
Four Different Ways to Check If an Array Contains a Value: * Using ```List```: ```public static boolean useList(String[] arr, String targetValue) { return Arrays.asList(arr).contains(targetValue); } ``` * Using ```Set```: ```public static boolean useSet(String[] arr, String targetValue) { Set set = new HashSet(Arrays.asList(arr)); return set.contains(targetValue); } ``` * Using a simple loop: ```public static boolean useLoop(String[] arr, String targetValue) { for (String s: arr) { if (s.equals(targetValue)) return true; } return false; } ``` * Using ```Arrays.binarySearch()```: The code below is wrong, it is listed here for completeness. ```binarySearch()``` can ONLY be used on sorted arrays. You will find the result is weird below. This is the best option when array is sorted. ```public static boolean binarySearch(String[] arr, String targetValue) { return Arrays.binarySearch(arr, targetValue) >= 0; } ``` Quick Example: ```String testValue="test"; String newValueNotInList="newValue"; String[] valueArray = { "this", "is", "java" , "test" }; Arrays.asList(valueArray).contains(testValue); // returns true Arrays.asList(valueArray).contains(newValueNotInList); // returns false ```
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 259, "passed_quality_check": "False", "flesch_reading_ease": 75.30800865800866, "entropy": 1.3068740189349657}
Does Java casting introduce overhead? Or the compiler just resolves everything and there is no cost at run time? Is this a general things, or there are different cases?
null
[]
There are 2 types of casting in Java: Implicit casting, when you cast from a type to a wider type, which is done automatically and there is no overhead: ```String s = "Cast"; Object o = s; // implicit casting ``` Explicit casting, when you go from a wider type to a more narrow one. For this case, you must explicitly use casting like that: ```Object o = someObject; String s = (String) o; // explicit casting ``` In this second case, there is overhead in runtime, because the two types must be checked and in case that casting is not feasible, JVM must throw a ClassCastException. Taken from JavaWorld: The cost of casting > Casting is used to convert between types -- between reference types in particular, for the type of casting operation in which we're interested here. Upcast operations (also called widening conversions in the Java Language Specification) convert a subclass reference to an ancestor class reference. This casting operation is normally automatic, since it's always safe and can be implemented directly by the compiler. Downcast operations (also called narrowing conversions in the Java Language Specification) convert an ancestor class reference to a subclass reference. This casting operation creates execution overhead, since Java requires that the cast be checked at runtime to make sure that it's valid. If the referenced object is not an instance of either the target type for the cast or a subclass of that type, the attempted cast is not permitted and must throw a java.lang.ClassCastException.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 141, "passed_quality_check": "True", "flesch_reading_ease": 83.88500000000002, "entropy": 0.7010400820976931}
How can I copy a string (e.g "hello") to the System Clipboard in C#, so next time I press CTRL+V I'll get "hello"?
null
[]
There are two classes that lives in different assemblies and different namespaces. * WinForms: use following namespace declaration, make sure ```Main``` is marked with ```[STAThread]``` attribute: ```using System.Windows.Forms; ``` * WPF: use following namespace declaration ```using System.Windows; ``` * console: add reference to ```System.Windows.Forms```, use following namespace declaration, make sure ```Main``` is marked with ```[STAThread]``` attribute. Step-by-step guide in another answer ```using System.Windows.Forms; ``` To copy an exact string (literal in this case): ```Clipboard.SetText("Hello, clipboard"); ``` To copy the contents of a textbox either use TextBox.Copy() or get text first and then set clipboard value: ```Clipboard.SetText(txtClipboard.Text); ``` See here for an example. Or... Official MSDN documentation or Here for WPF. Remarks: * Clipboard is desktop UI concept, trying to set it in server side code like ASP.Net will only set value on the server and has no impact on what user can see in they browser. While linked answer lets one to run Clipboard access code server side with ```SetApartmentState``` it is unlikely what you want to achieve. * If after following information in this question code still gets an exception see &quot;Current thread must be set to single thread apartment (STA)&quot; error in copy string to clipboard * This question/answer covers regular .NET, for .NET Core see - .Net Core - copy to clipboard?
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 92, "passed_quality_check": "False", "flesch_reading_ease": 91.53347826086959, "entropy": 0.9615268492894509}
I want to put a draft watermark using the below script but the problem is that the watermark don't come over the images and I want it to come over it. ```\usepackage{draftwatermark} \SetWatermarkText{DRAFT} \SetWatermarkScale{1} ```
null
[]
The problem is that the ```draftwatermark``` places the material in the background, so other elements (for example, figures and listings) might cover the included material; to prevent this, instead of using the ```draftwatermark``` package, you can use the ```xwatermark``` package; the starred variant of ```\newwatermark``` places the material in the foreground which seems to be what you need. A little example: First, with the unstarred variant (material on the background, so a figure will be placed on top of it): ```\documentclass{article} \usepackage[printwatermark]{xwatermark} \usepackage{xcolor} \usepackage{graphicx} \usepackage{lipsum} \newwatermark[allpages,color=red!50,angle=45,scale=3,xpos=0,ypos=0]{DRAFT} \begin{document} \lipsum[1-2] \begin{figure}[!ht] \centering \includegraphics[width=3cm]{example-image-a} \end{figure} \lipsum[1-2] \end{document} ``` And now, with the starred variant (material on the foreground, so it will appear on top of figures): ```\documentclass{article} \usepackage[printwatermark]{xwatermark} \usepackage{xcolor} \usepackage{graphicx} \usepackage{lipsum} \newwatermark*[allpages,color=red!50,angle=45,scale=3,xpos=0,ypos=0]{DRAFT} \begin{document} \lipsum[1-2] \begin{figure}[!ht] \centering \includegraphics[width=3cm]{example-image-a} \end{figure} \lipsum[1-2] \end{document} ```
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 202, "passed_quality_check": "True", "flesch_reading_ease": 61.45045454545455, "entropy": 1.4445735012480392}
Understanding the Rails Authenticity Token
null
[]
What is CSRF? The Authenticity Token is a countermeasure to Cross-Site Request Forgery (CSRF). What is CSRF, you ask? It's a way that an attacker can potentially hijack sessions without even knowing session tokens. Scenario: * Visit your bank's site, log in. * Then visit the attacker's site (e.g. sponsored ad from an untrusted organization). * Attacker's page includes form with same fields as the bank's "Transfer Funds" form. * Attacker knows your account info, and has pre-filled form fields to transfer money from your account to attacker's account. * Attacker's page includes Javascript that submits form to your bank. * When form gets submitted, browser includes your cookies for the bank site, including the session token. * Bank transfers money to attacker's account. * The form can be in an iframe that is invisible, so you never know the attack occurred. * This is called Cross-Site Request Forgery (CSRF). CSRF solution: * Server can mark forms that came from the server itself * Every form must contain an additional authentication token as a hidden field. * Token must be unpredictable (attacker can't guess it). * Server provides valid token in forms in its pages. * Server checks token when form posted, rejects forms without proper token. * Example token: session identifier encrypted with server secret key. * Rails automatically generates such tokens: see the authenticity_token input field in every form.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 38, "passed_quality_check": "False", "flesch_reading_ease": 15.640000000000015, "entropy": 0.10358018000765003}
Why is FIFA against adding instant replay to the game?
null
[]
There are a few fundamental considerations: * Uncertainty is a part of the game. The referee and linesmen are the arbiters of the action. Instant replay would limit their authority. * Football is global. Many places do not have access to the technology necessary to implement instant replay. * Football is a fast-paced game with few opportunities for stoppage. Instant replay would unnecessarily slow the pace. In 2008, FiFA President Sepp Blatter said: "Let it be as it is and let's leave [football] with errors. The television companies will have the right to say [the referee] was right or wrong, but still the referee makes the decision – a man, not a machine." Blatter and others at FIFA have repeatedly argued against using instant replay. But lately, FIFA has begun to come around on the idea. At FIFA's Congress in São Paulo prior to the 2014 World Cup, Blatter proposed allowing managers 2 challenges per game, much like the NFL handles challenges today. Although it's not quite "instant replay," in 2012 FIFA approved two different goal-line technologies to improve referee accuracy: "Hawk-Eye" -- which uses visual triangulation to determine ball location -- and "GoalRef" -- which uses a microchip in the ball and magnetic sensors within goalposts. (Many say FIFA approved the technologies in response to Frank Lampard's snubbed "goal" against Germany in the 2010 World Cup.) In 2013, FIFA announced it would use GoalControl, a German competitor to Hawk-Eye, at the Confederations Cup, basically a rehearsal for the World Cup. After a successful run at that tournament, FIFA announced it would implement GoalControl at the 2014 World Cup. The Guardian provides a pretty helpful FAQ on the technology. FIFA may choose to implement further changes to approved goal-line technology and referee rules when it meets again after the World Cup.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 45, "passed_quality_check": "True", "flesch_reading_ease": 95.165, "entropy": 0.2814655290196879}
If we should encrypt the message rather than the method of transfer, why do we care about wifi security? Is this just security theatre?
null
[]
Network encryption protects against different set of threats than application layer encryption like TLS. In particular, network encryption like Wifi encryption are primarily designed to protect from a local attacker from being able to watch network patterns (by recording who you're making connections with, and discovering what devices are on the local network), observing/tampering of low level messages like ARP/DNS, and protecting network broadcasts from devices that aren't supposed to be in the network, and from tampering or selective interference. TLS doesn't protect the low level TCP/IP packets, which leaks information like the IP address of the machine you're connecting with, and the TLS handshake also by design leaks a number of information about the connection like Server Name Indication (SNI) header. The side effect of needing to do all this is that Wifi hardware already need to have enough code and processing power to handle encryption, so it becomes easier to just encrypt all wifi packets rather than selectively figuring out what needs protection or not. This come also with the side benefit that unsecured HTTP connection will still be at least marginally protected, even if at least to protect users of the infrastructure from each other, but not from the infrastructure provider. Network encryption is designed to protect the network, not the service. Application encryption is designed to protect the connection to the service, but it doesn't protect the network. They complement each other, but neither completely makes the other unnecessary.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 112, "passed_quality_check": "True", "flesch_reading_ease": 81.85500000000002, "entropy": 0.5959617136016173}
Applying filter in scipy.signal: Use lfilter or filtfilt?
null
[]
* ```filtfilt``` is zero-phase filtering, which doesn't shift the signal as it filters. Since the phase is zero at all frequencies, it is also linear-phase. Filtering backwards in time requires you to predict the future, so it can't be used in "online" real-life applications, only for offline processing of recordings of signals. * ```lfilter``` is causal forward-in-time filtering only, similar to a real-life electronic filter. It can't be zero-phase. It can be linear-phase (symmetrical FIR), but usually isn't. Usually it adds different amounts of delay at different frequencies. An example and image should make it obvious. Although the magnitude of the frequency response of the filters is identical (top left and top right), the zero-phase lowpass lines up with the original signal, just without high frequency content, while the minimum phase filtering delays the signal in a causal way: ```from __future__ import division, print_function import numpy as np from numpy.random import randn from numpy.fft import rfft from scipy import signal import matplotlib.pyplot as plt b, a = signal.butter(4, 0.03, analog=False) # Show that frequency response is the same impulse = np.zeros(1000) impulse[500] = 1 # Applies filter forward and backward in time imp_ff = signal.filtfilt(b, a, impulse) # Applies filter forward in time twice (for same frequency response) imp_lf = signal.lfilter(b, a, signal.lfilter(b, a, impulse)) plt.subplot(2, 2, 1) plt.semilogx(20*np.log10(np.abs(rfft(imp_lf)))) plt.ylim(-100, 20) plt.grid(True, which='both') plt.title('lfilter') plt.subplot(2, 2, 2) plt.semilogx(20*np.log10(np.abs(rfft(imp_ff)))) plt.ylim(-100, 20) plt.grid(True, which='both') plt.title('filtfilt') sig = np.cumsum(randn(800)) # Brownian noise sig_ff = signal.filtfilt(b, a, sig) sig_lf = signal.lfilter(b, a, signal.lfilter(b, a, sig)) plt.subplot(2, 1, 2) plt.plot(sig, color='silver', label='Original') plt.plot(sig_ff, color='#3465a4', label='filtfilt') plt.plot(sig_lf, color='#cc0000', label='lfilter') plt.grid(True, which='both') plt.legend(loc="best") ```
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 50, "passed_quality_check": "True", "flesch_reading_ease": 50.66500000000002, "entropy": 0.11147076996478539}
What do different people in the department expect from a postdoc? By different people I mean the advisor, graduate students and PhD students. I know it mainly depends on the job description but there are few basic things that a postdoc must be expected to do. How aggressive (proactive) must one be? This question is important since a postdoc cannot just wait for the adviser to give him/her inputs. Rather the postdoc must take the project(s) as another PhD research of his own but be completely accountable to the adviser in terms of what he/she is doing and how is he/she doing that. The above are my thoughts. My question is divided into the following sub-parts: * What would you as a professor expect from your postdoc? * What preparation one must do to rise to the expected level? * Is the preparation merely restricted to having sound academic record and experience?
null
[]
You'll very quickly learn that being an academic involves more than just writing research papers. Your time as a postdoc is when you can start learning about these other aspects, while building your own profile. A postdoc needs to do the following: * Build a publication record. This will involve both what you are paid to do and your own line of research. * Get involved with supervising students. Help with the PhDs in the lab, and get involved in supervising masters students. * Get involved with obtaining funding. This can either be by helping your employer or (ideally) obtaining your own funding. * Build an international reputation. * Start collaborating with external parties. * Gain some teaching experience. This is absolutely crucial if you want a faculty position. * Learn how to manage projects and a lab. This includes overseeing the progress of projects, allocating your time (and others), presenting results at meetings and writing deliverables. If you are in a lab setting, you will need to learn how to fix/calibrate/maintain critical equipment and software so that you can start your own lab some day, and you will need to become proficient in teaching more junior members on how to use that equipment. * Start to devise a strategic research plan. While it is fun to do opportunistic research, solving a problem that comes along or investigating any idea that pops into your head, a better long term strategy is to formulate an interesting long term research plan and follow it, building result upon result. Be as proactive as humanly possible, without being annoying. Talk to everyone in the department, especially people whose research interests are close to your. Go to conferences and sit down and work with interesting people (not necessarily the superstars).
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 729, "passed_quality_check": "True", "flesch_reading_ease": 75.21761363636365, "entropy": 4.997703899920381}
Can someone explain to me what the ```contentInset``` property in a ```UIScrollView``` instance is used for? And maybe provide an example?
null
[]
While jball's answer is an excellent description of content insets, it doesn't answer the question of when to use it. I'll borrow from his diagrams: ``` _|←_cW_→_|_↓_ | | --------------- |content| ↑ ↑ |content| contentInset.top cH |content| ↓ |content| contentInset.bottom |content| ↓ --------------- |content| -------------↑- ``` That's what you get when you do it, but the usefulness of it only shows when you scroll: ``` _|←_cW_→_|_↓_ |content| ← content is still visible --------------- |content| ↑ ↑ |content| contentInset.top cH |content| ↓ |content| contentInset.bottom |content| ↓ --------------- _|_______|___ ↑ ``` That top row of content will still be visible because it's still inside the frame of the scroll view. One way to think of the top offset is "how much to shift the content down the scroll view when we're scrolled all the way to the top" To see a place where this is actually used, look at the build-in Photos app on the iphone. The Navigation bar and status bar are transparent, and the contents of the scroll view are visible underneath. That's because the scroll view's frame extends out that far. But if it wasn't for the content inset, you would never be able to have the top of the content clear that transparent navigation bar when you go all the way to the top.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 118, "passed_quality_check": "False", "flesch_reading_ease": 87.54204545454546, "entropy": 0.5342840295150273}
How is arc defined in TikZ?
null
[]
```\draw (x,y) arc (start:stop:radius);``` draws an arc * with radius ```radius``` * starts from ```(x,y)``` * with center ```(x-r*cos(start), y-r*sin(start))``` and * ends at ```(x-r*cos(start)+r*cos(stop), y-r*sin(start)+r*sin(stop))```. For example, ``` \draw[red] (0,0) arc (30:60:3); ``` draws an arc * of radius ```3``` * starting from ```(0,0)``` * with center ```(0-3*cos(30),0-3*sin(30))``` and * ending at ```(0-3*cos(30)+3*cos(60),0-3*sin(30)+3*sin(60))```. ```\draw[blue] (0,0) -- ++(30+180:3) -- +(60:3); ``` draw a blue line to the arc to make a complete sector. Minimal Working Example ```\documentclass[tikz,border=12pt]{standalone} \begin{document} \foreach \start/\stop in {30/60,45/90,135/180,0/180,45/315} { \begin{tikzpicture} \draw[lightgray,ultra thin] (-6,-6) grid (6,6); \draw[red] (0,0) arc (\start:\stop:3); \draw[blue] (0,0) -- ++(\start+180:3) -- +(\stop:3); \node[anchor=north] at (0,6) {$(\start:\stop:3)$}; \end{tikzpicture} } \end{document} ```
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 22, "passed_quality_check": "False", "flesch_reading_ease": 116.14500000000001, "entropy": 0.13265125765421268}
How to connect mysql workbench to running mysql inside docker?
null
[]
By default after deployment MySQL has following connection restrictions: ```mysql> select host, user from mysql.user; +-----------+---------------+ | host | user | +-----------+---------------+ | localhost | healthchecker | | localhost | mysql.session | | localhost | mysql.sys | | localhost | root | +-----------+---------------+ 4 rows in set (0.00 sec) ``` Apparently, for the security purposes you will not be able to connect to it outside of the docker image. If you need to change that to allow root to connect from any host (say, for development purposes), do: * Start your mysql image with all port mappings required: ```docker run -p 3306:3306 --name=mysql57 -d mysql/mysql-server:5.7``` or, if the complete port mapping is required: ```docker run -p 3306:3306 -p 33060:33060 --name=mysql57 -d mysql/mysql-server:5.7 ``` * If this is the fresh installation - grab the default password: ```docker logs mysql57 2>&1 | grep GENERATED``` * Connect using ```mysql``` client directly to the mysqld in docker: ```docker exec -it mysql57 mysql -uroot -p``` * If this is the fresh installation you will be asked to change the password using ```ALTER USER``` command. Do it. * Run SQL: ```update mysql.user set host = '%' where user='root';``` * Quit the ```mysql``` client. * Restart the container: ```docker restart mysql57``` Now you will be able to connect from MySQL Workbench to ```host: `0.0.0.0` port: `3306` ``` After all the changes the query will show: ```select host, user from mysql.user; +-----------+---------------+ | host | user | +-----------+---------------+ | % | root | | localhost | healthchecker | | localhost | mysql.session | | localhost | mysql.sys | +-----------+---------------+ ```
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 53, "passed_quality_check": "True", "flesch_reading_ease": 69.78500000000001, "entropy": 0.2007346061346783}
Can meat spoil outside the fridge if it's baked into bread as a filling?
null
[]
There are two differences between your buns and a tin can. First, your buns were heated to a core temperature of under 100°C. Yes, your oven was probably set way higher, but the water content in your filling prevents it from getting hotter than boiling water. Commercial canning is done in the vicinity of 120-130°C, which is possible because the cans are cooked under pressure. So unlike in a can, most pathogens were destroyed, but not necessarily all of them. For human consumption, that’s perfectly fine as long as the remaining ones don’t get the time-temperature combo to regrow. Second, a bread dough may be dense (although the aim is usually something different), but by no means airtight. Interestingly, wrapping meat in dense dough was used as preservation method in medieval times - the “ancestor” of today’s pork pies and pastries. But while the hard flour crust (not intended to be eaten originally) did form a protective layer and usually extended the shelf life more or less, it was by no means food safe judged by modern standards - although some pies were stored for months. But your fluffy buns are truly not a protective layer. Which means you should refrigerate your buns, but also that you get to enjoy the whole dish.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 59, "passed_quality_check": "True", "flesch_reading_ease": 95.93928571428573, "entropy": 0.35652473917376387}
I'm wondering how the XML Schema specification handles these cases: ``` ``` No maxOccurs given -> Is this the cardinality [1..1]? ``` ``` I suppose this is simply invalid? ``` ``` Is this the cardinality [0..2] or [1..2]? Is there an "official" definition on how the XML Schema spec handles these cases?
null
[]
New, expanded answer to an old, commonly asked question... Default Values * Occurrence constraints ```minOccurs``` and ```maxOccurs``` default to ```1```. Common Cases Explained ``` ``` means ```A``` is required and must appear exactly once. ``` ``` means ```A``` is optional and may appear at most once. ``` ``` means ```A``` is required and may repeat an unlimited number of times. ``` ``` means ```A``` is optional and may repeat an unlimited number of times. See Also * W3C XML Schema Part 0: Primer In general, an element is required to appear when the value of minOccurs is 1 or more. The maximum number of times an element may appear is determined by the value of a maxOccurs attribute in its declaration. This value may be a positive integer such as 41, or the term unbounded to indicate there is no maximum number of occurrences. The default value for both the minOccurs and the maxOccurs attributes is 1. Thus, when an element such as comment is declared without a maxOccurs attribute, the element may not occur more than once. Be sure that if you specify a value for only the minOccurs attribute, it is less than or equal to the default value of maxOccurs, i.e. it is 0 or 1. Similarly, if you specify a value for only the maxOccurs attribute, it must be greater than or equal to the default value of minOccurs, i.e. 1 or more. If both attributes are omitted, the element must appear exactly once. * W3C XML Schema Part 1: Structures Second Edition ```<element maxOccurs = (nonNegativeInteger | unbounded) : 1 minOccurs = nonNegativeInteger : 1 > ```
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 262, "passed_quality_check": "False", "flesch_reading_ease": 22.105974025974035, "entropy": 1.3748961538797733}
Were there any flying dinosaurs?
null
[]
Birds are both flying dinosaurs and flying reptiles. Yes, that's potentially confusing. To understand the apparent contradiction, you have to understand how modern classification of organisms works (phylogenetic systematics). Under the old (Linnean) classification system, Reptilia (reptiles) was an order and Aves (birds) was a separate order. Phylogenetic systematics, which has completely replaced the Linnean system, views all organisms as interrelated in a nested set of monophyletic groups (clades). It's like a set of venn diagrams, where all organisms fall into a giant circle and then successively smaller circles classify more and more specific groups. The clade Reptilia includes snakes, lizards, crocodiles, and lots of extinct groups, including dinosaurs. So all dinosaurs are reptiles. The clade Dinosauria includes all the extinct dinosaurs (Stegosaurus, Triceratops, sauropods, etc.), including theropod dinosaurs, which include well known dinosaurs like Tyrannosaurus and Allosaurus. Based on a mountain on anatomical evidence, including lots of transitional fossils, living birds are a sub-group of theropod dinosaurs. So all birds (Aves) are theropod dinosaurs (Dinosauria: Theropoda). All dinosaurs are reptiles. Therefore, birds are dinosaurs and reptiles. They are just more closely related to dinosaurs than to other reptiles. The tricky part is that most people have an intuitive idea of what "reptiles" and "dinosaurs" are. To a systematist, whose job it is to classify organisms, these terms don't mean the same thing as they do to most people. Systematists think about groups like Reptilia and Dinosauria and how those groups are related to one another. So they have no problem saying that birds are dinosaurs and reptiles, because birds are nested within both of those groups. A few words about pterosaurs Along with birds and bats, pterosaurs are the other clade of vertebrates capable of powered, flapping flight. Pterosaurs fall within Reptilia (and Diapsida and Archosauria) along with Dinosauria, which includes birds. There are a lot of other extinct lineages in the tree that are not shown, e.g., ornithodirans that are not dinosaurs and not pterosaurs. Pterosaurs and birds share anatomical features that all reptiles, diapsids, archosaurs, and ornithodirans have, which is how we know that they are more closely related to each other than to other groups, like crocodiles. But their flight structures evolved independently and are anatomically distinct fro one another. So pterosaurs are flying reptiles but not flying dinosaurs. These images might help you understand the above explanation.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 28, "passed_quality_check": "False", "flesch_reading_ease": 66.40000000000003, "entropy": 0.054293524960444706}
Say, a table ```car``` has one-to-one relationship to tables ```electric_car```, ```gas_car```, and ```hybrid_car```. If a ```car``` is ```electric_car```, it can no longer appear in ```gas_car``` or a ```hybrid_car```, etc. Is it a bad practice to have several mutually exclusive one-to-one relationships in database design?
null
[]
The different types of cars are an instance of a general problem that surfaces over and over again in data modeling. It is called "generalization/specialization" in ER modeling, and "superclass/subclass" in object modeling. An object modeler uses the inheritance features built into the object model to solve the problem quite easily. The subclasses simply extend the superclass. The relational modeler is faced with a problem. how to design the tables so as to emulate the benefits that one would get from inheritance? The simplest technique is called single table inheritance. Data about all types of cars are grouped into a single table for cars. There is a column, car_type, that groups together all the cars of a single type. No car can belong to more than one type. If a column is irrelevant to, say, electric cars, it will be left NULL in the rows that pertain to electric cars. This simple solution works well for the smaller and simpler cases. The presence of a lot of NULLs adds a tiny bit to storage overhead, and a little bit to retrieval overhead. The developer may have to learn SQL three-valued logic if boolean tests are done on nullable columns. This can be baffling at first, but one gets used to it. There is another technique, called class table inheritance. In this design, there are separate tables for gas_car, electric_car, and hybrid_car, in addition to a combined table, car, for all of them. When you want all of the data about a specific kind of car, you join the car table with the appropriate specialized table. There are fewer NULLs in this design, but you do more joining. This technique works better in the larger and more complex cases. There is a third technique called shared primary key. This technique is often used in conjunction with class table inheritance. The specialized tables for the subclasses have, as their primary key, a copy of the primary key of the corresponding entry in the car table. This id column can be declared to be both the primary key and a foreign key. This involves a little extra programming when new cars are to be added, but it makes the joins simple, easy, and fast. Superclasses and subclasses happen all the time in the real world. Don't be afraid. But do test your initial design for performance. If your first attempt is simple and sound, you'll be able to tweak it to speed it up.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 283, "passed_quality_check": "False", "flesch_reading_ease": 51.203376288659825, "entropy": 2.11667182077507}
I see a low use of Mathematica in Kaggle competitions. Why would one use the Wolfram Language versus R, Python, or Julia for machine learning? Besides prettier plots and the Manipulate function, do we have something that is useful for ML that other languages are lacking?
null
[]
Mathematica doesn't have the depth of algorithm support that is present in R or Python. Julia has much more limited algorithm support but does exhibit a good turn of speed. The few algorithms that Mathematica does support are not particularly well exposed for the type of tweaking needed to win Kaggle competitions. Mathematica, as of version 10, supports the following classifiers: "LogisticRegression", "Markov", "NaiveBayes", "NearestNeighbors", "NeuralNetwork", "RandomForest", "SupportVectorMachine". Whilst it does offer one ensemble method, RandomForest, it lacks both Bagging and any flavour of boosting, such as Adaboost. These latter general ensemble methods allow you to leverage the power of a base classifier, either built-in or, of greater utility when exploring performance improvements, of your own design. This limits significantly the potential for creating novel methods within the existing machine learning framework. Mathematica's strengths lay with it's expressive, compact, language, strong visualisation capabilities and easy parallelization. These make it very efficient to explore new strategies and combinations of ML algorithms you may already have implemented. A less often mentioned benefit is that use of Mathematica in a functional programming style tends to lead to fewer bugs in the final code.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 226, "passed_quality_check": "True", "flesch_reading_ease": 64.37166666666668, "entropy": 1.4977390744793684}
I'm using wp_nav_menu and am trying to create custom output for the sub-level drop downs. I came across the "items_wrap" argument but there's really not much information as to what it is, how it works, and what kind of things can be done with it. What exactly is "%1$s" and "%2$s"? (Can anyone explain it in layman's terms?)
null
[]
The parameter ```'items_wrap'``` for ```wp_nav_menu()``` defaults to: ```'%3$s' ``` This a a template that is parsed with ```sprintf()```: ```$nav_menu .= sprintf( $args->items_wrap , esc_attr( $wrap_id ) // %1$s , esc_attr( $wrap_class ) // %2$s , $items // %3$s ); ``` The numbered placeholders – ```%1$s```, ```%2$s```, ```%3$s``` – refer to the arguments after the first argument in ```sprintf()```. The percent sign marks a placeholder, the number the position and the type ```s``` means it should be treated as a string. Do not change the type unless you really know what you do. :) * ```$wrap_id``` is the parameter ```'menu_id'``` if you have it set, else it is ```'menu-' . $menu->slug```. * ```$wrap_class``` is the parameter ```'menu_class'``` if you have it set, else it is empty. * ```$items``` is a string of the inner content of the menu. Let’s say you don’t need a ```class```. Just omit the second string: ```wp_nav_menu( array( 'items_wrap' => '%3$s' ) ); ``` If you don’t need the ```class``` and the ```id```, and you want another container (because you used a custom walker): ```wp_nav_menu( array( 'items_wrap' => '%3$s' ) ); ``` The main point is: You have to use the numbers for the replacements given in ```wp_nav_menu()```. ```%3$s``` is always the list of items.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 268, "passed_quality_check": "True", "flesch_reading_ease": 84.6702419354839, "entropy": 2.471060251824804}
I've noticed that people on YouTube and even on TV would sometimes say things like "I used to take lots of coke a few years ago" or "I used to smoke weed daily until this and that" or "Yea, I smoke weed every once in a while," or "I used to pirate games a lot when I was a bit younger" or "I used pirated Windows and Photoshop until I got a job," etc., etc.. Basically they are confessing to a crime, on public record, couldn't anyone come after them? They've already confessed - technically all that would have to be done is a trial. How do people publicly admit to criminal activity and not typically get arrested?
null
[]
Unless the Youtube Video shows them committing a crime, then no, they couldn't be arrested and tried for a crime. Them saying it, not under oath, is just hearsay that has no evidentiary value unless there is already other evidence they have committed a crime. In that case, its an admission. But there must be other, either circumstantial, or actual physical evidence of a crime. Past intoxication is not a crime, either. Possession of drugs, if caught with them is. But saying you got high is not. People have walked into police stations and confessed to murders. But with no evidence, no body, no name of a missing person, they can't even be held after the holding period for investigatory purposes expires. If the video shows them committing assault, or breaking and entering (there actually are idiots who post this stuff), the video is actual evidence of a crime and it is often used against them. The statements can be used to begin an investigation, but people don't usually confess to anything worth pursuing even an investigation. The fact that someone says they used to do something criminal is not enough. For all you ( meaning anyone ) knows, the statute of limitations has expired because they "pirated games" 10 years ago. Your comment is right on.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 501, "passed_quality_check": "True", "flesch_reading_ease": 70.71101890756304, "entropy": 4.4024218304982625}
Did two dissenting Supreme Court justices agree that Trump was "absolutely immune" to the Manhattan DA's subpoena?
null
[]
If you are interested in the gory details, please see the full decision in Trump v. Vance. The first half of the linked document contains the Court's majority opinion and the concurring opinion of Justices Kavanaugh and Gorsuch, followed by the separate dissenting opinions of Justices Thomas and Alito. Based on a quick read, it's apparent that Justice Thomas agrees with the general court's opinion that a sitting President &quot;is not entitled to absolute immunity from issuance of [a] subpoena&quot;. Thomas dissents on the grounds that the President &quot;may be entitled to relief against [a subpoena's] enforcement&quot; based on his special status as president. Thomas argues (agreeing with the president) that the case should be vacated and returned to the lower court, so that the President can argue that his duties to the nation take up all of his time and attention and he thus deserves relief from the subpoena. Justice Alito makes a stronger dissent. While he agrees that a sitting President is not absolutely immune from a state subpoena, he argues that such a subpoena should not be enforced unless it meets a stringent legal test, such that: * It does not interfere with the President's execution of his duties of office, and * It carries a weight of urgency — e.g., subpoenaing information related to suspected treason — as a guarantee it is not merely issued to harass. In the absence of those conditions, in Alito's opinion, the President is only subject to the constitutional process of impeachment and trial in Congress. So no, neither dissenting Justice suggests that the President is absolutely immune from this kind of subpoena. Instead, they are concerned that the issuance of such subpoenas might negatively impact on the President's ability to perform the duties of the office, and argue that the President might legitimately be granted varying degrees of relief from such legal actions at a court's discretion.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 98, "passed_quality_check": "True", "flesch_reading_ease": 60.19176470588238, "entropy": 0.4104840160140982}
Just curious, given how heavily from Tolkien D&D drew, and the fact that games like Wizardry used Hobbits, is there a good design reason why Gygax and company used Halflings (a term that also appears in Tolkien) vice Hobbits as the term for our little friends?
null
[]
Halflings were originally called hobbits prior to a legal challenge. According to Gary Gygax himself, it was due to a legal claim on &quot;hobbit&quot; by a company who purchased the merchandising rights on Tolkien's works in 1976: TSR was served with papers threatening damages to the tune of half a mil by the Saul Zantes (sp?) division of Elan Merchandising on behalf of the tolkien Estate. The main objection was to the boardgame we were publishing, The Battle of Five Armies. The author of that game had given us a letter from his attorney claiming the work was grandfathered because it was published after the copyrights for JRRT's works had lapsed and before any renewals were made. The action also demanded we remove balrog, dragon, dwarf, elf, ent, goblin, hobbit, orc, and warg from the D&D game. Although only balrog and warg were unique names we agreed to hobbit as well, kept the rest, of course. The boardgame was dumped, and thus the suit was settled out of court at that. Halflings were originally called &quot;hobbits&quot; in the Dungeons & Dragons box set first released in 1974. Later printings changed this to &quot;halfling&quot;. According to The Acaeum, this change occurred between the fifth printing (Dec 1975 - Apr 1976) and sixth printing (1977), with the six printing being marked the Original Collector's Edition. However, Tim Kask has said that box sets were generally thrown together with whichever printings of the books were on hand, so the distinctions between printings are inexact. The Acaeum notes at least one box set shipped having the revised booklets but no Original Collector's Edition mark. Due to an oversight, a single reference to &quot;hobbit&quot; remained on page 6 of Men & Magic, which was fixed in the 2013 Deluxe reprint and PDF copies. According to Wikipedia, J.R.R. Tolkien sold the film, stage, and merchandising rights to The Hobbit and Lord of the Rings to United Artists in 1968, who sold them in turn to Saul Zaentz in 1976. Zaents would go on to produce the 1978 Lord of the Rings animated movie.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 215, "passed_quality_check": "True", "flesch_reading_ease": 53.475434782608716, "entropy": 1.2794453536799222}
My USB drive used to be originally 8GB when I bought it. I'm trying to reformatted in Windows 7 by right clicking on the drive and selecting ```Format...```. But the capacity only shows 250MB. Is there something I can do to get the original size back? Maybe it got partitioned in a weird way? The flash drive is a SanDisk Cruzer Micro 8GB.
null
[]
The command line procedure is not simple, but it is the most likely thing to work. When re-formatting the "drive" you're actually only formatting a partition on the drive. You need to use the diskpart utility to remove the partitions and create 1 single partition covering the full volume. ```diskpart``` can be a bit dangerous, because if you pick the wrong disk or partition, you can remove data or partitions that are extremely, EXTREMELY important and lose all data on your machine. Proceed with extreme caution! Open up a command prompt as administrator (open the start menu, type ```cmd``` and press Enter.) Type ```diskpart``` and press Enter. You'll end up with a new prompt that looks like this: ```DISKPART> ``` Type ```list disk ``` and you'll get a listing of all drives on your machine. Type ```select disk # ``` to select a disk, where ```#``` is the number of the disk Windows screw-balled. Usually, the device is disk 1, but it's always best to make sure. Then type ```list partition ``` to get a listing of all partitions on the disk. If you're sure you have the right disk/partition, you can then repeat typing ```select partition # delete partition ``` until all partitions are removed from that drive (you may need to type ```delete partition override``` for protected partitions). Once the drive is empty, exit diskpart and remove the drive. Wait at least 5 minutes, then re-insert the drive. DO NOT CLICK FORMAT – this will most likely re-create the problem. Instead, enter diskpart again, and select the disk. Then type ```create partition primary ``` Once you have created the partition, exit ```diskpart``` and, in the command promt, type ```diskmgmt.msc ``` This will provide a reliable way to create a FAT32 partition. On the drive you would like to format (NEVER TOUCH DISK 0!), right click and select ```format```. The ```allocation unit size``` option should be default, and the ```File System``` option should be set to ```FAT32```. The format may take a while, depending on the disk size, be patient. This should fix partition troubles on any readable USB flash drive.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 280, "passed_quality_check": "True", "flesch_reading_ease": 90.45464912280706, "entropy": 2.2717592503436324}
I am a Tor developer. I understand that the .onion address is a public key of sorts, but not much more than that (I can vaguely guess, though). When nobody knows the IP of the .onion address, how do requests reach it? Are they bounced between nodes in the P2P network till someone decrypts it with the corresponding private key?
null
[]
Up to at least October 2013 the hidden services work like this: * A hidden service calculates its key pair (private and public key, asymmetric encryption). * Then the hidden service picks some relays as its introduction points. * It tells its public key to those introduction points over Tor circuits. * After that the hidden-service creates a hidden service descriptor, containing its public key and what its introduction points are. * The hidden service signs the hidden service descriptor with its private key. * It then uploads the hidden service descriptor to a distributed hash table (DHT). * Clients learn the .onion address from a hidden service out-of-band. (e.g. public website) (A $hash.onion is a 16 character name derived from the service's public key.) * After retrieving the .onion address the client connects to the DHT and asks for that $hash. * If it exists the client learns about the hidden service's public key and its introduction points. * The client picks a relay at random to build a circuit to it, to tell it a one-time secret. The picked relay acts as rendezvous point. * The client creates a introduce message, containing the address of the rendezvous point and the one-time secret, before encrypting the message with the hidden service's public key. * The client sends its message over a Tor circuit to one of the introduction points, demanding it to be forwarded to the hidden service. * The hidden service decrypts the introduce message with its private key to learn about the rendezvous point and the one-time secret. * The hidden service creates a rendezvous message, containing the one-time secret and sends it over a circuit to the rendezvous point. * The rendezvous point tells the client that a connection was established. * Client and hidden service talk to each other over this rendezvous point. All traffic is end-to-end encrypted and the rendezvous point just relays it back and forth. Note that each of them, client and hidden service, build a circuit to the rendezvous point; at three hops per circuit this makes six hops in total.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 269, "passed_quality_check": "True", "flesch_reading_ease": 87.27000000000001, "entropy": 2.3053822727606135}
I have been offered a PhD position by an inexperienced professor in a great institution in Europe. Despite the fact that the institution is very strong in my area, since the position was offered by this particular professor, I would have to commit myself to working with him for my thesis. This professor is young, and relatively inexperienced, but I enjoy the things he works on, and we seem to get along well. My question is, would having an inexperienced advisor hurt my growth as a scientist, or my career in general? Will I have the time during my PhD to also work on the side with other, more renowned professors in the department, or is one usually focused in a single research project?
null
[]
An inexperienced advisor can hurt your career by being relatively unknown. This means they may not have access to the same network and that their recommendation letters do not carry the same weight. Inexperience in supervision may, for example, lead to unrealistic expectations. Or an inexperienced advisor can be very good for your career, by quickly rising to fame with the awesome publications the two of you will write together and being fresh in everybody's memory when writing recommendation letters. They may spend plenty of time on working with you. An experienced advisor can hurt your career by being never there. They may already have made their name, have extremely high expectations from PhD students, to the level of cause them to be overly stressed and quit. Or they may be very good for your career, as dedicated as can be to PhD students, prioritising them above most other duties, having realistic expectations from PhD students, and having great influence when writing recommendation letters. Bottom line: an experienced advisor may be better for you than an inexperienced one, but that certainly does not have to be the case. And keep in mind: a very good/famous scientist is not always a very good PhD advisor.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 571, "passed_quality_check": "True", "flesch_reading_ease": 56.252000000000024, "entropy": 4.635821210473649}
Is there a phrase that means "too important" and "attracting too much attention"?
null
[]
There is the term "overdominant": From Collins dictionary: >overdominant [adjective] excessively dominant To begin with, the design aspect is the most striking and arguably remains overdominant. [Times, Sunday Times (2010)] Here is an example: > [Steps must be taken to prevent any one] religious or ethnic group being overdominant. Otherwise, we will see a repeat of the unfortunate history of much of the 20th Century... Other possible terms that have similar meaning include "overpowered", "obtrusive" and "preponderant".
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 69, "passed_quality_check": "True", "flesch_reading_ease": 69.99384615384618, "entropy": 0.40495992130786757}
This guy claims that Olympic powerlifters working in the 1-6 rep range can increase strength without increasing muscle size. > Trained Olympic lifters, for example, were shown over a two-year period to have significant strength increases with barely noticeable increases in muscle mass (Hakkinen et al, 1988). I had a similar experience when I used AST's Max-OT principals. My strength went up like crazy, but I gained very little size. Obviously, traditional strength training with low volume and low sets (1-6 reps, 3 or less sets) is not the best approach. Strength training does cause hypertrophy (Hakkinen et al, 1985), but it won't cause maximum hypertrophy. What is the scientific explanation for this? Is the inverse true? That is, can a buff guy (with lots of prominent muscle) actually be weak?
null
[]
Certainly there is a correlation between muscle mass and strength, but there is more to the story. Two reasons why muscle mass and strength may not be completely congruous are: * Muscle fiber density * Muscle utilization Density: Your muscles are composed of four different types of fibers (slow-twitch, and three forms of fast-twitch). These fibers have different profiles in terms of force applied and recovery time. Slow twitch fibers, for example, recover quickly but have less force as there are fewer muscle fibers per bundle, compared with the fast-twitch fibers. Extra water in the form of glycogen can also cause muscles to take up more volume with the same amount of actual muscle. This glycogen can be a ready source of energy for the muscles, but isn't going to increase their maximum theoretical force for a single heavy lift (per Olympic competition) where endurance through a long set isn't at issue. Utilization: The average person is able to utilize 20-30% of their total theoretical muscle strength when trying their hardest. (Ref. Tsatsouline, Power To The People) Top lifters use perhaps 50% of their theoretical strength. Olympic and powerlifting-style training focuses on training the neural pathways to utilize a greater percentage of the available muscle mass. Since muscle fibers contract all internal cells (the all-or-nothing principal), this training is focused on convincing a greater proportion of fiber bundles to contract during a lift. Can a buff guy be weak? Well, it depends on your definition of buff. A cut guy can be weak (compared to a strength athlete), because muscle definition is more about having low body fat covering the muscle than it is about having large muscles. A bodybuilder with decent volume won't be able to lift as much as a comparable powerlifter because he/she doesn't train for strength per se. It seems worth noting that Olympic/power lifters also want to minimize their size (except for the heavyweights) because it affects their weight class in competition, so there is an added incentive to train for neural utilization over additional muscle mass.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 678, "passed_quality_check": "True", "flesch_reading_ease": 77.1435685320357, "entropy": 4.425474838519344}
What are the major concerns about planting trees to create carbon offsets?
null
[]
Here are some common concerns about using tree planting projects to create carbon offsets: * The scheme actually has a net positive effect, both in the short and long-term/ How effective a tree planting scheme is in capturing and storing carbon dioxide, is for a large part determined by what happens to the trees after they are planted. When trees mature and are harvested for wood that's used in construction, then the captured carbon dioxide is stored for a long time (until the wood decomposes or is burned). However, if no trees are replanted after harvesting this will have had a one-time effect only. Also when wood is burned (for energy or in a wild fire), or if trees die quickly and decompose, then their captured carbon is released again. Of course all trees die eventually even when they are not harvested, this is part of the natural cycle, but a mature forest can store a lot more carbon than a young, newly-planted forest so it's important to keep a forest intact as much as possible. * The wrong type(s) of trees are planted in the wrong location. In the past there were bad offsetting schemes that planted non-native trees, or planted trees in a location where they would change water flows and thus change local ecosystems in a negative way. Some offsetting schemes planted thousands of trees of the same species, resulting in a large monoculture. Such a monoculture hinders biodiversity, is susceptible to diseases and can even damage local communities. There have also been reports that planting trees above a certain latitude can have a net warming effect by changing the albedo and trapping heat. * Buying offsets reduces the incentive for people to reduce their emissions. Reducing emissions is much more effective than offsetting. Buying carbon offsets can lead to people thinking they are doing the right thing, whereas they had better spent their time and effort in reducing their emissions. Of course this point goes for all offsetting-schemes and is not specifically for planting trees. * There are more effective ways of reducing carbon emissions than planting trees. Nowadays many offsetting schemes invest in development of renewable energy sources (in developing countries) instead of planting trees, simply because it is a more effective and cheaper way to reduce emissions.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 63, "passed_quality_check": "True", "flesch_reading_ease": 67.75500000000001, "entropy": 0.26853364746430064}
I am wondering how to generate uniformly distributed points on the surface of the 3-d unit sphere? Also after generating those points, what is the best way to visualize and check whether they are truly uniform on the surface $x^2+y^2+z^2=1$?
null
[]
A standard method is to generate three standard normals and construct a unit vector from them. That is, when $X_i \sim N(0,1)$ and $\lambda^2 = X_1^2 + X_2^2 + X_3^2$, then $(X_1/\lambda, X_2/\lambda, X_3/\lambda)$ is uniformly distributed on the sphere. This method works well for $d$-dimensional spheres, too. In 3D you can use rejection sampling: draw $X_i$ from a uniform$[-1,1]$ distribution until the length of $(X_1, X_2, X_3)$ is less than or equal to 1, then--just as with the preceding method--normalize the vector to unit length. The expected number of trials per spherical point equals $2^3/(4 \pi / 3)$ = 1.91. In higher dimensions the expected number of trials gets so large this rapidly becomes impracticable. There are many ways to check uniformity. A neat way, although somewhat computationally intensive, is with Ripley's K function. The expected number of points within (3D Euclidean) distance $\rho$ of any location on the sphere is proportional to the area of the sphere within distance $\rho$, which equals $\pi\rho^2$. By computing all interpoint distances you can compare the data to this ideal. General principles of constructing statistical graphics suggest a good way to make the comparison is to plot variance-stabilized residuals $e_i(d_{[i]} - e_i)$ against $i = 1, 2, \ldots, n(n-1)/2=m$ where $d_{[i]}$ is the $i^\text{th}$ smallest of the mutual distances and $e_i = 2\sqrt{i/m}$. The plot should be close to zero.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 202, "passed_quality_check": "True", "flesch_reading_ease": 68.93343023255817, "entropy": 1.2217090860052753}
In Shutter Island, at the end of the movie Teddy had a chat with Chuck, in that scene Teddy told to Chuck as, Which would be worse: To live as a monster, or to die as a good man? What's the implicit meaning of this dialogue? Who's the monster as Teddy mentioned? And, who's a good man?
null
[]
To Live as a Monster If he accepts his guilt and becomes sane he will become the Monster. His delusions are his brains way of removing this guilt and hiding the fact that he ignored his family, did not act on his wife's mental illness, allowed her to murder their children and then murdered her. By accepting what the doctors are telling him he will need to go on living in the knowledge that he allowed terrible things to happen and did terrible things. The doctors will be able to treat him without a lobotomy but he will be fully aware of the crimes he committed. To die as a good man In his delusion he is a good man. He truly believes that he is on the side of law and order and that he is doing right. If he chooses to continue to believe this he will be lobotomised and will no longer have relevant brain function to question what he did or did not do. The death is not literal as the other answer suggests. It is about the fact that if he continues to believe he is this good man he will be lobotomised and effectively "die" believing in this. He will not die in a literal sense until later, but he will do so in the belief he was a good man. What is most exciting and cathartic about this decision is that this appears to be a moment of lucidity where he understands what has happened and is not in thrall of his delusions. He at this point of lucidity makes the decision that he can not live with his crimes and would prefer to lie to his doctor as he knows this will result in his lobotomy. By making the statement to his doctor he makes him aware of this also and by virtue of this you could also argue that he is being a good man by electing to be punished as well as the belief in his delusion that he is good.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 234, "passed_quality_check": "True", "flesch_reading_ease": 94.32000000000002, "entropy": 2.2697352860396163}
To set the minimal distance between flexbox items I'm using ```margin: 0 5px``` on ```.item``` and ```margin: 0 -5px``` on container. For me it seems like a hack, but I can't find any better way to do this. ```#box { display: flex; width: 100px; margin: 0 -5px; } .item { background: gray; width: 50px; height: 50px; margin: 0 5px; }``` ``` ```
null
[]
This solution will work for all cases even if there are multiple rows or any number of elements. But the count of the section should be same you want 4 in first row and 3 is second row it won't work that way the space for the 4th content will be blank the container won't fill. We are using ```display: grid;``` and its properties. ```#box { display: grid; width: 100px; grid-gap: 5px; /* Space between items */ grid-template-columns: repeat(4,1fr); /* Decide the number of columns(4) and size(1fr | 1 Fraction | you can use pixels and other values also) */ } .item { background: gray; width: 100%; /* width is not necessary only added this to understand that width works as 100% to the grid template allocated space **DEFAULT WIDTH WILL BE 100%** */ height: 50px; }``` ``` ``` The Downside of this method is in Mobile Opera Mini will not be supported and in PC this works only after IE10. Note for complete browser compatability including IE11 please use Autoprefixer OLD ANSWER Don't think of it as an old solution, it's still one of the best if you only want single row of elements and it will work with all the browsers. This method is used by CSS sibling combination, so you can manipulate it many other ways also, but if your combination is wrong it may cause issues also. ```.item+.item{ margin-left: 5px; } ``` The below code will do the trick. In this method, there is no need to give ```margin: 0 -5px;``` to the ```#box``` wrapper. A working sample for you: ```#box { display: flex; width: 100px; } .item { background: gray; width: 22px; height: 50px; } .item+.item{ margin-left: 5px; }``` ``` ```
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 305, "passed_quality_check": "False", "flesch_reading_ease": 84.17000000000002, "entropy": 1.4900164788778971}
Is there a Git for data? The key improvement I'd want is to Diff/Merge more intelligently. e.g. in CSV rather than line vs line comparison, it would do cell vs cell. And ordering is usually not significant, e.g. rows in a CSV, whereas Git does care and presents the user with 'conflicts'.
null
[]
Please note that ```git``` has two configuration commands: ```git config filter..clean git config filter..smudge ``` The ```clean``` filter can be used e.g. to sort all records in a CSV file except the top row, thus making re-ordering irrelevant. Quoting ```gitattributes(5)``` : A filter driver consists of a clean command and a smudge command, either of which can be left unspecified. Upon checkout, when the smudge command is specified, the command is fed the blob object from its standard input, and its standard output is used to update the worktree file. Similarly, the clean command is used to convert the contents of worktree file upon checkin. A missing filter driver definition in the config is not an error but makes the filter a no-op passthru. The content filtering is done to massage the content into a shape that is more convenient for the platform, filesystem, and the user to use. The key phrase here is &quot;more convenient&quot; and not &quot;turning something unusable into usable&quot;. In other words, the intent is that if someone unsets the filter driver definition, or does not have the appropriate filter program, the project should still be usable.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 238, "passed_quality_check": "True", "flesch_reading_ease": 83.46583333333336, "entropy": 1.7970769341660222}
I have been puzzling over where to put the submit button, on the left or the right. In researching, I noticed that many sites put buttons on the bottom right in dialogue boxes, and on the bottom left in forms. It makes sense: in a dialogue box it seems to denote finality, being in the endpoint of the window for left–right readers; in a form, the bottom right could be in a different position relative to the rest of the form if the window is resized. It seems to be a convention, but should the OK/Cancel buttons be aligned right or centered? Should the OK/Cancel buttons be aligned right or centered?
null
[]
Where to put the submit button should be decided in order to meet user expectations, it was best to put the button in the place that users expect to find it in the context of the form or dialogue they are using and with regard to the window size. Forms tend to be left justified while the browser window can leave a ton of white space to fill up a large monitor (especially in full-screen mode). Since the users' eyes never leave the left portion of the window, we place the button on the bottom left. This is especially important for forms that use the field name above the field, with most fields lying flush left on the form (as opposed to fields to the right of their names). Small Dialogue & Modal Windows are fixed width and tend to be small. Most contain simple phrases or questions, read right to left: having a button on the bottom right feels like both the most progressive position and the final resting place for the eye. Were the modal window large enough to contain a long form, we would probably follow the first principal for forms. In the end, the heuristic is this: * Large Windows & Forms get the button on the bottom left. * Small Windows & Dialogues get the button on the bottom right. Note the buttons on stackexchange sites: * Post Your Answer button at the bottom-left of the longer form * Add Comment button to the right of a small field Furthermore, with mobile-first responsive being the new law of the land, the button placement varies even more based on context and user expectation. Sometimes, it's in the middle, too! We're now starting to just put buttons on the left for even small forms if they're inline … and more forms are showing up inline through javascript.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 496, "passed_quality_check": "False", "flesch_reading_ease": 72.45323076923079, "entropy": 4.520151417487866}
Is it at all possible to update object's properties with ```setState```? Something like: ```this.state = { jasper: { name: 'jasper', age: 28 }, } ``` I have tried: ```this.setState({jasper.name: 'someOtherName'}); ``` and this: ```this.setState({jasper: {name: 'someothername'}}) ``` The first results in a syntax error and the second just does nothing. Any ideas?
null
[]
There are multiple ways of doing this, since state update is a async operation, so to update the state object, we need to use updater function with ```setState```. 1- Simplest one: First create a copy of ```jasper``` then do the changes in that: ```this.setState(prevState => { let jasper = Object.assign({}, prevState.jasper); // creating copy of state variable jasper jasper.name = 'someothername'; // update the name property, assign a new value return { jasper }; // return new object jasper object }) ``` Instead of using ```Object.assign``` we can also write it like this: ```let jasper = { ...prevState.jasper }; ``` 2- Using spread syntax: ```this.setState(prevState => ({ jasper: { // object that we want to update ...prevState.jasper, // keep all other key-value pairs name: 'something' // update the value of specific key } })) ``` Note: ```Object.assign``` and ```Spread Operator``` creates only shallow copy, so if you have defined nested object or array of objects, you need a different approach. Updating nested state object: Assume you have defined state as: ```this.state = { food: { sandwich: { capsicum: true, crackers: true, mayonnaise: true }, pizza: { jalapeno: true, extraCheese: false } } } ``` To update extraCheese of pizza object: ```this.setState(prevState => ({ food: { ...prevState.food, // copy all other key-value pairs of food object pizza: { // specific object of food object ...prevState.food.pizza, // copy all pizza key-value pairs extraCheese: true // update value of specific key } } })) ``` Updating array of objects: Lets assume you have a todo app, and you are managing the data in this form: ```this.state = { todoItems: [ { name: 'Learn React Basics', status: 'pending' }, { name: 'Check Codebase', status: 'pending' } ] } ``` To update the status of any todo object, run a map on the array and check for some unique value of each object, in case of ```condition=true```, return the new object with updated value, else same object. ```let key = 2; this.setState(prevState => ({ todoItems: prevState.todoItems.map( el => el.key === key? { ...el, status: 'done' }: el ) })) ``` Suggestion: If object doesn't have a unique value, then use array index.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 325, "passed_quality_check": "False", "flesch_reading_ease": 57.105277777777815, "entropy": 1.656833138603908}
What is the difference between Non-Player Characters (NPCs) and bots in video games?
null
[]
The key distinction is that a Bot represents an automated player; an NPC, by contrast, isn't playing the game at all. In general, an NPC is a part of the game; a placed object which is designed by the creator and exists to interact with the player. Examples would include vendors, quest givers, or enemies. In some games, (particularly RPG's), the term is also used to refer to characters under the control of, but not generated by the player. They are often distinguished by having distinct personalities and dialog, whereas a ""Player Character"" is meant as more of an extension of the player themselves. Think of the companion party members in the Mass Effect series for an example. A Bot, by contrast, is essentially a player of the game controlled by a computer. This can be populated within a single instance, as a feature in some games (i.e. AI opponents in a normally multiplayer game), or, in some cases, actually represents a separate instance of the application running on a networked computer and being controlled by some manner of AI script (as is common in many MMO's, much to the dismay of the communities playing the game). The term 'Bot' is also often used to refer to software used to enhance or replace the skills of a human player of the game; for example, an 'Aim-Bot' that handles targeting, or a 'Farming Bot' in an MMO that performs tedious or menial tasks. Such bots are usually (though not always), considered cheating and a violation of the Terms of Service of the game in question.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 72, "passed_quality_check": "True", "flesch_reading_ease": 77.81071428571428, "entropy": 0.38476183932910685}
Is there anything like ```static class``` in java? What is the meaning of such a class. Do all the methods of the static class need to be ```static``` too? Is it required the other way round, that if a class contains all the static methods, shall the class be static too? What are static classes good for?
null
[]
Java has static nested classes but it sounds like you're looking for a top-level static class. Java has no way of making a top-level class static but you can simulate a static class like this: * Declare your class ```final``` - Prevents extension of the class since extending a static class makes no sense * Make the constructor ```private``` - Prevents instantiation by client code as it makes no sense to instantiate a static class * Make all the members and functions of the class ```static``` - Since the class cannot be instantiated no instance methods can be called or instance fields accessed * Note that the compiler will not prevent you from declaring an instance (non-static) member. The issue will only show up if you attempt to call the instance member Simple example per suggestions from above: ```public class TestMyStaticClass { public static void main(String []args){ MyStaticClass.setMyStaticMember(5); System.out.println("Static value: " + MyStaticClass.getMyStaticMember()); System.out.println("Value squared: " + MyStaticClass.squareMyStaticMember()); // MyStaticClass x = new MyStaticClass(); // results in compile time error } } // A top-level Java class mimicking static class behavior public final class MyStaticClass { private MyStaticClass () { // private constructor myStaticMember = 1; } private static int myStaticMember; public static void setMyStaticMember(int val) { myStaticMember = val; } public static int getMyStaticMember() { return myStaticMember; } public static int squareMyStaticMember() { return myStaticMember * myStaticMember; } } ``` What good are static classes? A good use of a static class is in defining one-off, utility and/or library classes where instantiation would not make sense. A great example is the Math class that contains some mathematical constants such as PI and E and simply provides mathematical calculations. Requiring instantiation in such a case would be unnecessary and confusing. See the ```Math``` class and source code. Notice that it is ```final``` and all of its members are ```static```. If Java allowed top-level classes to be declared ```static``` then the Math class would indeed be static.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 249, "passed_quality_check": "True", "flesch_reading_ease": 92.28886956521741, "entropy": 1.9617531665321408}
The Episode IV-VI movies never mention the Emperor's name. In Episodes I-III, we can guess that Darth Sidious will be the emperor, but what about Chancellor Palpatine? If the audience didn't know that he was Sidious, the impact of the reveal would be far different than if they did. But I did. In all the novels and comics that came out after "Return of the Jedi", the Emperor's name was stated plainly: Palpatine. So when I saw the prologue movies, for the life of me I couldn't figure out: was I supposed to know that Palpatine was the villain? Maybe the filmmakers figured that most of the moviegoing public never got into the Expanded Universe. But they had to know that the hardcore fans would know. Or maybe when you watched the movie, even if you hadn't heard of Palpatine, it was supposed to be obvious? What was the intent?
null
[]
Palpatine's name was first given in the prologue to Alan Dean Foster's novelization of Star Wars (it was credited to Lucas, but he didn't write it), which came out in November 1976, six months before the May 25, 1977 release of the actual film. So Palpatine being the Emperor was literally known before the public ever saw a Star Wars movie. It was, in fact, one of the very first things people could find out about the Star Wars universe. The point of the films wasn't to conceal the fact Palpatine would end up the Emperor (or was Darth Sidious), it was to show that he was a masterful chessmaster who conned everyone, and that in large part it was the good guys responsible for his rise because of their own blindness. Amidala initiated the vote that removed his predecessor. Jar-Jar initiated the vote that gave him emergency powers. The Jedi Council allowed him to operate under their noses. Anakin never suspected he was being manipulated until too late, and so on. Just as the trilogy was meant as a tragedy showing Anakin Skywalker's rise and fall, it was an additional tragedy in that the person responsible for the whole mess was standing right there the entire time, in the case of the celebration at the end of The Phantom Menace quite literally.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 687, "passed_quality_check": "True", "flesch_reading_ease": 79.82792307692308, "entropy": 6.2539404862441685}
So, students in Gryffindor are supposed to represent bravery. How does Neville represent bravery, to the point in being accepted into the house. I've always thought of his strongest traits being things like loyalty, willingness to work hard, etc, and these things would tend to put him in Hufflepuff.
null
[]
First of all, in the first 4 years, it isn't really shown that Neville is NOT brave - the only thing he's really afraid of is his Grandmother and maybe Snape during Potions. With good reason. :) You may be confusing a lack of confidence/assertiveness with not being brave, but they are not the same (for a good in-universe illustration of the opposite, think Prof. Lockhart). First four books, he's clumsy, and is not yet showing any magical talent. Starting with the fifth year, Neville is shown to have been changed, and repeatedly proves his bravery and willingness to fight. NOTE: He first shows bravery in the First Year (see System's great answer for details), but the real Gryffindor-y Neville emerges in the Fifth year. There's another instance of him showing a Gryffindor quality - more specifically, integrity. He argued with the Hat to sort him into Hufflepuff (src: Pottermore), because he felt he wasn't brave enough to be a Gryffindor. Fifth year * He joins DA * He shows marked and significant improvement in his magical abilities while in DA * He voluntarily joins the DA members who accompany Harry to Ministry of Magic battle in the end of OoP, even arguing with Harry about it: Neville: &quot;We were all in the D.A. together. It was all supposed to be about fighting You-Know-Who, wasn't it? And this is the first chance we've had to do something real — or was that all just a game or something?&quot; Harry: &quot;No — of course it wasn't —&quot; Neville: &quot;Then we should come too. We want to help.&quot; * During the battle at the Ministry, he refused to leave as per Harry's suggestion after Dolohov broke Neville's nose and wand. * When being threatened and tortured by Death Eaters, he told Harry not to give them the Prophecy Sixth year * participated in the Battle of the Astronomy Tower. Along with Luna Lovegood, he was the only member of Dumbledore's Army to reply to the summons via the coins. Seventh year * Neville got in trouble with the Carrows for refusing to practise the Cruciatus Curse on other students as a method of punishment, as well as for standing up against their bigotry and cruelty. * along with Ginny and Luna, restarted Dumbledore's Army. * attempted to steal Godric Gryffindor's Sword from Snape's office * Neville was eventually left alone to lead the rebellion efforts (Luna and Ginny were not in Hogwarts anymore). When avoiding the Death Eaters at one point, Neville stumbled into the Room of Requirement, which he was able to turn into a hiding place for the D.A., and to connect to the Hog's Head in order to get food from Aberforth Dumbledore. By May, most of the D.A. had taken to living there. * During the first round of battle, Neville used various plants to attack Death Eaters, and helped transport the injured and dead when a temporary cease-fire was called. * When the Death Eaters approached with a &quot;dead&quot; Harry, Neville stood up in defiance of Voldemort. He was subsequently forced to wear the Sorting Hat as it burned because he refused to join Voldemort. Fortunately, due to Harry's sacrifice, Neville was able to shrug off the Full Body-Bind Curse. * Because of his tremendous bravery shown on the battlefield, Neville was able to pull Godric Gryffindor's Sword from the burning hat, in the process proving himself a true Gryffindor, something that was doubted constantly throughout due to his apparently weak-willed, shy, and bumbling nature. In a single stroke, he killed Nagini, destroying Voldemort's last remaining Horcrux. * Neville subsequently teamed up with Ron Weasley as the defenders of Hogwarts and Death Eaters were forced into the Great Hall and defeated Fenrir Greyback. All in all, pretty convincing evidence of someone's bravery.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 252, "passed_quality_check": "True", "flesch_reading_ease": 74.57911564625854, "entropy": 2.0363299117746356}
This claim was made popular by being said in the movie The Social Network. It exactly says: > Did you know there are more people with genius IQs living in China than there are people of any kind living in the United States?
null
[]
This claim can actually be tested very easily. Others have done it, e.g. Brian Dickerson: The perils of repeating political nonsense and came to the conclusion that the claim was wrong. You just need the chance a random person from a large group has a genius level IQ, then multiply it with the number of people in China and compare the result with the number of people in the USA. The IQ follows a Gaussian distribution where 100 is the mean by definition and a standard deviation (SD) of 15 (after Wechsler) or 16 (after Stanford-Binet). The rarity of a particular IQ can be calculated easily and are listed by the IQ Comparison Site. These numbers give the percentage of people with an IQ equal or lower than the given IQ and the rarity of this occurring. The main question actually is what an genius level IQ is. There is no definite answer. According to the IQ Comparison Site, it is 140 or higher ("Genius or near genius") while another source states it as at least 160. The rarity of such an IQ is 1/261 (with a SD of 15) or 1/161 (SD=16) for an IQ of 140 and 1/31,560 (SD=15) or 1/11,307 (SD=16) for an IQ of 160 according to Wikipedia. The population of USA for 2012 is about 313,221,000 according to the U.S. Census Bureau. The population of China for 2011 is about 1,370,537,000. Taking the lowest rarity of 1/161 from above then there are about 1,370,537,000/161 = about 8,513,000 geniuses in China, which is significantly less then the 313,221,000 Americans. If you take the 15 SD value of 1/261 then you get only about 5,251,000 Chinese geniuses. With the 160 IQ points, which are more realistic to indicate a real genius, the numbers are even smaller (about 43,400 or 12,100). Note that 1,370,537,000/313,221,000 = 4.375, so in order for this claim to be true actually one of every four (or say five) Chinese would need to be a Genius. Even without the numbers above, it can be easily understood that this is not the case. Conclusion: This claim is wrong according to the definition and probabilities of the IQ. Supplement: It has been pointed out, that there are published research results showing that China and other Asian countries have a higher average IQ of about 106 (or even as high as 115) as the normed average of 100. This would increase the number of geniuses in China: The above factor of 1/161 would drop to about 1/60 or, for a Chinese average of 115, even to about 1/17. These numbers can be easily calculated using the standard deviation, e.g. using MS Excel's function ```NORM.DIST(140, 106, 16, TRUE)```. However, both these factors are not in any way close to the US/Chinese population ratio of about 1/4.375, so the original conclusion still holds.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 184, "passed_quality_check": "True", "flesch_reading_ease": 82.4775, "entropy": 0.9950197804675501}
I am trying to get my program to print out ```"banana"``` from the dictionary. What would be the simplest way to do this? This is my dictionary: ```prices = { "banana" : 4, "apple" : 2, "orange" : 1.5, "pear" : 3 } ```
null
[]
As of Python 3.7, insertion order is maintained, so you don't need an ```OrderedDict``` here. You can use the below approaches with a normal ```dict``` Changed in version 3.7: Dictionary order is guaranteed to be insertion order. This behavior was an implementation detail of CPython from 3.6. source Python 3.6 and earlier* If you are talking about a regular ```dict```, then the &quot;first key&quot; doesn't mean anything. The keys are not ordered in any way you can depend on. If you iterate over your ```dict``` you will likely not get ```&quot;banana&quot;``` as the first thing you see. If you need to keep things in order, then you have to use an ```OrderedDict``` and not just a plain dictionary. ```import collections prices = collections.OrderedDict([ (&quot;banana&quot;, 4), (&quot;apple&quot;, 2), (&quot;orange&quot;, 1.5), (&quot;pear&quot;, 3), ]) ``` If you then wanted to see all the keys in order you could do so by iterating through it ```for k in prices: print(k) ``` You could, alternatively put all of the keys into a list and then work with that ```keys = list(prices) print(keys[0]) # will print &quot;banana&quot; ``` A faster way to get the first element without creating a list would be to call ```next``` on the iterator. This doesn't generalize nicely when trying to get the ```nth``` element though ```>>> next(iter(prices)) 'banana' ``` * CPython had guaranteed insertion order as an implementation detail in 3.6.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 183, "passed_quality_check": "False", "flesch_reading_ease": 94.4133552631579, "entropy": 1.7854648750900857}
Different coffee packets advertise different amounts of 'Robusta' and 'Arabica'? What do these terms refer to, and how does it affect the taste of the coffee?
null
[]
* One reason that the taste isn't as good for Robusta is that it has more caffeine compared to Arabica. Which may sound like a positive thing but caffeine carries a bitter taste which makes it an unpleasant drink. In fact the Robusta bean has 2.7% caffeine content, almost double the 1.5% of Arabica. * Arabica contains almost 60% more lipids and almost twice the concentration of sugar than Robusta. This factor also probably has a big impact on why we prefer the taste of Arabica. * From a price perspective, green beans of Robusta is about half the price of Arabica green beans on the commodity market. * Robusta is easier to tend to on the farm, has a higher yield and is less sensitive to insects - the extra caffeine is a chemical defense for the coffee seed as the quantity in the Robusta is toxic to bugs. All of these factors help bring up the supply and lower the input costs for farmers to produce. With this more attractive price point, a lot of roasters back in the day would add Robusta to their blend in an attempt to reduce their costs and increase their profits. When coffee was initially sold in the 1900s the quality of coffee slowly and slowly deteriorated in an effort for companies to squeeze the most profit. Where you’ll find it: Nowadays, it’s not often you’ll find Robusta in a coffee blends or in coffee shop. If you’re drinking instant coffee? Well, that’s probably all Robusta… but you probably don’t care very much about taste. In your espresso blend? That’s a mixed bag. Literally. Oddly enough, Robusta is still widely used as part of espresso blends – specifically Italian style blends. It is said to help improve the crema. One thing to note is despite the association with Arabica of being higher quality, and Robusta as being lower quality, it’s not always the case. Top notch specialty Robusta coffee will usually taste as good as or better than low end Arabica. However, high end Robusta isn’t widely used or available. Rather, Robusta is usually used as a filler or cost reducer. * Robusta beans are much more circular, whereas Arabica are more oval. * Chlorogenic acid is a significant antioxidant and an insect deterrent. Robusta is 7-10% CGA and Arabica has 5.5-8% CGA.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 133, "passed_quality_check": "True", "flesch_reading_ease": 66.74000000000002, "entropy": 0.8661016790719904}
So whenever we want to shoot our flash before taking a photo. we have to charge it first. What is the point of the charging our flashes? Aren't their power directly supplied by the battery of our camera? Please answer for the built in flash on the 2000D and the traditional hot shoe Xenon flashes. Perhaps these hot shoe xenon flashes have their own batteries charged by the slow hot shoe port. Who knows?
null
[]
The peak power at work when a flash is being discharged is extreme. Example: a classic Metz 45CT (a large but still handheld unit) on full manual power delivers around 90 watt-seconds of electrical output to the flash tube in 1/300s. That means there are 27000 watts at work for a short time. A 27000 watt lightbulb (BTW, your flash is much brighter than that - more efficient!) would need the ampacity of around eight european household sockets (230V, fused at 13 or 16 amps) to operate, since it would draw around 120 ampere from them. At the voltage levels xenon flash tubes typically operate at, around 80 amperes will flow; if you wanted to pull that energy "live" from a 5-6V battery, you'd need to pull around 5000 amperes AND instantaneously convert them to around 80 amperes at high voltage. Batteries that could deliver 5000 amps - while not wasting most of the power as heat generated across their internal resistance - for a short duration and live certainly exist - you are looking at starter batteries for big lorries, which are rather inconvenient to lug around. Also, a 5000 ampere current pulse is quite a magnetic nuisance if there is anything either ferromagnetic or intended as an electrical conductor near the conductors used. Your average "big" speedlite, btw, will be around half the power described here (but might in some cases reach the same or higher peak currents in order to discharge even faster), an in-camera flash will be a fraction of these numbers - but still inconvenient to build any other way. If you need a short, massive current pulse, the best energy source available in engineering is a previously charged capacitor (metal-paper or electrolytic type, not dual-layer "supercap"). This energy storage device is large for its storage capacity if you compare it to a battery - but able to respond far quicker to high current demand, since a) there is no chemical energy conversion involved in its operation, b) the relevant current path only involves metallic, very conductive parts instead of ionic conductors (aka electrolytes. An electrolytic capacitor, btw, does use its electrolyte for chemical self-upkeep, not for chemical energy storage or electrical connectivity). Also, since the charge in a a capacitor is limited, it allows portioning total energy to what the flashlamp can safely take. This allows a flash in manual mode to just completely discharge the capacitor until it is nearly empty (when the remaining charge can only deliver voltage below the quench voltage of the flashlamp) without complex control circuitry - and at the same time gives you a safety fallback when working with dynamically controlled power levels (telecomputer or TTL mode), leaving no way for catastrophic circuit failure in combination with several kilowatts of constant power available turning into a massive safety hazard. A handheld-sized efficient electrical near point light source with 27000W input, driven constantly, would first severely damage your eyes and then self destroy violently (think of a welding arc - dangerously bright, and it melts metal).
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 335, "passed_quality_check": "True", "flesch_reading_ease": 90.5312445887446, "entropy": 2.3202351366574967}
What are some strategies to maintain morale and productivity after massive layoffs? I am not in a managerial role, just a lead role, and am asking for myself and my fellow employees.
null
[]
The situation you're describing is tough. Layoffs have a very real impact on both the individuals that are let go and those that remain. I'm sorry you're experiencing this. Here are some things to consider that may help you and your colleagues cope with the added stress and emotions following a layoff: * Acknowledge the layoff and the feelings of your colleagues. Avoiding the topic can extend negative feelings and disenfranchise those most impacted. You should find an opportunity to connect with your colleagues for an honest conversation about your feelings following the layoff. Perhaps reach out to hold a number of 1-on-1 conversations, or gather your team for an off-site lunch and prompt the discussion. * Acknowledge that everyone will be impacted differently. Some of your colleagues will feel totally okay and ready to get back to work. Others will feel anxious and worried in a way that prevents them from performing the same way they did before the layoff. There is no right or "professional" reaction to a layoff. Be open to the feelings and reactions of all of your colleagues equally. * Create practical solutions to new processes and responsibilities. If your team now has a greater workload, be a generator of solutions. Try out ideas for making processes in your team more efficient and predictable. * Create transparency about the state of the business and potential future staff changes. Layoffs are a clear indication of business trouble. Facilitate sharing facts about the state of the business and actively work to eliminate rumors. Additionally, layoffs will likely cause shifts in responsibility as roles are consolidated or reorganized. Make clear who has specific responsibilities both inside and outside of your team. Actively eliminate any sources of uncertainty and anxiety that you can. * Be a role model. Don't participate in gossip or complaining about the layoff. Don't disparage management or other colleagues in casual conversation. Be a model for professionalism and caring. * Maintain work standards and a caring meritocracy. A layoff isn't an excuse for allowing work quality to decline. Additionally, differences in productivity and quality between team members should be consistently and fairly addressed. If a team member is underperforming following the layoff, provide direct feedback and ask what you can do to help.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 151, "passed_quality_check": "True", "flesch_reading_ease": 71.62625000000001, "entropy": 1.1344014523892605}
Could you please clearly explain what is the difference between correlation and convolution that is done by a filter on an image? I mean in terms of signal processing definition I know that convolution describes the output of an LTI system, that is if an LTI system produces an output due to convolution with an input system then the output signal can be described as the result of convolution of the input signal and the impulse response of the LTI system. As for the correlation, it describes the similarities between to signals. But how does convolution and correlation effect on a image and how different are they in terms of effects? Thanks
null
[]
Convolution is correlation with the filter rotated 180 degrees. This makes no difference, if the filter is symmetric, like a Gaussian, or a Laplacian. But it makes a whole lot of difference, when the filter is not symmetric, like a derivative. The reason we need convolution is that it is associative, while correlation, in general, is not. To see why this is true, remember that convolution is multiplication in the frequency domain, which is obviously associative. On the other hand, correlation in the frequency domain is multiplication by the complex conjugate, which is not associative. The associativity of convolution is what allows you to "pre-convolve" the filters, so that you only need to convolve the image with a single filter. For example, let's say you have an image $f$, which you need to convolve with $g$ and then with $h$. $f * g * h = f * (g * h)$. That means you can convolve $g$ and $h$ first into a single filter, and then convolve $f$ with it. This is useful, if you need to convolve many images with $g$ and $h$. You can pre-compute $k = g * h$, and then reuse $k$ multple times. So if you are doing template matching, i. e. looking for a single template, correlation is sufficient. But if you need to use multiple filters in succession, and you need to perform this operation on multiple images, it makes sense to convolve the multiple filters into a single filter ahead of time.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 536, "passed_quality_check": "True", "flesch_reading_ease": 48.03907894736841, "entropy": 3.611396885280419}
24601 has developed into being an iconic part of both the Les Miserables book and musical. Was that number special to him, or was it simply a random number he chose (I doubt it)?
null
[]
Yes: it corresponds to the date of Hugo's conception. This is part of a pattern of similarities between the character of Jean Valjean and the author himself: both are of similar age, have similar habits and similarly austere lifestyles, and even share the same dreams. This is according to David Bellos's The Novel of the Century: The Extraordinary Adventure of Les Misérables, which concludes Part Three with: But Hugo put in a secret sign to remind himself and maybe those who knew him well that there were deep links of identity between the dutiful and persistent ex-convict and himself. Hugo was born on 26 February 1802, but because he was a slightly premature baby, he always believed he had been conceived on 24 June 1801. Valjean's prison number on his first incarceration at Toulon is 24601. -- p. 162 (emphasis mine) As a bonus, Valjean's second prisoner number was apparently also chosen for its special significance to Hugo: it refers to the month of his daughter Léopoldine's death. From footnote 46 in Kathryn Grossman's Figuring Transcendence in Les Miserables: Hugo's Romantic Sublime: Gaudon demonstrates that this image, which represents genius in one of the poet's earliest carnets (8 July 1820), is a sign of his &quot;deep identification&quot; with Valjean (Temps 547). As further evidence that the hero is an alter ego, Gohin cites the two numbers assigned to him in prison. The first, 24601, refers to the supposed date of Hugo's conception (24 June 1801), while the second, 9430, alludes to Léopoldine's death in September 1843 (&quot;Une histoire&quot; 47; see also 52). -- p. 165 (emphasis mine)
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 145, "passed_quality_check": "True", "flesch_reading_ease": 77.60941176470591, "entropy": 1.0937444279171775}
Why does Michael Crichton use US Customary measurements in hard sci-fi?
null
[]
Crichton used both imperial and metric, depending on the context. In the course of one paragraph in The Sphere, he managed to use both! > "Pacific coral grows two-and-a-half centimeters a year, and the object-- whatever it is-- is covered in about five meters of coral. That's a lot of coral. Of course, coral doesn't grow at a depth of a thousand feet, which means that the present shelf collapsed to a lower depth at some point in the past." When the character (Barnes, a Navy captain) is talking about precise measurements, he uses metric. When he's being more general, he uses imperial. The main character Norman (a psychologist, not exactly the most mathematically intensive field) uses imperial when thinking to himself. > He climbed up through the submarine and into a round steel cylinder approximately eight feet in diameter. But later, when the astrophysicist Ted is giving officialish measurements the titular sphere, he uses metric: > "This object is a burnished sphere approximately ten meters in a diameter, no solid, and composed of a dense metal alloy." So the short answer is that Crichton is an American writing American characters for a predominantly American audience. He uses imperial units for clarity, but metric when it would realistically be used.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 61, "passed_quality_check": "True", "flesch_reading_ease": 74.805, "entropy": 0.12431526895404621}
How can horns, most of which have only three buttons, play all their notes?
null
[]
Put as simply as possible, horns are tubes. Blowing in special ways makes certain notes sound from those tubes. By changing one's embouchure, those notes start at a fundamental, then gradually go up in harmonics. The first notes (in key C) would be C, G, C, E, G.Those notes are the ones we hear when a bugle is played - Reveille, Last Post, etc. Bugles only play the harmonic series of notes, and can't play the ones in between. Read on. On a trumpet, for starters, there are three valves. One drops any open note played by one semitone, another by two semitones, and the other by three semitones. So using a combination of valves, you can lower any open note by up to six semitones. Let's take the first G note. To get F♯, press the semitone valve. To get F, press the tone valve. To get E, press two valves to drop a tone and a half. (there's one valve alone that can do this). To play E♭, press the two valves that drop two tones. To get D, press the two valves to drop two and a half tones. And to get C♯, press all three. That's the more complicated bit, as between the open notes, there's more semitones than anywhere else further up in pitch. Notice that between G and the next C, there are only two tones. So at this point, not so many notes are needed, so the valve pressing is more simple. Next, between that C and the E, there's even fewer, so again, not so many valve changes are needed. Now, onto trombone. There are actually valve trombones, which work the same as trumpets, etc., but for the standard trombone, imagine those extra lengths of tube brought into play by pressing valves are now a single continuum of tubing, operated by the slide. At various places along that slide, there are all the notes found similarly to pressing valves. There's also loads of extra notes that are going to be out of tune!
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 62, "passed_quality_check": "True", "flesch_reading_ease": 101.98214285714286, "entropy": 0.41410501819004714}
I am a big fan of worldbuilding. A common sight in science fiction is that aliens pretend to be human (For example in Third Rock from the Sun). Obviously if the aliens are advanced enough to disguise themselves as another species, there are much easier, simpler and less expensive methods to destroy humanity, so why else would an advanced alien civilization waste time, energy and resources to disguise themselves as humans? What possible scientific, cultural or commercial use could such an expensive procedure have?
null
[]
Aliens are alien, without a common background their motives may be incomprehensible. If we assume that these aliens are Hollywood aliens (ie humans with odd-looking rubber bits stuck on their faces) then there are all of the reasons that humans from one culture spend time in another culture and try and learn to fit in: * Anthropology; studying how a different culture has developed to better understand the developmental processes that influenced your own. Iain M. Banks wrote Inversions (two anthropologists from the Culture investigating a Renaissance-era world) and The State of the Art (a Culture Contact team on Earth ca 1970) in this vein. * Tourism; experiencing a culture that is vastly different from your previous experiences. * Reality TV; Bear Grylls. * Method Acting; preparing for a role in their own entertainment channels that involves playing the part of a member of an Information Age society. * Challenge; because they can. * Hermitage; there are people here on Earth who prefer to step away from the rat race and all the newfangled gadgets and live as their ancestors did, but usually not all the way back to stone tools. Selecting a developing world and fitting in gives them access to a level of technology between their home culture and being trapped on a desert island. * Camouflage; they are being sought by members of their home culture and it's easier to hide and survive amongst us than in their own milieu. There are a lot of examples of this in fiction already: For Richer or Poorer, Men in Black II and it's analogous to fleeing the law and retiring to a country without an extradition treaty. * Crash Landing, or a failure that prevents them from going home; if they came on an FTL ship that doesn't have FTL communications they may be waiting a long time for spare parts or updated navigational maps, or if they brought Gilligan who proceeded to ruin all of their plans to return home, or they may have arrived on a slower-than-light colony ship and would prefer to stay here and fit in amongst us rather than try and find another prospective colony. * Uplift; meddling to steer us onto the "right" path of development and prevent us from immolating ourselves (or vice versa if your species doesn't like the competition).
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 435, "passed_quality_check": "True", "flesch_reading_ease": 53.58428571428573, "entropy": 2.4098502929052312}
I've taken a look at the list of surveys taken on scala-lang.org and noticed a curious question: "Can you name all the uses of “_”?". Can you? If yes, please do so here. Explanatory examples are appreciated.
null
[]
The following is an explanation of the uses of the underscore is Scala _ [underscore] magic. Examples: ``` def matchTest(x: Int): String = x match { case 1 => "one" case 2 => "two" case _ => "anything other than one and two" } expr match { case List(1,_,_) => " a list with three element and the first element is 1" case List(_*) => " a list with zero or more elements " case Map[_,_] => " matches a map with any key type and any value type " case _ => } List(1,2,3,4,5).foreach(print(_)) // Doing the same without underscore: List(1,2,3,4,5).foreach( a => print(a)) ``` In Scala, ```_``` acts similar to ```*``` in Java while importing packages. ```// Imports all the classes in the package matching import scala.util.matching._ // Imports all the members of the object Fun (static import in Java). import com.test.Fun._ // Imports all the members of the object Fun but renames Foo to Bar import com.test.Fun.{ Foo => Bar , _ } // Imports all the members except Foo. To exclude a member rename it to _ import com.test.Fun.{ Foo => _ , _ } ``` In Scala, a getter and setter will be implicitly defined for all non-private vars in a object. The getter name is same as the variable name and ```_=``` is added for the setter name. ```class Test { private var a = 0 def age = a def age_=(n:Int) = { require(n>0) a = n } } ``` Usage: ```val t = new Test t.age = 5 println(t.age) ``` If you try to assign a function to a new variable, the function will be invoked and the result will be assigned to the variable. This confusion occurs due to the optional braces for method invocation. We should use _ after the function name to assign it to another variable. ```class Test { def fun = { // Some code } val funLike = fun _ } ```
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 171, "passed_quality_check": "True", "flesch_reading_ease": 84.90000000000003, "entropy": 1.6067091443372494}
My university usually asks that we book a flight via a travel agent, but the prices he gives me are about $50 higher than the prices I can get by online booking in the flight company's website. Why would a company want me to book a flight via a travel agent if it is more expensive?
null
[]
There are several reasons why such internal policies exist: * Your institution may get a discount on certain services of the travel agent if it buys enough from the agent * By having a contract with a reasonably-priced travel agent, they make sure that no employee books the flight with a very pricey agent or with a travel agent that happens to be a relative of the traveller * The travel agency offers easy methods to verify expense information and thus may lower the workload of your local administrative personnel. This especially holds if the payment is routed directly from the institution to the travel agent, which also makes sure that the flyer does not get credit card bonus points for the booking. * Your institution may have an agreement with the travel agent that they manually check if members of your institution are not unnecessarily booking expensive booking classes (in order to get more airline bonus miles) * Some insurances that your institution bought may only work if the ticket is bought directly from the institution and not by the flyer, and they elected the agent to handle such bookings. Which of these reasons is the one why this policy exists can only be answered by the responsible employees of your institution.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 227, "passed_quality_check": "False", "flesch_reading_ease": 76.75517241379312, "entropy": 1.6902806188654795}
Layman's explanation of encryption backdoors
null
[]
There are two somewhat orthogonal concepts in backdooring encryption algorithms: * The backdoor can be explicit or implicit. An explicit backdoor is one that everybody knows it is there. An implicit backdoor strives at remaining undetected by the algorithm owners. Of course, when there is an explicit backdoor, people tend to avoid the algorithm altogether, so explicit backdoors may hope to work only in the presence of a legal framework that forces implementers to use the backdoored system. An example of an explicit backdoor is the Clipper chip (which was ultimately abandoned). The backdoor is not really in the algorithm, more in the assembly of algorithms into a protocol, and technically it was an automatic key escrowing method. For an implicit backdoor, see the Dual EC DRBG as a famous example: it worked only as long as nobody was aware that it was backdoored. * The backdoor's security may be quantifiable, or not. In the case of Dual EC DRBG, the mechanism uses well-trodden mathematical paths: the NSA knew that exploiting the backdoor required knowledge of an internal secret key, based on discrete logarithm (on elliptic curves). A non-quantifiable security is what happens when you try to push, for instance, a voluntarily flawed algorithm, or one for which you know of a cryptanalytic method that you did not publish. This is a very dangerous game for a spy agency, because you cannot really know whether third parties could find the flaw or not. Such backdooring tends to backfire in the long term. Interestingly, the NSA tends not to use non-quantifiable backdoors. A good example is DES. At the time it was designed, the NSA believed that it could tackle an upfront 256 exhaustive search, and that nobody else (in particular the Soviets) had the technology and budget for that. The NSA also knew of a novel cryptanalytic method (differential cryptanalysis). So when the NSA intervened in the design of DES, it insisted on shortening the key from 64 to 56 bits (that's addition of a quantifiable backdoor, and it was rather obvious, so quasi-explicit), and also on strengthening the design against differential cryptanalysis. This is a good example about how NSA consciously refrained from a non-quantifiable backdoor. There is only one thing that spy agencies fear more than not being able to spy: it is the idea that other competing spy agencies may also spy. So a real, good backdoor is one that uses maths to offer quantifiable security against unauthorized usage of the backdoor. It is extremely difficult to have quantifiable security without making the backdoor explicit. The "best in class" in that area is Dual EC DRBG, and even before the Snowden business, cryptographers were already finding it weird and strongly suspected foul play (see the analyses back in 2007, 6 years before Snowden).
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 40, "passed_quality_check": "False", "flesch_reading_ease": -1.2799999999999727, "entropy": 0.09842774717454639}
I have a page where a scroll bar containing table rows with divs in them is dynamically generated from the database. Each table row acts like a link, sort of like you'd see on a YouTube playlist next to the video player. When a user visits the page, the option they are on is supposed to go to the top of the scrolling div. This functionality is working. The issue is that it goes just a tad too far. Like the option they are on is about 10px too high. So, the page is visited, the url is used to identify which option was selected and then scrolls that option to the top of the scrolling div. Note: This is not the scroll bar for the window, it is a div with a scrollbar. I am using this code to make it move the selected option to the top of the div: ```var pathArray = window.location.pathname.split( '/' ); var el = document.getElementById(pathArray[5]); el.scrollIntoView(true); ``` It moves it to the top of the div but about 10 pixels too far up. how to fix that?
null
[]
CSS ```scroll-margin``` and ```scroll-padding``` You might want to have a look at new CSS properties ```scroll-padding``` and ```scroll-margin```. You can use ```scroll-padding``` for the scrolling container (```html``` in this case), and ```scroll-margin``` for the element within the container. For your example, you would want to add ```scroll-margin-top``` for the element that you want to scroll into view, like this: ```.example { scroll-margin-top: 10px; } ``` This affects ```scrollIntoView``` code, like this code: ```const el = document.querySelector(&quot;.example&quot;); el.scrollIntoView({block: &quot;start&quot;, behavior: &quot;smooth&quot;}); ``` This will cause the viewport to scroll to align the top border of the viewport with the top border of the element, but with 10px of additional space. In other words, these properties of the element are taken into account: * ```padding-top``` * ```border-top``` * ```scroll-margin-top``` * (and not ```margin-top```) In addition, if the ```html``` element has ```scroll-padding-top``` set, then that is taken into account too. If you're using a framework like Vue, you might want to make sure that all changes to the DOM are finished before running `scrollIntoView` by using something like `Vue.nextTick(() => el.scrollIntoView())`
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 795, "passed_quality_check": "False", "flesch_reading_ease": 81.61788461538464, "entropy": 7.613550652296505}
Suppose I have the geographic coordinates of &quot;Saratoga, California, USA&quot; as ```Latitude: 37°15.8298′ N Longitude: 122° 1.3806′ W ``` I know from here that in the case of latitude ```1° ≈ 69 miles``` and that longitude varies: ```1° longitude = cosine (latitude) * length of degree (miles) at Equator. ``` How many miles is 1° longitude at ```longitude: 122°1.3806′ W```?
null
[]
It doesn't matter at what longitude you are. What matters is what latitude you are. Length of ```1 degree of Longitude``` = ```cosine (latitude in radians) * length of degree (miles) at equator```. Convert your latitude into decimal degrees ~ 37.26383 Convert your decimal degrees into radians ~ 0.65038 Take the cosine of the value in radians ~ 0.79585 1 degree of Longitude = ~0.79585 * 69.172 = ~ 55.051 miles More useful information from the about.com website: Degrees of latitude are parallel so the distance between each degree remains almost constant but since degrees of longitude are farthest apart at the equator and converge at the poles, their distance varies greatly. Each degree of latitude is approximately 69 miles (111 kilometers) apart. The range varies (due to the earth's slightly ellipsoid shape) from 68.703 miles (110.567 km) at the equator to 69.407 (111.699 km) at the poles. This is convenient because each minute (1/60th of a degree) is approximately one [nautical] mile. A degree of longitude is widest at the equator at 69.172 miles (111.321) and gradually shrinks to zero at the poles. At 40° north or south the distance between a degree of longitude is 53 miles (85 km) Note that the original site (about.com) erroneously omitted the &quot;nautical&quot; qualifier.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 328, "passed_quality_check": "False", "flesch_reading_ease": 78.9955463917526, "entropy": 1.655650965642975}
I have read numerous times that some Norse warriors, upon death, would go in Fólkvangr, while some others would go to Valhalla. How was it decided which warrior would go to which place? Why did the need to have many "paradises" (whatever you many call it) exist? Citing Wikipedia: > In Norse mythology, Fólkvangr (Old Norse "field of the host" or "people-field" or "army-field") is a meadow or field ruled over by the goddess Freyja where half of those that die in combat go upon death, while the other half go to the god Odin in Valhalla.
null
[]
The Norse mythological texts record three primary places where the dead were perceived to go: Helheim (Old Norse Helheimr, “the home of the goddess Hel“), Valhalla (Old Norse Valhöll, “the hall of the fallen”), and Folkvang (Old Norse Fólkvangr, “the field of the people” or “the field of warriors”). But they're indistinguishable and don't have any major differences between them. Valhalla is presided over by Odin, and to gain entrance to it, one must be chosen by him and his valkyries, the “choosers of the fallen.” Similarily, entrance to Folkvang is dependent upon being selected by Freya. Valhalla is often depicted as a realm where distinguished warriors engage in a continuous battle, and just such a place is described, in important early sources, as being located beneath the ground – and, intriguingly, without the name “Valhalla” or a cognate anywhere in the account. source: Ellis, Hilda Roderick. 1968. The Road to Hel: A Study of the Conception of the Dead in Old Norse Literature. p. 85-86. * Folkvang is the ninth, and there Freyia arranges the choice of seats in the hall; half the slain she chooses every day, and half Odin owns. source: 1996 Carolyne Larrington in The Poetic Edda “Grimnir’s Sayings” The only difference that is pointed out, is in the way that the dead are chosen to stay. Odin chooses for Valhalla, while Freya chooses for Folkvang. Coming to the second part of the question: And why did the need to have many "paradises" (whatever you many call it) exist? Hel is a place where all humans have to go after their death: “For there is a time when every man shall journey hence to Hel." Fáfnismál 10 So before the dead finally reach Hel, Odin and Freyja select the ones who are worthy of living in Valhalla and Folkvang. Therefore, * Valhalla receives distinguished warriors. * Folkvangr receives the rest of the warriors. * Hel receives the rest of the dead. source: Norse-Mythology.org
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 446, "passed_quality_check": "True", "flesch_reading_ease": 80.79140594059409, "entropy": 3.3094600961283764}
I noticed that there is a binary executable ```/bin/echo``` on my Ubuntu MATE 17.04 system. I thought, that's odd, because ```$ type echo echo is a shell builtin``` Cursory testing suggests that ```/bin/echo``` does the same sort of thing as the Bash builtin ```echo```: ```$ /bin/echo foo foo $ /bin/echo $USER zanna ``` So, why is there another version of ```echo``` separate from the Bash program, and why or when would I want to use it?
null
[]
If you open up a ```bash``` prompt and type in an ```echo``` command, that uses a shell builtin rather than running ```/bin/echo```. The reasons it is still important for ```/bin/echo``` to exist are: * You're not always using a shell. Under a variety of circumstances, you run an executable directly and not through a shell. * At least in theory, some shells don't have an ```echo``` builtin. This is not actually required. To expand on #1, suppose you wanted to move all the regular files whose names started with ```abc``` anywhere in ```src``` to ```dest```. There are several ways to do that but one of them is: ```find src -name 'abc*' -type f -exec mv -nv {} dest/ \; ``` But suppose, rather than just running that, you want to see every command that will be run first. Well, then you can prepend ```echo``` to the command, just as you might in other contexts: ```find src -name 'abc*' -type f -exec echo mv -nv {} dest/ \; ``` But ```find``` doesn't use a shell. That runs ```/bin/echo```. Besides ```find``` with ```-exec``` or ```-execdir```, the ```/bin/echo``` executable will be called by other programs that themselves run programs but not through a shell. This happens with the ```xargs``` command (which is related to ```find```), as well as in a number of other contexts, such as the ```Exec=``` line of a ```.desktop``` file. Another example is when you run ```sudo echo```, which can be handy for testing if ```sudo``` is working. Similarly, some shells have a ```printf``` builtin but ```/usr/bin/printf``` also exists. A less common possible reason you might deliberately use ```/bin/echo``` is if you were relying on the differences between it and the ```echo``` command provided by your shell. ```man echo``` documents ```/bin/echo```; ```help echo``` in ```bash``` documents the ```bash``` builtin. ```echo``` is not very portable, because different implementations--both across operating systems and across shells on the same operating system--support different options (e.g., ```-e```) and differ in their treatment of backslashes. Of course, it's better to avoid relying on such details, and use ```printf``` instead, which is far more portable. In ```bash```, you can make the ```type``` builtin show ```/bin/echo``` as well--assuming ```/bin``` is in your ```$PATH``` as it always should be--by passing it the ```-a``` flag: ```$ type -a echo echo is a shell builtin echo is /bin/echo ```
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 375, "passed_quality_check": "False", "flesch_reading_ease": 68.19071428571431, "entropy": 2.4364645513436285}
what's the difference between JavaScript objects, classes and functions?
null
[]
As you must already be aware by now there are no classes in JavaScript. Instead functions in JavaScript may be made to behave like constructors by preceding a function call with the ```new``` keyword. This is known as the constructor pattern. In JavaScript everything is an object except for the primitive data types (boolean, number and string), and ```undefined```. On the other hand ```null``` is actually an object reference even though you may at first believe otherwise. This is the reason ```typeof null``` returns ```&quot;object&quot;```. Functions in JavaScript are similar to functables in Lua (i.e. they are callable objects). Hence a function can be used in place of an object. Similarly arrays are also objects in JavaScript. On the other hand objects can be thought of as associative arrays. The most important point however is that there are no classes in JavaScript because JavaScript is a prototypal object oriented language. This means that objects in JavaScript directly inherit from other objects. Hence we don't need classes. All we need is a way to create and extend objects.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 64, "passed_quality_check": "True", "flesch_reading_ease": 66.10000000000002, "entropy": 0.3699839835698698}
In most introductory algorithm classes, notations like $O$ (Big O) and $\Theta$ are introduced, and a student would typically learn to use one of these to find the time complexity. However, there are other notations, such as $o$, $\Omega$ and $\omega$. Are there any specific scenarios where one notation would be preferable to another?
null
[]
You are referring to the Landau notation. They are not different symbols for the same thing but have entirely different meanings. Which one is "preferable" depends entirely on the desired statement. $f \in \cal{O}(g)$ means that $f$ grows at most as fast as $g$, asymptotically and up to a constant factor; think of it as a $\leq$. $f \in o(g)$ is the stricter form, i.e. $ $f \in \Omega(g)$ has the symmetric meaning: $f$ grows at least as fast as $g$. $\omega$ is its stricter cousin. You can see that $f \in \Omega(g)$ is equivalent to $g \in \cal{O}(f)$. $f \in \Theta(g)$ means that $f$ grows about as fast as $g$; formally $f \in \cal{O}(g) \cap \Omega(g)$. $f \sim g$ (asymptotic equality) is its stronger form. We often mean $\Theta$ when we use $\cal{O}$. Note how $\cal{O}(g)$ and its siblings are function classes. It is important to be very aware of this and their precise definitions -- which can differ depending on who is talking -- when doing "arithmetics" with them. When proving things, take care to work with your precise definition. There are many definitions for Landau symbols around (all with the same basic intuition), some of which are equivalent on some sets on functions but not on others. If you are interested in using Landau notation in a rigorous and sound manner, you may be interested in a work by Rutanen et al.. They formulate necessary and sufficient criteria for asymptotic notation as we use them in algorithmics, show that the common definition fails to meet them and provide a (the, in fact) workable definition. * A general definition of the O-notation for algorithm analysis by K. Rutanen et al. (2015)
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 284, "passed_quality_check": "True", "flesch_reading_ease": 50.895000000000024, "entropy": 1.7794130349427064}
Why is Gaia operating around Earth orbit? Why not send it to Neptune's orbit?
null
[]
Well, you thought about the spatial aspect of a parallax measurement, but not about the temporal one. Gaia's intention is to measure 3D positions as well as 3D velocities. For the distance, you need accurate parallactic measurement, which come in with your orbital period. For a typical Gaia-star with several measurement per year, you'll get 5 values of the parallax after 5 years of time, which you then average. If you'd send Gaia towards Neptune (besides the fact that no one has ever sent an orbiter, to say nothing of a L2 mission that far out) that has a period of 168 years, then after 5 years you'd get... 5/168 th of one paralactic measurement. It simply couldn't achieve its science goals if put around the L2 behind Neptune. Also no one on this planet has any experience in putting something into a outer system L2 point. This is different than putting it into Earth's L2, because reaching the L2 around one of the giants has vast and very precise $\Delta v$ requirements. This would be a massive technological leap, and things don't work that way in space. Small, incremental technological steps are required in an anyways unfriendly environment, to make sure everything works properly and no millions of dollars have been wasted. Compare that to Gaia's predecessor, the Hipparcos satellite, which was parked in geostationary orbit. Now you could still say, why not use Jupiter hypothetically anyways. Well, the orbital period there is still 11 years, and Jupiter's L2 still suffers from the intense radiation environment that is provided by Jupiter's magnetosphere. This would lead to rapid degradation of the CCDs used for scanning across the sky.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 64, "passed_quality_check": "True", "flesch_reading_ease": 78.87285714285717, "entropy": 0.32781912202177776}
I have a string representing a unix timestamp (i.e. &quot;1284101485&quot;) in Python, and I'd like to convert it to a readable date. When I use ```time.strftime```, I get a ```TypeError```: ```>>>import time >>>print time.strftime(&quot;%B %d %Y&quot;, &quot;1284101485&quot;) Traceback (most recent call last): File &quot;&quot;, line 1, in TypeError: argument must be 9-item sequence, not str ```
null
[]
There are two parts here: * Convert the unix timestamp ("seconds since epoch") to the local time * Display the local time in the desired format. A portable way to get the local time that works even if the local time zone had a different utc offset in the past and python has no access to the tz database is to use a ```pytz``` timezone: ```#!/usr/bin/env python from datetime import datetime import tzlocal # $ pip install tzlocal unix_timestamp = float("1284101485") local_timezone = tzlocal.get_localzone() # get pytz timezone local_time = datetime.fromtimestamp(unix_timestamp, local_timezone) ``` To display it, you could use any time format that is supported by your system e.g.: ```print(local_time.strftime("%Y-%m-%d %H:%M:%S.%f%z (%Z)")) print(local_time.strftime("%B %d %Y")) # print date in your format ``` If you do not need a local time, to get a readable UTC time instead: ```utc_time = datetime.utcfromtimestamp(unix_timestamp) print(utc_time.strftime("%Y-%m-%d %H:%M:%S.%f+00:00 (UTC)")) ``` If you don't care about the timezone issues that might affect what date is returned or if python has access to the tz database on your system: ```local_time = datetime.fromtimestamp(unix_timestamp) print(local_time.strftime("%Y-%m-%d %H:%M:%S.%f")) ``` On Python 3, you could get a timezone-aware datetime using only stdlib (the UTC offset may be wrong if python has no access to the tz database on your system e.g., on Windows): ```#!/usr/bin/env python3 from datetime import datetime, timezone utc_time = datetime.fromtimestamp(unix_timestamp, timezone.utc) local_time = utc_time.astimezone() print(local_time.strftime("%Y-%m-%d %H:%M:%S.%f%z (%Z)")) ``` Functions from the ```time``` module are thin wrappers around the corresponding C API and therefore they may be less portable than the corresponding ```datetime``` methods otherwise you could use them too: ```#!/usr/bin/env python import time unix_timestamp = int("1284101485") utc_time = time.gmtime(unix_timestamp) local_time = time.localtime(unix_timestamp) print(time.strftime("%Y-%m-%d %H:%M:%S", local_time)) print(time.strftime("%Y-%m-%d %H:%M:%S+00:00 (UTC)", utc_time)) ```
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 350, "passed_quality_check": "False", "flesch_reading_ease": 89.03746511627908, "entropy": 2.183913493764466}
In Django, the convention is to put all of your static files (i.e css, js) specific to your app into a folder called static. So the structure would look like this: ```mysite/ manage.py mysite/ --> (settings.py, etc) myapp/ --> (models.py, views.py, etc) static/ ``` In ```mysite/settings.py``` I have: ```STATIC_ROOT = 'staticfiles' ``` So when I run the command: ```python manage.py collectstatic ``` It creates a folder called ```staticfiles``` at the root level (so same directory as ```myapp/```) What's the point of this? Isn't it just creating a copy of all my static files?
null
[]
## Collect static files from multiple apps into a single path A single Django project may use several apps, so while there you only have one ```myapp```, it may actually be ```myapp1```, ```myapp2```, etc By copying them from inside the individual apps into a single folder, you can point your frontend web server (e.g. nginx) to that single folder ```STATIC_ROOT``` and serve static files from a single location, rather than configure your web server to serve static files from multiple paths. ## Persistent URLs with ManifestStaticFilesStorage A note about the MD5 hash being appended to the filename for versioning: It's not part of the default behavior of ```collectstatic```, as ```settings.STATICFILES_STORAGE``` defaults to ```StaticFilesStorage``` (which doesn't do that) The MD5 hash will kick in e.g. if you set it to use ```ManifestStaticFilesStorage```, which adds that behavior. > The purpose of this storage is to keep serving the old files in case some pages still refer to those files, e.g. because they are cached by you or a 3rd party proxy server. Additionally, it’s very helpful if you want to apply far future Expires headers to the deployed files to speed up the load time for subsequent page visits.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 502, "passed_quality_check": "False", "flesch_reading_ease": 70.81200000000003, "entropy": 2.9886761400049604}
I am used to thinking of finite-differences as a special case of finite-elements, on a very constrained grid. What are criteria to choose between finite-differences and finite-elements
null
[]
It is possible to write most specific finite difference methods as Petrov-Galerkin finite element methods with some choice of local reconstruction and quadrature, and most finite element methods can also be shown to be algebraically equivalent to some finite difference method. Therefore, we should choose a method based on which analysis framework we want to use, which terminology we like, which system for extensibility we like, and how we would like to structure software. The following generalizations hold true in the vast majority of variations in practical use, but many points can be circumvented. Finite Difference Pros * efficient quadrature-free implementation * aspect ratio independence and local conservation for certain schemes (e.g. MAC for incompressible flow) * robust nonlinear methods for transport (e.g. ENO/WENO) * M-matrix for some problems * discrete maximum principle for some problems (e.g. mimetic finite differences) * diagonal (usually identity) mass matrix * inexpensive nodal residual permits efficient nonlinear multigrid (FAS) * cell-wise Vanka smoothers give efficient matrix-free smoothers for incompressible flow Cons * more difficult to implement "physics" * staggered grids are sometimes quite technical * higher than second order on unstructured grids is difficult * no Galerkin orthogonality, so convergence may be more difficult to prove * not a Galerkin method, so discretization and adjoints do not commute (relevant to optimization and inverse problems) * self-adjoint continuum problems often yield non-symmetric matrices * solution is only defined pointwise, so reconstruction at arbitrary locations is not uniquely defined * boundary conditions tend to be complicated to implement * discontinuous coefficients usually make the methods first order * stencil grows if physics includes "cross terms" Finite Element Pros * Galerkin orthogonality (discrete solution to coercive problems is within a constant of the best solution in the space) * simple geometric flexibility * discontinuous Galerkin offers robust transport algorithm, arbitrary order on unstructured grids * cellwise entropy inequality guaranteeing $L^2$ stability holds independent of mesh, dimension, order of accuracy, and presence of discontinuous solutions, without needing nonlinear limiters * easy of implementing boundary conditions * can choose conservation statement by choosing test space * discretization and adjoints commute (for Galerkin methods) * elegant foundation in functional analysis * at high order, local kernels can exploit tensor product structure that is missing with FD * Lobatto quadrature can make methods energy-conserving (assuming a symplectic time integrator) * high order accuracy even with discontinuous coefficients, as long as you can align to boundaries * discontinuous coefficients inside elements can be accommodated with XFEM * easy to handle multiple inf-sup conditions Cons * many elements have trouble at high aspect ratio * continuous FEM has trouble with transport (SUPG is diffusive and oscillatory) * DG usually has more degrees of freedom for same accuracy (though HDG is much better) * continuous FEM does not provide cheap nodal problems, so nonlinear smoothers have much poorer constants * usually more nonzeros in assembled matrices * have to choose between consistent mass matrix (some nice properties, but has full inverse, thus requiring an implicit solve per time step) and lumped mass matrix.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 158, "passed_quality_check": "True", "flesch_reading_ease": 65.56701612903228, "entropy": 1.0429511267872542}
How important is multithreading in the current software industry?
null
[]
It is extremely important. What is more important though is to understand that multithreading is just one way to solve the asynchrony problem. The technical environment in which many people are now writing software differs from the historical software development environment (of monolithic applications performing batch computations) in two key ways: * Many-core machines are now common. We can no longer expect clock speeds or transistor densities to increase by orders of magnitude. The price of computation will continue to fall, but it will fall because of lots of parallelism. We're going to have to find a way to take advantage of that power. * Computers are now heavily networked and modern applications rely upon being able to fetch rich information from a variety of sources. From a computational standpoint, these two factors essentially boil down to the same core idea: information increasingly will be available in an asynchronous fashion. Whether the information you need is being computed on another chip in your machine or on a chip halfway around the world doesn't really matter. Either way, your processor is sitting there burning billions of cycles a second waiting for information when it could be doing useful work. So what matters now, and what will matter even more in the future, is not multithreading per se, but rather, dealing with asynchrony. Multithreading is just one way to do that -- a complicated, error-prone way that is only going to get more complicated and more error-prone as weak-memory-model chips become more widely used. The challenge for tools vendors is to come up with some way better than multithreading for our customers to deal with the asynchronous infrastructure they'll be using in the future.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 57, "passed_quality_check": "True", "flesch_reading_ease": 28.50000000000003, "entropy": 0.23947602591418496}
Is it true that the price of diamonds is based on a monopoly? And who actually runs/owns this supposed monopoly? Is this likely to affect diamond prices if I am interested in purchasing?
null
[]
Yes, the De Beers Group of Companies is a diamond cartel that had complete control of the diamond market for most of the 20th century. They still control a sizable portion of the market and their effort at marketing (particularly with the slogan "A Diamond is Forever") has done much to inflate the market for diamonds in our society. The intrinsic value of diamonds is much lower than the market prices currently reflect, but with the caveat that there is a rarity factor which does drive up the price of larger diamonds. The larger the diamond, the more likely it is to have flaws, so when it comes to diamonds that are 5 carats or greater, you are not as likely to see a new supply of diamonds disrupt the prices of those larger stones. Some other ways that high end jewelers and suppliers are differentiating themselves is by patenting a specific cut that they design. This is another barrier to entry that works to create some artificial price inflation. One common example is the Lucida cut sometimes referred to as the Tiffany cut. Diamonds can also be manufactured. The same carbon structure can be grown in a lab. These stones have the same carbon structure as natural diamonds but without the flaws and visible impurities. Most manufactured diamonds are used industrially, but processes have improved sufficiently to allow for gemstone quality synthetic diamonds. They sell at a decent discount, so that might be an option to consider if you want a substitute. In the years to come, you can expect prices for synthetic diamonds to continue to decrease which will probably put some further downward pressure on jewelers' prices.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 154, "passed_quality_check": "True", "flesch_reading_ease": 80.87284313725492, "entropy": 0.848636458622753}
Normal filesystem images can be easily mounted: ```mount system.img /mnt ``` Examined, and modified. But when I try this with a Raspberry Pi system image (e.g. raspbian), I get: ```mount: unknown filesystem type '(null)' ``` And no matter what I try with ```-t```, it won't work. How can I mount this image?
null
[]
You can't mount the image as a whole because it actually contains two partitions and a boot sector. However, you can mount the individual partitions in the image if you know their offset inside the file. To find them, examine the image as a block device with ```fdisk -l whatever.img```. The output should include a table like this: ```Device Boot Start End Blocks Id System whatever.img1 8192 122879 57344 c W95 FAT32 (LBA) whatever.img2 122880 5785599 2831360 83 Linux ``` These are the two partitions. The first one is labelled "FAT32", and the other one "Linux". Above this table, there's some other information about the device as a whole, including: ```Units: sectors of 1 * 512 = 512 bytes ``` We can find the offset in bytes by multiplying this unit size by the ```Start``` block of the partition: * 1st partition 512 * 8192 = 4194304 * 2nd partition 512 * 122880 = 62914560 These can be used with the ```offset``` option of the ```mount``` command. We also have a clue about the type of each partition from ```fdisk```. So, presuming we have directories ```/mnt/img/one``` and ```/mnt/img/two``` available as mount points: ```mount -v -o offset=4194304 -t vfat whatever.img /mnt/img/one mount -v -o offset=62914560 -t ext4 whatever.img /mnt/img/two ``` If you get an "overlapping loop" error here, your version of ```mount``` requires you to specify the size as well as the offset of the first partition. Unmount that, and use the number of blocks (57344) * 512 (= 29360128): ```mount -v -o offset=4194304,sizelimit=29360128 \ -t vfat whatever.img /mnt/img/one ``` The second partition doesn't need a sizelimit since there's nothing after it in the image. You can now access the two partitions. If you do not intend to change anything in them, use the ```-r``` (read-only) switch too. If you do change anything, those changes will be included in the ```.img``` file. Note that the first partition is probably mounted on ```/boot``` in the second partition when the system is running.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 262, "passed_quality_check": "False", "flesch_reading_ease": 74.25850877192984, "entropy": 1.7876253053134001}
How does immersion passively help with learning a language?
null
[]
There are a few reasons why immersion helps you learn a language without you actively trying: * You encounter the language more often. When you are immersed in a language, you don't go to class and do homework for a few hours a week, but rather use the language the entire day. You depend on the language to survive—to buy groceries, to talk to employers and customers, to ask for directions, etc. Being forced to use the language means you learn it even when you're not actively trying to. It becomes a way of life. * You learn the language in more than one way. Classroom learning focuses on specific activities at a time and generally is oriented around learning vocabulary and grammar. Immersion implicitly forces you to learn vocabulary (if you don't know a word, you simply can't communicate) and grammar (people will probably correct you if you say something incorrectly). You will learn these things whether you're trying to or not. In addition you will learn how to carry on a conversation, both by listening and participating in your own. This is something that simple exercises can very rarely accomplish. * You begin to think in the language. If you use the language enough you'll start to get good enough at it that you won't have time to think in your native language and translate. Immersion spurs this on because native speakers talk relatively quickly, signs you read may pass by in a moment, and you may quickly need to say "excuse me" or ask for help. Because you can't afford long delays, you'll begin to skip the translation step. This helps you use the language as a native speaker would. * Culture reinforces language learning. When you are immersed in a language, you often encounter the culture and traditions associated with speakers of that language. Your brain will retain the new knowledge and experiences you acquire better because it is different than what you are used to, and if the language is part of that cultural experience, you will remember it better. For example, you might remember an idiom or a joke that only exists in the language you are learning. This will expand your ability to communicate in that language.
{ "type": null, "score": null, "agent": null }
null
{"n_characters": 51, "passed_quality_check": "True", "flesch_reading_ease": 66.10000000000002, "entropy": 0.15456609234443755}

Dataset Card for text-descriptives-metadata

This dataset has been created with Argilla.

As shown in the sections below, this dataset can be loaded into Argilla as explained in Load with Argilla, or used directly with the datasets library in Load with datasets.

Dataset Summary

This dataset contains:

  • A dataset configuration file conforming to the Argilla dataset format named argilla.yaml. This configuration file will be used to configure the dataset when using the FeedbackDataset.from_huggingface method in Argilla.

  • Dataset records in a format compatible with HuggingFace datasets. These records will be loaded automatically when using FeedbackDataset.from_huggingface and can be loaded independently using the datasets library via load_dataset.

  • The annotation guidelines that have been used for building and curating the dataset, if they've been defined in Argilla.

Load with Argilla

To load with Argilla, you'll just need to install Argilla as pip install argilla --upgrade and then use the following code:

import argilla as rg

ds = rg.FeedbackDataset.from_huggingface("nataliaElv/text-descriptives-metadata")

Load with datasets

To load this dataset with datasets, you'll just need to install datasets as pip install datasets --upgrade and then use the following code:

from datasets import load_dataset

ds = load_dataset("nataliaElv/text-descriptives-metadata")

Supported Tasks and Leaderboards

This dataset can contain multiple fields, questions and responses so it can be used for different NLP tasks, depending on the configuration. The dataset structure is described in the Dataset Structure section.

There are no leaderboards associated with this dataset.

Languages

[More Information Needed]

Dataset Structure

Data in Argilla

The dataset is created in Argilla with: fields, questions, suggestions, metadata, and guidelines.

The fields are the dataset records themselves, for the moment just text fields are supported. These are the ones that will be used to provide responses to the questions.

Field Name Title Type Required Markdown
prompt Prompt FieldTypes.text True True
context Context FieldTypes.text False True

The questions are the questions that will be asked to the annotators. They can be of different types, such as rating, text, label_selection, multi_label_selection, or ranking.

Question Name Title Type Required Description Values/Labels
response Response QuestionTypes.text True N/A N/A

The suggestions are human or machine generated recommendations for each question to assist the annotator during the annotation process, so those are always linked to the existing questions, and named appending "-suggestion" and "-suggestion-metadata" to those, containing the value/s of the suggestion and its metadata, respectively. So on, the possible values are the same as in the table above, but the column name is appended with "-suggestion" and the metadata is appended with "-suggestion-metadata".

✨ NEW The metadata is a dictionary that can be used to provide additional information about the dataset record. This can be useful to provide additional context to the annotators, or to provide additional information about the dataset record itself. For example, you can use this to provide a link to the original source of the dataset record, or to provide additional information about the dataset record itself, such as the author, the date, or the source. The metadata is always optional, and can be potentially linked to the metadata_properties defined in the dataset configuration file in argilla.yaml.

The guidelines, are optional as well, and are just a plain string that can be used to provide instructions to the annotators. Find those in the annotation guidelines section.

Data Instances

An example of a dataset instance in Argilla looks as follows:

{
    "external_id": null,
    "fields": {
        "context": null,
        "prompt": "Can brain cells move? By movement I mean long distance migration (preferably within the brain only)."
    },
    "metadata": {
        "entropy": 0.4352176404374839,
        "flesch_reading_ease": 82.39000000000001,
        "n_characters": 85,
        "passed_quality_check": "True"
    },
    "responses": [],
    "suggestions": [
        {
            "agent": null,
            "question_name": "response",
            "score": null,
            "type": null,
            "value": "The question is relatively broad and one should take into account that the brain not only consists of neurons, but also glial cells (supportive cells) and pre-mitotic neuronal stem cells. Furthermore, as critical fellow-scientists have indicated, developmental stage is very important, as the developing embryonic brain is very different from the adult brain.\nHowever, after sifting through various publications, the answer to the question is actually remarkably simple: Yes, brain cells migrate.\nIn  the adult brain glial cells migrate in the brain (Kl\u00e4mbt, 2009). Glial cells are involved in a myriad of functions, but a notable example of migrating glial cells are the oligodendrocytes that migrate relative long distances to find their target axons onto which they wrap themselves to form the insulating myelin sheath (Tsai and Miller, 2002).\nNeuronal stem cells migrate over long distances in response to injury (Imitola et al., 2004) and they migrate from specific stem-cell locations (e.g., hippocampus and subventricular zone) to other regions (Clarke, 2003).\nPost-mitotic, but non-differentiated neurons have been shown to migrate in the adult brain in fish (Scott et al., 2012), and in mammals and non-human primates as well (Sawada et al., 2011).\nNot surprisingly, glial cells, stem cells and neurons also migrate during embryonic development. Most notably, post-mitotic neurons destined to fulfill peripheral functions have to migrate over relatively long distances from the neural crest to their target locations (Neuroscience, 2nd ed, Neuronal Migration)."
        }
    ]
}

While the same record in HuggingFace datasets looks as follows:

{
    "context": null,
    "external_id": null,
    "metadata": "{\"n_characters\": 85, \"passed_quality_check\": \"True\", \"flesch_reading_ease\": 82.39000000000001, \"entropy\": 0.4352176404374839}",
    "prompt": "Can brain cells move? By movement I mean long distance migration (preferably within the brain only).",
    "response": [],
    "response-suggestion": "The question is relatively broad and one should take into account that the brain not only consists of neurons, but also glial cells (supportive cells) and pre-mitotic neuronal stem cells. Furthermore, as critical fellow-scientists have indicated, developmental stage is very important, as the developing embryonic brain is very different from the adult brain.\nHowever, after sifting through various publications, the answer to the question is actually remarkably simple: Yes, brain cells migrate.\nIn  the adult brain glial cells migrate in the brain (Kl\u00e4mbt, 2009). Glial cells are involved in a myriad of functions, but a notable example of migrating glial cells are the oligodendrocytes that migrate relative long distances to find their target axons onto which they wrap themselves to form the insulating myelin sheath (Tsai and Miller, 2002).\nNeuronal stem cells migrate over long distances in response to injury (Imitola et al., 2004) and they migrate from specific stem-cell locations (e.g., hippocampus and subventricular zone) to other regions (Clarke, 2003).\nPost-mitotic, but non-differentiated neurons have been shown to migrate in the adult brain in fish (Scott et al., 2012), and in mammals and non-human primates as well (Sawada et al., 2011).\nNot surprisingly, glial cells, stem cells and neurons also migrate during embryonic development. Most notably, post-mitotic neurons destined to fulfill peripheral functions have to migrate over relatively long distances from the neural crest to their target locations (Neuroscience, 2nd ed, Neuronal Migration).",
    "response-suggestion-metadata": {
        "agent": null,
        "score": null,
        "type": null
    }
}

Data Fields

Among the dataset fields, we differentiate between the following:

  • Fields: These are the dataset records themselves, for the moment just text fields are supported. These are the ones that will be used to provide responses to the questions.

    • prompt is of type FieldTypes.text.
    • (optional) context is of type FieldTypes.text.
  • Questions: These are the questions that will be asked to the annotators. They can be of different types, such as RatingQuestion, TextQuestion, LabelQuestion, MultiLabelQuestion, and RankingQuestion.

    • response is of type QuestionTypes.text.
  • Suggestions: As of Argilla 1.13.0, the suggestions have been included to provide the annotators with suggestions to ease or assist during the annotation process. Suggestions are linked to the existing questions, are always optional, and contain not just the suggestion itself, but also the metadata linked to it, if applicable.

    • (optional) response-suggestion is of type QuestionTypes.text.

Additionally, we also have two more fields that are optional and are the following:

  • ✨ NEW metadata: This is an optional field that can be used to provide additional information about the dataset record. This can be useful to provide additional context to the annotators, or to provide additional information about the dataset record itself. For example, you can use this to provide a link to the original source of the dataset record, or to provide additional information about the dataset record itself, such as the author, the date, or the source. The metadata is always optional, and can be potentially linked to the metadata_properties defined in the dataset configuration file in argilla.yaml.
  • external_id: This is an optional field that can be used to provide an external ID for the dataset record. This can be useful if you want to link the dataset record to an external resource, such as a database or a file.

Data Splits

The dataset contains a single split, which is train.

Dataset Creation

Curation Rationale

[More Information Needed]

Source Data

Initial Data Collection and Normalization

[More Information Needed]

Who are the source language producers?

[More Information Needed]

Annotations

Annotation guidelines

This is a supervised fine-tuning dataset that contains instructions. Please write the response to the instruction in the response field. Take the context into account when writing the response.

Annotation process

[More Information Needed]

Who are the annotators?

[More Information Needed]

Personal and Sensitive Information

[More Information Needed]

Considerations for Using the Data

Social Impact of Dataset

[More Information Needed]

Discussion of Biases

[More Information Needed]

Other Known Limitations

[More Information Needed]

Additional Information

Dataset Curators

[More Information Needed]

Licensing Information

[More Information Needed]

Citation Information

[More Information Needed]

Contributions

[More Information Needed]

Downloads last month
53
Edit dataset card