I'm looking for a way to add region comments to an algorithm. A comment should appear left of the listing and mark the corresponding code region by, for example, a large curly bracket. Like summaries for specific code regions.   Edit 1: See this . Like that but with the curly bracket and the comment left of the code.  Edit 2:  to the corresponding question for the image from edit1.  I would like to see it as some kind of command to be easily reusable.   Do you have any idea how to achieve something like this?
In the paper "Beautiful Code Compelling Evidence", by J.R. Heard -- Code is formated in a particular way which includes margin comments. I am looking for a way to do this as I think it is a very clear way to comment comment code in a literate programming style.
Obtaining remote host name in bash script Sorry my knowledge of Linux bash commands is pretty basic, I've been searching for a while but I'm not 100% sure what I need to search for.  I was wondering if there's a way to grab the current logged in users remote host name in a Linux bash script? I have a script in which I need to log each time a user runs it. I'm obtaining the date like so:  cdat=`/bin/date +%a' '%d' '%h' '%Y', '%H':'%M`;   I now need to add the users remote host (not the username they logged in with). I'm not 100% sure I'm using the right terminology here either, just to clarify; by 'remote host name' I mean the same output that prints on the screen on most servers I've logged into over ssh, for example:  Last login: Mon Jul 22 16:35:09 2013 from win7-i7-stuart.my.domain.com   I'm looking for the win7-i7-stuart.my.domain.com bit. When in a group chat, if many messages are exchanged between other people in the group, when I check my Whatsapp, the messages are grouped according to sender and not chronologically. I know that my phone isn't the problem as I have recently changed my phone, however, I'm still experiencing the same problem.  I have tried uninstalling and re-installing WhatsApp on my phone, and the same problem still occurs. Can't start mongod , configured storage engine is 'mmapv1' I try to run mongo v2.6.10 on Ubuntu 16.04 lts:  mongod   And get the result:  mongod --help for help and startup options 2017-09-16T12:15:19.660+0430 [initandlisten] MongoDB starting : pid=15959 port=27017 dbpath=/data/db 64-bit host=mahdi-MS-7808 2017-09-16T12:15:19.660+0430 [initandlisten] db version v2.6.10 2017-09-16T12:15:19.660+0430 [initandlisten] git version: nogitversion 2017-09-16T12:15:19.660+0430 [initandlisten] OpenSSL version: OpenSSL 1.0.2g  1 Mar 2016 2017-09-16T12:15:19.660+0430 [initandlisten] build info: Linux lgw01-12 3.19.0-25-generic #26~14.04.1-Ubuntu SMP Fri Jul 24 21:16:20 UTC 2015 x86_64 BOOST_LIB_VERSION=1_58 2017-09-16T12:15:19.660+0430 [initandlisten] allocator: tcmalloc 2017-09-16T12:15:19.660+0430 [initandlisten] options: {} 2017-09-16T12:15:19.660+0430 [initandlisten] exception in initAndListen: 28574 Cannot start server. Detected data files in /data/db created by storage engine 'wiredTiger'. The configured storage engine is 'mmapv1'., terminating 2017-09-16T12:15:19.660+0430 [initandlisten] dbexit:  2017-09-16T12:15:19.660+0430 [initandlisten] shutdown: going to close listening sockets... 2017-09-16T12:15:19.660+0430 [initandlisten] shutdown: going to flush diaglog... 2017-09-16T12:15:19.660+0430 [initandlisten] shutdown: going to close sockets... 2017-09-16T12:15:19.660+0430 [initandlisten] shutdown: waiting for fs preallocator... 2017-09-16T12:15:19.660+0430 [initandlisten] shutdown: lock for final commit... 2017-09-16T12:15:19.660+0430 [initandlisten] shutdown: final commit... 2017-09-16T12:15:19.660+0430 [initandlisten] shutdown: closing all files... 2017-09-16T12:15:19.660+0430 [initandlisten] closeAllFiles() finished 2017-09-16T12:15:19.660+0430 [initandlisten] dbexit: really exiting now   error :     exception in initAndListen: 28574 Cannot start server. Detected data   files in /data/db created by storage engine 'wiredTiger'. The   configured storage engine is 'mmapv1'., terminating   after update mongodb show error . When should I use "a" versus "an" in front of a word beginning with the letter h? A basic grammar rule is to use an instead of a before a vowel sound. Given that historic is not pronounced with a silent h, I use “a historic”. Is this correct? What about heroic? Should be “It was a heroic act” or “It was an heroic act”?  I remember reading somewhere that the h is sometimes silent, in which case it’s an, and when the h is pronounced, it’s a. But then I also remember reading that it depends on which syllable is stressed. And I also think I read somewhere that it might differ between British and American English.  Personally, I pronounce the h, and believe that a is correct. I find that it sounds incorrect to use an and pronounce heroic without the h.  So how do I know when to use a and when to use an with a word beginning with the letter h? Are both acceptable or is there one that is correct? Posting a Solution of a problem that You faced to Help Newbies About an Hour ago, I faced a problem and tried different ways to solve it.  At last I was going to post my Question on Stack Overflow, but the last trick which came in my mind worked, and the problem got resolved.    Now, if I want to post that problem on Stack Overflow with the solution which worked for me, for the purpose to help other newbies to get their answer if they face the same problem, what is the proper way of posting such solution to a problem? Why did they make another prequel? Star Trek: Discovery, the first new Star Trek television series in 12 years, debuted last week.  As with a number of recent Star Trek efforts, this is a prequel to the Original Series, occurring roughly one decade prior chronologically.    The Original Series, the Next Generation, Deep Space Nine, and Voyager occur in a chronological sequence that, generally speaking, moves forward (although TNG, DS9, and Voyager overlap to various degrees).  The linear trajectory of Star Trek productions took a sudden shift with the television series Enterprise, which was set just over 100 years before TOS. This was followed by J.J. Abrams' 2009 film Star Trek, which created a new timeline and which followed the characters from TOS, but at a time that is also chronologically one decade before TOS.  Given that the last few interpretations of Star Trek were prequels in one sense or another, I was disappointed that Discovery was yet another prequel.  I'd like to know why the showrunners decided to take this direction.  I haven't been able to find any statements about the rationale.    That being said, I find it interesting that Star Trek (2009) was set in 2255-2258 and Discovery is currently set in 2256, even though they are ostensibly in different timelines &mdash; the former in the reboot timeline and the latter supposedly in the original timeline.  Also, one of the showrunners for Discovery, Alex Kurtzman, was one of the principal members of the creative team behind the Abrams films.  Why did the creative staff behind Discovery decide to make another prequel?  Does it have anything to do with the fact that Star Trek (2009) and Discovery are set in roughly the same years? Fix a wobbly Shimano freehub? Experiment to find structure of water Who first determined the structure of water (two hydrogen atoms stuck to an oxygen atom at approx 105 degrees), and, more importantly, how was this done? We have a group of three characters: The lawful good paladin (acolyte), the lawful good fighter (soldier) and the chaotic good druid (criminal). All try to help NPCs in need, won't fight between themselves, but of course have different alignments and personalities. The druid is greedy, but otherwise a good guy. This brought up the question for our group whether greed can be considered a contradiction to having a chaotic good alignment? I understand it as "acting upon what is good, but having your own understanding of 'good'". But I am not sure if the PC being is played 'wrong'.   How do you determine if a given action is in line with a PC's alignment? And should the GM intervene if a PC is played differently that his/her alignment indicates?  Example: There is a Chaotic Good druid with a criminal background. The druid attacked caravans who destroyed his homeland, which he was protecting as his druidic duty, to make way for faster trade routes. Thus he made a name of himself and soon had quite a pile of goods in his territory. The thieves guild caught wind of that and made a deal with him to smuggle wares through his territory as long as they won't hurt the wildlife. So far, seems like a reasonable match between criminal and CG.  Upon opening a chest in a dungeon the druid found a magic chainmail and a bag filled with 420gp. As he was the only one next to the chest, he turned around and told his two comrades there were 360gp in the chest, keeping an extra 60gp to himself without them knowing. Later after finishing a task for the mayor the druid and the paladin persuaded him to give them 550 instead of 500gp, while the fighter was drunk outside. The druid told the paladin to keep his share of those 10% extra, as a gift for always being successful on those charismatic tasks. This was done to check out the personality of the paladin. He accepted without a second of doubt and didn't even contradict when the druid told him not to tell the fighter anything about the extra.   I am now confused about whether this is just unlawful or also not good, and if so what should I as DM do about it? When a Battle Master fighter gets a critical hit and uses a maneuver that adds a superiority die to the damage, is that damage die doubled? The Battle Master fighter has access to a number of maneuvers that add a superiority die to the damage roll. For instance, the Trip Attack maneuver says (PHB, p. 74):     When you hit a creature with a weapon attack, you can expend one   superiority die to attempt to knock the target down. You add the   superiority die to the attack’s damage roll, and if the target is   Large or smaller, it must make a Strength saving throw. On a failed   save, you knock the target prone.   The Critical Hits rule states (PHB, p. 196):     When you score a critical hit, you get to roll extra dice for the   attack’s damage against the target. Roll all of the attack’s damage   dice twice and add them together. Then add any relevant modifiers as   normal. [...] If the attack involves other damage dice, such as from   the rogue’s Sneak Attack feature, you roll those dice twice as well.   During our game, the fighter PC rolled a critical hit. He then wanted to use a superiority die to use the Trip Attack maneuver to trip the enemy. Based on the above rules, is the damage from the superiority die also doubled?  I'm assuming the answer is yes based on the last statement in the Critical Hits section, but I wanted to confirm. Prologue:  This is an effort to follow up on  which is marked as a duplicate of  highly voted and status-declined feature request (although they seem to be different, one focusing on the OP and the other on the downvoter).   My New Year's resolution was to downvote more.  So on January 3rd or so, I saw a post that was low quality, and downvoted.  Two days later, I came back to see if it was ready to be deleted or had gotten piled with downvotes, to find it with a significant positive score!  At which point, I noticed that the answer had been significantly improved.  So I retracted my downvote, changed it to an upvote, and immediately resumed my dearth of downvoting again.  I think I have a responsibility to downvote bad posts, despite that oh-so-painful -1 rep penalty.  But if I am also going to have the responsibility to follow up on every downvote I cast, I'm not going to bother. I don't want my downvote to leave a residual penalty on posts that were once low quality, and I am not going to trouble myself to keep checking up on every post I downvoted.  Can a downvoter have an option to be notified when a post they voted down was edited?  I wouldn't make this an automatic thing, because not all downvoters want it, and it isn't applicable to all cases of downvoting (although  that this should be part of the responsibility of a downvoter).  Personally, I would make this a universal toggle on-off option on the user profile page, not a question-by-question option, but I don't have strong feelings about it. Question Prove that for every integer k≥1, exists a self-complementary graph with 4k vertices half of which are of degree 2k-1 and the other half of degree 2k.  My approach So, I think the easiest way to prove what is asked is by induction. I can prove the base case for k=1, but as far as the inductive step is concerned, I cannot seem to reach a conclusion as to why if the statement holds for n, then it holds for n+1.  Any help would be appreciated. What to do with an Ubuntu disk image that appears as a WinRAR file? What is the structure in "as best you can"? I instinctively translate it "as best as you can", however this makes no sense.  What is the real structure behind this phrase?  I'll include an  to illustrate the historical presence of this phrase:    Whatever the structure is, I'm guessing that it has something to do with 19th century grammar. Requires installation of untrusted packages? Help me to get command or ansibile Regex to fetch below details How do I kill a process that won't die? I'm unable to kill a process using any of the techniques I'm aware of ("Force Quit" in Activity Monitor, top, killall from the Terminal) and wonder if there are some additional steps I can take.    ~ $ sudo killall -KILL 77439 Password: No matching processes were found ~ $ killall -KILL 77439 No matching processes belonging to you were found ~ $ killall 77439 No matching processes belonging to you were found ~ $ killall Mathematica No matching processes belonging to you were found   FWIW the process is "Mathematica" which I cannot relaunch, Quit, or Force Quit, or sample, either by name or PID, and it appears to have some odd side effects (screenshots don't appear, can't empty trash, and can't even shut down the system).  Are there additional steps that can be taken to really really kill a badly behaved process? I am trying to prove that any conjugate of $a$ has the same order as $a$.  Let $G$ be a group and let $a \in G$.  An element $b \in G$ is called a conjugate of $a$ if $b=xax^{-1}$.  My professor gave us a hint.  Prove $a^k=e$ iff $b^k=e$ for all $k \in \mathbb{Z}$ implies $o(a) = o(b)$.  My first move is to $b^k = (xax^{-1})^k = (x^{-1})^ka^kx^k = (x^{-1})^kex^k = (x^{-1})^kx^k=x^{-k+k}=x^0$  I am not sure that I am doing this correctly?  I am trying to get $b^k=e$.  However when I raise $(xax^{-1})^k$, I am not sure if I what I have done is correct?  I am kind of confused here. How to correctly add a path to PATH? I'm wondering where a new path has to be added to the PATH environment variable. I know this can be accomplished by editing .bashrc (for example), but it's not clear how to do this.  This way:  export PATH=~/opt/bin:$PATH   or this?    export PATH=$PATH:~/opt/bin There is a problem with my logic and I cannot seem to point out where. There's a rocket ship travelling at close-to-c speed v without any acceleration (hypothetically), and there is an observer AA with a clock A on Earth, and there's another observer on the rocket BB with a clock B and these two clocks were initially in sync when the rocket was at rest with a FoR (frame of reference) attached to Earth. Now, this rocket's moving and AA tells us that B is running slower than A by a factor of$$ \gamma = 1 /(1-v^2/c^2)^{1/2} $$ $$ t_A/t_B = \gamma $$ where v is the relative 1d- velocity between the two i.e the earth and the rocket! That would mean the time elapsed on A is greater than that on B but this will happen only in the FoR of AA? So $t_B$ in this equation must be the time on B as observed by AA? Is this correct? What do the terms mean in the equations? If the symmetry holds and BB doesn't accelerate, then BB could say that $$ t_B/t_A = \gamma $$ right? where $t_B$ and $t_A$ are the times on B and A with respect to FoR of BB? But I was solving this problem and I took the earth FoR of A, but the prof took the rocket FoR of B? Like how will I know which FoR to solve the problem from? It'd greatly help if the terms in all the above equations were laid down neatly! DO we even need these FoRs?? Because in all the solved problems the prof is't specifying any and is using random ones! Please help!!!! This is the question where I messed up. The first rocket bound for Alpha Centauri leaves Earth at a velocity (3/5)c. To commemorate the ten year anniversary of the launch, the nations of Earth hold a grand celebration in which they shoot a powerful laser, shaped like a peace sign, toward the ship.  According to Earth clocks, how long after the launch (of the rocket) does the rocket crew first see the celebratory laser light?  This must be 25 years. My reasoning is: If v = 3c/5 10v + vt = ct where t is time taken by the light to reach the rocket from Earth as calculated from Earth.. and I solved that for t. and added 10 years to that because the time starts at the launch of the rocket!  According to clocks on the rocket, how long after the launch does the rocket crew first see the celebratory laser light?  This is 20 years. Here, I say: If it takes 25 years as observed by clocks on earth for the laser to reach the rocket, what should be the corresponding time as seen on a clock on the rocket? Using the formula: 25 = $\gamma$t where $\gamma$= 5/4 solved for t!  According to the rocket crew, how many years had elapsed on the rocket's clocks when the nations of Earth held the celebration? That is, based on the rocket crews' post-processing to determine when the events responsible for their observations took place, how many years have passed on the rocket's clocks when the nations of Earth hold the celebration?  For this, I did the following: 10 years on earth = T years on rocket ship where T must be lesser than 10 as observed from Earth FoR! Therefore, T= 4(10)/5 years = 8 years! But, prof says, 10 years on Earth = T years in rocket ship where T must be GREATER than 10 as observed from the rocket FoR??? Therefore, T = 10(5/4) years = 12.5 years!! What does this question actually want?