Skip to content
accelerando

Category Archives: Shortcuts

Find all non “.java” files but not in .svn directories

19-Aug-10

I’m migrating some old projects to Maven and i need to move all resources out of the source tree.

find . -type d -name '\.svn' -prune -o -type f -not -iname "*.java" -print
  • Prune every directory named ‘.svn’
  • Or
  • Type is file and the name ends not with “*.java”

I tried to create the necessary directories within the same command but after about half an hour xargs trial and error, i’ll do it manually, the list of files is small enough ;)

Oracle NLS-Lang Settings

13-Aug-10

To use SQL*Plus Windows correctly, export NLS_LANG like so:

set NLS_LANG=GERMAN_GERMANY.WE8MSWIN1252

If you prefer the command line client SQL*Plus, export NLS_LANG like so:

set NLS_LANG=GERMAN_GERMANY.WE8PC850

Using SQL*Plus without tnsnames.ora

29-Mar-10

As often, a quick reminder for me. I’m using the Oracle Instaclient on my Mac without a tnsnames.ora and i keep forgetting the connectstring syntax:

sqlplus USER/PASS@//HOST:PORT/SID

Extra bonus points: Through in rlwrap to get a nice commandline history and completion as used to in a standard shell:

rlwrap sqlplus USER/PASS@//HOST:PORT/SID

SVN: Revert to previous version

09-Sep-09

Just a quick reminder:

To revert a complete working copy or a single file use:

svn merge -rHEAD:PREV .
# or
svn merge -rHEAD:PREV path/to/file
svn commit -m "reverted"

Batchconvert ascii to utf8

12-May-09

Next time i see umlauts in source, I’ll scream. Loud.

In the mean time I try this:

find . -iname "*.java" -exec sh -c 'iconv -f cp1252 -t utf-8 {} > {}.utf8' \;
for i in `(find . -name "*.utf8")`; do mv $i ${i/.utf8/}; done

Before you try this, make a backup of your files. It worked for me but i don’t guaranty that your files won’t vanish.

XML / XSD Schema validation on Mac OS X

16-Jan-09

I found no fancy graphical xml validator on OS X, but this isn’t a problem.

OS X includes libxml which comes with xmllint.

To validate a xml file against a schema:

xmllint --noout --schema sitemap.xsd sitemap.xml

Recursively md5sum all files in a directory tree

25-Oct-08

After a server crash a wanted to compare all actual files with the backuped data. An easy way is to compare the md5 hashes like that:

First create recursively md5 hashes from all files in that directory:

find ./backup -type f -print0 | xargs -0 md5sum > /checksums_backup.md5

Then check the actual data:

md5sum -c checksums_backup.md5

I was lucky, no files where damaged.

Sony Ericsson C702: Show received and send traffic

28-Jul-08

Once again, a quick reminder for myself: Howto display the internet traffic on your Sony Ericsson C702:

Menü, #, 4th Tab, 5

(On a german phone: “Einstellungen / Anrufe / Zeit und Kosten”)

I guess that works with other SEs like K800i and K850i.

I remember an old SE that i had which always displayed the traffic after ending an internet session, i wonder why they changed it.

Firefox 3 Mouse Wheel Zoom

08-Jul-08

Zooming with the CTRL+Mouse Wheel Up/Down has been in inversed in Firefox 3. In version 2 you zoomed in (enlarged the text) with CTRL+Mouse Wheel Down and zoomed out with CTRL+Mouse Wheel Up, its now in Firefox 3 the other way round.

The revert back to the old behaviour, change

mousewheel.withcontrolkey.numlines = 1

to

mousewheel.withcontrolkey.numlines = -1

in about config.

To me “pulling” the page towards myself always felt much more natural to me than the other way round, but that’s just me.

Oracle XE environment variables on Linux

04-Jun-08

Just a quick reminder for myself:

With the default installation of an Oracle Express (Oracle XE) comes two shell script with all the necessary environment variables to use sql*plus, exp, imp and the like on the command line:

source /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh

respectively

source /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.csh
Close
E-mail It