How to send a JSON string with an HTTP request using in Java using HTTPClient

Question: This is my first question. I love stackOverflow but I've always been a reader, not a writer. Now here goes nothing:
So I've seen a LOT of different questions like this, believe me, I looked... but none of them seemed to answer my question exactly. I'm designing a test harness to test an API, and it involves sending HTTP requests using HttpClient (in Java). For some of the requests, such as POST requests, a JSON string or an XML string must be sent with the request. (I'm only asking about JSON here, if anyone had the answer of how to do the XML as well, I'd love that, but I'll save it for another question.)
Anyways, I have the following code so far which seems like it SHOULD do what I want... but I'm getting 400 error. I'm going to assume that I've properly created an instance of an HttpClient and an HttpPost, applied appropriate headers, etc... the pertinent part is below:
<code>    JSONObject JSONpayload = new JSONObject();
    JSONpayload.put("quantity", 1);
    JSONpayload.put("sku", "21-53429");
    String JSONstring = JSONpayload.toString();

    System.out.println("JSON PAYLOAD BEING SENT: " + JSONstring);
    request.setEntity(new StringEntity(JSONstring));

    response = client.execute(request);

    System.out.println("SERVER RESPONSE STRING: " + response.toString());
</code>
And I receive the following output:
<code>JSON PAYLOAD BEING SENT: {"quantity":1,"sku":"21-53429"}
SERVER RESPONSE STRING: HTTP/1.1 401 Unauthorized
[Date: Thu, 27 Jun 2013 19:57:29 GMT,
 Server: Mule Core/3.3.1,
 Set-Cookie: sid=h8jumUyMxMztmB1AHtbvmUzzc9WchbiR9dQahD6Q; Version=1;
 Domain=192.168.235.9;
 Path=/,
 http.status: 401,
 X-MULE_SESSION: rO0ABXNyACNvcmcubXVsZS5zZXNzaW9uLkRlZmF1bHRNdWxlU2Vzc2lvbi7rdtEW7GGKAwAEWgAFdmFsaWRMAA1mbG93Q29uc3RydWN0dAAmTG9yZy9tdWxlL2FwaS9jb25zdHJ1Y3QvRmxvd0NvbnN0cnVjdDtMAAJpZHQAEkxqYXZhL2xhbmcvU3RyaW5nO0wAD3NlY3VyaXR5Q29udGV4dHQAJ0xvcmcvbXVsZS9hcGkvc2VjdXJpdHkvU2VjdXJpdHlDb250ZXh0O3hwAXB0ACRjYzQwMmMwNy1kZjYzLTExZTItOGY1Yi1kOTk2MTM2MzZkZjJwc3IAJWphdmEudXRpbC5Db2xsZWN0aW9ucyRTeW5jaHJvbml6ZWRNYXAbc/kJS0s5ewMAAkwAAW10AA9MamF2YS91dGlsL01hcDtMAAVtdXRleHQAEkxqYXZhL2xhbmcvT2JqZWN0O3hwc3IAJG9yZy5tdWxlLnV0aWwuQ2FzZUluc2Vuc2l0aXZlSGFzaE1hcJ3R2e9nRc4AAwAAeHB3DD9AAAAAAAAQAAAAB3QABWR1bW15dAAYOU9WX0FBQUJHQmdBQUFFX0lTQVFBNGMydAAJUm91dGVkVVJMdABhaHR0cDovLzE5Mi4xNjguMjM1Ljk6MzA4MC9nc2kvcmVzdC9XRlMvVE1TTkEtVE1TVVMtU2l0ZS9yZXN0L2NhcnRzLzlPVl9BQUFCR0JnQUFBRV9JU0FRQTRjMi9pdGVtc3QAC0NvbnRleHRQYXRodAATZ3NpLWV3cy1zZXJ2aWNlL3N2Y3QAC291dHB1dC10eXBldAAQYXBwbGljYXRpb24vanNvbnQAClJlcXVlc3RVUkx0AEsvZ3NpLWV3cy1zZXJ2aWNlL3N2Yy92MS4wL3N0b3Jlcy9UTVNVUy9jYXJ0cy85T1ZfQUFBQkdCZ0FBQUVfSVNBUUE0YzIvaXRlbXN0AAdTdG9yZUlEdAAMc3RvcmVzL1RNU1VTdAAKaW5wdXQtdHlwZXEAfgATeHEAfgAJeHg=,
 X-MULE_ENCODING: UTF-8,
 Content-Type: text/plain,
 Transfer-Encoding: chunked]
</code>
Now, I know the basic things and I'm pretty sure I've taken care of them... like setting the headers Accept application/json, Content-Type application/json, etc..
Any advice would be greatly appreciated. I'm new to using HttpClient and I'm a little lost haha. Thanks guys!
Answer: The problem is that this server requires authentication and you're not providing it (or using invalid credentials). I can tell that because the response code was 401 (Unauthorized).

401: Similar to 403 Forbidden, but specifically for use when authentication
  is required and has failed or has not yet been provided [...]

HTTPClient's home page has a lot of information regarding authentication. You can check how to do that here also check some code examples here.


How to test pinch events on a web page on a Macbook

Question: I am working on a website which has an canvas on it. I have an image in the canvas, and what I want to do is pinch to zoom the image (the web page will eventually be on a touch screen). I am using jGestures for detecting pinch event. However, I wonder if there is a way to test on a Mac computer, because when I do pinch on mac trackpad, it zooms the webpage, not the canvas, which means that the pinch on trackpad does not apply to my canvas tag, it zooms my webpage (the font, the width, the height). I also wonder if magic trackpad or magic mouse can do it. Could anyone help?
Answer: If you have Xcode you could run the iOS simulator. The simulator would allow you to pinch. Hold down Option key and you should be able to mouse click to zoom in and out.
Comment: You can change your device type to iPad that should be larger.
Comment: Thanks for the answer, it works. However, testing a web page on a small iphone device seems a little bit troublesome. Is there a better way.
Answer: I got multitouch working on my MacBook's trackpad with npTUIOClient (see article) with an old version of Chrome. Think it was v.10 or so.


What is the theoretical limit of lumen/watt for lighting systems?

Question: Nowadays we see LEDs with 300 lumen per watt luminous efficacy. They still waste a lot of power as heat. Now what is the limit of electricity to light conversion? Say we build an LED with 100% efficiency, which doesn't waste any power as heat or sound or UV/infrared. All its spectrum is in visible range. What will be its lumen/watt? What is the theoretical roof we would hit in distant future?
Answer:
Nowadays we see LEDs with 300 lumen per watt luminous efficacy.

Maybe in the laboratory. Right now commercially available white LEDs are about 200 lm/w. 400 lm/w is the practical upper theoretical limit. US DOE estimated over 250 lm/w by 2025.

Commercial Blue LEDs have up to about 80% efficacy (Cree XP-3G and OSRAM Oslon SSL).
White LEDs use blue LEDs covered with a yellow phosphor.
Theoretically phosphors could produce better than 100% efficacy.
If the cost of manufacturing a UV LED dropped dramatically, efficacy could skyrocket.  LEDs emitting near 400 nm with remarkably high efficiencies have been reported (Morita et al., 2004)

What is the theoretical roof we would hit in distant future?

1 photon per electron is the ideal quantum efficiency of unity.
Internal, extraction, external, and power are the four basic LED efficiencies.
Internal: number of photons emitted from the active region per electron crossing the band gap.  Dependent on materials and temperature
Extraction: Photons emitted by the active region that escape from the LED die. If all photons emitted by the active region are also emitted into free space, the extraction efficiency is unity.
External:  the ratio of the number of useful light particles emitted to the
number of electrons crossing the band gap.
Power efficiency is the "wall plug" efficiency. The number of photons emitted per watt used.
If the technology reached the theoretical maximum of one photon per electron
The theoretical lm/w efficacy is based solely on the spectral output.
There are three common units of measure for LED flux.  Luminous (lumens), radiometric (watts), and quantum (number of photons, SI unit = Moles).
Visible spectrum is 380 nm (770 THz) to 770 nm (390 THz)
A 380 nm violet photon carries the most radiometric power.
You will get most lumens from a watt of 555 nm (540 THz) green photons.
602,214,085,700,000,000 electrons in 1 watt.
624,200,000,000,000,000 photons in 1 µMole.
which gives 1.036508469 µmol/w

Converting Photon Energy to Photon Flux
A photon has an energy quanta Ep which is defined by:
Ep= h•f

where h = Plancks constant 6.63 x 10^-34, and
f = Frequency = c/λ
where c = speed of light = 299,800,000 m/s and

λ = wavelength in meters

Therefore
Ep = h•(c/λ)

The number of photons, Np, can be calculated by
Np = E/Ep
   = E•((λ•10^-9)/h•c)
   = E [W/m2]•λ•10^-9[m]•/ (1.988•10^-25)
   = E•λ•5.03•10^15 [1/(m²•s)]   (with Irradiance[W/m²])

NOTE: above λ is in nm
The photon flux can be determined by:
Ef = Np/NA

where NA = Avogadro number 6,022•10^23 / mol)

Together gives
the equation for converting irradiance [W/m2] to quantum flux [µE]:
Ef = Np/NA = (E•λ•5.03•1015[1/(m2•s)])/(6.02•1017[1/µmol])
   = E•λ•0.836•10-2 [µmol/(m2•s)]

1 µMole of 555 nm photons = 0.2234 watts
Photopic Luminous Efficacy @ 555 nm = 147.2
147.2 x 1.036508469 µmol/w = 152.574 lm
152.574 lm / 0.2234 w = 683 lm/w
REFERENCES:
Light Emitting Diodes, 2nd Edition, E. Fred Schubert

candela (cd): The candela is the luminous intensity, in a given
  direction, of a source that emits monochromatic radiation of frequency
  540 THz hertz (555 nm) and that has a radiant intensity in that
  direction of 1/683 watt per steradian.
source The International System of Measuring Units

candela to lumen calculator
Photopic Luminous Efficacy, Relative Sensitivity Curve for the C.I.E. Standard Observer
Irradiance Conversion Factors
Answer: It depends on what spectrum of light you want. Our eyes are most sensitive to green light at 555 nm, so a perfectly efficient light source that only emitted that color would reach 683 lm/W. If you want to include other colors (say, to get white light), you'll need more power for the same apparent brightness. Wikipedia has a great summary at https://en.wikipedia.org/wiki/Luminous_efficacy. Depending on how closely you want to match daylight in appearance, the theoretical maximum efficacy is somewhere between 251 and 348 lm/W.
Comment: @Misunderstood I don't think that's correct. 1 candela is indeed (for 540 THz light) equivalent to 1/683 W/sr, and 1 lm = 1 cd * 1 sr, so a 540 THz source emitting over a solid angle of 1 sr with an intensity of 1 cd would be emitting 1 lm, and radiating (1/683 W/sr) * 1 sr = 1/683 W, for an efficacy of 683 lm/W.
Comment: @Misunderstood But to get 683 cd over a full sphere takes 12.566 watts, so it cancels out. 1 watt only gets you 683 cd over 1 steradian.
Comment: 1 candela = 1/683 watt per steradian, not lumen.  Conversion from candela to lumen requires the apex angle of the steradians.
Comment: 1 watt = 683 cd, 1 cd @ 360° = 12.566 lm,  683 cd = 8583 lm.  See the candela to lumen calculator at https://www.rapidtables.com/calc/light/candela-to-lumen-calculator.html.  Use 360° (4 x pi x r) for full spherical surface area.  Use 683 cd.
Comment: You are correct.  I need to find the errors in my math.  Okay found it.  I was off 1 decimal point for the number of electrons in a coulomb.  I multiplied by 12.566 which was converting from lux to lumens when I already had lumens, where I should have divided by by .22 which is the number of watts in a µMole @ 555 nm.   That got me 693 lm/w but .22 was rounded.  My big mistake was converting lux to flux when I already had flux.   Thanks for setting me straight.
Comment: Your statement is only half way correct. Our eyes are more sensitive to 555nm if speaking about PHOTOPIC vision (DAYLIGHT). When speaking about SCOTOPIC vision (NIGHT TIME) is 507nm. And MESOTOPIC vision the wavelength is 528nm.
Answer: 1 cd = 1/683 W/sr = 4π/683 W/sphere = 4π lm ⇒  1 W = 683 lm then
the maximal, theoretic efficiency is 683 lm/W.
D. I.


Is dark matter (if any) the reason why we even exist?

Question: If we were to model a universe without any dark matter in it, would stars and other large scale cosmic structures (galaxies or clusters) form in timescales similar to our universe? Or would they never form at all?
Comment: I don't understand in what sense this question is "unclear". It's a simple question. The answer is yes, no, it depends, or we don't know.
Comment: Alternatives to GR (e.g. MOND or $f(R)$- gravity) lead to galaxy & star formation as well....
Comment: Maybe it could do with some extra motivation, i.e. @user6760 could say what inspired the question.
Answer: The answer is, it depends. If you take the usual $\Lambda$CDM model and then remove the cold dark matter, then no, you wouldn't get the same universe at all. In fact the dark energy would dominate the energy density of the universe at an earlier time and the structures - galaxies, clusters of galaxies - we see in the universe today may not be able to form from the primordial fluctuations that we see evidence for in the cosmic microwave background. In fact those fluctuations are primarily due to dark matter (in the $\Lambda$CDM model) so the growth of structure would be starting from an even lower base.
The key question is I suppose do things like galaxies etc. form at all, or do they just take longer to form? My understanding is that in order to grow into the galaxies, clusters and superclusters that we see today, without dark matter, then the CMB fluctuations would need to be more like 1 part in a 1000, rather than the 1 part in 100,000 that are observed - and this is without considering dark energy, which will act to make structure formation more difficult.
The reason I started the answer with "it depends", is that there are alternatives to $\Lambda$CDM, namely the modified gravity theories such as MOND, MOG and TeVeS, which do away with the idea of dark matter and modify General Relativity at large scales and small accelerations. The most vanilla versions of these theories fail to explain structure formation in a satisfactory way, especially at large scales (e.g. Starkman 2011) but more complex versions are possibly still competitive
(e.g.Dodelson & Liguori 2006)) - I will leave others to comment on that.


Why are all my photos shot with a M38 Kodak Film Camera coming out super dark?

Question: I bought the Kodak M38 off of amazon for an easy point and shoot, but all my photos came out super dark and I obviously can't control the exposure. Can I do anything or is it just a bad camera? What can I do?
Answer: I wouldn't call this a "bad" camera, per se, but it's certainly a cheap camera.
There's some information on your camera here:
https://kodak.sinopromise.com/kodaklicensingproducts-filmM38.html
As far as I can understand from the specifications listed, the exposure is fixed at 1/120 second @ f/10. A fixed exposure means that your camera doesn't adjust for the actual light conditions, rather, it is exposing the film for a particular fixed level of light.
f/10 @ 1/120 second is roughly the right exposure for the following conditions:

EV 14 light levels – if you are using ISO 100 film
EV 13 light levels – if you are using ISO 200 film
EV 12 light levels – if you are using ISO 400 film
EV 11 light levels – if you are using ISO 800 film
EV 10 light levels – if you are using ISO 1600 film
EV 9 light levels – if you are using ISO 3200 film

And these EV levels approximately equate to:

EV 14: Subjects in weak, hazy sun.
EV 13: Subjects in cloudy-bright light (no shadows).
EV 12: Subject in open shade or heavy overcast.
EV 11: Sunsets. Subjects in deep shade.
EV 10: Landscapes and skylines immediately after sunset.
EV 9: Landscapes, city skylines 10 minutes after sunset. Neon lights, spotlighted subjects.

If you stick to these shooting scenarios, then at least your photos shouldn't come out dark. (But they won't come out sharp with this camera's cheap lens, one way or the other.)
The above information is for photography without flash. Since the camera has a flash, then in theory you should be able to work in darker scenarios, and light close subjects (1 to 3 metres away) with flash. But I really wouldn't expect to be "wowed" by the results – as I said, this is a very cheap camera (cheaply made, certainly).
Comment: If I was going to try to have some fun with this camera, I'd try some Ilford Delta 3200 black & white film in it. I know the specs say that the camera takes ISO 200 or 400 film, but there's nothing stopping you from loading faster (more sensitive) film. So I'd just experiment like that, and I think the grain from the fast film could add something to the "lo-fi" aesthetic. Note that Ilford Delta film doesn't use the C-41 development process, but rather needs specialised B&W development, but you should be able to find places to do it relatively easily (possibly by mail order).


About Netflow Collector in packet tracer

Question: How Netflow collector works in packet tracer to analyze the different parameters like counter bytes and counter packets
Comment: Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you can provide your own answer and accept it.
Answer: NetFlow collectors work by receiving and collating NetFlow updates, and in general will keep a local connection table to mirror the connection table on the router side. Counters for bytes (or octets) and packets are sent by routers configured to keep tabs on data flows and summarize the volumes in periodic updates; this is distinct from a packet capture containing the details of each packet, and is much more compact.
The tables on each side use an explicit tuple of sending IP, receiving IP, protocol, and (for appropriate protocols) sending port and receiving port. This identifies the communication sufficiently that when the byte counters and packet counters are received as part of a datagram, they can be matched to the correct conversation with reasonable accuracy.
There's also an implicit factor of time: these tables are of finite size, and the oldest entries (the ones that have been updated least recently) will get pushed out periodically in order to make room for records of conversations that are still on-going. If another packet comes in later matching the same hosts/protocol/ports, it gets noted as a new conversation.
You're probably using Cisco equipment, given the use of Packet Tracer, and so you should have a look at how Flexible NetFlow is configured on those platforms. Note that some of those fields are marked "match" and some "collect". The "match" fields are must-have, and you'll see that they match the identifying tuple I mentioned. The others are "collect" and you'll see from that example that there are a lot of other fields that can be sent alongside byte and packet counts for analysis -- which means that there are a lot of potential combinations that can be sent. In the Flexible NetFlow format, which uses NetFlow v9, template datagrams are sent periodically to tell your NetFlow collector how to read the actual data being sent in the other datagrams.
The important thing to realize when looking at that configuration is that there's no guaranteed "I'll get an update every X seconds" aspect -- update rates vary according to how busy the router is, and if UDP datagrams are dropped or delayed. As a result, byte and packet counter analysis is going to be at the mercy of when the data actually comes in if you're trying to do live analysis; you'll find that it's much more reliable in retrospect (even a few minutes afterward) when all of your data sources have reported in and filled in their byte/packet counts after-the-fact, and you're looking at totals for the whole conversation.


Why does 葛藤(갈등) mean 'conflict' or 'troubles'?

Question: I am learning Korean, and my dictionary gives an English meaning for 葛藤(갈등) as 'conflict' or 'troubles'. Why do these characters combine do give this meaning? Both characters seem to mean some kind of plant (although in each case, I'm getting varying definitions as to exactly which plant!)
Comment: Please check [this](https://zh.wiktionary.org/zh-hans/%E8%91%9B%E8%97%A4) out.
Comment: Note the same meaning also exists in Japanese.
Answer: The Wiktionary page for 葛藤 says:

Etymology: From the tendency of the vines of kudzu and rattan to become entangled.

No citation is provided, however.
The Korean Wikipedia page for 갈등 says something similar:

어원: 왼쪽으로 감아 자라나는 칡과 오른쪽으로 감아 자나라는 등나무가 서로 얽히고 설킨 모습에서 유래.
Etymology: It is derived from the shape of the wisteria that is wrapped to the left and the wisteria which is wrapped to the right and entwined to the right. (Google Translate)

Again, no citation is provided, unfortunately.
Answer: It's semantic extension.
The plant refers to a kind which forms entangled vines. This is extended to mean troubled, complex relationships or conflicts.
Answer: Conflict is a phenomenon in which an individual's emotion or motivation contradicts other emotions or motivations, and the expression is prevented.
You need to know the meaning of each letter in Korean.
It is a combination of "gal (葛)" meaning arrowroot and "deng (藤)" meaning rattan, and "conflict (葛藤)" refers to a state in which things are difficult to solve (狀態) due to a mess like rattan and rattan vines.


"Quick note" hot corner not working

Question: I have a hot corner turned on for quick note in lower right but nothing happens when I try it. Just installed Monterey yesterday. Is there something I might be missing?
Answer: I think I found a bug. So when an app on my second display has focus, the quick note does not work. If I give an app in display 1 has focus, quick note works.
Even weirder is that it does work the first time after giving an app on display 1 focus, but it starts working on the second try.
Comment: Sounds like a bug report…
Answer: I had same issue with second monitor. I went to hot corner settings in preferences. The right bottom corner was showing "quick notes". I changed it to some other option and then changed it back. Now it's working. Hope it helps you.
Answer: I just upgraded to Monterey and had this issue.  When I viewed System Preferences for Hot Corners, I see that the default hot corner to use Quick Notes requires that you hold down the Command key ⌘ before putting the cursor in the bottom right.  That worked for me.  I can also see why changing it to something and then changing it back to Quick Notes (without holding the Command Key ⌘ down would also work for people. :)
Answer: I had this problem, and it turned out to be a result of "On My Mac" notes being disabled. To fix it, I opened the Notes app, went to preferences, and clicked "Enable the On My Mac account". After this, the hot corner and shortcut keys worked to create quick notes.
Answer: I've just fixed it for myself so I made an account to share. You have to offset your displays in the display settings. For me, I have 3 monitors and I use the centre one as my main. In the settings, I raised monitors 1 and 3 slightly so monitor two has its own corners and voila, it works.
Answer: In macOS Monterey there is a default Hot Corner setup in System Preferences > Mission Control > Hot Corners… in the lower right Active Screen Corners for Quick Note.
When one brings the mouse cursor to the lower right cornet of the screen a small round-nosed square rises out of the corner, as show in the images below.
One must click on the small round-nosed square that rises out of the corner for the New Note to open.

Note that with the default wallpaper the small round-nosed square that rises out of the corner is almost not noticeable as it's dark in color.
In testing, a quick drag of the mouse to the lower right corner of the screen and clicking when the mouse got there opens Notes to a New Note.
If you do not see this small round-nosed square that rises out of the corner then I'd toggle the bit, so to speak, by turning off the Hot Corner and turning it back on by setting it to something else, e.g. - and then back to Quick Note.

Here is a screen shot with the light colored background for the wallpaper and the small round-nosed square that rises out of the corner is quite clear.
Comment: Thanks for the detailed graphics. Didn't help, though. See my answer. It may be a bug when running with two monitors.

"Quick note" hot corner not working


Receipt validation issue in App Purchases Mac Store "Receipt validation should be presented..."

Question: My applications uses the Store Kit API to purchases in app purchases. I am getting the following store rejection issue, has anyone ever encountered this?

2.3 Apps that do not perform as advertised by the developer will be rejected
The app is not using the Store Kit API properly. The application needs to use receipt     validation in order for Store Kit to properly
  process In App Purchases.

I inquired further and they said:

Receipt validation should be presented on launch of the app.

Anyone have any idea what the issue is?
Answer: See the following:
Mac App Store Receipt Validation Code?
This app is helpful as well but to pricy IMO:
http://receigen.etiemble.com/


remote desktop connection with win7

Question: I had OS win7 and I had problem when I connected to server from my PC by remote desktop connection I couldnot connect altought I managed all settings for connection any one help me.
Answer: You can check basic connectivity by pinging the server first, from the command prompt.  If the server is behind a firewall, confirm in the firewall settings that incoming RDP connections are permitted (TCP port 3389 by default).
Windows 7 uses a newer version of the terminal services client which can perform server authentication.  Check that you have set this (in Advanced settings) to "Warn me" or "Connect and do not warn me" if you're connecting to Windows Server 2003 or earlier.
If you're specifying a user name and domain, check that these are correct and that the user has authority to make RDP connections to the server, eg as a member of the appropriate group.
If you can post the error and more information about the environment then we could offer other help.
Comment: it didnot work I checked all but i didnot log to server
Comment: and how can i do that  If the server is behind a firewall, confirm in the firewall settings that incoming RDP connections are permitted (TCP port 3389 by default)?
Comment: You need to use the configuration tool for the firewall.  If it is a consumer firewall such as a broadband router, then there should be a web interface that you can use.  If it is not your firewall then you need to contact the person or company that manages it.
Answer: Also try remote access programs like RHUB, VNC, TeamViewer and LogMeIn. It is definitely a lot easier to set up. RHUB is my favorite out of all four since there's features like file transfer plus I also use it for web conferencing as well.

remote desktop connection with win7


$e^{e^{e^{79}}}$ and ultrafinitism

Question: I was reading the following article on Ultrafinitism, and it mentions that one of the reasons ultrafinitists believe that N is not infinite is because the floor of $e^{e^{e^{79}}}$ is not computable. I was wondering if that's the case because of technological limitations, or whether there is another reason we cannot find a floor of this number.
Comment: I am not sure what they mean by not computable. Different numbers have different representations. If you pick the base exp(exp(exp(79))) then the floor is 10.
Comment: @John: I don't understand your comment. The floor of a number is defined as the greatest integer not greater than the number, and it is independent of the base. The floor of $\pi$ is always 3; it doesn't become 1 just because you choose base $\pi$.
Comment: That's not my question Ross, it was asked by Carl Mummert.
Comment: @John: Further, computable is usually defined with respect to a fixed base (say, base $2$). If you want to say "the number is $10$ in base $\lfloor e^{e^{e^{79}}} \rfloor$", that is fine as long as you can properly specify the latter number — the base. Now you're back to your original problem.
Comment: @RobertMastragostino: As I wrote above, the usual *definition* of "computable" is wrt a fixed base, like base 2 or base 10. To say that a number is computable, you must be able to give the base-2 (or base-10) representation of the number. Otherwise it leads only to nonsense. E.g. although [Chaitin's constant Ω](http://en.wikipedia.org/wiki/Chaitin%27s_constant) is not [computable](http://en.wikipedia.org/wiki/Computable_number), you could say it is "1.0 in base Ω". All numbers would be computable if you could cheat like that; the question of "computable" would become meaningless.
Comment: "I was wondering if that's the case because of technological limitations, or whether there is another reason we cannot find a floor of this number." - The first one I believe; it certainly overflows on most computing environments.
Comment: @Ross Millikan: I will explain in my answer.
Comment: In your other question you say that in this one you have to assume $e^{e^{e^{79}}}$ is not an integer, but I don't see why.  We know it's not, but without a general principle we won't prove it.  But even if it were, we couldn't compute it.
Comment: @ShreevatsaR, but if you pick base $2$ then the floor of $\pi$ is $11$ *in base 2*. The number is independent of the base, but how it is written (and so in a certain sense whether or not it is computable) is not.
Comment: [Strongly related](http://math.stackexchange.com/questions/55894/ultrafinitism-and-the-denial-of-existence-of-lfloor-eee79-rfloor), [somewhat related](http://math.stackexchange.com/questions/531/what-is-ultrafinitism-and-why-do-people-believe-it?rq=1).
Comment: @ShreevatsaR $\Omega$ is not an integer, so can't serve as a base. On a different note, I could reply to your objection above by saying I'm using base $10$ (which is true whatever base I'm actually using.) Put another way, how do you object that I have computed this number if I happen to be using base $[e^{e^{e^{79}}}]$?
Comment: @FanZheng Bases don't have to be integers; see Wikipedia articles on [Non-integer representation](https://en.wikipedia.org/w/index.php?title=Non-integer_representation&oldid=674191855) and [base-φ](https://en.wikipedia.org/w/index.php?title=Golden_ratio_base&oldid=681151898). For the rest, I've already explained the issue in my previous comments; I don't know which part is unclear. You might also want to look at [this question](https://math.stackexchange.com/questions/166869/is-10-a-magical-number-or-i-am-missing-something) which is about the "every base is base 10" joke.
Comment: @FanZheng Both [computability](https://en.wikipedia.org/wiki/Computable_number) and [bases of number systems](https://en.wikipedia.org/wiki/Non-standard_positional_numeral_systems)  have a universally accepted definition in mathematics so arguing about that seems a bit futile.
Answer: In the formal meaning of "computable" the floor of that number is indeed computable. This is to say that a patient immortal human with access to unlimited paper and pencil could, in principle, work out the answer. (Here I assume, for technical reasons, that the number in question is not an integer - I assume someone who knows enough number theory will be able to cite a result that implies this.)
The article linked makes the weaker claim that the value has not yet been calculated, which seems likely to me. The issue they are concerned about is that humans are not immortal and that our supply of paper is very limited. If the number of decimal digits in the value is too large, it would be impossible to actually represent it in any physical way within our universe.
In general, I think it is more accurate to say that ultrafinitists don't accept that the set of all natural numbers is a coherent entity - not that they think it is finite. However, as the article you linked alludes, it is very difficult to find a coherent but non-arbitrary way to say what natural numbers are without accepting that there are an infinite number of them.
Addendum Here is why I am worried whether $e^{e^{e^{79}}}$ is an integer. It's certainly correct that no matter what, the floor of that number is an integer and is therefore computable. That part of my argument is fine.
On the other hand, if $e^{e^{e^{79}}}$ is not an integer, then I can tell you a specific algorithm to use to compute it. Namely, compute better and better upper and lower bounds until they fall strictly between two consecutive integers (which they must, since their limit is not an integer) and then pick the smaller of those two integers.
If $e^{e^{e^{79}}}$ is an integer, then that algorithm won't work, because it will never stop. But if we knew that $e^{e^{e^{79}}}$ was an integer then we could take better and better upper and lower approximations until they straddle a single integer, and then pick that.
So the reason that I am interested whether the number is an integer is that, beyond merely knowing that the floor is an integer, I'd like to know which algorithm could be used to compute it.
In any case, I don't think that the point of the example was to pick a number that is not known to be integer or known to not be an integer. The point of the example should be to pick a number which is simply too large to represent physically.  I was hoping that someone would have a quick answer that confirms $e^{e^{e^{79}}}$ is not an integer, so I could edit my response with that info. But the non-integer property seems more difficult than I thought.
Comment: Why do you need that assumption? If the number in question *were* an integer, its floor (i.e. itself) would still be computable. So it remains compatible with the argument you're making.
Comment: Thanks, your addendum makes a lot of sense. The crux of the matter seems to be that a discontinuous function of a computable number is not necessarily computable (I think?). So you can in principle compute $\lfloor e^{e^{e^{79}}} \rfloor$ because it is an integer and therefore trivially computable, but you can't necessarily compute it by computing $e^{e^{e^{79}}}$ and taking the floor of the result.
Comment: Yes, that's the issue. The floor function would be computable if you already had a decimal expansion for the real number, but if all you have are arbitrarily good rational approximations of a real then you also can't compute the decimal expansion in any uniform way. It's a matter of what representation you use for computing real numbers.
Comment: nitpicking: "ultrafinitists don't accept that **the set** of all natural numbers is a coherent entity". The finitists do not accept this also. The ultrafinitistic positions are more conservative than this.
Comment: @Carl: You don't know the floor of "0.999..." unless you either find a digit that's not 9, or you have a proof that your source of decimal approximations will give a 9 in every digit. Decimals make a bad model for computable reals; e.g. how do you output even the first digit of "0.000... + 0.999..."?
Comment: Thanks, this clarifies the issue quite a bit.
Comment: @Rahul Narain: I explained my motivation in an addendum to the answer.
Comment: I know very little about computability so I may be way off base here, but could you circumvent the issue by interleaving the two algorithms? ie, if algorithm $A$ computes the floor of this number provided it is not an integer, and algorithm $B$ computes its floor provided it is an integer, then could you form a new algorithm $C$ by alternating between computing a step of $A$ and a step of $B$? then, since the number either is or isn't an integer, $C$ would be guaranteed to terminate, right? (+1)
Comment: hi Carl, sorry for the double comment, but I am bumping my earlier comment; I hope that's alright.

$e^{e^{e^{79}}}$ and ultrafinitism


Is there a mental disorder in which one is unable to determine personal preferences, and as a result, is a cause of great distress?

Question: I know that our preferences and tastes help shape our behaviors and what activities we willingly engage in, but I also know that being faced with indecision is a common feature of the human experience. However, I wanted to know if there is a mental disorder classified in the DSM or elsewhere, where an individual's indecisiveness is so great that it prevents one from settling into an identity and determining what hobbies, interests, aesthetic preferences, etc. to pursue, and as such, causes a large amount of distress and significantly impacts said individual's life?
Comment: Welcome to Psychology.SE. We work differently to most SE sites, where we have a strict policy that all questions should [show evidence of prior research](https://psychology.meta.stackexchange.com/q/993). Please help us to help you and [edit] your question to provide more information on what you have read on this subject, what made you ask this question, and any problems you are having understanding your research. If you found nothing, what did you Google? This helps to provide an answer which will be more helpful.
Answer: There is no specific symptom criteria in DSM that matches your description. It's a very general problem that can be conceptualized in a variety of ways.
The closest thing I can think of that resembles your description would be generalized anxiety disorder (GAD). Dugas and Ladoceur claims in their research that the main underlying factor causing GAD is intolerance for uncertainty (IU), which - among several things - increases anxiety in decision making. IU paired with another factor for GAD - cognitive avoidance - causes tendencies to avoid difficult decisions completely, or dealing with decisions with excessive worry.
https://www.ncbi.nlm.nih.gov/m/pubmed/11142548/
Please bear in mind that proper assessment and diagnostic requires a face to face consultation with a licensed specialist.
Comment: +1 for a good and referenced answer; however, when providing references, rather than just providing a link, can you please provide a full reference **with doi and pmid/pmcid numbers** which work like ISBN numbers. This way, the answer is more easily read and understood, plus if the link breaks for any reason, the article can still be found. I have noticed this with other answers you have provided. [Please see this meta post](https://psychology.meta.stackexchange.com/q/8) for preferred referencing methods.
Answer: I was diagnosed with ASP a couple years ago. I'd say I have a big problem with this. I think there are various forms of poor awareness of ones own preferences. In my case I think there's Alexithymia.
A few years ago I was visiting my parents and feeling very uncomfortable, but hadn't realized it. My mom asked me for hep with the trash. When we were outside she asked if I was all right. For a second I wondered what she could be talking about. Then I realized, I was feeling miserable. My dad was very sick and my sister was having a manic episode. It was really getting to me and mom had to point this out to me.
There have been many other cases where I was bothered by something, people across the room were aware and I wasn't.
I don't qualify for Dependent Personality Disorder, but I score pretty high on assessments for it. One of the problems is ignoring your own preferences or boundaries for the sake of others.
Doubtless there are other conditions.


Wpf control size to content?

Question: How do I make a WPF control to change its size according the content in it?
Answer: For most controls, you set its height and width to Auto in the XAML, and it will size to fit its content.
In code, you set the width/height to double.NaN.  For details, see FrameworkElement.Width, particularly the "remarks" section.
Comment: In addition a lot of controls set their Horizontal- and VerticalAlignment to Stretch which will cause them to fill an available area so you will probably need to specify these properties, e.g. HorizontalAlignment="Left" VerticalAlignment="Top".
Answer: I had a problem like this whereby I had specified the width of my Window, but had the height set to Auto.  The child DockPanel had it's VerticalAlignment set to Top and the Window had it's VerticalContentAlignment set to Top, yet the Window would still be much taller than the contents.
Using Snoop, I discovered that the ContentPresenter within the Window (part of the Window, not something I had put there) has it's VerticalAlignment set to Stretch and can't be changed without retemplating the entire Window!
After a lot of frustration, I discovered the SizeToContent property - you can use this to specify whether you want the Window to size vertically, horizontally or both, according to the size of the contents - everything is sizing nicely now, I just can't believe it took me so long to find that property!
Comment: When the problem applies to the top level window Set SizeToContent="WidthAndHeight". I lost hours on this one - it's not intuitive! See http://stackoverflow.com/questions/812079/window-heightauto-problem
Comment: Although a `Window` is a `Control`, I think the OP was referring to a `UserControl`, which doesn't have a `SizeToContent ` property. Otherwise the OP would use the term "Window" in the subject.
Answer: I had a user control which sat on page in a free form way, not constrained by another container,  and the contents within the user control would not auto size but expand to the full size of what the user control was handed.
To get the user control to simply size to its content, for height only, I placed it into a grid with on row set to auto size such as this:
<Grid Margin="0,60,10,200">
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
    </Grid.RowDefinitions>
    <controls1:HelpPanel x:Name="HelpInfoPanel"
                         Visibility="Visible"
                         Width="570"
                         HorizontalAlignment="Right"
                         ItemsSource="{Binding HelpItems}"
                         Background="#FF313131" />
</Grid>

Answer: If you are using the grid or alike component:
In XAML, make sure that the elements in the grid have Grid.Row and Grid.Column defined, and ensure tha they don't have margins. If you used designer mode, or Expression Blend, it could have assigned margins relative to the whole grid instead of to particular cells.
As for cell sizing, I add an extra cell that fills up the rest of the space:
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>

Wpf control size to content?


How to select layer of .shp format by attribute using ArcPy?

Question: I have to first load a vector layer (in .shp format) in arcmap and then it should select to specific attribute (the name of attribute is taken as input from user which i have done). and only selected attribute layer should be visible.
All this should be done using python.
So how can I do this?
I have done this code snippet
import arcgisscripting
import arcpy
gp = arcgisscripting.create(9.3)
gp.workspace = "E:\boundary"
sFile = "E:\boundary\sample.shp"
lyr = "layer"
gp.makefeatureLayer_management(sFile, lyr)
gp.toolbox = "management"
gp.SelectLayerByAttribute_management("layer", "NEW_SELECTION", " 'DNAME' = 'NAME' ")

#now zoom to selected feature
mxd = arcpy.mapping.MapDocument('CURRENT')
df = arcpy.mapping.ListDataFrames(mxd, "Layers") [0]
df.zoomToSelectedFeatures()
arcpy.RefreshActiveView()

but it is throwing an error
Runtime error  Traceback (most recent call last):   File "", line 7, in  ExecuteError: ERROR 000732: Input Features: Dataset E:oundary\sample.shp does not exist or is not supported.
Answer: In your code you have not specified the pathname to your shapefile correctly.
Instead of:
sFile = "E:\boundary\sample.shp"

try:
sFile = r"E:\boundary\sample.shp"

This should make the 000732 error disappear.


Type of friction on circular road

Question: Why is the friction static while driving a car (at constant speed) on a horizontal circular road? Please explain in details.
Comment: Does this answer your question? [Direction of friction when a car turns](https://physics.stackexchange.com/q/87976/)
Comment: https://en.wikipedia.org/wiki/Circular_motion
Answer: Suppose you have a mass connected to the end of a string. You swing the mass in a circular horizontal path at constant speed. You feel a force pulling on your hand. Per Newton's third law that force is equal and opposite to the force that the string is applying to the mass. That force is called the centripetal (center seeking) force acting on the mass and is responsible for the circular motion of the mass. It causes the mass to have a constant acceleration towards the center. If the string was cut, the mass would fly off in a straight line, per Newton's first law.
Now let the mass be the car moving at constant speed in a circular path on a level road. There is no string connecting the car to the center of the circular path. So what force is responsible for keeping the car in the circular path? What is the source of the necessary centripetal force? It is the force of friction between the tires and the road.

I needed where is the car trying to move radially outwards since
friction opposes the relative motion,please help me with this

The car is not trying to move radially outward. It tries to move in a straight line. Before the car attempts to turn it is moving in a straight line at constant speed, i.e., constant velocity. It will continue to move in a straight line unless acted upon by a net force. Per Newton's first law: an object at rest stays at rest and an object in motion stays in motion with the same speed and same direction unless acted on by a net force.
If there were no friction between the tires and the road, turning the steering will will not result in the car turning (the tires will slide on the road). In order for the car to be able to turn some force is needed directed radially inward. The only available force is the static friction force directed radially inward.
The centripetal force is not opposing any radial outward force. The radially outward force the appears to occur in the non-inertial frame of the vehicle is a pseudo or fictitious force called the centrifugal force.  In the inertial frame of the road the only force acting on the car making it turn is the centripetal force, the static friction force between the tires and the road.
Hope this helps.
Comment: I needed where is the car trying to move radially outwards since friction opposes the relative motion,please help me with this
Comment: @Muzammilahmed I updated my answer. Hope it helps.
Answer: The car takes the corner because its wheels are turned (by the steering mechanism) at an angle to its direction of motion. There is still rolling resistance that is trying to slow the wheels down, but this is overcome by the car's engine which exerts a rotational torque on the wheels via the gearbox and transmission (just as it does when the car is going in a straight line). But the inertia of the car is now trying to move the wheels sideways as well, and this gives rise to an opposing sideways friction force (parallel to the axis between the wheels) which is much greater in magnitude than the rolling resistance. It is this sideways friction that provides the centripetal force that changes the car's direction of motion. Of course, if the car's speed is too high, the sideways friction will not be sufficient to turn the car and it will skid off the road.
Answer: I completely agree with the wonderful answer of @Bob D sir.
However I would like to add a few things to help your understanding even better.
First of all,what a lot of people seem to believe is that friction always opposes motion.This is not true.Friction may also help in motion. Eg We can walk only because friction pushes us forward when we push our feet back against the ground.
Friction is helping the motion here in circular motion,too.
Secondly ,as @Bob D sir pointed out, we need a centripetal force here and the only possible source is the ground reaction to the tyres. This ground reaction is by definition called as friction force. Notice that I am laying stress on 'by definition'.
P.S. The horizontal component of ground reaction is called friction and the vertical component is called normal force.

Type of friction on circular road


Shoring up drainage culvert slope

Question: I just bought a new house, and the drainage culvert out front along the road has several areas where the slope has collapsed, resulting in what looks like a miniature landslide landscape. What is the best way to shore this up to improve the aesthetics without causing drainage problems?
Comment: What kind of soil is that?  If you don't know, look at your extension service's or soil conservation service's map of soil types for your location.
Answer: Your pictures appear to show a steeply sloped section with erosion, a flat section, and another sloped section (without erosion.) If the flat section resulted from poor compaction of an original sloped profile that did not have the flat part, you may be able to simply fill that back in so the slope is not as steep. If you want to keep it in mown grass, that might be the best bet.
Otherwise, "rip-rap" or fairly large rocks are arguably the standard method of holding a steep drainage slope.
Comment: It's supposed to be sloped from the top of the eroded section to the bottom of the ditch.  Looking down the ditch along the intended flow of water,it's supposed to look like a V, with the sides at about 45 degrees, and relatively flat up to the inflection point.

Shoring up drainage culvert slope


Why does the speed of sound decrease with increase in density?

Question: In my book it's written that speed of sound will in increase with increase in density of the medium as molecules with get closer to each other, but after some browsing on internet I found out about Laplace's formula which states that speed of sound in a medium is inversely proportional to density of the medium?Which of these is correct and why?
Comment: What medium? Gases or solids?
Comment: Have a look at these values: https://www.aplustopper.com/speed-of-sound-in-various-substances/
Comment: @JohnRennie can you pls explain this for all the mediums
Comment: None of your statements are valid.  The speed of sound goes like the inverse of the square root of density of the medium.
Answer: The speed of a sound wave (a longitudinal wave) in a gas can be shown, using Newton's second law, to be given by
$$v=\sqrt{\frac{\gamma p}{\rho}}$$
in which $\gamma =\frac{\text {molar heat capacity at constant pressure}}{\text{molar heat capacity at constant volume}}$
$\gamma =1.4$ for diatomic molecules such as oxygen or nitrogen.
$p$ is the pressure and $\rho$ is the density.
At first sight you might say that the equation shows the speed of sound in (let's say) a diatomic gas to be inversely proportional to the square root of the density. This would be true if we had a cylinder full of nitrogen (relative molecular mass 28), and then replaced the nitrogen with oxygen (relative molecular mass 32) at the same pressure. The speed of sound in the cylinder would drop by a factor of $\sqrt \frac {28}{32}$.
But suppose that we didn't change the gas, but squashed it into a smaller volume by pushing in a piston very slowly so that the temperature change was negligible. It's easy to see that
$$\frac{\text{new density}}{\text{old density}} =\frac{\text{old volume}}{\text{new volume}}$$
and from Boyle's law, that
$$\frac{\text{new pressure}}{\text{old pressure}} =\frac{\text{old volume}}{\text{new volume}}$$
So the speed of sound would be unaffected by such a compression!
But we could increase the pressure without changing the density by increasing the temperature of the gas in the cylinder without changing its volume.
We can then see from our equation that the speed of sound in the gas will increase. [This makes sense because molecules at a higher temperature have a greater random speed and will on average move faster between collisions, so passing on faster the superimposed velocities that represent the sound.]
Answer: In that answer for elastic field in a solid, you can see that the density is multiplying the time derivative of the displacement: $$\rho\frac{\partial^2 u_x}{\partial t^2}$$
The second derivatives of the displacements with respect to position are in the left side of the equations.
So, the differential equations show that the wave velocity is proportional to the inverse of density.
Intuitively, it is because the acceleration is smaller for the same force, as mass increases, and density is related to the atomic weight per volume. The materials are not compressible.
It is different for gases because they are compressible. Increasing the density, the number of molecules per volume also increases. The average speed of the molecules are function of temperature, and doesn't change with the bigger density. So, the probability of interaction between molecules increases, what is necessary to propagate the sound.
Answer: The speed of sound goes like the square root of stiffness/density.  Thus, if the density increases and the stiffness doesn't change much, the speed of sound will decrease as you divide by a smaller number and thus take the square root of a larger number.  In air the stiffness doesn't change as quickly as density (with temperature) so the increase in density "wins" over the change in stiffness.
Note that keeping stiffness in mind is important: solids have a higher density than air but also much higher stiffness, resulting in greater speed of sound.


who can give me a example of coherent sheaf

Question: What are examples of coherent sheaves $\mathfrak{F}$ on a compact complex $n$-fold with $\dim \operatorname{Supp} \mathfrak{F}=p$ , where $0\leq p \leq n$ ? And how can they be described in local coordinates under the equivalence with vector bundles?
Comment: This is equivalent to the question whether for every $p$ there is some closed subvariety of dimension $p$ (because if you have one, take the corresponding ideal sheaf $I$ and $\mathcal{O}_X / I$ is a coherent sheaf with the correct suppoert). I don't know if this is true.
Comment: I edited your question slightly. For the original question, "Who can given me an example of ...?", a perfectly valid answer would be "I can".
Answer: Coherent sheaves are much more general than vector bundles. A vector bundle corresponds to a locally free sheaf; the support of such a sheaf is the whole variety.
If $X$ is your variety, of dimension $n$, and $Y \subset X$ is some closed subvariety of $X$, and $\mathcal{F}$ is some sheaf on $Y$, then there is a coherent sheaf $\mathcal{G}$ on $X$ whose sections over an open set $U$ are the sections of $Y$ on $U \cap Y$ (this is the "extension of $\mathcal{F}$ by 0"). If $\mathcal{F}$ is locally free (e.g. if $\mathcal{F}$ is the structure sheaf of $Y$ itself) then the support of $\mathcal{G}$ is precisely $Y$. This gives a nice supply of coherent sheaves whose support is easy to understand.
Comment: think kernels and cokernels of maps of vector bundles.
Answer: Take an affine patch $S\subseteq X$, then $S\hookrightarrow\mathbb{A}^N\subseteq \mathbb{P}^N$ for some $N\geq n$. Now take a (generic) hyperplane section of $S$ in $\mathbb{P}^n$, this will have dimension $n-1$. Let $Y$ be the closure of this in $X$, then $Y$ is a codimension 1 closed subvariety of $X$. Re-applying the process enough times to $Y$ itself will give you a closed $p$-dimensional subvariety $Z$ of $X$. The ideal sheaf $\mathcal{I}_Z$ is then a coherent sheaf on $X$, and the sheaf $\mathcal{O}_Z:=\mathcal{O}_X/\mathcal{I}_Z$ is coherent and supported on $Z$.
Note that this method cannot be applied to general complex analytic varieties.


Do you categorize the root cause of bugs?

Question: In order to have better view of the quality of defects, instead of measure using numbers of defects (which can be manipulated), can I measure the % of root cause.
Example codes problems, missing use cases, missing test cases?
Please share your experiences and thoughts.
Answer: This is a great idea, but not new. I have seen RCA (Root Cause Analysis) being done in several places, not as a replacement to other processes but as complementary. Most test management tools should easily support such categorization and analysis.
Having said that, this is not an easy task especially if you want it to be properly done. Similar initiatives tend to start with deep investigation of each bug, e.g. by asking five whys, and slowly end as being ignored or a very shallow reason for the failure is chosen.
Finally think of what do you want and can achieve, many times you will find out the the reasons for bugs are organizational and not easy to fix, "missing test cases" is usually a symptom to over stressed development, miscommunication or non aligned development processes.
Answer: Absolutely, categorizing the root cause of bugs is a valuable practice in software testing and quality assurance. It helps provide insights into the underlying issues that lead to the occurrence of defects and enables teams to address them effectively. Measuring the percentage of root cause categories can offer a more meaningful and informative perspective on the quality of defects rather than relying solely on the number of defects.
Here is a suggested approach to categorizing root causes:

Analyze Common Patterns: Examine the types of bugs that frequently occur in your projects and identify common patterns. This could include code-related issues, missing use cases, missing or inadequate test cases, configuration problems, data-related issues, or other relevant categories specific to your domain.

Define Root Cause Categories: Based on the identified patterns, establish a set of root cause categories that accurately represent the underlying causes of defects. It's important to have well-defined and mutually exclusive categories to ensure consistent classification.

Assign Root Cause Categories: When a bug is identified, analyze its root cause and assign it to the appropriate category. This can be done by conducting root cause analysis techniques such as reviewing code, analyzing requirements, performing impact analysis, and leveraging testing techniques like regression testing and exploratory testing.

Track and Measure: Maintain a record or database of categorized bugs, along with their respective root causes. This enables you to track the distribution of root causes over time and calculate the percentage of each category.

Use Metrics for Improvement: Utilize the root cause metrics to drive improvements in the software development and testing process. Identify areas that consistently contribute to specific root causes and take proactive measures to address them. For example, if missing use cases are a significant root cause, emphasize the importance of comprehensive requirement gathering and use case analysis.

By categorizing the root cause of bugs, you gain valuable insights into the strengths and weaknesses of your development and testing processes. It helps identify areas for improvement, enables targeted training or process adjustments, and guides decision-making regarding resource allocation and risk mitigation.
Remember, the effectiveness of categorizing root causes depends on the accuracy of the analysis and the consistency of categorization. Regular reviews and refinements of the categorization scheme may be necessary as new patterns and trends emerge.
Overall, by measuring the percentage of root cause categories, you can focus on addressing the underlying causes of defects rather than just the symptoms, leading to more effective quality improvements in the long run.

Edit:
Here are a few common ways to categorize the root cause of bugs:

Coding Errors:

Syntax Errors: Bugs caused by incorrect grammar or syntax in the code.
Logic Errors: Bugs resulting from mistakes or flaws in the code's logic or algorithms.
Data Type Errors: Bugs caused by using incorrect data types or performing incorrect type conversions.
Boundary Errors: Bugs occurring when code does not handle boundary values correctly.

Design Issues:

Architectural Flaws: Bugs resulting from design decisions that impact the overall system structure or behavior.
Poor User Interface Design: Bugs caused by user interface design issues that affect usability or user experience.
Inadequate Error Handling: Bugs occurring when error conditions are not properly handled or reported.

Environmental Factors:

Configuration Issues: Bugs caused by incorrect configuration settings or environment variables.
Platform Compatibility: Bugs occurring due to incompatibilities between the software and the underlying platform or dependencies.
Network or Infrastructure Problems: Bugs resulting from network issues, infrastructure failures, or external services not functioning correctly.

Data Issues:

Data Corruption: Bugs caused by data corruption or inconsistencies in the system's data storage or databases.
Invalid or Incomplete Data: Bugs resulting from incorrect or missing data inputs or data not meeting validation rules.
Data Integration Errors: Bugs occurring when data is not properly synchronized or integrated between different systems or modules.

Third-Party Dependencies:

Bugs caused by issues with third-party libraries, frameworks, or APIs used in the software.
Incompatibilities or Version Conflicts: Bugs arising from using incompatible versions of external dependencies.

Process or Workflow Problems:

Inadequate Testing: Bugs resulting from insufficient or ineffective testing practices.
Communication Issues: Bugs caused by miscommunication or lack of communication between team members or stakeholders.
Insufficient Documentation: Bugs occurring due to lack of proper documentation or outdated documentation.

You can always think of different ways to categorise.
Comment: thanks for the good input. For a relative new team (having new tester like myself), I only set 3 categories to segregated the bug (1. reproduable bug at every release - missing test in the past. 2. recurring - fixed but broke again, 3. regression - used to works but broke currently). The team has no such measurement in the past, the previous tester merely measure the quality by the bug counts which I am strongly disagree.
Comment: my potention issue could be development team might be inexperience to input a good "root cause categories" and "preventive actions". any suggestion what are the good categoies / labels which can be used to encourage them deep dive?
Comment: I've edited my answer to add a few ways to categorise root causes
Answer: Although the idea of performing root cause analysis is sound, I have yet to see a good categorization scheme. In my experience, trying to categorize root causes tends to yield categories that are too broad to be meaningful and useful or categories that are so fine-grained that they tend to be difficult to put causes into.
So far, my preferred approach has been to track proposed preventative actions and keep track of the number of RCAs that have proposed a given preventative action. Of course, the action itself may have a different impact on various incidents, but understanding that carrying out a certain preventative action would have mitigated or prevented a specific number of incidents can help prioritize which preventative actions to implement.
Answer: With more than 10 years of QA experience and association with a software qa consulting firm, I can certainly say that tracking and classifying the root cause of issues is one of the most beneficial practices in software testing.

During reporting and investigation, we have been employing this strategy as a drop-down in the JIRA tickets.
The drop-down is pre-populated with different reasons for DEV team selection.
Sharing a screenshot for the same with different categorization values for the 'root cause' type.

The tracking of the "root cause" of the issues gives us an understanding of the areas missed by the DEV team and improvements required in the development process.
Comment: exactly. the JIRA dropdown when closing a bug is optional to me. for instance, "Coding mistake" is too generic. I need for insight from developer on which component and area need to be careful handle. I just completed one session and it is very fruitful. at least I can see the rest of developers learnt from the problem maker, and aware of what to be caution in future.
Answer: In functional testing services, software testers report bugs every day. It's important to understand in which category the bug belongs.
Bugs can be caused by many factors, including:
Unclear requirements
Poor communication during development
Frequent changes to project requirements
Bad coding practices
Poorly documented code
Compromises made to save time
Lack of communication between team members
Poor requirements, architecture, or design
Bugs can be categorized bugs by analyzing common patterns. These patterns can include:

Code-related issues- Here are some common coding issues:
Repetitive code
Bad variable names
Not using comments
Language overload
Not backing up code
Complicated code
Not asking questions
Not planning in advance

Missing use cases: A missing use case is a use case that lacks interaction information, which can indicate missing requirements.
simple use case name may not sufficiently describe the use case details that affect the derived requirements

Data-related issues: Data-related issues can arise at any stage of the data entry process, from data collection to data integration.
Some data related issues include:
a.Data quality issues: These include:
b.Missing data: Can be caused by intentional or unintentional omissions
c.Duplicate data: Can skew business intelligence
d.Inaccurate data: Can be caused by human errors, such as misspelled names or wrong ZIP codes
e.Ambiguous data: Can be caused by misleading column headings or undetected spelling errors
f.Data governance: Poor data governance can lead to quality issues
g.Data format issues: Data can come from diverse sources with different formats and structures
h.Data security: More data means more opportunity for security breaches
i.Inconsistent data: Can be caused by missing data or inefficient data management

4.Out of bound bugs - Out-of-bound bugs are a type of software bug that occurs when a user interacts with the software in an unintended manner. These bugs can happen when a user:
Enters a value or parameter outside the limits of unintended use
Makes logical and arithmetic errors that exceed the allowable boundaries of a specified operation
Interacts with the software in a manner that is outside its logical capabilities
You can also classify bugs into multiple categories based on their nature and impact. These categories include:

Functional bugs
Logical bugs
Workflow bugs
Unit level bugs
System-level integration bugs
Security bugs
Syntax errors


What does GOAT or 'GOATing' mean?

Question: I've heard this a few times in Guild Wars 2, usually in the context of a PvP or WvW match.
Someone will be complaining that

There was too much goating in that match

or

That guy is a professional goat

What does it mean?
Answer: It's something I rarely hear, but associated with multiplayer online games (especially PvP in with objectives) it usually means scapegoating.
Now I haven't played a lot of GW2 but in WoW PvP or LoL matches you sometimes accuse someone of goating if he blames another teammate or his internet connection.
For the term "He's a professional goat"... well I've never heard that to be honest but I think it's someone who always blames others.
Answer: One suggestion I got from someone in-game was Greatest Of All Time
Indicating a player who was playing really well.
So

There was too much goating in that match

could mean there were several players in a PvP match that were untouchable.
I just can't remember what context I heard it in.
Comment: That was actually the full name of the guild I mentioned in my other comment :) so while their name was "greatest of all time",they did not seem to be THAT great.

What does GOAT or 'GOATing' mean?


magento 1 how can get images URL by images name

Question: How can I get an image URL from the image name?
Please provide me steps and also let me where need to keep code(folder or file location) to get URL.
Answer: You can't get product image by product name only. You need to load product by SKU or ID and then you can get the image details using the following code.
<code>$prdId = 35;
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$prdoduct = $objectManager->get('Magento\Catalog\Model\Product')->load($prdId);
$store = $objectManager->get('Magento\Store\Model\StoreManagerInterface')->getStore();

$productImageUrl = $store->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA) . 'catalog/product' . $prdoduct->getImage();
$productUrl  = $product->getProductUrl();
</code>
Comment: Magento 1+ I know only (/skin/frontend/default/default/images/color.jpg), now just want to know where in the frontend pages this images displaying.


How to detect if files were saved or copied to a USB drive?

Question: How can I find out if files from my computer were written/copied/moved to a USB storage device? I want to know if there is a solution that would work in a system that has not got any monitoring/logging of USB activity explicitly enabled and after the files have already been written.
I have already used software which would reads the information from registry location

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USBSTOR

But it just tells the vendor name, time connected and other artifacts.
Comment: Not sure if it directly answers your question, but you can get a copy of [Usb Security Suite](http://www.dynamikode.com/products/usb-security-suite/) and it logs everything happened on usb drives like copy, rename, delete etc.
The point is that, it only shows activities happened AFTER installation of the tool :(
Answer: This will depend entirely on what logging you have enabled. It it's easy after the event to tell you to log all file copies etc, but if you weren't logging it, you won't be able to retrieve that info.
Comment: I used to run a forensic team, and while there are a lot of good pieces of info you can grab, with dating windows logging you are very limited in finding out what someone has done with a file if they copied it onto a USB stick. You can hunt down command history, but it is limited. Seriously, this info is just not stored anywhere by default. This is why we encourage people to enable logging and auditing.
Comment: No. Copying from a file is not typically saved on a windows system unless you have enabled logging or auditing.
Comment: EnCase and Helix can help you retrieve all the information you have on a disk, but they can't make that information from nothing. Sorry to disappoint you.
Comment: yes i know you have to enable local auditing on files. But there has to be some other way. The information must be saved in some meta-data?
Comment: Yeah thats what i said; but I mean what about encase and helix big forensic technologies?
Comment: I disagree you seems to put all your hope in windows auditing and like if there there is no place in computer memory or hard-disk where such attributes (as folders, files) can be copied.
Answer: First, try to get the information about the devices that were plugged into the computer from the following locations
<code>C:\Windows\inf\setupapi.dev

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Enum\USBSTOR
HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Enum\USB
</code>
Be very particular when checking the Mounted devices key as this information will be required in future analysis
Analyse NTUSER.DAT file associated to that particular user in question.  Go to NTUSER.DAT\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2 and search for the GUID of the device.
Module II:
If you use Encase or FTK search for key words (name of the file in question), analyse the .lnk files associated with the keyword. Parse the .lnk using FTK or Encase which will give you the path and the time stamp. If the path refers to a USB then try to match user's SID, USB serial number and the time stamp information.
You can even analyse MFT records and $Logfile which give you more information about the file structure.
Note: .lnk files will be created only the suspect opens the file in question from the USB drive.
Answer: Update 9-21-2013
If you are still looking into this, or want to go back to it, then you might be interested in listening to the CyberSpeak Podcast to hear about one forensic investigator's/firm's research.  I suggest you listen to the whole episode, but if you want to spot-check its relevance then I think that around 22:00/23:00 they say a few points that are relevant to your endeavor.
The tool, called Registry Recon, is a commercial tool and I can not vouch for it since I have not yet used it myself.  Pursue that at your own risk; however, I will point out the bullet-point claim in the release notes.

"[..] Reports USB Storage Devices (see when they were attached over time!) and RecentDocs"

Clarifications Regarding the Original Post
I have left the original post exactly as it was, but would like to say that I never meant to bash any commercial product nor do I intend to promote myself or any third party products I happen to mention.
I do not apologize for my sense of humor, but I do regret the possibility that I offended anyone.  Not that is important what you think of me; rather it is important for me to respect the culture and demeanor of this forum.  I do respect the community here and for that reason I apologize.
Thank you again, @Gilles, for your comments.
Original Post
I looked at a commercial offering called "Spector 360" that was talking about this exact scenario.  As you might imagine, it required agents to be installed onto each monitored computer.  Honestly, I was not happy with the system impact that the agents had on system performance.  Enabling auditing/logging also has an impact on system performance.  This is to be expected from pretty much any solution that is available to address the scenario you are describing.
Before I came across Spector 360, I knew of a Remote Administration Tool (RAT) that was being used to a small extent by criminals.  The company that creates it is legit and was not necessarily responsible for the criminals actions; my point is that there are a lot of RAT/Spyware/Monitoring applications that will provide the functionality needed to accomplish what you desire.  You should expect friction from AV installed on those systems though, no matter how legit the company that authored the application.  They are all capable of being used malevolently.
As for forensically looking for evidence... maybe, but that is a long shot.  I really wouldn't count on it.  There would be artifacts created if the system conditions were right.  Those artifacts would also be eroded according to the system conditions, usage, and time since the event.
Are you trying to determine if you have had some files stolen, or are you just wondering?  If it is the latter, then you should really turn your attention towards the logging/auditing solutions.  If you hand has been forced, you should just kill whom ever you suspect of stealing the files before they can distribute/deliver them.  Burring their living space and surrounding areas to the ground would give a little more assurance that any stolen data was destroyed.
Of course, my last suggestion is illegeal and I am only kidding about actually carrying out such drastic measures.  If you think you have had a security breach and want to talk it through with someone, you can contact me and I'll spend sometime helping you as much as I can.
Comment: While there are good things in your answer, a lot of it comes out as bashing a competitor product, with a bit of advertisement at the end (which isn't against the rule, but comes out a little odd, considering that this is a [questions and answers](http://security.stackexchange.com/about), not a discussion forum). The hyperbole might put some readers off as well. This could explain why your answer was downvoted. I suggest toning it down a bit.
Comment: @GuyHoozdis I really admire your advice on the subject. It was thorough and very informative. In my case (can't disclose it openly) but it relates to the high possibility of information copied from a sensitive machine into a USB-device. The victim machine in this case ; was not forensically sound or prepared to detect such instances occurrences. I'm not concerned of evidence and its admissibility issues I'm hoping someone could help me get some clues / evidence of this activity happening in the system.
Comment: Thank you for your feedback and insight @Gilles- I appreciate your candor.  Bashing was not my intention nor was self-promotion; however, I'm sure that you are right because if you perceived it that way then many others did too.
Comment: @Saladin, I'm glad you found some utility in my ramblings.  I did come across some new research in this area a few months ago- if my memory serves me.  It might be too late if I understand what "its admissibility issues" implies about your situation; then again, this research I'm referring to is new and if there is reason/opportunity for you to appeal any previous decisions I think this information would be useful.  I'll have to go look for an exact link, but I came across the information in a CyberSpeak podcast.  You can search for yourself if this is still relevant.
Comment: I just took a quick look and here are some links that reference what I was talking about

I suggest you listen to the whole episode, but I think around 22:00-25:00 will briefly mention how this relates to your situation.

  http://cyberspeak.libsyn.com/cyber-speak-feb-18-2013-recon-mission

The Tool, Registry Recon.  It is a commercial tool and I have not yet used it myself (pursue it at your own risk). I want to point out claim about USB devices in the release notes that is relevant to your situation; "see when they were attached over time"

  http://arsenalrecon.com/apps/#newReleaseNotes


Spike in inverter output waveform due to Cgd coupling

Question: So while analysing the waveforms, I have noticed spikes in the ouput during input transitions for gates like inverter, nand etc. and so I was asked to look up Miller effect to explain the phenomenon. After reading through the topic (how Cgd appears across the input and the output) I found that this is caused due to the capacitive coupling of the input to the output by the gate drain capacitance. I can neither grasp the theory behind this completely nor can I figure out how the spike decays back to the supply voltage after a few moments. Can someone give me a detailed explaination for this effect.
PS. this is what the waveform looks almost like except that the spikes appear when output switches to one and when it switches to 0 (opposite to the waveform) like:
Comment: How about a circuit diagram?
Comment: These kinds of spikes often indicate inadequate or too-far-away supply bypass capacitors rather than a Cgd issue.
Comment: you mean leading-edge overshoot in both polarities with a bridge driver or CMOS output?  load Impedance mismatch with inductance
Answer: In order to change the voltage across a capacitor, you need current:
\$i_C=C\frac{dv_C}{dt}\$
The capacitor \$C_{gd}\$ connects input to output. So if the input were to change instantaneously from 0V to VDD, the voltage over \$C_{gd}\$ would have to change from VDD (\$v_{out}=VDD, v_{in}=0V\$) to -VDD (\$v_{out}=0V, v_{in}=VDD\$) instantaneously. This could only happen if an infinite amount of current flows through the capacitor!
As the input suddenly rose from 0V to VDD, the NMOS transistor switched on, and the PMOS transistor switched off. As you may know, the NMOS transistor will be in saturation, and will sink a pretty constant current to ground. This current is far from infinite! And so the capacitor can only slowly decrease its voltage. Instantaneously, it should retain all its charges as it hasn't had time to lose them through the NMOS. So at the exact instance where the input switches, the output will have to follow by the same amount of voltage.
Instantaneously, output will jump up from \$VDD\$ to \$2\cdot VDD\$... if no other capacitances are present.
If there are capacitors connected to the output, then they will not like the output to be changed instantaneously because it would mean they need an infinite current as well. So \$C_{gd}\$ will have to "fight" over the output voltage with all other capacitances connected to the output (actually, the charges stored on the capacitances are redistributed, this redistribution of charges will result in an infinite instantaneous current).
The output voltage they will agree on will depend on the capacitance of those capacitors. In the end, this causes the output not to jump over the full \$VDD\$, but some smaller voltage.
You will see that if you increase the capacitance at the output, that the peaking will get smaller and smaller. Unfortunately, the slew rate at the output will also get smaller and smaller...
The following figure summarizes everything into one image. \$C_L\$ is the total load capacitance, which is the sum of all capacitances connected to a constant voltage.
Comment: This is by far the simple and best explanation I have got for this phenomenon. Thank you.
Answer: Examine this schematic of a CMOS inverter:

simulate this circuit – Schematic created using CircuitLab
Comment: The values of C1 and C2 that you have used in the schematic is giving me a large delay so I brought them down in femtos . Even then I don't understand the way the input is coupled to the output for such a small period. For the positive spike a part of the input is added to the output waveform but how is it that the output falls below zero during the other transisition.
Comment: Suppose the FETs have 100uA drive strength. Lets compute the C_gate_drain_overlap charge injection. Assume 0.1pF Cgd overlap, with 10 picosecond edge for 2 volts. What is the current? Q = C*V, I = C * dV/dT, and if I is greater than 100uA, the input has over-driven the output. Now lets compute the current flowing through the 0.1pF. I = C*dV/dT = 1e-13F * 200 Billion volts/second = 1e-13 * 2e+10 = 2mA. The displacement current through the Cmiller is 20X stronger than the Inverter output FETs.
Comment: Thanks a lot, it makes a lot of sense now. What you mean to say is that the 10ps transition of the input waveform is causing a comparatively higher drain current to charge the load capacitance, which results in the spike and when the input has stabilised to vdd after 10ps the current resulting due to Cgd is insignificant and so the spike dissapears. So Cgd plays a role only during the transition and can be ignored pretty much anywhere else?


Is this a common database design / OO Mapping technique?

Question: I've recently been asked to rewrite a booking system that was not performing as well as a client would like.  I've found the database schema / object mapping technique used to be quite unusual and was wondering if anyone else has come across anything similar.
The old system used about 25 classes for things like customers, appointments and orders etc, each of which has a unique property called 'class_id'.
When looking at the database, each class had a corresponding table, however none of them contained any foreign key fields although they had to be linked in some way as the application allowed the client to carry out various levels of reporting.
After further investigation, I noticed that the database contained another table called 'application_hierarchy'.
This table contained 4 columns which mapped out the relations between different records:

class_id - Which identified the record type
object_id - Which referenced the id of the record within its corresponding table
parent_class_id - Which identified the record type of the related record
parent_object_id - Which referenced the id of the parent record within its corresponding table

For example, if customer 5 has three different orders with id numbers 10, 11 and 12:
The Customer class was ID 4
The Order class was ID 7
So:
<code>class_id | object_id | parent_class_id | parent_object_id
7          10          4                 5
7          11          4                 5
7          12          4                 5
</code>
There would be a large number of rows in this table for every single object record in the application and these would be combined with a large join query to create the reports.
Trying to import this data into the new schema has been an absolute nightmare, mainly because the original author has neglected to document which class is identified by which id number!
Is this a commonly used technique or was the original developer just being a PITA?
Any advice / comments appreciated.
Thanks.
Answer: You might find you answer here : Stefan Tilkov: Thoughts on the Generic vs. Specific Tradeoff.