How to exclude directories with tar

October 27, 2008 at 8:57

Filed under: Computing — Pistos @ 08:57

For a long time I had been unable to determine just how to exclude directories from a tarring operation. Surface googleage never helped. I have, however, (with some help) finally determined how to do this rather smoothly. Given a directory tree structure like this

/wanted-dir-1 /wanted-dir-1/wanted-subdir-1 /wanted-dir-1/wanted-subdir-2 /wanted-dir-1/unwanted-subdir-1 /wanted-dir-1/wanted-subdir-3 /wanted-dir-1/unwanted-subdir-2 …..

Your syntax should be as follows:

tar cjvf tarball.tar.bz2 –exclude unwanted-subdir-1 \ [--exclude unwanted-subdir-2...] wanted-dir-1 \ [wanted-dir-2...]

The critical part that I was not cluing into was that the ‘f’ option/command of tar expected the tarball filename (tarball.tar.bz2 in the above example) to immediately follow it. For example, this will NOT work:

tar cjvf –exclude unwanted-dir tarball.tar.bz2 \ wanted-dir

and it will, in fact, create a file literally named “–exclude” in the current directory.

Hope this helps some frustrated souls.

Share

Diakonos – version 0.8.5

October 3, 2008 at 12:56

Filed under: Computing — Pistos @ 12:56

Version 0.8.5 of Diakonos is now available. Install by gem install diakonos. I’m pleased to introduce several nice features in this version.

If your terminal supports 256 colours, Diakonos syntax highlighting can now employ 256 colours (instead of the usual 16). See diakonos-256-colour.conf which comes with the 0.8.5 package.

I have also added the ability to synchronize the Diakonos clipboard with the KDE clipboard (via DCOP and Klipper). If you are using KDE and have DCOP installed, activate this feature by using these lines which are commented out in the default configuration file.

Some of you may also have noticed that I’ve recently overhauled the Diakonos homepage. Have a look if you haven’t already!

The other changes are detailed in the actual changelog:

  • Added 256 colour support.
  • Added support for opening files with “filepath:linenumber” syntax.
  • Added ability to put %_ in a code closer as the place to position the cursor.
  • Code closers can now contain newlines.
  • Now closer text is parsed-indented by default.
  • Added integration with Klipper (KDE clipboard).
  • Added support for regexp match placeholders (\1, \2, etc.) in findAndReplace.
  • Added eol_behaviour setting.
  • Various minor bug fixes.
  • Changed to MIT licence.

Report any bugs here.

Share

Ramaze + Phusion Passenger

October 2, 2008 at 14:14

Filed under: Computing — Pistos @ 14:14

As some of you may know, I am a relatively active member of the Ramaze community. I have seen an increase in incidents of people asking for help getting Ramaze to run under Phusion Passenger. I decided to see just how hard the setup would be, with the intention of documenting it for the Ramaze community. I succeeded in running a basic Hello World application, so here are the steps I took.

Create a simple Ramaze app

Even if you have an existing Ramaze app that you will use instead of this little demo app, you should read this section because I talk about important pitfalls that can cause things to break. You can apply the same ideas to your app.

As per the Passenger User’s Guide, I created a tmp/ directory under the root of the Ramaze app. Passenger needs this directory (see the User Guide if you want to know why). I also made a public/ directory, which is a standard part of Ramaze apps in general.

Afterwards, I crafted a basic one-file Ramaze app in start.rb (the standard filename for the executable in Ramaze apps), and a config.ru file, which is needed by Rack. (Rack is the interface layer between Ramaze and Apache.)

start.rb

require 'ramaze'
class MainController < Ramaze::Controller
  def index
    'hi'
  end
end

A critical thing to note about this Ramaze app is that there is no Ramaze.start command. If you put it, the whole jalopy will fall apart — so don’t put that in your app. If you have a legacy app that you want to start running under Passenger, comment out or remove the existing Ramaze.start line.

config.ru

require 'start'
Ramaze.trait[:essentials].delete Ramaze::Adapter
Ramaze.start!
run Ramaze::Adapter::Base

This is the standard “rackup” file that comes with Ramaze. I didn’t make any changes to it, but I should point out that the rackup file that was shown on the Passenger site was out of date.

Overview

So, to recap, my basic little app had these four things:

public/
tmp/
config.ru
start.rb

Install Passenger

If you are intending to run a Ramaze app under a web host that already offers Passenger to its users, you can obviously skip this section.

As per the Install page of the Passenger website, I simply ran

gem install passenger

and

passenger-install-apache2-module

I did this as root, but it looks possible to do so as a non-root user. The Passenger installation script was straight forward, and required no interaction on my part other than to confirm my desire to proceed with the installation. It is sufficiently verbose enough for you to see it compile and install things under your /usr/lib/ruby tree. When it’s done, it clearly displays some lines for you to put into your Apache configuration file. In my case:

LoadModule passenger_module /usr/lib/ruby/…./mod_passenger.so PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3 PassengerRuby /usr/bin/ruby18

I obediently pasted that into the main Apache config. It then shows a sample virtual host configuration that you can use as a skeleton:

ServerName www.yourhost.com DocumentRoot /somewhere/public

I copied that into my virtual host config file, and adjusted the hostname and changed the document root to the full, absolute path of the public/ directory of my Ramaze app.

Restart Apache

I restarted Apache to get all my configuration changes active.

Run the app

At this point, my Ramaze app was ready to run under Passenger, so I browsed to http://myhostname and saw “hi” displayed, as expected. To see a little detail (or to troubleshoot problems), examine your Apache logs. You should see all output from Ramaze piped there.

I hope this helps people who are trying to run Ramaze under Passenger! If you need further assistance please visit our support channel, #ramaze on the FreeNode IRC network, or try the discussion group.

Share

Don't try this in Firefox

October 1, 2008 at 12:38

Filed under: Computing — Pistos @ 12:38

Try the live demo of a Firefox trap, or read on first. I recommend not visiting that page with Firefox.

I was doing some Javascript debugging today, and observed what I think is a design flaw in Firefox (and perhaps in GUI applications in general). The Firefox alert box is modal. From Wikipedia:

(more…)

Share

There is no such thing as right or wrong!

October 1, 2008 at 7:41

Filed under: Religion — Pistos @ 07:41

I was musing recently about subjective morality, and thought of something that I found rather amusing:

“There is no such thing as right or wrong.”<br/> [ ] Right   [ ] Wrong

:)

Share
Powered by WordPress.