January 5th, 2010 — Computers
Suppose you have a simple one line query to run on your Oracle database. Oddly, SQL*Plus doesn’t take SQL statements as a command line parameter.
For a simple one liner, it’s often too much work to start up sqlplus, logon, type in the SQL statement, then exit. It may also be too trivial to save the SQL statement to a file that you then call from sqlplus, e.g. C:\>sqlplus user/pass @myfile.sql.
To do it all in one line on the command prompt, echo the statement into sqlplus:
echo select count(*) from mytable; | sqlplus user/pass
This technique would probably also work on a Unix box, but I don’t have an Oracle db installed on a Unix box to test it out.
December 9th, 2009 — Computers
I’ve had Oil 101 in my Amazon.ca cart for a few weeks. Just not ready to read it yet. When I checked my cart today, I was unpleasantly surprised to read this note:
Please note that the price of Oil 101 has increased from CDN$ 23.20 to CDN$ 36.97 since you placed it in your Shopping Cart. Items in your cart will always reflect the most recent price displayed on their product detail pages.
How does Amazon justify boosting the price by almost 60% in just a couple of months? Perhaps, like the book’s subject, we’ve reached “Peak Books“…
May 5th, 2009 — Computers
Example using Cygwin gnu find, xargs and grep to search for a typo in XSLT and XML files. Note that -iregex matches a pattern in the whole path, and the pattern is a POSIX basic regex:
C:\>find ./ -iregex ‘.*\.\(xslt\^|xml\)’ -type f -print | xargs grep -i "staus"
When find matches a file path, the path is piped to xargs, which hands it off to grep to search for the string “staus” – which I want to replace with “status” (but not here :).
May 4th, 2009 — Computers, Society, Web 2.0, WordPress
Like Ruben, who provided the clues, I discovered that a corrupt/incompatible alternatives.lst.bz file in the C:\cygwin\etc\setup directory caused Cywin setup.exe to fail.
A few clues pointed to this file as the culprit:
- First time through, the installer complained that some other Cygwin process had locked the readme file
- the installer just looped indefinitely on extracting the README file from alternatives.lst.bz until I killed it
- The only .bz file in C:\cygwin\etc\setup with today’s date was alternatives.lst.bz.
Here’s what the log file recorded, for several thousand lines:
2009/05/04 11:01:23 io_stream_cygfile:
fopen(/etc/alternatives/README) failed 13 Permission denied
2009/05/04 11:01:23 Failed to open
cygfile:///etc/alternatives/README for writing.
I renamed the file to alternatives.lst.bz.bak , then reran setup.exe to successfully upgrade Cygwin.
Now I suppose I should log a bug report…
May 4th, 2009 — Computers
If the apropos command in Cygwin doesn’t find anything expected, run /usr/sbin/makewhatis from your Cygwin bash prompt to rebuild the whatis database.
Thanks to Mike and Igor for their tips.