Blog

Category Filtering: 'JavaScript'

Remove Filter


CFClient: What's Your (Geolocation) Vector, Victor?

Posted by Brad Wood
Jan 16, 2015 01:48:00 UTC

In my last post I played with the Media API to add sounds effects to the Roll The Ball game and made an Adobe CF Soundboard.  Today I'll be showing my work with the Geolocation API.  I wish I had some more time to do something more useful, but the CF mobile contest is drawing to a close tonight and I this will be the last feature I have time to put in.

CFClient: We Have Contact, Let's Notify!

Posted by Brad Wood
Jan 11, 2015 09:28:00 UTC

My last entry was a little light on the client APIs and mostly spent (unsuccessfully) wrestling my HTML markup around.  So,  to make up for it, I've implemented 2 different client APIs.  That's right, two for the price of one!  The first was notifications which was pretty straightforward, followed by contacts which is kind of complicated-- well, let's just say "involved".

You may notice in the screenshots that the app is no longer full screen.  I didn't care for that so I found the fullscreen preference under the project's PhoneGap properties and set it to false.  This setting does not appear to be stored anywhere in the web root though, so if you check out the code into a mobile project of your own you'll probably have to set it yourself too.

My "One Tough Puzzle" JavaScript Brute Force Solution

Posted by Brad Wood
Sep 30, 2012 04:20:00 UTC
So, I've been sitting on this for months (because I'm lazy) and decided it's finally time to post it. My mother-in-law visited a while back and brought a puzzle for the kids to play with. It's called "One Tough Puzzle". It claims to have "more the 300,000 wrong ways, but only one right way to assemble it." Well, after fiddling with it for a while, I did what any code-blooded hacker would do and wrote some JavaScript to brute force solve it.

Google AdSense Servers Tripling My Traffic?

Posted by Brad Wood
Nov 09, 2009 07:15:00 UTC
I threw some AdSense ads on my site the other day. I don't think I'll be getting rich any time soon though. I'm up to 58 cents so I figure I'll be seeing a check from Google in about 8 years. :) Anyway, while troubleshooting an error in my blogCFC I noticed I kept getting each error E-mail three times. Looking at the User Agent showed that "Mediapartners-Google" was hitting every URL I hit twice. Incidentally, I have two Google ads on every page of my site.

JQuery Corners-- What Will They Think Of Next?

Posted by Brad Wood
Mar 21, 2009 06:26:00 UTC
I have consistently been impressed by the number and quality of JQuery plugins that abound. Today at work we ran across JQuery Corners. This friggin' awesome plugin allows you to put rounded corners on your divs and it's oh, so easy.

How To Do argumentcollection With JavaScript Functions

Posted by Brad Wood
Feb 08, 2009 05:40:00 UTC
As of ColdFusion 8 we have been able to pass a struct into a method so it becomes the method's argument collection without knowing the individual keys in the struct. myObject.myMethod(argumentcollection=myStruct); The other day I needed to do this in JavaScript. It took me a short while to figure it out, so I thought I would blog it here for others' benefit.

Funny Yahoo! News Photos Bug

Posted by Brad Wood
Oct 20, 2008 20:45:00 UTC
I found a humorous bug in Yahoo's news photos tonight. After reaching the last image in the "Most Viewed Photos" the "next" button brought up a list of "Most Viewed Slideshows". Three of the slideshows listed looked like this:

OO Design Patterns and IBO

Posted by Brad Wood
Sep 10, 2008 23:29:00 UTC
If you missed it, Jeff Chastain put up a very interesting post over at Alagad's Blog. Also good was the "spirited" discussion that followed between Barney and Peter Bell. I don't know how I feel about all of it, but the entire thing is very fascinating.

ColdFusion, CFC Binding, Ajax Proxy and Updater 1

Posted by Brad Wood
Sep 10, 2008 09:05:00 UTC
This week I got a much belated chance to play with some of the CF8 Ajax features I've never gotten around to. I've had CF8 developer's edition on my home PC for a while, but never worked for a place that actually had CF8 in production so I didn't get to play much with the new stuff. I had a big show stopper though. Both my cfgrid bind attribute and my cfajaxproxy tag weren't working. The CFC's I wanted to bind to were web accessible, but there were in a series of subdirectories. ColdFusion, however, kept constructing Ajax code to look in the web root.

ColdFusion, JSON, and Booleans

Posted by Brad Wood
Sep 10, 2008 08:17:00 UTC
Last night I found myself wrestling with the behavior of ColdFusion's JSON serializing where the strings "yes" and "no" are converted to a Boolean and come out the other side as "true" and "false". This happens when variables are passed through SerializeJSON(), or a CFC is called with returnFormat="json". Nathan Mische pointed out not too long ago that 1 and 0 are NOT converted to Booleans, which is interesting. I have a feeling the logic goes something like this: If string can be converted to a number Treat it as a number Else if it can be converted to a Boolean Treat it as a Boolean Else Treat it as a string 1's and 0's probably get picked off early that way. As annoying as it is though, I'm not sure what the better solution would be. Unfortunately, in a loosely typed language the server has to make guesses for you that can be kind of un-forgiving when you translate them to a strictly typed language. In my case, I was passing back a result set to be bound to a cfgrid, so I didn't really have much control of how it displayed once it left the server. I needed it to come back from the server in the correct format. My solution was to add a space before or after each word such as "yes " and "no ". It's not quite optimal, but it works. The results were left as string and made it safely back to the browser. As far as a work-around from Adobe, I had originally thought of adding an additional setting called strictBooleanParsing or something, but what worked for one person would probably never work for someone else. In the end, it might have been best for them to ONLY accept "true" and "false" as Booleans. I don't think that would be too much to ask programmers to do. I mean, it's nice that you can be all loosey-goosey inside of ColdFusion with your data types, but I wouldn't expect that same kind of freedom when I want to convert my data to a less forgiving format. This might never be changed though given the backwards compatibility issue. There is probably code out there now that depends on "yes" and "no" turning Boolean. What would your solution be?

Site Updates

Entries Search