Dataset Viewer
Auto-converted to Parquet Duplicate
instruction
stringlengths
17
7.84k
response
stringlengths
15
13.7k
Can brain cells move? By movement I mean long distance migration (preferably within the brain only).
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 ...
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 ...
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, a...
View tabular file such as CSV from command line, having horizontal and vertical scrolling would be great.
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 co...
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...
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 ...
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...
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 det...
I am looking to use Java to get the MD5 checksum of a file. How is it done?
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 algori...
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?
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 `...
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?
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 ...
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[] ...
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...
How do DOS games like DOOM benefit from a PCI graphics card?
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 backw...
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?
```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...
Why does PRC devalue its currency on purpose, but Turkey is worried about the devaluation of its currency?
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 l...
"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?
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...
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"?
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 ...
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} ```
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 ```\newwaterma...
Understanding the Rails Authenticity Token
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...
Why is FIFA against adding instant replay to the game?
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 ...
If we should encrypt the message rather than the method of transfer, why do we care about wifi security? Is this just security theatre?
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 discover...
Applying filter in scipy.signal: Use lfilter or filtfilt?
* ```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 recording...
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 imp...
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...
Can someone explain to me what the ```contentInset``` property in a ```UIScrollView``` instance is used for? And maybe provide an example?
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| ↓ --------------- ...
How is arc defined in TikZ?
```\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...
How to connect mysql workbench to running mysql inside docker?
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 ...
Can meat spoil outside the fridge if it's baked into bread as a filling?
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, whi...
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?
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. ``` ``` m...
Were there any flying dinosaurs?
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 (bir...
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?
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. Math...
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...
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 place...
Did two dissenting Supreme Court justices agree that Trump was "absolutely immune" to the Manhattan DA's subpoena?
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...
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?
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 Za...
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 SanD...
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 d...
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 priv...
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 ...
Is there a phrase that means "too important" and "attracting too much attention"?
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 ...
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$?
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 y...
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?
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 do...
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; hei...
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 ...
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–ri...
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 ...
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 er...
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...
What is the difference between Non-Player Characters (NPCs) and bots in video games?
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 game...
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?
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 co...
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 comi...
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 s...
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.
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-univer...
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?
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 Chin...
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 } ```
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 e...
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?
* 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 contain...
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...
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...
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.
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 t...
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 s...
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 correlati...
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)?
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 th...
Why does Michael Crichton use US Customary measurements in hard sci-fi?
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 g...
How can horns, most of which have only three buttons, play all their notes?
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 -...
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 els...
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:...
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.
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 fi...
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?
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 tr...
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 d...
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 w...
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...
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 ...
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 ...
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 indisti...
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 ``...
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 ...
what's the difference between JavaScript objects, classes and functions?
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 (bo...
Why is Gaia operating around Earth orbit? Why not send it to Neptune's orbit?
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 measuremen...
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 ...
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 ``...
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...
## 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....
How important is multithreading in the current software industry?
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...
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?
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 i...
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?
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 t...
How does immersion passively help with learning a language?
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...
I have a script, that does not exit when I want it to. An example script with the same error is: ```#!/bin/bash function bla() { return 1 } bla || ( echo '1' ; exit 1 ) echo '2' ``` I would assume to see the output: ```:~$ ./test.sh 1 :~$ ``` But I actually see: ```:~$ ./test.sh 1 2 :~$ ``` Does the ```()``` comman...
```()``` runs commands in the subshell, so by ```exit``` you are exiting from subshell and returning to the parent shell. Use braces ```{}``` if you want to run commands in the current shell. From bash manual: (list) list is executed in a subshell environment. Variable assignments and builtin commands that affect t...
Adding a new swap file. How to edit fstab to enable swap after reboot?
These ares the steps to create a swap on a file: 1. Create a large file e.g. with ```sudo mkdir -p /var/cache/swap/ # create a directory that holds the swap file sudo dd if=/dev/zero of=/var/cache/swap/myswap bs=1M count=4096 # for 4 GByte ``` Of course any other method of creating a file of defined size would do. ...
How do I add a validation to make sure the date string being passed to the method is in the ffg. format: ```'YYYY-MM-DD' ``` if it's not, method should raise some sort of error
The Python ```dateutil``` library is designed for this (and more). It will automatically convert this to a ```datetime``` object for you and raise a ```ValueError``` if it can't. As an example: ```>>> from dateutil.parser import parse >>> parse("2003-09-25") datetime.datetime(2003, 9, 25, 0, 0) ``` This raises a ```Val...
When to use UICollectionView instead of UITableView?
That depends on the requirements. How the application flows determines which type of UI to integrate into the application. People mainly use the ```UICollectionview``` for creating types of UIs with multiple images shown in a grid. This would have complex logic using ```UITableView```, but with ```UICollectionview```, ...
On my branch I had some files in .gitignore On a different branch those files are not. I want to merge the different branch into mine, and I don't care if those files are no longer ignored or not. Unfortunately I get this: The following untracked working tree files would be overwritten by merge How would I modify ...
Safely remove/overwrite only bothersome files When you want to ```merge```: ```git checkout -f donor-branch # replace bothersome files with tracked versions git checkout receiving-branch # tracked bothersome files disappear git merge donor-branch # merge works ``` When you want to ```pull```: ```git fetch gi...
Since long time ago I have been thinking in two problems that I have not been able to solve. It seems that one of them was recently solved. I have been thinking a lot about the motivation and its consequences. Mostly because people used to motivate one of them with some very interesting implications. My conclusion howe...
The three-body problem is one of the most famous problems in the history of mathematics, which also has an important application in science: it was supposed to explain the Moon's motion, among other things. Enormous effort was spent on this problem by many famous mathematicians of the 18th and 19th centuries. Since New...
How do GPS receivers communicate with satellites?
The first thing to know is the communication is one-way. There's a satellite-to-receiver transmission, nothing going in the opposite direction. So your cell phone doesn't have to find the radio power to send a signal all the way to space! (exceptions: The decommissioned Chinese BeiDou-1 system - and any products where ...
How do I open the JavaScript console in different browsers?
Chrome Opening the “Console” panel of Chrome’s DevTools: * Windows and Linux: Ctrl + Shift + J * Mac OS: Cmd + Opt + J Note: In addition to the “Console” panel, there also exists a smaller slide-up console which can be toggled via Esc while any of the other panels is active. Firefox Opening the “Console” panel in F...
I have Ubuntu 10 as the guest OS on a Windows 7 machine. I have been trying to setup shares through VirtualBox, but nothing is working. First, I create the share in VirtualBox and point it to a Windows folder. Then I try to mount the drive in Linux, but I keep getting ```/sbin/mount.vboxsf: mounting failed with the ...
In order to use shared folder functionality few prerequisites need to be met: * Make sure that Guest Additions are properly installed on the guest OS. * Users in a guest Ubuntu must be in the group ```vboxsf``` to be able to access shares. * Define a directory on the host that will be used in the virtual machine using...
What does %~dp0 mean, and how does it work? I'd also like to know if it is a documented feature, or something prone to be deprecated.
Calling `for /?` in the command-line gives help about this syntax (which can be used outside FOR, too, this is just the place where help can be found). > In addition, substitution of FOR variable references has been enhanced. You can now use the following optional syntax: ```%~I - expands %I removing any sur...
Should a tester feel bad about finding too many defects/bugs in the product?
If this is a medical application you are talking about it is serious stuff. What if the bugs affected real users? Developers would be much less happy if they put in life threat someone or if management has to retire a product or make public excuses. Nowadays it is pretty standard for software having minor bugs, but a m...
Do you bleed to death after your penis is cut off?
Assuming the person is not taking anticoagulants, it's actually quite difficult to bleed to death from dismemberment of small members (hands, feet, penis, ears, nose, etc). Even large members such as arms and legs are often survivable because the body is very good at protecting itself from blood loss. For example, tran...
In Swift, is there a clever way of using the higher order methods on Array to return the 5 first objects? The obj-c way of doing it was saving an index, and for-loop through the array incrementing index until it was 5 and returning the new array. Is there a way to do this with ```filter```, ```map``` or ```reduce```?
With Swift 5, according to your needs, you may choose one of the 6 following Playground codes in order to solve your problem. #1. Using ```subscript(_:)``` subscript ```let array = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L"] let arraySlice = array[..<5] //let arraySlice = array[0..<5] // also works //...
What's the simplest way to get an environment variable from a docker container that has not been declared in the Dockerfile? For instance, an environment variable that has been set through some ```docker exec container /bin/bash``` session? I can do ```docker exec container env | grep ENV_VAR```, but I would prefer som...
The downside of using ```docker exec``` is that it requires a running container, so ```docker inspect -f``` might be handy if you're unsure a container is running. Example #1. Output a list of space-separated environment variables in the specified container: ```docker inspect -f \ '{{range $index, $value := .Config....
I am confused about the use cases for both ```InputStream``` and ```OutputStream```. Please include a snippet of code to go along with your explanation.
InputStream is used for reading, OutputStream for writing. They are connected as decorators to one another such that you can read/write all different types of data from all different types of sources. For example, you can write primitive data to a file: ```File file = new File("C:/text.bin"); file.createNewFile(); Data...
What is the difference between: ```npm install [package_name] ``` and: ```npm install [package_name] --save ``` and: ```npm install [package_name] --save-dev ``` What does this mean? And what is really the effect of ```--save``` and ```-dev``` keywords?
The difference between ```--save``` and ```--save-dev``` may not be immediately noticeable if you have tried them both on your own projects. So here are a few examples... Let's say you were building an app that used the moment package to parse and display dates. Your app is a scheduler so it really needs this package t...
pod install -bash: pod: command not found
Please follow the following steps to install Pod: 1. Open terminal and type: ```sudo gem install cocoapods ``` Gem will get installed in Ruby inside the System library. Or try on 10.11 Mac OSX El Capitan, type: ```sudo gem install -n /usr/local/bin cocoapods ``` If there is an error &quot;activesupport requires Ruby v...
I read in the Essential C# 3.0 and .NET 3.5 book that: GetHashCode()’s returns over the life of a particular object should be constant (the same value), even if the object’s data changes. In many cases, you should cache the method return to enforce this. Is this a valid guideline? I have tried a couple built-in...
The answer is mostly, it is a valid guideline, but perhaps not a valid rule. It also doesn't tell the whole story. The point being made is that for mutable types, you cannot base the hash code on the mutable data because two equal objects must return the same hash code and the hash code has to be valid for the lifetim...
How to set button click effect in Android?
It is simpler when you have a lot of image buttons, and you don't want to write xml-s for every button. Kotlin Version: ```fun buttonEffect(button: View) { button.setOnTouchListener { v, event -> when (event.action) { MotionEvent.ACTION_DOWN -> { v.background.setColorFilter(-0x1f...
What does strength refer to in mathematics? Is it a formal idea?
Suppose you have a theorem that says "If $X$, then $Y$." There are two ways to strengthen such a theorem: * Assume less. If you can reduce the number of hypotheses, but still prove the same conclusion, then you have proved a more "powerful" result (in the sense that it applies in more situations). * Prove more. If ...
Does vegetarianism affect life expectancy? Is an average vegetarian supposed to live longer just because of their diet?
Yes, according to a paper by the American Society for Clinical Nutrition. > Results: Our review of the 6 studies found the following trends: 1) a very low meat intake was associated with a significant decrease in risk of death in 4 studies, a nonsignificant decrease in risk of death in the fifth study, and virtually n...
What is the difference between an object and a companion object in a class in kotlin? Example: ```class MyClass { object Holder { //something } companion object { //something } } ``` I already read that companion object shall be used, if the containing parameters/methods are closely rela...
There are two different types of ```object``` uses, expression and declaration. Object Expression An object expression can be used when a class needs slight modification, but it's not necessary to create an entirely new subclass for it. Anonymous inner classes are a good example of this. ```button.setOnClickListener(o...
Is there a better way to determine whether a variable in ```Pandas``` and/or ```NumPy``` is ```numeric``` or not ? I have a self defined ```dictionary``` with ```dtypes``` as keys and ```numeric``` / ```not``` as values.
You can use ```np.issubdtype``` to check if the dtype is a sub dtype of ```np.number```. Examples: ```np.issubdtype(arr.dtype, np.number) # where arr is a numpy array np.issubdtype(df['X'].dtype, np.number) # where df['X'] is a pandas Series ``` This works for numpy's dtypes but fails for pandas specific types like p...
I've come across the polynomial algorithm that solves 2SAT. I've found it boggling that 2SAT is in P where all (or many others) of the SAT instances are NP-Complete. What makes this problem different? What makes it so easy (NL-Complete - even easier than P)?
Here is a further intuitive and unpretentious explanation along the lines of MGwynne's answer. With $2$-SAT, you can only express implications of the form $a \Rightarrow b$, where $a$ and $b$ are literals. More precisely, every $2$-clause $l_1 \lor l_2$ can be understood as a pair of implications: $\lnot l_1 \Rightarro...
I'm trying to write a Bash script that will overwrite an existing directory. I have a directory ```foo/``` and I am trying to overwrite ```bar/``` with it. But when I do this: ```cp -Rf foo/ bar/ ``` a new ```bar/foo/``` directory is created. I don't want that. There are two files in ```foo/```; ```a``` and ```b```. Th...
If you want to ensure ```bar/``` ends up identical to ```foo/```, use ```rsync``` instead: ```rsync -a --delete foo/ bar/ ``` If just a few things have changed, this will execute much faster than removing and re-copying the whole directory. * ```-a``` is 'archive mode', which copies faithfully files in ```foo/``` to `...
End of preview. Expand in Data Studio

YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

An attempt to unchained Llama2 by using only 780 filtered dataset from GAIR/lima.

Downloads last month
18

Models trained or fine-tuned on pankajmathur/lima_unchained_v1