Questions

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...

2 Aug at 07:53

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?

6 May at 03:21

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 ...

23 May at 12:18

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...

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...

14 Jun at 18:3

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://...

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...

13 Jul at 14:33

Algorithm to detect overlapping periods

I've to detect if two time periods are overlapping. Every period has a start date and an end date. I need to detect if my first time period (A) is overlapping with another one(B/C). In my case, if th...

22 May at 07:53

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?

22 Aug at 20:27

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...

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 ...

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' ...

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...

2 Feb at 02:13

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...

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...

8 Feb at 05:47

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...

26 Feb at 17:33

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...

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?

26 Jun at 12:31

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); ```

22 Oct at 09:22

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.

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...

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 ...

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?

30 Nov at 02:43

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...

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...

5 Dec at 16:16