Sunday, September 12, 2010

Open, View & Edit PDF, Docs and PPT Files Download From Websites With gPDF


Please note that this article was 'send-to' here from the following Google Reader article
All credit goes to the author, abhishek


There are times when you need view or edit a pdf, doc, docx or ppt file on a public computer and that computer may not have MS Office or PDF viewer like adobe pdf reader installed in such case you might feel helpless, but there is way to solve this issue with even installing MS Office or adobe reader on the computer.
In such cases you can use gPDF which is a browser extension for firefox, google chrome, safari and opera. It helps you open the above mentioned file type and edit then with free google docs viewer. You don’t need to have MS Office or Adobe reader installed on a computer to view or edit these files using google docs.
Some Important Features Of gPDF Browser Extension
  • Safe. You don’t need to use potentially vulnerable tools such as a local PDF reader. You open files remotely, without downloading them.
  • Fast! No more wait for downloading PDF, PPT, DOC and DOCX files! Google Docs Viewer processes files with super speed. It feels like visiting another web page.
  • HTTPS Secured connection. gPDF connects to Google Docs Viewer using secured connection.
  • You don’t need Adobe Reader or MS Office to open online files.
  • Full screen view. gPDF now opens PDF, DOC, Docs and PPT files in full screen mode.
  • Links to EDIT and SAVE file in your Google Docs account. Note: Google Docs does not support editing PDF files.


gpdf-31
gPDF Install Options
Firefox users can install the gPDF add-on from here.
Chrome users can install gPDF extension from the Chrome extension gallery.
Install gPDF as a greasemonkey script (userscript) from userscripts.org.
Opera and Safari users can use gPDF as a greasemonkey script.
A fellow blogger Arpit has developed this cool browser extension, he blogs at TechRaga, you can read this page for more updates on this extension.

14 Helpful jQuery Tricks, Notes, and Best Practices

Please note that this article was 'send-to' here from the following Google Reader article.
All credit goes to the author, Jeffrey Way


If there is one bad thing about jQuery, it’s that the entry level is so amazingly low, that it tends to attract those who haven’t an ounce of JavaScript knowledge. Now, on one hand, this is fantastic. However, on the flip side, it also results in a smattering of, quite frankly, disgustingly bad code (some of which I wrote myself!).
But that’s okay; frighteningly poor code that would even make your grandmother gasp is a rite of passage. The key is to climb over the hill, and that’s what we’ll discuss in today’s tutorial.

1. Methods Return the jQuery Object
It’s important to remember that most methods will return the jQuery object. This is extremely helpful, and allows for the chaining functionality that we use so often.

$someDiv .attr('class', 'someClass') .hide() .html('new stuff');

Knowing that the jQuery object is always returned, we can use this to remove superfluous code at times. For example, consider the following code:

var someDiv = $('#someDiv'); someDiv.hide();

The reason why we “cache” the location of the someDiv element is to limit the number of times that we have to traverse the DOM for this element to once.

The code above is perfectly fine; however, you could just as easily combine the two lines into one, while achieving the same outcome.

var someDiv = $('#someDiv').hide(); 

This way, we still hide the someDiv element, but the method also, as we learned, returns the jQuery object — which is then referenced via the someDiv variable.

2. The Find Selector
As long as your selectors aren’t ridiculously poor, jQuery does a fantastic job of optimizing them as best as possible, and you generally don’t need to worry too much about them. However, with that said, there are a handful of improvements you can make that will slightly improve your script’s performance.

One such solution is to use the find() method, when possible. The key is stray away from forcing jQuery to use its Sizzle engine, if it’s not necessary. Certainly, there will be times when this isn’t possible — and that’s okay; but, if you don’t require the extra overhead, don’t go looking for it.

// Fine in modern browsers, though Sizzle does begun 'running' $('#someDiv p.someClass').hide(); // Better for all browsers, and Sizzle never inits. $('#someDiv').find('p.someClass').hide(); 

The latest modern browsers have support for QuerySelectorAll, which allows you to pass CSS-like selectors, without the need for jQuery. jQuery itself checks for this function as wellHowever, older browsers, namely IE6/IE7, understandably don’t provide support. What this means is that these more complicated selectors trigger jQuery’s full Sizzle engine, which, though brilliant, does come along with a bit more overhead.
Sizzle is a brilliant mass of code that I may never understand. However, in a sentence, it first takes your selector and turns it into an “array” composed of each component of your selector.
// Rough idea of how it works ['#someDiv, 'p'];


It then, from right to left, begins deciphering each item with regular expressions. What this also means is that the right-most part of your selector should be as specific as possible — for instance, an id or tag name.

Bottom line, when possible: 
Keep your selectors simple
Utilize the find() method. This way, rather than using Sizzle, we can continue using the browser’s native functions.
When using Sizzle, optimize the right-most part of your selector as much as possible.

Context Instead?

It’s also possible to add a context to your selectors, such as:

$('.someElements, '#someContainer').hide();
This code directs jQuery to wrap a collection of all the elements with a class of someElements — that are children of someContainer — within jQuery. Using a context is a helpful way to limit DOM traversal, though, behind the scenes, jQuery is using the find method instead. 

$('#someContainer') .find('.someElements') .hide(); 


Proof 

// HANDLE: $(expr, context)// (which is just equivalent to: $(context).find(expr) } else { return jQuery( context ).find( selector ); } 


3. Don’t Abuse $(this) 
Without knowing about the various DOM properties and functions, it can be easy to abuse the jQuery object needlessly. For instance:

$('#someAnchor').click(function() { // Bleh alert( $(this).attr('href') ); }); 

If our only need of the jQuery object is to access the anchor tag’s href attribute, this is wasteful. Better to stick with “raw” JavaScript. 

$('#someAnchor').click(function() { alert( this.href ); }); 

Multiple jQuery Objects 

Even worse is the process of repeatedly querying the DOM and creating multiple jQuery objects.

$('#elem').hide(); $('#elem').html('bla'); $('#elem').otherStuff(); 

Hopefully, you’re already aware of how inefficient this code is. If not, that’s okay; we’re all learning. The answer is to either implement chaining, or to “cache” the location of #elem.

// This works better $('#elem') .hide() .html('bla') .otherStuff(); // Or this, if you prefer for some reason. var elem = $('#elem'); elem.hide(); elem.html('bla'); elem.otherStuff(); 

4. jQuery’s Shorthand Ready Method 

Listening for when the document is ready to be manipulated is laughably simple with jQuery. 

$(document).ready(function() { // let's get up in heeya }); 

Though, it’s very possible that you might have come across a different, more confusing wrapping function. 

$(function() { // let's get up in heeya }); 

Though the latter is somewhat less readable, the two snippets above are identical. Don’t believe me? Just check the jQuery source.

// HANDLE: $(function) // Shortcut for document ready if ( jQuery.isFunction( selector ) ) { return rootjQuery.ready( selector ); } 

rootjQuery is simply a reference to the root jQuery(document). When you pass a selector to the jQuery function, it’ll determine what type of selector you passed: string, tag, id, function, etc. If a function was passed, jQuery will then call its ready() method, and pass your anonymous function as the selector. 


5. Keep your Code Safe 

If developing code for distribution, it’s always important to compensate for any possible name clashing. What would happen if some script, imported after yours, also had a $ function? Bad stuff!

The answer is to either call jQuery’s noConflict(), or to store your code within a self-invoking anonymous function, and then pass jQuery to it. 

Method 1: NoConflict 

var j = jQuery.noConflict(); // Now, instead of $, we use j. j('#someDiv').hide(); // The line below will reference some other library's $ function. $('someDiv').style.display = 'none';


Method 2: Passing jQuery
(function($) { 
     // Within this function, $ will always refer to jQuery 
})(jQuery); 

The final parens at the bottom call the function automatically – function(){}(). However, when we call the function, we also pass jQuery, which is then represented by $. 

Method 3: Passing $ via the Ready Method 

jQuery(document).ready(function($) { // $ refers to jQuery }); // $ is either undefined, or refers to some other library's function. 

6. Be Smart

Remember – jQuery is just JavaScript. Don’t assume that it has the capacity to compensate for your bad coding. 

This means that, just as we must optimize things such as JavaScript for statements, the same is true for jQuery’s each method. And why wouldn’t we? It’s just a helper method, which then creates a for statement behind the scenes.


// jQuery's each method source each: function( object, callback, args ) { var name, i = 0, length = object.length, isObj = length === undefined || jQuery.isFunction(object); if ( args ) { if ( isObj ) { for ( name in object ) { if ( callback.apply( object[ name ], args ) === false ) { break; } } } else { for ( ; i < length; ) { if ( callback.apply( object[ i++ ], args ) === false ) { break; } } } // A special, fast, case for the most common use of each } else { if ( isObj ) { for ( name in object ) { if ( callback.call( object[ name ], name, object[ name ] ) === false ) { break; } } } else { for ( var value = object[0]; i < length && callback.call( value, i, value ) !== false; value = object[++i] ) {} } } return object; } 

Awful 

someDivs.each(function() {$('#anotherDiv')[0].innerHTML += $(this).text(); }); 

Searches for anotherDiv for each iteration 
Grabs the innerHTML property twice 
Creates a new jQuery object, all to access the text of the element. 

Better

var someDivs = $('#container').find('.someDivs'), contents = []; someDivs.each(function() { contents.push( this.innerHTML ); }); $('#anotherDiv').html( contents.join('') ); 

This way, within the each (for) method, the only task we're performing is adding a new key to an array…as opposed to querying the DOM, grabbing the innerHTML property of the element twice, etc. 

This tip is more JavaScript-based in general, rather than jQuery specific. The point is to remember that jQuery doesn't compensate for poor coding. 


Document Fragments 

While we're at it, another option for these sorts of situations is to use document fragments. 

var someUls = $('#container').find('.someUls'), frag = document.createDocumentFragment(), li; someUls.each(function() { li = document.createElement('li'); li.appendChild( document.createTextNode(this.innerHTML) ); frag.appendChild(li); }); $('#anotherUl')[0].appendChild( frag ); 

The key here is that there are multiple ways to accomplish simple tasks like this, and each have their own performance benefits from browser to browser. The more you stick with jQuery and learn JavaScript, you also might find that you refer to JavaScript's native properties and methods more often. And, if so, that's fantastic! 

jQuery provides an amazing level of abstraction that you should take advantage of, but this doesn't mean that you're forced into using its methods. For example, in the fragment example above, we use jQuery's each method. If you prefer to use a for or while statement instead, that's okay too!

Will all that said, keep in mind that the jQuery team have heavily optimized this library. The debates about jQuery's each() vs. the native for statement are silly and trivial. If you are using jQuery in your project, save time and use their helper methods. That's what they're there for!  


7. AJAX Methods

If you're just now beginning to dig into jQuery, the various AJAX methods that it makes available to us might come across as a bit daunting; though they needn't. In fact, most of them are simply helper methods, which route directly to $.ajax.

get 
getJSON 
post 
ajax 


As an example, let's review getJSON, which allows us to fetch JSON.

$.getJSON('path/to/json', function(results) { // callback // results contains the returned data object }); 

Behind the scenes, this method first calls $.get.

getJSON: function( url, data, callback ) { return jQuery.get(url, data, callback, 'json'); }

$.get then compiles the passed data, and, again, calls the 'master' (of sorts) $.ajax method.

get: function( url, data, callback, type ) { // shift arguments if data argument was omited if ( jQuery.isFunction( data ) ) { type = type || callback; callback = data; data = null; } return jQuery.ajax({ type: 'GET', url: url, data: data, success: callback, dataType: type }); } 

Finally, $.ajax performs a massive amount of work to allow us the ability to successfully make asynchronous requests across all browsers! 

What this means is that you can just as well use the $.ajax method directly and exclusively for all your AJAX requests. The other methods are simply helper methods that end up doing this anyway. So, if you want, cut out the middle man. It's not a significant issue either way. 

Just Dandy

$.getJSON('path/to/json', function(results) { // callback // results contains the returned data object }); 


Microscopically More Efficient 

$.ajax({type: 'GET', url : 'path/to/json', data : yourData, dataType : 'json', success : function( results ) { console.log('success'); }) }); 


8. Accessing Native Properties and Methods

So you've learned a bit of JavaScript, and have learned that, for instance, on anchor tags, you can access attribute values directly: 

var anchor = document.getElementById('someAnchor'); //anchor.id // anchor.href // anchor.title // .etc

The only problem is that this doesn't seem to work when you reference the DOM elements with jQuery, right? Well of course not. 

Won't Work 

// Fails var href = $('#someAnchor').href; 

So, should you need to access the href attribute (or any other native property or method for that matter), you have a handful of options. 

// OPTION 1 - Use jQuery var href = $('#someAnchor').attr('href'); 
// OPTION 2 - Access the DOM element var href = $('#someAnchor')[0].href; 
// OPTION 3 - Use jQuery's get method var href = $('#someAnchor').get(0).href; 
// OPTION 3b - Don't pass an index to get anchorsArray = $('.someAnchors').get(); var thirdHref = anchorsArray[2].href; 

The get method is particularly helpful, as it can translate your jQuery collection into an array.


9. Detect AJAX Requests with PHP

Certainly, for the huge majority of our projects, we can't only rely on JavaScript for things like validation, or AJAX requests. What happens when JavaScript is turned off? For this very reason, a common technique is to detect whether an AJAX request has been made with your server-side language of choice.

jQuery makes this ridiculously simple, by setting a header from within the $.ajax method. 

// Set header so the called script knows that it's an XMLHttpRequest // Only send the header if it's not a remote XHR if ( !remote ) { xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); } 

With this header set, we can now use PHP (or any other language) to check for this header, and proceed accordingly. For this, we check the value of $_SERVER['HTTP_X_REQUESTED_WITH'].

Wrapper 

function isXhr() { return $_SERVER['HTTP_X_REQUESTED_WITH'] === 'XMLHttpRequest'; } 


10. jQuery and $ 

Ever wonder why/how you can use jQuery and $ interchangeably? To find your answer, view the jQuery source, and scroll to the very bottom. There, you'll see:

window.jQuery = window.$ = jQuery; 

The entire jQuery script is, of course, wrapped within a self-executing function, which allows the script to limit the number of global variables as much as possible. What this also means, though, is that the jQuery object is not available outside of the wrapping anonymous function. 

To fix this, jQuery is exposed to the global window object, and, in the process, an alias - $ - is also created. 

11. Conditionally Loading jQuery

HTML5 Boilerplate offers a nifty one-liner that will load a local copy of jQuery if, for some odd reason, your chosen CDN is down. 

<!-- Grab Google CDN jQuery. fall back to local if necessary --> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script>!window.jQuery && document.write('<script src="js/jquery-1.4.2.min.js"><\/script>')</script> 

To 'phrase' the code above: if window.jQuery is undefined, there must have been a problem downloading the script from the CDN. In that case, proceed to the right side of the && operator, and insert a script linking to a local version of jQuery.

12. jQuery Filters

(video link removed)

<script>$('p:first').data('info', 'value'); // populates ${body}#39;s data object to have something to work with $.extend( jQuery.expr[":"], { block: function(elem) { return $(elem).css("display") === "block"; }, hasData : function(elem) { return !$.isEmptyObject( $(elem).data() ); } } ); $("p:hasData").text("has data"); // grabs paras that have data attached $("p:block").text("are block level"); // grabs only paragraphs that have a display of "block" </script> 

Note: jQuery.expr[':'] is simply an alias for jQuery.expr.filters.


13. A Single Hover Function 

As of jQuery 1.4, we can now pass only a single function to the hover method. Before, both the in and out methods were required.

Before 

$('#someElement').hover(function() { // mouseover }, function() { // mouseout }); 

Now 

$('#someElement').hover(function() { // the toggle() method can be used here, if applicable }); 

Note that this isn't an old vs. new deal. Many times, you'll still need to pass two functions to hover, and that's perfectly acceptable. However, if you only need to toggle some element (or something like that), passing a single anonymous function will save a handful of characters or so! 

14. Passing an Attribute Object 

As of jQuery 1.4, we can now pass an object as the second parameter of the jQuery function. This is helpful when we need to insert new elements into the DOM. For example:

Before 

$('<a />') .attr({ id : 'someId', class : 'someClass' href : 'somePath.html' }); 


After 

$('</a>', { id : 'someId', class : 'someClass' href : 'somePath.html' }); 

Not only does this save a few characters, but it also makes for cleaner code. In addition to element attributes, we can even pass jQuery specific attributes and events, like click or text.

Backup and Restore Master Boot Record

Please note that this article was 'send-to' here from the following Google Reader article
All credit goes to the author, jk.

Backup and Restore Master Boot Record: "The Master Boot Record (MBR) is the very critical part of a computer system. If it is damaged due to a virus attack or by other means your data on your hard drive may lost forever. The MBR Backup tool helps you in such critical situation. The new version of MBR Backup tool (v.2) allows you to restore saved backups in the event that your MBR becomes corrupted. You can do this by connecting the drive to another computer.




Another very helpful feature of this new version is its ability to view the partition which is table contained in the MBR. Moreover, this new version will also show the MBR on any drive connected to the computer.
You can download MBR Backup tool from here [home page]

Wednesday, September 8, 2010

Magento installation notes

There is a great article here describing what to do to ensure that, once you've installed Magento onto your local host, you can login as admin.

If you do not follow the above instructions, you will find yourself unable to login as admin.

Additionally, this article shows how to configure a test Paypal account with Magento.


ps: Comments and/or links to this article are most welcome!

Friday, September 3, 2010

Chrome August's big winner as Internet Explorer resumes slide

Please note that this article was 'send-to' here from the following Google Reader article
All credit goes to the author, Emil Protalinski.




As browser competition continues to heat up, 2010 looks like the year when the market was repeatedly disrupted. Internet Explorer has not managed to gain share for a third month in a row. Firefox is leveling out while Chrome and Safari continue to grow. Opera? It's hanging on to relevance.


Between July and August, Internet Explorer dropped 0.34 percent, a drop smaller than June's or July's gain. Firefox, meanwhile, went up 0.02 percent, Chrome gained 0.36 percent, Safari was up 0.07, and Opera dipped 0.08 percent.


IE looks stuck around the 60 percent mark for the time being. At least it's still above its lowest point (59.69 percent) with its best chance of market share gains in the short term coming with the IE9 beta, and the back-to-school season.


The importance of being the default browser in the world's most popular operating system continues to help IE. Microsoft browsers are being used by more than 6 out of 10 people and IE8 is being used by more than one in four on the Web (quickly closing in on one in three)—it is now at 27.90 percent (over 30 percent if Compatibility Mode is included). Unfortunately for Web developers everywhere, IE6 continues to be more popular than IE7, though this month it declined more than its successor. IE6's share can be attributed to businesses still using customized intranet applications, and XP's much bigger installed base than Vista's (especially in developing countries).



If we take a look at the last 12 months, the stabilization of IE is really obvious. Firefox, meanwhile, remains far away from what may be the unreachable 25 percent mark, having lost all the share it gained in the last year. Its market share is actually lower than it was a year ago. Chrome's progress is very noticeable in the chart above, though it seems to have found resistance at the 7 percent mark. Safari's gains are at about 1 percentage point, while Opera's are almost insignificant.



As always, things at Ars are very different. There was no place-changing this time: Firefox continues to dominate, Chrome is second, Safari is third, IE is fourth, and Opera brings up the rear. Last month, Firefox gained share, as did Chrome and Opera. The first-party browsers, Safari and IE, both dropped.
Please note that this article was 'send-to' here from the following Google Reader article
All credit goes to the author, jk.




Quickly Make Windows 7 Bootable USB Device


"Making a USB bootable operating system is a good idea if you want to install an operating system in machines that has no optical drive, for example netbooks and ultra-portable laptops.
Moreover, one of the main advantages of a bootable USB disk is, as it is faster than the optical drive, installing your OS requires less time, but, of course, your motherboard should have USB boot support.
Here is a very simple solution to create a bootable USB drive for Windows 7 without any extra expense and DOS technique. The free application called Windows 7 SBB Tool lets you easily create USB bootable windows 7 setup in few steps.
It is very simple to use if you have Windows 7 iso file, just extract the files in any location of your local disk and specify it to SSB Tool. You can choose any removable device (USB drive, SD Card, etc), if your motherboard has support for that.
Download Windows 7 SBB Tool

Wednesday, September 1, 2010

PDFill – Collection of 15 Useful Free PDF Tools, PDF Writer and Image Writer & PDF Editor

Please note that this article was 'send-to' here from the following Google Reader article
All credit goes to the author, Mayur.


pdf PDFill package contains the complete PDFill applications including the FREE PDF Tools, the FREE PDF and Image Writer and evaluation copy of PDFill PDF Editor. Check below about these 3 programs:


1) PDFill PDF Tools -



PDFill PDF Tools is a free suite without any Watermarks, which provides the world’s most powerful and useful PDF tools for FREE. It offers many tools for PDFs like Split, Merge, Rotate, Encrypt PDF, Watermark PDF files, add or edit PDF information, etc. All the 15 tools are accessible from one program, making it definitely easy to use.


PDFill PDF Tools_15 Free pdf tools



Following is the list of 15 Tools included in PDFill PDF Tools along with their function:

  • 1. Merge - Merge two or more PDF files into a single PDF file.
  • 2. Split or Reorder – Extract pages from a PDF file into a new file. Reorder the page sequence into a new file.
  • 3. Encrypt and Decrypt with Security Options – Protect PDF files with passwords and prevent PDF files from being printed, copied, changed, filled, extracted, signed, assembled or merged. Supports Adobe Standard 40-bit Encryption and Adobe Advanced 128-bit Encryption.
  • 4. Rotate and Crop – Rotate a PDF page by 0, 90, 180 and 270 degree. Crop a page to modify its layout of Print or View by specifying its margins.
  • 5. Reformat – Put multiple pages into one page to save paper and inks when printing hard copies. Add note lines for handout.
  • 6. Header and Footer – Add Headers and Footers to present information, such as date, time, page numbers, or the title of the document, in the top or bottom margins of a document.
  • 7. Watermark by Stylized Text – Add Stylized Text Stamp.
  • 8. Watermark by Image – Add Stamp using image file (bmp, jpg, gif, png, tiff, and wmf).
  • 9. Convert Images to PDF – Convert images (bmp, jpg, gif, png, tiff, and wmf) into a PDF file with layout options.
  • 10. Convert PDF into images – Save PDF pages into images (png, jpg, bmp, gif, wmf, and tiff) with DPI options.
  • 11. PDF Form Fields: Delete, Flatten, List – Delete, Flatten or List the PDF Form Fields inside a PDF file.
  • 12. Convert PostScript (PS) File into PDF – Covert PS files into PDF files so Adobe Reader can read them.
  • 13. Add Information – Add information (title, author, subject, keywords, created, creator, producer, version) to PDF documents.
  • 14. Free Scanner – Scan your paper form or photo as an image file (PNG, JPG, BMP, TIF, GIF) or a PDF file.
  • 15. Create Transparent Image – Create a transparent image with options to adjust transparency options

2) PDFill PDF Writer and Image Writer (FREE) -
PDF Writer allows you to create highest quality PDF from ANY printable windows application including Microsoft Word, PowerPoint, Excel, Cad, and more. A PDF Button can be added into Microsoft Word, PowerPoint and Excel using the ‘Advanced’ button to save PDF in one click. It also offers numerous PDF saving options.


PDFill PDF and Image Writer


Image Writer is installed as a virtual printer driver which allows to Print your document as an image file (PNG, JPG, BMP, TIF, GIF) with options for resolution, alpha bits, rotation, flip, output, and registry control.


3) PDFill PDF Editor


The evaluation copy of PDFill PDF Editor is also included which offers rich and powerful tools to edit a PDF file without requiring Adobe Acrobat. The free evaluation version produces watermark edited PDF files.


PDFill PDF Editor


Download PDFill Package [9.1 MB]

Requires: Free Adobe Reader, GhostScript 8.63 and Sun Java.
Supports: Windows 2000/XP/2003/2008/Vista/Windows 7 (32 & 64 Bit)


[Updated 24dec2013]
4) Online PDF filler http://www.pdffiller.com