Questions

Error "'git' is not recognized as an internal or external command"

I have an installation of Git for Windows, but when I try to use the `git` command in Command Prompt, I get the following error: ``` 'git' is not recognized as an internal or external command, operab...

Convert Array to Object

What is the best way to convert: ``` ['a','b','c'] ``` to: ``` { 0: 'a', 1: 'b', 2: 'c' } ```

10 Mar at 14:18

Regular expression for alphanumeric and underscores

Is there a regular expression which checks if a string contains only upper and lowercase letters, numbers, and underscores?

17 Oct at 19:47

Move the most recent commit(s) to a new branch with Git

How do I move my recent commits on master to a new branch, and reset master to before those commits were made? e.g. From this: ``` master A - B - C - D - E ``` To this: ``` newbranch C - D - E ...

Removing Conda environment

I want to remove a certain environment created with conda. How can I achieve that? Let's say I have an active `testenv` environment. I tried, by following documentation, with: ``` $ conda env remove ...

24 Feb at 18:42

What is the difference between ++i and i++?

In C, what is the difference between using `++i` and `i++`, and which should be used in the incrementation block of a `for` loop?

Download a specific tag with Git

I'm trying to figure out how I can download a particular tag of a Git repository - it's one version behind the current version. I saw there was a tag for the previous version on the git web page, wit...

29 Jan at 19:5

Failed to load the JNI shared Library (JDK)

When I try opening [Eclipse](http://www.eclipse.org/), a pop-up dialog states: > Failed to load the JNI shared library "C:/JDK/bin/client/jvm.dll"`. Following this, Eclipse force closes. Here's a f...

Count the number of occurrences of a character in a string

How do I count the number of occurrences of a character in a string? e.g. `'a'` appears in `'Mary had a little lamb'` 4 times.

9 Apr at 10:3

How to get current time and date in C++?

Is there a cross-platform way to get the current date and time in C++?

16 Jun at 20:35

Counting the number of elements with the values of x in a vector

I have a vector of numbers: ``` numbers <- c(4,23,4,23,5,43,54,56,657,67,67,435, 453,435,324,34,456,56,567,65,34,435) ``` How can I have R count the number of times a value appears in the...

4 Oct at 11:29

What is the correct way to check for string equality in JavaScript?

What is the correct way to check for equality between Strings in JavaScript?

3 Aug at 19:45

Using boolean values in C

C doesn't have any built-in boolean types. What's the best way to use them in C?

18 May at 22:54

How do I check if a variable exists?

I want to check if a variable exists. Now I'm doing something like this: ``` try: myVar except NameError: # Do something. ``` Are there other ways without exceptions?

9 Apr at 09:48

How can I write to the console in PHP?

Is it possible write a string or log into the console? ## What I mean Just like in JSP, if we print something like `system.out.println("some")`, it will be there at the console, not at a page.

3 Aug at 13:3

How do you set a default value for a MySQL Datetime column?

How do you set a default value for a MySQL Datetime column? In SQL Server it's `getdate()`. What is the equivalant for MySQL? I'm using MySQL 5.x if that is a factor.

12 Jul at 19:15

How do I set, clear, and toggle a single bit?

How do I set, clear, and toggle a bit?

Iterate through object properties

``` var obj = { name: "Simon", age: "20", clothing: { style: "simple", hipster: false } } for(var propt in obj){ console.log(propt + ': ' + obj[propt]); } ``` H...

13 Mar at 10:58

Removing whitespace from strings in Java

I have a string like this: ``` mysz = "name=john age=13 year=2001"; ``` I want to remove the whitespaces in the string. I tried `trim()` but this removes only whitespaces before and after the whol...

28 Mar at 07:29

jQuery how to find an element based on a data-attribute value?

I've got the following scenario: ``` var el = 'li'; ``` and there are 5 `<li>`'s on the page each with a `data-slide=number` attribute . I now need to find the currently active slide number which ...

Calculate difference between two dates (number of days)?

I see that this question has been answered for [Java](https://stackoverflow.com/questions/1555262/), [JavaScript](https://stackoverflow.com/questions/1036742/), and [PHP](https://stackoverflow.com/que...

23 May at 12:34

How to POST JSON data with Python Requests?

I need to POST a JSON from a client to a server. I'm using Python 2.7.1 and simplejson. The client is using Requests. The server is CherryPy. I can GET a hard-coded JSON from the server (code not show...

2 Oct at 23:23

How to set environment variables in Python?

I need to set some environment variables in the Python script and I want all the other scripts that are called from Python to see the environment variables' set. If I do, ``` os.environ["DEBUSSY"] = 1...

6 Sep at 13:43

CSS force image resize and keep aspect ratio

I am working with images, and I ran into a problem with aspect ratios. ``` <img src="big_image.jpg" width="900" height="600" alt="" /> ``` As you can see, `height` and `width` are already specified. ...

18 Jul at 18:55