Ask the main part of your question in the title. This should be concise but informative.
Provide everything up front.
Don't make people fish for more details in the comments. Provide background information and examples.
Be present for follow up questions. Don't ask for help and run away. Stick around to answer questions and provide more details.
Ask about the problem you're trying to solve. Don't focus too much on debugging your exact solution, as you may be going down the wrong path. Include as much information as you can about what you ultimately are trying to achieve. See more on this here:
https://xyproblem.info/
Icon base by Delapouite under CC BY 3.0 with modifications to add a gradient
Basically, I'm trying to figure out how I could allow a user to send a schedule in the cron syntax to some API, store it into the database and then send an email to them at that interval. The code is at gragorther/epigo. I'd use go-mail to send the mails.
I found stuff like River or Asynq to schedule tasks, but that is quite complex and I have absolutely no idea what the best way to implement it would be, so help with that is appreciated <3
package main
import (
"fmt"
"log"
"gorm.io/driver/sqlite"
"gorm.io/gorm"
)
type Env struct {
DB *gorm.DB
Logger *log.Logger
}
type User struct {
ID uint
Username string
Name string
Email string
PasswordHash string
Country string //should probably be a foreign key of another table
}
func initDB() {
env := &Env{}
db, err := gorm.Open(sqlite.Open("gorm.db"), &gorm.Config{})
if err != nil {
fmt.Printf("Error opening database: %v", err)
return
}
env.DB = db
env.DB.AutoMigrate(&User{})
}
func main() {
initDB()
}
As you can see in the comment in the code, I assume the best way would be to have a table of countries and then assign each user to one via a foreign key. However, it seems a bit cumbersome to manually create a list of all countries. Is there a better way to do this?
How to plan and build a programming project, a simple to follow guide for beginners to get you building your own amazing projects to impress any employer.
I'm going through the Programming With a Purpose course on Coursera, and trying to come up with my own implementation of some of the example programs before looking at the example. I just finished the example of a gambling situation. I was hoping to get some more eyes on my code and be told whether my version is going to behave differently from the example. Due to the nature of simulations, I can't just compare the output of the two, since it will vary.
This is the explanation of what the code is meant to represent:
Gambler (PROGRAM 1.3.8) is a simulation that can help answer these ques tions. It does a sequence of trials, using Math.random() to simulate the sequence of bets, continuing until the gambler is broke or the goal is reached, and keeping
track of the number of wins and the number of bets.
Mine:
java
public class Gambler
{
public static void main(String[] args)
{
int stake = Integer.parseInt(args[0]);
int initialStake = stake;
int goal =
should i go with Clojure or common Lisp? i'm looking for an intuitive language and the tooling is great. my background: Ruby programmer and i use neovim. my goal: AI development. do people really use Lisp family for AI dev tho?
I will frame the question in terms of a specific C# objective that I am working on right now but I imagine the question is a pretty general one related to the Dunning-Kruger effect, in a way - how do you know how to build an application when you don't know all the issues you are supposed to prevent?
There is a message hub and I am developing a consumer for it. The original plan was to just create a few background services that get initialized alongside the application, that have a loop to load new messages/events and then process them.
Some time has passed and it feels like I am knees deep in Wolverine, Quartz, Hangfire, MassTransit, transactional outbox and all manner of different related things now. The potential issues are dealing with downtime, preventing loss of messages by storing them in a separate table before processing them, and everyone on the planet has a different idea on how to prevent and solve them and none of them sound simple and straightforward.
Iβm versed enough in SQL and RDBMS that I can put things in the third normal form with relative ease. But the meta seems to be NoSQL. Backends often donβt even provide a SQL interface.
So, as far as I know, NoSQL is essentially a collection of files, usually JSON, paired with some querying capacity.
I've been stuck in this mindset where I can't think of any good website ideas, or game ideas, or anything really. I want to get out of this mindset by thinking, "What should I make?", or "What do I need to make?".
I still follow peoples advice on "go take a walk and think about it for a bit" and "you'll get one soon" and things like that. Those don't seem to work.
All I need is advice on how I can make myself come up with ideas for projects that would let me do something with my free time. Any help would be appreciated!
I know stuff like SDL and RayLib exists, but I already have my own X11 and Windows API stuff working, and otherwise those libraries like to obscure things from the user in the name of "ease of use", sometimes even missing features (force feedback and proper XInput are the ones that are often skimped out on for whatever reasons, and only SDL has them to my knowledge). While I'll implement libevdev eventually, it has the issue of needing access to the devices.
While I found some reference to game inputs in X11's input extensions, I cannot find any user guide on them, since they're instead pointing me to SDL and co.
I not only have hard time finding tutorials, but even if I do, I have a hard time getting them to not crash, let alone working. I don't know what's the reason, but I have a suspicion that some of these are now AI generated, hence the issues of them not working or outright crashing.
I know newer APIs exist. They're way too complicated for my usecase.
I've heard about WebGPU, but I don't want to touch it with a 10 meter long pole, due to its name. I'll have a lot of time convincing people that WASM isn't a web-only thing, and me using it for scripting won't mean my game engine is either Web-based, nor that it has any Web-capability, and I only stayed with it due to my inability of finding a well-supported scripting VM without "Web" in its name.
If you ask: My game engine is currently using CPU rendering, and used to use SDL2 for displaying the output. I decided to move away from them. Managed to find some basic OpenGL tutorials when I first write my replacement for the SDL2 window han
I cannot seem to get tutorials for anything older than OpenGL 3.3, and for my usecase, I could go lower, except everyone tells me "OpenGL is obsolete, try Vulkan instead".
gl_TexCoord[0] seem to be all zeros if I modify the fragment shader to try to output gl_TexCoord[0].st, so its content would be displayed as color information, which I did for a different test. Also I can't find anything on how do I "pass" textures (or other values) to the shaders in the official docs, nor any of the tutorials I could find explains how that actually works.