Thursday, September 30, 2010

listFind vs. listContains

ColdFusion has two functions for finding things in comma-delimited lists, but they behave very differently, and I can never which is which.  Today I needed one of them, and so I did a test to figure out which I needed.  If figured I would document their usages here, so that I wouldn't have to go thru this testing process next time.  Here are the functions:

listContainsNoCase(list, substring)
This function just finds the substring, and tells you which item contains that sub string.  It is important to understand that this item is not searching for a list item, just for a sub string.  Consider the following example:
listContainsNoCase("Date,Decimal,Image,Integer,Long Text,Rich Text,Simple Text", "Text")=5
Notice how it found that item number 5 has the word "Text" in it, even though "Text" is not the complete item.

listFindNoCase(list, value)
This function finds a value in a list, and tells you which item matches the value.  It compares the value to the list item, and only accepts complete matches.  So, consider the following examples:
listFindNoCase("Date,Decimal,Image,Integer,Long Text,Rich Text,Simple Text", "Text")=0
listFindNoCase("Date,Decimal,Image,Integer,Long Text,Rich Text,Simple Text", "Simple Text")=7
Notice how in the first example above, no item was found.  This is because there is no single item with value = "Text".  However, it did find "Simple Text" in the second example above.

Of course the same is true for listFind, and listContains, but those are case-sensitive.

Incidentally, I put this one in the "duh" category, because I think that the names are reversed.  The first usage should be named listFind, and the second should be named listContains.

Hope this helps.

Monday, September 13, 2010

Resolving Samsung Captivate Windows 7 (64 bit) connection problem

------ NOTE ------

See the updates at the end of this post. Although many people have reported in comments that this fix worked for them, it actually stopped working for me after a few days. Consequently I have actually returned my Captivate in favor of a different phone that actually works.

------ END NOTE ------

On Friday I purchased a new Samsung Captivate from Costco. Before I get into the USB connectivity issues, let me just say that this is a great phone. Great speaker, great microphone, great ambient-noise management, great processor speed, great camera, outstanding screen, tons of memory, the list goes on. However, I encountered some serious problems getting it to connect to my computer. It took two days to get the problems resolved. Amazingly, neither this problem nor the solution is documented online. So, here is what I learned. I don't make any recommendations that you should try this, or any guarantees whatsoever that any of this will work for you, or that it will not damage your phone, etc, etc. Try it at your own risk, you have been warned. However, I did eventually get it to work for me, and am now much happier with my phone. Here's what I did.

First, the computer is a newish, capable, reliable laptop running Windows 7 Home Premium (64 bit). It is a pretty new install of Windows, and there are no known hardware problems. When I complained to the guy at the AT&T store, he admitted that other customers have complained about the same problem. So I don't think that the problem was with my computer.

When I first attempted to connect my phone to my computer, Windows quickly reported that the driver install failed. I made several attempts, all of which failed. Next I tried on a Vista (32 bit) box. The driver install seemed to work OK, but it kept reinstalling over, and over, and over again. Like every 3 minutes, over and over again, times infinity. Weird.

So, after two days of research, and trial and error, and visiting 2 AT&T stores, here is what I learned.

Samsung Captivate (and I believe other Galaxy class phones) use a software package called Kies to manage your phone's connection to your computer. By default, when you connect the Captivate (and probably most Galaxy class phones) to a USB port on Windows, it is only willing to talk to Kies. If you don't have Kies on the computer, then the connection will fail.

The bad news is that Kies is not available in the U.S. (!?). I had to download it from Samsung's Singapore website. Worse, Kies is kind of lame. It looks nice, is user friendly, and is a good effort, but isn't very useful and just got kind of got in the way.

The good news is that installing Kies also installs the drivers. After installing Kies, Windows immediately recognized my phone. So that's good.

The better news is that it turns out you may not actually have to install Kies at all. You can change the default USB setting on the device (which I have done). If you go to settings > Applications > USB settings, you will see that the default USB behavior is set to "Samsung Kies". I changed mine to "Mass Storage". Now when I connect my Captivate to my computer, it doesn't try to talk to Kies. Instead, it just pretends to be an "External Mass Storage" device which Windows has no problem recognizing (think external hard drive, or thumb drive).

Next, when I connect my Captivate to the computer, Windows makes that happy little two-tone chime that means something has successfully connected. Then on the Captivate, I just have to tell it to mount on my computer. There is a little status bar along the top of the screen. If you touch that bar and drag it down, there are some useful toggle buttons and a section called "Ongoing". Under ongoing there is a "USB connected" entry. When I click "USB connected", it asks me if I want to mount my phone on Windows. If I click "Mount", then I can access my phone just like an external hard-drive. I can copy music or pictures directly onto or off of the phone. Easy-peasy.

So, at least now I have a way to get stuff onto and off of my phone, and I don't have to use Kies. This is good. Also, I reformatted the internal SD card (read somewhere online that this helps).

Again, I don't promise or guarantee or warranty or say that any of this will work for you. Just that it worked for me. Good luck!

Now I would just like to take a moment to talk directly to Samsung.

Samsung, listen, you are a big company. You are a respected brand. You make good products. You spend millions of dollars advertising them. But even though your phone is widely available for purchase across the U.S., it cannot connect to Windows 7 without your users going to extensive lengths to research and troubleshoot, and the software for your phone isn't even available in the U.S. This is a problem. It's not like this is a special advance order phone direct from Japan. This is a widely advertised, commercially available phone that consumers can buy at any AT&T store, Costco, Sam's Club, Best But, etc. Yet they cannot connect their phone to their computers, unless they download software from Singapore, or change unfamiliar settings.

Please fix this. Either release your software in the U.S., or include instructions in the packaging or on your website on how to change the USB settings. Better yet, on your phones sold in the U.S., just default them to "Mass Storage" mode, and include a quick-start paper on how to mount the phone as an external hard drive.

Ok, that's all for now. Will report if the situation changes.

------ UPDATE 10/3/2010 ------

Unfortunately, the fix described below stopped working for me a few days ago. That was the last straw. Although I liked the Samsung Captivate, I decided that I wasn't going to keep a phone that lacks basic driver support and can't even figure out how to connect to a computer. So, I returned my Captivate to Costco, and bought an iPhone instead.

------ UPDATE 10/4/2010 ------

On 10/2/2010 Anonymous commented: "I cannot believe this phone has been out for now over 3 months and no fix. Shame on Samsung; this is why people turn to macs and iPhones, lazy companies."

I agree. Putting the time, effort, and R&D money into building a fabulous phone, and then failing to deliver basic USB drivers (even just simple Mass Storage drivers) is absurd in the extreme. That's like spending months building a fabulous house, and then failing to include something simple like a door. Eventually no matter how great the house is, the owner will get tired of climbing into the house through a window, and just buy a house--any house--with a door.

------ END UPDATES ------

Thursday, September 09, 2010

ORM is not configured for the current application

Working on a little app in ColdFusion 9.  Was consistently getting a phantom ColdFusion error (especially containers loaded by the built-in ColdFusion.navigate function):
ORM is not configured for the current application

Very mysterious, and took a while to troubleshoot.  In my Application.cfc, in the onRequestStart method, there was a <cfset ormreload()> .  I had put it there thinking that while I was doing some development it would be nice to have the ORM reloading all of time as I make changes.  However, it looks like it was interfering with the ORM's sequencing, and on Ajax page loads it was causing ColdFusion to erroneously report back that the ORM was not loaded.  I simply moved the ormReload to onApplicationStart, and the problem seems fixed.