Drupal Quick Tip: Overriding strings
Photo CC-BY by smithers
Drupal comes with its own terminology and sometimes the strings returned to the user are not quite the vocabulary he or she uses. For example, a small library might refer to the people who have their library card as patrons or members. If a module to manage those users uses a different term this then can cause inconsistency, confusion, etc. One can, of course, just change the strings within the given contrib module but then upgrading becomes a tedious process of merging changes by hand. There is a much nicer solution available.
String Overrides
Within settings.php one can specify strings which should be overriden, so that a consistent word choice can be implemented without having to mess up core or contrib. The OpenAtrium documentation has a nice explanation of how to use this.
If you don't mind adding one more contrib module to your installation, there is also a gui solution to do this for you, called the String Overrides module.
posts:
Failing infrastructure
I have been digging through the 27C3 recordings from time to time and one which especially caught my eye was Eleanor Saitta's talk titled "Your Infrastructure Will Kill You" (Youtube, Webm Torrent). Her argument is that infrastructure will be neglected until the point of catastrophic and costly failure. This, she concludes, is primarily due to the fact that the agents in charge of said infrastructure normally do not have any incentive to invest in it. Short term gains, through cost cutting measures are tempting if the problem only occurs years or decades after one leaves the elected office.
Photo CC-BY by reallynothing
Several months after her talk Fukushima happened. Watching the talk after this event underscores the fundamental importance of infrastructure, though it does not address the inherent problematic operation of nuclear power plants. Having only recently come across her talk I was excited to hear her perspective on this topic in regards to the recent crisis on byciclemark's excellent podcast. (Also check out his 26C3 talk and his 24c3 talk.)
Slightly unrelated but also quite interesting is her talk at The Next Hope in 2010 on Buying Privacy in Digitized Cities and others in her list of talks, recordings can be found online with some digging. Overall, she's an interesting person to follow (@dymaxion) with an unusual set of insights.
Learning the basic sciences today
In school, many many people tend to construct a narrative around their skills and abilities to explain why one scores better in one subject than another. Probably the most common trope is being semi-illiterate in mathematics, often extended to include the natural sciences. As is regularly being noted, this cliché is common and acceptable even in highly educated circles to the point of pride (and sadly also often tied into sexism). I have become painfully aware of the fact that I have used a variant of this cliché in my personal narrative for far too long, by claiming to have an aptitude for languages but not the hard sciences.
That's a nice way of saying I was too lazy to study for math because I didn't like it. That's true, to a point. Then I came across Khan Academy and realized that this conflates several different issues. If you have not come across Khan Academy yet, it started as a series of YouTube videos of light/chalkboard math training excercises with voice-over. That sounds incredibly dull and boring and they are. Except when you struggle with your homework and would like to backtrack the last three or four lessons. Or twenty.
In my opinion, this inability to rewind is one of the main pillars of the i-suck-at-math cliché. Classical math education progresses steadily when the instructor has instructed, explained some more, handed out homework and graded. Homework serves as the memorization and familiarization mechanism and those who diligently do it can continue to perform adequately. The lazy ones and those which just need a bit longer than others will then get a bad grade but more importantly those holes in that foundation are never filled in and when you graduate you're glad that the whole thing didn't collapse under the weight of yet another abstract, unconnected method of computation.
And then Khan Academy set up their excercises and it expertly uses gamification elements and motivators (e.g. speed-solving trophies) combined with their video lectures to aid one to become proficient in all those basic building blocks in a mathematical foundation. Not only do the game elements make slightly addictive, the overview clearly shows what is hidden when you hand in your course books at the end of the semester and are not the instructor: A map of specific arithmetical, algebraic and trigonometric skills and their interdependence. It will not get you an advanced degree but it trains far better than any instructor's approach to homework I have ever seen in recognizing what proficiency means and how easy it is to fool oneself into getting it, i.e. reaching those ten-out-of-ten in a row isn't that trivial when you go beyond the first dozen lectures.
Obviously, Khan Academy does not replace a skilled teacher or commitment on the side of the student. I can only say that I would probably have killed, paid a lot been very thankful for it, had Khan Academy been available when I was in school.
Now, if you haven't gotten an urge yet to reclaim or revisit math, have a look at Vihart's fantastic YouTube channel. OMG binary trees. Oh, and of course the Khan TED talk, too.
Liveblogging Drupal Commerce Camp Lucerne 2011 / Sunday
Day three of three has arrived, sadly not with the perfect weather we had the past two days, then again the sessions are indoors anyway.
Writing payment modules for Drupal Commerce
Lorétan from Wunderkraut had worked on payment modules with Ubercart but was less than happy with the overall experience and then looked into Drupal Commerce. First good news: it's not much different. Naturally, security and consistency (process-wise) is vastly more important in the payment area compared to other areas. Paraphrased: If you don't know about security, don't write a payment module. And that's good advice. Also, national and international regulations do affect creating payment modules and have to be considered to some degree.
At the most basic level a manual payment involves entering information, which is validated and then a transaction is created and is pending on the payment gateway, hooks are shown, (in theory) done.
A more complex example is credit card processing via a payment gateway validation and act on answer of the payment gateway. So, in contrast to manual transactions we have local validation and remote validation (which creates an authorization answer) and then create a remoe transaction tied to a local transaction, the latter part is heavily dependent on the payment gateway (i.e. some providers allow you to authorize a card and directly execute the transaction). Commerce Payment does offer helper functions for standard credit card elements which avoid having to redo the obvious tasks of CC number field, expiration, etc., neat! His slides then show examples of how to carry out the transaction, formatting request information for a particular gateway and formatting the output/error codes for the user.
The third option is off-site payment, such as SagePay (or for a Swiss example, Datatrans offers the same). Thus we have enter information, local validation, redirect and the return page is what to act upon.
Tips. Make sure you have a test account, naturally. Have the documentation, error codes can be obtuse; same experience here, incredibly important and not always given. The documentation may also be erroneous and thus have a contact person at the payment provider. Writing tests should be mandatory but is not always possible (also depends on having a test account). Finally, consider what happens after the initial transaction, e.g. reimbursement/refunding/cancelling. The payment gateway can probably do this, but how will this be reflected on your site?
Module migration from D6 to D7
Plüss asks you to clone the module first (if it's in contrib), so your patch can go to upstream later. Obviously change the core version in .info, fix the dependency listing. White screen of death, turn on debugging. Iteratively fix. Kinda waiting on a coder upgrade tutorial.
In the link_node example he uses we now have the module enabled, no errors but a non-working module, his tip is to look for the hooks used, here this is hook_filter() which changed to hook_filter_info(), so check the upgrade guide and API reference.
Audience question on coder upgrade. He hasn't seen it yet, it wasn't ready 3-4 months ago. Damn, I failed at this two weeks ago and the multiple parser dependencies required on my test system.
He recommends submitting even incomplete patches with provide some functionality for D7 so the maintainer has something to work from and consider taking over abandoned modules.
Lunch break.
D7 and XHTML+RDFa
Schaffner starts off by talking about the Google panda update, which does take unique, creative content on the web into account and semantic declarations count. Right now, we have lots and lots of acronyms for standards, microformats and namespaces (OWL, RDF, SPARQL, FOAF, DDC, etc. etc.). D7 integrates RDFa. Some more background infos, still wondering about microdata with schema.org and the Google/Bing/Yahoo announcement a few months ago.
RDF does come to the editor at the level of the content type, where a "RDF Mappings" tab allows setting semantic properties on e.g. type, title, body. To actually do something you apparently need to enable the external RDF vocabulary import module, then you get proposed elements via ajax (e.g. hmedia:Audio).
Interesting other modules to consider are SPARQL Views and VARQL for working with semantic data.Schaffner hasn't yet tried implementing it on taxonomies and terms but he is fairly certain that this is currently not supported. Audience input on possibly using the relation module for this.

And it's over, lots of interesting talks and people to talk to over the last three days. Looking forward to the next event, hopefully something long before Drupalcon Munich 2012 in August.
This is part 3 of 3. See also the commentary on the Friday and Saturday sessions.
Liveblogging Drupal Commerce Camp Lucerne 2011 / Saturday
The second day of Drupal Commerce Camp is starting rather relaxed with an empty campus on Saturday. We are now split into three tracks (two regular, one training) and so sessions have thinned out somewhat. Off to the talks.
How do I monitor Drupal
The thinning out had the effect that the audience could introduce themselves and their background. Fischer starts off with probably the most important question on why to monitor: "How do you know that your site is currently up and running?"
The usual suspects: Nagios, Munin, Cacti. Interesting other solutions are New Relic (apparently used by Acquia), Groundwork and Zenoss. Surprisingly few complete solutions. Other interesting modules which can come in handy at times but are not really monitoring tools: prod_check, hacked, hosting_stats, variable_changes.
Drupalmonitor.com is a tool with a Drupal focus and not server maintenance or analytics in general, needs one module and the site should be successfully monitored under drupalmonitor.com. Monitoring apparently secured by a hash, looks like sniffing and replay attack might work here, speculating.
An interesting example is the analysis of watchdog here, split by type (i.e. page not found), which shows the development nicely over time, that information is normally hidden behind the tabular log entries report. I want that. Currently in free beta, with a tentative freemium model for monitoring more than one site. D7 release not yet out.
Date based pricing in Drupal Commerce
Phillip is showing his work on decoupling prices and products. The module Commerce Limited time Offers (LTO) creates temporary line items to perform price calculations where rules can be used to then compute. This looks at the two use cases of different prices based on different time unites (i.e. weekend/weekday) or different ranges of dates (i.e. seasonal prices during the summer). Interestingly, also makes it possible to go down to second-base pricing (though you probably only want daily). It also accounts for the fact that caching of a price until a specific time (i.e. midnight) is considered.
Fundraising and Donations with Drupal Commerce
Schmidt is showing the Commerce interactions in regards to donations, coupons and redeeming modules with Drupal 7. Donations are in essence one item per cart but the cart module is used to be able to rely on all the features it offers, while skipping the cart form with rules (/cart as a path is actually available if typed in by hand).
Variable pricing for donations can either be solved by creating unique products for each price entered, or changing the price on the fly of the product. Solved here with Commerce Product Option and rules then changes the product price for the transaction.
Coupons are integrated with Commerce Coupon but the extra case of users not entering more than the coupon value and thus not having to enter payment information has to be considered. Also, coupons should be able to be set by users, e.g. when a large company wants to hand out 1000 coupons and for the users the amount should be given by the coupon code and not by manually entering the amount. The solution was to use taxonomy terms: easy import, redeem status and associated amount per term. This showed really nicely how the workflow of Drupal Commerce was adapted to fit a custom transaction process and isn't limited to the cart-billing-done workflow. Hadn't actually used fields on terms before, that's a neat trick.
Lunch break.
How to sleep without the server-crash-fear
Schmidt talks about how they moved back from the cloud and are now primarily relying on APC, Varnish, MySQL master/slave and memcache on their own resources. The first, APC, is a nice basic PHP cache but as he points out, maxed shared memory has to be set sensibly. Default often 20MB, D7 needs 35MB at a minimum and they use up to 400MB.
An interesting file-system-level strategy is serving Apache webservers with GlusterFS as a distributed file-system. The auto-heal functionality in particular looks quite interesting.
Looking at MySQL, if you are running a master/slave configuration a neat fallback strategy is to declare one slave to be the hot-spare master. This does not switch automatically when the master goes down, though it is possible to configure this in Drupal but they are switching this manually.
Varnish is the reverse proxy which handles those queries which do not involves sessions, cookies and SSL extremely well and fast. Also an interesting point is to use Pressflow for D6 to backport some lazy session handling. Looking for modules which create a session for some reason as a performance problem is something I'll probably have to look into.
Schmidt concludes with their reasoning on why they choose managed hosting at a local hoster over Amazon resources after trying them due to price, performance and an actual person to call when things go pear-shaped. I definitely agree on his argument that Amazon pricing on a 24h basis is not cost-effective, even if it's cool that you can bring instances up and down at will.
Import and synchronize products with Feeds and Commerce
Feeds is a powerful module that allows non-developers a wide array of integration options. It separates into fetcher (grab), parser (we now have arrays) and processor (target entities and assigned to fields) and at each level one can cleanly adapt Feeds to the proper use case. So, Cambra shows us how one can create a product reference importer and how much can be managed right in the Feeds administrative pages and is easily accessible, even to novice Feeds users. Apparently even pulling in images should be possible, what else could a PIM want?
The alternative would be Commerce Migrate, which also makes converting Ubercart to Commerce often possible.
And that's it for day two.
Liveblogging Drupal Commerce Camp Lucerne 2011 / Friday
All right, let's get this started. It's 9am in Lucerne, after some rain in the morning, things have cleared up. Everything's a bit rough on the edges in terms of signage, organization etc., still, it's just the first Commerce camp. Now for Byhet and McGuire as the keynote speakers.
Oh, first some introductory notes: fees are being refunded thanks to sponsors and food is free too, plus Apéro, nice.
Keynote
McGuire says Drupal 7 is being adopted fantastically fast but we do need to leave the Drupal echo chamber to reach further. Also, Commerce 1.0 happened and the company-names-slide is packed. What's the most common thing people mention? Flexibility. It's a huge box of legos (love the metaphor) but that's hard to sell. Products/Distributions go beyond the lego box and make the process of selling Drupal easier.
Byhet shows us where online commerce came, hello "modem commerce" in the 80s, hello 90s with Amazon and the first standardized platform ATG. 00s: Oh look, there's Magento. Now for the present: diverse customers, places to shop (on- and offline), devices and information sources. There is no longer a direct mass-media marketing push but a diverse web of interactions.
Commerce getting traction due to multichannel, customer experience and more, says Byhet. Interesting factoid: 70% of the web is running without a CMS. What?! Hard to believe, I should research that. Drupal as the new Linux, interesting analogy.
Important highlight: Commerce Guys poured large amounts of R&D for upstream patches into Drupal 7 and creating Drupal Commerce. Some open source projects can run on part-time volunteers but (see Linux) the commercial support does make a difference in terms of development speed, functionality and release cycles.
eCommerce landscapes and Drupal
[Slides] Banerjee from Anolim takes a survey of the audience, developers seem to be the most common. Shows the different general approaches: CMS-based (Drupal, Wordpress), stand-alone (Magento), proprietary ERP (SAP), stand-alone proprietary (Hybris) and eCommerce SaaS (Amazon, eBay). Commerce in Drupal is given by the modules Ecommerce, Ubercart, Drupal Commerce and Bespoke.
The vast majority of Drupal 6 shops is Ubercart. Drupal Commerce completely build on D7 though Ubercart will also be available for D7. Though many Ubercart modules are not yet available for Drupal Commerce and subscriptions/services aren't very advanced yet.
Competitors: Magento in contrast to the CMS approach does its core competencies well, as long as you don't want to customize any of it and has a steep learning curve. Wordpress as the main Drupal competitor looks really nice but is not as flexible, also eight different modules and some have paid "gold versions".
Case studies
Kampajobs: Soon to relaunch automated job posting platform tiered to NGO/NPO, which is switching from free to paid services via Drupal Commerce. The discussion highlighted how complex invoicing procedures can become and that supporting those isn't trivial. (Kampaweb)
Sosense.org: Donation platform via credit card and invoice for social investors. Integrates a review workflow for due diligence and bilingual availability of all content. Integrates Drupal Commerce, og, heartbeat. Currently just CHF supported but more currencies are planned, another issue which highlights "hidden" complexity in commerce processes. (Amazee)
Naturstrombörse: Selling local renewable energy. Heavily relying on Google Maps and geocoding. Ubercart was evaluated but not used due to not being as easy customizable for this specific use-case. Expanded to multi-platform solution for integrating but also customizing for different cantonal providers. Looking towards relaunching via Drupal Commerce and Openlayers. (Floid)
Lunch break.
Case studies II
SaaS:: [Slides] Recurring payments are not easy to implement, due to the PCI requirements etc. using a payment service provider in some form or another is needed. However, now when you don't handle that payment information, what happens when this changes? Not a trivial problem at all. Similar to that is: who triggers the recurring transaction? Also, Chargebacks.
Business Process Management: How can Drupal transform a manual administrative paper-base workflow efficiently? A case in Drupal 6 with CCK & Views. (Plüss)
guzuu.com: A Swiss etsyesque plattform. Uses Drupal core and a few contrib elements, thus quite different from most shops here and oriented along using Drupal as a framework. This echoes what Remo has been advocating in terms of Drupal being an ideal CMS framework onto which other frameworks or custom solutions can be build on top of. Interestingly, from a good dozen contrib modules CCK is used but Views is not due to not being needed and performance aspects. (Netnode)
Open Government and Open Data
The final talk for today is a break from the previous talks and focuses on Open Government and Open Data in a Drupal context, e.g. fixmystreet. Now we are being bribed with t-shirts.I find this topic interesting but the speaker does not seem able to tie this into the theme of the conference at all.
And it's a wrap.



