I wnat to measure python power consumption while one or more python code is running.  How to measure power consumption for running python code on MacBook Air?
What's your preferred way of getting current system status (current CPU, RAM, free disk space, etc.) in Python? Bonus points for *nix and Windows platforms.  There seems to be a few possible ways of extracting that from my search:   Using a library such as  (that currently seems not actively developed and not supported on multiple platform) or something like  (again no activity since 2007 it seems and no support for Windows). Using platform specific code such as using a os.popen("ps") or similar for the *nix systems and MEMORYSTATUS in ctypes.windll.kernel32 (see ) for the Windows platform. One could put a Python class together with all those code snippets.   It's not that those methods are bad but is there already a well-supported, multi-platform way of doing the same thing?
Does Earth really have two high-tide bulges on opposite sides? The bit that makes sense – tidal forces My physics teacher explained that most tidal effect is caused by the Moon rotating around the Earth, and some also by the Sun. They said that in the Earth and Moon system, the bodies are in freefall about each other. But that points on the surface of Earth, not being at Earth's centre of gravity, experience a slightly different pulls towards the Moon. The pull is a little greater if they are on the Moon's side, and slightly lesser if they are on the side away from the Moon. Once freefall is removed, on the Moon side this feels like a pull towards the Moon and on the the opposite side it feels like a repulsion from the Moon. This makes sense to me, and is backed up by other questions and answers here, like  and also  Phys.SE question. The bit that doesn't make sense – tidal bulges They also said that there are &quot;tidal bulges&quot; on opposite sides of the Earth caused by these forces. The bulges stay still relative to the Moon and Earth rotating through the bulges explains why we get two tides a day. They drew a picture like this one…  An image search for  finds hundreds of similar examples, and  from a scientist on Twitter. …But, if there is a tidal bulge on both sides of Earth, like a big wave with two peaks going round and around, how can an island, like Great Britain where I live, simultaneously have a high tide on one side and a low tide on the other? For example:   on the West coast  on the East  Two ports with tides 6 hours, or 180º apart. It's high tide at one while low tide at the other. But they are only  by road. Great Britain is much smaller than Earth. It's probably not even as big as the letter &quot;A&quot; in the word &quot;TIDAL&quot; in that picture.  To prove this isn't just Britain being a crazy anomaly, here is another example from New Zealand:     Two ports that are 180º (6 hours) apart, but separated by  through a national park. New Zealand, unlike the UK, is in fairly open ocean. nodes near coords with logarithmic axis: Wrong values I created a horizontal bar plot to compare benchmark times. Since one of the tested components is really slow, I need a logarithmic y axis for the other values to be distinguishable. Combined with "nodes near coords" this results in the calculated values showing, instead of the original ones. Is there any way to fix this?  What it looks like:   What the values(!) should look like:   Clearly, I'm overlooking something terribly obvious. I'm just a beginner at PGFPlots, so please don't kill me. :)  MWE:  \documentclass[fontsize=12pt]{scrartcl}  \usepackage{pgfplots} \pgfplotsset{compat=1.8}  \begin{document}   \begin{tikzpicture}   \begin{axis}[      width=12.5cm,     xbar=0.1cm,     xmin=0,     y=0.6cm,     bar width=0.4cm,     xlabel={Time (ms)},     xmode=log,     major x tick style = transparent,     major y tick style = transparent,     symbolic y coords={       {SpreadsheetGear},       {Aspose.Cells},       {NPOI},       {C1.Excel},       {Spire.XLS},       {GemBox.Spreadsheet},       {SmartXLS},     },     ytick=data,     y dir = reverse,      nodes near coords,     nodes near coords align={horizontal},   ]    \addplot coordinates {       (3078.6,{Aspose.Cells})       (10059.2,{C1.Excel})       (28794.8,{GemBox.Spreadsheet})       (7437079.8,{SmartXLS})       (19975.2,{Spire.XLS})       (573.2,{SpreadsheetGear})       (10025.2,{NPOI})};   \end{axis}   \end{tikzpicture} \end{document} The statement is:     In a commutative ring with 1, every proper ideal is contained in a maximal ideal.   and we prove it using Zorn's lemma, that is, $I$ is an ideal, $P=\{I\subset  A\mid A\text{ is an ideal}\} $, then by set inclusion, every totally ordered subset has a bound, then $P$ has a maximal element $M$.  My question is why $M$ must contain $I$? given value of matrix, getting it's coordinate How to delete Windows.old in Windows 8 It seems to be a common thing that a Windows Update creates a Windows.old folder under C:\Windows.old My question is now, can it be deleted with Windows 8 and how can I do that?  If I try to manually delete it in Windows Explorer it does not let me, a permissions issue. What's the application extension? (aka .exe, .app, etc.) I'm new to Ubuntu. What's the application extension for development reasons? I know Windows is mainly .exe and Mac is .dmg or .app. Does Linux have an unique one? I have a website with software applications. Is it good for SEO to choose one keyword rich domain name for each of our software products or should we stick to a single domain?  From a user's perspective I think it would be easier to remember a domain that is keyword rich as the user will instantly know what this product is for.  But I have read articles that the latest trend in SEO is to stick to one domain for all of your products and invest on this single domain website.  Is that true? What do you advise? Should I register a separate domain for each of our products or should I use only one single domain?  Should I do a 301 redirect with a .htaccess to a single domain? And what about the sitemaps? Should I register all sites in Google Webmaster Tools and post a separate sitemap for each one of them? should my main site sitemap include all pages or should separate domains have their own sitemaps? Serial voteup someone you learn from I have filed my 2012 tax return jointly with my wife, along with my wife's ITIN application, back in late March.  In April, I got a letter for IRS ITIN department saying that we should send my wife's original passport to them. So we sent my wife's passport on May 15th. USPS tracking number confirmed that IRS received it on May 20th.  However, last week (end of June) we have received another letter from IRS ITIN department saying that our ITIN application has been rejected, rejected because we have not sent the original identification document that they requested!  Okay, let's put our tax return and ITIN aside. Where is my wife's passport? Right now my wife does not have her personal identification, nor proof of legal status in U.S. Could IRS have lost it?  I tried to call the IRS several times. One time I waited for 1 hour and 20 minutes to talk to a person, and that person said he has only 10 minutes to talk before he has to leave. He said they'll investigate and someone(?) will call us back soon, but never called back. I wrote them a letter, but no response. I tried calling several times more, but machine is saying 'sorry too many calls right now, we can't accept your call'.  What can I do? Multi-line list items on WinForms ListBox control? Why does LuaTeX plus breqn quadruple output of \text{} when in display-math mode? MWE needs to be compiled with LuaTeX to reproduce the problem:  \documentclass[11pt]{report}% \usepackage{amsmath,mathtools} \usepackage{breqn}                          \begin{document} $J^{\ast} = \text{JFK} \to \text{NO} \to \text{SFO}$ \[ J^{\ast} = \text{JFK} \to \text{NO} \to \text{SFO} \] \end{document}   Gives (no compile error or any warning) the following strange output    I have to use breqn package. If I remove it, then I get the expected output    Is there a way to work around this, so I can use breqn and get correct output?  TL 2015. filelist: (compiled with lualatex)  This is LuaTeX, Version beta-0.80.0.1 (TeX Live 2015) (rev 5863)   *File List*   report.cls    2014/09/29 v1.4h Standard LaTeX document class   size11.clo    2014/09/29 v1.4h Standard LaTeX file (size option)  amsmath.sty    2013/01/14 v2.14 AMS math features  amstext.sty    2000/06/29 v2.01   amsgen.sty    1999/11/30 v2.0   amsbsy.sty    1999/11/29 v1.2d   amsopn.sty    1999/12/14 v2.01 operator names mathtools.sty    2015/11/12 v1.18 mathematical typesetting tools   keyval.sty    2014/10/28 v1.15 key=value parser (DPC)     calc.sty    2014/10/28 v4.3 Infix arithmetic (KKT,FJ)  mhsetup.sty    2010/01/21 v1.2a programming setup (MH)    breqn.sty    2015/08/11 v0.98d Breaking equations    expl3.sty    2015/12/20 v6326 L3 programming layer (loader)  expl3-code.tex    2015/12/20 v6326 L3 programming layer  l3pdfmode.def    2015/11/11 v6250 L3 Experimental driver: PDF mode flexisym.sty    2015/08/11 v0.98d Make math characters macros   cmbase.sym    2007/12/19 v0.92 mathstyle.sty    2015/08/11 v0.98d Tracking mathstyle implicitly graphicx.sty    2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR) graphics.sty    2014/10/28 v1.0p Standard LaTeX Graphics (DPC,SPQR)     trig.sty    1999/03/16 v1.09 sin cos tan (DPC) graphics.cfg    2010/04/23 v1.9 graphics configuration of TeX Live   pdftex.def    2011/05/27 v0.06d Graphics/color for pdfTeX infwarerr.sty    2010/04/08 v1.3 Providing info/warning/error messages (HO)  ltxcmds.sty    2011/11/09 v1.22 LaTeX kernel commands for general use (HO) supp-pdf.mkii pdftexcmds.sty    2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO) ifluatex.sty    2010/03/01 v1.3 Provides the ifluatex switch (HO)    ifpdf.sty    2011/01/30 v2.3 Provides the ifpdf switch (HO) luatex-loader.sty    2010/03/09 v0.4 Lua module loader (HO) epstopdf-base.sty    2010/02/09 v2.5 Base part for package epstopdf   grfext.sty    2010/08/19 v1.1 Manage graphics extensions (HO) kvdefinekeys.sty    2011/04/07 v1.3 Define keys (HO) kvoptions.sty    2011/06/30 v3.11 Key value format for package options (HO) kvsetkeys.sty    2012/04/25 v1.16 Key value parser (HO) etexcmds.sty    2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO) epstopdf-sys.cfg    2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live  ***********   Update  I found another case of duplication when using breqn, which does not involve \text at all. But the solution provided below also fixes this issue. I am adding this second case here for reference just in case it might be useful. Here is MWE  \documentclass[11pt]{article} \usepackage[T1]{fontenc} \usepackage{amsmath,mathtools} \usepackage{breqn} \begin{document} \[ \underset{\mathbf{S}} {\operatorname{arg\,min}}      \sum_{i=1}^{k} \sum_{\mathbf x \in S_i}       \left\| \mathbf x - \boldsymbol\mu_i \right\|^2  \] \end{document}   The output is    After adding the patch in the answer below the correct output is now given, which is Consider a cement block of the same density as sea-water resting on the (perfectly polished) seafloor. I also assume the side-faces of the cement block are highly polished, so that no vertical hydrostatic forces can attack on them. A cable is attached to the top of the block.  My question ist: How much force must one apply to the cable before the cement block begins to lift off the seafloor?  The normal response would be to say that only a negligible force is needed - as the block is practically suspended in the water.  However, as the bottom surface of the cement block is not in contact with the water, it is NOT experiencing the hydrostatic pressure from below - only from above.  Before the crane starts lifting, the (zero-sum) forces on the cement block are:  $$F_{Seawater Pressure} +F_{Gravity on Cement Block} - F_{Seafloor Resistance} = 0$$  as the crane starts applying Force, the Seafloor will reduce its Resistance in the same measure, leaving the forces on the cement block zero:  $$F_{Seawater Pressure} +F_{Gravity on Cement Block} - (F_{Seafloor Resistance}+F_{Crane}) = 0$$  Just before the Cement block lifts, the Seafloor will stop applying Force and the Crane will be applying the only upward Force:  $$F_{Crane} = F_{Seawater Pressure} +F_{Gravity on Cement Block}$$  Once the Cement block lifts off the sea-floor, hydrostatic pressure kicks in on the lower cement surface, suspending the block, but before that - boy does it take a lot of force to lift it!  What is wrong with this reasoning? I am trying to use netcat to send a simple message over TCP, e.g. I want to send the digit 1.  So I understood that I write the following in the terminal, after installing netcat  netcat [ip-address] [port]  But how do I specify the message to be sent? i.e. where to I write "1" ? Maximum Likelihood Estimate with different parameters Suppose that X and Y are independent Poisson distributed values with means $\theta$ and $2\theta$, respectively. Consider the combined estimator of $\theta$ $$ \tilde{\theta} = k_1 X + k_2 Y $$ where $k_1$ and $k_2$ are arbitrary constants.   Find the condition on $k_1$ and $k_2$ such that $\tilde{\theta}$ is an unbiased estimator of $\theta$. For $\tilde{\theta}$ unbiased, show that the variance of the estimator is minimized by taking $k_1 = 1/3$ and $k_2 = 1/3$. Given observations $x$ and $y$ find the maximum likelihood estimate of $\theta$ and hence show that $\tilde{\theta}$ is also the maximum likelihood estimator.   I have gotten (1) and (2) okay, but it's (3) I am having trouble with, I'd be okay if $X$ and $Y$ had the same parameter but I'm having trouble with $X$ and $Y$ having different parameters, any help would be appreciated.   NOTE   For (1) I got $k_1 = 1 - 2k_2$.   For (2) I found the variance of $\tilde{\theta}$, then differentiated and let equal to zero to minimize - therefore we get (after subbing in $k_2 = 1 - k_1/2 $) $$3k_1-1=0,$$ which when subbing in $1/3$, we see it is minimised.   Thank you. Should a toggle button show its current state or the state to which it will change? I have a quick question about buttons that toggle between two states. (Think Play/Pause, or Shuffle/Regular Play.) As the title says, should the toggle show it's current state or the state to which it will transition?  I think people are used to the Play/Pause convention. But the Shuffle/Regular play might be more confusing if you show the transition state instead of current. For example, the built-in music player on the Xbox 360 does it this way: when it's in shuffle mode, it shows the icon for direct play and vice versa and it always confuses me (am I in shuffle mode or straight play).  I see it this way: Play/Pause is more like action as in begin playing or pause playing. Yes behind the scenes it is a state transition but to the user, there is an action. Whereas Shuffle/Straight Play is an option and it's best to show the current state (and possibly have only one icon and change button to show that the option is enabled/disabled). Thoughts? Can someone identify this book, where children are bred for specific jobs? Things I remember about this book:   Every child was selected for a certain job/career; If twins were born, one was always killed; Seeing colors for the first time (describing the color of an apple); Seeing war and death and poverty.   Does anyone have any idea what this book might be? If $\gcd(a,b)=1$, how can I find the values that $\gcd(a+b,a^2+b^2)$ can possibly take? I can't find a way to use any of the elemental divisibility and gcd theorems to find them. Choice of personal pronoun in single-author papers Which personal pronoun is appropriate in single-author papers - 'I' or 'we'? Could the use of 'I' be considered egotistical? Or will the use of 'we' be considered to be grammatically incorrect? Modelling the "Moving Sofa" I believe that many of you know about the moving sofa problem; if not you can find the description of the problem .     In this question I am going to rotate the L shaped hall instead of moving a sofa around the corner. By rotating the hall $180^{\circ}$ what remains between the walls will give the shape of the sofa. Like this:    The points on the hall have the following properties:  \begin{eqnarray} A &amp; = &amp; \left( r\cos { \alpha  } ,t\sin { \alpha  }  \right)  \\ { A }' &amp; = &amp; \left( r\cos { \alpha  } +\sqrt { 2 } \cos { \left( \frac { \pi  }{ 4 } +\frac { \alpha  }{ 2 }  \right)  } ,t\sin { \alpha  } +\sqrt { 2 } \sin { \left( \frac { \pi  }{ 4 } +\frac { \alpha  }{ 2 }  \right)  }  \right)  \\ { B } &amp; = &amp; \left( r\cos { \alpha  } -\frac { t\sin { \alpha  }  }{ \tan { \left( \frac { \alpha  }{ 2 }  \right)  }  } ,0 \right)  \\ { B }' &amp; = &amp; \left( r\cos { \alpha  } -\frac { t\sin { \alpha  }  }{ \tan { \left( \frac { \alpha  }{ 2 }  \right)  }  } -\frac { 1 }{ \sin { \left( \frac { \alpha  }{ 2 }  \right)  }  } ,0 \right)  \\ C &amp; = &amp; \left( r\cos { \alpha  } +t\sin { \alpha  } \tan { \left( \frac { \alpha  }{ 2 }  \right)  } ,0 \right)  \\ { C }' &amp; = &amp; \left( r\cos { \alpha  } +t\sin { \alpha  } \tan { \left( \frac { \alpha  }{ 2 }  \right)  } +\frac { 1 }{ \cos { \left( \frac { \alpha  }{ 2 }  \right)  }  } ,0 \right)  \end{eqnarray}  Attention: $\alpha$ is not the angle of $AOC$, it is some angle $ADC$ where $D$ changes location on $x$ axis for $r\neq t$. I am saying this because images can create confusion. Anyways I will change them as soon as possible.  I could consider $r=f(\alpha)$ and $t=g(\alpha)$ but for this question I am going to take $r$ and $t$ as constants. If they were functions of $\alpha$ there would appear some interesting shapes. I experimented for different functions however the areas are more difficult to calculate, that's why I am not going to share. Maybe in the future.  We rotate the hall for $r=t$ in the example above: In this case:   point A moves on a semicircle  The envelope of lines between A' and C' is a circular arc. One has to prove this but I assume that it is true for $r=t$.   If my second assumption is correct the area of sofa is $A= 2r-\frac { \pi r^{ 2 } }{ 2 } +\frac { \pi  }{ 2 } $. The maximum area is reached when $r = 2/\pi$ and it's value is: $$A = 2/\pi+\pi/2 = 2,207416099$$  which matches with Hammersley's sofa. The shape is also similar or same:    Now I am going to increase $t$ with respect to $r$. For $r=2/\pi$ and $t=0.77$:    Well, this looks like .   I believe thearea can be maximized by finding the equations of envelopes above and below the sofa. Look at  where @Aretino has computed the area below $ABC$.   I don't know enough to find equations for envelopes. I am afraid that I will make mistakes. I considered to calculate area by counting number of pixels in it, but this is not a good idea because for optimizing the area I have to create many images.  I will give a bounty of 200 for whom calculates the maximum area. As I said the most difficult part of the problem is to find equations of envelopes. @Aretino did it.  PLUS: Could following be the longest sofa where $(r,t)=((\sqrt 5+1)/2,1)$ ?   If you want to investigate further or use animation for educational purposes here is the Geogebra file:      Ok, I had some free time and I count number of pixels in the sofa and I am sure that I have something bigger than Hammersley's constant.  First, I made a simulation for Hammersley's sofa where $r=t=2/\pi$ and exported the image to png in 300 dpi (6484x3342 pixels) and using Gimp counted number of pixels which have exactly same value. For Hammersley I got $3039086$ pixels.   For the second case $r=0.59$ and $t=0.66$ and I got $3052780$ pixels. To calculate area for this case:  $$\frac{3052780}{3039086}(2/\pi + \pi/2)=2.217362628$$  which is slightly less than Gerver's constant which is $2.2195$. Here is the sofa: How do I copyright my website? My website has been in development for a long time and cost a lot of money.  How do I go about securing an enforceable copyright on my website design and what is the proper way to post a copyright notice on the site so others know the work is copyrighted?