Posts Tagged ‘search’

Google instant search: A better spell checker and calculator

September 16, 2010

One of my main uses for Google search is not the searching, but has slowing move towards often queries just for the sake of spell checking. Recently Google released its instant search. With that, I can easily see my spelling mistakes as I type, no more need to press enter :).

What I found by accident and found it even more useful is using instant search as a calculator. Some of you might know the Google easter egg about the answer to life universe and everything. Google calculator has been part of Google’s search features for some time now. With the instant search, the results of the calculator is also changed live. A cool and useful example (that was the way that made me discover this) is the binomial coefficient function. Give it a try and play around with it here.

Happy lazy calculating 🙂

Searching Source Code: LXR and grep

November 2, 2009

Looking for a certain functionality in someone else’s code could prove to be a tough challenge. This is increased by the size of the given project. Many systems exist today facilitating easy search in a project. For Java, eclipse is best used for that task, as it contains a strong in java class indexing, classification, and searching.

Some projects provide for you a portal to search their code base. Famous examples of these are LXR for the Linux kernel, and it’s customized version MXR used for Mozilla projects.

When all the above options are not available, the alternative exists natively in most linux systems. This is namely “grep”. Grep is a strong command for regular expression matching. On if it’s features is that it can also match to the content within files. Putting that in mind, the following command could be very useful:

grep -R "search query" .

This looks recursively for all mentions of search query in all files under the current directory. This prints output in the console the file name where this query was found, and the line that included it.

To be able to store this search result in a file, the output could be piped as follows:

grep -R "search query" . > log.txt


%d bloggers like this: