Tuesday, 1 December 2009 by Rob
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.
Read the rest of this entry »
Posted in Cookbook, Python, Shells | Leave a Comment »
Saturday, 21 November 2009 by Rob
Running a simple script over a file containing a list of basic English words revealed the following (strict) ‘upwords’ and ‘downwords’, i.e. words with alphabetically or reverse-alphabetically ordered letters.
Read the rest of this entry »
Posted in English | Leave a Comment »
Saturday, 21 November 2009 by Rob
Running a simple script over a file containing a list of basic English words revealed the following groups of anagrams with at least 3 elements.
Read the rest of this entry »
Posted in English | 2 Comments »
Saturday, 21 November 2009 by Rob
Running a simple script over a file containing a list of basic English words revealed the following reversible pairs.
Read the rest of this entry »
Posted in English | Leave a Comment »
Friday, 20 November 2009 by Rob
Posted in English, Python | Leave a Comment »
Friday, 20 November 2009 by Rob
Posted in Subversion | Leave a Comment »
Friday, 30 October 2009 by Rob
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
Read the rest of this entry »
Posted in Cookbook, Shells | Leave a Comment »
Friday, 30 October 2009 by Rob
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.
Read the rest of this entry »
Posted in Cookbook, Shells | Leave a Comment »
Thursday, 22 October 2009 by Rob
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.
Read the rest of this entry »
Posted in Cookbook, Shells | Leave a Comment »
Wednesday, 21 October 2009 by Rob
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.
Read the rest of this entry »
Posted in Cookbook, Programming, Question / Unsolved | Leave a Comment »