<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   
	 xmlns:podcast='http://ipodder.sourceforge.net/docs/podcast.html'
>
<channel>
    <title>Lot 49: Greg Beaver's blog - Mac Development</title>
    <link>http://greg.chiaraquartet.net/</link>
    <description>Music, Computers, and all things Greg Beaver</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.4.1 - http://www.s9y.org/</generator>
    
    

<item>
    <title>Music, PEAR, phar, namespaces and Macs.  Oh my!</title>
    <link>http://greg.chiaraquartet.net/archives/198-Music,-PEAR,-phar,-namespaces-and-Macs.-Oh-my!.html</link>
            <category>Chiara Quartet</category>
            <category>Mac Development</category>
            <category>Music</category>
            <category>PEAR</category>
            <category>PHP</category>
    
    <comments>http://greg.chiaraquartet.net/archives/198-Music,-PEAR,-phar,-namespaces-and-Macs.-Oh-my!.html#comments</comments>
    <wfw:comment>http://greg.chiaraquartet.net/wfwcomment.php?cid=198</wfw:comment>

    <slash:comments>4</slash:comments>
    <wfw:commentRss>http://greg.chiaraquartet.net/rss.php?version=2.0&amp;type=comments&amp;cid=198</wfw:commentRss>
    

    <author>nospam@example.com (Greg Beaver)</author>
    <content:encoded>
    
&lt;p&gt;Why the tri-partite title?  I&#039;ve been silent for a while on the blog, but the title sums up my life for the past several months.  What have I been doing?  Aside from some crazy music work learning a
blisteringly difficult Elliot Carter String Quartet No. 4 as well as
Steve Reich&#039;s Different Trains, Bartok&#039;s 6th Quartet, bringing back
Korngold 3rd Quartet, learning Carter&#039;s Figment for solo cello, and
performing Bach&#039;s 5th Suite for Unaccompanied Cello for the first time,
I&#039;ve also been pretty active in coding.  I acquired a new Macbook Pro with &lt;a href=&quot;http://greg.chiaraquartet.net/exit.php?url_id=662&amp;amp;entry_id=198&quot; title=&quot;http://www.vmware.com/products/fusion/&quot;  onmouseover=&quot;window.status=&#039;http://www.vmware.com/products/fusion/&#039;;return true;&quot; onmouseout=&quot;window.status=&#039;&#039;;return true;&quot;&gt;VMWare Fusion&lt;/a&gt; running Windows XP and Ubuntu, and it has made development super-easy.  I also put in a significant effort on the phone getting &lt;a href=&quot;http://greg.chiaraquartet.net/exit.php?url_id=663&amp;amp;entry_id=198&quot; title=&quot;http://www.barackobama.com/&quot;  onmouseover=&quot;window.status=&#039;http://www.barackobama.com/&#039;;return true;&quot; onmouseout=&quot;window.status=&#039;&#039;;return true;&quot;&gt;Barack&lt;/a&gt; his electoral vote in the Omaha area, which seems to have paid off.  So, here&#039;s the long version of what I&#039;ve been doing.&lt;/p&gt;&lt;h3&gt;Music and Macs&lt;/h3&gt;&lt;h4&gt;first the music&lt;/h4&gt;&lt;p&gt;The past month has seen my time consumed learning &lt;a href=&quot;http://greg.chiaraquartet.net/exit.php?url_id=678&amp;amp;entry_id=198&quot; title=&quot;http://www.boosey.com/pages/cr/catalogue/cat_detail.asp?musicid=3563&quot;  onmouseover=&quot;window.status=&#039;http://www.boosey.com/pages/cr/catalogue/cat_detail.asp?musicid=3563&#039;;return true;&quot; onmouseout=&quot;window.status=&#039;&#039;;return true;&quot;&gt;Elliot Carter&#039;s 4th String Quartet&lt;/a&gt; for the &lt;a href=&quot;http://greg.chiaraquartet.net/exit.php?url_id=665&amp;amp;entry_id=198&quot; title=&quot;http://www.scena.org/blog/newswire/2008/10/nec-celebrates-elliott-carter-100th.html&quot;  onmouseover=&quot;window.status=&#039;http://www.scena.org/blog/newswire/2008/10/nec-celebrates-elliott-carter-100th.html&#039;;return true;&quot; onmouseout=&quot;window.status=&#039;&#039;;return true;&quot;&gt;100th birthday thing&lt;/a&gt; in Boston.  Although I have not learned the others, a few veterans have reported that it is the most difficult.  I certainly found it to be the most difficult thing I&#039;ve ever learned by a long shot.  It took me almost 15 hours of work to be able to play the first page (only 15 measures of music) at 3/4 of the printed tempo, and the piece is 35 pages in the cello part.  To contrast, page 35 of the 10 Celebrated Mozart Quartet cello part is the third movement of &lt;b&gt;6th&lt;/b&gt; string quartet in the book.  Carter 4th&#039;s cello part is as long as 6 Mozart quartet cello parts.  However, it is shorter than some of the 4 page Mozart quartets, because it is frickin fast and there are lots and lots of notes.  It is the most holy s*** hard piece I&#039;ve ever learned, and for a while, I was scared it just wasn&#039;t going to be possible.&lt;/p&gt;&lt;p&gt;In addition, one of Carter&#039;s big compositional inventions is the &lt;i&gt;metric modulation&lt;/i&gt; in which a tempo change has a distinct rhythmic relationship.  He uses some pretty normal ones in the first movement (the 16th note becomes the new triplet), but the other movements have fun ones such as the 16th note becoming the new septuplet.  Because most of my part is written in septuplets, this can be difficult to do.  Speeding up septuplets so that you fit 7 into what used to be the space of 6 septuplets is not an easy thing to learn at all.&lt;/p&gt;&lt;h4&gt;...then the mac&lt;/h4&gt;&lt;p&gt;...unless you have a metronome that can do the metric modulation.  We had been using a web-based metronome to plug into our studio&#039;s stereo to rehearse, because it had a more pleasing beat than any of our metronomes have, and it occurred to me that I could probably pretty easily write a metronome that is capable of doing metric modulations on my new Macbook Pro.&lt;/p&gt;&lt;p&gt;So, I took it upon myself to learn &lt;a href=&quot;http://greg.chiaraquartet.net/exit.php?url_id=666&amp;amp;entry_id=198&quot; title=&quot;http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Introduction/chapter_1_section_1.html&quot;  onmouseover=&quot;window.status=&#039;http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Introduction/chapter_1_section_1.html&#039;;return true;&quot; onmouseout=&quot;window.status=&#039;&#039;;return true;&quot;&gt;Objective-C&lt;/a&gt; and the &lt;a href=&quot;http://greg.chiaraquartet.net/exit.php?url_id=667&amp;amp;entry_id=198&quot; title=&quot;http://developer.apple.com/cocoa/&quot;  onmouseover=&quot;window.status=&#039;http://developer.apple.com/cocoa/&#039;;return true;&quot; onmouseout=&quot;window.status=&#039;&#039;;return true;&quot;&gt;Cocoa framework&lt;/a&gt; in Xcode to write a metronome.  It took me just over a day to learn Objective-C; it&#039;s very easy for a C coder to pick up, and the syntax is pretty simple.  Learning Cocoa fully took quite a bit longer, but after 3 days I had a working metronome that could do metric modulations (&lt;a href=&quot;http://greg.chiaraquartet.net/exit.php?url_id=668&amp;amp;entry_id=198&quot; title=&quot;http://chiaraquartet.net/ChiaraMetronome1.0.0.dmg&quot;  onmouseover=&quot;window.status=&#039;http://chiaraquartet.net/ChiaraMetronome1.0.0.dmg&#039;;return true;&quot; onmouseout=&quot;window.status=&#039;&#039;;return true;&quot;&gt;http://chiaraquartet.net/ChiaraMetronome1.0.0.dmg&lt;/a&gt;).  It had several flaws, not the least of which was the inability to insert a measure group, no way to save your work, and some odd behavior on the first beat (sometimes it is late and fast).&lt;/p&gt;&lt;p&gt;After a few more days of digging, I had figured out most of the quirks (and discovered bindings and Core Data, which simplified things) and had the interface greatly simplifed (&lt;a href=&quot;http://greg.chiaraquartet.net/exit.php?url_id=669&amp;amp;entry_id=198&quot; title=&quot;http://chiaraquartet.net/ChiaraMetronome1.2.2.dmg&quot;  onmouseover=&quot;window.status=&#039;http://chiaraquartet.net/ChiaraMetronome1.2.2.dmg&#039;;return true;&quot; onmouseout=&quot;window.status=&#039;&#039;;return true;&quot;&gt;http://chiaraquartet.net/ChiaraMetronome1.2.2.dmg&lt;/a&gt;).  I added the ability to start at any measure in the piece, and to have lead-in measures (which allow you to start the metronome, sit down, find the beat, and then start playing).&lt;/p&gt;&lt;p&gt;Then, I discovered document-based Core Data, which allowed saving files, resulting in the next generation (&lt;a href=&quot;http://greg.chiaraquartet.net/exit.php?url_id=670&amp;amp;entry_id=198&quot; title=&quot;http://chiaraquartet.net/ChiaraMetronome2.0.0.dmg&quot;  onmouseover=&quot;window.status=&#039;http://chiaraquartet.net/ChiaraMetronome2.0.0.dmg&#039;;return true;&quot; onmouseout=&quot;window.status=&#039;&#039;;return true;&quot;&gt;http://chiaraquartet.net/ChiaraMetronome2.0.0.dmg&lt;/a&gt;).&lt;/p&gt;&lt;p&gt;Finally, not to leave an unturned stone, I added the final features, the ability to specify whether a beat is accented, beated or silent, which allows implementation of uneven compound meters (like 5/8), and the ability to accelerate or decelerate tempo, and we have the final version &lt;a href=&quot;http://greg.chiaraquartet.net/exit.php?url_id=671&amp;amp;entry_id=198&quot; title=&quot;http://chiaraquartet.net/ChiaraMetronome3.0.0.dmg&quot;  onmouseover=&quot;window.status=&#039;http://chiaraquartet.net/ChiaraMetronome3.0.0.dmg&#039;;return true;&quot; onmouseout=&quot;window.status=&#039;&#039;;return true;&quot;&gt;http://chiaraquartet.net/ChiaraMetronome3.0.0.dmg&lt;/a&gt;.  This version contains 3 sample metronomes, the complete Elliot Carter 4th quartet we used to practice the tempo changes, a sample demonstrating accelerando/ritardando, and a sample demonstrating how the metronome can be used to practice complex polyrhythms like 6 against 7.&lt;/p&gt;&lt;p&gt;In my potentially humble opinion, the metronome is my crowning glory as a programmer, it is incredible for learning complex tempo relationships for composers like Carter and Bartok who call for it.  It&#039;s also important to note that this metronome should &lt;b&gt;NEVER&lt;/b&gt; be used for learning music by composers such as Brahms or Mozart.  If I hear of anyone using it for that, I will hunt you down and make you listen to Beethoven 9 with your eyelids peeled back watching &lt;a href=&quot;http://greg.chiaraquartet.net/exit.php?url_id=672&amp;amp;entry_id=198&quot; title=&quot;http://www.youtube.com/watch?v=kiaLOzP1lCA&quot;  onmouseover=&quot;window.status=&#039;http://www.youtube.com/watch?v=kiaLOzP1lCA&#039;;return true;&quot; onmouseout=&quot;window.status=&#039;&#039;;return true;&quot;&gt;Teletubbies&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;Short feature list:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;free, released as a beta with no implied license or warranty.  I still own the copyright, so you can&#039;t use it in your own programming projects or sell it without infringing on the copyright.  You can use it for your own practicing, and I will eventually release the source under an open-source friendly license once I have time to research the options.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Please send me any metronome files you create, I&#039;ll start a public repository that people can download them from&lt;/b&gt;&lt;/li&gt;&lt;li&gt;requires Mac OS X Leopard (version 10.5.0) or newer&lt;/li&gt;&lt;li&gt;universal binary&lt;/li&gt;&lt;li&gt;relative tempo slider can be used to practice under tempo and click up the metronome, preserving tempo relationships at tempo changes&lt;/li&gt;&lt;li&gt;ability to program in endless tempo (0 bars) or a limited number of bars of a tempo&lt;/li&gt;&lt;li&gt;ability to do compound meters, both even and uneven&lt;/li&gt;&lt;li&gt;ability to do accelerando/ritardando, including ones that cross tempo group boundaries using the tempo calculator&lt;/li&gt;&lt;li&gt;ability to start and end accelerando/ritardando mid-bar.  No support for mid-beat start/stop, but this can be simulated by doubling the number of beats and making the mid-beats silent.  For example: instead of 4 beats at 60 bpm, choose 8 beats, and make 2,4,6 and 8 silent, with double the tempo, 120 bpm, then start the accel on beat 4 to start on the and of 2.&lt;/li&gt;&lt;li&gt;complete undo/redo support&lt;/li&gt;&lt;li&gt;ability to split up a tempo group, insert a new tempo group, or copy a set of tempo groups and paste them (copy button)&lt;/li&gt;&lt;li&gt;ability to play only a limited set of tempo groups, simply shift-click or command-click the tempo groups.  This can be used, for instance, to skip a repeat in practicing.&lt;/li&gt;&lt;li&gt;ability to accent all downbeats with a simple click.&lt;/li&gt;&lt;li&gt;start at any bar in the piece.&lt;/li&gt;&lt;li&gt;lead-in bars to help prepare tempo prior to playing.&lt;/li&gt;&lt;/ul&gt;&lt;h3&gt;PEAR&lt;/h3&gt;&lt;p&gt;Today, I upgrade &lt;a href=&quot;http://greg.chiaraquartet.net/exit.php?url_id=673&amp;amp;entry_id=198&quot; title=&quot;http://pear.chiaraquartet.net&quot;  onmouseover=&quot;window.status=&#039;http://pear.chiaraquartet.net&#039;;return true;&quot; onmouseout=&quot;window.status=&#039;&#039;;return true;&quot;&gt;pear.chiaraquartet.net&lt;/a&gt; to the latest version, 0.19.0, which Brett Bieber has been working hard to perfect.  The look is a bit cleaner, and I also replaced the defunct Crtx_Frontend_Chiara (or whatever it was called) with the newly minted Chiara_Pear_Server_Frontend_Web which is a direct port over of the old frontend with bugfixes and visual tweaks.&lt;/p&gt;&lt;h3&gt;PEAR and phar&lt;/h3&gt;&lt;p&gt;A high priority for PEAR is minting its next-generation installer, &lt;a href=&quot;http://greg.chiaraquartet.net/exit.php?url_id=674&amp;amp;entry_id=198&quot; title=&quot;http://svn.pear.php.net/wsvn/PEARSVN/Pyrus/?rev=0&amp;amp;sc=0&quot;  onmouseover=&quot;window.status=&#039;http://svn.pear.php.net/wsvn/PEARSVN/Pyrus/?rev=0&amp;amp;sc=0&#039;;return true;&quot; onmouseout=&quot;window.status=&#039;&#039;;return true;&quot;&gt;Pyrus&lt;/a&gt;.  Pyrus is based on PHP 5.3+, and thus I expended a tremendous amount of energy on the new &lt;a href=&quot;http://greg.chiaraquartet.net/exit.php?url_id=675&amp;amp;entry_id=198&quot; title=&quot;http://php.net/phar&quot;  onmouseover=&quot;window.status=&#039;http://php.net/phar&#039;;return true;&quot; onmouseout=&quot;window.status=&#039;&#039;;return true;&quot;&gt;phar&lt;/a&gt; extension,which will be enabled by default in PHP 5.3.  The phar extension provides several must-have features for Pyrus:&lt;/p&gt;&lt;p /&gt;&lt;ol&gt;&lt;li&gt;ability to run out-of-the-box applications without installing or extracting them (a la Java&#039;s jar) in zip, tar or native phar file format&lt;/li&gt;&lt;li&gt;ability to create data archives in tar or zip format and convert between them&lt;/li&gt;&lt;li&gt;ability to automatically handle oddities of running an application inside an uncompressed file&lt;/li&gt;&lt;li&gt;web-based applications without extraction&lt;/li&gt;&lt;/ol&gt;&lt;p /&gt;&lt;p&gt;I&#039;m very pleased this will be built into PHP 5.3, it cuts out oodles of code from Pyrus, and will significantly affect both its performance and memory footprint.&lt;/p&gt;&lt;h3&gt;PEAR and namespaces. Oh MY!&lt;/h3&gt;&lt;p&gt;Also important for PEAR2 is making it easier to work with the names, so I&#039;ve been fighting in &lt;a href=&quot;http://greg.chiaraquartet.net/exit.php?url_id=676&amp;amp;entry_id=198&quot; title=&quot;http://www.google.com/search?q=php+namespace+separator&quot;  onmouseover=&quot;window.status=&#039;http://www.google.com/search?q=php+namespace+separator&#039;;return true;&quot; onmouseout=&quot;window.status=&#039;&#039;;return true;&quot;&gt;the namespace wars&lt;/a&gt;.  For a while there, it was looking like namespaces would go the way they had in the PHP 5 beta cycle: to the trash can.  With a little bit of work, we found a solution no one is 100% happy with, but having tried out several possibilities, I must say the solution we chose is something we can be proud of.  There have been many complainers, but the irony I have seen is that most assert they never planned to use namespaces in the first place, which begs the question: why flap your trap if you have no plan to use the thing?  In any case, you know where I stand on the issue.  I wrote &lt;a href=&quot;http://greg.chiaraquartet.net/exit.php?url_id=677&amp;amp;entry_id=198&quot; title=&quot;http://php.net/namespaces&quot;  onmouseover=&quot;window.status=&#039;http://php.net/namespaces&#039;;return true;&quot; onmouseout=&quot;window.status=&#039;&#039;;return true;&quot;&gt;the new manual&lt;/a&gt; as well as the first draft of the patch that made it possible to end the bickering on internals.  A big thanks to Dmitry Stogov and Stanislav Malyshev for their patience, and especially persistence in working out the solution.  Also thanks to many others who fielded opinions on-list, on IRC, and through private email.  Anyone who contributed a real concern rationally and sometimes forcefully deserves credit for the final implementation, and time will prove that it is a very good one for those who need it.&lt;/p&gt;&lt;p&gt;I am, of course, referring to the now infamous decision to use the backslash (\) as the namespace separator in PHP&#039;s implementation of namespaces.  I won&#039;t go into the rationale, except to say that PHP, unlike other languages, implements a very loose autoload implementation, which makes it impossible to do the most common solution to resolving a name conflict between a static method and a namespaced function - disallow that.  In other words, it&#039;s not possible to detect the conflict unless autoload is called on every potential namespaced function call, which introduces a potentially exponential hidden performance loss.  As Stanislav so eloquently put it, name conflicts have not caused major websites to go down, but performance issues have.  Thus, anything that calls autoload where it may be unnecessary is an unacceptable solution, and the only way to safely handle the ambiguity is to eliminate it.&lt;/p&gt;&lt;p&gt;That is what using the backslash does, because the syntax is different between a namespaced function call and a static method.  Complain or ridicule if you&#039;d like, the rest of us will simply shut up and code.&lt;/p&gt;&lt;p&gt;This decision has several other benefits too, including the ability to audit someone else&#039;s code and figure out what you should grep for, a namespace or a class name.  This also translates into better autocomplete in future IDEs, and so on.&lt;/p&gt;&lt;h3&gt;Wrap up&lt;/h3&gt;&lt;p&gt;So, it&#039;s been a long blog post, but a lot has happened in the past several months, and it&#039;s time to get cracking on the future.  More will follow as time allows.&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Tue, 09 Dec 2008 21:00:17 -0700</pubDate>
    <guid isPermaLink="false">http://greg.chiaraquartet.net/archives/198-guid.html</guid>
    
</item>

</channel>
</rss>