October 8, 2008 by srackham
Currently the Mono project does not release Ubuntu binary packages so I you want the latest version of Mono you need to compile and install yourself. I use the Xubuntu, Here are the steps I took to install Mono 2.0 on Xubuntu 7.10:
- Download mono and libgdiplus tarballs from http://ftp.novell.com/pub/mono/sources-stable/.
$ wget http://ftp.novell.com/pub/mono/sources/mono/mono-2.0.1.tar.bz2
$ wget http://ftp.novell.com/pub/mono/sources/libgdiplus/libgdiplus-2.0.tar.bz2
- Install libglib2 development headers:
$ sudo apt-get install libglib2.0-dev
- Install libfontconfig1 development headers (without this ./configure emits configure: error: Cairo requires at least one font backend):
$ sudo apt-get install libfontconfig1-dev
- Compile and install libgdiplus. libgdiplus is required for Winforms, if you don’t use Winforms you can skip this step and use ./configure --with-libgdiplus=no when you compile Mono.
$ tar -xjf libgdiplus-2.0.tar.bz2
$ cd libgdiplus-2.0
$ ./configure
$ make
$ sudo make install
The libraries were installed in /usr/local/lib.
- Install bison:
$ sudo apt-get install bison
- Compile Mono:
$ tar -xjf mono-2.0.tar.bz2
$ cd mono-2.0
$ ./configure
$ make
$ sudo make install
See also http://www.mono-project.com/Release_Notes_Mono_2.0
If you want to compile or run GUI applications using GTK bindings instead of WinForms you need to download and compile Gtk#:
- First install the following packages to ensure the necessary headers:
$ sudo apt-get install libpango1.0-dev
$ sudo apt-get install libatk1.0-dev
$ sudo apt-get install libgtk2.0-dev
- Download Gtk# source tarball from http://www.mono-project.com/GtkSharp
- Extract, compile and install Gtk#:
$ tar -zxf gtk-sharp-2.12.0.tar.gz
$ cd cd gtk-sharp-2.12.0
$ ./configure
$ make
$ sudo make install
Other dependencies
One last point, the following packages were already installed on my machine: fontconfig, fontconfig-config, libfontconfig1 — not sure if they are ‘libgdiplus‘ compilation dependents but if you have problems these may be what are required. My machine already had a number of development tools and utilities installed, so there may be other dependencies I’ve missed for an “out of the box” Xubuntu install.
Getting Started
You need to tell Mono where to find it’s libraries:
$ export LD_LIBRARY_PATH=/usr/local/lib
See http://www.mono-project.com/DllNotFoundException
Next compile and run the Hello Worlds as described in Mono Basics.
If you have problems turn on debugging by setting MONO_LOG_LEVEL the environment variable. For example:
$ MONO_LOG_LEVEL=debug mono hello.exe
Closing thoughts
I like the idea of WinForms as a way of writing desktop apps that run on both Windows and Linux and I like to use Linux for development, problem at the moment is that there’s no SharpDevelop-like IDE for creating WinForm UIs on Linux (MonoDevelop uses GTK). There is a WinForms Designer that runs under Linux but it’s not a full IDE and currently is more a “proof of concept” thing.
Posted in .Net, C#, Ubuntu | Leave a Comment »
May 22, 2008 by srackham
blogpost 0.9.0 adds lots of new features to the previous 0.1.0 release. The most important feature in the blogpost 0.9.0 release is WordPress media file management:
- Media files (images, videos, audio, document) referenced in your AsciiDoc (or HTML) documents are automatically uploaded and linked to the uploaded blog.
- Only new or modified media files are uploaded (changes detected using cached MD5 checksums).
- Metadata caching means post options are remembered and don’t need to be repeated every time you update your posts.
- WordPress Pages can be posted and updated (blogpost includes a patched wordpresslib.py containing Page methods).
This blog post along with this inline image
and this block image:
Were uploaded by using this blogpost create command:
$ blogpost.py create blogpost_media_processing.txt
uploading: /home/srackham/doc/blogs/smallnew.png...
url: http://srackham.files.wordpress.com/2008/05/smallnew.png
uploading: /home/srackham/doc/blogs/tiger.png...
url: http://srackham.files.wordpress.com/2008/05/tiger1.png
creating published post 'blogpost media processing'...
id: 93
url: http://srackham.wordpress.com/2008/05/22/blogpost-media-processing/
|
The info command lists locally cached information:
$ blogpost.py info blogpost_media_processing.txt
title: blogpost media processing
id: 93
url: http://srackham.wordpress.com/2008/05/22/blogpost-media-processing/
status: published
type: post
doctype: article
created: Thu May 22 17:45:34 2008
updated: Thu May 22 17:45:40 2008
media: http://srackham.files.wordpress.com/2008/05/tiger1.png
media: http://srackham.files.wordpress.com/2008/05/smallnew.png
|
Note how the update command skips uploading the unchanged image files:
$ blogpost.py update blogpost_media_processing.txt
skipping: /home/srackham/doc/blogs/smallnew.png
skipping: /home/srackham/doc/blogs/tiger.png
updating published post 'blogpost media processing'...
id: 93
url: http://srackham.wordpress.com/2008/05/22/blogpost-media-processing/
|
Here’s the AsciiDoc blog file that generated this weblog entry:
blogpost_media_processing.txt
blogpost media processing
=========================
//
// Blog outlining blogpost media processing.
//
'blogpost' 0.9.0 adds lots of new features to the previous 0.1.0
release. The most important feature in the 'blogpost' 0.9.0 release
is WordPress media file management:
- Media files (images, videos, audio, document) referenced in your
AsciiDoc (or HTML) documents are automatically uploaded and linked
to the uploaded blog.
- Only new or modified media files are uploaded (changes detected
using cached MD5 checksums).
- Metadata caching means post options are remembered and don't need to
be repeated every time you update your posts.
- WordPress Pages can be posted and updated (blogpost includes a
patched wordpresslib.py containing Page methods).
This blog post along with this inline image image:smallnew.png[] and
this block image:
image::tiger.png[]
Were uploaded by using this 'blogpost' create command:
---------------------------------------------------------------------
$ blogpost.py create blogpost_media_processing.txt
uploading: /home/srackham/doc/blogs/smallnew.png...
url: http://srackham.files.wordpress.com/2008/05/smallnew.png
uploading: /home/srackham/doc/blogs/tiger.png...
url: http://srackham.files.wordpress.com/2008/05/tiger1.png
creating published post 'blogpost media processing'...
id: 93
url: http://srackham.wordpress.com/2008/05/22/blogpost-media-processing/
---------------------------------------------------------------------
The 'info' command lists locally cached information:
---------------------------------------------------------------------
$ blogpost.py info blogpost_media_processing.txt
title: blogpost media processing
id: 93
url: http://srackham.wordpress.com/2008/05/22/blogpost-media-processing/
status: published
type: post
doctype: article
created: Thu May 22 17:45:34 2008
updated: Thu May 22 17:45:40 2008
media: http://srackham.files.wordpress.com/2008/05/tiger1.png
media: http://srackham.files.wordpress.com/2008/05/smallnew.png
---------------------------------------------------------------------
Note how the update command skips uploading the unchanged image files:
---------------------------------------------------------------------
$ blogpost.py update blogpost_media_processing.txt
skipping: /home/srackham/doc/blogs/smallnew.png
skipping: /home/srackham/doc/blogs/tiger.png
updating published post 'blogpost media processing'...
id: 93
url: http://srackham.wordpress.com/2008/05/22/blogpost-media-processing/
---------------------------------------------------------------------
Here's the http://www.methods.co.nz[AsciiDoc] blog file that generated
this weblog entry:
[subs="attributes"]
.blogpost_media_processing.txt
---------------------------------------------------------------------
include1::blogpost_media_processing.txt[]
---------------------------------------------------------------------
The how's and why's are explained on the
http://srackham.wordpress.com/blogpost1/[blogpost(1) man page].
|
The how’s and why’s are explained on the blogpost(1) man page.
Posted in AsciiDoc, Weblog client, WordPress, blogpost | 2 Comments »
May 15, 2008 by srackham
I make lots of notes using AsciiDoc, the sort of stuff that’s to minor and/or not rigorous enough for formal publication, but possibly useful to others.
So I decided it was about time I started posting my notes to a blog. Creating and maintaining posts using the normal browser based interfaces was not an option — just to tedious for words. So I looked around for an HTML friendly blog host that could make a reasonable job of rendering AsciiDoc generated HTML.
After a search (albeit brief) I settled on WordPress.com. There is a problem though: WordPress massages HTML pasted into the WordPress HTML editor. Here are some rendering problems I observed after pasting AsciiDoc-generated HTML into WordPress:
- Paragraph tags are stripped and <br /> tags inserted at line breaks.
- Break tags inserted preceeding inline tags.
- Tables problems because WordPress seems to insist on the opening table tag occupying a single line.
- Emoticons are auto-generated.
These problems could be solved by installing the WP Unformatted WordPress plugin — unfortunately wordpress.com dosn’t allow plugins, in any case blog editing by pasting into the browser is still tedious. Submitting the unmodified HTML via the WordPress API doesn’t get round these problems either.
My solution was to write blogpost, a WordPress command-line weblog client for AsciiDoc. blogpost allows you to create, list, delete and update blogs written in AsciiDoc from the command-line. Here are some usage examples:
$ blogpost.py create doc/blogging_with_asciidoc.txt
creating published post 'Blogging with AsciiDoc'...
id: 38
$ blogpost.py list
38: Thu May 15 22:36:47 2008: Blogging with AsciiDoc
$ blogpost.py update 38 doc/blogging_with_asciidoc.txt
updating published post 'Blogging with AsciiDoc'...
id: 38
url: http://srackham.wordpress.com/2008/05/38/blogging-with-asciidoc/
$ blogpost.py delete 38
deleting post 38...
|
I have used blogpost to post the AsciiDoc User Guide, a long (around 100 page) and fairly complicated AsciiDoc document.
To get AsciiDoc output into a WordPress compatible format:
- I’ve written an AsciiDoc wordpress.conf configuration file which implements a wordpress backend — all it contains is a few minor adjustments to the existing AsciiDoc html4 backend.
- blogpost runs AsciiDoc with the —backend wordpress —no-header-footer options.
- blogpost then captures the HTML output from AsciiDoc and removes all extraneous line breaks — the HTML is now WordPress friendly.
See also:
blogpost uses Michele Ferretti’s Python WordPress library to communicate with the WordPress XML-RPC API.
Posted in AsciiDoc, Weblog client, WordPress, blogpost | 1 Comment »