Search
How do I post and store binary data correctly in Laravel?
I have the following migration:
(Schema::create('user_images',function(Blueprint $table){
$table->id();
$table->binary('image');
$table->unsignedBigInteger('user_id');
$table->foreign('user_id')->references('id')->on('users');
});)
And the following corresponding model:
`class UserImage extends Model { protected $fillable=[ 'image' ];
undefined
public function user():BelongsTo{ return $this->belongsTo(User::class); }
}`
I am trying to create new UserImage records with UserImage::create but it is always failing, I am sending the image data using curl:
curl -v -F image=@$1 $URL/api/users -H "Accept: application/json"
I have tried so many things but I got different SQL-related errors, I am not sure how am I supposed to encode the image data to get them stored, I know that accessing $request->image returns only a temporary path of the image on the HDD.
[Webdev]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:
- 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.
- 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.
- Start the embedded server, get an IP and the server is online. At that point, I can customize my paths to s
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!
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.
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)
what's one of the easier ways to make a window on linux using x11 and nasm assembly?
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.
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?
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.
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?
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...
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)
undefined
{ "version": "0.2.0", "configurations": [ { "type": "chrome", "request": "attach", "name": "Attach to Chrome", "port": 9222, "webRoot": "${workspaceFolder}", "urlFilter": "http://127.0.0.1:4000/*" }, { "nam
how to use a typescript decorator and initialize the class
I have currently:
A Class with multiple functions A Decorator that saves the function to a list
The problem:
When i call the function "this" is not the class ( or not yet initialized )
How can i implement it correctly?
My Class Function Decorator:
export function LemmyOn(data: ILemmyOn) { return function ( target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<any> ) { events.push({ data: data, fn: descriptor.value }); return descriptor; }; }
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 propertie
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?
[help] 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.
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 ES
[Python] 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 crucia