It there a easy way to handle floor cupping?

Question: Bit of a back story.
First we rent, but our land lord is awesome. As such, when things around the house need minor repairs, we tend to either just do them, or have them done. Major repairs he does, and we always work out the cost/rent issue as needed. As such, we have a great relationship, as we are allowed to do more to the house then if we were just a standard renter, and he has less upkeep.
For example, replacing ceiling fans, fixing toilets, repairing the dishwasher, we have just done, but removing trees, re insulating the attic, repairing the A/C he has always done.
The house has been expanded a number of times though the years but the original areas have real hard wood floors. This year was especially wet during the rainy season and the floors are now cupping in a few spots. I understand that some cupping is to be expected during our humid and wet season as the floors expand and pressure causes the issue. But historically, the cupping has gone away once the wet season was over.
We live in Florida, and this year has been especially wet. For example I don't think we have had enough of a dry spell in the past 5 month for the yard to stop being mud. It has rained most every day, and the days it didn't rain have not been dry enough for the water to evaporate well.
So back to the floors. This high moisture has caused cupping in 4-5 spots.  Is there an easy way for us to help along the drying / returning to normal or do we need to give up and call this major work.
What I have been able to find online has been a mixed bag. May sources say, just wait it out, with winter (our dry season) coming things should return to normal, and it's just a part of having real hard wood floors. Other sources say it's time to "rip up the floors" and start over.
Is there a place in between? Should we ride it out? Does delaying repairs to see what happens make the problem worse?
P.S. clarification: Water has not directly come in contact with the wood floors in any unusual way. That is to say that no flooding has occurred, no water set in a spot, or anything like that.
Comment: I'd be in the camp that that is just part of hardwood floors. It's possible they could have been installed too tight though.
Answer: Wait it out. If this was your place, you might ponder dealing with the root cause (probably, as noted in the comment above, that they're too tight), but this will return to reasonably flat in the dry season. Delay is not a problem.
Comment: I would agree on waiting. I would also look under the house is there standing water if there is a drain may be needed to remove the water and prevent even more long term problems. A dehumidifier in the home will also help but the root cause needs to be cured especially if there is standing water under the house.+


install desktop on server

Question: Will the desktop be consuming resources if Im not using it?  If so, how do I turn it on/off?
Comment: FYI there's also text mode browsers which you can use without a GUI, such as lynx, maybe that's enough to configure those devices ?
Comment: It greatly depends on what your desktop is doing while idle (i.e. what besides the desktop is running).  Call `uptime` before installing the desktop. Then after installation and one hours later call `uptime` again. If you need more details what is using resources, install `atop` or `htop` to monitor your processes.
Answer: I assume you have a clean install of Ubuntu Server. The apt command is equivalent to apt-get. I've tested all myself (except the first one). If you want a remote desktop like vnc server, you will need at least 3,4,5 or 6. See more info here: https://help.ubuntu.com/community/ServerGUI

Run GUI applications without GUI
sudo apt install xauth

Then any gui application that you install will also install the required dependencies. After you can connect with ssh -X command and run any gui application with X forwarding (never tried it with just xauth installed).
Minimal GUI:
sudo apt install xorg
sudo apt install openbox --no-install-recommends

Run the command startx and openbox will start (you can open a terminal there and run any application you want)
Minimal GUI with display manager:
sudo apt install xorg
sudo apt install lightdm-gtk-greeter --no-install-recommends
sudo apt install lightdm --no-install-recommends
sudo apt install openbox --no-install-recommends

After reboot you will see the lightdm login menu (I don't know how you can make it not to start automatically but I don't think it consumes too much resources when you haven't logged in). Maybe some themes won't appear correct, so if you don't mind more dependencies install all packages in the same order without the --no-install-recommends option.
A more functional minimal desktop environment (the one I use)
sudo apt install xorg
sudo apt install lightdm-gtk-greeter

Install lightdm-gtk-greeter first or it will install unity-greeter as dependency:
sudo apt install lightdm
sudo apt install lxde-core
sudo apt install lxpolkit #(pkexec can't run without it)
sudo apt install lxsession-logout #(logout button doesn't work without it)

A full lightweight desktop environment
sudo apt install lubuntu-core

It will install all dependencies like xorg, ligthdm, alsa and many more things.
A bit heavier desktop environment
sudo apt install xubuntu-core

It will install all dependencies like xorg, ligthdm, alsa and many more things.

You can use the --no-install-recommends option at 5 and 6 but you may need to install additional packages for the full desktop experience.
Answer: You can install desktop environments with sudo apt --no-install-recommends install lubuntu-desktop. This would be very lightweight
Thanks to Nick Weinberg from the comments: sudo apt install --no-install-recommends lubuntu-core should be better
Comment: `sudo apt install --no-install-recommends lubuntu-core` would be another,  even more lightweight option
Answer: Two additional options you can use in SSH connection
 Port forwarding
X11 Forwarding
Say a newly install application has a web administration interface that can only be accessed via localhost by default.  You can forward communications via ssh.
Additionally, you can install a web browser on the server and use x11 forwarding to transmit the application window display through ssh to the client.
Because x11 forwarding is transmitting images, it is usually slower than port forwarding.  Both can be useful tools depending on your situation.

install desktop on server


Facebook comment box not working in Joomla articles, works in K2

Question: We primarily use K2 for content on our site, but it doesn't have a working pagebreak function while Joomla does. We just started using Joomla articles and I'm trying to match the design between both. The one thing that's hanging me up is the facebook comment box.
The facebook comments works in K2 but doesn't in Joomla articles, even though the code is the same.
This is the code I'm using right after the body tag:

And this is what I have for the comment box in the article:
<div class="fb-comments" data-href="<?php echo HTTP_SERVER . $_SERVER['REQUEST_URI']; ?>"
data-width="450" data-num-posts="5" data-colorscheme="light">

The weird thing is that if you look at the source code, it's there. It just won't display it.
Any thoughts?
Btw, we're using Joomla! v2.5.8.
If you'd like to see the pages (comment box supposed to appear after AddThis buttons):
K2 aritcle – http://sciality.com/the-feed/robot-weight-loss-coach-helps-humans-slim-down.html
Joomla article – http://sciality.com/SCIFI/top-10-most-anticipated-scifi-movies-of-2013.html
Answer: Have used available plugins to work with native joomla artcles and it works just fine. for Instance, the Joomla Sp Comments works well with Native articles and even provide room for moderation on the articles.


Nashville Protest Felony Legislation Can't Possibly be Legal, Right?

Question: Tennessee passed some legislation yesterday in what appears to be a thinly veiled attempt to come down hard on protestors in the capitol. The most notable is that it is now a felony (with severe penalties) to erect a tent on state property between the hours of 10PM and 7AM. Is there any mechanism to prevent the legislation of arbitrarily severe punishments for crimes like this or is there precedent for overturning something like this in the court system?
Answer: The law is part of a larger bill modifying punishments for various crimes. For example it increases the penalty for vandalizing government property, creates offenses for assault on a first responder carrying out their duties (depending on the severity of the assault), increases the penalty for aggravated rioting, obstruction of highways and so on. It also clarifies that being assembling or being present at the scene of a riot is not an offense. The only new crime created is assault on a first responder. Unauthorized camping on state property was already a crime: this is an increase in the penalty for committing that crime. It does have a requirement for notice and continued violation for 24 hours, unlike vandalism where if you do the deed, you can be arrested.
The courts have not held that the First Amendment protects the right to trespass, assault or commit vandalism. The only viable avenue for a legal challenge is that the punishment is cruel and unusual (too severe). A change from Class A misdemeanor to Class E felony is the smallest increment in penalty. The state will argue that the increase in penalty is necessary to maintain public order, and that it is not arbitrary or capricious, because there have been many recent violations of the law. In general, when laws are frequently disobeyed, it is legal for the government to increase the penalty for breaking the law in order to achieve compliance.
Comment: I agree that it is *motivated* by events related to the protests, but nothing in the law specifically targets protests – that would be a First Amendment problem. It does so indirectly, because most vandalism of government property is part of a protest, most rioting is part of a protest etc. Do you think that rioting is intrinsically a First Amendment protected activity?
Comment: @DragonBobZ Except where specifically allowed by law or precedent, the courts do not delve into the motivations of legislatures. They deal with the laws and implementations themselves.  At the federal level this is derived from the Speech and Debate clause; [Tennessee](http://www.capitol.tn.gov/about/docs/tn-constitution.pdf) (see section 13) and most if not all other states have similar clauses.  So legislatures can totally pass a law with the express motivation of violating certain constitutional (state or federal) rights, but if the law in its own terms is constitutional then its fine.
Comment: @DragonBobZ [This seems to be a solid law review article on the applicability of legislative purpose to court analysis](https://www.nyulawreview.org/wp-content/uploads/2018/08/NYULawReview-83-6-Nelson.pdf).  They used to almost never delve into the purpose, but modern jurisprudence is more willing to tread there.  Race-based motivations in particular are something of a modern day poison pill, thanks to express constitutional prohibitions.
Comment: I guess my objection to this response might go too far into the territory of political opinion, but it seems clear that this is targeted at protestors, and holds jail time of up to 6 years, $3k+ fines, and a minimum holding period of 12 hours without bail (specifically for protestors). In my mind, specifically targeting protestors with harsher (and unusual, in the case of mandatory 12 hour holding) penalties is a bridge too far.
Comment: I disagree that the "rioting" label applies in any way to the situation, but that protests will be labeled as "riots" whenever it is politically convenient to do so.
Comment: @zibadawatimmy Thank you for the informative response.


Did Hezbollah ever have a flag with a nuclear mushroom cloud on it?

Question: In this video Salman Rushdie claims Hezbollah and Hamas was using mushroom clouds as their flag (1:31). Christopher Hitchens claims the Hezbollah's party symbol and flag was a mushroom cloud in Beirut (1:45). Is any of this true?
Answer: Hezbollah has used a variety of symbols, but there is no evidence that they have officially adopted any that relates to nuclear weapons. Christopher Hitchens does indeed use the words "party symbol" in the video, but that's probably a slip of the tongue. What he had in mind was a random banner in one rally (Dahiyeh, Beirut, 2009):

A huge poster of a nuclear mushroom cloud surmounts the scene, with the inscription oh zionists, if you want this type of war then so be it! During the warm-up, an onstage Muslim Milli Vanilli orchestra and choir lip-synchs badly to a repetitive, robotic music video that shows lurid scenes of martyrdom and warfare.
Source: The Swastika and the Cedar, Christopher Hitchens, Vanity Fair.

James Kirchick also attended the event, and gives a similar description of the banner:

A giant banner on the back wall bore the words, "Oh Zionists, Oh Zionists, if you want this type of war, SO BE IT," surrounding Arabic calligraphy bearing the same message in the form of a mushroom cloud.
Source: Lebanon on Tenterhooks, James Kirchick

Hezbollah's use of aggressive, chest pounding symbolism is no secret, but calling the banner "official party symbol" is a stretch. It never appeared in any official Hezbollah documentation and it hasn't made any notable reappearance in any form since that event.
Mr. Rushdie's claim is far too vague to investigate.
Comment: Excellent answer, I also can't even find a picture of it online which is pretty concerning and substantiates (in my mind) it being a one-time or minor thing.
Answer: A flag is a symbol of a people's hopes and dreams.
Neither Hamas nor Hezbollah depict a nuclear cloud on their flags and both are elected to govern in their own countries. But consider the subtext of the question posed by Hitchens: Is the leader of Iran or Hezbollah more dangerous than leaders of the US or Israel? Nassrallah or Clinton, Ali al-Sistani or Netanyahu? Trump? Don't even go there.
In the region only Israel possesses nuclear weapons technology supplied by the USA, France and the UK - themselves all nuclear armed.
While Hitchens has made unfounded allegations against Hezbollah, Australia's Bob Hawke (or Vulture?) actually advised Israeli Prime Minister, Golda Meir, to entertain use of nuclear weapons against Arab people during the 1973 Arab-Israeli war.
In 2006 Hezbollah drove the Israeli army out of Lebanon thus establishing years of relative peace (2006-16) for the people of that country; and this, after 30 years of civil war and Zionist occupation.
Regarding Rushdie's claim against Hamas using mushroom clouds on their flags, it is the apartheid state of Israel that is making Gaza unlivable through bombardment and sanction.
All is not what is alleged on the surface.
This image depicts a plane leaving a mushroom cloud over Clovelly, it does not mean that Australia is dropping nuclear weapons over a beach suburb in Sydney.
Comment: I'm sorry, but this does not add anything about the question which isn't already said much better in the other answer. When you just joined Stackexchange to say how much you dislike Israel, then this is unfortunately the wrong website. No, it is not because we would disagree with you. It is because we do not want political rants here at all, no matter for or against who or what.
Comment: I listened to the entire video and have attempted to respond to the subtext of Hitchens allegation.


what is the use of Serial.begin(9600)

Question: I mean what it does, why it is needed, what if we don't use it, similarly   for Serial.println(sensorValue).
Comment: Can you tell me what if i don't write it m program, what will happen
Comment: `Serial.begin()` initializes serial-port hardware and data structures so you can use the serial port.  See [Serial.begin](https://www.arduino.cc/en/serial/begin) and [Serial.println](https://www.arduino.cc/en/Serial/Println) doc pages at arduino.cc for details, and see the answers to [What is Serial.begin(9600)?](http://arduino.stackexchange.com/q/1569) for more background.
Answer: Serial.begin(9600); configures the UART interface and sets it to the right baud rate. If you don't to that you can't use the UART interface.
Serial.println(sensorValue); outputs the sensor value to the UART. If you don't use that you won't see the value of the sensor on the UART.
If you don't want to use the UART then don't use it. If you do want to use the UART then you must use the commands that control the UART.
Answer: As the name suggests, serial.begin(9600) is a command you give to the Arduino to begin serial communication. I'm assuming you're a beginner. Anyway, as you might've seen on the IDE, there's a serial monitor. It outputs data that you configure it to output. It won't work unless you begin the serial communication using. The serial.begin(x); command. X is a variable baudrate, and I highly suggest going with 9600.
Okay, also, serial.println(sensorValue) is a command that the program gives to the Arduino to print the variable sensorValue to the serial monitor. Keep in mind that you can also print this through a Bluetooth module by connecting the tx to the rx and the rx to the tx pins. Hope this helped! :)

what is the use of Serial.begin(9600)


Can i use my old MacBook charger on my new Mac?

Question: I have a 2011 15" MBP, that uses a 85W power supply.
My old 2008 MBP 15" also has a 85W power supply, but I cannot get it to work. Shouldnt it? Its the same watt power, and the adapter fits.
Comment: Maybe the power supply is dead? Did you try it on another computer, and did you try another supply?
Comment: Then it seems the power adapter is dead.
Comment: What are the models of the chargers? (But I think it should work either way)
Comment: They are both "85W MagSafe Power Adapter"

2008: Model no.: A1222, Input 100-240V - 1.5A. Output: 16.5-18.5V 4.6A max.

2011: Model no.: A1343, Input 100-240V - 1.5A. Output: 18.5V 4.6A.

So they should be compatible. I tried the old one on my girlfriends MBA 2011, and it dit NOT work.
Comment: Does the old power adapter show any lights at all when connected to either MBP?  Have you tried doing a SMC reset on the MBP that isn't charging?
Answer: The way Apple power adapters are designed is that you can use any charger on any laptop that has the same, or lower, power rating. For example, you can safely use an 85W power adapter (for MacBook Pro) on a MacBook Air (which requires only 45W) or MacBook (which requires 65W).
However this does not work the other way around, you cannot use a MacBook Air (45W) adapter to power a MacBook Pro.
A 2008 MacBook Pro adapter rated at 85W should power a 2011 MacBook Pro with no problem. If this is not the case, then the adapter is faulty.
Comment: @octern That's pretty much what happens - I've experienced it too. My Mac is aware of my adapter's wattage (it's shown in System Profiler under Power) and while they don't recommend it, they've obviously designed the power supply to avoid overloading the adapter. I believe it will even draw extra power from the battery if the adapter can't provide enough.
Comment: What happens if you use a charger on a mac with a higher power rating? I've always heard (and experienced) that it works fine, except that charging may take longer, and you may not be able to get a net charge increase if the computer is operating at maximum power usage.
Comment: Yes, you would impact the health of your battery doing that for prolonged periods so that is not recommended.
Comment: I think I ruined some MBP 13 and MBA adaptors by using them on MBP 15's.  The other way around never did hurt.
Answer: Yes.
Apple sells and markets the Cinema Display with an 85 watt adapter and it's an accessory for all MacBook whether your portable shipped with an adapter of 45 watts, 60 watts or 85 watts.
Using your higher rated adapter with a Mac that draws less power is safe to do. Going the other way is also safe - but the Mac will either not charge, charge slowly or work fine depending on how much power it needs from moment to moment.
Answer: After 2 years my Macbook Pro battery life has seen better days. It will only last 2 hours max. However, I recently visited friends and forgot my 85W power supply. Instead I charged up with the 13" Macbook 60W adapter. Yes, it took longer to charge all the way. However, I found a seemingly rejuvenated battery - with life extended to 4-6 hours depending on what applications I'm running.
To test this phenomenon, I have since tried multiple charge cycles with both a 60W and 85W adapter. Sure enough, every time I used the 60W charger I had a much longer battery life. And when I switch back to my brand new 85W power supply, I'm back to about 90 minutes battery life.
I've discussed this with several physicist and engineer friends, who can't offer an explanation. I assumed that the battery life was running down with time (even though I maintain proper battery training protocol) but I can't argue against the reality that using a 65W adapter has yielded a bigger charge and longer life. Go figure?
Answer: I have only just found out that adaptors are universal. I saw the new shape attachment on my MacBook Pro and thought it would not fit my old Macbook. The old 65W adaptor works well on my upgraded 2011 Macbook Pro and vice versa. The battery life is good. I'm so happy to discover this.


What rules can be used to infer statement endings for a language where they are implicit?

Question: In a lot of older C-family languages, lines of code (statements) must be ended with an explicit character (generally a semicolon). However, newer languages support inferring where statement endings should go. What are good parser rules to use for inferring statement endings?
Comment: https://stackoverflow.com/a/2846298/6333444
Comment: Note that in terms of having a simple non-ambiguous grammar it is *very* helpful to have an EOS token. Automatic EOS insertion always come at the price of having some bad corner cases. The trick is to minimize them.
Answer: A viable option is simply for every possible expression of the language to be self contained (i.e. with an unambiguous start and end).
Languages that do this is (that I know of) are Lua and Gleam: while at first it may appear as using newlines to end statements, every expression is either explicitly close or inferrably done by the next expression (as it's the case for infix arithmetic operators)
The following Gleam program
import gleam/io
import gleam/int

pub fn main() {
  let x = 8 + 8
  let y = {
    "meaningless"
    24 - 8
  }
  let add1 = fn(n) { n + 1 }
  let z = add1(7)

  io.print(int.to_string(x+y+z))
}

can be compressed and work just as well on a single line:
import gleam/io import gleam/int pub fn main() { let x = 8 + 8 let y = {    "meaningless" 24 - 8 } let add1 = fn(n) { n + 1 } let z = add1(7) io.print(int.to_string(x+y+z))}

This wouldn't be possible with the ML-style open expression syntax (i.e. application by juxtaposition).
Comment: Lua also does this.
Answer: When the next token in parsing would otherwise make no sense
A rule in some languages including JavaScript. For example:
{ 1
 2 }

In this case 1 2 is not a valid expression so JavaScript automatically inserts a ; in between, turning this into {1; 2}.
Comment: JS does not insert a semicolon for `1 2`, only for `1\n2`
Comment: Yea the specifics are either a line break needs to be in between or the offending token is a `}`
Answer: Python's grammar has the following:
simple_stmt: small_stmt (';' small_stmt)* (';')? NEWLINE;

The definition of NEWLINE then has to contend with Python's indentation rules, end-of-file determination, etc. If your language doesn't require white space the same way, then your lexer logic will be a little simpler.
A language I wrote uses the following:
eos : ';' | EOF | {endAhead()}? | {nlAhead()}?;

It still has to look ahead for end-of-file as well as block END tokens, but I didn't need to track indentation.
Answer: Infer end-of-statement aggressively at line end
If the end of the physical line could be the end of the statement, then it is. Only if the line ends mid-expression — within a bracketed construct, after an infix or prefix operator, or whatever else is applicable to the language — does it continue.
This rule ensures that lines never continue accidentally, which tends to be confusing and lead to unexpected errors. It is more or less the direct opposite of the JavaScript rule, which stops only if the statement could not continue — leading to situations like
var a = b * 2
// Log to screen or file
(verbose ? screen : file).write(a)

trying to call 2 as a function and complaining that it can't.
On the other hand, people often like to put their infix operator at the start of the continuation line, meaning that if the language both (1) has an overlapping prefix operator (like + or -) and (2) permits unused expressions as statements, this can pass unnoticed too:
x = y
    - z

In this case, the language will silently calculate and discard -z, rather than reporting an error. It's likely something the programmer will acclimatise to with use of the language, but there is a small trap there when the language allows.
A big advantage is that this rule is fully predictable based on the code the programmer is writing at the time, and won't ever inadvertently continue an earlier line that wasn't being edited. Each line "opts in" to being continued.
Comment: Unless you're okay with the language being newline-sensitive, wouldn't this rule mean you have to parenthesize all subtraction? `x=y-z` could feasibly parse as `x=y;-z;` even with no line break.
Comment: I tweaked the heading to mention line endings to match the body instead of leaving "whenever" open.
Answer: Indent continuation lines
A logical line continues across multiple physical lines as long as the subsequent lines are indented further than the initial line, and stops at the end of the physical line otherwise. This "hanging indent" matches the typical indentation pattern that people use for multi-line statements, so it virtually always does what the programmer intended. However, it requires including some indentation sensitivity in the parser, which is a complication. Otherwise, the statement ends at the end of the physical line.
The logical line ends as soon as a line at or before the initial indentation level is reached. For example, given this code:
while (condition) do {
    x := x ++ "a very long string with {interpolated - expressions} "
         ++ "spread over multiple lines" ++
         "with varied structure"
    !y or error
    z.update
}

the x := statement spreads across three lines, and stops before the prefix ! operator that matches the original indentation. The next two lines are single-line statements, on the same level.
Even in languages where line continuation works differently, programmers tend to indent the subsequent lines, so this aligns with general practice already, merely formalising it. They also, once they've learned what they're doing, don't tend to indent code at the same nesting level differently from line to line, so there are very few if any false positives in this approach. In the cases where they don't want to continue the statement, they don't need to do anything special.
This continuation is always explicit at the surface level: it doesn't matter what the contents of the lines are, where operators or brackets appear, or what sort of construct is in use, only the raw indentation. It is possible to pre-process the indentation away and mechanically join the logical lines together if desired, without needing to parse or understand the code. In that way the parser itself would not need to understand indentation.

This was the rule we ultimately adopted in Grace, and by and large it went unnoticed — the system always just did what people intended and they never thought about it. However, that language already had enforced indentation for bracketed blocks, so (1) the parser was ready to handle it, and (2) correct indentation was well trained into people before they started trying to split lines.


How can i create a VMFS datastore on an ESX 3.5 after ESX installation

Question: I have an ESX 3.5. After adding it to the VC i was getting an error message "The VMware ESX doesnot have a persistent storage". I think its because the VMFS partition has not been created during the ESX installation. Is there a way by which i can create the VMFS partition on the same ESX box.
Answer: Try this article: http://www.vmwareinfo.com/2008/10/creating-local-disk-vmfs-manually.html
The complexity of the task is going to depend on if you have partitioned and formatted all of your local space for ESX. If you haven't left any for VMFS, it'd probably just be easier to reinstall ESX. In the event that you are running ESXi on a thumb drive and don't have harddrives or a compatible controller, you will have to run your storage elsewhere (eg freenas, openfiler, NFS share)


Album covers getting mixed up on phone from iTunes

Question: I had this problem earlier but then knew how to fix it, it was when I sent songs to my iphone the cover art got messed up with art from songs I already have on my phone. I fixed this by uploading the covers on iTunes again but making them album covers then sending it to the iPhone but now I have the same problem but it wont let me fix it with the album art. It gets mixed with art from songs I already have on my phone. The art is correct on iTunes on my computer, but it's messed up on my phone, this has only happened with 3 of my songs and an album with 7 songs. I want to prevent it from doing it again. I have an iPhone 5s by the way, if that's needed.
Answer: I had the same problem. Twice... You will most probably have to remove and then re-sync your music.
Attach your iPhone and go to the music section. Remove the check mark to sync music. Your selections will stay intact for later re-sync. Sync your phone. When finished all music should be gone from the phone. Now re-check the mark for syncing music and do the sync.
This fixed the messed up covers for me.
Comment: Okay, it did fix the 2 album arts that I wanted to stay but then it mixed up the 2 previous album arts that i already had on my phone to the new ones. ??
Answer: I resolved the situation for myself...
I quit Apple music and re-installed Spotify and it works like a charm!


Is there a collection of popular/helpful comment responses for questions?

Question: I would like to quickly respond to a question with a comment such as "Your questions is not clear" or "Please include some code" or "This question belongs on Stack Overflow". Where can I find such a collection?
Comment: @Luuklag It's called "AutoReviewComments" and it's no longer being maintained.
Comment: Just a copy paste will do.
Comment: I think there is a userscript for this, don't know its name though. You might want to check out [Stack Apps](https://stackapps.com/).
Answer: Natively, there are a couple of shorthand links you can include in comments called "Magic Links". A list of all supported magic links is available in this Meta SE Q&A. These are useful in speeding up the manual commenting process, though.
What you're probably looking for is a userscript, which requires a script manager like Tampermonkey. As Sonic mentioned in the comments, there's a userscript called AutoReviewComments that adds a simple "auto" button next to the Add-comment modal when adding a comment, and allows you to select from a list of pretyped comments. However, that userscript's main repository is no longer being maintained.
Some users have forked the main repository and made their own, updating it when necessary. I personally like using a fork maintained by Machavity, a current Stack Overflow moderator. That fork is available here (install link). You can adjust the templates to fit your personal style or add new ones in accordance with your needs, but Machavity's fork has a good pool to choose from already.
Answer: I have extracted these from Machavity's script

It is preferred if you can post separate questions instead of combining your questions into one. That way, it helps the people answering your question and also others hunting for at least one of your questions. Thanks!
This question will probably be closed as a duplicate soon. If the answers from the duplicates don't fully address your question please edit it to include why and flag this for re-opening. Thanks!
Please don't add "thanks" as answers. Invest some time in the site and you will gain sufficient privileges to upvote answers you like, which is the Stack Overflow way of saying thank you.
Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.
This is really a comment, not an answer. With a bit more rep, you will be able to post comments. For the moment I've added the comment for you, and I'm flagging this post for deletion.
Please use the Post answer button only for actual answers. You should modify your original question to add additional information.
If you have another question, please ask it by clicking the Ask Question button.
If you have a NEW question, please ask it by clicking the Ask Question button. If you have sufficient reputation, you may upvote the question. Alternatively, "star" it as a favorite and you will be notified of any new answers.
This question appears to be off-topic because it is too localized.
The tags you were using are not appropriate for this question. Please review What are tags, and how should I use them?


Which Siri on which device does what?

Question: I am trying to figure out which device Siri does certain things. I have a 13" MBP, iPhone SE 2nd gen., and an iPad Air 2. I know if I ask Siri to set a timer, my phone will set the timer. But, why not the iPad? If I ask Siri to open Google Chrome, which is on all three devices, which device responds?
Answer:
I know if I ask Siri to set a timer, my phone will set the timer.

I'm assuming that you have "Hey Siri" enabled because I do this many times per day.

But, why not the iPad?

The iPad is fully capable of setting a timer via Siri.  I just set one on my iPad by invoking Siri with the home button.  It's also capable of doing so via "Hey Siri" as well. If yours isn't doing so - either via "Hey Siri" or manually, I suggest we look at this in another question, because that in and of itself is a technical issue.

If I ask Siri to open Google Chrome, which is on all three devices, which device responds?

I actually tested this.  Siri opens on the device that responds first.  Putting my iPhone next to my iPad and saying "Hey Siri" both devices responded however, it was always my iPhone that took control becuase it had the Siri "tone" first.  When that tone sounded, Siri on my iPad closed.  For the record, Handoff and Continuity was enabled.
For some reason, I don't have "Hey Siri" on my iMac with Catalina (10.15.5).  I can only invoke it by clicking the Siri icon or pressing the hot key assigned.  However, I would assume it functions in the same manner.
As for putting a priority on the device, decide which one you want to respond to "Hey Siri" enabled on one device and not on the others.  It's easy to invoke.  I have mine on my phone since I use it to control Apple Home (my lights, fans, etc.).  I don't enabled Hey Siri everywhere to avoid confusing things.
Comment: Just checked and my iPad didn't have Listen for "Hey Siri" enabled. It's interesting that iPhones react more quickly that others.
Comment: So true.  And interestingly enough, my iPad has the newer and faster processor. Conveniently, it works for me since my phone is my primary device, but I wonder about folks who use their iPad as their primary device.
Answer: MacWorld has a whole article about this in 2018. From the summary

The iPhone and iPad are the kings of Siri. Every request I made was answered best by these two devices, and the responses always matched up (though the language often differed).
The Apple Watch is the slowest to respond. Often times it would give me an I'll tap you when I'm ready message before offering up an answer several seconds later, even when connected to Wi-Fi and tethered to an iPhone.
The Mac is the worst Siri device. While it's fine for general knowledge questions, It can't set timers or alarms, can't control smart devices through HomeKit, and can't add songs to a playlist. Plus there's no (official) Hey Siri functionality.
HomePod is by far the best at listening and responding, and it's clear that Apple wants this to eventually be the high-water mark for Siri.
Siri on Apple TV is woefully underrepresented. It's missing key Siri components, including Hey Siri summoning and audible responses. And its answering left much to be desired, even when asking about movies.
Siri really needs a personality boost. Apple has added some fun interjections when asking questions and its responses are very natural, but it doesn't play games, read stories, or tell jokes nearly as well as Amazon Alexa or Google Home.
Answer: There's no different version of Siri for different device types. Siri is Apple's digital assistance service and is made available over an active Internet connection. What this means is that a request made to Siri is processed on Apple's servers, and you cannot use Siri without an active Internet connection.
With that said, Siri does not generally differentiate or use a different service based on the device type the request is coming from. Siri may or may not allow you to perform an action based on if that feature is available on the said platform.
For e.g., you can set a timer on an iOS app as the feature is available into the built-in Clock app. But no such functionality is available by default in macOS.
Additionally, it is possible to integrate Siri functionality in 3rd party iOS apps but the same is not available for macOS apps.
So even if it's possible to invoke a function available in a 3rd party app using Siri on your iPhone or iPad, the same would not be possible in macOS apps from same developer if they have an app on both the platforms.

Which Siri on which device does what?


image uploads using wrong permissions

Question: I am having a strange issue when uploading an image through the backend of magento. I currently have my /media/ permissions set to 777, however whenever I upload an image it changes the permissions to 600 which makes it not viewable until I change it manually back to 777. Is there a way to set it as default to be 777?
Comment: Possible duplicate of [Security Patch SUPEE-7405 - possible problems?](http://magento.stackexchange.com/questions/98220/security-patch-supee-7405-possible-problems)
Comment: After applying SUPEE-7405 v1.0, apply SUPEE-7405 v1.1 to change permissions back. There were 4 items that caused grief on the version 1 patch that are addressed by the version 1.1 patch.
Answer: Basically, the latest Magento security patch SUPEE-7405 affects file permissions on images uploaded from the Magento admin dashboard. Before applying the patch, uploaded files via admin panel such as product images, cms pages etc. used 0777 permissions and the patch changes these permissions to 0640 and 0750 which make them inaccessible for all users.
For easier demonstration, you can check the changes in this file:  lib/Varien/File/Uploader.php
diff --git lib/Varien/File/Uploader.php lib/Varien/File/Uploader.php
---
---
-        chmod($destinationFile, 0777);
+        chmod($destinationFile, 0640);
---
---
-        if (!(@is_dir($destinationFolder) || @mkdir($destinationFolder, 0777, true))){
+        if (!(@is_dir($destinationFolder) || @mkdir($destinationFolder, 0750, true))){
A new version of SUPEE-7405 has been released to resolve this issue but even without this revised version, you can permanently fix it with one of the following ways:
Option 1:
You can perform a manual change on the file  the file lib/Varien/File/Uploader.php to adjust the 0640/0750 permissions.
Option 2:
Because Magento expects the webserver to own the site files:
http://devdocs.magento.com/guides/m1x/install/installer-privileges_after.html#privs-after
The other way to resolve the problem is making the webserver the owner of the files
chown -R web-server-user-name magento/root/path
The webserver user name is commonly www-data or apache.
For more details, you can visit this tutorial
Answer: Magento use 700 permissions (drwx------) for the media/ and var/ directories give full control (that is, read/write/execute) to the owner and no permissions to anyone else.
Magento expects the webserver to own the site files:
http://devdocs.magento.com/guides/m1x/install/installer-privileges_after.html#privs-after
You can resolve this problem by making the webserver the owner of the files.
chown -R web-server-user-name magento/root/path

The webserver user name is commonly www-data or apache.
If you follow the instructions in the above link, the webserver will have read access to all files, and write access to media files and var files. This should be all you need for typical site operation. If you need to use Magento Connect you'll have to temporarily give the webserver write access to all files.

All file permissions are being set to CHMOD 640 which makes them inaccessible to all users.

Only the webserver user needs access to the files. There is no need to grant any permissions to all users.
You may want to grant access to a specific user if, for example, you need to edit or upload files via FTP. In this case, what I do is set a user who owns the file system and set the files' group to the webserver:
cd magento/root/directory

# Set ownership
# 'username' should be the file system owner username
# 'webserver' should be the webserver username
chown -R username:webserver .

# Give the user read/write access to all files.
# Give the webserver read access to all files
find . -type f -exec chmod 640 {} \;
find . -type d -exec chmod 2750 {} \;

# Give the user and the webserver read/write access to var and media
find var/ -type f -exec chmod 660 {} \;
find media/ -type f -exec chmod 660 {} \;
find var/ -type d -exec chmod 2770 {} \;
find media/ -type d -exec chmod 2770 {} \;
chmod 2770 includes
chmod 660 includes/config.php

The above commands will give your file system owner read/write access to everything and the webserver read access to everything. The webserver will also be able to write to the media and var directories.
This is a patch 7405 bug, look my search source

image uploads using wrong permissions


Regarding Proof of the independence of the sample mean and sample variance

Question: In this question  , I am unable to follow the hints given by @leonbloy in the second answer . Can somebody please write down a complete solution . I am stuck at the very first step .
Answer: I will not write down a complete solution, but I will get you started. The answer suggested you write $(\overline{X},A)$ as $CX$ for some square matrix $C$. Here I assume $X=(X_1,\dots,X_n)$. Expanding this, you want to fill in the square matrix below so that the following is true:
$$\begin{pmatrix} \overline{X}\\X_2-\overline{X} \\ X_3-\overline{X} \\ \vdots \\ X_n-\overline{X}\end{pmatrix} = \begin{pmatrix} * & * & * & \cdots & * \\ * & * & * & \cdots & * \\ * & * & * & \cdots & * \\ \vdots &\vdots & \vdots & \ddots & \vdots \\  * & * & * & \cdots & * \\ \end{pmatrix}\begin{pmatrix} X_1\\X_2 \\ X_3 \\ \vdots \\ X_n\end{pmatrix} $$
So, for instance, $\overline{X}$ should be the dot product of the first row of $C$ with the vector $X$. But you know that
$$\overline{X}=\frac{X_1+X_2+\cdots+X_n}{n}$$
so what must the first row of $C$ be? Similarly, you need to figure out how to write each element of the vector $(\overline{X},A)$ as the dot product of a row of $C$ and the vector $X$.
Now the covariance matrix of $(\overline{X},A)$ is given by $CC^T$. So once you have found $C$, compute the $(1,i)$-entry of $CC^T$ to find the covariance of $\overline{X}$ and $A_i$.
Comment: please give the form of $C$ . I have tried a lot and it still deceives me !
Comment: Say the first row of $C$ is $(c_{11}, c_{12},\dots,c_{1n})$. Then the dot product of this row with the vector $X$ is
$$c_{11}X_1+c_{12}X_2+\cdots + c_{1n}X_n.$$
On the other hand, this dot product should be equal to
$$\overline{X} = \frac{1}{n}X_1+\frac{1}{n}X_2+\cdots+\frac{1}{n}X_n$$
so what are the $c_{1i}$'s? Do the same for every row of $C$.


just installed ubuntu 14.04 on Dell Latitude d620 and no wired or wireless connection

Question: just installed ubuntu 14.04 on Dell Latitude d620 and no wired or wireless connection. Hardware: Dell Wireless 1490 Duel Band WLAN Mini-Card. Broadcom BCM4311 802.11a/b/g [14e4:4312]. Kernel driver:wl. I tried to install Synaptic package manager(downloaded it to a USB, then connect USB to 14.04 system) I don't think I am using the package manager right, or mabe I'm not install the drivers right. Any have a clue? And please don't say to just download the package.....I've done that 20 times and it doesn't register.
Thanks for any insight you can provide.
Answer: You installed a wrong driver for the wireless adapter. That probably is also the reason why Ethernet does not work as well.
Remove the wrong driver by running in terminal
sudo apt-get purge bcmwl-kernel-source

After reboot the Ethernet should work. Then connect to the internet and install firmware by
sudo apt-get install firmware-b43-installer

If Ethernet does not work for some reason, use this answer to install the firmware offline.


Cracking Knuckles in Zero Gravity

Question: Cracking knuckles has something to do with air bubbles, but would it work in the same way if there is no gravity? If not, how would it be different? Would there still be a popping sound and/or sensation?
Comment: Should be moved to space.se as it's about a real-world phenomena.
Comment: what a ridiculous & awesome question! re: sound, whilst 'there's no sound in space' is a common (para)phrase, in almost all situations where people say it.. there would in fact be sound - whales don't sing in the air.
Comment: Note that OP specify Zero gravity which do not exist anywhere in known universe, free fall is often mistaken for no gravity thus this question seems fine I suppose.
Comment: I agree with Gryphon that just because it is on-topic somewhere, does not make it off-topic here. Now, that being said, I don't see how that actually help building any world.
Answer: From Wikipedia

The cracking mechanism and the resulting sound is caused by carbon dioxide cavitation bubbles suddenly partially collapsing inside the joints.

The collapsing of the bubbles is due to pressure differential between the inside and the outside of the bubble.
When we consider the pressure in a liquid, we can distinguish two components:

pressure due to the proper weight of the fluid above the measuring point
pressure exerted from outside the fluid (i.e. atmosphere)

In microgravity 1 would be 0, but 2 will still be present (else any liquid in microgravity would immediatly evaporate).
Therefore, if the person cracking knuckles is in microgravity but still under some atmospheric pressure, the pressure differential will be of the same order of magnitude. Therefore it is reasonable to expect the same phenomena to happen.
Comment: As the cracking happens in fluid reservoirs on the mm-scale, the weight of the fluid is immaterial. All that needs to be considered is the external pressure, which on the ISS is sea level earth. As the partial pressure of carbon dioxide _inside_ the body would also not be specific to space stations vs earth, we can assume knuckle cracking in space to happen.

Cracking Knuckles in Zero Gravity


When making a credit transaction, why does it take the transaction a couple days to clear, but it can communicate the hold immediately?

Question: I find it interesting that if I make a purchase as a credit transaction -- that it takes a couple of days to clear, but yet, the hold can be communicated immediately.  If the networks in place can already immediately verify funds and place a hold -- why not just clear the transaction immediately ?
Comment: Makes it easy for reconciliation and removing erroneous transactions; i.e. items that did not go through fully.
Answer: Transactions are processed in batches because there's multiple parties involved. There are two main steps:

Authorization - that is what triggers the hold. The merchant through his own merchant account provider contacts the issuer of the card to ask whether the issuer would accept the transaction had it been submitted at that time. If the issuer would - the issuer gives an authorization code to the merchant, which is typically valid for 7-30 days (depending on the type of the expected transaction). As long as the code is valid, the issuer would put a hold on the account in that amount to cover for the expected transaction. This is more of a "smoke test" for the merchant that the card is not stolen/canceled, that it is not over the limit, and that it is likely to be OK to accept it.
Transaction - that's the longer process and is usually not done online but rather in batch, typically nightly. The only thing happening right away (even that not always) would be the merchant recording the transaction and the authorization code.

Once the transaction is processed by the merchant, it will then be submitted to the merchant account processor. This is done in batches, usually daily. The processor then credits the merchant account (balancing all the refunds, chargebacks, ect).
The processor then aggregates all the transactions and balances out its own cards (if the processor is also an issuer). The transactions using cards issued by others are then submitted to the network (Visa/Mastercard/etc).
The network, in another batch, then balances out all the transactions for the processor (balancing the amounts the processor is owed due to others' cards being used in its merchants with what the processor owes for its cards being used with other processors).
The network then distributes the transactions to the issuers to charge the accounts, which is also done in a batch - yet another. The issuers then accept that information and post the transactions to the respective accounts. When posting, the issuers match the authorization code recorded with the transaction to the authorization code attached to the hold, and remove the hold if there's a match. Sometimes the merchant get authorization but don't attach it to the transaction, and then you may end up with the transaction posted by the hold not removed automatically.
As you can see, this is a multi-step process with multiple parties involved. Since at this stage money is actually changing hands - it cannot be done online per transaction, since the volume would be enormous. It is done in batches, with only the aggregate balances moving around.
Answer: This behavior depends heavily on the merchant in question.  When you charge to a credit card, the information for that charge goes immediately to the credit card company, but the charge won't show as fully processed until the merchant confirms that transaction.  These captures are traditionally queued up and processed in batches, for historical reasons.
This separation between the information initially sent, 'authorization,' and the money actually changing hands, 'capture,' is the same thing that allows for things like tipping at a restaurant, where the actual amount varies from the initial authorization.  So there's some positive sides to the wait.
Lastly, there is a single step version of a credit card transaction, but it's not widely supported.


Switching from WebView to other views in Android

Question: I am developing a photo sharing app for Android.  I have a web site that I want the Android to get WebViews for most of it, but I want the android to have a native home screen rather than the web site homescreen.
As of right now, I open a WebView for login (this is needed because i must login with twitter) but after that I want the android to go to its own native home screen rather that the web site home screen.
I have tried using the shouldOverrideUrl() method to no avail.  Is it even possible to program and android app to switch from the WebView at a given url?
Answer: Just create a method to check for the URLs to catch. Then make it not call the URL and open the home screen.


Amazon Git Eb Tools not deploying

Question: I followed the help page here
and I created my application through the eb tools command line tools. I can see the application on command line, however when I log into my AWS Management console and select the region area, and click on "elastic beanstalk" I see the welcome screen asking me to create a new application,my question is why cant I see my application on the web interface? Also the application is running on the web because when I visit the url the link is active, but I see this message "Could not find rake-10.0.2 in any of the sources (Bundler::GemNotFound)" (which if anyone knows how to fix that would also help)
Thanks in advance
Answer: It turns out that somehow amazon changed my secret keys, and my instanced where not showing. When I updated the keys on my local machine everything began working correctly.

Amazon Git Eb Tools not deploying


Delete database tables on theme uninstall?

Question: How can I execute DB queries when theme installs and delete those tables on theme uninstall?
Answer: Yes, you can accomplish it by WP default functionality. Let me explain it.
1. While switch theme:
There is a switch_theme action that runs right after the theme is switched. switch_theme is triggered when the blog's theme is changed. Specifically, it fires after the theme has been switched but before the next request. Theme developers should use this hook to do things when their theme is deactivated.
<?php add_action('switch_theme', 'theme_deactivation_function'); ?>

Theme functions attached to this hook are only triggered in the theme being deactivated. To do things when your theme is activated, use after_switch_theme.
Delete a theme's options after deactivation:
add_action('switch_theme', 'mytheme_setup_options');

function mytheme_setup_options () {
  delete_option('mytheme_enable_features');
  delete_option('mytheme_enable_catalog');
}

switch_theme will only be called when your theme is de-activated.
2. After switch theme:
Theme functions attached to this hook are only triggered in the theme (and/or child theme) being activated. To do things when your theme is deactivated, use switch_theme.
In other words, the after_setup_theme represents the point at which WordPress sets up the current Theme, not the point at which the administrator activates and/or configures the current Theme.
<?php add_action("after_switch_theme", "mytheme_do_something"); ?>

Add options for your theme and set them to their default values:
add_action('after_switch_theme', 'mytheme_setup_options');

function mytheme_setup_options () {
  add_option('mytheme_enable_catalog', 0);
  add_option('mytheme_enable_features', 0);
}

after_switch_theme only fire when your theme is being activated.
Referance: switch_theme and after_switch_theme actions hook are located in wp-includes/theme.php
Comment: This is for when you switch your theme. Deleting the theme options when switching to another one is can be a bad user experience since switching themes shouldn't be a destructive action.
Answer: Theme activation use after_switch_theme
add_action("after_switch_theme", "setup_db");

function setup_db(){
   //run your create table statements
}

Theme deactivation use switch_theme
add_action('switch_theme', 'delete_db_things');

function delete_db_things(){
  //run deletion statements
}


Sausage discolouration - is it safe to eat?

Question: This morning, I found some sausages in the fridge that had been there all week.  The top of the sausage (that is, the surface of the skin facing upwards) had turned brown.  I initially thought that if I just fried them long enough, this would be fine; however, while frying I did a quick search on the web, got spooked and threw them away.
My question is: what causes this discolouration and, have I needlessly thrown three very tasty looking sausages in the bin?
Comment: Whenever you are faced with a situation like this, ask yourself "Am I willing to spend 3 to 5 days in the bathroom feeling absolutely terrible for the sake of eating ?" If the answer is yes, go ahead and eat. Otherwise, throw it out and order a pizza.
Comment: What type of sausage?  A fair bit of meat is colored reddish to look more "natural" but blood-less meat is not red (and blood darkens quickly anyways).  You'll often see steak for example start to look more brown as the coloring fades before the meat has actually gone bad.
Answer:
My question is: what causes this discolouration

Many meats are dyed to make them look fresher. They add red, cause meat is red right? Well no. Most meat will "brown" or "gray" as it is exposed to the air and the blood dries up (or drains out). This is not, in any way, a sign of bad meat. In fact it "may" be a sign of good, natural meat.
A YouTube Video that explains it

and, have I needlessly thrown three very tasty looking sausages in the bin?

Yes, probably.
Important note
When in doubt throw it out. A week in the fridge (not freezer) is border line for me. I would have probably cooked it, but I wouldn't fault someone else for not cooking it.
You can usually look for smell or slime to tell if meat is bad.
Comment: And don't freak out when you get home, and find that the ground meat in the package is almost purple (but a bright, even purple, not a dull, splotchy purple).  It means that the meat was just ground, and hasn't had enough time for the color changes to start
Answer: The one on top was probably exposed to air and its surface dried out which darkened it.
It's always better to be safe than sorry. I am a little more edgy and eat things others don't, but I have my limits of acceptable also. I wouldn't eat something a week old unless I was sure it was packed and stored properly.
Answer: The discoloring isn't a problem: it's just the meat reacting with oxygen in the air.  The same thing would happen, only more slowly, if you'd frozen the sausages.
The problem is possible bacterial growth.  By the time the bacteria levels become high enough to be visible, it's far past the point where the bacteria are dangerous.  Further, many bacterial excrete toxic substances that aren't inactivated by cooking.  This is why you should usually go with expiration dates rather than "what it looks like" to determine if food is safe to eat.  (There are some exceptions, where either spoilage is visible or it simply doesn't spoil at all, but sausage isn't one of them.)
Answer: The brown colour is because haemoglobin in blood oxidises in air (like rust forming on iron), but this is distinct from changes caused by bacteria that leads to food poisoning.
Comment: Sausages (other than blood sausages) contain little or no hemoglobin, which is only present in blood cells.


How to set a local user as "non-interactive" in Vista?

Question: As part of installing SQL Server on my PC I've created a specific user for it. When I log in now I'm offered this user as well as my own account. I remember in older versions of the Windows NT series there was an option in the user config dialog to set the user as non-interactive so they couldn't log in. I can't seem to find that checkbox in the Vista equivalent. Is there any other way to achieve this?
Answer: This article explains the Windows XP solution which also works in Windows Vista and 7.
It requires you to do some registry editing so be extremely careful when doing this.
If you want to disable the account you can edit the local policy as follows.

Open the Local Security Policy
Local Policies
User Rights Assignments
Double Click Deny Logon Locally
Add User
Comment: Short version: add the user to the _HKEY_LOCAL_MACHINE\Software\Microsoft\WindowsNT\CurrentVersion\Winlogon\SpecialAccounts\UserList_ registry key.
Comment: That tells you how to stop a username from appearing in the clickable logon screen introduced with XP, but it doesn't prevent a user from logging in as far as I can tell (that article says the accounts can still log in using the normal login dialog). I'm sure there was an option in NT4 and Windows 2000 that would completely stop WinLogon from accepting a particular user ID.
Comment: @U62 Updated the answer with the policy details to disable the logon.


Recreate UI or move it out of view?

Question: Which method would be best? What are the pros and cons? For example, if I have a main menu screen, I can easily start my game loop right as the user presses 'Start'. Which would be better, moving the 'Start' button as well as, 'settings, leaderboard, etc' buttons out of view? or to erase them and then recreate them when needed?
Answer: Erase them and recreate them as-needed. It is logically simpler and cleaner, and it avoids any potential problems that might arise from focus issues leaving the buttons and whatnot still accessible via the keyboard or other input device.
The only real reason to consider keeping them around but hiding them is if they are costly to re-create or show; generally this will not be a performance concern, and if it is it's worth first looking at whether or not you're doing something incorrect during the creation (such as reloading the textures from disk or whatever).
If for whatever reason you do have to go the route of simply moving the UI offscreen, make sure to take whatever precautions are needed to ensure they are totally disabled.
Comment: thanks, the main reason for my question is because my character shows up on the main menu screen in an idle animation, but the character is not part of the same class as the UI, so I was thinking about how to remove and redraw the character if the user clicked to enter the settings for example, which led me to think about the buttons in general, basically im recreating the buttons as suggested but i'm moving the character
Answer: It is simpler to debug 2 distinct simple code paths than it is to debug 1 code path where a boolean flag is used a lot to enable or disable features.
In other words for stuff like the main menu, pause screen you would have a different function you call from the main game loop:
switch (mode){
case MAIN_SCREEN: do_main_screen_stuff(); break;
case PAUSED: do_pauze_screen_stuff(); break;
case GAMEPLAY: game_update_and_render(); break;
case LOADING: loading_screen(); break;
}

But just because you aren't in GAMEPLAY doesn't mean that you can't render the player character doing some animations.
For example Assassin's Creed loading screen let you run around in a empty world. The only code needed for that is the animation blending systems and the inputs, there is no need to check collisions with the world geometry or trigger areas, no need to run the render culling operations because there is nothing to render except the player character.
There is reason to move stuff offscreen when not used however. For example if you want to avoid lag in late game because more stuff becomes available in the hub world, instead you can move the trigger areas that activate later out of bounds so the extra checks are always happening and framerate stays constant.

Recreate UI or move it out of view?


question on applying l'Hopital's rule

Question: I'm considering the limit
$$
\lim_{x\rightarrow -\infty} \frac{x}{e^x}.
$$
This is an indeterminate form $-\infty/-\infty$ so I should be able to apply l'Hopital's rule to get
$$
\lim_{x\rightarrow -\infty} \frac{x}{e^x} = \lim_{x\rightarrow -\infty} \frac{1}{e^x},
$$
which however is incorrect as the limit should be $-\infty$. What am I missing here?
Comment: This is not in the form $\infty /\infty $.
Comment: I'm sorry but I am not sure how the other answers have answered the OP's question, which is regarding why L'Hopital's rule doesn't seem to apply in this case. It is true that $$\lim_{x \to -\infty} { x \over {e^x} } = -\infty $$ but if L'Hopital's rule is applied then it would appear that the above limit is equal to $\lim_{x \to -\infty} { 1 \over {e^x} }$ which is however equal to $+\infty$. Has any of the preconditions of L'Hopital's rule been violated here, whereby the calculated limit is faulty? Perhaps is it because the original limit is not indeterminate at all, but in fact it is determi
Comment: @jamadagni: Yes the precondition has been violated as Thomas has stated in his answer, because $\lim\limits_{x\to - \infty} e^x = 0$, hence the limit is not in indeterminate form, so we can't apply l'Hopital.
Answer: Your limit is not of the $-\infty / -\infty$ form, but of $-\infty / 0$ form. Note that
$$
\lim_{x\to -\infty} e^x = 0.
$$
So in all you are taking a very large and negative number and dividing it by a very small (and positive) number. That all gives a very large and negative number. Hence the limit is (as you write) $-\infty$.
Answer: Beside to @Thomas's answer you could use some first terms of the expansion of $\exp(-x)$: $$\exp(-x)\cong 1-x+(1/2)x^2-(1/6)x^3+(1/24)x^4-(1/120)x^5$$ It is obvious that your limit when $x$ tends to $-\infty$, would be $-\infty$.

question on applying l'Hopital's rule


How are pentatonic scale degrees listed?

Question: I'm aware that the origin of the pentatonic scales probably preceded the diatonic scales, so does that mean that the designation of scale degrees for a pentatonic scale would be 1,2,3,4, and 5, or is it generally accepted that the scale degrees for pentatonic scales are based on the diatonic scales as in 1, 2, 3, 5, and 6, degrees and are designated in that fashion?
Comment: I trust you refer to the *major* pent. rather than the more used (in the guitar world) the minor pent.
Comment: Are we talking about history of making music or history of analyzing music?
Comment: @aparente001- Actually, I'm asking about current analysis language, but the history helps  me understand the reasons why.
Answer:
Numbers: 1 2 3 5 6 don't represent pentatonic scale degrees. They list 5 pitches of a major scale used in the specific pentatonic scale – major pentatonic in this case. In jazz/pop nomenclature major (ionian) scale is a typically used reference, so e.g. a scale commonly called minor pentatonic has pitches 1 b3 4 5 b7. There are some other conventions, e.g. this page: https://en.wikipedia.org/wiki/Pentatonic_scale shows examples of some pentatonic scales using minor (aeolian) scale as a reference.

Scale degrees: tonic, supertonic, mediant, subdominant, dominant, submediant and subtonic were developed to describe western music. If a pentatonic scale is used in the context of western music, these scale degrees are probably still the actual reference and it's reasonable to use them. If you speak of a pentatonic (or any other) scale used the context of non-western music, and you want to use other terminology then probably you should introduce the reader (with western music education) to that terminology first.

Pentatonic is any scale with 5 pitches. There are many pentatonic scales in use. Expression like "third note of a pentatonic scale" is meaningless unless you specify what pentatonic scale you have in mind. On the other hand  it happens that degrees of western major and minor scales degrees have similar function (e.g. mediant in C major: E has a similar function as mediant in C minor: Eb, despite they are different notes). One cannot expect the same to apply universally to all pentatonic scales.

To summarize: in the context of western music, use degrees of western scales. If you write about music that is based strongly on pentatonic scales and not on western scales, then numbering the scale degrees 1 2 3 4 5 may make sense, but make sure to explain to the reader what do you mean by these numbers or refer to the existing nomenclature.
Answer: I usually see the pentatonic scale degree numbers like 1 2 3 5 6.
Obviously, those aren't ordinal numbers.
If you want to break away from the notion that those are the numbers of a "gapped" major scale, to dispel the notion that the pentatonic scale was derived from a major scale, just think of the numbers as references to intervals above the tonic.
The minor pentatonic is sometimes labeled as 1 b3 4 5 b7. If you consider something like b3 is not strictly speaking an ordinal number (what would the flat third day of June be?) then it seems easier to see how these numbers can be thought of a intervals above the tonic (it's a flat third above the tonic.)
If someone referred to the third of a C pentatonic scale, my only question would be whether major or minor, the tone being either E for major or Eb for minor. I would not expect them to mean either the E for ordinal third tone in C major pentatonic or F for the ordinal third tone in C minor pentatonic.
You might have trouble finding what is "generally accepted" with a survey of literature. I have a few books with sections about the pentatonic scale, and none of them number the scale tones.
If a pentatonic tune is put into a tonal harmonic setting, I think it makes a lot of sense to use the numbers like 1 2 3 5 6, because the harmonization will most likely treat those scale tones like the analogous tones of the diatonic scale. I think it's fine to use that number, for that reason, even if you hold with the idea that the pentatonic scale pre-dates, and was not derived from the diatonic scale. It just makes things easier to talk about in the context of the harmony.
Answer: Since the diatonic scale has become the base for so much where terminology is concerned, then yes, the (major) pent. notes maybe should be called 1,2,3,5,6.
However since it's accepted that the pent. scale pre-existed the diatonic, then the pent. notes ought to be simply 1,2,3,4,5!
It's probably easier for most of us to use the diatonic scale as the datum point, and I think we'd understand 1,2,3,5,6 as it stands - after all, using the number 6 couldn't make it part of just a pentatonic scale, could it?
Comment: What you think "should" or "ought to" be the way things are does not answer a question about the way things are. And that would be true even if there weren't a far superior answer.
Comment: Be good if the dver provided what might be a far superior answer!
Comment: I'm not convinced that the pentatonic "precedes" the diatonic *in the sense that* one grew from the other (though I'm sure, yes, it was in use in Asia long before the diatonic was in Europe). But I'm not sure there's a narrative that makes the pentatonic an evolutionary ancestor of the diatonic.


Download angular-ui

Question: It appears the makers of angular-ui are hell bent on leading everyone on a merry dance to discover the most relevant place to download their js files from.

First I had a look on the angular ui web
site.  No obvious download link
Then I went to the git hub,
suggested using something called Bower?
Then I noticed there was a download link from the individual
component link for
validate. This
results in a 404
Then I found this
question
at last an actual download link! Oh no, two broken fiddles included
in the answer!
(Had to remove fiddles as "it must be accompanied by code" groan)
Eventually the last fiddle in that
question included a link that worked.

this links to http://cdnjs.cloudflare.com/ajax/libs/angular-ui/0.4.0/angular-ui.min.js. Now I don't know if a) this is a legitimate mirror, b) this is the latest version.
So where on earth are you supposed to download this js file from? What is the official download link or do I need to use this Bower thing?
I guess they have obfuscated this process to stop people using them as a CDN but in the process they've made this considerably more complex than it needs to be.
Answer: cdnjs has an outdated version!
Looking here :https://github.com/angular-ui/angular-ui , I found this:

DISCONTINUED REPO: This project has been restructured ->
  http://angular-ui.github.com/

The last version of angular-ui was 0.4 , but now it's discontinued.
They've just decided to break it down to separated modules ( which is great ).
I recommend using bower to install the modules you want, but you can also clone the repos.
Comment: Knowing it's been broken it into chunks does clarify the situation somewhat. The more I look at this the more the UI library feels unmature and in a state of flux. I think I'm going to back away from this particular piece of kit.
Comment: @Liam Does my answer addressed your question?

Download angular-ui


How do I pause a song thats playing while my phone is locked (Samsung ace 2)

Question: I am looking for a way to pause a song without unlocking it. Take the iPhone for example; just by pressing the home button twice, it pauses the song. It's annoying having to unlock my phone every time that I need to pause a song.
Answer: Here are some apps to suite your needs:
Tactile Player – Control Android Music Player Using Hard Buttons
"Tactile Player is my favorite tool which gets the job done and I must say, this one is a must for any music addict who wants to change songs using Android's hard buttons or play/pause the current playing song. When you are listening to music and don't want to unlock Android's lock screen, simply enter the following commands
Press the volume up button two times to play the next track.
Press the volume down button two times to play the previous track.
Press the power button three times to pause or play the currently playing soundtrack.
It works and the best part is that there are no settings and absolutely no configuration required on your music player app. The only catch is that the Tactile player app must run in the background or else the default music player app won't be able to receive your commands via the volume and power buttons."
Simply Lock Screen – Replace Android's Default Lock Screen And Add Multimedia controls
"Simply Lock Screen is a wonderful lock screen replacement app for Android which comes packed with basic multimedia features. You can show clock, date, time and media buttons on the lock screen itself, thereby allowing you to control the order of songs that is being played by Android's default media player app.
Simply Lock Screen adds three buttons on it's lock screen, so you can play a previous or next track or pause the current one by tapping the respective buttons on the lock screen itself. This one is a good choice if you are looking for a better lock screen replacement with added features."
Answer: If you use a headset when listening to your music, and that headset has a button (usually for accepting incoming calls), you might want to take a look at the many headset controller apps at Google Play. They allow you to play/pause with a short single press, skip forward/backward with double/triple click, adjust volume with holding the button, and much more.
As not every app/headset/device combination works 100% satisfying, don't give up on the first try if it doesn't work out "ideally" -- but try the next one. Took me 3 tries to find the perfect match for my device/headset :)


Problem for system of equations

Question: Find the solution of the following set of equations
\begin{equation}
\begin{cases}
yz-2z+x-1=0 \nonumber \\
zx+y-z-2=0 \nonumber \\
xy-2x-y+z+2=0
\end{cases}
\end{equation}
Answer: find sum of 2nd  and 3rd equation  :$$(xz+y-z-2)+(xy-2x-y+z+2)=0+0\\xz+xy-2x=0\\x(z+y-2)=0$$you can go on from there
Comment: For $x=0$ we get $(x,y,z)=(0,3,1)$ and $(x,y,z)=(0,1,-1)$. The other case is difficult.
Answer: By summing (2) and (3) you end up with the equation:
$$
x(z+y-2)=0.
$$
Which has two solutions, either $x=0$ or $z+y-2=0$.
For the first case you end up with the following system:
\begin{align}
z(y-2)&=1\\
y-z&=2,
\end{align}
which is equivalent to $(y-2)^2=1$ and whose solutions are $(0,1,-1)$ and $(0,3,1)$.
For the other case you end up with the following system, given that $z=2-y$:
 \begin{align}
y(2-y)-2(2-y) +x = -y^2 +x+4y -4 &=1\\
x(2-y)+y-(2-y)=-xy+2x +2y -2 &=2\\
xy-2x-2y+4&=0.
\end{align}
Observe that the second and third equation are the same.
Geomtrically the first equation is the horizontal parabola with vertex $(2,1)$:
$$
(y-2)^2 = (x-1).
$$
And the second is either a vertical or an horizontal line:
$$
x(y-2)-2(y-2) = (x-2)(y-2)=0.
$$
So the solutions are the possible intersections of them! To find them explicitly consider each possible case, $x=2$ or $y=2$, from which we obtain:
If $x=2$, then $y=1$ or $y=3$, with solutions $(2,1,1)$ and $(2,3,-1)$, respectively.
If $y=2$, then $x=1$ and $z=0$, with solution $(1,2,0)$.
These are all the possible solutions.
Plot: http://www.wolframalpha.com/input/?i=plot++%28y-2%29%5E2-%28x-1%29%3D0+and+x%3D2+and+y%3D2
Answer: Start by factorizing your equations:
$$z(y-2) + (x-1) = 0$$
$$z(x-1) + (y-2) = 0$$
$$(y-2)(x-1)  + z = 0$$
From this we see that we get a much simpler system if we define $\tilde{x} = x-1$, $\tilde{y} = y-2$ and $\tilde{z} = -z$ (this procedure backward is likely how the author of this problem constructed it):
$$\tilde{x} = \tilde{z}\tilde{y},~~~~~~~~~~~\tilde{y} = \tilde{z}\tilde{x},~~~~~~~~~~~\tilde{z} = \tilde{x}\tilde{y}$$
The system is now also invariant under a cyclic permutation of the variables so the solution set will also have this propery. All the combinations of any two of the three equaitions above gives us
$$\tilde{x}=\tilde{z}^2\tilde{x} = \tilde{y}^2\tilde{x}$$
$$\tilde{y}=\tilde{z}^2\tilde{y} = \tilde{x}^2\tilde{y}$$
$$\tilde{z}=\tilde{y}^2\tilde{z} = \tilde{x}^2\tilde{z}$$
From this it follows that $\tilde{x},\tilde{y},\tilde{z} \in\{-1,0,1\}$. Next we see that if one variable is $0$ then all variables must be $0$ and $(0,0,0)$ is indeed a solution so any other solution must have $\tilde{x},\tilde{y},z \in\{-1,1\}$ (which gives $8$ possible solutions). We can also rule out the possibillity that two of the variables being $1$ and the last being $-1$ or all three being $-1$ (since $\tilde{x}=\tilde{z}\tilde{y}$). This leaves us with $(\tilde{x},\tilde{y},\tilde{z})=(0,0,0)$, $(\tilde{x},\tilde{y},\tilde{z})=(1,1,1)$, $(\tilde{x},\tilde{y},\tilde{z})=(-1,-1,1)$, $(\tilde{x},\tilde{y},\tilde{z})=(1,-1,-1)$ and $(\tilde{x},\tilde{y},\tilde{z})=(-1,1,-1)$ which all satisfy the equation-set.
In terms of the original variables we get $(x,y,z)=(0,1,-1)$, $(x,y,z)=(0,3,1)$, $(x,y,z)=(1,2,0)$, $(x,y,z)=(2,1,1)$ and $(x,y,z)=(2,3,-1)$

Problem for system of equations


What does Jim Simons mean by "never override the computer"?

Question: In the video James H. Simons: Mathematics, Common Sense and Good Luck, James said that the only rule (in Renaissance Technologies Co.) is too "never override the computer" (See between 49:00 and 49:20). Could anyone be able to explain what it means and what it is the case?
Comment: Can you possibly provide context or summarize what he said here?  The video is over an hour long.
Comment: Sandra, note that you can link to a [time index](https://www.youtube.com/watch?v=Tj1NyJHLvWA#t=48m57s).
Comment: I have edited the question; the last words of James are between 49:00 and 49:20. (English is not my first language)
Comment: Context is crucial.  Some people rely on software to suggest defaults in their analyses and consequently they suffer by *not* using their judgment to override them.
Answer: Simons is talking about his company, which uses quantitative methods to automate financial trades of various kinds. "Overriding the computer" means making a trade other than what the computers are currently programmed to make, or preventing a computer-scheduled trade. The reason, Simons goes on to say, is that statistically analyzing the company's performance becomes much harder in the presence of human whimsy affecting the company's trades.
This is closely related to the issue of actuarial (quantitative, automatic) versus clinical (qualitative, manual) decision-making that's considered in psychology. Not surprisingly to a statistician, actuarial methods perform better than clinical methods, and purely actuarial methods perform better than actuarial methods with optional clinical overrides. See, for example,
Dawes, R. M., Faust, D., & Meehl, P. E. (1989). Clinical versus actuarial judgment. Science, 243(4899), 1668–1674. doi:10.1126/science.2648573
Comment: Funnily enough, when *actuaries* talk about 'actuarial judgement' they don't mean what that article (and others like it) mean. They mean something much closer to the professional judgement that the "clinical judgement" of the title intends -- actuaries regularly make the personal judgements that those articles about clinical judgement show the dangers of ... just in different contexts to this one. When they do make those kinds of judgements they're *just* as subject to the same kinds of biases, with the same bad results.
Comment: @Glen_b Good to know. I already thought "actuarial" and "clinical" weren't the best choices of term.
Comment: @Glen_b I'm actually not totally clear on the vocabulary here. Does 'actuarial judgement' mean the kind of judgement that actuaries use? An alternative interpretation might be like the way "mechanical thinking" could be used, not with reference to how _mechanics_ think, but rather 'in the style of a mechanism', or something. I imagine, for example, mechanics might say that their thinking is of the 'clinical' sort as well, not mechanical thinking. Actuarial judgement could perhaps be interpreted to mean like 'on an actuarial basis' or something that could give a little more technical vibe?
Comment: In the paper title it means "applying actuarial methods" (in a particular specific sense) and is in effect a kind of mechanical-but-statistically-based calculation. In actuarial literature it means something along the lines of "applying the professional judgment of a trained actuary".


Read frequency of input in digital pins

Question: This is a somewhat theoretical question:
Let's say I have some sensor that sends digital signals to one of Arduino's digital ports.
Now, I don't know the frequency it sends those signals in.
For example, the frequency of the sensor output could be 100Hz, so every 1/100 of a second it varies the voltage (or keeps the old voltage if the next signal is the same as the previous one), but it could just as well be 200Hz.
Would Arduino be able to faithfully read the digital signal regardless of its frequency? Or is there a conventional frequency that digital devices usually use for output?
Wouldn't it be the case that if Arduino expects 100Hz signal, but the signal is 200Hz it would miss half the inputs?
For: (1 0 1 0 0 1...) wouldn't it see: (1 1 0) - that is skip every other input because it's sampling rate would be too slow by half?
Thanks kindly for your help..
Comment: What do you mean by "digital signal"? Some kind of synchronous serial transmission protocol? SPI maybe? Or I2C? Or maybe an asynchronous one, like logic level UART? Or is it a custom protocol? Your question will start to make sense only once you specify how the data is supposed to be clocked in your protocol.
Comment: *so every 1/100 of a second it varies the voltage (or keeps the old voltage if the next signal is the same as the previous one),* - are you asking about measuring voltages or frequencies?
Comment: @Nick, let's assume that the 1 voltage is high enough (but not too high) for Arduino to register a 1, and the 0 voltage is also within the threshold for Arduino to register a zero (say 5V for HIGH and 0.5V for LOW). It's the frequency of the signal I'm concerned with.
Comment: @Edgar, I have in mind just a generic digital sensor - let's say one that measures temperature and sends a digital signal to Arduino at some unknown frequency.
Comment: A "generic" digital sensor doesn't mean anything. Digital sensors usually come with either SPI or I2C interfaces. Sometimes asynchronous serial. All those are well defined communication protocols. There are _rules_ stating how the sender should notify the receiver about _when_ precisely the data line is to be sampled. The Arduino has hardware support for these protocols, but other protocols have to be implemented in software (e.g. one wire). So forget about your meaningless "generic" and tell us what serial protocol you intend to use.
Answer: 100 Hz is pretty trivial. See my page about timers.
This sketch can detect frequencies up to about 5 MHz:
<code>// Timer and Counter example
// Author: Nick Gammon
// Date: 17th January 2012

// Input: Pin D5

// these are checked for in the main program
volatile unsigned long timerCounts;
volatile boolean counterReady;

// internal to counting routine
unsigned long overflowCount;
unsigned int timerTicks;
unsigned int timerPeriod;

void startCounting (unsigned int ms)
  {
  counterReady = false;         // time not up yet
  timerPeriod = ms;             // how many 1 ms counts to do
  timerTicks = 0;               // reset interrupt counter
  overflowCount = 0;            // no overflows yet

  // reset Timer 1 and Timer 2
  TCCR1A = 0;
  TCCR1B = 0;
  TCCR2A = 0;
  TCCR2B = 0;

  // Timer 1 - counts events on pin D5
  TIMSK1 = bit (TOIE1);   // interrupt on Timer 1 overflow

  // Timer 2 - gives us our 1 ms counting interval
  // 16 MHz clock (62.5 ns per tick) - prescaled by 128
  //  counter increments every 8 µs.
  // So we count 125 of them, giving exactly 1000 µs (1 ms)
  TCCR2A = bit (WGM21) ;   // CTC mode
  OCR2A  = 124;            // count up to 125  (zero relative!!!!)

  // Timer 2 - interrupt on match (ie. every 1 ms)
  TIMSK2 = bit (OCIE2A);   // enable Timer2 Interrupt

  TCNT1 = 0;      // Both counters to zero
  TCNT2 = 0;

  // Reset prescalers
  GTCCR = bit (PSRASY);        // reset prescaler now
  // start Timer 2
  TCCR2B =  bit (CS20) | bit (CS22) ;  // prescaler of 128
  // start Timer 1
  // External clock source on T1 pin (D5). Clock on rising edge.
  TCCR1B =  bit (CS10) | bit (CS11) | bit (CS12);
  }  // end of startCounting

ISR (TIMER1_OVF_vect)
  {
  ++overflowCount;               // count number of Counter1 overflows
  }  // end of TIMER1_OVF_vect

//******************************************************************
//  Timer2 Interrupt Service is invoked by hardware Timer 2 every 1 ms = 1000 Hz
//  16Mhz / 128 / 125 = 1000 Hz

ISR (TIMER2_COMPA_vect)
  {
  // grab counter value before it changes any more
  unsigned int timer1CounterValue;
  timer1CounterValue = TCNT1;  // see datasheet, page 117 (accessing 16-bit registers)
  unsigned long overflowCopy = overflowCount;

  // see if we have reached timing period
  if (++timerTicks < timerPeriod)
    return;  // not yet

  // if just missed an overflow
  if ((TIFR1 & bit (TOV1)) && timer1CounterValue < 256)
    overflowCopy++;

  // end of gate time, measurement ready

  TCCR1A = 0;    // stop timer 1
  TCCR1B = 0;

  TCCR2A = 0;    // stop timer 2
  TCCR2B = 0;

  TIMSK1 = 0;    // disable Timer1 Interrupt
  TIMSK2 = 0;    // disable Timer2 Interrupt

  // calculate total count
  timerCounts = (overflowCopy << 16) + timer1CounterValue;  // each overflow is 65536 more
  counterReady = true;              // set global flag for end count period
  }  // end of TIMER2_COMPA_vect

void setup ()
  {
  Serial.begin(115200);
  Serial.println("Frequency Counter");
  } // end of setup

void loop ()
  {
  // stop Timer 0 interrupts from throwing the count out
  byte oldTCCR0A = TCCR0A;
  byte oldTCCR0B = TCCR0B;
  TCCR0A = 0;    // stop timer 0
  TCCR0B = 0;

  startCounting (500);  // how many ms to count for

  while (!counterReady)
     { }  // loop until count over

  // adjust counts by counting interval to give frequency in Hz
  float frq = (timerCounts *  1000.0) / timerPeriod;

  Serial.print ("Frequency: ");
  Serial.print ((unsigned long) frq);
  Serial.println (" Hz.");

  // restart timer 0
  TCCR0A = oldTCCR0A;
  TCCR0B = oldTCCR0B;

  // let serial stuff finish
  delay(200);
  }   // end of loop
</code>

Or is there a conventional frequency that digital devices usually use for output?

No.

Wouldn't it be the case that if Arduino expects 100Hz signal, but the signal is 200Hz it would miss half the inputs? For: (1 0 1 0 0 1...)

No.
Why would it "expect" a frequency? It isn't a person expecting a chocolate cake on its birthday.

So whatever frequency the sensor sends its data in - be it 100Hz or 5Mhz - Arduino is smart enough to read all the voltage signals faithfully?

I'm not quite sure what you mean by "read all the voltage signals" which seems to imply you want to measure the voltage.

so every 1/100 of a second it varies the voltage (or keeps the old voltage if the next signal is the same as the previous one)

But then you say:

let's assume that the 1 voltage is high enough (but not too high) for Arduino to register a 1, and the 0 voltage is also within the threshold for Arduino to register a zero (say 5V for HIGH and 0.5V for LOW). It's the frequency of the signal I'm concerned with.

The voltage levels for 0 and 1 are documented in the datasheet. For the Atmega328P for most pins they are as follows:

You can see that if Vcc is 2.4V or above then LOW is -0.5V to 0.3 * Vcc, which if Vcc is 5V then a LOW is -0.5 to 1.5V.
Similarly a HIGH is 0.6V * Vcc to Vcc + 0.5, so if Vcc is 5V then a HIGH is 3V to 5.5V.
In between 1.5V and 3V then the digital status would be undefined.
So, if your LOW and HIGH are in those voltage ranges, yes you can detect the frequency of the signal.
I'm not sure about the bit where you said "keeps the old voltage if the next signal is the same as the previous one". That seems to imply that if the signals stay the same (eg. for a second) then the voltage won't change at all, and thus the frequency will be zero.
Comment: Yes, absolutely.
Comment: Thanks @Nick. So whatever frequency the sensor sends its data in - be it 100Hz or 5Mhz - Arduino is smart enough to read all the voltage signals faithfully? If that's the case, that's encouraging news.. One additional question pls: can you determine the frequency of the sensor from the code - i,e. determine if the sensor is 100Hz, 200Hz etc.
Comment: See amended answer.
Comment: thanks @nick for all the info. About the last paragraph: wouldn't it be the case that if there's a stream of 1s and not 0s for a whole second, then the voltage graph would look like a horizontal line of 5V (basically like DC of 5V) for that 1 sec.)?
Answer: Another method if it's helpful to the world:
Using inspiration from https://forum.arduino.cc/t/how-to-read-frequency-with-arduino/528143/2
I am just measuring the seconds using micros() between each up or down portion of the waveform, multiplying the time by 2 to get the full period (assuming a duty cycle of 50%). And then inverting the full period to calculate the frequency.
I was using a Teensy 4.1 for this.
<code>// READ FREQUENCY FROM A DIGITAL INPUT PIN SKETCH

// this cannot be used when the FreqMeasure.h toolbox is used if on teensy
// https://www.pjrc.com/teensy/td_libs_FreqMeasure.html

// define your digital input pin
#define inputPin 22

// initialize variables for the frequency reading function
boolean inputState = false; boolean lastInputState = false;
long lastTime; long period; double freq;

// the frequency reading function
double readFrequency(){
  inputState = digitalRead(inputPin);

  if (inputState != lastInputState) {
    period = micros() - lastTime; // in microseconds
    freq = 1/(2*period*pow(10,-6)); // conversion to Hz

    lastInputState = inputState;
    lastTime = micros();
  }
  return freq; // always return frequency even if it hasn't changed state...
}

// label the pin
void setup() {
  // Serial.begin(115200); // uncomment & adjust for Arduino - I was using a Teensy.
  pinMode(inputPin, INPUT);
}

// call the function and print the output at full speed
void loop() {
  Serial.print("Frequency:"); Serial.println(readFrequency());
  // works even if I put a delay in here (e.g., delay(1) millisecond)
}
</code>

Read frequency of input in digital pins


Customize the start menu tiles without any other program

Question: I want to customize my Windows 10 start menu, with my own tiles. I tested already TileCreator, problem here is that it always pops up for around 0.5 seconds, before the actual program starts. Thats annoying. I guess this program also just make some entries in the registry or works with Powershell, so is it there another way to make this custom start tiles? The custom tiles should looks like the spotify icon in the picture below, without any other text.
Example how it looks with TileCreator
Answer: Sure. Here is a neat guide to customize the Start menu tiles for desktop apps. Office 2010 as an example: Customize the background colour of Office 2010 tiles on the Start screen
It's a bit lengthly tutorial so I can't repost it here. Basically, you need to create the visualelementsmanifest.xml (per-executable) and set the background color and specify a logo image in the XML file.
Comment: But i want using full-filled tiles. Is that also possible? So that the whole tile is just a picture.


Adding offset before second order active filter

Question: Since i wont be able to provide negative voltage to the negative power rail of the OPAMP, i wanted to give my signal a slight positive DC offset and execute the amplification process in the positive region. Since capacitors in the filter circuit might as well serve as coupling capacitors, i am really confused about where to put the dc offset voltage divider. The setup below is supposed to filter signals below 130 Hertz and amplify the signal ten times but does neither. Any idea on how to make the design work is appreciated.

Op-amp datasheet
Comment: R12 does not connect to ground - only to R11 and the - input.
Comment: First, the connection between V- and R11, R12 looks like a mistake in the schematic, is that so?
Comment: A sallen key filter with this much gain will straight out oscillate so it's pointless figuring out where to put the resistors.
Comment: Can you please elaborate andy ?
Answer: try

simulate this circuit – Schematic created using CircuitLab
You've rather got in a mess with which resistors are biasing and which doing signal.
Now I've finished my tea, and thought a bit more, and read the comments ...
R1-R2 provides mid rail bias of the op amp, and the right impedance to ground for the filter network.
It looks like the intention of your R9,10 was to provide the bias, but then you've connected them in parallel to your inverting input. What you need is a network of two resistors that simulataneously provides the right voltage, and the right impedance to ground. My R1,2 provide mid rail, but it would be equally as easy to use for instance 1.6k and 4.7k to bias to 0.25x rail with 1.2k impedance to ground.
C3 is a better more generic solution for getting the DC offset into the feedback path, which in this case of a high pass filter, is obviously the case. It will still work if you ask for gain of 1000, which separate biassing probably won't. If correct gain and offset is important down to DC, then R5 should be replaced by a 2k resistive divider like R1R2.
Your R7 looks like it's part of a Sallen Key filter, but unfortunately the gain is wrong. With an equal component SK, a gain of unity gives you quite low Q. As you increase the gain, the Q increases, becoming infinite at a gain of 3. In fact such an equal component gain 3 SK filter is called a Wein Bridge Oscillator! Gains above 3 just give you instability and crashing into the rails.
R3,7 may be the clever bit. It undoes the x10 gain of the opamp, and presents the signal to the caps' mid point at the impedance of R3//R7, the 1.2k in your original. This will give you back the response of a unity gain equal component sallen key, followed by x10 gain, with one opamp.
However, while such a filter is stable, high pass, and has ultimate rejection at 40dB/decade, the passband is not one of the recognised responses. This may or may not matter. You could increase the gain at the filter by reducing R3 and increasing R7 a little, while keeping their parallel impedance 1.2k, to choose responses in the Butterworth or other families.
Comment: Neil, put a capacitor in series with R5 or it won't work at all. Ha ha I see - you have R4 to do this but with this much gain it'll sing!
Comment: I didn't want to redesign his filter, just set his biassing straight, which is why the comment. I think if the feedback to the caps' mid point is taken from a pot down from the output with the right output impedance, that will straighten out the filter and still provide the x10 gain. With only x10 DC gain, a difference in mid point R1R2 and R4R5 and some input offset will still be contained within the rails. Could be more elegant, but it was tea-time! A C to ground rather than R4R5 would have been better.
Comment: i am just curious if its a good practice to wire the voltage divider at that point of the circuit, how would it effect the gain etc
Comment: A schematic doesn't identify 'points' of the circuit, but only nets. The voltage divider goes to the positive supply, which as I pointed out earlier, is an AC ground. If it isn't, it should be, and if it still isn't, then you can decouple the bias chain suitably so it doesn't put noise from the positive rail onto your signal node, or suffer uncertain impedance to ground. It goes to the +ve rail to avoid the need for another supply. And BTW, it affects gain, not effects gain