Archive for the ‘Presentation Template’ Category

I was looking for something entirely different and found this blog about interviewers asking questions at interviews and why they are good questions.

I decided to answer them to find out how I would fare in the modern day interview.

What industry sites and blogs do you read regularly?

six revisions is the best place to keep my design skills accurate. Since I am mostly a developer and not a designer, I need to work at it. So I read that, although whatever development they have there is mostly front-end. With back-end development, the blogs are a little more involved and I am struggling to find the time to read them and I’ve not really found any that talk about Autonomy/Interwoven products in as much detail as I do. (by the way, I’d be happy to be proven wrong).

Do you prefer to work alone or on a team?

It varies depending on the complexity of the project and the complexity of the task at hand. the size of the projeccts I work on tend to be quite big, so collaboration is essential. However, we are mostly thinkers and in order to be effective, you need a place to think. I do work better in quiet environments.

How comfortable are you with writing HTML entirely by hand? (+exercise)

When I started, there wasn’t many WYSIWYG editors that could do the job so I had no choice. I still code HTML by hand today.
The editor I use (beloved Netbeans) has syntax highlighting and code completion on HTML so it goes quite fast.

What is the w3c?

World Wide Web consortium. They help define the standards of the web and their best task is to prevent Microsoft from messing things up too much and going off in a tangeant.

Can you write table-less XHTML?  Do you validate your code?

I do write table-less XHTML and CSS, although I tend to work with designers a lot so I usually have them verify the CSS. My code always validates if I can help it.

What are a few of your favorite development tools and why?

My favorite development tool is Netbeans. With it, I can do Java, HTML, CSS, javascript, XML and XSL. For mee it’s very complete. Put a layer of Firefox on top with a few choice add-ons like Firebug and HTML validator and you have a complete set-up. I also use my blog a lot, as I use it as a knowledge repository.

Describe/demonstrate your level of competence in a *nix shell environment

(the original question asked how to recursively copy directories and how to make a file only readable by the owner).
cp -R somedir, chmod 500 somefile

What skills and technologies are you the most interested in improving upon or learning?

For me, the back-end Java is just as satisfying as the front-end javascript. I am a developer at heart. The web services layer for me still holds a few secrets I’d like to unlock. I think this is the final layer I need before I’d start confortably call myself a J2EE web architect.

Show me your portfolio!

I have worked on intranets and Internet sites so not all of it can be accessed externally. Here are the few that still are in existance.
http://www.environment-agency.gov.uk/, http://www.atkins-global.com/, http://www.nomura.com/

What sized websites have you worked on in the past?

The biggest was the Environment Agency. It was big with all its metrics: number of pages, number of editors, number of visitors. the Environment Agency is responsible for flood warnings and that was always a high profile project within the  programme of work. When the UK is hit by a series of floods, The website is hit by a deluge of requests. We had to put in place a fail-over static webserver to take over when the dynamic servers would not cope anymore and use caching… a lot of it.

Atkins intranet was big. They had everything on it and as soon as you need anything, all 15000 employees could need anything from blueprints to communications setting, they found it there. The pressure came as the system grew out of proportion and we had to do something about it. We upgraded everything: software and hardware.

Nomura’s intranet site is also quite popular within. Every department has an intranet site, from Operations to Facilities management via Equities. The support function is quite intense there as the department staff are updating their sites themselves, and not all are fully web savy.

Show me your code!

I am not afraid of putting my words where my mouth is. ask me what you want to achieve and I’d develop it for you. For some code samples, there are plenty on my blog.

What are a few sites you admire and why? (from a webdev perspective)
I am a guy without bling. This transfers in my online tastes. I go to sites because they do what they say they do, not because they look good.
Linkedin is very useful and feedshow is very handy. Google maps is always reliable. functionaly over form. Always.

Fix this code, please.

(the original question prompts the interviewer to show broken code).
Yes, I can do that too.

I just pulled up the website you built and the browser is displaying a blank page.  Walk me through the steps you’d take to troubleshoot the problem.

these would by my methods for solving the problem

Press F5
Press Control+F5
view source. Is the response empty? is the HTML invalid? is the CSS valid?
is any other page displaying similar symptoms?
what is the HTTP response code? 200? other? telnet to the server on port 80 and issue an HTTP request manually. use Fiddler to see more.

What’s your favorite development language and why?  What other features (if any) do you wish you could add to this language?
Java has been hard to learn, because I am a perfectionist. I want to know how to do things, but I want to understand how they work. RMI was very painful that way.
But now I know it, I couldn’t go back to programming in Perl easily.
I think one thing Java could borrow from Javascript is how to add methods to objects like you can assign variables for example. I have found that very useful when doing callbacks in Javascript for example. I am sure this could change a couple of things.

Do you find any particular languages or technologies intimidating?

If I had limitless time resources, none – but that’s not how it works. I focus on the things I need for work and try to learn them before I need them but that’s not always possible. Microsoft technologies are intimidating, not because they’re hard but because you put code in and you don’t know what’s going to come out.

Acronym time (oh boy!)

I don’t like this questions. Acronyms are not your friend. the reason I am saying this is because two different sectors of technology could use the same acronym for different things. Jargon needs to be understood to be effective. the purpose of communication is to understand and be unsertood. Coding things for the sake of coding things is not a clever thing to do, unless both parties have a common understanding. The whole industry suffers of jargon overdose as a whole: ECM, WCM, DM. And yes, I do know what HTML, XML and CSS stand for.

What web browser do you use?

I prefer firefox. whenever I need to develop new stuff, I normally try it out there first. IE comes second. Usually, this is sufficient to ensure it works every where. Then there is IE6. I stopped supporting it for anything personal that I do. Only in the heavy corporate world is it still used, and only there I support it.

Rank your interest in these development tasks from 1 to 5 (1 being not interested at all, 5 being extremely interested)

Java 5, HTML 3, XSL 5, XML 5, CSS 2, javascript 5, content 1, documentation 3, project management 3

What are a few personal web projects you’ve got going on?

I am creating the website for the new side venture I am starting for Wedding Photography. It is quite a good project as it brought with it a lot of new stuff about image manipulation. It uses a custom tag library that I wrote to do XSL transformation of XML documents in the same way that Interwoven LivveSite does. I uses XML to store photo galleries, transforms them using XSL to create the online galleries. It also uses AJAX to dynamically provide slideshow of the whole gallery without compromising initial load times. The site is not live yet and won’t be for a little while as holding a day job, getting married and moving house doesn’t leave much spare time.

Advertisements

If you want to know the old perl templating tags and are searching for the help files, here’s the url:

From time to time, your data requirements will change. This cascades down to the data types you use. Adding new fields, removing others, changing values are all part of the evolution of your data so you should be prepared to transform it.

In this article, I will focus on migrating DCRs from one type to another. By way of example, I will use a fictitious intranet article type and something similar but different with portal news.

Intranet article Portal news
Article/type
Article/language
Article/region
Article/global
Article/category
Article/title Article/title
Article/date Article/date
Article/sortdate Article/sortdate
Article/content Article/content
Article/synopsis Article/synopsis
Article/image Article/image
Article/displayImage Article/showImage

The types are similar, as in real life your types will be similar: that’s why you’re changing them.

The plan is to wrtie an XSL stylesheet that wil help us transform DCR XML files of one type into DCR XML files of another type. This will be achieved through a java class that will scan the directory, perform the transformation and declare the resulting files as DCRs of the right type by setting some extended attributes on them. Here’s a sample source intranet article:

<?xml version="1.0" encoding="UTF-8"?>
<article>
 <title>lorem</title>
 <date>01 January 1970</date>
 <sortdate>01 January 1970</sortdate>
 <content><![CDATA[<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>]]></content>
 <synopsis><![CDATA[<p>Morbi feugiat nunc non urna auctor venenatis pulvinar nisi commodo.</p>]]></synopsis>
 <image>/resources/logo.gif</image>
 <displayImage>true</displayImage>
</article>

I create the XSL transformation template. I put it in templatedata/intranet/article/presentation. the file name is toPortalNews.xsl.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="xml"/>
    <xsl:template match="/article">
        <article>
        </article>
    </xsl:template>
</xsl:stylesheet>

It is best to deal with the fields in order. The missing values will be defaulted:

  • Article/language: en-gb
  • Article/region: emea
  • Article/global: false
  • Article/category: news
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="xml"/>
    <xsl:template match="/article">
        <article>
            <language>en-gb</language>
            <region>emea</region>
            <global>false</global>
            <category>news</category>
        </article>
    </xsl:template>
</xsl:stylesheet>

For the other fields, I can select them and copy them directly as they are identical, using the xsl:copy command:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
 <xsl:output method="xml"/>
 <xsl:template match="/article">
 <article>
 <language>en-gb</language>
 <region>emea</region>
 <global>false</global>
 <category>news</category>
 <xsl:apply-templates select="title|date|sortdate|content|synopsis|image" />
 </article>
 </xsl:template>

 <xsl:template match="*">
 <xsl:copy>
 <xsl:apply-templates select="@*"/>
 <xsl:apply-templates />
 </xsl:copy>
 </xsl:template>

 <xsl:template match="@*">
 <xsl:copy />
 </xsl:template>

</xsl:stylesheet>

For the last field which has the same value but a different name, I can use a simple xsl:value-of and encase that in the new field. this goes after the xsl:apply-template command in my example.

<showImage><xsl:value-of select="displayImage"/></showImage>

and the result is

<?xml version=”1.0″ encoding=”UTF-8″?>
<article>
<language>en-gb</language>
<region>emea</region>
<global>false</global>
<category>news</category>
<title>lorem</title>
<date>01 January 1970</date>
<sortdate>01 January 1970</sortdate>
<content>&lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit.&lt;/p&gt;</content>
<synopsis>&lt;p&gt;Morbi feugiat nunc non urna auctor venenatis pulvinar nisi commodo.&lt;/p&gt;</synopsis>
<image>/resources/logo.gif</image>
<showImage>true</showImage>
</article>

In this post, I will list all the good language references I use. I will update thi post whenever I find a good one.

When you have a date field or any other date represented as strings and want to re-format them in a different format, it is still feasible to do so using XSL.

As an example, take the date “2009-08-14T00:00:00+09:00”. This is not very user friendly but “14 August 2009 “would be a lot more readable. Let’s start with a sample XML document to transform into HTML using XSL that we’ll call articles.xml.

<?xml version="1.0" ?>
<articles>
    <article>
        <title>Lorem ipsum dolor sit amet</articles>
        <description>Morbi elit quam, porttitor non aliquet ultrices, elementum quis erat. Nulla tempus lorem eget tortor accumsan cursus. Fusce quis massa laoreet mi suscipit rutrum. Duis id tincidunt eros. Aenean feugiat consectetur ligula vitae facilisis. Morbi dapibus velit eu mauris rutrum ut ornare lorem tempor. Aenean ut sapien a turpis imperdiet laoreet. Fusce iaculis, eros at ultricies vehicula, dui velit condimentum eros, a suscipit urna justo sed augue. Phasellus venenatis varius feugiat. Aliquam nec orci leo.</description>
        <date>2009-08-14T00:00:00+09:00</date>
    </article>
</articles>

Let’s create the first version of the XSL and we’ll save it in articles.xsl.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
 <xsl:output method="html"/>

 <xsl:template match="/">
 <html>
 <head>
 <title>newstylesheet.xsl</title>
 </head>
 <body>
 </body>
 </html>
 </xsl:template>

</xsl:stylesheet>

We can extract portions of the date uisng the substr function for day, month and year and we can use the call-templates functionality to display the proper month names (e.g. January) by passing the month number (e.g. 01) as a parameter to the template.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
 <xsl:output method="html"/>

 <xsl:template match="/articles">
 <html>
 <head>
 <title>newstylesheet.xsl</title>
 </head>
 <body>
 <xsl:apply-templates select="article" />
 </body>
 </html>
 </xsl:template>

<xsl:template match="article">
 <xsl:value-of select="title" /> (<xsl:apply-templates select="date" />)
</xsl:template>

<xsl:template match="date">

 <!--
 year: <xsl:value-of select="substring(.,1,4)" /><br />
 month:<xsl:value-of select="substring(.,6,2)" /><br />
 day: <xsl:value-of select="substring(.,9,2)" /><br />
 -->

 <xsl:value-of select="substring(.,9,2)" />
 <!-- replacing a month number by its month name -->
 <xsl:call-template name="number-to-month">
 <xsl:with-param name="month"><xsl:value-of select="substring(.,6,2)" /></xsl:with-param>
 </xsl:template>
 <xsl:value-of select="substring(.,1,4)" />
</xsl:template>

<!-- replaces a month number by its month name -->
<xsl:template name="number-to-month">
 <xsl:param name="month"/>
 <xsl:choose>
 <xsl:when test="$month = '01'">January</xsl:when>
 <xsl:when test="$month = '02'">February</xsl:when>
 <xsl:when test="$month = '03'">March</xsl:when>
 <xsl:when test="$month = '04'">April</xsl:when>
 <xsl:when test="$month = '05'">May</xsl:when>
 <xsl:when test="$month = '06'">June</xsl:when>
 <xsl:when test="$month = '07'">July</xsl:when>
 <xsl:when test="$month = '08'">August</xsl:when>
 <xsl:when test="$month = '09'">September</xsl:when>
 <xsl:when test="$month = '10'">October</xsl:when>
 <xsl:when test="$month = '11'">November</xsl:when>
 <xsl:when test="$month = '12'">December</xsl:when>
 </xsl:choose>
 </xsl:template>

</xsl:stylesheet>