JSTL String test oddity

I’ve come across this multiple times, and for some reason this always catches me out. You’d think being that EL has ‘eq’ and ‘ne’ operators that work with Strings that this should work:

<c:if test="${hello.name ne ''}">
    Hello <c:out value="${hello.name}"/>
</c:if>

This seems to make sense that it would do what you think it should do, but no, it always returns true. The code you’re looking for is using EL operator ’empty’:

<c:if test="${!empty hello.name}">
    Hello <c:out value="${hello.name}"/>
</c:if>

Git notes

Typical add/commit/push workflow:

#add local change ready to commit
git add .

#git commit changes to repo
git commit -m "commit message"

#push to remote repo
git push [optional remote repo name here, eg origin, etc]

Find changes committed locally compared with remote repo, i.e. to find what you’ve committed locally but not yet pushed:

git diff --stat [remote repo name]

List associated remote repos and their locations:

git remote -v

Add a new remote repo to an existing local app/repo:

git remote add remotename remote_git_repo_url

Adding the WordPress Multisite feature to an existing site

I’ve had this site as my main blog site for a number of years now, but I also keep another site for past projects that I’ve worked on. It’s been a static HTML site for a number of years and gone through a number of revisions, but I wanted to move it to WordPress to make it easier to edit changes directly on the site instead of the normal editing HTML and FTP’ing to the site workflow.

Since this site is already using WordPress, I thought I’d take a look at the Multisite feature to avoid having multiple installs on my Apache server. Turns out starting this late into the evening was probably not the best idea, but after a few hours I finally got it all fixed up. Here’s some key resources:

Key things that I learnt:

  • If you have an existing site, saw www.example.com and you follow all the steps in the above articles, using the subdomain approach you’ll end up with your existing domain as example.com and other sites as subdomain1.example.com, subdomain2.example.com etc. Not wanting to break existing links to my existing site at www.example.com, you could either put in place Apache rewriting, or the ¬†approach I took was to copy my previous posts across to a new subdomain mapped as the original URL, www.example.com
  • To set up the above:
    • export the existing posts using Tools/Export
    • Create a new site and map it to www.example.com
    • Import your exported data into the new site
    • You can now delete the original posts in the original site that’s now mapped to exmaple.com. If it makes sense, create new content for this top site.

Red Hat release OpenShift PaaS as opensource, and ability to run your own PaaS with OpenShift Origin

Yesterday Red Hat announced at the Open Cloud Conference in Sunnyvale, CA, the release of OpenShift as open source, and the ability to take OpenShift and use it to run your own PaaS.

What does this mean? Firstly, you can take the source for OpenShift and view or modify it (under the Apache 2 license) as you please. Secondly, if you have a need to run your systems using a private cloud model locally or hosted using your own hosting provider, you can take OpenShift and deploy it where ever you need, and still take advantage of the ability to dynamically provision/deploy apps and services using the OpenShift toolset.

This is very similar to the approach VMWare have taken with Micro Cloud Foundry, which is also open source, and also available so you can run the PaaS yourself.