5/11/11

Getting rid of the trailing comma that blows up javascript in internet explorer (IE)

if you are like me, you can't stand writing pages for IE. Finicky and unique (from chrome and ff). One of my frustrations in writing code for IE that also incorporates jquery (or any javascripti function) is that IE chokes on trailing "," while FF does not.

For instance this exerpt describes the creation of a "formless submit" using jquery form plugin:

$(document).ready(function() {

$('#inputform1').ajaxForm({
// target identifies the element(s) to update with the server response
target: '#htmlExampleTarget1',

// success identifies the function to invoke when the server response
// has been received; here we apply a fade-in effect to the new content
success: function() {
$('#formsubmit1').html("entry saved");
$('#htmlExampleTarget1').fadeIn('slow');
}
});
$('#inputform2').ajaxForm({
// target identifies the element(s) to update with the server response
target: '#htmlExampleTarget2',

// success identifies the function to invoke when the server response
// has been received; here we apply a fade-in effect to the new content
success: function() {
$('#formsubmit2').html("entry saved");
$('#htmlExampleTarget2').fadeIn('slow');
},
});
});
This code would blow up in IE because of the last "," The solution I've found is to write out the comma at the top of the do loops instead of the logical end. For instance:
record=0
DO WHILE NOT objResultsSet.EOF

record = record + 1

if record>1 then
response.write(",")
END IF

-------------remainder of the loop

response.write(vbLf & "}")
objResultsSet.MoveNext
LOOP

Normally I would write out "}," on the last line - however by putting in the comma write out at the top of the loop (along with a simple conditional statement to keep the first one from appearing) I can avoid the dreaded trailing comma.

-bp

4/21/11

Implementing Google Health API - Vbscript Classic ASP oAuth

After getting facebook API and twitter API both to work - i'm digging into the google health API/Google oAuth protocol. Collection of notes below...

types of oAuth
http://blog.apigee.com/detail/oauth_differences/

http://code.google.com/apis/health/

getting started: http://code.google.com/apis/health/getting_started.html

you'll eventually need to start using H9:
https://h9.google.com/ - the sandbox environment.

more on google oAuth
http://code.google.com/apis/gdata/articles/oauth.html

oAuth Playground (FANTASTIC!!!)
http://googlecodesamples.com/oauth_playground/


possible plug and play solution...
http://www.dotnetopenauth.net/



more to come as i figure this out...
-bp

12/14/10

Using AdWords to determine best book title

I love the simplicity and speed of this concept... I believe this idea could be used for the name evaluation for almost anything  - from company to product to URL to brand names - almost anything could be run through this algorithym.

-bp

Wired: Speaking of testing, I assume you market-tested the title of the book?
Ferriss: Oh yeah, with about 4,000 people, in three separate rounds. Testing is how I ended up with the title of The 4-Hour Workweek as well. That was one of about 12 titles I tested using Google AdWords.
I bid on keywords or phrases associated with the book content, like “world travel,” “401K,” etc.
And then the ads that were displayed had the title of the book as the headline and the subtitle as the ad text. And then I just looked at the clickthrough rates.
Wired: What was on the pages when people clicked through?
Ferriss: Nothing. Just “under construction”.

From this Wired article:
http://www.wired.com/magazine/2010/11/mf_qa_ferriss/