I had to upgrade to python 3.5.2 to meet the requirements for another application. After I did I started having trouble with urllib results. The below code is returning "b'0'" but the 2.7 version returned just "0". How do I go back to just getting "0"?  Here is my code:  with urllib.request.urlopen('https://blockexplorer.com/api/addr/19hMEAaRMbEhfSkeU4GT8mgSuyR4t4M6TH/balance') as req:                 balance = req.read() print(balance)
I'm using this code to get standard output from an external program:  &gt;&gt;&gt; from subprocess import * &gt;&gt;&gt; command_stdout = Popen(['ls', '-l'], stdout=PIPE).communicate()[0]   The communicate() method returns an array of bytes:  &gt;&gt;&gt; command_stdout b'total 0\n-rw-rw-r-- 1 thomas thomas 0 Mar  3 07:03 file1\n-rw-rw-r-- 1 thomas thomas 0 Mar  3 07:03 file2\n'   However, I'd like to work with the output as a normal Python string. So that I could print it like this:  &gt;&gt;&gt; print(command_stdout) -rw-rw-r-- 1 thomas thomas 0 Mar  3 07:03 file1 -rw-rw-r-- 1 thomas thomas 0 Mar  3 07:03 file2   I thought that's what the  method is for, but when I tried it, I got the same byte array again:  &gt;&gt;&gt; binascii.b2a_qp(command_stdout) b'total 0\n-rw-rw-r-- 1 thomas thomas 0 Mar  3 07:03 file1\n-rw-rw-r-- 1 thomas thomas 0 Mar  3 07:03 file2\n'   How do I convert the bytes value back to string? I mean, using the "batteries" instead of doing it manually. And I'd like it to be OK with Python&nbsp;3.
Cyclic Quadrilateral Problems Sort array of objects by string property value I've occasionally noticed an OP who will edit their own question and destroy it completely, always leaving some kind of graffiti-like scrawl in its place.  This seems to happen on low-quality questions by low-rep users, and the moment of self destruction tends to occur after the question is closed or otherwise devolves into a communication breakdown between the poster and the community.  Here are some examples:        It seems like the poster usually does this in anger (1st and 3rd example), or else is just confused about how to delete their question (2nd example).  My question is about how this should be handled. In the past I wasn't sure, so I always flagged for mod attention. However I notice the solution on all of these was to just do a rollback (I did this myself on the 2nd example after nothing happened). Is this a good enough approach, or should a flag be used?  What about with particularly obnoxious users like in the third example, where the guy came back to do it again? Is there a comma needed before quotation? Sam developed an annual sweepstakes promotion entitled “The Free Gas Punt Return Game”.    Do I need a comma after entitled or not? Why are doctors addressed as Mr. in the UK? In the US most physicians, surgeons and dentists are addressed as "doctor". Very few other professionals receive the same title.  In the UK, however, surgeons and dentists seem to prefer to be referred to as Mr. If that is true, why?  And who is addressed as Dr. in the UK?  Those who hold doctoral degrees only? What is the difference between IQueryable and IEnumerable? What is the difference between IQueryable&lt;T&gt; and IEnumerable&lt;T&gt;?    See also  that overlaps with this question. PhD duration in the USA I am trying to find out what the average duration of PhD studies are in the USA. Here in Spain it used to be 4 years, but it seems that Europe is moving towards a 3-year scheme since students are expected to do their MSc before they start. What is it like in the USA? Is some kind of shortening also occurring? Print composer problems Qgis 2.8 Wien with Google Satellite I am having serious problems in exporting a map (Google satellite map) linked to QGIS.   Using the print editor I clearly see the part of the map I want to print and also in the right scale, but when I save it as jpeg, the result is: the correct map in a circle in the middle of the page, and all around it seems that Qgis is zooming at different scale on another part of the map [see attached file].  Any suggestion about it ? I don't want to save it as simple screenshot  because I need an HD file.   ] How can I set the value of auto property backing fields in a struct constructor? Given a struct like this:  public struct SomeStruct {     public SomeStruct(String stringProperty, Int32 intProperty)     {         this.StringProperty = stringProperty;         this.IntProperty = intProperty;     }      public String StringProperty { get; set; }     public Int32 IntProperty { get; set; } }   Of course, a compiler error is generated that reads The 'this' object cannot be used before all of its fields are assigned to.  Is there a way to assign values to the backing fields or the properties themselves, or do I have to implement properties the old-fashioned way with my own explicit backing fields? I'm looking for an easy and robust way to strip all the comments from a listing. My approach (passing \@gobble to the commentstyle key) correctly removes all the one-line comments and block comments. However, the white space left behind by by block comments remains, creating useless gaps in my listing. See the screenshot below (the red rectangle is my emphasis). Any idea?    \documentclass{article}  \usepackage{xcolor} \usepackage[T1]{fontenc} \renewcommand{\ttdefault}{pcr} \usepackage{listings}  \makeatletter \lstset% {%   basicstyle   = \ttfamily,   morecomment  = [l]{//},   morecomment  = [s]{/*}{*/},   frame        = single,   commentstyle = \itshape\color[gray]{.5},   rulecolor    = \color{black},   breaklines, } \makeatother  \usepackage{filecontents} \begin{filecontents*}{sample.c} #include &lt;stdio.h&gt;  /*  block comment taking up white space */ main() {     float fahr, celsius;     float lower, upper, step;     lower   = 0;    /* lower limit of temperature scale */     upper   = 300;  /* upper limit */     step    = 20;   /* step size */     celsius = lower;     printf("\nCelsius\tFahr\n");     while (celsius &lt;= upper)        {         fahr = (9.0/5.0) * celsius+32.0;         printf("%3.0f\t%6.1f\n", celsius, fahr);         celsius = celsius + step;     } } \end{filecontents*}  \begin{document} \makeatletter \lstinputlisting[caption={with comments}]{sample.c} \lstinputlisting[caption={without comments},commentstyle={\@gobble}]{sample.c} \makeatother \end{document} Generate dynamic XY coordinate labels for dataframe corners in ArcGIS layout I need to label the four corners of a dataframe as shown in the image. Can this be done with dynamic text scripts? Why $\sqrt{-1 \cdot {-1}} \neq \sqrt{-1}^2$? I know there must be something unmathematical in the following but I don't know where it is: \begin{align} \sqrt{-1} &amp;= i \\\\\ \frac1{\sqrt{-1}} &amp;= \frac1i \\\\  \frac{\sqrt1}{\sqrt{-1}} &amp;= \frac1i \\\\  \sqrt{\frac1{-1}} &amp;= \frac1i \\\\  \sqrt{\frac{-1}1} &amp;= \frac1i \\\\  \sqrt{-1} &amp;= \frac1i \\\\  i &amp;= \frac1i \\\\  i^2 &amp;= 1 \\\\  -1 &amp;= 1 \quad !!? \end{align} How can I kill the Mirelurk Queen? If $R_{1}$ and $R_{2}$ are relations on a set S with $R_{1};R_{2}=R_{2};R_{1}$. Then $R_{1}$ and $R_{2}$ are bijective maps For the surjectivity part, I showed that if $(a,b)\in I$ then $(a,c)\in R_{1}$ and $(c,b)\in R_{1}$ and $(a,c)\in R_{2}$ and $(c,b)\in R_{2}$ for some $c\in S$. Now for arbituary $(x,y)\in R_{1}$ we have $(x,z)\in I$ which implies that $(y,z)\in R_{2}$. But also $(y,z)\in R_{1}$, so $R_{1}$ is surjective. Similar argument for $R_{2}$  And for Injectivity, I've tried to show that if $aR_{1};R_{2}c$ and $bR_{2};R_{1}c$, then $a=b$ but I am not entirely sure what $a=b$ means in this context. Do I have to show that there is an equivalence relation containing (a,b)?  edit: $R_{1};R_{2}$ is a composition of two relations and $I=R_{1};R_{2}$ Today a student asked me $\int \ln (\sin x) \, dx.$ Calculate the integral $$\int \ln (\sin x) \, dx.$$ Partial instead of full markers are shown in PGFplots When using  \documentclass{article} \usepackage{pgfplots} \begin{document} \begin{tikzpicture}         \begin{axis}                     \addplot             [                 red,                 solid,                 mark=x,                 domain=-3e-3:3e-3,                 samples=50             ]              {exp(-x^2/(2e-3^2))/(1e-3*sqrt(2*pi))};         \end{axis}     \end{tikzpicture}    \end{document}   the markers look fine, see    , but when I replace solid with, for instance, loosely dashed, so  \documentclass{article} \usepackage{pgfplots} \begin{document} \begin{tikzpicture}         \begin{axis}                     \addplot             [                 red,                 loosely dashed,                 mark=x,                 domain=-3e-3:3e-3,                 samples=50             ]              {exp(-x^2/(2e-3^2))/(1e-3*sqrt(2*pi))};         \end{axis}     \end{tikzpicture}    \end{document}   the markers only show partially instead of fully, see    . How can I use loosely dashed with full markers showing? Is Borden's true identity real, or another ruse? Towards the end of , it's revealed that Borden accomplishes his Transported Man trick by using his twin brother, Fallon, as a double. It then becomes clear that he has been doing this in his personal life as well as on stage - each brother leads 'half a life', sometimes appearing as Borden and sometimes as Fallon. This is how he completes the illusion: one Borden goes into the first door, the other Borden emerges from the second door a moment later. Angier doesn't know how Borden does the trick, and doesn't believe Borden uses a double despite being told as much by Cutter. He follows what he believes to be a clue in Borden's notebook and travels to Colorado to meet Nikola Tesla, who Angier believes can build a machine that can help him perform the trick. Angier believes that Tesla built a similar machine for Borden. However, the final pages of the notebook reveal that Tesla was merely a red herring, designed to get Angier out of Borden's way for a long time. Tesla, it turns out, had never built such a machine before. At this point, Tesla agrees to build Angier's machine anyway. Instead of building a machine that transports matter, he builds one that duplicates it. Angier uses this machine in his act, but in order to avoid having to deal with multiple clones (the &quot;prestige materials&quot;), one of them must die as part of the act. This all makes sense, so far, but I find it hard to believe that Borden's use of the word 'Tesla' as the key to his cipher is random. It's too coincidental that he sends Angier on a wild goose chase, but Angier returns with a working machine. A film that is otherwise so tightly plotted shouldn't rely on coincidence to move the narrative forward, so there must be something else going on. Is it possible that Borden cloned himself using Tesla's machine? Confidence Interval Calculation I have temperature data of July 1991 to 2007, and wants to find the Confidence Interval at 95%, which distribution is best fit the data, Z or T. Please give me reason also.    minTemp = 14.4444, maxTemp = 38.3333, SizeofData = 527, (17 years) hist(July, 20), histfit(July, 20); I have been working with a string[] array in C# that gets returned from a function call. I could possibly cast to a Generic collection, but I was wondering if there was a better way to do it, possibly by using a temp array.  What is the best way to remove duplicates from a C# array? Is AES in CBC mode secure if a known and/or fixed IV is used? I have a need to encrypt credentials for a third-party app used by a secured internal app. Over on ITSec.SE, I was helpfully shown a scheme to encrypt the third-party credentials based on a hash of the credentials for the internal app.   I picked AES as the encryption algorithm, but the problem is that the password-based scheme doesn't produce a "secret" IV. So, the IV must at least be known to an attacker (stored alongside the encrypted data). A hash value used for password verification could work, or I could just generate a pseudorandom byte array and drop it in the DB as a new column. I was further considering, for simplicity, to use a constant IV.   What adverse effect will either of these choices have on the security of the encryption? Does AES depend, as many block ciphers do, on an unpredictable IV? Does it matter if the IV is stored as unencrypted plaintext?