<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" xml:lang="en-US">
  <title>chapados.org - Home</title>
  <id>tag:chapados.org,2007:mephisto/</id>
  <generator uri="http://mephistoblog.com" version="0.7.2">Mephisto Noh-Varr</generator>
  
  <link href="http://chapados.org/" rel="alternate" type="text/html" />
  <updated>2007-12-08T05:55:46Z</updated>
  <link rel="self" href="http://feeds.feedburner.com/ChapadosBlog" type="application/atom+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><entry xml:base="http://chapados.org/">
    <author>
      <name>brian</name>
    </author>
    <id>tag:chapados.org,2007-11-04:80</id>
    <published>2007-11-04T19:41:00Z</published>
    <updated>2007-12-08T05:55:46Z</updated>
    <link href="http://feedproxy.google.com/~r/ChapadosBlog/~3/h4N9eztHHp8/leopard-shines-the-spotlight-on-xattrs" rel="alternate" type="text/html" />
    <title>Leopard shines the spotlight on xattrs</title>
<content type="html">
            &lt;p&gt;When Tiger was released back in 2005, Spotlight search technology was all the rage.  Several articles appeared showing off the technology and &lt;a href='http://arstechnica.com/reviews/os/macosx-10-4.ars/9'&gt;explaining the details&lt;/a&gt;. For most people, being able to easily find their files was all they cared about.  Others thought it was too slow and immediately disabled it.&lt;/p&gt;

&lt;p&gt;If you're a geek like me, you probably got excited when &lt;a href='http://kernelthread.com/'&gt;Amit Singh&lt;/a&gt; explained how to use the undocumented &lt;a href='http://www.kernelthread.com/software/fslogger/'&gt;fsevents API&lt;/a&gt; to monitor spotlight events directly. However, although spotlight in Tiger monitors basic file activity, it ignored &lt;a href='http://arstechnica.com/reviews/os/macosx-10-4.ars/7'&gt;xattrs&lt;/a&gt; (extended attributes).  This matters, because extended attributes have major potential to store arbitrary metadata on files.  Ever wanted to be able to tag your files?  Maybe you've used one of the existing Finder-comment &lt;a href='http://lifehacker.com/software/tags/metadata-as-a-filing-system-169971.php'&gt;hacks&lt;/a&gt;, or a more elegant solution like &lt;a href='http://bigrobotsoftware.com/'&gt;Tagbot&lt;/a&gt;.  Perhaps you've experimented with &lt;a href='http://www.fluffy.co.uk/spotmeta/'&gt;spotmeta&lt;/a&gt;, a project started by Ben Summers that made extended attributes searchable through spotlight. In Tiger, this was difficult, since the fs_event system did not monitor changes to extended attributes. A quick look through the &lt;a href='http://www.opensource.apple.com/darwinsource/10.5/xnu-1228/'&gt;bsd kernel source code&lt;/a&gt; shows that this has changed in Leopard:&lt;/p&gt;

&lt;p&gt;(from xnu/bsd/sys/fsevents.h)&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;// Event types that you can ask to listen for
#define FSE_INVALID             -1
#define FSE_CREATE_FILE          0
#define FSE_DELETE               1
#define FSE_STAT_CHANGED         2
#define FSE_RENAME               3
#define FSE_CONTENT_MODIFIED     4
#define FSE_EXCHANGE             5
#define FSE_FINDER_INFO_CHANGED  6
#define FSE_CREATE_DIR           7
#define FSE_CHOWN                8
#define FSE_XATTR_MODIFIED       9
#define FSE_XATTR_REMOVED       10

#define FSE_MAX_EVENTS          11
#define FSE_ALL_EVENTS         998

#define FSE_EVENTS_DROPPED     999
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Leopard adds the &lt;code&gt;FSE_XATTR_MODIFIED&lt;/code&gt; (9) and &lt;code&gt;FSE_XATTR_REMOVED&lt;/code&gt; (10) events, making it possible to monitor changes to extended attributes. This might seem like no big deal. However, this opens the door to building custom metadata solutions and integrating them directly into the operating system.  I haven't installed Leopard yet, so I'm not sure if Apple is utilizing this underlying technology for anything in Leopard. I checked the online &lt;a href='http://developer.apple.com/documentation/Carbon/Reference/MetadataAttributesRef/index.html#//apple_ref/doc/uid/TP40001689'&gt;Spotlight metadata attributes&lt;/a&gt;, and there is nothing obvious to suggest that Spotlight is making custom extended attributes easily searchable through the MDQuery API.  Apple has a habit of adding features to the kernel in preparation for use in later versions of the OS (cough*autofs).  This little gem of a feature could bring a project like &lt;a href='http://www.fluffy.co.uk/spotmeta/'&gt;spotmeta&lt;/a&gt; back to life, or inspire a new round of xattr-based metadata solutions.  Stay tuned for more information on this topci after I have time to install Leopard.&lt;/p&gt;

&lt;p&gt;(07-dec-2007 update: fixed a few typos)&lt;/p&gt;
          &lt;img src="http://feeds.feedburner.com/~r/ChapadosBlog/~4/h4N9eztHHp8" height="1" width="1"/&gt;</content>  <feedburner:origLink>http://chapados.org/2007/11/4/leopard-shines-the-spotlight-on-xattrs</feedburner:origLink></entry>
  <entry xml:base="http://chapados.org/">
    <author>
      <name>brian</name>
    </author>
    <id>tag:chapados.org,2007-10-31:79</id>
    <published>2007-10-31T16:39:00Z</published>
    <updated>2007-10-31T16:41:28Z</updated>
    <link href="http://feedproxy.google.com/~r/ChapadosBlog/~3/u3k2L0M9gNQ/you-might-need-version-control-if" rel="alternate" type="text/html" />
    <title>You might need version control if</title>
<content type="html">
            &lt;ol&gt;
&lt;li&gt;&lt;p&gt;You're working on a grant or paper with collaborators and your filenames look like this (no, I'm not making this up):&lt;/p&gt;

&lt;p&gt;&lt;code&gt;endo07_gaz_D2edits_26oct_2pm_kih_26Oct_700pm_rick_27Oct.doc&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The filename would actually be longer, except that then it would exceed the 255 character limit, so you just make it more cryptic instead.  Soon you end up with files named:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;e07gD2e26o14k26o19r27o.doc&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Version control software is not "for programmers only". If you're working on a collaborative writing project, please, pretty please, stop pretending that &lt;a href='http://git.or.cz/'&gt;good&lt;/a&gt; &lt;a href='http://www.selenic.com/mercurial/'&gt;version&lt;/a&gt; &lt;a href='http://darcs.net/'&gt;control&lt;/a&gt; &lt;a href='http://subversion.tigris.org/'&gt;tools&lt;/a&gt; do not exist and learn how to use one of them.  While you're at it, ditch word and use a real &lt;a href='http://macromates.com/'&gt;text&lt;/a&gt; &lt;a href='http://www.gnu.org/software/emacs/'&gt;editor&lt;/a&gt; that supports syntax highlighting and integrates with your version control system.  Then you can write with &lt;a href='http://daringfireball.net/projects/markdown/'&gt;markdown&lt;/a&gt; + &lt;a href='http://www.latex-project.org/'&gt;LaTeX&lt;/a&gt; using &lt;a href='http://johnmacfarlane.net/pandoc/'&gt;Pandoc&lt;/a&gt; and save yourself and your collaborators from lots of headaches.&lt;/p&gt;
          &lt;img src="http://feeds.feedburner.com/~r/ChapadosBlog/~4/u3k2L0M9gNQ" height="1" width="1"/&gt;</content>  <feedburner:origLink>http://chapados.org/2007/10/31/you-might-need-version-control-if</feedburner:origLink></entry>
  <entry xml:base="http://chapados.org/">
    <author>
      <name>brian</name>
    </author>
    <id>tag:chapados.org,2007-08-24:77</id>
    <published>2007-08-24T06:22:00Z</published>
    <updated>2007-08-24T07:08:56Z</updated>
    <category term="hacks" />
    <link href="http://feedproxy.google.com/~r/ChapadosBlog/~3/2VXrEaX3MPM/readynas-upgrade-includes-ssh-access" rel="alternate" type="text/html" />
    <title>ReadyNAS upgrade includes ssh access</title>
<content type="html">
            &lt;p&gt;If anyone out there is actually checking this site for the latest info on readynas shell access, then know that this will probably be my last post about the topic. &lt;del&gt;Infrant&lt;/del&gt; Netgear has finally released a beta version of &lt;a href='http://www.infrant.com/forum/viewtopic.php?t=12671'&gt;RAIDiator v4&lt;/a&gt;.  Highlights include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;RAIDiator 4 is now based on Linux 2.6.&lt;/li&gt;
&lt;li&gt;Remote SSH for Support is disabled by default. If you wish to enable SSH access for Support, you&#x2019;ll need to install the ToggleSSH add-on. &lt;/li&gt;
&lt;li&gt;Root SSH support. With the EnableRootSSH add-on, you can now remote login to the ReadyNAS RAIDiator shell as a root user. Initial password for root will be the same as the current FrontView admin password. Please keep in mind that NETGEAR may deny support if you&#x2019;ve enabled root access.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;However, the upgrade is a one-way deal.  You can't go back to v3.x with the 2.4 kernel if something goes wrong.  Also, keep this in mind: &lt;/p&gt;

&lt;blockquote&gt;
    &lt;p&gt;"NETGEAR Support will in no way provide support for beta releases. All support will come from this beta forum. The Jedi council will try our best to support you here, but please understand that even if have encountered legitimate bugs, bug fixes may not occur in a timely manner, and in some cases if at all. "&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;Should I upgrade?&lt;/h2&gt;

&lt;p&gt;It depends... If you're worried about stability, then probably not.  Ironically, in terms of stability, I'm pretty sure that the info published here is probably a safer bet than upgrading to raidiator 4 if all you care about is ssh access.  They apparently redesigned frontview, but who cares if you do all your administration over ssh.  In the end, who do you trust more, me or Netgear? ;-) The choice is yours (see below if you're having a hard time deciding).&lt;/p&gt;

&lt;p&gt;I personally have &lt;em&gt;not&lt;/em&gt; upgraded my ReadyNAS yet.  To their credit, they are already on the 3rd release of the beta.  I will probably wait until things are looking stable to apply the upgrade.&lt;/p&gt;

&lt;h2&gt;IMPORTANT: install the Toggle SSH add-on for 3.x/4.x&lt;/h2&gt;

&lt;p&gt;One thing you should definitely do is close this &lt;a href='http://www.securityfocus.com/archive/1/archive/1/476266/100/0/threaded'&gt;backdoor security hole&lt;/a&gt;[1] by installing the &lt;a href='http://www.infrant.com/download/addons/ToggleSSH_1.0.bin'&gt;ToggleSSH&lt;/a&gt; add-on.  Infrant also &lt;a href='http://www.infrant.com/forum/viewtopic.php?t=12313'&gt;announced&lt;/a&gt; this vulnerability in their ssh-based backdoor.  If you connect your readynas to any kind of network, you should either disable SSH access, or login and disable root ssh login.&lt;/p&gt;

&lt;p&gt;[1]: I want to point out that while my name is listed first on the security advisory, practically all of the work was done by Felix.  He did some very clever and elegant work to obtain that information, and I was thrilled to be along for the ride.&lt;/p&gt;
          &lt;img src="http://feeds.feedburner.com/~r/ChapadosBlog/~4/2VXrEaX3MPM" height="1" width="1"/&gt;</content>  <feedburner:origLink>http://chapados.org/2007/8/24/readynas-upgrade-includes-ssh-access</feedburner:origLink></entry>
  <entry xml:base="http://chapados.org/">
    <author>
      <name>brian</name>
    </author>
    <id>tag:chapados.org,2007-07-24:75</id>
    <published>2007-07-24T20:44:00Z</published>
    <updated>2007-07-24T20:57:24Z</updated>
    <category term="hacks" />
    <link href="http://feedproxy.google.com/~r/ChapadosBlog/~3/YJvp7p6MqqE/take-back-your-readynas" rel="alternate" type="text/html" />
    <title>Take back your readynas</title>
<content type="html">
            &lt;p&gt;A few people have asked if I&#x2019;ve been able to compile a working kernel and run it on my readynas.  I haven&#x2019;t attempted this, but the lazy web has come through for all of us. Head over to &lt;a href='http://x226.org/'&gt;360&lt;/a&gt; and learn how to &lt;a href='http://x226.org/?p=30'&gt;compile a working kernel&lt;/a&gt; and &lt;a href='http://x226.org/?p=24'&gt;install it on the box&lt;/a&gt;.&lt;/p&gt;
          &lt;img src="http://feeds.feedburner.com/~r/ChapadosBlog/~4/YJvp7p6MqqE" height="1" width="1"/&gt;</content>  <feedburner:origLink>http://chapados.org/2007/7/24/take-back-your-readynas</feedburner:origLink></entry>
  <entry xml:base="http://chapados.org/">
    <author>
      <name>brian</name>
    </author>
    <id>tag:chapados.org,2007-05-06:62</id>
    <published>2007-05-06T04:44:00Z</published>
    <updated>2007-05-06T04:49:13Z</updated>
    <category term="hacks" />
    <link href="http://feedproxy.google.com/~r/ChapadosBlog/~3/RtQnr5P1I7E/readynas-shell-access-redux" rel="alternate" type="text/html" />
    <title>ReadyNAS shell access redux</title>
<content type="html">
            &lt;p&gt;When I wrote the original article on how to enable &lt;a href='http://chapados.org/2006/11/23/infrant-readynas-shell-access'&gt;shell access to the readynas&lt;/a&gt;, I was motivated by the need to solve my backup problems.  Given the &lt;a href='http://www.infrant.com/forum/viewtopic.php?t=2120&amp;amp;highlight='&gt;unfulfilled&lt;/a&gt; &lt;a href='http://www.infrant.com/forum/viewtopic.php?t=3366&amp;amp;postdays=0&amp;amp;postorder=asc&amp;amp;start=90'&gt;promises&lt;/a&gt; from &lt;a href='http://www.infrant.com'&gt;infrant&lt;/a&gt; regarding ssh availability, I was also frustrated, and wanted to share how easy it was to do it yourself. After solving solving the immediate problem, I did not try to develop a more elegant solution. Fortunately, the web is a big place, and I managed to inspire someone else to come up with a better solution that doesn't require removing any drives. This person, whom I will call "D", has asked to remain anonymous.&lt;/p&gt;

&lt;h2&gt;Protocol&lt;/h2&gt;

&lt;p&gt;Here is D's method for changing the root password:&lt;/p&gt;

&lt;blockquote&gt;
    &lt;p&gt;This is a simple approach that exploits the ability to create symbolic
    links (symlinks) while using NFS, and the ability to traverse symlinks
    while using AFP (Apple File Protocol). It also exploits the fact that
    /etc/cron.d is writeable by the admin user, which permits arbitrary
    crontabs to be created. This will probably require a Macintosh, or
    another platform which can mount AFP shares.&lt;/p&gt;
    
    &lt;ol&gt;
    &lt;li&gt;Enable NFS and AFP services (Services -&gt; Standard File Protocols).&lt;/li&gt;
    &lt;li&gt;Make a share NFS write-enabled and root privilege-enabled (Shares -&gt;NFS)&lt;/li&gt;
    &lt;li&gt;Make the same share AFP write-enabled for the admin user (Shares -&gt; AFP)&lt;/li&gt;
    &lt;li&gt;Mount the share using NFS&lt;/li&gt;
    &lt;li&gt;Create a symbolic link on the share to /etc (etc -&gt; /etc).&lt;/li&gt;
    &lt;li&gt;Mount the share using AFP, as the admin user.&lt;/li&gt;
    &lt;li&gt;Create a new crontab file in etc/cron.d/&lt;/li&gt;
    &lt;/ol&gt;
    
    &lt;p&gt;&lt;code&gt;# example listing for /etc/cron.d/passwd&lt;/code&gt;&lt;/p&gt;
    
    &lt;p&gt;&lt;code&gt;* * * * * root /usr/sbin/usermod -p '$1$RVWNkJR9$CaniKWqUxyXC3ETsWKrCE1' root&lt;/code&gt;&lt;/p&gt;
    
    &lt;ol&gt;
    &lt;li&gt;Reboot the device, to restart cron.&lt;/li&gt;
    &lt;/ol&gt;
&lt;/blockquote&gt;

&lt;h2&gt;Notes&lt;/h2&gt;

&lt;p&gt;This would not work if the backend software on the readynas was configured properly. It turns out that frontview, which is written in perl, makes system calls directly and executes commands as the admin user. To make life easier on themselves, Infrant allows the admin user to modify key system files such as /etc/cron.d. In fact, the entire frontview interface is owned by admin, so you should be able to mount /frontview that same way that you mounted /etc and modify any of the files that control the web interface. Now that &lt;a href='http://www.infrant.com/company/news_content.php?id=336'&gt;infrant has been acquired by netgear&lt;/a&gt;, maybe some of this will get cleaned up.  I suspect that is why infrant was promising a 4.0 release of RAIDiator that will include ssh access, and will &lt;em&gt;not&lt;/em&gt; be backwards compatible with the current versions of the OS (3.x). Sounds great, doesn't it? Given the amount of time that it takes Infrant to actually deliver on their promises lately, I think that if you want ssh access before 2008, you should probably use the method described above.&lt;/p&gt;
          &lt;img src="http://feeds.feedburner.com/~r/ChapadosBlog/~4/RtQnr5P1I7E" height="1" width="1"/&gt;</content>  <feedburner:origLink>http://chapados.org/2007/5/6/readynas-shell-access-redux</feedburner:origLink></entry>
  <entry xml:base="http://chapados.org/">
    <author>
      <name>brian</name>
    </author>
    <id>tag:chapados.org,2007-03-23:59</id>
    <published>2007-03-23T02:32:00Z</published>
    <updated>2007-03-23T02:37:44Z</updated>
    <category term="hacks" />
    <link href="http://feedproxy.google.com/~r/ChapadosBlog/~3/opL70vccr9s/infrant-readynas-software" rel="alternate" type="text/html" />
    <title>Infrant ReadyNAS software</title>
<content type="html">
            &lt;p&gt;The first quarter of 2007 is almost over and Infrant has still not released any patches that enable ssh access to the readynas.  I guess they were probably too busy &lt;a href='http://www.infrant.com/forum/viewtopic.php?t=9624'&gt;putting out fires&lt;/a&gt; caused by Windows Vista.  Those poor bastards.&lt;/p&gt;

&lt;p&gt;Judging from the responses to my &lt;a href='http://chapados.org/2007/1/16/building-a-compiler-for-the-infrant-readynas'&gt;cross-compiler post&lt;/a&gt; (a few spam messages and 1 real response), I think most people would prefer to just download pre-compiled software, rather than go through the hassle of building and using a cross-compiler. In an ideal world, I would bundle up some of the packages I&#x2019;ve compiled as .deb files that could be installed with dpkg.  If there is enough interest, maybe I will make some time for doing that.  Until then, I&#x2019;m just going to redistribute the compiled packages along with the full source code. I&#x2019;ve read through the license agreements and  I&#x2019;m pretty sure that I&#x2019;m complying with all the conditions for each package. If I&#x2019;m not, please tell me.  It is not my intention to illegally redistribute this software.&lt;/p&gt;

&lt;p&gt;I usually just build things when I need them for some reason.  Since I&#x2019;ve been primarily concerned about backups, I&#x2019;ve tried rdiff-backup and rsync with extended attributes. I will add new software to this page if/when I end up building it for the readynas. Enjoy!&lt;/p&gt;

&lt;p&gt;(Unless otherwise noted, you can install all of the prerequisite software from the debian-sparc repository)&lt;/p&gt;

&lt;h2&gt;rdiff-backup&lt;/h2&gt;

&lt;p&gt;&lt;a href='http://chapados.org/assets/2007/3/23/rdiff-backup-1.1.9-readynas.tar.bz2'&gt;rdiff-backup-1.1.9-readynas.tar.bz2&lt;/a&gt;
md5: c029e2ab6ad6a99f6b7aec2c7be871ab&lt;/p&gt;

&lt;p&gt;This is a great backup program.  However, due to the extreme strain it puts on the meager CPU of the readynas, it is not usable on the readynas.&lt;/p&gt;

&lt;p&gt;prerequisites: python, pylibacl, pyxattr, librsync&lt;/p&gt;

&lt;h4&gt;installation&lt;/h4&gt;

&lt;p&gt;The tar file contains the complete source code, along with the build directory containing the compiled C extensions.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;install prerequisites&lt;/li&gt;
&lt;li&gt;unpack the tarball&lt;/li&gt;
&lt;li&gt;run the setup.py program (as root): sudo python setup.py install&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;rsync-EA&lt;/h2&gt;

&lt;p&gt;&lt;a href='http://chapados.org/assets/2007/3/23/rsync-2.6.3-readynas.tar.bz2'&gt;rsync-2.6.3-readynas.tar.bz2&lt;/a&gt;
md5: 1735165cb7ab886a089f0fc42e20766b&lt;/p&gt;

&lt;p&gt;This is a patched version of rsync-2.6.3 with all of the patches from apple and &lt;a href='http://www.lartmaker.nl/rsync/'&gt;lartmaker.nl&lt;/a&gt; applied.  In addition, I back-ported some very minor changes from rsync-2.6.4 so that I could cross-compile the code. This version has worked well for me so far, and is my primary backup tool. The tar file contains the full source code along with the cross-compiled executable. &lt;/p&gt;

&lt;h4&gt;installation&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;unpack the tarball&lt;/li&gt;
&lt;li&gt;&#x2018;sudo make install&#x2019; to install rsync in /usr/local/bin.  Alternatively, you can just copy the executable to your favorite place.&lt;/li&gt;
&lt;/ol&gt;
          &lt;img src="http://feeds.feedburner.com/~r/ChapadosBlog/~4/opL70vccr9s" height="1" width="1"/&gt;</content>  <feedburner:origLink>http://chapados.org/2007/3/23/infrant-readynas-software</feedburner:origLink></entry>
  <entry xml:base="http://chapados.org/">
    <author>
      <name>brian</name>
    </author>
    <id>tag:chapados.org,2007-01-16:38</id>
    <published>2007-01-16T20:17:00Z</published>
    <updated>2007-03-23T01:35:38Z</updated>
    <category term="hacks" />
    <link href="http://feedproxy.google.com/~r/ChapadosBlog/~3/93YD_R3nV5I/building-a-compiler-for-the-infrant-readynas" rel="alternate" type="text/html" />
    <title>Building a compiler for the Infrant ReadyNAS</title>
<content type="html">
            &lt;p&gt;Having shell access is cool, but the real fun doesn't begin until you can build and run the software that you want on the ReadyNAS. After an embarrassingly long delay, here is the second installment of my series on &lt;a href='http://chapados.org/2006/11/23/infrant-readynas-hacks'&gt;Infrant ReadyNAS hacks&lt;/a&gt;. In this article, I'll show you how to use &lt;a href='http://kegel.com/crosstool/'&gt;crosstool&lt;/a&gt; to build a gcc compiler on a x86 linux box that you can use to compile software to run on your ReadyNAS.&lt;/p&gt;

&lt;p&gt;As opposed to installing a development environment on the ReadyNAS itself, a cross compiler offers a few key advantages:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The ReadyNAS is slow and doesn't have much memory (256 MB by default). Compiling software on the box would take a long time.&lt;/li&gt;
&lt;li&gt;It requires minimal modifications to the ReadyNAS. Let's face it, at the end of the day, you probably want to use the ReadyNAS for backups, which means you probably want a stable operating system that is compatible with upgrades released by Infrant. Manually installing the files necessary for a working development environment on the ReadyNAS is &lt;a href='http://chapados.org/2006/11/23/infrant-readynas-shell-access/comments/35'&gt;neither trivial nor elegant&lt;/a&gt;. I'm not sure if it would cause problems with future updates, but it is certainly an ugly solution.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Your first reaction to term "cross compiler" or "cross toolchain" might be that it sounds complicated, especially for an unknown system.  I'm not an expert on gcc by any stretch of the imagination. Fortunately, the people who are experts have packaged up their knowledge into a set of shell scripts called &lt;a href='http://kegel.com/crosstool/'&gt;crosstool&lt;/a&gt;, which mostly automates the process of building a cross compiler/toolchain. In short, &lt;a href='http://kegel.com'&gt;Dan Kegel&lt;/a&gt; and the crosstool contributors are my heros.  They deserve the lions share of credit for their work.  I'm just a user reporting results.&lt;/p&gt;

&lt;h3&gt;Resouces&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Access to an x86 linux box with a working build environment.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href='http://kegel.com/crosstool/'&gt;Crosstool&lt;/a&gt;. Go and download &lt;a href='http://kegel.com/crosstool/crosstool-0.43.tar.gz'&gt;crosstool v0.43&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href='http://www.infrant.com/download/GPL/glibc-2.3.2.ds1.tar.bz2'&gt;Patches for glibc-2.3.2&lt;/a&gt; [released] by Infrant in accordance with the GPL. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Time.  It will probably take a few to several hours to build the tool chain, depending on the speed of your system.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;Background&lt;/h3&gt;

&lt;p&gt;If you haven't already, go read the &lt;a href='http://kegel.com/crosstool/crosstool-0.43/doc/crosstool-howto.html'&gt;crosstool howto&lt;/a&gt;, I'll wait.&lt;/p&gt;

&lt;h3&gt;Crosstool configuration for Infrant ReadyNAS&lt;/h3&gt;

&lt;p&gt;Crosstool knows how to build toolchains for various combinations of glibc/gcc to run on target systems. For the purposes of configuring crosstool, we can assume that the ReadyNAS is just running vanilla sparc-linux. We already know that the ReadyNAS uses glibc-2.3.2. According to the crosstool &lt;a href='http://kegel.com/crosstool/crosstool-0.43/buildlogs/index.html'&gt;build matrix&lt;/a&gt;, there are only a few versions of gcc that are likely to work.&lt;/p&gt;

&lt;p&gt;So, there actually aren't many Infrant-specific modifications that haven't already been &lt;a href='http://www.infrant.com/products/products_details.php?name=RAIDiator#'&gt;provided by Infrant&lt;/a&gt;. However, to keep your crosstool directory nice and neat, you might want to set things up as follows:&lt;/p&gt;

&lt;p&gt;In your crosstool directory, make yourself a customized copy of demo-sparc.sh&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cp demo-sparc.sh infrant-sparc.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I was able to successfully build gcc-3.3.6 and glibc-2.3.2, so I recommend using that combination. For example, my infrant-sparc.sh file looks something like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#!/bin/sh
set -ex
TARBALLS_DIR=$HOME/downloads
RESULT_TOP=/opt/crosstool
export TARBALLS_DIR RESULT_TOP
GCC_LANGUAGES="c,c++"
export GCC_LANGUAGES

# Really, you should do the mkdir before running this,
# and chown /opt/crosstool to yourself so you don't need to run as root.
mkdir -p $RESULT_TOP

# Build the toolchain.  Takes a couple hours and a couple gigabytes.
eval `cat sparc.dat gcc-3.3.6-glibc-2.3.2.dat`         sh all.sh --notest

echo Done.
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Get &amp;amp; Patch glibc-2.3.2&lt;/h3&gt;

&lt;p&gt;If you just started crosstool at this point, it would download all necessary programs, apply patches necessary for building a cross compiler and build. It really is that easy. In our case, the only thing we want to do differently is use the patched version of glibc-2.3.2 from Infrant. Download glibc-2.3.2 from your favority Debian mirror, and create the following shell script to apply the infrant patches:&lt;/p&gt;

&lt;h5&gt;apply-patches.sh:&lt;/h5&gt;

&lt;pre&gt;&lt;code&gt;#!/bin/bash

VERSION=2.3.2 # version of glibc

# Patch in the Debian patches:
DPATCHES="$( grep -v '^#' debian/patches/00list | grep infrant )"
for pf in ${DPATCHES}; do
    patchf=debian/patches/${pf}.dpatch
    if [ -s ${patchf} ]; then
      echo "$patchf"
      chmod 755 ${patchf}
      ${patchf} -patch glibc-${VERSION}
    fi
done
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now unpack the tar file, apply patches, and repackage the source:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cd $HOME/downloads
mkdir infrant
cd infrant
wget http://www.infrant.com/download/GPL/glibc-2.3.2.ds1.tar.bz2
tar xjvf glibc-2.3.2.ds1.tar.bz2
cd glibc-2.3.2.ds1
chmod +x prep.sh
./prep.sh
./apply-patches.sh
tar cvf ../../glibc-2.3.2.tar ./glibc-2.3.2
cd ..
bzip2 glibc-2.3.2.tar
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;These commands download the glibc-2.3.2 from Infrant, unpack the debian distribution, and apply all the patches (prep.sh). The end result is a glibc-2.3.2 directory ready to be built. We then pack up the patched source directory to create a glibc-2.3.2.tar.bz2 file in the download directory.  Crosstool will find this file and use it instead of downloading the vanilla glibc-2.3.2.tar.bz2.&lt;/p&gt;

&lt;h4&gt;Are these patches really necessary?&lt;/h4&gt;

&lt;p&gt;I'm not sure if this step is necessary, because I never even tried to build the cross toolchain without using Infrant's glibc-2.3.2.  I know, I know, I wasn't being very scientific, but I didn't have time to mess around forever with this stuff. Building gcc and friends takes time.  If you try it without the patched glibc and it works, please let me know.&lt;/p&gt;

&lt;h3&gt;Build it&lt;/h3&gt;

&lt;pre&gt;&lt;code&gt;cd $HOME/crosstool
sudo mkdir -p /opt/crosstool
sudo chmod 777 /opt/crosstool
./infrant-sparc.sh | tee infrant-sparc-glibc-2.3.2-gcc-3.3.6.log
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;You don't need to use tee, but I like to keep a log of the build.&lt;/p&gt;

&lt;p&gt;After some time, your build should have completely successfully, and you will have a cross toolchain in /opt/crosstool.&lt;/p&gt;

&lt;h3&gt;Test it&lt;/h3&gt;

&lt;p&gt;The right way to test your new toolchain is to use &lt;a href='http://kegel.com/crosstool/crosstool-0.43/doc/crosstest-howto.html'&gt;crosstest&lt;/a&gt;. Dan Kegel has written up some very nice documentation on exactly how to test gcc using dejavu. I am guilty of not doing this yet. Sorry.  The worst part is that I was holding up this article for the test results. Sorry. It seems like there is enough interest in this information to just provide it "as is" for now, with a "works for me" clause. When I get the tests done, I will post another article about testing. Until, then I can only report that it works for the limited number of userland programs that I've tried.&lt;/p&gt;

&lt;h3&gt;Build stuff&lt;/h3&gt;

&lt;p&gt;If you're not planning to run the full test suite, you should at least try building a few "userland" programs. You can start with the classic hello world:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;/* hello.c : prints "hello world" */
#include &amp;lt;stdio.h&amp;gt;
int main(void) {
    printf("hello world\n");
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This will at least tell you that you can compile a basic running program.  To compile it, save the text above into a file called hello.c, then:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;/opt/crosstool/gcc-3.3.6-glibc-2.3.2/sparc-unknown-linux-gnu/bin/sparc-unknown-linux-gnu-gcc -o hello hello.c
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Copy the "hello" executable to your ReadyNAS, run and make sure it prints "hello world" on the screen. This works, but it's annoying to deal with the long paths. I like to wrap all the commands necessary for using the cross toolchain into a shell script.  Here's an example:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#!/bin/bash

TARGET="sparc-unknown-linux-gnu"
CROSSBIN="/opt/crosstool/gcc-3.3.6-glibc-2.3.2/sparc-unknown-linux-gnu/bin"

CROSS="${CROSSBIN}/${TARGET}-"

PATH="$PATH":$CROSSBIN
export PATH

# build commands below this line
# --------------------------
${CROSS}gcc -o hello hello.c
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Unfortunately, according to the crosstool website, the &lt;a href='http://kegel.com/crosstool/crosstool-0.43/doc/crosstool-howto.html#issues'&gt;builduserland option is broken&lt;/a&gt; for the time being. I've successfully compiled rsync, Python and the C components of rdiff-backup. I promise to post those instructions soon as an example of what is possible.&lt;/p&gt;

&lt;h5&gt;[UPDATED: 22-March-2007]&lt;/h5&gt;

&lt;p&gt;I realized that I forgot to include the step for actually applying the patches from infrant. This is now included as the apply-patches.sh shell script.&lt;/p&gt;
          &lt;img src="http://feeds.feedburner.com/~r/ChapadosBlog/~4/93YD_R3nV5I" height="1" width="1"/&gt;</content>  <feedburner:origLink>http://chapados.org/2007/1/16/building-a-compiler-for-the-infrant-readynas</feedburner:origLink></entry>
  <entry xml:base="http://chapados.org/">
    <author>
      <name>brian</name>
    </author>
    <id>tag:chapados.org,2006-11-23:14</id>
    <published>2006-11-23T08:12:00Z</published>
    <updated>2007-05-10T18:50:11Z</updated>
    <category term="hacks" />
    <link href="http://feedproxy.google.com/~r/ChapadosBlog/~3/VvIkchZZj6Q/infrant-readynas-shell-access" rel="alternate" type="text/html" />
    <title>Infrant ReadyNAS shell access</title>
<content type="html">
            &lt;p&gt;The &lt;a href='http://www.infrant.com'&gt;Infrant&lt;/a&gt; &lt;a href='http://www.infrant.com/products/products_details.php?name=ReadyNAS%20NV'&gt;ReadyNAS NV&lt;/a&gt; is a great backup server or media server. However, the one critical missing feature that will make any power-user break into a cold sweat is ssh shell/root access. My initial reaction was: Huh!? I&#x2019;m buying this box to store my precious data and you won&#x2019;t even tell me the root password or give me shell access? Dubious. I&#x2019;m sure that this has driven away many potential customers. To be fair, Infrant has &lt;a href='http://www.infrant.com/forum/viewtopic.php?t=3366'&gt;promised&lt;/a&gt; to add this feature in late 2006, but it&#x2019;s almost December and it hasn&#x2019;t happened yet.&lt;/p&gt;

&lt;p&gt;As it turns out, gaining root ssh access is trivial, you just need:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Logs from your ReadyNAS&lt;/li&gt;
&lt;li&gt;Computer with a free internal SATA port&lt;/li&gt;
&lt;li&gt;Knowledge of linux&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;Don&#x2019;t try this at home kids&lt;/h4&gt;

&lt;p&gt;This article is &lt;em&gt;not&lt;/em&gt; a step-by-step, copy-and-paste walk-through guide. If you are not comfortable working at a root prompt and have no clue about how linux is configured, then this article will not help you. My intended audience is knowledgeable users who want shell access, but have live data on their ReadyNAS boxes and can&#x2019;t afford to poke around and screw up their backups.&lt;/p&gt;

&lt;h3&gt;The system partition&lt;/h3&gt;

&lt;p&gt;The first thing I did after unpacking the ReadyNAS (no drives installed) was to plug it, connect it directly to my laptop and turn it on. My reasoning was that if the OS runs from a flash memory card, then the system should be accessible even without any disks. This is not the case. Instead, as I had hoped, the ReadyNAS creates a system partition on one of the drives. This means that the problem is essentially the same as that one time when your friend forgot the root password to her linux box and you had to help her &#x201c;break in&#x201d;.&lt;/p&gt;

&lt;h4&gt;Reconnaissance&lt;/h4&gt;

&lt;p&gt;If the ReadyNAS creates a system partition on a drive, where does that partition live? I&#x2019;ll give you a hint: Download the logs through frontview and look at them. The file called &#x201c;partition.log&#x201d; is a good place to start.&lt;/p&gt;

&lt;p&gt;If the ReadyNAS could be booted from a CD and had a monitor and a keyboard, you would just need a linux boot CD and and you&#x2019;ve have access.  It&#x2019;s not quite that easy, but the drives are very easy to remove. You&#x2019;ll just need to plug the drive with the system partition into another computer running linux. If you don&#x2019;t have a linux installed on the system with a SATA controller, try one of the live CDs from Ubuntu or Gentoo. These will even nicely with a PowerMac G5.&lt;/p&gt;

&lt;p&gt;Now that you&#x2019;ve determined where the system partition lives, shutdown your ReadyNAS and remove the drive with the system partition. Plug it in to a computer with an internal SATA controller. Turn on the computer. &lt;/p&gt;

&lt;h3&gt;Break in (through the unlocked front door)&lt;/h3&gt;

&lt;p&gt;While you were looking at the log files, you probably noticed that the system partition type is ext3, which is not surprising, since the ReadyNAS runs GNU linux. Mount the partition as ext3. That&#x2019;s it. You can now modify/create/delete files. However, the engineers at Infrant are clever. Enabling shell access is not as simple as modifying /etc/passwd and putting the drive back in your ReadyNAS.&lt;/p&gt;

&lt;h3&gt;Don&#x2019;t steal the marked bills&lt;/h3&gt;

&lt;h4&gt;.enc files&lt;/h4&gt;

&lt;p&gt;While you&#x2019;re poking around in /etc, you&#x2019;ll notice some files with &#x201c;.enc&#x201d; extensions. These are encrypted versions of the corresponding files without the extensions. The ReadyNAS updates the .enc files after you make changes to the system through frontview. The catch is that when you boot the ReadyNAS, it apparently compares each normal file with the encrypted version. If they are different, then the encrypted version is used to regenerate the normal file. This means that you won&#x2019;t be able to modify files that are managed by this mechanism. Trust me, I already tried it. For those following along at home, this rules out:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;/etc/passwd&lt;/li&gt;
&lt;li&gt;/etc/exports&lt;/li&gt;
&lt;li&gt;/etc/sudoers&lt;/li&gt;
&lt;li&gt;/etc/inittab&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I&#x2019;m sure we can all dream up a few ways to get around this &#x201c;security&#x201d; system. I used the method outlined below.&lt;/p&gt;

&lt;h4&gt;/root&lt;/h4&gt;

&lt;p&gt;Anything you add to /root appears to get removed when you put the disk back in the ReadyNAS and reboot the system.&lt;/p&gt;

&lt;h3&gt;Set a trap&lt;/h3&gt;

&lt;p&gt;Since the usual targets get reset when you boot the ReadyNAS, one route of attack is to plant a trojan horse that will modify these files after the ReadyNAS boot up. Fortunately, /etc/crontab is not controlled
by the security encryption, which makes setting the trap trivial.&lt;/p&gt;

&lt;p&gt;Write a shell script to add a user with uid = 0 if the user doesn&#x2019;t already exist. Add a line to /etc/crontab that executes this script as root every minute or so.&lt;/p&gt;

&lt;h3&gt;Spring the trap&lt;/h3&gt;

&lt;p&gt;Once you&#x2019;re happy with your changes, unmount the partition, shutdown your computer, and transfer the drive back into the ReadyNAS. Turn it on and wait for it to boot up. Wait a few minutes for the cron job to execute, then login as your new root user. You&#x2019;ll probably want to change the configuration settings so that you can login as a normal user and enable root access via sudo.&lt;/p&gt;

&lt;h3&gt;Cool&#x2026; now what?&lt;/h3&gt;

&lt;p&gt;Well, now you can modify any file you want, install your favorite software, and configure everything exactly the way you want. Slow down. Before you get too excited, let&#x2019;s think about this for a minute:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The Infrant processor runs @ ~250 MHz. You&#x2019;re probably not going to want to run your database-backed app off of the ReadyNAS. It can barely handle ssh file transfers without maxing out the CPU.&lt;/li&gt;
&lt;li&gt;The OS is a minimal version of Debian Linux. It does not have a working build environment.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Come back and look for the next article, which will cover building a sparc-linux cross-compiler with &lt;a href='http://www.kegel.com/crosstool/'&gt;crosstool&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;UPDATE&lt;/h4&gt;

&lt;p&gt;If you arrived at this page from a search engine and you&#x2019;re looking for an easier way to enable ssh access that doesn&#x2019;t require futzing with hardware, read &lt;a href='http://chapados.org/2007/5/6/readynas-shell-access-redux'&gt;this article&lt;/a&gt;.&lt;/p&gt;
          &lt;img src="http://feeds.feedburner.com/~r/ChapadosBlog/~4/VvIkchZZj6Q" height="1" width="1"/&gt;</content>  <feedburner:origLink>http://chapados.org/2006/11/23/infrant-readynas-shell-access</feedburner:origLink></entry>
  <entry xml:base="http://chapados.org/">
    <author>
      <name>brian</name>
    </author>
    <id>tag:chapados.org,2006-11-23:16</id>
    <published>2006-11-23T07:37:00Z</published>
    <updated>2006-11-23T18:22:21Z</updated>
    <category term="hacks" />
    <link href="http://feedproxy.google.com/~r/ChapadosBlog/~3/h02A0wZ95Ws/infrant-readynas-hacks" rel="alternate" type="text/html" />
    <title>Infrant ReadyNAS hacks</title>
<content type="html">
            &lt;p&gt;The &lt;a href='http://www.infrant.com'&gt;Infrant&lt;/a&gt; &lt;a href='http://www.infrant.com/products/products_details.php?name=ReadyNAS%20NV'&gt;ReadyNAS NV&lt;/a&gt; is an extremely capable network attached storage (NAS) device that packs some serious power into a tiny box. If you&#x2019;re in the market for a RAID storage device or perhaps even a home media server, give it a look. You&#x2019;ll probably be impressed.&lt;/p&gt;

&lt;p&gt;The ReadyNAS supports up to 4 drives in RAID 0,1,5 or Infrant&#x2019;s proprietary &lt;a href='http://www.infrant.com/products/tech.php'&gt;X-RAID&lt;/a&gt; configuration. The X-RAID technology allows you to add drives as you go and the machine automagically configures the RAID to give you redundant storage.&lt;/p&gt;

&lt;p&gt;The ReadyNAS uses a proprietary SPARC-based CPU/motherboard, optimized for RAID in a small package. The &lt;a href='http://www.infrant.com/products/products_details.php?name=RAIDiator'&gt;Raidiator&lt;/a&gt; OS is a slightly customized version of Debian GNU/Linux. So, when you buy a ReadyNAS NV, you are actually buying a tiny box optimized for life as a home RAID storage server.&lt;/p&gt;

&lt;p&gt;Despite the impressive features, I had second thoughts, because the readynas doesn&#x2019;t provide ssh shell/root access.  It also doesn&#x2019;t support &lt;a href='http://www.nongnu.org/rdiff-backup/'&gt;rdiff-backup&lt;/a&gt;, &lt;a href='http://www.rsnapshot.org/'&gt;rsnapshot&lt;/a&gt;, or even a version of rsync that plays nicely with Mac OS X (see &lt;a href='http://www.lartmaker.nl/rsync/'&gt;this site&lt;/a&gt;). Shame on Infrant for thinking that power users will want to use their pre-packaged backup solution. In the end, my need for a small-footprint RAID solution for my music library and online backups won out. I bought a disk-less ReadyNAS from &lt;a href='http://www.eaegis.com'&gt;eAegis&lt;/a&gt; and one 500 GB Seagate Barracuda ES drive from &lt;a href='http://www.newegg.com'&gt;newegg&lt;/a&gt;. I plan on adding a second drive soon, but in the meantime&#x2026;&lt;/p&gt;

&lt;p&gt;Since I was already storing data on a stack of external hard drives, there was no immediate rush to transfer all my data to the ReadyNAS immediately. Thus, I had some time to &#x201c;play&#x201d; with it before using it as my production backup system. The result is a series of hacks for the Infrant ReadyNAS that I&#x2019;ve put together in my spare time over the past couple months.&lt;/p&gt;

&lt;h3&gt;Outline&lt;/h3&gt;

&lt;p&gt;In the next few articles, I hope to cover:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;The first article covers gaining &lt;a href='http://chapados.org/2006/11/23/infrant-readynas-shell-access'&gt;root ssh shell access&lt;/a&gt;. Go read it now.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Building a cross-compiler for the ReadyNAS using &lt;a href='http://www.kegel.com/crosstool/'&gt;crosstool&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This process is straightforward using &lt;a href='http://www.kegel.com/crosstool/'&gt;crosstool&lt;/a&gt; and building on x86 linux.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Compiling a &lt;a href='http://www.lartmaker.nl/rsync/'&gt;modified version of rsync&lt;/a&gt; that properly stores meta-data from HFS+ filesystems.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Installing Python and the necessary requirements to run &lt;a href='http://www.nongnu.org/rdiff-backup/'&gt;rdiff-backup&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The ReadyNAS runs Debian Linux, and dpkg is installed.  You can download sparc packages and install them. To compile the [latest] rdiff-backup versions required for use with Mac OS X, you&#x2019;ll need the cross-compiler. This all works really nicely, except that it&#x2019;s really slow.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For those of you that were [asking], Perl is already installed, so [rsnapshot] shouldn&#x2019;t be a problem, although I haven&#x2019;t tried it yet.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;
          &lt;img src="http://feeds.feedburner.com/~r/ChapadosBlog/~4/h02A0wZ95Ws" height="1" width="1"/&gt;</content>  <feedburner:origLink>http://chapados.org/2006/11/23/infrant-readynas-hacks</feedburner:origLink></entry>
  <entry xml:base="http://chapados.org/">
    <author>
      <name>brian</name>
    </author>
    <id>tag:chapados.org,2006-10-22:13</id>
    <published>2006-10-22T04:15:00Z</published>
    <updated>2006-10-22T17:34:18Z</updated>
    <link href="http://feedproxy.google.com/~r/ChapadosBlog/~3/OYFW1fxLthw/journal-access-at-home" rel="alternate" type="text/html" />
    <title>Work at home with your SOCKS on</title>
<content type="html">
            &lt;p&gt;Most scientific articles are published in journals that are not freely accessible to the general public.
If you&#x2019;re in academic science, biotech or big pharma, your respective institutions pay the big bucks to the publishers so that you can access journal content over the internet. 
However, what about when you want to look something up at home, or access one of these resources from off site/campus? &lt;a href='http://computer.howstuffworks.com/vpn.htm'&gt;VPN&lt;/a&gt; seems to be the typical solution these days, but I honestly think that it&#x2019;s overkill. Why should you run your entire networking stack through VPN, when you really only want to access a few pages through your browser? The solution: &lt;a href='http://www.freeproxy.ru/en/free_proxy/faq/what_is_socks_proxy.htm'&gt;SOCKS&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Publishers usually only allow access to computers within a certain IP range, which includes the computers located at your institution. Therefore, in order to read journal articles at home, we need the publisher&#x2019;s website to think that we&#x2019;re accessing their site from a computer at work. All we need in order to pull this off is a program that can implement the SOCKS protocol. SOCKS is a proxy protocol that relays information from a source computer through the proxy to  another computer. It effectively allows your computer at home to interact with the internet through your computer at work.&lt;/p&gt;

&lt;p&gt;Unless you&#x2019;re using Windows, you already have the necessary tool installed on your system: ssh.  If you&#x2019;re using Windows, download and install a copy of &lt;a href='http://www.chiark.greenend.org.uk/~sgtatham/putty/'&gt;PuTTY&lt;/a&gt;. If you want something closer to *nix, download and install &lt;a href='http://www.cygwin.com/'&gt;Cygwin&lt;/a&gt;. Both of these are free, and IMHO, are essential software on any windows box.&lt;/p&gt;

&lt;h2&gt;Put your SOCKS on&lt;/h2&gt;

&lt;p&gt;ssh is one of those extremely versatile programs with so many different features that it&#x2019;s hard to remember all of them off the top of your head.&lt;/p&gt;

&lt;p&gt;To use it as a SOCKS proxy, open a terminal and type to following at the prompt (denoted by $&gt;):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$&amp;gt;ssh -ND 8080 username@host.with.access.com
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If you&#x2019;re on windows using PuTTY, select Start -&gt; Run, then type:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;plink -ssh -ND 8080 username@host.with.access.com
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In both of these commands, the -N option prevents ssh from executing a command on the remote system, which lets you use this on systems where you can&#x2019;t access a shell, but can still authenticate via ssh.
The -D 8080 tells ssh to act as a SOCKS proxy server, listening on port 8080. You can use a different port if you want.&lt;/p&gt;

&lt;p&gt;In your browser, go to the preferences, and find the proxy settings. Scroll down the list and enable the SOCKS server with these settings:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;SOCKS server settings
host: localhost
port: 8080
protocol: SOCKS v5
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Here are specific directions for commonly used browsers:&lt;/p&gt;

&lt;h3&gt;Firefox&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Open Firefox -&gt; Preferences.&lt;/li&gt;
&lt;li&gt;Under the &#x201c;General&#x201d; tab, click the &#x201c;Connection settings&#x2026;&#x201d; button. This will bring up the proxy configuration dialog.&lt;/li&gt;
&lt;li&gt;Click the &#x201c;Manual Proxy Configuration&#x201d; radio button.&lt;/li&gt;
&lt;li&gt;Fill in the values for the SOCKS configuration as listed above.&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;Get the &lt;a href='https://addons.mozilla.org/firefox/125/'&gt;Proxyswitcher&lt;/a&gt; Plug-in&lt;/h4&gt;

&lt;p&gt;This is an extremely useful tool that lets you switch between different proxy settings by clicking a button in your toolbar. I use it all the time when I need to access a journal article from home.&lt;/p&gt;

&lt;h3&gt;Safari&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Open Safari -&gt; Preferences.&lt;/li&gt;
&lt;li&gt;Under the &#x201c;Advanced&#x201d; tab, click the &#x201c;Proxies: Change Settings&#x201d; button. This actually opens the Apple System preferences pane to the proxy settings for the current network setting. Alternatively, you can access these settings, through the System Preferences: Open System Preferences, select &#x201c;Network&#x201d;, and click on the &#x201c;Proxies&#x201d; tab.&lt;/li&gt;
&lt;li&gt;Select the option to &#x201c;Configure Proxies Manually&#x201d;.&lt;/li&gt;
&lt;li&gt;Select the &#x201c;SOCKS&#x201d; proxy.&lt;/li&gt;
&lt;li&gt;Fill in the settings as described above.  Don&#x2019;t worry about the protocol, it will automically select SOCKS v5.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;Internet Explorer&lt;/h3&gt;

&lt;p&gt;Sorry, I try to avoid using Windows, and when I do, I use Firefox. If somebody knows what to do, please post instructions and I will update this post.  Otherwise, I will update this section next time I&#x2019;m near a Windows box.&lt;/p&gt;

&lt;h2&gt;Cleanup&lt;/h2&gt;

&lt;p&gt;When you&#x2019;re done, kill the ssh session by pressing Ctrl+C, and reset your browser&#x2019;s proxy settings to directly connect to the internet.&lt;/p&gt;

&lt;h2&gt;Before I forget&#x2026;&lt;/h2&gt;

&lt;p&gt;In case it&#x2019;s not obvious, in order for this to work, you need an account with login access to a machine at your institution. If you&#x2019;re a *nix user, you probably already have an account and know what to do with it. If you&#x2019;re not sure, think about how you get your email. Do you have a shell account that lets you login to that computer? Yes? Great, use it. Still not sure, contact a systems administrator and ask about getting a shell account on one of the unix terminal servers or file servers. If they refuse, see if you can have access to an account with guest access. Any account that can authenticate via ssh will work (remember the -N option). Strictly speaking, you &lt;em&gt;do not&lt;/em&gt; need shell access.&lt;/p&gt;

&lt;h2&gt;Fun things to do in your SOCKS&lt;/h2&gt;

&lt;p&gt;Obviously, accessing journal articles from remote locations is only one of several uses for this technique. SOCKS is useful whenever you need to access a service as if you were on a different computer. Utilities such as &lt;a href='http://proxychains.sourceforge.net/'&gt;ProxyChains&lt;/a&gt; and &lt;a href='http://tsocks.sourceforge.net/'&gt;tsocks&lt;/a&gt; allow you to wrap any network-based utility via a SOCKS proxy. Using SOCKS in this manner turns out to be a convenient way to acheive anonymity on the web. If this interests you, trying searching for &lt;a href='http://www.onion-router.net/'&gt;Onion routers&lt;/a&gt;. After that, get back to work. Isn&#x2019;t there some article you should be reading?&lt;/p&gt;
          &lt;img src="http://feeds.feedburner.com/~r/ChapadosBlog/~4/OYFW1fxLthw" height="1" width="1"/&gt;</content>  <feedburner:origLink>http://chapados.org/2006/10/22/journal-access-at-home</feedburner:origLink></entry>
  <entry xml:base="http://chapados.org/">
    <author>
      <name>brian</name>
    </author>
    <id>tag:chapados.org,2006-10-18:12</id>
    <published>2006-10-18T04:45:00Z</published>
    <updated>2006-10-20T00:03:47Z</updated>
    <category term="meta" />
    <link href="http://feedproxy.google.com/~r/ChapadosBlog/~3/LGqerzH1Oe0/upgrade-complete" rel="alternate" type="text/html" />
    <title>Upgrade Complete</title>
<content type="html">
            &lt;p&gt;I just finished &lt;a href='/2006/9/21/life-with-mephisto'&gt;migrating my site&lt;/a&gt; to &lt;a href='http://mephistoblog.com/'&gt;mephisto&lt;/a&gt;. There might be a few rough spots left to smooth out, but all of the old content that people were actually viewing should available at the &lt;em&gt;same urls&lt;/em&gt;, although some things have new homes that should be reflected in the links. If you find a problem please let me know. I&#x2019;m using a slightly modified version of &lt;a href='http://quotedprintable.com/pages/scribbish'&gt;scribbish&lt;/a&gt;, which is one of my favorite basic themes. I had actually ported scribbish for use with Mephisto on my own, but &lt;a href='http://delynnberry.com/'&gt;DeLynn Berry&lt;/a&gt; released &lt;a href='http://delynnberry.com/2006/10/18/porting-scribbish'&gt;his port&lt;/a&gt; yesterday! We used remarkably similar approaches, but since his version encompasses sribbish trunk, I used his version and &#x201c;back-ported&#x201d; my changes.  Thanks DeLynn!&lt;/p&gt;

&lt;p&gt;My motivation for doing this was to make it easier for me to write content, so the plan from here on out is to add some new articles and information that I have laying around in various unfinished states.&lt;/p&gt;
          &lt;img src="http://feeds.feedburner.com/~r/ChapadosBlog/~4/LGqerzH1Oe0" height="1" width="1"/&gt;</content>  <feedburner:origLink>http://chapados.org/2006/10/18/upgrade-complete</feedburner:origLink></entry>
  <entry xml:base="http://chapados.org/">
    <author>
      <name>brian</name>
    </author>
    <id>tag:chapados.org,2006-09-21:8</id>
    <published>2006-09-21T06:08:00Z</published>
    <updated>2006-10-19T21:18:33Z</updated>
    <category term="meta" />
    <link href="http://feedproxy.google.com/~r/ChapadosBlog/~3/Q05m2G8gJGY/life-with-mephisto" rel="alternate" type="text/html" />
    <title>Life with Mephisto</title>
<content type="html">
            &lt;p&gt;No, I&#x2019;m not talking about the &lt;a href='http://en.wikipedia.org/wiki/Mephisto'&gt;demon&lt;/a&gt;. I&#x2019;m not living in hell, yet. I&#x2019;m talking about the hot, new &lt;a href='http://mephistoblog.com'&gt;blogging cms app&lt;/a&gt; that all the &lt;a href='http://mephisto.stikipad.com/help/show/Blogs+and+Sites+running+Mephisto'&gt;cool kids&lt;/a&gt; are using. I&#x2019;ve finally upgraded this site to use some modern technology. If you&#x2019;re one of the ~100 people who has actually viewed this page in the past couple months, then congratulations, you&#x2019;re seeing something new! For the rest of you, trust me, it&#x2019;s better now.&lt;/p&gt;

&lt;p&gt;For those of you who don&#x2019;t know, mephisto is a &lt;a href='http://rubyonrails.com/'&gt;ruby-on-rails&lt;/a&gt; app. Here&#x2019;s where I stand as far as the hybrid blog+website setup is concerned:&lt;/p&gt;

&lt;p&gt;I&#x2019;m running the trunk version of &lt;a href='http://mephistoblog.com'&gt;mephisto&lt;/a&gt;, which is upgraded practically everyday - go &lt;a href='http://weblog.techno-weenie.net/'&gt;techno-weenie&lt;/a&gt;! To keep up with the changes, I&#x2019;m using &lt;a href='http://svk.elixus.org/'&gt;SVK&lt;/a&gt; and &lt;a href='http://subversion.tigris.org/'&gt;subversion&lt;/a&gt; as described by &lt;a href='http://octopod.info/2006/8/19/managing-multiple-local-mephisto-repos-with-svk'&gt;octopod&lt;/a&gt;. Pages are served up with &lt;a href='http://mongrel.rubyforge.org/'&gt;mongrel&lt;/a&gt; and &lt;a href='http://httpd.apache.org/'&gt;apache&lt;/a&gt; on a linux vserver. I even setup a one-step deployment procedure using &lt;a href='http://manuals.rubyonrails.com/read/book/17'&gt;capistrano&lt;/a&gt; to move changes from my classic &lt;a href='http://en.wikipedia.org/wiki/PowerBook_G4#Titanium_PowerBook_G4'&gt;Powerbook G4 Titanium&lt;/a&gt; to the vserver.  What&#x2019;s that? I&#x2019;ve spilled some kool-aid on my shirt? Thanks, I didn&#x2019;t even notice.&lt;/p&gt;

&lt;p&gt;Overall, I&#x2019;m happy with mephisto for now.  I get the following wrapped up in a nice package with a bow:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;write text in &lt;a href='http://daringfireball.net/projects/markdown/'&gt;markdown&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;do basic version control&lt;/li&gt;
&lt;li&gt;easily manage non-blog areas of the site&lt;/li&gt;
&lt;li&gt;manage files/images using the assets system&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For those interested, in the past I&#x2019;ve also evaluated &lt;a href='http://radiantcms.org'&gt;radiant&lt;/a&gt;, &lt;a href='http://smallwiki.unibe.ch/smallwiki/pier/'&gt;pier&lt;/a&gt;, and also &lt;a href='http://media.wu-wien.ac.at/download/xowiki-doc/'&gt;xowiki&lt;/a&gt; from &lt;a href='http://openacs.org'&gt;openacs&lt;/a&gt;, but ultimately chose mephisto.  Here&#x2019;s a brief summary:&lt;/p&gt;

&lt;p&gt;Radiant seemed like a great option at first, and it powers the &lt;a href='http://www.ruby-lang.org'&gt;Ruby site&lt;/a&gt;, so it is clearly capable.
However, after some basic testing, reading the mailing list archives, and checking out the &#x201c;plugin&#x201d; system, I got the impression that despite the slogan, radiant has not clearly defined what it&#x2019;s trying to be. I guess the core of radiant is fairly simple, but it&#x2019;s missing enough features that I wanted (comments, asset management, and basic version control) that I decided to pass for now.&lt;/p&gt;

&lt;p&gt;I&#x2019;m blown away by Pier, and I can envision using it at some point. At this point, I decided against it because it doesn&#x2019;t support markdown, and the object database persistancy mechanism is still being developed. Still, I think the concept of storing pages as objects is much cleaner than markup text in a database, and will ultimately be more flexible. Also, Pier is written in &lt;a href='http://www.seaside.st'&gt;Seaside&lt;/a&gt;, so you can integrate it into an existing Seaside app or embed a Seaside app into Pier. Try doing that with rails. Unfortunately, as stupid as this might sound, one of the things I don&#x2019;t like about using pier for a CMS app is the external URLs. Since seaside is a continuation-based framework, the URLs store the continuation key. This looks ugly and also breaks the cache/history feature of your browser that denotes which links have already been visited. These are minor concerns for Applications that run in a browser. However, in my opinion , this situation is not ideal for a content-heavy site.&lt;/p&gt;

&lt;p&gt;&lt;a href='http://openacs.org'&gt;OpenACS&lt;/a&gt; is the first web development framework that I ever used. 
I never used it for a public site, but I was inspired by &lt;a href='http://phillip.greenspun.com'&gt;Phil Greenspun&lt;/a&gt;&#x2019;s &lt;a href='http://philip.greenspun.com/panda/'&gt;book&lt;/a&gt; and &lt;a href='http://philip.greenspun.com/teaching/psets/'&gt;problem sets&lt;/a&gt;. I also followed the success and demise of &lt;a href='http://www.eveandersson.com/arsdigita/'&gt;Arsdigita&lt;/a&gt; while I was in grad school. As far as I can tell, (Open)ACS was the original &#x201c;opinionated&#x201d; web framework: &#x201c;use AOLserver+Tcl and Oracle/Postgres and make the db do your heavy lifting, because &lt;a href='http://philip.greenspun.com/sql/'&gt;SQL is easy&lt;/a&gt;.&#x201d;  Despite the fact that there are several out-dated packages, the core of OpenACS still has some well-designed pieces. The &lt;a href='http://media.wu-wien.ac.at/download/xowiki-doc/'&gt;xowiki&lt;/a&gt; package is very cool, but it&#x2019;s just not as easy to setup, maintain or use as the other two options.&lt;/p&gt;

&lt;p&gt;With Mephisto, you know where you stand.
Mephisto is a blogging app first, and can also handle simple pages with comments.
For the most part it does what you expect it to do, and it doesn&#x2019;t try to be all things to all people. I give it a thumbs up.&lt;/p&gt;
          &lt;img src="http://feeds.feedburner.com/~r/ChapadosBlog/~4/Q05m2G8gJGY" height="1" width="1"/&gt;</content>  <feedburner:origLink>http://chapados.org/2006/9/21/life-with-mephisto</feedburner:origLink></entry>
  <entry xml:base="http://chapados.org/">
    <author>
      <name>brian</name>
    </author>
    <id>tag:chapados.org,2006-05-25:1</id>
    <published>2006-05-25T20:55:00Z</published>
    <updated>2006-12-09T18:31:11Z</updated>
    <category term="tutorials" />
    <link href="http://feedproxy.google.com/~r/ChapadosBlog/~3/gi3T3d5pA4E/pier-design-tutorial" rel="alternate" type="text/html" />
    <title>Pier Design Tutorial</title>
<content type="html">
            &lt;h2&gt;Introduction&lt;/h2&gt;

&lt;p&gt;&lt;a href='http://www.lukas-renggli.ch'&gt;Lukas Renggli&lt;/a&gt; has created an amazing content management system called
&lt;a href='http://smallwiki.unibe.ch/smallwiki/pier/'&gt;Pier&lt;/a&gt;. It's still in the alpha phase, but the functionality and flexibility
make it a truly innovative content management solution. If you've played with
wiki software in rails or php, try &lt;a href='http://smallwiki.unibe.ch/smallwiki/pier/'&gt;Pier&lt;/a&gt; and &lt;a href='http://www.seaside.st'&gt;Seaside&lt;/a&gt; and prepare to
experience enlightenment. Currently, the default
Pier installation does not take full advantage of the capabilities of CSS. This
document describes how to build a simple theme/template for a Pier wiki starting
from an existing css framework.&lt;/p&gt;

&lt;h2&gt;Disclaimer&lt;/h2&gt;

&lt;p&gt;I'm new to &lt;a href='http://www.squeak.org'&gt;Squeak&lt;/a&gt;/Smalltalk, &lt;a href='http://www.seaside.st'&gt;Seaside&lt;/a&gt; and &lt;a href='http://smallwiki.unibe.ch/smallwiki/pier/'&gt;Pier&lt;/a&gt;.  I've learned
quite a bit over the past few months, but I'm still a newbie. As a result,
my approach might not represent the
"best practices" way of customizing Pier.  My hope is that in writing this
document, people that know more than me will read it and give me some useful
feedback.&lt;/p&gt;

&lt;h2&gt;Pier layout structure&lt;/h2&gt;

&lt;p&gt;Before we dive in and start writing or editing css code, let's take a look at
the style handles that Pier provides by default and how to change them.&lt;/p&gt;

&lt;h3&gt;A brief introduction to CSS&lt;/h3&gt;

&lt;p&gt;Cascading StyleSheets (CSS) provide an abstraction layer for specifying the
appearance of an HTML document. It's beyond the scope of this document to
explain the intricacies of css.  Instead, you should check out:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href='http://www.alistapart.com'&gt;A-list-apart&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href='http://www.meyerweb.com'&gt;Eric Meyer's site&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href='http://www.simplebits.com'&gt;Simplebits&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;and of course, &lt;a href='http://www.google.com'&gt;google&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you collect computer books for a hobby, you should buy
&lt;a href='http://www.amazon.com/o/ASIN/0321346939'&gt;Bulletproof Web Design&lt;/a&gt; by &lt;a href='http://www.simplebits.com'&gt;Dan Cederholm&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;What you need to know about CSS&lt;/h4&gt;

&lt;p&gt;For now, suffice it to say that CSS allow you to specify the appearance of any
HTML tag.  They also provide "class" and "id" elements that are used to create
a hierarchy of style commands. As a general rule of thumb, use an "id" when
there is only one occurrence of the object per page. Use a "class" when there
are one or more occurrences per page.&lt;/p&gt;

&lt;p&gt;Given this general rule, you can get a very good idea of where to start
customizing the layout of a page/site by looking through the HTML source for
&lt;code&gt;&amp;lt;div id="..."&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;div class="..."&amp;gt;&lt;/code&gt; tags.&lt;/p&gt;

&lt;h3&gt;Pier layout&lt;/h3&gt;

&lt;p&gt;Pier uses the &lt;a href='http://www.seaside.st'&gt;Seaside&lt;/a&gt; web framework. Compared to other web frameworks,
Seaside is a &lt;a href='http://conferences.oreillynet.com/cs/os2006/view/e_sess/8942'&gt;web heretic&lt;/a&gt; that breaks several conventional rules.
For example, most designers are probably used to working with templates
containing a mixture of HTML and framework-specific code. Seaside applications
use an API to generate HTML. There are no templates. That's right, no
templates. This means that as a designer, you only need to worry about the stylesheets.
This section provides an overview of the default HTML structure provided by
Pier, and how to customize it.&lt;/p&gt;

&lt;h4&gt;General outline of a page&lt;/h4&gt;

&lt;p&gt;Pier currently uses classes under the #frameContent id to control the style of
different page elements. In css code, '#' is the prefix for ids, and '.' is
the prefix for classes.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#frameContent
    .frame
    .header
    .box .views
    .box .commands
    .box .tree
    .content
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In Seaside and Pier, the "pages" that are rendered in your browser are made
up of several components. In Pier, the main layout components are embedded in a
special page component called the 'environment'. It's normally hidden, but you can
access it by typing it in the location bar of you browser. In the default case
(above), the environment contains header, box-&gt;view, box-&gt;command, box-&gt;tree
and content components. The view, command and tree components are actually
subclasses of the box component, so they inherit the default css settings from
that class.&lt;/p&gt;

&lt;h4&gt;Changing the css parameters of a Pier component&lt;/h4&gt;

&lt;p&gt;You can easily change the default values. For example, let's say you would rather
specify the header using an id (#header) instead of a class (.header)&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;navigate to environment/header&lt;/li&gt;
&lt;li&gt;click on the 'settings' link under commands&lt;/li&gt;
&lt;li&gt;add the text "header" to &lt;strong&gt;CSS Name&lt;/strong&gt;. Note that the &lt;strong&gt;CSS Name&lt;/strong&gt;
field controls the &lt;code&gt;&amp;lt;div id&amp;gt;&lt;/code&gt; name.&lt;/li&gt;
&lt;li&gt;delete the text for &lt;strong&gt;CSS Class&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;click the 'save' button&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;Where do the default values come from&lt;/h4&gt;

&lt;p&gt;Pier components are subclasses of PRWidget. Continuing our previous example,
here is the class heirarchy for PRHeaderWidget:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ProtoObject
  Object
    WAPresenter
      WAComponent
        MAComponent
          PRWidget
            PRBoxWidget
              PRListWidget
                PRCommandsWidget
                  PRHeaderWidget
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and the class methods for PRHeaderWidget:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;PRHeaderWidget class
  defaultCommandClasses
  defaultCssClass
    ^ 'header'
  defaultTitle
    label
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Notice that defaultCssClass returns the string "header".  You can change the default value
by changing this string. I'll leave it as an exercise for you to explore the
rest in detail. (Hint: defaultCssName appears as a class method of PRBoxWidget.)&lt;/p&gt;

&lt;h2&gt;Don't work too hard: Get a template&lt;/h2&gt;

&lt;p&gt;Unless you're a seasoned web designer, there's a good chance that you probably
won't create an ideal css template from scratch on the first try. Like the
scaffolds created by generators in &lt;a href='http://www.rubyonrails.com'&gt;Ruby on Rails&lt;/a&gt;, having a good outline
for your css files will get you started down the right path, and help you
avoid mistakes. Furthermore, you can avoid several cross-browser css compatibility
issues by finding a good starting framework.&lt;/p&gt;

&lt;h3&gt;Look for design contests&lt;/h3&gt;

&lt;p&gt;Design contests are a great source for CSS templates. The quality varies, but
it's usually high.  Many of the designers are trying to make a name for
themselves, so their entries are probably worth hundreds to thousands of dollars
in development time.  Think of  design competition sites as a repository for
high-quality, open-source css. However, be sure to double-check that you are legally
using a theme/design, and give the author credit!&lt;/p&gt;

&lt;p&gt;Here are a few design contest sites to get you started:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href='http://www.typogarden.org'&gt;Typogarden&lt;/a&gt;: themes for &lt;a href='http://www.typosphere.org'&gt;Typo&lt;/a&gt;, a &lt;a href='http://www.rubyonrails.com'&gt;Ruby on Rails&lt;/a&gt;-based blogging app.&lt;/li&gt;
&lt;li&gt;&lt;a href='http://textplates.com'&gt;Textplates&lt;/a&gt;: themes for &lt;a href='http://textplates.com'&gt;Textdrive&lt;/a&gt;, a php-based CMS.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Find a template&lt;/h3&gt;

&lt;p&gt;One of my favorite design-theme/frameworks is &lt;a href='http://www.quotedprintable.com/pages/scribbish'&gt;Scribbish&lt;/a&gt;, a css framework and typo
theme designed by Jeffrey Allan Hardy at &lt;a href='http://www.quotedprintable.com'&gt;Quoted-Printable&lt;/a&gt;. Scribbish
has a simple, yet elegant appearance, which is mirrored in the css
framework. There are separate stylesheets that control different components of
the page, making this theme easy to understand and modify to fit Pier, or any site.
Before continuing, go read about the &lt;a href='http://www.quotedprintable.com/articles/read/19'&gt;css framework&lt;/a&gt; used by scribbish,
I'll wait.&lt;/p&gt;

&lt;p&gt;Sounds good, right? Download the &lt;a href='http://www.quotedprintable.com/files/scribbish-1.2.tar.gz'&gt;latest version&lt;/a&gt;
of &lt;a href='http://www.quotedprintable.com/pages/scribbish'&gt;Scribbish&lt;/a&gt;, expand the tar file and take a look at the source code.&lt;/p&gt;

&lt;h3&gt;Modify scribbish for use with Pier&lt;/h3&gt;

&lt;p&gt;Before we tell Pier about the new css files, we need to change a few things so
that scribbish works correctly outside of its native Typo environment.&lt;/p&gt;

&lt;h4&gt;Use relative paths&lt;/h4&gt;

&lt;p&gt;All references to 'url's in all the stylesheets are hard-coded to work with
&lt;a href='http://www.typosphere.org'&gt;Typo&lt;/a&gt;.  For example, in scribbish/stylesheets/application.css,
the body tag looks like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;body {
    background: url(/images/theme/background.gif) repeat-x left top;
    font: normal 12px "lucida grande", verdana, arial, helvetica, sans-serif;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;You could hard code a new url, but for now I recommend just using a relative url:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;background: url(../images/background.gif) repeat-x left top;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Find all the references to absolute paths change them to relative paths.&lt;/p&gt;

&lt;h4&gt;Deal with tables and textareas&lt;/h4&gt;

&lt;p&gt;Pier still uses tables in a few places. Whenever you edit a page, the form
generated by Magritte uses tables.  I haven't figured out how to change this
yet.  For now, we'll work around it.&lt;/p&gt;

&lt;p&gt;Unless the table width is set to 100%, the width of your textareas will be
constrained by the table width, rather than the width of the 'content' div.
To ensure that your forms use the full allowable width, and have reasonable
height, add the following code to the bottom of content.css:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#content textarea {
    width: 100%;
    height: 300px;
}

#content table.container {
    width: 100%;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Configure Comanche to serve files&lt;/h2&gt;

&lt;p&gt;If you look closely at your default Pier installation, you'll notice that you
are using css stylesheets from &lt;a href='http://www.lukas-renggli.ch/smalltalk/pier/style/84/style.css'&gt;here&lt;/a&gt;. We want to use our own custom
stylesheets. There are multiple ways of accomplishing this goal.  You can put
the stylesheets at any web-accessible URL and reference them.  If you running
Pier behind a proxy front-end, then you can just put them somewhere in your
root directory and refer to them.  If you know how to setup Seaside Style
Libraries (I haven't tried this yet) then you can just do that. The solution I chose was to
configure Comanche to serve files.  This allows me to keep the stylesheets
outside of my Squeak image. Right now I find this easy since I'm used to working
this way.&lt;/p&gt;

&lt;h3&gt;The default configuration&lt;/h3&gt;

&lt;p&gt;If you followed the instructions for &lt;a href='http://smallwiki.unibe.ch/smallwiki/pier/installationofpier/'&gt;installing Pier&lt;/a&gt; posted on
the &lt;a href='http://smallwiki.unibe.ch/smallwiki/pier/'&gt;Smallwiki site&lt;/a&gt; or the instructions for
&lt;a href='http://www.seaside.st/Download/'&gt;installing Seaside&lt;/a&gt; from the &lt;a href='http://www.seaside.st'&gt;Seaside&lt;/a&gt; home page,
then Comanche is not configured to serve static files.&lt;/p&gt;

&lt;h3&gt;The new configuration&lt;/h3&gt;

&lt;p&gt;Fortunately, all of the necessary changes are summarized nicely in the
&lt;a href='http://www.shaffer-consulting.com/david/Seaside/GettingSoftware/index.html'&gt;Getting Software&lt;/a&gt; section of David Shaffer's
&lt;a href='http://www.shaffer-consulting.com/david/Seaside/'&gt;Seaside tutorial&lt;/a&gt;. For completeness, I'm posting the exact
same code here, but all credit goes to &lt;a href='http://www.shaffer-consulting.com/'&gt;David Shaffer&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Rather than starting Comanche like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;WAEncodedKom startOn: 8080.
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Kill any existing server instances with this command:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;"Kill all existing Kom HTTP servers"
HttpService allInstancesDo: [:each | each stop. each unregister].
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And then start Comanche with these options:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;"Start a new server on port 8080 servering both static content and seaside apps"
| ma seaside |
seaside := WAKom default.
ma := ModuleAssembly core.
ma serverRoot: (FileDirectory default directoryNamed: 'FileRoot') fullName.
ma alias: '/seaside' to: [ma addPlug: [:request | seaside process: request]].
ma documentRoot: (FileDirectory default directoryNamed: 'FileRoot') fullName.
ma directoryIndex: 'index.html index.htm'.
ma serveFiles.
(HttpService startOn: 8080 named: 'httpd') plug: ma rootModule
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Note that the directory 'FileRoot' can be called anything you want.  You'll
need to put that directory in the same folder as your Squeak image file.&lt;/p&gt;

&lt;h2&gt;Customize your Pier environment&lt;/h2&gt;

&lt;p&gt;Although I recommend more changes to the css stylesheets, those minor edits are
the only changes that you have to make. To use the new stylesheets, we need to
give Pier the path to 'application.css', and modify the environment to
reflect the scribbish layout structure.&lt;/p&gt;

&lt;h3&gt;Use the new stylesheets&lt;/h3&gt;

&lt;p&gt;To make Pier use the new stylesheets, just change PRStyleLibrary&gt;&gt;style as follows:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;PRPierLibrary&amp;gt;&amp;gt;style
    ^ '@import "/scribbish/stylesheets/application.css";'
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Note that if you started Comanche prior to adding scribbish 
underneath the 'FileRoot' directory, you might have to restart Comanche before
the stylesheets will be recognized.&lt;/p&gt;

&lt;h3&gt;Edit the environment&lt;/h3&gt;

&lt;p&gt;With the new stylesheets in place, the pages will look strange because the Pier
layout structure does not match the css design. To fix this, you need to edit
the environment. Access it by typing it in the navigation bar of your browser,
or clicking &lt;a href='http://localhost:8080/seaside/pier/environment'&gt;here&lt;/a&gt;, if you're following this tutorial.&lt;/p&gt;

&lt;h4&gt;A new environment&lt;/h4&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div id="container"&amp;gt;
+header++views++path+
&amp;lt;div id="page"&amp;gt;
&amp;lt;div id="content"&amp;gt;+main+&amp;lt;/div&amp;gt;
&amp;lt;div id="sidebar"&amp;gt;+search++tree++commands+&amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;div id="footer"&amp;gt;Pier &amp;amp;mdash; Empowered by Seaside&amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;h5&gt;Set the default environment&lt;/h5&gt;

&lt;p&gt;The default environment is returned by the method
PRStructure&gt;defaultEnvironment. To add new default components, just add
children to the the environment Page (a PRPage instance). To change the
environment contents, change the string for the 'contents:' parameter. Here
is an example of a new default environment that adds a path component
under the header, and a search component in the sidebar.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;PRStructure&amp;gt;environmentStructure
    ^ (PRPage named: 'environment')
            addDecoration: PRHider new;
            addChild: ((PRComponent named: 'header')
                    componentClass: PRHeaderWidget;
                    yourself);
            addChild: ((PRComponent named: 'path')
                    componentClass: PRPathWidget;
                    yourself);
            addChild: ((PRComponent named: 'views')
                    componentClass: PRViewsWidget;
                    yourself);
            addChild: ((PRComponent named: 'search')
                    componentClass: PRSearchWidget;
                    yourself);
            addChild: ((PRComponent named: 'commands')
                    componentClass: PRCommandsWidget;
                    yourself);
            addChild: ((PRComponent named: 'tree')
                    componentClass: PRTreeWidget;
                    yourself);
            addChild: ((PRComponent named: 'main')
                    componentClass: PRContentsWidget;
                    yourself);
            contents: '&amp;lt;div id="container"&amp;gt;+header++path++views+&amp;lt;div id="page"&amp;gt;&amp;lt;div id="content"&amp;gt;+main+&amp;lt;/div&amp;gt;&amp;lt;div id="sidebar"&amp;gt;+search++tree++commands+&amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;&amp;lt;div id="footer"&amp;gt;Pier &amp;amp;mdash; Empowered by Seaside&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;';
            yourself
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This new environment will be used whenever you create a new kernel. To reset
your kernel (this will destroy all data):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;"Reset Pier Kernel"
PRKernel reset. PRPierFrame initialize.
&lt;/code&gt;&lt;/pre&gt;

&lt;h4&gt;Customize components&lt;/h4&gt;

&lt;p&gt;The new environment defines some new components, and uses familiar components
(i.e. views) in a new way. In this scenario, the header, path and view components
are intended to be laid out horizontally across the top of the page, before
the "page" and "sidebar" content. In my customized &lt;a href='http://www.quotedprintable.com/pages/scribbish'&gt;scribbish&lt;/a&gt; layout, 
each component has a corresponding #id or .class
to provide complete control over the style. The default component settings
in Pier use classes, so you'll either have to change the component
'settings' after adding the component, change the code to set
new defaults, or change your stylesheet to fit the Pier defaults. For example,
the default path widget has a title that gets in the way when the path is
displayed as an inline list. You might also want to hide the icons by default.
The Pier UI components that you add to each page are subclasses of PRWidget.
Thus, to change the default settings of the path component,
add class methods to PRPathWidget.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;PRPathWidget&amp;gt;defaultTitle
        ^ nil

PRPathWidget&amp;gt;defaultShowIcons
    ^ false

PRPathWidget&amp;gt;defaultCssName
    ^ 'path'
&lt;/code&gt;&lt;/pre&gt;

&lt;h4&gt;Custom Header component&lt;/h4&gt;

&lt;p&gt;The default Pier header uses tables.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;PRHeaderWidget&amp;gt;renderWidgetOn: html
html table
    class: 'header';
        with: [
            self renderLogoOn: html.
            self renderSpacerOn: html.
            self renderTitleOn: html ]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Let's change the header to look like a simple blog or wiki: get rid of the
table, and add a subtitle.  On the instance side, add methods to get, set and
render the subtitle.  Then modify renderWidget on to render both the title and
subtitle.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;renderWidgetOn: html
    self renderTitleOn: html.
    self renderSubtitleOn: html

renderSubtitleOn: html
    html heading level: 2; with: (self expand: self subtitle).

subtitle
    ^ self propertyAt: #subtitle ifAbsent: [ self class defaultSubtitle ]

subtitle: aString
    self propertyAt: #subtitle put: aString
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;On the class side, add a method for the description and the default subtitle
(a new string).&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;defaultSubtitle
    ^ String new

descriptionSubtitle
    ^ MAStringDescription selector: #subtitle label: 'subtitle' priority: 120 default: self     defaultSubtitle
&lt;/code&gt;&lt;/pre&gt;

&lt;h4&gt;CSS class controls for inline lists&lt;/h4&gt;

&lt;p&gt;Inline lists are a versatile design technique that allow the use
of lists to control horizontal layout (see &lt;a href='http://www.alistapart.com/articles/taminglists/'&gt;CSS Design: Taming Lists&lt;/a&gt;).
With this techinque, lists can be used to create menu bars and context bars.
To control the style of inline lists, it is
often convenient to designate the first and/or last item of the list using a
class. This allows these items to be styled differently than items in the
middle of list, providing a convenient mechanism for creating a path string
separated by slashes, or a menu bar separated by lines.&lt;/p&gt;

&lt;p&gt;Although we could make these properties configurable, simply hard-coding them
to always be "first" and "last" should work for 99% of all cases.
To add this capability, modify PRListWidget&gt;renderItems.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;renderItems: aCollection on: html
    html unorderedList with: [
        aCollection do: [ :each |
            html listItem 
                class: (aCollection first = each ifTrue: [ 'first' ]);
                class: (aCollection last = each ifTrue: [ 'last' ]);
                class: (self selected = each ifTrue: [ 'active' ]);
                with: [ self renderItem: each on: html ] ] ]
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Add a context bar&lt;/h3&gt;

&lt;p&gt;Now that we can uniquely render the first and last items of a list, it's easy
to add a context bar.  Just add a path component to the environment. Under the
settings for environment/path, add a custom &lt;strong&gt;CSS name&lt;/strong&gt;. Then, use css to
render the path as an inline list, adding a '»' (&lt;code&gt;&amp;amp;#187;&lt;/code&gt;) or '/' character before
each item except the first. To add this change into the scribbish framework,
we'll add #path to the layout, and create a new component.css file to handle
the the style settings for #path and other Pier components.&lt;/p&gt;

&lt;p&gt;Since path is a floating element, we need to make sure that all of the floats
are cleared before rendering the page content, by adding 'clear: both;' to
the top of the #page style.&lt;/p&gt;

&lt;p&gt;Make changes to layout.css&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#path {
    padding: 0px;
    margin-bottom: 0px;
    float: left;
}

#page {
    clear: both;
    /* ... page settings here ... */
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;create component.css (based on code from *CSS Design: &lt;a href='http://www.alistapart.com/articles/taminglists/'&gt;Taming Lists&lt;/a&gt;)&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#path {
    /* additional custom path styles here */
}

#path ul {
    margin-left: 0;
    padding-left: 0;
    display: inline;
    border: none;
}

#path ul li {
    margin-left: 0;
    padding-left: 2px;
    border: none;
    list-style: none;
    display: inline;
}

#path ul li.first {
    margin-left: 0;
    padding-left: 0px;
    border: none;
    list-style: none;
    display: inline;
}

#path ul li:before {
    content: "\0020 \0020 \0020 \00BB \0020";
}

#path ul li.first:before {
    content: "";
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Add a reference to component.css in application.css
just above the 'local.css' reference, so that component
styles override any default settings. &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;@import 'component.css';
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;P is for paragraphs&lt;/h2&gt;

&lt;p&gt;Lukas recently changed the way paragraphs are rendered in Pier from using &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt;
tags to &lt;code&gt;&amp;lt;div class="paragraph"&amp;gt;&lt;/code&gt;. This change first appeared in
Pier-lr.83. The monticello comments say something about the &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; element causing
problems with nested pages.  Unfortunately, the change to
&lt;code&gt;&amp;lt;div class="paragraph"&amp;gt;&lt;/code&gt; completely breaks the scribbish theme.&lt;br /&gt;
Currently, I'm using &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; elements with one level of nesting and I haven't
noticed any problems.&lt;/p&gt;

&lt;p&gt;To use normal &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; elements, change PRViewRenderer&gt;visitParagraph to&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;visitParagraph: anObject
    html paragraph with:  [ super visitParagraph: anObject ]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Please note that it might be possible to fix this problem by using specifying
properties for &lt;code&gt;&amp;lt;div class="paragraph"&amp;gt;&lt;/code&gt; that will make it behave like &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt;.  If
anyone knows how to do this, please let me know.&lt;/p&gt;

&lt;h2&gt;Get the code&lt;/h2&gt;

&lt;p&gt;I haven't covered every Pier and css modification in detail. Rather, I tried
to provide example cases that highlight the types of changes you can make
to add some style to Pier. To provide a finished example, you can download
my version of a default Pier installation (Pier-all-lr.87) styled along with
my modified version of scribbish (version 1.2).&lt;/p&gt;

&lt;h3&gt;Files&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href='/download/pier-design-tutorial.tar.gz'&gt;Pier Design Tutorial image+changes&lt;/a&gt;&lt;br /&gt;
Squeak (3.8) .image and .changes files loaded with Seaside 2.6a3, Pier-All-lr.87 plus all
the necessary dependencies.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href='/download/pier-scribbish-1.2.tar.gz'&gt;pier-scribbish-1.2&lt;/a&gt;&lt;br /&gt;
Scribbish 1.2 distribution containing changes described in this tutorial and
a few other modifications for Pier.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
          &lt;img src="http://feeds.feedburner.com/~r/ChapadosBlog/~4/gi3T3d5pA4E" height="1" width="1"/&gt;</content>  <feedburner:origLink>http://chapados.org/2006/5/25/pier-design-tutorial</feedburner:origLink></entry>
</feed>
