Coder's Revolution

Do you want a revolution?

Category Filtering: 'JavaScript'

My "One Tough Puzzle" JavaScript Brute Force Solution

General, JavaScript, Technology
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.
1

Google AdSense Servers Tripling My Traffic?

General, Google, JavaScript, Performance
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.
2

JQuery Corners-- What Will They Think Of Next?

JavaScript, JQuery
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.
12

How To Do argumentcollection With JavaScript Functions

ColdFusion, JavaScript
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.
2

Funny Yahoo! News Photos Bug

General, JavaScript
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:
0

OO Design Patterns and IBO

Ajax, ColdFusion, Java, JavaScript, Object Oriented Design (OOP), Technology
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.
11

ColdFusion, CFC Binding, Ajax Proxy and Updater 1

Ajax, ColdFusion, JavaScript
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.
2

ColdFusion, JSON, and Booleans

ColdFusion, JavaScript
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?
7

JavaScript Error at feeds.adobe.com

General, JavaScript
Have I been the only person constantly annoyed by the JavaScript error that pops up on EVERY SINGLE page at feeds.adobe.com? Apparently you only get the message in IE. It is related to some site tracking code called SiteCatalyst and apparently doesn't run for Firefox. I kept assuming Adobe would fix it, but it's been weeks, so I finally fired up MS Fiddler to have a look.
1

My analysis of the SQL injection zombies

JavaScript, Security, SQL, Technology
So as the SQL injection attacks have rained down on my server for the past few days, my logs have been steadily filling up with data about the requests. Frankly, the data probably can't be trusted, it's all totally un-scientific, and doesn't really lead me any closer to the people responsible for the attacks. Regardless, I think it's pretty interesting. I've compiled some graphs and stats here.
9