How to make a mobile wifi hotspot using your Bluetooth-enabled Sprint PCS phone and your Mac

Let’s say Sprint happened to to send you a free phone with a free service plan as part of their Ambassador program. Wouldn’t you want to share the benefit of that service with as many people as possible? Especially if the plan included free data service? After all, Mr. Ambassador, you certainly want everyone to enjoy Sprint’s quality service as much as you do, right?

Or let’s say you’re so rich you can afford to pay Sprint’s (probably high) fees for unlimited data service. Since there’s no additional cost to you, shouldn’t you share some of that bandwidth with some of us poor saps who can’t afford such luxuries?

This post describes how to use your Bluetooth- and Airport-enabled Mac with your Bluetooth-enabled Sprint PCS phone to set up a mobile wifi access point. Meaning, you can put your iBook in your car or backpack, put your phone in your pocket, and give free wifi internet access to anyone who happens to be in the area. (Of course, you will also be able to access the internet yourself all the while.)

These instructions assume you are using Mac OS X 10.4 (Tiger), and a Samsung A920, the official phone of Sprint Ambassadors everywhere. But they should apply to any Sprint phone with Bluetooth that is capable of being a data modem and/or using their Power Vision service. Non-ambassadors will have to navigate the labyrinth of Sprint customer service and get “phone-as-modem” service added to their plan. Once you’ve gotten that taken care of, please continue…

Summary for experienced people

Details are below, but if you know what you’re doing and just want to do it quickly:

  1. Turn on Bluetooth on your phone.
  2. Pair your phone with your Mac.
  3. In the PPP configuration for Bluetooth in Network preferences, leave the username and password blank and use this phone number: #777
  4. In Sharing preferences, go to the Internet pane and turn on Internet Connection Sharing for Bluetooth, allowing AirPort devices to connect.
  5. Back in PPP, click “Dial Now…”. You should be all set. By default, your SSID will be your computer’s name.
  6. If you need a detailed step-by-step, continue reading…

First, set up the phone

  1. Press “Menu/OK”.
  2. Select “Settings”.
  3. Scroll down and select “Bluetooth” and press OK.
  4. If Bluetooth is disabled, click OK on to enable it.
  5. Set “Visibility” to “Always visible”. (This is optional and not very secure, but it might make things easier later.)
  6. Select “Device Name” and enter a nice name for your phone. This is the name other Bluetooth devices (like your Mac) will display when connecting to your phone. (I have found in other contexts that choosing a one-word name can reduce errors.)

Connect your Mac to your phone via Bluetooth

  1. Open System Preferences.
  2. In the Hardware section, click Bluetooth.
  3. In the Settings pane, make sure it says Bluetooth is on. Other than that, it doesn’t matter much what is selected. [screenshot]
  4. In the Devices pane [screenshot], click “Setup New Device”.
  5. The Bluetooth Setup Assistant wizard will start. Click “Continue” and select “Mobile phone” from the list of device types.
  6. The wizard will scan the airwaves looking for Bluetooth devices. When you see the name of your phone, select it and click “Continue”.
  7. After a few seconds of “gathering information,” the wizard will prompt you to click “Continue” to continue. Do so.
  8. Your computer will display a “passkey”, a number you have to type into your phone to “pair” the phone with your Mac. [screenshot]
  9. Your phone will prompt you to accept the pair. Press “Accept”.
  10. Enter the passkey into your phone and press OK. If you wait too long, the connection will time out, and you’ll probably have to go back in the wizard and get a new passkey.
  11. Once the pairing has taken place, click “Continue” to continue.
  12. Make sure “Access the internet with your phone’s data connection” is checked.
  13. Click “Continue”.
  14. Here’s the important part: You will be prompted to enter connection settings. Leave “Username” and “Password” blank. In “Phone Number”, enter #777. For “Modem Script”, select “Sprint PCS Vision”. [screenshot]
  15. Optionally, select the checkboxes to show Bluetooth and Modem status in the menu bar.
  16. Click “Continue”.
  17. Click “Quit”.

Connect to the Internet

At this point, you might want to turn off Airport and/or unplug your network cable, so that when you connect to the internet via the phone, you’ll be sure you are connected via the phone. (After it’s all set up, you can turn Airport back on.) In the meantime, here’s how to get connected:

  1. Open System Preferences. (Or click “Show All” if your Bluetooth panel is still active.)
  2. In the Network & Internet section, choose “Network”.
  3. In the dropdown labeled “Show”, select “Bluetooth”.
  4. In the “PPP” pane, make sure “Account Name” and “Password” are blank, and that “Telephone Number” is #777.
  5. In the “Bluetooth Modem” pane, make sure the Modem dropdown says “Sprint PCS Vision”, and (optionally) check all checkboxes. Now you’re ready to connect to the internet.
  6. Go back to the “PPP” pane, and click “Dial Now…” An “Internet Connect” dialog box will appear. Make sure the Bluetooth pane is showing. [screenshot]
  7. Click “Connect”. The modem status in the menu bar will read “Connecting…” and your phone will say “Connected as data modem to [your computer name]”. You are connected! A timer on the phone will show the duration of your connection.
  8. Open a web browser on your computer to confirm that you are connected.

Share your internet connection via AirPort

Now you are ready to share your connection to the internet with other users. To do so:

  1. Turn AirPort back on if you turned it off earlier.
  2. Return to System Preferences. (Click “Show All” if you are still on your Network settings.)
  3. In “Internet & Network”, click “Sharing”.
  4. Go to “Internet” pane. [screenshot]
  5. In the dropdown labeled “Share your connection from”, select “Bluetooth”.
  6. In the “To computers using” area, select “AirPort”.
  7. Click “AirPort options” to make sure encryption is not turned on and/or to change the name of the access point (SSID) that your Mac will broadcast .
  8. Click “Start” to start sharing your internet connection via wifi.
  9. You may get a message saying this conflicts with your firewall setting, as Personal Web Sharing must be turned on (for some reason) to share your internet connection. If there’s a dialog, click “Show Services” or directly open the “Services” pane in Sharing (which partially controls your firewall), and activate “Personal Web Sharing” service. Note that this will make the “Sites” folder in your home directory available via your network connection. (If someone can explain to me why Personal Web Sharing has to be turned on in order to share your internet connection, I’d love to hear it. If it’s just to open the port, couldn’t they do that without firing up your web server?)
  10. That’s it! You’re connected and you’re sharing your connection. You might want to test it with another wifi device to make sure it can connect. (By default, your Mac will broadcast its name as the the name of the access point (SSID)).

Potentially sad note: Some devices may not be able to obtain an IP address from your Mac, in which case they won’t be able to use your connection to the internet. However, if you can talk to whoever is attempting to share your connection (e.g., you’re over at your friends’ house and want to get them online), you can configure their network connection manually. To do so, follow these instructions. I’d recommend keeping the IP addresses of some public DNS servers handy, so you can just type those in instead of trying to determine them from the dig utility or similar. I really don’t know anything about Internet Connection Sharing on the Mac, so I have no idea which devices can automatically obtain an IP from it and which can’t.

Added bonus: Note that if you look at the Personal Web Sharing preferences, you’ll see your external IP has been resolved to an actual domain name like http://h460c83c6.area2.spcsdns.net. Anyone accessing that address in their browser will see whatever website your Mac is serving from its web server folders.

Keep in mind:

  • Sprint PCS may or may not like the idea of you sharing your bandwidth. (Especially if you’re not an Ambassador and don’t have diplomatic immunity.)
  • If you are at work or school, your network administrator may or may not like (1) your computer’s new-found role as a DHCP server, and (2) your computer giving indirect access to his/her LAN.

Even so, at least you can go to bed knowing you are the Robin Hood of wireless bandwidth!

How to process AOL’s search logs with PHP

AOL, for some reason, released 2,000,000 search records taken from the last 3 months. With a tiny bit of programming, you can use PHP to search through these records. This post describes how.

But first, let’s cut to the chase:

First, you need to download the files, which you’ll have to find on your own, as I can’t remember where I found them. The file is ~450MB.


wget http://whereverthosefilesare.com/AOL-data.tgz

Next, uncompress this file into its multiple parts:


tar zxvf AOL-data.tgz

Then, un-gzip the compressed files:


gzip -f user*.gz

This will leave you with a bunch of text files containing the actual log data. These files will be very large. So large in fact that your web server might not be able to deal with them in PHP. So, you should split them into multiple smaller files. For each .txt file, run a command such as:


csplit -f aol user*01.txt 1000 {1000} &

That code will split the files into multiple files of 1000 lines each, naming each them aol100, aol101 and so on. In these smaller chunks, PHP will be able to deal with them more easily. When I ran this command, I ended up with 2000 files of 1000 lines each. For the code below to work, each of these files must have the letters “aol” in their names.

Next, you can create a PHP page that will search the AOL log files for a certain string, and then return matching lines. The string you are looking for will be passed on the URL, as in http://example.com/search.php?search=sex

Here is the code for the PHP page.

Save the file as search.php or whatever, and then access it at its url, e.g., http://yourwebsite.com/search.php?search=thewordyouarelookingfor

Change the URL to run another search. You can take the user id from one search and put it on the URL, thereby finding all the searches by that user.

Brief thoughts on the iPhone

I don’t usually do opinion pieces here, but today is sort of a notable day. Here are my general thoughts on the iPhone.

  • it is small and light
  • the virtual keyboard thing is a pain in the ass. i’m sure it gets better the more you get used to it, and the auto-correction works well, but it never types the letter you are aiming for. it really slows you down. the keys need to be wider. also, the virtual keyboard gets in the way. for instance, when accessing my gmail, i had to type in a captcha code to sign in, but the keyboard obscured so much screen real estate, i couldn’t see the captcha text and the text field at the same time. it also sets the visual focus wherever you are typing, so you can’t look at the captcha while typing blindly. i had to memorize the sequence, then scroll down and type it in.
  • interface is not as dead simple as you would expect. for instance, in the web browser, i couldn’t figure out how to go to a new page! turns out the address bar is pinned to the top of the page, instead of the top of the browser window. SO YOU HAVE TO SCROLL UP on a PAGE to find the address bar. Really poor decision there, and very uncharacteristic of Apple. the apple store employee who i asked about this was puzzled by it and couldn’t immediately figure out how it worked.
  • it’s a little slower than you would hope. for example, when you pan-and-scan a pdf document, the screen redraw takes a second or two. that said, the ability to open up and zoom in and out of a pdf or other attachment is nice.
  • the interface across applications is not consistent. forward/back work differently in safari, the notepad, and itunes.

finally: because it is still a closed system, you sit there using it for 15 minutes or so, fooling around with safari, the camera, email, and itunes, and then you realize that you have done everything you can do with it. the words that went through my head were, “Well, I guess that’s it.” In the end, it’s just a cool phone.

i don’t think i am going to get one. it seems to me that any Nokia Series 60 (aka “N Series”) phone does nearly everything that the iPhone does, with the exception of the touch-screen interface, The Nokias have these advantages that are valuable to me:

  • GPS (N95 only)
  • unlocked; no contract
  • multimedia messaging, which was inexplicably left off the iPhone
  • 3G data
  • open architecture, so you can install third-party applications
  • way better camera (zeiss lens 5MP vs. run-of-the-mill 2MP)
  • video recording (inexplicably left off the iphone; N95 does 480p)

sure, the Nokia interface isn’t as slick, but it is still very well designed, and probably more efficient for the most common operations (calling people, texting, sending someone a picture).

the one caveat for me here is that the iPhone OS X certainly has 1000x more potential than the Series 60/Symbian OS, so if/when Apple opens it up, it will blow away the Nokias and everything else.

How to use iTunes “currently playing” info as your email signature in Outlook

outlook with itunes screenshot

Ok, here’s one for the masses.

This post describes how to add info about the song currently playing in iTunes to emails you compose in Outlook. Anyone can do it!

First, create the macro. To do so:

  1. Open Outlook.
  2. From the Tools menu, select Macro, then Macros…
  3. In the Macro field, enter a name for your macro. “AddiTunesSig” is probably appropriate. [screenshot]
  4. Click “Create”.
  5. A “code window” will open. This is where, in a minute, you will type the code that makes up the macro.
  6. But first, you need to tell Outlook how to talk to iTunes. To do so, go to the Tools menu and select References. Scroll down until you find “iTunes Type Library” or something similar. Select its checkbox and click OK. [screenshot]
  7. Back in the code window, you will see two lines of code: Sub AddiTunesSig() and End Sub. In between these lines, paste in the following code:
    
    
    ' purpose: opens a new mail message, 
    ' appends info re: currently playing track in iTunes
    
    Dim itunes As iTunesApp
    Dim strArtist As String
    Dim strTitle As String
    Dim strOutput As String
    Dim mail As Outlook.MailItem
    
    Set itunes = New iTunesApp
    
    'load the track info into easy-to-read variables
    strArtist = itunes.CurrentTrack.Artist
    strTitle = itunes.CurrentTrack.Name
    strAlbum = itunes.CurrentTrack.Album
    
    'assemble the signature
    strOutput = vbNewLine & "------------------------------"
    strOutput = strOutput & vbNewLine & "Now playing: " & vbCrLf _
         & strTitle & vbCrLf & strArtist & vbCrLf & strAlbum
    
    'create a new email message
    Set mail = Outlook.CreateItem(olMailItem)
    
    'put the signature in the body
    mail.Body = vbNewLine & vbNewLine & strOutput
    
    'show the message to the user
    mail.Display
    
    'clear up the memory
    Set itunes = Nothing
    
    

    See how easy programming is! [screenshot]

  8. To finish up: Click the Save button on the toolbar and close the code window.

Now, you need to add a toolbar button to your Outlook toolbar that will run this macro. To do so:

  1. Go to the Tools menu, and select Customize…
  2. In the dialog box that pops up, scroll down the left side, and click Macros. [screenshot]
  3. You will see your macro on the right (“Project1.AddiTunesSig”). Drag it up to a convenient location on your toolbar. (Next to the “New” button is probably a good place.)
  4. To rename the button, right-click the button and type the new name where it says “Name:” in the pop-up menu. “New (with music)” is probably a good name. [screenshot]
  5. Close the Customize window.

That’s it! To use it, open iTunes, play a song, go back to Outlook, and click your new button. A new email will open with info about the currently playing song in the signature area.