Showing posts sorted by relevance for query label:Chrome|label:Google. Sort by date Show all posts
Showing posts sorted by relevance for query label:Chrome|label:Google. Sort by date Show all posts

Awesome Tips about Google Products


Google Lens Tips and Tricks


Using Save to Google Drive & Google Cloud Print Effectively


Today it's very common that we save or print some web pages, save some pdf/ppt links directly to Google Drive, so we can access them everywhere.

Save to Google Drive Plugin
We can install Google's Save to Google Drive plugin.

Then if we want to save the page we are browsing as a PDF to Google Drive, click the "Save to Google Drive" button.
If we want to save content of a link to GDrive, right click it, then select "Save Link to Google Drive" menu.

It allows to rename the file to give the file an meaningful name.

Google Cloud Print
Google Cloud Print is integrated with Chrome in desktop version. It allows us to print to local printers, send print jobs from virtually anywhere to a connected printer in any other location or send print jobs to phones or tablets.

It can also allow us to send print jobs to Google drive, the file will be saved as PDF.

When we enter Ctrl+P, Chrome will open Print dialog in current page. Click the change button in Destination section, and select "Save to Google Drive". We can change the layout as Portrait or Landscape.


We can click Save button on the top.

If we want to change the file name, we have to click "Print using Google Drive dialog". In the Google Cloud print dialog, select "Save to Google Drive", in next page, give the file an meaningful name.
Mobile
In android phone/tablets, we can install the Google Drive and Google CLoud Print apps, then use Android's "Share" function to save to GDrive.
 or send print jobs.

Youtube Tips and Tricks


How to Prevent Accidentally Close the Tab in Browser


Awesome Tips about Google Assistant


Awesome Tips about Google Blogger


Using Chrome DevTools to Bring Default Context Menu: Enable Copy Text


The Problem
Sometimes site owners disable right-click context menu for some reason: to disallow copy text, or to protect better user experience such as Google Drive and Dropbox:  remove browser context menu and add customized context menu.

As web developer, or hackers, we use Chrome Devtools often, especially its "Inspect Element" function, so sometimes we want to remove this limitation: to bring back the browser default context menu.


Enable Copy - Chrome extension
Simple Solution that Works Most Time: document.oncontextmenu = null
or document.designMode = "on"
Site owner usually add javascript like below to disable context menu: <body oncontextmenu="return false;">
Or:
document.oncontextmenu = function() {
    return false;
};
In this case, we can just execute document.oncontextmenu = null in Chrome Devtools to remove the handler.

But sometimes, things are harder. Let's take a look at how to show default context menu in Google Drive as an example.

If this doesn't work you may run the following javascript code in devtools:
window.oncontextmenu=null;;
window.onmousedown=null;
window.onkeydown=null;
window.onclick=null;

document.oncontextmenu=null;
document.onmousedown=null;
document.onkeydown=null;
document.onclick=null;

document.onselectstart=null;
Re-enable Default Context Menu in Google Drive: by Changing Definition of hca function
To restore the default browser context menu in Google Drive, we first open Chrome Devtools(Using Ctrl+Shift+I), in the bottom panel, go to search tab, type "contextmenu".

It will find matches in js file: 2222407164-doclist_modularized_core.js


Clicking one match will bring you to the line, but this js file is minified, and ubale to read. SO click on the pretty button {}, this will format the js file to make it more readable.


Then search "contextmenu" again in the button search tab. Now it will show matches in the formatted js file. 


The following code seems interesting to us. e.Yqa prevent context menu default behaviour.
e.initialize = function(a) {
    b.listen(a, "contextmenu", this.Yqa);
};
e.Yqa = function(a) {
    a.shiftKey || (a.stopPropagation(), a.preventDefault(), pCa(this, a.clientX, a.clientY, a.target))
};
Let's add a breakpoint in the e.Yqa function, right click on Google Drive, now it stops at the Yqa function. This is great.

From the Call Stack view, we can see that e.Yqa function is called by function hca.
function hca(a, b) {
    var c = a.Gn, d = a.Xd || a.src;
    a.Ooa && Ze(a);
    return c.call(d, b)
}
hca is a global function, we can change its definition in the console to change its behavior.


Check the value of parameter a, and b. Found out when we right click in Google Drive, the value of a.type is "contextmenu".

So we can change hca like below: if a.type="contextmenu", do nothing, return directly.
function hca(a, b) {
   if( a.type == "contextmenu" ) return;
    var c = a.Gn, d = a.Xd || a.src;
    a.Ooa && Ze(a);
    return c.call(d, b)
}
So every time, we want to show Chrome's default context menu in Google Drive, run the previous js code in the console to change the definition of hca. Then right click on Google Drive, it will show default context menu.

Happy hacking!!!

Resource
Don’t Disable Right Click!

Google Search Tips


Google Search Tips

How to Get More out of Google

I'm Feeling Lucky

Getting Specific

Singular is different from plural.

The order of words matters. Google considers the first word most important, the second word next, and so on.

Google ignores most little words or called stop words.

Google ignores most punctuation, except apostrophes, hyphens, and quote marks.

To Quote a Phrase

If you type in more than one keyword, Google automatically searches for all the words anywhere they appear on a Web page, whether they're side by side or scattered throughout.

If you want only Web pages that contain your words in order, as a complete phrase, let Google know by enclosing your words in quotes, as: "to be or not to be".

Searching Within Your Results

And vs. Or

When you run a search, Google assumes that you want to find all of the search words you type.

If, on the other hand, you want to find pages that have either one term or another, type OR between them, like this: "Ben Affleck" OR "Matt Damon" OR chimps

Finally, if you want one term plus any of several other terms, group the optionsin parentheses, like this: chimps ("Ben Affleck" OR "Mark Wahlberg")

Just Say No

Google lets you use a minus sign (or dash) to indicate that you don't want a certain term to appear in your results.: "Ben Affleck" -"Jennifer Lopez"

Just Say Yes

If a common word or number is critical to your search, you can tell Google to include it. Simply place a plus sign (+) directly in front of the term you want to include, like this: +the omen

Two Important Google Quirks

Wildcards

Google offer full-word wildcards. You can throw one into a phrase and have it substitute for a word. Thus, searching for "chicken with its * cut off" could find: "chicken with its head cut off," "chicken with its hair cut off," "chicken with its electricity cut off," and so on.

The full-word wildcard is also cool when you want the answer to a question.

Haley's comet appears every * years

Playing the wildcard

Google doesn't count wildcards as part of your *-word limit.

Similar pages

The "Similar pages" link searches the Web for pages that fall into the same general category as that result.

Sponsored Links

Cool Google Tricks

Definitions define sedulous

If you want a list of definitions and no other results, type in define followed by a colon and your terms, with no spaces on either side of the colon, like this: define:wireless LAN

Calculator

You can use the blank Google search box as a calculator.

Phonebook

Google provides a phonebook service, letting you look up a phone number and address (with corresponding map) for business or residential listings.

To get a page of nothing but phonebook listings, type the word phonebook followed by a colon, then a space, and then the name and state you want to look up:

phonebook: ansonia veterinary center NY

To limit your search to residential listings, type rphonebook before the name and state. For business listings, use bphonebook.

Patents, Tracking IDs, and Other Numeric Goodies

Weather: weather: shanghai

Movies: movie public enemy


Superior Searching

Setting Preferences

SafeSearch Filtering

Page-specific tools:

Find pages similar to the page

Find pages that link to the page

http://www.google.com.au/language_tools?hl=en

http://translate.google.com/

Getting Fancy with Syntax

File format: filetype:[pdf|ppt|doc|xls|swf|]

Specifying where on a page to search: allintitle, allinbody, allinurl, allinlinks

Domain: site:www.ibm.com/developerworks

Searching Titles: intitle:"file sharing"

A variation of this syntax, allintitle, finds pages that have all your keywords or phrases in the title, in any order: allintitle:file sharing

Searching Text: intext:amazon

Searching Anchors: inanchor:"Richard Stallman"

Searching Within Sites and Domains: site:gov "agricultural subsidies"

You can also use site to exclude a particular Web site from your search: books -site:amazon.com

Searching URLs:

Inurl is also handy when you want to exclude a site from your search: books -inurl:amazon

Who Links to Whom?

If you type in link:friendster.com, Google spits out a list of pages linked to Friendster.com.

Caching Up

The cache operator lets you view Google's last cached copy of a page, even if the page has moved from its original URL or changed radically: cache:espn.com

Searching for Related Content

The related operator performs the same search as the "Similar pages" link that appears in a Google result: related:"sesame street"

Synonyms

The ~ symbol tells Google to look for synonyms: ~help "openoffice"

Most of the Kit and Caboodle

The info operator provides you with a tidy summary of the details Google can give you about a URL: info:firefox 3.6

Mixing Syntax

How Not to Mix Syntax

Canceling yourself out

Don't mix operators that cancel each other out: site:bluefly.com inurl:bluefly

Doubling up

"trading spaces" site:com site:edu

To get what you want, try this: "trading spaces" (site:edu OR site:com)

How to Mix Syntax Correctly

cattle intitle:form site:usda.gov

Anatomy of a Google URL

http://www.google.com.au/search?hl=en&num=30&q=firefox+4&btnG=Search&meta=&aq=f&oq=

Changing the Number of Results: num=?

The "q" toward the end signals the query itself.

Changing the Interface Language: hl=en


Other sites:

http://clusty.com/

Many sites perform deeper, more specialized searches than Google.

http://mesa.rrzn.uni-hannover.de/


Resources:

Google: The Missing Manual

Guide to Google Guice


Must-Know Chrome DevTools Tips and Tricks


Collections in Guava


Google Guava is an open source library which provides lots of useful utility to Java programmer,  one of them is easy way to find the difference between two maps.
MapDifference of two Maps

public void getMapDiff() {
    Map<Integer,Integer> leftMap = ImmutableMap.of(1, 1, 2, 2, 4, 40);
    Map<Integer,Integer> rightMap = ImmutableMap.<Integer,Integer> builder()
        .put(2, 2).put(3, 3).put(4, 41).build();
    MapDifference<Integer,Integer> diff = Maps.difference(leftMap, rightMap);
    
    // output: entriesInCommon:{2=2}
    System.out.println("entriesInCommon:" + diff.entriesInCommon());
    // output: entriesOnlyOnLeft:{1=1}
    System.out.println("entriesOnlyOnLeft:" + diff.entriesOnlyOnLeft());
    // output: entriesOnlyOnRight:{3=3}
    System.out.println("entriesOnlyOnRight:" + diff.entriesOnlyOnRight());
    
    Map<Integer,ValueDifference<Integer>> entriesDiffering = diff
        .entriesDiffering();
    // output: entriesDiffering: {4=(40, 41)}
    System.out.println("entriesDiffering: " + entriesDiffering);
  }

JavaScript: Get the Selected Html in Webpage


The Code
Tested in Chrome:
function getSelectionHtml(selection) {
  var range = selection.getRangeAt(0);
  
  var div = document.createElement('div');
  div.appendChild(range.cloneContents());
  var htmlText = div.innerHTML;
  return htmlText;
}

function parseSelection() {
  var selection = window.getSelection();
  
  if(selection.rangeCount > 0)
  {
      var selectedHtml = getSelectionHtml(selection);
      console.log("selectedHtml: " + selectedHtml);
  }   
}

parseSelection();

How To Show Post Excerpts on Blogger when Writing with Markdown, Pandoc and Minify


Quickly Access Tab History in Chrome


When we are browsing a web site, we may want to go back to one page we viewed before - 2 or 3 pages back, but we are not sure. 
In the past, we have to click the back button once or multiple times to the desired page, or we may click back button too many times, have to click forward button. This is inconvenient.

In recent update to Chrome, we can view a full list of current tab history by holding the back or forward button. This will reveal a drop down area, with previously viewed tabs displayed in a vertical list like below:

If left click on the page , Chrome will open the page in current tab; if click the mouse middle button on the page, Chrome will open the page in a new tab.- Not the mouse right button, this is kind of counter-intuitive.

This feature is available in all platform: in windows, Linux, tablet, Android, and IPhone, IPad.

Labels

ANT (6) Algorithm (69) Algorithm Series (35) Android (7) Big Data (7) Blogger (14) Bugs (6) Cache (5) Chrome (19) Code Example (29) Code Quality (7) Coding Skills (5) Database (7) Debug (16) Design (5) Dev Tips (63) Eclipse (32) Git (5) Google (33) Guava (7) How to (9) Http Client (8) IDE (7) Interview (88) J2EE (13) J2SE (49) JSON (7) Java (186) JavaScript (27) Learning code (9) Lesson Learned (6) Linux (26) Lucene-Solr (112) Mac (10) Maven (8) Network (9) Nutch2 (18) Performance (9) PowerShell (11) Problem Solving (11) Programmer Skills (6) Scala (6) Security (9) Soft Skills (38) Spring (22) System Design (11) Testing (7) Text Mining (14) Tips (17) Tools (24) Troubleshooting (29) UIMA (9) Web Development (19) Windows (21) adsense (5) bat (8) regex (5) xml (5)