Building a GUI for MacPorts
March 24th, 2008 § 5 Comments
In a fit of enthusiasm/hubris, I volunteered to be a mentor for MacPorts participation in the Google Summer of Code. Specifically, I’m taking on the issue of Graphical User Interfaces, because I once wrote one for DarwinPorts (the predecessor to MacPorts. Unfortunately, the code seems to be long gone; FreeBSD mirrored the dp-cocoa and PortsManager projects, but all the folders appear to be empty.
The current “state of the art” in MacPorts GUIs is the clever Port Authority by Kevin Walzer. Kevin did a fine job, but there is community interest in something that is:
- Native Cocoa
- Fully Open Source (and thus free, not shareware)
- removing the need to run as root
- installing built packages, rather than needing to compile ports
- Installing and using MacPorts, both via the command-line and Port Authority
- Comparing that user experience with Fink Commander (from the parallel Fink project)
- Exploring the internal Tcl libraries used by the port(1) command-line tool
- Identifying the key functionality to provide to user, both now and in the future
- Designing an Objective-C (or Ruby, or Python) wrapper for those Tcl calls (perhaps leveraging Objective-C/Tcl or tclobjc.)
- Developing a reusable MacPorts Framework, for both this GUI and potentially other projects
- Working with the MacPorts team (perhaps including other GSOC members) to address the pre-compiled packages and non-root-user issues
- Building a simple GUI to “prove out” the framework
- Develop an extensible architecture (palettes, services, etc.) for future GUI development
- Integrate nifty Leopard features (Core Data? Animation? Scriptability?)
Of course, that would be a lot to do in one Summer! For those submitting applications (due March 26th, I believe) the key is to demonstrate that you understand the larger problem and what you can realistically accomplish within the time available — and how others can build on it in the future.
Basic Instruments.app Demo
February 20th, 2008 § Leave a Comment
[This is a follow-up to my Rails 2.0 demo]
- In Finder, Double-click to launch /Developer/Applications/Instruments.app
- Select “UI Recorder” for new document
- In toolbar, Select Launch Executable -> Safari.app
- Quit Safari if currently running
- In that instrument, Click “i” for info subwindow
- Configure UI Recorder to NOT Record Mouse Move, Drag
- Open Library from Toolbar
- Select Activity Monitor instrument (e.g., type “act” in Search field)
- In Instrument, select [i] and choose:
- Sample Rate: 2
- Net Bytes In Per Second
- Disk Bytes Read Per Second
- Disk Bytes Written Per Second
- % User Load
- Zoom 4x (move split screen)
- Save
- Click “Record”
Assuming you have already started the app from the last post:
- Type http://localhost:3000/articles into address bar
- Click on “New article”
- Enter title and contents
- Click “Create”
- Click “Back”
- Select “Destroy” for that record
- Quit Safari # ends recording
Finally, zoom into Track to fill window, to show individual actions.
If you’re brave, click “Drive [& Record]” to show that it recorded properly. I haven’t gotten that to work consistently yet, though…
Rails 2.0 on Leopard
February 15th, 2008 § 3 Comments
I wanted to try out some of the new Ruby on Rails 2.0 features in Leopard, so I may as well blog my notes here for future reference.
1. Update Gems
Use this if you haven’t ugpraded your system to Rails 2.0 yet.
sudo gem update --system # Update "gems" itself
sudo gem install rails # not just update, since there's new components
sudo gem uninstall actionwebservice # Get rid of SOAP; REST rules!
sudo gem update # update everything else, to help Rails 2.0 compatibility
yes | sudo gem cleanup # Remove old versions
yes | sudo gem cleanup # Twice, because of dependencies
gem list
actionmailer (2.0.2)
actionpack (2.0.2)
activerecord (2.0.2)
activeresource (2.0.2)
activesupport (2.0.2)...
mongrel (1.1.3)...
rails (2.0.2)
rake (0.8.1)...
sqlite3-ruby (1.2.1)
...
2. Create Project
Create the Rails project, and make sure it and Mongrel work properly.
cd ~/Developer # where I keep all my Rails projects
rails miniblog # Create new Rails hierarchy
cd !$
open http://0.0.0.0:3000 && script/server # start server and launch Safari
=> Booting Mongrel (use 'script/server webrick' to force WEBrick)
=> Rails application starting on http://0.0.0.0:3000
3. Create Scaffold
Use [Command-T] to create a new Tab in Terminal, so the server can keep displaying output in original Tab.
cd ~/Developer/miniblog
script/generate scaffold article title:string content:text
open http://0.0.0.0:3000/articles # Will return error, since no tables
4. Add to Xcode Organizer
- Launch Xcode
- Click on Window -> Organizer (Ctrl-Command-O)
- Drag ~/Developer/miniblog into Organizer window
- Select “miniblog”
- Under ‘Action’, choose “rake db:migrate”
open http://0.0.0.0:3000/articles
Leopard UNIX Links
January 29th, 2008 § Leave a Comment
Since someone else asked, I figured I’d capture a list of UNIX-related resources for Leopard (Mac OS X v10.5).
LOP-ing Off Language-Oriented Programming
July 27th, 2007 § Leave a Comment
I’ve been fascinated by Domain-Specific Languages (DSLs) and metaprogramming for a while (particularly in Ruby), but just encountered the larger concept of Language-Oriented Programming (LOP). As someone who’s been an OOP weenie since the late 1980′s, I am intrigued by the question whether LOP and Language-Driven Development (LDD) will prove to be a similarly transformational paradigm.
As usual, once I discover something “new” it turns out people quicker than me have already been talking about it for years. Still, there’s probably people slower than me who haven’t heard of it yet, so for them I’ve collected some of the more useful resources below. Enjoy!
- Language Oriented Programming: The Next Programming Paradigm (PDF) by Sergey Dmitriev of JetBrains (IntelliJ)
- Language Workbenches: The Killer-App for Domain Specific Languages? by Martin Fowler
- Intentional Programming: A Talk With Charles Simonyi
- Code Generation Network – Andy Evans of Xactium
Technorati Tags: language-driven development, language-oriented programming, domain-specific languages, dsl, ruby, transformation
Nested Data Parallelism in Haskell
July 25th, 2007 § Leave a Comment
[More unedited notes from OSCON]
Nested Data Parallelism in Haskell by
Simon Peyton-Jones
Appeared in the mid-1990′s, but not yet available in a mainstream language.
cf. Flat data parallel (MPI, map/reduce, *C, OpenMP)
-> chunking mechanism (not “N” threads)
-> great for distributed memory systems (MPI)
“do X to A[i]“
X is sequential
in NDP, X can be parallel
-> recursive and unbalanced (e.g., QuickSort)
-> still good cost model, but hard to implement
-> can’t statically predict: do we need millions of threads?
Programmers life is easier, but compiler work is harders
-> NESL; flattens parallelism
-> parallelizing array comphrehensions; no fork/join — or locks!
but, still communication
e.g., sparse vectors -> sparse matrixes
i.e., F-script like array language carefully constrained for “easy” compiler parallelization
Tricky part: ill-balanced!
Solution:
-> flatten sparse vector into a single huge (1-D) vector + index array
-> Guy Blelloch showed us how to do this systematically
-> price is extra bookeeping
-> works best if data always encoded in this manner
Also: general, aggressive fusion (e.g., multiply + add)
-> only possible in functional language with no side effects!
NESL-> Haskell (compiled high-order vs. interpreted first-order)
Key technologies:
- flattening
- non-parametric repsresentations
- chunking
- aggressive fusion
Plus in a “mainstream” language, with libraries often useful for other things.
About 30% slower on uniprocessor, can be faster on > 2processors.
“Alpha” in top of tree of ghc, usable (bleeding-edge) in a few months.
Technorati Tags: haskell, parallelism
Eben Moglen: Public Policy in the “Free” World
July 25th, 2007 § Leave a Comment
Yesterday Eben Moglen made headlines during the O’Reilly Radar at OSCON with a (somewhat) surprising attack on “Open Source” in general, and (more surprisingly) Tim O’Reilly in particular:
- Eben Moglen Wacks Tim O’Reilly
- Eben Moglen Challenges Tim O’Reilly to Join the Conversation
- Eben Moglen Berates Open Source
Today Eben had the stage to himself, to share his thoughts on The Legal Policy of the Free World in the Age of Web 2.0. The following are my (copious, unedited) notes…
———————
Pick up on theme from earlier remarks (explicitly: at Ubuntu live, not yesterday’s Radar
.
Licensing is NOT where it is at in the “next little while.” Protecting free software’s right to be free is not a “licensing job”; what lawyers do at the SFLC is “keep communities strong.” Licenses are a type of “constitution” that shape the resulting community (cf. MIT vs. Apache).
The issue is not technical details of “copyleft” et al, but the nature of the “Republic” being established [place of both public and private community with certain rules/norms]. GPL has the most comprehensive view of such as a Republic — but licenses are merely the beginnings. Life of the community is much deeper and richer [than the written license].
Underlying 21st century political economy: neither factories nor individuals are the unit of production, but communities. No mass-market product is without its community (e.g., cola websites). Both producer and consumer communities need to be nurtured and protected from disruption (external competitors or internal stresses). GPL (inadvertently) addressed these very presciently.
GPLv3 discussions [with corporations] were more thorough than most outsider commentary, exemplary form of serious public policy development for the long-term viability of the community (cf. Apache 2.0, CDDL, MPLv2, etc.): recognize that community interests must be served.
Have we been successful? This year much easier to be us than Microsoft.
We have turned an eternally important corner: we will never go away now! Nothing can extirpate the free business model.
Yes, we are facing patent threats and competitive heat, but those are small compared to our fundamental engineering strengths, and we have taken steps to prepare for those challenges [cf. GPLv3's "correct" solution to problematic patent covenants]. Not a big deal; we [SFLC lawyers] do this sort of “preventive medicine” all the time.
Winning in the court [as happened recently] is the second-best outcome; first-best is for the problem to not arrive. Note: Open Source “litigation rate” is far less than in the commercial world; time to celebrate rather than point fingers or monger fears. Large capital growth with low investment and huge social benefit, with “low friction/low confrontation” mechanisms.
If we have done well [which we have], we ought to understand why. Not to avoid disaster [not gonna happen], but because we are a “city on a hill”, setting an example, but not receiving enough credit or being emulated because of “ludicrous” narrative about relationship of ownership and innovation.
We have to be more attentive to the fact that this is a political achievement: building a good republic, more than a good store/school/product. Pragmatic business questions are important — spend a lot of time on it — but are short term/small beer compared to “fundamental issue of how we build the free community so it builds stronger and more efficient over time” as it becomes larger and (frankly) more unequal.
Why didn’t community fall apart (as widely predicted) when economic inequality increased as a consequence of success? Institutions of equalization (e.g. email) powerful democratizing force in “our” Republic. Meritocracy always a relevant question; sense of shared equality, self-reliance, Emersonian virtues. Almost, but not quite, Libertarian: still believe in community rather than individual as “atomic” unit of value.
Service provision in the GPL: not a matter of business strategy (Google-bashing), but fundamentally a question of rights [Ed: deductive vs. inductive]. Fundamental rule: persons right to run whatever they want wherever they want — including sovereign right to provide services! Ties into right of private modification, including right not to share (cf. freedom of speech includes right to not speak, not to be compelled).
Sometimes, of course, we find ourselves compromising among rights when such conflicts exist. In those cases, it is important to define those rights precisely in order to make a reasoned decision. In Eben’s experience, did not hear a compelling argument for overriding First Two Freedoms for compulsory release of modifications for SaaS; created bridge to “technical experimentation” (Affero?) without “lightly throwing aside long years of argument of principle”.
That’s as far as the license can take us; NOW is the time the interesting conversation can begun.
But, that’s only one. Patent threatening topical, but merely a “family squabble.” Bigger challenge is patent reform. We know something [Congress doesn't] about the harm to innovation caused by patent system. Patent policy is at long last a subject of public discussion; up to us to do what we can to share our “knowledge and wisdom”. IT organizations are also “feeling skeptical”; but we need to stay engaged ourselves to ensure appropriate representation.
cf. ODF: Public data ought to be in a form the public can access, without any intermediary. We can as citizens to effect this issue for all our common good. This of fundamental relevance to what we have learned about how to build “peaceable kingdoms.”
But…
Though democratic in principle, we hold no elections. We need to move as far/fast we can to institutions that are selected by voting. Not proposing how/when, but pointing out that need legitimacy that comes from representation. “My lawyers [and RMS!] work for you more than they work for me, or our donors.” We will work better as we recognize this and improve representation.
Nobody elected Gates either, but this is something we know in our communities: self-governing, legitimate leadership. Nothing more to say: “Republic is not going to be kept strong by speeches made by me… but by you.”
Technorati Tags: community, eben moglen, governance, gplv3, law, politics, democracy, citizenship, sflc, tim o’reilly
Sproutin’ Ideas
July 10th, 2007 § Leave a Comment
I had the pleasure of recently meeting Charles Jolley, best known for his work as CEO of Sproutit. This gave birth to a hot new JavaScript framework/Rails plug-in known as Sproutcore, which for some reason never showed up on the Google searches. Hopefully this blog post will help raise its profile.
ActiveRecord Refactoring Project
February 26th, 2007 § Leave a Comment
I am excited that Zach Dennis has taken up last year’s cause of ActiveRecord Refactoring, since I never made much progress on my ActiveData efforts. Still, to help him out I’ve posted my pre-alpha ActiveData code, which builds on my earlier non-SQL ActiveRecord. I’ve pasted some excerpts below (Read More).
« Read the rest of this entry »
Restful Rails 1.2
January 22nd, 2007 § Leave a Comment
particular, the new scaffold_resource generator makes it really easy
to mockup a basic resource-oriented web app with trivial amounts
of code. Check it out.
