How do I tar a directory of files and folders without including the directory itself?
I typically do: ``` tar -czvf my_directory.tar.gz my_directory ``` What if I just want to include everything (including any hidden system files) in my_directory, but not the directory itself? I don...
How does one parse XML files?
Is there a simple method of parsing XML files in C#? If so, what?
Difference between Math.Floor() and Math.Truncate()
What is the difference between [Math.Floor()](http://msdn.microsoft.com/en-us/library/9a6a2sxy.aspx) and [Math.Truncate()](http://msdn.microsoft.com/en-us/library/system.math.truncate.aspx) in .NET?
How can I check out a GitHub pull request with git?
I'd like to check out a previously created pull request (created via GitHub web interface). I searched and found different places where a refs/pull or refs/pull/pr But when I add `fetch = +refs/pull/...
- Modified
- 7 Oct at 10:54
How to Git stash pop specific stash in 1.8.3?
I just upgraded Git. I'm on Git version 1.8.3. This morning I tried to unstash a change 1 deep in the stack. I ran `git stash pop stash@{1}` and got this error. > fatal: ambiguous argument 'stash@1...
Using Enum values as String literals
What is the best way to use the values stored in an Enum as String literals? For example: ``` public enum Modes { some-really-long-string, mode1, mode2, mode3 } ``` Then later I cou...
How can I preview a merge in git?
I have a git branch (the mainline, for example) and I want to merge in another development branch. Or do I? In order to decide whether I really want to merge this branch in, i'd like to see some sort...
JavaScript: location.href to open in new window/tab?
I have a JavaScript file from a third party developer. It has a has link which replaces the current page with the target. I want to have this page opened in a new tab. This is what I have so far: ``...
- Modified
- 4 Sep at 15:11
Ruby: Can I write multi-line string with no concatenation?
Is there a way to make this look a little better? ``` conn.exec 'select attr1, attr2, attr3, attr4, attr5, attr6, attr7 ' + 'from table1, table2, table3, etc, etc, etc, etc, etc, ' + ...
- Modified
- 13 Feb at 09:18
Replace a newline in TSQL
I would like to replace (or remove) a newline character in a TSQL-string. Any Ideas? The obvious ``` REPLACE(@string, CHAR(13), '') ``` just won't do it...
Transferring files over SSH
I'm SSHing into a remote server on the command line, and trying to copy a directory onto my local machine with the `scp` command. However, the remote server returns this "usage" message: ``` [Stewart...
Setting a backgroundImage With React Inline Styles
I'm trying to access a static image to use within an inline `backgroundImage` property within React. Unfortunately, I've run up dry on how to do this. Generally, I thought you just did as follows: ```...
- Modified
- 10 Aug at 20:45
Pods stuck in Terminating status
I tried to delete a `ReplicationController` with 12 pods and I could see that some of the pods are stuck in `Terminating` status. My Kubernetes cluster consists of one control plane node and three w...
- Modified
- 14 Feb at 23:8
Android Studio doesn't see device
The AVD Manager in Android Studio doesn't show my device but `adb devices` does show it. Am I missing something obvious here?
- Modified
- 21 Aug at 10:13
Automatically creating directories with file output
Say I want to make a file: ``` filename = "/foo/bar/baz.txt" with open(filename, "w") as f: f.write("FOOBAR") ``` This gives an `IOError`, since `/foo/bar` does not exist. What is the most pytho...
Regular expression search replace in Sublime Text 2
I'm looking to do search replace with regular expressions in Sublime Text 2. The [documentation on this](http://docs.sublimetext.info/en/latest/search_and_replace/search_and_replace_overview.html#regu...
- Modified
- 25 May at 15:33
What do the python file extensions, .pyc .pyd .pyo stand for?
What do these python file extensions mean? - `.pyc`- `.pyd`- `.pyo` What are the differences between them and how are they generated from a *.py file?
Percentage width in a RelativeLayout
I am working on a form layout for a Login `Activity` in my Android App. The image below is how I want it to look like: ![enter image description here](https://i.stack.imgur.com/5mrcx.png) I was able...
- Modified
- 12 Sep at 17:3
What is the point of the diamond operator (<>) in Java?
The diamond operator in java 7 allows code like the following: ``` List<String> list = new LinkedList<>(); ``` However in Java 5/6, I can simply write: ``` List<String> list = new LinkedList(); ``...
- Modified
- 15 Jul at 00:3
#if DEBUG vs. Conditional("DEBUG")
Which is better to use, and why, on a large project: ``` #if DEBUG public void SetPrivateValue(int value) { ... } #endif ``` or ``` [System.Diagnostics.Conditional("DEBUG")] public void Se...
- Modified
- 28 Dec at 10:28
What is the reason for having '//' in Python?
I saw this in someone's code: ``` y = img_index // num_images ``` where `img_index` is a running index and `num_images` is 3. When I mess around with `//` in [IPython](https://en.wikipedia.org/wiki/I...
Is there a conditional ternary operator in VB.NET?
In Perl (and other languages) a conditional ternary operator can be expressed like this: ``` my $foo = $bar == $buz ? $cat : $dog; ``` Is there a similar operator in VB.NET?
- Modified
- 28 Mar at 13:40
Git reset single file in feature branch to be the same as in master
I'm trying to revert my changes in a in my feature branch and I want this file to be the same as in master. I tried: ``` git checkout -- filename git checkout filename git checkout HEAD -- filenam...
- Modified
- 22 Jun at 15:43
What is the difference between using a Makefile and CMake to compile the code?
I code in C/C++ and use a (GNU) Makefile to compile the code. I can do the same with CMake and get a Makefile. However, what is the difference between using a Makefile and CMake to compile the code?