Categories
Development Firebase

Flutter rendering list from firebase based on condition in dropdown menu

I’m trying to figure out how to render a list from a specific collection in firebase and to change that list when selecting options from dropdown menu. I could get the list rendered on 1 collection, but when I add my dropdown menu, with the default value being ‘lost’, nothing is displayed. Here’s what I […]

Categories
Development

Test if function of object has been called inside another function in jest

My code looks somewhat like this : Class A :{ Object foo = new foo; function (){ … let var = this.foo.bar() … } And I would like to test with jest that foo.bar() has been called. I’ve tried with barSpy = jest.spyOn(function, ‘foo.bar’); but it doesn’t work, can someone guide me toward the good […]

Categories
Development

Array map function is undefined in production build

I’ve finished an app I’ve been working on built using create-react-app, and the development build runs without any errors and everything works. But when I run npm run build to make the production build, and test it, I get the follow error: TypeError: “c.map is not a function” The code that seems to be causing […]

Categories
Development SQL

SQL Is there a more efficient method than CASE results based upon varying criteria

The below case statement does not seem to be the best or most efficient method for the result I am looking for. The result needs to be on 1 line in 1 field as shown below in the result. If there is 1 PO and 1 IREQ the result should show “1 PO, 1 IREQ” […]

Categories
Development

@NgModule static forRoot when implementing dynamic modules

I have this code in @NgModule: @NgModule({ declarations: [ AppComponent, DashboardComponent ], imports: [ BrowserModule, BrowserAnimationsModule, ClarityModule, RouterModule.forRoot([ { path: ”, redirectTo: ‘dashboard’, pathMatch: ‘full’ }, { path: ‘dashboard’, component: DashboardComponent }, ], {useHash: true}), LibraryTestModule.forRoot(ServicetestService), HttpModule ], If you can see i am injecting the ServicetestService to the LibraryTestModule. But in my case i […]

Categories
Bootstrap Development Google

Bootstrap modal is not opening on Google Maps marker click

I tried several options but did not succeed. My main goal is to open a Bootstrap modal.centered with info about the location. I tried to put trigger button it to infoWindow, but when I click on it page shows only grey semitransparent background. I made a simple map where I tried to test. My codepen: […]

Categories
Development

Postgres generate series of columns

I have a couple of tables Table 1: meter_id | date 1 2019-01-01 Table 2: meter_id | read_date | period | read 1 2019-01-01 1 5 1 2019-01-01 2 6 1 2019-01-01 5 2 1 2019-01-01 6 1 1 2019-01-01 7 2 2 2019-01-01 1 3 2 2019-01-01 2 10 1 2019-01-02 6 7 Is […]

Categories
Development Java

Java Eclipse – JUnit test expects exception but still fails when exception is

I am writing a test for a method that gets the maximum key value out of a binary search tree. I specifically check what happens when the method is called on an empty tree, in which case, it will throw an exception: public K getMax() throws NoSuchElementException { try { return root.max(); } catch (TreeIsEmptyException […]

Categories
Development Linux Windows

Debug linux crash dump on Windows

I have got a crash dump of a C++ application from Linux platform. How can I use that on Windows to look at the state of the program (call stack, variable values, thread info, etc.)? Can I use Visual Studio/VSCode?

Categories
Development

How to rewrite a program to use recursion?

Just started to deal with recursion – I don’t understand everything in it yet. I think that i don’t use a basic conditional, but i don’t have any idea how to write it. The program itself works and execute everything i need, but there is no recursion. The idea of the program is that there […]