Wednesday, May 25, 2011

My vimrc for Windows

I need gvim in Windows to support accented characters for my Latin homework. Adding
:set encoding=utf-8
to _vimrc helps with input. Now I can press
ctrl-k a -
to get lower-case 'a' with a macron. The next trick is to add
:set guifont=DejaVu_Sans_Mono:h10:cANSI
so another font is used. This actually displays the lower-case 'a' with a macron instead of a black rectangle. To see what fonts are available and to help in constructing the guifont arguments, type into vim
:set guifont=*
A font selection dialog will pop up. Choose a combination that works for you, then type
:set guifont
to see what needs to be put into _vimrc. By the way, I put _vimrc in C:\Documents and Settings\Administrator, which I figured out by typing
:echo $HOME
into vim.

Tuesday, May 17, 2011

Epson P-3000 hard drive upgrade #2

Since the old WD 1200BEVE drive was resetting (or something) whenever it was flipped around or jarred, I decided to get a Samsung HM160HC on sale from NCIX for about CAD 56 after tax. Here it is installed in the P-3000. Sorry about the poor lighting. The Epson P-3000 would not boot up if the entire drive (minus a bit for EPV_SYSTEM) was partitioned for data, so I did a some binary searching to find a working configuration. Here's what I finally settled on:
Disk /dev/sdb: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xfa08a67c

Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       16700   134142718+   c  W95 FAT32 (LBA)
/dev/sdb2           16701       19457    22145602+   f  W95 Ext'd (LBA)
/dev/sdb5           16701       16784      674698+   b  W95 FAT32
There's about 20GB of unused space, but at least the P-3000 boots up and behaves normally. Further tests are obviously required. Here's the interesting bit. If the first partition goes from 1 to 16701 (and all the other partitions are moved along appropriately), the P-3000 boots up normally but the menus are suddenly in Japanese! Same with numbers 16702 through 16703. I was able to reconfigure the P-3000 to use English again, but I didn't feel comfortable about it. If the first partition is configured to go from 1 to 16704, the P-3000 boots up normally. but the menus didn't make sense. They appeared to be in Korean, and I couldn't figure out how to change the language back to English. Using cylinders 16705 and beyond, the P-3000 wouldn't boot up beyond the "EPSON" screen. Here's how much space my P-3000 has now: And here are some numbers collected from data sheets:
FeatureFujitsu MHW2040ATSamsung HM160HC
Rated current0.55 A0.85 A
Rotational speed4200 RPM5400 RPM
Buffer size2 MB8 MB
Spin up current (max)0.9 A0.9 A
Read/write (typical)1.6 W2.0 W
Idle (typical)0.5 W0.6 W
Standby (typical)0.2 W0.25 W
Sleep (typical)0.1 W0.1 W
Acoustics (idle)1.5 Bel2.2 Bel
Subjectively, the Samsung seems as quiet if not quieter than the Fujitsu, despite what the data sheets say. I'll post again when testing is done. In the meantime, the usual disclaimers apply. My advice is: don't try this. I am not responsible for anything that happens if you try to replicate my results. You undertake any modifications at your own risk. If you format the wrong drive or part thereof, destroy your (or anybody else's) equipment, lose photos, videos, music, or other digital data, burn down your place of business or domicile, suffer any personal, financial, or material loss or injury, pull out your hair, go crazy, go bankrupt, get separated or divorced, or anything else, it won't be my fault. Remember that my experience, skill set, test cases, use-case scenarios, support network, and criteria for success are probably different from yours, so what looks good here may turn out to be disastrous for you. Update: my tests were successful. I was able to backup from an 8GB CF card about 16 times until the disk was full. I was also able to use the Epson Link2 Utility v1.21 to browse the drive. The Samsung drive is staying, the old Fujitsu is going into storage, and the WD has been turned into an external drive.

Monday, May 16, 2011

Fixing USB car chargers from eBay

A few months ago, in an accessory buying frenzy for my then-new N8, I ordered a couple of USB car chargers from eBay. The first one did not specifically say it was for the N8, but it didn't say it was for Apple either, so I took a chance with it. Disappointingly, it did not work. I ordered another one, this time in a bundle with a wall adapter and 3 micro USB cables. There was a choice of colours, so I ordered a pink one because that goes well with Subies. This model was advertised to work with the N8, but of course it didn't work. Some time passed. Recently, I helped put together two Minty Boost USB chargers, which showed that for some devices, pins 2 and 3 need to be shorted together. Inspired, I disassembled the pink one and soldered the pins together. Sadly, the N8 still wouldn't charge from it. Luckily I spotted this in a forum:
I found a similar problem: USB cigarette ligher (an expensive one) charger, and the phone (Nokia C7) won't charge. The solution was somewhat surprising. Some background info: in the USB plugs, there are 4 wires: +5 V, Ground, +Data, -Data. Only the first two is required for charging, but you have to do something with the rest. The spec says, they should be connected together either directly or through a maximum of 200 ohm resistor. However, in my charger (optimised for iPhone perhaps?) the +Data was connected to the +5 V through a 24K resistor, and likewise the -Data to the Gnd through a 24K resistor. Removing them and connecting the + and - Data through a 100 ohm resistor, the charger works perfectly. Too bad though, that you need a soldering iron for this...
Aha! After removing two resistors tying pins 2 and 3 to the power rails (and of course soldering pins 2 and 3 together), the charger works. The voltage between pins 1 and 4 is 5.24 V, and between 1 and 2-3 it's now 2.15V (it used to be ~3V). Mr Pink's circuit board. Green: solder bridge. Red: removed resistors. The other USB charger was trickier to disassemble because it is encased in a stainless steel sleeve, but after some prying it came apart. Same problem, same resolution, same results. Top: Mr Pink's resistors. Bottom: Mr Steel's resistors. There's no doubt in my mind that Mr Pink's components were placed and soldered by hand :(

Saturday, May 14, 2011

Epson P-3000 hard drive upgrade

Following Julius Lagula's instructions, I upgraded my Epson P-3000 from a 40GB hard drive to a WD 1200BEVE model. The difference is I did it using Linux. Here's what I did:
  1. Plug the P-3000 into my Linux desktop computer, which had a lot of unused disk space.
  2. Copy the contents of the BACKUP folder to the computer.
  3. At this point, don't make the mistake I made. Do not delete the contents of the BACKUP folder (or any folder) from your Linux desktop. Use the P-3000 if you want to do any cleaning up. It appears the P-3000 keeps an index of the backups somewhere, and if the contents of the folder suddenly disappear, the P-3000 doesn't know how to set things straight again. Nothing really bad will happen when you fire the P-3000 up, but you'll be left with a list of backups that aren't there any more and no easy way to get rid of them. If you made this mistake, just copy the backups back into the BACKUP folder and go to the next step.
  4. Unmount the P-3000.
  5. Using the P-3000, clean out the "Backup Files" and anything else (videos, pictures, music) you don't want to waste time copying over later, and which you have previously already backed up.
  6. Power down the P-3000.
  7. Disassemble the P-3000 using Julius Lagula's excellent guide.
  8. Plug the P-3000's 40GB drive into a external USB drive controller and connect it to the Linux desktop computer.
  9. At this point, you can copy the contents of the P-3000 folder to your hard drive, or use dd to copy the entire partition. The advantage of using dd is you'll get everything. The disadvantage of dd is it's slow, as it copies everything, including the blank space. Before you use dd, unmount the partition.
  10. If necessary, unmount the EVP_SYSTEM partition and use dd to make an image of it on the hard drive:
    dd if=/dev/sdb5 of=/bigdisk/image.sdb5.EVP_SYSTEM
  11. Using fdisk, make a record of the old drive's partitions:
    debian:~# umount /media/EPV_SYSTEM
    debian:~# umount /media/P-3000
    debian:~# fdisk /dev/sdb
    
    The number of cylinders for this disk is set to 4864.
    There is nothing wrong with that, but this is larger than 1024,
    and could in certain setups cause problems with:
    1) software that runs at boot time (e.g., old versions of LILO)
    2) booting and partitioning software from other OSs
    (e.g., DOS FDISK, OS/2 FDISK)
    
    Command (m for help): p
    
    Disk /dev/sdb: 40.0 GB, 40007761920 bytes
    255 heads, 63 sectors/track, 4864 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Disk identifier: 0x05e51aee
    
    Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1               1        4780    38395318+   c  W95 FAT32 (LBA)
    /dev/sdb2            4781        4864      674730    f  W95 Ext'd (LBA)
    /dev/sdb5            4781        4864      674698+   b  W95 FAT32
    
  12. Unmount the 40GB drive.
  13. Attach the new drive to the external USB controller, and plug it into the desktop computer.
  14. Partition the drive using fdisk. For my new drive, the Units (cylinders of 16065 * 512 = 8225280 bytes) was the same as it was in the old drive. So I calculated how many cylinders sdb5 needed to be, and created sdb1 to fill the rest of the drive. To be more specific,
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1               1       14509    c  W95 FAT32 (LBA)
    /dev/sdb2           14510       14593    f  W95 Ext'd (LBA)
    /dev/sdb5           14510       14593    b  W95 FAT32
  15. Set the types of the partitions as indicated above, namely sdb1=c, sdb2=f, sdb5=b.
  16. Format the partitions:
    mkfs -t vfat -n P-3000 /dev/sdb1
    mkfs -t vfat -n EPV_SYSTEM /dev/sdb5
    Optional: Include the -c option to check for bad blocks as the filesystem is being made. This significantly increases the time it takes for mkfs to run, but may be worth it.
  17. Copy the images back to the hard drive:
    dd if=/bigdisk/image/sdb5.EPV_SYSTEM of=/dev/sdb5
    mkdir /media/P3000
    mount /dev/sdb1 /media/P3000
    # If you used dd to save the P-3000 partition, do this:
    mkdir /media/loop
    mount -o loop /bigdisk/image.sdb1.P3000 /media/loop
    # Now copy the directories from the old P-3000 to the new one
    cp -aR /media/loop/* /media/P3000/
    cd /media/loop
    cp -aR .Trash* /media/P3000/
    cp -aR ._.Trashes /media/P3000/
    cp -aR .RATE /media/P3000/
    cp -aR .DS_Store /media/P3000/
    
  18. Use ls -aR | wc to compare the contents of /media/loop to /media/P3000.
  19. Unmount the new drive.
  20. Install into the P-3000 and reassemble
If all went well, you should be able to boot up the P-3000 and see 111GB (or so) free disk space. I have noticed one problem: sometimes a CF card backup will hang half-way through, and the only recourse is to power-down the system by removing the battery. It seems this is happens only when the P-3000 is moved in some significant way, e.g. flipped over or jarred. Backups continue to completion if the P-3000 is moved gently or left alone. Update: Yep, the WD Scorpio Blue (vintage Jan 2008) resets or something if it is rotated or moved too much, causing the backup process to hang. I reinstalled the Fujitsu 40GB, and could not repro the problem using the same motions. I'm going to try a Samsung drive next.

Smartphone followup

The verdict In the end, the Nokia N8 won, at least for me. Mrs Squirrel bought a second-hand Nexus One based on my research, and that device and OS is perfect for her. For me, the N8 has been a better fit. I ordered an unlocked, black version from Newegg.ca in December, received it a few days later, and have been enjoying it since. Let's break it down. Camera and xenon flash Much has already been written about N8's camera, and no other smartphone has yet to best it. The shutter-to-shot time could be faster. The Xenon flash is so close to the lens that red-eye (or in the case of cats, laser eye) is almost always present. But if you're serious about using your smartphone as a camera, the N8 is hard to beat. Compared to a point-and-shoot, the only thing missing is optical zoom. Making and receiving calls Though I don't spend much time talking on my N8, I've never dropped a call or been disappointed by the sound quality. By way comparison, my old Treo 650 frequently could not receive or make calls from inside buildings (even standing near a window), and it needed an app to boost the earpiece and mike volume. Mrs Squirrel makes lots of calls on her Nexus One, and is happy with it. WLAN During our recent vacation, Mrs Squirrel and her Nexus One was much quicker at connecting to public WiFi networks that require one to accept an agreement on a browser. But that might be attributable to Mrs Squirrel, who is brilliant, and not necessarily to the Nexus One. At home or on networks using WEP or WPA/WPA2, the N8 has no problems once the SSID and passkeys are entered. My N8 can even connect to the LEAP network at the office, something I've yet to configure my Linux laptop to do. 3G data The N8 has a pentaband 3G radio, but I'm too cheap to buy a data plan. I like not being tied to any service provider though. Battery life I can go 2 days without needing to charge my N8, whereas Mrs Squirrel frequently runs out. But this is likely a reflection of usage patterns too. The battery meter on the N8 could use some work though: the reading is usually higher than what other battery monitoring apps say. Operating system I'm ok with the Symbian OS that runs on the N8. Sure, it's not as tweakable, nice looking, and the app store is not as well stocked as Android or iOS, but it's perfectly serviceable. The long period from when PR 1.1 was announced to be available and when it actually released for my phone was regrettable, but at least it happened. This is one of the benefits of buying an unlocked phone, by the way. Earlier this month I played with an N8 that was locked to Smart, and PR 1.1 is still not available for it. Applications Nokia makes some nice apps for Symbian. I'm really happy with their Ovi Maps, Wellness Diary Beta, and Sleeping Screen. I haven't had a problem with the Ovi store. Their browser, Web, has gotten better with the recent updates, and I use it equally with Opera Mini. Other 3rd party apps that I use are Gravity, Best Timer, Best TaskMan, Best Jotter, Best Converter, Panorama, Pixelpipe, Offscreen's Anglemeter, and MobileKnox. My favourite games are Angry Birds, Doodle fit, and MicroPool. Case I used a cheap slip-on hard case from ebay, and upgraded to Otterbox's Commuter case as soon as it became available. The future I'm happy with my N8, and I'll probably keep using it until it breaks. Nokia has partnered with Microsoft and produce some Windows 7 phones, and there are rumours of a new N8, so we'll see what happens.