StackOverflow.com

VN:F [1.9.22_1171]
Rating: 9.4/10 (10 votes cast)

Random snippets of all sorts of code, mixed with a selection of help and advice.

Creating an outliner and a summariser to register a language

20 April 2024 @ 12:04 pm

I am trying to update the registering of my language and with the new specifications I need to define an Outliner and a Summariser Here is the example project for the pico dsl file here and the language specification (i assume) here module lang::pico::LanguageServer import util::LanguageServer; import util::IDEServices; import ParseTree; import util::Reflective; import lang::pico::\syntax::Main; import IO; // a minimal implementation of a DSL in rascal // users can add support for more advanced features set[LanguageService] picoContributions() = { parser(parser(#start[Program])), // register the parser function for the Pico language outlin

The argument 'path' must be a string, Uint8Array, or URL without null bytes. Received '\x00__sveltekit/server'

20 April 2024 @ 12:02 pm

When migrating to old SvelteKit project I am getting this error when running npm run dev. How to solve? TypeError [ERR_INVALID_ARG_VALUE]: The argument 'path' must be a string, Uint8Array, or URL without null bytes. Received '\x00__sveltekit/server' at open (node:internal/fs/promises:605:10) at Object.readFile (node:internal/fs/promises:1085:20) at loadAndTransform (file:///Users/moo/code/frentek/node_modules/vite/dist/node/chunks/dep-2b82a1ce.js:54957:34) at async instantiateModule (file:///Users/moo/code/frentek/node_modules/vite/dist/node/chunks/dep-2b82a1ce.js:55940:10) npm run preview works fine.

Air_MultiAvailability_19.1 AMADEUS

20 April 2024 @ 12:01 pm

How can I retrieve more than 10 flight information in the response? Currently, I'm only able to receive 10 flight info each time I make a request, but there are more than 10 flights available on certain days Here is my request <Air_MultiAvailability xmlns="http://xml.amadeus.com/SATRQT_19_1_1A"> <messageActionDetails> <functionDetails> <businessFunction>1</businessFunction> <actionCode>44</actionCode> </functionDetails> </messageActionDetails> <requestSection> <availabilityProductInfo> <availabilityDetails> <departureDate>200524</departureDate> </availabilityDetails> <departureLocationInfo> <cityAirport>TPE</cityAirport> </departureLocationInfo> <arrivalLocationInfo> <cityAirport>IC

Failed step "verifyConditions" of plugin "@semantic-release/apm"

20 April 2024 @ 11:58 am

I do get the following error while running my Github action Error Failed step "verifyConditions" of plugin "@semantic-release/apm" My config commitlink.config.ts module.exports = { extends: ['@commitlint/config-conventional'], } package.json "devDependencies": { "@commitlint/cli": "^19.2.2", "@commitlint/config-conventional": "^19.2.2", "@semantic-release/apm-config": "^9.0.1", "husky": "^9.0.11", "semantic-release": "^23.0.8" }, "release": { "extends": "@semantic-release/apm-config" }, ci.yml - name: release run: npx semantic-release --branches main env: GITHUB_

Failed to parse URL when bulding nextjs client in api platform

20 April 2024 @ 11:57 am

I've been trying to play around with api platform these last few days. However I must be missing somethign. When I follow the steps in "getting started with...", to generate the nextjs client, everything seems to work: I can go to localhost/greetings and I can add, edit and delete greetings. However, after that I tried to follow https://api-platform.com/docs/deployment/minikube/. This fails in the build step of the pwa with the error TypeError: Failed to parse URL from undefined/greetings. This is the same error I get when following the steps to build a nextjs client here: Here it says to go to localhost:3000/greetings after starting the server with pnmp dev. Going to that page gives me the same error as I wrote above. After this, the page that originally worked (localhost/greeti

Data not loading on Page refresh in blazor webassembly standalone app

20 April 2024 @ 11:56 am

I have created a sample web app in blazor as webassembly standalone app, then I simply published this web app in a local folder and hosted it in the iis as a website. I browse the site it worked properly but I refreshed the page then got the error page. I looked for the issue on internet then I found one setting to be done in the web.config file of the application. I did the same and error page did not come but the data was also not loaded which I am fetching from the sql server. Currently the sql server is in the same machine but I want the solution for both sql server in local machine sql server on a hosted server. Also the menus given in the left hand side got hidden and I was unable to expand them using the menu button just like app got hannged. On browsers back button I went back then app started working but the page refresh issue still persists.

.NET MAUI redraw animation during switch between two TabBars

20 April 2024 @ 11:56 am

I have two TabBars in AppShell.xaml switching between them. <TabBar> <Tab Title="Novinky"> <Tab.Icon> <FontImageSource FontFamily="FASolid" Glyph="{StaticResource IconHome}"></FontImageSource> </Tab.Icon> <ShellContent Title="Home" ContentTemplate="{DataTemplate view:HomePage}" Route="HomePage" /> </Tab> <Tab Title="Skupiny"> <Tab.Icon> <FontImageSource FontFamily="FASolid" Glyph="{StaticResource IconGroups}"></FontImageSource> </Tab.Icon> <ShellContent Title="Skupiny" ContentTemplate="{DataTemplate view:GroupListPage}" Route="GroupListPage" /> </Tab> <Tab Title="Profil"> <Tab.Icon> <Fon

My HashSet stored a duplicate object after a modification

20 April 2024 @ 11:53 am

I am a programming tutor. Yesterday, I was trying to explain HashSet to my students in some test cases. Of course, HashSet allows modifying contained objects, but it can lead to inconsistency problems, and I was showing them some ways to do this correctly. Then, I encountered a situation where my HashSet added an object that was already in it after a modification. Could anyone explain to me why it happens? Here is my code: boolean cambiar = false; Persona personaCambiada = null; Iterator<Persona> iteratorHS = hs.iterator(); while (iteratorHS.hasNext()) { Persona persona = iteratorHS.next(); if (cambiar == false) { personaCambiada = persona; iteratorHS.remove(); personaCambiada.setDNI(p2.getDNI()); personaCambiada.setNombre(p2.getNombre()); cambiar = true; } } System.out.println(p2.equals(personaCambiada)); // prints true System.out.println(personaCambiada.equa

How to prevent component reload when toggling Modal visibility?

20 April 2024 @ 11:35 am

I am using a Modal in my RN app to show a map to the user. This component is slow and expensive to load, which is why I want to make sure it is not getting loaded from scratch every time. However, currently this is not working. By toggling visible, the map component gets loaded from scratch each and every time the modal opens up again. Is there a way to prevent this behavior and make sure that the map is not getting unmounted and reloaded every time? import { Modal } from 'react-native'; <Modal animationType="slide" transparent={true} visible={showModal} onRequestClose={() => setShowModal(false)}> <MapView onTogglePressed={() => setShowModal(false)} /> </Modal>

numba jitclass with record type of string

20 April 2024 @ 11:16 am

The v3 variable is string value. I could not run with below code which gives error. import numpy as np import pandas as pd from numba.experimental import jitclass from numba import types import os os.environ['NUMBA_VERBOSE'] = '1' # ----- BEGINNING OF THE MODIFIED PART ----- # recordType = types.Record([ ('v', {'type': types.int64, 'offset': 0, 'alignment': None, 'title': None}), ('v2', {'type': types.float64, 'offset': 8, 'alignment': None, 'title': None}), ('v3', {'type': types.bytes, 'offset': 16, 'alignment': None, 'title': None}) ], 32, False) spec = [ ('data', types.Array(recordType, 1, 'C', False)) ] # ----- END OF THE MODIFIED PART ----- # @jitclass(spec) class Test: def __init__(self, data): self.data = data def loop(self): v = self.data['v'] v2 = self.data['v2'] v3 = self.data['v3'] print("Inside loop:") print("v:", v) print("v2:", v2) pr