Comment by user2297996 on How to create a type in TypeScript which can be a...
Or we can test if y has a constructor, if it then it's the class. etc.
View ArticleComment by user2297996 on What's the performance impact of consuming...
We would read those configs on every request. Otherwise we couldn't use updates kubernetes provides via autoupdate, since we would only get the initial config.
View ArticleComment by user2297996 on How to populate GTK4 DropDown using a custom struct?
I'm not saying StringListModel is the only supported one, but it's the only one supported automatically. So what I need is a custom "class" which implements the ListModel interface. This seems to...
View ArticleComment by user2297996 on Is it possible to to handle invalid JSON values...
No. I want to convert every type that's not boolean to false.
View ArticleComment by user2297996 on Is it possible to to handle invalid JSON values...
Thanks. This sounds much better than implementing From for each and every struct / enum. But I guess this still means I have to create a bunch of custom deserializers and then attach them to each field...
View ArticleComment by user2297996 on How to create a generic function that supports...
OK I see thc. Just want to know if there is an easy way around this, but apparently there isn't. Anyway thx!
View ArticleComment by user2297996 on How to implement a trait in Rust which modifies a...
@ShadowRanger yes, but I was hoping for a simpler solution :) Anyway thanks, i will look into this answer.
View ArticleComment by user2297996 on How to get all items from a GtkComboBoxText in GTK4...
@JMAA I know it's deprecated but my app supports it. Moreover, setting the active-id doesn't seem to wok. At least, it doesn't work with the string value of the option. And get_active_id() returns None...
View ArticleHow to put a spy to a single function using SinonJS?
I have this:import * as sinon from 'sinon';import {someFunc, someOtherFunc} from 'someModule';describe("Something", () => { let sandbox: sinon.SinonSandbox; beforeEach('setup sandbox', function() {...
View ArticleIstanbuljs with TS reports 0% coverage for certain files only. Why?
So I have this config:.nycrc"extends": "@istanbuljs/nyc-config-typescript","extension": [".ts" ],"exclude": ["**/*.d.ts","**/*.spec.ts" ],"reporter": ["html","lcov","text-summary" ],"lines":...
View ArticleNodeJS EventEmitter: how to wait for all events to finish?
Got a class, it extends EventEmitter.Got function that fires a bunch of events on that emitter. These events trigger async tasks and they all have a done() callback.What's the proper way to wait for...
View ArticleHow to run a single test suite in Jest?
I have many test suites. I wanna to run a singe one and skip all the others, and I would like to do this on the code level.I know I can do this using .only() and .skip() in a test file, but that...
View ArticleHow to resolve Eslint plugin ambiguity?
I have a eslint config which extends some others. Those packages depend on "@typescript/eslint-plugin" but they use different versions. extends: ['airbnb', 'airbnb-typescript',...
View ArticleDoes the Nestjs controller method have to be async if it returns a promise?
Very simple general question:@Controller('something')class SomeController { @Get() foobar() { return foo() // this returns a promise }}So in such a case, do I have to make the foobar() controller...
View ArticleAnswer by user2297996 for How to delete / skip directory using Angular...
Figured it out:There is no such option, but you don't need it. If you don't want a directory to be created, remove its contents from the tree using tree.delete(). Schematics won't create empty...
View ArticleHow to delete / skip directory using Angular schematics?
I have some files in my schematics template which should be generated only when a certain input options is present. e.g: db==trueIs there a way to skip these directories / files?One solution is to...
View ArticleAnswer by user2297996 for How to validate plain object with class-validator?
This cannot be done using just JSON. You have to create a class type and use that as follows:@IsBoolean()someBool: boolean@IsString()someStr: string@ValidateNested()@Type(() => SomeClass)someObject:...
View ArticleHow to validate plain object with class-validator?
So I have a DTO:@IsBoolean()someBool: boolean@IsString()someStr: string???someObject: anyHow do I validate someObject? Its value is a plain JS object, just some arbitrary JSON data, so it's NOT another...
View ArticleHow to make class-validator to stop on error?
I want class validator to stop validation as soon as the first error is found.I know there is a stopAtFirstError option, but that prevents further validation on property level only. I want to stop it...
View ArticleHow to properly use interrupt handlers in 6502 Assembler?
I'm new to assemblers, so this question might sound dumb, but exactly what type of code should be implemented in a raster interrupt handler?So I know this handler gets called when the desired raster...
View ArticleHow to print help form Schematics?
Is there a built-in method for printing formatted CLI help message using Angular Schematics. I'm thinking of something something like Yargs would produce, for example.schematics @my-schematic --helpThe...
View ArticleIs there a way to inherit Schema of custom schematic?
Using Angular Schematics, I would like to build a schematic which inherits the schema from a "Base" schematic (which is private and hidden, so it cannot be executed from CLI).So when I run:schematics...
View ArticleHow to prevent Fiber from auto registerting HEAD routes?
Fiber v2 (https://gofiber.io/) automatically adds a HEAD route for each GET route.Is it possible to prevent this?I want only the GETs to be registered. Actually, I want to register only those routes I...
View ArticleHow do I obtain a refernce to widgets in Relm4 Component?
I'm building an app using the Relm4 SimpleComponent / Component macro. It works great. But I don't understand how can I refer to the generated GTK widgets later?My understanding is that the...
View ArticleAnswer by user2297996 for How to run child process in a new thread using Rust...
Actually it's possible to do this, there are multiple solutions.Check out this page for an overview:https://relm4.org/book/stable/threads_and_async/index.htmlI used a Component and Commands, basically...
View ArticleHow to run child process in a new thread using Rust / Relm4?
I'm using Rust, GTK4-rs and the Relm4 UI framework.So I have Relm4 SimpleComponent. In its update() method, I have a message handler which spawns a child process to run some task.This is kinda a long...
View ArticleEC2 error: cannot create temp file for here-document: Read-only file system
Looks like my Ubuntu 14.04 EC2 made the fs read-only. cd /var/ (pressing tab for autocomplete)cannot create temp file for here-document: Read-only file systemBut I have plenty of free space and memory...
View ArticleComment by user2297996 on What's the best way to run shell command from GUI...
@rodrigo so am I supposed to parse those profile files and set the env manually? I was hoping there is a way to do that automatically, but I guess not?
View ArticleComment by user2297996 on How to mock std::something in Rust?
I don't want to test reading a file. I want to test the logic inside this function, but there are dependencies such as this fs::read(). This is only an example. What I'm looking for is a way to mock /...
View ArticleComment by user2297996 on How to mock std::something in Rust?
Thanks for the answer, I accepted it. I will go with solution one. I would like to add, though, that even this doesn't seem to be ideal. I mean, yes you can do it this way, but this is not a mock. That...
View ArticleHow to use ResolveField decorator with a generic typeFunc?
How to do this in Nestjs Graphql?@ResolveField('items', () => [SomeClass])where SomeClass is any class that implements interface XSo if SomeClass is a specific class then it works. But how to make...
View ArticleAnswer by user2297996 for How to put a spy to a single function using SinonJS?
Just to clarify:In order to be able to use Sinon spies, you need to export your module functionality in a certain way. Basically, use classes or objects.Works:export default {func() {},func2()...
View Article