object Questions

3

Solved

I want to create a javascript object from a template. The problem is I don't know what the template is going to look like beforehand. As a simple example, if I had the template function template =...
Gavrila asked 21/4, 2014 at 9:15

4

Solved

I'm currently building an analysis application that handles large amounts of data. A typical case would looks like this: the user selects a folder with about 600 measurement files that each contain...
Ruffle asked 14/5, 2014 at 10:10

9

Solved

In ES6, we can do: const key = "foo" const myObj = { key } myObj // => { foo: "foo" } So, { key } is equivalent with { key: key }. But, how can we create the same object without having the k...
Kalasky asked 22/8, 2017 at 14:2

4

Solved

This is probably a stupid question but its got me stumped coming from a Ruby background. I have an object that looks like this when I try to print it. print celery.AsyncResult.task_id >>&gt...
Eccentricity asked 18/9, 2013 at 12:55

6

my problem is about i have a file that contain class and inside this class there is bunch of code will be executed so whenever i import that file it will executed ! without creating an object of ...
Astyanax asked 17/8, 2012 at 17:10

5

Solved

I've spent some time looking for some alternative to handle generic objects, I've seen questions similar to mine, but not as specific I suppose? Protocol buffers has multiple scalar types that I ca...
Subsoil asked 6/9, 2012 at 17:27

4

Solved

In a Unit Test (in Visual Studio 2008) I want to compare the content of a large object (a list of custom types, to be precise) with a stored reference of this object. The goal is to make sure, that...
Canton asked 13/8, 2010 at 10:0

7

Solved

I have a json object as shown below. where i want to delete the "otherIndustry" entry and its value by using below code which doesn't worked. var updatedjsonobj = delete myjsonobj['otherIndustry']...
We asked 6/10, 2017 at 6:25

9

Solved

I need to find the fastest way to remove all $meta properties and their values from an object, for example: { "part_one": { "name": "My Name", "something"...
Confessional asked 30/7, 2015 at 16:14

7

Further in my code, I check to see check if an object is null/empty. Is there a way to set an object to null?
Chandigarh asked 13/6, 2010 at 2:12

7

Solved

I'm trying to use bash scripting to make an script act like a phone book, so i tried to create classes and objects but unfortunately i couldn't find a way to do that ! so i'm asking how to create a...
Ahrens asked 21/4, 2016 at 13:27

10

Solved

Is it possible to merge the props of two generic object types? I have a function similar to this: function foo<A extends object, B extends object>(a: A, b: B) { return Object.assign({}, a, ...
Mississippian asked 5/4, 2018 at 22:37

4

Solved

I have been searching for a way to save the references of variables of various types into a dictionary, together with a corresponding key. Then i would like to modify the instance of the variable b...
Macarthur asked 20/6, 2014 at 13:57

3

Solved

So I have the following class... class Pet { public: Pet() : id(0), name("New Pet") { } Pet(const int new_id, const std::string new_name) : id(new_id), name(new_name) { } Pet(const P...
Rosenstein asked 12/5, 2015 at 23:37

6

Solved

type Foo = { [key: number]: string } const foo: Foo = { 100: 'foo', 200: 'bar' } const sizes: number[] = Object.keys(foo) Gives me: Type 'string[]' is not assignable to type 'number[] Why d...
Botch asked 28/6, 2019 at 9:13

5

Solved

Let's say I have an object - a User object in this case - and I'd like to be able to track changes to with a separate class. The User object should not have to change it's behavior in any way for t...
Loosetongued asked 26/3, 2012 at 5:14

4

Solved

I just noticed that an interface cannot be assigned to Record<string, unknown> (playground link): interface Foo { foo: number } const foo: Foo = { foo: 1 } const bar: Record<string, unkn...
Transformation asked 19/1, 2021 at 20:48

2

Solved

I have a key-value database table, where I store some settings. I would like to have these settings in a PHP constant object, since they shouldn't be editable. In PHP7 we can now do this: define...
Rimbaud asked 22/9, 2016 at 14:5

8

Solved

Is it possible to access an object's key inside the name portion of a .each? let accounts = [ { details: { company_name: "company_name", email, password: "asdf", }, find: [ "_id", "c...
Infinite asked 28/6, 2019 at 1:49

4

Solved

I would like to implement deep pick in typescript. My example code is: interface TestBook { id: string; name: string; } interface TestUser { id: string; email: string; books: TestBook[]; } I ...
Pshaw asked 10/11, 2022 at 14:5

2

What is the memory footprint of an empty object in JavaScript? If object is created using object literal syntax: let emptyObj = {}; in Google Chrome Developer Tools (Profiles tab), after taking ...
Meteoritics asked 8/10, 2016 at 12:10

3

Solved

So here is my JSON column in my Postgres DB: { "objekt_art": { "86": { "code": "86", "bezeichnung_de": "Kino", "bezeichnung_fr&...
Taggart asked 3/11, 2021 at 6:44

8

Solved

I have an object of class Foo: class Foo extends Bar { protected $a; protected $b; } $obj = new Foo(); What I want (and have) to do is cast this object to an array, like this: $arr = (array)...
Airbrush asked 20/6, 2012 at 14:16

8

Solved

So I have been searching for a while and cannot find the answer to a simple question. Is it possible to have an array of objects in PHP? Such as: $ar=array(); $ar[]=$Obj1 $ar[]=$obj2 For...
Analysis asked 23/12, 2011 at 4:17

5

I was going through an introduction to Smalltalk. In C++, the functions declared inside a class can be called by objects of that class, and similarly in Smalltalk a keyword, termed as message, is w...
Interne asked 28/2, 2017 at 0:45

© 2022 - 2024 — McMap. All rights reserved.