Sync an iPod Touch to Two Computers

Mobile Devices No Comments

I use both a Macbook and a Windows desktop and wanted to see if I could sync the same iPod Touch to both machines. Below is one method I found to do this and some caveats about the method.

Some background on how an iPod Touch pairs with an iTunes library

When you install iTunes on any computer, iTunes gets assigned a unique identifier. When you sync an iPod Touch to that same computer, the iPod Touch will store that unique identifier. If you attempt to sync the iPod Touch with another computer, the stored identifier won’t match that of the other computer’s iTunes library and the iPod Touch will refuse to sync. To get the iPod Touch to sync with the other computer, you would have to agree to overwrite the stored unique identifier and content of the iPod Touch with that of the new iTunes library.

Syncing to more than one machine

I found several websites that contained instructions on how to sync an iPod Touch (or iPhone or iPad) to more than one computer. However, the instructions did not work for the latest iTunes 10.5 version. In the comments of How to sync an iPhone with two (or more) Computers, I found a method which worked. While the old method was to change the unique identifier in two files (“iTunes Library.itl” and “iTunes Music Library.xml”), the new method only required changing one file (iTunes Music Library.xml).

  1. On the first computer (which the iPod Touch currently syncs to), locate the iTunes directory.
    • On Windows XP: \Document and Settings\username\My Documents\My Music\iTunes
    • On Windows 7: \Users\username\Music\iTunes
    • On Mac OS X: /Users/username/Music/iTunes
  2. Open the “iTunes Music Library.xml” file in your favorite text editor, search for the “Library Persistent ID” key, and copy the key value (a hex string that looks like “8ACF35DDCB78FEB1″).
  3. On the second computer, locate the iTunes directory.
  4. Open the “iTunes Music Library.xml” file, search for the “Library Persistent ID” key, and overwrite its value with the value from the first computer.
  5. Rename (or delete if you are brave) the “iTunes Library.itl” file.
  6. Run iTunes on the second computer, it will throw a warning that the “iTunes Library.itl” file is missing and it will then generate a replacement.
  7. Because the iTunes Library was re-generated, you will need to re-add any apps, music, videos, etc. To re-add the content, go to the menu “File->Add File to Library” or “File->Add Folder To Library” and choose the file or folder to add. (The application files with extension “.ipa” are located in the “iTunes Media/Mobile Applications” subdirectory under the iTunes directory.) iTunes will automatically recognized what is being imported.

The iPod Touch is now sync’able against both computers. But wait, the information (music, video, contacts, notes, etc.) and applications on both computer are likely not identical. If that is the case, you will want to manually control how the sync works on either computer. You can start by configuring iTunes to not automatically sync.

Run iTunes on both computers and do the following:

  1. On Mac OS X, go to menu “iTunes->Preferences”. On Windows, go to menu “Edit->Preferences”.
  2. Select the Devices tab and check the “Prevent iPods, iPhones, and iPads from syncing automatically” option.
  3. Optionally, if you would like to control the location where your music and video files are stored, select the Advanced tab and uncheck the “Keep iTunes Media folder organized” and “Copy files to iTunes Media folder when adding to library” options.
  4. Optionally, if you would like to prevent automatic downloads from the iTunes store, select the Store tab and uncheck every option (including “Always check for available downloads”).

Doing the above does not solve the whole issue of having different content on the two computers. The problem is that the iPod Touch has its own configuration on what to sync (Apps, Music, Movies, TV Shows, Photos, and Info). To see those sync options (they show as tabs in the device details), connect the iPod Touch to the computer and click on the iPod Touch device in iTunes. If you configure the iPod Touch to sync Music, the same setting is used for both computers and if you don’t have the same music on both computers, then you have an issue.

The workaround I use for the above is manually intensive. Before syncing, I double-check the sync options on the iPod Touch. If I only have music on my first computer, I make sure to check “Sync Music” before syncing; while on the second computer, I make sure to uncheck “Sync Music” before syncing. (Strangely, the “Sync Info” options are not persisted for both computers, but this might be a Mac OS X and Windows side effect.) If I’m careful and don’t get confused, it works. Of course, if I mess up and accidentally get the music wiped from the iPod Touch, it is easy to re-sync the music back.

Of course, you can avoid the above complexity by having the same content exist on both computers. In that case, instead of following the steps above to get sync working with both computers, you might consider copying the “iTunes Library.itl” file over to the second computer and deleting the “iTunes Music Library.xml” file on the second computer. On startup, iTunes will regenerate the “iTunes Music Library.xml” file with the library identifier from the “iTunes Library.itl” file. The content info (stored in “iTunes Library.itl”) will show up in iTunes on the second computer; you will need to have the actual content files, like mp3 music files, exist in the same directory locations. I also read that you could just copy the whole iTunes directory from the first to the second computer, but I have never tried this so don’t know if it will work.

Alternatively, there is a way to sync the content from the iPod Touch to the second computer. This is possible according to Sync iPhone to iTunes – Transfer iPhone to iTunes synchronization. I haven’t tried this, but it looks very interesting and opens up new possibilities.

I hope that the above info will help you to get the most from your iPod Touch.

Jailbreak iPod Touch 4G Running IOS 5.0.1 Using RedSn0w

Mobile Devices No Comments

Luckily, just when I needed to jailbreak a new iPod Touch 4G with iOS 5.0, I found that the iPhone devteam had released a version of RedSn0w (version 0.9.10b3) that would jailbreak the latest iOS 5.0.1 operating system. And better yet, this version would allow untethered usage (thanks to @pod2g!) which means that it is possible to reboot the iPod Touch without having to connect the device (“tether”) and re-running the jailbreak software. You can read up on the details at Dev-Team Blog – Untethered holidays.

You can download RedSn0w 0.9.10b3 from the Dev-Team Blog link above. I downloaded the version for Mac OS X, which worked perfectly on my Mac OS X 10.6 Snow Leopard macbook. This new version of RedSn0w did not prompt me for the iOS 5.0.1 IPSW firmware image so you don’t need to download that (previous RedSn0w versions would require the correct IPSW image file).

Before running redSn0w, I used iTunes to upgrade the iPod Touch 4G to the latest iOS 5.0.1 version. When that was completed (about 10 minutes), I installed and ran RedSn0w. I noticed that on launch, RedSn0w now quits iTunes automatically; this is nice because in the past, I had to manually quit iTunes in order to avoid popup messages from iTunes during the jailbreak.

I followed the instructions like so:

  1. I selected “Jailbreak and install Cydia”.
  2. I shutdown the iPod Touch as instructed.
  3. The next screen provides instructions to get the device into DFU mode: press power 3 seconds, press both power and home for 10 seconds, press home for 15 seconds.
    • The number of seconds were very generous but I still followed them regardless. In the second stage, the screen shut off after the power and home were held for 6 seconds. In the third stage, the device entered DFU mode after the home button was held for 5 seconds.
    • When I was jailbreaking a second iPod Touch, I didn’t follow the instructions closely and ended up putting the device into recovery mode, instead of DFU mode. There are several utilities to exit a device from recovery mode and I ended up using TinyUmbrella. Though I had to reboot the iPod Touch a couple of times with TinyUmbrella running before TinyUmbrella would recognized the device and enabled the “Exit recovery mode” button.
  4. RedSn0w will recognized when the device enters DFU mode and will start the jailbreak process.
  5. After about 20 seconds, RedSn0w will offer some options. I just kept the default “Install Cydia” and “Enable battery percentage” options checked. The “Enable battery percentage” is very useful (to tell when it is fully charged) and I’m surprised Apple doesn’t provide it by default.
  6. RedSn0w ends after a minute or two and the iPod Touch continues the jailbreak process for another few minutes. The iPod Touch’s screen will show a pineapple logo with a progress bar.
    • The second iPod Touch froze during the jailbreak; I think I moved the USB connector and interrupted the process. If that happens to you, just quit RedSn0w and shutdown the device so you can start over. You can force a shutdown by holding both the Power and the Home button for 5-10 seconds until the screen turns off. If the device goes into recovery mode, RedSn0w will complain about it and you can use TinyUmbrella (like above) to exit recovery mode.

Once the iPod Touch has completed the jailbreak and started successfully, I recommend doing the following on the device:

  • Enable battery percentage by going to Settings->General->Usage and turning On the “Battery Percentage” option.
  • Install the “Installous 4″ application by doing the following:
    1. Run Cydia and select a User profile (or any other profile). Wait for Cydia to update itself; you can watch the spinning icon near the top. This will take about 30 seconds.
    2. Go to Manage->Sources->Edit->Add, input “http://cydia.hackulo.us”, hit Add Source, and hit Add Anyway. Once the data is reloaded (10-20 seconds), tap on “Return to Cydia” near the bottom.
    3. Go to Search, tap on the input field at the top, and input “Installous”. Tap on “Installous 4″ in the search results, hit Install and Confirm. After the install completes (about 30 seconds), tap on “Restart SpringBoard” and you will be placed back into the normal unlock screen.
    4. You should now see an Installous application icon next to the Cydia icon.

Thanks to RedSn0w, the jailbreak process has never been easier. Good luck with your jailbreak.

A Senior Software Developer’s Survival Guide For The Future

Life and Work No Comments

My future survival guide for senior software developers, who work in companies, can be summed up as two advice: move to a technical leadership position and master mobile device (iPhone and/or Android) development. I believe that these advice will keep a senior software developer in demand for the near and distant future.

Be the technical liaison to avoid commoditization

The first advice requires you to modify your career path a little. As a senior developer, you command a high salary and thus, you will be endangered by the penny counters that dominate the modern companies and economy. Sooner or later, you will be replaced by someone who will cost less, someone very junior or more likely, someone in a foreign country working for a fraction of your salary. In the end, it will be the latter.

I hate to say it, software development is being commoditized. Along with that, software of average quality is becoming more acceptable to the heads of companies. With the increasingly higher level languages and tools, the required programmer skill set is reduced. I imagine in the future, one can write a complex program by drawing boxes and linking them. Hey, that’s the way progress and capitalism works. We might not like it, but we should acknowledge reality.

Sure, you may be lucky to work in a great company that values your talent, recognizes that you are 10 or 100 times more productive than the average developer, and pays you accordingly. Or you may have some esoteric knowledge (Cobol?) which requires companies to keep you around, until a cheaper option appears (the Cobol application becomes obsolete due to a process change… and you know those MBAs love process changes). However, I’m talking about the real world here and the majority of senior developers in the majority of companies are not so lucky. I know I am not.

In the early to mid 2000′s, when every other company was off shoring development, I only saw one possible career change to secure my employment. That was to move into a higher level position which can be known by various names like technical leader, architect, or program manager. The goal is to become someone who is responsible for coordinating a team of developers, local or remote, to produce results. The idea is that companies in the US will need at least one person in the US who can coordinate and make sure that the off-shore teams of software developers are actually delivering something that can be sold, or can fulfill a commitment of delivery to a customer. Someone who the higher-ups can talk to in-person who will give them that “everything is going good, you are still in control” feeling. Basically, a technical person who can keep the whole house of cards from falling down and the company from well, imploding.

In the above, I did not suggest people manager as a target role. I believe that being a manager will make you unsuitable as a technical liaison for a remote team. Not to mention, once a team is remote, they won’t need a manager locally. About seven years ago, I made the move from technical leader to development manager. (That is an adventure which I may blog about later.) Before you take this path, just understand that being a manager is totally different from being a individual developer. You don’t write code. If you are a manager and you spend a significant amount of your time writing code, then you are probably not doing a good job as a manager, or very unlikely (in my dreams), you are in a great supportive company with a team of happy, senior developers who are self-driven and great team players. Unfortunately, as a manager, without the practice of coding, you will find yourself getting rusty technically. And the stress of dealing with people, who are as dysfunctional or more so than you may be (come on, let’s all admit it), and office politics will cause you to develop some nasty habits, such as not caring about code quality anymore or worse, developing an abrasive personality.

A year and a half ago, I demoted myself back to individual contributor. I don’t regret being a manager. It was a great learning experience and it taught me that I dislike managing people and office politics. That’s not to say that I sucked at being a manager. I read tons of books, tried out all the techniques (most of which didn’t work), and eventually became an effective manager (at least in my mind). I even dabbled in office politics and pulled off a couple of successful maneuvers. But though I could become more successful at it, I found it was on the whole, a soul-sucking experience. If I want to deal with people, I would have kids; I’d rather spend my life-force on family than on a company. As my friend’s dad used to say, “I don’t hate kids; I just hate other people’s kids.”

Be mobile or get left in the dust

Recently, with the rise of mobile applications (for Android and iPhone), the need for experienced, senior developers will rise. Eventually, companies will need those applications to do functions which their SDKs don’t easily support. In Android, though you can write in Java, eventually you will need to go down to the low-level C language layer. Same with Apple iOS. At that point, you will need a senior developer who understands all of the low-level complexities (pointers, stacks, heaps, memory management, inter-process communication, etc.) in order to get the application to do what is needed. And with the restriction on memory and cpu in a mobile device, you will need those senior developers who can optimize and minimize.

This is the Indian Summer for senior developers and it is the near future. Just as the web applications are conquering the desktop applications (except complicated beasties like video editing and 3D games), mobile applications will conquer the web applications. So the second advice is to learn and master either Android or iPhone development (or better yet, both of them). Join a company doing mobile applications. Work on a mobile app as a side project. Do whatever it takes to build up your expertise so that you can be a technical liaison for mobile development when it becomes commoditized and off-shored.

An exception to the rule

The above advice only apply if you wish to remain an employee in a medium to large company. I believe that choosing the security and stability of a corporate job is perfectly fine; in fact, I’ve made this choice for most of my working life. If you have the talent and drive (worth much more than talent) to work for yourself, as a contractor/consultant or building your own business, I think you should go for it. It’s probably the most future-proof route. However, if you wish to continue working for a company, I hope that above advice will help you.

In an effort to simplify, I left a lot of nuance out of the above. However, I’ve learned that nuance is not necessary until people want it, and people won’t want it until they need it. But then I could be just talking nonsense about everything.

Unlock an AT&T iPhone 3G (with iOS 4.2.1) For Use With T-Mobile (RedSn0w Edition)

Mobile Devices No Comments

My nephew got an iPhone 3G and wanted to unlock it for use with his T-Mobile plan. Unfortunately, the iPhone was stuck in a weird state with only the Apple logo showing, and the iTunes application did not recognize it. I found that I could put the iPhone into Recovery mode. I then attempted to jailbreak using the custom PwnageTool firmware image I created in my last blog on iPhone jailbreak/unlock (my nephew’s iPhone 3G is the same model as mine’s). Unfortunately, the custom image restore process failed midway. I decided to load the latest official Apple iOS 4.2.1 image onto the iPhone and then use RedSn0w to jailbreak it.

To load the iPhone with the official Apple image, I had to put it into Recovery mode. Here’s how I got the iPhone into Recovery mode to do an official Apple restore:

  1. Connect the iPhone to the computer with the USB cable and start the iTunes application.
  2. Turn off the iPhone by holding the Power button until the Shutdown option appears at the top of the screen. If the iPhone is in a state where the shutdown option does not show and the screen is lit up, then just hold both the Power and Home buttons down for several seconds until the screen goes black.
  3. To enable Recovery mode, press and hold both Power and Home buttons until the screen lights up and you see the apple logo. Release the Power button but keep holding the Home button. After several seconds, iTunes will detect the iPhone and show a dialog saying the device is in recovery mode. You can release the Home button at that point.
  4. On iTunes, select the iPhone, and click the Restore button. Follow the iTunes instructions.

After the restore, the iPhone booted up with the following two messages: “No SIM card installed” and “Insert a valid SIM with no PIN lock to activate iPhone”. And when I slide to unlock the iPhone, it displayed a dial-pad with the title “Emergency call” mode. There was no way to access the normal application home screen. This was okay and something RedSn0w will take care of as part of the jailbreak.

To perform the jailbreak, I followed the instructions from How to Prepare your iPhone 4.2.1 for Unlock using RedSn0w.

  • In step 4, the download link for RedSn0w 0.9.6 beta 5 is broken. Instead, I downloaded it from Download Redsn0w 0.9.6 Beta 5 For Windows, Mac OS X.
  • In step 7, I saw a new option called “Enabled battery percentage” which was checked by default. I left it checked and when enabled in Settings->General, a useful charge percentage appeared next to the top-right battery icon on the iPhone.

Thankfully, the iPhone rebooted successfully and I was able to successfully repeat the unlock using UltraSn0w. My nephew was very happy with his new T-mobile iPhone!

Configure Wireless Access for the Brother HL-2280DW Multi-Function Laser Printer

Mac OS X, Windows No Comments

I scored a great deal on two Brother HL-2280DW Wireless Laser Printers (with scanner functions) during Thanksgiving break. Once I got the printers and tried to configure them for wireless, I found that Brother’s wireless configuration options were lacking and in some cases, didn’t work at all.

Unfortunately, the Ethernet connectivity on one of the printers was broken; worse, that was the printer I picked first to configure. After wasting half the weekend, I thought I would document how I finally went about configuring the wireless access for the Brother HL-2280DW printer and adding it to my Windows and Mac OS X machines. Hopefully, the steps below will help you with your Brother printer woes.

Configure Wireless Access With Ethernet Connection and Web Interface

Note: The WPS and “WPS with Pin” setup did not work with my Cisco Linksys E1000 router. And while the printer allowed me to manually input the SSID and passphrase using the up/down arrows, the printer’s LCD only displayed the first 10-12 digits of the passphrase making it impossible to input the rest! Because I dislike using the USB method (which required installing and then uninstalling software), I decided that using the printer’s Ethernet connection and web interface was the best solution.

  1. Before we start, you will need to know the following info concerning your wireless network (check your wireless router’s configuration):
    • Network ID (SSID)
    • Channel Number (usually 3, 7, or 11)
    • Authentication Method (WEP, WPA or WPA2)
    • Encryption Mode (TKIP or AES)
  2. Follow the included Brother “Start Here” manual to prepare the printer for operation.
  3. Before turning on the printer, connect it to your wireless router by Ethernet cable.
  4. After the printer is on, we will need to find its assigned IP address:
    • Look it up on the printer:
      1. Press the Menu button to the right of the printer’s LCD and you will see “1. General Setup” menu item show up. You might need to press the Menu button twice sometimes. (Do not select the “1. General Setup” item.)
      2. Select the following menu items by pressing the up/down arrows and clicking on the OK button:
        • 4. Network
        • 1. Wired LAN
        • 1. TCP/IP
        • 2. IP Address
    • Alternatively, you can browse to your wireless router’s web interface and look at the list of connected DHCP clients.
  5. Browse to the printer’s assigned IP address to access its web interface.
  6. Configure the printer to enable toner save mode and to allow printing even if the toner is low:
    1. Click on “General Setup” at the top.
    2. You will be prompted for the user/password. Input the default: admin/access.
    3. Set the following options:
      • Toner Save: On
      • Replace Toner: Continue
    4. Click on the Submit button
  7. Configure the wireless network access:
    1. Click on “Network Configuration” link at the top.
    2. Click on the “Configure Wireless” link near the bottom of the page.
    3. Configure the following options:
      • Communication Mode: “1) Infrastructure Mode”
      • SSID: [input your wireless ID]
      • Channel: [input the wireless channel]
      • Authentication Method: WPA/WPA2-PSK (usually)
      • Encryption Mode: AES (usually for WPA2)
      • Passphrase: [input your wireless password]
    4. Click the Submit button.
    5. Answer Yes to “Would you like to enable the wireless interface?”.
    6. You will get a message to unplug the Ethernet cable. The printer will reboot and then print a page indicating whether the wireless connection succeeded or not.
  8. If the wireless connection didn’t succeed, then connect the Ethernet cable and repeat from step #4. Usually, the wireless router will give the printer the same IP address.
  9. If you are totally lost, you can reset the printer configuration by doing the following:
    1. Click on the Menu button next to the printer’s LCD.
    2. Select the following with the up/down arrows and the OK button:
      • 1. General Setup
      • 5. Reset
      • 2. All Settings
    3. Hit the Up arrow to Reboot.

Mac OS X: Add Printer, Set Toner Save Mode, and Scan

To add the printer on Mac OS X, do the following:

  1. Open up System Preferences.
  2. Click on “Print & Fax” under Hardware.
  3. Click the Plus button underneath the list of printers on the left.
  4. Bonjour should detect the printer and you will see “Brother HL-2280DW” listed.
  5. Select it and the “Print Using:” field will populate with “Brother HL-2280DW CUPS” driver.
  6. Click the Add button.
  7. The Brother HL-2280DW should show up on the list of Printers. To make it the default printer, double-click on it and select “Set default printer”.

To configure Mac OS X to use Toner Save Mode by default:

  1. Browse to the local CUPS driver web interface running on your machine.
  2. Click on the Printers tab to the top-right.
  3. Click on the “Brother_HL_2280DW” printer in the list.
  4. Click on the Administration drop-down list box and select “Set Default Options”.
  5. Change “Toner Save Mode” to be “On”.
  6. Click on “Set Default Options” button.
  7. If you are prompted for a user/password, input your Mac OS X login username and the administration password.

The built-in way to do a scan on Mac OS X:

  1. Open up System Preferences.
  2. Click on “Print & Fax” under Hardware.
  3. Select the printer.
  4. Click on the “Scan” tab.
  5. Click the “Open Scanner…” button.
  6. Click “Show Details” for more options like output format and location.
  7. Make your selections and click on the “Scan” button.
  8. The scan will be taken.

Windows XP and 7: Add Printer, Set Toner Save Mode, and Scan

To add the printer on Windows, do the following:

  1. Download the latest Brothers HL-2280DW printer software (it is the same file for Windows XP, Windows 7 32-bit, and Windows 7 64-bit and is named “HL-2280DW-inst-B1-usa.EXE”).
  2. Run the downloaded installation executable.
  3. Select “usa” for language. Click OK.
  4. Select “Wireless Network Connection” and check “Custom Install”.
  5. Take the default for “Change the Firewall port settings…”. Click Next.
  6. Take the default selected features (all are selected) and click Next.
  7. I usually select “No, I don’t want to register this PC to ‘Scan To’ button”; however, feel free to select Yes. (I think this option is so when you press the Scan button on the printer, it will send the image to this computer.) Click Next.
  8. On Windows XP:
    1. Keep the “Search the network for devices…” selected and click Next.
    2. Select the found Brother printer (the node name looks like “BRxxxxxxxxxx”) and click Next.
  9. On Windows 7, the printer detection doesn’t work so you will select either “Specify your machine by address” (IP address) or “Specify your machine by name” (node name/hostname). I usually do it by using the node name:
    1. To lookup the node name, go to the printer, press the Menu button, select “4. Network”, “2. WLAN”, “1. TCP/IP”, and “5. Node Name”. (Alternatively, the wireless router’s DHCP client table should have the printer’s hostname which is the same as the node name.)
    2. Back in the Brother setup dialog, select “Specify your machine by name” and input the node name.
    3. Click Next.
  10. The installation program will take several minutes to install the various Brother driver and tools.
  11. Click Next and Next to skip the “User’s Guides” and “On-Line Registration”.
  12. I usually uncheck “Enable Status Monitor on startup” and leave the “Set as Default Printer” checked. Click Next.
  13. The setup will request a reboot.
  14. After the reboot, you will see a new, red “CC4″ icon in the status tray. This is the Brother Control Center software which allows you to set device properties, print, and scan. Because I prefer using my own programs to scan, I usually remove this from the tray by doing the following:
    1. Right-click on the CC4 icon and select “Preferences”.
    2. Unselect “Start ControlCenter on computer startup”.
    3. Hit the OK button.
    4. Right-click the CC4 icon and select “Close”.
  15. (OPTIONAL) Even though I have configured the Brother software to not run Control Center and the Status Monitor (unchecked “Enable Status Monitor on startup” in last page of installation wizard), Brother still runs them stealthily on startup. To really get rid of them, I had to do the following:
    1. Run “msconfig”.
    2. Select Startup tab.
    3. Under Windows 7, uncheck “Brother ControlCenter” and “Brother Status Monitor Application”.
    4. Under Windows XP, uncheck “BrCcBoot” and “BrStMonW”.
    5. Click Apply and then click OK.
    6. You may be prompted to restart.

To configure Windows to use Toner Save Mode by default:

  1. Go to menu “Start->Control Panel”.
  2. On Windows XP:
    1. Click on “Printers and Other Hardware”.
    2. Click on “View installed printers or fax machines”.
    3. Right-click on printer and select “Printer Preferences” to open the “Brother HL-2280DW Printer Printing Preferences” dialog.
  3. On Windows 7:
    1. Click on “View devices and printers”.
    2. Double-click on the Brother printer to open it.
    3. Double-click “Adjust print options” to open the “Brother HL-2280DW Printer Printing Preferences” dialog.
  4. In the Printer Preferences dialog:
    1. Select the Advanced tab.
    2. Check the “Toner Save Mode” option.
    3. Hit the Apply button and then the OK button.

The built-in way to do a scan on Windows XP:

  1. Run “Start->All Programs->Accessories->Scanner and Camera Wizard”.
  2. The Brother printer will be listed at the top. Click Next.
  3. Click on Preview, select options, and click Next.
  4. Select output format and folder. Click Next.
  5. The scan will be taken.

The built-in way to do a scan on Windows 7:

  1. Run “Windows Fax and Scan”.
  2. Click the “New Scan” button in the top toolbar.
  3. Hit Preview to see a preview image.
  4. Select the options and hit Scan.
  5. The scan will be taken.

Though I refer specifically to the Brother HL-2280DW, these instructions may apply to other wireless printers.

PHP Script to Convert Firefox’s “sessionstore.js” to HTML

Internet 1 Comment

Today, my Firefox browser decided to freeze on startup while loading the pre-existing tabs. After killing it and restarting several times, I realized that the only way to recover was to prevent Firefox from loading the tabs. I located Firefox’s “sessionstore.js” file and moved it (one could also rename it). I started Firefox and it came up fine.

To find the “sessionstore.js” file on Windows 7, open up a “Command Prompt” and type the following:

cd %APPDATA%\Mozilla\Firefox\Profiles
cd <random_alphanumeric>.default

The macro %APPDATA% will translate to “C:\Users\your_username\AppData\Roaming”.
Windows XP and Mac OS X will have the “sessionstore.js” file in a different location.

I had about 25 tabs opened in the previous session and I did not want to lose those tabs. The tab URLs were stored in the “sessionstore.js” file but the file was big (it contained the open tab URLs and historical URLs) and hard to parse (it was a single huge JSON text string).

I decided to write a PHP script to convert the JSON string into an HTML file with a list of all the URL as links. Below is the PHP script I wrote. Just run it using the command line PHP executable, provide the “sessionstore.js” file location as the input, and it will create a “sessionstore.js.html” file (in the current directory), which you can then open in a browser to see the list of links.

<?php
{
 // Make sure we have the correct number of args
 $args = $_SERVER['argv'];
 if (2 != $_SERVER['argc']) {
   echo "Format: $args[0] <filename>\n";
   exit(-1);
 }
 $filename = $args[1];

 // Read the input file into a json string
 $jsonStore = file_get_contents($filename) or die("Failed to open input file");

 // Convert the json string into an object
 $store = json_decode($jsonStore);

 // Create an output .html file
 $file = fopen("$filename.html", "w") or die("Failed to create output file");

 // Add HTML header
 fwrite($file, "<html><body><ul>\n");

 // Parse the session store object and generate HTML links for each tab.
 // Session stores have windows->tabs->entries array-of-arrays structure.
 $windows = $store->windows;
 foreach ($windows as $window) {
   $tabs = $window->tabs;
   foreach ($tabs as $tab) {
     $entries = $tab->entries;
     foreach ($entries as $entry) {
       fwrite($file, "<li><a href=\"$entry->url\">$entry->title</a>\n");
     }
   }
 }

 // Add HTML footer
 fwrite($file, "</ul></body></html>\n");

 // Close the output file
 fclose($file);
}

If you find that the “sessionstore.js” does not contain your open tabs, use the “sessionstore.bak” backup file instead. I hope that the script above may prove useful for you. Good luck with your Firefox blues.

Unlock an AT&T iPhone 3G (with iOS 4.1 or 4.2.1) For Use With T-Mobile

Mobile Devices No Comments

My friend gave me his old AT&T iPhone 3G. I decided to unlock it for use with T-Mobile. On the web, there was a lot of info on how to go about doing the unlock and a lot of caveats. I wanted to summarize my findings below and provide details on how I went about the process of unlocking the iPhone 3G. (Though I did the unlock on Mac OS X, the instructions for Windows are the same.)

Note: I decided to remove the AT&T SIM card to see if I could do the unlock without it. This would be useful for those who got their iPhone 3G without an AT&T SIM card. It turns out that the AT&T SIM card is not required. (To remove the SIM card, locate the card slot at the top of the iPhone 3G with a visible little hole. Insert the end of paperclip into the hole, push down gently, and the SIM card holder will pop up.)

Some important pointers:

  • There are software and hardware unlocking methods. The hardware unlock usually requires a custom SIM card overlay or a custom SIM card holder. I will be doing a software unlock.
  • An iPhone has two very important information, the iOS version and the baseband version, which determines whether the unlock is possible. Confusingly, some websites will refer to the iOS version as the “firmware” version and Apple refers to the baseband version as the “modem firmware”.
  • An official Apple iOS version update may also include a baseband version update. Unlock is very dependent on the baseband version so be very careful to avoid official Apple iOS upgrades unless you know what you are doing.
  • In order to unlock, you must jailbreak first. The popular jailbreak methods (like RedSn0w and PwnageTool) will include a way to preserve the baseband version. PwnageTool creates a custom upgrade file (ipsw) by modifying the official upgrade ipsw file to remove the baseband version update.
  • The software unlock method “UltraSn0w” that I plan to use supports only specific baseband versions.

First, we need to figure out what we are working with:

  1. Determine the iPhone model by looking at the back of the phone for the model number. Check the Apple site to find a match. My iPhone had a model number of “A1241″ which matched with “iPhone 3G”. (I couldn’t tell visually whether I had an iPhone 2G, 3G, or 3GS.)
  2. Determine the iOS and baseband versions by going to “Settings->General->About” on the iPhone. My iPhone 3G had an iOS “Version” of 4.1 and a baseband “Modem Firmware” version of 05.14.02.

Unfortunately, my iPhone 3G had a baseband version 05.14.02 which was not supported by UltraSn0w according to this UltraSn0w unlocking tutorial. If I upgrade to iOS 4.2.1, the baseband version would be upgraded to 05.15.xx which is also not supported by UltraSn0w. The workaround is to upgrade the baseband to the 06.15.00 version, which is surprisingly provided in the iPad 1 iOS 3.2.2 image.

Updating to 06.15.00 baseband is not reversible (back to 05.14.xx or 05.15.xx) so it would void the Apple warranty (I didn’t care because the iPhone is out of warranty) and future upgrades would require custom ipsw images. To me, it looks like Apple doesn’t plan to upgrade iPhone 3G past iOS version 4.2.1 and even if that were to happen, I could figure out how to use PwnageTool to create the necessary custom ipsw image. So, I made the decision to upgrade the iOS version to 4.2.1 and the baseband version to 06.15.00 so I could unlock using UltraSn0w.

According to the UltraSn0w tutorial, I could jailbreak and update to 06.15.00 using either the RedSn0w jailbreak tutorial or the PwnageTool jailbreak tutorial. I decided to use the PwnageTool because it would allow me to avoid having to do an official Apple iOS upgrade to 4.2.1 (required by the RedSn0w method) and it would allow me to get familiar with PwnageTool (I have used RedSn0w before).

To perform the jailbreak, I followed the PwnageTool tutorial step by step:

  • Before starting, I connected my iPhone 3G using the USB cable and quit the iTunes application.
  • In step #1, make sure to download the specific version 4.1.3 of PwnageTool requested (I tried the latest version 4.3.3.1 which wouldn’t accept any of the ipsw files), the iPhone 3G iOS 4.2.1 image file “iPhone1,2_4.2.1_8C148_Restore.ipsw”, and the iPad 1 iOS 3.2.2 image file “iPad1,1_3.2.2_7B500_Restore.ipsw” (which contained the 6.15.00 baseband).
  • In step #5, the first ipsw file to select is the iPhone 3G iOS 4.2.1 ipsw image file. The second one to select is the iPad 1 iOS 3.2.2 ipsw image file containing the baseband.
  • Step #6 was a little confusing. After reading it a couple of times, I got that if you plan to use the iPhone with the service provider it was originally locked to, then do not check the “Activate the phone” option. If like me, you wish to use an unofficial service provider (I’m using an AT&T iPhone with T-Mobile), then check the “Activate the phone” option. (For me, the “Activate the phone” option was selected by default.)
  • Also in step #6, my “Root partition size” was set to 731MB by default. I manually increased it to 834MB to match the picture in the tutorial. (I don’t know if this was necessary or not, but I figured it could only help.)
  • During step #12, when following PwnageTool’s steps to put the iPhone into DFU mode, the iTunes application was automatically started. I minimized iTunes and restarted the PwnageTool DFU instructions. When the iPhone entered DFU mode, iTunes threw an error dialog saying there was an unrecognized device. I had to disconnect and reconnect the USB cable in order for iTunes to recognize the phone properly and the DFU mode. (Now that the iPhone was in DFU mode, I quit the PwnageTool application.)
  • Once the iPhone was successfully restored (using the PwnageTool custom ipsw image) and restarted, I verified that the “Settings->General->About” listed the Version as 4.2.1 and the Modem Firmware as 6.15.00.
  • Whew, I was really glad the iPhone came back to life because I was waiting for a long time. The restore took about 10 minutes and the restart took several minutes.

To perform the unlock, I followed the original UltraSn0w tutorial step by step:

  • Before starting, I configured the iPhone (Settings->Wi-Fi) to connect to my wireless network.
  • In step #2, Cydia took a couple of minutes to update itself on initial startup. Then it asked me if I would like to update packages. I selected the “Complete Upgrade” option which took several minutes to complete and required a reboot. (Once Cydia was done with the update, it showed a large Reboot text at the bottom of the screen; I just tapped on the text to do a reboot.)
  • In step #3, I clicked on the Cydia Search tab to find and install UltraSn0w (that’s a number zero in the word “sn0w”). The UltraSn0w installation also required a reboot when it completed.

Finally everything was done. I shut down the iPhone, inserted my T-Mobile SIM card, and restarted. After startup, the iPhone took a couple of minutes to find the T-Mobile network. Because my T-Mobile plan did not have a data plan (and I didn’t want to be charged for one), I disabled the 3G connectivity function by going to “Settings->General->Network” and setting the “Enable 3G” and “Cellular Data” options to Off. I then tested the iPhone by taking a call, making a call, receiving a text, and sending a text. It works, yeah!

Hopefully the above is helpful. Good luck with your unlocking.

Migrating from Windows XP to Mac OS X, Part 2

Mac OS X No Comments

It has been over a year since I migrated to a Macbook Pro laptop and started using the Mac OS X operating system. Since then, I have learned some useful tips and tricks, which I have shared below.

Using Keyboard Shortcuts

If you can master keyboard shortcuts, you will be able to perform some actions (especially repetitive ones) much faster than using the trackpad.

Enable Tabbing Between All Controls

This will allow you to tab to any control, such as a button, in a window or dialog.

  1. Go to “System Preferences” and Keyboard.
  2. In the “Full Keyboard Access: …” section at the bottom, make sure that the “All controls” radio option is checked.

Strangely, after you tab to a button, some dialogs require you to press the Return key and other dialogs require you to press the Space key in order to “click” the button.

Perform a Screen Capture

Use the following key combinations to perform either a full screenshot or a cropped screenshot:

  • Simultaneously press Apple + Shift + 3 keys to perform a full screenshot.
  • Simultaneously press Apple + Shift + 4 keys to enter cropped screenshot mode, where the cursor becomes a target icon. Click down, without releasing, to pick a corner of the shot and drag to frame the shot (you will see a translucent rectangle). Release to take the cropped screenshot.

The screenshots will appear on your desktop as PNG image files.

Deleting Files

Select one or more files and simultaneously press Apple + Delete keys to delete them. This key combination will also work to delete folders. The deleted files and folders are placed in the waste basket.

Force Quit an Application

If your Mac OS X appears to be frozen due to an unresponsive program, one drastic measure is to kill that program’s process. Simultaneously press Command + Option + Esc keys to open up the “Force Quit Applications” dialog, select the offending application, and click on the “Force Quit” button.

Note: For more details on running applications (in addition to disk, memory, and network usage), you can launch the “Activity Monitor”.

Just for Fun

There are a ton of keyboard shortcuts. You just have to find the ones most useful to you. For example, here’s a fun shortcut: press Fn + Shift + F10 keys to make the current window bright and slowly move to the center, while everything else fades away.

Command Line With Terminal

The Terminal application is equivalent to the Linux shell or the DOS command prompt. For certain activities such as writing scripts or doing development, I prefer to use the command line. So I was very glad that Mac OS X came with the Terminal application. One can open several Terminals and even skin them so they will be partially transparent.

Launch an Application

One can launch a Mac OS X application from the Terminal by issuing the following commands:

  • Run “open [application | file | directory | URL]” to launch a particular application (ex: “/Applications/TextEdit.app”), open a file with its default associated application, open a directory using Finder, or browse to a URL using the default browser respectively.
  • Run “open -e [file]” to open a file with the TextEdit application.
  • Run “open -a [application] [file]” to open a file using the specified application.

Debug the Wireless Network

Mac OS X comes with a nifty command line wireless utility called airport. To enable easy access to it, run the following to put it in the command line’s search path:

sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/sbin/airport

Once you have run the above, you can now issue the following commands:

  • Run “airport -I” to see the current wireless status, what SSID you are connected to and the strength of the signal. Note that some of this info is also shown if you hold down Option key while clicking on the Airport status icon in the top menu bar (on the right-hand side).
  • Run “airport -s” to scan the wireless broadcast space.
  • Run “airport -z” to disassociate from any wireless network.

Some other useful commands are:

  • Run “ifconfig en1″ to see your machine’s assigned IP address on the wireless network.
  • Run “dscacheutil -flushcache” to flush the DNS cache.

Where’s My CD?

To access another partition or a CD using Terminal, change to the “/Volumes” directory.

Reset Your Admin Password

If you ever forget your administrative password, there are two easy methods to reset the password. One requires the Mac OS X Install CD and the other does not.

Require the Mac OS X Install CD

First method is to boot from the Mac OS X Install CD and run the reset password application.

  1. Insert the Mac OS X Install CD and restart the Mac.
  2. Hold the “C” key on startup to boot from the CD.
  3. Once the specialized Mac OS X operating system on the CD is booted, go to menu “Utilities->Password Reset”.
  4. Select the Mac OS X hard drive.
  5. Select your username and input the new password.
  6. Restart the Mac.

Don’t Require Mac OS X Install CD

Second method uses single user mode and does not require the Mac OS X Install CD.

  1. Restart the Mac.
  2. On startup, hold the Command + S keys down to boot into single user mode.
  3. Once you have Terminal access, input the following commands to reset your password:
    mount -uw /
    ls /Users
    passwd [your_username]
    shutdown -r now

    The second command will show the list of users, one of which will be your username.

  4. Alternatively, if you wish to have Mac OS X prompt you to create a new administrative user, run the following command instead of the “passwd [your_username]“:
    rm /var/db/.AppleSetupDone

    Deleting the .AppleSetupDone file will cause Mac OS X to re-run the setup wizard on bootup, which will prompt you to create a new user account with administrative permission. You can then run “System Preferences->Accounts” to reset any user’s password.

Note: Did you know that Mac OS X, like Windows, has a Safe Mode? If you ever need it, just hold the Shift key on bootup to go into Safe Mode.

Bootcamp for the Schizophrenic

Bootcamp comes with Mac OS X and allows you to dual-boot into either Mac OS X or Windows. It is very easy to setup as long as you have an official Windows installation CD with product key. The only decision you have to make is how much space to allocate to Windows; I recommend 32GB or more for Windows 7 to allow space for applications.

Install Windows

Run “Boot Camp Assistant” and follow the directions.

  • The Windows Support Software can be considered Windows drivers for Mac hardware such as video cards, trackpad, etc. I consider it a requirement, otherwise Windows would not perform well on the Mac.
  • For the “Download Windows Support Software” page, I selected the second option since I had the Mac OS X Installation CD. I did try the first option “Download the Windows support software…” on another Macbook but it failed after several minutes; maybe you will have better luck if you use this option.
  • Per the instructions, insert the Windows installation CD and start the Bootcamp installation.
  • Note: I recommend using an official, unmodified Windows CD. I tried this with a customized, no interaction Windows Install CD and its custom installation script repartitioned the whole drive as a Windows partition (thereby destroying the Mac OS X partition). To recover, I had to reinstall the Mac OS X operating system from scratch.

Configure Windows

Once Bootcamp is installed, on startup, just hold the Option key down and you will be presented with a menu to select either Mac OS X or Windows to boot into. When you are in Windows, insert the Mac OS X Install CD to install the necessary Apple Windows drivers. Once installed, you will see a Bootcamp icon in the bottom-right dock which will allow you to configure the Trackpad, which OS to boot by default, etc.

Mac Keyboards Are Strange!

You will need to either get used to using Windows with the Mac keyboard or alternatively, to remap the Mac keys to match Windows.

Emacs The Way You Want It

Mac OS X comes with a command line version of Emacs. However, I’ve gotten used to GNU Emacs on Windows and wanted the same on the Mac OS X. Here’s how to install GNU Emacs on your Mac:

  1. Download the latest GNU Emacs for Mac OS X.
  2. Open the disk image and copy Emacs.app to the “/Applications” folder.
  3. You can launch GNU Emacs from the command line using “open -a /Applications/Emacs.app [file]“.

Customize Emacs

If you want to customize Emacs to disable the startup splash screen and enable mouse scrolling, create a “~/.emacs” file with the following content:

;;Prevent startup splash screen
(setq inhibit-splash-screen t)

;;Increase width to 120 chars
(add-to-list 'default-frame-alist (cons 'width 120))

;;Set tab to be displayed as 4 spaces, not the default 8
(setq-default tab-width 4)

;;Enable wheelmouse support
(require 'mwheel)

;;Define the mouse scroll wheel
(defun up-slightly () (interactive) (scroll-up 5))
(defun down-slightly () (interactive) (scroll-down 5))
(global-set-key [mouse-4] 'down-slightly)
(global-set-key [mouse-5] 'up-slightly)

;;Support for scrolling (two finger scrolling is double-wheel-up/down)
(global-set-key [wheel-down] 'up-slightly)
(global-set-key [wheel-up] 'down-slightly)
(global-set-key [double-wheel-down] 'up-slightly)
(global-set-key [double-wheel-up] 'down-slightly)
(global-set-key [triple-wheel-down] 'up-slightly)
(global-set-key [triple-wheel-up] 'down-slightly)

Restart Emacs for the changes to take effect.

Remove Windows Return Characters

Files from Windows may contain return characters which show up as visually distracting ^M characters in Emacs. Worse, the Windows return characters inside a bash script file will cause errors on execution. To remove the Windows return characters, open the file in Emacs and perform one of these two methods:

  1. Type “Esc-x set-buffer-file-coding-system”, Enter key, “unix”, Enter key to switch the format to Unix (from Windows).
  2. Type “Esc-x replace-string Ctrl-q Ctrl-m” and Enter key to replace the Windows return characters with nothing. The Ctrl-q will allow you to type control characters into the input buffer, such as Ctrl-m for the Windows return character.

Miscellaneous

This is the dumping ground for random, but possibly useful tips.

VMWare Fusion

When using VMWare Fusion running Windows, you will need to add Fn to the normal Windows keyboard shortcuts. For example:

  • Use Fn + Control + Option + Delete keys to issue a Windows Ctrl-Alt-Delete command.
  • Use Fn + Delete to issue a Windows Delete command.

Firefox

To run Firefox in 32bit mode by default (so some legacy plugins can work):

  1. Go to /Application and select the Firefox icon.
  2. Left-click and select “Get Info” on the Firefox application.
  3. Check the “Open in 32-bit mode” box.

Did you know that you can issue commands in the Firefox address bar? Try the following:

  • Input “about:blank” to get a blank page. (You can also set this as the home page.)
  • Input “about:sessionrestore” to load the tabs that were opened in the previous session. Try using this if Firefox complains that it is unable to recover your saved tabs on startup.
  • Input “about:plugins” to see a description of all the installed plugins.

The above will work in Firefox running on all supported operating systems.

Hopefully all the tips here will help you to enjoy your own Mac migration.

Import Movies and TV Shows to Your Apple iPad

Audio Visual, Mobile Devices No Comments

Have you ever imported movies and TV show episodes into your Apple iPad and have them show up as generic videos, not movies or TV shows? Worse, these videos show up without a preview image, just a totally black square? And are the episodes nicely grouped under the TV show’s name? Finally, when you play a movie, can you skip to later chapters?

Well, I have had all of the above problems until I discovered Subler. Subler is available only for Mac OS X. It is used to add meta-info to the movie or TV episode files so they will show up in iTunes and iPad correctly as movies or TV shows. In addition, Subler supports adding chapters, subtitles, and secondary audio tracks (like for other languages). Below are my notes on how I used Subler.

Before anything else, you will need to convert your movie or TV episode into the iPad supported format (usually an MPEG4 file ending in .m4v or .mp4 extension). There are several resources on the Internet about how to do the conversion. Here is a nice tutorial using the free Handbrake tool to convert a movie DVD. If you use this tutorial, before importing the movie into iTunes, make sure to run Subler on it to add a preview image and chapters.

Apple iPad Supported Formats

A quick google search identifies that the iPad supports the following video formats:

  • H.264 video (up to 720p 1280×720, 30 frames per second) with AAC audio (main profile level 3.1 with AAC-LC audio up to 160 Kbps, 48kHz, stereo) in .m4v, .mp4, and .mov file formats.
  • MPEG-4 video (up to 2.5 Mbps, 640 by 480 pixels, 30 frames per second) and AAC audio (simple profile with AAC-LC audio up to 160 Kbps, 48kHz, stereo) in .m4v, .mp4, and .mov file formats.
  • Motion JPEG (M-JPEG) video (up to 35 Mbps, 1280 by 720 pixels, 30 frames per second) and PCM audio (ulaw, stereo) in .avi file format.

For simplicity, I always encode movies and TV episodes using the first format: H.264 video and AAC audio.

Using Subler for Movies

I use Subler to add a preview image and chapters to a movie file. Subler will also add meta-info to indicate that the file is a movie type so that iTunes and iPad will recognize it accordingly. Here are the steps:

  1. Launch Subler. Subler won’t open a default project window so the only change you will see is that the top menu title changes to Subler.
  2. (Do this once) Go to menu Subler->Preferences and check the “Create Preview Images” for Chapters. This will cause Subler to generate chapter preview images when you save. Without this option, chapters will show up as black squares on the iPad. (QuickTime player and iTunes will generate the chapter previews on the fly if they don’t exist, but the iPad won’t.)
  3. Go to File->Open to find your mp4 or m4v iPad supported movie file. The project window will appear.
  4. In the project window, you will see a line for the “Video Track” for video and “Sound Track” (or sometimes “Stereo” track) for audio. Optionally, you may see a second audio track, a “Subtitle Track”, or a “Chapter Track”. Tracks with a check are enabled by default.
  5. If you don’t select any of the track line items (just click on any blank area in the project window), you should see the following appear at the bottom: Metadata, Artwork, and Other Settings.
  6. Go to menu “File->Import->Search metadata online” to find the movie description and artwork (preview image).
    • The Movie search tab will be selected by default.
    • Input the Movie Title, click the Search button, select the movie, and click the Add button.
    • Select a picture and click the “Set as artwork” button. Note that I could not find a way in Subler to change the artwork once it has been selected!
    • The Metadata and Artwork content at the bottom will be populated.
  7. Go to menu “Edit->Insert a Chapter Every X minutes” to add the chapters. I recommend selecting the “5 minutes” interval.
    • A “Chapter Track” will appear.
    • Make sure to check the chapter track to enable it.
  8. Commit your changes by going to menu File->Save. Subler will generate the chapter preview images and store them in a new “Video Track” with format “Photo – JPEG”. Leave this new video track unchecked.

Using Subler for TV Episodes

Adding meta-info to TV episodes is very similar to the above. The difference to keep in mind is that episodes have seasons and are numbered. iTunes and iPad will use the seasons and episode numbers meta-info to group TV episodes together (usually episodes together under a season). If you end the TV episode file names with the season and episode number like “S02E15″ (Season 2, Episode 15), Subler will automatically pre-populate the search form. Here are the steps:

  1. Open the TV episode file using menu “File->Open”.
  2. Go to menu “”File->Import->Search metadata online”.
  3. If you have named your file with the season and episode number, Subler will select the TV Episode search tab and fill in the TV Show, Season #, and Episode # fields. If this didn’t happen, manually make the selection and inputs.
  4. Select the TV episode and artwork like above. (The first option for artwork is usually a screenshot from the episode. I recommend you select this so that each episode will have a unique preview image.)
  5. Verify the info in the Metadata tab content at the bottom. Make sure that the TV Season, TV Episode #, and Track # (aka episode number) is correct. The “Track #” will consist of the episode number and the total number of episodes in the season; for example, “5/21″ meaning episode number 5 out of 21 episodes. Usually the Metadata will not have the total number of episodes; when you save without specifying it, the Track # will default to zero for total number of episodes. (I don’t think missing the total number of episodes will affect iTunes or iPad, but I have not tried it.)
  6. I don’t believe that the “TV Episode ID” is used by iTunes or iPad; however, it doesn’t hurt to make sure it is correctly filled-in. Basically, it is the season followed by the episode number; for example, “203″ meaning season 2 and episode 3.
  7. I believe you can add chapters to TV episodes if you wish to. I don’t think it hurts and I’m not sure if iTunes or iPad will make use of chapters for TV episodes.

Use Subler to Increase Sound Volume

Subler has other functions which allow you to scale the video resolution or increase/decrease the sound volume. To double the sound volume:

  1. Select the “Sound Track” in Subler.
  2. In the Sound Settings that appear below, drag the Volume marker to the maximum “+6 db” setting. (From a quick google seach, “+6 db” effectively equals to double the sound volume.)

If you need to increase the sound volume further, you may wish to use a tool like AACGain.

Finally, import your movies and TV episodes to iTunes and/or iPad. They will show up under the correct Movies or TV Shows section, instead of the generic Videos section. Good luck!

For more info and advanced tips, see the following web forums and websites:

Holy Cow, Batman! My Linux Server Got Hacked!

Linux 1 Comment

It was quiet, peaceful Tuesday night when I attempted to log into my Ubuntu Linux server as the root user. Permission denied, I got back. I tried it again. And again. Access denied. What the heck? I’m sure it was the correct password. I then tried all the passwords that it could be, from past to present. No luck. I got a sinking feeling. My root password was easy to remember and thus, easy to guess. I think my Linux server has been hacked!

No problem, I thought, I just have to reboot and log into single user mode… uh, unfortunately, my Linux server was sitting somewhere in cyberspace and I couldn’t do any of that. So I called up the service provider and they said, we didn’t touch your server and we don’t know who did. However, for $25, they can reset the root password. Having no choice, I accepted. Hours passed and finally I got an email with the new password.

I logged in, viewed the “/etc/passwd” file, and noticed two new users. Bad news, my server definitely got hacked. Good news, the hackers weren’t too sophisticated and had left a huge clue. I immediately copy the users’ info down and deleted them. Then it was off to google for what to do after a server hack. After looking at several websites, the most relevant one I found was How to restore a hacked Linux server.

What I got from the research was that once your Linux server is compromised, the best solution is to re-install the operating system. I did not want to do that because it would cost (a) money to ask the service provider to reinstall Ubuntu and (b) time for me to reinstall the applications. So I decided to play detective, find any damages, and fix them. Below are the steps I took.

1. Are there any unidentified users?

Run the following to list the users and groups:

more /etc/passwd
more /etc/group

Make a copy of the unknown users’ info, especially their usernames and ids, and delete them using the “userdel <unknown_username>” command. You should also check for and delete their home directories, located at “/home/username”.

2. Are there any strange processes running?

Run the following to list all the active processes started by the root or by the unidentified users:

ps -aef | grep root
ps -aef | grep <unknown_username>

Look for processes with weird names like “AkjwetSAG”; these are usually suspect. You can then run “lsof -p <process_id>” to get more info.

On my Ubuntu server, I found two processes, “avahi-daemon: chroot helper” and “/usr/sbin/console-kit-daemon –no-daemon”, that looked weird; but it turned out they were valid processes. After some quick online searches, I found that Avahi was used to detect network devices (not necessary for a server so it can be disabled or deleted) and console-kit was used for GUI related functions.

3. Are there any tracks left by the perpetrators?

Run the following to find any commands to change a password in the system:

cd /var/log
grep -R -i passwd *

This command returned several entries in the “auth.log” which included password changes for the unidentified user accounts. Strangely, there was no reference to a password change for the root user. By luck, there were two “Invalid user passwd from <ip_address>” messages containing the IP addresses of the perpetrators.

I then did a search on each of those two IP addresses:

grep -R -i <ip_address> *

I got back a ton of entries in “auth.log” which show numerous failed attempts using different usernames from these two IP addresses. I guess they kept trying until they got lucky. And they got lucky about five days ago.

Just for curiosity’s sake, I installed traceroute (it isn’t installed on Ubuntu by default) to see where the perpetrators came from:

apt-get install traceroute
traceroute <ip_address>

One of the IP address came from “CHINA-NETCO.edge3.SanJose1.Level3.net” and the other from “DC-PT-01-te1-2.ip4.012.net.il”. China and Israel. But there was no guarantee that those were the origins because the perpetrators could have hacked some machines there and then used those machines to hack into my server.

4. Are there any surprises left behind?

To be on the safer side, I installed and ran two rootkit scanners recommended by the website I found:

apt-get install rkhunter
rkhunter --check

apt-get install chkrootkit
chkrootkit

Both reported a clean bill of health. There were one or two false positives which I investigated and cleared. Finally, some good news! It looks like the hackers didn’t do anything damaging (cross my fingers).

5. Any strange new files?

One of the recommended actions was to look for new files that were created since the break-in. But I didn’t find this useful at all; it was like looking for a needle in a haystack. (Funny, in real life, robbers take stuff. In cyberspace, they leave stuff… malicious stuff.)

On Ubuntu, I couldn’t find a way to search for newly created files since 5 days ago. So I did the next best thing, which was to search for files last modified in the past 5 days.

find / -mtime -5

Unfortunately, the service provider had rebooted the machine as part of the password reset. So I got a ton of results back. Too much info to process.

6. What can I do to prepare for the next assault?

First, secure the root access. I changed the root password to an incomprehensible, random string of numbers, letters (lower and upper case), and special symbols. Try guessing that! And I will only share this root password with one other person as a backup.

Second, enable auditing of the server so we will have a record of every command issued by any user. This will make it easier to figure out what actions any user, legitimate or not, does on the server. I installed the Process Accounting (psacct or acct) service which this website recommended.

apt-get install acct
service acct start

By default, the service is configured to start on bootup. To double-check, I tried using the “update-rc.d acct defaults” command but got back a strange warning “update-rc.d: warning: acct stop runlevel arguments (0 1 6) do not match LSB Default-Stop values (1)”. I didn’t know what it meant so decided to use an alternative check:

apt-get install chkconfig
chkconfig acct

This command returned “acct on”, meaning that the Process Accounting service was configured to start on bootup.

Hopefully the above info will help you should you ever encounter the same misfortune. And maybe, the last section might help you to be better prepared.

« Previous Entries