BLTouch not leveling

Question: I installed a BLTouch V3.1 on my Ender 3 which is using Marlin (bugfix 2.0.x) off a Skr mini e3 v2.0. I updated the firmware using a teaching tech video.
I'm having trouble when using bed leveling. It homes everything correctly, and then moves outside the bed before the probe repeatedly deploys and retracts, without the head moving at all. I attached a link to a video here: Bed Leveling Problem
I have a feeling it  must be something in my config files from looking at other answers here but I really don't know. I attached my config files as well. Configuration.h , Configuration_adv.h
I have the BLTouch plugged into the z-stop for the black and white cords. I didn't need to cut any wires or anything since mine came with the endstop connector piece attached, and the other wires in the Zprobe section (Blue, Red, Yellow) to (GND, +5V, PA1) respectively. As for the firmware, I got it directly off the Marlin site: marlinfw.org/meta/download.
Any assistance would be greatly appreciated.

Additional information:
I have connected my printer to PronterFace and recieve the following error when sending a G29
    Reset.
>>> G28
SENDING:G28
>>> G29
SENDING:G29
Error:!! STOP called because of BLTouch error - restart with M999
[ERROR] Error:!! STOP called because of BLTouch error - restart with M999

Error:Probing Failed
[ERROR] Error:Probing Failed

Answer: You are mixing and matching a few older techniques. That's understandable, because "older" means "as of three months ago." But there is a better way now: as of version 2.0, the SKR mini has a full, working port for the BLTouch. You do not need to plug it into the z-stop, and you can and should retain your existing z-stop switch.
So:

Power down your printer and get access to your board.
Roll back your hardware changes by unplugging the BLTouch and reattaching the z-stop switch.
Plug the bltouch into the port labelled "z-probe", which is next to the display port. Starting from the pin nearest to the stop switches, the pin order should be Brown, Red, Yellow, Black White.
Optional: instead of the step above, cut the DuPont connectors off the BLTouch cables and crimp a single XH-5Y connector in their place, then plug that into the board.
Download the official BLTouch firmware from SKR mini: https://github.com/bigtreetech/BIGTREETECH-SKR-mini-E3/blob/master/firmware/V2.0/firmware-bltouch.bin
Install that firmware: Rename the file to "firmware.bin", unplug any USB cables from your printer, copy the file to a MicroSD, insert the MicroSD into your printer and power it on.

...and then it should work.
Comment: Thank you! I followed your instructions and it seems I'm almost good to go. I'm able to run everything for the bltouch ( reset, self-test, deploy, and stow,) and they appear to be working correctly. However, while the probe moves to correct spot now, It still deploys and stows the probe several times while not moving at all.
Comment: I test some stuff out a little more and when it sits in place, I do see that its trying to run the leveling, I see a points 1/25 on the lcd but it never goes past that before stopping as if it aborts the leveling
Comment: Hmm. Mine homes first, then goes to the first spot for leveling. When you run the BLTouch self test, does it click in and out about ten times? If so, are you confident you got the black and white wires in the right order?
Comment: @AbberantAeons I am having this exact same issue. Have you found a resolution??
Comment: Thanks a lot fectin!! Your solution works!
In addition, make sure to download the regular BL Touch firmware from BTT, not the one for Z probing as I had done at the begining!
:)

BLTouch not leveling


High similarity index on turntin

Question: My paper got accepted for a conference. Before submitting the paper, I used Turntin to check for any similarity and found only 6%. But after the conference reviewed my paper and sent it to me, I again checked for similarity (as I made some changes) and found that it was 95% similar! 90% of those come from a student paper at a Texas university.
Why is that? I have to submit the final version tomorrow. Is this going to be any problem?
Comment: Does this answer your question? [What is the acceptable similarity in a mathematics PhD dissertation when checking by Turnitin?](https://academia.stackexchange.com/questions/29723/what-is-the-acceptable-similarity-in-a-mathematics-phd-dissertation-when-checkin)
Comment: In particular, as the answers to https://academia.stackexchange.com/questions/29723/what-is-the-acceptable-similarity-in-a-mathematics-phd-dissertation-when-checkin say:  Do not use Turnitin for anything important.
Comment: This is a good answer: https://academia.stackexchange.com/a/185810/13240
Comment: Did you get to see the student paper ? How much similarity between your paper and the student's paper after you read that paper yourself (not by Turntin) ? What was the publish date of the student's paper ?
Comment: If you didn't plagiarize,  you can submit the final version of the paper which was accepted. Why not ?
Answer: I don't see how any of us can say. Maybe you stole it from a student at a Texas university. Maybe they stole it from you. Maybe a glitch. Maybe the conference will use a plagiarism checker like the one you used, maybe not.
You should never need to check anything you've written yourself on a plagiarism checker, because if you wrote it yourself you don't need to check it for plagiarism: it isn't plagiarized if you didn't plagiarize it, regardless of what a computer comparison says. Focus on not plagiarizing, rather than focusing on making sure you can evade the detection system; evading the system of checks is something for guilty people to do, not honest ones.
In some cases, sending a copy of your work to a plagiarism detector may result in it showing up as plagiarism later, because the plagiarism software works by making comparisons to previous submissions.
Comment: @rafraf That's not what you wrote in your post. I guess your advisor doesn't trust you? **There is no reason to check if references are "getting caught as plagiarism" in your own work**, unless perhaps someone is accusing you of plagiarism already based on a report like this and you're trying to refute it.
Comment: I didn't check it myself. My teacher did. He is the co-author, and the reason I am checking now is because I added a lot of references as per the review from the conference, so I checked if they were getting caught as references or plagiarism. The similarity didn't exist before. It was after i submitted to the conference that its showing 95%
Answer: There's a plethora of reasons this could have happened but, assuming the conference did not make any mistakes in the paper that was checked and who it was reported to. It may be that turnitin added your paper to their database after you submitted it and afterwards when the conference went to scan your paper turnitin recognized your paper as previously submitted. I would bring this up to the conference and try to show them as much documentation you can (i.e. timestamps on browser history, any editing history assuming your text editor supports this).

High similarity index on turntin


Can't see any fluid mesh in any view after i bake it in blender 3.0.0

Question: I can't find any fluid mesh after I bake it in blender 3.0.0. I bake the fluid simulation and the mesh separately. I'm sure the mesh was baked because the processing bar showed up. and the mesh parameters are grey, Free Mesh bottom was enabled.  But still, I couldn't see the mesh in any view. I'm using blender 3.0.0 in M1 chip iMac.  Does anyone have a similar issue?
Answer: It turns out that fluid mesh baking is not creating a new object in the scene, but basically turning the domain object into the scene. As I previously set my domain cube viewport visibility into bounds rather than the default solid mode. the mesh that has been generated from the domain object was displayed as bounds as well.


Tradition of Chanting Shema

Question: Why is the additional phrase "bruch Shem Cavod Malcuto Layolam Vaed, a non Torah addition, added to the chanting of Shema before the chanting of the vahavta?
Comment: http://judaism.stackexchange.com/questions/4035/boruch-shem-kevod-malchuso-lolam-voed-why-do-we-whisper-it
Comment: http://judaism.stackexchange.com/q/30847/603
Answer: The ברוך שם was originally the liturgical response to the recitation of Hashem's name in the temple. Of course, since we no longer have the temple, it is not used in that way.
We could consider that the Shma is our proclaiming of Hashem's Glory and uniqueness which would be similar (though not the same) as the use of the Name in the temple. That is, just as it was the recognition of the glory and presence of Hashem that caused the response in the temple, so to it is the recognition of Hashem's presence that cause us to respond (as did Yaakov when his children said the Shma).
There is a medrash in Pesachim 56, that when Yaakov avinu was not allowed to tell about the mashiach on his death bed. When his children said the Shma, he burst out with ברוך שם
The Midrash (Devarim Raba 2:25) relates that we do not say the praise "Baruch Shem..." out loud because Moshe Rabbeinu "stole" it from the angels whom he heard saying it when he went to heaven to receive the Torah. We "hide" it from the angels by saying it in a whisper. However on Yom Kippur, when we are raised to the level of the mal'achim, we can make a public declaration just as Yaakov Avinu did.
Reciting "Baruch Shem Kevod Malchuto" Silently explains that we normally recite it silently because it is not in the Torah and also that we are not on a level that would allow us to emulate the mal'achim.

Yaakov was overjoyed to hear his sons' collective declaration, and he
  praised G-d by exclaiming, "Baruch Shem Kevod Malchuto Le'olam Va'ed"
  ("Blessed is the Name of the Glory of His Kingship, forever!"). In the
  Book of Devarim, however, when Moshe declared the verse of "Shema
  Yisrael," he did not then proclaim "Baruch Shem." We thus face the
  dilemma of whether we should follow Yaakov's example, and recite
  "Baruch Shem" after "Shema Yisrael," or the precedent set by Moshe, to
  recite "Shema Yisrael" without adding "Baruch Shem." For this reason,
  the Gemara writes, we recite "Baruch Shem" in a low tone after
  reciting the verse of "Shema Yisrael." We do this as a compromise, of
  sorts, between the respective practices of Yaakov and Moshe.
(The one exception is Yom Kippur, when we declare "Baruch Shem" in a
  loud tone; we explained the reason for this practice in an earlier
  edition of Daily Halacha.)

Tradition of Chanting Shema


Is there an easy way to tell if a public address was derived from an hd key?

Question: Assuming you know the hd key's private & public info, and you have a given address is there an easy way to know whether or not that address is derived from said hdkey?
Answer: Other than just deriving a ton of potential keys and checking whether they correspond to the address, no. There is no mathematical relation between keys in a HD keychain that allows you to determine whether they are in that keychain.
Comment: Yikes. Okay so I suppose I'll need to check my database if an address receives value. Thanks!


Youtube API response data

Question: Youtube's API documentation seems to me to be complete rubbish, I've spent hours reading through it and can't seem to figure out how to display a simple thumbnail of a video even by just test-copy-and-pasting the code they give in a few examples. Could someone maybe explain or point me in the direction of an at least half decent tutorial of how to retrieve data from a video search query?  Using JSON by the way
Answer: In the past I've disregarded the youtube api and just made my own thumbnails using imagemagick with node, but it doesn't sound like you're using node.
Answer: If you paste the JSON response into this JSON to CSV converter, you can open the CSV file in a spreadsheet.  Within the spreadsheet you will have lots of tools to help you parse the data.

Youtube API response data


How to approximate this expression ?

Question: Here 'n'is a constant number between 1 and 2 and we know that $V<<c$. Then how do you show that:$$\frac{1}{1+\frac{V}{nc}}$$ can be approximated by this expression:$$(1-\frac{V}{nc})$$
Answer: $$\frac{1}{1+k} = \frac{1-k}{(1-k)(1+k)}= \frac{1-k}{1-k^2}\approx 1-k$$ if $k$ is very small. $k=\frac{V}{nc}$ with $V\ll c$, so this is exactly what you want.
Answer: You can simplify the problem by asking how to estimate
$$ \frac{1}{1+x} $$
You can apply all of the various methods you learned in single variable calculus to produce an estimate; additional methods apply too, such as recognizing it as a geometric series:
$$ \frac{1}{1+x}  = 1 - x + x^2 - \ldots $$

However, you're already been given the estimate directly; it might be easier to verify it rather than try to figure out how you would derive it had you not known about it. The absolute difference happens to have a nice form which makes it easy to see that the absolute error is small:
$$ \frac{1}{1+x} - (1 - x) = \frac{x^2}{1+x} $$
In fact, you could even use this approach to derive the estimate, which I will demonstrate since it's an uncommon, but neat technique.
If you recognized that the value is approximately $1$, you can write:
$$ \frac{1}{1+x} - 1 = -\frac{x}{1+x} $$
and then recognize the right hand side is approximately $-x$:
$$ \left( -\frac{x}{1+x} \right) - (-x) = \frac{x^2}{1+x}$$
and combine the estimates to get
$$ \frac{1}{1+x} = 1 - x + \frac{x^2}{1+x} $$
Answer: The inverse of the first, multiplied by the second, is
$$1-\frac{V^2}{n^2c^2}$$
very near from $1$.
Answer: Another way of presenting this is to telescope the expression to arbitrary precision generating the geometric series in the process
Thus we start with
$$\frac{1}{1+\frac{V}{nc}}=\frac{1}{1+\frac{V}{nc}}\frac{1-\frac{V}{nc}}{1-\frac{V}{nc}}=\frac{1-\frac{V}{nc}}{1-\left(\frac{V}{nc}\right)^2}$$
and the next iteration
$$\frac{1}{1+\frac{V}{nc}}=\frac{1-\frac{V}{nc}}{1-\left(\frac{V}{nc}\right)^2}\frac {1+\left(\frac{V}{nc}\right)^2} {1+\left(\frac{V}{nc}\right)^2}=\frac{1-\frac{V}{nc}+ \left(\frac{V}{nc}\right)^2-\left(\frac{V}{nc}\right)^3} {1-\left(\frac{V}{nc}\right)^4}$$
and so on.
We can stop at any stage once we are happy to approximate the denominator as $1$.

How to approximate this expression ?


Can you always throw away the types when evaluating lambda expressions?

Question: As I understand it, in the simply typed lambda calculus you can type-check your terms, then throw away all the types and do the evaluation exactly as if it was the untyped lambda calculus. Is that always the case or do some typing systems require you to know the types when evaluating terms?
Answer: It is not always the case. Systems where this is possible are called "Curry style," and systems where it is not possible are called "Church style." The general idea is that in Curry style systems, the types are a mechanism for reasoning about pre-existing structure. The types just help us make sense/keep track of ways of using said structure. In a Church style system, the types are a necessary part of specifying the structure/behavior of the terms.
A relatively simple example of something Church style is type classes in Haskell. For instance, we have:
read "45" :: forall t. Read t => t

as a most general type. We could also instantiate it to:
read "45" :: Int
read "45" :: Double

However, completely eliminating types leaves something under specified. In the first case, the Read t constraint indicates that the behavior we get for any instantiation of t will depend by cases on t. When instantiated to Int, we get 45, and when instantiated to Double we get 45.0, and these are not represented identically in some underlying untyped system. To elaborate this into an untyped system, we need to not just erase types, but add arguments that correspond to how the types influence the actual meaning of the term. A common way of doing this for type classes is dictionary passing, which gives something like:
\readDict -> read readDict "45"
read readDictInt "45"
read readDictDouble "45"

A more complicated example is homotopy type theory. It's typical to imagine that type/universe arguments to functions in dependent type theory still enjoy erasure, because you cannot write programs that do case analysis on them. However, this is no longer really the case when identity types for them have non-trivial computational content. Given a family:
P : T -> Type

and an identity:
e : Id T t u

we can obtain:
subst P e : P t -> P u

which may have meaningful computational content, because in general it could correspond to any sufficiently nice function from P t to P u. For instance, we might have P t = ℕ and P u = ℤ, and subst P e is some enumeration of all integers.
This information is not trivial, and it at least seems to indicate that we cannot just erase things like P because they are 'type level'. It doesn't make sense to say that we can go from:
(\P ... -> ...) : Π(P : T -> Type). ...

to:
(\ ... -> ...) : ...

becuase P is where we get the enumeration of the integers. So, even if we're going to 'erase' types, we need to do so in a way where the untyped level has extra information plumbed through it corresponding to the types, similar to the type class example above. In this case, we need to retain a function that maps identities in T to functions between the right types.
Comment: This is not what is usually meant by the Church-Curry distinction. Church vs Curry is a property of a semantics (defined over typing derivations or untyped terms) and sometimes it is shown that. Church style and Curry style semantics are equivalent: https://tidsskrift.dk/brics/article/view/20167
Comment: The question, and my answer, are about semantics. Can you give an untyped meaning to typed terms in a way that the meaning doesn't depend on the types (and thus, can be given by naively erasing types)? In my examples, then answer is, "no."
Comment: I'm not saying your answer is wrong, I'm just objecting to your use of "Church"/"Curry" terminology. What I meant is that "Church"/"Curry" is a property of the *definition* of a semantics, and "Church" style semantics doesn't imply that it isn't possible to write an alternative, equivalent semantics that doesn't depend on the structure.


ffserver streams webm data, but nothing is displayed

Question: I'm trying to stream webcam data over the internet on a lubuntu machine. To achieve this, I've installed ffmpeg and ffserver. However, I can't seem to get this to work.
I would like to use the webm format to integrate it as an HTML5 video. I found several examples of this on the internet, so that is where I based my settings on. This is the ffserver config I have at the moment:
HTTPPort 8090                      # Port to bind the server to
HTTPBindAddress 0.0.0.0
MaxHTTPConnections 2000
MaxClients 1000
MaxBandwidth 10000             # Maximum bandwidth per client
                               # set this high enough to exceed stream bitrate
CustomLog -
#NoDaemon                       # Remove this if you want FFserver to daemonize after start

<Feed feed1.ffm>               # This is the input feed where FFmpeg will send
   File ./feed1.ffm            # video stream.
   FileMaxSize 5M              # Maximum file size for buffering video
   ACL allow 127.0.0.1         # Allowed IPs
</Feed>

<Stream camera1.webm>              # Output stream URL definition
   Feed feed1.ffm              # Feed from which to receive video
   Format webm

   # Audio settings
   #AudioCodec vorbis
   #AudioBitRate 64             # Audio bitrate
   NoAudio

   # Video settings
   VideoCodec libvpx
   VideoSize 640x480           # Video resolution
   VideoFrameRate 2           # Video FPS
   AVOptionVideo flags +global_header  # Parameters passed to encoder
                                       # (same as ffmpeg command-line parameters)
   #AVOptionVideo cpu-used 0
   AVOptionVideo qmin 1
   AVOptionVideo qmax 42
   #AVOptionVideo quality good
   AVOptionAudio flags +global_header
   #PreRoll 1
   #StartSendOnKey
   VideoBitRate 400            # Video bitrate
</Stream>

<Stream status.html>            # Server status URL
   Format status
   # Only allow local people to get the status
   ACL allow localhost
   ACL allow 192.168.0.0 192.168.255.255
</Stream>

<Redirect index.html>    # Just an URL redirect for index
   # Redirect index.html to the appropriate site
   URL http://www.ffmpeg.org/
</Redirect>

I put the FPS at 2 seconds, pretty much the maximum the computer I'm using can achieve is 4 for some reason. I then start ffmpeg with the following command:
ffmpeg -f video4linux2 -s 640x480 -r 2 -i /dev/video0 -c:v libvpx http://localhost:8090/feed1.ffm.

The input is a standard UVC webcam that wprks properly (tested with cheese), ffmpeg seems to work (setting a file as ouput works properly) and the link to ffserver seems to work, the two programs regocnize each other. If an application requests the ffserver stream, it does receive data. wget for example results in a file of the size you would expect with the given bitrate. However, opening the stream in a webpage does not work.
I tried it in two ways: simply browsing to the webm link. firefox indicates it's receiving some data, but nothing is displayed. ffserver also indicates that a normal amount of data is transferred. The second option I tried was webpage with video tags for the video stream:
<video with="640" height="480" autoplay>
  <source src="http://localhost:8090/camera1.webm" type="video/webm">
</video>

but this works neither.
Who has any idea where I went wrong?
Answer: You could try the <embed> tag for this purpose. Something like this:
<embed type="video/webm" src="http://localhost:8090/camera1.webm" width="640" height="480">

If that doesn't work, you could try 127.0.0.1 instead of localhost


Can Alcatraz tours only be booked from their website?

Question: I'm currently checking the web site www.alcatrazcruises.com to book an Alcatraz tour 2 weeks from now but they are fully booked.  Is that web site the only way to book a tour of the island?  Will it be possible to show up at the pier and getting on a ferry there to the island?
Answer: The National Park Service has an arrangement where only a single company is granted an exclusive franchise to travel to or take guests to Alcatraz. Therefore, if you want to go to Alcatraz, there is only one company you can travel with, and private boats are forbidden.
Wikivoyage notes:

Tickets for the Ferry to Alcatraz are available at the Alcatraz
  Cruises website, but they sell out fast so buy in advance.

There are a few other websites when you search, but I can't vouch for any of them.  What you could do to confirm is to call Alcatraz Cruises Box office: +1 415 981-7625, or email them (email@example.com).  However, even when I was in San Francisco last year, tickets were sold out online and it wasn't possible to buy them in person on the day.  However, that was Fleet Week, so your mileage may vary on a different week.  I'd drop them a line and see what your options are.
Answer: No.
This is what happens: one company is responsible for selling all the tickets to Alcatraz. The thing is they sell a lot of tickets to multiple tourism agencies. These agencies create some packages like Wines + Alcatraz and sell them to the general public. By buying one of these packages you can get second hand tickets to Alcatraz.
If there aren't tickets anymore for the date you want and you are not willing to buy those combos there is still one thing you can try: check the official website one or two days before your desired date. When the tourism agencies fail to sell some of their tickets, those tickets are returned and put back for selling in the site(you may want to refresh the page every 5 minutes to find the ticket before someone else does). I managed to get a ticket this way. The bad part is that usually only the tickets for the worst times are returned.
Answer: No! It is possible to line up very early in the morning to try to get last-minute tickets. This is a desperate last-ditch move where people show up as early as 4am to get in line for when the ticket office opens at 7:30am. Everyone buying a ticket must wait in line the entire time (no sending someone ahead to buy for the whole group), and you could well wait in line for hours during a wet and cold morning to wind up with nothing, especially during peak season.
Obviously, getting tickets through a more expensive package (you could even "throw away" the other part of the package if you want) or one of the returned tickets as hooray describes is a far better option, but if you want to try it, the details of the system are provided online. The short version is: get there extremely early, everyone buying a ticket must wait in the line the entire time (except restroom breaks), first come, first served, no guarantees.
It's probably worth talking to the Alcatraz Cruises workers at the ticket booth before trying this, to ensure the morning-of scheme is in operation.
The best approach, of course, is to buy your tickets from the website months in advance.


Iphone SDK - Multiple subviews and shouldAutorotateInterfaceOrientation

Question: The iPhone Application Programming Guide shows an example labelled "Listing 2-1  Creating a window with views" (see below). This shows how to create and add two subviews to a window.
I am using a similar pattern=. This works correctly, both windows get displayed.
The problem I am having is to get it to recognize and do rotation. I have added the shouldAutorotateInterfaceOrientation methods to do a return YES. These are being seen. But only one of the views gets rotated.
More specifically the last view to be added gets rotated and the previous one does not. I can get either to rotate by having it as the second addsubview. But cannot get both to rotate. (Testing in the Iphone simulator.)
Any suggestions on what is needed to get both views to rotate correctly?
Here is Apples sample code.
<code>- (void)applicationDidFinishLaunching:(UIApplication *)application {
    // Create the window object and assign it to the
    // window instance variable of the application delegate.
    window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    window.backgroundColor = [UIColor whiteColor];

    // Create a simple red square
    CGRect redFrame = CGRectMake(10, 10, 100, 100);
    UIView *redView = [[UIView alloc] initWithFrame:redFrame];
    redView.backgroundColor = [UIColor redColor];

    // Create a simple blue square
    CGRect blueFrame = CGRectMake(10, 150, 100, 100);
    UIView *blueView = [[UIView alloc] initWithFrame:blueFrame];
    blueView.backgroundColor = [UIColor blueColor];

    // Add the square views to the window
    [window addSubview:redView];
    [window addSubview:blueView];

    // Once added to the window, release the views to avoid the
    // extra retain count on each of them.
    [redView release];
    [blueView release];

    // Show the window.
    [window makeKeyAndVisible];
}
</code>
Answer: This question was abandoned, sadly...
I would love to find the answer to that, as it causes alot of problems on the iPad SDK... adding more than 1 subview at a forced landscape mode, will only make one rotated view.
Causing alot of confusion, something is very wrong with the system.
~ Natan.


How could a bulb light up if aĺl the voltage is lost in the resistor?

Question: I recently came up with this slight confusion about voltage loss in resistors/resistance. So for example My circuit has a 12V battery, a 2 Ohms resistor and a Bulb. If we use the V=I.R formula then a current of 6A(amperes) will flow through the circuit, then i remembered that V=I.R is the voltage loss due to a certain resistance, if we try to insert this formula to the resistor, then 12V will be lost in the resistor(6A×2 ohms), so how would the bulb turn on if all the voltage is wasted in the resistor?
*I'm still new to this topic, so please give me a clear simplified explanation, any answers would be appreciated.
Comment: The bulb also has resistance.
Answer:
My circuit has a 12V battery, a 2 Ohms resistor and a Bulb. If we use the V=I.R formula then a current of 6A(amperes) will flow through the circuit

The confusion comes from your first assumption. You start by calculating your current based on the assumption that all the voltage will drop across your 2-ohm resistor.
Take the resistance of your bulb into the equation and you'll get a different answer.
Example:
If your bulb has a resistance of 10 ohms, the current flowing through your circuit will be:
I = V / R = 12V / (2+10) ohms = 1 A.
With this, you can find how much voltage is dropped across your resistor:
V = I * R = 1A * 2 ohms = 2V
So 2V drop across your resistor and the other 10V across your bulb.
Answer:
if we try to insert this formula to the resistor, then 12V will be lost in the resistor(6A×2 ohms),

Voltage is

Voltage is electric potential energy per unit charge, measured in joules per coulomb ( = volts). It is often referred to as "electric potential", which then must be distinguished from electric potential energy by noting that the "potential" is a "per-unit-charge" quantity.

So the loss of volts means that energy has been deposited on the resistor.This energy following the quantum mechanical behavior of the specific resistor will become heat or light , if it is an incandescent lamp.
Answer: Voltage isn't "lost" in the resistor.  Voltage provides the driving force to cause electrons to flow through the circuit.  The resistance does what it says: it resists the flow of electrons by using atoms in the resistor to temporarily stop the electrons that are accelerating under the electric field that is in the circuit, and that electric field is measured in voltage drop per meter of length.  When these accelerating electrons hit atoms in their path, they impart their kinetic energy onto the atom that stopped them, leading to heat in the resistor.  The electron is then accelerated again by the electric field, and it continues until it strikes another atom in its path.
For a light bulb, the heat produces an increase in temperature that is high enough to cause the bulb's filament to glow.  The power produced by the bulb is given by the voltage drop across the bulb multiplied by the current flowing through the bulb, or $P=IV$.
Comment: So what about power lines? Some people told me that voltage is lost in the powerlines due to the resistance
Comment: I'm somehow still not getting it. Isn't V=I×R , the voltage lost ? So if you try increasing the resistance more voltage(electrical energy be lost)? {I came up with this question because in one of my textbook, there's a circuit with 2 ohms of resistance, a bulb, and the resistance of the bulb is probably negelected}
Comment: @KedagiSport, no.  $V=IR$ is the voltage drop across a given circuit element.  This voltage drop results in power production in that circuit element, in the form of heat.
Comment: @KedagiSport, are you reading a book on the subject of voltage and power?  Are you trying to learn this stuff on your own, or in a class room?
Comment: On my own, so after voltage passes a resistor, a voltage drop happens, right? So how will the bulb light on if all the voltage is 'dropped' across the resistor. (Ex before passing the resistor=12V, after passing the resistor=0V?
Comment: @KedagiSport, I suggest you carefully read a good book on the subject.  It would also be helpful if you find a qualified instructor, as electricity is not all that intuitive.


How to keep packages updated and keep in pace with security updates

Question: In a project with multiple vms that run various applications from Wordpress to Django and various other things.
Is there a way or a tool to keep track of the packages that require updates or have security problems not on an app level but on a vm level. Do I have to ssh into each machine and keep track of the packages or is there a smarter way to do that, could a tool like ansible be used for this job?
Answer: You could use pre-made roles like this one or this one or this one to manage apt for system related security upgrades.


Override mtdparts configured in kernel device tree

Question: I've installed Debian Buster on a "ReadyNAS 102" via u-boot / serial console. I was following this tutorial. But, replaced used different links to download current the Debian installer and Device Tree Blob:

http://ftp.debian.org/debian/dists/buster/main/installer-armhf/current/images/device-tree/armada-370-netgear-rn102.dtb
http://ftp.debian.org/debian/dists/buster/main/installer-armhf/current/images/netboot/initrd.gz
http://ftp.debian.org/debian/dists/buster/main/installer-armhf/current/images/netboot/vmlinuz

Installation worked fine, except for the installation of grub (which is known to fail according to the tutorial). Instead you've to manually install/configure the flash-kernel package.
I also had to manually call "mtdpart" to create the uImage and minirootfs partitions to finally be able to successfully run "update-initramfs":
# mtdpart add /dev/mtd0 uImage 0x200000 0x600000
# mtdpart add /dev/mtd0 minirootfs 0x800000 0x1000000
# update-initramfs -u

So far so good. I got the kernel booting, but after booting I've some preconfigured "mtd partitions", which seem to originate from the kernel device tree:
~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00180000 00020000 "u-boot"
mtd1: 00020000 00020000 "u-boot-env"
mtd2: 00600000 00020000 "uImage"
mtd3: 00400000 00020000 "minirootfs"
mtd4: 07400000 00020000 "ubifs"

The problem with this is: "minirootfs" is too small (only 4 MB) for the generated initramfs:
 # update-initramfs -u -k 4.19.0-6-armmp
 update-initramfs: Generating /boot/initrd.img-4.19.0-6-armmp
 Using DTB: armada-370-netgear-rn102.dtb
 Installing /usr/lib/linux-image-4.19.0-6-armmp/armada-370-netgear-rn102.dtb into /boot/dtbs/4.19.0-6-armmp/./armada-370-netgear-rn102.dtb
 Taking backup of armada-370-netgear-rn102.dtb.
 Installing new armada-370-netgear-rn102.dtb.
 Installing /usr/lib/linux-image-4.19.0-6-armmp/armada-370-netgear-rn102.dtb into /boot/dtbs/4.19.0-6-armmp/./armada-370-netgear-rn102.dtb
 Taking backup of armada-370-netgear-rn102.dtb.
 Installing new armada-370-netgear-rn102.dtb.
 flash-kernel: installing version 4.19.0-6-armmp

 The initial ramdisk is too large. This is often due to the unnecessary inclusion
 of all kernel modules in the image. To fix this set MODULES=dep in one or both
 /etc/initramfs-tools/conf.d/driver-policy (if it exists) and
 /etc/initramfs-tools/initramfs.conf and then run 'update-initramfs -u -k 4.19.0-6-armmp'

 Not enough space for initrd in MTD 'minirootfs' (need 4971360 but is actually 4194304).
 run-parts: /etc/initramfs/post-update.d//flash-kernel exited with return code 1

The new /dev/mtd0 to /dev/mtd4 devices can not be removed, edited or recreated by mtdpart. I also tried to set the mtdparts kernel parameter (which needs to be 'cmdlinepart.mtdparts' due to a bug in buster; I've tried 'mtdparts=' too):
# cat /proc/cmdline
console=ttyS0,115200 cmdlinepart.mtdparts=armada-nand:0x180000@0(u-boot),0x20000@0x180000(u-boot-env),(uImage),0x1000000@0x800000(minirootfs),-(ubi)

The mtd partitions seem to be defined in the *.dtb file that comes with the kernel:
The following message appears in "dmesg" speaking about "5 fixed-partions".
   [   18.310935] 5 fixed-partitions partitions found on MTD device pxa3xx_nand-0
   [   18.318030] Creating 5 MTD partitions on "pxa3xx_nand-0":
   root@ReadyNAS102:~# dmesg | grep 'MTD' -A 3
   [   18.310935] 5 fixed-partitions partitions found on MTD device pxa3xx_nand-0
   [   18.318030] Creating 5 MTD partitions on "pxa3xx_nand-0":
   (...some other lines...)
   [   18.443214] 0x000000000000-0x000000180000 : "u-boot"
   [   18.497255] 0x000000180000-0x0000001a0000 : "u-boot-env"
   [   18.543756] 0x000000200000-0x000000800000 : "uImage"
   [   18.601234] 0x000000800000-0x000000c00000 : "minirootfs"
   [   18.661169] 0x000000c00000-0x000008000000 : "ubifs"

I tried to edit the *.dtb file that comes with the kernel (/boot/dtbs/4.19.0-6-armmp/armada-370-netgear-rn102.dts) by using the dtc tool:
# dtc -I dtb -O dts armada-370-netgear-rn102.dtb > armada-370-netgear-rn102.dts
# editing the *.dts file
# dtc -I dts -O dtb armada-370-netgear-rn102.dts > armada-370-netgear-rn102.dtb

I changed the *.dts file as following:
 nand-controller@d0000 {
       compatible = "marvell,armada370-nand-controller";
       reg = < 0xd0000 0x54 >;
       #address-cells = < 0x01 >;
       #size-cells = < 0x00 >;
       interrupts = < 0x71 >;
       clocks = < 0x0d 0x00 >;
       status = "okay";

       nand@0 {
               reg = < 0x00 >;
               label = "pxa3xx_nand-0";
               nand-rb = < 0x00 >;
               marvell,nand-keep-config;
               nand-on-flash-bbt;
               nand-ecc-strength = < 0x04 >;
               nand-ecc-step-size = < 0x200 >;

               partitions {
                       compatible = "fixed-partitions";
                       #address-cells = < 0x01 >;
                       #size-cells = < 0x01 >;

                       partition@0 {
                               label = "u-boot";
                               reg = < 0x00 0x180000 >;
                               read-only;
                       };

                       partition@180000 {
                               label = "u-boot-env";
                               reg = < 0x180000 0x20000 >;
                               read-only;
                       };

                       partition@200000 {
                               label = "uImage";
                               reg = < 0x200000 0x600000 >;
                       };

                       partition@800000 {
                               label = "minirootfs";
                               reg = < 0x800000 0x1000000 >;
                       };

                       partition@c00000 {
                               label = "ubifs";
                               reg = < 0xc00000 0x7400000 >;
                       };
               };
       };
};

Especially, I changed "reg = < 0x800000 0x400000 >;" to "reg = < 0x800000 0x1000000 >;" for partition@800000:
                       partition@800000 {
                               label = "minirootfs";
                               reg = < 0x800000 0x1000000 >;
                       };

There's enough space before the "ubifs" partition and I don't use it anyways. But, after a reboot the kernel still tells me about the old settings. How can I fix that?
I could probably manually install "vmlinuz + *.dtb" to the NAND via uboot. But, that would be gone as soon as the next kernel update is installed.
I would prefer the kernel to interpret the "mtdparts" command line parameter.
Any ideas?
EDIT #1:
I now (ab)use the partition "ubifs" instead of "minirootfs" for the initramfs. This works, but I would like to know if there is a more clean solution. Of course, I also had to change my "bootcmd" at u-boot to load/use data from this partition instead:
setenv bootcmd 'nand read 0x2000000 0x200000 0x600000; nand read 0x3000000 0xc00000 0x800000; bootm 0x2000000 0x3000000'
saveenv
reset

Answer: It should be enough to just edit the dtb just like you already tried.
    partition@800000 {
      label = "minirootfs";
      reg = <0x0800000 0x800000>;    /* 8MB */
    };

    /* Last MB is for the BBT, i.e. not writable */
    partition@1000000 {
      label = "ubifs";
      reg = <0x01000000 0x7000000>; /* 112MB */
    };

I suspect you simply forgot to append the dtb to the kernel.
mtdinfo then reports:
    mtd3
    Name:                           minirootfs
    Type:                           nand
    Eraseblock size:                131072 bytes, 128.0 KiB
    Amount of eraseblocks:          64 (8388608 bytes, 8.0 MiB)
    Minimum input/output unit size: 2048 bytes
    Sub-page size:                  2048 bytes
    OOB size:                       64 bytes
    Character device major/minor:   90:6
    Bad blocks are allowed:         true
    Device is writable:             true

This is using debian 4.19.0-10 kernel


Reusing iPod touch 3.1 to play music

Question: I would like to use my iPod touch 3.1 only for music, pictures and videos.  Can I still download music to this iPod from my current iPhone music list?
Answer: You can sync music, pictures and videos to your iPod touch by syncing it with iTunes on your Mac or PC.
You can get the music that you have in your iPhone music list, by syncing the iPod with the same iTunes library that you used to sync music onto your iPhone.
Comment: Also, depending on it's age, iTunes may want to update IOS on the device. Though it is not necessary it might be a good idea to do so, from a device security standpoint.

Reusing iPod touch 3.1 to play music


How can I tell whether my Django application is running on development server or not?

Question: How can I be certain that my application is running on development server or not? I suppose I could check value of settings.DEBUG and assume if DEBUG is True then it's running on development server, but I'd prefer to know for sure than relying on convention.
Comment: Old ones are good ones! One reason you may need this is that logging.handlers.RotatingFileHandler doesn't work on the development server, so you need to conditionalize LOGGING if you want to use it.
Answer: I put the following in my settings.py to distinguish between the standard dev server and production:
import sys
RUNNING_DEVSERVER = (len(sys.argv) > 1 and sys.argv[1] == 'runserver')

This also relies on convention, however.
(Amended per Daniel Magnusson's comment)
Comment: i had to add if len(sys.argv) >1:  on prod server to get it working.
Comment: Could you explain what is this for? Maybe I do not understand the problem, but this variable stores whether the site is called with manage.py runserver, right? And what do you do with this? I stumble upon this post and this seems new stuff I want to learn. I was looking for a way to detect whether I am on localhost, in that case turn DEBUG on (I am not looking for an answer about this on this post)
Comment: simplified here: https://stackoverflow.com/a/37880897/
Comment: This is the better answer since it doesn't require a request. I want to do this to conditionally wire up the media urls
Comment: @aless80 there are uwsgi-specific stuff you might want to disable when running with the dev-server, like the spooler
Comment: What about running migrations (or any other command) on dev server? In my case it tries to connect to the database with the prod server credentials.
Answer: server = request.META.get('wsgi.file_wrapper', None)
if server is not None and server.__module__ == 'django.core.servers.basehttp':
    print('inside dev')

Of course, wsgi.file_wrapper might be set on META, and have a class from a module named django.core.servers.basehttp by extreme coincidence on another server environment, but I hope this will have you covered.
By the way, I discovered this by making a syntatically invalid template while running on the development server, and searched for interesting stuff on the Traceback and the Request information sections, so I'm just editing my answer to corroborate with Nate's ideas.
Comment: +1 for actually trying to address the question i.e. detecting what server is serving up the Django app, rather than relying on settings.  For example, there is nothing stopping someone from running in DEBUG mode behind something other than the development web server.
Comment: Very cool, but I would like to do this once upon startup, and not upon every request. Is that possible?
Comment: @TalWeiss you can add logic to `manage.py` and `wsgi.py` (or keeping with DRY, add the logic to a third file like `setvars.py` that gets imported & called by both). So use logic like the answer above, or another one of these answers, in order to call different variations of `os.environ.setdefault('DJANGO_SETTINGS_MODULE','some.settings.module')`. This assumes you separate your settings module into submodules by environment. On second thought the answer above won't work there since request isn't set yet. But you get the idea.
Comment: In Django 1.5.5 running on OS X, the module name is `wsgiref.util`. So this snippet won't work.
Comment: in Django 1.8.12 on linux, the module name is also `wsgiref.util`
Comment: Another META field that is specific for dev server: SERVER_SOFTWARE has strings `WSGIServer` and `Python` on dev and anything you configure in your HTTP server on "deployed".
Comment: I would add a `getattr(server, '__module__', None)` in the second line instead of going directly to the dot notation. You never know...
Answer: Usually this works:
import sys

if 'runserver' in sys.argv:
    # you use runserver

Comment: According to documentation, you should not use 'runserver' in a production setting. Just make sure DEBUG is used correctly; e.g. add safety nets and checks.
Comment: What would be the case under production environment? Doesn't this mean that `./manage.py runserver` is run and not for example `./manage.py shell_plus`
Answer: Typically I set a variable called environment and set it to "DEVELOPMENT", "STAGING" or "PRODUCTION".  Within the settings file I can then add basic logic to change which settings are being used, based on environment.
EDIT: Additionally, you can simply use this logic to include different settings.py files that override the base settings.  For example:
if environment == "DEBUG":
    from debugsettings import *

Answer: Relying on settings.DEBUG is the most elegant way AFAICS as it is also used in Django code base on occasion.
I suppose what you really want is a way to set that flag automatically without needing you update it manually everytime you upload the project to production servers.
For that I check the path of settings.py (in settings.py) to determine what server the project is running on:
if __file__ == "path to settings.py in my development machine":
    DEBUG = True
elif __file__ in [paths of production servers]:
    DEBUG = False
else:
    raise WhereTheHellIsThisServedException()

Mind you, you might also prefer doing this check with environment variables as @Soviut suggests. But as someone developing on Windows and serving on Linux checking the file paths was plain easier than going with environment variables.
Comment: well, apart from occasions when i might adopt same path convention in development and production (which would defeat this), this seems to be  the best for me. and +1 for `WhereTheHellIsThisServedException` :-)
Answer: I came across this problem just now, and ended up writing a solution similar to Aryeh Leib Taurog's. My main difference is that I want to differentiate between a production and dev environments when running the server, but also when running some one-off scripts for my app (which I run like DJANGO_SETTINGS_MODULE=settings python [the script] ). In this case, simply looking at whether argv[1] == runserver isn't enough. So what I came up with is to pass an extra command-line argument when I run the devserver, and also when I run my scripts, and just look for that argument in settings.py. So the code looks like this:
if '--in-development' in sys.argv:
    ## YES! we're in dev
    pass
else:
    ## Nope, this is prod
    pass

then, running the django server becomes
python manage.py runserver [whatever options you want] --in-development
and running my scripts is as easy as
DJANGO_SETTINGS_MODULE=settings python [myscript] --in-development
Just make sure the extra argument you pass along doens't conflict with anything django (in reality I use my app's name as part of the argument).
I think this is pretty decent, as it lets me control exactly when my server and scripts will behave as prod or dev, and I'm not relying on anyone else's conventions, other than my own.
EDIT: manage.py complains if you pass unrecognized options, so you need to change the code in settings.py to be something like
if sys.argv[0] == 'manage.py' or '--in-development' in sys.argv:
    # ...
    pass

Although this works, I recognize it's not the most elegant of solutions...
Answer: If you want to switch your settings files automatically dependent on the runtime environment
you could just use something that differs in environ, e.g.
from os import environ
if environ.get('_', ''):
    print "This is dev - not Apache mod_wsgi"

Answer: You can determine whether you're running under WSGI (mod_wsgi, gunicorn, waitress, etc.) vs. manage.py (runserver, test, migrate, etc.) or anything else:
import sys
WSGI = 'django.core.wsgi' in sys.modules

Answer: settings.DEBUG could be True and running under Apache or some other non-development server. It will still run. As far as I can tell, there is nothing in the run-time environment short of examining the pid and comparing to pids in the OS that will give you this information.
Answer: I use:
DEV_SERVERS = [
    'mymachine.local',
]

DEVELOPMENT = platform.node() in DEV_SERVERS

which requires paying attention to what is returned by .node() on your machines.  It's important that the default be non-development so that you don't accidentally expose sensitive development information.
You could also look into more complicated ways of uniquely identifying computers.
Answer: One difference between the development and deployment environment is going to be the server that it's running on. What exactly is different will depend on your dev and deployment environments.
Knowing your own dev and deploy environments, the HTTP request variables could be used to distinguish between the two. Look at request variables like request.META.HTTP_HOST, request.META.SERVER_NAME and request.META.SERVER_PORT and compare them in the two environments.
I bet you'll find something quite obvious that's different and can be used to detect your development environment. Do the test in settings.py and set a variable that you can use elsewhere.
Answer: Inspired by Aryeh's answer, the trick I devised for my own use is to just look for the name of my management script in sys.argv[0]:
USING_DEV_SERVER = "pulpdist/manage_site.py" in sys.argv[0]

(My use case is to automatically enable Django native authentication when running the test server - when running under Apache, even on development servers, all authentication for my current project is handled via Kerberos)
Answer: You could check request.META["SERVER_SOFTWARE"] value:
dev_servers = ["WSGIServer", "Werkzeug"]
if any(server in request.META["SERVER_SOFTWARE"] for server in dev_servers):
    print("is local")

Answer: Simple you may check the path you work on server. Something like:
import os
SERVER = True if os.path.exists('/var/www/your_project') else False

Answer: One approach is to create an environment variable on your dev machine such as RUNNING_IN_DEVELOPMENT = 1. JetBrains, for example, lets you do this in the Configuration Dialog.
Then in settings.py you can do:
try:
    running_in_development = os.getenv('RUNNING_IN_DEVELOPMENT')
    DEBUG = True if running_in_development else False
except Exception as e:
    DEBUG = False

Answer: I use the following:
MANAGING = (
    len(sys.argv) >= 2 and "manage.py" in sys.argv[0] and sys.argv[1] != "runserver"
)


How is the way that iphone received data from mysql with APNs?

Question: I am newbie for iphone development and wanna know that what is the way that iphone can received the live data , i mean when the data is inserted into mysql database and instantly can receive it on the iphone and update the recently data into the tableview by Apple push notification service.
Answer: It is not possible to sync data with just push notifications if the app is not active. You cannot execute any code when the app is not active.
But there are other ways:
1) When user tap on the push notification banner, your app is launched. You can do the syncing then. This is the most straight forward way to do it, and you will not get into trouble with app reviewers.
2) Newsstand - you can use push notification to send content update to Newsstand. Your app will be woken up in background to download any content update, but you are only allowed to do this once a day. You app needs to support auto-renewable subscription.
3) If you app uses any of the available background modes (e.g. continuous location update) to run in the background, then application delegate's didReceiveRemoteNotification is called when a push is received. You can do syncing here. But you have to have a good reason to use these background modes, not just as a workaround to keep the app active.


Up one's ass vs. In one's ass

Question: Why is stick/shove/etc up one's ass much more common than in/into one's ass?
Comment: Probably because when you tell someone to shove it, they're in a position where _in_ is _up_?
Comment: People keep using this word, *why*... And I keep asking back, why do you not use *blagoveshchensk* to mean "car"? Answer me that question, and you'll have answered yours.
Comment: That reminds me of Frindle...
Answer: The former is a more aggressive description of the act being used as a metaphor.  Well, mostly as a metaphor.  One would never say the nurse "stuck a 250mg acetaminophen suppository up . . . ," rather one would say that the nurse "inserted a suppository into my. . . ."  The more aggressive makes a stronger metaphor.
Comment: _Up_ is not more rude; it's more aggressive. _In_ suggests a gentler treatment. You _put_ something _in_; you _shove_ something _up_.
Comment: So basically "up" here kinda means "far in"?
Comment: No it doesn't mean 'far in' at all. It's simply a phrase that adds rudeness to 'arse'.
Comment: Why is "up" more rude than "in"? Don't ask me about blagoveshchensk though :)
Answer: One part of the answer may be that ass, or arse, has got two different meanings.
Ass, or arse, has the same meaning as buttocks or bottom, as in:
"The nurse said, 'Right then.  Don't just sit on your arse!' No sooner had I got up than, without so much as a Howdydoody, she'd stuck the needle in my arse."
The prepositions on/in are used because here ass or arse refers a solid object.
However, arse is sometimes used to replace the more technically correct arsehole (a three-dimensional space).
"Then, to make matters worse, she'd stuck a suppository right up my *arse/arsehole!  When I told her that she had promised it wouldn't hurt, she just replied, "Well, I guess I was just talking out of my *arse/arsehole."
I don't know what it would be like to have a suppository shoved in my arse (solid object), but I'd rather not find out.
Comment: Well, yes, in a literal sense you are correct. It was ass, not arse and not rectum. I was commenting on your unnecessary complication of adding arse to the discussion.  Anatomically, the specific site under discussion is, in fact, the rectum, a space rather than a structure.
Comment: How did a perfectly reasonable discussion of up, in or into a rectum descend into a discussion of arse and ass?
Comment: Look again.  I think the word in the question was ass, not rectum.

Up one's ass vs. In one's ass


More energy than normal - should I push myself?

Question: Somedays (like today) I feel literally like I could move mountains! Is there any harm to pushing yourself harder on these good days? Just likes it's okay to slow down on the low energy days (I'm talking about going from 5 sets to 7 to 8 sets).
Answer: If you want to increase your overall time under load (which based on other posts of yours is a strong possibility), this would be a good time to increase the weight.  That way, on your low energy days you'll already have built the base to keep the higher weights.

Why not go up by at least 5lb in all your lifts, and keep at least the same sets/reps you've been doing?

The arguments for and against the extra sets really depend on your goals:

Body building is trying to increase time under load, which usually emphasizes more sets/reps
Strength training keeps the number of sets/reps constant while progressively adding more weight
Lifting to failure makes the time after the gym much less pleasant--which tends to demotivate people.  Might not be an issue for you.
More weight at the same sets/reps is more load which also means more muscle.  I tell you, it doesn't take long before it becomes really challenging.
Answer: Yes, but depending on your goals (i.e. strength gains versus endurance) it may make more sense to add extra weight.
Edit: If your goal is to burn a specific number of calories, increasing weight or reps won't provide any benefit. If the goal is increase strength, size, power, or endurance doing more work than normal will get you closer to overload where the micro trauma occurs that allows for muscle growth (assuming your diet and rest periods will accommodate the growth). The proper balance of weight versus reps depends on which type of muscle fibers (i.e. slow twitch, fast twitch A, or fast twitch B) you want to encourage.
Comment: Care to explain why this is a good idea @Christopher?
Comment: @Ivo I expanded the answer with an edit. Hopefully that makes my thought clearer.


Which one makes a melody more noticeable, playing it an octave above the chords or below the chords?

Question: On a midi keyboard/piano, if I play both the chords and the vocal melody at the same time. How do you make the melody sound more prominent than the chords?
In general, which makes the melody more prominent, pitching a melody an octave above the chords or an octave below the chords it? I tried both but I can't tell.
Comment: I suspect the problem comes from using a keyboard which is not touch-sensitive. If that's the case, nothing much can be done. Every note played will come out at the same volume, which is not how real pianos work.
Comment: Pitch relative to the accompaniment, contour relative to the accompaniment, timbre, VOLUME (voicing), harmonic alignment with the accompaniment, repetitiveness, syncopation... There are many factors involved and pitch is just one. However, convention tends to put the (first instance) of the melody higher than the accompaniment, which probably creates an expectation on the listener's part.
Answer: In general, people perceive higher sounds more prominently than lower ones, all things being equal. However in practice our perception is multi-determined, so in the way it's asked, there's not a concise answer to the question. For example, density of sound (i.e., chords) can produce the effect of loudness, so that chords in which each note is the same volume as the melody will be perceived as louder than the melody.
Dealing with this problem is a basic part of piano training -- learning to balance volume between the hands and even individual fingers, and the starting point is near always learning to "bring out" a (higher) melody over a (lower) accompaniment. A touch-sensitive keyboard will allow for this with practice. The basic idea is to put more weight in the louder part(s). We talk about weight rather than force, because thinking in terms of force tends to result in a harsh sound (on an acoustic instrument, at least) and poor technique (which is more of a concern, because excessive force can lead to injury).
On a keyboard that doesn't allow for such variations in touch, one could try splitting the keyboard between two sounds such that one has some quality (loudness or  distinctive timbre, for example) that makes it more prominent and the other has qualities that reduce its impact.
Answer: Volume and tone (timbre) are more important that the octave.
Of course the emphasis on melodic line is what really makes the difference. It's hard to describe in objective terms, but melodic emphasis is what makes the melody stand out. It's a line with unique qualities. It depends on the texture, but in homophonic music the texture is one main melody with accompaniment. The main melody is unique while the accompaniment is more generic.
Just think of a bass singer. A bass could sing low to accompaniment in the high register of the piano. If you want to remove the textual aspect of the singing, just consider a bassoon instead. The timbral difference makes the melody part stand out.
In the case of a single instrument, like a piano, volume is one of the important things to bring out the melody. Louder parts tend to be heard as the main focus and therefore "the" melody. But the melodic emphasis part should be considered too. If an even touch was used in a passage, so volume would be a factor, the uniqueness of line will help bring out a melody. A generic broken chord pattern played against a line with mixed rhythms a much intervallic variety will tend to be heard as broken chord accompaniment to a main melodic line.
Having said all that, the top voice tends to be heard as "the" melody. If a passage was block chord with all parts moving in quarter notes, smooth step-wise voice leading in all parts, you might be hard pressed to say which part is "the" melody. In such a case the top part will probably be heard as the melody.
Answer: Indeed typically higher notes come to the first plane easier. Typically during the bass solos the rest of the band goes very quiet... or the bass moves to its higher registers.
If you don't have access to dynamics, you can use other means: articulation (legato/portato/staccato), timing, and also arrangement. Organ and harpsichord music might be a great source of inspiration. In this example of Fugue from Bach Toccata in C-minor BWV 911:

note how articulation is used to differentiate between the voices. It also helps that the fugue builds upon a theme of characteristic motifs which are repeated in various voices which makes it easier for the listener to distinguish them.


80s cartoon that had foes that looked like ant or scorpion aliens and rode cycled vehicles

Question: I'm looking to identify this 1980s cartoon that had a gang of foes. They had cycled vehicles and looked like ants or scorpions from an alien race (I don't know exactly).
Comment: By "they had cycled vehicles and looked like ants or scorpions from an alien race", are you referring to the "gang of foes" or to the protagonists? (I'm asking to make sure your question is worded properly.)
Answer: Perhaps you're recalling Jayce and the Wheeled Warriors (1985)

The show featured two duelling forces. The heroes are humans called the Lightning League who drive white and silver vehicles with assorted weaponry led by a teenager named Jayce. The villains are organic plant-based creatures called the Monster Minds who travel via large green organic vines, which can grow in and across interstellar space, and sprout seeds that grow rapidly into further Monster Minds. They are led by the very first of the Monster Minds, Saw Boss.
Comment: OP mentioned the villians. You might want to show some pics of those instead; https://jayce.fandom.com/wiki/Gun_Grinner / https://jayce.fandom.com/wiki/Terror_Tank /  https://jayce.fandom.com/wiki/KO_Kruiser etc
Answer: I had a friend with the same memory. We figured out it was a cartoon called InseKtorS (1994).
They fought off the enemy with musical colour guns.

The comic insect fight between Good and Evil. The Verygreens love
sunlight, bright colours and hilarity. The Kruds prefer shadows and
dull colours, and spend all their time plotting to overthrow the
Verygreens - always coming up with gadgets, machines and crazy plots
that never quite work.
Comment: Hi, welcome to SF&F.  Can you include some screenshots to help make the identification?


Power-on delay using NPN transistor

Question: I'm looking for a small and simple 1-2 second power-on delay circuit which would power the bluetooth module (20mA @ 3.6V). I have tried to achieve this using 2n3904 transistor, few resistors and capacitor, but unsuccessfully. Various schematics I found on the internet doesn't seem to work as expected. Any help would be greatly appreciated.
Comment: Are you trying to delay the power going into the bluetooth module, or a reset signal into the module.  I'm having troubling imagining the NPN only in the first scenario unless your also intending to have a lot of drop out or have some other higher voltage rail available to bias is on.
Comment: I'm trying to delay the power going into the bluetooth module.
Answer: This is the power-on delay circuit for the MIDI outputs of the Roland A-50:

R15 and R17 set the base current of the PNP transistor (this circuit is designed to supply 25 mA at 5 V). When powering on, C14 needs to be charged before the voltage at the transistor's base is low enough to switch on; the delay is determined by the time constant of C14 and R15. (For 1–2 s, you need a much larger capacitor.) R14 and D1 are optional; they are a path to quickly discharge the capacitor when power is switched off. R18 is optional; it speeds up switching off the transistor by allowing its base to be discharged faster.
This circuit switches the positive power rail. If you have only an NPN transistor, you have to reverse everything to switch the other rail (ground).
In either case, the module probably will not be able to withstand any voltages applied to its input pins when it is not powered.
Answer: The right way to achieve this is to use voltage detector with programmable delay e.g. NCP302

Power-on delay using NPN transistor


Why does the Strait of Hormuz sometimes get pluralized?

Question: On the map, there only seems to be one Strait of Hormuz, and I'd say about 50% of the time, I have indeed heard it referred to as the 'Strait of Hormuz', but the other half of the time people will refer to the 'Straits of Hormuz'.  Is this an arbitrary, incorrect pluralization?  If so, how did it originate?
Answer: In general, the plural form seems to be preferred in most descriptions of narrow waterways connecting two large stretches of water. The OED has this note in its entry for strait:

When used as a geographical proper name, the word is usually plural
  with singular sense, e.g. the Straits of Dover , the Straits of
  Gilbraltar (formerly †the Straits of Morocco ), the Straits of
  Magellan , the Straits of Malacca , and the Straits as short for any
  of these; with regard to Bass('s) Strait(s) , Torres Strait(s) , usage
  is divided, while Davis Strait rarely appears in the plural form. The
  use of the plural for the singular  began in the 15th c. A few
  writers, chiefly of gazetteers, use the singular consistently
  throughout.
Comment: @Jez: I don't, but a similar thing happened to 'narrow', another word for a constricted stretch of water. Its earliest recorded use is in the sixteenth century in the singular, but it seems to have become plural in the eighteenth century and is now only ever found as such.
Comment: Do we know *why* the plural started getting used, though?
Answer: It may not be as much as half the time that people refer to it as the 'Strait s of Hormuz'.  A majority of standard references seem to refer to it correctly in the singular.
One possible source of the sudden popularity in recent times could be Johnn Schroeders' March, 2011 book 'Straits of Hormuz', and propelled by current geopolitical interest in the region.
Comment: Barrie England's answer suggests how out of place your word "correctly" is.


Do this fact table alteration change the grain?

Question: The fact table is a weekly snapshot of help desk tickets with 1 row per ticket per week.  The ticket dimension contains TicketAgeTarget.  I would like to add to the fact table TicketAgeTargetIndicator which is simply 1 or 0 set by the age of the ticket exceeding the TicketAgeTarget, or not.  Now TicketAgeTargetIndicator is cumulative which qualifies as a fact however my feeling is the grain is altered?  Is it?
Answer: It's altered if your logic depends on days (or a finer grain) rather than weeks.  Imagine if you had a separate record for all tickets each day.  Would they all switch from 0 to 1 on the same day, or would they tick over in batches, one day at a time?  If the latter, then yes your grain has changed.
You may be able to retain your current grain by splitting your facts into "Num Old Tickets" and "Num New Tickets".


How to open and edit any xlsm files?

Question: How to open and edit any xlsm files in ubuntu?
Is there Any offline or online tools ?
I have tried libre office and WPS office . Also tried google sheet and online Microsoft office .
Answer: If you need to run the macros that are included/referenced in the .xlsm file on Linux then there is no software that I've come across or was able to find through searching that can do this. The major problem is that the underlying macro languages are completely different between MS Excel of LibreOffice.
Without an application your next best options are to either use something like CrossOver followed by Wine.
There is also a 3rd option, which I've never used, that's web based called Zamzar. Zamzar allows you to upload files and convert them to a variety of formats.
I tried the following answer in other forum but it didn't worked for me but you can gave a shot
Ask ubuntu solution

How to open and edit any xlsm files?


Do >iOS8 devices randomize Bluetooth-MAC address

Question: iOS8 has brought the randomization of the WiFi MAC-address. My question is if the Bluetooth MAC-address is also randomized in the same manner on iDevices?
Answer: Not on iOS 9.1 and earlier. Also, the wifi isn't always "randomized"
Answer: The answer right now on my iPhone 7 with iOS 10 is yes. On iOS 9.1 and earlier this wasn't the case.
I've been doing bluetooth scans today while toggling Airplane mode on and off. Every time I toggle Airplane mode off a new device, with a brand new MAC address, appears in the list.


Why is automatic weights missing from ctrl+p?

Question: I tried it on a fresh project and there I was able to successfully apply automatic weights. Here if I try to do it with empty weights I can't select bones in weight paint mode, so that's not an option. I tried searching for answer but couldn't find any. Any help is greatly appreciated :)
Comment: To select bones in weight paint mode see https://blender.stackexchange.com/questions/127805/i-cant-keep-my-armature-in-pose-mode-when-selecting-another-object
Comment: I tried it but I can't select them anyway, however, on a fresh project I'm able to select bones in weight paint mode just fine.
Comment: Still having this problem and cant find a solution anywhere :(
Comment: Grab object first ,then ⇧ Shift + Click add rig. There's no *Automatic Weight* that when you just only grab rig
Answer: If it help anyone: I had the same issue but was unable to solve this issue. There was no "automatic weights" in ctrl+p menu nor was I able to assign weights in any other way. After an hour of pain, the issue was that my mesh was disabled for selection. So dont forget to uncheck this option :)
Comment: Nice answer. Could be improved to show a screenshot with annotations.
Answer: I noticed that when I select Armature it highlights all my bones and when I press ctrl + p it seems that the automatic weights is missing as well.
If you're in Object Mode and you hit "a" to select everything, and then hit ctrl + p it shows the automatic weights in the context menu. Hope that helps :)
Answer: I had the same problem too. When I used Ctrl+mouse click (object data or vertex group) the automatic weight is missing, so the solution is to click on the rig then click the first object, then click the bottom object while holding shift and then when you click Ctrl+P it shows up. I hope that helps.
Answer: If you try to apply automatic weights to a curve or something like that be sure that you converted that to MESH with right click when object selected and convert to mesh option.
Answer: Try checking if your mesh is actually a mesh. I had this problem earlier when I tried to add an amature to a model. The problem was the model was made from curves, when I tried to set the parent with automatic weights the option was missing. When I converted the model  to a mesh and did the same process, the option came up. Hope this helps lol
Answer: I noticed that when I had not renamed my mesh the option did not appear, soon as I renamed it and selected it along with my armature, the option for Automatic weights showed up. Hope this helps.
Answer: I noticed that we have to select mesh before armature.


Macbook Pro boots successfully when using hard drive in USB enclosure but doesn't boot when connected internally

Question: Apologies for the long question. I will keep it as simple as I can.
Last week my Macbook Pro (13-inch, Mid 2010) started to act strange.
It started when I tried to open Skype and received an error complaining that the program could not start because Skype could not read (or lock, unfortunately I can't remember) it's skype.plist file.
I restarted my Macbook hoping that would fix the problem (and I hadn't restarted in a while so I figured it was overdue).
My Macbook restarted and played the startup chime but then hung at the grey startup screen  with the spinning wheel. I thought nothing of it and did a hard shutdown but no matter how many times I did, the Macbook never advanced past the grey startup screen.
I tried to boot using Safe and Verbose mode and got the following error in both cases:
<code>BootCacheControl : Unable to open /var/db/BootCache.playlist: 22 invalid argument
</code>
I googled the error and tried various solutions with no luck.
The Macbook would boot to the built-in Mountain Lion recovery partition.
At this point I decided to backup my data so I could mess with the hard drive a bit more without fear of losing any data. I booted in to the recovery partition and cloned my hard drive onto another using a USB enclosure. It seemed to work OK and I verified all of my files were on the backup hard drive by plugging it into another Macbook.
After cloning my hard drive I verified and repaired the disk and disk permissions using the disk utility in the recovery partition but that had no effect.
At this point I decided to reinstall Mountain Lion. I tried numerous times to reinstall it with the hard drive inside the Macbook (both using the recovery partition and a bootable Mountain Lion SD card) but couldn't get it to install. Eventually I got it to install, but only when the hard drive was placed in a USB enclosure. I knew this probably indicated a bigger underlying problem but decided to go ahead anyway.
I installed Mountain Lion successfully but now it will not boot with the hard drive connected inside the Macbook, only when it is used in my USB enclosure. When the hard drive is placed in my USB enclosure it boots to Mountain Lion without any problem.
With the hard drive inside the Macbook:

If the Macbook is booted as standard, it hangs on the grey startup screen with spinning wheel
If it is booted in verbose mode, it seems to boot successfully (shows no errors when the white text show up) and then hangs on a black screen with a solid white cursor in the top left corner (I can type at this point but it does nothing, it doesn't appear to be a terminal window)
If it is booted in safe mode, the progress bar appears, progresses to the end and then hangs on the grey startup screen with spinning wheel

I noticed a lot of suggestions on the internet to replace the hard drive cable to the motherboard. I did and it had no effect.
I've tried using another hard drive running a brand new install of Mountain Lion and that behaves exactly the same (boots fine using a USB enclosure but doesn't boot when connected internally).
I've booked an appointment at the Apple store but figured it was worth posting the question anyway, in case anybody has a similar issue in the future (hopefully I'll be able to post the answer, if nobody else does, after a visit to the Genius bar).
Any suggestions?
Thanks for reading.
Comment: I think you've done all the troubleshooting you can. Seems like a logic board problem.
Comment: Was your MBP under warranty or did Apple charge you to diagnose and/or replace the cable?
Answer:
You have eliminated the possibility of a hardware issue on the hard drive by installing a new hard drive and also by installing the operating system on the previous hard drive via USB.
You have replaced the cable connecting the internal hard drive to the mother board, so it's not a cable problem.
The only thing left seems to be the hard drive controller on the motherboard. I expect the Genius bar will recommend replacing the motherboard.
For an older model Mac like yours, it might be worth searching for a replacement motherboard and having a local Mac repair shop swapping it in for you. It might cost less.
Comment: I thought (but hoped not) that was the case. Thanks for taking time to read the question.
Answer: I took my Macbook to the Apple store. After performing some tests the man at the genius bar agreed with me that it would either be the cable or the motherboard. He said he would replace the cable again (just to make sure the one I installed wasn't defective or installed incorrectly) and if that didn't work, replace the motherboard.
I just received a call saying the Macbook was working after installing a new cable. I guess the cable I installed was defective or installed incorrectly.
I hope no-one ever has a similar problem, but if they do, this is what fixed it for me.
Answer: I literally unscrewed the cable, rubbed off some dirt and grit and dust, replaced it and SOLVED my issue! Thank you to this vlogger for his video! :) try it before you reinstall, format, or buy a new cable! Vid below:
https://www.youtube.com/watch?v=Amg5w0rlwDo
Answer: This YouTube video was incredibly helpful, and worked for me:
https://www.youtube.com/watch?v=Amg5w0rlwDo
I'd only add that as I chose to upgrade my HDD to SSD at the same time as fixing this problem using James' technique, I had to re-set the PRAM by starting-up while holding the CMD-OPT-P-R keys down.  Before I did that, the MacBook would boot from the drive connected to USB, but not while installed directly onto the HDD SATA cable.  Once the PRAM was re-set, all works properly (and I'm not even sure I need a new cable).
Comment: Welcome to Ask Different! Please describe the essential suggestions of the video that helped you solve the problem. Link only answers do not age very well. We don't know if the video will be there in the future. Thanks!


Which transformation did Future Gohan use in Dragon Ball Heroes episode 50?

Question: In Dragon Ball Heroes episode 50,

 Future Gohan, Goku and Bardock are fighting Demigra I believe and counter an attack of him with kamehamehas. Then, Goku which was fighting as super saiyan blue kaioken turns into Ultra Instict, Bardock which was transformed in Super Saiyan 3 turns into Super Saiyan 4, and Future Gohan who was fighting as super saiyan power ups, and apparently there is some light blue flashes in the aura. Did he turn Super Saiyan Rage or any other transformation?

Which transformation did Future Gohan use in Dragon Ball Heroes episode 50?
Answer: Future Gohan powered up to Super Saiyan 2.


"Inactive memory" management on Linux

Question: One of the problems that i face to many times a week on Linux is the inactive memory management.
Whenever i copy a a huge file or open a program like Matlab on my Ubuntu i notice that there is a huge amount of inactive memory remaining on my systems and my system slows down.
Although i can free it up by dropping caches (sysctl vm.drop_caches), But i still want to know why Linux doesn't manage it better? What are those inactave memory for after a copying process is finished?!
Is this a problem? If yes, How can it be solved?
Answer: Inactive memory is basically a cache, which makes consecutive operations faster. For example, that makes the second launch of Firefox significantly faster, than the first one.
You can be quite sure that this does not make your system slower. When there is a need of RAM, Linux (the kernel) can drop these immediately.
So actually, what you think as a deficiency, is actually a pretty amazing piece of engineering. Obligatory reference: "Linux ate my RAM!"
Comment: Yes, That it true for recently opened programs. But what about copied files?
Comment: That's disk caching.
Comment: I can't see why it occupies the RAM. I can feel it slows the performance down and it makes it slower for new programs to be loaded to the ram.
My friend has the same problem on Mint.

"Inactive memory" management on Linux


What is the correlation between developed provinces and institutions?

Question: In EU4, I have a nation that has no allies surrounding its borders and they all have an institution that I haven't embraced yet. However, I have noticed that if I increase the production value and base tax of some of my more wealthy provinces and if I have enough ducats, my nation embraces the institution on its own. Can someone tell me how exactly the development of provinces can lead to better institutions and if it would be worth it to develop said institution on my own?
Answer: From http://www.eu4wiki.com/Institutions

Developing a province gives that province an immediate increase in the
  oldest non-present institution equal to 16.66% (slightly under one
  sixth) of the new development of the province. The development
  required to bring an institution with 0% presence to 100% presence is
  of 601 cumulative development points, because for 600 points (reaching
  36 dev starting from 11) you get 99.96%. The required development
  within a province of a given starting development is summarized in the
  table below.

and

Regardless of initial development, the total cost of going from 0 to
  100% institution presence in a province is always about 2000 monarch
  points before other modifiers (such as terrain or the merchant guild
  estate bonus) to development cost. The amount of monarch points
  required to reach 100%, without any modifiers or initial presence, is
  summarized by the table below:

Because all of your neighbhor are not allies. It is likely that you are not benefiting from "friendly" neighbhor institution spread modifier. It is worthwhile trying to temporarily befriend someone with institution next to you to help spread it faster even if you plan to beat them later on.
Converse the opposite is also true. If your neighbor is rival then institution spreader will be extremely painful. This can be easily observable when British start colonialism institution and only border France and nobody else.
This is when forcing institution via development is handy. Instead of waiting for it. You can just start it yourself. However you have to keep in mind that 2200 MP is a significant investment and try to find decent province to do it in. Like a province that is grassland (low penalty) and has a decent trade good.
Edit: There is also a state edict that allow you to make institution spread slightly faster but I don't recommend that method because it cost ducat monthly upkeep. I often forget about edicts that are still active and costing me upkeep.


Extjs combo initial value after loadRecord before loading store

Question: I have a problem with combobox initial value. I'm using form.loadRecord() and form.updateRecord() to load form values and insert them to grid. It works ok except for the combo values. I load store for combo on demand when it is clicked, so after the initial loadRecord() I get an int value with id. I have both smthid and smthname columns on grid.
I tried to change the value beforerender but as suspected it gets propagated to grid. I need to somehow change the initial value of the combo without writing it to the grid when the value is not int.
Answer: Try using setValue() or setRawValue() on the Combo. This should set the display, but not save the record until you updateRecord() manually.


How to cancel processed order?

Question: I have created an order and invoice is generated. After creating the invoice, the customer asked to cancel the order.
How to cancel the invoice created order.
Answer: You cannot cancel the invoice but you need to create credit memo.
Open your order, then click on credit memo and click on refund offline
Answer: Canceling the invoice is to remove part of the history of the order.  If the order was invoiced and charged, but it would be desired to undo that, the correct process is to acknowledge that the order was invoiced, charged, and then add the additional step in the procedure that issues a credit refund to the customer.
The entire transaction and exchange of monies will be logged and referenced for more historical "paper-trail" than you may be aware of.  It would be a good idea to understanding all the transactions that were completed, then resulted in returns/refunds.  In additional to historical sales/returns data, if there is any discrepancy about the order in the future, the transaction details for each step from start to finish will be accessible as fact.
Consider that you can even track details from the payment gateway for the charge, as well as for the refund/credit, to cover your butt if the customer cannot recall the outcome or the tries to scam.

How to cancel processed order?


301 redirect of main URL

Question: I have changed my website's domain. For eg. www.abc.com to www.xyz.com.
Now I want to set 301 redirect for www.abc.com to www.xyz.com.
I have checked Catalog > URL Rewrite Management.
Is that right way to do it? Or how can I do that redirect for the main URL from Magento backend.
Answer: You can do this through your .htaccess file. Unfortunately, Magento does not have a built in functionality for redirecting root domains.
Add this to your .htaccess file. It will 301 redirect all requests from the old domain to the new one.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^old.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.old.com [NC]
RewriteRule ^(.*)$ http://www.new.com/$1 [L,R=301,NC]

Comment: How can i redirect my abc.com to www.abc.com by using 301 redirect
Answer: Best way will be you can do it is if you can access database.
UPDATE core_config_data SET value = "www.xyz.com/" WHERE value = "www.abc.com/"

Then delete your cache and session folder inside magento_root_folder/var
OR
If you can access your backend from your old URL then change Base URL in:
System > Configuration > General > Web > Unsecure
System > Configuration > General > Web > Secure

And clear your cache and session after it.

301 redirect of main URL


Burning CDs from iTunes

Question: Why are my music tracks when burned to CD from iTunes thru the Playlist feature shorter than the originals?  I have tried on multiple albums all with the same result.  A song might be 4:58 in iTunes and when I burn a CD, the song is now 2:58.  There does not appear to be any logic on the difference, just that the entire song does not copy.  This does not happen with all songs, just random ones.  Typical 5-8 minutes of music is deleted from several tracks.  It is not an issue of capacity on the CD.  I am well under the limit there.
Comment: Are the original files definitely on your computer, not iTunes Match tracks which iTunes is trying to stream and burn at the same time? And have you listened to these tracks all the way through to check that there isn't actually an error reading them from disk?
Answer: That is odd. The only thing I can think of is that perhaps the start/stop times of some individual songs have been changed. Try this

Find a song that this happened to
Get Info on it (right click on the song in iTunes and select Get Info)
Click the "options" tab near the top of the Get Info window
Check and see if the start and stop times have been changed. Start should be "0:00" and end should be the full length of the song in minutes and seconds.

If those times are set incorrectly the songs will be clipped/truncated when playing, creating an AAC version of the song or burning to CD.
If that is not it... well sorry I don't know

Burning CDs from iTunes


Apple Pay Checkout Integration?

Question: I would like to use Apple Pay in my checkout through Stripe. Is this possible and if so, is there any documentation to make this happen?
Answer: (I'm with Vector; we run CartThrob)
My understanding is that right now Apple Pay is only used for within-app purchases, not on mobile websites. So typically this would be unrelated to the website's CartThrob installation. Or is the app just a wrapper for the site?

Apple Pay Checkout Integration?


How to find files that are not owned by any package?

Question: In my system I have files that not belong to any package, they are mine or from compiled programs installed with make install. How can I find all files that do not belong to any package?
Answer: In /var/lib/dpkg/info are .list text files that list all the files contained in each package¹ installed through Debian's package manager.
Finding all files in the filesystem not matching any entry there can be achieved with something naïve like this:
find / -xdev -type f \( -exec grep -xq "{}" /var/lib/dpkg/info/*.list \; -or -print \)

This will obviously take a very long time as the whole filesystem will be scanned.  If you use different partitions for system directories (such as /usr or /var), specify them after the initial /.
Warning: That does not include files created by package scripts. For instance:

/etc/hosts.allow is not listed anywhere but it might come from libwrap0 that possibly created it, if that file didn't exist at time of the package installation.
Many files are compiled during installation, for example .pyc files (compiled Python libraries), .elc files (compiled Emacs Lisp librarires), etc.
…
Comment: error `find: argument list too long`
Comment: @naught101 That suggests there are a gazillion files matching `/var/lib/dpkg/info/*.list` — above query would need to be rewritten under some other principle.
Answer: A more efficient version of @Patrice's solution, using a shell with support for process substitution (bash, AT&T ksh, zsh):
(
  export LC_ALL=C
  comm -23 <(find / -xdev -type f | sort) \
           <(sort -u /var/lib/dpkg/info/*.list)
)

Like Patrice's solution, it assumes no file path contains newline characters.
Comment: Would using the `locate` database be faster than running `find`? `locate \* | grep -v "^/home/"` - also has the benefit of looking in `/boot/` and other system partitions.
Answer: Since you tagged your question with debian the obvious choice not mentioned yet is to use cruft-ng if you don't require any flexibility or cruft if you don't want to search through the whole system/locatedb.
Answer: You can also use process substitution & grep & find. Note that the grep is used twice to filter only relevant paths from /var/lib/dpkg/info to save few seconds if you are looking for files in a certain directory.
dir="/lib/x86_64-linux-gnu"
find "$dir" -type f \
| grep -v -x -F -f \
    <(find '/var/lib/dpkg/info' -name '*.list' -print0 \
       | xargs -0 grep -h -F "^$dir" \
       | sort -u)


process command with -U

Question: ps -f -U

I am not able to understand the functionality of this command.
I am getting output for the above mentioned command, but not able to understand it.
Comment: What Uix are you trying to use this on? Does it generate any error or warning message? Please [edit] your question to fill in some details.
Answer: In ps the -U option is supposed to take list of users whose processes you want to view (or more correctly, usernames under which processes run).  Purpose is obviously filtering by username.
Something like this:
$ ps -f -U syslog,avahi
UID        PID  PPID  C STIME TTY          TIME CMD
syslog     522     1  0 10月22 ?      00:00:00 /usr/sbin/rsyslogd -n
avahi      594     1  0 10月22 ?      00:00:00 avahi-daemon: running [eagle.local]
avahi      622   594  0 10月22 ?      00:00:00 avahi-daemon: chroot helper

The option is present in both FreeBSD and coreutils ps as well as POSIX standard, so I'm guessing this is fairly portable option.
As for -f, manual for coreutils ps states:
   -f     Do full-format listing. This option can be combined with many other UNIX-style options to add additional columns.  It also causes the command arguments to be printed.  When used with -L, the NLWP (number of threads)
          and LWP (thread ID) columns will be added.  See the c option, the format keyword args, and the format keyword comm.

while FreeBSD manual states:
 -f      Show command-line and environment information about swapped out
     processes.  This option is honored only if the UID of the user is
     0.

So the purpose is to obtain full formatting of the output in either case, but notice the description is very different. Notice also that FreeBSD option is supposed to unclude swapped out processes. This one isn't quite portable, since it's missing in OpenBSD manual.

process command with -U


How can I fix my PS3 controller?

Question: My friend left his wireless PS3 controller at my house. He told me I can keep it because he plays XBOX 360. My wired controller stopped working last night. I tried to use the wireless one my friend left to play Grand Theft Auto V. It does work but, the L1 and down button on the D-Pad don't work. I have the controller apart but, I can't see anything wrong with it. I don't see the sense in throwing it away because it works great except for those 2 buttons. How do I repair it?
Comment: @TheIdiotGamer. I fail to see how a PS3 controller is unrelated to gaming.
Comment: If you could show us some screenshots, we might be able to help a bit better, otherwise I would just put it down to wear and tear. How old is the controller?
Comment: Sounds like a loose connection. You might be able to solder it back in place but unless you know what you're doing, ie have used a soldering iron before, you'll probably just do more damage.
Comment: @TheIdiotGamer 323 questions on the controllers tag says exactly otherwise (especially since the tag has a developed wiki), you can even filter them down to just questions using the ps3 tag and see how there are 40 questions, only 1 is closed because it's a duplicate. what isn't welcome here in terms of hardware is Hardware Recommendations (mostly on the context for "Which PC/Component, X or Y, is better for me to buy to play Z")
Comment: My advice is to take is to a PC repair shop- most will be able to either fix it or be sure that it's not worth fixing.
Answer: I repaired a PlayStation 2 controller whose circle button wasn't working reliably by taking it apart and cleaning it. All I did was use tissue to wipe away the grease and dirt that had built up on the pads and contacts. The direction pad should be easy to clean, make sure to clean the pads on the rubber part, the film covering the motherboard, and the contacts on the motherboard itself. The L1 trigger will be trickier, you'll probably need to consult a teardown to see how to get access to the parts that need to be cleaned.
Don't be aggressive, these parts will also wear out and when that happens there's little you can do to fix the problem. You want to do as little a possible to hurry this along, so be gentle.
I've also done the same thing to fix TV remotes whose contacts have gotten dirty, but I should note this problem usually only occurs for me with the commonly used buttons. Since the direction pad doesn't get a lot of use in most games, this may mean that you have encountered a different problem. Unfortunately that would also mean there's probably nothing you can do to fix it.

How can I fix my PS3 controller?