Tutorial

What are the most useful Google tricks for programmers?

The most valuable tricks on Google for those who work with programming

Google can be a friend to those who program: learn how to use the search engine to find solutions or clarify programming doubts

From the outside, developers just need to sit in front of the computer and write code as if it were mechanical work. If you’re from the area, you know that’s not the case. Sometimes it is necessary to spend some time on Google to find solutions to programming questions or problems .

Turning to the search engine for this is no demerit. But it’s important to know how to search, otherwise you won’t budge. The good news is that a few simple tricks can make Google a great ally of your work. Eight of them are presented in the next lines.

Just note that, as a program is usually a computer task, the tricks shown here were performed on the desktop. But the tips can also work on mobile devices.

1. Searching in English is a good start

The idea of writing this text came when we came across a message from Carol Cedro, on Twitter . In the tweet, the front-end and software engineering student asks precisely if there is any technique to search for (programming) solutions on Google.

When we passed the question to Camila Satie and Lyon Müller , developers of DIGITALTREND , they both echoed a tip that appeared in the responses Carol received: search in English, even if you have to use Google Translate.

One of the reasons for this is the fact that, on platforms like GitHub and Stack Overflow (and many others), English is used by most participants. Therefore, the chances that the solution to your problem has already been solved in a topic in that language are higher.

In addition, there is a very large number of developers who post content about the area on blogs, specialized sites or on YouTube, for example.

It’s not that you can’t search in Portuguese. Camila claims to have already found many solutions in our language. But English is really a more promising path.

2. Search Google using quotes

When you do a Google search using more than one word, the search engine tries to display pages that contain all or most of them in the results.

This can be good in some situations, but bad in others. For example, if you’re looking for information about a specific error message or syntax, ideally, Google should only display results that contain the exact phrase you used.

Fortunately, you can tell the search engine to search for the exact expression. Just put it in quotes.

Suppose, for example, that you encountered the error “illegal start of an expression” when programming in Java. To look for solutions to this problem, search Google using this exact expression, including the quotes. Note that the results will only show pages that have that exact phrase.

Search Google using quotes (image: Emerson Alecrim/Tecnoblog)
Search Google using quotes (image: Emerson Alecrim/Tecnoblog)

3. Make Google exclude results with a certain term

Google’s search algorithms are constantly being improved to display results that are contextualized, that is, that correspond to the real intentions of the user. Despite this, it is still possible to come across results that are not directly related to what you are looking for.

Again, there is a trick that alleviates this type of situation. Simply enter into Google the expression to be searched followed by the term (or terms) that should be ignored. The term must be preceded by the minus sign (-).

Imagine that you need to search for “exceptions” in the Python language, but you don’t want to see pages that relate this subject to errors. You can do the following search:

python exceptions -errors

With this, Google will prioritize pages that contain “python” and “exceptions”, but not “errors”.

4. Use asterisks in place of dynamic terms

You already know that searching with quotes is useful for syntax or error messages. But sometimes the warning has dynamic information, that is, it changes each time it is generated. This information can be a count of time or a specific date, just to give you a few examples.

In this case, the quotes may not work well unless you replace the dynamic information with a wildcard character (asterisk). Via Twitter, developer Sergio Soares gave an example of how this trick can be relevant. He did a search with the following expression, but there was no result:

release failed after 2.54s error=github/gitlab/gitea

So, Soares changed the dynamic information “2.54s” to *. He got it right:

release failed after * error=github/gitlab/gitea

Note that this trick also works with quoted searches.

Result with and without asterisk (image: Emerson Alecrim/Tecnoblog)
Result with and without asterisk (image: Emerson Alecrim/Tecnoblog)

5. Instruct Google to search only on a certain site

You also already know that there are specific sites for developers. Among them are the aforementioned GitHub (repository, discussion and questions) and Stack Overflow (questions), as well as services such as DevDocs (documentation), Hacker News (discussion) and Indie Hackers (discussion and questions).

These and many other sites often have very useful content for developers, but it’s often not easy to get to the topic that really interests you. It may happen that the site’s search engine is not very accurate, for example.

Fortunately, it’s possible to ask Google to display results that only link to a particular site. For example, suppose you are having problems with the Next.js framework. You can then ask Google to show results on the subject only within Stack Overflow.

How? Typing site:followed by the address of the website to be searched for plus the search term. In our case, it looks like this:

site:stackoverflow.com next.js

Make Google search only on a certain site (image: Emerson Alecrim/Tecnoblog)
Make Google search only on a certain site (image: Emerson Alecrim/Tecnoblog)

6. Search only in certain file type

It is often necessary to search for very specific information, such as a concept that is usually covered in academic documents. In these circumstances, it may be interesting to use Google to search only files with a certain format, such as PDF, DOCX, and TXT.

For example, suppose you need to review the Markov chain concept. There are many scholarly works on the subject. You can then search for that term followed by the instruction filetypeplus the file type. Here, we want PDF results. The command in Google looks like this:

cadeia de Markov filetype:pdf

Note that when doing this, Google will only show PDF files about Markov chain.

Several formats support this trick, including source code formats, for example: CPP (C++), PY (Python) and CS (C#).

An additional tip: when the search is related to a topic that is usually covered in academic works, using Google Scholar can be a good way to refine the search.

Search in a certain type of file (image: Emerson Alecrim/Tecnoblog)
Search in a certain type of file (image: Emerson Alecrim/Tecnoblog)

7. Convert measurements with Google

Fahrenheit versus Celsius, miles versus kilometers, pounds versus kilograms, dollars versus dollars, in short. Turns and moves a developer needs to deal with conversions. You can use ready-made libraries or scripts for this. But in a code review, for example, you might want to make sure that a certain conversion is correct. Well, turn to Google.

It’s simple: just type the original measurement followed by emor toand the expected measurement. Suppose, for example, that you need to convert 42 miles to kilometers. Just type:

42 milhas em quilômetros

Or:

42 milhas em km

Or, in English:

42 miles to km

If you need to convert 345 euros to US dollars, just type:

345 euros em dólar

Or, in English:

36 euros in dollars

The same logic applies to various types of conversion, you just have to test it.

Use Google as a converter of measurements and values ​​(image: Emerson Alecrim/Tecnoblog)
Use Google as a converter of measurements and values ​​(image: Emerson Alecrim/Tecnoblog)

8. Have Google show the cache

It is not uncommon for searches on programming to bring forums among the top results. The problem is that the discussion on these sites can be so intense that when you access the page, you no longer find the answer you were looking for.

But, yes, there is also a trick for situations like this: make Google display the cache for that page.

You can do this in two ways. In the first one, go back to the search page, click on the down arrow next to the website address and then on “cached”.

In the second, copy the address of the destination website, type it cache:in the address bar of the browser or in Google itself, and then paste the link (no space). Stays like this:

cache:tecnoblog.net

This hack can also be used for when the landing page is down, obviously.

Of course, the tips shown on this page can be used for other purposes, not just programming. But the idea here is to give guidance that can be really useful for aspiring or professionals in the field. If you work with development and want to add some tricks, leave your tip in the DIGITALTREND community !

Related Articles

Back to top button
%d bloggers like this: