Good comments on changesets in sourcecontrol

Question: We need to develop guidelines for writing comments when we register code in version control system (such as TFS).
E.g., when we submit a bugfix, we create a comment "Fixed bug #..."
We tried to brainstorm on this topic, but most of the ideas bring too little added value.
I would appreciate any suggestions for this.
Comment: Please make this community wiki as it is subjective.
Answer: Generally the comments we do where I work are a quick overview of the changes that were made.  Something short and simple.
It may not seem to add much value initially, but can be very helpful when going back through history trying to find when something changed (much more so than just "bug #####").  There have been a few times when I needed to go back in the source control history to try and find when a particular behavior or piece of code changed, and the quick overviews can make it much easier to track down where that might be.  If you just give a bug number then you have to do more work to find that basic information (pull up bug tracker and find the bug).
Comment: Why add the number, wouldn't the Work Item link(s) be enough? (or are you not using TFS for bug tracking?)
Comment: I'd paste the bug title as well as the bug number into the comment: ideally the bug had already been given an informative title.
Answer: My (rather pithy) guidance around this topic is "to document why you are making the change not what."
I.e. you shouldn't say "fixed bug in MyClass.cs and FooBar.cs" because that comment is fairly irrelevant - they can just look at the changeset to find those details.  Equally with TFS the linking of changesets to work items means that including the work item reference in the comment is pretty superfluous.  Instead a short sentence explaining the reason for the change such as "fixed potential XSS vulnerability in editor" is the most useful thing to read when looking through a big history of changesets.
Answer: For a change that will be mentioned in the Release Notes, include a suggested Release Notes entry, either in the changeset comment or in the linked bug report if there is one.
By writing out a Release Notes entry, you're forced to take a step back and look at the edit from the user's point of view.  This encourages you to succinctly describe what the problem was and how the fix addresses the problem.
Answer: You can configure TFS to require that any code check-in have a TFS task associated with it.
The project team that uses it where I work requires that all bugs and / or features be entered in TFS as tasks - and that any code check-in be associated with the tasks(s) that it applies to.
A comment is also required but they don't have any stringent guidelines for what you write, except to note if the change is not required to be merged forward to another branch.
Answer: If the change has an associated ticket somewhere or a bug, in that case the number and title (with a link) should be enough.
Otherwise just state what change did you implement. Regular commenting guidelines apply, you can check some popular project log to see good examples.
Answer: Where possible (such as when using TFS for bug-tracking and source control) link the checkin directly to an appropriate work-item. Failing that, add the work-item / bug # in the changeset comments. This is the bare minimum acceptable level of changeset comments.
The checkin comment should describe the intent of the change made, only adding details on the way the change achieves the desired results as necessary. A good starting point would be the title of the appropriate work item.
One or two sentences is a good target length for the comment. Don't be so general the comment is meaningless (e.g. "Fixed a bug in xyz"), but don't hide the intent of the change under layers of unnecessary detail either.
Answer: I like to include a reference to the bug (ticket, issue, what ever its called) if possible because that provides the context and motivation for the change.  Also, I like to try to answer the questions What has changed and Why in as close to one line as I can.  When doing the comment, I try to think about my future self in 6 months looking back at the logs, diff, and ticket to understand what the heck I was thinking.  Getting into too much detail never seems to help.
Answer: +1 for pasting the bug issue title, which should be informative.
+1 for document why, if needed in addition to bug title.
+1 for being conscious about release notes for when you want to inform customers.
+1 for integrating SCM, bug tracking, and CI, and making them link to each other on issues/ bugs.


Can a word have two separate etymologies?

Question: A separate etymology for the spelling and another for the meaning of the word?
Comment: Does *island* count?
Answer: Sure, per the OED, the word doubt comes to us from the Old French douter, no b, and in the 14th century, the English word had no b either.  But those familiar with Latin on both sides of the Channel, inserted the b to indicate that the word ultimately came from the Latin dubitare.  The pronunciations remained unchanged, so the b was silent. By the 17th century, the silent b was a fixture in modern English but had been abandoned in modern French.  So the English etymology for meaning is French; the etymology for spelling, Latin.  You may not wish to accept this as an example because the French etymology is Latin.
Of course, sometimes those familiar with Latin were more familiar with Latin than with the derivation of English from Latin.  The word scissors originally didn't have an initial s, coming to us from the Old French cisoria, a cutting implement.  The French word came from the Latin caedere (to cut), past participle caesum.  The initial s was added during the 16th century in the mistaken impression that the word came from the Latin scindere (to cut), past participle scissum.  So the correct etymology for meaning involves caedere; the mistaken etymology for spelling, scindere.


Is it possible to install Android on a Motorola ROKR E6?

Question: I have a Motorola ROKR E6, which is currently running MontaVista Linux, and I was thinking of installing Android on it to make it usable again (and also to clear a lock code previously set on it that I completely forgot). I found how to access the bootloader, and now I'm installing the required drivers and software. But if I flash Android on it, it may brick the phone, so I'm going to be very careful while flashing Android. Do you think that installing Android on a non-Android phone like this old Motorola phone is possible?
Comment: Since there is no generic ROM for Android, I guess another question and hurdle is, is there a working Android ROM already for this phone?
Comment: Not possible. And phones of that vintage are useless nowadays (as phones), in a nutshell.
Answer: Do not try this. Your best possible result is that you can't flash it. If you manage to flash it with Android, you will brick it.
The device has only 46MiB RAM and 120MiB storage, which are not enough for Android.
There are a bunch of other reasons, why this isn't practical, notably that Android will not have device drivers for this phone, but the lack of RAM and storage mean they don't get to take effect.


Modeling orderbook shapes as distribution

Question: What are different distribution models typically used for generating orderbooks under high volatility, illiquidity, and multiple exchanges with different fees?
Comment: I cannot completely understand what you are asking or want to achieve but essentially a snapshot of an orderbook consists of bid/ask (price) and sizes. It updates based on new information. This is a process that consists of different data that are related or not. Different levels have different meanings and purposes (a price and size at level N which is X% away from mid price can be there just for fun and get canceled as N or X reduces). If you want to generate data for simulation, you can use random walk with some drift for mid price, Poisson for update and linear or uniform for the size.
Comment: https://letmegpt.com/?q=what%20are%20distributions%20used%20to%20model%20order%20book But seriously - according to ChatGPT, answer is Zipf Distribution
Answer: They are three levels of sophistication of order book models (there is a book on the topic: Abergel, Frédéric, Marouane Anane, Anirban Chakraborti, Aymen Jedidi, and Ioane Muni Toke. Limit order books Cambridge University Press, 2016)

Zero intelligence models - Farmer, J. Doyne, Paolo Patelli, and Ilija I. Zovko. "The predictive power of zero intelligence in financial markets" Proceedings of the National Academy of Sciences 102, no. 6 (2005): 2254-2259.
2-dimension flows - Cont, Rama, and Adrien De Larrard. "Price dynamics in a Markovian limit order market" SIAM Journal on Financial Mathematics 4, no. 1 (2013): 1-25.
Queue Reactive models - Huang, Weibing, C-A L, and Mathieu Rosenbaum. "Simulating and analyzing order book data: The queue-reactive model" Journal of the American Statistical Association 110, no. 509 (2015): 107-122.

In the first ones you focus on a few distributions (of order sizes, of frequency of events, etc) an univariate way and you replay them.
In the second ones you focus on the trajectories of the two first queues (first bid and ask) and events that modify them.
In the third ones you do the same but you condition the intensities of events by the shape of the orderbook.
The take away of this line of research (spanned over more than 10 years) is that: the intensity of events conditioned by the shape of the order book reflects well the dynamics of liquidity (Queue Reactive), but not well the macroscopic volatility (it is toon mean reverting). This is the opposite for the Zero-intelligence approach. The middle approach is interesting from a theoretical viewpoint, but you can in general do better in practice.
There is no reason to not use them in a fragmented setup (ie multiple order books), it is "just" that you will have to increase the dimension of the models.


Complex function derivative.

Question: Spent 2 hours solving this, but still no results. Let's define
$$
\frac{\partial}{\partial \overline{z}} = \frac12 \left( \frac{\partial}{\partial x} + i \frac{\partial}{\partial y} \right), \\
\frac{\partial}{\partial z} = \frac12 \left( \frac{\partial}{\partial x} - i \frac{\partial}{\partial y} \right).
$$
Proof, that
$$
\frac{\partial^2 |f(z)|^p}{\partial z \partial  \overline{z}} = \frac{p^2}4 |f(z)|^{p-2}|f'(z)|^2.
$$
Made lots of calculations. Is it true, that
$$
\partial_z \partial_{\overline{z}} = \frac14 (\partial_{xx} + \partial_{yy})?
$$
Comment: Yes. $\partial_{z\,\overline{z}} = \dfrac14 (\partial_{xx} + \partial_{yy})$
Comment: I noticed that even if you got answers to most of your (currently) 11 questions, you never *accepted* an answer so far. In the case that you are not yet aware of that procedure, have a look at http://math.stackexchange.com/help/someone-answers and https://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work.
Answer: We can write $\lvert f(z) \rvert^p = \left(f(z)\overline{f(z)}\right)^{p/2}$, by the definition of the modulus. Now, if we define $\bar{f}(z) = \overline{f(\bar{z})}$, then $\overline{f(z)} = \bar{f}(\bar{z})$. In particular, $\bar{f}$ is analytic if and only if $f$ is (by expanding in a power series, for example). Now,
$$ \left(f(z)\bar{f}(\bar{z})\right)^{p/2} =  \exp{\left(\frac{p}{2}\log{\left(f(z)\bar{f}(\bar{z})\right)}\right)} $$
by definition. Doing the first derivative gives
$$ \frac{\partial}{\partial \bar{z}} \exp{\left(\frac{p}{2}\log{\left(f(z)\bar{f}(\bar{z})\right)}\right)} = \frac{p}{2} \exp{\left(\frac{p}{2}\log{\left(f(z)\bar{f}(\bar{z})\right)}\right)} \frac{\partial_{\bar{z}} \bar{f}(\bar{z}) }{\bar{f}(\bar{z})}, $$
since the $f(z)$ is a constant with respect to $\bar{z}$.
The last term contains no $z$s, so we can ignore it for the $z$ derivative. Differentiating again, we have
$$ \frac{\partial^2}{\partial z \partial \bar{z}} \exp{\left(\frac{p}{2}\log{\left(f(z)\bar{f}(\bar{z})\right)}\right)} = \frac{p^2}{4} \exp{\left(\frac{p}{2}\log{\left(f(z)\bar{f}(\bar{z})\right)}\right)} \frac{f'(z)}{f(z)}\frac{\partial_{\bar{z}} \bar{f}(\bar{z}) }{\bar{f}(\bar{z})} $$
It is clear that we will get what we want if we can show that $\partial_{\bar{z}} \bar{f}(\bar{z}) =\overline{f'(z)}$. This becomes clear when we unwind $\bar{f}$:
$$ \frac{\partial}{\partial \bar{z}} \overline{f(z)} = \overline{\frac{\partial}{\partial z} f(z)} = \overline{f'(z)}, $$
since it is easy to see from the definition that $ \overline{\partial_{z}}=\partial_{\bar{z}} $.

Indeed, $4\partial_z \partial_{\bar{z}} = \partial_x^2+\partial_y^2$ for twice-differentiable functions, since the mixed partial derivatives cancel in that case.
Comment: You're genius! Thanks!
Answer: Just derivate:
\begin{eqnarray}
\partial_{z\,\overline{z}} |f|^p
&=& \partial_{z\,\overline{z}}\left(f^p\overline{f}^p \right)^\frac12\\
&=& \partial_{z}\left(\frac12\left(f^p\overline{f}^p \right)^{-\frac12} pf^p\overline{f}^{p-1} \frac{\partial\overline{f}}{\partial\overline{z}}\right)\\
&=& \partial_{z}\left(\frac{p}{2}f^{\frac{p}{2}}\overline{f}^{(\frac{p}{2}-1)} \frac{\partial\overline{f}}{\partial\overline{z}}\right)\\
&=& \frac{p}{2} \frac{p}{2} f^{\frac{p}{2}-1} \overline{f}^{(\frac{p}{2}-1)} \frac{\partial f}{\partial z}\frac{\partial\overline{f}}{\partial\overline{z}}\\
&=& \frac{p^2}4 |f(z)|^{p-2}|f'(z)|^2
\end{eqnarray}

Complex function derivative.


How to execute command when holding a book?

Question: Well, I was playing on a Creative Plots server today, and I noticed this particular book. When you held it, it killed you. I know there must have been some hacks involved, but how was it done? I think NBT was involved, so is there a tag that would make this possible?
Answer: I would add a scoreboard dummy variable for anybody holding the book, like so;

/scoreboard objectives add holding.killbook dummy

Next, add a scoreboard variable for deaths, to reset the previous variable;

/scoreboard objectives add deaths deathCount

Then, put these three commands (in this order) on a repeating command string;

/scoreboard players set @a holding.killbook 1 {SelectedItem:{id:id,tag:{put any other NBT tags in here}}}
/kill @a[score_holding.killbook_min=1]
/scoreboard players set @a[score_deaths_min=1] holding.killbook 0
Comment: How can  you set holding.killbook if the player is dead? Wouldn't holding.killbook always be set to 1 once a player holds the killbook? (I'm assuming all three command blocks operate in the same tick)
Comment: A variable can be set to a player regardless of whether they are dead or not


Style - When to serialize a Django model Instance: signals vs model's save method

Question: I plan to serialize a Django model to XML when it's saved or updated.  (The XML's going to be imported into a flash movie).  Is it better to listen for a    post_save() or       pre_save() signal and then perform the serialization, or to just handle it in the model's    save() methon
Answer: If it's core functionality for saving the model you'll want it as part of the save method. However, if you already have a functioning model and you want to extend it for other purposes then signals are your best bet since they allow for properly decoupled modules.
A good example might be that you want to add event logging to your site, so you simply listen for the signals that signify an event rather than modifying the original site code.
post_save() is usually best because it means the model has been successfully saved, using pre_save() doesn't guarantee that the save will be successful so shouldn't be used for anything that would depend on the save being completed.
Answer: Post save. That way the new data (the reason for performing the serialization) is already in the database. It'll make for a much cleaner bit of code that simply takes from the database and doesn't have to worry about adding an extra value.
The other way that comes to mind is to maintain the xml file in parallel to the database. That is to say, in your save() add the data to the database, and to the xml file. This would have a much less overhead if you're dealing with huge tables.
Comment: "Data already in the database" doesn't make the code any cleaner.  Either way you want to pull the data from the model object, you don't make an extra trip to the DB.  Post_save is the right answer, but @Andrew Ingram has the correct reason.


Spview listview item count shows wrong?

Question: We got a list and listview to group our items. But sometimes the total count is showing wrong number. I added sample picture to explain it. In this picture, Type is Form and it says there is one file in this type. But there are 5 items and it is calculating the count is wrong.
Comment: is all the 5 items checked in ??
Comment: Yes, there are all checked in. Is there any reason for problem?
Answer: This is a known issue. This could be the problem with the documents checked in problem.
How does it work?
Normally what happens, there are documents in the library that were uploaded for the first time and never checked in, so only the owner of the files can see them no matter the view or permissions you have.
You can navigate to the Library settings page and then click on "Manage checked out files" and you will probably see the remaining files of the total number of items that SharePoint is seeing.
Comment: There are all checked in. Is there any reason for problem?

Spview listview item count shows wrong?


The best way to keep my private keys safe?

Question: Best ways means the most reliable and robust, and meanwhile easy to access ways?
Comment: You're chances of getting an answer you like will be higher if you define the terms in bold. Otherwise, people might guess a wrong meaning of them.
Comment: yes, but i don't have an idea about how to describe it in bold. i just feel the current ways (hardware wallet, qr-on-paper, flash disk, etc) are not both robust and reliable. is there any more creative way, maybe low tech way that outperforms the current methods?
Answer: The best way currently, that is still easy to access are hardware wallets. The two most famous retailers are:
Trezor:
https://buytrezor.com/
Ledger:
https://www.ledgerwallet.com/
A hardware wallet is dedicated hardware with a defined interface that makes it impossible to extract the private key from the hardware. The interface does however allow signing of transactions. This means that the hardware wallet can safely be plugged into hardware infected with malware.
Comment: I should maybe add that when creating the private key on the hardware wallets I linked to, they present a 24 word seed on a dedicated screen. These 24 words represents the base private key and the chain code.

This means that you can backup the wallet by storing these 24 words in  method of your liking, that you find robust enough. A common recommendation is to write them on paper that you store in a fire- and waterproof safe.
Comment: Thanks. But digital products don't meet "robustness".
Answer: Besides hardware wallets I also recommend desktop wallet Electrum which you can protect with username, password and two-factor authentication. Same as hardware wallets Electrum generates a HD wallet which means that in a case of disk failure you can restore whole wallet on another computer with the seed you were given at the beginning when you generated a HD wallet.
Answer: For storing the seed I recommend Cryptosteel. It's waterproof, fireproof and made of stainless steel.


Formatting a drive that is protected with BitLocker

Question: I am planning to do a complete format on my computer. My HDD (which everything is located) is encrypted with BitLocker. A few months ago I tried to manually decrypt the drive to not cause any error before format but it literally took ages to even decrypt. Since I don't care about the data, is it OK for me to format a Bitlocker encrypted drive? Will it cause any problems or errors?
Comment: How are you reinstalling windows? Are you going to be using a recovery partition or discs?
Comment: Modern rotational drives tend to have a throughput in the 50-100 MB/s range during purely sequential I/O. (Seeking can easily drop this to a few hundred kilobytes per second in the worst case, if you are IOPS-bound doing I/O on single sectors.) Thus a 4 TB drive will take at least 80,000 seconds (or thereabouts), which is a shade over 22 hours, to process. Is this in line with your relatively vague "ages"?
Comment: @MichaelKjörling yes it is.
Answer: There's nothing at all wrong with formatting a BitLocker-protected drive. Doing so removes BitLocker - in a sense, when you encrypt the disk you are "Formatting it with BitLocker" because BitLocker takes over the space where filesystem metadata usually goes and moves it elsewhere - and it will be as if you'd just formatted any other disk.
You will of course lose all data, even if you don't do a full format - and I recommend only doing a quick format because, as @MichaelKjorling pointed out, a full one takes approximately "ages" - because it will no longer be possible to decrypt the disk's old data. I'm guessing you're fine with that, though.
Answer: If you are not worried about the data, simply format it.
Bitlocker does not stop you from doing so.
It won't cause any problems or errors.


Need examples from German and French, for chapters 31 and 32 on WALS

Question: WALS chapters 31 (wals.info/chapter/31) and 32 (wals.info/chapter/32). I need examples in French and German languages regarding these chapters. One language would be enough too!hello can you please explain the values (chapters) seperately? for one language would be enough!!! I will try to find the whole book! I have just got the whole book but I would like you ti explain the values in a few sentences regarding just one language!
Comment: Welcome to Linguistics.SE! Please expand your question so it were self-sustaining, and so users who'd like to answer it were not required to search for what exactly you mean.
Comment: @erik2 you can comment I guess, if not, it's unclear what you are trying to ask of me (after the edit). Also if my answer was good enough you can upvote it too.
Answer: according to what I understand, WALS ch 31 and 32 talk about Gender based systems, Given below is an excerpt from (Gender By Greville G. Corbett) for French (refer to book for more details).

And this is an excerpt for German (same book):


How long should I cook boned shoulder of Lamb?

Question: I have 794g of lamb shoulder. It is boned (can you buy it with a bone in??). How long should I cook it?
I have Delia's Complete Cooking Course, which suggests cooking for 30 minutes at 230C plus 30 degrees at 180C per pound (450G); about 1hr 20 minutes.
Delia Online just says 30 minutes per pound at 190C.
Which would people recommend?
Comment: Usually, unless you're slow cooking it, the best way to cook meat is with a thermometer. Do you have one?
Comment: Unfortunately not; I've gone with 52 minutes at 190C... We'll see how it turns out!
Answer: Shoulder is a tough cut. I think you will probably find it a bit chewy if you've cooked it at 190ºC for 52 minutes. In future, preheat the oven to maximum, place the lamb in a roasting tin, cover the tin with foil, put the tin in the oven, then immediately turn the oven down to 150ºC, and leave it for 4 hours. After that time, take it out of the oven and let it rest for 30 minutes or so. The lamb will melt in your mouth.
And yes, you can buy a bone-in shoulder at just about any supermarket, and they are usually tastier. Cook it as above and you will just be able to pull the bone out of the meat.
Comment: 150ºC is a bit too low and slow for modern lamb, as it has so much fat trimmed off. Try around 160ºC at 1.5 to 2 hours per kg. Either way make sure you baste the surface with the drippings regularly. Go with the bone in too! See http://www.beeflambnz.co.nz/
Comment: No it isn't, I do it all the time. New Zealand lamb may have the fat trimmed off, but here in the UK shoulder is still a fatty cut. If you cover the pan with foil you don't need to baste as it prevents the surface from drying out too much.
Comment: I'd also recommend a marinade and a short spell of grilling in some rosemary, garlic and honey for example. Golden brown on the outside, slow cooked gorgeous on the inside :). I've also tried 6-8 hours of 120 degrees on a barbecue. I think the slower, the better.
Comment: The high heat blast at the beginning performs the same task as grilling would, but grilling would impart a great flavour. I would put it in the oven at 150 rather than doing the whole high heat/turn down thing.
Answer: If boned ensure the joint is tied tightly with cooking twine, trim the fat so that it is uniform all around and lightly score. Brown all external surfaces on a hot pan/skillet. Remove and season as desired. Place on a rack in a roasting tray in 160c preheated oven for 2-3 hours, basting occassionally. Check internal temperature of joint, 60c is juicy! Remove and rest for 20 mins before carving.


How do I size a UITextView to its content on iOS 7?

Question: I've been using the accepted answer here for years.
On iOS 7, the contentSize.height becomes the frame.height-8, regardless of text content.
What's a working method to adjust the height on iOS 7?
Comment: I am running into the same issue. I see that they added textContainer to UIView that has a size but I am currently see it's size be inaccurate.
Answer: I favor this minimal code change: Just add these two lines after addSubview and before grabbing the height of the frame
...
[scrollView1 addSubview: myTextView];

    [myTextView sizeToFit]; //added
    [myTextView layoutIfNeeded]; //added

CGRect frame = myTextView.frame;
...

This is tested backwards compatible with iOS 6. NOTE that it shrink-wraps the width. If you're just interested in the height and have a fixed width, just grab the new height but set the original width, and it works just as before on both iOS 6 and 7.
(Speculation: it does size to fit on iOS 7 as well, but the layout is updated later or in a separate thread, and that this forces the layout immediately so that its frame is updated in time for using its height value a few lines later in the same thread.)
NOTES:
1) You might or might not have implemented the outer container resize this way. It does seem to be a common snippet, though, and I've used it in my projects.
2) Since sizeToFit seems to work as expected on iOS 7, you likely don't need the premature addSubView. Whether it will still work on iOS 6 then is untested by me.
3) Speculation: The extra layoutIfNeeded mid-thread might be costly. The alternative as I see it is to resize the outer container on the layout callback (fired or not depending on if the OS decides whether layout is needed or not) where the outer container resize will cause another layout update. Both updates might be combined with other layout updates to be more efficient. If you do have such a solution and you can show that it is more efficient, add it as answer and I'll be sure to mention it here.
Comment: It resizes textview but I still didn't manage to resize textview's parent element with this in iOS 7, can you please share more details ?
Comment: No idea, too little information. But if you write a question with the code that doesn't work I could have a look.
Comment: @JannieT since I posted the answer I've used it in every app I've updated on the app store, I guess five or so. Some text views were single line, some were multiline. I may be updating another today, could have a look on the very latest OS 7.1.x.
Answer: Since I'm using Auto Layout, I use the value of [textView sizeThatFits:CGSizeMake(textView.frame.size.width, CGFLOAT_MAX)].height to update the constant of the textView's height UILayoutConstraint.
Comment: MattDiPasquale, There should I put these code? Into viewDidLoad, layoutSubviews or else?
Comment: @AlexanderVolkov layoutSubviews or viewWillAppear.
Comment: thanks, this is useful. was hoping to dynamically resize as I type though. I guess the best I can ask for is to put the sizing logic in the delegate's textFieldDidEndEditing ?
Comment: This NSLayoutConstraint is being configured with a constant that exceeds internal limits.  A smaller value will be substituted, but this problem should be fixed. Break on void _NSLayoutConstraintNumberExceedsLimit() to debug.  This will be logged only once.  This may break in the future.
 -[<_UITextTiledLayer: 0x7fd9a8dcfac0> display]: Ignoring bogus layer size (375.000000, 1000000000.000000), contentsScale 2.000000, backing store size (750.000000, 2000000000.000000)
Comment: @mattdipasquale : No idea why this hasn't been marked as accepted answer :) But u sir :) Saved my day with this piece of code :) Hence up voted :)
Answer: I use an adapted version of madmik's answer that eliminates the fudge factor:
- (CGFloat)measureHeightOfUITextView:(UITextView *)textView
{
    if ([textView respondsToSelector:@selector(snapshotViewAfterScreenUpdates:)])
    {
        // This is the code for iOS 7. contentSize no longer returns the correct value, so
        // we have to calculate it.
        //
        // This is partly borrowed from HPGrowingTextView, but I've replaced the
        // magic fudge factors with the calculated values (having worked out where
        // they came from)

        CGRect frame = textView.bounds;

        // Take account of the padding added around the text.

        UIEdgeInsets textContainerInsets = textView.textContainerInset;
        UIEdgeInsets contentInsets = textView.contentInset;

        CGFloat leftRightPadding = textContainerInsets.left + textContainerInsets.right + textView.textContainer.lineFragmentPadding * 2 + contentInsets.left + contentInsets.right;
        CGFloat topBottomPadding = textContainerInsets.top + textContainerInsets.bottom + contentInsets.top + contentInsets.bottom;

        frame.size.width -= leftRightPadding;
        frame.size.height -= topBottomPadding;

        NSString *textToMeasure = textView.text;
        if ([textToMeasure hasSuffix:@"\n"])
        {
            textToMeasure = [NSString stringWithFormat:@"%@-", textView.text];
        }

        // NSString class method: boundingRectWithSize:options:attributes:context is
        // available only on ios7.0 sdk.

        NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
        [paragraphStyle setLineBreakMode:NSLineBreakByWordWrapping];

        NSDictionary *attributes = @{ NSFontAttributeName: textView.font, NSParagraphStyleAttributeName : paragraphStyle };

        CGRect size = [textToMeasure boundingRectWithSize:CGSizeMake(CGRectGetWidth(frame), MAXFLOAT)
                                                  options:NSStringDrawingUsesLineFragmentOrigin
                                               attributes:attributes
                                                  context:nil];

        CGFloat measuredHeight = ceilf(CGRectGetHeight(size) + topBottomPadding);
        return measuredHeight;
    }
    else
    {
        return textView.contentSize.height;
    }
}

Comment: I can solved content height of UITextView is iOS 7 from tames code. Thanks.
Comment: Doesn't adapt when the user hits return. New line clipped until you type in text.
Comment: works great for me, thanks :)
to avoid line clipped, simply use `[self.textView scrollRangeToVisible:NSMakeRange(0,0)];` when detected different line height
Answer: Based on other answers, I made it work(in Swift).
This solves the problem with newline character.
textView.sizeToFit()
textView.layoutIfNeeded()
let height = textView.sizeThatFits(CGSizeMake(textView.frame.size.width, CGFloat.max)).height
textView.contentSize.height = height

Auto Layout is needed.
Answer: If you're using Auto Layout, you could create a trivial UITextView subclass that self-sizes the text view height to fit the content:
@interface ContentHeightTextView : UITextView

@end

@interface ContentHeightTextView ()
@property (nonatomic, strong) NSLayoutConstraint *heightConstraint;
@end

@implementation ContentHeightTextView

- (void)layoutSubviews
{
    [super layoutSubviews];

    CGSize size = [self sizeThatFits:CGSizeMake(self.bounds.size.width, FLT_MAX)];

    if (!self.heightConstraint) {
        self.heightConstraint = [NSLayoutConstraint constraintWithItem:self attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:0 multiplier:1.0f constant:size.height];
        [self addConstraint:self.heightConstraint];
    }

    self.heightConstraint.constant = size.height;

    [super layoutSubviews];
}

@end

Of course, the text view's width and position must be defined by additional constraints configured elsewhere in the program.
If you create this custom text view in IB, give the text view a height constraint in order to satisfy Xcode; just make sure the height constraint created in IB is merely a placeholder (i.e., tick the box that says "Remove at build time").

An alternative way to implement the UITextView subclass is as follows (this implementation might qualify as best practice):
@interface ContentHeightTextView ()
@property (nonatomic, strong) NSLayoutConstraint *heightConstraint;
@end

@implementation ContentHeightTextView

- (void)layoutSubviews
{
    [super layoutSubviews];

    [self setNeedsUpdateConstraints];
}

- (void)updateConstraints
{
    CGSize size = [self sizeThatFits:CGSizeMake(self.bounds.size.width, FLT_MAX)];

    if (!self.heightConstraint) {
        self.heightConstraint = [NSLayoutConstraint constraintWithItem:self attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:0 multiplier:1.0f constant:size.height];
        [self addConstraint:self.heightConstraint];
    }

    self.heightConstraint.constant = size.height;
    [super updateConstraints];
}

@end

Comment: I think subclassing UITextView and working with height constraint is the best solution when dealing with auto-layout.Thank you.
Answer: If you are using auto-layout, you can use the following UITextView subclass that adds an intrinsic height:
@implementation SelfSizingTextView

- (void)setText:(NSString *)text
{
    [super setText:text];
    [self invalidateIntrinsicContentSize];
}

- (void)setFont:(UIFont *)font
{
    [super setFont:font];
    [self invalidateIntrinsicContentSize];
}

- (CGSize)intrinsicContentSize
{
    CGFloat width = self.frame.size.width;
    CGSize size = [self sizeThatFits:CGSizeMake(width, MAXFLOAT)];
    return CGSizeMake(UIViewNoIntrinsicMetric, size.height);
}

@end

Comment: It worked for me on iOS 7.0. But didn't check on iOS > 7.0. Thanks @phatmann.
Comment: The docs for `intrinsicContentSize` say: `This intrinsic size must be independent of the content frame, because there's no way to dynamically communicate a changed width to the layout system based on a changed height.` So my code is not really kosher. On iOS 7 it worked, but it is not reliable on iOS 8. If you are using self-sizing cells on iOS 8, then you can use `preferredLayoutAttributesFittingAttributes:`
Answer: this method seems to work.
// Code from apple developer forum - @Steve Krulewitz, @Mark Marszal, @Eric Silverberg
- (CGFloat)measureHeight
{
if ([self respondsToSelector:@selector(snapshotViewAfterScreenUpdates:)])
{
    CGRect frame = internalTextView.bounds;
    CGSize fudgeFactor;
    // The padding added around the text on iOS6 and iOS7 is different.
    fudgeFactor = CGSizeMake(10.0, 16.0);

    frame.size.height -= fudgeFactor.height;
    frame.size.width -= fudgeFactor.width;

    NSMutableAttributedString* textToMeasure;
    if(internalTextView.attributedText && internalTextView.attributedText.length > 0){
        textToMeasure = [[NSMutableAttributedString alloc] initWithAttributedString:internalTextView.attributedText];
    }
    else{
        textToMeasure = [[NSMutableAttributedString alloc] initWithString:internalTextView.text];
        [textToMeasure addAttribute:NSFontAttributeName value:internalTextView.font range:NSMakeRange(0, textToMeasure.length)];
    }

    if ([textToMeasure.string hasSuffix:@"\n"])
    {
        [textToMeasure appendAttributedString:[[NSAttributedString alloc] initWithString:@"-" attributes:@{NSFontAttributeName: internalTextView.font}]];
    }

    // NSAttributedString class method: boundingRectWithSize:options:context is
    // available only on ios7.0 sdk.
    CGRect size = [textToMeasure boundingRectWithSize:CGSizeMake(CGRectGetWidth(frame), MAXFLOAT)
                                              options:NSStringDrawingUsesLineFragmentOrigin
                                              context:nil];

    return CGRectGetHeight(size) + fudgeFactor.height;
}
else
{
    return self.internalTextView.contentSize.height;
}
}

Answer: If you're using iOS 7+, you can just turn on auto layout, pin each of the sides of the text view to the edge of its parent view, and it works fine. No additional code needed.
Answer: Not sure if this was always the case but the following is true since at least iOS 10.
UITextView implements the intrinsicContentSize property if scrollEnabled == NO. That means you just need to make sure the width of the text view is constrained enough and then you can use the intrinsic content height (either via Auto Layout content hugging/compression resistance priorities or directly using the value during manual layout).
Unfortunately, this behavior is not documented. Apple could have easily saved us all some headaches… no need for an extra height constraint, subclassing, etc.
Answer: In iOS 8 you'll in inherit some content offset from the parent, which you need to get rid of as well.
A subclass example
// Originally from https://github.com/Nikita2k/resizableTextView

#import "ResizableTextView.h"

@implementation ResizableTextView

- (void) updateConstraints {

    // calculate contentSize manually
    // ios7 doesn't calculate it before viewDidAppear and we'll get here before
    CGSize contentSize = [self sizeThatFits:CGSizeMake(self.frame.size.width, FLT_MAX)];

    // set the height constraint to change textView height
    [self.constraints enumerateObjectsUsingBlock:^(NSLayoutConstraint *constraint, NSUInteger idx, BOOL *stop) {
        if (constraint.firstAttribute == NSLayoutAttributeHeight) {
            constraint.constant = contentSize.height;
            *stop = YES;
        }
    }];

    [super updateConstraints];
}

- (void)setContentOffset:(CGPoint)contentOffset
{
    // In iOS 8 we seem to be inheriting the content offset from the parent.
    // I'm not interested
}

@end

Answer: In storyboard, if using constraints, make sure you are constrained to your superview in the 'ruler' tab of the right-hand pane on xcode for the UITextView.  My problem was that I had a constraint of -80 pts on the 'Trailing space to'.
Answer: Guys using autolayout and your sizetofit isn't working, then please check your width constraint once. If you had missed the width constraint then the height will be accurate.
No need to use any other API. just one line would fix all the issue.
[_textView sizeToFit];

Here, I was only concerned with height, keeping the width fixed and had missed the width constraint of my TextView in storyboard.
And this was to show up the dynamic content from the services.
Hope this might help..
Answer: I wrote a category over UITextView:
- (CGSize)intrinsicContentSize {
    return self.contentSize;
}

- (void)setContentSize:(CGSize)contentSize {
    [super setContentSize:contentSize];
    [self invalidateIntrinsicContentSize];
}

When UIKit sets its contentSize, UITextView adjusts its intrinsic content size. That plays nicely with autolayout.
Answer: The answer given by bilobatum worked perfectly With auto layout, i.e subclassing the textview.
If you want to limit the height of the text view add another constraint (I added it using storyboard i.e. height <= 166 (height as per your need))
Then inside subclass reduce the priority of height constraint to 750 (self.heightConstraint.priority = 750) to avoid conflict between height constraint added in subclass and  height constraint added on storyboard.


Do the 31 realms physically exist or is it a state of mind?

Question: I know its an imponderable or unconjecturable to us putthujjanas, but do any of the 31 realms have corporeal existence or are they states of mind (mind-made) or a mixture of both? For example, does tusita heaven physically exist, or is it purely a state of mind? If tusita does exist physically then how can one get there? Is the earthly plane and the laws of physics also mind-made?
Answer: When you read the Pali Canon, they seem like places that exist that beings live in. At the end of a teaching, the Buddha would explain any similes or metaphors he used. I've never read him explain the 31 planes as a metaphor, which means he taught it as a literal existence. There are also examples of monks with past live memories talking about their previous existences or visiting other realms in this life. Maha Mogallana was known in particular for his psychic powers.
To get to Tusita, you need to create the type of karma that would lead to being reborn there. In MN 120, the Buddha explains how to influence your rebirth by aspirations. Alternatively, you develop the Divine Eye, a psychic power. To do that, practice the Noble Eightfold Path and learn the 4th jhana. That is not an easy task.
I don't think any sutta states why the laws of physics exist.
Comment: After reading your answer, it hit me that the planes do physically exist. You are right. Its kind of like how we travel on the earthly plane, i.e. if we decide to reach a destination, say Bodhgaya, we not only have to make up our mind but also have to physically travel. So in essence, we require both mental determination and physical effort. But we can transcend physics by reaching higher states of mental development, not sure how that actually unfolds, i.e. how is mind able to transcend laws of physics.
Answer: During the Mongol Yuan dynasty, where the Sakya-Mongol alliance reigned, I was a monk at a temple in Tibet. It was in the year 1247. I had a big nose and smelly breath, and I walked like an Egyptian, but I could throw dhamma bullets from my mouth like a shaolin warrior throws needles, and they liked me for that.
My general behaviour was unkempt and controversial at best, and I would often hear my fellow dhamma farers complaining about me, but they'd always finish their lamenting with, "sure, he's a weird guy, but he speaks dhamma well - let him be". The Lamas of that particular era held huge political and military responsibilities alongside their religious endeavours, which I did not envy in the slightest.
I died a peculiar death in 1261. It was precisely 49 days later that a crack team of siddhi enthusiasts tried to track me down with their divine eyes. One of those siddhi masters got too close, so I poked him in the eye with a divine poke, a special siddhi move that can be transferred into the physical world. Their confidence had been bruised as they found they were one man down for a few weeks. Regardless, they never found me, and I made damn sure!
3 weeks before I died, I deliberately vandalised a sand mandala two days before it was due to be finished as a way to teach them that impermanence doesn't follow schedules. Well, they didn't appreciate that! The sand used for the mandala had been collected from various rocks covering a 25 mile radius, painstakingly ground into sand and partially made into a rudimentary mandala, awaiting its final detailing. As you can imagine, there were some tears and a few wet robes. Mandala creation in Tibetan Buddhism was in its very infancy at that time, and they 'apprehended' the idea from the Vedas.
As you can probably incur from the style of delivery, even in my other lives, I wasn't a very conventional sort of person, and often went against the grain of things. I guess some habits never die! *wink!
My point is that all of this is a state of the mind, just like the realms, themselves. Perhaps they happened or are happening now, but regardless, they remain figments of the imagination, no matter how creative they my seem.
I do have more interesting past-life stories to share, though - even some other-realm stories! It's fun, isn't it? ;-)
If you like Buddhist cosmology, try watching Ajahn Sona's excellent 10-part series on the subject, here. It had answered a lot of questions for some of the things I was seeing in my own practice. But be warned! This region of Buddhism can captivate the mind, thus causing one to drift off from the primary objective! This was illustrated in the story of Mae Chee Kaew, who often visited these planes and spoke to the inhabitants. Her teacher, Ajahn Boowa, immediately told her to stop doing this in order to guide her towards enlightenment, and at one point he shouted at her, and for good reason! For most, it's best to steer clear!
Comment: @NithinManmohan - I've responded to your comment by adding another paragraph in my answer. Keep well, my friend!
Comment: Thank you for sharing, its very interesting and also loved the way the words are stitched. If you don't mind me asking, can you please share your experiences in other realms as well. Eagerly awaiting and curious to know. :)


How to write a 40+ page story in 3 weeks

Question: What is the best way to write a 40+ page story in 3 weeks? The story I am writing has to be spot-on and close to a professional level and is totally fictional.
Comment: Is there a word count or are we going by standard MS Word page (8X11 ins)?
Comment: @hszmv We are going by standard MS Word page
Comment: I'm not clear on what exactly you are asking. How to figure out if your story idea would produce a story of the required length? How to make yourself sit down and write the needed X hours per day?
Comment: @Galastel  I am asking for advice on how to sit down and write the required amount of pages each day
Answer: Welcome to the forum.
First, to put your mind at ease, each November, many writers participate in a mad rush of writing that averages 1600 words per day per writer. (50,000 words in a month, about 200 pages of standard margin, double-spaced 12 point font text.) You have three weeks and need forty pages (at standard formatting, about 10000 words). You can do this.
I can't speak to the quality of your storytelling, but it's certainly possibly to write forty pages in a week and polish it up. I suggest creating a framework first, to make the writing easier.

Question: How to write 40 pages of a story in three weeks?
Answer: Here is one possible way.
Week 1 (best to do this in ~four days instead of seven, because you might need the cushion at the end):
Identify the story and structure you would like to most closely pattern after. If you create a sense of the 'route' you are following, you'll be able to keep making progress. Think of it like a map. You want a map through the wilderness.
Identify characters and a general story structure--the outline. Write a few scenes to 'limber up' but don't commit to keeping them. You want to get to know your characters, and the story. What is the central conflict? What is the goal of each character? What is each character actively doing to achieve their goal?
Week 2:
Crush out 1400 words per day; roughly six pages per day. (better to hit 1500 words per day because you will likely lose words in revision, which will be week three.) Force yourself through the story. It will feel rushed, and awkward. Don't worry. When you hit a patch you are unsure of, put in a few (xxx) or other indicator that allows you to get past the speed bump and keep going.
At the end of week two, plan to have fifty pages or more of a complete story. Don't worry if it is bad.
(If typing is a physical issue, you can use tools, like the voice-to-text dictation software in your Word or other processor. Fifteen hundred words a day for a week is doable, but it will be major thing in your life for that week. Do it.)
Week 3:
Revise. Every day, work through your story to clean it up. Check the arc, the dialog, the language, the motivations and goals, the tension, the conflict, and so on. Balance dialog, setting, action, plot. This is the week where you clean up the thing you created in weeks one and two.
If you have days at the end of your three weeks, give yourself a rest day and then read through the whole thing in one sitting. Out loud, printed on hard copy.
If possible, get feedback from a friend at the beginning of week three.
Good Luck.
Answer: So I've found that you set an average writing goal that you will consistently add x amount of words per day.
Given a standard MS Word page is about 500 words (give or take... it can be less than that if you have fast dialog but more if you have standard discriptions.  Generally this is the space for a fomatted 5 paragraph essay).  A 40 page document will thus be about 20,000 words, which given 21 days in a full three week period, results in about 950 words per day goal to make it by deadline.  Depending on how well you have planned your story, this isn't a difficult goal.
I wouldn't commit to writing this quota in one go... but if your on a roll, keep rolling. But, I've found that if you set aside two times a day where you can give yourself 30-60 minutes in each period, sit down, and write the next segment of your story to the tune of about 500 words give or take.  Go in order as you want it to appear.  Write to the nearest point you want to complete (i.e. if you go over, but the scene is almost done, go to the end of the scene and stop.  If you're close but not quite there and the chapter has ended, feel free to stop.  Most writers hate math and I'm getting too mathmatical as is.).  Try and put significant time during these sessions (I do one at breakfast, one at lunch, and one at dinner... I also go for more words in slightly more time).
Now, while I said 950 is a goal, it is soft.  You want to write to a good stopping point even if that means coming up short or putting yourself over quota (doing this is good).  I also recomend you keep the full story in a master save, but write the new segment in a freshly opened word doc.  The reason for this is that it resets the word counter at zero which means you don't have to find your next start.  When your finished, copy paste into your master and save there.  Word also does frequent autosaves just in case something accidentally deletes your entire effort (I'm old enough to remember when a power outage as you finished your research paper was the bane of people who didn't Ctrl+S early and often).
This may seem rather daunting, but you'd be surprised just how fast you can write 500 words, especially if you love your subject... and what writer doesn't love his or her subject?
Also, you're gonna find as you near completion of the story, you will over write... the climax is the best part (IMHO) because everything you've been setting up is now paying off.
Finally, if you found mid story you're not sure what the next step in the story should be, write "Suddenly Ninjas lept through the doors and windows".  Then describe your characters reacting to the situation and trying to make it out in one piece.  If you can't get a page and a half of dialog along the lines of "WTF, Ninja's?" out of your characters (especially if your out of genre... say in a Tsarist Russian Court) then maybe writing isn't for you.  I mean, this isn't even the fight... this is just acknowledging the ninjas.
Comment: You've left no time for editing, revisions etc. Very rarely the first draft is a finished product.
Comment: @ hszmv and @ DPT Thank you so much for the valuable advice and I will use it in my future writing pieces.
Comment: @Galastel:  I'm aware.  My focus is purely for getting words on paper (the ninja advice bit is space eating but not necessarily something of substance to the narritive).  Obviously editing is something that I put aside for later.  I do NaNo, so my goal is to meat deadlines.  Typically I have a month off for Christmas and start Editing the year afterwards.


Difference between the prefixes "pre" and "ante"?

Question: Thinking of the words "precedent" and "antecedent" led me to this question. They seem to mean almost exactly the same thing in their more general usages, but "antecedent" seems to imply causation while "precedent" does not. Is there some difference between "pre" and "ante" that I don't understand, or am I just misunderstanding the definitions of "precedent" and "antecedent"?
Comment: Isn't it that 'precedent' is more proximate than 'antecedent'? Can't we read it along with precede x succeed; anterior x posterior?
Answer:
pro (w/abl)  > position and separation (pro + ject = from a point --> departure)
ante (w/acc) > location and direction (ante + chamber = before the room, --> towards it) whereas > (ante + mortem = before death <-- prior to it)
prae (w/abl) > place where = position (pre + fer =put before --above all)

One may keep these in mind in understanding the basic difference–not always so clear, but gives the notion based on Latin.
Comment: I'm guessing that (w/abl) stands for "ablative", while   (w/acc) stands for "accusative". Though I'm not sure what the "w" stands for
Comment: @Mari-LouA: "w/" is often used as an abbreviation for "with"; I assume that's what's meant here.
Answer: From New Oxford American Dictionary

ante- PREFIX
before, preceding
pre- PREFIX
before (in time, place, order, degree, or importance)

So there is much overlap in the meaning.  I would say the difference is that pre- is much more common.  You would say "in pre-Covid times".  Do not say "in ante-Covid times" unless you are an expert speaker of English and know what you are doing.
Comment: I suspect that "pre-" is still productive, but "ante-" is not mainly because of the possibility of confusing it with "anti-".
Comment: As this says, they are basically very similar but have slightly different connotations and are used in slightly different ways, often with a series of terms modelled on a similar term. If you can get access to the OED, you can browse their vast list and see the many shades of meaning. For instance, you find ante- in a lot of terms meaning a small place in front of a bigger one (e.g. ante-chamber) but this sense doesn't apply to many ante-words.
Answer: It really does not matter if there is a distinction between pr[a]e and ante. The tendency is as follows:
The pre- prefix has entered English directly from Latin, and French and has been used to create words in English from Late Middle English onwards chiefly with the added meaning of "before [with respect to time] prenatal - before [the time of] the birth.
The ante- prefix has has entered English directly from Latin, and French and has been used to create words in English from the 17th century onwards chiefly with the added meaning of "before [with respect to space or time]", e.g. antenatal before [the time of] the birth / antechamber before (place) the main chamber.
Origins and eytomology from OED:
English anteroom adj.
Origin: A borrowing from Latin, combined with English elements. Etymons: ante- prefix,  Old English hrum (rare).
Latin - Antecede: antecēdere antecede v Origin: A borrowing from Latin. Etymon: Latin antecēdere.
1628   T. Spencer Art of Logick 239   This Axiome..containes nothing that doth antecede, or follow.
antestomach  n.
French: Etymology: < Old French estomac, stomaque, stomeque (modern French estomac)
1678   J. Ray tr. F. Willughby Ornithol. i. 17   The Gullet..in many birds of this kind immediately above the stomach is dilated into a kind of bag or ante-stomach.
Pre- :
Latin: prae-ambulāre to walk before (see preamble)
French: preeminence,  Etymology: < Middle French preeminence, preeminance, preheminance, prehemynence.
English: predestiny Etymology: < pre- prefix + destiny n. Etymology (destiny): Middle English,
Comment: References? Summary referencing causation (or not)?


Robots.txt - no follow, no index

Question: Please can someone explain to me the difference between setting allow and disallow in a robots.txt file and create No follow, No index meta tags!
Is it possible to set no follow and no index within the robots.txt file?
I have look on http://www.robotstxt.org/robotstxt.html and not really got what im looking for!
Thanks
Answer: The robots.txt file will simple tell a robot where he is allowed to go and where he isn't. It has no power to make a robot follow a link to another website. The nofollow, noindex meta tag will prevent a compliant robot from indexing or following the link specified or the links contained in the webpage.
Answer: Disallowing a robot in robots.txt from a specific page has the same effect setting a META tag of noindex for that page does.
A META tag of nofollow prevents search engines from following the links on the page even if they're allowed to index the page itself. There's no robots.txt version of this.
noindex can be useful in some situations on dynamic sites where a robots.txt is not flexible enough. For example, if you had a system that made URLs like node/123, blocking articles based on certain data in the article would have to be done with noindex, as robots.txt can only filter based on stuff in the URL itself.

Robots.txt - no follow, no index


Test cases for media migrating from the file location to a database

Question: What are the test cases that can be considered on media (pictures) being migrated from  file location to a database?
Comment: Hi user7822, this is a Q&A site.  Do you have a question?
Comment: Can you add any additional details?  Are these pictures then being served up by a web site?  Was the website code changed in order to pull from the new location?  Are you thinking of issues with performance?  Are you asking about tools to verify that the correct image is shown, or that it does not 404, etc?
Answer: Some research would have been appreciated. You have not mentioned about file type. Since no details are available I have considered your application does upload and download which in case of upload goes to the database.

Check the file size before and after transferred to the database, it should be same.
When the file upload is in progress disconnect the internet and connect again, how does your application respond.
Does application start data transfer from the beginning or from where it left when the internet was disconnected.
Check the same scenaeio for download if internet disconnects while the download is in progress.
Does it allows to upload same file more than once or is there any validation. Check FRS.
Check for the extension after file upload in database.
What is the extension of half file upload on database.
File size limitation on upload and download.
What is the threshold time set for file upload in case of low internet connectivity.
Error on disk full.

There are hundreds of other scenarios.


SharePoint Online Content Type Hub won't publish content types with managed metadata columns

Question: I created site columns using managed metadata and added them to custom content types.  When I try to publish them I get the message "The current content type contains a managed metadata column that uses a customized term set that is not available outside of the site collection. Please change the column settings or remove the column and publish the content type."  We should be able to use managed metadata in site content types.  Is there something I am missing?  A setting?
Comment: Did you checked this? http://kjellsj.blogspot.com/2010/06/content-type-hub-publishing-and-column.html
Answer: You need to define the Managed Metadata Term Set in the centralized Term Store, not in the Site Collection specific Term Store as it is only available in single Site Collection.
Go to SharePoint tenant admin site (direct link https://yourtenant-admin.sharepoint.com/_layouts/15/termstoremanager.aspx), select "term store" on the left, and define Term Set there. It will be available throughout the tenant in all site collections.


iMac 21.5" (2010) OSX Yosemite 10.10.2 / Thunderbird 31.5.0

Question: I want to delete 'offered' email addresses from T'bird's lists. This is easy in 'Collected Addresses' but there are other, often duplicated, lists such as 'Family' that include out of date info. If I open up the category I can access the addresses BUT when I highlight a specific address and right-click on it the drop-down menu has 'Delete' greyed out and therefore I can't delete it. An example is my wife's email addresses from her last two places of work - and she's now retired!
Answer: Looks like you have some external contact database connected to Thunderbird like Google contacts or Exchange. In that case it depends on the used plugin if deletion of contacts from such list is implemented. Try to go to the origin of the contact database and remove members from there.


Grounded conducting sphere inside uniform electric field

Question: The problem of a grounded conducting sphere inside a uniform $E$ field in the $z$ direction can be solved by imagining the field be produced by a pair of charges $Q$ and $-Q$ put on the $z$ axis, taking the limit that the charges are very very far away, $Q\rightarrow\infty$, and using the image method. Under this limit, the field produce by $Q$ and $-Q$ will be uniform in the vicinity of the sphere. My question is, why we need two charges? A single charge $Q$ can also produce a uniform $E$ field under the same limit.
Answer: you don't need two charges, you can use only one charge and the answer will be the same, you only should note to add a second image charge in the centre of the sphere to make the sphere neutral.
in both cases, when you take the limit, you get same electric dipole in the centre of sphere.
but because the symmetry of two charges, calculations are somehow easier.
with any relevant boundary condition, the sphere should remain neutral. to see this suppose it gains charge $q$. if you change $E \to -E$ then the charge of sphere should change to $-q$ (you can see this by dimensional analysis, since the $q$ should be proportional to $E$). but the new setup are the same as the first one, because letting $E\to -E$ is the same as rotating the setup by 180 degrees. it certainly shouldn't change the sphere's charge. so $q=-q=0$.
Comment: If we literally consider the case where a grounded metallic sphere of radius $a$ is placed in an electric field generated by a single huge charge $Q$ located at a huge distance $r$, there will be an induced charge of $−aQ/r$ on the sphere. Intuition tells us that it is a wrong way to represent the problem of a grounded metallic sphere in a uniform electric field, but arguing why it is so looks subtle to me. I guess it has to do with what we really mean by grounding.
Comment: it is wrong way to represent the problem because it doesn't have the symmetries of original problems.
Comment: literally because the boundary conditions isn't the same. actually the original problem's boundary condition is ill-defined. for example if the field is in the $\hat x$ direction, the $x=constant$ planes would be the equipotential surfaces. so the $(0,0,0)$ and $(0,0,\infty )$ has the same potential. but in the $Q$ charge model the potential deference between the origin and the $(0,0,\infty )$ point would tend to $\infty$ after taking the limit.
Comment: I guess we can consider a Neumann boundary condition at a sufficiently large spherical surface for the original problem. I see that the notion of being grounded, i.e., having the same potential as the spatial infinity, is ill-defined in this case.
Comment: On the other hand, in the model with the charge Q, grounding makes the metallic sphere have the same potential as the spatial infinity, which is much farther away than the charge Q. By this, the role of Q is not only to generate a constant electric field near the metallic sphere but also to affect the boundary condition on it. This is certainly not what we have intended. I agree with you that that the trouble here is the boundary condition. It seems that the usage of the notion "grounding" is somewhat misguided in the original problem statement.
Answer: If we forget about the image charges for a moment, there should be a symmetry between the front part and rear part of the sphere. Because, $e^-$s drawn from
the back of the sphere to the frontal part will expose equal amount of +ve ions in the back. A single charge will note restore this symmetry. Also, there will be unbalanced amount of charge on the sphere of magnitude $-\frac{aQ}{R}$(which is not supposed to be, as to start with the sphere was neutral). Here, $a$ is the radius and $R$ is the distance where the charge $Q$ has been kept ($R\rightarrow\infty$).
Comment: Kolahal, but what's the mathematical point of view of needing two charges? The BC is that we have a uniform field far away from the sphere, and one single charge can fulfill the purpose. By the way, the sphere is grounded, not neutral, although it will remain so in the solution using two charges.
Comment: Even if the sphere is grounded, in a uniform electric field it will remain neutral. In fact, in this example there is not difference between grounded/non-grounded (if you have access to Greiner's electrodynamics, you can refer to that book for this example). The electric field is not itself the boundary condition. Boundary condition relates to the potential on the boundary of the sphere - that the potential is uniform across the surface. And in that case, the symmetry should be maintained.
Comment: If uniform field is not a BC, what is the BC at infinity?
Comment: There is no boundary at infinity...so why are you worried about boundary condition there?
Comment: How can you obtain a unique answer without specifying a BC at infinity??
Comment: What unique condition you want to specify at infinity? The condition $\phi(\infty)\rightarrow0$ is not valid here. Usually, boundary conditions are specified in terms of potential (not electric field).
Comment: No, you can specify a Neumann BC at infinity.


When do we read a vav prefix as "or" rather than "and"?

Question: This answer cites the Ralbag as interpreting a (critical-to-the-question) vav prefix on a verb as "or".  I've heard before that a vav prefix is not always "and" and can be "or" or even "but".  Is there any grammatical rule by which we can tell when to read it which way, or do all the non-"and" readings always arise from judgments about what would make most sense to the interpreter?  Do Chazal generally agree on how any given vav is translated, making it received tradition and there are no explicit rules?
Comment: @msh210, I was starting to wonder (based on the comments and answer here) whether the problem is that there are no rules.  If there are I would like to know them; if it's "you just have to know" I'd like to know that too so I stop looking for rules.
Comment: I don't think there are such grammatical rules. Note that in regards to the linked answer, not everyone even reads the *vav* as "or". Chazal, for instance, read it as "and" (Taanis 4a). On the other hand, in a case like "ומקלל אביו ואמו", everyone reads the *vav* of "ואמו" as "or", because that's what makes the most sense.
Comment: @YDK, It is not explicit. The gemara says that Yiftach acted improperly, vowing that he would sacrifice to God whatever exited his house to greet him first, even if it was not an acceptable sacrifice (אפילו דבר טמא). Chazal are thus **not** reading "והעלתהו עולה" as "*or* bring it as an *olah* offering"; otherwise, Yiftach may have only been referring to if what came out of his house **was** appropriate as a *korban*. Elsewhere, the *midrash* says that Yiftach actually sacrificed his daughter as a *korban*, in which case, clearly it is reading the *vav* as "and". See Abarbanel (Shoftim 11).
Comment: Re "Do Chazal generally agree on how any given vav is translated, making it received tradition and there are no explicit rules?": that they agree on it doesn't mean there are no explicit rules. (Presumably, if there are rules, they agree.)
Comment: @jake, can you be more specific about the Taanis source for the default reading of vav?  I could not find it.
Comment: See משנה שבת ז ג where the the first ו means "and" and the second ו means "or."
Answer: Vav does not necessarily mean and or or.  It is a conjunction and translated according to context.  I translate most vav's as a "soft then"- a subsequent event where formal written English would not put a then, but in a conversation, one might say "so then I..."
Other possibilities: but (although, however), while, since, therefore.
Answer: I thought to do the following experiment to test "and" vs. "or" in the way Targum Onkelos interprets the Chumash by searching for the word או on both sides of the equation.
There is an extreme amount of vav-prefixes but a more limited amount of instances of the word או both in the Chumash and in the Targum (a total of more than 250 in each):

Look for instances of או in the Targum and see whether they map back    to instances in Chumash of vav-prefixes
Look for instances of או in the Chumash and see whether they map back to instances in Targum of vav-prefixes

The results are as follows:
1 - In Targum:או to Chumash:vav, we have the following single exception in דברים כט:יז to the normal או=או match

פֶּן יֵ֣שׁ בָּ֠כֶ֠ם אִ֣ישׁ אוֹ אִשָּׁ֞ה א֧וֹ מִשְׁפָּחָ֣ה אוֹ שֵׁ֗בֶט
אֲשֶׁר֩ לְבָב֨וֹ פֹנֶ֤ה הַיּוֹם֙ מֵעִם֙ ה֣' אֱלֹהֵ֔ינוּ לָלֶ֣כֶת
לַעֲבֹ֔ד אֶת אֱלֹהֵ֖י הַגּוֹיִ֣ם הָהֵ֑ם פֶּן יֵ֣שׁ בָּכֶ֗ם
שֹׁ֛רֶשׁ פֹּרֶ֥ה רֹ֖אשׁ וְלַעֲנָֽה

דִּלְמָא אִית בְּכוֹן גְּבַר אוֹ אִתָּא אוֹ זַרְעִי אוֹ שִׁבְטָא
דְּלִבֵּיהּ פְּנִי יוֹמָא דֵין מִדַּחְלְתָא דַּייָ אֱלָהַנָא לִמְהָךְ
לְמִפְלַח יָת טָעֲוָת עַמְמַיָּא הָאִנּוּן דִּלְמָא אִית בְּכוֹן
גְּבַר מְהַרְהֵיר חֲטִין אוֹ זָדוֹן

Perhaps Onkelos sensed that the very end of the pasuk: פֶּן יֵ֣שׁ בָּכֶ֗ם שֹׁ֛רֶשׁ פֹּרֶ֥ה רֹ֖אשׁ וְלַעֲנָֽה is parallel to the very beginning of the pasuk: פֶּן יֵ֣שׁ בָּ֠כֶ֠ם אִ֣ישׁ אוֹ אִשָּׁ֞ה א֧וֹ מִשְׁפָּחָ֣ה אוֹ שֵׁ֗בֶט
where the clause at the beginning has a pure sequence of "or"s.
The תרגום המיוחס ליונתן there keeps it as a vav and doesn't switch it to an או.
2 - In Chumash:או to Targum:vav, we have the following single exception in במדבר יא:ח to the normal או=או match

שָׁ֩טוּ֩ הָעָ֨ם וְלָֽקְט֜וּ וְטָחֲנ֣וּ בָרֵחַ֗יִם א֤וֹ דָכוּ֙
בַּמְּדֹכָ֔ה וּבִשְּׁלוּ֙ בַּפָּר֔וּר וְעָשׂ֥וּ אֹת֖וֹ עֻג֑וֹת
וְהָיָ֣ה טַעְמ֔וֹ כְּטַ֖עַם לְשַׁ֥ד הַשָּֽׁמֶן

שָׁיְטִין עַמָּא וְלָקְטִין דְּצָבֵי טָחֵין בְּרִחְיָא וּדְצָבֵי
דָּאֵיךְ בִּמְדוֹכְתָא וּמְבַשְּׁלִין לֵיהּ בְּקִדְרָא וְעָבְדִין
יָתֵיהּ גְּרִיצָן וְהָוֵי טַעְמֵיהּ כִּטְעֵים דְּלִישׁ בְּמִשְׁחָא

Here Onkelos actually interprets או as "and" (with the caveat that things might have changed here due to the Targum adding in the word ּדצבי for explanatory purposes).
So it seems at least according to the פשט as interpreted by Targum Onkelos, while vav-prefix="and" and או="or", there can be rare exceptions.
Answer: Technically, it both never and always means "and".
In Hebrew, each word derives its meaning from a combination of its letters and vowels, each of which has a single fundamental meaning. The Vav prefix consists of a single vav (shva is not a vowel at all, just a marker for pronunciation reasons). Therefore, it reflects the single fundamental meaning of the letter Vav.
The word "vav" in Hebrew means "hook". As with every letter, Vav resembles its meaning, appearing as a rod with a shallow hook at the tip.
The function of Vav as a prefix, therefore, is to connect the previous word or phrase to the word to which it is attached. In English, we usually use the word "and" for such a connection, but the connection indicated by Hebrew Vav is slightly more encompassing than that.
For example, in the Passuq "וּמְקַלֵּ֥ל אָבִ֛יו וְאִמּ֖וֹ מ֥וֹת יוּמָֽת", the verse is most literally translated as follows:
"And [whomever] curses his father, AND his mother, shall die death."
In Hebrew, the Vav prefix connects the word "Father" to the word "Mother" more strongly than the grammatical break indicated by the cantillation (which I represented using a comma). However, in English, the comma is stronger than the word "and", which turns the verse into nonsense. Removing the comma, however, would make the verse seem as if the death sentence applies only if he curses both his mother and his father, which is not the case. Therefore, the Vav is commonly translated as "or" to entirely avoid this problem:
"And [whomever] curses his father OR his mother shall die death."
In conclusion, the Vav prefix retains its usual meaning even in this case, where it's translated as "or."
Comment: What does this add to previous answer?


Why do skin tones become yellower / oranger when the flash is on?

Question: When I take pictures of people, the yellow and red tones seem to be enhanced and the result is a more jaundiced complexion in best case scenario and orange and a bit shiny if their skin is a bit oily. This only occurs with flash on. Is there anyway to remedy this situation, because sometimes I need flash on. Could it also be the orange autofocus light's fault?
Comment: Are you using direct flash, pointed right at the subject? Can you post an example?
Comment: @NitinKumar It's not white balance. I've tried the different settings and they all have that tinting.
Comment: @mattdm Yes it's direct flash, and at the moment I don't have examples as I normally delete those pictures since the complexion is extremely unflattering.
Answer: Its unlikely to be the autofocus light, unless something is broken.
Its probably really white balance. If you shoot raw you can correct it in post-processing fairly easily, which can keep you from having to throw out shots that have good expressions.
You can try using a piece of white cardboard (say an index card) to redirect the flash up onto the ceiling, if its painted white. Do it as an experiment, just to isolate the cause. Of course, if the ceiling is purple, then expect a purple cast to the photos.
Comment: Thanks. The problem was the flash and redirecting the flash elsewhere or even minimizing the flash really helped!
Answer: It can also be result of low quality flash. I'm not sure about the physics behind it, but what happens is that flash of light does not contain whole spectre of light and as a result you have some colours lightened more and some less. It can result in orange skin, but it can also lead to other colour anomalies.
I'm sorry for not giving more information, it's been some time since I used flash. I hope this can be helpful enough to lead your research
Answer: It's worth noting that most cameras ignore your white balance setting when using a flash.  Exceptions are typically for "set" white balance relying on a test exposure of a white surface that is typically taken using the flash (when flash is set explicitly).
The camera typically expects a certain color temperature from an external flash and is likely producing what it expects when using the internal flash.  If your external flash has a lower color temperature than the camera expects, you'll get reddish tinted results.


Problem with stroke

Question: I am creating a leaf from scratch in illustrator, I made the stroke a different color than the fill, and now I can see that the stroke is sort of distorted and is not properly lined up to the actual shape itself. How can I fix this?
Comment: It is hard to say what is going on with your drawing without more info or a screenshot- it could be that you have an "effect" applied to the path that is making it not adhere exactly to the path (roughen or zigzag maybe ?) a look at the appearance panel would be a good place to start- it seems unlikely that the distorted stroke has anything to do with your different colored fill
Comment: The Stroke appears to have a brush applied to it. Chances are it's the brush stroke causing the apparent misalignment. Change the setting to "Basic" and see if it aligns.
Answer: As Scott mentioned you probably have a brush applied to the stroke for some reason. Open up the Brushes panel from the Main Menu > Window > Brushes and click the 'Basic' style as shown below.
Comment: I just now tried to change it back to basic, it's still showing the same appearance for some reason.
Comment: What happens if you just remove the stroke completely then ?
Answer: I guess you have drawn a separate stroke shape which doesn't fit well enough. Remove it and insert a new to the base leaf shape or (or a copy of it, no fill). Use the width tool to get some variation.
If you have a copy of the leaf shape you can even split the curve with the Scissors to get individually adjustable stroke shapes.
An example:

My basic leaf shape with no stroke

An uniform stroke is inserted

The width tool is used to get some variation. The stroke is not a separate shape in this case.

Problem with stroke


Do genitals need to be censored even in non-pornographic works in Japan?

Question: Building on this question, I want to know how the law is interpreted for things that just happen to feature nudity, but aren't meant to be consumed as "pornographic material". Example: sculptures, images or 3d models of naked people. How does the law treat these things? Does it matter if it's pornographic in nature or does the mere presence of genitals require it to be censored in some way?
Answer: If the work is determined to have artistic merit, even if it might be considered by some as "obscene", it seems Japan will eventually find it's OK. So photos of classical sculptures/statues should be fine. Photos of people, or 3D nude models, possibly, depending on content and context. But you may face a legal battle unless the work is very clearly for artistic and not pornographic reasons.


Given a four note combination under the span of a fourth, does this chart correctly show the number of times it will appear in a scale?

Question: I have made this chart
that shows how many times will a four note combination under the span of a fourth whether perfect or augmented appear in a scale and some observations, so I wanted to ask you if this chart correctly reflects this and if my observations are correct or utterly wrong.
Comment: All this is very dependent on the definition of *tetrachord* - and that's where it all falls down.
Answer: Yes, regarding the number of times appearing in the scales.
Two comments about your observations section:
One, you refer to Gregorian modes, relative major/minor, natural minor, etc. All of that could be summed up as simply the diatonic gamut of ABCDEFG, which contains 2 major, 2 minor, 2 phrygian, and 1 lydian tetrachords.
When you mention that the diatonic gamut contains those tetrachords is sort of hints at looking at the tetrachords on each scale step, like this...

C - major tetrachord    CDEF
D - minor tetrachord    DEFG
E - phrygian tetrachord EFGA
F - lydian tetrachord   FGAB (not a P4 tetrachord)
G - major tetrachord    GABC
A - minor tetrachord    ABCD
B - phrygian tetrachord BCDE

While that is true, you will not be able to do the same thing with the non-diatonic scales. Consider, for example, C harmonic minor...

C  - C D Eb G  minor tetrachord
D  - D Eb F G  phrygian tetrachord
Eb - Eb F G Ab major tetrachord
F  - F G Ab B  (not a P4 tetrachord)
G  - G Ab B C  harmonic tetrachord
Ab - Ab B C D  (not a P4 tetrachord)
B  - B C D Eb  (not a P4 tetrachord)

That leads to the second point. When saying a scale contains various tetrachords, it sort of obscures the fact that a lot of the 4 tone sequences of various scale will not be P4 tetrachords.
A more common reference is to show which of the P4 tetrachords (major, minor, phrygian, and harmonic) separated by a P5 comprise various scales. For example, the major scale is two major tetrachords separated by a perfect fifth. Or, the melodic minor scale is a minor tetrachord and a major tetrachord separated by a perfect fifth. Etc. etc.
There is a good theoretical reason to look at scales and tetrachords in that way. Using C as tonic, and using only P4 tetrachords, all of the scales thus derived will have principle tones of C F G C, or a tonic with two tones a perfect fourth and a perfect fifth above the tonic, which gives us the all important tonal scale degrees. From there all the various tones of D E A B become effectively the modal scale degrees. The method provides more than a whole heap of scales, it provides a framework for understanding the tonal structure of the scales.
I'm not saying you shouldn't make your chart, but just pointing out the reason why joining two P4 tetrachords is a common music theory concept.
Comment: I think the first minor tetrachord got a typo, G for F?
Answer: From Alfred's Essentials of Music Theory:

A tetrachord is a series of four notes having a patter of whole step, whole step, half step.  The four notes of a tetrachord must be in alphabetical order.

In a major scale, there are two places this pattern occurs.  Notes 1 to 4, and notes 5 to 8, so it appears twice in a major scale.
I looked at the Wikipedia Tetrachord definition which says:

In music theory, a tetrachord (Greek: τετράχορδoν, Latin: tetrachordum) is a series of four notes separated by three intervals. In traditional music theory, a tetrachord always spanned the interval of a perfect fourth, a 4:3 frequency proportion (approx. 498 cents)—but in modern use it means any four-note segment of a scale or tone row, not necessarily related to a particular tuning system.

While Wikipedia says:

In traditional music theory, a tetrachord always spanned the interval of a perfect fourth

They don't indicate the pattern of a tetrachord, which I've been taught is important.  The pattern is whole step, whole step, half step.  Also, Wikipedia says:

in modern use it means any four-note segment of a scale or tone row, not necessarily related to a particular tuning system

So I would say that just because someone calls a four note segment a tetrachord doesn't mean that it is a tetrachord.
So I guess the useful answer is, know your audience.  If you're being tested in a music theory class there is one right answer.  Learn that answer.  When you're in an informal setting with other musicians (who don't know music theory) they might refer to a 4 note sequence as a tetrachord, and you can at least understand what they mean when they say it.
Comment: Well, a technicality: I'm not sure that "C-C#-E-F" would be considered a segment of any "scale or tone." If you spelled the C# as Db, presumably it would.
Comment: So the `tone row` G,Ab,B,C (intervals are half-step, minor 3rd, half-step) are last 4 notes of C harmonic minor scale match this pattern.  See diagram at https://en.wikipedia.org/wiki/Minor_scale.  I don't consider this a tetrachord even though Wikipedia's definition allows it.
Comment: The definitions (Alfreds and wikipedia) are different.  I believe what I've been taught which is the Alfred's definition is the correct definition.  But I respect others opinions which is why I shared the Wikipedia definition.  In your comment that says I said there are four tetrachords, I think you misunderstood me.  There are two tetrachords in a major scale (1-4 and 5-8), they happen to match the Ionion and Mixolydian modes, but that is unrelated to the definition of a tetrachord (IMO).
Comment: Actually, as I think about it, maybe [it could be](https://en.wikipedia.org/wiki/Tone_row). The usual definition is, in the context of "12-tone" or serial music, a complete set of all 12 chromatic pitches, but arranged in a specific order—a sort of 12-tone "melody." But the Wikipedia sentence wouldn't make sense with that definition, unless you re-ordered them in order of pitch... in which case it's just a chromatic scale. Maybe it used the term more broadly to cover more exotic "scales."
Comment: Yup. My point was that, for most "garden-variety" meanings of "scale," the enharmonic spellings are such that you don't repeat or skip a letter, thus Db instead of C#. Meanwhile, to the big-picture question of "what 'tetrachord' means," I think you're onto it: it can mean *any* 4 neighboring notes, but we talk about the major one so often that sometimes we use it as a shorthand, like saying "C chord" without bothering to say "major."
Comment: Fair enough. I think "you're both right"; that if you walk up to a random person and ask them "what's a tetrachord" they'd say whole-whole-half, but neither is it out of line to discuss other divisions of the fourth as "other types" of tetrachords.
Comment: @PatS the tone row G-Ab-B-C is m2-A2-m2, you can't say that the interval between Ab & B is minor 3rd, as a minor 3rd would be Ab-Cb, which is en-harmonically the same, but not functionally.
Answer: Yes, the chart is correct. Here it is recreated in text for future readers.

Tetrachord
Tone composition
Major
N. Minor
H. Minor
M. Minor (asc.)
H. Major

Ionic
W-W-H
2
2
1
1
1

Doric
W-H-W
2
2
1
2
1

Phrygian
H-W-W
2
2
1
1
1

Lydian
W-W-W
1
1

2

Harmonic
H-A-H

1

1

Total

7
7
4
6
4


Numpad view not working properly

Question: This is making me go nuts. Whenever I'm trying to go to the numpad view, instead of going into the 2D and showing only 2 axis, it's trying to show and think about the depth of the third axis.
This is how it should look:  This is how it looks instead:  Please help me, it has been bothering me for a while but I can't even find anywhere how to fix this (oh also the background isn't full of cubes either.. :(
Answer: You are in Perspective view.
Hit Numpad 5 to switch to Ortographic.
Perspective - all the horizontal lines appear to converge into a vanishing point in the middle of the horizon: the point of view is a... point
Ortographic - all the horizontal lines appear as points: the point of view can be thought of as an infinite plane

Numpad view not working properly


A linear algebra exercise from Griffiths "Introduction to quantum mechanics"

Question: (Edited so that it obeys the rules of homework questions) I am stuck on this linear algebra problem from Griffiths's "Introduction to quantum mechanics". Can somebody give me some guidance? (I am interested to the sentence that is highlighted with red.)
Answer: Let's assume you start with an orthonormal basis $|e_{i}\rangle \, , \, i = 1, ...,N$ , where $N$ is the dimensionality of your vector space. Then we would like for the new basis elements to be defined as:
\begin{equation}
|\tilde{e}_{i}\rangle = S|e_{i}\rangle
\end{equation}
EDIT:
Since it's not allowed to provide a complete proof and I have been compelled to only provide a guideline here, what I can say is that you should then consider what kind of mathematical condition orthonormality implies. That of course should apply to both the old and new basis. You should also think how the Hermitian conjugate of such a matrix appears when dealing with a complex vector space such as this. From these it's fairly easy to deduce the unitarity of $S$.
Comment: This is a complete (or nearly complete) answer to a homework-like question.  We don't answer that kind of question here.  We're not here to do people's homework for them.  Instead, we give guidance when a question asks for help on a specific idea or principle.  The question does not ask for that kind of help, it asks for an answer, which is contrary to the kind of questions allowed here.   The question will be closed eventually.  Until then, please rephrase your answer to provide guidance or a direction.  Alternatively, you can delete your answer.
Comment: @rhomaios Yes, I just wanted to inform you.
Comment: Well, I cannot delete it anymore (perhaps this is a privilege I haven't unlocked yet), but I can edit accordingly.
Comment: @rhomaios I think the problem is that your answer was marked as *accepted* - and, as far as I know, you cannot delete it yourself in this case. But the OP could remove the check mark such that you could, if you wanted to, delete the answer.
Comment: @JasonFunderberker Since it's edited now there would be little point in further deleting it. But thanks for pointing it out.


How do I find the gas consumed by a contracts extrinsic?

Question: I am querying extrinsic data and I am able to fetch gasLimit and gasPrice out of Extrinsic.method.args. But how do I fetch the amount of gas used from an extrinsic?
Comment: Hi, are you using contracts or pallets? Because gas is a contract specific terminology while pallets use weights to determine the cost of a transaction . Please do clarify
Comment: @islami00 it's a contract
Answer: Gas and weight are one and the same concept when it comes to pallet-contracts. We merely kept the name gas for historic reasons. The gas limit you supply to the contracts.call extrinsic directly influences the weight of the extrinsic (1to1 translation).
So what you want to index is the system.ExtrinsicSuccess or system.ExtrinsicFailed event emitted by the contracts.call exrinsic. It contains a weight field which tells you the overall weight of the extrinsic. This is essentially the gas that was consumed + static overhead of the extrinsic.
I think things get clearer when you look at the weight annotation of the call extrinsic:
#[pallet::weight(T::WeightInfo::call().saturating_add(*gas_limit))]
pub fn call() { ... }

Comment: Hi! thank you for the answer! is it the same in moonbeam too?
Answer:
Click the image for better resolution
With a contracts call extrinsic there will be an associated event ExtrinsicSuccess where you can deduce the gas consumed. You may want to look at using an indexer.
Answer: If you are using the Polkadot API, you need to check the Contract section (https://polkadot.js.org/docs/api-contract/start/contract.read/):
const { gasConsumed, result, output } = await contract.query.get(alicePair.address, { value, gasLimit });

Interacting with your contract (querying or executing functions) will return information like the gasConsumed in the execution, as shown above.
Comment: thing is, i'm not interacting with any contracts. I'm merely indexing the details of previous interactions on chain.


Date-specific hats - Timezone specific?

Question: Do date-specific hats (such as "'Tis The Season") respect a user's timezone?  I'm guessing not since the only region specific info in the profile is the Location field
Comment: UTC... always UTC.
Answer: Well the Stack Exchange knows  your IP.
They know when your awake.
They know when you've been bad or good.
So be good for...
Wait I went a little of topic there...
All of the time based events on the Stack Exchange are usually based on UTC Time.
Comment: Accepted for being the first accurate answer, as well as for making me laugh - the obvious criteria for accepting an answer in my book. :)
Comment: Interesting - I could have sworn that I'd seen some behaviour that suggested otherwise (votes today, for example).  I may have imagined it, though.
Comment: I can confirm that Amanaplan is right :)
Comment: @Aarthi you really know when we are sleeping?!
Comment: "Last visited: 6 hours ago" We can make educated guesses. :P
Comment: @Aarthi - can you set a reminder to wake me at 7:30 tomorrow, please?  I have a plane to catch. ;)
Answer: Most Stack Exchange events are based on UTC/Zulu time, just for consistency and convenience.
For this event, there are safeguards in place to account for timezone changes and spans. Don't worry -- as long as you meet the criteria, your hat should be awarded to you.
Comment: I'm not too worried - I'm unlikely to be posting on Christmas Day anyway, but I was curious.  Thanks for the clarifications.
Comment: Incidentally, shouldn't "'Tis The Season" take a leading apostrophe since it is a contraction of "It Is"?  Nitpicky, I know. :)
Answer: As far as I've seen, all dates happen in UTC; for example, the rep cap is for one day from midnight to midnight UTC. So I'm guessing that the day specific hats would work that way as well.

Date-specific hats - Timezone specific?


Can I remotely monitor printf results of a C program?

Question: I have a long running C program in which I've started from the Terminal.app using:
gdb program_name
gdb run

I'm using many printf statements to monitor the progress of the program. Unfortunately, the screen of the computer has been frozen since yesterday, but the process is still running. My question is, can I watch the progress of the program (i.e. the results of the printf statements) remotely?
I'm not that familiar with the terminal, but I know how to ssh and do some simple terminal tasks. The OS of the machine with the frozen screen is Mac OS 10.6.
Answer: Enable logging in gdb and use something like tail -f gdb.txt to watch the in a terminal.


MIT license, do I need to include it?

Question: If I program a website and use a JS plugin (http://responsiveslides.com/ for example), which is licensed under MIT. Does this mean I have to put the MIT-license somewhere in my directory. If so, where do I put it and does the user of the website have to be able to see it somehow?
Answer: What is not clear in this?

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

So yes, you have to.
The best place to put the license is, I would say, in a comment in the code of the JS plugin itself. It is short enough so that it won't be a problem.
If you minify the source before distributing it, you should make sure that the minified version still contains the license (preferably at the top, with some explanation on what it applies to). So yes, the user will be able to see it, by dispaying the source of the page.
I don't think anything forces you to have an About page to acknowledge the use of this library, although this is nice to do so.

MIT license, do I need to include it?


Add product to different website using rest API in magento 2

Question: I want to add product to different website in magento 2 using rest api. I am able to add product to the store but I am not getting any information as how to add product to different websites inside magento.
Answer: As far as I know, this cannot be done in the initial adding of the product through the API (it will always be added just to your default website), but you can then use the API to add it to other websites.
Documentation on catalogueProductWebsiteLinkRepositoryV1
Send a POST request to /V1/products/{sku}/websites (changing {sku} for the item's sku).
For the body of the request, use the format:
{
  "productWebsiteLink": {
    "sku": "{your-sku-again}",
    "website_id": {numeric-id-of-website}
  }
}

e.g.
{
  "productWebsiteLink": {
    "sku": "1234",
    "website_id": 2
  }
}

Answer: In addition to Luke Cousins answer, I'd like to point out that "Use default value" on the default store view gets deselected as soon as you link the product to a non-default website via /V1/products/{sku}/websites.
I haven't found a way to solve this problem.


Who is Clive Handforth meant to be in Little Big Planet 2?

Question: Clive Handforth (the guy with a notepad for a head) appears to be a parody of something, but I'm not sure what. Simply the "it's grim up north" stereotypical Yorkshireman?
Answer: I usually think of Monty Python whenever the Alliance leaders appear in the game.  Unfortunately, I'm not familiar enough with their skits/movies to know who Clive might be based on.
He does remind me a little of Eeyore.
I was just watching the latest season of The IT Crowd, when Richmond made a surprise appearance.  I immediately thought of Clive Handforth.  They sound and act a lot alike.  I think, as the original question states, that Clive is meant to be a stereotypical gloomy Yorkshireman.  Having never been to England, and knowing nothing of the culture or country, this is only a guess.
Answer: Based on splattered bits' answer, I think I've remembered what I was reminded of:
The Testing of Eric Olthwaite
By Michael Palin and Terry Jones - Pythonistas.
Comment: Spot on!  Even down to the accent. Until Media Molecule makes an official statement, this is it.


Hagen-Poiseuille for vacuum induced flow

Question: Does the Hagen-Poiseuille equation work for controlling vacuum induced flow via a tube? Decreasing the flow rate induced by vacuum via control of the radius of the tube and the length is the issue.
Comment: Ignoring viscosity, what is the formula, including Darcy-Weisbach considerations, for relating vacuum pressure in  mmhg (P1) to the length a tube of 4mm I.D. to achieve P2 flow rate at 2l/minute?  Thanks for first answer
Answer: "Vacuum" may mean several things. If it is just lower pressure and laminar flow, the answer is yes. But for me vacuum means that one is in the Knudsen regime, with the tube limiting the mean free path. So this does not work for ultra-high vacuum equipment.
Answer: Yes, the Hagen-Poiseuille equation just tells you the pressure gradient for a given flow rate, viscosity and tube dimensions. It doesn't matter how the pressure gradient is created. As long as the flow is laminar the Hagen-Poiseuille equation will apply.
Comment: Small comment: at sufficiently high flow rates, the input pressure of the tube is no longer atmospheric pressure and this will affect the result. It might be argued that by the time this is a significant factor, you no longer have laminar flow, and there are bigger issues...


Can I stay in US legally after my I-94 date if I have applied for Visa Extension 20 days back?

Question: My I-94 is expiring on 23rd Dec but I applied for visa extension on 5th Dec. I spoke to an immigration lawyer and she told me I can stay as long as my decision is pending. If the decision is Yes, then all good, otherwise I'll have to leave immediately. Is that how it works? I'm on a B1 visa.
Answer: Yes, if you have timely filed (i.e. USCIS received it before your status expired) a non-frivolous extension of status application, you can stay in the US for as long as it is pending, regardless of whether your status has expired or not. It currently takes a few months for them to give a decision on the application.
Comment: @Maverick: Just bring your I-539 receipt on future trips, showing that you had a pending application and therefore you didn't have any unlawful presence that would void your visa. The I-539 will probably be automatically denied after you leave, as there is no status to extend anymore, and if so, bring the notice of such denial to prove that it was after you left (and thus the application was pending for your entire period of stay) and it will be fine. Of course the officer may still ask you why you wanted to stay longer, etc, but there is no reason to believe it will cause any particular issue
Comment: Thank you Sir,
Just one more thing - SInce I asked for extension to attend an specific event on 27-29th Jan and I asked for extension until 2nd Feb. Most likely, I won't get any answer until then. Will I face some questions about it on my next visit?
Comment: Thanks again, Just for some clarification - I submitted a hardcopy I-539 application to Dallas but haven't received a receipt of application. Although, my application was received in their receiving office (confirmed by FedEx) Do they mail receipts usually or send them my email/phone?
Comment: @Maverick: They send receipts by mail. The "received date" is what matters and that shouldn't be more than one or two days after physically receiving it at most. Even though you haven't actually received the receipt, it's not a problem because you know that when you receive it, it will say that the application was received before your I-94 expired.