Entries for April 2007
Tuesday, April 24, 2007
.Net, Mono, Gtk# and IronPython on Mac OS X
Today’s development platform test was on Mono and IronPython with Gtk#. I was testing the feasibility of achieving three goals:
- Support both Windows and Linux with a single codebase, using either Microsoft’s .Net Framework or Mono.
- Provide a smooth learning curve for my existing .Net dev team.
- Use Python for rapid development, without resulting in disjoint codebases.
My current requirement is for several hundred Windows desktops that I’d rather be using a more maintainable operating system on. I’m bound to Windows by third party software that I must support, but don’t want my team’s own work to become a barrier to migration in future.
Mono doesn’t support Windows.Forms very well, so if I am to adopt it, the first task will be to replace WinForms with Gtk# in existing apps. For the evaluation today, I tried the most basic: getting Mono and Gtk# working, and maybe writing a “Hello, World” Gtk# app in Python. My primary environment is a Mac, which made this evaluation more interesting. Could I actually do my development on OS X and deploy on Windows and Linux? The Mono distribution for Mac OS X includes IronPython but not Gtk# (Cocoa# is bundled instead). Gtk# requires the Gtk+ library, which is not a standard component on OS X, and hence Mono’s understandable omission.
Compiling Gtk# involved jumping a few hoops. Basically: symlink the Mono C# compiler /usr/bin/mcs to /usr/local/bin/csc.exe, because Gtk#’s configure script assumes a Microsoft .Net Framework environment, and then edit all Makefiles to set RUNTIME = mono. That compiled it. To install, I had to create gtk-sharp-2.0 under /Library/Frameworks/Mono.framework/Versions/1.2.1/lib/mono and throw in symlinks to all the DLLs from their source location in ../gac.
I then tried this simple Gtk# example in C#:
using Gtk; using System; class Hello { static void Main() { Application.Init (); Window window = new Window ("helloworld"); window.Show(); Application.Run (); } }
But it wouldn’t compile:
$ mcs HelloGtk.cs -pkg:gtk-sharp-2.0 Package gtk-sharp-2.0 was not found in the pkg-config search path. Perhaps you should add the directory containing `gtk-sharp-2.0.pc' to the PKG_CONFIG_PATH environment variable No package 'gtk-sharp-2.0' found error CS8027: Error running pkg-config. Check the above output.
Turned out there were two copies of pkg-config, one from Fink and one from Mono. The solution was to set a common environment variable:
export PKG_CONFIG_PATH=/sw/lib/pkgconfig\ :/usr/lib/pkgconfig\ :/Library/Frameworks/Mono.framework/Versions/1.2.1/lib/pkgconfig
The code compiled but still wouldn’t run:
$ mono HelloGtk.exe Unhandled Exception: System.DllNotFoundException: libgtk-x11-2.0.0.dylib at (wrapper managed-to-native) Gtk.Application:gtk_init (int&,intptr&) at Gtk.Application.Init () [0x00000] at Hello.Main () [0x00000]
Mono couldn’t find the Gtk+ libraries in /sw/lib. Fixing this was uglier; it required messing with the DYLD_LIBRARY_PATH environment variable:
$ export DYLD_LIBRARY_PATH=/sw/lib\ :/Library/Frameworks/Mono.framework/Versions/1.2.1/lib
HelloGtk.exe would run after this, but if I tried anything else, it failed complaining about missing libraries. I couldn’t find a solution. Anyway, I moved on Gtk# from Python, translating the code above line for line. It wouldn’t work. No known module named “Gtk”. Much head-scratching and Googling later, I learnt that IronPython needs a special invocation for .Net assemblies (that’s .Net speak for “libraries”). Here’s the code:
import clr clr.AddReference('gtk-sharp') import Gtk Gtk.Application.Init() window = Gtk.Window("helloworld") window.Show() Gtk.Application.Run()
Kushal has a slightly more elaborate example.
Friday, April 20, 2007
Zope monitor script
I manage a box with multiple Zope installations. It’s been running low on memory lately, causing one of the older Zope installations to freeze every couple of days. I put together this simple script to monitor Zope’s status, as a standby until a proper solution is found. It’s a simplified version of a script originally written in 2000, when Zope was unstable enough to need it.
#!/bin/sh cd `dirname $0` SCRIPTHOME=`pwd` if (wget http://localhost:8080/ --delete-after -t 1 -T 120 >& /dev/null) ; then # Zope is alive if [ -f $SCRIPTHOME/zope-status.down ] ; then rm -f $SCRIPTHOME/zope-status.down touch $SCRIPTHOME/zope-status.up fi else # Zope is dead if [ -f $SCRIPTHOME/zope-status.up ] ; then rm -f $SCRIPTHOME/zope-status.up touch $SCRIPTHOME/zope-status.down $SCRIPTHOME/zopectl restart fi fi
To use, dump this in your Zope’s bin folder, change the 8080 to whatever port your server is running, set the initial status flag …
$ touch zope-status.up
… and setup a cron job for the user account:
*/5 * * * * ~/zinstance2.7/bin/zopecheck.sh
Wednesday, April 18, 2007
Fireflies festival pictures
I shot over 500 pictures and need more time to process them. For now, please enjoy this picture of Clio Karabelias playing the harp (another). She appears to have been the most photographed performer of the evening, judging by the number of pictures I’ve seen. There’s a comment or two to be made there on the nature of publicity.
More in a few days.
Wednesday, April 11, 2007
Fireflies music festival this weekend
The Fireflies Festival of Sacred Music is happening this weekend, from 6PM on Saturday, April 14th, to 6AM the next morning. These pictures are from last year (a report).
The festival is held at Fireflies Ashram, some 30 km south of Bangalore on Kanakapura road. Here’s contact information, a map, and the location in Google Maps. The schedule is up on Wikipedia. Tickets cost about Rs 200 and can be purchased at the venue.
Some of us have been considering using Fireflies as a location for barcampish events over an extended weekend. This will be a good chance to go check out the place.
Sunday, April 8, 2007
Barcamp Bangalore 3 organisers
Lest we forget them too soon, ladies and gentlemen, here be the team that made Barcamp 3 possible. Click through for individual names. We of course take no credit for the enthusiasm you brought to the event and made it what it was.
Saturday, April 7, 2007
Examining the “e” in “e-gov”
Last week at Barcamp, during the e-governance session, TB Dinesh of Janastu announced an e-governance conference he was helping organise later in the year, tentatively December 2007.
Typical criticism of e-governance centres around how the digitisation is often an excuse to usher in something else, a something that may not always be in favour of the citizenry in whose name e-governance is justified. The best criticism of the technology itself that I’ve seen is limited to questioning the platforms and vendors used. None of it deals with how the manner of application of the technology, shorn of non-technological motives, correlates with its transformative effect on society.
As Mitch Kapor brilliantly summarised it, in a different context, Architecture is Politics:
When I was first thinking fifteen years ago about the challenge of protecting and fostering freedom and openness on computer networks, I originated the phrase “architecture is politics”. The structure of a network itself, more than the regulations which govern its use, significantly determines what people can and cannot do.
…
When it comes to building a new movement, the converse proposition, “politics is architecture” holds true as well. The architecture (structure and design) of political processes, not their content, is determinative of what can be accomplished. Just as you can’t build a skyscraper out of bamboo, you can’t have a participatory democracy if power is centralized, processes are opaque, and accountability is limited.
BoingBoing has a timeline of Kapor’s thought process.
Dinesh has tentatively titled his conference “Information Architectures for E-Governance”. Here are his notes. Elsewhere on that site, I found another page outlining plans for the event (both links may break). While the site says the event is scheduled to be held in Trivandrum, the plan appears to have changed to Mysore (from personal conversation).
Dinesh has specific questions: what is it that makes computers e-governance, and how can the software backend be strengthened to reduce tampering? The concern: an electronic system may be said to eliminate corruption and redundancies only so far as there is no unauthorised access to the data storage. What was once a social construct defined around persons, economic standing and power hierarchies is now an act of patrolling the technological barriers, in turn defined around a different and (often) unwitting social construct.
In my opinion, a conference of this sort would be incomplete without representation from NIC.
The National Informatics Centre is a government body that provides tech solutions to various other government agencies. By virtue of regulations in India, government agencies can procure from other government agencies without requiring external approval, but must use an open tender process for private suppliers. This makes NIC the primary supplier to much of the government.
NIC built some of the key software components of the e-governance framework in Karnataka, including the Bhoomi land records system, and Rural Digital Services (RDS), a unified interface to services from state departments.
I deal with NIC as part of my work responsibilities and find their motivation structure incomprehensible. It is neither capitalistic nor based on the free software philosophy. If I understand correctly, NIC provides software at no charge, their payment coming out of a central budget. Their units appear to operate independently, for I’ve heard of radically different platform choices in different parts of the country, while each unit more or less sticks to the same platform. The software in Karnataka is not open source. They appear to not be answerable to their client, the government department that takes their software to citizens.
So what, then, motivates them? A concern for the common citizen, an altruistic sense of what’s good for the government department, or an unknown hierarchy within their organisation?
For it has much to do with how the architecture of their software turns into politics and defines what e-governance is in some of India’s most significant projects.
NRC-FOSS seeking FOSS enthusiasts
NRC-FOSS is setting up a network of resource centres across the country. These centres are basically a phone line and email address with one or two persons to respond to queries from the general public, represent the FOSS community at events, and otherwise further the cause of Free and Open Source Software. Resource persons get a stipend. The job is ideally suited for freelancers with spare time and a passion for FOSS.
NRC-FOSS is now seeking to setup a centre in Bangalore and needs resource persons. If you are interested, please contact Kenneth Gonsalves. More information is at the mailing list and the website.
The National Resource Centre for Free and Open Source Software (NRC-FOSS) is a joint initiative of the Government of India with CDAC Chennai and Anna University’s KBC Research Centre, also in Chennai. The two units operate independently. While CDAC has focused on building an Indianised distribution, AU-KBC has built educational materials and the upcoming network of city-specific resource centres.
Friday, April 6, 2007
Stylesheet fixed
A long standing issue with this site’s stylesheets has been fixed. IE7 users would see a long horizontal scrollbar, while Firefox users would see the right hand side sections overlapping the dividing line.
This site’s layout is now tested working with Safari 2.0, IE 7.0, IE 6.0, Firefox 2.0 and Firefox 1.0. The font rendering still seems to be a bit of a problem. I use Lucida Grande falling back to Lucida Sans, falling back to Verdana. It appears that some Windows systems have a bitmap version of Lucida that looks horrible. Lucida Grande also lacks an italic face. Safari handles this gracefully by substituting from Lucida Sans. Firefox does not, and as a result, Mac Firefox users get a poor experience.
That, and handheld rendering, remain to be resolved.
Venue management
On the venue again: suppose we had to settle for the same venue, but got to change how it’s used? We had four rooms across two floors. What if we abandon the upper two, use the lower rooms, and add the space between and the corridors? We could toss some mats around the place and insist that anyone not giving a projected demo get out of the rooms. If someone wants a breakaway discussion, they simply move further down the corridor.
Would that improve camaraderie?
Barcamp wiki visual theme
The Barcamp Bangalore wiki needs a facelift. The standard MediaWiki theme doesn’t carry the vibe we want. We’re looking for someone help create a new look for the site, or at least locate a nice theme.






