Is a lock required with a lazy initialization on a deeply immutable type?

If I have a deeply immutable type (all members are readonly and if they are reference type members, then they also refer to objects that are deeply immutable). I would like to implement a lazy...

What is the right tool to detect VMT or heap corruption in Delphi?

I'm a member in a team that use Delphi 2007 for a larger application and we suspect heap corruption because sometimes there are strange bugs that have no other explanation. I believe that the...

Shallow copy of mpz_t

GMP provides methods for initializing and assigning an mpz_t. A call to mpz_init_set(a, b) will assign to a the content of b. However, I assume, this performs a deep copy on b. On my project I...

Parsing a string to Integers and storing them in an array

I'm a bit stumped on how to go about doing this right. I got some ways into it and now I'm waist deep. So what I want to do is parse a text file with a bunch of number two on each line like...

Recursive/deep extend/assign in Underscore.js?

Is there any way to get Underscore.js extend function: Copy all of the properties in the source objects over to the destination object, and return the destination object. It's in-order, so the...

How to work with nested data structures in Elixir

I'm trying to work with the Google Maps geocoding API in Elixir though I'm a bit new to the language so working with nested data structures is eluding me. I'm using HTTPotion to fetch the JSON...

Deep copying a Func within an object in C#

I am building a list of unit tests, which are organised as a list of objects, each of which contain the test method to be executed as a Func. Each object has a variable which is within scope of...

NPM install for packages not working

T hanks in advance for any help I can get. I am trying to install packages like grunt, bower, and yeoman using nodejs and the NPM in my mac OSX 10.8's terminal. I check node and NPM's versions to...

How can I query a temporary PS-Drive while returning files with a name relative to the drive?

I am trying to create a script where I will be searching the file servers for non inherited permissions. I have run into the 260 character limit for file names as a result. A suggestion I saw,...

AngularJS : copy vs extend

Explanation : we come across some situation in which we need to copy one object to another object. In that case, we probably have two solutions: angular.copy() or angular.extend(). Challenge i am...

ASP.net Core RC2 Web API POST - When to use Create, CreatedAtAction, vs. CreatedAtRoute?

What are the fundamental differences of those functions? All I know is all three result in a 201, which is appropriate for a successful POST request. I only follow examples I see online, but they...

How are x86 uops scheduled, exactly?

Modern x86 CPUs break down the incoming instruction stream into micro-operations (uops1) and then schedule these uops out-of-order as their inputs become ready. While the basic idea is clear, I'd...

How does the "creation phase" know how much memory space to set up?

In JavaScript: Understanding the Weird Parts the instructor explains that memory for variables is set up during a so-called creation phase (and that undefined is assigned); then the execution...

Why should the training label for Generator in GAN be always True?

I am currently learning deep learning especially GAN. I found a simple code of GAN from a web site...

What does dot notation for classes, properties and methods mean?

I'm a relative newbie to programming, except having used basic capabilities of Matlab for several years (manipulating arrays, linear algebra, functions, scripts, etc.) and am very recently...

Define instance key (index number) for Cloud machine learning prediction

I followed the 'Getting Started' tutorial for Cloud Machine Learning Engine and deployed it. I can pass an input file containing JSON instances to Batch Prediction service and it returns a file...

How to assign to deeply nested Hash without using many 'nil' guards

I have a nested hash, to which I need to add more deeply nested property/value pairs. Sample A: a = {} a['x']['y']['z'] << 8 Normally I'd have to do this: Sample B: a = {} a['x'] ||=...

Angular interpolated value not updating on subscription

Angular 6.0.1 ngRx 6.0.1 I have an interpolated value set up in my View: {{firstName}} It is not updating when the value of the field it is bound to changes. The value is changing though - if I...

Security difference between textarea and input HTML elements?

I'm new to HTML frontend and general coding. I am wondering if there's any security differences between the input and textarea elements. From what i understand so far: The input element can...

node-pre-gyp install --fallback-to-build --library=static_library

Trying to set up Angular App on existing project. On npm install under project dir, getting dependency error. I git cloned existing angular project and setting up my dev environment. FYI I am...

Keycloak authorization services don't deny scopes in resource

I am testing Keycloak authorization services in the admin console and I'm unable to understand why in the next example keycloak is authorizing a user (tested in the evaluate tab). this is my setup...

Is it safe to use a useState "setter" function as a callback ref?

Is it safe to use the setter function of a useState hook as a callback ref function? Will this cause trouble with Suspense or other upcoming React changes? If "yes, this is OK", that's cool! If...

How to combine two yolov3 models for object detection?

We have two yolov3-tiny models for license plate detection.The first yolov3-tiny model detecting licence plate on cars and cropping it for the second yolov3-tiny model, then should send these...

React native create new app issue - npm exited with non-zero code: 1

expo init test111 ? Choose a template: expo-template-tabs Using npm to install packages. You can pass --yarn to use Yarn instead. Extracting project files... Customizing project... Unable to...

How to use 'sample_weight' in keras

I want to implement Deep RL policy gradient. For that it is required to specify how much weight each sample in a batch should have in computing the total loss. My problem is I could not assign...

How to Assign User Permission Via CheckboxList Using MERN

I'm attempting to grant user permission via MERN using a checkbox list; I've already attempted to grant manual user access by using an if and else statement to grant fixed authorization. Here's an...

Is it UB to return a pointer to local variable?

Yes, I know perfectly well you should not do that. If we have this code: int *foo() { int a = 42; return &a; } As most C coders know, this is undefined behavior:...

Unable to resolve dependency tree - React Native Expo

I have been starting my story with React Native (Expo). Someday I needed to install datetimepicker. Unfortunately, I have done something wrong. I tried to face the problem by myself. I removed the...

How to solve UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte

I'm trying to use Black to format my Django code. It works fine in most directories. However, I get the Unicode decode error UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0:...

Dictation (Speech Recognition) text does not match a string in Swift

I have developed a speech recognition function that can detect Arabic audio and return a string, I assign it to a var called speechRecogText. Within the code I also have a text field which I store...