October 22, 2024
Chicago 12, Melborne City, USA
Android

Why is the Paging3 PagingState not saving items?

I’m doing a pokedex example app in compose but the pagination works only if i close and reopen the application. override suspend fun load( loadType: LoadType, state: PagingState<Int, PokemonEntity> ): MediatorResult { val page = when(loadType) { LoadType.REFRESH -> 0 LoadType.PREPEND -> return MediatorResult.Success( endOfPaginationReached = true ) LoadType.APPEND -> { val lastItem = state.lastItemOrNull()

Read More
pdf

Create pdf:s that are digitally signed

Where I work, we sometimes train customers. Every participant of these training will get a training certificate. The current method is that we have a template where we change the time period and the name of the trainer. These templates are then printed by one of the office secretaries, that then in turn need to

Read More
jQuery

How to Upload a Video Files Template in GrapesJS?

I’m working with GrapeJS for a project and have successfully implemented custom image upload functionality using the tag. Now, I need to do something similar for videos. Specifically, I want to: Add a video template (like a tag) to the editor. Allow users to upload a video file and set the video source dynamically. Ensure

Read More
python

SQLAlchemy hangs when sending ALTER TABLE

I’m trying to add a column to a PostgreSQL table with SQLAlchemy. I read on a couple threads that the simplest way to do this is to send plain SQL rather than modifying the Table object. My query is really basic: import sqlalchemy engine = create_engine("postgresql://user@host:port/db") query = sqlalchemy.text("alter table schema.table add column if not

Read More
javascript

React Module not found error when importing addColor component

I’m working on a React project for a university assignment and I’m encountering an error when trying to import the addColor component. Here’s the error message I’m getting: (modified to include complete error message) Failed to compile. Module not found: Error: Can't resolve './components/addColor' in '/my/base/path/my-app/src' ERROR in ./src/App.js 8:0-45 Module not found: Error: Can't

Read More
C++

How to determine available physical RAM in a RISC-V OS?

I was recently going through the source code for xv6 (https://github.com/mit-pdos/xv6-riscv), when I recently came across this line: (https://github.com/mit-pdos/xv6-riscv/blob/riscv/kernel/memlayout.h) #define PHYSTOP (KERNBASE + 128*1024*1024) combine this with the Makefile of the project (https://github.com/mit-pdos/xv6-riscv/blob/riscv/Makefile): QEMUOPTS = -machine virt -bios none -kernel $K/kernel -m 128M -smp $(CPUS) -nographic This made me realise that they are just hard

Read More
CSS

CSS-only masonry layout

I want to use CSS to align a series of images like the image shows. 2 columns, and any number of side by side images. No vertical gaps between the images. And all the images are displayed with the same width (whatever their original size), and the heights are adjusted to keep the original aspect

Read More
SQL

sqlplus: how to execute a query spanning multiple lines

I am using Oracle 19c. I can get the following to work: variable max_id number; exec select 41 into :max_id from dual; begin dbms_output.put_line(:max_id); dbms_output.put_line(:max_id+1); end; But splitting the select across multiple lines produces an invalid SQL statement error at the new line: variable max_id number; exec select 41 into :max_id from dual; -- invalid

Read More
python

How do I make caves randomly generate in pygame?

My game is supposed to be like Minecraft using pygame, but 2D. I do not know how to generate caves, and other questions I looked at didn’t really work, like this: Perlin worms for 2D cave generation. That did not explain how to, and I am trying to find out. I heard of perlin noise,

Read More
java

Missed signal in a Java

Can this code ever lead to missed signal? If yes, then how? private Object lock = new Object(); private boolean conditionMet = false; public void waitForCondition() throws InterruptedException { synchronized (lock) { while (!conditionMet) { lock.wait(); } // Proceed when condition is met } } public void signalCondition() { synchronized (lock) { conditionMet = true;

Read More