Monthly Archives: December 2007

Using Telnet to Check Your Email

Like a lot of people at this time of year I went home for a few days. It was great to get home for a while, but it has it’s downside – no broadband. So I was transported back to the the dark days of dial-up.

It’s been so long since I used dial-up that I’d forgotten how slow it is. Even checking email can take an age. So here’s a quick guide on how to use telnet to do a quick email check.

Before you start, you’ll need three pieces of information:

  • your mail server address,
  • your user name, and
  • your password.

Once you have these, open a command prompt and type:

telnet mail.server.tld 110

It might take a couple of seconds, but you should get a response from the server. Something along the lines of:

+OK server ready

The next step is to logon to the server with your user credentials:

Enter your user name:

user user name

If the user name has been accepted, the server will respond with:

+OK

Now enter your password:

pass password

If you have provided the correct password, then you should get the following server response:

+OK Logged in

To see if you have any messages, you can use either of the following commands:

stat

or,

list

The list command will return a list of all messages and their respective sizes, while the stat command will return the total number of messages and the total size.

Sample output from the list command:

+OK 2 messages:1 11952 2365.

Sample output from the stat command:

+OK 2 3560

You’ll note from the output of the list command, that each email is numbered. To read your emails, use the retr command:

retr 1

This command will display the entire email message including the headers. If you want to view just part of the message, then use the top command.

top 1 20

The above command will return the first 20 lines of email number one on the server, not including the email headers.

If like me, you receive a lot of spam, then you might want to delete an email without actually downloading it. This is accomplished using the dele command.

dele 1

The server should respond with a success code:

+OK Marked to be deleted

Be very careful when using this command, as any email messages deleted using this method are irretrievable and gone forever. There are no “Trash” or “Deleted Items” folders on the server.

As a side note, these commands are part of the official POP3 standard, and as such are the commands used by all email programs to retrieve email from POP email servers. (IMAP is a different standard, and uses different commands.)

If you want to send an email, then a different protocol must be used: SMTP, and that’s another post.

The Quick Way to Connect to a Network Drive using Mac OS 10.5 Leopard

I’ve posted a few times about the problems I’ve had connecting to a network drive using Leopard. Previously I posted about how Leopard was able to connect to a network drive, but wouldn’t show the contents of the shared folder. After a lot of testing, and a bit of luck, I followed that up with a post on how I was able to browse the folders on my network drive. Now, I’ve found a way to connect to my network drive and browse the folders almost immediately. Although this method may sound a bit convoluted, there are just four steps. As I only have my MacBook to test with, I can’t guarantee that this will work for you, but I don’t see any reason why it shouldn’t.

Step One

Connect to your network drive in the usual manner. Either use the Command-K shortcut, or from the Menu Bar use Go -> Connect to Server. In either case, you’ll be presented with a Connect to Server dialog box. The server address should be specified as:

smb://network.drive.ip.address

Click the Connect button and wait for Finder to connect to your network drive. If you have more than one shared folder set up on the drive you’ll be prompted for the folder that you want to connect to. Once Leopard has connected to the shared folder a new Finder window should open.

Step Two

Open Terminal from Applications -> Utilities -> Terminal. At the prompt, type the following command:

sudo smbclient -L NETWORK_DRIVE_NAME

The NETWORK_DRIVE_NAME refers to the the Windows name for your drive and is usually set using the configuration interface for the drive – this may be a web interface or an application, the exact details will depend on your specific drive. When you press Return, you’ll be prompted for your password. Type your password and press Return again. When you run this command, you should get a response like this:

Receiving SMB: Server stopped respondingsession request to NETWORK_DRIVE_NAME failed (Call returned zero bytes (EOF))Receiving SMB: Server stopped respondingsession request to *SMBSERVER failed (Call returned zero bytes (EOF))

Although the Samba Client returns with an error message, don’t worry, you’re still on track to be able to browse the drive contents.

Step Three

Restart the Finder. This is achieved by typing the following command in Terminal:

sudo killall Finder

Once this command has been entered, the Leopard Finder will restart. You’ll notice that your Desktop icons disappear, as will any open Finder Windows. Your Desktop icons should reappear almost immediately.

Step Four

Repeat Step Three:

sudo killall Finder

Open a Finder Window, and under the Shared section your network drive should be listed. Click the drive name, and then double-click the shared folder name. You should now be able to browse the contents of the drive.

Important Notes

  • I don’t know why, but the Finder has to be restarted twice for this work.
  • The Terminal commands must be run using sudo or as root (using su), even if you are logged in as an adminsitrator. If you are an administrator, you’ll be able to run the smbclient command and the killall command, but the process just won’t work.
  • I have no idea why this works, or how, I just know that it does work for me.
  • I’d recommend that you close all open programs while doing this, just in case. Using the killall command may have some strange effects on open programs, or lead to system instability.
  • Once again, I haven’t been able to test this on any other system other than my own, so your milage may vary.

Changing the Contrast on a MacBook

While I was playing around with the Keyboard Shortcuts for the previous post, I noticed that there’s a shortcut for adjusting the contrast on my MacBook. I’ve been looking for a way to do this for ages, and it turns out that it’s possible to do this with a shortcut, albeit, not a very obvious one:

To increase the contrast use: Ctrl-Alt-Command-. (that’s a full stop)
To decrease the contrast use: Ctrl-Alt-Command-, (and that’s a comma)

I’ve changed them to Ctrl-Alt-PgUp and Ctrl-Alt-PgDn on my Mac – it’s so much easier to remember.

Using Tab to Select Dialog Box Buttons in Mac OS X

One of the things that has annoyed me about Mac OS is the behaviour of the Tab key. When presented with a dialog box with multiple buttons, pressing the Tab key will not allow you to shift focus from one button to the next. Thankfully this default behaviour can be changed.

 

Dialog Box with Tab Key Disabled

Figure 1: Dialog box with Tab key disabled

 

In System Properties, open the Keyboard & Mouse settings and click on the Keyboard Settings section. At the bottom of the screen is an option for Full Keyboard Access.

 

System Properties - Keyboard & Mouse - Keyboard Shortcuts

Figure 2: System Properties – Keyboard & Mouse – Keyboard Shortcuts

 

In this section there is the option for using the Tab key to move focus between a) Text boxes and lists only, or b) All controls. Click the radio button for the second option, and the Tab key will now allow you to tab between all the available dialog box buttons. On a MacBook you can also use the following shortcut key to turn on/ off this behaviour: ^fn F7

 

Dialog Box with Tab Key Enabled

Figure 3: Dialog Box with Tab Key Enabled

 

Once this option has been enabled you should be able to use the Tab key to highlight any of the available buttons. One word of caution though: if you select a different button than the already highlighted default, then you must use the spacebar to “press” it. Using the Enter or Return keys will always “press” the default button.

Changing How WordPress Displays the Date and Time

If you’ve had a blog for any length of time you’ll be hard pressed not to play around with it and mould it to your own needs. Even if you find a theme that you like, there will always be the odd thing that you want to change.

In my case, I wanted to change how the date and time were displayed on my blog posts – it was just a bit too “American” for my tastes. WordPress allows you to change the default date and time formats, (it’s under Options), but changing this had no effect. Obviously, the time and date formats were hard-coded into the theme files.

So I fired up my FTP program and downloaded copies of archive.php (displays the archive pages), single.php (displays a single post per page – basically the permalink page), and index.php (displays the main home page).

WordPress uses a specific function for displaying the date and time. So it was just a matter of searching each file for:

<?php the_time('F j, Y '); ?>

This displays the date as:

December 14, 2007

I changed the code to the following:

<?php the_time('l, jS F, Y'); ?>

which displays the date as follows:

Friday, 14th December, 2007

If you need a description of what the different parameters mean, then you can find more information from the WordPress Documentation Site and from the PHP Manual.

Adding a Mouse Gradient to Stacks in Mac OS X – Leopard

Here’s how to add a mouse-over gradient to your Stacks in Leopard:

Open Terminal and type the following command:

defaults write com.apple.dock mouse-over-hilte-stack -boolean YES

Hit return and then restart the Dock with this command:

killall Dock

To get back the default behaviour, replace “YES” in the above command with “NO”.

Just a Thought

We’ve all heard about how carbon dioxide is causing climate change. The number of articles about reducing our “carbon footprint” or touting low carbon alternatives grows every day.

Why do all these articles talk about reducing carbon output? What about removing carbon dioxide?

If excess CO2 is such a problem, why aren’t we doing more to remove the excess from the atmosphere?

Like I said, just a thought.