Questions

How do I add an extra column to a NumPy array?

Given the following 2D array: ``` a = np.array([ [1, 2, 3], [2, 3, 4], ]) ``` I want to add a column of zeros along the second axis to get: ``` b = np.array([ [1, 2, 3, 0], [2, 3, 4, ...

30 Jul at 08:33

How to convert a unix timestamp (seconds since epoch) to Ruby DateTime?

How do you convert a Unix timestamp (seconds since epoch) to Ruby DateTime?

3 Jun at 21:7

How to ignore HTML element from tabindex?

Is there any way in HTML to tell the browser not to allow tab indexing on particular elements? On my page though there is a sideshow which is rendered with jQuery, when you tab through that, you get ...

31 Jan at 19:38

How to detect Adblock on my website?

I would like to be able to detect if the user is using adblocking software when they visit my website. If they are using it, I want to display a message asking them to turn it off in order to support ...

9 Aug at 13:47

Toggle Checkboxes on/off

I have the following: ``` $(document).ready(function() { $("#select-all-teammembers").click(function() { $("input[name=recipients\\[\\]]").attr('checked', true); }); ...

What are the differences between numpy arrays and matrices? Which one should I use?

What are the advantages and disadvantages of each? From what I've seen, either one can work as a replacement for the other if need be, so should I bother using both or should I stick to just one of t...

10 Aug at 08:40

Create a GUID in Java

What are some of the best ways to create a GUID in Java?

18 Nov at 17:55

How can I get a random record from MongoDB?

I am looking to get a random record from a huge collection (100 million records). What is the fastest and most efficient way to do so? The data is already there and there are no field in which I can g...

20 Jul at 13:17

The simplest way to resize an UIImage?

In my iPhone app, I take a picture with the camera, then I want to resize it to 290*390 pixels. I was using this method to resize the image : ``` UIImage *newImage = [image _imageScaledToSize:CGSiz...

5 Aug at 20:9

New line in JavaScript alert box

How do you put in a new line into a JavaScript alert box?

3 Dec at 17:21

Core Data: Quickest way to delete all instances of an entity

I'm using Core Data to locally persist results from a Web Services call. The web service returns the full object model for, let's say, "Cars" - could be about 2000 of them (and I can't make the Web Se...

6 Nov at 05:1

Shortest distance between a point and a line segment

I need a basic function to find the shortest distance between a point and a line segment. Feel free to write the solution in any language you want; I can translate it into what I'm using (Javascript)...

Calculate distance between 2 GPS coordinates

How do I calculate distance between two GPS coordinates (using latitude and longitude)?

How can I use async/await at the top level?

I have been going over `async`/`await` and after going over several articles, I decided to test things myself. However, I can't seem to wrap my head around why this does not work: ``` async function m...

How to add a title to each subplot

I have one figure which contains many subplots. ``` fig = plt.figure(num=None, figsize=(26, 12), dpi=80, facecolor='w', edgecolor='k') fig.canvas.set_window_title('Window Title') # Returns the Axes ...

14 Sep at 13:56

What is the difference between ng-if and ng-show/ng-hide

I'm trying to understand the difference between `ng-if` and `ng-show`/`ng-hide`, but they look the same to me. Is there a difference that I should keep in mind choosing to use one or the other?

How to get value of selected radio button?

I want to get the selected value from a group of radio buttons. Here's my HTML: ``` <div id="rates"> <input type="radio" id="r1" name="rate" value="Fixed Rate"> Fixed Rate <input type="radio" id="...

20 Jul at 22:30

How to split a String by space

I need to split my String by spaces. For this I tried: ``` str = "Hello I'm your String"; String[] splited = str.split(" "); ``` But it doesn't seem to work.

17 Sep at 09:58

Cannot read configuration file due to insufficient permissions

I've recently encountered an error trying to host my asp.net site with IIS. I have found a solution that many swear by. > Solution: 1. Add IIS_IUSRS with Read permission on files in the folder 2. Cha...

20 Jun at 09:12

stopPropagation vs. stopImmediatePropagation

What's the difference between `event.stopPropagation()` and `event.stopImmediatePropagation()`?

20 Jul at 21:53

How to show the first commit by 'git log'?

I have a Git project which has a long history. I want to show the first commit. How do I do this?

21 May at 18:2

Tools to selectively Copy HTML+CSS+JS From A Specific Element of DOM

Like most web developers, I occasionally like to look at the source of websites to see how their markup is built. Tools like Firebug and Chrome Developer Tools make it easy to inspect the code, but if...

Find and extract a number from a string

I have a requirement to find and extract a number contained within a string. For example, from these strings: ``` string test = "1 test" string test1 = " 1 test" string test2 = "test 99" ``` How c...

10 Sep at 22:4

What is console.log?

What is the use of `console.log`? Please explain how to use it in JavaScript, with a code example.

23 Jul at 15:55

How to view hierarchical package structure in Eclipse package explorer

OK here's what I would like: in the Eclipse package explorer, I see the following: (dot represents a clickable arrow that I can use to expand the folder) - - - - - - - - Long story short, I want to...