Archive for the ‘Cookbook’ Category

Disabling Ubuntu Unity’s Global Menu Bar

Wednesday, 13 June 2012

It’s goodbye Windoze, hello Linux.

Well, nearly. I have now started using Ubuntu in anger for commercial development, and have started to find going back to Windows 7 on my home machine relatively painful.

However, there are a couple of things in Ubuntu Unity that I can’t get on with. The main one is the Global Menu Bar; that is, the menu for an application appearing only in the top title bar for the desktop, rather than at the top of the application’s window.

Solutions to this problem are described elsewhere on the web, but instructions vary. I wanted to make as minor a change as possible.

(more…)

Advertisements

SVN Tip: Find/Grep but excluding .svn (Linux)

Saturday, 5 February 2011

Here I give Linux commands to allow the searching for filenames or strings within files without descending into the <.svn> subdirectories.

(more…)

SVN Tip: Uniform Hook Script Wrappers

Saturday, 31 July 2010

If you have a collection of SVN repositories with common hook scripts, it makes sense to have a single copy of them in a separate directory (say _common_/) alongside the repository directories.

The hook files can then just be ‘wrappers’ that call out to the real scripts. To make things really easy, there’s no reason why those wrappers couldn’t be identical.

(more…)

Absolute, Relative, and Splitting Paths in Bash

Tuesday, 1 December 2009

The main stumbling block with splitting paths in Bash is converting a relative path into an absolute one.

Searching the Internet I found many partial solutions, but none was entirely satisfactory. There may be a better solution out there, but I didn’t find it.

(more…)

Batch / Bash: Output to STDERR

Friday, 30 October 2009

To output a message to the error stream in a batch file, simply do this:

echo your message text 1>&2

Similar syntax may be used in Bash shell scripts:

echo "your message text" 1>&2

(more…)

Batch: Comparing Files

Friday, 30 October 2009
The trick to testing file contents is to do something like this:

( fc /B "%file1%" "%file2%" | find "FC: no differences encountered" ) > nul && (
  echo "%file1%" and "%file2%" are the same
) || (
  echo "%file1%" and "%file2%" are different
)

using conditional execution.

(more…)

Batch: Testing for Empty Directories

Thursday, 22 October 2009

To test whether a directory (or “folder”) is empty, the code

if exist "%dir%\*.*" (
  echo %dir% is non-empty
) else (
  echo %dir% is empty
)

does not work; it always reports “non-empty”.

The trick

( dir /b /a "%dir%" | findstr . ) > nul && (
  echo %dir% non-empty
) || (
  echo %dir% empty
)

using conditional execution, however, does work.

(more…)

JSP & JSTL: Setting a Variable to the Content of an XPath

Wednesday, 21 October 2009

I had a problem in JSP and JSTL where I could not get a core variable to contain the content of an XML XPath expression.

Following a combination of reading a book, searching the Internet and speaking to a colleague, I found two solutions to my problem, but unfortunately not an answer to the question of why my original code does not work.

(more…)

SVNMUCC: Co-tagging and Co-branching

Monday, 19 October 2009

In a previous post, I mentioned co-tagging.

Here are a couple of scripts, one Bash shell script, and the equivalent DOS Batch file, to assist with co-tagging and similarly with co-branching.

(more…)

SVN: Partial Checkouts

Monday, 19 October 2009

It is often useful to be able to partially checkout a project or a subset of related projects from a repository. Having such a partial working copy may be helpful to allow the joint commit of related changes to more than one project. Thus helps to “tie” the changes in the projects’ histories.

Here are a couple of scripts to assist that process: one Bash shell script, and the equivalent DOS Batch file.

(more…)