Which Pentatonic scale to play over which chord in a major key chord progression?

Question: How do I decide which scale to play on each different chord.
For example in a C major key I have I ii iii IV V vi viidim chords.
I can play C major pentatonic on I chord but on other chords ii iii IV V vi viidim which scales do I choose? Which scales would work best.
Answer: When you compare all the diatonic chords I ii iii IV V vi viio with the pentatonic scale on the tonic C D E G A you will notice that most of the various chords don't have all their tones available in the pentatonic scale. Chords I (C E G) and vi (A C E) are complete, but all the other chords are incomplete. Ex, you can't get the two other primary chords IV (F A C) and V (G B D), because the F and B are not in the pentatonic scale.
One approach to deal with this is workaround the missing tones and target the available tones. If you focus on the tonic and dominant of the scale it covers almost all the chords...

C with I vi IV
G with V iii I & viio for a V7

...notice that G is in both I and V making it a fairly "safe" tone.
You could also focus on the tonic and second scale degree, the supertonic...

C with I vi IV
D with ii viio V

A benefit of pairing up two target tones is it helps make nice two part phrases.
But there is another thing to consider. In pop and rock style it's common for the melody - especially improvised solo lines - to not match up perfectly with chord tones. In this style chord progressions have a tendency to repeat over and over. They don't move to new keys. From a higher level perspective such progressions just set out the tonic or tonal palette. Something like ||: I V vi IV :|| in C is a good example. Repeating that over and over is basically harmonically static. It just stays in C.
When a C pentatonic scale is used to improvise over that kind of progression the concern isn't about each tone harmonizing with every chord. It's about an interesting line and a clear sense it's a line in C. The ending of phrases and lines in the improvisation will get more care to end on a good harmonic note, most likely the tonic. The "mismatch" of tones on the interior of the improvised lines is something you can exploit. It can create dynamic tension leading to a satisfying ending on a well harmonized note.
Answer: What makes a Pentatonic scale so "useful" is that you can play it on any scale degree, not just on I chords. The Pentatonic scale has at least one note in each of the chords you listed, so it will never technically be wrong to stick purely to the scale. Now, that wouldn't make for a very interesting jam, but it is a really good starting place for learning improvisation. As you continue, you can do more interesting things, like adopting some notes from the chords that aren't in the Pentatonic every once in a while.
But that is a little besides your question, so your answer would be: the Pentatonic scale on I chord will work for every chord in your scale.
Answer: Pentatonics. Here, pent. major. In key C, C major pentatonic works well. Especially over any bars with a C chord. That's particularly due to two 'avoid' notes missing. C maj. pent. has C D E G A. Missing F and B. Those avoid notes are so called because they are the ones which can easily clash when played over a C chord. Out of C maj. pent. the C E and G are already sounding in that chord, and the D and A don't present any particular discordancy.
All that's o.k., but songs don't just stay on C all through!
Let's consider the V chord - G. If it's G7, then it contains those two previously considered avoid notes! They are good to play over G(7), so are not avoid notes at this point. Ironically, the worst avoid note now is C. G A B D E and F are good.
On to the IV chord - F. Obviously, F itself is a goody, although B probably isn't. So - F G A C D work best.
You may have noticed that the notes for each are their own maj. pent., with the addition of note F over G7.
On to the minors. Dm is relative to F, so the F notes work. Em is relative to G, so the G notes (minus F) work, and Am is relative to c, so C notes work. All this paragraph is a sort of blanket - 'safety blanket' is you like.
Having said all that, I often tell students that after the 'rules' are known, any note, anywhere, any time, over any chord is possible. Andd that includes non-diatonics, so use pents as a start point, but don't be restricted to only using those. Music is pretty bland when that happens. it needs the 'wrong' notes - but used intelligently!


is it possible to control the Fan from GPIO?

Question: am a programmer with no hardware knowledge background and defently no physics background.
I have a RPi4B and bought a fan bundled with its heatsink.
I realized the fan is basic and has 2 female pins to the 5V and ground.
I want to control the fan depending on CPU temperature. am well aware it's impossible with a software solution only because the 5V is always on. the 5V pin is not a GPIO pin, and only GPIO pins can be controlled from software.
so additional hardware is needed!
I found many articles and posts here how to do this with the help of a 2N222 transistor and a resistor. (which I just ordered from aliexpress lol. alongside the soldering iron and wire)
I noticed the fan is very quiet on the 3V pin so I got the idea to control the watt output too while keeping always on the 5V pin!(just like the gears in your car)
can this be acheived from software only ?
or can I use two different resistors to the transistor (each resistor is connected to a different GPIO) and control which GPIO is on ?
Answer: Perhaps the easiest way to do this is to add the one-line dtoverlay=gpio-fan facility to your /boot/config.txt file. You will still need to add some hardware, but the transistor and resistor may be all the hardware required.
You can learn a bit about the Raspberry Pi's device tree, and the pre-packaged overlays in this document. Scroll down or search this file until you find the dtoverlay=gpio-fan section.
Define the dtoverlay parameters:
You'll need to make two decisions to set this up:

the GPIO pin to use, and
the temperature at which the fan will turn on

Assuming your choices are GPIO 23 and 50℃, your one-line overlay is this:
dtoverlay=gpio-fan,gpiopin=23,temp=50000

To "install" this overlay, open the file /boot/config.txt in your editor, and insert this dtoverlay line somewhere above the [pi4] section near the end of the file.
The components and interconnections required are shown in the following schematic:

simulate this circuit – Schematic created using CircuitLab
Some notes re this schematic:

You may use either the 5V supply (shown), or the 3.3V supply.
The diode D1 (1N4148) is optional, but preferable, to limit "back EMF" when the fan is switched off.
See this page for a "translation" between GPIO numbers and physical pin numbers

reboot and test
The dtoverlay will take effect after the next reboot. When the CPU temperature reaches 50℃, the designated GPIO will go "HIGH", thereby turning the transistor Q1 "ON", and causing the fan to start. When the temperature falls to approx 45℃, the fan will be switched "OFF" again.
Let us know if you have further questions.
Answer: Your Question is rather confused, but the following may help (if I understand what you are trying to ask).
You can not power a fan from GPIO pins.
It is possible to power from 5V or 3.3V pins, but this will run all the time.
NOTE powering a 5V fan from 3.3V is not recommended.
Fan control is about the simplest workable solution. I use this on my Pi4 and the fan rarely operates, and only activates if it is stressed.
It is possible to control speed (over a limited range) using PWM. The hardware remains the same, you need to program the PWM duty cycle to control speed.
NOTE your question about different resistors is a bad idea. Operating a transistor in linear mode dissipates excessive heat; you would need to use trial and error to find a resistor which works (as Hfe of transistors varies) and motors are unreliable at low voltage.
Comment: 1-first part is reaffirmations of what i said. 2- in 2nd paragraph i have to disagree about "is about simplest workable solution". 3- you answered my question with PWM ! I guess that's what am looking for. Now am wondering how that is achieved? Since Voltage is constant (5v) PWM works by changing the amps on the GPIO pin ? How does the speed change happen ? Thank you
Comment: @AmineTbaik I still maintain that this is the simplest solution; it uses minimal hardware (3 components) and software (1 line). If you find something simpler I would love to hear it. There are hundreds of posts about PWM using various libraries on this site. I suggest you try the suggested solution and only explore PWM if you find it does not meet your needs. It is simple enough if you have programming experience, but I have never bothered. In fact if you really want variable speed a 3 terminal fan is probably better.
Comment: just since you asked: the easiest solution in the planet is to just plug it and let the thing spin forever. But am not looking for easy. Am looking for: power efficient (meaning it only spins when needed) and looking for silence (slow speed and goes faster the higher the temperature gets). But thanks, you already answered the question. Dont know why you removed that part from your answer then challenged me here on comments.
Comment: @AmineTbaik You asked "I want to control the fan depending on CPU temperature". Doing nothing is obviously simpler. "Don't know why you removed that part from your answer" - I removed nothing!  If you need clarification ask.


JQTouch transition problem

Question: I have a problem with the jqtouch bottom toolbar. Its a stationary bottom toolbar that is implemented with the iScroll plugin for jqtouch.
When I want to switch between a page with a "right" slide transition effect I want to exclude the bottombar from also using the transition effect.
The reason for this is because it looks weird when the bottom toolbar slides to the right.
edit:
Example would be to imitate the iPhone webbrowser. You always see the navigation at the bottom and it does not move with the website.
This effect I want within jqtouch.
Answer: Solved with a new update in jqtouch.

JQTouch transition problem


Can a paper accepted as an extended abstract be submitted to other conferences?

Question: Recently, I have a paper only accepted as an extended abstract by a AI conference. Is it still possible to submit this paper to other conferences like KR (International Conference on Principles of Knowledge Representation and Reasoning)?
Answer: I would guess not, unless you take some steps. First, contact the conference organization of the AI conference and pose your question there. And make sure that the organizers of any conference you want to submit to in future know about the abstract. Make it transparent.
Second is that if all of your "innovative" results are present in the extended abstract, then the other conference probably won't be interested, even if they consider it a "separate" work, which they might not.
But if the full paper is sufficiently innovative as an extension of the extended abstract, then you should be fine.
It will take some finesse, quoting and citing the abstract as necessary in the "new" paper.
Answer: It depends on the specifics, but often, yes, this is allowed.
In particular, if the paper was accepted in a conference as an extended abstract such that the full paper being submitted to the second conference did not appear in the proceedings in an archival form, it is usually not considered "published" in the formal sense that conferences mean when they refer to original and unpublished work in their calls for submission. This also applies to papers that previously were presented in workshops without archival proceedings.
The idea is that the initial submission as an extended abstract or workshop paper may be a work in progress, with a more complete version submitted for archival to the conference later. But even then, there are usually no formal requirements that new content needs to be added between the two papers, unlike the case where you first submit to a conference and  a full version to a journal later. So even submitting the paper as is should usually be acceptable.
In your particular case, the submission instructions of KR (at least the 2020 instance) do explicitly allow this (emphasis mine):

Both full and short papers must describe original, previously unpublished research, and must not simultaneously be submitted for publication elsewhere. These restrictions do not apply to previously accepted workshop papers with a limited audience and/or without archival proceedings, and to papers uploaded at public repositories (e.g., arXiv).

To summarize: usually yes, if the first submission did not appear in the formal proceedings, and no otherwise.

Note: if the abstract itself appeared in the proceedings of the first conference, then it should be cited in the second submission. Also, I am assuming your full submission to the second conference is a significantly expanded version of the abstract.
Comment: I worry about "usually yes". I think that in CS the conditions that permit it are rarer than you might think. "Workshop papers" is also significant here.
Comment: @Buffy That's surprising, I am in CS too, and the policies of all the conferences I have seen so far in my subfield (which is close to AI) do not prevent non-archival past work from being submitted. Here, I am assuming that the paper in conference B is significantly extended from the abstract in conference A. My third para was only to cover papers that may have been presented in A but did not appear in its proceedings.
Comment: I agree that if the extended abstract was in the proceedings, and the submission to conference B is very close to it, then there is a problem.
Comment: @GoodDeeds Actually, my extended abstract is not a workshop paper. Is it still possible to submit to KR? Is it belong to the third type, i.e., papers not uploaded at public repositories?
Comment: @Marvin Is your full submission significantly expanded upon the abstract? Did the extended abstract appear in the first conference's proceedings?
Comment: @GoodDeeds The extended abstract is in the first conference's proceedings.  And  full submission is significantly expanded upon the abstract. But the full version is not uploaded at public repositories.
Comment: @Marvin Then it should be fine, looking at the policy linked. Make sure you cite the abstract. If you're still doubtful, contact the second conference's organizers.


Highlighting shader but using touch points/mouse

Question: I have done the following highlighting shader using GLSL.
What I want to do is getting the mouse coordinates and "start" the highlighting from that point. is that possible ? What's the math or the idea behind doing that ?
https://youtu.be/8etJho4agpg
Answer: In the vertex shader (or on the CPU) what you'll want to do is transform your screen space coordinate into an object space coordinate. Or you could use a ray trace, tracing a ray from the screen point out of the camera, so that it hits the geometry and returns that point in world space (which you can easily turn into object space in your vertex shader) see https://docs.unity3d.com/ScriptReference/Camera.ScreenPointToRay.html for what I mean (I know your not using unity but it explains it better). Once you have this point then in the fragment shader subtract (or add) this point to the vertex position/uv used to calculate the highlight and it should make it expand out from the mouse.


What is the Todd's function in Atiyah's paper?

Question: In terms of purported proof of Atiyah's Riemann Hypothesis, my question is what is the Todd function that seems to be very important in the proof of Riemann's Hypothesis?
Comment: I guess this had to come. I would be tempted to close the question to preserve Sir Micheal Atiyah from further embarrassment. On the other hand someone has to stress that, sadly, his alleged proof of RH makes no sense at all.
Comment: I just decided to email Atiyah asking for clarifications, and he has answered. If I figure something worthy out of the conversation, I will post it here (of course, since I'm not an expert in analysis, I may fail to understand subtle ideas). For starters, the preprints are from him (although he didn't know they had leaked, and is going to circulate a paper), and address the "T would be constant" issue: since it is defined as a weak limit (which is not unique), it has no analytic continuation. It is uniquely determined by Hirzebruch theory. If you want to help me, write to josebrox at mat.uc.pt
Comment: @JackD'Aurizio In my opinion this kind of question is precisely what the site is for.
Comment: @josebrox I think he needs to define precisely what he means by weak limit. It is a critical part of the proof and he cannot assume that people know what he is talking about.
Comment: @JackD'Aurizio Perhaps you want to take a look at this serious blog post:
https://rjlipton.wordpress.com/2018/09/26/reading-into-atiyahs-proof/ .
$T$ may make sense, but not as a complex analytic function, of course. But that is not what Atiyah has in mind, since he says so himself (personal communication). Some are trying to make sense of his definitions and terms (which in my opinion are strange in part because they are like coming from the 30's - 50's of the past century, not from their usual usage right now)
Comment: https://mathoverflow.net/questions/311280/what-is-the-definition-of-the-function-t-used-in-atiyahs-attempted-proof-of-the
Comment: @tst Thanks. Yes, I'm already addressing that.
Comment: @JoseBrox: even if $T$ makes some sense (which is not the case, in my opinion), "proving" RH without invoking any particular property of the $\zeta(s)$ function (like Euler's product for $\text{Re}(s)>1$ or the reflection formula) is highly suspicious.
Comment: It is told that Todd dunction has weak analytic Continuation ... any comment on that ?
Answer: While there might be an interesting question here about the older math that Atiyah references, it is worth pointing out what Atiyah actually says about the function $T$:

$T : \mathbb{C} \to \mathbb{C}$ (this is in Section 3.4 of the longer paper "The Fine Structure Constant").
$T$ is "real" (see 2.2 of the shorter paper "The Riemann Hypothesis" - it doesn't mean "real-valued").
$T(1) = 1$ (2.3 of the shorter paper "The Riemann Hypothesis").
On any compact, convex set $K$, $T$ is a polynomial of some degree and the degree is in principle allowed to depend on the set $K$ (this is in the start of Section 2).
If $f$ and $g$ are power series with no constant term then
$$
T\Bigl( 1 + f(s) + g(s) + f(s)g(s)\Bigr) = T\Bigl(1 + f(s) + g(s)\Bigr)
$$
(this is 2.6 of shorter paper).

The following proof is from a Redditor :
Set $f(s) = e^s - 1$ and $g(s) = 1 - e^s$. Point 5. then implies that
$$
T\Bigl( 1 + e^s - 1 + 1 - e^s + (e^s - 1)(1 - e^s)\Bigr) = T(1)
$$
i.e.(using 3.):
$$
T\Bigl( e^s(2-e^s))\Bigr) = 1.
$$
Now notice that the function $e^s(2-e^s)\rvert_{\mathbb{R}}$ takes any value in $(-\infty,1)$. To see this claim you can solve
$$
e^x(2-e^x) = y\ \Leftrightarrow e^{2x} - 2e^x + y = 0
$$
by using the quadratic formula and taking logarithms to get a real solution when $y < 1$. This shows that $T\rvert_{(-\infty,1)}$ is constant.
OK so now take a compact, convex set $K \subset \{ \mathrm{Re}(z) < 1\}$ that contains an interval on the real line, i.e. $K$ contains a subinterval $I$ of $(-\infty,1)$. From the properties 2. and 4. we know that $T\rvert_K$ is a polynomial with real coefficients. But we also know it is constant on $I$ which means $T \rvert_K$ is constant.
Since $K$ was arbitrary we can easily exhaust$ \{ \mathrm{Re}(z) < 1\}$ by compact, convex sets to show that $T$ is constant on $\{ \mathrm{Re}(z) < 1\}$, in particular, this includes the critical strip.
Comment: I think property 4 by itself kills the proof completely. If a complex function is a polynomial in an open set, it is just a polynomial. There is no way out of this.
Comment: Unless I do a dumb mistake, property 4 implies that $T$ is a global polynomial. Indeed, pick any two (non-trivial) compact convex sets $K_1,K_2$. Then $T=P_1$ on $K_1$ and $T=P_2$ on $K_2$ for some polynomials. I claim that $P_1=P_2$. Indeed, pick a compact convex set $K$ such that $K_{1,2} \subset K$ (for example $K=$ convex hull of $(K_1,K_2)$. Then $T=P$ polynomial on $K$. Next, since $K_1 \subset K$ you have $P_1=P$ on $K_1$, and hence, since $K_1$ is infinite, $P_1=P$. Same was $P_2=P$, and hence $$P_1=P_2$$
Comment: What I read about [Todd multiplicative sequences](http://184.108.40.206/uploads/soft/all/18729.pdf) (p.122) lets me wonder if $T$ is a function of formal power series instead of complex numbers
Comment: I guess there are two different $T$, one is a function and one an operator, denoted by different braces: $T(\cdot)$ vs $T\{\cdot\}$.
Comment: @DavidRoberts Yes I think you're right you could add this step. I guess I had in mind that Re < 1 takes care of the critical strip
Comment: @tst no, its not claimed that T is holomorphic or smooth or anything
Comment: @tst $$T((1+z)^2)=T(1+2z) \Rightarrow \deg(T((1+z)^2))=\deg T(1+2z) \Rightarrow 2 \deg(T)= \deg(T) \Rightarrow T \mbox{ is constant}$$
Comment: When he said T  is  real, he  had T(s*)=(T(s))* which is  more general but does mean that real values get mapped to real values.
Comment: @reuns I don't know but Atiyah clearly says it is from C to C in his paper, so it's unnecessary to give him the benefit of the doubt.
Comment: Why not then look at compact convex sets that intersect $\{Re(z)\lt 1\}$ and exhaust the right half of the plane?
Comment: @DavidRoberts well, that's a tricky bit. This function T may not even be a function at all if we just look at weak limits. If we want to make it a function I cannot see how we can avoid having it constant.
Comment: @T_M good point. I might add this to the answer.
Comment: @T_M, my previous comment was supposed to be to you, but I got the username wrong :/ Anyway, my point is that the weak limit does not necessarily give you a function (assuming it makes sense at all). Now if we assume it is a function, then we already assume more regularity than what the definition implies. But if we don't then I don't understand what is the meaning of $T(1+g(z))$.
Comment: @N.S. Yes, this basically means that on any neighborhood of any number in the complex plane the function $T$ is the same polynomial. And then it gets worse. Using (5) we have $T((1+z)^2)=T(1+2z)$. Then we need a disk in which the first derivative of $T$ does not vanish. This implies that we can construct a local inverse. This can be done easily since $T$ is a polynomial everywhere. The by using the inverse we get $z^2=0$ for every $z$ in the disk. :/
Comment: @T_M But he also states in the following remark of 2.6 that this formula is just a linear approximation of the power series expansion of $T$ near the origin? So maybe this argument cannot be used for the original $T$?
Comment: @reuns There are field and ring properties strangely mixed in the definition of $T$ and its use for the alleged proof that invalidate it.


total number of ways

Question: At a cafeteria, there are $10$ seats in a row, and $10$ people are lined up to walk into the cafeteria. The first person can sit anywhere, but any future person will only sit in a seat next to someone who is already sitting down. If the first person sits in the $5$th seat, how many total ways are there for the rest of the people to sit down?
Comment: Well, you know the order in which seats 1-4 will be filled, and likewise with 6-10, so how many ways are there to intersperse the two?  Put another way, each person sitting down just needs to decide whether to sit to the right of the first person, or the left, assuming there's room.  After that, their seat is determined.  Four people can choose "left", and the other five will choose "right", so with nine people, how many ways can we choose four to go left?
Answer: Since we have a restriction that the next person will only sit in a seat next to someone who is already sitting down and there's only one person seated initially then at any moment the persons already seated will be seated in a contiguous sequence of chairs.
Given this, we can think about the state at a given point to be defined by the chair closest to the left that have a person seated, L, and the chair closest to the right that also have a person seated, R, forming a pair (L,R).
We start with the state (5,5). From here we have two restrictions: L must be positive and R must be at most 10. So, if we see how the people seat sequentially and set a '0' if a person seats at the left and set a '1' if a person seats at the right, the resulting binary string must have size 9 and be composed with exactly 4 zeroes and 5 ones.
The number of such binary strings is:
(9C4)=126.
Answer: WRONG APPROACH:
There are always only two possible seats for each except last after first person. So for 9 (first being already seated at 5th seat) persons $2^8$. There will be only one seat left for the last one, so no choice for him.
EDIT:
It can be solved using following formula
$$
P(m, n)=
\begin{cases}
    1 + P(m - 1, n) + P(m, n - 1)& \text{if } m \neq 0\ \text{and}\ n \neq 0\\
    1              & \text{if } m = 0\ \text{or}\ n = 0\\
    0              & \text{if } m = n = 0\\
\end{cases}
$$
where $m \text{ and } n\ are$ seats remaining to left and right after first person seated. Answer for m = 5, n = 4 is 251.
How to solve two variable recurrence relation: Solving recurrence relation in 2 variables
Comment: I don't see this.  If the next four people sit in seats $4, 3, 2, 1$, then succeeding people only have one place to sit.  Gabriel Burns's comment to the OP gives the proper approach.
Comment: @BrianTung Ya. I missed that.

total number of ways


Does Equinox counter Desolation Angel if it's kicked?

Question: Can the ability granted by Equinox counter Desolation Angel if the angel is kicked. Or is it considered to be indirectly destroying lands as it requires it to enter the battlefield first?
Answer: No, Equinox cannot counter Desolation Angel. Equinox says

Enchanted land has "{T}: Counter target spell if it would destroy a land you control."

When a creature spell resolves, its only effect is to put the creature onto the battlefield. In the case of Desolation Angel, after it enters the battlefield its ability triggers. That ability is what would actually destroy the lands, and it is a separate game object from the Desolation Angel creature spell—and is in fact not a spell at all (it's an ability) so Equinox can't counter it. So, if you activate the ability granted by Equinox targeting a Desolation Angel spell, it will do nothing because the spell itself won't destroy any lands.
Comment: "When a creature spell resolves, its only effect is to put the creature onto the battlefield." Some creatures have replacement effects affecting _how_ they enter the battlefield (usually with counters, or as a copy of something, but there are others). Would that be included in the effect of the creature spell?
Comment: @Arthur Pretty sure not; spells and abilities are 2 separate things; a static ability that creates a replacement effect is still an ability; separate from the spell.


Using regular unleaded gasoline in a Lexus RX330

Question: Is it OK to use Regular Unleaded Gasoline in a 2005 Lexus RX330?
In the past I have used Super but am now using Regular. So far no problems.
Answer: Lexus recommends a 91 Research Octane Number (RON).
Here is additional information related to octane ratings and standards worldwide.
Gasoline has chemical components that have anti-knock components.  Anti-knock components elude to chemicals within the gasoline that prevent the fuel from pre-igniting under compression before the spark fires.  If your vehicle starts to pre-ignite it will sound like there are marbles bouncing around in your engine or a loud rattling.  The sound is generated by combustion occurring too early in the combustion process as the piston is rising on it's compression stroke.  Due to compression and lower octane the fuel charge initiates combustion early and the expanding gas is working against the piston upstroke.  The sound of rattling is the piston slapping in the cylinder.
If this begins to occur you would want to switch up to a higher octane rating.  Increased temperatures with Summer could increase the chances of knocking with the lower octane rating.
Answer: Agreeing with @DucatiKiller here for the most part. There are a couple of things of note though ...
The reason your engine seems to be running fine is because the computer will detect the "pinging" before you ever will through the use of a knock sensor. When the ECU detects pinging, it will start pulling timing (retarding your timing) until it stops pinging or it gets to a preset limit. This allows the engine to run without any damage to the engine. What happens when this occurs, though, is by pulling the timing, it is also detuning your car. It is making it so it isn't running as efficiently or as strongly as it was designed to do.
You will notice a drop in performance and a drop in fuel economy by using the lesser octane. As long as the ECU can keep pulling timing when encountering the pinging, you'll not have any detrimental effects to the car mechanically. Once it reaches the pinging level where it's not allowed to pull anymore timing, you'll start seeing the mechanical effects, which could be anything from something minor to complete engine destruction (and I'm not be melodramatic when I say that). You can easily push past this point by rapid acceleration (stomping on the gas pedal or going to Wide Open Throttle) or even during climbing a steep incline.
What it comes down to is this: Use the lower octane fuel at your own risk. Know you are risking the long term health of your vehicle by using it. Also realize you will not have the performance or fuel economy you are used to with the Super.
Answer: According to https://lexus2.custhelp.com/app/answers/detail/a_id/8129/~/which-fuel-grade-should-i-use-for-my-lexus-vehicle%3F
2004-2005 RX 330 has a "Recommended Minimum Octane Rating" of 87
2006 RX 330 has a "Recommended Minimum Octane Rating" of 91
I am looking for the answer too and this is what I found today, having lost the original user manual.
Answer: It will run fine , the knock sensor and computer will retard spark as necessary. You will lose peak performance. I have a 2011 Murano 3.5 L , I used regular in it for 80,000 + miles, never a problem. With the pandemic situation , I am driving less  and using little fuel, so I went to premium. I have been impressed by the power improvement. No difference going down the freeway at 75, but it gets to 75 very fast.


Pillager raids always end after the third wave

Question: I've been killing pillager captains and then going to villages for the raid to start, but the raids always end after the 3rd wave and I have no way to get totems of undying, what can I do to fix this?
(Minecraft bedrock windows 10)
Answer: The difficulty of your game influences how many waves a pillager raid would have. As quoted from the MineCraft Wiki;
"The number of waves depends on difficulty: There are 3 waves in Easy difficulty, 5 in Normal, and 7 in Hard."
This means to increase the amount of waves you have in a raid, you'll need to play in a higher difficulty until the raid is finished, then you could set your game difficultly back to what it was previously if you want, until the next time you want to start another pillager raid.


Minecraft SMP randomly teleporting to a set location

Question: I run a minecraft bukkit server, 1.7.10-r3 with a handful of plugins. There is a specific location that players get teleported to at random times, sometimes it's only once in a few hours, sometimes several times per minute. There is nothing in the server console, I dug a hole down to bedrock under this location so that when players get teleported there they die, allowing me to see when it happens exactly. There is absolutely no pattern whatsoever as to when this happens and it's extremely annoying. Any ideas?
Comment: What are the coordinates of the specific location? What plugins are you using? Do you have command blocks turned on? You could try turning the plugins off one a time (or do a binary-search type thing) to narrow it down and find which one is causing the issue (or if it's vanilla).
Answer: Just in case anyone else has this problem, I had a command block set to silently teleport people to that location. I dug out around where it was and confirmed there was no way it could be activated. People continued to get teleported anyways, but breaking the command block fixed the problem.
I never figured out what was setting it off.


The color of resorcinol-formaldehyde resin

Question: At school, I did an experiment of synthesizing resorcinol-formaldehyde resin. When I added $\ce{NaOH}$ and gave some heat, the color of resorcinol-formaldehyde resin inside the test tube became reddish-brown. Can anyone tell me why?
Comment: What do you think happen if you do the same with the green tea infusion or generally phenolic compounds? And why?
Comment: Because you have made a polymer.
Comment: @Poutnik What has the green tea to do in this problem ?
Comment: @Maurice Phenolic OH groups and tendency of their conjugate bases in alkalic solutions to 1/ get intensified red/brown colour due electron delocalization 2/ to get oxidized, condensed and further deepening of colour.
Comment: @Poutnik. So the red color is due to the oxidation of resorcin, and it has nothing to do with the polymerization with methanal. Does this happen only when there is an excess of resorcin in the mixture ?
Answer: The polymerization of resorcinol creates multiple (spaghetti-like) chains containing the aromatic rings of resorcinol.  This is a simultaneous growth in multiple directions. Eventually, the chains trap each other in the solid state. In the analogy used, it is like stirring a pot of spaghetti and then freezing the content.
It may happen that an arene ring is just in proximity of an arene ring of an other chain.  Given a growing polymer chain may be flexible, it may happen that there are intramolecular "close couples", too.  If these arenes are close enough to each other, their $\pi$-electron systems may interact with each other as if they were coupled as one.  This extension of the $\pi$-electron system may move the observable absorption band toward longer wavelengths. Then,

If there are just enough of these "close encounters" per unit of volume with the same arene-arene distance, the perception of color may be intensified (e.g., pale yellow -> bright yellow).

With variation of the arene-arene distance, the intermolecular interaction of these $\pi$-electron systems equally varies. This may yield the absorption of light of different wavelengths / the subtraction of different colors from the white light by these arenes.  Thus it may happen that the color of the polymer is not uniform. If the range of light absorption is wide enough, the polymer may appear just black.


How to connect two sections of a mesh (sawed off shotgun)

Question: I was wondering how I could connect the grip of my shotgun to the body like image one instead of the way i have it where it is just laying on the object.(check picture two)
Comment: I guess your question is too vague and too broad, what have you tried and why don't you succeed, what is the specific problem you've encountered?
Answer: To join 2 separated meshes press ⎈ Ctrl + J in Object Mode. If you want to split them press instead ⎈ Ctrl + P.
Comment: Thanks for the comment but what I need to know how to do is how to connect the grip seamlessly to the body like in the first image of the finished shotgun.
Answer: If you want the grip to be seamless, I think that you've got a couple of options:
1) In Edit mode, select the "back" faces of the front of the gun (where it needs to turn into grip) and extrude the grip directly from it to replace the stock that you've already made (or at least the central round core).  As you extrude the new stock out, you can start transitioning the shape to be more rounded. This is probably the cleaner approach but is more work.
2) You can use a Boolean Union modifier to join the current stock to the front half of the gun (make sure that the two meshes have some overlap for this to work correctly).  Then, you can go into Sculpt Mode, enable Dyntopo, and use the Smooth tool to ease the transition from barrel section to stock section.  If you want a more verbose description of this process, let me know and I'll type it up.


Is power series expansion not allowed for Gauss' Convergence Test?

Question: Given the following Legendre series, I wanted to test its convergence at $x^2=1$ when $l$ is not an integer
\begin{align}
S =
\sum_{j=0}^{\infty}
u_j
&&
u_{j+2}
=
\dfrac{(j+1)(j+2)-l(l+1)}{(j+2)(j+3)}
x^2
u_{j}
\end{align}
I tried using Gauss' test for the following Legendre Series
\begin{align}
\lim\limits_{j \rightarrow \infty}
\left|
\dfrac{u_{j}}{u_{j+2}}
\right|_{x^2 = 1}
=
\lim\limits_{j \rightarrow \infty}
\dfrac{(j+2)(j+3)}{ (j+1)(j+2)-l(l+1)}
=
\\
\lim\limits_{j \rightarrow \infty}
\dfrac{ j^2 + 5j+6 }{ j^2+3j+2-l(l+1)  }
=
\lim\limits_{j \rightarrow \infty}
\dfrac{ [j^2+3j+2-l(l+1)] +[2j+4+l(l+1)] }{ j^2+3j+2-l(l+1)  }
\\=
\lim\limits_{j \rightarrow \infty}
1+
\dfrac{ 2j+4+l(l+1) }{ j^2+3j+2-l(l+1)  }
=
1
+
\dfrac{2}{j}
+
\mathcal{O}(j^{-2})
=
1
+
\dfrac{h}{j}
+
\mathcal{O}(j^{-2})
\end{align}
I identify the value of Gauss' coefficient $h$ from the power series expansion of the of the ratio of the two adjacent series coefficients as illustrated above. I keep getting a factor of 2 for Gauss' coefficient $h$ which states that the series convergence, however my friends tell me that the series diverges. Is it possible that power series expansion cannot be used to evaluate Gauss' coefficient?
Comment: Where is the series?
Comment: @Did I provided more information on the series. Let me know if more information is required. I am so puzzled by this.
Answer: Your mistake is to apply a recipe valid when the ratios $$\left|\frac{u_j}{u_{j+1}}\right|$$ are considered, to a setting where you estimate the ratios $$\left|\frac{u_j}{u_{j+2}}\right|.$$ Renaming $u_{2k}=v_k$, your computations yield $$\left|\frac{v_k}{v_{k+1}}\right|=1+\frac2{2k}+O\left(\frac1{k^2}\right)=1+\frac{\color{red}{1}}{k}+O\left(\frac1{k^2}\right),$$ that is, the case $c=\color{red}{1}$ of the recipe you are trying to apply. (Hence you need to get one more term in the expansion to be able to conclude but at least now, the prediction of your friends is a possible outcome.)


Bitcoin transfeered to wrong address

Question: I'm new to copay.  I just transferred money to a bitcoin address but for some reason, Copay transferred it to my own account.  I had to pay a miners fee for this which cost a lot of money.  How can I contest this?  I put in the correct address but it did not go there.
Comment: Are you sure that you are not confusing this with change? If the inputs to the transaction were greater than what you wanted to pay, some of that will be paid back to your own wallet as change.
Answer: Its on Copays end so open a support ticket with them and see if they will refund you the miners fee and the fee for the bitcoin to go to the correct address. Purely an issue on their end and nothing you can really do on the Bitcoin network.

Bitcoin transfeered to wrong address


How to access gRPC service from WPF running .NET 4.7.2?

Question: I have created a gRPC service in .NET Core which needs to be used from a legacy WPF application running on .NET 4.7.2. The existing WPF application is huge and can't be converted immediately to .NET Core and the effort isn't worth it just to use gRPC. My question is, is there a way to use the gRPC service from .NET 4.7.2 WPF?
Comment: I am using gRPC Core. It works fine. Cannot access the services from WPF using .NET 4.7.2.
Comment: Are you using Grpc.Core or grpc-dotnet? Only the former is compatible with the .NET Framework.
Comment: Are you just wanting to communicate, as a client, to an existing gRPC service from a .NET Desktop WPF app?  I do that, but all my gRPC services are not .NET core yet.  Is that the issue?
Comment: That's correct Rob. That's precisely what I want to do. How can you access the gRPC services from WPF? I can't add the proto files to WPF due to their differences in the .NET. Is there a way to consume the services from WPF?
Answer: I finally got a working solution for this problem with:

Asp .NET Core 3.1 Server (using the new grpc-dotnet package) and
.NET Framework 4.7.2 WPF-Client (using old C wrapper grpc package)

The main problem was to find a solution to accept a self-signed SSL server certificate from a remote client, which is a mandatory for our scenario.
The server gets a generated certificate using a solution like provided here (solution also works with any valid certificate):
https://gist.github.com/mivano/356d4f0354d997370e3c2e62809cdeef

adjusted Subject/FriendlyName to something more meaningful
adjusted DnsName to the IP or Hostname of the server (which is used by the clients)
adjusted NotAfter to desired end date
adjusted $pfxPassword

Important thing to mention here: the DNS or IP of the server is verified by the client so it has to be part of the certificate.
gRPC Server was configured this way (could also be achieved through .appsettings.json):
 webBuilder.ConfigureKestrel(
    options =>
    {
        options.Listen(
            IPAddress.Any,
            <your port>,
            listenOptions =>
            {
                listenOptions.UseHttps("<your.pfx path>", "<your passphrase>");
                listenOptions.Protocols = HttpProtocols.Http2;
            });
    });

gRPC Client:

Create a .pem File from your .pfx (using openssl):

openssl pkcs12 -in "<pfx path>.pfx" -out "<pem path>.pem" -clcerts
How do you create a gRPC client in .NET Framework?

read the .pem File in your client and use it for the gRPC channel:

Channel:
var channelCredentials = new SslCredentials(
    File.ReadAllText("<path to pem>.pem"), null, verifyPeerCallback => true);
var serviceChannel = new Channel("<DnsName from cert", <port>, channelCredentials);
var serviceProxy = new GrpcService.GrpcServiceClient(serviceChannel );

The client can also be implemented to dynamically download the certificate from the server using a regualar HttpClient.Get with a proper HttpClientHandler and attached ServerCertifacteCustomValidationCallback. The pem has to be created in memory before the service channel creation:
https://github.com/grpc/grpc/issues/8978#issuecomment-283469676
Comment: Got this working in .net fw by adding the CA.pem to the SslCredentials like shown here. Thanks JanW!
Answer: As mm8 stated, Grpc.Core is the predecessor to the grpc that is baked into .Net Core grpc-donet.  In general they are very similar.
I just went thru this process of converting a medium sized WPF Framework app to net core with grpc replacing out WCF.  It has been a learning curve but the issues were not in the WPF area as much as trying to produce a standard way of passing data the way I wanted.
If there is interest I can produce a small book on my solution.
Comment: Thank you Jeff for your comment. The app in concern took 10 years to develop by a team of 10+ developers so you can imagine that it would be impractical to convert it to .NET Core right now. However, I am more interested to know if I can consume the service exposed by gRPC from .NET 4.7.2? Is there a workaround? The gRPC documentation has been shy of mentioning anything that marries .NET Core and .NET Framework.
Comment: Can you make a .NET core service that consumes gRPC and then your .NET Framework service consumes this .NET core service?


Would a recording of a complete GSM session provide a proof of authenticity?

Question: Hypothetical question: suppose I had a OsmocomBB phone modified to record all transmission done over GSM including encryption keys used during the communication. If I made a call and recorded all data transferred since the phone was turned on, would it be enough to prove that the phone call from one phone number to another took place? I'm interested in proving that without engaging the operator in this process.
Comment: how would a third party that is not the cell operator verify the recorded data is genuine?
Answer: If you mean "prove" in the sense of ensuring that the call is authentic and cannot be reputiadated by the other party then the answer is no.
Cellphone encryption is used only for the over-the-air portion of the call - between the mobile telephone and the base station. A GSM telephone has to authenticate to the base station but there is no guarantee the base station is genuine.


How to re unwrap uv islands with same rotation and scale

Question: I need some help, I'm working on a commercial project and need to resize elements by a few inches. After changing the size of the models, it is necessary to correct the UV as seamless textures are used and the rotation of the islands should remain as it is, but the blender have only unwrap that ruin texel density and rotation of islands. It is necessary to correct more than 200 models and each time manually rotate and changing texel density of the islands far too long. I know that in Maya there is an unfold operation, it re unwrap selected islands but leaves the texel and rotation the same, is there any addon for blender that would add such functionality, or maybe there are some other tips? Or just switch to maya for that specific task?
Answer: I've had the same problem as you and found a solution for it, hope it works for you:

Select the UV islands' bounds. I used an addon called "textools" for it.

Open UV > Pin in the menu OR press P to pin the vertices so it's kept on place.

Then unwrap it.

There might be some issues for some islands you can simply undo and hide the islands that had issues and re-unwrap again.
Comment: Thanks for answering, i try this addon with pinned islands but they anyway rotates in different angles, not all of them but too many for hand correcting. Total UV island count is about 120 an correcting half of them by hand - is hell. I aready finish this project using maya3d like an external uv editor and there was no issue at all when i re-unwrapping UV there. Maybe somedays maya like uv editor come to blender but now i will be using maya for that type of work.


Office 2010 Starter removes all icon pictures on desktop and taskbar temporarily

Question: This may seem like an unconstructive question, but this has been very irksome. I have office 2010 starter and every time I launch it all my icons in my taskbar and on desktop take on the appearance of a blank page (as if the icons were missing). This usually lasts about 2 seconds, but it takes some time for the icons to come back one by one. I also realized this happens the first time I launch it (upon reboot). What could be the reason? Is this a bug? because it is getting progressively worse.
Answer: This is a speed issue - the Office takes over all of the available resources during start and as it eases the requirements, the system slowly goes back to a "stable" state.
You didn't say which windows version or HW you are using but in general you can use the task manager -> resource monitor to see which process uses most resources. There might be a plugin or some other background process that coflicts with the office.
Start the resource monitor, launch the office and look for any culprits


Colloquial forms (let's...) in articles

Question: I am writing an article for a peer reviewed journal in the field of literature, and I am wondering about the use of colloquial expressions like: "Let's take a step back", or "Let's look at the data", "Let's look at the coxtext" etc.
Would you suggest avoid these forms? Could you maybe suggest me a subsitute formula to express the same idea?
Comment: Would "Let us take a step back ...", or "Taking a step back ..." work?
Answer: In general I don't think it's a big issue but alternatives may look better, here are a few suggestions:

"Let's take a step back" -> "from a broader perspective"; "in a larger context"
"Let's look at the data" -> you don't need this at all, you can just start talking about the data: "the data shows that...", "in the data we observe that..."
"Let's look at the context" -> you don't need it here either: "the context consists of...", "to put this analysis in context, ...."
Answer: It is probably a mistake in extremely formal writing, but many people write as if the paper is a conversation between the author and the readier. If the material is appropriate for that view, then the form is quite appropriate.
How formal the writing should be depends somewhat on where you do it and even more on the audience.
One way to know whether it is appropriate in your own circumstance is to look at how other recent papers in your field are written. It is probably safe to emulate them.
I'll also note that historically we seem to be moving from a more to a less formal presentation style in general, but the rate isn't uniform across fields. We are, in fact, normally writing for our colleagues, so it is fairly normal to consider our writing as a conversation. This is especially true if, in writing, you are mentally focused on the reader him/herself, rather than the material itself. Which view is more or less natural depending on the field.
Comment: After posting my answer I noted that it applies to your answer as well: Does the last paragraph starts with "I will" or "I shall"?
Comment: @Dirk, I honestly didn't consider it. The colloquial meaning is close enough. But "shall" is becoming a bit archaic, I think. See https://everything2.com/title/will+vs.+shall
Comment: Never mind - and thanks for the link! I didn't know that the matter with shall and will is so intricate.
Answer: I think this is frowned upon in academic writing. Personally, I am happy with abbreviated form like "let's" or "didn't", but since English is not my native language, I always need some time to extract the meaning of something like "that'd" (is it "that would" or "that had" or maybe something else?).
So I would suggest to just the full unabbreviated form: Just write "let us", "did not", "that would",...
It has exactly the same meaning, always sounds as good or better to non-native speakers (which are likely to be the majority of your readers), and is faster to parse for them.
Answer: I would avoid contractions and a too chatty manner.  This doesn't mean you have to be stilted either.  You can still use short sentences and short paragraphs and gutty Anglo-Saxon words.  This will be enough to make your articles enjoyable to read--more so than the norm--while still passing the pompous preening set.

Colloquial forms (let's...) in articles


Angular NgRoute and leaflet declaration directive

Question: I'm pretty new to Angular, and I'm trying to make a little app for learning.
I use the leaflet directive and want to add the NgRoute directive too but I have some errors in the console.
Here is my code :
var app = angular.module('demoapp', ['leaflet-directive'], ['ngRoute']);
app.controller("toulouseController", [ '$scope', '$http', function($scope, $http) {
  angular.extend($scope, {
    osloCenter: {},
    markers: {},
    defaults: {
      scrollWheelZoom: false
    }
  });

I don't know if I can't declare two directive at the same time...
Thanks for your help!
Answer: Try this: var app = angular.module('demoapp', ['leaflet-directive', 'ngRoute']);
That should work.
Answer: As per AngularJS documentation, the syntax of angular.module is
angular.module(name, [requires], [configFn]);

So you should use
angular.module('demoapp', ['leaflet-directive','ngRoute']);
                                 /\
                                 ||
                                 ||
                                 ||
                   All dependencies should be specified in single array.


Breathe, breathe in the air

Question: This is part 47 of the puzzle series Around the World in Many Days. Each part is solvable on its own.

Dear Puzzling,
This time I have a jigsaw puzzle for you. You need to first solve a crossword, and after that fill all white cells with the given pieces. Pieces must be inserted as is (no rotating or mirroring), and letters on pieces must match the filled crossword grid.
Today I have breathed in the smoky air on the slopes of a very active volcano. Can you guess where I am?
Love, Gladys.

Solve on Penpa+
Across
1. Speak
3. To me (2,2,7)
9. Breathe (in the air)
10. On the run (2,5)
12. Time
14. The great (4,2,4)
19. Gig
22. In the sky
24. Money
25. Us and them
29. Any
31. Colour
33. You
36. Like
38. Brain damage
39. Eclipse
Down
1. Small, insignificant
2. British prog group
3. Egyptian deity or Levantine self-proclaimed Caliphate (abbr.)
4. The Simpsons bartender
5. Pythia, for one
6. Unwell
7. What comes after E in the Queen's monogram (2,1)
8. Originally known as
11. Precious stone
13. Flee
15. Broadcasts (a show)
16. Instrument used in bloodletting
17. First adjective used to describe Frankenstein's monster
18. Slippery swimmer
20. Warren Buffett, the "Oracle of –"
21. Lists as a source
23. Beheaded queen
24. Sequel game to The Frozen Throne (abbr.)
26. Interconnected smart devices (abbr.)
27. More strained
28. Nonsense word from The Shining (or is it?)
30. Game of Thrones network (abbr.)
32. Novel by Jane Austen
33. What's not visible on the dark side of the Moon
34. Musician Reed
35. Part of the self
36. Old French coin
37. Young man

Gladys will return in Wreck Exploration.
Comment: Loving the Pink Floyd clues!
Comment: @0x5453 Hehe, glad to hear it!
Answer: Gladys is

 on Mount Yasur, on Tanna Island, Vanuatu.

Completed grid with puzzle pieces:

Breathe, breathe in the air


How many times can we recycle one sheet of paper?

Question: Its really interesting to see the process of recycling of paper (as shown in picture below) but at the same time I was thinking like for how many times can one sheet of paper can be recycled ?
Comment: Technically, once, since the paper gets shredded and redistributed among many pieces of paper. But more than 90% of the paper can complete each cycle.
Comment: Why do you think there is a limit to the number of times a sheet can be recycled?
Comment: I doubt that there will be difference in quality which might make that paper quite not useful. I am not sure of that.
Answer: Well apart from the fact that the answer depends on the type of the paper that is used. Secondly how much is wasted and also the process used. Below is an article that might be helpful in answering the question

Some industry sources estimate that an ordinary sheet of paper made from cellulose fibers derived from wood can survive only four to six trips through the recycling process. The Environmental Protection Agency puts the figure at five to seven times.
It is not surprising that the rigors of remanufacturing take a toll on the fibers.
Ideally, paper for recycling is separated into types, because paper with long fibers, like white office paper, offers the most flexibility for recycling, while newsprint, with its shorter fibers, is usually reserved for making more newsprint and other low-quality papers.
The paper is shredded and chopped, then subjected to a mixture of chemicals and water and heated as it is repulped. It is centrifuged and screened to remove impurities; de-inked with more chemicals; then sprayed onto a wire screen, drained, dried and squeezed through heated rollers.
With each step, the fibers become shorter, coarser and stiffer, so that eventually, recycled fiber needs to be mixed with virgin fiber to make paper of the desired quality.
According to the American Forest and Paper Association, 63.4 percent of the paper consumed in the United States was recovered for recycling in 2009. C. CLAIBORNE RAY

SOURCES: New York Times - http://www.nytimes.com/2010/12/21/science/21qna.html?_r=0
Comment: The fibre length keeps decreasing and the ink load keeps increasing. When no longer suitable for paper the pulp moves to the cardboard recycling stream and eventually leaves through some non-recycled avenue (landfill or burning).
Comment: "Energetic recycling" sounds a lot nicer. ;) Even for toilet paper, after the wastewater treatment plant.


Anyone can explain why light passes through the object?

Question: Sorry, my English skill bad.
I'm new to Blender. I have a steel barrel but in Eevee Render it look like shadow error, light pass through steel barrel. I don't want that. . Anyone can explain for me why? And how to fix this problem or I missing something in model progress. Thanks !
Comment: Sorry, I just saw you said this happens in Unity as well?  Try selecting the whole mesh (in edit mode), and select `mesh > clean up > merge by distance`. Also try `mesh > normals > recalculate outside`.
Answer: Select your light, and under Properties, check the box that says "Contact Shadows".

As you can see, however, a small amount of light still bleeds through. If this happens, it can usually be eliminated by giving your object more thickness. In the example below, I used a solidify modifier to make it thicker.

It seems like the only problem areas in your object are concerning the "bands". Make sure they have both inside and outside faces, and that they are correctly aligned with the rest of the mesh.
Lastly, though I cannot tell from your photo, it looks like your object may be mirrored on the Z axis. If this is the case, make sure the two halves merged correctly, and if you're using a modifier to achieve this make sure "Clipping" and "Merge" are enabled.
Comment: Yeah, make it thicker maybe good enough.I put it into Unity and get same problem lighting, i'll try your solution. Thankyou so much
Answer: Eevee handles light very badly because it fakes it , on the other hand , cycles is a pro at lighting , you should really use cycles , if you want accurate lighting
Comment: Sure, in Cycles it normal. But I put it into Unity and this get same problem
Comment: Sorry but i dont have much knowledge about Unity , maybe this could be a problem with the game engine itself
Comment: Thankyou, it look like my object too thin, so blender and unity get same problem.


Some Basic PHP Questions

Question: I just had some basic php questions to further my understanding as I learn, that I could not find easy answers to

I have a php ajax application that generates a table of mysql rows. I would like to know if there is a way to get php to generate neat html, as it seems neat enough as I echo it out, but when "viewing source" the html is a huge jumbled block with no line breaks or anything. Is there a trick to doing this?
What is the best way to limit table output for a mysql database, so only the first 10 records or so are displayed, and there are automatically generated next and previous links to go between records?
When outputting information with php from a mysql database, what is the best way to handle booleans? What is the easiest way to display the words "yes" or "no" or a tick or a cross? edit: I do not mean should I use words or pictures, but rather how to show either in response to a boolean
Answer: Question 1
You need to separate the PHP code and the HTML output. The easiest thing to do, as a newbie, is  :

Fill a var named $tab with your entries.

Create a file called "my_tab_template.php" including your xHTML code, using very few PHP to unpack $tab and only with the PHP alternative syntax.

   <?php foreach ($tab as $line) : ?>

         <?php foreach ($line as $cell) : ?>
           <?php echo $cell ?>
         <?php endforeach; ?>

    <?PHP endforeach; ?>

Include my_tab_template.php right after you have filled $tab.

Don't worry about optimization and performances, this will certainly not be your website bottleneck as you starting to code and you will make some things far more troublesome ;-)
Then, in your next project, when you will feel fine doing this, try to learn about the MVC pattern (a little search on SO may help). Don't listen to people talking about templating systems, and else. Don't try to start running a 150 cc before passing your driving licence.
Question 2
This is not a PHP question. What you want to do is to limit the output from your database. You can do that using the "LIMIT" SQL keyword.
You can use :

LIMIT 10 : this will limit your query to the 10 first row (= LIMIT 0,10)

LIMIT X, Y : this will limit your query to Y rows, starting from the row X

Remember to sort your query result with "ORDER BY" before using LIMIT to avoid nasty surprises.
And there is no automatic pagination in PHP. There are some PHP libraries that does the dirty job for you, but before you use them, I recommand to hack your own solution first to understand the mechanism. It's just about checking vars and using "LIMIT", really.
Then you may have a look to PEAR where a standard way to do it exists. But don't try too hard to find it, you'd better code it yourself first.
Question 3
If your database store a boolean, therefore it will output "0" for false, anything else (most probably "1") for true. Just test it :
if ($my_bool)
    echo "True";
else
   echo "False";

In PHP, there is a shortcut to say that, but you have no obligation to use it. Anyway, it's good to know it exists. Meet the boolean operator :
echo  $my_bool ? "True"  : "False" ;

Comment: shouldn't that be echo  $my_bool ? "True" : "False" ;
Comment: Oh yeah ! Python coder habit :-) (ternary ends up like this : "True" if my_bool else "False") I fix that, thanks.
Answer:
If you want to see your HTML output in a nice format, I'd recommend using Firebug. It puts all your HTML into a collapsible tree format and even lets you merely click on an item to show you where it is in the source.
There's no nice and easy way to generate the pagination (showing only 10 results, and then giving you back/next page buttons) of a search result natively. I'm sure that some frameworks would help you out in that regard, but the simplest method is to use the LIMIT keyword in your SQL. eg: you want to see page 3? SELECT * FROM mytable LIMIT 20,10
The easiest way to display booleans is like this: var_dump($myBool) which will display bool(true).
Alternatively you could do: echo $myBool ? "True" : "False"; - replace "True" and "False" with whatever you feel is easiest to read.
If screen real-estate is a concern, an accepted way to display a bool is with 1 or 0.
echo $myBool ? 1 : 0;, or even shorter still: echo (int)$myBool;
Answer: replace var $amir with your variable

    <?php foreach ($amir as $yasir) : ?>

        <?php foreach ($yasir as $shah) : ?>

                <?php echo $shah?>

        <?php endforeach; ?>

    <?PHP endforeach; ?>

Answer:
You could use the PHP Tidy Addon. Keep in mind, that filtering the HTML with it uses quite some Server CPU. Alternatively you have to print the line breaks yourself (echo "\n";)
However I suggest, that you leave it as it is. Just consider how many people will benefit from reading the source code vs. how many people will benefit from smaller file sizes if you don't format the HTML nicely.
You have to do that manually. There are some helping libraries available on the net. Just Google it.
That's up to you to decide and depends on the application. Keep your users needs in mind.
Answer:
There exists a very nice PHP HTML templating engine called Smarty.
select * from table limit 10, 10; will show results between 10 and 20
that's really your decision from a UI point of view, personally I would use True or False
Answer: Just touching on the first point since it looks like the other two have been answered well already:
If it already looks OK in the HTML and you're just worried that it's all jumbled when you view source, just add "\n" to the end of each line as you print it.

Some Basic PHP Questions


Can we convert a solochain to a relay chain?

Question: I want to know is it possible to convert solochain to a relaychain so that parachain can connect with the chain but I was not able to see any tutorial, i came across this tutorial which converts a solochian to a parachain which will connect to a relaychain, is there a similar type of document that describes how to convert solochain to a relaychain.
Answer: In the tutorial you posted the term solochain refers actually to a regular node based off the node template, and the guide allows you to "convert" it to an actual parachain by adding Cumulus to the node's codebase, so it can communicate with the relay chain. If you want to run a relay chain, you need to use the Polkadot node. This repo has the details how to run a local two node relay chain, for example. To this relay chain you can connect your parachain, which you can create from your solochain. Hope this provides a bit more clarity. You can read more about Polkadot architecture here.
Answer: You can launch a relay chain testnet from the polkadot repo (as Lana mentioned), and i would recommend launching a Rococo chain. There are substrate docs to launch a local relay chain. That is the most practical way.
If instead of local relay chain you want to create a Live staging relay chain, so that other validators can connect to it, then you would need to change the chain spec to "Live" instead of Local and then add some initial validator keys.
To answer the question:

is it possible to convert a solo chain (substrate node-template) to a
relay chain?

The answer is yes you can, but it is not practical to do so. You will need to add the necessary pallets and perhaps some changes in the node outside of the runtime. There is a learning adventure required in order to really understand what is going on there though.
I started a community run relay chain test net called Pop-Art, which is a Rococo fork. But i havent yet tried to convert a substrate node template to a relay chain, and makes its not practical there are not much docs on that workflow yet.
A great step is to add a validator to an already live relay network, before creating a relay network. Follow this tutorial how to add validators to a relay chain (and here is a similar issue to gain more breadcrumb insights.
Comment: So is it not possible to convert a already working chain which is not substrate-node-template to a parachain?
Comment: i answered your initial question "is it possible to convert a solo to a relay chain", which i hope was a satisfactory answer for your initial question?

To answer your new question "is it possible to convert an already working chain to a parachain?" The answer is yes and no, meaning you wont be able to take the blocks with you to the parachain. The parachain has to start with a new genesis block. But yes there are examples of solo chains becoming parachains by forking the state of their chain and then uploading it to the genesis state of the parachain.


Bike sizing question - are these two sizes actually that different?

Question: Could use some advice on bike sizing. I'm in the market for a new commuter and after a lot of research I ended up picking this one:
https://www.bergamont.com/gb/en/product/bergamont-vitess-n8-belt-gent#geometry
Unfortunately it's online only so couldn't try it and returns cost £35. I'm 6'0" (183cm) with 33" inseam (84cm). I ordered the large (56) frame but when I hopped on, the top bar was too high and couldn't rest comfortably when standing over it without strong pressure down there.
I'm thinking of ordering the smaller one (52) but wanted to check with you if it's not too small (and avoid another £35 return). Comparing the two sizes - there doesn't seem to be much difference apart from the shorter stack/standover! The seat and head tube are slightly shorter (shorter stack) but the reach is the same. Does that mean that the smaller bike will fit just as well or am I missing something?
Here's a comparison of the two frame sizes (you can see the comparison if you click 'Shadow bike'):
https://www.bikegeocalc.com/#9Bergamonta0b4c789.58314d280e624.25905f788.81524g993.29239h427.82039i340j340k1446.65227l926m1194.58314n765.75095o1251.33031p1005.28465q1272.29156r1404.18714s1006.29693t31.8u40v6w7.75408x10y280z40A0B150C25D458.77624E42F172.5G30H30Z6Berg+Ma0b4c791.02661d280e642.17724f752.08989g995.28771h435.49726i340j340k1443.36749l907m1198.02661n765.60378o1248.09764p986.28465q1275.73503r1391.63503s986.28465t31.8u40v6w7.75408x10y280z40A0B150C25D458.62011E42F172.5G30H30Z
Also full geometry is on the bike website: https://www.bergamont.com/gb/en/product/bergamont-vitess-n8-belt-gent#geometry
Thanks!
Comment: I share your apparent skepticism over those measurements.  That geometry link shows that the "52" actually has a longer reach than the "56".  That's a bit strange. I think you probably should contact the seller and/or manufacturer directly.
Answer: You'll get 40mm more stand-over clearance with the 52 over the 56.
As the reach is about the same on both sizes you will not be cramped by the frame, but I suspect the 52 may come with a shorter stem. You may need to buy a longer stem with a little more rise to get the effective (to the handlebar) stack and reach that you need.


File with removed tag showing up in Finder

Question: I recently learned about the tagging system on macOS and tagged the file with name DA1 with a yellow tag. Shortly after that, I removed the yellow tag but the file keeps popping up in my Finder window. What should I do to remove that file from Finder?
Answer: I have not found a stable way in the finder to apply tags. Usually any new method I try works for the first 5 files, and then the problems arise. Even the Get Info window will not reliably work (the tags appear to be fixed, but if you close the Get Info window and open it again, none of the changes have been kept).
However, recently I have been applying tags through an application's Save dialog box. Often this works to add or remove tags when the Finder doesn't. Maybe that will work for this problem file.
Answer: If I'm understanding you correctly, you tagged a file with the "yellow" tag, then later removed the tag. But when you view all files with that tag, that file appears in the view.
I would try restarting the Mac. That may flush the system. I have found adding or removing tags in the Finder to be completely unreliable. The problem has existed for years and in Sierra it's still not fixed. It may be that you thought you deleted the tag on the file, but it isn't actually removed.
Comment: Thanks a lot! Is there any way to remove the tag of a file without any such consequences?


What happens when a flash drive wears out?

Question: Flash memory has a limited number of read/write cycles, after which it fails.  What happens when it fails?  Is it like a hard drive, where a failed write is silently moved to another part of the disk and that sector marked as bad and never used again, without data loss?  Are there a limited number of replacement sectors?  Do operating systems warn the user in some way?
Comment: Related: [This newer post](http://superuser.com/q/175524/109256) had asked on "What actually happens with an USB flash drive when it dies?", which has explanations in terms of memory cell and semiconductor material failures.
Answer: Yes, they do very similar operations when sectors fail: both silently move sectors to unallocated area after failed write verification. Yes, their number is limited on both the memory types.
There is just one, but important, difference: number of writes on hard drives isn't limited, so failure of sectors in hard drive is unexpected and is probably sign of failure in some other it's part: a crashed head or scratched surface or overheated controller etc. Most time you will want to replace the whole driver when bad sectors begin to appear even if controller has remapped them successfully because soon the whole drive will fail.
Failure of sectors on flash drive is expected and (quite) often happens in normal use: a sector has a limited and determined maximal number of writes, avg. 100000 on a recent flash chip (I'm referring to datasheets of common I2C flashes, but the technology is very similar in USB flash drives). After this number for any sector is exceeded it will fail, sooner or later, so it does not refer to overall state of the drive in any way.
Because hard drives weren't supposed to have any bad sectors during normal work, there were not any technology that was able to detect them (and also remap and notify user). Some years ago SMART was created to do this job.
As remapping for flashes is required by the technology, SMART-like technology was used in flash drives initially. No standardized methods of checking it's status exist, and AFAIK there are no vendor-specific utilities too. That's all about cost reducing.
Comment: I've read that the USB external drive interface doesn't provide any way to send SMART errors to the OS; so even if a thumb drive implemented SMART the warnings wouldn't be delivered.  This is doubly disappointing because flash cells don't suddenly stop working, failure comes after a period of progressively slower write times meaning there always should be plenty of warning to send a SMART error vs mechanical drives often failing without warning.
Comment: Yes, there is no way to send SMART commands over any compliant USB mass storage controller. The slowness you mention appear because controller repeatedly tries to write same sector and eventually remaps it.
Comment: None of currently present filesystems can handle a slowly shrinking drive. Also the number of sectors is only checked by OS when drive is inserted and cannot be changed during work if the device is USB mass storage-compliant.
Comment: Why are there a limited number of sectors?  Couldn't the drive just slowly reduce in reported size as sectors disappear to wear?
Comment: `Yes, they do very similar operations when sectors fail: both silently move sectors to unallocated area after failed write verification.`   Is this for SSDs or "thumb drives" too? Is the remapping automatic and transparent? Shouldn't that mean that if there are spare cells available, the write should succeed even if it had a problem? I just copied some files to a brand-new, brand-name SD card and flash-drive and both of them had some files that were slightly corrupted. I re-copied them and they were fine.
Comment: @Synetech Both. Yes. Yes. That sounds like a completely unrelated problem, perhaps with your OS.
Comment: @whitequark, I wish it were, but it's not one OS or one system. I think the quality of flash-drives has simply gone down. I thought Kingston was reliable, but I see that it does not even have the right size (binary units and formatting already considered). Also, they're probably MLC. `:-/`
Answer: I've had quite a few failed flash drives, and there was no warning - the drive simply stopped being readable. They were large drives, and I didn't put much on them, so I assume things were being written to good sectors automatically, if silently.
Moral of the story? Back up everything on your flash drives.
Comment: USB key-style drives? They may have broken due to mechanical damage or similar.

Of course, you should back up everything that you want to keep, regardless of what it's stored on :)
Comment: @pjc50: Could have been. I try to be careful with stuff, but it's not beyond me to be particularly clumsy!
Comment: If you (or anyone) has a lot of trouble with flash drives, especially different ones, then it could be the port. Make sure to try different USB ports/card-readers and check that the pins on the port and device are clean. Also, if you are using a USB extension cable, try connecting directly to a port (I found that a cheap cable I bought on eBay gave me a lot of trouble when I connected flash-drives through it).
Comment: Also note that wear leveling is almost nonexistent on pen drives.
Comment: `Also note that wear leveling is almost nonexistent on pen drives.`   @Calmarius, so what is the results of that? Does it get "bad sectors"? Do they get remapped? Does the whole thing fail? Also, if that is/were true, then it would mean that the parts of the drive where the file-system structures (FAT, MFT, etc.) are stored would get worn out very quickly even from just renaming and moving files around, thus rendering the whole thing useless even if 99% of the drive is perfectly good. I can't imagine that drive manufacturers would be so obtuse.
Comment: @Synetech Most cheap drives indeed don't have wear leveling, and they'll die quickly. The good wear leveling algorithms are greedily patented by the companies, so cheap pen drive manufacturers cannot afford licensing them...
Comment: @Calmarius, how can one find out / is there a way to know? What about memory cards?
Comment: @Calmarius: The cheapest flash chips per unit capacity have large erase blocks; some sort of dynamic sector mapping would be needed to get even vaguely-tolerable performance.  It's would hardly be surprising that cheap drives might use rather crummy wear-leveling algorithms that don't distribute wear very evenly; another possibility would be that a cheap drive that loses power while it's trying to reorganize itself might be unable to recover.
Comment: Moral of the story? Back up *everything*.  All drives fail eventually.


Does panpsychism imply mathematical entities are conscious?

Question: Does panpsychism claim or logically imply that even mathematical entities, like numbers and functions and sets, are conscious entities? Or is it restricted to physical objects?
Comment: No, see [SEP, Panpsychism](https://plato.stanford.edu/entries/panpsychism/#DefiPanp):"*The word "panpsychism" literally means that everything has a mind. However, in contemporary debates it is generally understood as the view that mentality is fundamental and ubiquitous in the natural world.*" "Everything" does not extend to fictions and abstractions.
Comment: It *could* mean that in the case of Tegmark's [mathematical universe hypothesis](https://en.wikipedia.org/wiki/Mathematical_universe_hypothesis) which collapses the difference between the physical and mathematical worlds. I had a long answer [here](https://philosophy.stackexchange.com/a/72799/10780) which discussed the idea of relating logical/mathematical structures to experiences by generalizing the notion of the "psychophysical laws" that some philosophers with panpsychist leanings (David Chalmers especially) have speculated about.
Comment: Man that's a full and complete answer!  And a good one!
Comment: I don't know if there is a standard ontology of panpsychism, but as Conifold says, it generally holds that particles or relations of conscious are present in decreasing degrees in all "physical" entities, down to particle level. Nothing is fully independent of consciousness. Neither are mathematical entities, unless you are a Platonist. So perhaps the wording that equations are "conscious" is not the right way to state it. They too are formed out of and grounded in consciousness.
Comment: Suggested tag and links.
Comment: I think it should be noted that there are many different flavours of pansychism, and each one may have a different take on what kinds of entities can be conscious and why.
Answer: No. In panpsychism, the fundamental stuff of the universe is matter-consciousness. Mathematical entities are immaterial. They are abstractions that can be used by conscious entities. At the fundamental level, I prefer awareness to consciousness.
Answer: I learned and heard of panpsychism from Eastern religions and Leibnitz, who as a universalist was well aware of and very interested in eastern mythology and religions. In Leibnitz later years he developed Monadology as a final summary to depict his panpsychism view using his famous monad, which I suspect is derived from the old indo-european word "Manas", very similar in meaning to English's word "Mine".
In his view, certain higher level monad like animal soul and human rational mind with reasoning/abstracting capabilities can have consciousness. Only monad is real substance in this world and monads exist everywhere, but one person can only have one distinctive soul-monad which is self-conscious. Plants also have monads but they're of bare type without consciousness. A math entity is only a very abstract concept only found to be in human mind level monad, thus the math concept itself has no consciousness, but the containing mind has.
A computer's memory also can have math entities, but computers are material composites which can be infinitely divisible without a unifying consciousness, thus according to him, this computer can not have consciousness. it can manipulate and compute these math entities faster than any human mind, but it simply does not "understand" any meaning of its computation. And I totally agree with him on this question.
Comment: Computers are material composites which can be infinitely divisible  'Splain me please?
Comment: @user4894 Per Mill Argument you can regard a however complex computer as a mill. *If we imagine that there is a machine whose structure makes it think, sense, and have perceptions, we could conceive it enlarged, keeping the same proportions, so that we could enter into it, as one enters into a mill.  Assuming that, when inspecting its interior, we will only find parts that push one another, and we will never find anything to explain a perception.  And so, we should seek perception in the simple substance and not in the composite or in the machine.* (https://iep.utm.edu/lei-mind/#H3)
Comment: How does that answer my question or support your claim that computers are infinitely divisible? Surely you know they're not. Leibniz didn't know modern physics.
Comment: @user4894 thx for ur comment and challenge. Let me use an example to illustrate. Say you don't understand a true proposition (like the proved Poincare Conjecture), you either understand it  (meaning you can logically and mathematically prove it) or don't. Of course you may understand some lemma leading to it, but let's omit those prep steps here for my illustration. So understanding about something is a type of higher level consciousness which is indivisible. While any computer proof assistant deriving it can be infinitely divided at least in terms of time. As for you last proposition no idea.
Comment: You know, I looked at the Mill story and I do not understand your post. You are aware that matter's not infinitely divisible, right? Maybe I should make sure of that. You can't infinitely divide time either, since you can't measure below the Planck time. And computers operate in discrete steps, finitely many of them for any computation. I am surely not understanding what you are saying.
Comment: @user4894 you're reading modern physics *literally* in the first order manner to apply to philosophical questions. First if time/space is really logically proved to be undivisible, then Zeno's paradox should be settled for now which seems not the case. What we call modern physics may be called outdated and false by next generation. Secondly, Leibniz is not against material atomism, the lowest types of monad is like a physical (Planck scale) atom which still may have inside mentally-divisible analytic structure (string theory wants to further explore that). The key of conscious is...
Comment: ... its *spark* revelation of thorough causal understanding which is consistent with logic, math and any true meta knowledge/language, and at this stage you're self aware you understand, not just know something. A Turing test may spot general intelligence/reasoning abilities, but still no way to spot p-zombie or not (hard problem of consciousness). Physicalism only acts as is (no more no less) without truth/falsity awareness. Imagine I'm a bot, when you asked me am I aware Planck time, it doesn't make sense at all. But if I'm a person with a moral soul, then the question makes sense...
Answer: There are many different approaches to pansychism.
In Buddhist Yogacara philosophy, subjectivity is seen as fundamental, with all phenomena occur in the intersubjective space of shareable experiences. That is, no pure objective reality, because no one can experience that, but no pure subjectivity or isolated thinker either because that arises interactively - as illustrated in the metaphor Indra's Net. In this framework, relations between minds would be fundamental, with material experiences like geometry occuring within that, ie within the alaya vijnana, or space of mentalising/narrative possibility.
In physics, symmetries and conservation laws have been shown to be equivalent. If the set of fundamental constants has been determined by the Strong Anthropic Principle, then the symmetries and arising of minds are intimately related, and perhaps equivalent in our patch of all possible universes. That is not all mathematics being a kind of entity, but maybe E8.
Comment: Can I summarize that as saying it is the experiencing of phenomena (which is one thing) is all. Hence experiencing math (thinking about it etc) is what would exist?
Comment: @AlBrown: Er, no..? Buddhist thought is non-dualist, so you could say there's a fundamental unit of kind or substance. But also has anatta and sunyata, no permanence to self-natures or thingnesses, and emptiness of any non-dependent origination. So 'one thing' is problematic, it essentialises, & doesn't recognise the fundamental fluidity of things, even laws of physics. I'd relate E8 in Lisi's proposal, to a 'superspace' of all different arrangements of fields. It's not all of math, just a specific hyper dimensional & quite large structure, that we could relate to the anthropic principle.
Comment: The Buddha's suttas are not nondual. There is the conditioned, ie phenomenal world of the five skandas. And there is the unmanifest, uncreated, unborn. There is reincarnation. Anatta means not self. Means anything that can be prrceived or conceived is not self. A method. Does not mean "there is no sef, realize this fact" https://youtu.be/FEnb2cFWKBs
Answer: It generally does not. According to panpsychism consciousness is intrinsic to matter, it is in rocks or rivers. The more advanced forms of the human-level of consciousness arise due to complex combinations of particles and their specific properties intrinsic to matter (i.e. spin, charge, mass).
However:

mathematical entities, like numbers and functions and sets, are
conscious entities

Can be metaphysically speculated under idealist panpsychism where ideas are themselves, conscious agents. I do not recall a variant of panpsychism that asserts just that, however, I find Donald Hoffman's conscious agent theory close.
Namely, Don Hoffman proposes that all experience in so-called reality is constructed by qualias which are themselves, agents. Those agents (i.e. the qualia of red apple) degrade from complex agencies down to simple binary agents at Planck scales. Agents are networked through Markov's kernels and operate via state transitions.
Answer: Mathematical ideas are not conscious. However there is a craving to hold on to numbers and mathematics in general. Craving gives rise to grasping. Grasping gives rise to becoming(a Mathematician). Becoming gives rise to birth of ,numbers , mathematical equations , concepts and understanding. However given the birth , the mathematician and mathematical ideas are subject to ageing and death.
Therefore ideas of maths take birth ,and, they age ,and ,they die. If there is a craving left while dying ,then there is a rebirth of mathematician and the related ideas.
Panpsychism doesn't mean that the numbers themselves are alive. It takes a mathematical mind to become conscious of numbers. Not everything conscious is capable of discerning mathematical ideas.


Is there a way to use the USB-C port as power and for something else?

Question: What I mean by something else I mean connecting my external ssd (uses usb-c) to my pi rather than the usb ports as those are slower. I have read on usb-c Port of RasPi 4 used for anything else but Power? that power and data is populated in the port, but I was wondering. Can you use something like a USB hub or apple's multiple-connector-into USB-c? (beacause the apple one allows a usb-c power)
Comment: the pi4 has 2xUSB3.0 ports ... and I use them for SSD at 5Gbps (max rate for USB 3.0)
Comment: Yes but that gives 640 mbps whereas my ssd goes up to 1050
Comment: SSD on a USB3.0 port should go to 5 gigabits per second ... if you're only getting 640 megabits per second, and the device is only capable of about 1 gigabit per second, then the USB-C connector won't help anyway - get a better USB3.0->SATA connector
Comment: 640 megaBYTES per second
Comment: Oh, well that is the maximum then
Comment: The USB-C on a RPI4 is purely for power and not data.
Answer: The USB-C connector on the Pi DOES NOT implement USB-C.
It is used for power and a USB-2 OTG interface.


Unselect the selected rows in DataGrid

Question: I am maintaining a legacy VB window application. I have datagrid (not datagridview), I select a row by right click, but when i right click on some other rows, that row also shows selected, I just need only one row to be selected, not both. I use DataGrid1.Select(currentSelectedRow), which will select the row. there is second method unselect, but that required row number. When I move the mouse, row number changes. Is there any reset or any other way to reset the datagrid row selection. Thanks in advance
Answer: Loop through all rows in your datagrid and deselect everything accept the newly selected row.

Unselect the selected rows in DataGrid


Adding 48" planks to widen a 36" bridge with no support at ends

Question: How much load can a 48" (wood) board support if it is supported in middle, but unsupported for 6 inches at ends? It is for  a 600 lb mower that must go over a wooden bridge we will are adding width to. The tires of the mower are 45" wide. Could we use 1 x 6" pressure treated decking? The weight is more on the back 2 tires. The 600 lbs includes the person on the mower. Can we get away with 1" X 6"?
Comment: How thick and how wide are the planks?
Comment: I'm not sure I understand the layout. Are there 3 supports across the bridge? If so, it seems like the maximum span is about 15". (48" board with half on one side, minus 6" overhang, minus width of out-board support...say 2", minus one-half of middle support, or about 1"....thus: 24" - 6" - 2" - 1" = 15" )  The shortest span my tables go down to is 3' and a 2x will support about 460 lbs. per square foot.  The unsupported overhang is minimal and will support the load too. (1x material would probably work, but I wouldn't use it because the main load is on the cantilever portion of each board and
Comment: Of each board and pressure treating the lumber actually weakens the boards. )
Answer: Assuming reasonably equal weight distribution, each wheel of a 600 lb. mower and a 200 lb person would carry 200 lbs. Any 2x4 or wider SPF lumber that's reasonably free from large knots will suffice.
The actual calculations are difficult due to the unknown weight distribution (front/rear, tire width, tire pressure, etc.), but experience tells me that you certainly will not break 2x4 or 2x6 (or larger) lumber in that application, especially if you were to run a sleeper under the ends to tie the boards together and distribute load. I consider that overkill, though, and I'd only bother to do it if you see substantial flex in the individual boards as you roll over them.


Flash input text field only accepts characters already used somewhere on the stage. What's happening?

Question: On the stage I have an input field (classic text, input text) with **no filters** and **no restrictions** and yet, when I try to type something in it, I can only use characters that are already on the stage somwhere else.
For example, I have a few other labels on the stage with the strings '125' and 'HB'. In my input field I can now type any string containing those characters, like 'H52B' or '121212', but I just can't use any other characters! If I press '4' or 'K' on my keyboard, nothing happens!
I am sure there is nothing happening to this input field in actionscript and there are no filters on it. This problem may have something to do with the fact that I got this fla from a designer and upon opening it, I got a message saying something about fonts not being on my machine and converting to system defaults. Could it have something to do with that?
I'm using flash cs5.5 and actionscript 3.
Comment: Check if the designer embedded only some characters of your font and embed all the remaining characters you eventually need.
Comment: Thanks! That was it! Post it as an answer and I'll accept it.
Comment: You're welcome. Just posted   :-)
Answer: Check if the designer embedded only some characters of your font and embed all the remaining characters you eventually need.


Fractional Delay using Polyphase Filter

Question: How to use rectangular window design to design a length-9 polyphase filter which delays an input signal by 3/5 of a sample? An expression for the 9 coefficients is required.
Comment: Why do you need a polyphase filter, if you just want to implement a single fractional delay. A single FIR filter will be fine for this. With 9 tabs you not going to get particularly good results. Where does that come from ? Rectangular window is also a sub-optimal design method. Why that ?
Comment: This was my exam question. :)
Answer: Just sample a Sinc function at the appropriate phase offset, and truncate the FIR as needed to meet your rectangular window length requirement.  You only need 1 phase for a constant delay while keeping the same sample rate.
Comment: i think the OP needs the $\operatorname{sinc}()$ function to be 9 taps.  so a good window is needed.  i would suggest a kaiser window with a $\beta \approx 5$ i think.
Answer: Since the question was how to specifically implement this with a polyphase filter, I offer the following:
Such a true polyphase filter structure could be done by designing the base FIR filter with 9*5 = 45 taps and then mapping this to polyphase using row to column mapping of the taps in the one 45 tap FIR filter to 5 9 tap polyphase filters. In this approach each filter out would be an additional 1/5 of the delay, so choose the 3rd filter to get 3/5.
See the Interpolator implementation at this link for further details on how to construct the Polyphase Filter: How to implement Polyphase filter?
Each output of the polyphase filters in the interpolator is a delayed version of the same signal (hence how interpolation can be performed with these structures). Each filter is an allpass filter with a different delay (hence "poly-phase").
Answer: A windowed sinc filter with 9 taps has an inherent delay of around 4 taps, so depending on the context this could be useless. A fractional delay using an allpass filter might be a better choice.
Comment: Hi Robert, it is me indeed! Thanks for the welcome!
Comment: are you Stefan Stenzel??  $$ $$ in any case, welcome.

Fractional Delay using Polyphase Filter


Generalisation of the measurement postulate in quantum mechanics

Question: Given an observable that has a partially discrete and partially continuous spectrum of eigenvalues associated to it with the order of the spectrum's degeneracy being greater than 1, how would you derive an expression for the probability of finding a particular eigenvalue upon measuring this observable?
Answer: For a particular nondegenerate eigenvalue of an operator $O$, the probability that the system in state $|\psi\rangle$ will be measured to be in the eigenstate $|v\rangle$ associated with that eigenvalue is given by
$$P=|\langle v |O|\psi\rangle|^2$$
For a particular eigenvalue with degeneracy $n$, we can freely choose an $n$-dimensional orthonormal basis of the eigenspace $\{|v_i\rangle\}_{i=1}^n$. The probability that it will be measured to be in that particular eigenstate is equal to the probability that it will be in any of the eigenstates $\{|v_i\rangle\}_{i=1}^n$ or any superposition thereof. Therefore, we can extend the nondegenerate case to the following:
$$P=\sum_{i=1}^n|\langle v_i|O|\psi\rangle|^2$$
Note that this holds whether the spectrum is continuous or discrete, as long as you remember that this is the probability that you obtain exactly this eigenvalue given the exact state of the system $|\psi\rangle$.
Comment: You might care to add a bit about the case for the continuous spectrum: this would transform your answer from good to excellent.
Comment: The answer I wrote above applies to either case; in the continuous case, you get Dirac delta functions in the sum (from e.g. some constant multiplied by $\langle x|x' \rangle$). It's also not entirely clear what degeneracy would mean in the continuous case. Is the entire continuous part of the spectrum degenerate? Is only part of it? What happens if that part is uncountable and of measure zero?