Replace values of a numpy index array with values of a list

Replace values of a numpy index array with values of a list

Suppose you have a numpy array and a list:>>> a = np.array([1,2,2,1]).reshape(2,2)>>> aarray([[1, 2], [2, 1]])>>> b = [0, 10]I'd like to replace values in an array, so that 1 is replaced by 0, and 2 by 10.I found a similar problem her

What is the Label property under the identity inspector in Xcode 4?

What is the Label property under the identity inspector in Xcode 4?

The place holder text for the Label property is 'Xcode Specific Label', which when googled turns up nothing.I assumed it used for identifying the UI element in your code by it's 'Xcode Specific Label' and not the actual text that the button

Cleaning out test database before running tests

Cleaning out test database before running tests

What is the best way to clean out a database before running a test suite (is there a npm library or recommended method of doing this).I know about the before() function.I'm using node/express, mocha and sequelize. 1:The before function i

Any way to use some Scala for iOS coding?

Any way to use some Scala for iOS coding?

I want to be able to use Scala to code iOS programs. Any tools available for this ? 1:Well, now you can use RoboVM - a Java library for native IOS developmentSee also:an SBT plugin for RoboVM https://github.com/roboscala/sbt-robovmA blog

Java HttpURLConnection

Java HttpURLConnection

What is the function or purpose of HttpURLConnection.setDoInput or HttpURLConnection.setDoOutput? 1:From the documentation for URLConnection: Set the DoInput flag to true if you intend to use the URL connection for input, false if not.

Regex- Space or no space

Regex- Space or no space

Part of my regex is : /. Within the (" "|""), I am trying to say match with either space or no space, but I can't get anything out of it. Ive also tried ("\s"|"") with no results. 1:"space or no space" is the same as "zero or one space",

How to determine whether a character is a letter in Java?

How to determine whether a character is a letter in Java?

How do you check if a one-character String is a letter - including any letters with accents?I had to work this out recently, so I'll answer it myself, after the recent VB6 question reminded me. 1:Character.isLetter() is much faster than

Testflight: Cannot upload build, cannot download SDK

Testflight: Cannot upload build, cannot download SDK

I'm having difficulties with TestFlight today. I've tried to upload ipa for the new app but getting this error: Sorry, we are no longer accepting any new builds that use the TestFlight SDK. Please remove the SDK and re-upload. Learn More.L

No context type was found in the assembly

No context type was found in the assembly

I'm using .NET 4.0, MVC3, and EF5 with code first.My solution is split up into three projects, with the dependencies as indicated:Project.Web -> Project.BLL -> Project.DALThe Project.DAL layer contains my entity framework data context class

XCTAssertEqual error: (“3”) is not equal to (“3”)

XCTAssertEqual error: (“3”) is not equal to (“3”)

NSMutableArray *arr = [NSMutableArray array];[arr addObject:@"1"];[arr addObject:@"2"];[arr addObject:@"3"];// This statement is fine.XCTAssertTrue(arr.count == 3, @"Wrong array size.");// This assertion fails with an error: ((arr.count) eq

WPF how to show an Image.Source (BitmapSource) pixel position?

WPF how to show an Image.Source (BitmapSource) pixel position?

Let's suppose I've got an image which shows its source in a scaled way, how could i use aMouseMove event to show in a label or textblock the pixel position in which the cursor is?(I need the pixel coordinates not the coordinates of the imag

Determine physical mem size programmatically on OSX

Determine physical mem size programmatically on OSX

We're trying to find out how much physical memory is installed in a machine running Mac OS X. We've found the BSD function sysctl(). The problem is this function wants to return a 32 bit value but some Macs are able to address up to 32 GB w

Is it possible to use AWS Beanstalk's .ebextensions config to install mod_pagespeed Apache modu

Is it possible to use AWS Beanstalk's .ebextensions config to install mod_pagespeed Apache modu

I'm using AWS Beanstalk for my Django/Python application, and I would like to use Google's mod_pagespeed module. Is it possible to install and run mod_pagespeed using the .ebextensions/.config file? 1:Download the package Add the rpm int

Any research on maintainability of “guard statement” vs. “single function exit point” paradigm avail

Any research on maintainability of “guard statement” vs. “single function exit point” paradigm avail

I'm wondering if there has been any research (both casual and robust) on the maintainability of projects that use the "guard statement" paradigm vs. the "single function exit point" paradigm?Guard statement example (in C#):string GetSomeSt

C++ polymorphism and default argument

C++ polymorphism and default argument

I have these classes:class Base{ public: virtual void foo(int x = 0) { printf("X = %d", x); }};class Derived : public Base{ public: virtual void foo(int x = 1) { printf("X = %d"

If statement weirdness in Visual Studio 2008

If statement weirdness in Visual Studio 2008

I've come across a problem so strange, that I've recorded my session because I didn't think anyone would belive me.I came across a bug that seems to be at very fundamental level. This is a single threaded application and all im doing is eva

How to set runtime PATH for CMake custom command on Windows

How to set runtime PATH for CMake custom command on Windows

I'm trying to port a *nix, CMake-based project to Windows. One header file needed by the main library is generated by a custom program, so the CMakeLists.txt file contains something like this:add_executable(TableGenerator "TableGenerator.cp

Webforms and jQuery, how to match the ID's?

Webforms and jQuery, how to match the ID's?

I want to use jQuery with asp.net webfoms. Do I need to get a special toolkit so the .net controls spit out friendly Control ID's?Reason being, I don't want to write javascript referencing my html ID's like control_123_asdfcontrol_234.Has

How do I validate an Australian Medicare number?

How do I validate an Australian Medicare number?

I'm developing an online form in which user-entered Medicare numbers will need to be validated.(My specific problem concerns Australian Medicare numbers, but I'm happy for answers regarding American ones too. This question is about Medicare

getLastKnownLocation returning NULL

getLastKnownLocation returning NULL

I had just got this to work but when I turned off my Wifi to see if I could get a more accurate location using my GPS it's now bringing me a NullPointer error and I can't see why.The below code gets called first; public void onConnected(Bun

Getting My LAN ip address (192.168.xxxx) (IPV4)

Getting My LAN ip address (192.168.xxxx) (IPV4)

In my android device I am trying to find its IP address(IPV4). If I do the following codeInetAddress inet = InetAddress.getLocalHost();System.out.println(inet.getHostAddress()); //giving me 127.0.0.1The code is giving me 127.0.0.1.I wanted

UNIX newbie: shell script not running, command not found

UNIX newbie: shell script not running, command not found

I am very, very new to UNIX programming (running on MacOSX Mountain Lion via Terminal). I've been learning the basics from a bioinformatics and molecular methods course (we've had two classes) where we will eventually be using perl and pyth

unpack the first two elements in list/tuple

unpack the first two elements in list/tuple

Is there a way in python to do like this:a, b, = 1, 3, 4, 5And then:>>> a1>>> b3(The above code doesn't work as it will throw ValueError: too many values to unpack.) 1:Just to add to Nolen's answer, in Python 3, you can also unpack the r

Operator[] C++ Get/Set

Operator[] C++ Get/Set

I'm having trouble with telling the difference between get and set for the operator[]. I need to tell the difference between these function calls.cout I googled it, and the answers I found still didn't help. People suggested making the sign

How can I document a type in webstorm using just jsdoc?

How can I document a type in webstorm using just jsdoc?

When I write the following code, the annotator tells me that BrowserSelector is not defined in the second typedef:/** * @typedef {{name: String, minVer: Number, maxVer: Number}} BrowserSelector *//** * @typedef {{type:String, browser: Brows