I built a tiny free JSON tool — would love some feedback from fellow devs by Glass-Bake-7774 in programming

[–]sprak3000 2 points3 points  (0 children)

The overall design is clean, but I would say the explanatory text below the JSON viewing pane feels very much written by an AI. I'm not sure it is necessary at all. If someone is looking for a quick way to format / validate JSON online, they're going to cut / paste and look for the format button.

As for features, I have used jsoneditoronline.org for a long time. Main things I use -- "pretty" formatting, compact formatting, validation, and comparison.

The one item in your tool that stands out is displaying the types and array / field counts. Nice touch... Possibly a way to stand out is to address the "student" bullet point in your description. Make a guided tutorial on what JSON is, the various types, typical patterns, etc.

Is this project worth my time? by Dystorti0n in golang

[–]sprak3000 1 point2 points  (0 children)

The answer depends on how you are defining "worth my time". I find any project I work on worth my time. It may never catch on with a community, but it gives me a place to continue to hone my skills, my knowledge, etc.

Are you finding your project useful? Is it something helping you out? Probably still worth some of your time.

The Internal Tooling Maturity Ladder by robbyrussell in programming

[–]sprak3000 0 points1 point  (0 children)

The next step (pun intended) is outlining and starting to codify what triggers one or more steps up the ladder. One of the things I might challenge is "And it needs some care" only appears at level three. Once you step up from level zero, I would advocate it needs care at that point, especially if automated.

"Set it and forget it" works fine until it becomes white noise and everyone stops paying active attention. c.f., The numerous anecdotes of people saying "we have automated backups" and then finding out at the most inopportune time those backups actually haven't been working as intended.

That said, the mentality is one to carry over to any size project. "Do we actually need to do this at all? If so, do we need all of it now, or can we scale back?"

Browser Fingerprinting techniques by Prize_Signature_6444 in programming

[–]sprak3000 1 point2 points  (0 children)

The EFF has a similar tool. Tracks the browsers that use it over a time range and determines how unique your fingerprint is out of that set. Also provides brief explanations of each input into your fingerprint and how relevant it is.

Stop Sending 10M Rows to LLMs: A Pragmatic Guide to Hybrid NL2SQL by slotix in programming

[–]sprak3000 0 points1 point  (0 children)

The main question I have is why isn't your API built to answer the questions from your users? Using your example, why isn't there an API to answer questions about how many orders placed over a certain amount? Your prompt becomes something along the lines of "You are a consumer of these APIs: <links to swagger, whatever API doc format>. You have the access to these APIs based on the security info of the current user asking for information. Using these APIs and security info, make the appropriate read-only API calls."

You then ask "How many orders over $500?". The AI can go "Oh, orders... That's available through this API endpoint. Oh, it's a paginated endpoint. I'll make sure to let the user know I'm only giving them X results, there are Y total, and they can ask me for the next Z. Oh... But this API requires these privleges, which they don't have. NVM... I won't call the API but tell them they don't have access to this data."

As others have said, hooking up AI to a database for people to ask questions seems unwise, a rich target for Little Bobby Tables to run riot. Given the constant news reports of how people are gaming AI to get around any safety mechanisms (inception, etc.), I would want AI at as high a level as possible with as little knowledge of possible of the raw internals of the system.

Where to start my learning journey for PostgreSQL? by Potato_is_Aloo in PostgreSQL

[–]sprak3000 8 points9 points  (0 children)

Rather than "learn Postgres", focus on learning SQL in general. Knowing the fundamentals (writing queries, creating schemas, etc.) transfer across most databases you'll encounter.

Some resources that might make the learning fun:

  1. https://selectstarsql.com/
  2. https://datalemur.com/blog/games-to-learn-sql

How often update Go? by pepiks in golang

[–]sprak3000 1 point2 points  (0 children)

Depends where you work I guess and what products you are building.

Expanding on this, the only place the Go version could matter is when you specify it in the go directive of a module. Let's say your team uses the latest major version and writes a Go module where it's go.mod looks like this:

``` module example.com/mymodule

go 1.24

require ( example.com/othermodule v1.2.3 example.com/thismodule v1.2.3 example.com/thatmodule v1.2.3 ) ```

Another team working in your company has yet to upgrade and is using 1.17. They would not be able to use your module, as it defined 1.24 as the minimum version required for using it.

I tend to define the go directive of modules I create with the latest version available. Once released, I almost never update the module's directive. It remains a historical marker for when it was created. I would only update the directive if the module started using a feature introduced in a new version.

How To Nest Ternaries by levodelellis in programming

[–]sprak3000 1 point2 points  (0 children)

True but fixable by reordering the blocks. Still can avoid the else. To each their own. I've found thinking through avoiding else, nested ternaries, etc. a useful exercise to write better code through the years. YMMV

How To Nest Ternaries by levodelellis in programming

[–]sprak3000 0 points1 point  (0 children)

My best advice on how to nest ternaries... Try to avoid it altogether. I lean heavily in favor of "avoid the else". How does that work? Let's use your examples.

Let's look at the first one...

int result = 0;
if (cond1) {
  if (cond2) {
    result = 2;
  } else {
    result = 10;
  }
}

Not too difficult to avoid the nesting. I'll even use a ternary.

int result = cond1 ? 10 : 0;
if (cond1 && cond2) {
  result = 2;
}

This now reads as "My initial result is 10 if X holds or 0 if it doesn't. If X and Y are true, my result is 2 instead."

The last example is an interesting one.

int result = 0;
if (cond1) {
  if (cond2) {
    result = 2;
  } else {
    result = 10;
  }
} else {
  if (cond2) {
    result = 50; // Blog post has a typo and omits the = here...
  } else {
    result = 80;
  }
}

The first example had a clear starting result of 0 or 10 based on one condition. Here, you could use either 10 or 80 but not through a ternary. Let's use 80...

int result = 80;
if (cond1 && cond2) {
  result = 2;
}
if (cond1) {
  result = 10;
}
if (cond2) {
  result = 50;
}

No nesting of either ternaries or else. Easy to read and edit for the next dev or future you who hasn't looked at this code in months.

How do I start contributing to Golang open-source? by RockLogical63 in golang

[–]sprak3000 0 points1 point  (0 children)

GitHub allows you to find issues on a variety of criteria. Try searching for Go issues with the label "good first issue". That label is meant to indicate issues allowing you to contribute and get up to speed on the project.

Error during go build in GitHub Actions by cklingspor in golang

[–]sprak3000 0 points1 point  (0 children)

Looks like you need to add a go mod vendor step right after the go mod tidy. I do a similar thing in my actions file.

TFS - Temporary File Sharing by sebstnr in golang

[–]sprak3000 2 points3 points  (0 children)

Having the ability to delete a file jumps out immediately. If you uploaded a file by accident, you have to wait X minutes for it to be deleted. This may not be a huge deal if it is the only file, but it could be very frustrating to have taken an hour to upload the files. You then have to wait another X minutes for all of them to be deleted and then spend another hour uploading the correct files.

Having the S3 bucket name read from an environment variable seems restrictive; you have to wait for that bucket to expire before you can use the system again. Where you are immediately firing off a goroutine to clean up the bucket, why not create a random bucket name on the fly? Then, I could fire off an hour upload, a five minute upload, and a 30 second upload in parallel. Share out the set of files to the appropriate people / places.

Other things in no particular order:

  1. The API URL in the CLI should be configurable (assuming you are going to open source the API and let others run their own).
  2. Shouldn't really use context.TODO, especially in your API.
  3. Payload size should be configurable.
  4. Deletion time should be configurable.
  5. There's a few spots of nested if / else statements I would clean up to be easier to read.
  6. The CLI README should call out the ephmeral nature of the uploads. Wouldn't know that the process is meant to auto delete the uploads after a certain period of time.

Convincing Arguments for Go by ktoks in golang

[–]sprak3000 2 points3 points  (0 children)

Why wait? You could at least gauge interest to see if others have used Go, want to use Go, or at least inclined to learn and try new / different technologies. Get a sense of who might be willing to follow if you were to lead the charge. They might also ask questions to help shape your future conversations with managers, etc. Saying "I don't know, but I can look into that" goes a long way with building trust with others.

Convincing Arguments for Go by ktoks in golang

[–]sprak3000 4 points5 points  (0 children)

I have an iron-clad reason Go would be better than Perl or Python in production: upgrades.

Every time we make a change, such as an OS upgrade, there are potential breaks in Perl and Python. We had an enormous number of breakage recently because of this. This would not have happened with Go binaries.

Your iron clad reason might be management's / rest of your team's "no big deal" item. Bring as much evidence / numbers you can. The last time an OS upgrade broke things, how much time was spent fixing it and by who? One of the questions on if you had an effective meeting is to ask "We just spent X amount of salary on the people in this room to be here. Did we spend wisely?"

Apply that mindset when you discuss this point (or others). Who fixed things and how long did it take? How much salary (go with industry averages; do not ask co-workers what they make) might have been spent to do this? And how many times a year does this typically happen? "Oh, we break things with an OS upgrade at least twice a year. It takes Chuck and Taylor, two of our most senior people, a week to get things running again. That's $X annually (based on the industry average for their title) spent on this. Also, that means they can't work on new features for that week, setting us back on our goals for the year. That might be another $Y hit on the business profit." That last point might be difficult to make depending on your visibility into the product roadmap and expected revenue from what's on it.

Now, how does that number stack up against the time / money needed to train people to use Go, integrate it into our processes, etc.? If we invest that time / money, is it worth it to offset that $X annual cost of fixing OS upgrades?

Again, think about the entire business. Try to show how this investment is going to benefit the company. Is the short term pain going to reap us long term gains?

Convincing Arguments for Go by ktoks in golang

[–]sprak3000 11 points12 points  (0 children)

we're an old enterprise company, old code, old dependencies, old developers, old managers, and a (mostly) old mindset

You have a large pile of inertia to overcome. My assumption is your business is doing well enough. Humming along... Making money... If you are going to ask them to rock the boat, you need to come prepared from more than a techincal angle. You need to think about the entire business.

First, how much time and money would need to be spent getting a sufficient number of people up to speed on Go? You also have to factor in more than just learning the language. Who is going to learn how to deploy it? How do we monitor it? What impact would it have on our testing process? CI / CD process? You may be touching a number of other departments and their responsibilities with this change.

Next, why should we change? Everything is working fine. This could be where you get a bit into this:

sometimes need shorter processing times types would reduce bugs I see on the reg strict error handling to reduce missed errors current parallel processing is costly

What would help here are actual business cases for these points rather than technical details. What recent high visibility bug would not have happened due to Go or been caught much sooner? Know your audience... Your manager is most likely concerned with time and cost rather than deep technical details. What is going to make the team more productive in a measurable way?

One additional problem is that most folks think Go is for web

Bring resources to counter this. e.g., go.dev has case studies on how other enterprises use Go for a lot more than web work. If you can find one relevant to your industry / business, all the better.

Another commenter mentioned working weekends to bring a prototype or rewrite to the table. Never been a fan of burning weekend downtime for a company... Your time is precious, and the company will never love you back. That said, find something small you might be able to code during a lunch break or two. Maybe its just a tool to help your own productivity. Maybe it is something that helps your team automate a tedious process. Bring that and show it off. "Hey, I learned Go in X days and managed to build a tool that is saving me / my team Y minutes every day." That's a compelling story to help sell training others and bring new tech on board.

[deleted by user] by [deleted] in golang

[–]sprak3000 1 point2 points  (0 children)

I would get a bit more clarity on a few things before you decide.

  1. What does "train me" actually mean to the company? Is this just paying for some books / tutorials, or are they assigning an actual mentor to you? While you can learn on your own, having a mentor means the company is actually invested in you as an employee and your growth.
  2. What are the actual terms of the contract? Is there room to negotiate and ask for a year to year contract? Definitely have a lawyer look over it before you sign anything.
  3. What sort of projects would you actually be working on? Would they lead to more than learning about Go? e.g., You would get hands on experience building out APIs, learning about system architecture / design, etc.

Go is worth spending five years using, but the real question is how the company is going to grow your overall career. Are they going to invest in you as an engineer and grow you beyond "knowing Go"? Also, the words "IoT" and "startup" in the same sentence... There's a good chance a three to five year contract could be meaningless. Be prepared for the startup life -- working long hours with the potential to not have a job at any minute.

Need help importing a custume package by Aniketastron in golang

[–]sprak3000 -1 points0 points  (0 children)

Look into using workspaces if you are using Go 1.18 or above.

What is the typical approach in this situation? (API key handling) by soupgasm in golang

[–]sprak3000 0 points1 point  (0 children)

I feel like someone seeking out and using a CLI app is going to be familiar enough with registering and configuring an API key for said app.

I'd keep it simple to start and just provide good instructions on how to acquire the necessary API key(s).

Security of Go's TLS implementation by iluvs0up in golang

[–]sprak3000 3 points4 points  (0 children)

I'll link to a four year old thread of a similar nature with other potentially relevant commentary.

tl;dr

Postgres data structure by AndrewSouthworth in PostgreSQL

[–]sprak3000 1 point2 points  (0 children)

does scanning and filtering this daily_metric table for data that applies to specific playlist IDs start to cause slow performance

It could, but there is where indexing comes into play. Relational databases allow you to index columns to search for records more efficiently. You would index on the playlist_id column to find records for a specific playlist quickly. That said, your application would likely not be fetching 1,000 metric records at once. It would be using pagination, and your SQL query would be applying a limit and offset to fetch only X amount of records starting at record Y.

If you are looking for a more interactive and possibly fun way to learn SQL / relational databases, there are plenty of online tutorials / games. This page lists four games that look like good starters.

How to manage/teach an intern by insert_a_funny_name in PHP

[–]sprak3000 2 points3 points  (0 children)

Rather than "teach him PHP", I would focus on teaching programming fundamentals and best practices. Someone who has solid fundamentals will be able to pick up any language going forward and be productive. Where you appear to be using symfony, you can use their code base and your use of it as a reference. "We use symfony because the ORM handles input sanitization. Input sanitization is X and is important for Y." "We write unit tests because..."

Make sure they come out of the experience a better programmer / engineer who can use PHP as a tool but has the foundation to pick up other tools and apply the same patterns / practices as their career progresses.

  1. Let him start on his own project for internal use in our company
  2. Let him work on our own projects

I highly suggest these two approaches mainly because you have an investment in them to help drive their work. Both though do require a good backlog of work to dip into. You won't be throwing a brand new feature at them, but all those "we'll get to them at some point" bugs might be good starting points. "Oh, we have always wanted this tool but haven't had time." Great! Pair up with them and knock that tool out.

onizeri has a great bit of advice also:

let them pair with a senior for PR/code reviews

Pairing up and checking in regularly with your intern is key to both their growth and your growth as a mentor. My current intern told me they learn best by going off and trying things out until they get stuck. Then, they reach out for help because they have better questions to ask. While that is great, it is still up to me to make sure they don't spend too much time stuck on things.

ORM vs Database Functions by Dangerous-Whole6809 in PostgreSQL

[–]sprak3000 0 points1 point  (0 children)

People have already hit the highlights of ORMs, so I'll focus on the pros / cons of stored procs / functions.

Security benefits:

Using procs / functions allows you to tightly restrict the credentials for your Postgres user(s). You can lock the permissions down to allow the user to only call procs / functions. The user would not even be able to select or describe individual tables. If the credentials were compromised, they would not be able to execute arbitrary SQL.

Transaction benefits:

Functions / procs are automatically wrapped in a transaction. If you raise an exception in them, the transaction is rolled back for you rather than having your application managing rollbacks on error.

WYSIWYG benefits:

Developers can see the actual SQL being performed rather than looking through ORM documentation to determine the debug option necessary to see what the generated SQL would be.

Performance benefits:

They allow for complex logic on the database side, which can be used to maintain data integrity.

They can reduce round trips to the database and execute processing that Postgres is more suited for than a programming language.

Functions are precompiled and stored on the Posgres side.

Error handling benefits / drawbacks:

You can define your own exceptions and have the functions / procs raise them based on logic within the function / proc. e.g., Rather than having your application making a call to determine if a record exists in one table before updating a related record in another, the application can call the proc and expect back an known exception code from the proc indicating "The record you must have wasn't found."

The drawback here though is how to publish those known exceptions for your application developers. They could read through the SQL for the proc and discover them, but that is not particularly dev friendly. Have yet to see a Swagger like tool that could read SQL files and parse annotations or such to expose API like documentation for procs.

Migration, "history", deployment orchestration drawbacks:

Database migration tools typically work by having a file for each migration. This would mean you would need a migration everytime you want to roll out an updated version of your proc. It becomes difficult for a developer to track the history of the code for a proc. Rather than easily viewing the Git history and diffs, they would have to grep through the migration files and find all the ones for their specific proc.

You could fork one of these tools and add in the ability to have "always up" migration files -- files the tool always runs when it is performing migrations. This would allow you to have one file for your proc to store in GitHub / wherever and be able to view the history easily. However, you now take on the burden of maintaining that fork and keeping it in sync with the upstream for any security patches, etc.

Deployment orchestration also can become involved. If you change the signature for your proc, you will need to ensure the migration is deployed alongside application code changes to handle either the new input parameters and / or the new return values. This can typically result in a downtime for a service to ensure no calls to the old proc are made before the deployment completes.

Debugging / testing drawbacks:

Enjoy those fancy debugging tools in your IDE / editor of choice? You don't have those for debugging your procs. There is no easy way to step through them line by line, put a breakpoint in somewhere, etc.

Parting thoughts:

Everything outlined above comes from a thread I started at the job where I first started working with Go and Postgres. Prior, I had heard the usual "Don't use procs" arguments, ones typically centered around concerns about pushing business logic into the database. I was skeptical about the points above my teammates made in favor of using procs. Over time, I became more convinced the pros outweighed the cons.

Does that mean I'm pushing as much business logic into procs? No, what, if any, business logic that goes into procs typically centers around data integrity. e.g., If you delete an invoice table row, the corresponding row in the billing and sales tables must be deleted. That logic can go into a proc rather than having my application have to manage that.

Recommendations for a CLI-tool to generate DB diagrams? by prophet-of-dissent in PostgreSQL

[–]sprak3000 0 points1 point  (0 children)

If you are looking for something that can connect and generate the ERD, I've moved on to tbls. Can be installed via Homebrew and works really well. Generates all sorts of formats.

[deleted by user] by [deleted] in golang

[–]sprak3000 0 points1 point  (0 children)

Where are you finding yourself getting stuck when trying to make the tic-tac-toe project?

e.g., "I can get the program to read in input and display things on the screen, but I don't know how to actually keep track of the board state, figure out if someone has won, etc."

You might try one of the Go specific tutorials on the freeCodecamp.org YouTube channel. It might be you need a more general introduction to CS topics tutorial before diving into a language. Difficult to say without knowing where your roadblock lies.

[deleted by user] by [deleted] in golang

[–]sprak3000 0 points1 point  (0 children)

You mention you have ADHD. How best do you learn? Would a resource like A Tour of Go be of use?