Skip Navigation

Search

Minimal dev environment for Preact + TailwindCSS

Hello,

I am currently trying to implement a webserver on an embedded STM32F439 using the Mongoose library and Preact (3kB React equivalent made especially for embedded solutions).

My speciality is in embedded development and my web dev experience is next to nil, so I have a hard time finding a solution for my problem.

Right now, I tried to use Preact + Vite.js, but it seems to be causing issues when packing my webpage into my embedded system.

The workflow I am using right now is as follows:

  1. Create a webpage with Preact/TailwindCSS in jsx and build the page with npm run build. If I run npm run dev or start a http server with python3, the webpage loads properly.

  2. For Mongoose Library, since I don't have a file system, I use their packing utility which takes the webpage files and convert them into a C array that can then be unpacked by the Mongoose Library at runtime.

  3. Start the embedded server, get an IP and the server is online. At that point, I can customize my paths to show whatever I want and fetch embedded resources. The issue happens here. As I add more elements to my webpage, eventually, it stops working. It produces a range of issues (403 forbidden, illegal characters for example).

Preact+Vite.js is definitely creating some issue here with the embedded dev environnement, so I would like to explore more "barebone" options where I have more control over what is bundled and how it is bundled. It really feels like Preact+Vite.js is obfuscated a lot when bundling all the files together, and I would like to have more control over that part so that I can learn a little bit about the workflow of the bundling.

So my question is as follow : what other dev environnement do you recommend knowing that the webpage is packed in a C array and then runs on an embedded system with no file system?

Thanks

8

Are there tools for documents manipulating that can provide an approximate size of components (text included)?

Long story short, I want to build a system that reorders some components in a document file (be it a docx or odt, I don't have a hard constraint atm).

So my problem input should be a document file, and I need to be able to approximate the number of pages consumed by this document file, I also need to be able to get the height of individual components (like a single paragraph or a table) to have the data I need to rearrange so I can make the document have less pages.

I don't have a hard constraint on the programming language of the tool either (Python preferred), I prefer not embedding LibreOffice into my system.

Also I'm willing to hear other solutions (maybe my input is not the optimal thing I can use for this problem).

Thanks in advance!

14

Should I use Django for a small website?

I basically want to make a small personal website that probably won't get any attention. It will also be somewhat simple. Is Django overkill and I should use Flask or something else or is it okay? I tried learning JS and using ExpressJS but JS overall feels very loosely typed and I don't like it. I've been using Python for over 3 years now.

18

represent PC speaker beep with audio file

for a while, I have been using hardware through Linux that uses the beep from the PC speaker. I'm actually really used to it, so when I switched to using hardware with an unusably loud (volume can't be changed) volume (and also different frequency), I started looking into "exporting" the original beep to an audio file that could be played at different volumes and for other purposes.

looking through the internet, however, I haven't found any attempts to represent any actual PC speaker beep in an audio file, so I'm asking you guys if you know how to do so. presumably, the beep is just a short, simple waveform at a certain frequency, but I am not sure what that waveform is, or what the easiest way to do so is.

1

Doxygen: Is it possible to reference methods and data members in other method's comment block?

Hello everyone, I've recently picked up doxygen and have been trying to document an old project, nevertheless, I have some class's method and I want to refer in the docs to another class's method and a data member of the same class

Here's the method:

void App::start() { for (unsigned i = 0; i < currentScene->gameObjects.size(); ++i) { currentScene->gameObjects[i]->start(); } timeSinceStart.restart(); }

I want to have a reference to GameObject::start and App::timeSinceStart in App::start doc block

(Sorry not in monospace, my Lemmy client doesn't seem to support it and I don't know the syntax here if one present)

2

what's one of the easier ways to make a window on linux using x11 and nasm assembly?

6

Why do app updates have download sizes almost as large as the apps themselves?

They seem to be too big for what devs claim to be a 'minor patch' and yet too small to suggest a complete reinstallation of the app. Is there some technical reason behind it? I would like to request an ELI5 for this.

9

So I cant' fork the fork of repo?

Let's say a repo named cool-stuff is on github. I have a fork of cool-stuff and I have submitted a PR associated with my fork of cool-stuff which is waiting to be merged.

Now, there is another independent fork of cool-stuff,say, even-cooler-stuff which works on new features to introduce to cool-stuff. I would like to contribute to the even-cooler-stuff repo but github won't let me since I already have a fork of cool-stuff.

Is there any way to do what I want like this or should I manually tell the author of even-cooler-stuff the changes I want to do?

10

Any FOSS or at least privacy friendly AI tool to automatically comment code?

I used Trelent, an extension for VS code that didn't require any registration, but their server has been unresponsive for a while. Any alternative you would recommend? My code is in Python, mostly.

Edit: I wasn't clear on my intention. I was looking for a tool that would lay out a generic description so I would start from something and fine tune the explanation. I am incredibly bad at documenting, the process is tedious and frustrating. At the end of the day, my explanations are mostly gibberish anyway. From your general consensus, I should bite the bullet and do it by myself. I really appreciate your feedback, point taken. Time to psych myself up with some death metal and get it over with.

7

Tools for monitoring changes in a Git repo

Anyone have suggestions for getting some tools in place to monitor for when changes happen that match certain criteria (obvious one being when certain files change)? Hosting-wise, we use BitBucket Cloud, though I can't find anything built-in that'd be useful (seems like most cloud-based solutions don't offer pre-receive hook customisation?)

We've had some "issues" with people not considering the impact of changes to certain code, and just want a little more handholding before the next time that sort of issue happens. I'm sure I could rig something either with a webhookey endpoint, or a CI build that does it, but it just seems like the sort of thing there'd be a pre-built tool for.

Any ideas?

5

Question regarding Builder design patter.

I was watching a video regarding design patterns and the youtuber made an example of the builder pattern... I didn't know about the pattern(there is a reason why I was watching the videos); But I had encounter the same type of problems so what I usually did was to return null to the fields I didn’t had their data.

Is it wrong what I was doing?

At the end the builder will make the object with a null data and realistically it takes the same amount of code...

3

Vscode debugger for firefox is all buggy

I am trying to debug from vscode a vue 3 with TS and vite project using firefox

As stated in the Debugger for firefox extension page i did:

>open the Developer Tools Settings and check the checkboxes labeled "Enable browser chrome and add-on debugging toolboxes" and "Enable remote debugging"

and executed Firefox as follows

"C:\Program Files\Mozilla Firefox\firefox.exe" -start-debugger-server

The problem is that the debugger is all buggy and doesn't hit the correct line

Here is my launch.json (the one for chrome works perfectly well)

{ "version": "0.2.0", "configurations": [ { "type": "chrome", "request": "attach", "name": "Attach to Chrome", "port": 9222, "webRoot": "${workspaceFolder}", "urlFilter": "http://127.0.0.1:4000/*" }, { "name": "Attach to Firefox", "type": "firefox", "request": "attach", "url": "http://127.0.0.1:4000", "webRoot": "${workspaceFolder}", "pathMappings": [ { "url": "http://127.0.0.1:4000/src", "path": "${workspaceFolder}/src" } ] } ] }

0

JS array with getter by ID ?

Hi !

Given the following sample items :

| ID | First name | Age | | ---------- | ---------- | --- | | xvZwiCpi | Naomi | 42 | | Nzd9UsGT | Naomi | 24 | | QiDXP2wA | Thea | 53 | | JpYeAY7H | Jeremy | 35 |

I can store these in an array : js const data = [ { id: 'xvZwiCpi', firstName: 'Frederic', age: 42 }, { id: 'Nzd9UsGT', firstName: 'Naomi', age: 24 }, { id: 'QiDXP2wA', firstName: 'Thea', age: 53 }, { id: 'JpYeAY7H', firstName: 'Mathew', age: 35 } ]; Thus access them the same way by ID : js console.log(data.find(item => item.id === 'xvZwiCpi')); And by properties : js console.log(data.find(item => item.firstName === 'Frederic').id); Or I can store these in an object : js const data = { 'xvZwiCpi': { firstName: 'Frederic', age: 42 }, 'Nzd9UsGT': { firstName: 'Naomi', age: 24 }, 'QiDXP2wA': { firstName: 'Thea', age: 53 }, 'JpYeAY7H': { firstName: 'Mathew', age: 35 } }; Thus more easily access properties by ID : js console.log(data['xvZwiCpi'].firstName); But more hardly access ID by properties : js console.log(Object.entries(data).find(([id, item]) => item.firstName = 'Frederic')[0]); I could duplicate IDs : js const data = { 'xvZwiCpi': { id: 'xvZwiCpi', firstName: 'Frederic', age: 42 }, 'Nzd9UsGT': { id: 'Nzd9UsGT', firstName: 'Naomi', age: 24 }, 'QiDXP2wA': { id: 'QiDXP2wA', firstName: 'Thea', age: 53 }, 'JpYeAY7H': { id: 'JpYeAY7H', firstName: 'Mathew', age: 35 } }; To slightly simplify that previous line : js console.log(Object.values(data).find(item => item.firstName = 'Frederic').id); But what if a single variable type could allow doing both operations easily ? js console.log(data['xvZwiCpi'].firstName); console.log(data.find(item => item.firstName === 'Frederic').id); Does that exist ?

If not, I'm thinking about implementing it that way : js const data = new Proxy([ { id: 'xvZwiCpi', firstName: 'Frederic', age: 42 }, { id: 'Nzd9UsGT', firstName: 'Naomi', age: 24 }, { id: 'QiDXP2wA', firstName: 'Thea', age: 53 }, { id: 'JpYeAY7H', firstName: 'Mathew', age: 35 } ], { get: (array, property) => array[property] || array.find(item => item.id === property) }); In which case I'd put it in a lib, but how would this be named ?

I'd also make a second implementation that would enforce ID uniqueness and use Map to map IDs with indexes instead of running find : while the first implementation would be fine for static data, the second one would be more suitable for dynamic data.

Would this make sense ?

Thanks

20

Learning to code

I’ve been wanting to learn how to code for a while so I figure now is as good a time as any to start. I downloaded VS code on my laptop for python but I don’t really know end product I should try to code and I also am just bad and barely know what I’m doing. Does anyone here have any advice on what to code and how best to learn?

34

what font do you use in your code editor/IDE?

I'm looking for a good on the eyes font that suport a feel special characters like ç, ã and í. It also need to have a easy difference between 0/O and I/l. Sorry if this is not the best place to ask this.

Edit: thank you everyone for the answers, i will use fira code on my terminal and intel one mono on my text editor.

83

Community Content Vote

Hey everyone

Theres been some discussion recently about the content allowed in this community so I wanted to make a quick poll to gauge what is wanted in terms of what people see here

The current description of the community is a bit ambiguous so this will determine whether everything is allowed here or if only more general programming topics are

You can just dm me with options ranked based on your preference (its ranked voting) to vote and ill share the results in a day of the overall vote tallies

---

1: Allow all posts relevant to the instance (main community)

This will let pretty much any post be able to be posted in here whether that be a help question, discussion, news, etc.

Allowed:

  • What is your favorite music to listen to while programming?
  • Has anyone else seen this interesting “challenge site” when googling a programming topic?
  • Intellij and docker on vm memory issues
  • [HELP][Python] How to use Selenium correctly
  • Announcing TypeScript 5.2 Beta
  • Discussion ES6 Classes. Good or Evil?

Disallowed

  • Things not relevant to the instance

2: Allow any posts and direct people in the comments to more specific communities for their future posts (people catching community)

This will also let any post be able to be posted in here like the previous option but will guide people towards the more specific communities in the future to make them then post the content in those

Allowed:

  • What is your favorite music to listen to while programming?
  • Has anyone else seen this interesting “challenge site” when googling a programming topic?
  • Intellij and docker on vm memory issues
  • [HELP][Python] How to use Selenium correctly
  • Announcing TypeScript 5.2 Beta
  • Discussion ES6 Classes. Good or Evil?

Disallowed

  • Things not relevant to the instance

3: Only allow topics that arent limited to one language, library, etc. (general topic community)

This will let posts such as: what is your favorite music to listen to while coding? or Here is some details about functional programming be able to be posted while something like a library for python will instead be posted in the python community

Allowed:

  • What is your favorite music to listen to while programming?
  • Has anyone else seen this interesting “challenge site” when googling a programming topic?

Disallowed

  • Things not relevant to the instance
  • Intellij and docker on vm memory issues
  • [HELP][Python] How to use Selenium correctly
  • Announcing TypeScript 5.2 Beta
  • Discussion ES6 Classes. Good or Evil?

4: Dont allow questions of how to do X in X language but allow actual discussions or news about the language in addition to general topics (general & discussion community)

Like above but also allows conversations about specific languages in the community as long as its not a question on how to do X in the language

Allowed:

  • What is your favorite music to listen to while programming?
  • Has anyone else seen this interesting “challenge site” when googling a programming topic?
  • Announcing TypeScript 5.2 Beta
  • Discussion ES6 Classes. Good or Evil?

Disallowed

  • Things not relevant to the instance
  • Intellij and docker on vm memory issues
  • [HELP][Python] How to use Selenium correctly

5: Only allow crossposts into the community with things like news being posted in the specific community first (crosspost community)

This will ONLY let crossposts be made. All other options also allow crossposts but this makes it so that the post will fill up the specific community while c/programming is a main post feed for people who want to see many different topics from the specific communities

Allowed

  • anything as long as its crossposted

Disallowed

  • anything not crossposted
  • things not relevant to the instance

You can find some past discussion here https://programming.dev/post/388375 to see some points for the different options

Based on whats voted some other communities may be created or adapted to fit the new niche of people

(ill reply to your dm when your vote is counted, if I havent responded in awhile I may not have gotten it or im asleep)

45

How to use Selenium correctly

Hi there! So I was hoping programming might be able to help with this. I am trying to learn how to use Selenium for personal projects.

I have tried using normal, straight up selenium but it does not support authorized proxies... I have tried SeleniumBase, but when I got it working, there were WebRTC leaks that I could not avoid. I have tried using Undetected-chrome but that too I was unable to get authorized proxies working... For proxies, I tried seleniumwire as well. That seems to use its own SSL certificates which unfortunately as far as I can tell is easy to detect. Main purpose for me is web scraping and or simple login to X site, enter X info and close.

So my question is... What is the proper way to use Selenium for automating functions while avoiding detection?

Thank you in advance.

EDIT: I made this post because I am hitting a wall at every turn, and I feel like I might just be approaching this the wrong way, or maybe I'm just missing something crucial. I was hoping someone with more experience could explain to me what is the correct way of doing it without cobbling it together with duct tape.

18