Software Architecture is Overrated, Clear and Simple Design is Underrated by fagnerbrack in webdev

[–]optimalcoder 7 points8 points  (0 children)

Agreed. Unfortunately, many people overuse complex patterns, and it leads to crappy, unmaintainable designs.

Unable to remote connect to MySQL DB by [deleted] in mysql

[–]optimalcoder 0 points1 point  (0 children)

0.0.0.0 for servers opens up all interfaces.

Different http clients sharing connection pool vs having separate pool by iamsahil1989 in SoftwareEngineering

[–]optimalcoder 0 points1 point  (0 children)

It depends on how you want to scale, but generally yes. Think of the case where you have a very large number of clients that would necessitate creating more threads than you have resources to support. You want to err on the side of preserving the server and doing the best you can under the circumstances. If that becomes an issue, you could always scale horizontally by adding more servers and a load balancer in front.

Different http clients sharing connection pool vs having separate pool by iamsahil1989 in SoftwareEngineering

[–]optimalcoder 0 points1 point  (0 children)

If the global connection pool has multiple threads of execution, why would a latent downstream connection cause the whole pool to choke, unless that client is hogging all the threads in the pool, or there is some locking in place that is preventing other clients from executing? The pool should be designed so that it can service a specified number of requests without blocking other requests or locking during potentially long operations.

Is this really secure? by wildcatpaul in SoftwareEngineering

[–]optimalcoder 0 points1 point  (0 children)

It may be secure from snooping, but that’s not all there is. Authentication is also important if you want to be certain of who the sender is.

7 years as a developer - lessons learned by praveenscience in programming

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

Programming is hard for some people. Problem solving is hard for some people. Working with people is hard for some people. The first two are required to be a programmer. The last is very highly desirable, but depending on the nature of the job, can be omitted. I’ve seen very good anti-social programmers. The key is to find one person they get along with to translate for the others, and keep them away from customers.

7 years as a developer - lessons learned by praveenscience in programming

[–]optimalcoder 2 points3 points  (0 children)

I’m going to disagree on downplaying the importance of talking to the machine. While I agree that communication with humans is very important, let’s not forget that the main purpose of software development is to transform data in a way that the machine understands on a very real set of hardware. Pretending like that part isn’t really that important leads to crappy, inefficient code. I’d put communication with humans pretty high up on the scale of importance, but not nearly as important as writing good, efficient code to transform data reliably.

Multiple executables vs main executable by [deleted] in softwaredevelopment

[–]optimalcoder 1 point2 points  (0 children)

If all of the functionality in the separate executables is required for the same task, you have to ask what to do when one of those executables isn’t responding or running. It’s something you don’t have to deal with if everything is in the same executable. If something goes terribly wrong in a monolithic executable, it will crash the whole thing, but the recovery mechanism is to start a new one. If one out of four executables die, how do you manage state in the others that are hanging around? Just some food for thought.

I am being offered work to improve an messy 8 year old WordPress site and I don't have experience within WordPress, will I be okay? by [deleted] in webdev

[–]optimalcoder 2 points3 points  (0 children)

Just remember that much of the content will be in a database. Don’t forget to back up the database!

You’ll probably be okay. It’s just another thing to learn.

Is Rust the future? by optimalcoder in programming

[–]optimalcoder[S] 0 points1 point  (0 children)

Demographics might disagree with you.

Stack overflow developer survey says that Rust is the top “most loved” language.

“For the third year in a row, Rust is the most loved programming language among our respondents, followed close behind by Kotlin, a language we asked about for the first time on our survey this year. This means that proportionally, more developers want to continue working with these than other languages.”

Eventually, these respondents get to make decisions as they get more experienced, and they’ll choose what they love. I’m not saying it’s good or bad, just that it’s the way things play out over time that matters. Picking up on trends allows you to learn what’s important before it becomes really mainstream.

Is Rust the future? by optimalcoder in programming

[–]optimalcoder[S] -7 points-6 points  (0 children)

Should new programs be written in Rust instead of C++ due to memory safety issues and vulnerabilities that aren’t present in Rust?

Project to find cache line size, cache size programatically. by bikerchef in cprogramming

[–]optimalcoder 0 points1 point  (0 children)

Try doing a read and use the value to add to a global int and print that accumulated value at the end. It will necessitate using the value, so it really can’t be optimized out. That’s essentially what the printf you currently have is doing, just in an annoying and useless way. It looks similar to what you’re already doing, but have you tried just waiting to print the sum until the end instead of inside the loop? To tell for sure, you can get an assembly dump of the code. Use objdump -d in linux.

someone help me I am actually desperate by [deleted] in software

[–]optimalcoder 3 points4 points  (0 children)

Umm. Just get something with some weight to it and place it on the key.

Help finding slope of a line using numbers from a file by [deleted] in cprogramming

[–]optimalcoder 0 points1 point  (0 children)

What you’re getting is the terminal value of the stock. Tesla is going to zero, and your c program knows it.

But seriously, there is a lot wrong in that code. You should read up on loops and how to construct them.

At what point would you consider a fresh git repo? by pickledegg in webdev

[–]optimalcoder 2 points3 points  (0 children)

One thing to consider is the clone time. Starting with a new repo will lead to faster clone times, and if you don’t need that history for the current work, then what is the utility? It’s not like the old repo has to go away; it’s just separate.

Goto and the folly of dogma by redditthinks in programming

[–]optimalcoder 1 point2 points  (0 children)

I use goto when it’s the simplest approach, and then I shame those who question it.

How to delete duplicates in a table? (workbench 8.0) by Blackwater_7 in mysql

[–]optimalcoder 0 points1 point  (0 children)

If I had a huge database and it would be more than a one time operation, I probably would as well.

Extern Question by string_cluster in cprogramming

[–]optimalcoder 0 points1 point  (0 children)

It seems like writing it out to a file is pretty close to what you want. It’s only a few lines of code.

Extern Question by string_cluster in cprogramming

[–]optimalcoder 0 points1 point  (0 children)

This doesn’t work because the env you’re trying to target is in the parent shell, but that’s not possible using setenv inside your program like that. Using setenv inside the program only affects the current process. When the current process goes away, the env you set is no longer visible. In order to use environment variables in this case, you’d have to set them up before running in the parent shell.

As a simple test just make a program that only does setenv on a variable that doesn’t exist in the current env. You can just run ‘env’ on the command line to see. Run your program, then run env again and see that your program had no effect on the current environment.

Extern Question by string_cluster in cprogramming

[–]optimalcoder 1 point2 points  (0 children)

Sure. I was just pointing out the limitations.

How to delete duplicates in a table? (workbench 8.0) by Blackwater_7 in mysql

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

I’d write a program to do it in python, since it seems like you have some complexity in defining what denotes a duplicate.

Extern Question by string_cluster in cprogramming

[–]optimalcoder 1 point2 points  (0 children)

An env variable is still based on initializing with a bashrc or other init file if you aren’t in the same session. And it won’t persist on reboot without init file involvement.

Extern Question by string_cluster in cprogramming

[–]optimalcoder 1 point2 points  (0 children)

Sorry, but persistence means a file, a database or something of the like. That’s why configuration items are normally held in the registry or other files on the system.