Tag Archives: tips

Sibling Tabs User Macro for Atlassian Confluence

The sibling tabs user macro for Confluence gives a simple way to create a horizontal tabbed navigation system between sibling pages in a Confluence space.

Here’s a video demo:

Here’s the code and how to apply it to your Confluence system:

In Confluence Admin | User Macros, create a new user macro and paste in:

Simply add the Sibling Tabs user macro whenever you want horizontal tabs — don’t forget to att the macro to each of the pages 😉

 


The AppFusions team provides tough-problem expert-level product development and consulting servicesOur portfolio of solutions is a prime example of our expertise, aside from much other community involvement. Nonetheless, we are only at the beginning of our journey.

Please reach out any time. We know we can help you – it is our relentless obsession and passion!

Gister for Confluence – Effortlessly embed gists into Atlassian Confluence

Announcing Gister for Confluence, a new Confluence add-on that does just one thing. Effortlessly.

Gist is a simple way to share snippets and pastes with others. All gists are Git repositories, so they are automatically versionedforkable and usable from Git.

Got a gist on Github?

Want to embed it in Confluence?

Paste the gist URL into the Confluence editor and your gist will automatically be embedded using the Gist macro.

 

Here’s how it works:

What does it cost? Nothing at all. Have this one on me.

Get Gister for Confluence for free

Works with Confluence 5.2 and up.

 


The AppFusions team provides tough-problem expert-level product development and consulting servicesOur portfolio of solutions is a prime example of our expertise, aside from much other community involvement. Nonetheless, we are only at the beginning of our journey.

Please reach out any time. We know we can help you – it is our relentless obsession and passion!

Searching Atlassian JIRA from an external website

Following on from a previous post about searching Confluence from an external website, I’ve forked the code to search JIRA instead.

Atlassian JIRAThis very simple PHP code searches a remote JIRA server by querying the JIRA search REST API, the formats the results into a neat list.

Here’s a walk through video demonstration of the code and the resulting web page:

The source code in available on Bitbucket here.

Fork it. Adapt it. Secure it.

Let me know how you’ve used it 😉

 


The AppFusions team provides tough-problem expert-level product development and consulting servicesOur portfolio of solutions is a prime example of our expertise, aside from much other community involvement. Nonetheless, we are only at the beginning of our journey.

Please reach out any time. We know we can help you – it is our relentless obsession and passion!

How to disable the Popular tab on the dashboard page in Atlassian Confluence

Dalai Lama
..sprecken of “popular” .. Dalai Lama

 

The Popular tab on the dashboard of Atlassian Confluence displays:

  • Pages, blog posts and comments that people have recently liked.
  • Pages and blog posts that people have recently commented on, and threaded comments that people have recently replied to.
  • Pages and blog posts that have recently been created.

A fresh installation will display a helpful “Welcome, looks like you’re new here” section – as shown below.

Some companies do not want this functionality and want to know how it can be turned off.

It’s very easy to remove this functionality, as it is based on an add-on module that can simply be disabled.

Here’s how:

  • Browse to Confluence Admin | Atlassian Marketplace | Manage Add-ons
  • Filter for “dash” in “System” add-ons
  • Expand the Dashboard Macros add-on
  • Expand the 14 of 14 modules enabled link
  • Disable the Popular Tab (popular-tab) module

Having stepped through this process, the Popular tab will no longer be displayed. Simple.

 


The AppFusions team provides tough-problem expert-level product development and consulting servicesOur portfolio of solutions is a prime example of our expertise, aside from much other community involvement.

Nonetheless, we are only at the beginning of our journey. Please reach out any time. We know we can help you – it is our relentless obsession and passion!

How to move the Confluence “Create” button back to the pre-Confluence 5 location

The Good Old Days
Those were the good ol days..

Upon release of Confluence 5, I really couldn’t handle the new location for the “Create button”.  A few months in, I’m happy and it now seems natural, but for users making the change, it can seem counter-intuitive.

Several clients have asked how to get the create button back to where “it should be”. This is a hack to do just that.

 

Browse to Confluence Admin | Look and Feel | Custom HTML | At the END of the BODY and paste the following:

 

Save and you’re back to the “good old days”:

 


The AppFusions team provides tough-problem expert-level product development and consulting servicesOur portfolio of solutions is a prime example of our expertise, aside from much other community involvement. Nonetheless, we are only at the beginning of our journey.

Please reach out any time. We know we can help you – it is our relentless obsession and passion!

Searching Atlassian Confluence from an external website

Oliver Marshall asks:

We’re looking at using Confluence for an internal and external knowledgebase. A number of our suppliers use it, so we’re happy it does what we want.

However we want our customers to find common wiki entries via our website, where we send them for various bits of info at the moment.

Other KB/Wiki tools we’ve looked at provide a javascript widget we can include in the site which will give us a CSS’able search box and results. That works nicely.

At a push I’d take the ability to use an iFrame on our site pointing to a basic page with no Confluence navbars or headers (just the page and search bar).

Anyone got any comments or feedback at all on this? Our site is in WordPress if that helps.

This post offers a possible complete working solution for Oliver’s task using PHP.

Here’s a video demonstrating how:

Here’s the source code.

The code reuses the REST API for the quick search dropdown in the standard Confluence search field and as such only returns the first 6 results. You could of course change this to use a different REST API.

 


The AppFusions team provides tough-problem expert-level product development and consulting servicesOur portfolio of solutions is a prime example of our expertise, aside from much other community involvement. Nonetheless, we are only at the beginning of our journey.

Please reach out any time. We know we can help you – it is our relentless obsession and passion!

ScalaTest vs Specs2

Setting out to write some unit tests in Scala, I was faced with a problem that many others must have faced: which testing framework to build upon.

ScalaTest Wanting to embue my tests with a particularly Scala-some flavour, I discarded the option of using JUnit directly, narrowing the field to ScalaTest and Specs2.

I asked the question on Twitter,
specs2

How do I choose between Specs2 and ScalaTest?

and received answers (not only on Twitter) from the authors of both frameworks.

I also heard podcast interviews with both Bill Venners (ScalaTest) and Eric Torreborre (Specs2). It’s great to know that for both frameworks, constructive, friendly help is only a tweet away.

In the end, I figured that the only way to make my choice, was to implement a test first in one framework, and then in the other, and see how I felt about the results. So here it is.

Enterprise Directory and Org Chart for Atlassian ConfluenceThe test is very simple in its goals. It tests a Java class that is part of an AppFusions product called Enterprise Directory and Org Chart for Confluence. It tests that a certain condition is true after each of four different method calls. The test logic is trivial, but there is a non-trivial fixture; not an unusual testing scenario for many web application developers, I imagine. I’m using Mockito for the mock objects.

I hope that I’ve done each framework justice. In any case, my situation will be that of many a budding Scala programmer: limited time in which to read the relevant documentation, and come up with something that seems idiomatic.

First, the test written with Specs2. I’ve not shown the import statements, since they didn’t weigh into my decision-making process.

class EnterpriseDirectoryActionSpec extends Specification { def is = s2"""
  An enterprise directory action should provide enabled fields
    after a call to doDefault                                        ${fixture().e1}
    after a call to doSearchPrevious                                 ${fixture().e2}
    after a call to doSearchNext                                     ${fixture().e3}
    after a call to doExecuteSearch                                  ${fixture().e4}
    """

  case class fixture() extends Mockito {
    val fields = Seq("one", "two", "three")

    // some mock objects
    val directoryManager = mock[EnterpriseDirectoryManager]
    directoryManager.isLicenseValid returns true
    directoryManager.getEnabledFields returns fields.asJava
    directoryManager.shouldShowOrgChart("fred") returns true

    val user = mock[User]
    user.getName returns "fred"

    val sessionAccessor = mock[SessionAccessor]
    sessionAccessor.getSession returns mock[HttpSession]

    /** an instance of the class under test */
    val action = new EnterpriseDirectoryAction
    action.setEnterpriseDirectoryManager(directoryManager)
    action.setSessionAccessor(sessionAccessor)

    AuthenticatedUserThreadLocal.setUser(user)
    def e1 = { action.doDefault(); checkEnabledFields }
    def e2 = { action.doSearchPrevious(); checkEnabledFields }
    def e3 = { action.doSearchNext(); checkEnabledFields }

    def e4 = {
      action.setLastName("Bloggs")
      action.doExecuteSearch()
      checkEnabledFields
    }

    def checkEnabledFields = action.getEnabledFields.asScala must containTheSameElementsAs(fields)
  }
}

And now for the same test, written using ScalaTest.

class EnterpriseDirectoryActionFlatSpec extends FlatSpec with ShouldMatchers with MockitoSugar {
  def fixture = new {
    val fields = Seq("one", "two", "three")

    // some mock objects
    val directoryManager = mock[EnterpriseDirectoryManager]
    when(directoryManager.isLicenseValid).thenReturn(true)
    when(directoryManager.getEnabledFields).thenReturn(fields.asJava)
    when(directoryManager.shouldShowOrgChart("fred")).thenReturn(true)

    val user = mock[User]
    when(user.getName).thenReturn("fred")

    val sessionAccessor = mock[SessionAccessor]
    when(sessionAccessor.getSession).thenReturn(mock[HttpSession])

    /** an instance of the class under test */
    val action = new EnterpriseDirectoryAction
    action.setEnterpriseDirectoryManager(directoryManager)
    action.setSessionAccessor(sessionAccessor)

    AuthenticatedUserThreadLocal.setUser(user)
  }

  "An enterprise directory action" should "provide enabled fields after a call to doDefault" in {
    val f = fixture
    f.action.doDefault()
    f.action.getEnabledFields.asScala should be (f.fields)
  }

  it should "provide enabled fields after a call to doSearchPrevious" in {
    val f = fixture
    f.action.doSearchPrevious()
    f.action.getEnabledFields.asScala should be (f.fields)
  }

  it should "provide enabled fields after a call to doSearchNext" in {
    val f = fixture
    f.action.doSearchNext()
    f.action.getEnabledFields.asScala should be (f.fields)
  }

  it should "provide enabled fields after a call to doExecuteSearch" in {
    val f = fixture
    f.action.setLastName("Bloggs")
    f.action.doExecuteSearch()
    f.action.getEnabledFields.asScala should be (f.fields)
  }
}

So there you have it. I think I prefer the ScalaTest version, but that may be because it most closely resembles the JUnit-style tests that I’m familiar with. Although slightly more verbose, I figure that it will also be the most comfortable for my colleagues, who I hope will want to experiement with Scala too. Even with the recently-introduced string interpolation in Specs2, I find the manner of specifying test examples in a column on the right-hand side of my test conditions a bit awkward. Yes, it is possible to embed test conditions with the text – described in the Specs2 documentation as unit-testing-style test specification – but then mixing in the Mockito sugar seemed like a tricky business.

Specs2 does appeal from the somewhat philosophical point of view of cleaving more closely to the immutability everywhere ideal, but heck, in this case I’ll sacrifice that notional purity for niceness.

Twelve Helpful git Videos

This is another in our discussion on DVCS and git (see our git category in the right column for more). We see DVCS and git as a major transformation in how software is created.  There are so many videos on git that they deserved a separate post.

Here, we have provided a listing of videos on git, the free and open source tool that is so popular DVCS environments.

Linus Torvalds
  1. Tech Talk: Linus Torvalds on git – Video (10:15) Linus Torvalds visits Google to share his thoughts on git, the source control management system he created two years ago.
  2. git in One Hour – Video (1:00:21) by O’Reilly Media provides an overview of git.
  3. Please. Stop Using git. – Video (5:26) parody by Matthew McCullough.
  4. What’s so good about git – Video (10:20) by Zoë Blade
  5. How to use git – installation – First is a series of video tutorials by @thejacenxpress. This one (7:20) covers installation.
  6. How to use git – add, commit, push, pull, status – Another in a series of video tutorials by @thejacenxpress. This one (9:12) covers add, commit, push, pull, status.
  7. How to use git – history – Another in a series of video tutorials by @thejacenxpress. This one (9:59) covers git history (log, reflog, show, gitk, checkout, reset).
  8. How to use git – basic file flow, rm, add, commit, gitignore – Another in a series of video tutorials by @thejacenxpress. This one (9:58) covers basic file flow, rm, add, commit, gitignore.
  9. How to use git – setting up a user account – Another in a series of video tutorials by @thejacenxpress. This one (9:50) covers setting up a user account.
  10. How to use git – merge conflicts – Another in a series of video tutorials by @thejacenxpress. This one (9:25) covers merge conflicts.
  11. How to use git – more merge conflicts – Another in a series of video tutorials by @thejacenxpress. This one (10:01) covers more merge conflicts.
  12. How to use git – branch, checkout, remote – Another in a series of video tutorials by @thejacenxpress. This one (9:20) covers branch, checkout, and remote.

 


The AppFusions team provides tough-problem expert-level product development and consulting servicesOur portfolio of solutions is a prime example of our expertise, aside from much other community involvement. Nonetheless, we are only at the beginning of our journey.

Atlassian Stash

Please reach out any time. We know we can help you – it is our relentless obsession and passion!