<?xml version="1.0"?>
<!-- name="generator" content="blosxom/2.0.2" -->
<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd">

<rss version="0.91">
  <channel>
    <title>peteg's blog   2007-12-06-HOPE-Unicode.autumn</title>
    <link>http://peteg.org/blog</link>
    <description></description>
    <language>en</language>

  <item>
    <title>&lt;a href=&quot;http://haskell.org/&quot;&gt;Haskell&lt;/a&gt; &lt;a href=&quot;http://wiki.fckeditor.net/Developer%27s_Guide/Participating/Server_Side_Integration&quot;&gt;server-side integration&lt;/a&gt; for &lt;a href=&quot;http://www.fckeditor.net/&quot;&gt;FCKeditor&lt;/a&gt;.</title>
    <link>http://peteg.org/blog/2007/12/10#2007-12-10-FCKeditor</link>
    <category>/AYAD/Project</category>
    <description>
&lt;p&gt;

I am not a &lt;a href=&quot;http://en.wikipedia.org/wiki/JavaScript&quot;&gt;JavaScript&lt;/a&gt; hacker, so I have no clear idea how best to
use &lt;a href=&quot;http://www.fckeditor.net/&quot;&gt;FCKeditor&lt;/a&gt;. My embryonic &lt;a href=&quot;http://haskell.org/&quot;&gt;Haskell&lt;/a&gt; library just spits out
either a &lt;code&gt;textarea&lt;/code&gt; or some &lt;a href=&quot;http://en.wikipedia.org/wiki/JavaScript&quot;&gt;JavaScript&lt;/a&gt; that creates an
&lt;a href=&quot;http://www.fckeditor.net/&quot;&gt;FCKeditor&lt;/a&gt; instance depending on how &lt;code&gt;HTTP_USER_AGENT&lt;/code&gt;
is set, though I can imagine someone wanting to do something fancier
[*]. The &lt;code&gt;POST&lt;/code&gt;ed data is validated against &lt;a href=&quot;http://www.w3.org/1999/xhtml&quot;&gt;XHTML&lt;/a&gt; 1.0
Strict using &lt;a href=&quot;http://www.cs.york.ac.uk/fp/HaXml/&quot;&gt;HaXml&lt;/a&gt;, which seems to work well for the most part;
for some reason &lt;a href=&quot;http://www.fckeditor.net/&quot;&gt;FCKeditor&lt;/a&gt; uses the non-standard
&lt;code&gt;&amp;lt;embed&amp;gt;&lt;/code&gt; tag for &lt;a href=&quot;http://www.macromedia.com/&quot;&gt;Flash&lt;/a&gt; content, and I can't find
a convincing reason why [**].

&lt;/p&gt;&lt;p&gt;

In the not-to-distant future I will implement the connector stuff, and
&lt;a href=&quot;http://www.haskell.org/cabal/&quot;&gt;Cabal&lt;/a&gt;ise it.

&lt;/p&gt;&lt;p&gt;

[*] Apparently I still need to crank out an
&lt;code&gt;&amp;lt;iframe&amp;gt;&lt;/code&gt; to satisfy &lt;a href=&quot;http://www.microsoft.com/windows/ie/default.mspx&quot;&gt;Internet Explorer&lt;/a&gt;, so we can
either revert to &lt;a href=&quot;http://www.w3.org/1999/xhtml&quot;&gt;XHTML&lt;/a&gt; 1.0 Transitional or generate some
non-standard &lt;a href=&quot;http://www.w3.org/1999/xhtml&quot;&gt;XHTML&lt;/a&gt; just for &lt;a href=&quot;http://www.microsoft.com/windows/ie/default.mspx&quot;&gt;Internet Explorer&lt;/a&gt;. It's a tough
call.

&lt;/p&gt;&lt;p&gt;

[**] It seems that recent versions of &lt;a href=&quot;http://www.microsoft.com/windows/ie/default.mspx&quot;&gt;Internet Explorer&lt;/a&gt; (6 and 7),
&lt;a href=&quot;http://www.mozilla.org/&quot;&gt;Mozilla&lt;/a&gt;-based browsers (&lt;a href=&quot;http://caminobrowser.org/&quot;&gt;Camino&lt;/a&gt;, &lt;a href=&quot;http://www.mozilla.org/products/firefox/&quot;&gt;FireFox&lt;/a&gt;) and &lt;a href=&quot;http://www.apple.com/safari/&quot;&gt;Safari&lt;/a&gt; 3
are all happy with the &lt;code&gt;&amp;lt;object&amp;gt;&lt;/code&gt; tag. &lt;a href=&quot;http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_4150&quot;&gt;Adobe&lt;/a&gt; has
a &lt;a
href=&quot;http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_4150&quot;&gt;&quot;knowledge
base&quot; article&lt;/a&gt; full of non-reasons to use the
&lt;code&gt;&amp;lt;embed&amp;gt;&lt;/code&gt; tag. The great thing about web standards is
we're all empiricists now...

&lt;/p&gt;</description>
  </item>
  <item>
    <title>Lest I forget, &lt;a href=&quot;http://haskell.org/&quot;&gt;Haskell&lt;/a&gt; and &lt;a href=&quot;http://unicode.org/&quot;&gt;Unicode&lt;/a&gt;.</title>
    <link>http://peteg.org/blog/2007/12/06#2007-12-06-HOPE-Unicode</link>
    <category>/AYAD/Project</category>
    <description>
&lt;p&gt;

One reason I ran away from all of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Content_management_system&quot;&gt;CMS&lt;/a&gt; systems implemented in
&lt;a href=&quot;http://www.php.net/&quot;&gt;PHP&lt;/a&gt; is its (historically) crappy support for &lt;a href=&quot;http://unicode.org/&quot;&gt;Unicode&lt;/a&gt; [*]. Standard
&lt;a href=&quot;http://haskell.org/&quot;&gt;Haskell&lt;/a&gt;, on the other hand, has required the &lt;code&gt;Char&lt;/code&gt;
type to be able to represent a &lt;a href=&quot;http://unicode.org/&quot;&gt;Unicode&lt;/a&gt; codepoint for quite a while
now. Unfortunately there are a few libraries that are not &lt;a href=&quot;http://unicode.org/&quot;&gt;Unicode&lt;/a&gt;
friendly, such as just about every library interfacing with &lt;a href=&quot;http://www.lysator.liu.se/c/&quot;&gt;C&lt;/a&gt;.

&lt;/p&gt;&lt;p&gt;

Concretely:

&lt;/p&gt;
&lt;ul&gt;

&lt;li&gt;&lt;a href=&quot;http://darcs.haskell.org/HSQL/&quot;&gt;HSQL&lt;/a&gt; needed some work to get it to talk &lt;a href=&quot;http://en.wikipedia.org/wiki/UTF-8&quot;&gt;UTF-8&lt;/a&gt; to &lt;a href=&quot;http://www.postgresql.org/&quot;&gt;PostgreSQL&lt;/a&gt;.&lt;/li&gt;

&lt;li&gt;Most but not all of the CGI library is &lt;a href=&quot;http://unicode.org/&quot;&gt;Unicode&lt;/a&gt; friendly. I
don't know enough about the various &lt;a href=&quot;http://www.ietf.org/rfc.html&quot;&gt;RFC&lt;/a&gt;s to know what's encoded as
what, so I don't know how to do this right. For example, how are &lt;a href=&quot;http://unicode.org/&quot;&gt;Unicode&lt;/a&gt; filenames handled?&lt;/li&gt;

&lt;li&gt;The regexp libs are a bit of a minefield (the user-interface is
quite complex, and those &lt;a href=&quot;http://www.lysator.liu.se/c/&quot;&gt;C&lt;/a&gt; libraries are unknown quantities), so I
have avoided using them.&lt;/li&gt;

&lt;li&gt;&lt;a href=&quot;http://hope.bringert.net/&quot;&gt;HOPE&lt;/a&gt; itself is almost entirely encoding-agnostic, apart from
the top-level (where it builds a &lt;a href=&quot;http://hoohoo.ncsa.uiuc.edu/cgi/&quot;&gt;CGI&lt;/a&gt; header for the webserver's
consumption), and &lt;a href=&quot;http://haskelldb.sourceforge.net/&quot;&gt;HaskellDB&lt;/a&gt; just punts around the strings fairly
blindly, doing a minimal amount of escaping. Good job, &lt;a href=&quot;http://www.dtek.chalmers.se/~d00bring/&quot;&gt;Bj&amp;ouml;rn&lt;/a&gt;.&lt;/li&gt;

&lt;/ul&gt;
&lt;p&gt;

I really, really wish &lt;a href=&quot;http://haskell.org/&quot;&gt;Haskell&lt;/a&gt; had a decent story about character
encoding at the I/O level. Back in 2002 &lt;a
href=&quot;http://www.haskell.org/pipermail/haskell-i18n/&quot;&gt;people seemed to
get really excited about doing something about it&lt;/a&gt;, but that
mailing list is dead now. I guess the hope is that once
&lt;code&gt;ByteString&lt;/code&gt;s and all that are bedded down, the I/O layer
can be rebuilt on efficient foundations, fusion will take care of
performance issues with codec layers and so forth.

&lt;/p&gt;&lt;p&gt;

&lt;em&gt;Update:&lt;/em&gt; ConradP has &lt;a
href=&quot;http://blog.kfish.org/2007/10/survey-haskell-unicode-support.html&quot;&gt;surveyed
some Haskell character munging libraries&lt;/a&gt;.

&lt;/p&gt;&lt;p&gt;

[*] &lt;a href=&quot;http://www.perl.org/&quot;&gt;perl&lt;/a&gt; has good &lt;a href=&quot;http://unicode.org/&quot;&gt;Unicode&lt;/a&gt; support, if one is happy to play the
guessing game as to what format each string is in. I feel that strong
typing &amp;mdash; clearly separating characters from strings of bytes
&amp;mdash; is just what is needed here.

&lt;/p&gt;</description>
  </item>
  <item>
    <title>Halfway through the project, I begin to talk about the project.</title>
    <link>http://peteg.org/blog/2007/11/27#2007-11-27-HOPE</link>
    <category>/AYAD/Project</category>
    <description>
&lt;p&gt;

So the game here is to build a &lt;a href=&quot;http://en.wikipedia.org/wiki/Content_management_system&quot;&gt;CMS&lt;/a&gt;-style website for &lt;a href=&quot;http://drdvietnam.com/&quot;&gt;DRD&lt;/a&gt;, who
are presently using an unmaintainable &lt;a href=&quot;http://www.asp.net/&quot;&gt;ASP&lt;/a&gt; mess. (Heh, I think
that's the &lt;em&gt;old&lt;/em&gt; ASP, not ASP.NET, but what would I know.) I
decided to renovate &lt;a href=&quot;http://www.dtek.chalmers.se/~d00bring/&quot;&gt;Bj&amp;ouml;rn&lt;/a&gt;'s &lt;a href=&quot;http://haskell.org/&quot;&gt;Haskell&lt;/a&gt; effort, &lt;a href=&quot;http://hope.bringert.net/&quot;&gt;HOPE&lt;/a&gt;, which
looked, superficially at least, pretty hackable.

&lt;/p&gt;
&lt;p&gt;

Activity for these past few months:

&lt;/p&gt;
&lt;ul&gt;

&lt;li&gt;I tried to fix the concurrency issues. There was/is [*] a lot of
confusing code that looks like it might be safe, but wasn't. It might
have worked if the DBMS provides coarse enough concurrency, and
traffic is sufficiently light. (I don't claim to have fixed everything
yet, and there are limits to what we can do.)&lt;/li&gt;

&lt;li&gt;As part of the above I hacked the daylights out of &lt;a href=&quot;http://haskelldb.sourceforge.net/&quot;&gt;HaskellDB&lt;/a&gt;
and &lt;a href=&quot;http://darcs.haskell.org/HSQL/&quot;&gt;HSQL&lt;/a&gt;, but only conforming their &lt;a href=&quot;http://www.postgresql.org/&quot;&gt;PostgreSQL&lt;/a&gt; backends with
my higher-level changes [**]. Specifically I tried to extend their
notions of a relational database to encompass constraints [***], and
add support for the &lt;code&gt;serial&lt;/code&gt; datatype.

 &lt;ul&gt;

  &lt;li&gt;&lt;a href=&quot;http://darcs.haskell.org/HSQL/&quot;&gt;HSQL&lt;/a&gt; seems adequate as a low-level &lt;a href=&quot;http://en.wikipedia.org/wiki/SQL&quot;&gt;SQL&lt;/a&gt; interface, at
  least as far as these things go in &lt;a href=&quot;http://haskell.org/&quot;&gt;Haskell&lt;/a&gt; [***], so I don't
  know why anyone would reinvent that wheel (ask them).&lt;/li&gt;

  &lt;li&gt;I would strongly recommend against trying to use &lt;a href=&quot;http://haskelldb.sourceforge.net/&quot;&gt;HaskellDB&lt;/a&gt;,
  despite the heroic efforts of &lt;a href=&quot;http://www.dtek.chalmers.se/~d00bring/&quot;&gt;Bj&amp;ouml;rn&lt;/a&gt; et al. It's nice in theory
  but quite limited and very complex in practice. If I were to do this
  project over, I would drop &lt;a href=&quot;http://hope.bringert.net/&quot;&gt;HOPE&lt;/a&gt;'s dependency on &lt;a href=&quot;http://haskelldb.sourceforge.net/&quot;&gt;HaskellDB&lt;/a&gt;.&lt;/li&gt;

  &lt;li&gt;I am now painfully aware of the semantic gap between &lt;a href=&quot;http://haskell.org/&quot;&gt;Haskell&lt;/a&gt;
  and &lt;a href=&quot;http://en.wikipedia.org/wiki/SQL&quot;&gt;SQL&lt;/a&gt; databases. What we really want is serialisation and
  querying of &lt;a href=&quot;http://en.wikipedia.org/wiki/Algebraic_data_type&quot;&gt;algebraic data types&lt;/a&gt;, that is, something closer to &lt;a href=&quot;http://www.w3.org/XML/&quot;&gt;XML&lt;/a&gt;
  technology. The only group I know that is taking persistence
  seriously at the typed, higher-order, etc. programming language
  level is the mob working on &lt;a href=&quot;http://www.ps.uni-sb.de/alice/&quot;&gt;Alice/ML&lt;/a&gt;, and if I had a spare life
  I'd marry that with &lt;a href=&quot;http://www.cis.upenn.edu/~bcpierce/&quot;&gt;Benjamin C. Pierce&lt;/a&gt;'s work of the past ten years or so
  and develop a mergeable, distributed, queryable storage manager for
  a decent language.&lt;/li&gt;

 &lt;/ul&gt;
&lt;/li&gt;

&lt;li&gt;Added a lot of &lt;a href=&quot;http://en.wikipedia.org/wiki/Internationalization_and_localization&quot;&gt;I18N&lt;/a&gt; support. This is as-yet incomplete, of
course, and I'm not very happy with how I've done the dynamic part of
it. One major outstanding issue is how best to support multi-lingual
tagging.&lt;/li&gt;

&lt;li&gt;Shifted away from &lt;a href=&quot;http://www.dtek.chalmers.se/~d00bring/&quot;&gt;Bj&amp;ouml;rn&lt;/a&gt;'s home-brew and somewhat buggy
&lt;code&gt;hmarkup&lt;/code&gt; to the &lt;a href=&quot;http://www.microsoft.com/&quot;&gt;Windows&lt;/a&gt;-user friendly &lt;a href=&quot;http://www.fckeditor.net/&quot;&gt;FCKeditor&lt;/a&gt;. I
have my qualms about this, but I've got to consider my user-base.&lt;/li&gt;

&lt;/ul&gt;
&lt;p&gt;

Some of the abstractions in &lt;a href=&quot;http://hope.bringert.net/&quot;&gt;HOPE&lt;/a&gt; are fantastic, and others are
head-scratching, tantalisingly close to being so. If I have the time
and enough brain capacity, I'd really like to re-do the notion of
resource so we can (for example) generate &lt;a href=&quot;http://www.sitemaps.org/&quot;&gt;site maps&lt;/a&gt; and have fewer
URL paths scattered through the code. So, good effort &lt;a href=&quot;http://www.dtek.chalmers.se/~d00bring/&quot;&gt;Bj&amp;ouml;rn&lt;/a&gt;.

&lt;/p&gt;
&lt;p&gt;

If you're interested in any of this, you can take a look at the &lt;a href=&quot;http://darcs.net/&quot;&gt;darcs&lt;/a&gt; repos at &lt;a
href=&quot;http://peteg.org/haskell/&quot;&gt;http://peteg.org/haskell&lt;/a&gt;. Please
note that everything there should be considered alpha quality and
under chaotic development.

&lt;/p&gt;
&lt;p&gt;

[*] My changes are so pervasive that it's better to think of my
version as a fork rather than a continuation. The database schema is
quite different and currently requires &lt;a href=&quot;http://www.postgresql.org/&quot;&gt;PostgreSQL&lt;/a&gt;, so I doubt it
is useful to any current users.

&lt;/p&gt;
&lt;p&gt;

[**] This has some nasty ramifications. One is that it is unlikely
that my code will be merged into the mainstream &lt;a href=&quot;http://darcs.net/&quot;&gt;darcs&lt;/a&gt; repos, as I
have no interest in or time to fix the other backends. (I refuse to
encourage anyone to use speed-over-correctness software like MySQL.)
Due to this, I doubt one can use the shiny-new &lt;a href=&quot;http://hackage.haskell.org/trac/hackage/wiki/CabalInstall&quot;&gt;cabal-install&lt;/a&gt; to
suck down the myriad dependencies of my version of &lt;a href=&quot;http://hope.bringert.net/&quot;&gt;HOPE&lt;/a&gt;, as you'll
need some stuff from my repos, and other stuff may as well come from
the official places.

&lt;/p&gt;
&lt;p&gt;

[***] Somewhat ironic to me is that all the low-level &lt;a href=&quot;http://haskell.org/&quot;&gt;Haskell&lt;/a&gt; &lt;a href=&quot;http://en.wikipedia.org/wiki/SQL&quot;&gt;SQL&lt;/a&gt; bridges I've seen have a very limited view of what a relational
database is; usually the bridge just ships &lt;a href=&quot;http://en.wikipedia.org/wiki/SQL&quot;&gt;SQL&lt;/a&gt; one way and gets a
list of rows back, and provides a very basic table description
mechanism. I haven't seen any support for defaults, triggers,
constraints (foreign keys, primary keys, uniqueness, etc.), and while
there is usually support for transactions, it is difficult to figure
out what that means as the bridges all try to be
backend-agnostic. Conversely there are a lot of attempts at making
rows and queries type-safe.

&lt;/p&gt;</description>
  </item>
  </channel>
</rss>
