Killing Tynt’s “Read More” Clipboard Copy Hijacker With The Adblock Plus Plug-In For Firefox
I love Firefox. It’s pretty much the only Web browser I use.
I hate Tynt. If you’ve ever copied text from a Web page, then pasted it, only to find a mysterious “Read More:” link inserted at the end of the text you copied, you just ran headfirst into Tynt.
Each time a user pastes content from your website into an email, blog or website, we automatically add a URL link back to your site’s original content. When someone clicks that URL, they are directed back to your site and see the original content. This drives incremental traffic to your site when your content is shared without your knowledge while maintaining a consistent user experience.
It may well be a “consistent user experience” for me to have to hit the backspace key to delete the “Read more” link Tynt adds every time I copy a small block of text, but it’s a consistently annoying experience.
I appreciate the importance of reciprocal links. I understand the challenge to content publishers of having content lifted from their Web sites without attribution.
So before I get into details about this fix, let me be clear: If you copy Web content, attribute it. It’s the right thing to do.
That said, there’s a wrong way of getting people to do the right thing, and Tynt is definitely the wrong way.
I find having my simple act of extracting a quote from a Web page turned into a link-spamming takeover of my local machine to be far more disturbing than a tracking cookie or layer ad.
Don’t be messing with my clipboard. It’s mine, not yours. I will put into it what I want there, not what you want.
Fortunately, I was able to put an immediate end to Tynt’s “Read More” clipboard copy highjacking in Firefox with Adblock Plus, a highly popular add-in that does what its name suggests: Blocks advertisements, and other content, from displaying on a page.
Good Coding Practices Should Replace Comments In Code
I recently came across a post on elegantcode.com that really struck a nerve. The premise: If you write good code, comments should not only be unnecessary, they could actually be counterproductive. Says author John Sonmez:
“As my experience has increased, I have realized more and more that comments are actually bad. They indicate a failure.”
I know that this runs contrary to what most professors, instructors and textbooks say. They offer what seems a reasonable rule: Comment your code so that the next person who reads it doesn’t need to try to figure out what you’re doing.
And it’s also contrary to most of the code I put out on this Web site. I would certainly agree that I over-comment my code, but that’s a conscious decision, based in large part because I want my readers, who tend to be newer programmers, to completely understand what my code is doing at each step.
But as Sonmez notes, comments aren’t the best way to achieve that goal, especially in object-oriented code.
For example, if you change code, its related comment doesn’t change. Use proper constants — e.g., DEFAULT_LOOP_ITERATIONS — instead of a variable declarations. Name your methods, properties and function so they are self-documenting (do you really need to comment a method named OpenXMLFile?) and write more code so that self-documenting names can replace more abstract procedural code calls.
It’s this third suggestion that interests me. I’ve said, many times, that less code is better. I maintain that view. But I’m inclined to agree more with Sonmez that, if it takes a few extra lines and a couple more dependencies to create self-documenting code, that complexity is probably the right trade-off, versus adding novella-sized comment blocks.
I’m almost certainly going to continue over-commenting code here, especially because I am trying to serve the needs of novice programmers.
But Sonmez’s brilliant post really hits hard, and reminds me that if I am trying to write simple code that’s easy to understand, I should rely more on best programming practices than double-slashes. Expect to see more of that in the future. And please do take the time to read his post in full.
All links in this post on delicious: http://delicious.com/dougvdotcom/good-coding-practices-should-replace-comments-in-code
MSDN Northeast Roadshow: Sept. 24 in Augusta, ME
The MSDN Roadshow returns to Augusta, ME and the Central Maine Commerce Center’s Florian Auditorium on Sept. 24, from 1 p.m. – 6 p.m. (That’s a later start than recent roadshows, because directly before it, there’s a TechNet event about Windows 7 and Remote Desktop.)
MSDN Roadshows are a chance for Microsoft evangelists — namely, Chris Bowen and Jim O’Neil — to describe new technologies, demonstrate how to program in Microsoft languages and platforms, and generally share the word about what’s new and on Microsoft’s mind at the moment.
Among the issues to be discussed at this roadshow is Windows 7. Without question, Chris and Jim know their stuff, and you’ll definitely walk away from this event with a better knowledge of Microsoft technologies — if not some of the loot they give out at every event (fully-functional copies of Windows Vista, Visual Developer 2008 Professional, Microsoft Press books and peripherals having been offered in the past as door prizes).
Florian Auditorium and the Central Maine Commerce Center are in the former SCI Systems / Digital Equipment plant off Civic Center Drive. I have a public Google Map of the location.
If Augusta or the date are not convenient for you, Chris and Jim are doing the same agenda in Manchester, NH; Rochester, NY; Troy, NY; Waltham, MA and Farmington, MA. Chris Bowen details it all on his blog.
Working With The Authorize.net Customer Information Manager (CIM), Part 1: Overview
I’m going to spend several posts discussing authorize.net’s Customer Information Manager, a Web service for storing and retrieving personally identifiable information about the people who place credit card orders on your Web site.
Today, I’m focusing solely on an overview of CIM: What it is, how it works, why it works that way, and approaches to integrating CIM into your custom storefront / ordering systems. In future posts, I will discuss actual implementation via PHP and MySQL; my intent is to use 2-3 posts to cover the process, but it may take more or less. My intent is to post every day, but there may be a delay of a day or two between posts.
(I’m uncertain on the number and timing of posts on this topic because I’ll be blogging about implementation as I implement CIM for the first time. And lest that gives you pause, I’ve extensively reviewed the documentation, tested the basics of using the service, and have over 10 years’ experience with PHP / XML / MySQL. And because I’m doing the actual implementation for pay, I will have extensively tested the solution for elegance, reliability and security.)
What Is A Web Service?
The Customer Information Manager is a Web service. In its most common implementation on the World Wide Web, you send a Web service an XML document describing information you want, and the service responds with an XML document that contains the information you requested. (Not all Web services work this way; there are many kinds of Web services out there. But rather than bog down the point, let’s stick with this basic description.)
We can therefore think of a Web service as a remote database; the Customer Information Manager Web service is, in fact, a way to get data into and out of a remote database.
In the case of a Web service, rather than connecting to a local database, writing a SQL query and asking it to send us a result set (or Boolean false on failure), such as we would do in PHP / MySQL, we instead write an XML document that provides our authentication credentials and describes the data we want, send that to the CIM Web service via cUrl (or, if your server allows it, fopen), and get back from the CIM an XML document that contains the records we want (or an error code describing any problems encountered).
In other words, for most intents and purposes, the CIM Web service works exactly like a database, only different. So why in the world does authorize.net bother with a Web service, rather than simply giving you access to their database directly?
JavaScript Function Arguments: They’re An Array And You Can Treat Them As Such
One of the nicest features of JavaScript is the ability to treat function arguments as an array. We all know how to write a function that takes a known number of arguments:
function foo(bar) {
alert(bar);
}
function getArea(shape, measure, unit) {
var output = 'The area of a ' + measure + ' ' + unit + ' ' + shape + ' is ';
switch(shape) {
case 'square':
output += (measure * measure);
break;
case 'circle':
output += (3.14 * (measure * measure));
break;
default:
output += 'unknown to this function.';
}
alert(output);
}
But sometimes, your script will require you to pass some unknown number of parameters to a function. So how do you deal with that?
Luckily, JavaScript functions treat all of their arguments as an array. So, if you’re not certain how many arguments your function will take, don’t declare them in your function code; simply use the reserved word arguments to iterate the array of arguments passed to the function.
Continue reading: JavaScript Function Arguments: They’re An Array And You Can Treat Them As Such »




