Monday, November 28, 2011

Forgetful Filesystems


There is a slather of news and criticisms aimed at IBM for its recently awarded patent application for a document aging file system.

I'm going to come to Big Blue's defense here, and say that it makes some sense in certain contexts.

There is no such thing as a non-degrading media; digital storage simply reduces the error injection rate infinitesimal proportions and increases the rate at which refreshes occur by orders of magnitude.  Purposefully degrading the fidelity of the data stored on a system is a way to put the lifespan of the storage on par with the lifespan of pre-digital technologies, and thus be enabled to offer a similar value proposal.

Individuals, businesses, and governments generate a lot of junk data. Should this junk data be treated with such high fidelity value as the stuff we really care about?  As long as we get to chose between what constitutes the good stuff and the junk, I'm all for having forgetful filesystems.  They are inevitable.

There are a LOT of business and government records in particular that would be well placed into a round file.  I'm told that some of my tax records, for instance, should be kept around seven years.  Here is a way I can put such records, that to me are truly garbage, in a round file and know that eventually they'll be discarded just like paper copies, and the storage space can be reclaimed and sold to someone else.

We couldn't save such junk data when the medium was paper, but why maintain it just because it went digital?

Sunday, November 27, 2011

OSX Wireless Printing with Leftover PC printers

Apple's AirPrint has very little in the way of direct vendor support. HP seemed to be the only printer maker that supports the protocol.  Now Epson and Cannon have joined in.  

Epson printers suit me just fine. With an external inkwell, the cost of operation is a tiny fraction of the HP ink suckers. I have an older Epson though. What to do?

I dug up an old TrendNet TE100-P1U wireless print server.  The install manual claims that only PostScript printers are supported under OSX. Not so!

Just install the Gimp Print CUPS drivers. You then add the print server as a printer under System Preferences, Scan and Print settings. Set the printer type to your printer's model (mine is an Epson 9400Fax).   Print a test page and... it worked! So now I can print from OSX wirelessly to my old PC printer, without the old PC.  

No, as to AirPrint... OSX Lion can act as a host to your IOS devices via Activator 2.  It works fine sharing the print server printer, using the cups driver. 

Monday, November 21, 2011

Textured Typeography with CSS3

Let's suppose I have a textual element that serves as a title and I don't want it to be a plain boring flat color. CSS3 has a nifty way of letting an image serve as a mask for an element.

Let's take an image with some texture to it, say, the Lava effect from Gimp:


We can apply this to an element using the mask-image property:

.title {
    -webkit-mask-image:  url(http://mitch.amiano.agilemarkup.com/images/titlemask2.png); 
-o-mask-image: url(http://mitch.amiano.agilemarkup.com/images/titlemask2.png); 
-moz-mask-image: url(http://mitch.amiano.agilemarkup.com/images/titlemask2.png); 
mask-image: url(http://mitch.amiano.agilemarkup.com/images/titlemask2.png); 
}


This gives us:

Textured Text

Wherever the image mask is fully opaque, the original element content shows, and wherever it is fully transparent, the original element content is occluded. Between opaque and transparent, bits in the mask will show(or hide) content to the degree that they are partially opaque(or transparent).

Saturday, November 19, 2011

College Computer Science: We don't speak with LISP here.

A presenter at a conference was dismayed at how poorly the computers languages he was taught at NYU translated into practical application on the Web. I asked if LISP was among the languages. It wasn't.

The look on some of the attendees' faces seemed to suggest I was being a wise-guy. I wasn't trying to be snarky; I expected his response because I'd heard it repeatedly and found through personal investigation of engineering curricula that it is not in the mainstream.

λx.x

Substitution of terms in expressions is a fundamental concept. It is so fundamental that kids who are allowed to handle money will do it intuitively when making change. It is bizarre that such a fundamental hypothesis of calculation in computer science and mathematical logic is elided in modern computer science degree programs.

(The same kids will run into difficulty reframing their experience, when given non-monetary challenges in math classes. They get counting and computing when it is informed by their use of language; they lose the cognition when the language is removed.  So add the vocabulary and operators of substitution to their repertoire , early, often, and concretely, and perhaps they will actually start intuiting what computation is all about.)

To the best of my recollection the first standardized transformation language for markup content was ISO/IEC 10179:1996 (DSSSL). It used a subset of Scheme (a LISP dialect) and in turn informed the development of XSL(T). Functional languages (Javascript is another example) are excellent tools for processing markup. University educators need to get beyond their own reframing difficulty to recognize the obvious substitution of "markup" for "Web," and Scheme to re-introduce a little more of a LISP in their discourse.

Thursday, November 17, 2011

Emotional Maturity and Divorce

My spouse has been married to me for over 25 years. The relationship is symmetric: I've been married to her for precisely the same amount of time. It certainly isn't reflexive: we're may be married to each other but I'm not married to myself.  And it isn't transitive either; if I was married to someone else, that wouldn't mean that my two wives would be married (and anyway that would be bigamy). Therefore:

Marriage is Not An Equivalence Relation 

Look, I'm not bragging about it.   I'm no more worthy of accolades on this matter than any one of my divorced friends and relatives.  Life has not always a bed of roses either;  just as in the economy,  externalities shift and expectations change,  excitement can give way to disappointment, disappointment to grief, and new realities set in.  But in our 25 years of marriage, we've been witness to a great deal of divorce, which substantively impacted our family and relationships.

No matter how close you imagine yourself to be to someone, you're not that person and they are not you. The unity is plural. Perceptions matter a little, to be sure, but having a good grasp of reality and an emotional balance between empathy and self-interest matters much more. That means taking time to be reflective together, actively exercising empathy and not just entertaining yourselves on a date night and slugging through chores the rest of your time. Or in the case of those struggling with a loss or divorce, taking a year off to normalize your emotional response to relationships.

Wednesday, November 16, 2011

The Pakled Philosophy of Development

A rambling, opinionated, and very poorly justified rant. Please don't shoot me, I'm just venting. 

A few months ago I blogged on my disenchantment with PHP.  It isn't just PHP, but Java, Perl, and ASP/.NET that make me feel similarly estranged.  The thing is, I want to work with languages, platforms, and systems that don't really, truly, deeply suck, on projects that are worth doing.  Sadly, that's a rare combination. 

I'm not sure exactly what it is about server-pages platforms that gives rise to such feelings of discomfort. I've worked with Joomla and Drupal and ASP sites, so perhaps it is in part the layering of immature cultural cruft inherent in their codebases that gives me the stray thoughts of "what a freakin' mess," and "are you kidding me?"  

But as convoluted as some poorly written components can be, it isn't the primary reason these platforms suck. They suck because, for a dollar you put in today, you have to put a dollar plus change more in tomorrow just to keep the stack from completely collapsing in on itself.  In effect, these platforms encourage a kind of codebase Ponzi scheme or a development Hell.

"We look for things."


All development builds upon previously constructed artifacts. Those artifacts must be available, demonstrably functional, and comprehendible to contribute to the next generation.  Our objectives should not be merely to "make things go", but should include incorporating our knowledge into our archetypal forms, a process of language refinement.  With PHP, Java, and so many other languages, we focus our efforts on entraining more and more information into the platforms, like some sort of junk DNA as it were; the languages and libraries grow in complexity much faster than they grow in value. Similarly, artifacts in these languages seem to have a very limited impact in advancing the system to higher levels of functionality. 

Web Developers using server-page approaches produce piecemeal patchworks of solutions that last for a few months to a few years. Do such systems get increasingly easier to understand and maintain, or do they get increasingly cluttered and ever more risk laden?  Is there repeatability, refinement, increasing transparency, and data unencumbered by private licensing, or a daily slog of Development Hell?

PHP systems rarely gain the level of maturity needed to be approach either self-consistency or completeness and closure over a domain.  The intelligent fall-back position when you're ignorant is Lean -- sacrifice completeness and reduce the feature set to that which is minimally viable. Focus on what provides value. But if you just want to make it go, Pakled style, even when provided sufficient resources it won't contribute to the process of exposing and refining the domain language. Developing a domain language to incorporate new knowledge simply isn't a value proposition that is often pursued in that development culture, and it isn't well supported by the language. 

In mathematics, there is the concept of the derivative. In the context of a function that plots a curve, the derivative tells you the rate at which the function output values are changing at a given point on the curve: it tells you the slope, as it were.   In order for solutions to remain viable over time, the slope of the curve of revenue generating features must be greater than the slope of the curve of hidden costs and intangible liabilities.  Otherwise, you're creating a shell hollowed out of real value.  My sense on server page technologies is that feature incorporation has a relatively flat slope, the cost curve increases more rapidly, and hidden liabilities arise very abruptly and without warning.

For most clients of technology, it is a lose-lose proposition: they know they need to spend the money to stay in the game, but the game is rigged with goods frequently subject to erratic and unplanned obsolescence. 

But that begs two questions. Are there any more sustainable alternatives? Would a more sustainable alternative slow down the pace of innovation? I don't pretend to know the answers but after blathering on in this article, I at least understand some of the reasons why languages like PHP rub me the wrong way. 


Monday, November 14, 2011

Groan! Sass is great, but incomplete


Seduced by the lure of smaller, cleaner, neater, and more responsive stylesheets, I began moving my home page to Compass and SASS.  I installed compass, and got the basic framework in place quickly.

Then I went away for a while.

When I came back, it was because I had the brilliant idea to clean up the media selectors I had made a mess of. "Variables," I thought, "Why, SASS' variable interpolation would make that much easier!"

Sadly, this is not yet the case as of version 3.1.10 :

Syntax error: Invalid CSS after "(max-width: ": expected expression (e.g. 1px, bold), was "$phone-height) {"
        on line 33 of /Users/mamiano/workspace/mitch.amiano.agilemarkup.com/sass/screen.scss
        from line 1 of /Users/mamiano/workspace/mitch.amiano.agilemarkup.com/sass/index.scss

Backtrace:


Well, they are pushing to fix it in version 3.2.  The thought occurs to me that for simple cases, a regexp replacement could do the trick if it could be inserted before Compass processed the file through SASS. 

Sunday, November 13, 2011

Getting fuse4x installed on OSX Lion


I tried out Fuse4x and sshfs for OSX, through Hombrew, this week-end. It should have been a piece of cake, but apparently the recipes aren't very good about telling when another fuse package is installed.

As recommended, I did the install:
$ brew install fuse4x sshfs

Homebrew cheerfully informs me that sshfs won't work unless I sudo copy a file, so I follow its instructions. Seems a bit strange to have to do this manually:
$ sudo cp -rfX /usr/local/Cellar/fuse4x-kext/0.8.13/Library/Extensions/fuse4x.kext /System/Library/Extensions


$ sudo chmod +s /System/Library/Extensions/fuse4x.kext/Support/load_fuse4x

Alas, things just didn't work:
$ sshfs myname@mysite.me:  ~/mnt/mysite.me
/Library/Filesystems/fusefs.fs/Support/fusefs.kext failed to load - (libkern/kext) link error; check the system/kernel logs for errors or try kextutil(8).
the MacFUSE file system is not available (71)

Well, actually, it looks like the kernel extension never even loaded.  OSX is supposed to attempt to auto-load them when a fuse filesystem is mounted, but it doesn't look like it succeeded. I use kextunload and kextload to get it to load the extensions:
$ kextunload /System/Library/Extensions/fuse4x.kext/

(kernel) Kext org.fuse4x.kext.fuse4x not found for unload request.
Failed to unload org.fuse4x.kext.fuse4x - (libkern/kext) not found.

$ kextload /System/Library/Extensions/fuse4x.kext/
Yet trying sshfs again gives the same error. What gives?

I look for more info on homebrew and fuse4x forums and bug lists. Wading through Web pages -- they all describing the solution to the link error as (to sum up) "use fuse4x".  I *am* using fuse4x. One bug report on homebrew hinted at a possible cause to the problem.

It looks like at some point, I had a MacFuse installed,  and it left an orphaned copy of /usr/local/lib/pkgconfig/fuse.pc:
$ cat /usr/local/lib/pkgconfig/fuse.pc
prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: fuse
Description: File System in User Space (MacFUSE)
Version: 2.7.3
Libs: -L${libdir} -lfuse -pthread  -liconv
Cflags: -I${includedir}/fuse -D__FreeBSD__=10 -D_FILE_OFFSET_BITS=64


So I brew uninstall fuse4x, remove the fuse.pc file, and brew install fuse4x.
The homebrew recipe symlinked to the correct fuse.pc file, and I hoped all was good.

It was not good. Same error.  I check the system kernel error logs:
 kernel[0]: fuse4x: starting (version 0.8.13, Nov 11 2011, 17:54:24)
 kernel[0]: kxld[com.google.filesystems.fusefs]: The following symbols are unresolved for this kext:
 kernel[0]: kxld[com.google.filesystems.fusefs]: _OSRuntimeFinalizeCPP
 kernel[0]: kxld[com.google.filesystems.fusefs]: _OSRuntimeInitializeCPP
 kernel[0]: Can't load kext com.google.filesystems.fusefs - link failed.
 kernel[0]: Failed to load executable for kext com.google.filesystems.fusefs.
 kernel[0]: Kext com.google.filesystems.fusefs failed to load (0xdc008016).
 kernel[0]: Failed to load kext com.google.filesystems.fusefs (error 0xdc008016).


Egads! Unresolved symbols? Something just isn't right.  Looks like the same 32 bit MacFuse garbage.

At this point, I'm seriously doubting the sanity of the the homebrew fuse4x/sshfs recipes. Maybe someone thought they were working, as a coincidence of them already having a working fuse4x kernel extension installed.

Well, it turns out that the MacFuse code was not fully uninstalled, and the brew recipe simply accepts the existing files without complaint or comment:
$ ls -ld /Library/Filesystems/fusefs.fs
drwxr-xr-x  4 root  wheel  136 Dec 19  2008 /Library/Filesystems/fusefs.fs

December of 2008 ???!  That's a little dated for a filesystem I installed today (Nov 2011). Even if it were unzipped from a file (which it wasn't), the datestamps of an active project should be more recent than 2008.

My experience with the fuse4x recipe is that it doesn't do squat for detecting previously installed files.... it just accepts them without complaint.

If you've got a previous install of anything remotely resembling MacFuse, clear it out, clean it out, and purge every remnant from your system before monkeying around with fuse4x.

$ /Library/Filesystems/fusefs.fs/Support/uninstall-macfuse-core.sh

MacFUSE Uninstaller: Sudoing...
Password:
MacFUSE Uninstaller: Can not find the Archive.bom for MacFUSE Core package.


Alas, if you upgraded to OSX Lion and MacFuse was previously installed, a LOT of garbage was left around. Kind of makes you wonder, why Apple still has no package management system, but I digress...
$ brew uninstall fuse4x
$ brew uninstall sshfs
$ rm -rf  /usr/local/include/fuse
$ rm /usr/local/lib/libfuse_*
$ sudo rm -rf /Library/Filesystems/fusefs.fs
$ sudo rm -rf /System/Library/Extensions/fuse4x.kext/
Hopefully, I'm not clobbering anything too important that actually worked before now.  I check for anything else fuse related: 
$ find / -name "*fuse*" -print
/Applications/Custom/expandrivencsu/ExpanDrive.app/Contents/ExpanDrive/fs/fstools/fuse.pyo
/Applications/Custom/expandrivencsu/ExpanDrive.app/Contents/Resources/com.expandrive.ExpanDrive.exfs.components/libfuse.dylib
/private/var/db/receipts/com.google.macfuse.bom
/private/var/db/receipts/com.google.macfuse.core.bom
/private/var/db/receipts/com.google.macfuse.core.plist
/private/var/db/receipts/com.google.macfuse.plist
AHA! That explains where my MacFuse install came from! It was a stowaway on a tool I had used to support a client project!  Well, expandrive can be trashed with CleanApp. I plug the com.google.macfuse receipts as well:
$ sudo rm /private/var/db/receipts/com.google.macfuse.bom
$ sudo rm /private/var/db/receipts/com.google.macfuse.core.bom
$ sudo rm /private/var/db/receipts/com.google.macfuse.core.plist
$ sudo rm /private/var/db/receipts/com.google.macfuse.plist
OK. Time to start over. 
$ brew install fuse4x
==> Cloning https://github.com/fuse4x/fuse.git
Updating /Users/myname/Library/Caches/Homebrew/fuse4x--git
==> Checking out tag fuse4x_0_8_13
==> autoreconf --force --install
==> ./configure --disable-debug --disable-static --prefix=/usr/local/Cellar/fuse4x/0.8.13
==> make install
/usr/local/Cellar/fuse4x/0.8.13: 16 files, 728K, built in 35 seconds
$ brew install sshfs
==> Cloning https://github.com/fuse4x/sshfs.git
Updating /Users/myname/Library/Caches/Homebrew/sshfs--git
==> Checking out tag sshfs_2_3_0
==> autoreconf --force --install
==> ./configure --disable-debug --prefix=/usr/local/Cellar/sshfs/2.3.0
==> make install
==> Caveats
Make sure to follow the directions given by `brew info fuse4x-kext`before trying to use a FUSE-based filesystem.
==> Summary
/usr/local/Cellar/sshfs/2.3.0: 6 files, 116K, built in 10 seconds
$ brew info fuse4x-kext
fuse4x-kext 0.8.13
http://fuse4x.org/
/usr/local/Cellar/fuse4x-kext/0.8.13 (5 files, 304K)

In order for FUSE-based filesystems to work, the fuse4x kernel extension
must be installed by the root user:
  sudo cp -rfX /usr/local/Cellar/fuse4x-kext/0.8.13/Library/Extensions/fuse4x.kext /System/Library/Extensions
  sudo chmod +s /System/Library/Extensions/fuse4x.kext/Support/load_fuse4x

http://github.com/mxcl/homebrew/commits/master/Library/Formula/fuse4x-kext.rb

$ sudo cp -rfX /usr/local/Cellar/fuse4x-kext/0.8.13/Library/Extensions/fuse4x.kext /System/Library/Extensions

$ sudo chmod +s /System/Library/Extensions/fuse4x.kext/Support/load_fuse4x


$ sshfs myname@mysite.me:  ~/mnt/mysite.me


Finally! Everything just worked! Satisfaction!


Wednesday, November 9, 2011

Going to Compass

A new home page for me, myself, and I, is posted at http://mitch.amiano.agilemarkup.com .

After playing with some ideas about a canvas toy and Javascript managed page, I decided to stop screwing around with it. There is still a "play" page, for silly toys, but the rest of the site uses good-old, straightforward HTML5 content and CSS3.

The intent wasn't to do anything too flashy (as if I'm capable of being that flashy), but to at least show off some of the technologies I use or have used, and to put out a general call to action (hire me!)

After putting up a few more pages I realized I'd be wasting a lot of time futzing around with the CSS rules. The problem isn't one of mere file organization, but of the brutally redundant information spread among the style rules themselves, and the interdependencies among the rules. 

A common software technique for managing increasing complexity is to modularize. Yet CSS provides no meaningful modularization mechanisms.  Splitting style rules into separate .css files is a trivial, almost valueless, proposition, because the cost of keeping up with which rule is (or is not, or should be, or should not be) in which file overwhelms any benefit from separating the rules appropriate to each page.  The problem of repetition of semantic-less constants and interaction among rules also still remains.  

Managing style rules as CSS syntax in files, even with an IDE, is a waste of time. Yes, people pay for it, but it is still time wasted. We can be cleverer than that. 

Compass, or more precisely, SASS, provides a meaningful modularization and refactoring syntax layer. SASS is a kind of algebra for CSS, allowing you to identify patterns and factor out common variables. Compass is the tool that makes it feasible to use. 

First step: get Ruby. Since OSX runs my development machine, and I use RVM to manage the scripting engines and gem components for development, I've already got Ruby. But I do need to chose which Ruby and gemset I'll use:

cd ~/workspace/mitch.amiano.agilemarkup.com

rvm gemset create agilemarkup
echo "rvm use ruby-1.9.2@agilemarkup" >.rvmrc

Next step: get Compass. I tend not to like it when components for one project pollutes another project, and hate the hassle of manually figuring out component dependencies, so I'm going to use Bundler to make the gem dependency explicit:

cat < Gemfile
source 'http://rubygems.org'
gem 'compass'
EOT
bundle

Running bundle will fetch the Compass gem and any other gem component dependencies needed to use Compas' features.

Now, Gemfile and .rvmrc are specifications of the toolchain that supports the publishing process. Those are pretty high value bits, so they should be version controlled. I use GIT, so yeah, that's easy:

echo "Gemfile.lock" >> .gitignore
git add Gemfile .rvmrc .gitignore
git commit -m "add Compass to manage stylesheets"


The Compass gem installed, it is time to set up the basic framework of files in the working tree:

cd .. 
compass create mitch.amiano.agilemarkup.com

cd mitch.amiano.agilemarkup.com

There is a load of stuff created:
directory mitch.amiano.agilemarkup.com/sass/
directory mitch.amiano.agilemarkup.com/stylesheets/
   create mitch.amiano.agilemarkup.com/config.rb 
   create mitch.amiano.agilemarkup.com/sass/screen.scss 
   create mitch.amiano.agilemarkup.com/sass/print.scss 
   create mitch.amiano.agilemarkup.com/sass/ie.scss 
   create mitch.amiano.agilemarkup.com/stylesheets/ie.css 
   create mitch.amiano.agilemarkup.com/stylesheets/print.css 
   create mitch.amiano.agilemarkup.com/stylesheets/screen.css 

Finally, get Compass to watch the directories and process any SASS files that change:

compass watch & 

That's it! I'm all set for refactoring my stylesheets.