What does "format" do?

Question:
What does the computer do when we format our hard disk or flash disk.
If formatting clears all data on a disk, what is the difference between deleting all files in the disk and formatting the entire disk?
Is it bad to format multiple times?
How many times can a disk be formatted?
Will formatting reduce the lifespan of my drive?
What is the difference between quick formatting and standard formatting?
Answer:
Essentially, the system just loses the references to any actual information that is on the disk, it doesn't actually 'remove' the information.
"Formatting a hard disk drive will overwrite the data on the drive. However, the data hasn't exactly been erased. The formatting process only removes the operating system's ability to read the data on the drive. Data needs to be rewritten to the drive and then reformatted again to ensure that data is no longer accessible." Source
Formatting will typically remove the operating system as well.
Not really. Doesn't really matter.
As often as you'd like.
No. Source
Standard formatting checks for bad sectors on the hard drive and flags them, as well as deletes the references to the information on the hard drive, while a quick format simply deletes the references to the information on the hard drive. Source
Comment: Hi! Nice answer, but second list should start form number 2.
Comment: Thanks! Yeah, adding in a quote messed it up. I'm currently attempting to fix it.
Comment: #2 -- the operating system is part of "all files" too
Answer:
1) What does the computer do when we format our hard-disk or Pen-drive.
  2) Formatting clears all Data on a Disk , then what is the difference between deleting all files in the disk and Formatting the entire disk

Before answering this, you should know how a file system is built. A file system is a kind of library in which we have books that represent files. These books can be found using the Library's catalogue, telling you in which shelf the books are stacked.
Over time, the catalogue will still contain books that are no longer present in the library or books will be in the library that are not recorded in the catalogue. There will be decay in the system and errors might occur. Also the library might decay and fall into ruin.
When we delete all files from a media, we clear out the entire catalogue but leave all the books in the shelves. When we want to add a file (book), we make room for the new book by removing some of the other old books from the shelf and putting the new book there.
However, if we format the media, we demolish the entire library and rebuild it. The books may then still be recovered from all the rubble of the old library, but once the new library is getting filled up, that books will decay.

3) Is it Bad to format Multiple times
  4) On an average how many times can you format your disk
  5) Will Formatting reduce hard-disk lifespan

There's no real reason to format several times. Media, as well as hard drives and especially USB thumb drives have a number of write cycles in which according to the manufacturer, proper operation is guaranteed. Formatting media will contribute to the number of write cycles being done. Yet, you won't actually damage the drive.

6) What is the difference between quick Formatting and the standard Formatting

From Wikipedia:

High-level formatting is the process
  of setting up an empty file system on
  the disk and installing a boot sector.
  This alone takes little time, and is
  sometimes referred to as a "quick
  format".
In addition, the entire disk may
  optionally be scanned for defects,
  which takes considerably longer, up to
  several hours on larger hard disks.
Comment: Yes, I've seen bombed, shelled and bulldozed buildings where books and shelves have survived. Of course, the important point is that after format data isn't destroyed, it's just inaccessible and may be recovered unless it is actually overwritten. What you explained is more like zero-filling on modern or low level format on ancient hard drives.
Comment: @Andre I edited that part with the demolishing a bit... This better? =)
Comment: Nice analogy, but wouldn't normal format be equivalent of destroying library's catalog and saying that all space occupied by old books may now be used for something else?
Comment: @Andre Have you ever seen books/shelves survive being in a building being demolished? :P
Comment: @BloodPhilia Are you sure that deleting files from a USB drive just deletes them from the catalogue and not wipe them? Thanks for the answer.
Answer:
it initializes an empty filesystem on the device you're formatting
formatting actually clears che "index" that lets you access your data (that's the filesystem), it does not erase actual data blocks around the disk. That's why formatting a device does not take different times if it was empty or full.
it's useless, not bad
if you just "format" and do not write anything else, you could probably do that hundreths of thousand times on flash devices, and some million times on magnetic devices (harddisks). Every sector in every device can be written a number of times, that's millions for hard disks and hundreds of thousands on flash devices. But you don't access physical sectors on flash devices, the controller will do write leveling. And on magnetic hard disk you have spare sectors that will be used to remap bad ones. It's a long story.
yes, but by a really little fraction. Writing many gigabytes (like a dvd iso) on the same disk will probably have a worse effect (the filesystem itself is smaller)
that's a bad naming coming from MS-DOS times. a "quick format" is what we call formatting the device. a "long format" (the one that takes hours to complete) is a formatting + a complete surface scan of the device (they're two totally unrelated things)

EDIT: keep in mind that you cannot actually "erase" anything on hard disks or flash medias. You can just write different, possibly meaningful, data in a sector (like writing a bunch of zeros or stuff like that) but there is no such thing as a physically "empty" sector.
Answer: First you need to know a filesystem is a method of storing and organizing computer files and their data. Essentially, it organizes these files into a database for the storage, organization, manipulation, and retrieval by the computer's operating system.
To format a drive you are creating a new filesystem.  You are not only deleting all the files but also deleting the structure that your computer uses to know where the files are.
A quick format is very much like deleting all the files, because your only actually deleting the first little bit of each file.  Enough so that your computer now thinks of those files as "free space", even though the original data is there, the computer knows it can write over it at any time.  A quick format also creates a new filesystem (but your probably using the same type of filesystem that you were before).  A standard Format writes over the whole disk so that the original data isn't there anymore.  This takes longer and isn't really necessary.
That should answer 1 and 2 and 6.
(3) No.
(4) There is no limit. Thousands.  Less on a Pen-drive, but formating is no different than other writing on the drive.  Any writing shortens the lifespan since, especially pen-drives, can only do so much writing before they die.
(5) No, not more than regular writing
Answer: Formatting a drive removes the reference pointer (index) to the files, which were reserved space.  The process is the same when you delete a file.  It is still present until another file is added to the drive, which then overwrites the previous file's allocated space that is no longer reserved.  If your goal is to delete the data on the drive to an unrecoverable state then perform random write followed by zero write operations.  To truly be sure data is unrecoverable then either follow the DoD standard of at least seven overwrites or physically destroy the drive's platters (HDD) or primary storage chips (SSD/USB).
If you simply format the drive and then add a new operating system then the majority of its content will remain.  The new operating system will be placed in the same place as the previous one unless the user specifies otherwise but this does not occur by default and if done can still leave valuable information that existed in the previous operating systems allocated space.
In summary, formatting merely makes all space available for new information and is obviously necessary as certain devices require/operate more efficiently with different file systems and block sizes.  In short, formatting is the easy button for unreserving space.  You can format as many times as you'd like and the result is the same.  Now making data unrecoverable will wear the drive (both HDD and SSD) as data is physically written to the drive to overwrite previous data.  Do not perform these types of write operations to SSDs as it will wear the device sooner and the way many SSDs work when a file is deleted or a drive is formatted makes the process overkill but it can still be done if desired.

What does "format" do?


What is a common-emitter bjt push-pull output stage?

Question: My professor mentioned it briefly in class, and I've been googling it and all I find is the CC output stage. Can anyone show me a picture of this configuration and maybe describe how it works? Can you provide a source?
Comment: Edit your question, click the circuit diagram editor button, and draw it there. Then we can see where you're at.
Comment: Do you know what a *common-emitter circuit* is? Do you know what a *push-pull circuit* looks like? I suggest that you Google both terms and look not at the web sites but the **images** tab. You will see many circuits. The circuit you're after is a combination of two CE stages into a push-pull stage. Also next time, as the professor for an example circuit. It takes only a minute to draw one.
Comment: I searched images but only got either cc ones or complicated ones. I tried to draw it. But what I have drawn doesn't seem to work.
Comment: @MylaIzaman The common-emitter topology for high power requires thermal sensing of the output transistors, of COURSE you only find complicated ones.
Answer: A BJT (NPN in this example) connected in common emitter configuration looks like this:

Putting two of these with opposite polarity together is a push-pull stage:

The name comes from the fact that the output is actively pushed and pulled in both polarities.
There are a great many details about how to drive the two transistors so that they each turn on when needed, but not both turn on to fight each other.  Just getting the DC quiescent operating point right isn't trivial.  This is sometimes called biasing.  That would be good to look up.
Also look up class A amplifier, class B amplifier, and class AB amplifier.  These classes have to do with the overall strategy of when each of the transistors are intended to conduct.  The classes are a tradeoff between smooth transitions and wasted power.
Those details are beyond your simple question, but this should give you things to go look into.
Comment: @cact: No, that's a PNP/NPN push/pull pair.  Yes, it is tricky to bias, as I mentioned in the answer.
Comment: I'm pretty sure you have the transistors mixed up in the second picture, it'd be pretty tricky to bias that to get them to work in their respective linear regions


How to get Featured products display using attributes

Question: I want to create featured products attribute for that I created an attribute and selected catalog input type as yes/no and then selected used for sorting in product listing but the featured products are not being displayed instead all the products are being displayed
Answer: here I can recommend using an extension.
I have used in the past this extension, and it is working great But it is not free.
but Also not more so expensive.
Also you can add sorting by best sellers,rating and any of your custom attribute you can add with this extension from admin configuration, it has really nice sorting options in catalog grid and list view.
hope this will sure help you.
i am not promoting any extension or associated with this link. Its just for your help


Random Unanswered question sorting

Question: I think that a feature that sorts all the unanswered questions randomly would be good, as long as it reordered everything every time the page is refreshed. I often browse the newest page,  only to find that I am out of questions that I can answer within five minutes. It would help get attention to old questions that would not be looked at otherwise.
Comment: "out of questions that I can answer within five minutes" - That's actually pretty good. For most people (including myself), that would be "zero minutes".
Comment: The only problem that I can see with this is that there are currently 795,133 unanswered questions, so you're drawing from a pretty large pool of questions, many of which are too old to still be useful.  The system already randomly pokes old, unanswered questions to bring them to the front page.
Answer: Here's a SEX-DEX query to do this:
Random Unanswered Posts
It has a few problems, such as SE's overly aggressive caching allowing RAND() not to function properly (make a simple edit every time you run the script & it should work), and the interface isn't the best, but it does pull down what you want.
Here's the query parameters I used:

Only Questions
Zero total answers
Less than 500 views
Not closed

And, the most important part

Selects 15  in-order rows, from a random part of the SE Question heap.

I could have used ORDER BY newid(), but that would have cause major performance issues, so I decided to use this instead.
Enjoy the script, and let me know if you have any more requests (besides tag filtering, it turned out to be too complex).

Random Unanswered question sorting


Answer to "What day are you leaving?"

Question: If someone asks "What day are you leaving?", would it be grammatically correct to answer with "On the 8th April." for example? Or does it have to be "On Monday."?
Comment: You can say "on the 8th of April" or "on April 8th" or "on April 8" or "on 8 April" ... and why do you think "on Monday" would be a replacement for any of those?
Comment: The 8th April would be in eight years, so that would give urgent meaning to "What day are you leaving?"  :-)
Comment: I had an English test today and my teacher said that "On the 8th of April." is incorrect. But I don't know how I can prove that it's correct to him. If you can help me by telling exactly why it would be correct, I would love you forever.
Comment: "On the 8th April" is wrong, but "On the 8th of April" is correct.  If your teacher literally said that that was incorrect, either there was a misunderstanding, or he doesn't know what he is talking about.  Unfortunately there are a lot of bad English teachers out there.
Answer: Often, when people ask the day, it's the day of the week (Monday). When they ask for the date they are looking for the actual date, April 8th, in your example. A simple way to avoid confusion is to give both answers, "Monday, April 8th".
Answer: This is a question of what's technically correct versus what's commonly used.
Common usage:
What day are you leaving?
Monday / next Monday / On the 8th of April.
No one really asks "On what date are you leaving?' even though it's technically correct.
Technically correct:
What day are you leaving?
Answer should be a day of the week
What date are you leaving on?
The 8th of April.

Answer to "What day are you leaving?"


Properties of reflexive Banach spaces

Question: I just want to see the importance of reflexive Banach spaces and what is special about them compared to other Banach spaces. What kind of properties hold in reflexive spaces that do not necessarily hold for a random Banach space. The only property I know is that the closed unit ball of a reflexive space is compact in the weak topology.
Comment: The most commonly used Banach spaces are Hilbert Spaces and $L^p$ spaces, both of which are reflexive. Of course in the case of a Hilbert space, the dual can be identified with the Hilbert space itself, which is a stronger statement. Here we may view an element of a Hilbert space as functional. This is where the bra-ket notation comes in handy in Quantum mechanics.
Answer: Reflexive spaces interest mathematicians because they have a lot of nice properties:
The unit ball is weakly compact, so you can exploit compactness to prove existence of fixed points, convergent subsequences and etc.
Reflexive spaces are characterized by the property that weak and weak* topology coincide. You can forget about weak topology and work with much-well-understood weak* topology.
Every functional on a reflexive space attains its norm. Simply speaking, you always have a vector that tells you almost everything about your functional. More on this matter you can find here.
Reflexivity is a three-space property. You can pass to quotients and subspaces of reflexive spaces and get a reflexive space again.
After equivalent renorming, all reflexive spaces are strictly convex. In some sense, the unit ball of a reflexive spaces is round.
Reflexive spaces have the Radon–Nikodym property. This allows you to develop a rich theory for vector-valued integration and vector-valued measures for reflexive spaces.
Reflexivity is a rare property and this helps one to distinguish Banach spaces. For example there are no infinite-dimensional reflexive $C^*$-algebras, so $c_0$, $l_\infty$ are not reflexive. Their non-commutative counterparts $\mathcal{K}(H)$ and $\mathcal{B}(H)$ are not reflexive either.
Schauder bases in a reflexive space are very nice and sweet; they are shrinking and boundedly complete. Beware! There are hereditarily indecomposable (and a fortiori without any basis) reflexive Banach spaces. See this paper.
To find more on reflexive spaces use search on this site, or mathoverflow, or any book on Banach geometry with keyword 'reflexive'.
Comment: Wow, that's a good list, thank you Norbert !!
Comment: Thank you. Your answer helped me greatly. I was wondering if you could recommend a book that treats reflexive spaces in more depth than for example Kreyszig? (If you don't know it: Kreyszig is an introductory book into functional analysis. It is very general.)
Comment: @student There s no book specializing on reflexive spaces. You should look for specific chapters in different books. See this answer for [my suggestions](http://math.stackexchange.com/questions/901030/book-suggestion-geometry-of-banach-spaces).

Properties of reflexive Banach spaces


Does using wild shape allow extra movement?

Question: If a human druid (30 ft/round), in combat/initiative, uses all their movement speed, than wild shapes into a brown bear (40 ft/round), do they get to move again? If not, what is the formula for their remaining speed if they had only used half of all their movement?
Answer: Treat this as a case of multiple speeds
The Player's Handbook (p190) states:

If you have more than one speed, such as your walking speed and a flying speed, you can switch back and forth between your speeds during your move. Whenever you switch, subtract the distance you've already moved from the new speed.... If the result is 0 or less, you can't use the new speed during the current move.

At any time during her turn, the druid's total distance covered can be no more than her current movement speed. Wild shaping does raise her movement speed, but does not affect her accumulated movement.
In your hypothetical example, the druid moves 30ft as a human. Then she wild shapes into a bear, and now has a movement speed of 40ft. She can therefore move a further 10ft after shaping.
Comment: This seems like a reasonable ruling, but what makes you think that this rule applies to the case of a wild shaped druid by RAW? She does not have more than one speed, she just has different speeds at different moments of her turn.


How can i edit jupyter notebook from terminal without opening web browser?

Question: How can I edit my jupyter notebook in terminal.
I just don't like to open jupyter notebook in web browser.
I google out but every answer is related to how can we open notebook from terminal directly.
Comment: What kind of edits are you trying to make? `.ipynb` files are `json` data structures, so this is possible, but an example of what you are trying to do would help us understand how feasible this may be.
Answer: I'd suggest looking at Jupytext's ability to do command line conversions back-and-forth from the notebook json structure to a python script (or markdown). If you already have the backbone of a notebook (.ipynb) file, you can convert it to .py script using jupytext --to py notebook.ipynb. That makes a text file that is easy to edit in your favorite terminal based text editor. The json in the .ipynb files is not as easy to edit directly.
Then when you are done editing, you can convert the .py script form back to a notebook with something like jupytext --to notebook notebook.py. Optionally, you can even execute it without opening a browser by adding --execute. I have an example conversion-and-execution command in use here.


Normal Form in Artificial Intelligence

Question: Why do we use normal form(like Conjuctive Normal Form and Disjunctive Normal Form) in Artificial intelligence?What is the specific purpose of Making a sentence in Normal Forms?
Answer: The point of normalizing forms is for consistency between expressions.  It makes identical expressions easier to spot, and makes reasoning and simplifying easier.
Conjunctive, disjunctive, or even propositional expressions are just different ways to say the same things.
Artificial intelligence is concerned with these logic forms only when the AI happens to perform logical operations.  Most AI's use logic in some form.
Answer: Many algorithms, such as SAT solvers, are optimized for Conjunctive Normal Form.
See for instance http://minisat.se/

Normal Form in Artificial Intelligence


How do I add the wifi and bluetooth icon to the menubar programatically (from the command line)?

Question: We have a large number of computers to set up and would like to add the wifi and bluetooth icons to the menubar. How can I turn these settings on via a shell script or command line instruction?
Comment: No, that just turns bluetooth on and off - there is another checkbox in the bluetooth GUI to display the icon in the menu bar.
Comment: Ah, ok, I missed that part of your question.  I'll remove the dup.  It would help if you added the script you have so far so we can look and see the error.
Answer: I believe the Wi-Fi one is there by default, but if you want to be sure, you can use
open '/System/Library/CoreServices/Menu Extras/Bluetooth.menu'
open '/System/Library/CoreServices/Menu Extras/AirPort.menu'
to add them to the menu bar.
(Note: those paths are valid from at least El Capitan to Catalina.)


Lookup column to open a URL instead of related item in SharePoint 2010?

Question: I have a list with two columns; both are single line of text. The first acts as a URL title and the second one contains the actual URL. Again, both columns are of type single line of text.
Next, I have another list with some columns, including one lookup. That lookup is targeting the second column in the first list, i.e. the single line of text that contais the actual URL. Now, when I click on that lookup field for some list item, a display form is opened showing that related item from the first list. This is a default SharePoint behavior.
I want to be able to open the actual URL instead of opening the lookup item. Is that possible? I prefer the solutions in SharePoint Designer more than coding, but I'll take anything at this point :) Thank you.
Answer: You can add a calculated column to generate HTML with the link, have a look at these articles:
http://blog.pathtosharepoint.com/2008/09/01/using-calculated-columns-to-write-html/
http://blog.pathtosharepoint.com/2008/09/01/apply-color-coding-to-your-sharepoint-lists/


CSV vs XLS for import

Question: I need to import data from various database sources.  At the moment I plan on importing files via a CSV file or XLS.  All the data if in XLS would be on one sheet (notebook).  Are there any advantages of using one format over the other?
Thanks.
David
Comment: It's probably good to know about [this](http://mathematica.stackexchange.com/q/55245/12).  When the importer tries to be too smart, it can work against you.
Comment: Very helpful.  That is a gotcha that could take a long time to figure out!
Answer: Both have advantages and disadvantages.
Importing XLS is done using a Java-based application. In my experience, it is terribly slow and eats up enormous amounts of memory to the extent that it blows up your Java heap space, requiring a manual adjustment of this heap space (quite often to no avail). It happens to me all the time that a data structure that I know should fit in memory cannot be imported along the XLS route just because of these memory issues. It does, however, have conveniences such as the ability to read and automatically convert dates and times, select indivudal cells for import, and you can read both formulas and their results.
Importing CSV files with Import can be much faster and takes less time and memory, although I often resort to reading line by line or as a block using ReadList and do my own conversions when needed.
Comment: I think the point you just removed is quite important.  Yes, RFC4180 is there as a recommendation, but in practice there's no single standard that CSV readers/writers (or people piecing together CSV files) follow, which causes all kinds of trouble.
Comment: Those names *are* single fields according to RFC 4180: http://www.ietf.org/rfc/rfc4180.txt
Comment: Again, very helpful. Thank you.
Answer: I would like to mention a few things.

XLS is widely used, but I always find it clunkier and more inconvenient than CSV.
CSV is more portable:

CSV format is supported well in other data processing ecosystems like R, pandas, Spark, etc. ("Right out of the box" for R and Spark.)
CVS files are readily viewed in the WWW interface of GitHub.
(BTW, for my projects, I often make R-data-packages that often also include the 'raw' CSV files the data frames are based on.)

I have seen a lot of posts in MSE discussing different tweaks or enhancements of Import for dealing with CSV and XLS files. It would be nice if the posters or users of those enhancement "package" the corresponding know-how and publish it at Wolfram Function Repository.

For example, see ImportCSVToDataset. (Yes, self-advertising here, but also a "do as I do" point.)

CSV vs XLS for import


DirectSound: how to change the input volume of a microphone?

Question: I have some questions about Directsound and windows mixers.
My goal is to enumerate all microphones and be able to change the input volume of each one.
I think i'm not far from the solution, but I don't find what is wrong in my code.
Here is what I have done:
- I enumerate all input devices and get a GUID for each one
- I use a method found on a topic to get the mixer id corresponding to a directsound guid using this method  (but I'm not sure if it works)
- Then I get the id corresponding to the control in the mixer
- Then I can modify the volume
Here is the code: a vs2008 project
To test, I have connected two microphones usb + the line-in microphone, and I visually check what sliders are moving. But unfortunately it's not the good one ...
here is a screenshot (img177.imageshack.us/img177/5189/mixers.jpg) of all my mixers opened in windows xp.
Have you an idea of what I am doing wrong? Is there an easiest solution?
bonus question: do you know if there is a way to know if a microphone is connected or not in Line-in, using Directsound? Because the Line-in is always detected as connected even if no microphone is connected.
Comment: I think the only way to detect if a microphone is connected is to see if there is some input noise coming in.
Answer: check this questions:
How to adjust microphone gain from C# (needs to work on XP & W7)
or
http://social.msdn.microsoft.com/Forums/en/isvvba/thread/05dc2d35-1d45-4837-8e16-562ee919da85


Japanese thick old book

Question: I am looking to find out something about this book. I have no idea about it's age. Seems pretty old. This page is the first page of the book. It has a few colored illustrations and a few black and white ones to of people and landscapers. It is about 4"x7" and 4 inches thick. Anything you can tell about it would be great. If you need more pictures let me know. It would be a great help if you could translate this page. Thanks Kirk
Answer: Hokkaido university library shows the book on the Internet. (See page 7 in the link)
Kakyoku Sarae Kou published in 1805 (文化2年).
Your picture version is 「嘉永新鐫(か えい しん せん)」. This might augumented in 1848 (嘉永元年).
There are many 地歌(じか)'s song lyrics over 400 songs.
地歌 is traditional song in Japan.
This is chanted on the samisen in Kyoto, Osaka and the outskirts.

Japanese thick old book


Leader key for many commands

Question: Many commands need the Leader key, but I can't found out what is that key on my keyboard. How could I test it out?
Answer: If you don't set one, the default leader is the backslash \
You can set your leader with :let mapleader = "x", for example to make x your leader.
It's handy to set this at the top of your .vimrc to whatever your desired leader is (I use space as mine). See :h leader for more info and examples.

Leader key for many commands


What is a node in a Power Grid

Question: I have heard the term Node in the Power Grid or Smart Grid, what does this node compose of? Is it a group of houses connected to the same substation?
Comment: The literal meaning of "node" is "knot" so, where wires are tied together. Or, junctions.
Answer: "Node" (or: vertex) really is just a term from graph theory and describes any point in a graph where two edges connect.
Whether that is a single device, power outlet, house, a substation, a nuclear power plant or a national exchange where GWh are auctioned depends on the context. You'll need to really look into the details of each publication – "power grid" or "smart grid" doesn't define that.
Answer: A node is essentially a junction box provided to different regions of the state. It allows for more expansion from power grids to various houses in the region. A simple definition of a node is where two or more wires meet.
Some Nodes have smart systems that makes sure there is regulation in supplying mains voltage. Hope this helped.
Answer: A node in power transmission can be a power plant, substation, tap, or Junction. Taps & junctions are essentially where the power line splits in many directions and usually done on the power pole.

What is a node in a Power Grid


How to create an effect of eyes opening and closing in first person perspective when awaking from syncope?

Question: How to create an effect of eyes opening and closing in first person perspective when awaking from syncope? AE, PR or Final Cut Pro any software is OK. How to create this effect? Or are there any templates or tutorials relating to this?
Comment: When you say syncope, what do you expect to be different than awaking from sleep?
Answer: Syncope is also called "blacking out". So it kinda follows that you might fade in from black…? This effect is in every NLE usually as the default transition.
If you wanna get artsy, maybe you could add say, a blur that gets progressively less blurry as the transition proceeds.
But really, it totally depends on what you want it to look like. Is there a director for this video? Making creative decisions about stuff like this is their job.


Is it notationally appropriate to use $\in$ and $\subseteq$ in the quantificational part of a predicate logic statement?

Question:
In this question it was said in a comment that it is not good style to use $\in$ in the quantificational part of a predicate logic formula.
Is this so? I have actually seen this quite often in definitions (like $\forall x \in \mathbb{R}:\  ...$) and find this by far more convenient than definining additonal predicates for sets that already have an unambiguous set symbol (like $\mathbb{R}$) and then spelling out the set membership by an additional predicate $P(x) \land \ ...$ (for $\exists x$) or $P(x) \to \ ...$ (for $\forall x$) respectively.
In some statements (usually translations of natural language sentences into predicate logic such as "All bachelors are not married") this predicate version instead of $\in$ notaton might make sense, but is it in general not good style to write $\exists x \in P : R(x)$ but only $\exists x : P(x) \land R(X)$?
Similarly, is it permissible to use the $\subseteq$ in the quantificational part of a statement?
E.g. if I wanted to say "for all subsets $B$ of this particular set $A$", with the $\in$-relation, I'd have to make the rather complicated assertion $\forall B \in \mathbb{P}(A)$ by saying "for all sets that are an element of $A$'s power set".
Could I just use $\forall B \subseteq A :\ ...$ instead? It looks weird to me, but I see no reason not to use it if $\in$ is allowed as well.
In case neither $\in$ or $\subseteq$ is allowed, how would I formalize this statement - would I need to define a predicate "is a subset of $A$"?
Answer: Technically, it's not appropriate, in the sense that the syntax of first-order logic doesn't allow for it.
That said, it is indeed efficient. More than that, it can be viewed as an abbreviation for perfectly correct syntax: as you observe, we can just replace "$\forall x\in A(...)$" with "$\forall x(x\in A\rightarrow . . . )$," and replace "$\exists x\in A(...)$" with "$\exists x(x\in A\wedge ...)$". (A similar trick works for "$\subseteq$".)
Whether this matters comes down to what context you are in. There are certain contexts where it's important to pay attention to the precise form of a first-order sentence, and there abbreviations can mislead you as to the true complexity of the formulas involved. However, for the vast majority of purposes there is no problem.
Comment: It should also be remarked that in many contexts we _really don't care_ whether our use of quantifiers stick to the syntax of first-order logic. Often we write formulas with quantifiers in them merely as a way to be precise about how each variable is quantified and which of them may depend on each other how, and in such cases even thinking about the the bounded quantifiers as abbreviations is likely to be counterproductive.
Comment: Thank you, this seems reasonable. So there is no difference in the possibility of use between $\in$ and $\subseteq$ either, so I could write both $\forall B : B \subseteq A \to \ ...$ and $\forall B \subseteq A : \ ... $ (as long as context permits) the same way I have both notations available for $\in$? To clarify, I am aware that $\in$ is of course not the same as $\subseteq$, I am just wondering whether they are to the same degree usueable like this in predicate logic formulae, because I can't recall having seen the subset relation there very often.
Comment: By the way, is this abbreviation the same as the use of the alternative style $(\forall x : P(x)) Q(x)$ in place of $\forall x P(x) \to Q(x)$, or is this a different issue? As far as I see it, it should be the same as what you described, just with predicates instead of $\in$/$\subseteq$, so the choice of style should be similar here?
Comment: @lemontree Yes, that's basically right.
Comment: @NoahSchweber Just been looking at logic recently. Is it not more so the case that $\in$ has no place unless you're doing something with sets? $\in$ is a predicate of two set variables. Then once you're dealing with sets you can define notation $\forall x \in A: P(x)\;  : \iff \forall x: x\in A \implies P(x)$.
Answer: In pretty much all of everyday mathematical writing, not only is it good notation to use restricted quantifiers; it is actually desirable to do so consistently, for clarity and to avoid mistakes in writing. For example, $x$ is often used to denote a real number; but often enough, our mathematical statement applies only for positive or non-negative $x$, or perhaps $x$ represents a set, a vector, a function, or some other type of mathematical object. This restricted quantification also reflects how we naturally think. For example, consider $$(\forall\varepsilon)(\forall x)(\exists\delta)[ \delta\in\Bbb R_+^n\;\&\;((\varepsilon>0\; \&\; x\in\Bbb R^n)\implies X(x,\varepsilon,\delta))],$$where  $X(x,\varepsilon,\delta)$ is some mathematical statement involving (unquantified) $x$, $\varepsilon$, and $\delta$. It starts off by introducing things which could be almost any imaginable sort of mathematical object. Only after this hyper-abstract introduction are we allowed to know in which sets these objects respectively reside. How much more natural it is to write $$(\forall\,\varepsilon>0)(\forall\,x\in\Bbb R^n)(\exists\,\delta\in\Bbb R_+^n)[X(x,\epsilon,\delta)].$$
Comment: The example seems very reasonable, thanks.


How can I summon TNT without causing damage to blocks?

Question: I want to summon a TNT block that will cause damage to mobs. However, I don't want it to damage or break blocks. Is there any way that I can do this?
Comment: Possible duplicate of [How can I turn off TNT block damage?](https://gaming.stackexchange.com/questions/191684/how-can-i-turn-off-tnt-block-damage)
Comment: This isn't possible with TNT, however, this *is* possible using creepers with a fuse time of 0. If you want to replace the functionality of TNT, then this can also be done by looking for a TNT entity with a fuse of x, then summoning a creeper there with fuse 0 and killing the TNT. This does require mobGriefing=false, though
Comment: Have you made any attempt to solve this yourself? Arqade works better when askers show effort to solve their own problems; we see that you have a problem you've worked on, and answerers respond to that. You also get a more specific answer that's tailored exactly to the part you're stuck, and Arqade gets a very specific question. Everybody wins!
Answer: Similar to Unionhawk's comment:
you should run three commands one after the other:
Do gamerule mobGriefing = false**

1 tick delay
Summon Creeper fuse 0 at Tnt

3 ticks delay
Do gamerule mobgriering = true

Answer: Method #1:
On a fast Redstone clock / using Repeat Command blocks, put this command:
/execute @e[type=PrimedTnt] ~ ~ ~ summon Creeper ~ ~ ~ {powered:1}

Then, with a Comparator, execute this command to kill the TNT:
/kill @e[type=PrimedTnt]

Note: Before you do this, you would have to run this command:
/gamerule mobGriefing false

Method #2:
Repeatedly run these commands in Command blocks (repeat as fast as you can):
/execute @e[type=PrimedTnt] ~ ~ ~ summon ArmorStand ~ ~ ~ {CustomName:"RudolfJelinek"}

/execute @e[type=PrimedTnt] ~ ~ ~ setblock ~ ~ ~ minecraft:water

And when the Comaparator leading from one of the CMD blocks above does not output signal, execute these commands:
/execute @e[type=ArmorStand] ~ ~ ~ setblock ~ ~ ~ minecraft:air

/kill @e[name=RudolfJelinek]

Comment: The armour stand is there so you can execute commands at it even when all other entities are gone. If the armour stand wasn't there, there would be no way to clean up the water after the tnt exploded (unless you knew the exact cords everytime).
Comment: This is what I want! But can I know why you need to summon ArmorStand?
Answer: There's an easier solution to this, relying on the rule that immerged TNT doesn't explode blocks but do damage to entities :

Place a water block :

setblock X Y Z minecraft:water

Summon an instant-exploding TNT at this location :

summon minecraft:tnt X Y Z {Fuse:0}

You can remove the water block afterwards, but after a little delay, otherwise TNT would explode and destroy blocks.


Missing I (1st) chord in the progression: an example

Question: Could you indicate an example of a song in a certain key that doesn't express the tonic chord (I chord) in its progression? Are harmonic progressions of this type possible in pop music?
Comment: Would you be willing to edit your question to emphasize your last sentence? Otherwise, it may risk getting closed, since the first question is not well-suited for our site (since there are countless acceptable answers).
Comment: I initially misread the question and answered thinking you were asking for songs that don't start on the tonic but you want songs than actually have no I chord at all! I'll see if I can think of one...
Comment: I remember hearing that If you get deep into Chord Cycles, there maybe several explainations of what the tonic is. I might as well say `Em - C - G - D` has the tonic `G` instead of `Em` and justify my reasoning saying `D - Em` is like `V - I` except instead of `I` there's a chord from the tonic group which is `vii`, but someone else might say something else. With that said there maybe several explainations of a different chord being Tonic and that chord not apprearing at all in some cases. `Am - G - F - G` with tonic `C` for example with a similar reasoning.
Comment: If what I've learned about [primitivism](https://academic.udayton.edu/phillipmagnuson/soundpatterns/microcosms/primitivism.html) is any indication, *there is no such thing as a tonal piece with no tonic chord/note in it* - if you think you've found an example, you got its key wrong. The most common note or chord sounds like the tonic. Even for pieces that I think sound like they're soloing on the dominant of a minor key, I've read valid interpretations that they *are* in that dominant's key instead.
Answer: There are a few although they may be open to interpretation. Two are very similar, "Dreams" by Fleetwood Mac and "Teenage Dream" by Katy Perry. Both sound like unresolved IV-V vamp progressions (Perry's has a quick vi between the IV and V). The melodies of each are grounded in the non-existent I chord. Maybe not having a tonic is a "dreamy" sound, that would explain the titles.
Another similar one is "I'll Be Around" by the Spinners. It is two chords, Emaj7 and D#m/F# with a G# minor pentatonic melody so you can think of it as a VI-v6/4 that never resolves to  the i.
To me the Marvin Gaye/Tammi Terrell version of "Ain't No Mountain High Enough" sounds like the key of D with no tonic chord. Some might say it's in Bm but it doesn't sound like that to me. In the Supremes' version they do a different arrangement in Eb and do resolve to what I consider to be the tonic on the final choruses, Eb. They never go to the D in the Gaye/Terrell version.
The chorus on this one is (analysis is in D):
Gmaj7 Em7 | F#m7 Bm7 | Gmaj7 Em7 | F#m7 Bm7 | Gmaj7 Em7 | F#m7 Bm7 | E7  | G  |
This sounds to me like: IV ii iii vi (x3) then II7 IV.
Answer: A great example of this is Chopin's Prelude in E Minor, Op. 28 No. 4. The root position i chord is not heard until the very final chord of the piece.1

Another example is Robert Schumann's "Der Dichter spricht" ("The Poet Speaks"). The piece is in G Major, but again, the root position G major chord is only heard at the very end.

A classic example from Jazz is "Autumn Leaves" (Joseph Kosma/Johnny Mercer). It's in E Minor, but that chord only appears at the end of the A section(s). The song opens with a ii-7 V7 IMaj7 in G Major.

1 Technically, the piece does start with a i chord, but it's obscured by appearing in first inversion. The work is considered a classical example of Romantic-era composer's attempts to express the key of a composition without explicitly stating it.
Comment: I count inversions of the tonic chord as tonic chords. I've always heard Chopin's Prelude in E Minor, Op. 28 No. 4 as starting in E Minor (and, when the starting theme returns, the piece is also in E Minor at that point).


Is triple-strands or multiple-strands DNA possible?

Question: Before the double helix DNA was discovered by Watson and his colleague, they theorized the existence of a triple-strands DNA and its properties. Is multiple-strands DNA possible perhaps by manipulating the structure of a double helix DNA with science? Multi means more than 2
Comment: Note than in the double helix, only half of the chain provides information (the other half is formed by the "complementary" nucleotide, so you can derive it from the original one. It seems that the main function of the double helix is protection and control of the generation of ARNm.
Comment: I feel the need to say that this might be more at home on the biology SE. While it is still on topic here you might consider asking it there for a more scientific answer.
Comment: @DustinJackson Please be careful to not encourage cross-posting, particularly if the user might not have much experience with how the network works. Better to suggest flagging a question for moderator attention and requesting migration if so desired.
Comment: @MichaelKjörling Not what I intended, but I now see that my choice of words was poor :)
Comment: @DustinJackson It's okay, no harm done in this case. Just something to keep in mind for future occasions.
Answer: There has been a claim that 4-strand DNA structures exists in nature, in fact in human cells. University of Cambridge article. The link to the the original paper in Nature seems to be broken though. I am pretty think the Nature paper was more detailed, but it is not my field.
I should also note that there is no evidence of a complete organism based on using triple or higher strands of DNA. But the scientists claimed they had stablized the quad strand DNA, so it would appear to be viable at a molecular level.
Though the Cambridge article is limited (as were the others I checked), there were some interesting details:

The findings mark the culmination of over 10 years investigation by scientists to show these complex structures in vivo – in living human cells – working from the hypothetical, through computational modelling to synthetic lab experiments and finally the identification in human cancer cells using fluorescent biomarkers.
  The research, published today in Nature Chemistry and funded by Cancer Research UK, goes on to show clear links between concentrations of four-stranded quadruplexes and the process of DNA replication, which is pivotal to cell division and production.

...

"The research indicates that quadruplexes are more likely to occur in genes of cells that are rapidly dividing, such as cancer cells. For us, it strongly supports a new paradigm to be investigated – using these four-stranded structures as targets for personalised treatments in the future."
  Physical studies over the last couple of decades had shown that quadruplex DNA can form in vitro – in the 'test tube', but the structure was considered to be a curiosity rather than a feature found in nature. The researchers now know for the first time that they actually form in the DNA of human cells.*

...

While quadruplex DNA is found fairly consistently throughout the genome of human cells and their division cycles, a marked increase was shown when the fluorescent staining grew more intense during the 's-phase' – the point in a cell cycle where DNA replicates before the cell divides.
Comment: See also [4-Strand DNA](http://www.scientificamerican.com/article/four-strand-dna-structure-found-cells/)
Answer: It is possible but impractical.
Double-helix DNA's structure is something like this:
$$ \text{B — (A/C/T/G) : (T/G/A/C) — B} $$
where B is a backbone molecule, A/C/T/G is adenine/cytosine/thymine/guanine, — is a molecular bond, and : is a hydrogen intermolecular bond.
What's important here is the molecule connecting the strands: since it's only connecting 2 backbones, it's a relatively simple molecule.

3-way DNA I can't accurately represent with MathJax, so here's a picture:

In this diagram, a line is a molecular bond, a dotted line is a hydrogen intermolecular bond, B remains the same, H and N are hydrogen and nitrogen, and (AF/CF/TF/GF) is some variation of (A/C/T/G) where the molecule must incorporate a fluorine molecule on the outside of the molecule.
The part in the center is $\text{NH}_3$, which I have picked purely because it has 3 outer hydrogen molecules. These hydrogens form hydrogen intermolecular bonds with the fluorine atoms in (AF/CF/TF/GF).
There are relatively few 3-way molecules like $\text{NH}_3$, so 3-way DNA is more difficult and more fragile than 2-way.

4-way DNA is also possible: substitute $\text{NH}_3$ in the diagram for $\text{CH}_4$, methane, which has 4 outer hydrogens and can thus form intermolecular bonds with 4 (AF/CF/TF/GF) - B groups.

The major point to note here is that DNA is the way it is because it's simple: 2-way DNA does not require another molecule in the middle like my representations of 3- and 4-way DNA do. While my ideas are probably not optimal, 2-way DNA is both simpler and stronger than any other type.
(Also, DNA helicase (one of the enzymes that process DNA) would have a hard time adapting for 3- or 4-way DNA.)
Answer: It is possible to produce triple stranded genes using some variation of DNA, PNA, XNA, etc.  I recall reading about PNA as a third strand as a possible means to bootstrap our modern DNA scheme.
I doubt three-stranded genes would be found in a life system of a mature planet ecosystem. It would evolve toward simplicity, and lose one.
But, that's a way of having an intermediate step offering the possibility of changing the encoding system.  E.g. an asymmetric Peptide-Ribo two strand system is good for early days because it is easy to emerge from RNA-world and has high matching affinity.  But symmetric DNA is better after various other mechanisms mature and the cell gets more complex. So it first gains a 3rd strand, changes the RNA to DNA, then loses the PNA.
Answer: The real problem with multi strand DNA isn't so much if it is possible (Dr Science can do some pretty freaky stuff in the lab), but how it would work in the natural environment.
To put it bluntly, if there were some evolutionary advantage to 3 stranded DNA, then there would need to be some means of combining it during reproduction: 3 parents would be needed. If this means 3 different sexes are needed is probably up to you as an author, a more likely scenario is two "male" parents and a "female" parent. (Star Trek gets it wrong with their "Species 8472" since they claim 5 genders but only 3 strand DNA. Unless their reproduction includes phases where they burrow into a host like parasitic wasps, this is hopelessly inefficient, and since two of the genders are not represented in the DNA, why would they evolve in the first place? A five gendered species would have 5 strand DNA.)
Comment: That is not how dna works. You do not get one strand of the double-helix from each parent - you get full chromosomes from each parent (excluding abnormalities where the offspring get only one or 3 or even 4). Additionally, there are many species in the real world with more than 2 sexes (some fungi have thousands) - this does not mean that every sex is needed for reproduction, just that there are many compatible potential mates of different kinds.


OS X Yosemite - cannot remember Keychain access password

Question: Is there any way to recover this?  Can I change it without knowing my current password?
Answer: No. You cannot recover the contents of the keychain without the password. There is no way to reset the password retaining the keychain data.

If you want to access a login keychain after changing user's password, the keychain will still be accessible using the old password.
If the problem is reappearing password prompt after a login password change, you can delete and recreate the keychain, but the original data is non-recoverable.


Cutting a 2mm wide / 3mm deep groove

Question: How can I cut a groove between say 1.5mm to 2.5mm wide using the Dremel Cutting guide in the 565 kit? The cutting bit 561 is too wide at 3.2mm.
Comment: If you want an answer to the question, "how can I make a 2.5mm groove in wood", then [edit] the question and tell us how you intend to groove the material. It matters if you are grooving along a length, or really long pieces width-wise, etc. Maybe show a sketch of what you want, and let the hive-mind come up with solutions to the problem. Otherwise, this is a shopping question or maybe an X-Y question.
Comment: I'm voting to close this question because it is a "shopping" question
Comment: If Dremel doesn't make it, you might have to look for an aftermarket solution; either with some adapter or smaller cutting tool. You are just as likely to find this online as we are.
Comment: This sounds like you just need someone to help you find a 2mm 1/8" shank router bit.  This type of "shopping" question is considered off-topic so I'm going to vote to close it.  That said, there are plenty of places that you can get things like that.  Right off the cuff I'd suggest MicroMark or StewMac.
Comment: Two words: scratch stock. Your project will be done before a bit arrives, even with next-day delivery (if that's still a thing during the pandemic).
Answer: Is cutting bit 561 the smallest that is made that you can chuck into your Dremel? Find a narrower bit - it might not be made by Dremel.
Try a hobby store - model railroading/RC aircraft, not woodworking. They'll have absolutely tiny bits, there's bound to be something that will do the trick. It may take multiple passes to get to your desired width/depth. You might have to buy a whole new toy er, tool to do it, but if you really need a groove that small, that may well be what it takes.
You could also probably do it with a hand saw. I believe some of the Japanese saws are pretty thin, with some searching you could probably find one that fits the bill.
If you're absolutely sold on using the Dremel and can't find a cutter small enough, you may just be out of luck.
Answer: There is a whole world of CNC bits with 1/8" shanks that will work for this. Here's just one link:
https://www.ebay.com/str/CARBIDE-PLUS/DIAMETER-070-0799/_i.html?_storecat=50046017013
You can probably find individual bits on Amazon or visit Kyocera online. As mentioned you should specify what material you're working with for more relevant replies.

Cutting a 2mm wide / 3mm deep groove


What's the best free software to learn "Touch-typing"?

Question: I am not a fast typist, but I want to be one for academic purposes. So I am looking for a free typing tutor by which I can learn "touch typing" to type faster in minimum time with maximum efficiency and accuracy.
Thank you.
Answer: The software may not be the key to your success. Please consider the following and then perform a search for "free typing tutor software."
Prepare for the self-instruction by purchasing a "cast-off" keyboard. An inexpensive, used keyboard can be found at thrift shops and similar places. Ensure you have the proper connection, typically USB, to avoid the seldom-used PS2 round connector. Your computer should be able to manage two keyboards connected simultaneously.
Note that the F and J keys have raised nubs (redundant?) which are used to provide tactile reference for your index fingers. Part of a good lesson plan will present to you the keys to use for specific letters. If that is not part of the program, consider to locate a better software package.
Additionally, it is important to obscure the keys to prevent you from looking at them to locate them. The key to effective typing is muscle memory, which can build quickly with a well-written program and user determination.
I've painted keyboards for friends to obscure them, but one "student" devised a different method. The keyboard was encased in a cardboard box, sized and hot-glued to provide sufficient hand movement, but full blocking of the keys.
But wait, there's more. Provide something for your eyes as well. In the case of the cardboard box user, a printed image of the keyboard was attached to the top of the box, with a dot on the F and J keys as a reminder. For the painted keyboard users, it was a simple matter to have the original keyboard on the desk above the painted one.
The box method has the advantage of not requiring one to purchase an additional keyboard along with the chore of painting it, while the painted keyboard means one does not have to print out an image of the keyboard.
Devote no more than one hour to your lesson plan with at least a few hours between lessons. If you feel you are getting weary, take a break for a day. You will find that a good portion of your previous lesson work will return more quickly when you are rested.
In the process of a quick search for free software, I also discovered online resources for learning to type. One such site is https://www.typingclub.com/sportal/ but this is not a recommendation. On the paid software side, Mavis Beacon Teaches Typing has been around almost as long as there have been personal computers. It's not particularly expensive and has a good lesson plan.
Answer: I recommend Tuxtyping. It's free. It's fun. It's cross-platform. It has multiple options. It helps.
There might be better options out there, but this is the best one I know about.
Website: http://www.tux4kids.com/tuxtyping.html
To install it on Ubuntu (a Linux distribution), do sudo apt-get install tuxtype.
Answer: I ended up using Keybr . It really helped me a lot .
It automatically adjusts your lessons as you progress . It emphasizes on your weak points and help to improve them . There are different layouts according to your preference . You can set a daily goal time to practice everyday .You also get detailed statistics about your typing .
There are also multiplayer mode and typing tests to compete yourself with other players .It is completely free and web based , so you don't need to install anything . you need only email for a persistent account and no password needed .
Comment: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).
Answer: My young daughter successfully used KTouch - https://apps.kde.org/de/ktouch/ .

comes with courses that build from learning the individual keys to complex texts
tracks your progress
has an on-screen keyboard (that can be disabled) to train you not to look at your physical keyboard, optionally highlighting the key you need to press
free software (GPL)

It only runs on Linux, though.


Histosketch vs Count-Min sketch: preserving similarity

Question: A preprint describing a new tool and its application to microbiome analysis was recently published in bioRxiv[1]. At the core of this new tool, HULK, is a new data structure called a histosketch[2] which is similar in spirit to CountMin sketches and MinHash sketches that have become quite popular in bioinformatics in the last several years.
One of the main advantages the histosketch authors claim over CountMin sketch is that CountMin sketches do not preserve similarity. From section II of their paper[2] (emphasis mine):

It is practically difficult to compute histograms for data streams with typically unknown cardinality and which thus require and unbound amount of memory to maintain the histogram. In this context, the count sketch and the count-min sketch and other online histogram building methods were proposed to approximate the frequency table of elements (i.e., histograms) from a data stream with a fixed-size data structure. However, the resulting sketches do not preserve similarity between different data streams.

In what sense does the CountMin sketch not preserve similarity between streams? Does this refer to similarity at intermediate states (while data is still streaming) or does it refer to inherent characteristics of the data structure itself?

[1] Rowe WPM, Carrieri AP, Alcon-Giner C, Caim S, Shaw A, Sim K, Kroll JS, Hall L, Pyzer-Knapp EO, Winn MD (2018) Streaming histogram sketching for rapid microbiome analytics. bioRxiv, 408070, doi:10.1101/408070.
[2] Yang D, Li B, Rettig L, Cudré-Mauroux P (2017) HistoSketch: Fast similarity-preserving sketching of streaming histograms with concept drift. Proc. IEEE Int. Conf. Data Mining, doi:10.1109/ICDM.2017.64.
Answer: Answer from @user172818, converted from comment:
My understanding is that you can't compute Jaccard similarity given two count-min sketches. You can with two histosketches, though I don't know exactly how yet.


Kubernetes config: on code repo vs on helm charts repo

Question: Helm is advertised as pretty much "the way to manage the deployment of apps on k8s".
We have microservices whith a 1-to-1 mapping of code repo and deployable, and I would find it much more convenient to have the k8s config map along with the code, so that they evolve together, e.g. when adding a new environment variable for a feature flag.
However, we maintain instead a single helm charts git repo, that would need to be occasionally updated in sync with the code.
What is the best practice:

When to use helm charts? Is it applicable when having 1-to-1 mapping of code repo and deployable? Or mainly to coordinate deployment of composite apps?
Have you been using successfully helm chart per repo (isntead of a single repo for all charts)?
If using vanilla k8s config map for configuring the deployment out of a git repo, what issues have you faced? I.e. when do you start needing helm?

Hope it is not too generic or opinionated, but happy to edit to make it more concrete.
Comment: Do you have any constraints for your project? Understanding them may help to provide more accurate answer.
Answer: We've encountered some of these same questions on the Activiti cloud project so can answer based on my experience:

1 When to use helm charts? Is it applicable when having 1-to-1 mapping of code repo and deployable? Or mainly to coordinate deployment of composite apps?

If you find yourself needing different configurations for different environments then helm can be useful. Even more useful if you've got external consumers who also want to use your deployables and deploy with them to their own environments or extend or further configure the deployable.

2 Have you been using successfully helm chart per repo (isntead of a single repo for all charts)?

We have done this for some purposes and it's the default if you work with Jenkins-X, which gives you an opinionated kubernetes cluster set up for a particular way of doing CI/CD. It includes a chartmuseum in that cluster and when you build an app in Jenkins-X using its default pipeline then the chart is published to the internal chartmuseum.
However, we've also used a single repo. That is a natural way to go if you're hosting your charts using a github pages repository as it makes it easier to build the chart packages and publish them if the source is in the same place as where they are hosted. I don't think this is necessary though - if you set up your CI to do so you should be able to add packaged charts to the docs directory and re-index the repo. It would mean that your CI for each project would need to make commits to the helm repo project.

3 If using vanilla k8s config map for configuring the deployment out of a git repo, what issues have you faced? I.e. when do you start needing helm?

As with 1, you really get value if you need to be able to change config at deploy time (e.g. to set a url that is specific to a cluster) or distribute to allow others to create new packages that override the defaults. It might also help to be able to externalise some config as deploy-time parameters so that specific parameters don't have to live in git (e.g. you might want to do this with certain passwords).


How to import bookmarks from Chrome or Safari into Opera 19 for OS X?

Question: I've just installed Opera 19 on OS X Mountain Lion and I don't find how to import my Bookmarks from Safari or Chrome. On Windows menu the voice "Import Bookmarks" is deactivated
Answer: The migration from other browsers to Opera is not ideal. This will hopefully improve soon, but in the meantime some manual work is required.
To export from Safari, open the File: Export Bookmarks menu. The resulting HTML file can be opened directly in Opera as a kind of portal page with all your bookmarks. The same method can be used from Firefox and Chrome.
You then have three options:

Open the HTML page and drag each link from these HTML pages onto the bookmarks bar or Speed Dial
Install the Bookmarks Manager extension and use it to manage your bookmarks. It can import directly from the exported HTML files.
Import the HTML files into Chrome. Move all the bookmarks to the Bookmarks bar in Chrome using the Bookmarks Manager. Then manually copy the ~/Library/Application Support/Google/Chrome/Default/Bookmarks file to ~/Library/Application Support/com.operasoftware.Opera/Bookmarks (quit both apps first!)

Not ideal, but all methods will get your bookmarks into Opera.
Hope these methods can be an acceptable. I hope that by the time others find this post using a search-engine, there will be a more user-friendly approach available.
Good luck!
Disclaimer: I am an employee of Opera Software, however, this comment represents only my own views and whatnot.
Answer: Disclaimer: This is for Windows, have not tried this on OSX.
Opera 18/19 doesn't have a "Manage Bookmarks" option at this point and thus you cannot easily from within opera import your bookmarks.
Since the reboot of the Opera browser which now is based on Chrome you will have to do this manually.
They are now storing the Bookmarks in a db-file located at C:\Users\user\AppData\Roaming\Opera Software\Opera Stable in a file called bookmarks
I do not know if this is possible to import bookmarks at this time at all. I did manage to edit in new bookmarks in this file how ever. I just copy pasted on bookmark, then changed "name" and "url".
The "bookmark"-code looks like this:
{
   "checksum": "bf09e07c5302ee15844dafbeaa57513a",
   "roots": {
      "bookmark_bar": {
         "children": [ {
            "children": [ {
               "date_added": "13036440856757495",
               "date_last_visit": "0",
               "description": "",
               "guid": "4750048B-1349-420F-B8FA-286EF2E917C7",
               "id": "3",
               "name": "Where are the bookmarks in Opera 18? - Opera browser - Opera Community",
               "nickname": "",
               "type": "url",
               "url": "http://my.opera.com/community/forums/topic.dml?id=1789322"
            }, {
               "date_added": "13036441355489304",
               "date_last_visit": "0",
               "description": "",
               "guid": "63F6728C-B8CA-49DD-90F1-A6CCAF4BCFA0",
               "id": "4",
               "name": "facebook",
               "nickname": "",
               "type": "url",
               "url": "https://www.facebook.com/"
            }, {
               "date_added": "13036441355489304",
               "date_last_visit": "0",
               "description": "",
               "guid": "63F6728C-B8CA-49DD-90F1-A6CCAF4BCFA0",
               "id": "4",
               "name": "Google",
               "nickname": "",
               "type": "url",
               "url": "https://www.google.se/"
            }, {
               "date_added": "13036441418005285",
               "date_last_visit": "0",
               "description": "",
               "guid": "EDA1AF94-DDE0-4D5D-996D-5851A7E2F9D3",
               "id": "7",
               "name": "How to import bookmarks from Chrome or Safari into Opera 19 for OSX? - Super User",
               "nickname": "",
               "type": "url",
               "url": "http://superuser.com/questions/714480/how-to-import-bookmarks-from-chrome-or-safari-into-opera-19-for-osx"
            } ],
            "date_added": "13036440853441495",
            "date_modified": "13036441418005285",
            "description": "",
            "guid": "5D44B413-AF8F-40CC-8A19-5EC228479516",
            "id": "2",
            "name": "Test",
            "type": "folder"
         } ],
         "date_added": "13036440645256151",
         "date_modified": "0",
         "description": "",
         "guid": "739DAED2-A313-4346-837C-A2E0F296DD67",
         "id": "1",
         "name": "Bookmarks bar",
         "type": "folder"
      },
      "other": {
         "children": [  ],
         "date_added": "13036440645256151",
         "date_modified": "0",
         "description": "",
         "guid": "4750522C-8EBE-41AD-A6F0-84158E73B6BE",
         "id": "5",
         "name": "Other bookmarks",
         "type": "folder"
      },
      "synced": {
         "children": [  ],
         "date_added": "13036440645256151",
         "date_modified": "0",
         "description": "",
         "guid": "4749DD7D-7FDB-40F9-BD91-19BE53571935",
         "id": "6",
         "name": "Mobile bookmarks",
         "type": "folder"
      }
   },
   "version": 1
}

More on the latest version of Opera: http://betanews.com/2014/01/28/opera-19-adds-bookmarks-bar-hardcore-mode/
Comment: Unfortunately, I can't find that file on OSX..
Answer: I've located a different way to do this.
You can install Opera 12, from there you can export by doing: Go to Bookmarks → Manage bookmarks → File → Export as HTML and save. this exports bookmarks as a Netscape-format HTML file.
When you've done this you can import that file with an extension called Bookmark Manager which you can find here: https://addons.opera.com/en-gb/extensions/details/bookmarks-manager/?display=en
I am not sure if this is also a Windows only solution, but seems easier than the previous suggestion. I know that there are some OSX versions of Opera which has Export bookmarks as HTML... option.


Bezier curve in f(x) form

Question: I'm trying to get a cubic bezier curve (four points) implementation in f(x) form. Obviously bezier curves aren't perfect functions, but if the last two points are within a square made between the first and second point then they are. I'm really not that great with maths - I barely understand the implementation of a normal bezier curve, and I have no idea how or if you can equate things together to get such a function. i.e. y = f(x).
That being said, I don't necessarily need a bezier curve, I just need a curve that goes from one point to another where I can define the gradients at both points. I've tried to mess around with mathematics to get such a function, and I managed to get a function which drives at the appropriate gradients, but not the appropriate height.

y = m1*x^2 / 2w + w(m1 - m2*x/2)

This function has (0,0) with gradient = m1
and (w, y) gradient = m2
The problem is that I can't figure out how to get the height between the two points into the equation. I had a method for another equation, where the new function was f(x) * h / f(w), but in this case that changes the gradients of the points in question.
Answer: Bezier spline is a parametric function of t and control points (four in case of cubic Bezier spline)
P(t) = f(t, P1, P2, P3, P4)
More precisely for 2D case:
    x(t) = (1 - t)^3*x1 + 3*(1 -  t)^2*t*x2 + 3*(1 -  t)*t^2*x3 + t^3*x4
    y(t) = (1 - t)^3*y1 + 3*(1 -  t)^2*t*y2 + 3*(1 -  t)*t^2*y3 + t^3*y4

where t in [0, 1].
It will be hard to express y(t) through x(t) as it's multiple-valued function in general case.

Bezier curve in f(x) form


Django Filename Generation Issue

Question: I have a Django based media server that accepts a variety of video formats for upload. While uploading a large .wmv file, I noticed some strange behavior. The first time I uploaded the video, it took almost five minutes to convert and upload. Thereafter, some sort of caching occurred, and the video would merely point to the one I had previously uploaded. I don't understand why this is happening. When a video is uploaded, the file name extension is checked for conversion purposes, and then an ffmpeg command is executed to carry out the conversion. This is all run asynchronously, using django-celery with RabbitMQ as the message broker. I don't see any reason why the ffmpeg conversion command would not execute again. Here is my code for the celery task that handles the upload. (This was my initial reasoning, look at the EDIT for the correct error diagnosis)
<code>@celery.task
def handleFileUploadAsync(update, m, file_type, video_types):
    filename = m.file.name.replace(' ', '\\ ')
    if video_types[file_type] == 'wmv':
        os.system(
            "ffmpeg -i " + MEDIA_ROOT + filename + " -strict experimental -vcodec libx264    -profile:v baseline " + MEDIA_ROOT + filename.replace(video_types[file_type],'mp4')
    )
        m.file.name = m.file.name.replace(video_types[file_type], 'mp4')
        m.save()
        os.remove(m.file.path.replace('mp4', 'wmv'))
    elif file_type in video_types.keys():
        os.system(
         "ffmpeg -i " + MEDIA_ROOT + filename + " -vcodec libx264 -profile:v baseline -s 672x576 " + MEDIA_ROOT + filename.replace(video_types[file_type],'mp4')
        )
        m.file.name = m.file.name.replace(video_types[file_type], 'mp4')
        m.save()
        if video_types[file_type] != 'mp4':
            os.remove(m.file.path.replace('mp4', video_types[file_type]))
</code>
EDIT:
Here's the problem. When I convert videos, I only want the converted .mp4 file, not the original upload. Django generates filenames from the file upload field, automatically appending numbers to the end of existing files (i.e. test.mp4, test_1.mp4, test_2.mp4, etc.). However, when I upload a video like test.wmv, there will be no file named test.wmv after the conversion is complete (I delete the non-converted file). Is there any way I can modify Django method that generates these filenames??
Answer: Use upload_to when declaring the FileField. Maybe use the object's primary key as the filename?

Django Filename Generation Issue


Calculate voltage with voltage divider

Question:
I'm very confused when I have to find voltage at different resistors terminals. How do I do it? Series-parallel circuit.
For example v01 at R2 terminals and V02 at R4 terminals
Comment: Can you calculate the total current draw from the 12 V supply? Can you calculate how much current is flowing in each branch?
Comment: The total current will be 6mA = 0.006A not 6A. Yes, you need to use Kirchhoff's.
Comment: I know that the total current is 6A, I just used Ohms Law, But I thought I need to use voltage divider. Anyway, I dont know How to calculate current in each branch. do I need to use Kirchoff?
Comment: Of course, you can use voltage divider \$V_{01} = V_I \frac{R_2||(R_3 + R_4)}{R_1 + R_2||(R_3 + R_4} = 6V\$ and \$V_{02} = V_{01}\frac{R_4}{R_3 + R_4 } = 3V\$
Comment: Everything is a voltage divider if you allow difficult enough expressions, but in this case you could solve it as just voltage dividers. If I were your teacher, I wouldn't mind. Please try.
Comment: So Basically V01 is R234 divided by the total resistance, and v02 is just a simple voltage divider that begins from v01
Answer: You can approach this from the right to the left using elemental voltage divider methods. Or set up two equations using KCL and solve that using Cramer's rule, if solving by hand or just using a solver, otherwise. And that's not the limit of approaches you can use, by any stretch.
Let's go from right backwards to the left.
On the right side, you have a voltage divider formed by \$R_3\$ and \$R_4\$. Here, \$V_{O_2}=V_{O_1}\cdot\frac1{1+\frac{R_3}{R_4}}\$ and its load impedance is \$R_{O_2}=R_3+R_4\$.
Next, you have a voltage divider formed by \$R_1\$ and \$R_2\$ but with an added load (in parallel with \$R_2\$) of \$R_{O_2}\$. So here, \$V_{O_1}=V_{I}\cdot\frac1{1+\frac{R_1}{R_2\,\vert\vert\, R_{O_2}}}\$.
So the complete symbolic-form answer is:
$$\begin{align*}
V_{O_1}&=V_{I}\cdot\frac1{1+\frac{R_1}{R_2\,\vert\vert\, \left(R_3+R_4\right)}}
\\\\
V_{O_2}&=V_{O_1}\cdot\frac1{1+\frac{R_3}{R_4}}=V_{I}\cdot\frac1{1+\frac{R_1}{R_2\,\vert\vert\, \left(R_3+R_4\right)}}\cdot\frac1{1+\frac{R_3}{R_4}}
\end{align*}$$
The main thing to note is that the right-side divider is itself unloaded, so it solves as a simple voltage divider problem, but that this right-side divider does load down the left-side divider, and that fact has to be accounted for when working out the left side.
In your approach, you find that the total load impedance is \$2\:\text{k}\Omega\$. If so, then you should recognize that the source current will be \$\frac{12\:\text{V}}{2\:\text{k}\Omega}=6\:\text{mA}\$. This means that \$R_1\$ must drop \$6\:\text{V}\$ across it, leaving \$V_{O_1}=6\:\text{V}\$. That current will equally split between \$R_2\$, which is \$2\:\text{k}\Omega\$ and the series pair, \$R_3+R_4=2\:\text{k}\Omega\$. So there will be \$3\:\text{mA}\$ through \$R_3+R_4\$ and each will drop exactly \$3\:\text{V}\$. So, \$V_{O_2}=3\:\text{V}\$. So, your approach works fine.
Answer: Here's how I "see" such circuits:

simulate this circuit – Schematic created using CircuitLab
Then

simulate this circuit
Ok, so VO1 is a mid-point of a 1k:1k voltage divider from 12V - so VO1=6V.
Now that we know VO1, we can use that fact:

simulate this circuit
Once we know VO1, we stick a voltage source in there - it reflects the potential present at that point in the circuit. Adding this source to the original circuit changes nothing, since no current flows through that source. VO1 is now held fixed at 6V by the source, and we can remove any components in parallel with that source - they don't change any voltages.
After removing R2, there then is a current flowing through VO1, but so what - it's an ideal voltage source. The voltage is fixed no matter the current. Then we're left with VO2 being is 6V divided down by another 1k:1k divider - and is 3V.
The values in this circuit were chosen specifically to facilitate the transformations I've performed above. It's not a coincidence that the numbers "work out" so nicely. It's by design in this case. That's what authors of teaching materials - be it textbooks or teachers - deal with :)
This circuit is a "cut down" version of the R-2R ladder used in some DAC converters.

If you'd want to simulate the circuit, only one variant should be left, and the others removed from the schematic, since:

SPICE disallows repeated reference designators, and
the nodes labeled GND (triangle symbol), VO1 and VO2 are respectively connected together between the circuit variants as shown.

That's why simulation won't work as-is. But as soon as you delete two circuits that you don't care about from a simulation, and leave one left, everything will work as expected. CircuitLab does "dynamic" DC analysis - it shows DC operating point without having to run simulation. Just mouse over points in the circuit and voltages and/or currents will be displayed.
Comment: Thank you everyone for the answears!! It did clarify things for me

Calculate voltage with voltage divider


Routing access point internet through PC on same network

Question: I have just bought a Cisco wireless access point (Cisco Wireless-N Access Point WAP4410N). It is connected to the same network as my computer. My devices can connect to the access point and get internet access, but what I want to do is have their connection go through my computer. To do this I have set the gateway of the access point to my computers IP however this does not work. What do I need to do to set this up?
Comment: You don't want to set the AP's gateway, but the connected devices'. I assume they're getting their IP configuration via DHCP from some Internet gateway device...? If you really *need* to route your traffic this way, you'll probably want VLANs.
Comment: What do VLAN's have to do with it? VLAN's are a layer 2 construct, not a layer 3 construct. VLAN's don't provide routing capability but instead impose a need to implement inter-VLAN routing. I don't see how VLAN's are at all related to the problem or the solution.
Comment: Your computer need to be configured as a router and the devices need to be configured to use your computer as their Default Gateway.
Answer: Short answer: You need to set the gateway IP address on each of your wireless devices to point to your computer's IP. Assuming, of course, that your computer is set up to forward IP traffic.
Long answer: A wireless access point is not a router, but basically a network switch. Thus it operates on a lower level than a router and merely pipes through layer 2 network traffic. It does not know, or care about, IP addresses (other than for its configuration interface). In fact you could run non-IP protocols over it.


Remove duplicated items in Arc attribute table?

Question: I have imported a set of points into ARCmap using a kml file created in google earth. During this process, a number of the points were duplicated (see below). Is there a way to get rid of the duplicated points in arc rather than recreating the kml file which will be hugely time consuming?
Comment: Note that the Identical tools given in both current answers require an Advanced license.
Comment: If you don't have an Advanced license, you can play around with the Summarize tool to find duplicates.  It does require some scripting or manual work to remove them however.
Answer: Use the Delete Identical tool. In the syntax you specify the field you want to look for duplicates in and ArcMap deletes all but one of them automatically. You can also use the Find Identical tool to just find the identical features and delete them manually if you would like to check the results yourself.
Answer: There is a tool called Find Identical (Data Management) that does exactly what you are after.  The tool adds a new field to the output feature class indicating the status.
Answer: Use this python script at field calculator to find identical itens and then delete them. Create first a field (e.g 'duplicate') of short type. Then using field calculator use the python script bellow:
d = []
def isDuplicate(t):
    import string
    global d
    iD = 0
    for item in d:
        if item == t:
            iD = 1
            continue
    if iD == 1:
        return 1
    elif iD == 0:
        d.append(t)
        return 0

Also select 'codeblock' and use the code bellow replacing !YourField! for the field you just created (e.g. 'duplicated').
isDuplicate( !YourField!)
After running the above script the field created will have 1 for duplicated fields and 0 otherwise.
Comment: Simpler Python script code for field Calculator can be found here: https://gis.stackexchange.com/questions/183472/identifying-duplicate-attributes-using-arcgis-desktop
Answer: I was unable to make the  VB Script that was provided above work (don't see it now)  I did however have success  with the python script above using the field calculator. I'm using ArcGIS10.3

Add new field (type short) I named it dup.
Use field calculator on the new dup column.    Selected Python
    radio button and Show Codeblock check box in the field calculator.
Pasted the above python script in the Pre-Logic Script Code: window.
In the second isDuplicate window replace the isDuplicate(
    !YourField!) with the field you are checking for duplicates on.In
my case it was wells. isDuplicate( !wells!).

Thanks!


What does the phone do when it runs out of battery but it has an alarm scheduled?

Question: Does it power off completely or go into a deep sleep state?
Comment: Isn't this a self-testable question? A little experimentation, maybe? Then come back and supply your own answer?
Answer: No matter what, if there is no battery, there is no power to do anything, it is dead. But android saves the state of these even if you pull the battery. If power is restored before the scheduled alarm, it will still fire. (Assuming you are talking about the actual alarm app. It is feasible, but unlikely, that a poorly written app's alarm scheduling could fail with a power failure.)
However, if you restore power after the alarm has passed, the alarm will not fire.
TLDR: It can't be in a low power state, if there is no power. But it saves scheduled alarms, etc, to memory, so they are not lost.
Comment: But apparently some hardware manufacturers have built this feature into their phones, particularly the oppo one plus one : https://forums.oneplus.net/threads/power-off-alarm.300539/


Whats the last OS X that supported Power PC?

Question: I still have an old Power PC machine and was wondering what the latest OS X build I can install on it?
Answer:
Snow Leopard (OS X 10.6) is also the
  first Mac OS release since the
  introduction of System 7.1.2 that
  does not support the PowerPC
  architecture, as Apple now intends to
  focus on its current line of
  Intel-based products.

Thus OS X supported PowerPC up to and including version 10.5 (Leopard).
Answer: 10.5 Leopard is the last to support PowerPC as far as I know:
http://en.wikipedia.org/wiki/Mac_OS_X
Answer: Snow leopard does support PowerPC applications, this function was dropped with Lion. I base this on one MacBook with Snow Leopard on it works fine with Microsoft Office X, Quake II (OS XVersion), Halo, Roxio Toast Lite 5.2.2.
However on my upgrade MacBook running Lion they are tomb stoned and when you try to run them the message you receive is PowerPcC no longer supported!
Comment: OS X running on PowerPC *hardware* and OS X supporting PowerPC applications is not the same thing.


Android Log.v(), Log.d(), Log.i(), Log.w(), Log.e() - When to use each one?

Question: The different LogCat methods are:
Log.v(); // Verbose
Log.d(); // Debug
Log.i(); // Info
Log.w(); // Warning
Log.e(); // Error

What are the appropriate situations to use each type of Logging? I know that perhaps it's just a little bit of semantics and perhaps it doesn't really matter, but for LogCat filtering in Android Studio and Eclipse, it would be nice to know I am using the proper methods at the appropriate times.
Comment: Remember also the use of custom logs. They can be really useful when targeting specific scenarios.
Answer: Let's go in reverse order:

Log.e: This is for when bad stuff happens. Use this tag in places like inside a catch statement. You know that an error has occurred and therefore you're logging an error.
Log.w: Use this when you suspect something shady is going on. You may not be completely in full on error mode, but maybe you recovered from some unexpected behavior. Basically, use this to log stuff you didn't expect to happen but isn't necessarily an error. Kind of like a "hey, this happened, and it's weird, we should look into it."
Log.i: Use this to post useful information to the log. For example: that you have successfully connected to a server. Basically use it to report successes.
Log.d: Use this for debugging purposes. If you want to print out a bunch of messages so you can log the exact flow of your program, use this. If you want to keep a log of variable values, use this.
Log.v: Use this when you want to go absolutely nuts with your logging. If for some reason you've decided to log every little thing in a particular part of your app, use the Log.v tag.

And as a bonus...

Log.wtf: Use this when stuff goes absolutely, horribly, holy-crap wrong. You know those catch blocks where you're catching errors that you never should get...yeah, if you wanna log them use Log.wtf
Comment: wtf Stands for "What a Terrible Failure"
Comment: I did not believe `Log.wtf` I even checked couple of times and laughed really out loud .. In my opinion, All APIs should have something like this within
Comment: Who named those method? That is a terrible idea. I wonder how my team would appreciate if I named my stuff with only 1 letter names. Bet they would send me to hell?
Comment: Hey buddy! I finally find myself doing some Android work at Google. And I ran into this while trying to figure out how to log things. :)
Comment: I would suggest `Log.v` be used in conjunction with `Log.i`. Use `Log.i` to report a successful connection, then `Log.v` to give more details about that connection.
Comment: Is `Log.wtf` a joke or is it actually useful? As far as I can see the `wtf`-Method will kill the process by PID
Comment: Log.v is for `Verbose` logging. It what you use when you want to output every possible logical operation.
Comment: We have to just print the values at the console, it can be printed by any of the above! or we should learn using them each as a good programming practice ?
Comment: `Log.wtf` is used in Android Open Source Project. No surprise there.
Comment: Apparently `Log.wtf` will cause the app to crash silently. This may not be your desired outcome
Comment: Should I keep using a log in my end app version that goes to play store? Would I be able to see logs in play console, when I keep a log in my end version of app? Thanks
Comment: A couple of points worth mentioning: There's a `shouldLog()` method that you can use to determine if a log message will be filtered out. You can wrap expensive log calls with that. Also, I understand that there's a way to get Proguard to remove Log.d() and Log.v() calls from your executable for production.
Answer: The different methods are indications of priority.  As you've listed them, they're going from least to most important.  I think how you specifically map them to debug logs in your code depends on the component or app you're working on, as well as how Android treats them on different build flavors (eng, userdebug, and user).  I have done a fair amount of work in the native daemons in Android, and this is how I do it.  It may not apply directly to your app, but there may be some common ground.  If my explanation sounds vague, it's because some of this is more of an art than a science.  My basic rule is to be as efficient as possible, ensure you can reasonably debug your component without killing the performance of the system, and always check for errors and log them.
V - Printouts of state at different intervals, or upon any events occurring which my component processes.  Also possibly very detailed printouts of the payloads of messages/events that my component receives or sends.
D - Details of minor events that occur within my component, as well as payloads of messages/events that my component receives or sends.
I - The header of any messages/events that my component receives or sends, as well as any important pieces of the payload which are critical to my component's operation.
W - Anything that happens that is unusual or suspicious, but not necessarily an error.
E - Errors, meaning things that aren't supposed to happen when things are working as they should.
The biggest mistake I see people make is that they overuse things like V, D, and I, but never use W or E.  If an error is, by definition, not supposed to happen, or should only happen very rarely, then it's extremely cheap for you to log a message when it occurs.  On the other hand, if every time somebody presses a key you do a Log.i(), you're abusing the shared logging resource.  Of course, use common sense and be careful with error logs for things outside of your control (like network errors), or those contained in tight loops.
Maybe Bad
Log.i("I am here");

Good
Log.e("I shouldn't be here");

With all this in mind, the closer your code gets to "production ready", the more you can restrict the base logging level for your code (you need V in alpha, D in beta, I in production, or possibly even W in production).  You should run through some simple use cases and view the logs to ensure that you can still mostly understand what's happening as you apply more restrictive filtering.  If you run with the filter below, you should still be able to tell what your app is doing, but maybe not get all the details.
logcat -v threadtime MyApp:I *:S

Answer: You can use LOG such as :
Log.e(String, String) (error)
Log.w(String, String) (warning)
Log.i(String, String) (information)
Log.d(String, String) (debug)
Log.v(String, String) (verbose)

example code:
private static final String TAG = "MyActivity";
...
Log.i(TAG, "MyClass.getView() — get item number " + position);

Answer: Even though that this question was already answered I feel that there are missing examples in the answer that was answered.
Therefore I'll bring here what I wrote in a blog post "Android Log Levels"
Verbose
Is the lowest level of logging. If you want to go nuts with logging then you go with this level. I never understood when to use Verbose and when to use Debug. The difference sounded to me very arbitrary. I finally understood it once I was pointed to the source code of Android¹ "Verbose should never be compiled into an application except during development." Now it is clear to me, whenever you are developing and want to add deletable logs that help you during the development it is useful to have the verbose level this will help you delete all these logs before you go into production.
Debug
Is for debugging purposes. This is the lowest level that should be in production. Information that is here is to help during development. Most times you'll disable this log in production so that less information will be sent and only enable this log if you have a problem. I like to log in debug all the information that the app sends/receives from the server (take care not to log passwords!!!). This is very helpful to understand if the bug lies in the server or the app. I also make logs of entering and exiting of important functions.
Info
For informational messages that highlight the progress of the application. For example, when initialising of the app is finished. Add info when the user moves between activities and fragments. Log each API call but just little information like the URL , status and the response time.
Warning
When there is a potentially harmful situation.
This log is in my experience a tricky level. When do you have a potential harmful situation? In general or that it is OK or that it is an error. I personally don't use this level much. Examples of when I use it are usually when stuff happens several times. For example, a user has a wrong password more than 3 times. This could be because he entered the password wrongly 3 times, it could also be because there is a problem with a character that isn't being accepted in our system. Same goes with network connection problems.
Error
Error events. The application can still continue to run after the error. This can be for example when I get a null pointer where I'm not supposed to get one. There was an error parsing the response of the server. Got an error from the server.
WTF (What a Terrible Failure)
Fatal is for severe error events that will lead the application to exit. In Android the fatal is in reality the Error level, the difference is that it also adds the fullstack.
Answer: The source code provides some basic guidance:

The order in terms of verbosity, from least to most is ERROR, WARN, INFO, DEBUG, VERBOSE.  Verbose should never be compiled into an application except during development.  Debug logs are compiled in but stripped at runtime.  Error, warning and info logs are always kept.

For more detail, Kurtis' answer is dead on.  I would just add: Don't log any personally identifiable or private information at INFO or above (WARN/ERROR).  Otherwise, bug reports or anything else that includes logging may be polluted.
Answer: The Android Studio website has recently (I think) provided some advice what kind of messages to expect from different log levels that may be useful along with Kurtis' answer:

Verbose - Show all log messages (the default).
Debug - Show debug log messages that are useful during development only, as well as the message levels lower in this list.
Info - Show expected log messages for regular usage, as well as the message levels lower in this list.
Warn - Show possible issues that are not yet errors, as well as the message levels lower in this list.
Error - Show issues that have caused errors, as well as the message level lower in this list.
Assert - Show issues that the developer expects should never happen.
Answer: I think the point of those different types of logging is if you want your app to basically self filter its own logs. So Verbose could be to log absolutely everything of importance in your app, then the debug level would log a subset of the verbose logs, and then Info level will log a subset of the debug logs. When you get down to the Error logs, then you just want to log any sort of errors that may have occured. There is also a debug level called Fatal for when something really hits the fan in your app.
In general, you're right, it's basically arbitrary, and it's up to you to define what is considered a debug log versus informational, versus and error, etc. etc.


UE4 C++ - Add generated source code folders to Visual Studio solution?

Question: In Unreal Engine 4, using a Visual Studio solution and projects generated from the Editor using the First Person Template, the layout of the Solution looks something like the following:

I am not a fan of this flat horizontal folder structure. What I would like to do is put some new classes into a nested folder here.
I will be generating a new GameState subclass, and putting the sources into the Source\GameState folder that will also be created on the fly, using the UE4 editor:

Notice that the "Create New Folder" option is disabled.

Here I have appended the "GameState" folder to the normal source path.
However, the folder structure in the Solution Folder has not changed, and nothing I try to do is working. The things I have tried to do so far include:

Drag the folder into the solution from the file explorer
Right Click > Add > Existing Item... (Which just results in the files appearing horizontally to the other files without the new folder I have created, also add as link is not an available option)
Create a "Filter" (what the other folders appear to be) within Visual Studio. This results in the layout I desire, but I have to add the source code files to the filter manually which just copies them to the .vcxproj file directory. I end up not modifying the actual files I added.

How can I add this folder and it's files while keeping up with the original copies?
Answer: Answering this myself because I fought this problem for a couple of hours.
After the project has been first generated from within the Editor at:
File > Generate Visual Studio Project Files
The option changes to
File > Refresh Visual Studio Project
I found that the easiest, most effective, and I assume intended way to have the Solution Explorer layout match the actual file/folder structure is to use this to refresh the project. This will require a reboot of Visual Studio, which will also require a reboot of the editor if it's being debugged.