Saturday, August 30, 2008

How to print to a windows printer from linux

I have been struggling to set this up. I found a nice tutorial in the Internet.

Printer Sharing: Windows Print Server for Linux Clients

In short, the steps are

  1. Enable Windows support for Unix printing: Open Control Panel --> Add or remove programs --> Add/remove windows components. Scroll down to "Other Network File & Print Services".icon Highlight that and select "details". Put a check mark in "Print Services for Unix" and OK/Next or whatever.
  2. Now that Unix services are installed, you activate them as a service: Open Control Panel --> Administrative Tools --> Services (Local) and find icon TCP/IP print server. It should be set to "Status= started" and "Start type=Automatic". To change settings you double click the line "TCP/IP print server" and adjust appropriately.
  3. Install CUPS and use lpd.
  4. You should be able to fire a test page from your linux machine.
I tested it from my ubuntu 8.04 to a windows XP machine having a HP LaserJet printer.

Wednesday, July 9, 2008

to Ubuntu from Debian

I was a strong debian user. Have been using it for the last 11 years. But then I moved to Ubuntu last week :)

All this started when I found ruby to be very interesting. As usual, I was an emacs fan and used emacs for ruby too. Problems came when I wanted to install some lisp package for rails support. The new package said, it will work with only emacs 22.

Ok, got an emacs22 backport but then it wont work with auctex, my favorite latex support package for emacs.

Installed eclipse. But then rdt and Aptana studio and radrails are not working. Downloaded the latest eclipse and tried the same..still not working...

It was then my friends said, they are using eclipse with Ubuntu.

In one day moved to Ubuntu.......after living with Debian for around 11 years :(

Had to spent a day for configuring my apps...I think it was worth. To quote my learned friend, "Ubuntu is better for developers while debian stable may be used for big servers". Thats it.

I think moving to ubuntu was a good choice....


How to archive outgoing emails

Archiving incoming mails in a linux system is easily done with procmail. This article shows how to archive outgoing emails.

It is easy whether you have postfix or sendmail as your mail transport agent.

With Postfix

There is an option named "always_bcc". You may set it like this:

always_bcc = your_email_address.

In fact the above will archive all incoming and outgoing emails.

With sendmail

There is a tool called mimedefang. You can just add something like this in the /etc/mimedefang-filter, in the filter_begin function.

sub filter_begin {
#bcc to gmail
add_recipient( 'your bcc email address' );

: the remianing code without modification

The mimedefang approach archives only the outgoing emails.

The sendmail approach was tested in debian etch and the postfix based on one ubuntu 8.04.


Saturday, July 5, 2008

How to rename a set of files using ruby

While switching to Ubuntu from Debian, in order to use the same home directory partition, I had to rename old configurations files to a new one so that ubuntu can freely create its own new configurations. At the same I was not willing to delete the old configurations files.

This is how it was done using ruby

  1. #!/usr/bin/ruby
  2. dir = "/mnt/home/suresh"
  3. files = Dir.entries(dir)
  4. files.each do |f|
  5. next if f == "." or f == ".."
  6. if File.fnmatch('.*',f) then
  7. puts f
  8. newname = f + ".olddeb"
  9. File.rename(f,newname)
  10. end
  11. end
Line 5: To ignore the current and parent directories
LIne 6. I wanted to rename only files/directories starting with . (hidden files in unix)
Line 7. prints the current files - just for information
Line 8. the new name is old one with a .olddeb extension
Line 9. Does actual renaming