You are currently browsing the Carl's notes weblog archives for June, 2010.

Correct bounding box in EPS figures

Epstool works best for me, as suggested by La Consigna: how to export correctly from Matlab and how to fix bounding boxes with epstool. I needed to manually edit one of my eps figures to increase the bounding box to avoid part of the right hand border of the plot from being clipped.

epstool --copy --bbox input.eps output.eps

This also works for me but seemed to cause some ugly aliasing on the text:

eps2eps ugly_figure.eps nice_figure.eps

which can be put into a loop like this

for file in original/*.eps; do eps2eps $file fixed/`basename $file`; done

Another technique is:

cat figure.eps | ps2eps > figure2.eps

Thanks to Stephan for this. He wrote his tip for OpenOffice figures but it also works for Matlab figures that have too much white space around them and that mess up LaTeX documents.

There is a shell script called epscrop. It’s available from CTAN as part of the figfrag package. It doesn’t work for me. I get it mixed up with pdfcrop that I’ve mentioned in another post and which does work.

Not happy with the Buffalo Terastation III NAS

Just got an 8TB Buffalo Terastation III at work for storing research data and videos. It works more or less but there are plenty of bugs and missing features. Too late I’ve discovered that these shortcomings are mentioned in some of support forums. Maybe by including them here I can help others make a more informed decision.

  • All configuration must be done via a web interface. There is no command line interface. The web interface only works if I use the IP address, if I try to use the hostname I’m unable to log in. The Javascript used in the admin web pages makes them a bit slow.
  • Every time you change a setting all open connections are reset. Not good if someone was transferring a large file or using their share as a home directory.
  • Users and groups have to be created manually in the web interface or imported from Active Directory. There is no way to use a Linux based LDAP directory or to import an /etc/passwd file from a Unix system.
  • Permissions on the folders and files can only be set at the highest level in the web interface. Neither users nor the admin can change ownership or permissions of subfolders and files. This means that if a few users want to share the contents of a folder the admin needs to add them all to a group and then create a top level folder for which only this group has access. In order to give each user their own private folder the admin needs to give them each their own top level folder. They cannot choose to give access to any subfolders to other users. This is a lot of work for the admin and forces them to create a new top level folder for every new user/project/set of permissions.
  • If you connect by SFTP you will not be able to access folders for which you have access via a group. The system will ignore the fact that you belong to certain groups and will deny access to folders which that group should be allowed to access. To access them the admin must give access to individual users, not groups. This is only a problem for SFTP, not for Samba or AFP shares.
  • SFTP doesn’t provide all the expected features, for instance it doesn’t recognize df or allow you to list more than one subdirectory down (ls folder1/folder2 doesn’t work, you have to cd to folder1).
  • Windows shares aren’t accessible from Windows Vista or Windows 7 until you apply a change to the security settings. See the relevant post on DigitalQuery.
  • It would be nice for users to be able to login using SSL keys.
  • Firmware upgrades have to be performed from a Windows machine on the same subnet as the NAS. Not very convenient since all my machines run Linux and the NAS is locked away in a server room and connected to a different subnet.

Apparently there were ways to log into previous models via Telnet and SSH but I’m not sure about the Terastation III. See BigDiver’s blog post.

There’s a Java tool called acp_commander to enable Telnet access available from NAS Central. I haven’t been able to use this, perhaps because it’s not compatible with the Terastation III, or perhaps because my workstation is on a separate subnet from the NAS.

You can use the Terastation to rsync files from your workstation. This is actually designed to allow syncing Terastations between each other but it also works from a workstation or server. See instructions by Arne Brodowski. This works but I haven’t been able to restrict access via rsync. There’s a field to set a backup password but then I can’t perform any sync at all.

Not much info on the Buffalo forums except for comments saying that lots of features aren’t available and most likely won’t be implemented. In addition to the tech forums they have something called the Idea Exchange Lounge where users can submit feature requests but there wasn’t much about Terastations.

A post by Volker Weber explaining how to use the Terastation as an Apple Time Machine target. No idea whether this works but sounds like it’s risky. Can’t figure out whether the shares need to be mounted or if Time Machine has it’s own network protocol for transferring files.

Using Git and Gitosis.

Git is the version control software, gitosis is the wrapper that manages permissions on the repositories.

Ask the admin to give access to the appropriate users. The admin will need the public keys of all the users and the name of the repository.

You can then create the repository yourself.

mkdir project
cd project
git init
git remote add origin gitosis@eis.comp.lancs.ac.uk:Thatproject.git
touch tmp # you must add some files or the push will fail
git add tmp
git push origin master:refs/heads/master
git commit -a -m "first commit"

Then other users can operate as follows.
Get code from a repository.

git clone gitosis@eis.comp.lancs.ac.uk:Thatproject.git

Make some changes.
Use git add if adding new files to version control.
Commit and push to the server.

git commit -a -m "My commit message"
git push

Pull changes from the server from time to time.

git pull

My username and hostname aren’t very informative so I tell git about my real name and e-mail address.

git config --global user.name "Carl Fischer"
git config --global user.email "my.email@example.com"

I occasionally get the following error which was solved by deleting the local repository and cloning it afresh from the server.

You asked me to pull without telling me which branch you
want to merge with, and 'branch.master.merge' in
your configuration file does not tell me, either. Please
specify which branch you want to use on the command line and
try again (e.g. 'git pull <repository> <refspec>').

Git and Gitosis admin

Install the git-core and gitosis packages.
Don’t create a git user because the Debian gitosis package will create its own gitosis user when it’s installed.
If you don’t already have a keypair have a look at the Dreamhost wiki.
Then copy your public key .ssh/id_rsa.pub to the server.
Initialise the gitosis repository.

sudo -H -u gitosis gitosis-init < id_rsa.pub

Return to your workstation and get the gitosis configuration files from the server.

git clone gitosis@eis.comp.lancs.ac.uk:gitosis-admin.git

Add public keys into gitosis-admin/keydir and edit gitosis-admin/gitosis.conf to allow new users to administer gitosis or to give permissions on new repositories.
Save changes to the gitosis configuration by committing (locally) and pushing (to the server).

git add keydir/Whatshisname@hismachine.pub
git commit -a -m "Give Whatshisname write access to Thatproject"
git push

Create a new repository on your local machine.

mkdir Thatproject
cd Thatproject
git init
git remote add origin gitosis@eis.comp.lancs.ac.uk:Thatproject.git
touch tmp # you must add some files or the push will fail
git add tmp
git push origin master:refs/heads/master
git commit -a -m "first commit"

Clone it from the server onto the workstation of a user who has access to the repo.

git clone gitosis@eis.comp.lancs.ac.uk:Thatproject.git

Then use it.

Trying to push a new and empty repository will fail with error: src refspec master does not match any.

I was getting the error gitosis.serve.main repository read access denied when trying to clone the repository from another machine because I hadn’t completed the edit-add-commit-push cycle for the gitosis-admin repository.

A bunch of articles on Git.

  • http://sunoano.name/ws/public_xhtml/scm.html#provide_a_git_repository_to_the_public
  • http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way
  • http://www.hackido.com/2010/01/installing-git-on-server-ubuntu-or.html
  • http://wiki.dreamhost.com/Gitosis