How do I ignore files in a directory in Git?
What is the proper syntax for the `.gitignore` file to ignore files in a directory? Would it be ``` config/databases.yml cache/* log/* data/sql/* lib/filter/base/* lib/form/base/* lib/model/map/* li...
How to find all occurrences of an element in a list
[index()](https://docs.python.org/3/tutorial/datastructures.html) will give the first occurrence of an item in a list. Is there a neat trick which returns all indices in a list for an element?
A quick and easy way to join array elements with a separator (the opposite of split) in Java
See [Related .NET question](https://stackoverflow.com/questions/455438/opposite-of-string-split-with-separators-net) I'm looking for a quick and easy way to do exactly the opposite of split so that ...
How do I create a basic UIButton programmatically?
How can I create a basic `UIButton` programmatically? For example in my view controller, when executing the `viewDidLoad` method, three `UIButton`s will be created dynamically and its layout or proper...
- Modified
- 18 Nov at 06:12
Creating a range of dates in Python
I want to create a list of dates, starting with today, and going back an arbitrary number of days, say, in my example 100 days. Is there a better way to do it than this? ``` import datetime a = date...
IllegalArgumentException or NullPointerException for a null parameter?
I have a simple setter method for a property and `null` is not appropriate for this particular property. I have always been torn in this situation: should I throw an [IllegalArgumentException](http://...
- Modified
- 17 Jan at 12:18
How can I check if a string is null or empty in PowerShell?
Is there a built-in `IsNullOrEmpty`-like function in order to check if a string is null or empty, in PowerShell? I could not find it so far and if there is a built-in way, I do not want to write a fu...
- Modified
- 13 Jul at 14:33
performing HTTP requests with cURL (using PROXY)
I have this proxy address: `125.119.175.48:8909` How can I perform a HTTP request using cURL like `curl http://www.example.com`, but specifying the proxy address of my network?
Create folder with batch but only if it doesn't already exist
Can anybody tell me how to do the following in in a Windows batch script? (`*.bat`): - In more detail, I want to create a folder named `VTS` on the `C:\` drive, but only if that folder doesn't alr...
- Modified
- 22 Jun at 15:14
Dependency Injection vs Factory Pattern
Most of the examples quoted for usage of Dependency Injection, we can solve using the factory pattern as well. Looks like when it comes to usage/design the difference between dependency injection and ...
- Modified
- 13 Sep at 05:36
What is the most efficient/elegant way to parse a flat table into a tree?
Assume you have a flat table that stores an ordered tree hierarchy: ``` Id Name ParentId Order 1 'Node 1' 0 10 2 'Node 1.1' 1 10 3 'Node 2' ...
- Modified
- 23 May at 12:18
Converting a POSTMAN request to Curl
I am calling my java webservice (POST request) via POSTMAN in the following manner which works perfectly fine (i.e. I can see my records getting inserted into the database): [](https://i.stack.imgur.c...
How to use Git for Unity3D source control?
What are best practices for using [Git](http://en.wikipedia.org/wiki/Git_%28software%29) source control with Unity 3D, particularly in dealing with the binary nature of Unity 3D projects? Please descr...
- Modified
- 9 Jun at 21:55
How to compare the performance of Android Apps written in Java and Xamarin C#? Anyway to check quantitative data (code & results)
I came across Xamarin claims that their Mono implementation on Android and their C# compiled apps are faster than Java code. Did anyone perform actual benchmarks on very similar Java and C# code on di...
Superscript in markdown (Github flavored)?
Following this [lead](https://web.archive.org/web/20171125132707/http://blog.jochmann.me:80/post/24465337253/tumblr-markdown-footnote-superscript-css), I tried this in a Github README.md: ``` <span s...
Where to get "UTF-8" string literal in Java?
I'm trying to use a constant instead of a string literal in this piece of code: ``` new InputStreamReader(new FileInputStream(file), "UTF-8") ``` `"UTF-8"` appears in the code rather often, and wou...
- Modified
- 9 Oct at 23:22
Why does the order in which libraries are linked sometimes cause errors in GCC?
Why does the order in which libraries are linked sometimes cause errors in GCC?
How can I get the DateTime for the start of the week?
How do I find the start of the week (both Sunday and Monday) knowing just the current time in C#? Something like: ``` DateTime.Now.StartWeek(Monday); ```
Convert .pem to .crt and .key
Can anyone tell me the correct way/command to extract/convert the certificate `.crt` and private key `.key` files from a `.pem` file? I just read they are interchangable, but not how.
- Modified
- 5 Dec at 21:30
How to return value from an asynchronous callback function?
This question is asked many times in SO. But still I can't get stuff. I want to get some value from callback. Look at the script below for clarification. ``` function foo(address){ // google...
- Modified
- 16 Dec at 13:9
Can "git pull --all" update all my local branches?
I often have at least 3 remote branches: master, staging and production. I have 3 local branches that track those remote branches. Updating all my local branches is tedious: ``` git fetch --all git ...
- Modified
- 15 Jun at 23:39
How to get the last char of a string in PHP?
I need to get the last character of a string. Say I have "testers" as input string and I want the result to be "s". how can I do that in PHP?
Git: See my last commit
I just want to see the files that were committed in the last commit exactly as I saw the list when I did `git commit`. Unfortunately searching for ``` git "last commit" log ``` in Google gets me no...
- Modified
- 9 Feb at 21:29
Finding a branch point with Git?
I have a repository with branches master and A and lots of merge activity between the two. How can I find the commit in my repository when branch A was created based on master? My repository basicall...