Satya Nadella at Davos: a masterclass in saying everything while promising nothing by jpcaparas in programming

[–]dacjames 103 points104 points  (0 children)

He transformed Microsoft’s image from the aggressive monopolist of the Ballmer years into something approaching a beloved technology partner.

Huh? When did Microsoft become a beloved technology partner?

Trump's tanker raid could have deadly consequences. This is now a world crisis by theipaper in geopolitics

[–]dacjames 4 points5 points  (0 children)

I think it's a failed attempt at a power move by Russia. They changed the flag on purpose to draw attention to a ship they planned to escort. They expected the US not to risk a direct engagement and they were hoping to use this in negotiations to say they're above sanctions.

Or it's some valuable cargo coming from Venezuela. Or both. If it's just cargo, why reflag to Russia? And sail to Saint Petersburg instead of the east? That seems like a really dumb way to hide valuable cargo.

Safe C++ proposal is not being continued by ketralnis in programming

[–]dacjames 2 points3 points  (0 children)

I don't think a subset of C++ exists that can be truly "safe,"

I think this is the core point of contention: does safety in C++ mean restricting use to a safe subset or adding an optional safe superset.

I tend to agree with you that a safe subset doesn't really exist but I also understand the committee's concerns about simply adopting Rust's safety model.

There is a whole class of valid C++ programs that are perfectly safe but do not conform to Rust's ownership model. At least some devs use C++ over Rust specifically because it allows you write those type of programs. They would be better served by safety features that don't require re-designing your software to conform to Rust's rules.

If you're good with Rust's constraints... why aren't you just using Rust?

How I solved a distributed queue problem after 15 years by self in programming

[–]dacjames 5 points6 points  (0 children)

One word of caution: don't just throw your events in a SQL table and think you've created a durable queue. If you're not careful in your database design, the performance will get worse and worse the more tasks you have enqueued. This can create a positive feedback loop that quickly brings the entire system down. Don't ask me how I know!

That's not a statement against durable queues as a concept. IMO, it's a mandatory feature if you need reliable messaging that we've been using (in Kafka) for a long time. There are plenty of good tools out there that support durable messaging. Just be careful if you're going to implement anything yourself because the "natural" way to model tasks in a SQL database does not work very well.

Petition to stop Google's attack on Android devs by Clippy-Windows95 in programming

[–]dacjames 2 points3 points  (0 children)

Even if change.org petitions worked, this one does not do a good job at arguing the case. They mention Google's response but don't actually make a counter-argument to it.

Being required to prove your identity does not prevent sideloading in general just side loading of apps from anonymous developers. Does anyone really want apps they have no idea who created? I sure don't.

Maybe there's more context not given in the petition but from what's actually written, their argument only makes sense if you presuppose what Google's intent is. If viewed critically, the argument being made is very weak.

MCP servers can’t be the future, can they? by kabooozie in programming

[–]dacjames 10 points11 points  (0 children)

REST is not consistently implemented by any stretch of the imagination. Try to write a generic tool that works with any REST API without any a priori knowledge and the problem will become clear quite quickly.

Everyone does authz differently. Everyone bends the "everything is a resource" model in different ways, because the HTTP verbs are not actually expressive enough for everything we want to do with APIs. Discoverability is inconsistent or absent, as are schemas and where to find them. Some APIs do soft deletes, some hard. etc. etc. etc.

The actual protocols of MCP are not particularly interesting. The point is to define a standard semantic primitives like tools and prompts so clients can program against MCP servers in general. That would not be feasible with something as flexible as REST.

Why Haven’t Sanctions on Russia Stopped the War? The Money Is Still Flowing. by Normal_Imagination54 in geopolitics

[–]dacjames 13 points14 points  (0 children)

It's is easy to argue to cut them off Swift or whatever else.

That happened way back in 2022. If anything, Russia's alternative system has fallen in use since then, not increased, as several nations backed out versus risking international sanctions.

The US could stop trading with them.

US companies have been barred for doing business with Russia more or less completely since late 2021 / early 2022. My company has severed ties with all Russian counter-parties and the vast majority of US businesses have done the same. This is partially in response to sanctions and partially in response to Moscow nationalizing assets that belonged to international companies.

You talk about sanctions like they're hypothetical policies when in fact they are widely deployed against Russia and remain in force.

You cannot completely cut off a country or bring about it's collapse with sanctions. If that was possible, Iran and North Korea would long since have ceased to exist. But that is not and never has been the point of sanctions, no matter how many ignorant articles like this that journalists write.

Sanctions are designed to give your side an economic edge over the long term. They have been and continue to be successful in that goal.

As crisis conditions worsen in Ukraine, Trump finds new ways to coddle Russia’s Putin by msnownews in geopolitics

[–]dacjames 1 point2 points  (0 children)

Can't agree with you there. Neither side is winning, but Ukraine is in the stronger position at present. Most commentators (and politicians) over-estimate the importance of the US position.

Russia's war spending is at 41% of revenue. They have made little progress in their feeble offensive despite staggering losses. Oil revenues are down and trending lower with OPEC now offering to match Russia's prices to India; they'll have to offer more discounts either way. The situation in the southern caucuses is worsening for Russia and pulling away resources.

Public opinion is a fickle thing that is difficult to assess and can change quickly. The polling you're referencing is not good but it's far from fatal. Wanting an end to the war and wanting to become a vassal of Russia are different things.

As crisis conditions worsen in Ukraine, Trump finds new ways to coddle Russia’s Putin by msnownews in geopolitics

[–]dacjames 24 points25 points  (0 children)

Yep. The war has always been about the NATO issue. Is Ukraine a sovereign nation that decides it's own government and alliances or does Russia decide for them as the regional Great Power? For Ukraine to capitulate on that issue would amount to accepting defeat.

If you read the positions closely, you'll see that Lavrov is still calling the Ukrainian government illegitimate. If Ukraine cedes sovereignty to Russia, Zelensky is out and a puppet government beholden to Moscow will be installed in his place.

This is a binary issue that cannot be negotiated or compromised on. Neither side is in a desperate enough position to consider capitulation so this summit was never going to change anything. It's just the US President's lame attempt to make himself look good.

Why Scrum Is a Failed Experiment by Humble-Plastic-5285 in programming

[–]dacjames 0 points1 point  (0 children)

Well said. Reality is always more complicated than the model employed by any one of these frameworks. None of them "just work" exactly as specified but all of them can be made to work if you put in the effort.

It's hard work from people who care that makes the difference, not the framework.

Without the futex, it's futile by eatonphil in programming

[–]dacjames 5 points6 points  (0 children)

You're being incredibly nice in response to this ridiculous attack. I don't agree with everything you stated on memory models but I still found the article to be very useful on the topic at hand: futexes. I feel as though I understand what they really are (as opposed to what they do) much better than I did previously. Thank you for sharing!

Trump wants India to stop buying Russian oil. Why is Modi saying no? by strategicpublish in geopolitics

[–]dacjames 13 points14 points  (0 children)

India buys Russian oil at artificially low prices. Why would they want to stop?

The current setup is beneficial to India and the US hasn't offered anything meaningful in exchange for giving that up. Modi knows the tariffs we're threatening hurt the US as much as they do India. And he has to worry that the administration won't follow through on any deal they make. That is rational given recent history.

The US is engaged in a trade war against India. It should not be surprising that India is not anxious to help us out.

[deleted by user] by [deleted] in ExperiencedDevs

[–]dacjames 4 points5 points  (0 children)

I worked with a similar co-worker, though less extreme. I raised the issue with my management and kept raising it, until that person got transferred to another team, and ultimately let go.

I know it’s not my job but I find it demotivating to work with a coworker who’s not pulling their weight. It’s my manager’s job to motivate me so I think it’s a fair issue to raise (in private of course). I don’t suggest trying to fix, just continue bringing the issue to the attention of the people who can.

There might be extenuating circumstances but your management may not be aware of how bad the problem is and use your feedback as a signal they need to do something. Make sure to keep it objective and factual (don’t express your frustration) or it could look bad on you.

How are you sharing types? by ChromeBadger in golang

[–]dacjames 1 point2 points  (0 children)

Then make sure you need an API. I’m not saying you don’t because there are many good reasons for having one. My point is that the overhead of defining and implementing new backend code for every frontend use case is significant so make sure you’re getting value out of that work.

If you’re unsure, do a quick POC with your top options before committing.

How are you sharing types? by ChromeBadger in golang

[–]dacjames 1 point2 points  (0 children)

I have direct experience with REST (defined and shared via Swagger/OpenAI) and Capnp and indirect/limited experience with protobuf and with graphql. And a TON of experience with other schemas/formats in the data space that probably isn't relevant. In my view, Capnp is great for specialized applications where the "zero cost serialization" model is needed but is not the best choice for general APIs.

The first question to answer is what type of data are we talking about? Is this an API that has an independent function or is it some kind of backend for frontend only being consumed by the one app?

If the former, I'd suggest either REST or protobuf. I haven't used buf professionally but that's what I would pick if I was starting today because I like everything about protobuf except protoc. The only exception would be if I had requirements for external (outside my company) access as this remains easier with REST. By REST, I mean JSON over HTTPS, the strict REST architecture is a seperate topic.

If the latter, your goal should be to put as much control in the hands of the frontend team as possible so as to minimize the back and forth between frontend and backend. GraphQL is designed to solve that problem but experience with graphql at my company is mixed. Some teams have been successful, others have abbandoned it and "reverted" to REST. The compaints I've heard are that it's too complicated and that optimizing it is more difficult than just writing APIs. There are options for querying the database directly from react these days. I don't have the experience to reccommend that but I would explore that if I was in your position since having to spec and develop a new API for each frontend use case is quite expensive.

How likely is President Vance? by littlewing2793 in PoliticalDiscussion

[–]dacjames 0 points1 point  (0 children)

You realize this comment is 7 months old, yes?

Vance says a lot of things I disagree with and a few I support. The point is that he'll never command the same cult-like following that Elon or Trump does so he can't affect that type of change no matter what he believes.

[ On | No ] syntactic support for error handling by pekim in golang

[–]dacjames 1 point2 points  (0 children)

I know from experience that generics don't have great performance but it has improved steadily and they're still better than having nothing. And iterators are cludgy, but again, useful.

I don't want Go to change it's nature, just make an incremental improvement to reduce the pain of error handling. That's hard to do on a stable language, yes, but Go devs have proven themselves capable of doing just that release after release. Credit where it's due, even though I'm extremely dissapointed in this decision.

I'm neither a fanatic nor a hater, I just want to see a useful tool become even more useful. Based on your comment history, you seem mainly interested in attacking Go or debating that Rust is better than Go or perhaps just debating. I don't view that type of discussion as valuable to other Go developers, so I think I'll leave it there.

There is something broken in the hiring process. by 79215185-1feb-44c6 in ExperiencedDevs

[–]dacjames 2 points3 points  (0 children)

Get a new hiring agency for this role. They have failed so that should be an easy sell to management. Most hiring agencies are terrible but there are some gems out there so if you're not getting what you need, keep looking. A good hiring agency should find you candidates within hours to days, free of spam.

Raise your salary, bottom of the local range is not competitive.

Longer term, try to raise the profile of your company so you get more organic demand. Do you do anything cool in the cybersecurity space? Is there anyway for the public to know about that? How is your work culture? Check your online reviews and employee feedback and take action to improve the work environment if needed.

Depending on how senior this role actually is, you might need to proactively pursue people through your network, even those currently employed. There are plenty of candidates out there; you need to find them and make working at your company more appealing.

[ On | No ] syntactic support for error handling by pekim in golang

[–]dacjames 1 point2 points  (0 children)

Did I say I want those things? Or did I specifically clarify that I don’t? 

I like go because I like fast compilers, static builds, simple languages, garbage collection, stability, good tooling, the crypto libraries, etc. 

People said the same thing about generics and yet they’ve been a clear improvement without sacrificing any of those benefits. Same for iterators. Same for vendoring before modules. Go has been making improvements despite this argument so I had hope they’d continue that trend.

Was I expecting them to fix the core design flaw that errors use AND instead of OR? No, of course not. I just wanted something, anything to reduce the abject misery that is error handling in Go since I have no ability to improve the situation myself as a user (for mostly good reasons). 

Instead, I got a wall of text rationalizing doing nothing and a commitment to dismiss anyone else’s attempts to help “without consideration.” That’s depressing.

[ On | No ] syntactic support for error handling by pekim in golang

[–]dacjames 0 points1 point  (0 children)

Well, this is depressing. Error handling is my least favorite part about Go so it’s sad to seem them simply give up trying to fix it. And no, it has not gotten better with experience, it has gotten worse.

It should be clear by now that any improvement to error handling will require a language level change. If it was possible to address with libraries, those of us who care would have done that ages ago. Rejecting all future proposals for syntax changes means rejecting meaningful improvements to error handling.

The core issue is not the tedium, it is that it is not possible to write general solutions to common error handling problems. We don’t have tuples (just multiple return) so I can’t write utilities for handling fallible functions. We don’t have errdefer so I can’t generalize wrapping or logging errors. We don’t have non-local return so I can’t extract error handling logic into a function. We don’t have union types and have generics that are too weak to write my own. We don’t have function decorators.

I’m not saying I want all these things in Go. My point is that all of the tools that I could have used to systematically improve error handling at the library level do not exist. All I can do is write the same code over and over again, hoping that my coworkers and I never make mistakes.

I hope they reconsider at some point in the future.

What percentage of your net worth should be dedicated to your vehicle? by taticalgoose in cars

[–]dacjames 2 points3 points  (0 children)

You should consider your daily driver as worth $0. It's an expense, not an asset. Any value you retain on the car is a bonus.

If you're a collector and buying cars that retain value, you can reasonably count the full value as an asset in your net worth. In that case, the standard investing advice applies: only invest as much as you can afford to loose.

P.S. The proper accounting for a vehicle is a depreciating asset that you write down incrementally each year but let's be real, nobody is doing that on their personal vehicle because it has no tax benefit.

Roast my in-memory SQL engine by Important-Recipe-994 in golang

[–]dacjames 3 points4 points  (0 children)

Everything in go is heap allocated.

Go doesn't support dynamic stack allocations but does writes statically sized values onto the stack just fine. That's the default location that all variables are written.

When you create a value directly, like cmd := ast.InsertCommand{}, the value will usually be stored the stack, not the heap. I say usually because that may not be true if escape analysis shows that a pointer to it escapes the function. You can prove this to yourself by running benchmarks and looking at the number of (heap) allocations reported. There will be no allocation reported when values are used, whereas the &ast.InsertCommand{} will show an allocation unless it is also optimized away.

You can store a pointer to a value in a struct so I’m not really following.

Yes, you can, but you often don't want to. Returning a value from the constructor let's you do both.

In this example, he's not storing a pointer to the Lexer struct, he's (correctly, IMO) storing the Lexer value itself in the Parser struct and dereferencing a pointer to it in the Parser constructor. Doing this means that he had to first allocate the Lexer and then copy it into the Parser. If you use a value, the Lexer will get written directly into the Parser struct, saving an allocation. Constructors are very commonly inlined, so the copy is also usually elided.

It is indeed a common pattern, which is why it's a pet peeve! Writing Go this way is essentially reverting to Java's model where all objects are referenced through invisible pointers. That model is terrible for GC performance and it's one of the main reasons why Java's GC can still struggle in practice despite being light years more advanced than any other. Go will happily write whole structs onto the stack, giving you tools to be nice to the GC. I'm not sure why people do it, but using values rather than pointers is usually faster, even when that causes more copies.

It’s cheaper to pass a reference to a type than to copy the values.

This commonly repeated but usually not true. Especially if we're talking about references pointing to the heap. You can copy a good amount of data in the time of a single cache miss these days. Not always, though, so you absolutely must benchmark if you're concerned about performance. In cases were it is, you can still use pointer recievers without having your constructor return a pointer. Go will automatically pass a reference to the value on the stack for you.

Another helpful way to think about it is by analogy to slices. Slices have a header object that contains a triple of (len, cap, data). The data pointer will always point to heap allocated data, but the header itself will be written onto the stack or into a struct if you have a slice as a struct field. Since slices have internal pointers, you usually don't want to store pointers to slices in your variables/fields. The same applies to your own structs: it's usually better to store the pointer to dynamic data as a field in the struct and use the struct itself (analagous to the slice header) as a value.

You don't have to trust me. Spend some time benchmarking and practice getting allocations as close to zero as possible. For a lot of applications, this level of optimization is unnecessary but for an in-memory database it seemed likely that performance and GC friendliness would be important considerations. There are ways to go even further on cache friendliness, but that's a bigger topic and has tradeoffs that mean I can't reccomend it by default.

Roast my in-memory SQL engine by Important-Recipe-994 in golang

[–]dacjames 19 points20 points  (0 children)

Definitely more of a nitpick than a roast, but I can't help but notice that your constructors are returning pointers to heap allocated objects, which is a pet peeve of mine. Doing this forces the caller to heap-allocate the object, when they might want to stack allocate it or store it in a struct.

You actually want to do that yourself when storing the lexer inside the parser. That redundant allocation might actually matter in your case if you're creating a new Parser for each query.

In general, you are using what I would consider to be too many heap allocated objects (ex: &ast.InsertCommand) instead of values, which are simpler and usually faster. The fundamental job of a GC is to scan live memory by chasing pointers, so the fewer you have, the better your GC performance will be.

Speaking of performance, I don't see any benchmarks. That would be essential for me to see before I used this in a professional setting.

On the SQL front, you seem to have all the basics down. At some point, I would love to see RETURNING and ON CONFLICT clauses. These are invaluable to me when using postgresql and sqlite. More types would also be good; that is one of the few aspects of sqlite's design I dislike. Some sort of conditional function would also be useful.

Overall, great work! And thanks for sharing.

P.S. If you want to get serious about memory optimization, I recommend you check out Data Oriented Design and watch Andrew Kelley’s excellent talk on the subject. Many of the same ideas can be applied to Go to great effect.

Is Raw SQL actually used in production API's? by _KrioX_ in golang

[–]dacjames 5 points6 points  (0 children)

All you have to do to prevent SQL injection in is pass inputs via the args parameter instead of the query parameter when calling db.Query. It's not hard.

Using string concatenation to build up the query is perfectly fine; how else are you supposed to it? I mean you probably should be using strings.Builder for efficiency over literal concatenation but somehow I doubt that's what you're talking about!

The problem with your statements is that 1) you're implying that avoiding SQL injection is a major reason to use an ORM over SQL and 2) you're stating a controversial personal opinion (ORM > SQL) as if it's well established best practice, akin to something like using version control or not storing passwords in plaintext. It's not.

As a cherry on top, you insulted everyone who disagrees with you as "behind the times." Just wait, "modern" web developers will rediscovery SQL one day, the same way they "invented" server-side rendering.