Is there a way to flush a POSIX socket?

Question: Is there a standard call for flushing the transmit side of a POSIX socket all the way through to the remote end or does this need to be implemented as part of the user level protocol? I looked around the usual headers but couldn't find anything.
Answer: What about setting TCP_NODELAY and than reseting it back?
Probably it could be done just before sending important data, or when we are done with sending a message.
send(sock, "notimportant", ...);
send(sock, "notimportant", ...);
send(sock, "notimportant", ...);
int flag = 1;
setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, sizeof(int));
send(sock, "important data or end of the current message", ...);
flag = 0;
setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, sizeof(int));

As linux man pages says

TCP_NODELAY ... setting this option forces an explicit flush of pending output ...

So probably it would be better to set it after the message, but am not sure how it works on other systems
Comment: I confirm that it works. I prefer to set and reset TCP_DELAY after sending the "important data or end of the current message" because it allow to put this stuff inside a flush socket method.
Comment: This should work with linux at least; when you set TCP_NODELAY it flushes the current buffer, which should, according to the source comments, even flush when TCP_CORK is set.
Comment: You describe a situation where "notimportant" messages are mixed with messages that are to be sent ASAP. For this situation, I guess your solution is a  good way to circumvent the delay that might by introduced by Nagle. However, if you do not send multiple messages but one compound message, you should send it with single `send()` call! It's because even with Nagle, the first package is sent immediately. Only subsequent ones are delayed, and they are delayed only until the server acknowledges or replies. So just pack "everything" into the first `send()`.
Comment: It is true, but in this case, we do not know how large is non important data, nor if there were any delays between single sends. The problem arise when data is send in one direction. For example I work as a proxy - I forward everything I get relay that network will send it optimum way so I do not care. But then comes an important packet, which I want to send as soon as possible. Which is what I understand as flushing.
Answer: For Unix-domain sockets, you can use fflush(), but I'm thinking you probably mean network sockets.  There isn't really a concept of flushing those.  The closest things are:

At the end of your session, calling shutdown(sock, SHUT_WR) to close out writes on the socket.
On TCP sockets, disabling the Nagle algorithm with sockopt TCP_NODELAY, which is generally a terrible idea that will not reliably do what you want, even if it seems to take care of it on initial investigation.

It's very likely that handling whatever issue is calling for a 'flush' at the user protocol level is going to be the right thing.
Comment: I don't see any reason why disabling the Nagle algorithm "is generally a terrible idea". If you know what it does, there are many application protocol situations where disabling Nagle is exactly what you want to do. I suspect you haven't had a situation where you really needed to do that or you don't understand what it really does. In other words, this feature is there for a reason and it can also be disabled for a very good reason.
Comment: `fflush` has nothing to do with the issue even for unix domain sockets. It's only relevant if you've wrapped your socket with a `FILE` via `fdopen`...
Comment: What I do is enable Nagle, write as many bytes (using non-blocking I/O) as I can to the socket (i.e. until I run out of bytes to send, or the send() call returns EWOULDBLOCK, whichever comes first), and then disable Nagle again.  This seems to work well (i.e. I get low latency AND full-size packets where possible)
Comment: Nagle could have been a wonderful thing if there was a TCP flush. Since it can optimize it's buffer size to the current segment size. If you disable nagle you have a buffer of your own which is not synchronized to the segment size and so you will send half-filled packets over the network...
Comment: You'll need to `#include ` or whatever include file provides `TCP_NODELAY` on your system (try `fgrep -r 'define TCP_NODELAY' /usr/include`).
Comment: @Tall Jeff: Often enough you only need to disable nagle because there is no flushing mechanism!
Comment: I'm a bit surprised that there isn't a way to flush AND that Nagle disabling is discouraged.  I got rid of a 40ms latency sending a command to a server and getting the reply (reducing it to < 1ms) by disabling Nagle.  Still, I'm calling write() with 1-4 bytes at a time, so I imagine it could be even faster if I could explicitly tell when to flush, rather than waiting for some stupid timeout!
Comment: @JeremyFriesner: That is slick as hell.
Comment: In the go language, TCP_NODELAY is the default behavior. Did not see anyone complaining about it.
Comment: I tried using TCP_NODELAY but i got the following error- 'TCP_NODELAY' was not declared in this scope.

I used- setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, sizeof(int));
Comment: @TallJeff _there are many application protocol situations where disabling Nagle is exactly what you want to do_ Would you describe some of them please? Is there any common denominator?
Answer: In RFC 1122 the name of the thing that you are looking for is "PUSH".
However, there does not seem to be a relevant TCP API implementation that implements "PUSH". Alas, no luck.
Some answers and comments deal with the Nagle algorithm. Most of them seem to assume that the Nagle algorithm delays each and every send.
This assumption is not correct. Nagle delays sending only when at least one of the previous packets has not yet been acknowledged (http://www.unixguide.net/network/socketfaq/2.11.shtml).
To put it differently: TCP will send the first packet (of a row of packets) immediately. Only if the connection is slow and your computer does not get a timely acknowledgement, Nagle will delay sending subsequent data until either (whichever occurs first)

a time-out is reached or
the last unacknowledged packet is acknowledged or
your send buffer is full or
you disable Nagle or
you shutdown the sending direction of your connection

A good mitigation is to avoid the business of subsequent data as far as possible. This means: If your application calls send() more than one time to transmit a single compound request, try to rewrite your application. Assemble the compound request in user space, then call send(). Once. This saves on context switches (much more expensive than most user-space operations), too.
Besides, when the send buffer contains enough data to fill the maximum size of a network packet, Nagle does not delay either. This means: If the last packet that you send is big enough to fill your send buffer, TCP will send your data as soon as possible, no matter what.
To sum it up: Nagle is not the brute-force approach to reducing packet fragmentation some might consider it to be. On the contrary: To me it seems to be a  useful, dynamic and effective approach to keep both a good response time and a good ratio between user data and header data. That being said, you should know how to handle it efficiently.
Answer: There is no way that I am aware of in the standard TCP/IP socket interface to flush the data "all the way through to the remote end" and ensure it has actually been acknowledged.
Generally speaking, if your protocol has a need for "real-time" transfer of data, generally the best thing to do is to set the setsockopt() of TCP_NODELAY. This disables the Nagle algorithm in the protocol stack and write() or send() on the socket more directly maps to sends out onto the network....instead of implementing send hold offs waiting for more bytes to become available and using all the TCP level timers to decide when to send. NOTE: Turning off Nagle does not disable the TCP sliding window or anything, so it is always safe to do....but if you don't need the "real-time" properties, packet overhead can go up quite a bit.
Beyond that, if the normal TCP socket mechanisms don't fit your application, then generally you need to fall back to using UDP and building your own protocol features on the basic send/receive properties of UDP. This is very common when your protocol has special needs, but don't underestimate the complexity of doing this well and getting it all stable and functionally correct in all but relatively simple applications. As a starting point, a thorough study of TCP's design features will shed light on many of the issues that need to be considered.
Answer: There is a linux-specific way to do this on TCP sockets:
You don't force the tcp stack to "send out data immediately", but remember that you and kernel are sending data as fast as you can. You can slightly reduce the delay between send and actual delivery with TCP_NODELAY.
But basically, by doing send you've done your part and you just have to wait for tcp to do its part.
You can Use ioctl on the socket with SIOCOUTQ or TIOCOUTQ to query the status of delivery and just wait until it's finished. This should be be enough. Especially for use-cases like sending an application-level packet fragments.
Answer: I think it would be extremely difficult, if not impossible to implement correctly. What is the meaning of "flush" in this context? Bytes transmitted to network? Bytes acknowledged by receiver's TCP stack? Bytes passed on to receiver's user-mode app? Bytes completely processed by user-mode app?
Looks like you need to do it at the app level...
Comment: Nagle = don't send to wire immediately. No Nagle = send to wire immediately. The in-between option stares right in everyone's face: don't send to wire immediately (Nagle) except when I say to Send Now (the elusive TCP Flush).
Comment: @romkyns Nevertheless the actual send() is asynchronous w.r.t. the sending, regardless of the Nagle state.
Comment: @Roman Nagle does _not unconditionally_ equal _don't send to wire immediately_.
Answer: TCP gives only best-effort delivery, so the act of having all the bytes leave Machine A is asynchronous with their all having been received at Machine B.  The TCP/IP protocol stack knows, of course, but I don't know of any way to interrogate the TCP stack to find out if everything sent has been acknowledged.
By far the easiest way to handle the question is at the application level.  Open a second TCP socket to act as a back channel and have the remote partner send you an acknowledgement that it has received the info you want.  It will cost double but will be completely portable and will save you hours of programming time.
Comment: It does not help you in reducing the send-delays that TCP (especially nagle) produces. But reducing send-delays would be one of the most interesting point in having a flush for TCP.
Comment: I don't think you need a second socket....it would seem reasonable that the far end could send something back on the same socket, no?
Answer: You could set the tcp option SO_LINGER to set a certain timeout and then close the socket in order  to make sure all data has been sent (or detect failure to do so) upon the closeing of a connection. Other than that, TCP is a "best effort" protocol, and it doesn't provide any real guarantees that data will ever actually reach the destination (in contrast to what some seems to believe), it just tries it best to get it delivered in correct order and as soon as possible.
Answer: Use fsync():
sock_fd is integer file descriptor from socket(..., ...) call
fsync(sock_fd);
Comment: This flushes files, not sockets.
Comment: Not for me, I'm getting `EINVAL`. (As verified by strace on a UDS I just wrote a bunch of bytes to.)
Comment: Which must be why it works so well on UNIX Domain Sockets

Is there a way to flush a POSIX socket?


Remove certain lines of stroke/line art modifier

Question: I want to make a 3D model look more like an anime picture, so I added a grease pencil stroke and added it to the collection with the modifier. Now it almost looks good, but some lines I dont want, like the lines on the nose and neck. How can I get rid of those? I tried looking for an editor for the stroke but there isnt one to my knowledge.
Attached is an image of the model and render.
Answer: Don't know the specifics, but it looks similar to when you have the auto smooth turned on in the Normals tab within the Object Data Properties while using the line art modifier. To keep the good line art mixed with the good shading, just bake the line art , and then turn on the auto smooth


Special formatting and/or special characters in text boxes

Question: Is it possible to create a form with a text box that allows the user to change formatting (i.e. bold, italic, underline, etc) or to insert special characters (i.e. Greek letters)?
Answer: I am a developer for Cognito Forms.
Although we do not currently have a field that a user can change the formatting in this is a feature that we have added to our Idea Board.


How to define a distance measure between two IP addresses?

Question: I have IP addresses as feature and I would like to know how much two IP addresses are similar to each other to use the difference in an Euclidean distance measure (in order to quantify the similarities of my data points). What tactic can I use for this?
Comment: To you what would make two IP addresses similar?
Comment: You could use a GeoIP lookup and literally compare the distance on the earth between them....
Comment: @Spacedman That only works for WWW public IP.  OP has not even provided that information.
Comment: Yes, I was hoping some clarification would be forthcoming, instead of everyone piling in with "answers"... @marcL?
Comment: How they are similar in terms of network not based on earth distance. Sorry for the delay
Comment: What to you makes an IP similar in terms of a network?  Is this a public (WWW) network?
Comment: You can't tell the network similarity without the netmask value.... Again, people are piling in with answers when the question is unclear.
Answer: If I understood them correctly, both Jeremy and Edmund's (first) solutions are the same, namely, plain euclidean distance in a 4-dimensional space of IP addresses.BTW, I think a very fast alternative to euclidean distance would be to calculate a hamming distance bit-wise.
Edmund's first update would be better than his second. The reason is simple to state: his 2nd update tries to define a distance measure by considering a non-linear function of the coordinates of a 4D vector. That however will most likely destroy the key properties that it needs to satisfy in order to be a metric, namely

Injectivity: $d(IP_1,IP_2)=0 \iff IP_1=IP_2$,
Symmetry: $d(IP_1,IP_2)=d(IP_2,IP_1)$, and
Triangular inequality: $d(IP_1,IP_2)\leq d(IP_1,IP_3)+d(IP_3,IP_2)\,\forall IP_3$.

The latter is key for later interpreting small distances as close points in IP space. One would need a linear (in the coordinates) distance function. However, simple euclidean distance is not enough as you saw.
Physics (well, differential geometry actually) could lead to a nice solution to this problem: define a metric tensor $g$. In plain english, give weights to each pair of coordinates, take each pair difference, square it and multiply it by its weight, and then add those products. Take the square root of that sum and define it as your distance.
For the sake of simplicity, one could start trying with a diagonal metric tensor.

Example: Say you take $g=\begin{pmatrix}1000 &0 &0 &0 \\0 &100&0&0\\0&0&10&0\\0&0&0&1\end{pmatrix}$ $IP_1=(x_1,x_2,x_3,x_4)$ and
  $IP_2=(y_1,y_2,y_3,y_4)$. Then the square of the distance is given by
  $$d(IP_1,IP_2)^2=1000*(x_1-y_1)^2+100*(x_2-y_2)^2+\\ \,+10*(x_3-y_3)^2+1*(x_4-y_4)^2$$
  For $IP_1=192.168.1.1,\,IP_2=192.168.1.2$ the distance is clearly 1.
  However, for $192.168.1.1$ and $220.127.116.11$ the distance is
  $\sqrt{1000}\approx 32$

Eventually you could play around with different weights and set a kind of normalization where you could fix the value of the maximal distance $d(0.0.0.0,FF.FF.FF.FF)$.
Furthermore, this set up allows for more complex descriptions of your data where the relevant distance would contain "cross-products" of coordinates like say $g_{13}*(x_1-y_1)*(x_3-y_3)$.
EDIT: While this would be a better "weighting" method than using those other I addressed, I realize now it is actualy meaningless: As Anony-Mousse and Phillip mention, IP are indeed 32 dimensional. This means in particular that giving the same weight to all bits in say the 2nd group is in general not sound: One bit could be part of the netmask while the other not. See Anony-Mousse answer for additional objections.
Comment: Very nice. Thanks for critique. I obviously need to brush up on my Linear Algebra. ;-)
Comment: As I mentioned, eventually one could introduce a more complex "IP space-time" by considering also non-vanishing off-diagonal elements in $g$. This I guess would depend on the problem he wants to solve, i.e., on the data. However, my first guess is that it easily is overkill. At least one should first try with a diagonal form as in the example above. In such case, there wouldn't be any need to dust-off your LA books, ;-) just following the example, which is, btw, like a problem of vectors in 2 dimensions.
Comment: It's *not* a fourudimensional space. It's a 32 dimensional space. The dot-representation is just easier to remember.
Comment: @Anony-Mousse You are right, there is this other way of looking at it, namely bit-wise. What I propose is independent of how one describes the "IP-space, i.e., whether 4 or 32-dimensional. That said, without other info on the OP's problem, it's seems reasonable to distinguish the usual 4 numbers of an IP and say that 188.8.131.52 and 192.0.0.0 differ more than 0.0.0.0 and 0.0.0.1.
Answer: That's a very interesting question. Similarity here should be computed component-wise, but the thing is from a "business logic" perspective, the similarity of the last 3 numbers doesn't matter if the other 3 sets of numbers are not the same. Keeping that in mind, I would probably do something like the following (there is probably a more elegant way of doing it, and I don't have much time to think about it so forgive me if it doesn't answer your question and for the poor formatting).
Assuming IPv4 of the form aaa.bbb.ccc.ddd, I would so something like:
If aaa_1 == aaa_2:
  If bbb_1 == bbb_2:
    If ccc_1 == ccc_2:
        If ddd_1 == ddd_2:
            Dist = 1;
        Else:
            Dist = (3 + distance(ddd_1,ddd_2))/4;
        End if;
    Else:
        Dist = (2 + distance(ccc_1,ccc_2))/4;
    End if;
  Else:
    Dist = (1 + distance(bbb_1,bbb_2))/4;
  End if;
 Else:
  Dist = distance(aaa_1,aaa_2);
  Return 1/Dist;

Comment: So, if both addresses are the same you code assigns a distance of 1, not zero. Is that a typo or it does this 1 have a special meaning? (You could make it return a zero at that point so as to avoid a NAN at the return at the bottom.)
Comment: An IP is *one* 32-bit number.
Comment: @MASL This is a similarity metric, I should have precised it. 1 means complete similarity here.
Comment: Also I am probably abusing the word "metric" here,  forgive me for that.
Answer: 20 years ago, I would have suggested to use the length of the shared prefix as similarity measure.
So you take two IPs. In their 32 bit representation, not the "pretty printed" x.y.z.w form; the real "int" reoresentation your network stack uses. Then XOR them, count the leading zeros, and you get
distance = 32 - leadingZeros(ip1 XOR ip2)

However, we have exhausted the IPv4 namespace long ago. The last 10 years, the few remaining netblock have been more or less "randomly" (at least from a similarity perspective) been distributed. IP ranges have been relocated and so on.
A lomg time ago, people would have told you routing happens on trees, based on their prefix. So If you wanted to read an IP 10.2.3.4 it would go to 10.0.0.0 then 10.2.0.0 then 10.2.3.0. But that was just the theory. If you manually configured your router, that is what you would do. 10.2 isthe second building, 10.2.3. is the third floor router.
History.
Within networks, IPs are assigned by DHCP, often first-come-first-served. Within intranet, you have mostly switches not routers. And on the global level, the BGP is responsible for taking care of the big mess of todays routing tables.
In other words:
use some database like GeoIP to map the IPs to (approximate) coordinates. Best you can do.
IP based similarity is mostly useful on a /24 prefix, but a binary yes/no similarity won't make you happy I guess.
Comment: I hadn't seen your answer before I replied to your comment on mine. I understand now what you meant. Simple di/similarity measures on the IP's won't help one to distinguish any sort of geographical location. Maybe not even any other kind of useful measure of proximity -organizations have IP ranges assigned at ad-hoc, such that make a distance function superfluous/meaningless.
Answer: IP (v4) addresses are a 32-bit integer, which trivially gives you a metric. However, it may not be a particularly useful metric - 10.255.255.255 and 184.108.40.206 are almost certainly significantly more different than 192.168.1.1 and 192.168.1.2.
Comment: What is a *good* metric depends on the problem you're trying to solve. You could for instance use one of the geoIP services to get a geolocation for every IP address - but we can't tell you whether that's good for you because we don't know what your problem is.
Comment: Exact so do you have any idea ? Maybe one of the answers above ?
Answer: Like someone else mentioned, treating IPs as int automatically gives higher bits higher weights.
I've used variance of IPs which is log scaled.
math.log(np.std([IP(ip).int() for ip in ips]))

Answer: 2nd Update
The below can be improved as it does not consider the hierarchical structure of an IP address.  To account for this the elements of the IP vectors can be non-linearly scaled before computing the distance vector and its norm. This gives more weight to the elements higher in the hierarchy.
Mathematica code
Once we have the 4D vectors from the 1st update each element is scaled based on its position $[x^{2}_{1},x^{\frac{3}{2}}_{2},x^{1}_{3},x^{\frac{1}{2}}_{4}]$.
Subtract @@ (MapIndexed[
       Function[{value, index},
        value^((5 - First@index)/2)], #] & /@ {ip1, ip2}) // Norm // N
(* 2209.17 *)

There is information lost in collapsing from 4D down to 1D but this can't be helped if you are looking for a 1D distance metric.

1st Update
An IP address is made up of 4 numbers. Takes these as vectors in 4D and calculate the distance between them ( Distance in Euclidean space ).
Mathematica code
(* Make some IP addresses *)
{ip1, ip2} =
 StringRiffle[#, "."] & /@
  Map[ToString, RandomInteger[{1, 255}, {2, 4}], {2}]
(* {"22.214.171.124", "184.108.40.206"} *)

(* Extract 4D vector *)
{ip1, ip2} = Map[FromDigits, StringSplit[#, "."] & /@ {ip1, ip2}, {2}]
(* {{50, 229, 29, 146}, {27, 167, 216, 58}} *)

(* Calculate distance *)
Norm[ip1 - ip2] // N
(* 216.993 *)

Consider an IP address as a 4D vector. Subtract and calculate the norm.
Comment: So you are assuming that Sim("192.168.1.1", "192.168.1.2") == Sim("22.214.171.124", "192.168.1.1")?
Comment: Can you explain a bit more?
Comment: @marcL , I was on my phone.  Check the update.
Comment: Correct. They are equally similar to one another with this measure. But I see the issue here with the hierarchical nature of the IP addresses.  Let me think about that.
Comment: @JérémieClos So I'm thinking that each element of the vector could be non-linearly scaled before computing the norm of the distance vector.  This would give more weight to elements higher in the hierarchy.
Comment: That's what I was thinking too, but I didn't really take the time to formulate it well so I went with a simpler solution. Decomposing the similarity into a logarithmically weighted sum of pointwise similarities might do the job better (where each component is divided by log(n) where n is the position of the component).

Then sim(aaa.bbb.ccc.ddd, eee.fff.ggg.hhh) = sim(aaa,eee)/$log_2$(2)  + sim(bbb,fff)/$log_2$(3) + sim(ccc,ggg)/$log_2$(4) + sim(ddd,hhh)/$log_2$(5)
Comment: My bad, I didn't see that you updated your answer with something similar.
Answer: First you need to distinguish private and public addresses (check wikipedia IP_address#Private_addresses).
Private IPs: the best you can do is compute if 2 addresses COULD be on the same network or not, then you need clues from other features to KNOW if it is the case or no.
Public IPs:
For geographic distance, you may want to check web services/API that try to map IP and geographical locations (one google search turned this one for instance enter link description here).
Another point which could be interesting is the "organisational distance", from the IP address you can try to identify the owner of the address (the ISP), check ARIN for instance http://whois.arin.net/rest/net/NET-8-8-8-0-1/pft?s=184.108.40.206.
From there you can try to figure out if two addresses belong to the same organisation or not. You will have to find some way to tell if the organisation is an ISP with private customers or a company with their own network. Please be also aware that some organisations have started to resell blocks from their IPV4 addresses to other companies for money with the effect that addresses that used to be in the same organisation/location can now be thousands of miles away in different companies.
I think it would be wise to consider these informations as probabilities only.


Is there a way to re-encode video files ripped by Handbrake to add iPod 5G support?

Question: Handbrake has an option for iPod 5G support.  But I have some video files I ripped without checking that option.  Can I use ffmpeg or Handbrake to re-encode those files without having to re-rip from the DVD?
Answer: Re-encoding a video using the same settings would certainly degrade video quality further; audio can usually simply be copied over.
According to this Handbrake page, that option adds "an atom" to the file. More detailed information seems to be hard to come by, so I believe your best option is to re-rip from the original source.
Alternatively you could try these methods:

Re-encode the file with Handbrake
Make sure to copy over the audio tracks so they don't degrade as well. This is accomplished by selecting the appropriate (or auto) passthru audio encoder on the "Audio" tab.

Try importing and converting the file in iTunes as per the post on this forum thread:

I assume your movie(s) are already in iTunes; if not then import them.
  Select a movie, then in the menu bar select Advanced / Convert
  selection for iPod/iPhone. This leaves the movie unchanged, but
  creates a new version compatible with iPod.

I can't say for sure whether the video quality would degrade using this method, but my guess is yes.


How to disable opening inventories in minecraft?

Question: So I've been working on my map for a while, and its a custom pvp game kinda thing. There, I want all the players to be unable to access their inventories because it might cause some errors, as in my minigame there are different classes with different skills etc. How do I do that?
Comment: I don't think you can do that. I might be wrong though.
Comment: Would regularly removing items be good enough?
Answer: If you are a developer you can look further into cancelling the OpenInventoryEvent, it would look something like this, with a little editing of course. Or you can look into premade code such as RegionInventoryBlocker.
<code>    @EventHandler(priority = EventPriority.NORMAL)
public void onInventoryOpen(InventoryOpenEvent event)
{
    event.setCancelled(true);
}
</code>
If you are a regular user, you can use a plugin such as http://mods.curse.com/bukkit-plugins/minecraft/lobbytools to disable the movement of things around on your inventory, this should do the job. You can also look into many other plugins that do this job.
Other than that, there is no other known way to completely disable the inventory.


Web has multiple contacts for a business or bank; which is real?

Question: "A websearch finds five or six different phone numbers for my bank. Are they all real, or is one or more of them a scam? How do I know for sure?"
Comment: That's nothing. Try searching for Microsoft tech support.
Comment: FWIW, the official word from Microsoft is that _there is no phone number for tech support._ All contact must initially be through their website's chat function. If you can't use chat because Windows is completely booked, borrow someone else's machine to get to the chat. If you can't do that, get a friend to use the chat to ask them to call you in the next day or two; supposedly they will do so, though "I hae me doots." Don't complain here; complain to MS... or get off Windows.
Answer: Apparently this is a new trend, with scammers abusing search engine optimization to try to get people looking for a bank to come to their fake sites instead.
Always contact your bank directly. Check where the search engine is pointing you and make sure it's really your bank's page. Ideally, don't rely on search at all; get the address or phone number from the back of your credit card or a paper document the bank has mailed you; you can bookmark that in the browser or add it to your phone's contact list for easy reference. (I also have these stored in my password manager.)
You may want to take similar precautions for other business.
And as always, be suspicious of any link you are e-mailed or phone number you are given that you didn't explicitly request, whether it's from bank, business, or government; make sure it goes where it claims to go, and if there is any doubt whatsoever use your stored information instead.
As a programmer might say, practice safe hex.
Comment: If you know your bank's *real* website (you should), you can go there and find the phone number.


Hide objects bigger than background in Illustrator

Question: When I place an object bigger than the background, I want it to cut off by itself just like Photoshop. But in Illustrator it doesn't do that. I tried clipping mask but it doesn't do anything.
Comment: This object is  a vector, text, compound path image? As a general rule there is no crop in illustrator. For clipping mask to do anything you need to draw a rectangle if front of your object before applying.
Comment: That's just how Illustrator works (and is incredibly useful, I generally have 4 or 5 times as much stuff off of any artboard than I do on), Is there a specific reason you want to hide everything outside the artboard?
Answer: You can create a LAYER MASK of any shape and have it apply to all the other objects on that layer. In order to achieve the behaviour that you desire, the object that is being used as the clipping mask needs to be a rectangle with the same extents as the page. This rectangle needs to be the top sub layer of the layer that you want to mask. Once you have this in place, just select the LAYER (not sub layer) and hit the Make/Release Clipping Mask button at the bottom of the layers palette and you're done. The following screenshot should help to clarify:


Drupal 8 MVC: is there a Model?

Question: Coming from a Drupal background, I am quite thrilled at the idea of working with drupal 8 and symfony proper OOP and MVC practice.
Right now I I am building a module with a service and a controller and I am at a loss regarding where to put my data fetching logic (that should be used by both).
Understanding MVC policy I should put it in some kind of "model" structure but I can't find anything about that in Drupal documentation (sadly a bit lacking at the moment).
So what is the Drupal way for this?
Comment: Start point for understand database layer in Drupal 8 - https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Database%21database.api.php/group/database/8
There is a buch of module example that can help you - https://www.drupal.org/project/examples
Comment: You may not even need a data fetching code because you could re-use the existing entity manager service to load entities.
Comment: I do use entityQuery (and sql query) to fetch data but to me it is data fetching code.
Comment: As mradclif pointed out, use a service(custom or from core).
Answer: Your data-fetching logic should be in its own service(s).
Symfony and by extension Drupal are not traditional implementations of the MVC architecture as there's no separate Model layer, like for instance in CodeIgniter.
One of the most important features in Symfony and Drupal are services, which are (or should be :p ) independent and reusable implementations of various functionalities.
So if you want data-fetching logic, then you can create your own service that does that and use that service in your controller, instead of polluting it with the queries (entity queries or otherwise).
I'll leave with a comment from Fabien Potencier (the creator of Symfony):
"It's up to you to create your model by hand or use any other tool, like an ORM" [...]I don't like MVC because that's not how the web works. Symfony2 is an HTTP framework; it is a Request/Response framework."
This statement might be debatable, but what I want to show here is the intent behind the choice of leaving out a well defined Model layer.

Drupal 8 MVC: is there a Model?


GitLab Vagrant VM takes forever to provision, due to Berkshelf backup?

Question: I have a GitLab VM with Vagrant based on the GitLab Cookbook in production mode. I was running fine, until I had to restart the host today.
This is my output when I am running vagrant provision:
$ vagrant provision
[Berkshelf] This version of the Berkshelf plugin has not been fully tested on this version of Vagrant.
[Berkshelf] You should check for a newer version of vagrant-berkshelf.
[Berkshelf] If you encounter any errors with this version, please report them at https://github.com/RiotGames/vagrant-berkshelf/issues
[Berkshelf] You can also join the discussion in #berkshelf on Freenode.
[Berkshelf] Updating Vagrant's berkshelf: '/Users/admin/.berkshelf/default/vagrant/berkshelf-20140116-30359-fggony-default'
[Berkshelf] Using gitlab (0.6.4)
[Berkshelf] Using yum (2.4.2)
[Berkshelf] Installing magic_shell (0.3.2) from git: 'git://github.com/customink-webops/magic_shell.git' with branch: 'master' at ref: '447b4b67420d3a7a749d2dd3b13a7f9aceb54c36'
[Berkshelf] Installing monit (1.4.0) from git: 'git://github.com/phlipper/chef-monit.git' with branch: 'master' at ref: '276c99ba08869ebd5117267d91a2ff6aa0d9fc6b'
[Berkshelf] Using redisio (1.7.0)
[Berkshelf] Using ulimit (0.3.2)
[Berkshelf] Using ruby_build (0.8.0)
[Berkshelf] Using postgresql (3.3.4)
[Berkshelf] Using apt (2.3.0)
[Berkshelf] Using build-essential (1.4.2)
[Berkshelf] Using openssl (1.1.0)
[Berkshelf] Using mysql (4.0.10)
[Berkshelf] Using database (1.5.2)
[Berkshelf] Using aws (1.0.0)
[Berkshelf] Using xfs (1.1.0)
[Berkshelf] Using postfix (3.0.4)
[Berkshelf] Using phantomjs (1.0.3)
[Berkshelf] Using chocolatey (0.0.5)
[Berkshelf] Using powershell (1.1.2)
[Berkshelf] Using windows (1.11.0)
[Berkshelf] Using chef_handler (1.1.4)

Now it stays forever (more than 40 minutes) here ... after looking at some lsof output I found out that Berkshelf is creating a backup of all my files from home_git, which contains the application and repositories several GB in size.
ruby      10049 admin    7r     REG                1,2   59361467  99893126 /Users/admin/********/home_git/gitlab-satellites/*********/**********/.git/objects/89/61108fd29d60d311dd44b0e4d7ed0ddd7233ee
ruby      10049 admin    8w     REG                1,2   56639488 103952415 /Users/admin/.berkshelf/default/tmp/d20140206-10049-1q37zex/gitlab/home_git/gitlab-satellites/********/*********/.git/objects/89/61108fd29d60d311dd44b0e4d7ed0ddd7233ee

But these files don't have to be backed up, when I provision the VM.
Questions:

It looks like Berkshelf is treating these files as part of one of my cookbooks?
How could I tell Berkshelf to ignore this folder?

... or any other hint is very welcome! I also tried to disable Berkshelf without luck.
Workaround
If I move away the home_git folder the provisioning process runs through fast and smoothly.
Answer: Berkshelf 2 needed all of the cookbooks in a single location, since it compiled the metadata requirements on the fly. Berkshelf 3 uses a hosted API server, so this is no longer the case for most cookbooks.
However, it's also worth nothing that we are pushing people away from Vagrant Berkshelf and into Test Kitchen, as explained in this blog post: https://sethvargo.com/the-future-of-vagrant-berkshelf/


Deleted? Items show up in Export

Question: I export a list from my sharepoint and items in the excel show up that are not in the list, where are these coming from?
Answer: Perhaps things that were filtered out in a view are showing up.
In Sharepoint go in:
Document Library Settings > Modify View > Filter.
If there is a filter it might be filtering out certain items.

Deleted? Items show up in Export


Who faces the next ball if the striker is run out at the end of an over?

Question: Assume 'A' is playing at striker's end and 'B' is at non striker's end, If 'A' runs for a single run on the last ball of the 5th over and B is run out at the striker's end, who will be on strike on for the 1st ball of the 6th over? 'A' or new batter?
Answer: For now, ignore the fact that it is the end of an over. The important law here is 18.11.1:

When the striker is dismissed in any of the circumstances in 184.108.40.206 to 126.96.36.199, the not out batter shall return to his/her original end.

184.108.40.206 to 22.214.171.124 are bowled, caught1, LBW, stumped, hit wicket, hit the ball twice, obstructing the field (under some circumstances) and when a runner is dismissed (under some circumstances). This list does not include run out, so the batters remain at the ends they were when the dismissal occurred.
A is now at the "over 5" non-striker's end, so will face the first ball of the 6th over.
1. Added to the list as of 1st October 2022.


Converting XML feed to JSON preserving the itunes:image data

Question: I need to convert a podcast feed XML to JSON. Today I use the Google API to convert my feed to JSON, using the sentence:
var jsonUrl = "http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&output=json&num=999&q="
              + encodeURIComponent(xmlUrl);

WinJS.xhr({ url: jsonUrl, responseType: document }).done( ... )

This works, but I'm also interested in the < itunes:image ... > data that these feeds have most of the time, but using the Google APIs it just give me Atom and RSS elements and ignore the itunes' ones.
There's any way I can modify my Google call or even use some javascript inside my code, reading the XML and converting it myself, to get a standard RSS Json plus the itunes image info?
Answer: Is jQuery.parseXML() what you are looking for?


Relations between 4 tables

Question: I have 4 tables event, group, category, judoka. Event has many groups, group has many categories and category has many judokas. So how can i realize this? I tried to create pivot tables event_group, group_category, category_judoka, but when I put judokas to category they are in all events not just in one. I have many to many relations between all tables. Any suggestions?
Comment: I'm having a little trouble figuring out the query here, can you post the code for the relationships and the actual query you are trying to run?
Comment: "Event has many groups, group has many categories and category has many judokas." based on this.. you don't need pivot table. why is it many to many situation?
Comment: Because I can create many events where can be same groups but different judokas.
Answer: you have to define the reverse of relation for us to know how to best answer that but here is what You can Do it you just need a 1 to n relation ship between them all :
here in your Event model :
public function group(){
return $this->hasMany(Group::class);
}

and in your Group model :
 public function category(){
    return $this->hasMany(Category::class);
    }

and in your Category Model :
public function judokas(){
        return $this->hasMany(Judokas::class);
}

and consider to put a modelname_id in your related table so for example in your event model you need a column like :
group_id

and in your Group model you need a column like :
category_id

and in Your Category model you need a column like :
jukodas_id

and now you can access all the relation by nestest relationships so for example in your controller you can use thew like below :
 $data = Event::with('Group', 'category.judokas');

here you can get the nested relationship which is the category relation inside the judokas .
i hope it helps
Answer: your question is not clear but
based on your description you should have this relations :

events has many categories
events has many judokas
groups has many judokas

when you add judoka to cateory you should sync this relations :
category->events()->judokas()
category->groups()->judokas()

and access them like this:
event->judokas()
group->judokas()

Answer: Thank you all, i found a solution. Just created pivot table with 3 values category_id, event_id and judoka_id. Attached values like this: $categoryf->events()->attach($categoryf->id, ['event_id' => $event->id, 'judoka_id' => $judokas->id]);

Relations between 4 tables


Sphinx and GUIDs

Question: We have a database that we would like to index with Sphinx search engine. The problem is that Sphinx requires integer ID for each document but our database has GUIDs (actually, random GUID-like strings) as primary keys. I could generate synthetic IDs on the fly as described in this recipe, but it is good only for full indexes. What if I want to have incremental indexes or runtime index? Are there any best practices to deal with GUIDs using Sphinx that would work with incremental indexes and runtime indexes? The databases in question would be quite large so I wouldn't want to reindex them frequently.
Answer: Real-time indexes: you can convert your non-numeric GUID to a numeric value (you can use crc32 or md5 casted to a number) like this:
mysql> select conv(mid(md5('abc'), 1, 16), 16, 10);
+--------------------------------------+
| conv(mid(md5('abc'), 1, 16), 16, 10) |
+--------------------------------------+
| 10376663631224000432                 |
+--------------------------------------+
1 row in set (0.00 sec)

test or google to figure out what algorithm will give less collisions.
Once you have numeric IDs you can just INSERT your docs to Sphinx RT index.
Incremental indexes: you can convert GUID to numbers using the same method described above, but you will have to remember somewhere where the main part of your index finishes to build the delta. You can do it easily if you have some "updated" or "inserted" field in your table. sql_query_range will be smth like "select ... where updated > (select last_updated from sphinx_helper)". You can't base on the ids in this case as they're not sequential.
I've tested the half of md5 algo on 11.8M different domains:
mysql> update domain_tmp set hash = conv(mid(md5(domain), 1, 16), 16, 10);
Query OK, 5901483 rows affected (1 min 59.03 sec)
Rows matched: 11800403  Changed: 5901483  Warnings: 0

mysql> select count(*) from domain_tmp;
+----------+
| count(*) |
+----------+
| 11800403 |
+----------+
1 row in set (16.30 sec)

mysql> select count(distinct hash) from domain_tmp;
+----------------------+
| count(distinct hash) |
+----------------------+
|             11800403 |
+----------------------+
1 row in set (1 min 5.51 sec)

i.e. no collisions occured. So if you don't have much more documents in your dataset it should be ok to use half of md5.
Comment: You don't need to change the table structure, you can generate new IDs on the fly when you make SELECT by Sphinx indexer. As for the collisions - half of md5 looks quite ok, I've tested it on 11.8M different domains - no one collision.
Comment: I can't really change all the table structure (the DB has 50+ tables with table structure generated by ORM-like system) to generate new IDs. I could use md5 method probably... But I'm worried about the collisions.

Sphinx and GUIDs


DIY Social media buttons Vs. Ready built (e.g. AddThis)

Question: Is there any benefit from rolling-your-own set of social media 'like' buttons rather than using a pre-packaged widget, such as that provided by AddThis? Are there any downsides from using out of the box services?
Answer: Out of the box services

may go out of business
their servers may go down
they may not be responsive when new social media sites appear and their widget doesn't include them
they may not be responsive when existing social media sites change their APIs in a way which breaks the widget
you have a lot more control over behaviour and appearance

Of course rolling-your-own may be a lot of work, particularly if you're the one changing your widget because someone changed their API.
Comment: Good points.. +1
Comment: These are all valid down sides, but what if non of this happens? Assuming everything is working correctly, is there any disadvantage?
Comment: Only the fact that you are limited when it comes to appearance as to how the services choose to display the widgets.


Why do some people CC themselves on their emails?

Question: I noticed this several times and wondering if there is a reason for Carbon Copying themselves on a email when sent to others?
Comment: You are the only one who up voted it. ;) Thank you
Comment: Not sure why this is attracting so much negative attention. Can't say it's something I ever noticed or cared about before, but the answers make the question useful.
Answer: From Workplace.SE
The accepted answer

Most people I know that exhibit this behavior is so they have an email in their inbox that continues the chain, and they can see their response in the timeline continuity of the chain. If you don't CC yourself, most email clients do not show your response, as it goes to the "Sent" folder, and does not appear in your Inbox or the same folder the email chain is in.

My favorite

I set up rules in Outlook where if an email contains "Project A" in the subject, it should be routed to the "Project A" folder in my inbox. When I CC myself in these emails, I can be sure that my "Project A" folder contains all related emails, including those that I sent.
It also means that I can periodically clear out my Sent Mails folder without worrying about losing project specific emails.

From Quora
I find this is one example of good workaround of email system

Typically, it's because they're accessing their email through a POP3 server which means that sent emails are only stored locally (unlike IMAP).  They would do this regularly if they happened to use more than one client as it would allow them to see the sent email from all clients (as it's stored in the Inbox, which is accessible to all clients when using POP3).
This is a reason, amongst others, to use IMAP rather than POP so as to avoid this rigmarole.

Just like @David Morris answer, as a support to non-tech savvy users, they only want to view the message they've sent in one folder (Inbox) rather than searching the Sent folder.
Though I find this as a sign of being disorganized, as long as it works for them, I won't complain.
Answer: Obviously there are a large number of possible reasons, but one reason that I know of is to store messages in a folder that's not the sent folder. They may have rules set up that automatically put emails in different folders within Outlook, and they want to capture their responses in those same emails.
They may also be sending it to an additional email address so that they can chronicle it there. For example, I use a different email account for job searching than I do for personal use, I always BCC the personal email account when I'm using the job searching account so I can find my messages if I need to.
Comment: Exactly, they want to put it in there inbox and then sort either manually or by a rule. I know plenty of parties that do this, instead of sorting by using their sent box.


How can I include different navigations for my website using HTML?

Question: I have an html website that has a "computer" web style to it, and then a style for mobile. The problem is the mobile navigation has pipes separating the navigation and I don't need the pipes on the "computer" web style. How can I include the different navigations for the different agents?
Answer: Fix the markup so it makes sense everywhere.
You shouldn't separate navigation items with pipe characters, ASCII art doesn't play well with semantic markup.
Use list items for all your navigation, and style it differently using media queries. You can use a border on one side of the list items to create the appearance of a vertical line between items.


What is the equation for an inflation adjusted annuity held in perpetuity?

Question: What is the equation relating an initial investment, a fixed rate of return, an inflation rate, and a perpetual payment adjusted for that inflation rate?
Comment: Does such a thing exist or is this theoretical?
Comment: @DilipSarwate the idea is that a portion of the periodic payment is reinvested thus increasing the principle.
Comment: @JoeTaxpayer It's real in as much as the rate of inflation stays constant and you can find an investment that will give you a constant rate of return in perpetuity. Obviously those are both ridiculous statements, but no more so than most of the other long term projections made in the financial world.
Comment: @JoeTaxpayer You're assuming the discount rate is the inflation rate. But in this case it's not, it's a value grater than the inflation rate. I.e. the payments are growing at a rate smaller than the discount rate of the TVM calculation so things still stay finite.
Comment: The PV of an (infinite) series of values increasing faster than inflation will be infinite. The reason $1/yr for perpetuity has a present value I can calculate is due to the time value of money. Even at .1%/yr, the PV only hits $1000. Of course division by zero yields infinity, which is meaningless.
Comment: @MikeDeck You are correct, and I have deleted my comment. I am also posting an answer which gives perhaps a simple-minded way of looking at your own answer.
Answer: Let P denote the amount of the investment, R the rate of return and I the rate of inflation.  For simplicity, assume that the payment p is made annually right after the return has been earned.  Thus, at the end if the year, the investment P has increased to P*(1+R) and p is returned as the annuity payment.
If I = 0, the entire return can be paid out as the payment, and thus p = P*R.
That is, at the end of the year, when the dust settles after the return P*R
has been collected and paid out as the annuity payment, P is again
available at the beginning of the next year to earn return at rate R.
We have

P*(1+R) - p = P

If I > 0, then at the end of the year, after the dust settles, we cannot
afford to have only P available as the investment for next
year. Next year's payment
must be p*(1+I) and so we need a larger investment since the rate of return
is fixed.  How much larger?  Well, if the investment at the beginning
of next year is P*(1+I), it will earn exactly enough additional money
to pay out the increased payment for next year, and have enough
left over to help towards future increases in payments. (Note
that we are assuming that R > I. If R < I, a perpetuity cannot be created.)
Thus, suppose that we choose p such that

P*(1+R) - p = P*(1+I)

Multiplying this equation by (1+I), we have

[P(1+I)]*(1+R) - [p*(1+I)] = P*(1+I)^2

In words, at the start of next year, the investment
is P*(1+I) and the return less the increased payout
of p*(1+I) leaves an investment of P*(1+I)^2 for the
following year.  Each year, the payment and the
amount to be invested for the following year increase
by a factor of (1+I). Solving

P*(1+R) - p = P*(1+I)

for p, we get

p = P*(R-I)

as the initial perpetuity payment and the payment increases
by a factor (1+I) each year.  The initial
investment is P and it also increases by a factor of (1+I) each year.
In later years, the investment is P*(1+I)^n at the start
of the year, the payment is p*(1+I)^n and the
amount invested for the next year is P*(1+I)^{n+1}.
This is the same result as obtained by the OP but written in
terms that I can understand, that is, without
the financial jargon about discount rates, gradients,
PV, FV and the like.
Answer: EDIT: After reading one of the comments on the original question, I realized that there is a much more intuitive way to think about this. If you look at it as a standard PV calculation and hold each of the cashflows constant. Really what's happening is that because of inflation the discount rate isn't the full value of the interest rate. Really the discount rate is only the portion of the interest rate above the inflation rate. Hence in the standard perpetuity PV equation PV = A / r r becomes the interest rate less the inflation rate which gives you PV = A / (i - g).
That seems like a much better way to get to the answer than all the machinations I was originally trying.

Original Answer:
I think I finally figured this out. The general term for this type of system in which the payments increase over time is a gradient series annuity. In this specific example since the payment is increasing by a percentage each period (not a constant rate) this would be considered a geometric gradient series.
According to this link the formula for the present value of a geometric gradient series of payments is:
P = A_1 [1 - (1 + g)^n(1 + i)^-n]/(i - g)

Where
P is the present value of this series of cashflows.
  A_1 is the initial payment for period 1 (i.e. the amount you want to withdraw adjusted for inflation).
  g is the gradient or growth rate of the periodic payment (in this case this is the inflation rate)
  i is the interest rate
  n is the number of payments
This is almost exactly what I was looking for in my original question. The only problem is this is for a fixed amount of time (i.e. n periods). In order to figure out the formula for a perpetuity we need to find the limit of the right side of this equation as the number of periods (n) approaches infinity.
Luckily in this equation n is already well isolated to a single term: (1 + g)^n/(1 + i)^-n}. And since we know that the interest rate, i, has to be greater than the inflation rate, g, the limit of that factor is 0.
So after replacing that term with 0 our equation simplifies to the following:
P = A_1 / (i - g)

Note: I don't do this stuff for a living and honestly don't have a fantastic finance IQ. It's been a while since I've done any calculus or even this much algebra so I may have made an error in the math.
Comment: I think this site does not use MathJax. I am told that using MathJax adds a lot of expense, and so sites that do not need it, often choose to avoid the expense.  Besides $ is commonly used for other purposes on this sight.
Comment: EDIT: Unfortunately I can't seem to get any of the Tex markup to render properly. This is the first time I've tried marking up mathematical formulae on a stackexchange site, so if anyone can fix the original revision of this question to render properly, please add a comment and let me know what I was doing wrong.
Comment: @DilipSarwate I see, makes sense. Thanks for the info.
Answer: The question lacks specificity, i.e. when does the initial investment occur, now or one period from now?  If now then it is a perpetuity due.
I  will consider under 2 scenarios, A and B, relating to the size of the initial investment.
A.
Assuming that the initial investment (C_0) occurs now and each payment thereafter has the relationship (1+g) with this investment then the relevant base equation is that for the present value of a growing perpetuity due, expressed in terms of C_0, i.e.
PVGPD=  [C_0*(1+g)*(1+i)]/(i-g).
Now, to suit the question asked, we can see that i=fixed rate of return (f) and g = expected inflation rate (e) such that we can rewrite the equation as
PVGPD = [C_0*(1+e)*(1+i)]/(i-e].
We know that f = is a fixed nominal rate and must be adjusted for e to calculate the real rate (r) according to the equation f=(1+r)*(1+e)-1. Therefore
PVGPD = [C_0*(1+e)(1+(1+r)(1+e)-1)]/((1+r)*(1+e)-1-e]
Tidying up
PVGPD = {C_0*(1+r)(1+e)^2}/[r(1+e)]
PVGPD = [C_0*(1+r)*(1+e)]/r
B.
Assuming that the initial investment (X) is not equal to each subsequent perpetual payment (C_1) then the relevant base equation is that for the the initial investment plus the present value of a growing perpetuity, i.e.
PVGP=  X + [C_1/(i-g)]
Rewriting
PVGP = X + [C_1/(f-e)]
Substituting
PVGPD = X + {C_1/[(1+r)*(1+e)-1-e]}
Tidying up
PVGPD = X + C_1/[r*(1+e)]


Max value of I in a circuit

Question: I am a EE student.I have been taught Ohm's law which says $I = \frac{V}{R}$.In the limit of$R \rightarrow 0,I \rightarrow \infty$.But I have also taken the course "Electromagnetism II" where we learn of the invariance of the speed of light which also acts a limit to information transfer.The current $I$ inside a conductor is due to charged particles which move according to the electromotive force of the battery.Now I know that the velocity of these charged particles is also due to temperature but lets assume we cool the conductor at near 0K temperatures so the velocity is mainly due to the electromotive force.But the velocity of the charged particles which create current $I$ cannot be greater than c because they would carry information with a velocity greater than c which is universally forbidden.So the current $I$ has a limit.Which is it?Has it been calculated?
Comment: Obviously the size of the wire remains constant
Comment: Current is charge/second. If I make a bigger wire, I can fit more charges and more current
Comment: In a band structure, electrons have crystal momentum even at T=0.
Comment: @JonCuster yes and they have momentum anyway due to their zero-point energy....but it is so small it can be ignored...
Answer: In the most basic classical picture, the drift velocity $v_d$ of electrons in a wire is related to the current $I$ via
$$v_{d} = I/neA \equiv J/ne$$
where $n$ is the density of conduction electrons, $e$ is the fundamental charge, $A$ is the cross-sectional area of the wire, and $J\equiv I/A$ is the current density in the wire. Plugging in $v_d = c$ and $n\approx 8.5 \times 10^{28}$ m$^{-3}$ (the conduction electron density of copper) yields an upper limit of $J\approx 4\times 10^{18}$ A/m$^2$, which corresponds to a current of $I\approx 8 \times 10^{13}$ A in a cylindrical wire with diameter $5$ mm.
Of course, this number isn't really physically meaningful for a number of reasons. This classical picture is a toy model, and electrons in solids are a highly quantum mechanical system. Even disregarding quantum mechanics, no conductor could come anywhere near this current density without being vaporized by Ohmic heating. Even considering a classical model of a superconductor as a conductor with zero resistivity, this current density would be far above the superconductor/normal conductor switching threshold.

Max value of I in a circuit


Why aren't Runge-Kutta methods used for molecular dynamics simulations?

Question: One of the most used schemes for solving ordinary differential equations numerically
is the fourth-order Runge-Kutta method. Why isn't it used to integrate the equation of motion of particles in molecular dynamics?
Comment: RK4 doesn't preserve conservation of energy, for one. IIRC it tends to lose energy over time. Symplectic integrators do better here.
Comment: @TLW many (but not all) molecular dynamics applications do not need strict energy conservation, very often we use an explicit, significant damping term and use it to find the minimum energy configuration. In these cases nobody is interested in the accuracy of the path taken to the bottom, only that it successfully finds its way there. cf. [FIRE: Fast Inertial Relaxation Engine for Optimization on All Scales](http://users.jyu.fi/~pekkosk/resources/pdf/FIRE.pdf) If you can find an actual example of someone using a symplectic integrator in MD and of it "doing better" that would be interesting!
Comment: @TLW see also [Structural Relaxation Made Simple](https://www.math.uni-bielefeld.de/~gaehler/papers/fire.pdf)
Comment: What methods _are_ used, then?
Answer: In molecular dynamics simulations, the overwhelming part of the computational time is spent evaluating forces. For this reason, since the very beginning of the method, the algorithms of choice were those requiring the minimum evaluation of forces per unit of time.
Higher-order algorithms are usually not necessary for two reasons:

in molecular dynamics simulations, one is not interested in the maximum accuracy of the trajectories but in an efficient sampling of the phase space compatible with the physical constraints. For this reason, usually, lower-order but symplectic schemes are preferred.
the increased accuracy of higher-order algorithms does not allow a proportional increase of the time step size. The reason is the stiff nature of the interatomic forces at short distances.

Based on these considerations, the fourth-order Runge-Kutta method is usually excluded. It is not time-reversible nor symplectic and requires four force evaluations per step. Even the existing symplectic Runge-Kutta methods are not appealing when compared with methods of the same order using fewer force evaluations.
Comment: @KevinKostlan When we say that Verlet is 3rd order, it means that the *local* error is third order in the time step. The *global* error is 2nd order. RK4 has a fourth-order *global* and a  fifth-order. *local* error. Therefore, the fair comparison should be between the global 2nd order Verlet and the *global* 2nd order RK that requires two evaluations of the force per step. Better than four, but worse than one :-)  Finally, I would add that Verlet's method does not allow general velocity-dependent forces. Its generalization for this case (Groot-Warren) requires two force evaluations per step.
Comment: Good answer but might be useful to add a definition of "symplectic" for those unfamiliar with this term of art.
Comment: The Verlet method is 3rd order and symplectic without ANY additional force evaluations. RK4 is 4th order with *4 times* the cost. Also, high accuracy is impossible when we are making crude approximations from quantum mechanics.
Comment: @WOPR Good point. I have added a link to the relevant Wikipedia page. Thanks
Answer: In molecular dynamics you have to evolve a large number of  particles, so efficiency is important. The Verlet algorithm provides numerical stability, as well as other properties that are important in molecular dynamics: time reversibility and preservation of the symplectic form on phase space, at no significant additional computational cost over the most basic integrator, i.e., the Euler method. Therefore, if you want to use Runge Kutta (that is computationally more expensive than Euler), you first ask yourself if it would perform better than Verlet.
Answer: GiorgioP has the right answer, but I just want to emphasize a point. We use different time integration methods for different problems. For example, consider these two problems.

You want to know the location of satellite orbiting the Earth one year from now.
You want to know if one drug binds more strongly to its target protein than another drug.

In the first case, you use a high-order Runge-Kutta method, or something else that gives you very accurate trajectories. In the second case, you are more interested in getting accurate statistical properties. You don't need to know the exact position of a particular water molecule after 100 nanoseconds. Often for molecular simulation, we are only interested in equilibrium thermodynamic properties like free energies and radial distribution functions. To calculate such statistical properties, it is important that the integrator be reversible and symplectic so that equilibrium can be reached and so that we correctly sample a valid thermodynamic ensemble. Also, to get good statistical accuracy, we need a lot of sampling, so it's also important that the method be computationally efficient.
We usually don't want to exactly follow the trajectories of molecules at the nanoscale, since these usually can't be compared to experiment because of the sensitivity to initial conditions and perturbations from outside (thermal fluctuations, vibrations). In experiment, we can't control initial conditions at the molecular scale very well (certainly not to the sub-picometer precision that would be required for reproducible trajectories on the picosecond timescale) and can't isolate systems from thermal fluctuations of their surroundings. If we are comparing to experiments happening in beakers of water or inside living organisms, there is no way to control outside influences even if we wanted to.
Moreover, in molecular dynamics simulations, we often use thermostats and barostats that slightly modify the dynamics (and therefore trajectory) in artificial ways, so that we can sample constant temperature ($NVT$) or constant pressure ensembles ($NpT$). These ensembles are usually more useful for comparing to experiment than the ensemble given by applying Newton's laws unmodified (constant particle number, volume, and energy, $NVE$).
We may use enhanced sampling methods like replica exchange, which lead to even more dramatic departures from physically realistic trajectories. For example, in temperature replica exchange (also known as parallel tempering), you run 10 replicas of the system at different temperatures and periodically attempt to exchange coordinates between the different temperature replicas using the Metropolis criterion. When exchanges are accepted, the trajectory at a given temperature changes discontinuously (molecules may appear teleport around). If we are only interested average equilibrium quantities, we don't care about thes artificial jumps, only that we are accurately sampling an $NVT$ (or $NpT$) ensemble.


Would we able to meet the Non Muslim person whom you love in jannah?

Question: Asslamalikum
Alhamdulillah i am a Muslim and I live in India. all Of a sudden I fall in love with my girl best friend who is a non Muslim (Hindu) and because of differeces of cast we cant unite.
I love her so much but since Muslims can't marry a women until she believes so I can't have her as my wife. So my question is WOULD WE ABLE TO MEET THE NON MUSLIM ONES IN PARADISE AS I LOVE HER VERY MUCH BUT I CANT BE WITH HER IN THIS WORLDY LIFE.
I am very depressed these days and I have turned my self to Allah the creator and but I can't find the solution to it.
SINCE ALLAH SAID I WILL GRANT EVERYTHING TO MY SERVANTS IN PARADISE SO WILL HE GRANT ME THE PERSON WHOM I LOVE IN PARADISE?
Comment: You can give dawah to her.
Answer: Walekum salaam brother.
First of all the relationship that you have/had with her, whether it is that of love that you have for her now, or the friendship that you had with her earlier, is haraam. You should distance yourself from her, cut all contacts, lest it becomes a source of further fitnah for you. And repent to Allaah (ﷻ) sincerely.
Secondly, you should make dua to Allaah (ﷻ) to grant you a righteous Muslimah wife, who will be a coolness for your eyes and your heart and ask Allaah (ﷻ) to put love between you and her. In sha Allaah, this will make you forget the girl in question, leaving not regrets.
Thirdly, Jannah is the ultimate reward that Allaah (ﷻ) has prepared for the believers. What you will get there is far better that anything that you can expect in this life. Be righteous and strive to please Allaah (ﷻ) to get Jannah, and be assured that what you will get there will make you forget anything that you wished for in this dunya.
Lastly, like others have mentioned, giving dawah to her is also an option. But I am afraid that if you contact her even for giving dawah, it will be a source of fitnah for you. If you can find someone else to give dawah to her, that would be great. Otherwise, focus on the above three points and there will be no regrets, in sha Allaah (ﷻ).
And Allaah (ﷻ) knows the best.
Answer: See
Allah grant every wish of a person who entered in paradise. I can't say with 100% surety  but I think if you will ask her Allah might grant your wish.
You can have her in this life too. Just give her dawah and teach her about Islam and if she asks any questions then explain the answer.
Answer: islam is a religion of mercy and justice. you can pray for her and give her dawah and give her advice or give her leaflets. i would advise moving if you are living with her.that leaves us with the queatin:Can a Muslim live with a non Muslim? Consequently, it also means that Muslims are allowed to live in a non-Muslim country or under a non-Muslim government, as long as they have the freedom to worship their religion and can experience basic human rights. There is no reason or compulsion for Muslims who live in such situation to move but it would be reasonable and advisable to move to a muslim country.
allah is the most wisest


Ubuntu not working properly, settings menu isn't working

Question: I updated ubuntu from 19.10 to 20.04. Now my system is actually a pure mess.
Now sometimes doesn't load and after the boot menu, there's nothing but '_', and the freezes. I guess it's a GPU error. I tried accessing the console but during accessing the console using "ctrl+alt+F1" whilst trying to put in login credentials the screen starts loading and my ubuntu starts again.
Other than this whenever I try to access the setting whenever it boots it's not responding.
Answer: Update:
I have read this: https://askubuntu.com/a/234657/1157519 and found that - in such case that you describe - instead of virtual consoles, using the recovery mode's root shell (illustrated guide here) may be a better idea.
The argument is that if your system is unstable, then your virtual consoles might also exhibit some degree of instability. The recovery root shell is designed to provide as much stablility as possible. So as long as the problem is solvable from the recovery root shell, that should be the choice.
With that said, here's info about virtual consoles:
In recent versions (of GDM), the virtual consoles are:
from ctrl+alt+F3 up to ctrl+alt+F6.
ctrl+alt+F1 is the graphical GDM login screen.
ctrl+alt+F2 is the actual graphical session (after having logged in).
ctrl+alt+F7 is unstable / unreliable, and not recommended.
Answer: My problem got solved in four easy steps.
I firstly checked if gnome-control-center is working or not in my system by typing
gnome-control-center

It showed some error after that I simply reinstalled gnome-control-centre by using these commands:
yogi@yogi-HP-Laptop-15q-by0xx:~$ sudo apt-get remove gnome-control-center
yogi@yogi-HP-Laptop-15q-by0xx:~$ sudo apt autoremove

and then finally:
yogi@yogi-HP-Laptop-15q-by0xx:~$ sudo apt-get install gnome-control-center

It solved my problem, I hope it will solve yours.


Is it possible to base GroupTemplate (.NET) on anything but a fixed record count?

Question: I'd like to use ListView to display grouped data from my db. Because of the way the query is structured, each logical group might have 1 or 2 records associated with it. Is there anyway to use GroupTemplate, while overridding the GroupItemCount behavior? Ideally, I'd like it to behave the way SQL does- assign a column ID, and let it watch for a change in value.
Answer: Ok here it is, nicely documented
It would be nice to build this kind of functionality directly into the control so you can simply specify this "watch" field using markup.
Again, this is the reason why I switched to the ListView, to try to avoid lengthy workarounds like this where you have to manually inject your own HTML. I bet they will eventually add this feature in and then claim how super amazing .Net 4.0 is.
All the time, more and more, I find more reasons to steer clear of inflexible .Net and use one of the more "direct" HTML manipulation platforms (PHP + CodeIgnitor). If you are absolutely fluent with CSS and HTML and know them backwards, you will find .Net uber frustrating every single time, because you just "can't quite get in there" and do what you need to do quickly without searching for workarounds all the time.
Summary: ASP.Net still isn't there yet.


What Linux version of Flash do I download?

Question: I don't know what Linux version of Adobe Flash to install for Ubuntu 13.04; Also: once I get it, how do I install it?
Answer: Start an terminal and add the Canonical partner repository:
sudo add-apt-repository "deb http://archive.canonical.com/ubuntu $(lsb_release -sc) partner"
Then enter
apt-get update && sudo apt-get install adobe-flashplugin

As alternative you can download the .deb file from Adobe.
First check the bit version you need.
Therefore open a terminal and enter
 uname  -m
Remember the x86_64 (so 64 bits address range) or x86 of the output.
http://get.adobe.com/flashplayer/otherversions/
Select Linux (64/32) (according to the output above)
and
*Flash_Player_11.2_for_Ubuntu_(apt)
and click download.
The Ubuntu Software Center will open and then you can install the "Adobe Flash Player plugin version 11" with a click onto the install button.
Answer: I'm not sure since I don't have my Linux machine with me but try this.  Just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:
sudo apt-get install flash

(press tab twice list all the possibilities select the installer).


Sufficient conditions for equality of measures related to harmonic functions

Question: In Axler's book "Harmonic function theory" on this link http://www.latp.univ-mrs.fr/~chaabi/ARTICLES%20IMPORTANTS/Autres%20articles%20interessant/Livres/Harmonic%20Function%20theory.pdf on page 112 the author say: "We know that if $f\in C\left(S\right)$, then $P\left[f\right]$ has a continuous extension to $\overline{B}$. What can be said of the more general Poisson integrals defined above? We begin to answer this question in the next two theorems." I tried to understand the idea of this, but I couldn't understand. So, my first question is: "What is the idea and answer about this problem?"
 Then, I tried to think in other way. If we suppose that $P\left[\mu\right]$ can be extended continuously to $\overline{B}$, and if we denote by $u$ such extension, then  from theorem 1.21 on page 15 we will have $u=P\left[f\right]$, where $f$ is a restriction of $u$ to $S$. Now we have that $P\left[\mu\right]=P\left[f\right]$ on $B$, and this implies that $$\int_{S}P\left(x,\xi\right)d\mu\left(\xi\right)=\int_{S}P\left(x,\xi\right)d\mu_{f}\left(\xi\right),$$ where $d\mu_{f}\left(\xi\right)=f\left(\xi\right)d\sigma\left(\xi\right)$. My intuition tells me that I need to prove that $\mu=\mu_{f}$ but I don't know how to prove that. Are there any theorems in Measure theory related to this kind of problem? So we have the same integrals of a "nice" function in two measures. What are the conditions for this "nice" function and on the set to imply the equality of these measures?
Answer: The book you are reading deals with harmonic functions from the point of view of "classical analysis", whereas the question you are asking is best answered in terms of the more abstract "potential theory". The point is that for any fixed boundary point $\xi$ the Poisson kernel $P(x,\xi)$ as a function of $x$ is positive harmonic, moreover, all functions $P(\cdot,\xi)$ are minimal in the cone of positive harmonic functions. Now, it is a pretty general fact (by which I mean that it applies to other definitions of harmonicity as well) that the cone of positive harmonic functions is a lattice, which by Choquet's theorem implies that any such function has a unique decomposition into an integral of minimal ones.
Comment: I really don't understand your answer.
Comment: What concretely?


Is there a more positive term for "desk rejection"?

Question: I wish to ask a journal's editor if my manuscript will be "desk rejected" (for, if not, it will be peer-reviewed).  He and I both know what that means, but I'd rather say it without prejudicing my submission.
Comment: This seems like an [X-Y problem](https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem). If you are trying to figure out if this journal is an appropriate venue, or about bureaucratic requirements, then you can ask the editor (or someone else in your field) without referencing your paper. If you are worried your paper is not good enough, then asking the editor is likely inappropriate.
Answer: What are you trying to do?

If you've already submitted your article but the status remains "Submitted to journal", you could ask for an update on the status of review.
If you've already submitted your article and the status has updated to something like "Reviewer invited", then your article is likely not being desk rejected because if the journal was desk rejecting, they would not be inviting reviewers.
If you've not submitted your article and are wondering if they will desk reject it, you could ask whether the journal is willing to consider your article.
Answer: Just submit it. If it will get immediately rejected, it will... The time it takes to do that is probably less than the time it'd take to respond to your email, and perhaps the editor's feeling a need to explain. Indeed, what do you hope to accomplish by asking? For that matter, the editor might decline to give any opinion until you submit, and then, again, you've wasted other peoples' time (and your own).
Comment: This is mostly true, although I have a friend who got a desk rejection after waiting one year. It might be relevant to ask if a journal has a reputation for this type of behavior...


Can targets placed on the facades of a building be used to increase the accuracy of a point cloud of a building generated from Drone/UAV/UAS imagery?

Question: Can targets (used for registering point clouds) mounted on a building be used to increase the accuracy of a point cloud generated from UAV imagery?
Comment: What accuracy are you referring to? Absolute (place on earth) or relative (to other photos).  I would imaging you would use features on the structure itself.
Answer: If you're using photogrammetric methods for producing the point cloud, targets won't necessarily increase the accuracy of the point cloud. What they are useful for is taking measurements from your point cloud or scaling/georeferencing your point cloud data to be representative of real-world measurements.
If you have access to a Total Data Station or other piece of equipment that can help you establish the location of your targets on your building relative to your grid coordinates (whether you use an arbitrary grid or one based on map coordinates with the TDS back sighted to true north), you can scale your point cloud dataset to your grid and incorporate other datasets.
Targets can also be used to stitch photos together if your process requires manually relating photos to one another. If you want a more automated methodology for point cloud creation you can check out the photosynth toolkit (http://www.visual-experiments.com/demos/photosynthtoolkit/)


Installing cloudera manager in ubuntu 14.04/64b

Question: I am installing Cloudera Manager in my system(14.04/64b).
While installing at the final step, before finish installation I got some ERRORs in validation as shown below,

errors in above page are,

ERROR 1
Individual hosts resolved their own hostnames correctly.
Host localhost expected to have name localhost but resolved (InetAddress.getLocalHost().getHostName()) itself to arul-pc.
ERROR 2
The following errors were found while checking /etc/hosts...

The hostname localhost is not the first match for address 127.0.0.1
in /etc/hosts on localhost. Instead, arul-pc is the first match. The
FQDN must be the first entry in /etc/hosts for the corresponding IP.
In /etc/hosts on localhost, the IP 127.0.0.1 is present multiple times. A given IP should only be listed once.

How to solve these 2 errors ?

Note(info)::

In my /etc/hosts,
127.0.0.1       localhost
127.0.0.1       arul-pc

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Note 2(my try)::

I tried to avoid arul-pc from /etc/hosts/ as,
127.0.0.1       localhost
#127.0.0.1      arul-pc

after saved and Run again, Error 2 cleared, but Error 1 become as,
Individual hosts resolved their own hostnames correctly.
Host localhost failed to execute InetAddress.getLocalHost() with error: arul-pc: arul-pc. This typically means that the hostname could not be resolved.
Answer: It picks value from hostname -f command. You need to update /etc/sysconfig/network with appropriate hostname.


Aluminum electrolytic vs. aluminum polymer capacitor

Question: What type of capacitor should I use for a longer life (C8) aluminum electrolytic or aluminum polymer capacitor? It works at 400 kHz and must provide a current of 30 mA.
Comment: Polymer caps don't dry out like electrolytic
Comment: @Aaron Hybrid polymer can dry out I think, but solid/dry polymer can't. Hybrid is more resistant to overvoltage though.
Comment: At this small capacitance value, I would contemplate a ceramic capacitor instead of both C8 and C9. **But that depends on whether U6 is stable with low ESR-caps.** If U6 needs the C8's ESR to work as a snubber and stabilize the output, then an aluminum polymer cap might not be an option and could lead to oscillations.
Comment: @tobalt U6 appears to be a simple rectifier bridge (DB = Diode Bridge, I guess), so there is no stability issue here. The "U" prefix in its designator is indeed misleading.
Answer: As you are a new member here in the community in order to receive better recommendations my suggestion is when you post a question first keep in mind this points:
1- show the community your researching about the topic you are asking about.
2- be explicit in your post (if you post schematics, tell us what's the schematic about, in this question also it's important to know what would be working temperature of the board for example)
Take a look at this table
(https://www.we-online.com/web/media/07_electronic_components/news_1/blog/midcom_blog_photos/capacitor_series_august_2016/32_res18.png)
having in mind what would be the working temperature of the board.

Also take into account this points:
Pro's of aluminium electrolytic caps:

higher voltage ratings available (up to 600v)
way cheaper pricing ( for the same capacitance and voltage)
better leakage current behaviour than polymer

Pro's of polymer electrolytic capacitors:

lower esr/higher allowable ripple current
no dry out behaviour
higher expected lifetime/load life

When you calculate the expected load life of a capacitor take into account the temperature in which the board will work. At 105 degree celsius the aluminium electrolytic capacitor has longer life but if the temperature drops in a more normal range of 65 degree celsius the polymer capacitor has a longer life.
Comment: U6 is a simple 4-diode rectifier bridge. Can I give up the C8?
Comment: It is interesting that you tell that lower ESR was unequivocally a *pro*. Very often, when a schematic shows a parallel combination of a ~100nF ceramic cap and a larger polarized cap, the **high ESR** of the polarized cap on the order of ~1 Ohm is actually *important* to stabilize the rail against oscillations by working as a snubber. So at the least, emphasize that it critically depends on the specifics of U6.
Comment: @Miau that depends on how much ripple voltage you can tolerate across R8 then.
Comment: @Miau C8 is there to filter the output of the bridge. It must be there if you want small ripple. C9 isn't there to filter out ripple but to improve transient response if the load varies rapidly (C8 is slow in this respect, because of various reasons, ESR and also ESL).
Answer: I would say: neither.
Use an X5R or X7R 10uF 50V capacitor in 1206 or 1210 SMT package. E.g. SAMSUNG CL31A106MBHNNNE, about a dime each qty 100. Compared to electrolytics, its life is effectively infinite.
Make sure that the rectifier U6 uses ultrafast diodes. You may end up needing discrete diodes instead. Even at mains line frequencies, fast switching of rectifiers is essential to keep the noise down. At 400kHz, the problems caused by slow rectifiers are 10,000 times worse, relatively speaking. Use diodes that are designed for ultrafast switching, and whose datasheets provide maximum switching time specifications. Otherwise, you'll end up with noisy outliers if only a typical switching time is guaranteed.
Ensure that the path from the rectifiers into the filter capacitors has low AC impedance: use wide copper areas to lay out this circuit. The "small" 30mA current is only the DC part of it, while the AC part at tens of MHz may have peaks 10-100x higher than 30mA. The low impedance of this current loop will ensure that the capacitors have a chance to shunt the majority of the switching noise energy away from the rest of the circuitry.


Sound Card Design: Why 96Khz/24bit?

Question: I'm in the process of designing a soundcard. However, I'm a little confused over one aspect. The primary usage of the soundcard's output will be playing 320kbs mp3s through a program (Traktor, VDJ, Serato...). I'm under the assumption that one cannot polish a turd and am struggling to see the point in supporting sample rates of 96Khz and bit depths of up to 24 bits. Any insight?
Comment: [24/192 Music Downloads ... and why they make no sense](http://xiph.org/~xiphmont/demo/neil-young.html).
Comment: Designing a soundcard??
Answer: The point is to have more resolution than the typical final output so that there is less rounding error.  96khz is chosen because it is exactly twice 48khz which is the standard audio sampling rate for video.  This way, you can cut the audio from 96khz to 48khz by cutting the number of samples in half, so there aren't aliasing problems.  Similarly, 24 bit audio gives 8 bits more precision than 16.  It's the minimum increase that makes sense since you want the samples to be a set number of bytes.
This allows for 256 times the resolution in terms of intensity and twice the temporal resolution while editing and limits rounding error so that the final output is higher quality when it is mixed down to 48khz or 44.1 khz and 16 bit.
If the soundcard is only going to be playing 16 bit, 48khz sources, then there isn't any gain by supporting the additional bits and samples as the device on the other end could accomplish the same by simply sampling the audio at the desired rate and bit depth since the information is already lost, but it makes a lot of sense when using higher quality inputs.
Comment: "cutting the number of samples in half, so there aren't aliasing problems": This only works if the 96 kHz material is strictly bandlimited to 24 kHz already, in which case the 96 kHz sample rate is useless to begin with. - "24 bit audio gives 8 bits more precision than 16. It's the minimum increase that makes sense": It is also the maximum increase that makes (somewhat) sense, because no speaker will be able to fully reproduce even that much of dynamic range. -
Comment: "twice the temporal resolution": Increasing the sample rate does not in any way change the temporal resolution of the signal, only allow higher frequencies (from 24 kHz upward, inaudible for humans). - Again, see [24/192 Music Downloads ... and why they make no sense](http://xiph.org/~xiphmont/demo/neil-young.html).
Comment: @chirlu - that post talks about final listening, not processing.  Yes, it may not make sense to use it for final output, but it DOES make sense during signal processing.  There is a fundamental difference between what machines can do and what we can hear and rounding error does make a difference.  This is the same reason that photos and video work with levels of sampling outside what we can see until final output as well.  It guards against further quality loss from alterations.
Comment: @chirlu - as for the temporal resolution, again, this is talking about for processing.  See the article you linked in the section on Over-sampling and it's application to filters.  Just because it isn't needed for human hearing, doesn't mean it isn't helpful in processing.
Comment: *"that post talks about final listening, not processing. Yes, it may not make sense to use it for final output, but it DOES make sense during signal processing."* While this is true, the OP's question is about "soundcard output", making it more concerned about final listening rather than processing...
Answer: Not sure about your output, but here's an example of why I would want a sound card to meet or exceed 96KHz at 24 bits on the input side. I have a Zoom G2.1u effects processor and a Tascam DR-08 that both can deliver 96KHz 24 bit audio, so I would want to be sure my sound card could deliver this fidelity to my DAW or NLE.
Comment: Hmm that would make some sense in reverse. But in terms of fidelity, what is say 16bit 48Khz going to sound like at 110+DBa
Comment: Sorry I don't understand.

Sound Card Design: Why 96Khz/24bit?


What are the original components to a 1953 Schwinn Paramount?

Question: I have a 1953 Schwinn Paramount that I inherited and have been riding as my daily commuter.  I think most everything is original, but am not sure. Where can I find out what the original components should be, and any idea of its value?
Answer: The Schwinn Paramount was a special machine, as Sheldon Brown describes. I cannot tell you what components it had, because it seems that they were custom built to order only.
Maybe the people at the Schwinn Paramount Registry can help more.
Looks like it's valuable. Look after it.


The Fundamental Theorem of Symmetric Polynomials

Question: This theorem stays that any symmetric polynomial can be expressed as a polynomial of elementary polynomials. So let's suppose I have a symmetric polynomial $f(x_1,x_2,...,x_n)$ in $R[\mathbb{X}]$. I can find a unique polynomial $g(s_1,s_2,...,s_n)$ in $R[\mathbb{X}]$ so I can express f in term of g, where $s_1,s_2,...,s_n$ are elementary polynomials.
My question to you is: Is there a algorithm/set of stepts to determine g? Thanks.
Answer: Let $c x_1^{a_1} x_2^{a_2} \dots x_n^{a_n}$ be the lexicographically largest monomial of $f$, that is there are no monomials with strictly larger exponent of $x_1$, and no monomials with $x_1$ exponent ${a_1}$ that have a higher power of $x_2$, and so on. We'll think of this as being the leading term of the polynomial.
Now the key thing to notice is that $e_n^{a_n}e_{n-1}^{(a_{n-1}-{a_n})} \dots e_1^{(a_1-a_2)}$ contains the monomial $x_1^{a_1} x_2^{a_2} \dots x_n^{a_n}$ with coefficient $1$ and all other monomials it contains are smaller lexicographically.
Now the point is you can consider the leading term of $f - c e_n^{a_n}e_{n-1}^{(a_{n-1}-{a_n})} \dots e_1^{(a_1-a_2)}$, and so on.  Each step reduces the leading term (in lexicographic order), so this process must eventually terminate, at which point you have written $f$ in terms of the elementary symmetric functions.
Comment: Ok, you kinda lost me at the last paragraph. Can you please show me how this work on a example. Let's say I have the following polynomial:
$$ P(x_1,x_2,x_3) = x_1^4+x_2^4+x_3^4-2x_1^2x_2^2-2x_2^2x_3^2-2x_1^2x_3^2 $$. Thanks a lot for your help.
Comment: The lexicographically largest term is $x_1^4$. So according to the algorithm described you should subtract off $e_1^4 = (x_1+x_2+x_3)^4$.  The point being that what remains, while having more terms, will have a smaller leading term namely $-4x_1^3x_2$.  Then we apply the same operation again to this polynomial $P - e_1^4$, this time adding $4e_2e_1^2$ to cancel the leading term.  Next we would cancel the leading term $P - e_1^4 + 4e_2e_1^2$, and so on. Eventually we are left with $P - g(e_1,e_2,e_3)$ having no leading term and hence $P - g(e_1,e_2,e_3) = 0$ as desired.
Answer: You can use divided difference operators to express the polynomial in terms of Schur polynomials, then you can apply the second Jacobi-Trudi formula, which expresses a Schur polynomial as the determinant of a matrix whose entries are elementary symmetric polynomials. Computationally this is rather inefficient, but it is nonrecursive, which is sometimes advantageous.
Comment: Hey, thank you for your answare. Can you please show me how this would work on a real example. See the polynomial in the comment section for @Nate 's answare.
Comment: @Raducu I don't have a computer algebra system here, but my hand calculations resulted in $\partial^{4123}(p)=3$, $\partial^{5423}(p)=-1$, $\partial^{3423}(p)=-2$, so $p=3s_{(31)}-s_{(211)}-2s_{(22)}$, and you can go to the Wikipedia article on the Jacobi-Trudi formula and substitute what it gives you.


Young's double slit experiment modified

Question: When an electron passes the double slit it hits the screen leaving a trace but we don't know anything about which one of the two it acctually passed.What about making a single slit on the screen where a stripe appears.We now have a possibility of the electron to pass that slit on the stripe and by placing an additional screen after the first screen we can measure if the pattern on that screen is more wider than it would be if the electron arrived from only one direction from the double slit.If it is wider that would suggest,I think, that the electrons arrived from two directions from the double slit or they pass once from one hole and once from the other with same possibility.It is my rough teory and I ask if it is worth and possible trying this in a lab experiment?I am only concerned if that difference in angles is too small to be acctually measured but what caused me to post this is that if we hit a single slit from two direction the pattern on the screen must be different that the one caused by hitting that single slit from one direction.
Comment: An electron can only go through one slit at a time. There's no reason or proof that anything can go through two separate openings at once. There's no way you can physically describe such an action. No one ever has and no one's even tried.
Answer: I'm afraid that your idea is ingenious but would not shed any light upon the mystery. Whether an electron passes through one of the front sits or both simultaneously, quantum theory would predict that the wave function of any electron passing through the new rear slit would disperse, so when you measured the positions of incident electrons on the additional rearmost screen you would find a spread, and the spread would mask any hint you might have about how the electrons interacted with the original pair of slits.
Comment: If electrons do pass both slits they have to have only one trajectory and make a narrower disperssion on the additional screen.If they pass discrete slits they would have two possible trajectories and should make a wider disperssion that is a possibility........
Answer: The question to answer is not whether the stripe is made from one slit or 2, with QM we find they are made from both. But the question to answer is from which slit the electron came without disturbing the pattern, which can not be answered.
So yes the pattern would be broader but the additional slit would introduce more diffraction as well on the final screen.

Young's double slit experiment modified


How does CiviCRM make the link between uploaded pdfs and the database table?

Question: I want to import many pdfs into Civi and so need to make the link between the uploaded pdf and the database table.  I used the UI to upload a sample pdf (calke_walk.pdf) and looking at the db table, the field in question contains an int(10) unsigned   with a value of 8.  The uploaded pdf has a file name of Calke_walk_a0e8f5791bb72c5b53c253f4fa66fd2f.pdf    In Civi's UI the file has a url that ends with &id=8&eid=28308  The clue there is the &id=8 I guess, but is there more to this that I need to know?
Answer: Try using the attachment api, it will handle the nitty-gritty for you.
Comment: In the 4.6+ api explorer (use the demo server if you haven't upgraded) go to the "Code Docs" tab and look it up.
Comment: I cannot find any examples of the attachment api - and no documentation either apart from your link.  Can you suggest where to look for an example of this api being used in Civi?  Thanks


pin state after shutdown

Question: i am on Ubuntu 20.04 on RPI4.
I am driving a 4 PWM motor driver using PWM on pins 22,23,26,27.
When i turn off the raspberry, the driver being still powered, go off.
I suppose some of this pins change state to HI.
Is there a way to power off the RPI4 assuring the pins stay LOW ?
Thanks
Comment: always assume that the pins will float when the microcontroller is powered off ... design external circuitry with that in mind ... also, the motor driver should not drive any microcontroller pins high when the microcontroller is powered off
Comment: thanks for the reply @jsotola . I don't think the motor driver affects the RP pins when it's off. but i will check that too
Answer: If you want to ensure the GPIO are low at power-off connect each GPIO to ground via a 4k7 resistor.
Answer: Your Question asks about "pin state after shutdown" - in general pins retain their state if powered.
You later state "i turn off the raspberry" - if unpowered the pins obviously have no voltage so state is meaningless.
It is unclear what you have done or WHY you would want to turn off power while apparently leaving the motor driver powered.

pin state after shutdown