What patterns have been measured in the graph of the number of two-prime-sum representations of even numbers?

Question: There are remarkable patterns of density in the graph http://upload.wikimedia.org/wikipedia/commons/7/7c/Goldbach-1000000.png plotting the number of representations of even numbers up to a million as the sum of two primes. Has anyone measured these patterns? The referenced graph was uploaded in 2006. Given the enormous data bases of primes, it would seem to be a matter of simple checking of sums to generate the graph, with a complexity that grows not much more than linearly with the size of the even number. Thus, with the growth of computer power, some advance on a million might have been achieved over the past few years. Has this been done?
Answer: That link reveals that a certain heuristic but extremely plausible asymptotic formula is highly accurate at least up to $10^{10}$. That information tells us what a graph over a larger range would look like. So one knows certain patterns are there even if the graph is not drawn. (Maybe someone has drawn it, I don't know).
Roughly, the expected number of pairs is about $0.66\frac{n}{{\log}^2(n)}$ for a large number which is twice a prime. Multiply that by $\prod_{p|n}\frac{p-1}{p-2}$ to get the estimate for any even n (the product over odd prime divisors of $n$).
This explains these patterns (do you see others?): There should be a lower half very roughly hitting at $10^6$ from 3460 to 6700 and then an upper half from 6920 to 13400 about twice the lower part. The lower part is for 2 or 4 mod 6 and the upper for mutiples of 6. Numbers which are or are not multiples of 5 and/or 7 should create 4 bands in each half (I can't see much beyond that). Those patterns (including with more primes taken into account)continue very faithfully as far as calculated.
added information
The name "Goldbach's Comet" is probably not useful in finding extended computations. "Goldbach partitions" might do better. As far as I can tell the state of the art is
MR1850627 (2002g:11142)  Richstein, Jörg . Computing the number of Goldbach partitions up to $5\cdot 10^8$.
 Algorithmic number theory (Leiden, 2000),
 475--490, Lecture Notes in Comput. Sci., 1838, Springer, Berlin,  2000.
That paper does include a graph for the range $500500000 \le n \le 500660160$. The author no doubt has the data and could generate other graphs, but may not see any reason to. There are a number of observations in that paper about patterns. You might be better served by looking at color coded plots over short ranges (say according to congruence class mod 30 or 210). for example a plot over a modest range colored mod 6 shows that the top is all of the $0 \mod 6$ and nothing else (of course) BUT it also shows that the very bottom boundry is heavily in favor of $2 \mod 6$ leading me to pose this question.
Comment: Thank you for the search term "Goldbach comet", given in your edit to Gerry Myerson's answer, which does indeed lead to many sites via Google. However, I have not been able to find among them plots of the comet even as far as the original reference's $10^6$: they are mostly relatively old sites where the plot doesn't reach $10^5$.
Comment: I just fixed the link. What are you looking for in a plot with a larger range? It will look "the same" only more.
Comment: We would expect it to look similar over a larger range, from the Hardy--Littlewood formula. But, as far as I know, that formula is still only a conjecture. Moreover, the formula was proposed only as an asymptotically correct description, although it may be more precise than just that. The definition of the bands in the comet improves greatly as the graph is extended. By eye-balling pictures with very clear, regular, and measurable patterns, one can get ideas. I don't have any prior view on what I would expect to see in an extended graph.
Comment: Ok I expanded the answer
Answer: Yes. See http://www.ieeta.pt/~tos/goldbach.html
EDIT: The graph is sometimes referred to as the Goldbach Comet, and you'll find numerous links by typing that phrase into your favorite search engine. http://en.wikipedia.org/wiki/Goldbach's_comet for example covers some of the same ground that Aaron does in his answer.
Comment: Thanks for the link. Although the site doesn't consider patterns in the referenced graph, it indicates (without reference) that enough data have been collected to extend the graph to an abscissa of $10^{10}$ ─ and perhaps more.
Answer: Permit me to add two nice images of Goldbach's Comet:
Richard Tobin's color-coded image,

"Multiples of 3 are green, multiples of 5 are red, and multiples of 7 are blue. These are combined so that multiples of 3 and 5 are yellow, multiples of 3 and 7 are cyan, multiples of 5 and 7 are magenta, and multiples of all three are light grey. Numbers that are a power of 2 times a prime are orange."

and Andrew Morris's density-based plot,

"I used color to indicate density — from multiple points landing on the same pixel. This occurs because there are 10,000,000 numbers on the x axis but the image is only 2,560 pixels wide. The color variation is automatically scaled so that each part of the spectrum from red (only one point landed on the pixel) to purple (very many points landed on the pixel) is used equally."
Answer: It is probably hard to give an exact function for the actual number of Goldbach partition. The best way to go about it is to consider the upper and lower limit cases. If we take 2k to be a Goldbach number with k>1, the number of primes in the interval [1, 2k] can be shown to be given  by
(1) π(2k)=2k(1/2-r).
Here r is the ratio of composite odd numbers to the Goldbach number 2k.
Just to illustrate how it works: if 2k = 26, then r = 4/26 and π(26) = 9.
By (1) above we note that
(2) π(2k)<=k. Since the pairs of Goldbach partition are in the interval [1,2k], the upper limit for the function, R(2k), for the number of Goldbach partitions is given by
(3) R(2k)<=k/2.
The Goldbach partition equations are given by:
(4) p2=k+√(k^2- L)
(5) p1=k-√(k^2- L
The product of the two equations give
(6) L =p1*p2.
The sum of the two equations give the result
(7)  2k =p1*p2, and the difference is given by
(8)  p2- p1 = 2√(k^2-L). These results mean that each Goldbach partition is associated to some semiprime  p1*p2 of the form
(9)  p1*(2k-p1) for semiprimes  the interval [1,k^2].
The number of Goldbach partitions is equal to the number of these Goldbach partition semiprimes.
Now how do we formulate a function for the number of Goldbach partitions?
 From the above discussion of the upper limit of R(2k), the way forward is to divided 2k by a partition number d.
(10) If d = d2- d1, we can write d as
(11) d = 2√((d2+d1)^2)/4-d1*d2) = 2√(k^2- m),
where k is some Goldbach integer k>=2 and m is some elastic rational number with lower limit governed by the upper limit of R(2k).
Thus R(2k) can take the form
(11)  R(2k) = k/√k^2- m).
Now since R(2k)<=k/2 it also means k^2- m>=4. But since k>=2, it means that m>=0. These results fix the lower limit of R(2k) as R(2k)>=1, meaning that the minimum number of Goldbach partitions is one and this proves Goldbach conjecture
The facility I am using to make this post does not have an equation editor. I request some editing.
https://www.academia.edu/38024182/Goldbach_strong_conjecture_and_its_proof
Comment: Suggestions: break into short paragraphs; use TeX encoding; use complete sentences, and check grammar and punctuation.
Comment: Then after you do all that, check the mathematics. This elementary faffing around is not going to prove the conjecture.
Comment: The math is fine. Just to explain to you. Consider 2k = 20. Then k^2 = 100. The Goldbach partition semiprimes less than 100 of are13*7 and 3*17. The number of partitions is also equal to the number of semiprimes for Goldbach partition in the interval [1,2k].
Comment: The math is garbage. Try submitting it to a journal, and see what happens.


Can 2h washing pole be parried?

Question: So I am really bad and I am really trying to get good. I have the monastery scimitar but my parrying rate seems to be less then 5% in pvp. So I was fighting someone today. They had washing pole and they would walk up to me and spam their rt attack 2 handed. I had the monastery scimitar. If I did it too late they would hit me and i would get stun locked for 3 hits. If I did it too early, i would raise my hand to do the parry animation, and they would stun me out of it. Can 2handed washing pole even be parried? I had 3k health with 1,200 defenses. got beaten by someone with robe armor and a 2
Answer: Yes. Any and all enemies (and weapons) can be parried, with the exception of jumping attacks. It is important to note that there is latency between players fairly often, being anywhere between a .5 - 2 second gap.
Comment: greatswords, greathammers, and greatclubs 2h initial attacks cannot be parried. the secondary attacks, however,  can be parried.  shield bashes, along with arrows and hexes, cannot be parried.
Answer: Yes, although not every weapon can be parried and some weapons are way easier than others to parry.
It doesn't matter what you parry with though, even if some tools to parry (like a 2handed greatsword) are way harder to parry with than others (light shields or curved swords), if it's possible, it is for all weapons.
Some heavy strength weapons have unparryable moves, mostly 2handed RT/R2 attacks.
Examples for unparryable weapons:
- 2handed Curved Greatswords (all but the roll attack)
- Whips
- The R1/RB of the 2handed halberds
- 2handed R2/RT of Syan's Halberd
- 2handed R1/RB and R2/RT of the great hammers, great swords and great axes
(There are exceptions for single weapons, the reason for this is that they might have a different moveset, but these work for almost all weapons)
Answer: You can parry the washing pole.
A patch has greatly hurt the parry window of the Monastery Scimitar. The
buckler now has way more active time (compare to the Monastery Scimitar.). The
buckler has a slightly slower startup, but that's the ONLY disadvantage.

Can 2h washing pole be parried?


Amplitude of a pendulum

Question: I have a pendulum drawn back at a height of 20mm from the surface, its length is 800mm and is a 25g mass. I'm asked to calculate the initial amplitude of the pendulum as well as its maximum speed and I do so by firstly calculating the period by $T=2π\sqrt{\frac{L}{g}}$ giving me $1.79s$, I then proceed to use $mgh=0.5mv²$ as energy is conserved in a pendulum ignoring all friction with air and then sub my value of velocity into $v=2πfA$ and get my correct answer. However, looking at another equation for maximum acceleration which is $a=(2πf)²A$ I thought that seeing the object only accelerates under $9.81m/s ²$, I assumed this equation would suffice, however I get the wrong answer. Is there infact a greater maximum acceleration possible meaning that this equation wont work with what I need (The initial amplitude)?
Comment: A pendulum fixed at a point will undergo rotational motion. Is the acceleration the bob experiences really *only* that of $g = -9.81\frac{m}{s^2}$?
Comment: As far as I know yes.
Comment: Think a little bit more about how the bob will accelerate. If gravity was the only force accelerating the bob, what is causing it to move horizontally at all? What you need to discern is the net acceleration from both gravity, and the string pulling it back.
Answer: The amplitude of a pendulum is not a well defined term. It can be measured by horizontal displacement or angular displacement.
When the angular displacement of the bob is $\theta$ radians, the tangential acceleration is $a=-g\sin \theta$ which is "towards" the equilibrium point - ie acceleration is always opposite the direction in which $\theta$ is increasing. (Think of the bob sliding down an inclined plane at angle $\theta$.) The acceleration is greatest when $\theta$ equals the amplitude, and zero when $\theta=0$.
The above formula for $a$ is exact. You have to be careful when using other formulas which use the small angle approximation (SAA) : $\sin\theta \approx \theta$.
Your formula $a \approx -(2\pi f)^2 A$ (note minus sign) is also correct, assuming that $A$ is angular displacement $\theta$, which (using the SAA) varies sinusoidally :
$\theta \approx \theta_0 \sin(2\pi f t)$.
Here $\theta_0$ is the angular amplitude. The linear acceleration is
$a=L\frac{d^2 \theta}{dt^2} \approx -(2\pi f)^2 \theta$.
Note that
$(2\pi f)^2=(2\pi \frac{1}{T})^2 \approx \frac{g}{L}$.
Therefore
$a \approx -g\theta$.
This differs from the equation in the 1st paragraph because it includes the SAA : $\sin\theta \approx \theta$.

Amplitude of a pendulum


Does a wide angle crop lens designed for crop sensors have the same FOV as their full frame equivalents?

Question: I'm looking to get into real estate photography and I'm often advised that for full frame cameras you want something like an 18-35mm and in the same breath they also say if you have a crop sensor camera you'll want a 10-20mm lens.  I have a Nikon d500 crop sensor camera and I'm looking at a dx (crop sensor) lens made by sigma that's 18-35mm f/1.8, my question is, will it have an ~equivalent/comparable~ field of view to a full-frame lens with the same specs?
Comment: If you use both types of lenses on the crop body the view will be the same for the same focal lengths. Both a 10mm FF lens and a 10mm APS-C lens will give the same FoV on an APS-C camera. An 18mm FF lens and an 18mm APS-C lens will both give the same FoV on an APS-C camera. We've got several dozens of versions of this question here already. Your 18-35mm DX lens will give the same FoV on an APS-C camera as a FF (FX) 18-35mm lens would on an APS-C camera. That would be equivalent to what a 27-52mm FX lens gives on a FF camera.
Comment: "...will it have an ~equivalent/comparable~ field of view to a full-frame lens with the same specs?" That all depends upon whether you're asking about comparing the APS-C lens on an APS-C camera to the FF lens also on an APS-C camera, or whether you're comparing the APS-C lens on an APS-C camera to a FF lens on a  FF camera. Your question is unclear in that regard.
Comment: Also related: [FX 50mm on DX sensor giving same picture as DX 50mm on DX sensor?](https://photo.stackexchange.com/q/100861/15871) and [matching field of view between apsc and full frame](https://photo.stackexchange.com/q/124907/15871) and [What is "angle of view" in photography?](https://photo.stackexchange.com/q/5917/15871) and [What is crop factor and how does it relate to focal length?](https://photo.stackexchange.com/q/139/15871)
Answer: "DC" is Sigma's way of saying this lens is designed for Crop cameras, and even though it might be able to be mounted on a Full Frame camera, the image circle will not be large enough to cover the entire Full Frame image sensor.
With very few exceptions, the focal length written on the lens is the actual focal length, and does not change when mounted on different formats of sensor size.
So, the Sigma 18-35 DC(DX) will NOT have the Ultra-Wide field of view (FOV) you are looking for when used with a crop camera.
Comment: Actually, Sigma uses "DG" and "DC", not DX and FX.
Comment: Corrected, thanks.
Comment: My mistake for not placing both in the same order: DG are FF and DC are APS-C.
Answer: The Nikon D500 sports a sensor that measures 16mm height by 24mm length. This format is called APS-C (Advanced Photo System – Classic Format).  The industry likes to make comparisons to the esteemed (100 year old) full frame 35mm (FX) a format rectangle measuring 24mm height by 36mm length.
The best way to do this is to find the diagonal measures of both formats and divide. We are talking Crop Factor (magnification Factor).
The FX rectangular formant has a diagonal measure of 43.27mm. The APS-C format is a rectangle with a diagonal 28.8mm. The magnification difference is 43.27 ÷ 28.8 = 1.5.
The value 1.5 tells us, we must magnify the APS-C 1.5X because it is 1/1.5 = 0.66 = 66% of the size of the FX format.
Now the rest of the story: A 18mm – 35mm is mounted on an FX. What is the focal length range equivalent for an APS-C. Answerer 18 ÷ 1.5 = 12  and  35 ÷ 1.5 = 23. OK to round so – you want a 10mm – 25mm Zoom to do this task. The task is to deliver about the same angles of view.


Does 30% hydrogen peroxide eat away at platinum?

Question: if I soaked a platinum dish with 30% hydrogen peroxide, will it eventually eat away at it?
Comment: Nope. On the contrary, hydrogen peroxide will decompose pretty quickly.
Answer: Yes, as @Ivan said, hydrogen peroxide will not corrode platinum, instead hydrogen peroxide will get decomposed.
Catalytic decomposition of hydrogen peroxide by metals and alloys of the platinum group:

The catalytic decomposition of dilute aqueous solutions of hydrogen
  peroxide has been studied on a number of Group VIII metals and binary
  alloys, including palladium-gold. The kinetics were measured at 27 °
  as a function of catalyst composition and pH of the solution. In
  neutral solution, the activity of the individual metals of Group VIII
  was generally greater than those of Group VIII2, the order of specific
  activity (per unit surface area) decreasing in the sequence $\ce{Pt > Os >
 Ir > Pd > Ru > Rh}$. (...)

Other references:

http://ac.els-cdn.com/S0926337306001561/1-s2.0-S0926337306001561-main.pdf?_tid=a114888e-1c29-11e7-9622-00000aacb360&acdnat=1491635258_a3e20984dda9eaaf07e78f4814383b96
http://pubs.acs.org/doi/abs/10.1021/ed080p788
http://jcsp.org.pk/ArticleUpload/2541-11513-1-CE.pdf


Establishing the point-wise convergence of the sequence of functions $f_n(x) = \frac{\lceil nx\rceil}{n \lceil x \rceil }$.

Question: I'm trying to find the point-wise limit of this function on the interval $(0, \infty)$ (I know it exists because it is a homework question). I'm having some difficulty with the ceilings. Clearly, whenever x is a natural number, $f_n = 1$, but I am stuck on what to do in other cases. I've tried decoding the ceiling as an infimum (i.e. $\lceil t \rceil = \inf \{m \in {N} : m \geq t\}$, but it hasn't really gotten me farther. Any ideas on how to proceed?
Answer: Hint.  For any fixed $x$ we have
$$\frac{nx}{n\lceil x\rceil}\le f_n(x)< \frac{nx+1}{n\lceil x\rceil}\ .$$Now let $n\to \infty$.
Comment: Awesome...I didn't even think about using the squeeze theorem. Thanks!
Answer: You always have $nx \le \lceil nx \rceil < nx+1$, so dividing by $n$ gives
$x \le { \lceil nx \rceil \over n} < x+{1 \over n}$. It follows that
$\lim_n { \lceil nx \rceil \over n} = x$.
Hence $f_n(x) \to { x \over \lceil x \rceil}$.


Sliding Insoles: does this need to be resolved?

Question: I put some used Superfeet insoles in my new Danners and they slipped just a little on the downhill part of a hike (1/4in to 1/2in) but they're very prominent insoles. Is this a huge problem as far as in-shoe wear goes, or most importantly, preventing blisters? I don't really want to glue my boots or modify them for insoles, I'll just go get some new ones if needed!
Comment: It seems like you know at this point whether or not you got blisters. It's not really a question we can answer for you. Are you wearing these because of a specific problem such as plantar fasciitis? For general comfort? If it's for general comfort, then again, you know and we don't.
Answer: Most insoles are either sized to fit, or cut to fit in your shoes, if your insoles don't fit right then you should probably buy new ones. But first I would question whether or not your new boots are the proper fit. If your insoles are slipping, chances are that you have more room in your shoes than you need, and your foot might slide around with or without properly sized insoles, though getting the right insoles can also improve the fit of your boot.
Insoles will only give you blisters if they're sliding against your foot, or causing your foot to rub against the sides or uppers of your boots, if they shift a bit in your boots when switching from uphill to down hill, it's not a big problem, you'll maybe put additional wear on the inside of your boots over time. You could try a strip of double sided tape or gluing them in and see if that helps, or just tighten up your laces a bit more to keep your heel in it's cup on the down hill.


Family view and Skyrim

Question: I own Skyrim, now suddenly it won't load and tells me the game is not able to be played in family view. I have disabled family view in Steam, restarted but still no joy.
Answer: There must be a problem with the Steam configuration files linked to your profile. Your best bet is to reinstall Steam.
The games in your library will be detected automatically once you start Steam after the reinstallation process.
Comment: This, but move the appmanifest files from the steamapps folder too so it can avoid the need to "reinstall" (discover existing data).

Family view and Skyrim


ddclient: do not update IPv4, but just IPv6

Question: I'm using dydns to name my servers. My provider is using CGN, therefore my IPv4 is almost useless. Updating my IPv4 does not make any sense and I want to skip/deactivate this, I just want to update my IPv6 (e.g. after a prefix update). Is there a way to achieve/configure this with ddclient?
Comment: If your ISP is using CGN, then you have a residential network, and your residential terms of service forbid running services to the public Internet. You need to get a business account.
Answer: Assuming a sufficiently new Perl ddclient  perhaps
<code>use=if
ipv6=yes
ipv4=no
</code>
Makes use of the OS interface command to find IPs, ip on Linux, others on other platforms.
My reading of the source is that it only does one address family, I think. Disabled v4 just in case.  Per the template config file, IPv6 requires newer than 3.8.1.

Or, consider using a v6 only network for some hosts. Remove all (non-loopback) v4 addresses  from interfaces.  Implement transition methods like DNS64/NAT64 where required to connect to IPv4 hosts.
Comment: `usev6=ip` yields `DEBUG: get_ipv6: using ip, ip reports `. I tried `usev6=web, web=checkipv6.dyndns.com, web-skip='IP Address'` and the website shows the correct IPv6, but the debug output says `DEBUG: get_ipv6: using web, checkipv6.dyndns.com reports ` .
Comment: My mistake, ip method is static IP, as in command line option.  if is probably what you want, if getting the IP of a Linux box.  See edit.
Comment: With a tiny modification to `usev6=if, if=enx...` the edit fixed it for me. Thank you.


Question mark to epxress uncertainty?

Question: Instead of using it to ask a question, can you use the question mark to express uncertainty?

Who did that?
I don't know?

I always did this, but now I am not sure if I was using it wrongly all this time.
Comment: Only *Who did that?* **is** a question.
Answer: A question mark only ends a direct question. One must not be used to end a statement or indirect question expressing curiosity, hope, doubt, lack of knowledge, etc.

Will Mary be at the party? - correct
I wonder if Mary will be at the party? - incorrect.
I don't know? - incorrect.

You can use a question mark when a sentence is half statement and half question:

You do care, don't you?

Question marks are not used at the end of reported questions:

She wondered if it would rain that day. - correct.
She wondered if it would rain that day? - incorrect.

Question marks
The question mark
Comment: I generally agree, but see my answer for an exception, which might be helpful for the person asking this question, depending on what level he or she is at.
Answer: The basic function of question marks is to mark questions, not doubt. "I don't know." is a statement and not a question and so won't be marked with a question mark.
Sometimes question marks are used to indicate that question intonation would be used.  It is possible to ask a question using only the tone of your voice.

— What's this?  <-   question
— It's a kind of fish.  <- not a question.
— It's a fish? But it doesn't have any fins!  <  The first part is a question. The question is formed by rising intonation. The second part expresses doubt or incredulity.  The second part isn't a question even though it implies a question "How can a fish not have fins?"
— I think you would say it's a fish. It's actually a lamprey, which is a very primitive animal.  <- There is doubt in the first sentence, but it is not a question, so no question mark.

You sometimes see the question mark in brackets as a kind of editor's mark to express uncertainty:

Margaret Thatcher was the first woman, and the first redhead(?) to be Prime  Minister of the UK.

The writer is expressing doubt about the "first redhead".  [By the way it's not true, Churchill was a redhead, and Thatcher's colour came from a bottle]
Answer: In conversation or conversational writing, you can sometimes use a question mark at the end of a declarative statement to turn it into a question.  For example:

Your friend: "I've gotta get home - my dog's gotta be hungry by now."
You: "Oh, you've got a dog?"

The question in a form of a statement would be common here. Asked this way, you indicate that you just got a piece of information that makes it fairly clear that your friend has a dog, but you're asking anyway to confirm it. If you instead said, "Do you have a dog?" it would actually sound somewhat unnatural, in my opinion.
Your example doesn't fit into this category. When you say, "I don't know," you're not typically asking a question in the form of a statement. So you'd normally never put a question mark at the end of it.
In a few rare scenarios, it might nonetheless make sense to say "I don't know?" For example, if you want to express consternation that you're being asked the question in the first place, the use of the question mark (or a rising tone, if spoken) can convey something like, "I don't know... why are you asking me?" Note, however, that this could be taken with offense. The technique might also be used to express that you're not sure whether "I don't know" is an acceptable answer. There might be a few other remote applications where it would make sense to use the question mark here, but all of them together don't amount to very much.

Question mark to epxress uncertainty?


Does Jira Kanban offer measurement reports?

Question: What are the gadgets, reports or metrics available in Jira Kanban that are useful for management reporting and to measure team performance?
Is there a way to get throughput, cycletime and lead time from Jira?
Answer: Jira offers a series of very useful reports for different purposes. Reports in Cloud and Server instances of Jira are mainly the same, as far as I could see.
For Jira Kanban specifically, there are two specific reports (details obtained from the source links):
Cumulative Flow Diagram:
A Cumulative Flow Diagram (CFD) is an area chart that shows the various statuses of work items for an application, version, or sprint. The horizontal x-axis in a CFD indicates time, and the vertical y-axis indicates cards (issues). Each colored area of the chart equates to a workflow status (i.e. a column on your board).
The CFD can be useful for identifying bottlenecks. If your chart contains an area that is widening vertically over time, the column that equates to the widening area will generally be a bottleneck.

Control Chart
The Control Chart shows the Cycle Time (or Lead Time) for your product, version, or sprint. It takes the time spent by each issue in a particular status (or statuses), and maps it over a specified period of time. The average, rolling average, and standard deviation for this data are shown.
A Control Chart helps you identify whether data from the current sprint can be used to determine future performance. The less variance in the cycle time of an issue, the higher the confidence in using the mean (or median) as an indication of future performance.
Answer: The standard reports in Jira provide a good start. In practice though, quite often it is not enough and depending on the level of maturity and desire to truly improve your Kanban system you could look into additional apps like https://marketplace.atlassian.com/apps/1218809/quantify-kanban-metrics that makes throughput, cycle time and lead time really easy to use.


Use Ubuntu network share for Apple TimeMachine backups?

Question: I want to backup my Mac to a network drive mounted on my Ubuntu computer. How do I set this up?
Answer: NOTE: this is now out of date. See linked question re: TimeMachine in High Sierra
This is actually really straightforward. My solution below works for a single user, but can likely be easily adapted for multiple users.
On the Ubuntu machine:

Make sure the directory to be shared is mounted and owned by your user (e.g., your backup hard drive is mounted at /mnt/backups in /etc/fstab, and you've created a subdirectory called myMac in this backup folder). Because this is a network share it actually doesn't matter what format the disk uses - it could be ext4, btrfs, etc.
Install netatalk (open source AFP):
sudo apt-get install netatalk

Configure the Apple share by editing location at the bottom of the /etc/netatalk/AppleVolumes.default file (comment out the line with the home directory and add the actual mount location; add your username):
#~/                "Home Directory"
/mnt/backups/myMac "TimeMachine"    allow:username options:tm,usedots,upriv

(I'm not sure that options:usedots,upriv needs to be explicitly set but it works for me.)
Restart the netatalk service:
sudo service netatalk restart

Make sure ports 548/tcp and 5353/udp are open in your firewall.

On the Mac machine:

Open the terminal and enter:
defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1

Reboot the computer.
Mount the network share location by selecting the network share from the leftmost pane in a Finder window, or by selecting "Connect to server" from the Finder app's "Go" menu (or press ⌘+K) and enter the machine name or IP address of your Ubuntu machine:
afp://123.456.789.123

Use your Ubuntu user credentials to authenticate when prompted.
Go to Time Machine preferences (accessible from "System preferences") and select "Change location", selecting to encrypt backups, and begin the backup setup process.

This will automatically create the sparsebundle file necessary for backups.

After setup is complete, wait ~90 seconds for backup to automatically begin, and even longer for it to complete ☺
Comment: because it took me way too long to realize it, the "username" in step 3 is the actual user name, e.g. "daniel".
Comment: brilliant tutorial!
Comment: Stacks of thanks for your concise and well written tutorial!
Comment: My Ubuntu has "PasswordAuthentication no" in the sshd_config. But I have my Mac's public RSA key in the Ubuntu's authorized_keys. I'm getting "Error 22, errno 2". Is that because using authorized keys can't work on this?  Or is this supposed to be able to work without passwords and I'm doing something else wrong.


Two people holding fingers (not hands), one leading the other

Question: Is there a word or phrase to describe the act of taking someone by a finger or a few fingers, but not the whole hand, to lead them somewhere/to show them something? It's an intimate and sometimes seductive gesture and not necessarily the same, in my opinion, as taking someone by the hand. Here is an example:
Answer: This is often described as linking fingers.1 Fingers that are joined this way are connected similarly to the links of a chain. For example:

She linked fingers with Conrad and tugged him toward the side of the house.
  (Catherine Mann, All or Nothing, 2013)
The daters were always touching. If they didn't hold hands, they linked fingers or massaged a knee or volunteered small kisses for no reason.
  (Chris Keniston, Just one Kiss, 2015)
Louis chuckled, linking his finger with his boyfriends'.
  ("Sing me to sleep", tryingtotell.tumblr post)

You're right that it can be an affectionate or romantic gesture, as you can probably tell from the quotes. But note that it can also be applied to any time that fingers are crooked (crookt, not crookèd) and then joined together, so occasionally it is used to describe a fuller hand-clasp or one's own interlaced fingers.

1  See Oxford Dictionaries' definition, linked above, especially v. 1.3. Note that this usage of "linking" is not restricted to fingers; it is at least as common to link arms, but that is a somewhat friendlier, less-intimate gesture.
Answer: I really don't think there's a word for that. . . I would probably just say "Held her hand by the fingers" or something like that.


Is it possible to connect LibreOffice Database to QGIS?

Question: I developed a database for our exploration points and would like to connect it directly to QGIS instead of exporting to CSV. So, (if possible) how can I connect LibreOffice Base to QGIS?
Comment: Andres - my advice would be to use PostgreSQL instead of LibreOffice Base. My experience with both tools is that PostgreSQL can handle the data side of things, and since you can 'add PostGIS layers' to QGIS, you can also check the box to 'Also list tables with no geometry' and voila - you have your non-spatial PostgreSQL tables accessible too!!! However, you may have a reason for using LibreOffice Base, which I'd be interested to hear! (also: PostgreSQL has drivers for LibreOffice, meaning you can connect your PostgreSQL *AND* PostGIS tables to LibreOffice!!!
Comment: @AndresAristizabal I did a little talk on Geodesign at FOSS4G last year that discusses integrating PostgreSQL/PostGIS + QGIS + LibreOffice https://vimeo.com/106233274 To me it's such an incredible and powerful open source stack ...
Comment: Probably doable with ODBC https://help.libreoffice.org/Common/ODBC_Connection and GDAL ODBC driver http://www.gdal.org/drv_odbc.html
Comment: Thanks a lot for your answer. The fact is that we are a small mineral exploration company, and I'm basically forcing everyone to use opensource software. Libreoffice offers a very complete package for office applications. In the past we managed our exploration data as Excel files, and that has major data loss and corruption risks. We also use QGIS to map our exploration databases, so it made sense to me trying to connect them.
Comment: Thanks mapBaker. I will give it a shot to Postgresql. I really thought this should be a lot easier.
Answer: Libreoffice Base has the benefit of potentially becoming something like ESRI's personal geodatabase format. The main reason for NOT using PostgreSQL is that you want (or need) data stored in files rather than on servers, so it's understandable to want to use Libreoffice Base.
It should be easy to export BASE into a format easily used by QGIS: sqlite.  Spatialite adds GIS features sort of like how ESRI adds GIS features to ACCESS databases within its personal geodatabase.mdb format. (or how PostGIS enables ProstreSQL database servers.
You can use QGIS DB Manager and supplement it with Spatialite GUI, a powerful sqlite frontend.  sqlite is lightning fast and able to store a tremendous amount of data within a single file.
So, my answer would be to utilize your BASE data by exporting it into sqlite and connecting QGIS to it.  There is no reason to use ProgreSQL unless you have multiple offices that are feeding data into a single database.
Comment: Thank you very much user12711. Your approach fits a lor better what I'm looking for. I will give it a try.
Comment: I have been looking into connecting base directly to a Spatialite database. I installed the ODBC driver from http://www.ch-werner.de/sqliteodbc/ and got Sqlite 2 and 3 as connection options. I have not yet gone further but it might be an option for you as well.


why the username does not have a UID?

Question: My server is compromised, and I try to get the open files of the malicious user, it says that the user does not have a UID , so it cannot find anything. I see there are processes which are running by that user but I cannot get the files opened by it.
Comment: If you haven't yet, I suggest you unplug the network cable
Comment: @Alex No, don't try to recover. Reinstall.
Comment: I did that, now I want to recover it.
Comment: (1) How are you getting the username of the attacker? (`ps`?) (2) Exactly what command are you using that gives you this "the user does not have a UID" error? Please do not respond in comments; [edit] your question to make it clearer and more complete.
Answer:
it says that the user does not have a UID

I can certainly agree with that.  A user as defined by "malicious user running things on a server" does not have an UID, but that is because that user is a person who may (perhaps) run things as different UIDs on your machine (from now on I'll stick to the term "attacker").
Therefore the correct path is to try to figure out what path the attacker took to gain control of a process on your machine that could perform fork() and exec().  That is a pretty good starting point because, at the end of the day, a successful attack starts by gaining control (possibly in a very convoluted way) of a process that can do that.  How the attacker manages to get to that point is what varies in the attack.
That said, the canon answer on what to do with a compromised server is to nuke it from orbit.  It is not your computer anymore, and you cannot be sure on how much access the attacker achieved.  Has the attacker achieved root privileges, then you may as well be connecting to a VM running on what once has been your server.  Or you could even be dealing against a rootkit.
(Note: "nuke from orbit" means a "fresh install" by most people)

Back to the actual question:

why the username does not have a UID?

Or better, the implied one by the text of the question:

(how a process is running without an UID?)

The idea that a process is running without an UID is absurd.  The kernel structure that maintains the existence of a process (actually the KSE) contains an UID field which must be populated (even if it is populated with rubbish in case of, say, a kernel bug).  Therefore every process always has an UID.
What you are most likely dealing with is that the UID is not listed in /etc/passwd, which, although strange for a process, is no different from doing touch leet; chown 1337 leet (assuming that you do not have a user leet with that UID , that is).  Pretty much all standard *nix tools work on UIDs as they would for usernames.  i.e.
lsof -u username

is equivalent to
lsof -u `id -u username`

And
find . -user username

is also equivalent to
find . -user `id -u username`

Therefore back to the first quote (emphasis mine):

it says that the user does not have a UID

Whatever the it is in there, it is not a standard *nix tool.  Or you're really more screwed than you believe, and are running inside some rather strange environment created by the attacker.
Comment: Related: [How to deal with an intrusion](http://serverfault.com/questions/218005/how-do-i-deal-with-a-compromised-server).
Answer: To find Ownerless files on your system you can run find / -nouser
You can also run find /sbin -mtime 1 to find any files which were modified within a day in /sbin directory.
Answer: If you have processes running and you know their PID you can find what file descriptors are open with "ls -l /proc/PID/fd" where PID is the process of the dis process.
The problem is the process may open a file, read or write it and then close the fd. In that case nothing will tell you but @damansk idea of using find will help.
You could also strace the process and look to see what open() calls it makes.
Answer: Simply enough, the user and the binary may have been deleted from the system or root could have launched a process and changed the  uid; be prepared that you might not find the binaries too.
At this point in time I would not boot with the compromised system, and would boot with a live distribution to analyze the file system. As grochmal says, tou might have compromised tools/binaries installed if there was a root compromise. The fact you have a binary of which you do not know the user points strongly to that.
That being said, I have seen a couple of system compromises, either with root escalation, and a simple user password compromise, were it seems a common trend to leave binaries running and then deleting them to complicate forensyc operations.
Answer: I have also seen this when using docker since the UIDs inside the containers may not map to users on the host OS.

why the username does not have a UID?


need help with getting laptop for daughter and dowload Ubuntu

Question: my daughter is ten. She is wanting to learn to code. She wants to create apps and games.  I want to give her a laptop for Christmas. My research indicates I should download Ubuntu for her.  I saw where Ubuntu partners with an organization to provide Google chromebooks to kids with Ubuntu downloaded.  I am considering getting the following laptop; HP 13.1 touch screen 750 GB Hard Drive AMD Quad Core A8-6410 2.4 GHZ AMD Radeon R5 Graphics. 6GB DDR3 Memory.  She is just starting and just took a course to create a video game.  Her game will be showcased at a technology fair in January. I am not tech savvy.  I do want to give the best start That I can but I can not pay $1000 for a gaming computer. This computer is on sale at sams and I can get 24 months no interest to pay for it.  Would this make a good a starter computer for a young coder?
Comment: This seems like a decent buy, but I never recommend buying a PC of any kind on payments. I make this recommendation because of how fast hardware becomes obsolete. While this laptop would certainly meet your daughter's needs, you might want to shop around and see if there are any that you can afford without payments.
Comment: Before you get your daughter into Ubuntu, make sure her teacher is using tools that can be used with Ubuntu. Even when the tools exist for Windows/Mac and Ubuntu, the teacher may provide installation instructions for Windows/Mac. It may be difficult to translate these instructions for Ubuntu unless someone in the home is familiar with Ubuntu already.
Comment: I would have it paid by tax time. Just nice to have interest free.  She only has one more class with this gamingcourse.  It was only 5 classes long. So we are free to learn on our own.  I know nothing.  She is taking the reins i just need to provide her with something to start. We can look into something better in few years when she has gained some more knowledge.  Thank you! Very helpful!
Answer: You're probably asking your question at the right website, although some would differ and slight it because of the hardware topic. The fact is that Ubuntu has a different character from proprietary operating systems, and that is what makes it such a good operating system for development. Like any other work, development is dependent on having the right tools to do the job properly. By doing the job properly I mean being able to download and install the necessary software in order to not have to "reinvent the wheel" for every project.
Ubuntu has a very large repository of vetted software, and this is a great benefit, but in the end one has to face the eventuality of requiring additional software from untrusted sources and this means in real terms having to run such software in some sort of virtual environment, either a virtual envelope or if that is not possible a virtual machine.
The requirements for a virtual machine would be enough RAM (6GB is OK) and preferably an SSD. Although a spinning hard drive is possible, it's slow and unpleasant to use compared to an SSD. A touch screen is nice, but a 13" screen is in my opinion entirely too small. It's unpleasant to have to work with your eyes glued to a small screen squinting to read miniature lines of text on the screen. LCD screens become yellowish and off-color with age, so get a computer with an LED screen. A ten-year-old girl will have no difficulty at all appreciating the difference between an LED and an LCD screen.
For development, the difference between a laptop and a desktop computer is like the difference between a little gardening shovel and a full-sized shovel. They're almost like two completely different tools. You can't properly do gardening with a full-sized shovel and you can't properly shovel wet concrete with a gardening shovel. Lines of code on a screen have a virtual weight. For working with large quantities of code, you need a full-sized tool to do the job efficiently.
Answer: It very much would so make a good computer for a young coder. Touch screen is nice for art, you can get her a touch pen for greater accuracy later, and you wouldn't need the tablet to go with it until she really finds the need for it.
Your biggest issue will be the eventuality of her looking into making something bigger, like a 3D game. A 3D game,especially one created with a powerful engine, can be very tough on a computer like this. Some of them ask for a minimum of 8Gig ram or more.
Don't let the latter discourage you though, there is still much she can do with this as it is. If she likes making games, you might want to know if she likes making the art for her games, Ubuntu 14.04 LTS has great open-source (free, and without royalty) programs like
ART
-Inkscape (Art Program)
-GIMP (Adobe Photoshop quality program)
-Blender (like autodesk maya which is 7000. A 2D/3D art program and game engine)
-MyPaint (works with Wacom tablets, so you neednt use the mouse tediously)
MOVIE (could be video game cutscenes)
-Kino
-Pitivi
MUSIC (for game music)
-Ardour (Music Maker)
-MusE (Music Maker)
-Rosegarden (Audio Sequencer)
these are programs for making games, they are all bundled together so that its easier to make a game.
GAME ENGINES (some have demos only that are free to use)
-Open Game Maker
-Solarus
-Game Maker Studio
-C4 Engine
If she likes making art on computers as well as coding, a Wacom Tablet and Pen might be a good investment for the future, they go as cheap as 99$ for both.
If she is into 2D games and coding programs and viewing the code of other people, this is the PERFECT computer for her right now. The codes on linux are almost always open source and available for anyone to see, study, change, and distribute. So your daughter can learn from tech geniuses without needing to go to college to meet them first, this community is full of really smart people who can answer her questions and help her grow from an aspiring coder to whatever she wants.
Little more advice
I am 20 years old and I have had "I wanna pull out my hair moments" trying to use this OS after 20 years of windows and mac. But reinstalling the OS is free and quick so if you screw up you just start over and redownload everthing much faster now that you know what to do.
If you yourself haven't looked up Sudo commands and the like for the linux terminal it might be wise to check it out so that you can show her how to open up terminal and how to google for the instructions on how to add what shes trying to add.
for example I needed Nuvola Player as an app for my Google Play Music. But its not on the ubuntu software center, so I needed to download the Nuvola Tarball on thier website and extract it, then run the installer through terminal to get the app.
would have looked something like this
ctrl+alt+t (open terminal)
cd home/username/desktop/nuvola   [hit enter]
sudo apt-get install nuvola-player   [hit enter]
sudo apt-get update    [hit enter]
and poof the nuvola player is on my computer.
The only true reason we see this as anymore complicated than the windows and mac way of going onto the web and finding files to download is that we got used to the fact that we needed to go out into the dangerous web with a stupidly weak Operating System like Windows, attempting to dodge virus' and hopefully getting the files we wanted.
This way we get the files from the source and no virus' or bloatware will show up with it. no offers to norton antivirus or for girth enlargement pills, none of that garbage. Just you and the files you wanted on the computer you love. Once you get used to the terminal, the OS is a piece of cake.
everything on linux works perfectly for me except that sometimes on boot I need to start up twice, and now my headphone speakers will not play, although my mic does work. trying to solve this one myself haha.
anyways hope this helps
EDIT
I just read the other post about a laptop and a desktop difference is like a tiny garden shovel and a full sized shovel. True in its ways.
But.. A huge but is this.
I have an old macbook, almost 10 years old. It has intel core 2 duo, 256 Megabytes of ram, and some whack graphics card that has no name and it just a bunch of random assorted numbers. It's awful,I there's a game from the 90's on my steam that won't run on it...
On top of all this it runs Linux 12.04 32-bit perfectly, there's new 300$ laptops that run worse. Its alive and kicking and just last week it was dead and in a drawer rotting away.
Linux brought a useless laptop back and now it runs inkscape,even blender runs,I haven't put strAin on it in blender but still it works. It runs GIMP, Libre office, steam (games won't run without a new graphic card and ram though) and everything else essentially. Linux just kicks butt in this regard. My Mac was dead and osx was actually holding it back. Now I can do more coding than your little girl could learn in a year on a crummy laptop that wouldn't start a week ago. Not that I could,cuz I suck at coding so far I'm very new to it. But just to put in to perspective just how weak a laptop can be and still run Linux and the nice programs it has


McCallum-Relyea exchange on x25519 elliptic curve

Question: Background
I have a degree in electronics engineering, I'm not bad at programming with many languages, but I'm not that good at cryptography, I'm just able to use that from libraries, and I understand just a few basic principles.
I'm evaluating the McCallum-Relyea key exchange protocol (the one used in the tang protocol)  in order to use it in a project, so I became aware of a few things about elliptic curve cryptography, further details can be found below. I apologize in advance for the atrocities I'm surely going to say regarting this subject.
The problem
I would like to use the protocol to derive an encryption key used for storing other sensitive keys on a device, allowing decryption only if it can be trusted (for now suppose it's a manual process, the server waits for confirmation before responding to the device's request). The point is protecting those sensitive keys in case of theft.
So far I implemented a simple test using Python and tinyec as below, however I need to do the same on top of the X25519 protocol, but I can't find a library with point addition and subtraction methods.
Example Python code with tinyec, working (as far as I can say in my limited knowledge):
# McCallum-Relyea exchange simple test
from tinyec import registry
from tinyec.ec import *

curve = registry.get_curve('brainpoolP256r1')
server = make_keypair(curve)

# provisioning step
client = make_keypair(curve)  # public must remain secret
derived = ECDH(client).get_secret(server)
client.priv = None  # discarded
client.can_sign = False
print(derived.x, derived.y)

# recovery step
ephemeral = make_keypair(curve)  # both must be kept secret
temp = client.pub + ephemeral.pub
# send temp key to server
temp = ECDH(server).get_secret(Keypair(curve, priv=None, pub=temp))  # server side operation
# get back updated temp key from server
recovered = temp - ECDH(ephemeral).get_secret(server)
print(recovered.x, recovered.y)

print("Keys%s match." % ("" if recovered == derived else " do not"))

As far as I've been able to understand, in the X25519 protocol only the $x$ coordinate is used, and I found formulas for adding points using only their $x$ coordinates but they also require to know the difference between those points (I think because they are only used in Montgomery ladders), thus I haven't been able to use those. So I tried to calculate the $y$ coordinate using the actual curve equation, then selecting the sign for the calculated $y$ based on the sign of the input $x$. Then I tried to add or subtract two points (subtraction should be the same as addition with flipped $y$ coordinate) using the affine coordinates formulas.
Edit: here is the updated code based on Daniel's suggestion, and there was an error in addition/subtraction too, now the exchange works half the time because there is still the problem of selecting the correct root for $y$ when decoding the point.
So the problem now is: how to make it work the other half times? (partially solved)
And is there a way of computing $\sqrt{y}$ using exponentiation instead?
Or even better is there a way of adding/subtracting without having to recover $y$? It seems that there is no indication of the sign to pick for $y$ in $x$ (the MSB seems always 0).
Edit 2: it seems to be working in any case actually, in fact, if both addition and subtraction are computed at the final step then either one of them has to be the correct result. But still, the problem remains: how to determine in advance which one to compute?
from secrets import randbelow
from curve25519 import *
from libnum import sqrtmod_prime_power

def decodePoint(x):
    x = unpack_number(x)
    y = [y for y in sqrtmod_prime_power(x ** 3 + A * (x ** 2) + x, P, 1)]
    y = y[-1]  # just picking a random one since I don't know which one to pick
    return x % P, y % P

def groupAddSub(a, b, sub):
    xa, ya = decodePoint(a)
    xb, yb = decodePoint(b)
    yb = -yb if sub else yb
    x = pow(yb - ya, 2, P) * pow(xb - xa, -2, P) - A - xa - xb
    return pack_number(x % P)

server = X25519PrivateKey(fix_secret(randbelow(P)))

# provisioning
client = X25519PrivateKey(fix_secret(randbelow(P)))  # public must remain secret
derived = client.exchange(server.public_key())
client = client.public_key()
print(derived.hex())

# recovery
ephemeral = X25519PrivateKey(fix_secret(randbelow(P)))  # both must be kept secret
temp = groupAddSub(client.public_bytes(), ephemeral.public_key_bytes(), False)
# send temp key to server
temp = server.exchange(temp)  # server side
# get back updated temp key from server
recoveredAdd = groupAddSub(temp, ephemeral.exchange(server.public_key()), False)
recoveredSub = groupAddSub(temp, ephemeral.exchange(server.public_key()), True)

if derived == recoveredAdd:
    print(recoveredAdd.hex())
elif derived == recoveredSub:
    print(recoveredSub.hex())
else:
    print("no match")

Please note that as of now I still haven't considered security issues like constant time execution, I'm still trying to understand the process, let's consider one issue at a time.
And here is the curve25519.py file I've been using, I just removed the trailing _ from functions containing it to use them in my script.
Context details
This is not relevant to the question, but here is the full story anyway (suggestions are always welcome). I'm trying to implement an access control system, since it has to work with NFC tags supporting only 3DES authentication, I have to store their keys on the reader, and being symmetric keys I have to encrypt them "at rest". The reader device has to work even offline, except for the initial connection where it decrypts its main key, keeping it in volatile memory so if it gets stolen it will still be safe. The one I'm discussing is the only applicable mechanism I've been able to find, but again I may be missing a lot of better ways to do it since I have a limited knowledge on the subject.
Answer: I think that your main issue is in the use of the math.isqrt (there may or may not be others). The function returns the floor of the positive, real square root of a positive number i.e. you are computing
$$y=\lfloor\sqrt{x^3+Ax^2+x}\rfloor.$$
Such a $y$ is unlikely to satisfy the elliptic curve equation modulo $p$. Instead you should be computing a modular square root such as sqrtmod_prime_power in the libnum library. Calling libnum.sqrtmod_prime_power(x**3+A*x**2+x,P,1) will return a $y$ such that the curve equation is satisfied modulo $p$, but you may need to adjust the circumstances under which you negate $y$ to account for the high bit of $y$.
Comment: Thank you very much for pointing that out. In fact the y coordinate was not correct, I checked if it was a square, however it still doesn't work, I don't know how to choose between y and -y at this point. I found another probably usable formula for point addition, I will update the question soon.


Difference between sudo -i and sudo su

Question: What is the difference between sudo -i and sudo su?
Comment: To be fair, while _answers_ to the linked question address "sudo su", it was not part of the original linked question.
Answer: Based on the descriptions from the man pages for su and sudo I would assume the following things:

Since sudo -iu <user> means a login shell this would be equivalent to an su - <user> or su -l <user>.
An su without any arguments changes your effective user ID but you're still using your original <user> environment and a who am i will report you're still <user>.

excerpt sudo man page
-i [command]
        The -i (simulate initial login) option runs the shell specified in
        the passwd(5) entry of the target user as a login shell.  This means
        that login-specific resource files such as .profile or .login will
        be read by the shell.  If a command is specified, it is passed to
        the shell for execution.  Otherwise, an interactive shell is
        executed.  sudo attempts to change to that user's home directory
        before running the shell.  It also initializes the environment,
        leaving DISPLAY and TERM unchanged, setting HOME, MAIL, SHELL,
        USER, LOGNAME, and PATH, as well as the contents of
        /etc/environment on Linux and AIX systems.  All other environment
        variables are removed.

Example
I have a user account, saml with a UID of 500.
$ egrep "Uid|Gid" /proc/$$/task/$$/status
Uid:    500 500 500 500
Gid:    501 501 501 501

In the above output, the 1st column is my real UID (uid) and the 2nd is my effective UID (euid).
Becoming root via (su)
$ su

Now I'm root, but I still maintain my environment and my real UID is still 500. Notice that my euid is now 0 (root).
$ egrep "Uid|Gid" /proc/$(pgrep su -n)/task/$(pgrep su -n)/status
Uid:    500 0   0   0
Gid:    501 501 501 501

However my environment is still saml's. Here's one of he environment variables, $LOGNAME.
$ env | grep LOGNAME
LOGNAME=saml

Becoming root via (su -) or (sudo -i)
$ su -

With an su - or sudo -i not only do I change my effective UID to a new user, but I also source their files as if it was a login, and my environment now becomes identical as if I were them directly logging in.
$ egrep "Uid|Gid" /proc/$(pgrep su -n)/task/$(pgrep su -n)/status
Uid:    500 0   0   0
Gid:    501 501 501 501

However my environment is now root's. Same variable, $LOGNAME, now it's set with root.
$ env | grep LOGNAME
LOGNAME=root

So then what's the difference?
Well let's try the above with sudo -i and find out.
$ sudo -i

Now let's look at the same info:
$ egrep "Uid|Gid" /proc/$(pgrep su -n)/task/$(pgrep su -n)/status
Uid:    0   0   0   0
Gid:    501 501 501 501

Well one major thing is my effective ID and real ID are both 0 (root) with this approach. The environment variable $LOGNAME is as if we logged in as root.
$ env | grep LOGNAME
LOGNAME=root

Comparing environments
If we count the number of lines in say the 3 methods, perhaps there is some additional info to be had.
$ env > /tmp/<method used to become root>

We are left with these 3 files:

-rw-r--r--  1 root root   1999 Nov  2 06:43 sudo_root.txt
-rw-r--r--  1 root root   1970 Nov  2 06:44 sudash_root.txt
-rw-r--r--  1 root root   4859 Nov  2 06:44 su_root.txt

Already we can see that something is up with just a plain su. The env. is over 2x the size of the others.
Number of lines in each:
$ wc -l su*
  28 sudash_root.txt
  32 sudo_root.txt
  92 su_root.txt

There's really no need to look further at the su_root.txt file. This file contains a much of user's environment that ran the su command. So let's look at the other 2 files.
They're virtually identical except for a few cosmetic variables, such as $LANG being slightly different. The one smoking gun in the list is the $PATH.
sudo
 PATH=/usr/lib64/ccache:/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/brlcad/bin:/root/bin

su -
PATH=/usr/lib64/qt-3.3/bin:/usr/lib64/ccache:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/brlcad/bin:/root/bin

As you can see sudo -i gives us some additional protection by stripping out suspicious paths, but it also keeps our $DISPLAY and $TERM intact in case we were displaying a GUI to  different location.
Takeaways?

The big takeaway is that the method used to become root sudo -i has advantages over the others because you use your own password to do so, protecting root's password from needing to be given out.
There is logging when you became root, vs. mysteriously someone becoming root via su or su -.
sudo -i gives you a better user experience over either su because it protects your $DISPLAY and $TERM.
sudo -i provides some protection to the system when users become root, by limiting the environment which they are given.

What about sudo su - you didn't even discuss it?
I intentionally avoided bringing that into the discussion even though the OP asked about it because doing so would only have confused the issue, IMO. When you run sudo su the sudo command masks the effects of the su and so much of the environment that you'd get from a regular su is lost. Sudo is doing its job and providing a limited and protected environment regardless of whether it's sudo su or sudo -i.
Example
Here's the result of the sudo su environment being dumped:
ls -l /tmp/sudosu_root.txt
-rw-r--r-- 1 root root 1933 Nov  2 14:48 /tmp/sudosu_root.txt

And the number of lines:
$ wc -l /tmp/sudosu_root.txt
31 /tmp/sudosu_root.txt

These are the only variables that differ between a sudo su - and a sudo -i:
$ sdiff /tmp/sudosu_root.txt /tmp/sudo_root.txt  | grep ' |'
USERNAME=saml                             | USERNAME=root
PATH=/usr/lib64/ccache:/sbin:/bin:/usr/sbin:/usr/bin:/usr/brl | PATH=/usr/lib64/ccache:/usr/local/sbin:/sbin:/bin:/usr/sbin:/
MAIL=/var/spool/mail/saml                 | MAIL=/var/spool/mail/root
PWD=/home/saml/tst                        | PWD=/root
SUDO_COMMAND=/bin/su                      | SUDO_COMMAND=/bin/bash
XAUTHORITY=/root/.xauthYFtlL3             | XAUTHORITY=/var/run/gdm/auth-for-saml-iZePuv/datab

So as you can see there really isn't much of a difference between them. Slightly different $PATH, the $SUDO_COMMAND, and the $MAIL and $USERNAME are the only differences.
References

Real and Effective IDs
Comment: both `sudo` and `su` go through the PAM stack. If it logs under one, it should be logging under the other. Also `sudo su` will strip the environment just like `sudo -i` will. In fact I don't see you mention `sudo su` anywhere in your answer...
Comment: @Patrick - Added `sudo su` to the descriptions (at the end).
Comment: @Patrick - figured it was long enough already. I figured touching on `sudo -i` was sufficient in giving insights into the advantages of `sudo` over bare `su -`. Do you think it's necessary to mention it? I'll mention that I've been on Solaris systems that did not log `su` attempts but did log `sudo`, so that distinction though a low possibility is possible.
Comment: No, I was referring to you covering "bare `su`". Op asked about `sudo su`, not `su` :-)
Comment: @Patrick - that was intentional not to discuss `sudo su`. Since the `sudo` that prefixes would've masked the effects of `su`. Most ppl get lost in the `.bashrc` & `.profile` business so I was attempting to shield the OP from that morass and cut to the effect, which is the resulting environment.
Answer: I think @slm misread the question, so providing another answer.
He did hit on the main point, about one being a login shell and the other not.
When running sudo -i the shell will become a login shell, and so it will read things like ~/.profile where as a non-login shell will only read ~/.bashrc.
When chaining sudo with su (as in sudo su), neither the sudo nor the su invoke a login shell. The equivalent to sudo -i when using su would instead be sudo su -l.
I personally consider sudo su to be along the lines of "useless use of cat" examples. You can get the same behavior with sudo -s.
There are basically 5 common ways of invoking a root shell via sudo

sudo su

non-login shell
sets HOME to /root
Prunes the environment

sudo -i

login shell
sets HOME to /root
Prunes the environment

sudo su -l

login shell
sets HOME to /root
Prunes the environment

When invoking a shell, this is equivalent to sudo -i
sudo -s

non-login shell
sets HOME to /root
Prunes the environment

When invoking a shell, this is equivalent to sudo su
sudo -Es

non-login shell
Leaves HOME alone
Leaves the environment alone (except for $PATH and $LD_LIBRARY_PATH iirc)

Note, that these rules only apply when using them to gain a shell. There is a difference between sudo -s somecommand and sudo su -c somecommand.
Answer: The second one preserves the current directory (pwd) but the first command drops the user to the root's home directory.

Difference between sudo -i and sudo su


The Intersection of Two Implicit Functions in Maple

Question: How would I find the intersection between the system of equations $2x^4-2y^3+y=0$ and $2x^2y+3y^4-2x=0$? The section in my book hasn't covered plot3d yet, so I  was thinking perhaps implicitplot would be good, but I'm not sure if that's right command to use or not.If it is the right command, would the typical fsolve() method work on finding the points of intersection? Usually when I find solutions to a system of equations, I define the equations as functions,( say f and g) and then use fsolve(f(x)=g(x),x=-5..5) to find the solutions. But this isn't possible for an implicit function. How would I define something that isn't a function (such as a circle) in terms of a function in Maple? I change the last option accordingly to search for the solution, as I usually have the plot open in front of me. If anyone could offer any ideas, that would be appreciated.
Comment: Note that the question is not just about where the two expressions (the left-hand-sides of the two equations) are equal to each other. The question is about where they are equal to each other AND (more importantly) where they are both individually equal to zero.
Answer: restart:

ee:=2*x^4-2*y^3+y=0;

ff:=2*x^2*y+3*y^4-2*x=0;

plots:-display(
   plots:-implicitplot(ee,x=-4..4,y=-2..2, color=red),
   plots:-implicitplot(ff,x=-4..4,y=-2..2, color=blue) );

sols:=solve({ee,ff}):
rsols := remove(hastype,evalf(map(op,{allvalues({sols})})),nonreal);

fsol1 := fsolve({ee,ff},{x=-4..4,y=-2..2});

seq( eval([ee,ff], s), s in rsols );


(+)/(-) Acceleration & (+)(-) Velocity

Question:
Does a negative acceleration mean an object is slowing down?
Does a negative velocity basically mean you are moving at an opposite direction? The sign is just direction?
Comment: related: http://physics.stackexchange.com/q/129012/
Comment: Note that yes/no questions e not a good fit for this site because the answers (yes or no) are too short to be valid answers.
Answer: Think of a position axis $x$ starting at zero, positive to the right and negative to the left.
It is like a number line.
A positive velocity means that the value of $x$ is increasing eg going from $x=+3$ to $x=+5$ or $x=-7$ to $x=-4$ or $x = -3$ to $x=+4$.
A negative velocity means that the value of $x$ is decreasing eg going from $x=-3$ to $x=-5$ or $x=+7$ to $x=+4$ or $x = +3$ to $x=-4$.
A positive acceleration mean that a velocity is becoming more positive (or less negative) eg going from $v=+3$ m/s to $v=+5$ m/s or $v=-7$ m/s to $v=-4$ m/s or $v = -3$ m/s to $v=+4$ m/s.
A negative acceleration mean that a velocity is becoming more negative (or less positive) eg going from $v =-3$ m/s to $v =-5$ m/s or $v =+7$ m/s to $v =+4$ m/s or $v = +3$ m/s to $v =-4$ m/s.
Answer: well you have given answer in your own question!
Velocity and acceleration are both vector quantities, meaning they have magnitude and 'direction'. The sign (+/-) will depend on the direction.
To simplify, let me give you an easy example..
Case 1: An object is moving down from the top of a mountain. The acceleration (in this case 'g') will act in the direction of motion, hence called as 'positive acceleration'.
Case 2: Same object is moving up. The acceleration (g) will act in the opposite direction of motion, hence called as 'negative acceleration'.

The same logic is behind negative velocity.
For more information, go to Wikipedia page.

(+)/(-) Acceleration & (+)(-) Velocity


Safari 17 hangs on opening a new link if no windows open

Question: The Problem
On opening a new link when there are no Safari windows, but Safari is already active, Safari will hang (complete with beach ball) for ~10–30 seconds.
Reproduction Steps

Have Safari open but with no windows
Click a link in any app, open a bookmark with Alfred, or enter a URL with Alfred or Spotlight.
If Safari opens both the link and a blank tab, Safari beach balls for between 10–30 seconds.

Specs

Safari v17.1 (196188.8.131.52.7)
macOS v14.1.1 (23B81)
MacBook Pro 14" (2021, M1 Pro, 32GB RAM)

Things I Have Tried

Disabling all extensions.
Occurs with or without a network connection.
Doesn't reproduce on a test user account.
Clearing website data: Settings > Privacy > Manage Website Data > Remove All.
Setting Safari as the default browser (previously BetterTouchTool was) from Settings > General > Set Safari as Default Browser.
Quitting BetterTouchTool just to be safe.
Restarting my Mac.

Things I have noticed

Whenever the hang happens, I have noticed that Safari will open a second, blank tab. So, although I have only clicked one link, two tabs open.
In Activity Monitor, the Safari process says it is using ~100% CPU when the beach ball happens. All the other Safari processes (extensions, networking SafariLaunchAgent, etc) seem normal.
Frustratingly, it doesn't happen every time! It will be fine for 3-4 fresh links and then the problem will reoccur.
It doesn't matter what URL I go to.
It doesn't happen at the same point. Sometimes happens before the page loads, and sometimes after the page loads. But always within about 60 seconds of the new window opening.
Clicking on Safari in the dock to open a new window, and entering the URL into the address bar, doesn't cause the fault.

I am a bit stumped about what to try next. Every time I think I've narrowed the culprit down, I manage to reproduce the problem. Suggestions for things to try or ways to narrow down the fault gratefully received!
Answer: In case anyone comes across this, as was suggested by @cornchip on the Mac Power Users Forum, I tried using Safari Technology Preview.
Having installed it and set it as default the problem is resolved for now. A feedback has been lodged.
Feedback FB13384650


Step function versus Sigmoid function

Question: I don't quite understand why a sigmoid function is seen as more useful (for neural networks) than a step function... hoping someone can explain this for me. Thanks in advance.
Answer: The (Heaviside) step function is typically only useful within single-layer perceptrons, an early type of neural networks that can be used for classification in cases where the input data is linearly separable.
However, multi-layer neural networks or multi-layer perceptrons are of more interest because they are general function approximators and they are able to distinguish data that is not linearly separable.
Multi-layer perceptrons are trained using backpropapagation. A requirement for backpropagation is a differentiable activation function. That's because backpropagation uses gradient descent on this function to update the network weights.
The Heaviside step function is non-differentiable at x = 0 and its derivative is 0 elsewhere. This means gradient descent won't be able to make progress in updating the weights and backpropagation will fail.
The sigmoid or logistic function does not have this shortcoming and this explains its usefulness as an activation function within the field of neural networks.
Comment: This is a beautiful answer. Builds up the required context and comes in for the kill. Thank you!
Answer: It depends on the problem you are dealing with. In case of simple binary classification, a step function is appropriate. Sigmoids can be useful when building more biologically realistic networks by introducing noise or uncertainty. Another but compeletely different use of sigmoids is for numerical continuation, i.e. when doing bifurcation analysis with respect to some parameter in the model. Numerical continuation is easier with smooth systems (and very tricky with non-smooth ones).
Comment: I think the most common case for sigmoid activation is simply regression.

Step function versus Sigmoid function


GAE JAVA Endpoints with android - am I authenticated or not?

Question: On android client, I create Credentials, then choose account using AccountPicker and set the account name. On GAE, I have User parameter in every endpoint method. (I described it here)
Android Client ID, Web client ID and audiences are configured correctly.
On endpoint, the user is not null and has correct email set. But when I call user.getUserId() I get null. Is this user authenticated or not?... It really makes me nervous not to know that...
Answer: This is a bug on google's side.
There seems to be a clunky workaround: save User to datastore and read it back.
Answer: What you describe is odd, and I don't know why you get null when you call getUserId(), but never-the-less I would say, Yes, you are authenticated.
If you want to be sure, then you could try using that authentication from a web client - I read that once you have authenticated an Android user you are automatically given minimal account authentication for web too.  So create a minimal servlet that includes the following code:
UserService userService = UserServiceFactory.getUserService();
User user = userService.getCurrentUser();

Load the page while signed in with the same account you authenticated from Android and see whether it acts like it already knows you, or whether it prompts the user as it would for a different, un-authenticated user.


Upper bound on multicolor ramsey number

Question: I have an assignment question for an intro course in Graph theory where we have to show that $R_k (3) := R(3_1,...,3_k) \leq 3k!$. Since this is an intro course we do not know much about ramsey numbers. I have the classic upper bound on 2 color ramsey numbers $R(k,l) \leq R(k-1,l) + R(l,k-1)$ and also the proof by induction that the multicolor Ramsey number exists for all positive integers $s_1,...,s_k$ by induction : $R_k(s_1,...,s_k) \leq R_{k-1}(R_2(s_1,s_2),s_3,\ldots,s_k)$. I think the same kind of induction should be used but I don't really know how to make that upper bound become a product.
Answer: This exercise also belongs to introduction  and induction. To obtain an upper bound for $R_k(3)$ put $n=R_k(3)-1$ and consider a complete graph $K_n$ with edges colored in colors $\{1,\dots, k\}$ without monochromatic triangles. Pick an arbitrary vertex $v_0$ of the set $V$ of vertices of the graph $K_n$. Then we obtain a partition $V\setminus \{v_0\}=V_1\cup\dots\cup V_k$, where $V_i=\{v\in V: (v_0,v)$ has color $k\}$.  Since edges of each $V_i$ cannot be colored by a color $i$, $|V_i|\le R_{k-1}(3)-1$. Thus $n\le 1+k(R_{k-1}(3)-1)$ and $R_{k}(3)\le kR_{k-1}(3)-k+2$. Since $R_2(3)=6=2\cdot 2!$, by induction we obtain $R_k(3)\le 3\cdot k!$.
Comment: @ARi By the definition of a Ramsey number $R_k(3)$ as a smallest number $n'$ such that any edge-coloring in $k$ colors of a complete graph $K_{n'}$ has a monochromatic triangle.
Comment: Why the condition of not having a monochromatic triangle?

Upper bound on multicolor ramsey number


WebKit shell browser for internal web application

Question: I am creating an in-house web application that I want to run in a WebKit shell browser on the Mac. I searched and came up empty. Basically, I want the site rendered and shown in a window with no chrome for navigating to other pages, bookmarks, etc. Seems to me that there should be a relatively easy way to get something like that up and running in Xcode, but alas I don't know how. The more barebones the better. Anybody know the answer?
Answer: Not sure if this is what you're looking for, but you could use a WebView.  The content is rendered by Safari/WebKit.
As for chrome, if you just put the view, that's all you'll have.  You can shape the rest of the User Interface however you'd like.
Apple's documentation has a couple of examples using WebView... Should this solve your problem.
Answer: Did you take a look at the phonegap mac project.
Its a full screen webkit without any chrome in which you can put your html / css / javascript to run:
https://github.com/callback/callback-mac


How do I create additional users connected to my Cognito Forms account and give them access to entries for their specific forms?

Question: I had created an online booking form for products. I should display the order to the admin. I need to add a user to view the entries in my form.
Answer: I'm a developer with Cognito Forms.
You can add new users to your Organization by inviting them. This can be done under the 'Users' area of your Organization Settings. Once invited, the user will get an email with an invitation link. They can use the link to add an already existing user account to your Organization or they can create a new one. You can learn more about adding or inviting users in our Help Content.
Once your user has been added to your Organization you can set up the users specific permissions. You can restrict the users so that they can only view entries for a form, without the ability to edit the form. You can also block the users ability to view forms at all. You can learn more about setting up user permission levels in our Help Content as well.


How to select a weapon?

Question: I know I can hit f and see weapon choices. 0 is my stimpacks found in the beginning.  4 is the handgun.  Thing is I do not want to waste bullets on cockroaches so how do I select fists? 1 or 2 or 3 are empty so I figured those but they do not work.
Comment: How to *un*-select a weapon? If only...
Answer: You can go into your Pip-Boy and unequip the weapon manually, but probably the best way to handle this situation is to favorite a melee weapon (in the prologue, you normally find a Security Baton well before you find the first pistol) and simply press its hotkey when you don't want to waste ammo.
Comment: As far as I know, pressing the hotkey of the weapon you currently have selected will not unequip it in Fallout 4. It did so in previous Bethesda games.
Comment: @Thorsal I believe you are correct; answer edited.  Thanks for pointing that out.
Answer: Like gatherer818 said, you can equip and unequip a weapon manually in your Pip-Boy, or assign it as a favorite.
However, there is another, faster way to address your concern of not wasting ammo on pathetic enemies like radroaches. You can melee using your gun, which the game refers to as "bashing". Just press the power attack/grenade button (right bumper on Xbox) and you'll melee. There's even a perk to improve this damage, called Basher.

How to select a weapon?


How to prevent cursor from getting stuck in corner in Mac OS Catalina?

Question: I have a dual monitor setup.
In previous versions of Mac OS, when I move the cursor from the left monitor to the right, it moves without any problem, regardless of how high or low on the screen the cursor is.
Ever since I installed Catalina, if the cursor is within an inch of the top or bottom of the screen, it won't move on to my other monitor. The cursor seems to move between monitors only if it is NOT in the top inch or bottom inch of the screen. Clearly this is an intentional "FEATURE" that was added in El Capitan
This is really annoying behavior. Is there some way I can revert it back to the behavior in Mavericks, El Captian, High Sierra (basically every version of Mac OS before this?)
I've tried looking in System preferences but can't find a setting for this.
Answer: I figured it out. Its the most dumb thing.
You go to System Preferences -> Display -> Arrangement. Make sure both monitors are "in line" with each other".
XD


Function that has potential to increase current value, based on current value

Question: Math is not my strong suit, let's start there. (Be gentle.) I have a game engine that is "ticking" every 1 second. I would like for a number, A, to increase at an exponential decaying rate based on a function of its current value. (Up to a maximum value that would be hit after a long time, potentially.)
As an example, with an initial value of 10 and a maximum value of 100, at "Tick 0" it would have a value of 10.
Then at "Tick 100" it would have a value of 20. At "Tick 1000", maybe a value of 27. etc.
The issue is, it can't be dependent on the tick value. It's a property that can be "used up", and then will recover over time - quickly in the beginning, but more slowly as time goes on. So you may be left with a value of 10 at "Tick 4,300,000". I would like for the value to again be 20 at "Tick 4,300,100".
The idea is that this value will be used to determine whether an action can be performed. So for simple actions, it won't really dent. But you can save up for more complex actions that might require 30 units, and you'd have to wait for an hour or so.
I've tried a few simple tactics that are close but not quite:

The value is "staggered" so that if it's 0 <= A <= 10, it increases per Tick, and if it's 11 <= A <= 20 it increases every 10 Ticks, etc. but I dislike the plateau effect that occurs.
I've tried using a modulus based on TickCount % (A^2) == 0, but this does not decay fast enough. Using A^3, it decays too quickly at lower values.
Answer: How about adding each tick (max value-current value)/100, or whatever divisor makes you happy?  Then subtract however much is used up in the current action.


Activation Functions

Question: What is the purpose of linear activation functions in keras, isn't the entire point of activation functions to introduce non-linearity?
Comment: I'm not 100% sure, but the Activation ("linear") might be an historic artifact. There is / was also an activation parameter to a couple of functions. There it makes sense, because sometimes you don't want to apply an activation function.
Answer: A combination of multiple linear functions can help one model complex decision regions. Two or more linear functions can be combined to form a piece-wise approximation of a non linear function. Computation of non-linear activation function on a very deep network can be expensive (because of the exponential term involved). ReLu activation function which is a linear activation is used almost by every CNN model and is proved to give better results.
$$ f(x) = max(0,x-1) + max(0,x+1)$$
Consider the function above which is combination of two reLu's.  This approximates the sigmoid function(try plotting the same) and is computationally cheap.

Activation Functions


Backdrop doesn´t work/ image won´t show up (for compositing)

Question:
Hello, i am in the last part of the blenderguru-tutorial.
I want to use compositing in order to change the final image.
The problem is backdrop won´t let the image appear in the background
of the node-editor. The only hint i have is as follows: in the video it appears that andrew used "Last: Link Nodes". I don´t know what that exactly means...
Answer: You will need to ⇧ Shift +  A add a Viewer node and connect your Image or Render Layer node to the Viewer as well as your Composite.
At the header, tick the option for Backdrop like you have, and the image should show up in the background of the node editor.
Comment: thank it kinda worked, but the image in the background is way too big now. How can i scale it down? ...oh i found it: i can zoom out at "Zoom"
Comment: You can use V and Alt+V, also for zooming, and Ctrl+Shift left click on a node to watch his output.
Comment: Is it possible to display the backdrop with the viewr and the composite node inside a node group? outside the node group is only the render reult node.
Comment: No, not as I am aware of. The Viewer node is what is displayed only, and the Final Composite node is the way the full render gets output. The ability to only show a certain group would need a duplicate viewer node so that you can select which one shows in the backdrop.
Answer: The answer is that you will have to press (shift A) go to output, then pick viewer, after that just connect the yellow image wire to the viewer and there you go. if you press v it will shrink the backdrop image or if you press alt v it will enlarge the backdrop. This answer works in v2.79 so far and may update answer if it changes in the future


Monitor SSH traffic

Question:
Hi Folks,
I was monitoring my SSH port with tcpdump and have had a lot of activity as expected.  When I look at the traffic I get the above image.  What does it mean?
Thanks
Answer: That is the SSH2 key exchange.  The following is a quick and dirty run down of SSH.
When the SSH tunnel is established the client and server perform a Diffie Hellman (DH) exchange.  This is to establish a shared secret between the client and server in order to generate the session keys needed for the encrypted tunnel.
The way SSH does this by first establishing the algorithms.  Each side first sends their SSH version (which I don't see in your capture for some reason), and all of the algorithm combinations each supports.  The server chooses the first one that matches in both lists.  Then the DH parameters are sent, hashed value H (which hashes 7-12 pieces of data), and the signature of H to ensure it hasn't been tampered with.  This is most likely the binary data you see in the picture.
I'm skimming over the details, but essentially after all this is said and done there is a value K that only both sides can generate.  Using whichever hashing algorithm agreed upon the session ID, H, and K are all used to generate the session keys.
TimC is correct that looking at the data in Wireshark will tell you a lot more.  Each of those pieces will be parsed out with nice easy to read labels.  As long as the default SSH port (22) is used. I've also found that Wireshark sometimes does not associate some TCP packets with the SSH session, and those packets are not properly parsed.  This doesn't mean the data did not reach its destination; it just means that Wireshark could not properly interpret the data. Depends on the version of Wireshark you're using.
Here's a basic introduction to SSH versions, with some extra linkage.
Answer: It looks like it could be binary data, or it could even be the encrypted data that is being sent across.
If you were to look at it in Wireshark then it would make it more obvious as it shows you each part of the network frame and you would be able to see where abouts in the packet that data is.
Comment: Brilliant, thanks TimC, I will have a look in Wireshark.

Monitor SSH traffic


Can a class method be both inline and static?

Question: Does it even make sense?
Answer: static means that the method isn't associated with an instance of a class. (i.e. it has no "this" pointer).
inline is a compiler hint that the code for the method ought to be included inline where it is called, instead of being called via a normal branch. (Be aware that many compilers ignore this keyword, and use their own metrics to decide whether to inline).
These are orthogonal (unrelated) concepts, so there's no particular reason they couldn't be combined.
Comment: The more important meaning of inline is that multiple definitions of the method are allowed (and assumed to be identical).  This allows function definitions to be places in header files that are #included in multiple places.
Still no reason they cannot be combined.  In fact, for a static method in a template, they pretty much have to be.
Answer: I don't see why not. A static class member is like a standalone function with private access to the other member functions.
Answer: Yes, there is no reason these can't be combined.
Answer: You can.
However, the GCC manual says that the function will not be integrated by the compiler into the code if:

you call the method before you define it, or
there are any recursive calls within the definition.

Source: GCC Manual - discusses both C and C++.
I tried coding up both of these scenarios in Visual C++ using a small sample class called Class1.  Here's the relevant snippet, where incTest is defined in my Class1.h file.
// test static inline method - based on the GCC manual's C example
static inline int inc (int *a)
{
    return (*a)++;
}

// test recursive call in a static inline method
static inline int fac (int x)
{
    return x * fac(x-1);
}

int Class1::incTest(int* x)
{
    return inc(x);
}

This is the version of it that compiles successfully.  However, if I'm using Visual C++ and I move the definition of inc() to after incTest()'s definition, the file does not compile successfully, giving me an error at the call to inc() saying, "Identifier not found".
Edit: revised my answer to take into account comments and results of my testing in Visual C++.
Comment: This is wrong.  Neither of the restrictions are part of C++.  They may limit the ability of a function to actually be inlined in the generated code, but you can still mark them as inlined.  This is useful if they need to be defined in a header file, for instance if they are templated.
Comment: neither of these conditions stop you declaring a method inline.


Install Startup Disk Creator error from Ubuntu Software on Ubuntu 18.0.4 minimal installation version

Question: Unable to install Startup Disk Creator as download failed: E: http://cn.archive.ubuntu.com/ubuntu bionic/main amd64 usb-creator-gtk amd64 0.3.5 is not (yet) available (Unsupported proxy configured: 127.0.0.1://37809)
Comment: 1. Please describe how you tried to install `usb-creator-gtk`, the command you used; 2. Can you install other programs, or update & upgrade your Ubuntu? -- 3. Maybe there is a problem with your connection via the internet (if you must connect via a proxy).
Answer: I faced the same problem.
Try to manually install it on command line sudo apt-get install usb-creator-gtk.
The application is installed and you can find it on "Show Applications", or manually execute it via usb-creator-gtk.


Windows 7: How to view/split/extract or convert very large .reg files?

Question: On Windows 7 x64 SP1 Home Prem
Have very large .reg files (over 400MB) that were created by exporting from Regedit.  Files too large even for Notepad++.
Need a way to extract or view portions of the files.  These are historical snapshots of the registry, so re-creating them isn't possible.
The ideal would be a tool that can display it like RegEdit but without changing the actual registry.
Or, a way to split them into smaller .reg files that Notepad++ can read.
Or, a way to convert the .reg files to HIVE format, since I do have ways to extract from large HIVE files.
I'm so desperate I'll even go for a Cmd line tool to grope my way through, but these are unicode files so even FINDSTR won't work.
I've tried using MORE cmd (yes I'm THAT desperate) but it would take days.
Any ideas?
Answer: For command line tools, use type to handle Unicode in combination with findstr.
So do something like this:
<code>type myfile.txt | findstr "what I want to find"
</code>
Or, consider grepWin, which has a slew of options to search a file on Windows. - http://stefanstools.sourceforge.net/grepWin.html
Comment: VERY nice trick. And it ran faster than I expected.
(I did TYPE My.reg|FINDSTR /B /N /C:"[HKEY" to get a
sort of table-of-contents, which is a big step...)
Will also look into grepWin.
Thank you.