Questions

How can I save username and password in Git?

I want to use a push and pull automatically in [Git Extensions](http://gitextensions.github.io/), [Sourcetree](https://en.wikipedia.org/wiki/Atlassian#Acquisitions_and_product_announcements) or any ot...

How can I determine if a variable is 'undefined' or 'null'?

How do I determine if variable is `undefined` or `null`? My code is as follows: ``` var EmpName = $("div#esd-names div#name").attr('class'); if(EmpName == 'undefined'){ // DO SOMETHING }; ``` ``...

Chmod 777 to a folder and all contents

I have a web directory `/www` and a folder in that directory called `store`. Within `store` are several files and folders. I want to give the folder `store` and all files and folders within the `stor...

ValueError: invalid literal for int() with base 10: ''

I got this error from my code: ``` ValueError: invalid literal for int() with base 10: ''. ``` What does it mean? Why does it occur, and how can I fix it?

14 Jan at 03:0

How to insert an item into an array at a specific index (JavaScript)

I am looking for a JavaScript array insert method, in the style of: ``` arr.insert(index, item) ``` Preferably in jQuery, but any JavaScript implementation will do at this point.

7 Mar at 12:49

Compare two dates with JavaScript

Can someone suggest a way to compare the values of greater than, less than, and not in the past using JavaScript? The values will be coming from text boxes.

27 Feb at 19:37

How do I split a string on a delimiter in Bash?

I have this string stored in a variable: ``` IN="bla@some.com;john@home.com" ``` Now I would like to split the strings by `;` delimiter so that I have: ``` ADDR1="bla@some.com" ADDR2="john@home.co...

22 Oct at 21:20

How to copy files

How do I copy a file in Python?

Inserting multiple rows in a single SQL query?

I have multiple set of data to insert at once, say 4 rows. My table has three columns: `Person`, `Id` and `Office`. ``` INSERT INTO MyTable VALUES ("John", 123, "Lloyds Office"); INSERT INTO MyTable ...

17 Oct at 13:25

Insert into ... values ( SELECT ... FROM ... )

I am trying to `INSERT INTO` a table using the input from another table. Although this is entirely feasible for many database engines, I always seem to struggle to remember the correct syntax for the ...

How do I efficiently iterate over each entry in a Java Map?

If I have an object implementing the `Map` interface in Java and I wish to iterate over every pair contained within it, what is the most efficient way of going through the map? Will the ordering of ...

What does the "yield" keyword do in Python?

What is the use of the `yield` keyword in Python? What does it do? For example, I'm trying to understand this code: ``` def _get_child_candidates(self, distance, min_dist, max_dist): if self._left...

15 Feb at 20:38

How can I convert a string to boolean in JavaScript?

Can I convert a string representing a boolean value (e.g., 'true', 'false') into a intrinsic type in JavaScript? I have a hidden form in HTML that is updated based upon a user's selection within a li...

What is the best comment in source code you have ever encountered?

What is the best comment in source code you have ever encountered?

18 Sep at 01:54

How do I squash my last N commits together?

How do I squash my last N commits together into one commit?

8 Jul at 04:55

Set select option 'selected', by value

I have a `select` field with some options in it. Now I need to select one of those `options` with jQuery. But how can I do that when I only know the `value` of the `option` that must be selected? I ha...

18 Sep at 15:40

How to align a <div> to the middle (horizontally/width) of the page

I have a `div` tag with `width` set to . When the browser width is greater than , it shouldn't stretch the `div`, but it should bring it to the middle of the page.

24 Mar at 10:51

How do I create a file and write to it?

What's the simplest way to [create and write to a (text) file in Java](https://docs.oracle.com/javase/tutorial/essential/io/file.html)?

27 Jan at 11:20

Echo newline in Bash prints literal \n

How do I print a newline? This merely prints `\n`: ``` $ echo -e "Hello,\nWorld!" Hello,\nWorld! ```

31 May at 03:51

No 'Access-Control-Allow-Origin' header is present on the requested resource—when trying to get data from a REST API

I'm trying to fetch some data from the REST API of HP Alm. It works pretty well with a small curl script—I get my data. Now doing that with JavaScript, fetch and ES6 (more or less) seems to be a bigge...

14 Aug at 12:48

How do I determine the size of my array in C?

How do I determine the size of my array in C? That is, the number of elements the array can hold?

20 Jan at 16:31

How do I check if an element is hidden in jQuery?

How do I toggle the visibility of an element using `.hide()`, `.show()`, or `.toggle()`? How do I test if an element is `visible` or `hidden`?

5 Jul at 07:29

How do I check if a directory exists or not in a Bash shell script?

What command checks if a directory exists or not within a Bash shell script?

27 Jan at 23:14

OR is not supported with CASE Statement in SQL Server

The `OR` operator in the `WHEN` clause of a `CASE` statement is not supported. How can I do this? ``` CASE ebv.db_no WHEN 22978 OR 23218 OR 23219 THEN 'WECS 9500' ELSE 'WECS 9520' END as w...

13 Sep at 13:26

How to concatenate text from multiple rows into a single text string in SQL Server

Consider a database table holding names, with three rows: ``` Peter Paul Mary ``` Is there an easy way to turn this into a single string of `Peter, Paul, Mary`?