<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>Professional IT and software development</description><title>Nate Silva</title><generator>Tumblr (3.0; @natesilva)</generator><link>http://blog.natesilva.com/</link><item><title>How to destroy your database in two clicks using Querious</title><description>&lt;p&gt;Open your database in &lt;a href="http://www.araelium.com/querious/" title="Araelium Group: Querious"&gt;Querious&lt;/a&gt;. Then:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click “Users.”&lt;/li&gt;
&lt;li&gt;Say to yourself, “I wonder what the button with two squares on it does.” Please don’t click the button. Because the instant you do, all of your rights are revoked and there is no way to recover them.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I hope you have another admin login. Otherwise you’re screwed.&lt;/p&gt;

&lt;p&gt;Yes, I did this on an &lt;a href="http://aws.amazon.com/rds/" title="Amazon Relational Database Service"&gt;Amazon RDS&lt;/a&gt; instance. Thank goodness it was a test database and I was just experimenting with Querious. I never imagined such a dangerous operation would happen without warning.&lt;/p&gt;

&lt;p&gt;Why on Earth doesn’t Querious have a warning or an “Apply” button so the change doesn’t happen instantly?&lt;/p&gt;

&lt;p&gt;See the &lt;a href="http://nate.s3.amazonaws.com/tumblr/sequel-pro.png" title="Sequel Pro Users Screen"&gt;equivalent screen&lt;/a&gt; in &lt;a href="http://www.sequelpro.com/" title="Sequel Pro"&gt;Sequel Pro&lt;/a&gt;, which has an “Apply” button, making it much safer.&lt;/p&gt;

&lt;p&gt;(I suspect you could also screw up your database by un-checking some of the other boxes. Again, there is no “Apply” button in Querious, so you will &lt;em&gt;instantly&lt;/em&gt; change your rights.)&lt;/p&gt;

&lt;p&gt;&lt;a href="http://nate.s3.amazonaws.com/tumblr/querious.png"&gt;&lt;img src="http://nate.s3.amazonaws.com/tumblr/querious-small.png" alt="Don’t click this button in Querious"/&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://blog.natesilva.com/post/661039145</link><guid>http://blog.natesilva.com/post/661039145</guid><pubDate>Thu, 03 Jun 2010 14:20:00 -0700</pubDate><category>querious</category><category>aws</category><category>sequelpro</category><category>mysql</category><category>rds</category><category>databases</category></item><item><title>How to build the pscyopg2 Python PostgreSQL interface on Mac OS X Snow Leopard</title><description>&lt;p&gt;&lt;em&gt;These instructions may work on earlier versions of OS X, but I’ve only tested on Snow Leopard.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A common problem for Python programmers using Mac OS X is how to install psycopg2, the standard Python interface for PostgreSQL.&lt;/p&gt;

&lt;p&gt;If you Google for the instructions, you’ll get all kinds of advice, most of which involves using MacPorts or installing a complete server installation of PostgreSQL on your Mac.&lt;/p&gt;

&lt;p&gt;I don’t want to do that.&lt;/p&gt;

&lt;p&gt;I don’t want to run a database server on my local Mac. I want &lt;em&gt;only&lt;/em&gt; the necessary PostgreSQL client libraries and I want to use the OS X native build system, not MacPorts.&lt;/p&gt;

&lt;p&gt;It’s actually easy to do this. The instructions may look complicated, but it’s only because I’ve added a lot of explanation to them.&lt;/p&gt;

&lt;h2&gt;Step 1: Install the PostgreSQL client library&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Download the PostgreSQL &lt;em&gt;source code&lt;/em&gt; from &lt;a href="http://www.postgresql.org/ftp/source/"&gt;&lt;a href="http://www.postgresql.org/ftp/source/"&gt;http://www.postgresql.org/ftp/source/&lt;/a&gt;&lt;/a&gt;. Don’t download Mac OS X binaries, as that would be a complete server installation.&lt;/li&gt;
&lt;li&gt;Un-tar the source code and &lt;code&gt;cd&lt;/code&gt; into its directory. Then run:

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;CFLAGS="-arch i386 -arch x86_64 -arch ppc" ./configure --with-openssl&lt;/code&gt;

&lt;ul&gt;
&lt;li&gt;This &lt;code&gt;CFLAGS&lt;/code&gt; setting will get you a universal binary. Without it you would only get a 64-bit Intel binary (assuming you have a 64-bit Intel Mac), or a 32-bit Intel binary (if you have a 32-bit Intel Mac). We also include PowerPC support, for the unlikely event that you have a program that runs under Rosetta that needs to use the PostgreSQL libraries.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;We are going install only the client parts of PostgreSQL. These instructions are based on the &lt;a href="http://www.postgresql.org/docs/8.4/interactive/install-procedure.html"&gt;PostgreSQL manual, section 15.5&lt;/a&gt;.:

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;sudo make -C src/bin install&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;sudo make -C src/include install&lt;/code&gt;

&lt;ul&gt;
&lt;li&gt;In my experience, the error about &lt;code&gt;utils/fmgroids.h&lt;/code&gt; can be ignored.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sudo make -C src/interfaces install&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sudo make -C doc install&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;Step 2: Install Psycopg2&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Download and un-tar the &lt;a href="http://initd.org/psycopg/"&gt;Psycopg&lt;/a&gt; source code.&lt;/li&gt;
&lt;li&gt;Edit the psycopg2 &lt;code&gt;setup.cfg&lt;/code&gt; file. Add or update the following lines:

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;have_ssl=1&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pg_config=/usr/local/pgsql/bin/pg_config&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Build and install it:

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;python setup.py build&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sudo python setup.py install&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Test it:

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;$ python&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&gt;&gt;&gt; import psycopg2&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&gt;&gt;&gt; psycopg2.__version__&lt;/code&gt;&lt;br/&gt;&lt;code&gt;'2.0.14 (dt dec ext pq3)'&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Looks good!&lt;/p&gt;</description><link>http://blog.natesilva.com/post/482008337</link><guid>http://blog.natesilva.com/post/482008337</guid><pubDate>Mon, 29 Mar 2010 10:03:00 -0700</pubDate></item><item><title>An over-compressed JPEG file with bad artifacting. A good...</title><description>&lt;img src="http://26.media.tumblr.com/tumblr_kud0deZUSC1qaswauo1_100.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;An over-compressed JPEG file with bad artifacting. A good example of why JPEG should never be used for text.&lt;/p&gt;

&lt;p&gt;Guess where it’s from? (&lt;a href="http://www.jpeg.org/"&gt;Answer&lt;/a&gt;)&lt;/p&gt;</description><link>http://blog.natesilva.com/post/275307178</link><guid>http://blog.natesilva.com/post/275307178</guid><pubDate>Tue, 08 Dec 2009 16:36:50 -0800</pubDate><category>humor</category><category>graphics</category><category>web design</category></item><item><title>How to make an Intel wireless card connect to an Apple Airport base station in WPA2 mode</title><description>&lt;p&gt;With some notebooks (including a Lenovo Thinkpad and a recent Gateway model) we’ve had problems getting Wi-Fi connected to our Airport Extreme base station.&lt;/p&gt;

&lt;p&gt;In the past, we enabled both WPA and WPA2 on our base station and then manually set the laptops to use TKIP (WPA) mode (&lt;a href="http://natesilva.tumblr.com/post/250567179/lenovo-thinkpad-with-intel-wireless-wont-connect-to-an" title="Lenovo Thinkpad with Intel wireless won’t connect to an Airport Extreme base station"&gt;previous post describing how to do this&lt;/a&gt;). This worked until we decided to turn off WPA mode, supporting only WPA2, due to newly-discovered &lt;a href="http://arstechnica.com/security/news/2008/11/wpa-cracked.ars" title="Battered, but not broken: understanding the WPA crack"&gt;vulnerabilities in WPA/TKIP&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Once again, our notebooks with Intel 4965AGN and Intel 5100AGN wireless cards were unable to connect.&lt;/p&gt;

&lt;p&gt;Then one of my awesome coworkers, Matt, discovered a setting that fixes everything: turn on an option called “FIPS compliance.” Here’s what to do:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open &lt;em&gt;Network and Sharing Center&lt;/em&gt; (NSC).&lt;/li&gt;
&lt;li&gt;From the list at the left-hand side of NSC, choose &lt;strong&gt;Manage wireless networks&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Right-click on your network and choose &lt;strong&gt;Properties&lt;/strong&gt;. (If your network is not in the list yet, you will have to click on “Add” and enter your network information and password before continuing.)&lt;/li&gt;
&lt;li&gt;On the &lt;em&gt;Security&lt;/em&gt; tab, set &lt;em&gt;Security Type&lt;/em&gt; to &lt;strong&gt;WPA2-Personal&lt;/strong&gt; and &lt;em&gt;Encryption Type&lt;/em&gt; to &lt;strong&gt;AES&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Still on the &lt;em&gt;Security&lt;/em&gt; tab, click the &lt;em&gt;Advanced Settings&lt;/em&gt; button.&lt;/li&gt;
&lt;li&gt;Check the box that says &lt;em&gt;Enable Federal Information Processing Standards (FIPS) compliance for this network&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;Click OK several times to close the dialog boxes.&lt;/li&gt;
&lt;/ol&gt;</description><link>http://blog.natesilva.com/post/250553610</link><guid>http://blog.natesilva.com/post/250553610</guid><pubDate>Wed, 18 Nov 2009 10:31:00 -0800</pubDate><category>apple</category><category>computers</category><category>solutions</category><category>windows</category><category>wireless</category></item><item><title>How to use bpython as your Django shell </title><description>&lt;p&gt;&lt;code&gt;&lt;strong&gt;$&lt;/strong&gt; DJANGO_SETTINGS_MODULE=settings bpython&lt;/code&gt;&lt;/p&gt;</description><link>http://blog.natesilva.com/post/250565647</link><guid>http://blog.natesilva.com/post/250565647</guid><pubDate>Tue, 25 Aug 2009 06:23:00 -0700</pubDate><category>computers</category><category>linux</category><category>mac</category><category>programming</category><category>python</category></item><item><title>Lenovo Thinkpad with Intel wireless won’t connect to an Airport Extreme base station</title><description>&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; This method is no longer recommended due to a recently-discovered &lt;a href="http://arstechnica.com/security/news/2008/11/wpa-cracked.ars" title="Battered, but not broken: understanding the WPA crack"&gt;vulnerability in WPA/TKIP&lt;/a&gt;. I found and blogged about a better solution here: &lt;a href="http://natesilva.tumblr.com/post/250553610/how-to-make-an-intel-wireless-card-connect-to-an-apple" title="How to make an Intel wireless card connect to an Apple Airport base station in WPA2 mode"&gt;How to make an Intel wireless card connect to an Apple Airport base station in WPA2 mode&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;We had a problem with a Lenovo Thinkpad T500 notebook that has Intel wireless networking built-in.&lt;/p&gt;

&lt;p&gt;It could not connect to our Airport Extreme wireless network that is secured using WPA/WPA2 encryption. When you try to connect, the Windows wireless status window alternates between “Connecting” and  “Acquiring IP address” forever.&lt;/p&gt;

&lt;p&gt;The solution is to change the authentication method from AES to TKIP. To do this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open Windows’ Network Connections window. One way to do this is to open Control Panel &gt; Network and Internet Connections.&lt;/li&gt;
&lt;li&gt;Right-click on the wireless network connection and choose “Properties.”&lt;/li&gt;
&lt;li&gt;On the “Wireless Networks” tab, under “Preferred Networks,” locate your network and click “Properties.”&lt;/li&gt;
&lt;li&gt;Change “Data Encryption” from AES to TKIP and click OK to close the dialogs.&lt;/li&gt;
&lt;/ol&gt;</description><link>http://blog.natesilva.com/post/250567179</link><guid>http://blog.natesilva.com/post/250567179</guid><pubDate>Mon, 03 Aug 2009 06:28:00 -0700</pubDate><category>apple</category><category>computers</category><category>solutions</category><category>windows</category><category>wireless</category></item><item><title>PHP sessions timeout too soon, no matter how you set session.gc_maxlifetime</title><description>&lt;h3 id="the_scenario"&gt;The scenario&lt;/h3&gt;

&lt;p&gt;You’re running Debian Linux or Ubuntu Linux. You want PHP sessions to last longer than the default 1440 seconds (24 minutes). So you do this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ini_set('session.gc_maxlifetime', 10800);    # 3 hours
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;With this setting, sessions should remain active for at least three hours, as long as users don’t close their browser.&lt;sup&gt;&lt;a href="#footnote_1" name="footnote_1_link"&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;

&lt;p&gt;But no matter what you do, sessions keep getting deleted after 24–54 minutes. It seems PHP is ignoring the &lt;code&gt;gc_maxlifetime&lt;/code&gt; setting.&lt;/p&gt;

&lt;h3 id="the_real_cause"&gt;Why this happens&lt;/h3&gt;

&lt;p&gt;Debian and Ubuntu Linux override PHP’s session behavior. If you look closely, you’ll see that &lt;code&gt;session.gc_probability&lt;/code&gt; is set to &lt;code&gt;0&lt;/code&gt;, meaning PHP’s garbage collection will &lt;em&gt;never&lt;/em&gt; run. Instead, there’s a Debian-specific &lt;code&gt;cron&lt;/code&gt; job in &lt;code&gt;/etc/cron.d/php5&lt;/code&gt; that runs every 30 minutes!&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;cron&lt;/code&gt; job does garbage collection based on the global &lt;code&gt;session.gc_maxlifetime&lt;/code&gt; in &lt;code&gt;php.ini&lt;/code&gt;. The &lt;code&gt;session.gc_maxlifetime&lt;/code&gt; in your app is ignored.&lt;/p&gt;

&lt;h3 id="the_solution"&gt;The solution&lt;/h3&gt;

&lt;p&gt;While you could disable the &lt;code&gt;cron&lt;/code&gt; job and/or modify &lt;code&gt;php.ini&lt;/code&gt;, I’d prefer to fix the problem without modifying system defaults. A better solution is to create your own sessions directory, somewhere outside the normal one, and then locally enable PHP’s session garbage collection.&lt;/p&gt;

&lt;p&gt;To do this, set &lt;code&gt;session.gc_maxlifetime&lt;/code&gt;, &lt;code&gt;session.gc_probability&lt;/code&gt;, &lt;code&gt;session.gc_divisor&lt;/code&gt;, and &lt;code&gt;session.save_path&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# Session lifetime of 3 hours
ini_set('session.gc_maxlifetime', 10800);

# Enable session garbage collection with a 1% chance of
# running on each session_start()
ini_set('session.gc_probability', 1);
ini_set('session.gc_divisor', 100);

# Our own session save path; it must be outside the
# default system save path so Debian's cron job doesn't
# try to clean it up. The web server daemon must have
# read/write permissions to this directory.
session_save_path(APP_PARENT_DIR . '/sessions');

# Start the session
session_start();
&lt;/code&gt;&lt;/pre&gt;

&lt;div style="border-style:solid;border-width: 1px 0 0 0;border-color: #c0c0c0;height: 1px;width: 8em;margin-top:2em;"&gt;&lt;/div&gt;
&lt;div style="font-size:85%"&gt;
&lt;a name="footnote_1"&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/a&gt; You could change this setting in &lt;code&gt;php.ini&lt;/code&gt;, but there are several reasons not to. &lt;code&gt;php.ini&lt;/code&gt; changes things globally, not just for your application. And if someone else changes it, your application could break. Finally, if you ever need to deploy your application on another server, you would have to remember to change the setting in the new server’s &lt;code&gt;php.ini&lt;/code&gt;. I always prefer &lt;code&gt;ini_set()&lt;/code&gt; and never modify &lt;code&gt;php.ini&lt;/code&gt; except as a last resort. &lt;a href="#footnote_1_link"&gt;↩&lt;/a&gt;
&lt;/div&gt;</description><link>http://blog.natesilva.com/post/250569350</link><guid>http://blog.natesilva.com/post/250569350</guid><pubDate>Thu, 23 Jul 2009 14:31:00 -0700</pubDate><category>computers</category><category>linux</category><category>php</category><category>programming</category><category>solutions</category><category>web</category><category>debian</category></item><item><title>How to get iChat video chat working behind a SonicWALL firewall</title><description>&lt;p&gt;We couldn’t get iChat’s video chat feature to work behind our SonicWALL PRO 3060 firewall. Whenever someone tried to connect, iChat would say it “did not receive a response.”&lt;/p&gt;

&lt;p&gt;The solution was to enable the SonicWALL’s “consistent NAT” feature. To do this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Log in to the SonicWALL administrative web page.&lt;/li&gt;
&lt;li&gt;From the menu at the left side of the page, choose &lt;strong&gt;VoIP&lt;/strong&gt; (which stands for voice-over-IP).&lt;/li&gt;
&lt;li&gt;In &lt;strong&gt;VoIP&lt;/strong&gt; &gt; &lt;strong&gt;Settings&lt;/strong&gt; check the box that says “Enable consistent NAT.”&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Apply&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;That was all we needed to do to enable a user on a Verizon 3G card to video conference with a user on our internal LAN.&lt;/p&gt;</description><link>http://blog.natesilva.com/post/250570106</link><guid>http://blog.natesilva.com/post/250570106</guid><pubDate>Tue, 04 Nov 2008 10:00:00 -0800</pubDate><category>mac</category><category>networking</category><category>solutions</category><category>sonicwall</category></item><item><title>Microsoft Internet Authentication Service (IAS) dies or won't start</title><description>&lt;h2 id="problem"&gt;Problem&lt;/h2&gt;

&lt;p&gt;We use the Microsoft &lt;a href="http://technet.microsoft.com/en-us/network/bb643123.aspx" title="Microsoft: Internet Authentication Service"&gt;Internet Authentication Service&lt;/a&gt; (IAS) to provide RADIUS authentication for our wireless network.&lt;/p&gt;

&lt;p&gt;From time to time we would notice that IAS had stopped working on one of our servers. In Event Viewer, we would see the following error:&lt;/p&gt;

&lt;p&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_ZRWDTuIUxGU/SNLkG14Gq0I/AAAAAAAAAEU/PWXUDQbGACY/s1600-h/eventid7023.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://2.bp.blogspot.com/_ZRWDTuIUxGU/SNLkG14Gq0I/AAAAAAAAAEU/PWXUDQbGACY/s400/eventid7023.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5247507322032794434"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;“Service Control Manager, Event ID 7023: The Internet Authentication Service terminated with the following error: Only one usage of each socket address (protocol/network address/port) is normally permitted.”&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;You could also click on “Internet Authentication Service (Local)” and notice that the green start button was enabled, indicating that the service was not yet started.&lt;/p&gt;

&lt;p&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_ZRWDTuIUxGU/SNLkV6smkKI/AAAAAAAAAEc/7lbozdQG3ws/s1600-h/ias-not-running.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://2.bp.blogspot.com/_ZRWDTuIUxGU/SNLkV6smkKI/AAAAAAAAAEc/7lbozdQG3ws/s400/ias-not-running.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5247507581024768162"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You could start the service, but a few seconds later it would stop.&lt;/p&gt;

&lt;h2 id="cause"&gt;Cause&lt;/h2&gt;

&lt;p&gt;The problem was caused by the Microsoft DNS server hogging one or more of the ports RADIUS needs! Those would be UDP ports 1812, 1813, 1645 and 1646.&lt;/p&gt;

&lt;p&gt;To identify this problem I had used a free program called &lt;a href="http://www.nirsoft.net/utils/cports.html" title="CurrPorts: View Opened TCP/IP ports / connections on Windows"&gt;NirSoft CurrPorts&lt;/a&gt;. I could have used Windows’ built-in &lt;code&gt;netstat&lt;/code&gt; command, but this is one of those times when a GUI is nice — especially because you can sort by port number.&lt;/p&gt;

&lt;p&gt;Why was DNS using those ports? It was because of the recent DNS security update (the one that fixes the &lt;a href="http://www.doxpara.com/?p=1185"&gt;Kaminsky port randomization bug&lt;/a&gt;). It was Microsoft security update 953230 (MS08-037).&lt;/p&gt;

&lt;p&gt;This problem is described in &lt;a href="http://support.microsoft.com/kb/956188" title="Microsoft Knowledge Base: You experience issues with UDP-dependent network services after you install DNS Server service security update 953230 (MS08-037)"&gt;KB56188&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id="solution"&gt;Solution&lt;/h2&gt;

&lt;p&gt;The solution is described in &lt;a href="http://support.microsoft.com/kb/812873/" title="Microsoft Knowledge Base: How to reserve a range of ephemeral ports on a computer that is running Windows Server 2003 or Windows 2000 Server"&gt;KB812873&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The short version, for Server 2003, is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In the Registry Editor, go to &lt;code&gt;HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;If there is a value called &lt;code&gt;ReservedPorts&lt;/code&gt;, open it. Otherwise, create it as a “Multi-String Value”.&lt;/li&gt;
&lt;li&gt;Add the following ports to the list: &lt;code&gt;1812-1813&lt;/code&gt; and &lt;code&gt;1645-1646&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_ZRWDTuIUxGU/SNLkdWMktsI/AAAAAAAAAEk/88P6HjMnjAI/s1600-h/reserved-ports.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://2.bp.blogspot.com/_ZRWDTuIUxGU/SNLkdWMktsI/AAAAAAAAAEk/88P6HjMnjAI/s400/reserved-ports.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5247507708665706178"/&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://blog.natesilva.com/post/250570923</link><guid>http://blog.natesilva.com/post/250570923</guid><pubDate>Thu, 18 Sep 2008 13:26:00 -0700</pubDate><category>computers</category><category>networking</category><category>solutions</category><category>windows</category></item><item><title>My thoughts on Google App Engine</title><description>&lt;p&gt;I recently tried &lt;a href="http://code.google.com/appengine/" title="Google App Engine"&gt;Google App Engine&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id="pros_and_cons"&gt;Pros and cons&lt;/h2&gt;

&lt;h3 id="pros"&gt;Pros&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The canned environment is really nice. It’s great to focus on development instead of setting up infrastructure.&lt;/li&gt;
&lt;li&gt;Love &lt;a href="http://python.org/" title="Python Programming Language"&gt;Python&lt;/a&gt;. Like the &lt;a href="http://www.djangoproject.com/" title="Django: The Web framework for perfectionists with deadlines"&gt;Django&lt;/a&gt;-based templating engine.&lt;/li&gt;
&lt;li&gt;Bandwidth allocation is reasonable for small- or medium-sized apps.&lt;/li&gt;
&lt;li&gt;The data store is great!
&lt;ul&gt;
&lt;li&gt;Because it’s non-relational there’s no ORM layer to get in the way. Once you understand it, it’s intuitive.&lt;/li&gt;
&lt;li&gt;Reading from the datastore is nice and fast. (But not writing — see next point.)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="cons"&gt;Cons&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The data store sucks!
&lt;ul&gt;
&lt;li&gt;There’s no way to import/export data.
&lt;ul&gt;
&lt;li&gt;So you have to write your own.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Writing to the datastore is &lt;em&gt;extremely slow&lt;/em&gt;, so if you write your own import routine, you need to break up your imports so they don’t time out. It took a couple hours to manually load around 2,000 items.&lt;/li&gt;
&lt;li&gt;The &lt;a href="http://code.google.com/appengine/articles/bulkload.html" title="Uploading Data with Bulk Data Uploader"&gt;Bulk Data Upload&lt;/a&gt; utility is essentially useless, because it can’t handle Unicode and it times out when importing large amounts of data. If I wasn’t importing large amounts of data, I wouldn’t need a bulk upload utility, no?&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;During beta, the &lt;a href="http://code.google.com/appengine/articles/quotas.html" title="Understanding Application Quotas"&gt;quotas&lt;/a&gt; are so restrictive that it’s only useful for trivial applications at this time.
&lt;ul&gt;
&lt;li&gt;You can’t retrieve more than 1,000 rows from a query (and doing so would probably time-out your request).&lt;/li&gt;
&lt;li&gt;Apps are limited to 500 MB total storage and 1,000 files.&lt;/li&gt;
&lt;li&gt;Developers can only create three apps &lt;em&gt;and you can’t delete or rename an app&lt;/em&gt;, so use your three wishes wisely.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="other"&gt;Other&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;If you’re using &lt;a href="http://www.google.com/a/" title="Google Apps For Your Domain"&gt;Google Apps For Your Domain&lt;/a&gt; to authenticate, you need to separately set the app up in your domain, which is poorly documented. It seems obvious, but it was confusing when I tried it.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="moving_apps_to_gae"&gt;Moving apps to GAE&lt;/h2&gt;

&lt;p&gt;I considered moving three in-house apps to GAE, but none were feasible.&lt;/p&gt;

&lt;h3 id="build_query_tool"&gt;Build query tool&lt;/h3&gt;

&lt;p&gt;The first is a build query tool. It lists which components are present in our software builds, organized by category.&lt;/p&gt;

&lt;p&gt;Builds have anywhere from 10 to 1,500 components. Our users sometimes pull up the larger builds. The list loads quickly because it’s plain text.&lt;/p&gt;

&lt;p&gt;With GAE there’s no way to retrieve it (1,000 row limit) and even if there were, it would probably time out. We could get around this by introducing a search feature, and showing just subsets of the data. But we would lose the ability to browse over the entire contents of a build at once.&lt;/p&gt;

&lt;p&gt;And then there’s the nightmare of updating the datastore. Let’s say we add a new build that incorporates a few hundred components. How are we going to update the datastore in an automated fashion? It’s certainly possible with HTTP POSTs but it would take ages because of timeout issues and how slow it is to write to the datastore.&lt;/p&gt;

&lt;h3 id="file_upload_utility"&gt;File upload utility&lt;/h3&gt;

&lt;p&gt;The second is an upload utility. Files are uploaded and then “processed,” which involves storing them into an &lt;a href="http://aws.amazon.com/s3" title="Amazon Simple Storage Service (S3)"&gt;Amazon S3&lt;/a&gt; bucket and writing a database record.&lt;/p&gt;

&lt;p&gt;This was out of the question due to the 10 MB file size limit. And the 500 MB overall limit might be an issue — we occasionally get giant files up to ~750 MB. (The 1,000 maximum file count is fine; once files are processed they would be deleted from the GAE application space.)&lt;/p&gt;

&lt;p&gt;Finally, getting a responsive progress bar during an upload is a tricky problem that generally requires some help from the server-side. I don’t know how to do it with GAE, or if it’s even possible. Of course it’s possible to upload without a progress bar, but users need the reassurance of a progress bar when dealing with huge files.&lt;/p&gt;

&lt;h3 id="historical_data_utility"&gt;Historical data utility&lt;/h3&gt;

&lt;p&gt;The third is a historical data utility. It contains old (going back to 1995!) customer records, notes and invoices. These come from an obsolete accounting system that has been decommissioned, so the web UI is the only way our users can get to it. While not frequently used, it is sometimes handy to pull up old data and chart trends.&lt;/p&gt;

&lt;p&gt;Application wise, this should work with App Engine. The row, data size and other limitations don’t come into play.&lt;/p&gt;

&lt;p&gt;Unfortunately, there are a few hundred thousand rows in the database. It’s around 125 MB so it would not hit quotas but uploading that data could take &lt;em&gt;weeks&lt;/em&gt;.&lt;/p&gt;

&lt;h2 id="summary"&gt;Summary&lt;/h2&gt;

&lt;p&gt;Bottom line: I would &lt;em&gt;love&lt;/em&gt; to use Google App Engine, especially for in-house apps where we can authenticate against our Google Apps domain. But it’s too limited right now — at least for the types of apps I tried. I’m still on the lookout for other apps that might be a better fit.&lt;/p&gt;</description><link>http://blog.natesilva.com/post/250571545</link><guid>http://blog.natesilva.com/post/250571545</guid><pubDate>Tue, 24 Jun 2008 11:24:00 -0700</pubDate><category>computers</category><category>google</category><category>programming</category><category>python</category><category>web</category></item><item><title>How to tell if a Mac OS X application is “Cocoa” or “Carbon”</title><description>&lt;p&gt;There are two ways that software developers can create Macintosh applications — known as Carbon and Cocoa. As has been said many times before, it &lt;a href="http://davidweiss.blogspot.com/2006/09/mixing-carbon-and-cocoa.html" title="David Weiss: Mixing Carbon and Cocoa"&gt;doesn’t&lt;/a&gt; &lt;a href="http://wilshipley.com/blog/2006/10/pimp-my-code-part-12-frozen-in.html" title="Wil Shipley: Frozen in Carbonite"&gt;really&lt;/a&gt; &lt;a href="http://www.red-sweater.com/blog/181/the-cocoa-carbon-advantage" title="Daniel Jalkut: The Cocoa-Carbon Advantage"&gt;matter&lt;/a&gt; to users if an application is Carbon or Cocoa, although developers do tend to prefer one or the other when writing applications.&lt;/p&gt;

&lt;p&gt;A quick way to identify Carbon and Cocoa applications is to drag them to the bottom of the screen.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Carbon applications will not let you drag their title bar off the bottom edge of the screen.&lt;/li&gt;
&lt;li&gt;Cocoa applications will let you drag the title bar partially off the bottom of the screen, but as soon as you let go of the mouse, it will bounce back into view.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This isn’t always accurate, as some well-known Carbon applications (the Finder) have Cocoa-like behavior.&lt;/p&gt;

&lt;p&gt;And since it’s possible for &lt;a href="http://developer.apple.com/documentation/Cocoa/Conceptual/CarbonCocoaDoc/Articles/WrapperFunctions.html" title="Apple: Cocoa-Carbon Integration Guide"&gt;Cocoa applications to call Carbon and vice-versa&lt;/a&gt;, you might say that many apps are not entirely Cocoa or Carbon, but a mix of the two.&lt;/p&gt;</description><link>http://blog.natesilva.com/post/250572189</link><guid>http://blog.natesilva.com/post/250572189</guid><pubDate>Mon, 02 Jun 2008 11:55:00 -0700</pubDate></item><item><title>Python PostgreSQL interfaces: pg8000 vs. psycopg2 micro-benchmark</title><description>&lt;p&gt;I have great hopes for the &lt;a href="http://pybrary.net/pg8000/"&gt;pg8000&lt;/a&gt; project, which is a &lt;a href="http://www.postgresql.org/" title="PostgreSQL: The world's most advanced open source database"&gt;PostgreSQL&lt;/a&gt; interface written entirely in Python.&lt;/p&gt;

&lt;p&gt;The current standard in this category is something called &lt;a href="http://www.initd.org/"&gt;psycopg2&lt;/a&gt;. It depends on &lt;code&gt;libpq&lt;/code&gt; (the official PostgreSQL client library). While it works great, it can be difficult to get it running on some platforms (ahem, OS X), because you need to download all of PostgreSQL to get the client library. You can install just &lt;code&gt;libpq&lt;/code&gt; if you can suss out the correct build parameters, but it’s still quite a hassle when deploying software on random client machines.&lt;/p&gt;

&lt;p&gt;What pg8000 offers is &lt;strong&gt;no dependencies&lt;/strong&gt;. I can do database stuff without having the client install anything other than Python itself.&lt;/p&gt;

&lt;p&gt;But this comes at a cost; namely: it’s very slow.&lt;/p&gt;

&lt;p&gt;I used one of our build scripts that records metadata from a directory tree into a PostgreSQL database. The directory tree contains more than 3,000 files. The script reads some data from each file, as well as its last modification time. For each file, it then executes two statements: one &lt;code&gt;SELECT&lt;/code&gt; to validate the data, and one &lt;code&gt;INSERT&lt;/code&gt; to plunk it into the database. A single &lt;code&gt;commit()&lt;/code&gt; is executed at the very end of the whole process.&lt;/p&gt;

&lt;p&gt;Using psycopg2 gave the following results:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Processing complete. 3230 files total.

real    0m28.654s
user    0m4.419s
sys 0m6.582s
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;With pg8000 I got the following results:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Processing complete. 3230 files total.

real    7m53.424s
user    0m13.516s
sys 0m8.267s
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;So, for this test, pg8000 took 16 times as long to complete.&lt;/p&gt;

&lt;p&gt;I haven’t figured out why it’s so much slower. Perhaps pg8000 is opening transactions for each statement instead of using a single transaction. Or maybe an all-Python database interface is just destined to be slow.&lt;/p&gt;

&lt;p&gt;For everyday use (i.e., you’re not executing thousands of consecutive statements at once) you probably won’t notice much difference using pg8000. As always, you need to &lt;a href="http://c2.com/cgi/wiki?ProfileBeforeOptimizing" title="C2 Wiki: Profile Before Optimizing"&gt;profile&lt;/a&gt; to find out where the bottleneck is. If your application only needs to do a few statements per minute then the speed of your database interface probably isn’t a constraint.&lt;/p&gt;</description><link>http://blog.natesilva.com/post/250572698</link><guid>http://blog.natesilva.com/post/250572698</guid><pubDate>Tue, 20 May 2008 14:14:00 -0700</pubDate><category>computers</category><category>databases</category><category>programming</category><category>python</category></item><item><title>When downloading an .EXE file in IE, it loses its file extension</title><description>&lt;p&gt;Internet Explorer has odd behavior when downloading certain files. If you have an &lt;code&gt;.exe&lt;/code&gt; file, but it’s served by a URL with a query string, IE will lose the file extension.&lt;/p&gt;

&lt;p&gt;An example might be easier to understand.&lt;/p&gt;

&lt;p&gt;Let’s say you’re using &lt;a href="http://aws.amazon.com/s3" title="Amazon Simple Storage Service"&gt;Amazon S3&lt;/a&gt; to serve your downloads. You’ve got a file, &lt;code&gt;myfile.exe&lt;/code&gt;, that your customer wants to download. Using S3 you generate a URL that allows them to download the file, and you can set the URL to expire after a certain time. The resulting URL might look like this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;a href="https://nate.s3.amazonaws.com:443/myfile.exe?Expires=1210007779&amp;AWSAccessKeyId=1HHMQMPRV9GFWH6BTP82"&gt;https://nate.s3.amazonaws.com:443/myfile.exe?Expires=1210007779&amp;AWSAccessKeyId=1HHMQMPRV9GFWH6BTP82&lt;/a&gt;
&amp;Signature=5dfcG5OC9BSkDFSzjxQGjlbKNi0%3D&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Notice that the URL contains &lt;code&gt;/myfile.exe&lt;/code&gt; followed by some query string parameters (everything after the question mark is the query string parameters).&lt;/p&gt;

&lt;p&gt;Most web browsers will interpret this as being a request for the file &lt;code&gt;myfile.exe&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Internet Explorer will interpret this as being a request for a web page served by an application on the server called &lt;code&gt;myfile.exe&lt;/code&gt;. The resulting download will be called &lt;code&gt;myfile&lt;/code&gt; (instead of &lt;code&gt;myfile.exe&lt;/code&gt;), which doesn’t work.&lt;/p&gt;

&lt;p&gt;There’s a workaround, which is to add the filename to the end of the query string, like this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;a href="https://nate.s3.amazonaws.com:443/myfile.exe?Expires=1210007779&amp;AWSAccessKeyId=1HHMQMPRV9GFWH6BTP82"&gt;https://nate.s3.amazonaws.com:443/myfile.exe?Expires=1210007779&amp;AWSAccessKeyId=1HHMQMPRV9GFWH6BTP82&lt;/a&gt;
&amp;Signature=5dfcG5OC9BSkDFSzjxQGjlbKNi0%3D&amp;filename=myfile.exe&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;There’s no reason in the HTTP standard why this should be required; it’s just a way that Microsoft developed to work around the bug in IE.&lt;/p&gt;

&lt;p&gt;More information, including Microsoft’s creative interpretation of the HTTP standard, can be found in &lt;a href="http://support.microsoft.com/kb/221805" title="FIX: File Extension Parsing for URLs with Query Strings"&gt;Knowledge Base Article 221805&lt;/a&gt;. The article says the bug is fixed, except not for &lt;code&gt;.exe&lt;/code&gt; and &lt;code&gt;.dll&lt;/code&gt; files! This is another case of inconsistent behavior in IE.&lt;/p&gt;</description><link>http://blog.natesilva.com/post/250573293</link><guid>http://blog.natesilva.com/post/250573293</guid><pubDate>Mon, 05 May 2008 07:28:00 -0700</pubDate><category>computers</category><category>programming</category><category>solutions</category><category>web</category><category>windows</category><category>ie</category></item><item><title>How to get some HP network printers to work with Mac OS X Leopard</title><description>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_ZRWDTuIUxGU/R8ScwbTQm_I/AAAAAAAAAAo/Xfpt-nxNsYY/s1600-h/print-dialog.jpg"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;" src="http://4.bp.blogspot.com/_ZRWDTuIUxGU/R8ScwbTQm_I/AAAAAAAAAAo/Xfpt-nxNsYY/s200/print-dialog.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5171430627904363506"/&gt;&lt;/a&gt;

&lt;p&gt;Some HP network printers — such as the HP Color LaserJet 3600n and 3600dn — don’t have what Apple calls “modern” printer drivers. As a result, you may not be able to print over the network. This will happen if both of the following things are true:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The printer doesn’t have a modern driver.&lt;/li&gt;
&lt;li&gt;You are not using Bonjour to print; for example, if you are on a different network subnet than the printer.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The correct driver won’t even be available in the driver list. Apple has a &lt;a href="http://docs.info.apple.com/article.html?artnum=306684" title="Mac OS X 10.5: Included printer drivers"&gt;list of supported printers&lt;/a&gt;; an &lt;strong&gt;X&lt;/strong&gt; in the right-hand column indicates modern drivers.&lt;/p&gt;

&lt;p&gt;The good news is that there’s a solution. For this to work the printer must have &lt;strong&gt;built-in networking&lt;/strong&gt; and it must be an HP printer (Canon and Epson owners see my &lt;a href="#epson_canon_note"&gt;note below&lt;/a&gt;).&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In System Preferences, open the Print &amp; Fax Preference Pane.&lt;/li&gt;
&lt;li&gt;Click the plus sign to add a printer.&lt;/li&gt;
&lt;li&gt;In the dialog that appears, click the “More Printers” icon at the top.&lt;/li&gt;
&lt;li&gt;In the More Printers dialog, choose “HP IP Printing” from the drop-down list.
&lt;ul&gt;
&lt;li&gt;If your printer is on the same subnet as your Mac, you should see it listed. Select it and click Add.&lt;/li&gt;
&lt;li&gt;If you don’t see it listed, click the “Manual” tab and enter the printer’s IP address, click “Connect”, then “Add”.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;That’s it. Most of the time the printer model will be automatically detected and you won’t even have to select a driver.&lt;/p&gt;

&lt;h3 id="epson_canon_note"&gt;Note for Epson and Canon owners&lt;/h3&gt;

&lt;p&gt;The steps above are for HP printers only. But the “More Printers” dialog also offers options for “Canon IJ Network” and “Epson TCP/IP” printing. I have no way to test these, but if your printer has built-in networking choosing one of these may work for you.&lt;/p&gt;</description><link>http://blog.natesilva.com/post/250573947</link><guid>http://blog.natesilva.com/post/250573947</guid><pubDate>Wed, 20 Feb 2008 12:25:00 -0800</pubDate><category>computers</category><category>mac</category><category>solutions</category></item><item><title>Engineers and early adopters vs. the customers</title><description>&lt;p&gt;“We thought it was a mistake and made our engineers check the logs again,” said Vic Gundotra, head of Google’s mobile operations.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.ft.com/cms/s/667f13de-da60-11dc-9bb9-0000779fd2ac.html"&gt;Google receives 50 times as many searches from iPhone users than from any other mobile handset&lt;/a&gt;. It’s the very definition of usability: how many people actually use their phones to browse the web. Apparently only iPhone users.&lt;/p&gt;

&lt;p&gt;Products that are popular with engineers and early adopters—the previous generations of smartphones, loaded with features—aren’t necessarily what customers want. They want usability. It looks like Apple has figured that out.&lt;/p&gt;</description><link>http://blog.natesilva.com/post/250574341</link><guid>http://blog.natesilva.com/post/250574341</guid><pubDate>Fri, 15 Feb 2008 05:50:00 -0800</pubDate><category>mobile phones</category><category>rants</category></item><item><title>Time Machine only runs if your MacBook is plugged in</title><description>&lt;p&gt;&lt;a href="http://www.apple.com/macosx/features/timemachine.html"&gt;Time Machine&lt;/a&gt; is a great feature of Apple’s computers. It backs up your Mac every hour, as long as you have a backup disk connected to the USB or Firewire port. Because it only needs to back up whatever changed in the last hour, it only takes a few seconds to do.&lt;/p&gt;

&lt;p&gt;But on my wife’s MacBook it was not doing automatic backups:&lt;/p&gt;

&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_ZRWDTuIUxGU/R8SdULTQnAI/AAAAAAAAAAw/3m0IkXmc9Ng/s1600-h/time-machine-no-next-backup.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;" src="http://3.bp.blogspot.com/_ZRWDTuIUxGU/R8SdULTQnAI/AAAAAAAAAAw/3m0IkXmc9Ng/s400/time-machine-no-next-backup.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5171431242084686850"/&gt;&lt;/a&gt;

&lt;p&gt;The “Next Backup” field just contains two dashes.&lt;/p&gt;

&lt;p&gt;The solution was easy: &lt;em&gt;plug in the computer&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;It turns out that Time Machine doesn’t run automatically when your notebook computer is not plugged in. It does this to preserve battery life. As soon as you plug it in, the “Next Backup” time shows up and automatic backups will continue.&lt;/p&gt;</description><link>http://blog.natesilva.com/post/250575647</link><guid>http://blog.natesilva.com/post/250575647</guid><pubDate>Fri, 25 Jan 2008 07:25:00 -0800</pubDate><category>computers</category><category>mac</category><category>solutions</category></item><item><title>Notes on using Cocoa-Python in Mac OS X Leopard</title><description>&lt;p&gt;I’ve been looking at Leopard’s amazing new Cocoa-Python support. It uses &lt;a href="http://pyobjc.sourceforge.net/" title="PyObjC - Home"&gt;PyObjC&lt;/a&gt; 2.0 to give Python programmers access to the Cocoa frameworks that Mac OS X is built on.&lt;/p&gt;

&lt;p&gt;Working from the &lt;a href="http://developer.apple.com/cocoa/pyobjc.html" title="Using PyObjC for Developing Cocoa Applications with Python"&gt;Apple tutorial&lt;/a&gt;, which is based on an older version of PyObjC, I was able to build a working application. But I hit a few roadbumps and those are what I want to document here for other would-be Cocoa-Python programmers.&lt;/p&gt;

&lt;p&gt;The first problem was figuring out how to instantiate my &lt;code&gt;Averager&lt;/code&gt; object in Interface Builder. I found the solution on the &lt;a href="http://forums.macosxhints.com/showthread.php?p=419996" title="Leopard (10.5) Developer Tools - The macosxhints Forums"&gt;macosxhints Forums&lt;/a&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Drag an instance of &lt;code&gt;NSObject&lt;/code&gt; from the Library into your &lt;code&gt;xib&lt;/code&gt; file.&lt;/li&gt;
&lt;li&gt;Click on the new instance of &lt;code&gt;NSObject&lt;/code&gt; and bring up the Identity Inspector (⌘-6 or find it in the Tools menu).&lt;/li&gt;
&lt;li&gt;Set the object’s class name to your class name, which is &lt;code&gt;Averager&lt;/code&gt; if you’re following the Apple tutorial.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The second problem was this error:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://4.bp.blogspot.com/_ZRWDTuIUxGU/R8UDTLTQnBI/AAAAAAAAAA4/1p3X2xo726g/s400/pyobjc-key-value-error.png" style="margin:10px" alt="This class is not key value coding-compliant for the key calculatedMedian"/&gt;&lt;/p&gt;

&lt;p&gt;This was caused by not importing the &lt;code&gt;Averager&lt;/code&gt; class. To fix it, add the following to your &lt;code&gt;main.py&lt;/code&gt; file:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;from Averager import *
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Some tips:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The debugger console window (Shift-⌘-R) is your friend.&lt;/li&gt;
&lt;li&gt;Beware of Xcode’s tab handling. You can force it to use spaces under Preferences &gt; Indentation.&lt;/li&gt;
&lt;li&gt;If you are doing the tutorial and you get “ValueError: invalid literal for float()”, it’s because you’ve passed something that doesn’t look like a number — most likely a comma. Python’s &lt;code&gt;split&lt;/code&gt; method only recognizes lists separated by &lt;em&gt;spaces&lt;/em&gt;. In the debugger console you can see what exception is raised. You can of course catch the exception and handle it in your Python code.&lt;/li&gt;
&lt;/ul&gt;</description><link>http://blog.natesilva.com/post/250576067</link><guid>http://blog.natesilva.com/post/250576067</guid><pubDate>Wed, 07 Nov 2007 02:24:00 -0800</pubDate><category>computers</category><category>mac</category><category>programming</category><category>solutions</category><category>python</category></item><item><title>How to make readline support work in IPython on Mac OS X Leopard</title><description>&lt;p&gt;Many &lt;a href="http://python.org/" title="Python Programming Language"&gt;Python&lt;/a&gt; programmers use the &lt;a href="http://ipython.scipy.org/" title="IPython: an Enhanced Python Shell"&gt;IPython shell&lt;/a&gt; for interactively testing their code.&lt;/p&gt;

&lt;p&gt;But if you recently upgraded to &lt;a href="http://www.apple.com/macosx/" title="Apple - Mac OS X Leopard"&gt;Mac OS X Leopard&lt;/a&gt; then you may have noticed that a key feature — tab-completion — doesn’t work.&lt;/p&gt;

&lt;p&gt;It doesn’t work because IPython uses the &lt;a href="http://tiswww.case.edu/php/chet/readline/rltop.html" title="The GNU Readline Library"&gt;GNU Readline&lt;/a&gt; library, and Mac OS X doesn’t include that. Instead, OS X ships with a similar library called &lt;a href="http://www.thrysoee.dk/editline/" title="Editline Library (libedit)"&gt;Editline&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You can make IPython work with EditLine by adding the following lines near the top of your &lt;code&gt;~/.ipython/ipy_user_conf.py&lt;/code&gt; file:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;import readline 
readline.parse_and_bind ("bind ^I rl_complete")
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; You must be using a recent version of IPython. You can install the latest version by typing &lt;code&gt;sudo easy_install ipython&lt;/code&gt; from the OS X command-line.&lt;/p&gt;

&lt;p&gt;(Found in &lt;a href="http://www.nabble.com/readline-support-for-OS-X-Leopard-t4670419.html"&gt;this message thread&lt;/a&gt; on the Pythonmac-SIG mailing list)&lt;/p&gt;</description><link>http://blog.natesilva.com/post/250577654</link><guid>http://blog.natesilva.com/post/250577654</guid><pubDate>Tue, 30 Oct 2007 12:47:00 -0700</pubDate><category>computers</category><category>mac</category><category>programming</category><category>python</category><category>solutions</category></item><item><title>How to fix an SSL certificate error in Exchange System Manager</title><description>&lt;p&gt;For the longest time I’ve had this error in Exchange System Manager when managing public folders:&lt;/p&gt;

&lt;p&gt;&lt;span style="margin: 20px;"&gt;
&lt;img src="http://3.bp.blogspot.com/_ZRWDTuIUxGU/R8UGR7TQnCI/AAAAAAAAABA/ibOVZKphckQ/s400/exchange-ssl-error.png" alt="The SSL certificate server name is incorrect.
ID no: c103b404
Exchange System Manager" title=""&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;This can happen when using Outlook Web Access if your webmail URL doesn’t match the server’s internal name. Exchange System Manager expects your SSL certificate to match the server’s internal name. OWA users — including Windows Mobile devices — expect the certificate to match the server’s public URL.&lt;/p&gt;

&lt;p&gt;One solution is to manually change the SSL certificate every time you need to manage a public folder, then change it back when you’re done. That gets old quickly.&lt;/p&gt;

&lt;p&gt;Another solution, suggested in a &lt;a href="http://support.microsoft.com/kb/324345" title="Microsoft Knowledge Base Article 324345: You receive an SSL Certificate error message when you view public folders in Exchange System Manager"&gt;knowledge base article&lt;/a&gt;, is to turn off SSL for the IIS &lt;code&gt;Exadmin&lt;/code&gt; virtual root. This didn’t work: SSL &lt;em&gt;was&lt;/em&gt; turned off for &lt;code&gt;Exadmin&lt;/code&gt; but the problem remained.&lt;/p&gt;

&lt;p&gt;Here’s an alternate solution that works:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Run &lt;code&gt;adsiedit.msc&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Navigate to: &lt;code&gt;CN=Configuration&lt;/code&gt; &gt; &lt;code&gt;CN=Configuration,DC=YOURSITE&lt;/code&gt; &gt; &lt;code&gt;CN=Services&lt;/code&gt; &gt; &lt;code&gt;CN=Microsoft Exchange&lt;/code&gt; &gt; &lt;code&gt;CN=YOURDOMAIN&lt;/code&gt; &gt; &lt;code&gt;CN=Administrative Groups&lt;/code&gt; &gt; &lt;code&gt;CN=first administrative group&lt;/code&gt; &gt; &lt;code&gt;CN=Servers&lt;/code&gt; &gt; &lt;code&gt;CN=YOURSERVER&lt;/code&gt; &gt; &lt;code&gt;CN=Protocols&lt;/code&gt; &gt; &lt;code&gt;CN=HTTP&lt;/code&gt; &gt; &lt;code&gt;CN=1&lt;/code&gt; &gt; &lt;code&gt;CN=Exadmin&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Right-click on &lt;code&gt;CN=Exadmin&lt;/code&gt; and choose &lt;em&gt;Properties&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;Find the attribute called &lt;code&gt;msExchSecureBindings&lt;/code&gt; and click &lt;em&gt;Edit&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;Remove the value &lt;code&gt;:443:&lt;/code&gt; from the list.&lt;/li&gt;
&lt;li&gt;Click OK twice to close the dialog boxes.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;(Found on &lt;a href="http://mostlyexchange.blogspot.com/2006/11/e2k3-public-folder-management-ssl.html" title="Jim McBee's Mostly Exchange Web Log: E2K3 Public folder management - SSL certificate server name is incorrect error"&gt;Jim McBee’s Mostly Exchange Web Log&lt;/a&gt;)&lt;/p&gt;</description><link>http://blog.natesilva.com/post/250578064</link><guid>http://blog.natesilva.com/post/250578064</guid><pubDate>Sun, 21 Oct 2007 02:10:00 -0700</pubDate><category>computers</category><category>solutions</category><category>windows</category></item><item><title>How to make Safari work behind a SonicWALL firewall</title><description>&lt;p&gt;Do you have a Mac behind a &lt;a href="http://sonicwall.com/" title="SonicWALL"&gt;SonicWALL&lt;/a&gt; firewall? Do you find that some URLs (like certain pages at the &lt;a href="http://www.nytimes.com/" title="The New York Times"&gt;New York Times&lt;/a&gt;) won’t load in Safari, but they work in Firefox? Is the problem worse when you’re behind a secondary router, such as a wireless router?&lt;/p&gt;

&lt;p&gt;If so, Edward Marczak of Tech Zendo &lt;a href="http://www.radiotope.com/writing/?p=95" title="Tech Zendo: Safari and Sonicwall"&gt;has the solution for you&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The basic solution is to access the SonicWALL’s hidden diagnostics page at &lt;code&gt;&lt;a href="http://your.ip.address/diag.html"&gt;http://your.ip.address/diag.html&lt;/a&gt;&lt;/code&gt; and turn &lt;strong&gt;off&lt;/strong&gt; the checkbox that says “Enforce Host Tag Search for CFS”.&lt;/p&gt;

&lt;p&gt;It turns out the SonicWALL drops some web connections where the HTTP request headers are split across multiple packets. It does this to make it harder to bypass content filtering, but it can cause Safari’s legitimate traffic to be dropped.&lt;/p&gt;

&lt;p&gt;Thanks Edward!&lt;/p&gt;

&lt;h3 id="followup_2007_10_10"&gt;Followup: 2007-10-10&lt;/h3&gt;

&lt;p&gt;&lt;a href="http://www4.nohold.net/noHoldCust304/prod_3/KnowledgePortal/KPscripts/frames.asp?login=1&amp;app=KP&amp;ruleid=5401" title="SonicWALL: Firewall Configuration KnowledgePortal"&gt;This support document&lt;/a&gt; from SonicWALL explains the problem in more detail. WebKit (Safari) is waiting for a TCP ACK before sending out the next packet; apparently it is not supposed to do that.&lt;/p&gt;

&lt;!-- technorati tags start --&gt;&lt;p style="text-align:right;font-size:10px;"&gt;Technorati Tags: &lt;a href="http://www.technorati.com/tag/mac" rel="tag"&gt;mac&lt;/a&gt;, &lt;a href="http://www.technorati.com/tag/networking" rel="tag"&gt;networking&lt;/a&gt;, &lt;a href="http://www.technorati.com/tag/safari" rel="tag"&gt;safari&lt;/a&gt;, &lt;a href="http://www.technorati.com/tag/sonicwall" rel="tag"&gt;sonicwall&lt;/a&gt;&lt;/p&gt;
&lt;!-- technorati tags end --&gt;</description><link>http://blog.natesilva.com/post/250578614</link><guid>http://blog.natesilva.com/post/250578614</guid><pubDate>Mon, 08 Oct 2007 08:26:00 -0700</pubDate><category>computers</category><category>mac</category><category>solutions</category><category>networking</category><category>sonicwall</category></item></channel></rss>
