I generally use my MacBook (running Mac OS X 10.5 Leopard) at work and it is essential for me to be able to print documents on my network printers attached to a Linux CUPS server (running CentOS Linux 5.3.)
What needs to be done on the Mac OS X Leopard computer
For some reason, Leopard cannot see printers shared by CUPS by default (it only sees Bonjour printers.) To rectify this, open a terminal and type:
sudo vi /etc/cups/cupsd.conf
and add “BrowseProtocols all” so that the file looks like this:
# Enable printer sharing and shared printers. Browsing On BrowseOrder allow,deny BrowseAllow all BrowseAddress @LOCAL BrowseProtocols all DefaultAuthType Basic <Location />  # Allow shared printing...  Order allow,deny  Allow @LOCAL </Location>
Then restart the CUPS daemon running on the Mac with
sudo launchctl unload /System/Library/LaunchDaemons/org.cups.cupsd.plist sudo launchctl load /System/Library/LaunchDaemons/org.cups.cupsd.plist
What needs to be done on the Linux server
Modify /etc/cups/cupsd.conf so that its beginning somewhat looks like this:
# Share local printers on the local network. Browsing On BrowseOrder allow,deny BrowseAddress @LOCAL DefaultAuthType Basic <Location />   # Allow shared printing...   Order allow,deny   Allow @LOCAL </Location>
and restart the CUPS server with one of:
/etc/init.d/cups restart /etc/init.d/cupsd restart
and everything should work from there. Go on your Mac and add your Linux printers in the usual way.
Printing generally works great but sometimes stop working when either the Mac or the Linux server are updated. What happens is that, during the update, the CUPS configuration (/etc/cups/cupsd.conf) gets slightly changed to something much more restrictive for security reasons (i.e. network printing is disabled.) I guess this is because both the Apple and Linux people think that it’s better be prudent than sorry especially in our era of fully opened Wifi network.
You’ve been warned :-)
sanjive says
Hello,
I’v one question wrt java…
Consider the following:
int x = 42;
How to get the memory address of X?
Please, can you provide some help?
avinash says
You can’t :-)
Incidentally, the default implementation of hashCode() returns the address of that object. For example,
Object o = new Object();
System.out.println(o.hashCode());
will print the address of o in memory. Unfortunately, hashCode() is overridden is a lot of subclasses of Object including Integer. This:
Integer n = 42;
System.out.println(n.hashCode());
prints 42! Yeah. I know. It’s a pity. But it’s consistent with what a hash function is supposed to be :-)
david says
Thanks. You can also make the changes via localhost:631 in administration and the cups server will be restarted automatically.
avinash says
Thanks :-)