Posts

HOW TO prevent screen scraping

It is not difficult to screen scrape web pages & get specific portions of the page using regular expressions. This custom C# GetImages method  fetches all images from a specified web page URL. [BTW, it has a nice trick to show complete hyperlinks or image filepaths where relative paths are used. These would otherwise never link to original content from the scraped page. It uses the BASE tag to set the document's base URL. The BASE element should be used within the HEAD tag.] Some of the strategies that this whitepaper[pdf] [Google's cached HTML version] discusses to prevent scraping include proactive measures like putting a website policy forbidding scraping, limiting results, DRM, rendering and reactive measures like policing by monitoring Physical and Internet (through IP address) identities. While it alludes to rendering, one other possibility is to block access based on the referer page & render content conditionally. A page with valuable information could be ...

Inline Spell-check, Inline Search, Find As You Type

As a developer, I try to be browser agnostic and use all the 3 popular browsers (IE, Firefox, Opera) on my development machine. One good thing I liked in Firefox 2.0 is the inline spell checking feature that chips in when you are typing anything in a text area (like this blog post in Blogger) on any web page. I also find the Inline Search & Find As You Type features helpful. I got to know from the "Firefox Myths" article that this is now available for IE (5.5 and above) as well through a free Add-on .

HOW TO add a header or footer to a dynamically generated Word document

Image
There was a question recently on my CodeProject article "Dynamically generate a MS Word document using HTML & CSS" . The article describes how to generate a Word document programmatically without using any components, by exploiting the formatting features exposed through Office XML and CSS. The questioner wanted to know how to add a custom header and footer and show something like Page X of Y (total pages). Based on what I have tried so far, showing a header and footer using Office XML in MS Word is not as easy as it is in Excel . If you want to keep the code simple & don't need any great fireworks i.e. you will just settle for page numbers in the header or footer then it's a matter of adding a few lines to the original source code. The code can be viewed at this Github Gist Update (1-Sep-2010): To add a custom header & footer, check this new post To add a footer that shows Page number at the bottom right, here are the steps - 1) Add these classes...