Here is a quickie shell script (bash) tip. If you ever want to insert a random sleep/pause into a running script:
sleep $[ ( $RANDOM % 10 ) + 1 ]s
This will introduce a 1-10 second random sleep/pause in the script. Can be handy at times.
Here is a quickie shell script (bash) tip. If you ever want to insert a random sleep/pause into a running script:
sleep $[ ( $RANDOM % 10 ) + 1 ]s
This will introduce a 1-10 second random sleep/pause in the script. Can be handy at times.
Posted at 11:35 AM in Web/Tech | Permalink | Comments (0) | TrackBack (0)
I recently decided to give the functional web testing framework Selenium (and the related premium test execution service, Sauce Labs) a trial run, using the Altos Research purchase workflow as a testbed. After a few hours of experimenting, I had run into a stone wall: Automating the test of an jquery autocomplete menu.
In the workflow I wanted to test, users are asked to type the first few letters of the name of a US County into a text field. An AJAX request is then triggered to find matching counties, and a list of matches is presented to users. It looks something like this:
Users are then expected to use the mouse or keyboard to select an item from the menu, which is then added to their shopping cart. Because this technique relies heavily on dynamically created DOM elements and jquery javascript, the normal Selenium Firefox macro recorder/IDE won't record any of the important events required to make the menu behave like it should.
After much experimentation and fiddling around with levers and knobs, I came up with the following successful sequence that would trigger Selenium to correctly invoke the autocomplete menu (the first four entries in this test case). The name of the text field on which the autocomplete is based is 'county_search'. The user will enter the letters 'lake', causing the server to search for all matching counties. One of those matches will be 'Lake County, IL':
The trick is in the XPath expression that tells Selenium how to select the item from the dynamically generated menu. As it turns out, the default behavior of the JQuery autocomplete widget is to render each item inside an anchor (<a>) within a list item (<li>). Or in other words:
<html><body><ul><li><a>Lake County, IL</a></li></ul></body></html>
When the script is converted to Java/Junit source code, it will look like this:
selenium.typeKeys("county_search", "lake");
for (int second = 0;; second++) {
if (second >= 60) fail("timeout");
try { if (selenium.isTextPresent("Lake County, IL")) break; } catch (Exception e) {}
Thread.sleep(1000);
}
selenium.mouseOver("//html/body/ul/li/a[. = \"Lake County, IL\"]");
selenium.click("//html/body/ul/li/a[. = \"Lake County, IL\"]");
Posted at 11:01 AM in Web/Tech | Permalink | Comments (0) | TrackBack (0)
Update #1 [Sunday, Jan 24th, 9:08am]: I have been experimenting with various encodings and bitrates to try and determine what 'works best'. So far, there is what I've settled upon:
Update #3 [Saturday, Feb 13, 9:09am]: In the most recent batch of encodings, I have migrated away from using AVCWare Total Video Converter to convert the video. Instead, I have opted for a two step video conversion process that starts with MakeMKV to extract the video and audio tracks from the files decrypted by AnyDVD HD, followed by the ever trusty HandBrake to convert that video+audio MKV file into the final form.
Here are screenshots of my Handbrake configuration:
Original Post:
Not too long ago I made the upgrade to the Android 2.0 enabled Moto Droid on Verizon. I'd been using the HTC Titan (a.k.a. VX6800) for a while, but accidentally dropped it in the toilet a while back and decided it was time to move on.
In general, I've been thrilled with the Moto Droid and with the Android platform in general. One thing that I wanted to be able to do was watch episodes of the Band of Brothers series that I had previously purchased on Blu-Ray Disc. I just hadn't made the time to watch these at home, and decided that watching them on the Droid while at the gym would be perfect.
After a bit of snooping, tweaking and futzing I put together the following recipe that will allow you to rip and convert Blu-Ray vdieo into a format suitable for perfect playback on the Moto Droid. This will probably work on other Android devices, although video dimensions and bitrates may differ. Also note that this is not free (as in beer) or free (as in speech) - it will require that you purchase two pieces of commercial software.
My list of ingredients:
The AnyDVD HD application is used to remove the encryption (a.k.a. DRM) from the video files stored on the Blu-Ray disc, allowing the files to be accessed. The AVCWare Total Video Converter is then used to convert the original Blu-Ray video files (stored in a format called AVCHD) into format that can be played on the Moto Droid (MP4 file format with MPEG4 video encoding and AAC audio encoding).
One the following tools have been installed, the process is actually quite simple:
Posted at 09:11 AM in Web/Tech | Permalink | Comments (0) | TrackBack (0)
Here is a head scratcher for you:
While investigating a customer-reported problem with one of Altos Research's WordPress Plugin, I had sent off a technical support request to GoDaddy.com's support team. The problem was being caused by HTTP 404 status codes being returned by server-side PHP scripts generating JSON-formatted output. This is a fairly typical thing for a PHP script to do as part of a modern AJAX-powered web application, and our WordPress plugin is one of those.
After Googling around a bit, I did come across another developer who'd experienced similar problems with a GoDaddy.com hosted application, as described in this StackOverflow.com question:
http://stackoverflow.com/questions/948116/ajax-404-with-results-using-buddypress
The solution is fairly simple, as it turns out (you must manually set an HTTP status code value of '200').
But before I'd come across this answer, I had decided to submit a description of the problem using the GoDaddy.com Technical Support form. About 5 hours later, I received the following answer:
"Ajax requires a Windows operating system; the domain welcomehomenwi.com is on a Linux server. To switch the operating system of your hosting account, please use the following instructions"
Huh? AJAX in the GoDaddy.com environment requires that you switch from a Linux-based host to a WIndows server? In either case, the WordPress plugin problem has been fixed, and it didn't require that our customer switch their hosting service to a Windows server. Sheesh.
Posted at 08:54 PM in Web/Tech | Permalink | Comments (0) | TrackBack (0)
Apple has taken many well deserved punches for the opacity of the iPhone App Store approval process. However, Apple deserves major credit for finally breaking the suffocating control of the mobile service provider over the set applications that can be installed on a mobile device.
In my three years as an engineering manager at Motorola's Mobile Devices business unit, I was approached dozens of times by energetic mobile application entrepreneurs who all asked the same question:
"How do I get my application onto your phones?"
The only answer available at the time was:
"Talk to the mobile network operators (carriers). You'll need to negotiate the pre-installation of your application with each operator for each device they support. One at a time. It will be impossibly hard and likely to fail, so you should probably give up now."
At the time, I had no useful advice on how they could achieve the widespread distribution their business plan depended on. It was depressing.
I am now convinced that Apple and the iPhone App Store have finally cracked that nut. This article from the NYTimes triggered my change in attitude:
To quote:
"Still, the App Store is markedly better than the alternative, says Peter Farago, a marketing executive at Flurry, a mobile analytics company in San Francisco. Gone are the days when mobile developers had to negotiate with major telecommunications companies if they had any hopes of publishing their applications on a mobile phone.
“It took six to nine months to build a relationship with a carrier, maybe a quarter-million to get the infrastructure built, and the company took 50 percent or more from each dollar,” Mr. Farago says, a process that limited access to mobile platforms. “Apple has helped create a much healthier middle class of developers and expanded the pie for everyone.”
This is indeed a watershed period for the developer of mobile applications. The break between carrier and application control (AT&T + iPhone) now has the momentum. We already see signs of this spreading from carrier to carrier (Verizon, Sprint) and platform to platform (Android, WebOS, Blackberry).
Finally, a nice dose of free (free as in speech) in the world of mobile devices.
Posted at 07:19 PM in Economics, Web/Tech | Permalink | Comments (0) | TrackBack (0)
I have been using the free version of the YouMail.com voice mail service for a while now, and have been happy with it. It offers much better web-based access and customizable responses than what my mobile service provider (Verizon) offers. So far, so good.
Early last week I received an email from their marketing folks encouraging me to enable the free version of their voicemail -> text translation service. The first 7 transcribed voicemail messages are free each week. It sounded like a good offer - I don't get too many voicemails anyways. The service comes with two quality level settings - good and super-mega-good. They do warn you that the super-mega-good quality option does incur a slight delay in message delivery.
I went ahead and opted for the 'super-mega-good' option, wanting to see how far computer translation technology had come recently.
When I started receiving the messages, the quality level seemed too good to be true. I was completely amazed by the detail. For example, a donation solicitation from my alma mater was transcribed as:
"Hi, my name is Laura and I'm a sofmore at Illinois Wesleyan. I'm one of more than 1,800 students who recieve financial aid so I know first hand the importance of support from alumni and friends. I see you've made donations to the university in the past and I was hoping you might give a gift again this year. Now more than ever a gift of any amount is greatly appreciated. Thank you for your time and thanks in advance for your support. Have a good night."
The two things errors in the above message immediately tipped me off - the spelling of 'sophomore' as 'sofmore' and 'receive' as 'recieve'. A computerized transcription engine would be unlikely to make phonetic errors like that, I thought.
Then, after a few more, the clincher:
"Hey, Jason. It's Cathy. We just left. We are on our way to the Freeway. So, we'll probably there in about 20-25 minutes. It's about 9:40 right now. So let us know where you wanna meet. Bye"
The capitalization of the word Freeway was the give-away this time. It just smacks of an error only a human transcriptionist would make. Perhaps someone out there can prove me wrong, but as far as I can tell, YouMail.com must be using a pool of humans to listen to and then manually transcribe voicemail messages when you choose the 'super-mega-good' quality option.
Can you say 'privacy concern'? I can't wait for the voicemail from my doctor asking me about scheduling a rectal exam!
Posted at 05:56 PM in Web/Tech | Permalink | Comments (0) | TrackBack (0)
The news is out that the FCC plans to take a more formal stand and formulate specific rules related to Net Neutrality. This is one of Obama's campaign promises, so this turn of events is not particularly surprising. My first reaction to the news was along the lines of 'That sounds like a good thing.'
But now that the reports have begun to trickle in about what this might really mean in practice, I'm starting to get more and more worried about the implications.
Depending on the source, 'Net Neutrality' has been used to mean one or more of the following:
These both seem like very noble goals and intentions. There is always the straight forward libertarian argument against any such governmental intervention in the operations of a private business - but I am going to ignore that one for now (despite the fact that I mostly agree with it).
I then put myself in the shoes of an ISP owner and operator, and think about scenarios such as:
"If one of my user/customers was using such large amounts of bandwidth to download fully legal BitTorrent files (Linux CD images, for instance) that the experience of my other customers was negatively affected, would I be allowed to throttle the traffic of that one excessive user?"
"If I were approached by Hulu.com with the following offer: Please give preferential treatment to traffic you transfer to/from our website so that our users can watch movies in high-def without interruptions. In exchange for this preferential traffic handling, we will give you $$$ per month. Would I be legally permitted to sign such a contract?"
Complicating issues like this lead me to believe that there will be no fair or just rule by which to judge the legality of scenarios like these. And they only get more complicated - especially in the case of cellular networks that are severely bandwidth limited - the more you ask.
In the end, I fear we're getting our FCC into a black hole of unintended consequences that will be very hard to escape from.
Posted at 06:42 PM in Web/Tech | Permalink | Comments (0) | TrackBack (0)
A long, long time ago I had written two on-line calculators to help photographers answer the following questions:
The calculators are available here. Enjoy!
PS This would not have been possible (or at least as easy as it was) were it not for the Internet Archives. The old version of my calculator page had been lost when I migrated to TypePad as my new weblog platform of choice, but luckily a snapshot of my website from April of 2005 was available, allowing me to pull the original formulas out of the digital dust bin.
Posted at 05:01 PM in Web/Tech | Permalink | Comments (0) | TrackBack (0)
After submitted this feature enhancement request to the Mozilla bug database, I received a comment on the bug informing me that the feature already (more or less) exists.
Here is my complaint: After using Firefox for several months, form fields with common names - email, address - tend to accumulate a very long list of auto-complete values. Most of them are not very useful and just slow me down. For example, see this street address field (from Senator Barbara Boxer's message submission form):
What I learned after submitting my enhancement request that it is possible to remove entries from this auto-complete list using a (in my opinion) completely undocumented feature:
Use the arrow keys or mouse to highlight an entry in the auto-complete menu, then press the 'Delete' key. That value will then be removed from the list of retained/suggested values! I would prefer to have an entry at the bottom of the list 'Remove all suggestions for this field' to completely clear the auto-complete list, but one at a time will work in a pinch.
This is particularly useful for those times when your credit card number seems to have been remembered by Firefox when it probably shouldn't!
Posted at 09:04 AM in Web/Tech | Permalink | Comments (0) | TrackBack (0)
After a few too many minutes spent digging into this error message and not finding any applicable answers, I looked into the NX session log file in my user home directly to see:
/usr/NX/bin/nxagent: error while loading shared libraries: libXpm.so.4: cannot open shared object file: No such file or directory
Because this is a newly installed server (RedHat/CentOS 5.3), and even though I had installed the 'xorg-x11-xauth' and 'gnome-desktop' packages, this required library somehow got missed. To install this missing library, you need to install the 'libxpm' package. In my case, using yum:
yum install libXpm
And while you're at it, make sure that the full Xorg x11 server is installed. Oddly, 'gnome-desktop' does not depend on this package:
yum install xorg-x11-server-Xorg
Posted at 10:51 AM in Web/Tech | Permalink | Comments (0) | TrackBack (0)