Thursday, February 25, 2010

Block image and flash-based advertisements in Firefox

One of my biggest pet peeves about browsing through my daily regimen of websites is the advertisements that I come across. Usually they are something about "getting ripped" in 3 weeks or whitening your teeth. I'm not the kind of person who can just ignore things like that so easily, so anything that takes away those annoying advertisements is like candy to me. Enter in Firefox's native image-blocking abilities, and Flashblock. Behold the following screenshot of a web-site and look at all the wonderful, advertisement-free white-space:


The lack of stuff to fill in the white-space may scream out at you, but it's a huge relief to me. With Firefox and Flashblock, locking image-based or flash-based advertisements is a cinch! For image-based advertisements, all you have to do is right click on the image, and then click on Block images from ... and you're set. For flash-based advertisements, Flashblock basically turns all instances of Flash on websites into buttons that you can click on if the Flash is a functional part of the website. If you want to get rid of the button altogether, all you have to do is right click on it and then click on Remove Flash.


That's all! Enjoy surfing with no advertisements :)

Tuesday, February 23, 2010

Wireless just works better with WICD than Gnome Network Manager

As I mentioned in my post about getting Ubuntu to start your wireless connection before login, Gnome Network Manager has to be uninstalled so that Ubuntu will rely on your /etc/network/interfaces file to start up your wireless connection. This worked great for me and my Ubuntu laptop until I started having to take my laptop away from home and use other wireless networks. In order to connect to other wireless networks, I would have to set my /etc/network/interfaces file so that my wlan0 interface relied on dhcp instead of static settings. I would then have to re-initialize my networking settings and then use the command-line to scan for dhcp requests on my wireless interface. This was no good!

To remedy the situation, I discovered another graphical network manager called WICD. The version in the Ubuntu repositories was actually a bit buggy, so I went directly to the WICD launchpad website and downloaded the latest release (version 1.7.0). I've tested it out at home and away and I can now say that it works quite nicely. WICD allows Ubuntu to start up my wireless connection before the Login screen. It also allows me to connect to other wireless networks despite the settings in my /etc/network/interfaces file.



As you can see above, WICD puts an icon in your system tray with a green indicator bar that tells you how good your signal is. If you hover your mouse over the icon it tells you what network you're connected to, what percentage signal strength you have, and what your IP address is.



Above is the window that pops up when you left click on the WICD icon in the system tray. As you can see, the window contains information about all available wireless network SSIDs in your vicinity, how strong the signal is to those networks, and what type of encryption (if any) protects each network. You can click on the properties button for any network that you want to connect to if you have to put in a wireless encryption key. The screen that pops up follows



Once you're ready, you can click on the Connect button and you're on your way!

Setting Up WICD

As I mentioned above, I first installed WICD from the Ubuntu Repositories. I think this forced my computer to install all the appropriate dependencies so that the newer version could work. When you download the newer version, extract it to whatever directory you want. Then, open up your terminal, navigate to the directory with the WICD setup files that you just extracted, and type in sudo python setup.py install. Now, when you restart your computer, you should see WICD in your system tray ready to do your bidding.

Thursday, February 11, 2010

Install OpenOffice 3.2 in Ubuntu!

Today I checked the openoffice.org website to see if OO 3.2 was released yet. I discovered it was, and decided to download and try to install it. I think this is the first time that I've tried to completely remove one installation of OpenOffice in Ubuntu and install another. If you'd like to do the same and check out the new OpenOffice, here are the steps I used:
  1. Choose a mirror site to download an Archive containing the appropriate OpenOffice.org installation for your system
  2. Once you've downloaded the archive, extract it to your directory of choice
  3. Navigate to that directory in your terminal
  4. Now, remove all packages in your system associated with OpenOffice by typing in sudo apt-get remove openoffice*. For some reason this removed alpine from my system. It was easy enough to reinstall alpine and I discovered that none of my settings were lost. Do take note of what your system removes using the previous command
  5. Now, navigate to the DEBS subfolder of your openoffice setup directory
  6. Install all openoffice packages by typing in sudo dpkg -i --force-overwrite *deb
  7. Finally, navigate to the dekstop-integration subfolder of the DEBS directory and type in sudo dpkg -i --force-overwrite *deb
Now you will have the new stable OpenOffice Suite version 3.2 installed on your Ubuntu system!

Tuesday, February 9, 2010

Start your wireless connection before Ubuntu login

Recently I started asking myself how I could get Ubuntu to forge its wireless connection (with WEP encryption) to my router without having to log-in through the GUI. I noticed that the default way of logging in through the GUI and then having a wireless connection available was limiting for two reasons: (1) If I wanted to be able to connect to my openSSH server then I needed to be logged in, and (2) If there was something wrong with the GUI and I had to log-in through the command line then I wouldn't have internet access.

So I started looking around on the net. Most pages that I found showed messageboard threads suggesting modifications to the /etc/network/interfaces file. This is the file that is supposed to tell your Linux system what to do with your network interfaces at boot-up. I tried to modify it so that my wireless card would start-up with a static IP at boot-up, but no matter how I changed this file, nothing worked.

Finally, I decided to ask a question on ubuntuforums. I found out that Gnome Network Manager, the program in Ubuntu which manages all your wired and wireless network connections, works terribly with the settings in the /etc/network/interfaces file. In other words, if you want Ubuntu to start your wireless connection at bootup instead of after login, you have to get rid of Gnome Network Manager!

So, on the advice of chili555 from ubuntuforums, I got rid of Gnome Network Manager by typing in sudo apt-get remove --purge network-manager and modified my /etc/network/interfaces file to look like the following (SSID and WEP key changed for privacy):

auto lo
iface lo inet loopback

auto wlan0
iface wlan0 inet static
address 192.168.2.11
netmask 255.255.255.0
gateway 192.168.2.1
wireless-essid MYSSID
wireless-key 12345678912345678912345678

iface eth0 inet dhcp


Now, every time I start my computer, my wireless connection is available before login so that I can login to my openSSH server or go to the command-line without logging in to the GUI!

Thursday, February 4, 2010

Alpine, Gmail, and SSH. How to make your computer send emails when you're not there!

Out of the many things I've learned in the past half year about using Linux, I find the concept of remote access of my computer through SSH to be the coolest.  Periodically I will be away from home, and I'll realize that I need access to some file on my computer so that I can send it to someone.  I recently learned how to set up a Secure Shell Server on my Ubuntu Linux laptop that I can access from my Android cell phone using an Android app called ConnectBot.  Once I get into my computer, I can then open up a fantastic text-mode email program called Alpine and compose emails with files attached right from my computer's hard drive and then send them through my Gmail account.  Nothing makes me feel more like a huge nerd than this!

Here's how I set up an SSH server and then install Alpine with access to my Gmail account (my Gmail is setup to check and respond from 2 additional email addresses, so the instructions are tailored to that scenario):

Setting up openSSH

First you need to install the openSSH server.  Easily enough you just have to type in sudo apt-get install openssh-server into your terminal to get the server.  Amazingly, it's ready right away to be used!   I wanted the SSH server to use a different port than the default (port 22), so I opened up /etc/ssh/sshd_config and changed the port number on the 5th line to something that was wacky enough not to be predictable.

Next came two considerations: (1) I'm behind a router, and therefore needed to set-up port forwarding so that I'd be able to access my openSSH server remotely.  If you have a router and forget this step then prepare for lots of frustration!  (2) Even having port-forwarding set-up, who wants to remember and type in an IP address so that you can connect to your server?  So I needed to sign up for a free dynamic hosting service that would give me a constant host name regardless of my IP address.

Setting up Dynamic DNS hosting

I found a great tutorial on the Ubuntu Help Site for setting up Dynamic DNS hosting for your computer.  Basically, I went to DynDNS, set-up an account for my computer, and then followed the instructions on the above-mentioned Ubuntu Help Site to install and configure ddclient.  ddclient will periodically send updates to DynDNS so that the hostname they provide you with always points to your IP address.  When you're done configuring all of this, you will then have a host-name pointing to your computer such as tommy.gotdns.com.  That's a lot easier to remember than 40.831.391.33 right?

Initial installation and set-up of Alpine

Next I set-up Alpine.  Installing it was easy enough: sudo apt-get install alpineOnce it's installed, you have to set it up to work with your Gmail account.  Refer to this tutorial from the University of Virginia for a tutorial on how to do that.  Be sure that when you're in the Config screen of Alpine, look for the field named Inbox Path and enter in the following: imap.gmail.com/ssl/user=username@gmail.com .  Be sure to replace 'username' with your own Gmail account username.  This will make sure that when you start-up Alpine and go into your Message Index, you will see the emails in your Gmail Inbox right away, instead of having to navigate to that inbox.

Configuring Alpine to send emails using different 'From' email addresses

Now, when I reply to emails that I've picked up using my Gmail account, I usually want to reply using different email accounts.  When you're only using the web-based Gmail checker, it allows you to respond using the account that the email was downloaded from.  I wanted to have that same functionality in Alpine.  This is where the Alpine concept of a Role comes in handy.  From the main screen of alpine, type the following keys (don't type the triangular brackets): S > R > R > A .  This will bring you to a screen that allows you to set-up the conditions under which Alpine will let you send an email using a different From email address. 

First, set a nickname up for your role; maybe the name of your email provider (i.e. Sympatico).    Next, under Current Message Conditions and beside To Pattern put one of the (or the only) email address(es) that Gmail is checking for you (e.g. bill@sympatico.ca).  This creates an expectation that whenever this email address is in the the To field of an email, Alpine will do whatever you tell it in your role.

Then, under Actions Begin Here and beside Set From put your name and then email address that Gmail is checking for you (e.g. Bill Nye <bill@sympatico.ca>).

Finally, under Uses Begin Here you need to make the following changes (if necessary): (1) Under Reply Use = make sure to highlight and press enter on Without Confirmation and (2) Under Compose Use = make sure to highlight and press enter on With Confirmation.  This will make it so that if someone emails you at bill@sympatico.ca, when you reply to that email, Alpine will automatically put bill@sypmpatico.ca in the From email address and not bill@gmail.com.

When you're done, you can press E to exit the Role set-up.  If you check two email accounts through Gmail like me, press A once more when you're in the Setup Role Rules screen in alpine and repeat the above instructions to set-up a role for your other email account.

Saving your Gmail password in Alpine so that it doesn't prompt you all the time

Finally, you'll probably be annoyed with entering in your Gmail password every time you start up Alpine.  Thanks to a helpful user on Ubuntu Forums, I found out a simple way of making Alpine save your password.  Open up your terminal, change directories to your home directory, cd ~/, and then type in touch .pine-passfile.  After that, run Alpine.  It will ask you for your password on start-up, and on sending an email, only to save your password indefinitely so that you no longer have to type in your password all the time.
 


Conclusion


Wow, those were a lot of very little steps which, put together, seem mountainous.  However, now I can punch in my dynamic DNS hostname into ConnectBot on my Android cell phone, access Alpine and send emails with files attached right from my computer's hard drive!  I also like that I can update my databases on the fly with important personal info, manage, and even turn my computer off from afar.  It's quite neat and if you're into feeling nerdy, I highly recommend getting your own openssh server configuration.