Tag Archives: search

Geany: Ignoring .SVN Folders when searching with Find in Files Software & Sites 08 APR 2013

Geany is a text editor using the GTK2 toolkit with basic features of an integrated development environment (IDE). It was developed to provide a small and fast IDE, which has only a few dependencies from other packages. It supports a fair number of languages (like PHP for example) and has most of the features that you would require from a simple IDE, making it a worthy tool for me to use on my sluggish home desktop PC, in place of the a bit too resource heavy, JAVA-powered NetBeans IDE.

By now pretty much all developers should be using some sort of source control system for their code, in my case the preferred one is SVN. The problem now arises that when searching for a string in all my project files using Geany’s Find in Files function, results are returned which point to files in the hidden .svn meta directories. Needless to say, this is pretty useless and definitely something which needs to be addressed.

Luckily for us though, Geany is essentially just pushing through the search request to grep to handle all the heavy lifting, meaning that we can leverage grep’s parameters in order to specify a directory to avoid searching in.

To do this, open up Geany’s Find in Files function via the Search menu, and note the last option in the resulting dialog, right at the bottom – the one that reads Extra options. Check this to enable and then add:

--exclude-dir=.svn

As easy as that. Obviously in this example I want the search to ignore .svn folders. Needless to say, you can modify this to whatever suits your individual needs. Nifty.

Ubuntu: How to jump to the next Search Result in Nano Software & Sites 26 MAR 2013

ubuntu-10-logoGNU nano is a simple terminal-based text editor. Though not as powerful as Emacs or Vim, it is (relatively) easy to learn and use, and has been part of a standard Ubuntu installation for years now.

Ctrl+w is show as the shortcut to initiate a simple text search, but frustratingly enough, it isn’t immediately obvious to jump to the next search result. As it turns out, to do this is simple enough: Alt+w will actually repeat the search, in other words jump to the next search result!

You’ll also notice when entering a search term at the start of a search operation, pressing the up and down arrows will allow you to cycle between terms previously searched on!

Oh, and to toggle searching backwards as opposed to forwards, you’ll need to press Alt+b.

And now you know.

PHP: How to Get the Associated Key from an Array given a Value Programming 06 FEB 2012

If you have a value and you suspect that it might be contained within your array, can you somehow find the key linked to that value if it does exist?

The answer is yes, thanks to the handy array_search function which searches an array for a given value and returns the corresponding key if the search is successful, and false if the value isn’t found in the array.

In practice:

$array = array(0 => 'blue', 1 => 'red', 2 => 'green', 3 => 'red');
$key = array_search('green', $array); // $key = 2;
$key = array_search('red', $array);   // $key = 1;

(Note that similar to strpos validations, you need to make use of the === operator when testing the return value of this function).

The array_search returns the first match it comes across, meaning that if the value is in the array, you’ll only know of one instance. If it is important to know all of the corresponding keys where the value can be found, rather use the array_keys function, but this time with the optional search parameter.

In practice:

$array = array("blue", "red", "green", "blue", "blue");
print_r(array_keys($array, "blue"));
/*
returns:
Array
(
    [0] => 0
    [1] => 3
    [2] => 4
)
*/

Useful.

Ubuntu: How to Search for a Folder via the Terminal CodeUnit 11 JAN 2011

Often you know that there exists a specific directory on your system, but you just can’t seem to locate it anywhere. Enter the useful find statement, a generic workhorse that you will most certainly find on almost all *nix distributions!

To locate a specific directory by name, simply run:

sudo find / -name directoryname -type d

This will print out the list of matching directory paths that can be located on the system. Note that the sudo isn’t strictly necessary, but helps if you suspect the folder to be lurking in one of the system protected directories!

Nifty.

FileCrop: RapidShare and MegaUpload Search Engine CodeUnit 17 MAY 2010

I’ve mentioned the great MegaDownload.net RapidShare and MegaUpload search engine on this site before, but now a new site has caught my fancy, namely FileCrop.

Like I mention above, at the heart of it all, FileCrop is simply a search engine in the sense that it collects links to uploaded files hosted on RapidShare and MegaUpload, two of the Internet’s biggest providers of public accessible file drop sites. This of course opens up a wealth of download possibilities, be it downloads for those hard to find anime episodes you are looking for, or perhaps an desktop application you no longer can locate an official download point for.

FileCrop is quick, features a growing database of about 22 million links, is simple to use and doesn’t seem to feature any adverts or spam content. It gives a good amount of detail about the files retrieved based on your search criteria, and goes that extra step in allowing you to dictate in part where it searches and in what size range the results should be.

Slick, works well and a great little tool to find those gems you like holding on to as entertainment on those frequent little tea breaks of yours.

Related Link: http://www.filecrop.com/