Wednesday, October 17, 2012

FoxitReaderOCX.ocx failed to load.

Here’s how to fix this error.

For a long while I have been using Foxit Reader for PDF files rather than using Adobe’s PDF Reader. (Adobe kept bugging me too much about installing stuff, all the time it seemed.) After I installed a new Foxit Reader, I began seeing an error whenever a PDF was to be displayed in the browser. It just gave a dialog that said, “FoxitReaderOCX.ocx failed to load.”

FoxitReaderOCX-failed-to-load

Interestingly enough, even when I uninstalled Foxit completely, Chrome still gave me the exact same behavior. The software didn’t change.

Googling turned up little help, but eventually led me to this interesting fact:  Chrome actually loads plugins directly from your Firefox plugins directory. Check your chrome plugins at chrome://plugins/ in your browser and you find some loaded directly from your Firefox directory (if you have Firefox).  You’ll have to click the [+] Details button/link in the upper right to see the full file paths. Here’s some of mine:

plugins-from-firefox-are-loaded

Aha! I remember when I installed the new version of FoxitReader, I unchecked the box to install the Firefox plugin, since I rarely use Firefox.

So first I went to the Firefox plugins directory and removed the offending file “npFoxitReaderPlugin.dll”. Then I ran my new FoxitReader installer and this time I allowed it to install the Firefox plugin, i.e. the new one.

 

new-foxit-plugin

Thursday, September 6, 2012

twilio4j updated to support new Twilio <Queue>

 

twilio_queue_graphic Yesterday, Twilio introduced a new feature, call queuing.

This allows you to answer a phone call and place the caller into a queue. You can still use all the other Twilio features, like giving the person a message, and playing “on hold” music the same way you would for a Conference call. The API exposes information like the caller’s position in the queue, the time that the caller has been in the queue, the average queue time, and the current queue size. You can also capture events like caller hangups.

 

Today I have updated the twilio4j java library (version 1.0.4) to support these new <Queue>, <Enqueue>, and <Leave> noun/verbs.

Saturday, August 25, 2012

Manual Install of Jellybean on Nexus S (i9020a AT&T)

[Update 11/8/2012: Tethering may not work after updating. I have not figured out why.]

My Nexus S does not get OTA updates. (I suppose this is because I bought it new and unlocked, and not from my carrier.) I had to update it to Ice Cream Sandwich manually, and it looks like I will be doing the same for Jellybean. I’m making a few notes this time.

I own a Nexus S i9020a (the model for AT&T frequencies), so I grabbed the JRO03E factory image “sojua” from Google’s factory images site. Update 12/17/2012: The JRO03E image is no longer available since 4.1.2 is now available. Just choose the appropriate souja version from Nexus Factory Images.

The md5 checksum checks out fine.

$ md5 sojua-jro03e-factory-1ac76773.tgz
MD5 (sojua-jro03e-factory-1ac76773.tgz) = 39f0a4079f81882d354f228000ccf8f4

 

You don’t have to root the device to do this update. Just use the fastboot tool to drop the factory image onto the device. However, you will lose all your application data, so you may want to back it up.

To backup the primary contents of your device (i.e. your apps and your network settings, etc.), I enable the built-in google Backup & Reset settings. This will make the recovery step so much simpler after you install the new OS. This is highly recommended. (If you are just now turning these settings on, you’ll need to wait until everything is sync’d to the cloud before proceeding.)

Screenshot_2012-08-26-01-43-28

Because your data will be wiped, you will lose the arrangement of all your app icons on your home screens. I suggest taking a screen shot of each home screen to speed up this task later. (Press volume-down and power buttons simultaneously to get a screen capture.)

To backup the remaining contents of your phone (including the screen shots you just made), simply mount it via USB and manually copy all the folders to a backup location on your PC. Note that if you wish to restore any of this back to your “new” phone (like photographs from your DCIM folder), you will have to copy these files manually again. Note: I don’t think your SMS messages will be backed up by this method. (There are other apps in the android market that backup all this stuff for you.)

To mount as a disk via USB, drag down the notifications bar from the top of the screen, where the USB symbol is showing as a notification. Then click the “USB connected” notification, then on the next screen, click the “Turn on USB storage” button.

turn-on-usb-storage

This should let you see all your (user) files on your Nexus S. I simply copy everything to a backup folder on my PC. It took about 8 minutes. :-|

nexus-s-files

Now turn off USB storage:

 

turn-off-usb-storage 

Now it is time to put your device in fastboot mode. To do this you first need to be sure you have a copy of fastboot.exe on your path. (You need to have a copy of the Android SDK, and you’ll find fastboot.exe living in platform-tools directory.)

Confirm you have fastboot.exe on your path by executing ‘fastboot –?’:

fastboot_path

You will also need to have your USB driver setup properly. But that is beyond the scope of this post. If you encounter a < waiting for device > message when you use the fastboot.exe tool, then you need to update your USB driver.

To get in fastboot mode, first power off your Nexus S. Then boot into fastboot mode by pressing and holding the volume-up key and continue holding it while you press and hold the power key. You will get the fastboot screen, which looks like this:

fastboot-screen-1

You will need an unlocked bootloader to flash a factory image. Check your fastboot screen on your device to see if it says “LOCK STATE – LOCKED” or “LOCK STATE – UNLOCKED”.

Unlocking your bootloader will wipe your device of all data. Unlock it from the command line using the fastboot oem unlock command. (you should still have your device plugged in via USB)

fastboot-oem-unlock

You will have to use the Volume-Up/Down buttons to select “Yes”, followed by the Power button to accept. The screen will not respond to touch controls. Here’s what it looks like:

bootloader-unlock-yes

And then you should be unlocked:

bootloader-unlocked

Now change to your unzipped “sojua-jro03e” directory. You should these files:

sojua-jro03e-dir Have a look at the file flash-all.sh. This file contains the sequence of commands to execute, which I will execute manually, rather than rely on the timing of sleep commands. (Also, this particular machine of mine is not a unix box, so the shell script is somewhat useless as an executable.) Here’s what the shell script contains:

fastboot flash bootloader bootloader-crespo-i9020xxlc2.img
fastboot reboot-bootloader
fastboot flash radio radio-crespo-i9020uckj1.img
fastboot reboot-bootloader
fastboot -w update image-sojua-jro03e.zip

 

So we simply execute these one at a time, executing reboots in between, and seeing small changes to the fastboot screen each time.

fastboot flash bootloader bootloader-crespo-i9020xxlc2.img

The screen shows “Verify Image (IBPL) … Success”:

verify-image-IBPL-success

fastboot reboot-bootloader

The device reboots, and shows an updated bootloader version on the fastboot screen. In the same fashion we update the radio.

fastboot flash radio radio-crespo-i9020uckj1.img

We see “Verify Image (RADIO) … Success” on the screen, and then we reboot it again

fastboot reboot-bootloader

The device reboots, and then we issue the big update command, which gives us the new OS.

fastboot -w update image-sojua-jro03e.zip

flash-all-sequence

When it reboots, you’re done. You’ll have Jellybean running. You’ll have to sign in with your google account and give it a few minutes to download and restore all your apps and settings. Hopefully you have some bandwidth. You’ll still have to put the app icons back on the home screens yourself. You can find those screen shots in the “Pictures/Screenshots” directory that you backed up over USB.

Screenshot_2012-08-25-22-19-51

Tuesday, March 13, 2012

Hey, That Google IO 2012 Theme Feels Familiar…

Last spring I shared a doodle 4 google sketch, which was a sort of “machine”, and happened to have a “track” element for the letter “G”…

doodle4google[4] 

And then I see this year’s “theme” for Google IO 2012…

io2012_theme

Holy Buckets.

Wednesday, January 11, 2012

Eliminate the cache for LESS Stylesheets

If you are using Bootstrap and LESS, the “Dynamic Stylesheet Language”, then you may have had the experience of editing your .less files, reloading your browser, and not seeing your changes.

And then you check that you are not including the .css file, but are actually including the .less file plus running the javascript to interpret the .less file. But you did do that correctly and your changes are still not showing up when you reload your browser.

It turns out that the javascript stores a cached copy of your stylesheet into Local Storage in your browser. Take a look:

blog_local_storage

I don’t really understand why the caching is there to begin with. I only do the dynamic interpretation of the .less files while in development. For production I will compile everything into a .css file.

I favored the quickest way to work around this after looking at some discussion online. I just pasted a snippet of javascript into the footer of my page, just before the closing </body> tag. The snippet is a slightly edited version of code found on github. Here is the snippet to paste into your page:

<script type="text/javascript">
    function destroyLessCache(pathToCss) { // e.g. '/css/' or '/stylesheets/'
      if (!window.localStorage ) {
        return;
      }
      var host = window.location.host;
      var protocol = window.location.protocol;
      var keyPrefix = protocol + '//' + host + pathToCss;
      for (var key in window.localStorage) {
        if (key.indexOf(keyPrefix) === 0) {
          delete window.localStorage[key];
        }
      }
    }
    destroyLessCache('/css/');
</script>

 

Be sure to change the string ’/css/’ to be the path to where your bootstrap directory lives.

Also do not forget to remove this code when you go to production. (Yes, I know it is not ideal to have manual tasks like this upon code releases, but hey, I just need to get my .less file working once! Plus I am  documenting my code snippet here for next time I am in this soup.)