<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dw="https://www.dreamwidth.org">
  <id>tag:dreamwidth.org,2009-04-21:107589</id>
  <title>Tang's DW</title>
  <subtitle>tangaroa</subtitle>
  <author>
    <name>tangaroa</name>
  </author>
  <link rel="alternate" type="text/html" href="https://tangaroa.dreamwidth.org/"/>
  <link rel="self" type="text/xml" href="https://tangaroa.dreamwidth.org/data/atom"/>
  <updated>2014-05-14T16:47:17Z</updated>
  <dw:journal username="tangaroa" type="personal"/>
  <entry>
    <id>tag:dreamwidth.org,2009-04-21:107589:79000</id>
    <link rel="alternate" type="text/html" href="https://tangaroa.dreamwidth.org/79000.html"/>
    <link rel="self" type="text/xml" href="https://tangaroa.dreamwidth.org/data/atom/?itemid=79000"/>
    <title>Nifty link of the nonce</title>
    <published>2014-05-14T16:47:17Z</published>
    <updated>2014-05-14T16:47:17Z</updated>
    <category term="programming"/>
    <category term="python"/>
    <category term="computers"/>
    <dw:security>public</dw:security>
    <dw:reply-count>0</dw:reply-count>
    <content type="html">&lt;p&gt;&lt;a href="https://jakevdp.github.io/blog/2014/05/09/why-python-is-slow/"&gt;"Why Python Is Slow"&lt;/a&gt; is a quick read on Python's dynamic typing. I had not known that it was possible to change the value of an integer constant in Python.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src="https://www.dreamwidth.org/tools/commentcount?user=tangaroa&amp;ditemid=79000" width="30" height="12" alt="comment count unavailable" style="vertical-align: middle;"/&gt; comments</content>
  </entry>
  <entry>
    <id>tag:dreamwidth.org,2009-04-21:107589:72161</id>
    <link rel="alternate" type="text/html" href="https://tangaroa.dreamwidth.org/72161.html"/>
    <link rel="self" type="text/xml" href="https://tangaroa.dreamwidth.org/data/atom/?itemid=72161"/>
    <title>Proprietary Value Decomposition</title>
    <published>2014-04-09T03:43:49Z</published>
    <updated>2014-04-09T03:43:49Z</updated>
    <category term="numpy"/>
    <category term="computers"/>
    <category term="python"/>
    <category term="programming"/>
    <category term="idl"/>
    <dw:security>public</dw:security>
    <dw:reply-count>0</dw:reply-count>
    <content type="html">&lt;p&gt;Math has a concept called &lt;a href="https://en.wikipedia.org/wiki/Singular_value_decomposition"&gt;singular value decomposition&lt;/a&gt;. The short version is that you put in one matrix and get three out. This apparently being a well known concept in engineering, it is implemented in the data analysis language &lt;a href="http://www.exelisvis.com/docs/SVDC.html"&gt;IDL&lt;/a&gt; and in the &lt;a href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.linalg.svd.html"&gt;NumPY&lt;/a&gt; library for Python, and you can probably guess where this is going. The singular value decomposition functions in IDL and NumPy produce different matrices for the same input matrix.

&lt;ul&gt;
&lt;li&gt;All three output matrices have their columns swapped.
&lt;li&gt;One of the columns in the 'u' matrix is the negative of the matching column in the other language. 
&lt;li&gt;One of the rows in the 'v' matrix is the negative of the matching row in the other language. 
&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/ul&gt;

&lt;p&gt;I've only tested one chunk of data, so I do not know if the pattern will hold for different input matrices.&lt;/p&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src="https://www.dreamwidth.org/tools/commentcount?user=tangaroa&amp;ditemid=72161" width="30" height="12" alt="comment count unavailable" style="vertical-align: middle;"/&gt; comments</content>
  </entry>
  <entry>
    <id>tag:dreamwidth.org,2009-04-21:107589:69279</id>
    <link rel="alternate" type="text/html" href="https://tangaroa.dreamwidth.org/69279.html"/>
    <link rel="self" type="text/xml" href="https://tangaroa.dreamwidth.org/data/atom/?itemid=69279"/>
    <title>Obscure bug of the nonce</title>
    <published>2014-03-23T13:44:38Z</published>
    <updated>2014-03-23T16:54:13Z</updated>
    <category term="i18n"/>
    <category term="computers"/>
    <category term="python"/>
    <category term="debugging"/>
    <category term="programming"/>
    <category term="xml"/>
    <dw:security>public</dw:security>
    <dw:reply-count>0</dw:reply-count>
    <content type="html">Python easy_install on Windows sometimes fails with a UnicodeDecodeError:

&lt;blockquote&gt;
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 6034: ordinal not in range(128)
&lt;/blockquote&gt;

&lt;a href="http://stackoverflow.com/questions/19536068/mitmproxy-installation-by-the-python-setuptools-easy-install-got-error-decoding"&gt;The solution is to comment out the &lt;code&gt;config = config.decode('ascii')&lt;/code&gt; line in Lib/site-packages/setuptools/easy_install.py&lt;/a&gt;.

&lt;hr /&gt;

&lt;p&gt;Here's an even more fun one: 

&lt;blockquote&gt;&lt;pre&gt;
  File "geopts.py", line 128, in xp2str
    s = etree.tostring(resultset[0], method="text")
  File "lxml.etree.pyx", line 3165, in lxml.etree.tostring (src\lxml\lxml.etree.
c:69399)

exceptions.TypeError: Type '_ElementStringResult' cannot be serialized.
&lt;/pre&gt;&lt;/blockquote&gt;

&lt;p&gt;This says that the XML library's own tostring() function cannot convert one of its own string types to a string. What's especially brilliant about this is that &lt;a href="http://lxml.de/2.1/api/lxml.etree._ElementStringResult-class.html"&gt;_ElementStringResult inherits from the native string class&lt;/a&gt;. 

&lt;p&gt;Here is a hacky attempt to manage the problem:

&lt;blockquote&gt;&lt;pre&gt;
r = resultset[0]
if isinstance(r, etree._ElementStringResult):
    s = r
else:
    s = etree.tostring(r, method="text")

&lt;/pre&gt;&lt;/blockquote&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src="https://www.dreamwidth.org/tools/commentcount?user=tangaroa&amp;ditemid=69279" width="30" height="12" alt="comment count unavailable" style="vertical-align: middle;"/&gt; comments</content>
  </entry>
  <entry>
    <id>tag:dreamwidth.org,2009-04-21:107589:68628</id>
    <link rel="alternate" type="text/html" href="https://tangaroa.dreamwidth.org/68628.html"/>
    <link rel="self" type="text/xml" href="https://tangaroa.dreamwidth.org/data/atom/?itemid=68628"/>
    <title>easy_fail_to_install</title>
    <published>2014-03-19T00:31:13Z</published>
    <updated>2014-03-19T00:31:25Z</updated>
    <category term="perl"/>
    <category term="programming"/>
    <category term="windows"/>
    <category term="computers"/>
    <category term="python"/>
    <dw:security>public</dw:security>
    <dw:reply-count>0</dw:reply-count>
    <content type="html">This is only my opinion fwiw, but library/add-on packages for a high-level scripting language should not require a C compiler, any version of Visual Studio, or any development environment for any different lower-level language.&lt;br /&gt;&lt;br /&gt;&lt;img src="https://www.dreamwidth.org/tools/commentcount?user=tangaroa&amp;ditemid=68628" width="30" height="12" alt="comment count unavailable" style="vertical-align: middle;"/&gt; comments</content>
  </entry>
  <entry>
    <id>tag:dreamwidth.org,2009-04-21:107589:18218</id>
    <link rel="alternate" type="text/html" href="https://tangaroa.dreamwidth.org/18218.html"/>
    <link rel="self" type="text/xml" href="https://tangaroa.dreamwidth.org/data/atom/?itemid=18218"/>
    <title>Scrap dump: Key handling in PyGame</title>
    <published>2012-08-31T07:12:31Z</published>
    <updated>2012-08-31T07:12:31Z</updated>
    <category term="programming"/>
    <category term="computers"/>
    <category term="python"/>
    <category term="video games"/>
    <dw:security>public</dw:security>
    <dw:reply-count>0</dw:reply-count>
    <content type="html">&lt;p&gt;Some notes on keypress handling in Python's PyGame library, from about seven years ago: 

&lt;span class="cut-wrapper"&gt;&lt;span style="display: none;" id="span-cuttag___1" class="cuttag"&gt;&lt;/span&gt;&lt;b class="cut-open"&gt;(&amp;nbsp;&lt;/b&gt;&lt;b class="cut-text"&gt;&lt;a href="https://tangaroa.dreamwidth.org/18218.html#cutid1"&gt;Read more...&lt;/a&gt;&lt;/b&gt;&lt;b class="cut-close"&gt;&amp;nbsp;)&lt;/b&gt;&lt;/span&gt;&lt;div style="display: none;" id="div-cuttag___1" aria-live="assertive"&gt;&lt;/div&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src="https://www.dreamwidth.org/tools/commentcount?user=tangaroa&amp;ditemid=18218" width="30" height="12" alt="comment count unavailable" style="vertical-align: middle;"/&gt; comments</content>
  </entry>
</feed>
