Single-Language Internationalization: Spellcheck Basis

Uncategorized Comments Off on Single-Language Internationalization: Spellcheck Basis

Even if a project has only one language — ie has not yet been considered for internationalization — an internationalization message catalog can give benefits such as sanity-checking the text that is not subject to compiler cross-check. I’d like to look at the effort to do this in my own work.

I’m a big fan of things that can be automated, or that enable other capabilities without much effort. For example, I tend to recommend checking for a compatible standard rather than willy-nilly inventing a new one on the off-chance that accidental compatibility is reached (“hey, they use Dublin-Core, and we use Dublin-Core, we can use their text-manipulation tools with our outputs! We can work together without a code change!”)

By extracting the visible strings of text form an application, it’s possible to consider them en-masse even before translation. Messages can be more consistent (tense, tone, dialect). Additionally, it may be possible to spellcheck.

Case-in-point:

Spelling anyone?

“Yosemite”

Rsync Over FTP, read-write, on a Mac or BSD Client

howto Comments Off on Rsync Over FTP, read-write, on a Mac or BSD Client

Recently I was discussing with someone the need to simplify the sync of a folder into an FTP server. The goal is that at set intervals, any change in a local folder is pushed to a remote folder: changes changed, new files created, removed files removed. Similar to yesterday’s article, except this is a read-write access to the FTP server, allowing either direction of sync.

This is how to do it using curlftpfs and rsync.

The general idea is to use the curlftpfs almost like FUSE-mounting a remote resource, then using rsync on that mounted filesystem. Like yesterday, we use mktemp to work relatively portably in a temp folder.

The exult would be something like this:

  • local folder: ${HOME}/contrib
  • remote server: ftp.example.com
  • remote folder: ./Scott/ABC
  • remote user: scott
  • remote pass: tiger
# create a temporary/random mountpoint
TEMPFILE=$(mktemp -d -t ftprsync)

# mount the remote space
sudo curlftpfs -o rw ftp://scott:tiger@ftp.myserver.com/Scott/ABC ${TEMPFILE}

# sync
rsync -avr --delete-after ${TEMPFILE}/* ${HOME}/contrib

#shut it down
sudo umount ${TEMPFILE}
rm -fr ${TEMPFILE}

Similar to the method used with mount_ftp, curlftpfs will use a URL-encoded user/pass. Additionally, curlftpfs will allow -o options to provide username and password.

The issue with this method is that obtaining the curlftpfs for MacOSX is problematic: it’s based on glib-2.0, and glib itself has a bit of a dependency to build. As well, it uses pkg-config which is still not a standard part of Apple Xcode CLI tools, but if you have glib-2.0 built, then you’ve already got pkg-config working (glib is heavily dependent)

In my own experience, curlftpfs is quite function, and plays very well with the automount config; the problem is that on very long distance connections, it seems to choke quite often during the sync. I would recommend using this method for low-lartency connections to legacy servers, and for longer-hauls, work on getting rsync able to connect directly without using FUSE to indirectly map to FTP.

…so the task right now is to build curlftpfs, or find a functioning binary.

Rsync Over FTP, on a Mac or BSD Client

howto, Uncategorized Comments Off on Rsync Over FTP, on a Mac or BSD Client

Recently I was discussing with someone the need to simplify the sync of a folder into an FTP server. The goal is that at set intervals, any change in a remote server is pulled to q local folder: changes changed, new files created, removed files removed. This is that kind of thing that should be easier, but it’s mixing an old technology (rsync) with a very, very old technology (FTP).

This is how to do it using mount_ftp and rsync.

The general idea is to use the mount_ftp almost like FUSE-mounting a remote resource, then using rsync on that mounted filesystem. If we wrap it around mktemp to work relatively portably in a temp folder, we’d have something like this:

  • local folder: ${HOME}/contrib
  • remote server: ftp.example.com
  • remote folder: ./Scott/ABC
  • remote user: scott
  • remote pass: tiger
# create a temporary/random mountpoint
TEMPFILE=$(mktemp -d -t ftprsync)

# mount the remote space; no output, but the return code matches errno.h values
sudo mount_ftp -o rw ftp://scott:tiger@ftp.example.com/Scott/ABC ${TEMPFILE} ; echo $?

# sadly, despite best efforts (and "-o rw"), this is only a read-only, so only good
# for syncing FTP content out to the local system

# sync
rsync -avr --delete-after ${TEMPFILE}/* ${HOME}/contrib

#shut it down
sudo umount ${TEMPFILE}
rm -fr ${TEMPFILE}

Java getOutputStream() surprises

Uncategorized Comments Off on Java getOutputStream() surprises

As a not to my future self, apparently you need to open the connection before setting doOutput:

URLConnection connection = url.openConnection();
connection.setDoOutput(true);

return connection.getOutputStream();

It’s a good thing that’s poorly documented and non-obvious, and that it fails in misleading ways.

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in