Blog on Plone in 2 minutes

Have you ever watched screencasts of Ruby on Rails to create a weblog site in 15 minutes and TurboGears to create a wiki site in 20 minutes? If you haven’t, give them a try. This is not a language war. I just want to explain my principle of how to develop a web site effectively. First of all, I will summarize the result of comparison of those two movies.

  • Weblog is a web that you can create new page, edit existing pages, delete pages, and list pages via browser.
  • Wiki is a web that you can create new page, edit existing pages, delete pages, and list pages via browser.
  • In term of complexity, wiki is a little bit more complicated than weblog because wiki engine has to parse WikiWord.

In other words, TurboGears take another 5 minutes to generate HTML code from given Wiki code. The rest of wiki seems to be very similar to weblog. Anyway, these 2 frameworks are focusing on creating a web application from scratch. My point is "scratch".

Ok. Now you should watch another short moviesCOREBlog2 don’t claim to develop a blog site in 2 minutes. You have to watch it yourself. This is what it should be in real world.

  • You want a weblog.
  • You have an application server.
  • You deploy a weblog package.
  • It rocks!

That’s it! This is the point. 2 minutes are enough to finish deployment. I don’t care how long it take to develop an application, e.g., weblog or wiki. It should be installed in or uninstalled from my site instantly. Not everyone are programmers. Fast development doesn’t mean the application runs fast.

So the most important part of production level web application is the application server. It must provide necessary APIs to develop applications. Each application must be redistributable. And administrator can deploy new application with a few click. I don’t think it’s a good idea to have only one programmer to maintain the whole web site. I’m talking about production web site.

The last screencast, I mentioned about give the whole idea why you need application server. The application server in this screencast is Plone running on Zope. There is COREBlog for running on Zope directly if you wish. Actually, Plone is a powerful content management system so it also provides authentication, authorization, and many more.

Lastly, this concept is also called Reusable component. Do you still want to create a site from scratch again?

Technorati Tags: , , , , , , , , ,

shortest wiki

If you are interesting in wiki and imagine that it is so difficult to implement in 20 minutes, take a look at Shortest Wiki Contest. See below for some samples in various languages. Perl in 4 lines #!/usr/bin/perl use CGI':all';path_info=~/\w+/;$_=`grep -l $& *`.h1($&).escapeHTML$t=param(2) ||`dd<$&`;open F,">$&";print F$t;s/htt\S+|([A-Z]\w+){2,}/a{href,$&},$&/eg;s/ /br/eg;print header,"$_
",submit,textarea 2,$t,9,70 Python in 11 lines #!/usr/bin/python import re,os,cgi;d,h=os.listdir('.'),'?',h+'g=%s>%s')[m.group(0) in d]%((m.group(0),)*2)),('^{{$','
    '),('^# ','
  • '),('^}}$','
'),('(ht\ tp:[^<>"\s]+)',h[:-3]+r'\1>\1'),('\n\n','

')),s);o,g=lambda y:(y in d and cgi.escape(open(y).read()))or'',(g or p and[open(p[0].strip('./'),'w').write(s[ 0])or p[0]]or[0])[0];print'Content-Type:text/html\n\n'+(s and', '.join([f(n)for n in d if s[0]in o(n)])or'')+(e and'%s'%(e[0],o(e[0])) or'')+(g and'

%ss=%s>%s,%se=%s>edit

'%(h,g,g,h,g)+f(o(g))or'')
PHP in 15 lines MuWiki';$r=$_REQUEST;$w=($r[0])?$r [0]:"HomePage";$l='ValidxHTML';if($r[2]){$f=fopen("_$w",'w');fwrite($f,$r[2]) ;$r[1]='';}if(!$t=join(file("_$w"),"")or$r[1])die ('
'.$e);foreach(glob("_*")as$g)if(ereg($w,join(file("$g"))))$b.=" $g";echo "

$w

".preg_replace(array("/\n( +.*)\n/","/'''([^']*)'''/","/''([^']*)'" ."'/","/\n{/","/\n@(.*)/","/\n}/","/\n+/","/(http:[^ \n]*)/","/[_']?(([A-Z][a". "-z]+){2,})/","/-{4}/","/'{6}/"),array('
\1
','\1','\1', '
    ','
  • \1
  • ','
','
',$l. '\1">\1'," $l".'?0=\1">\1',"<" ."hr/>","",),$t."
".$b);echo" $l?0=$w&1=1\">ed $w".$e;/* xHTML */?>
Ruby in 20 lines #!/usr/local/bin/ruby require 'cgi';def load(n) File.exist?("w/"+n) ? File.read("w/"+n) : '' end def fs(s) s.gsub!(/\r/,'');s.gsub!(/^---/, "
");s.gsub!(/^\{\{$/, "\n
    ") s.gsub!(/^}}$/, "
");s.gsub!(/^\* /, "
  • ");s.gsub!(/\n\n/, "

    ") s.gsub!(/(^|[^A-Za-z0-9?])(([A-Z][a-z]+){2,})/) {$1+(File.exist?('w/'+$2) ? %{#{$2}}:$2+%[?]+ %[])};s.gsub!(/(ht|f)tp:[^<>"\s]+/){ %{#{$&}}};s end def pg(m,n) {'get'=>%{

    WyRiki:#{n}

    (edit me)

    #{fs(load(n))||n}},'edit'=> %{

    #{fs(n.dup)}

    }+ %{}+ %{
    },'find'=>"

    Links: #{fs(n.dup)}

    "+fs(Dir['w/*'].select{ |fn| File.read(fn).include?(n)}.collect{|s|"\n* "+s[2..-1]}.join)}[m] end def main(f) n=f['p']||ENV['QUERY_STRING'].dup;n=(n=~/^[A-Za-z]+$/)?n:'HomePage' print "Content-type: text/html; charset=utf-8\r\n\r\n#{n}" open("w/"+n,"w"){|io|io.write f['t']} if ENV['REQUEST_METHOD']=='POST' print pg({'e'=>'edit', 'f'=>'find'}[f['q']] || 'get', n) end main Hash[ *CGI.new.params.collect{|k,v| [k,v[0]]}.flatten ] if __FILE__==$0
  • Post new comment

    The content of this field is kept private and will not be shown publicly.