Questions

Map and filter an array at the same time

I have an array of objects that I want to iterate over to produce a new filtered array. But also, I need to filter out some of the objects from the new array depending of a parameter. I'm trying this:...

20 Mar at 09:37

How to enable CORS in ASP.NET Core

I am trying to enable cross origin resources sharing on my ASP.NET Core Web API, but I am stuck. The `EnableCors` attribute accepts `policyName` of type `string` as parameter: ``` // Summary: // C...

2 Apr at 07:55

What is Hash and Range Primary Key?

I am not able to understand what Range / primary key is here in the docs on [Working with Tables and Data in DynamoDB](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithTable...

How do I install Python OpenCV through Conda?

I'm trying to install OpenCV for Python through [Anaconda](https://en.wikipedia.org/wiki/Anaconda_(Python_distribution)), but I can't seem to figure this out. I tried ``` conda install opencv conda ...

19 Nov at 17:44

Pandas: Setting no. of max rows

I have a problem viewing the following `DataFrame`: ``` n = 100 foo = DataFrame(index=range(n)) foo['floats'] = np.random.randn(n) foo ``` The problem is that it does not print all rows per defaul...

How to detect iPhone 5 (widescreen devices)?

I've just upgraded to Xcode 4.5 GM and found out that you can now apply the '4" Retina' size to your view controller in the storyboard. Now if I want to create an application that runs on both iPhone ...

13 Apr at 20:19

Modify tick label text

I want to make some modifications to a few selected tick labels in a plot. For example, if I do: ``` label = axes.yaxis.get_major_ticks()[2].label label.set_fontsize(size) label.set_rotation('vertical...

8 Oct at 19:6

Add padding on view programmatically

I am developing Android v2.2 app. I have a `Fragment`. In the `onCreateView(...)` callback of my fragment class, I inflate an layout to the fragment like below: ``` @Override public View onCreateView(...

How can I split a string with a string delimiter?

I have this string: ``` "My name is Marco and I'm from Italy" ``` I'd like to split it, with the delimiter being `is Marco and`, so I should get an array with - `My name`- `I'm from Italy` How can I ...

5 Aug at 06:54

How to center an iframe horizontally?

Consider the following example: ([live demo](http://jsfiddle.net/wYNSu/)) HTML: ``` <div>div</div> <iframe></iframe> ``` CSS: ``` div, iframe { width: 100px; height: 50px; margin: 0 a...

Guid is all 0's (zeros)?

I'm testing out some WCF services that send objects with Guids back and forth. In my web app test code, I'm doing the following: ``` var responseObject = proxy.CallService(new RequestObject { Dat...

2 Nov at 19:28

MongoDB: Combine data from multiple collections into one..how?

How can I (in MongoDB) combine data from multiple collections into one collection? Can I use map-reduce and if so then how? I would greatly appreciate some example as I am a novice.

Animate the transition between fragments

I'm trying to animate the transition between fragments. I got the answer from the following [Android Fragments and animation](https://stackoverflow.com/questions/4817900/android-fragments-and-animatio...

23 May at 12:2

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

I am getting the following error when I try to connect to mysql: `Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)` Is there a solution for this error? What might ...

12 May at 06:3

Get Month name from month number

> [How to get the MonthName in c#?](https://stackoverflow.com/questions/975531/how-to-get-the-monthname-in-c) I used the following c# syntax to get month name from month no but i get `August` ...

23 May at 12:34

How does C compute sin() and other math functions?

I've been poring through .NET disassemblies and the GCC source code, but can't seem to find anywhere the actual implementation of `sin()` and other math functions... they always seem to be referencing...

17 Mar at 21:21

How do I use Assert.Throws to assert the type of the exception?

How do I use `Assert.Throws` to assert the type of the exception and the actual message wording? Something like this: ``` Assert.Throws<Exception>( ()=>user.MakeUserActive()).WithMessage("Actual e...

28 Jul at 19:46

Displaying the build date

I currently have an app displaying the build number in its title window. That's well and good except it means nothing to most of the users, who want to know if they have the latest build - they tend ...

8 Jun at 10:38

How to migrate GIT repository from one server to a new one

I have a server that I'm taking down. The only thing I have left to migrate is my repository. This server is listed as the origin (master) for one of my projects. What is the proper way to move the...

27 Sep at 22:26

Javascript replace with reference to matched group?

I have a string, such as `hello _there_`. I'd like to replace the two underscores with `<div>` and `</div>` respectively, using . The output would (therefore) look like `hello <div>there</div>`. The s...

3 Aug at 04:0

Python's most efficient way to choose longest string in list?

I have a list of variable length and am trying to find a way to test if the list item currently being evaluated is the longest string contained in the list. And I am using Python 2.6.1 For example: ...

5 Dec at 14:13

go to character in vim

I'm getting an error message from a python script `at position 21490`. How can I go to this position in Vim?

20 Apr at 10:10

How to correctly use the extern keyword in C

My question is about when a function should be referenced with the `extern` keyword in C. I am failing to see when this should be used in practice. As I am writing a program all of the functions that...

21 May at 09:47

Find a value anywhere in a database

Given a number, how do I discover in what table and column it could be found within? I don't care if it's fast, it just needs to work.

26 Apr at 14:25

Change the URL in the browser without loading the new page using JavaScript

How would I have a [JavaScript](http://en.wikipedia.org/wiki/JavaScript) action that may have some effects on the current page but would also change the URL in the browser so if the user hits reload o...