September 13th, 2007 by pim
There are many places where programs written using grace seem to be syntactically closer to languages like Python than to C. String formatting used to be not one of these places. Historically, formatting text with dynamic elements within grace was a matter of using either string::printf() or file::printf(). These are C-style printf formatters, which means they accept a variable argument list consisting of a ‘format string’ and one or more integer or pointer arguments. When dealing with value and string objects, this means liberally using explicit casts like cval() and ival() to convert those to printf-compatible types.
The library version inside the repository now supports a friendlier way of going about things, one that does away with all the explicit casting in the form of the %format pseudo-keyword. In its most simple incarnation, it works mostly the same as a normal printf formatting operation, except that it can deal with any objects that can be cast to value:
string test = “%i bottles of %s” %format (99, “beer”);
One level up on the funky scale is referring to positioned arguments:
fout.writeln (”<%s>%s</%{0}s>” %format (”str”,”foo”));
Finally, you can access children of the first argument like this:
value v;
v["name"] = “John Smith”;
v["email"] = “j.smith@example.net”;
fout.writeln (”%[name]s <%[email]s>” %format (v));
This way of formatting, apart from being more flexible and less sensitive to formatting-related security problems (since it doesn’t need to follow arbitrary pointers), adds a lot of clarity to your source code, which is a major plus for keeping up maintainable code.
Tags: c++, grace, programming
Posted in misc | No Comments »
August 27th, 2007 by Habbie
Hi!
Last week we released new alpha packages to our group of testers, both .deb and .rpm packages. See the changelog for a list of what’s new and great!
Posted in core, misc | No Comments »
August 6th, 2007 by Habbie
Although this blog has been awfully quiet, we have not been idle at all. Since the alpha release a few more alpha releases have happened and many alpha testers have provided us with valuable feedback.
Current projects include:
- a unit testing framework for opencore and all modules; in the process of building this, many bugs have been uncovered!
- lima, our own mailinglist manager, because the state of open source mailinglistsoftware when considered in a virtual hosting context is sad
- wasp, a tool to manage web applications for individual users, with upgrades (including forced global upgrades eventually)
- massive work on the GUI to get it stable and mature
We intend to release a full public beta within Q3; watch this space!
Posted in misc | No Comments »
March 21st, 2007 by pim
This problem may sound familiar to some people: You have an office (or a livingroom) filled with Macs and you want to share a common NFS volume from a linux machine that all OSX users can access. Linux’ kernel nfsd doesn’t support uid/gid-mapping beyond its rather tame idea of uid-squashing: mapping all file access over NFS to a specific userid and groupid combination. Although this sounds like a sensible approach for such a shared volume, unfortunately the OSX Finder is trying to be way too smart about things and will block any operations on a volume if the permissions look wrong. What this means is, if you use all_squash to map all access to, say, uid/gid 100/100, the Finder running for a user under uid 501 will refuse to copy files to the share, even while the NFS server will permit this.
So for months we resolved to just making sure everybody was running under the default userid 501 assigned to the primary (or actually, first created) user of an OSX system. This, of course, is unworkable for machines that have multiple accounts (onlyl the account with userid 501 will allow proper access to the share).
Then I ran across this post, documenting that the uid/gid combination of 99/99 is magic to OSX and the Finder: it will automatically map the ownership of a file/directory with these properties to that of the user that is currently looking, so problem solved. By exporting an NFS volume like this:
(rw,insecure,all_squash,anonuid=99,anongid=99)
we no longer have to muck around making sure everybody has uid 501.
Posted in misc | No Comments »
December 30th, 2006 by pim
The alpha release of OpenPanel is now available for people who want to test it out. We’re trying to keep this first test run somewhat controlled, so you have to sign up to join the party. The beta release will be completely public, but if you can’t wait to take a look go to the site and sign yourself up.
Posted in misc | No Comments »
December 23rd, 2006 by pim
This month has been a really energetic one and we’re almost ready for a limited seed of the alpha release of OpenPanel to our testers. Now’s a good time to take a closer look at what it is that we’re shipping.
OpenPanel is not a monolithic product. Yes, you’re getting a complete control panel, but its architecture makes it extremely adaptable to more specific circumstances. Put into perspective, the project has the following components:
- The opencore configuration daemon.
- The authd privilege manager
- The opencli command line shell
- The openpanel AJAX-based web interface
- A large number of opencore modules for configuring specific services
- A software distribution for some necessary components
The flexible design means we will be able to adapt the OpenPanel system to new demands from the market easily. The open-ended architecture also allows this market to extend beyond the purposes for OpenPanel that we happen to find interesting; Users are free (and actually encouraged) to create their own modules.
The alpha release carries the following modules:
- Apache2 virtual hosts
- BIND9 DNS zones
- Postfix and Courier-IMAP hosted mail domains
- PureFTPd chrooted ftp-accounts
- MySQL databases and user accounts
- IPTables firewall configuration
- Software updates through apt or yum
- Amavis and SpamAssassin for mail protection
- AWStats website statistics
Some more modules will make the mark before the public beta release.
Posted in misc | No Comments »
December 23rd, 2006 by pim
Posted in misc | No Comments »
November 22nd, 2006 by pim
We’re trying to get Xen running on our new, fresh, Dell PowerEdge 1950 servers. The install itself was pretty uneventful. Plenty of distros offer pretty decent support for the Xen Hypervisor from their default install (we’re currently testing it with FC6). A major bummer, though, was that the networking part of Xen just plain wouldn’t start in Dom0. The network bridge just plainly didn’t want to receive back packets coming to the interface, so stuff like ARP just didn’t work at all.
It turns out the problem lies with the built-in management firmware that Dell puts on these broadcoms. You can look here for a solution. Beware, the solution involves Windows to unpack the file and MSDOS to change the IPMI settings.
Posted in misc | No Comments »
November 20th, 2006 by peter
dbmanager.cpp:626: error: request for member 'ival' in '*((+(unsigned int)(+ res)->string::operator bool()) + ((const char*)"insertid"))', which is of non-class type 'const char'
Posted in syndicated | Comments Off
November 20th, 2006 by Coos
when you really really really don’t want 304 on dynamic pages and you are using PHP:
header(’Last-Modified: ‘.date(’r'));
this will print the date in http://www.faqs.org/rfcs/rfc2822 formatted date.
Posted in gui | Comments Off