How can I exclude directories from grep -R?

SOLUTION 1 (combine find and grep) The purpose of this solution is not to deal with grep performance but to show a portable solution : should also work with busybox or GNU version older than 2.5. Use find, for excluding directories foo and bar : Then combine find and the non-recursive use of grep, as a portable solution : SOLUTION 2 (using the –exclude-dir option of grep): … Read more

Stash just a single file

I think stash -p is probably the choice you want, but just in case you run into other even more tricky things in the future, remember that: Stash is really just a very simple alternative to the only slightly more complex branch sets. Stash is very useful for moving things around quickly, but you can accomplish more complex things with … Read more

Node Version Manager install – nvm command not found

Check your .bash_profile, .zshrc, or .profile file. You most likely had a problem during the installation. You should have the following at the end of one of those files. The . $HOME/.nvm/nvm.sh is the same as source $HOME/.nvm/nvm.sh See: Sourcing a File You can also check to see if you have a .nvm folder. If you’re missing that folder then the installation failed to run … Read more

is not JSON serializable

It’s worth noting that the QuerySet.values_list() method doesn’t actually return a list, but an object of type django.db.models.query.ValuesListQuerySet, in order to maintain Django’s goal of lazy evaluation, i.e. the DB query required to generate the ‘list’ isn’t actually performed until the object is evaluated. Somewhat irritatingly, though, this object has a custom __repr__ method which makes it look like a … Read more

Are multi-line strings allowed in JSON?

Is it possible to have multi-line strings in JSON? It’s mostly for visual comfort so I suppose I can just turn word wrap on in my editor, but I’m just kinda curious. I’m writing some data files in JSON format and would like to have some really long string values split over multiple lines. Using … Read more

Pinging servers in Python

This function works in any OS (Unix, Linux, macOS, and Windows)Python 2 and Python 3 EDITS:By @radato os.system was replaced by subprocess.call. This avoids shell injection vulnerability in cases where your hostname string might not be validated. Note that, according to @ikrase on Windows this function will still return True if you get a Destination Host Unreachable error. Explanation The command is ping in both Windows and … Read more

Undefined reference to pow( ) in C, despite including math.h [duplicate]

You need to link with the math library: The error you are seeing: error: ld returned 1 exit status is from the linker ld (part of gcc that combines the object files) because it is unable to find where the function pow is defined. Including math.h brings in the declaration of the various functions and not their definition. The def is present in … Read more

Categories C Tags

You need to use a Theme.AppCompat theme (or descendant) with this activity

The reason you are having this problem is because the activity you are trying to apply the dialog theme to is extending ActionBarActivity which requires the AppCompat theme to be applied. Update: Extending AppCompatActivity would also have this problem In this case, change the Java inheritance from ActionBarActivity to Activity and leave the dialog theme in the manifest as it is, a non Theme.AppCompat value The general … Read more