Dominic Cronin's weblog
Batching components for the component synchronizer
Although the Tridion power tools are currently undergoing a major overhaul to bring them in line with SDL Tridion 2011 and its Anguilla extensibility framework, many of us will be working on pre-2011 systems for some time to come. This being so, the "old" power tools remain a useful resource. Today I was working on a 2009 system, where we are busy with a data migration. This means using the component synchronizer. We've been using it for a few things, but today we wanted to remove some redundant fields from a schema, and then have that reflected in the data. The schema in question had about 8500 components based on it, and processing the entire list in one go was going to slow the whole team down. (We're doing this on a relatively under-powered image that can run quite slowly sometimes - it's easy to max it out!)
So what to do? The way of using the component synchronizer that I'm most familiar with is simply to select the schema and then process all it's components. However, the synchronizer also has an option to process a specific list of components; you have to paste a comma-separated list of TCM URIs into a text box. So then the question was how to get such lists with a reasonable amount of effort. Powershell to the rescue. Here's the approach:
> $tdse = new-object -com TDS.TDSE
> $alg = $tdse.GetObject("tcm:12-1255-8",1)
> $f = $tdse.CreateListRowFilter()
> $f.SetCondition("ItemType", 16)
> $docAlgItems = [xml]$alg.Info.GetListUsingItems(1,$f)
> $AlgTcms = $docAlgItems.ListUsingItems.Item | %{$_.ID}
> $algTcms[0..999] -join "," | out-file first1000.txt
> notepad .\first1000.txt
As you can see, we start with instantiating TDSE and getting hold of the schema. To protect the innocent, let's pretend that this schema is called Algernon. $alg is the variable representing the schema.
So - after a quick where-used, we do the standard Powershell trick of casting the results to an XmlDocument and reading off the ID attributes. By this time, $AlgTcms contains an array of TCM URIs and it's almost trivial to dump the first thousand into a file by specifying an array range (obviously you can get the second thousand by saying $AlgTcms[1000..1999] and so on) and doing a -join
So instead of maxing out the system for several hours, we were able to schedule the work in reasonable batches through the day.
Smoke-testing my Tridion database connections
I'm installing and configuring Tridion 2011 SP1. There are now so many databases, that it's just insane to try to keep track of them all by hand, but nil desperandum, the power shell is here. OK - you might not be quite so compulsive/obsessive, but I threw together a script that lets me have a list of verified working logins before I start poking at config files. At the very least, it brings out some findings about consistency across the different products. Here's what I did:
function CheckDatabase($connStringBuilder, $queryString="select DB_VERSION from TDS_DB_INFO", $CommandType="Text"){ $conn = new-object System.Data.SqlClient.SqlConnection $conn.ConnectionString = $connStringBuilder.ConnectionString $conn.Open() $comm = new-object System.Data.SqlClient.SqlCommand $comm.CommandText = $queryString $comm.CommandType = $CommandType $comm.Connection = $conn $reader = $comm.ExecuteReader() $readResult = $reader.Read() $dbversion = $reader.GetString(0) $reader.Close() $Conn.Close() $dbName = $connStringBuilder["Initial Catalog"] if ($dbversion.length -gt 0) {"$dbname Database version found: $dbversion"} else {"$dbname fffft"} } $connStringBuilder = new-object System.Data.SqlClient.SqlConnectionStringBuilder $connStringBuilder["Data Source"] = "MY_LAPTOP\DEVELOPER" $connStringBuilder["Initial Catalog"] = "Tridion_cm" $connStringBuilder["User ID"] = "TCMDBUSER" $connStringBuilder["Password"] = "Yes I used the same password for all dbs - don't you?" CheckDatabase $connStringBuilder $connStringBuilder["Initial Catalog"] = "Tridion_Broker" $connStringBuilder["User ID"] = "TridionBrokerUser" CheckDatabase $connStringBuilder $connStringBuilder["Initial Catalog"] = "Tridion_cm_email" $connStringBuilder["User ID"] = "TMSDBUSER" CheckDatabase $connStringBuilder "select DB_VERSION from OE_DB_INFO" $connStringBuilder["Initial Catalog"] = "Tridion_submgmt" $connStringBuilder["User ID"] = "TMSSMUSER" CheckDatabase $connStringBuilder "select DB_VERSION from DB_INFO" $connStringBuilder["Initial Catalog"] = "Tridion_tracking" $connStringBuilder["User ID"] = "TMSPSUSER" CheckDatabase $connStringBuilder "PS_READ_DBINFO" "StoredProcedure" $connStringBuilder["Initial Catalog"] = "Tridion_TranslationManager" $connStringBuilder["User ID"] = "TMUser" CheckDatabase $connStringBuilder "SELECT DB_VERSION FROM TM_DB_INFO" $connStringBuilder["Initial Catalog"] = "Tridion_Ugc" $connStringBuilder["User ID"] = "TridionUgcUser" CheckDatabase $connStringBuilder "SELECT DB_VERSION FROM UGC_TDS_DB_INFO"
And here's what the output looked like:
. C:\Users\Administrator\Desktop\dbTest.ps1 Tridion_cm Database version found: 6.1.0.0 Tridion_Broker Database version found: 6.1.0.0 Tridion_cm_email Database version found: 2.2.0.0 Tridion_submgmt Database version found: 2.2.0.0 Tridion_tracking Database version found: 2.2.0.0 Tridion_TranslationManager Database version found: 3.0.0.0 Tridion_Ugc Database version found: 6.1.0.0
All in all - maybe not worth the effort, but somehow satisfying. Is it useful? Maybe.
Using Ghostscript to reduce the size of a PDF
I had scanned in a document with the intention of emailing it. (For this I usually use PDFCreator which allows you to aggregate the results of several scans into a single PDF.) On this occasion, I had scanned all four pages of the document before realising that with, my current scanner settings, the resulting document would be about 12MB. So I was faced with the choice of either scanning them all again, or finding a way to reduce the size of the PDF. A quick Google turned up this link, which gave the following command line to use with Ghostscript:
gswin32c -sDEVICE=pdfwrite -dNOPAUSE -dBATCH
-dPDFSETTINGS=/ebook -sOutputFile=C:newFile.pdf C:originalFile.pdf
The reason I had Googled for a Ghostscript solution was that I already knew I had it installed as part of Cygwin. (I always install Cygwin on any Windows machine I need to use regularly - mostly for the SSH client, but I usually do a full install just so that all those useful utilities are just there. After a bit of poking, I realised that instead of typing "gswin32c" I just needed "gs". The rest of the command worked just fine, and I ended up with a PDF of somewhat less than 2MB.
So here's a hat tip to the Ghostscript contributers over the years. Thanks. Isn't free software great?
Professional criticism
One of the blogs I follow is Glenn B. Allman's "Herding Cats". He rounded off a recent post with the following:
"If you can't defend your position on the facts, but instead reject criticism as an attack, then your idea is pretty much going to die a slow death."
This is right on the money. It reminded me of something that I often see happen on projects. Members of the technical team will engage in (sometimes animated) debate: one proposing an idea, and the other probing it for weaknesses. Sometimes people looking on who don't understand what's happening will worry that there's bad blood between the participants, or that robust debate might be damaging the team dynamic.
Far from it. Engineers need not only to come up with ideas, but to develop them in a professional context. An engineer must be willing to show that he has done his homework, and show and explain his designs and calculations to his peers. Not only must he be willing to defend his position against criticism, he must seek out that criticism. The fellow engineer he consults must be convinced that the idea is fully thought through; then - even if her own design would perhaps differ in some respects - she will be willing to join forces and back the idea in front of people outside the team.
So the next time you see a bunch of technicians in a discussion round a whiteboard, be happy that they are able to give and receive criticism. It's the lifeblood of a successful project.
Breathing new life into the Tridion power tools
A week or so ago we had the second Tridion MVP retreat. SDL's Tridion MVP programme is intended to encourage and inspire people to build a community among people who use the Tridion range of products. People who contribute visibly to building the community are recognised by the Most Valued Professional award. As one of this year's recipients, I was invited to spend a few days as Tridion's guest at a "retreat" in Portugal, also attended by the Community Builders (which is how Tridion extends the same recognition to it's own people who are active in the community).
It was an intense few days. The MVPs and Community Builders are social, driven and experts in their field; you couldn't wish for a more stimulating group of people to bounce ideas off, and the discussions ranged far and wide. These are real in-the-trenches practitioners, and it was great to hear the different ways people approach similar problems. Most of the attendees gave technical presentations, all of which were interesting both in themselves, and in the discussions they generated. The highlight though was our "technical assignment". The Power Tools will be familiar to most Tridion specialists as a set of custom pages which use the API to make some common tasks more manageable. Now that GUI extensibility is a first class citizen, it makes sense to review the old power tools and re-implement them in the new idiom. Chris Summers had prepared the ground before the retreat, and once he had led us through his analysis, the team began on a re-implementation of the batch image uploader.
The new power tools are now hosted on Google Code, and in addition to beginning the work of re-vitalisation, the MVPs and Community Builders also spent time to set up the basis of an open-source development team to continue the work once we all got back home.
I'd like to thank Tridion** for having invited me, not only for their splendid hospitality, but for the opportunity to spend some time off-line working with such stimulating people. As always - thanks to Nuno for pulling it all together, and thanks to the guys for being who they are!
** Yes - I know that I can't thank "Tridion", and that I should say "SDL Web Content Management Solutions", but everyone knows what I mean.
Announcing the Tridion Practice project
There's much talk in some circles about the "Tridion community" and how we can promote community contributions and collaboration. I've been thinking about this, and I see a "gap in the market". Tridion's own building blocks exchange is great, and there are some outstanding community contributions on there. It's a showcase for people's coding talents and much more, but when it comes to making use of the building blocks, the most obvious way to do so is to download and install a given building block. Somehow the focus is not on showing people how they can raise their game at a coding level. The code is available, but it seems the focus is not on the code.
Other people have mentioned the need for a "cookbook" with examples and samples, but perhaps with the idea that this is something Tridion should produce. Of course, the documentation team at Tridion are putting huge efforts in to expanding the product documentation, and there are many examples to be seen there. That's not what I'm on about either.
You don't read product documentation to become inspired. (My humble apologies to the documentation team for my boorish bluntness.) But really - you don't. That's not what it's for. Then of course, there's other coders' blogs. Some of the Tridion bloggers are great, and you do sometimes get the sense of "Hey guys! This is cooool!! Did you know you could do this!!!! ???". That's something we need more of.
So you're probably ahead of me here, but the "gap" I talked of - what's missing - is a community collaboration cookbook. I'm announcing today that I have begun that project, and that anyone who wishes to help is welcome to join me. I believe that by collaborating, we can produce an on-line resource that combines real inspiration with sheer grinding competence. I've chosen to host it on "neutral" territory, at Google Code (https://code.google.com/p/tridion-practice/). I've also selected a liberal open source license (MIT) for the project, because I don't want anyone to have a moment's doubt as to whether it's OK to copy and paste the code straight in to their own work.
I've begun the cookbook with a single recipe: a template building block that factors some of the work out of building page templates. I hope this inspires you (OK - I'm smiling as I write this!) but if it doesn't please don't let that put you off. Maybe it's just not your thing, or you have a completely different approach to the same problem that works fine for you. In that case, maybe one of the other recipies will float your boat (assuming that more recipies will come).
Alternatively, you may look at it and think: "Gee, that would be great, except that such a thing irritates me, or I don't see why that part of the explanation is like that, or sheesh that code is ugly, or why aren't there any comments", or whatever. I know you're definitely ahead of me this time, but I'm going to say it anyway; this is where you come in. Community collaboration doesn't have to be about spending all your free evenings for a week producing a whole recipe yourself. You can help to improve it simply by sending in a couple of review comments, or whatever contribution suits you. Part of the reason for hosting it on neutral territory is to reinforce the idea that criticism is welcome.
Then again, you may not wish to contribute directly. That's also fine. Please make use of whatever you find on the Tridion Practice project. Enjoy! Be inspired! :-)
How does SDLTridion rate on J. Boye's 8 CMS features you are likely never to use?
CMS industry analyst Janus Boye just posted "The 8 CMS features you are likely never to use". Generally, I agree with Janus's 8 points, and I definitely agree with the thinking behind it; that it's important to know which features are relevant to you when choosing a CMS. Here's my point-by-point take on how this applies to Tridion:
Dominic: Indeed, the vast majority don't use it, and I'd be the first to advise them not to. Unless, of course, they need it. Working with workflow is always going to be more complex than working without it, but if you have a governance requirement which demands it, you have to have it. Tridion can meet this need, but I'm very glad most implementations don't need it.
Dominic: This feature is available in Tridion, and to be honest, I don't know how much it gets used by content workers. For developers, I'd say it gets used pretty regularly.
Dominic: At one time or another, Tridion has had built-in integrations with Word. Over the years, people have realised that copy and paste works just as well, and they understand it better. Most implementations have some code in the format area XSLT for cleaning up the MSO "crap" that comes along with the paste. I don't know of anyone these days using an explicit integration, (or even if it's still on the truck at Tridion).
Dominic: You could implement this easily enough in Tridion with maybe some BluePrinting and an extra publication target. On the other hand, I have never, ever, been asked for this.
Dominic: Totally agree. What? Like the content teams have got too much time on their hands. Gee, we musta been good! :-)
Dominic: Down the years, Tridion has been a "best of breed" WCMS. The vision was always to have great APIs, so that Tridion itself could integrate well with other specialised software. (In other words: have some focus; stick to what you're good at.) It's not uncommon to feed data to a search engine at publish time, although just having your search appliance spider the site is probably just as good. So advanced search is often a requirement on Tridion projects, but you don't usually use Tridion itself for it. Of course, these days, we have advanced taxonomy support, and some search-like features might well be driven by categorising content on the back end.
Dominic: Indeed - more usually done with a third-party tool. It's not core WCMS functionality. You can definitely integrate it via some of Tridion's out of the box features (e.g. target groups, customer characteristics) but it's not what a WCMS is for.
Dominic: In Tridion, this is called SiteEdit, and these days it's pretty much an expected part of an implementation, perhaps even more so with big customers. I think Janus is missing the point a little here. You need a staging environment for this approach to make sense, because that's where you use it. You certainly don't miss out permissions and quality assurance. With Tridion SiteEdit, you still need the requisite permissions, and your quality assurance process stays intact.
Keep the good stuff coming Janus. Maybe some other people will give a detailed breakdown for their favourite CMS.
Republish from publish queue for Tridion 2011
Many of you will remember that absolutely the most popular Tridion extension ever :-) was my Republish from publish queue extension. It has just come to my attention that Bart Koopman has implemented pretty much the same thing for Tridion 2011.
First of all - it's great to see this old chestnut get a new lease of life. Thanks Bart.
Just in case anyone thinks Bart nicked my idea - well he didn't. We were both inspired by Hendrik Tredoux's idea which he posted on the ideas site way back. (Actually the "most voted" idea on the site to this day.) The irony of it is that although Hendrik was the one who posted the idea - he could probably have implemented it in his sleep, and the people of whom that is true would make a very short list indeed. Hopefully, with the great extensibility API in 2011, the list will be much longer.
But back to the main theme. That's the great thing with a software community; we're all throwing ideas around and bouncing off each other. I love it. The really good part is that right now I'm just a tad too busy to re-implement this extension for 2011 (it was on my to-do list - honest!) and now I don't have to. I suppose I should at least find the time to download Bart's extension and kick the tyres. :-)
Why Scrum when you can Maul?
I'm currently doing a Scrum project, and I suppose it's not surprising that we occasionally make reference to scrums in the sport of Rugby football. According to Wikipedia, the use of the term in the context of development projects seems to have come from a 1986 article by Takeuchi and Nonaka describing a new approach to manufacturing cars, photocopiers, cameras and the like. Their analogy compares a relay race to a game of rugby, and although the term Scrum is used, it's really incidental to their point, which is that a "holistic" team-based approach can be more useful than the sequential approach which was widely in use.
If you really want to know how Scrum came to mean what it means today in software development, you might follow some of the other links in the history section of the Wikipedia article. Suffice it to say that the use of the word Scrum in this context probably just refers to the concerted approach of a Rugby team rather than to the specifics of what a scrum is in Rugby.
What most Rugby players today would call a scrum is something of a set piece which is used to re-start play after an infringement. The forwards of each team form a well-defined structure, putting their arms around each other and holding on to each other's clothing (binding-on). Three distinct rows of players on each side face their opponents and "engage" with them in a carefully controlled ritual.
When you're creating software in a Scrum team, the idea is that each team-member should be able to dynamically shift their focus as necessary to make sure they are contributing to the most important goal of the team at any given moment. Of course, a Rugby scrum is a great analogy for general team-work and having a concerted goal, but it doesn't really say much about the need for team members to spot when a colleague needs help and come to their assistance. This is far better illustrated by another feature of Rugby - the Maul.
A maul in Rugby takes place when a player wants to move forwards with the ball and is stopped by opposing players. From going forwards, he turns back towards his own supporting players, who bind on and drive the maul forwards. More players can run in from behind the maul, bind on and add their strength to overcoming the obstacle. All this happens without a whistle being blown or play being stopped. A team with the right training and discipline can generate and control a so-called "rolling maul", where a stable formation is maintained while driving forward and gaining sometimes significant territory.
You can see how this works in this training video, and if you're interested a quick search of YouTube would yield many examples of teams putting the technique to use with great effect.
I'm quite sure that Scrum as a brand is very well established, and I'm not proposing that anyone should start up a new software development method called Maul (although if you do, I want the credit!). Even so, the game of Rugby has more metaphors to offer than the simple one of team effort in a common cause. The scrum itself illustrates a formally organised set-piece, with the players fulfilling their specialist roles. In free-flowing play, such as mauling, the team expresses its ability to self-organise and respond to unforeseen conditions. You'll also see the benefits of cross-disciplinary working. When things turn chaotic, the relevant specialist probably isn't where he's most needed, so the players on the spot do whatever's needed. As that happens, the rest of the team are dynamically reorganising so that when the ball comes out, it will be into the hands of the right player.
Of course, you can take this too far. Forthcoming posts: Should the Scrum-master role be re-branded as scrum-half? OK - never mind.
Site now running on plone 4, and without disgusting blue-green skin
Erm.. yes - I did know that the site previously looked awful. I'm not a web designer, and I never made any pretence of being one. Suffice it to say that I've upgraded to Plone 4 and in doing so, I'd have to make a conscious choice to bring the old skin with me. As my primary goal in messing with the site in the first place was to fix that ugliness, I've decided that - having got things working - the default plone look and feel is enough for now.
Over the coming period, I intend to find some time to spend on re-skinning the site properly - in the meantime, at least it's readable.
Hmm - wonder what it should look like!!?