For people who like null jokes. I'm not sure if that's an urban legend or not, but it's a strange story.

https://www.wired.com/story/null-license-plate-landed-one-hacker-ticket-hell/ (use anonymous mode if the site is giving you a hard time)

JOSEPH TARTARO NEVER meant to cause this much trouble. Especially for himself.

In late 2016, Tartaro decided to get a vanity license plate. A security researcher by trade, he ticked down possibilities that related to his work: SEGFAULT, maybe, or something to do with vulnerabilities. Sifting through his options, he started typing “null pointer,” but caught himself after the first word: NULL. Funny. “The idea was I’d get VOID for my wife’s car, so our driveway would be NULL and VOID,” Tartaro says.

The joke had layers, though. As Tartaro well knew, and as he explained in a recent talk at the Defcon hacker conference, “null” is also a text string that in many programming languages signifies a value that is empty or undefined. To many computers, null is the void.

That setup also has a brutal punch line—one that left Tartaro at one point facing $12,049 of traffic fines wrongly sent his way. He’s still not sure if he’ll be able to renew his auto registration this year without paying someone else's tickets. And thanks to the Kafkaesque loop he’s caught in, it’s not clear if the citations will ever stop coming.
[...]

He can thank Tony Hoare for that. ;)

 
Rust fact vs. fiction: 5 Insights from Google's Rust journey in 2022:

https://opensource.googleblog.com/2...-insights-from-googles-rust-journey-2022.html
My impression and what I've read about that:
  • 2-3 weeks (27%) to be confident in most areas of Rust is just fantasy; even 1-2 months (39.8%) seems a very short time. It all depends what 'confident' means, of course. It's possible to read a book in that time, but the experience to write code confidently in real conditions will take longer, unless you don't need some features like references and multithreading.
  • The difficult areas: macros aren't difficult (they're actually quite fun), but ownership definitely is. I suppose async is, by nature, but I haven't done much of that in Rust. The absence of inheritance makes it challenging to translate the underlying concepts efficiently in Rust code, too. The programmer has to let go of a few common paradigms, which is not intuitive. If you need to port a Java or C++ library, you often have to change the whole architecture.
PS: Declaring a reference as 'static' when it's on the stack? :eek:;)
 
I'm actually toying with the idea of writing a book with all the techniques that we need to discover during the learning process, such as: how to create a builder, how to translate inheritance, how to create a procedural macro, how to make an iterator, etc. I missed that quite a few times. :)
 
I'm actually toying with the idea of writing a book with all the techniques that we need to discover during the learning process, such as: how to create a builder, how to translate inheritance, how to create a procedural macro, how to make an iterator, etc. I missed that quite a few times. :)
If you do that, I generously offer to read what you write during the process. And learn Rust at the same time. :)

pibbuR
 
Last edited:
git.png


pibbuR who has never used git, but installed it in Visual Studio nevertheless.

PS. I have implemented source control using robocopy and on line storage of backups. DS.
 
I just followed the example I found here: https://www.tutorialspoint.com/rust/rust_string.htm

fn main() {
let company:&'static str = "TutorialsPoint";
let location:&'static str = "Hyderabad";
println!("company is : {} location :{}",company,location);
}

pibbuR who doesn't know Rust. Yet.
Sorry, I was kidding. The funny notation (the &'<something>) is called a lifetime annotation, it helps the compiler know how long data live when it can't deduce it. Things that are on the stack don't live past the end of the function since the stack is destroyed when it returns. But the string literal is an exception; they live forever (static) because the compiler is clever and stores them with the constants. In the example, these annotations are optional since the compiler can deduce it - don't worry, you won't have to write lifetimes very often.

It's almost a private joke, since these lifetime annotations can be a source of complaint from the compiler. When people have to fight the compiler over this (it's turn-based combat), they're often tempted to put a static lifetime to win, but it's cheating.

If you do that, I generously offer to read what you write during the process. And learn Rust at the same time. :)
Thanks, I welcome the offer!
It could be very boring to read, so you may regret this. (If I do it) ;)

pibbuR who has never used git, but installed it in Visual Studio nevertheless.

PS. I have implemented source control using robocopy and on line storage of backups. DS.
I find git ... err, fun? As in 'it's difficult so it's going to be fun'. But it's a great system.
This interactive tutorial is a nice way to visualize how it works.
 
Yet another language:

Problems of C, and how Zig addresses them (https://avestura.dev/blog/problems-of-c-and-how-zig-addresses-them)

A quote:
... C has almost no abstraction over memory. This has pros and cons:

  • Pro: One has full control over memory and can do whatever one wants with it
  • Con: One has full control over memory and can do whatever one wants with it

ApparentlyCzig offers (at least to some degree) the flexibility of C and the security of Rust.

pibbuR who will never use it because it reminds him of zigarettes (typo intended) which he finds extremely yeeeeeechy.
 
I'm about to start some work on a sabbatical project (no, a sabbatical is *not* a holiday !!!! Sore point ;) ...and I'll have to use Python since most ML stuff these days is Python based. I have always used C++ for projects, and Python...well, I hate not seeing at a glance what the type of any variable is :/ And I don't think Pythonically - Another offender is Numpy - which uses broadcasting rules to reshape matrices etc, but often in ways that are mathematically non-nonsensical (at least to me). I think I understand the conventions mostly, but always fretting about making an error that I don't notice. Somone jokingly suggested using Rust, but that seems like too much of a departure from what I know - I need to be a productive as I can as soon as possible. Learning a new language is a luxury I don't have time for....if that makes sense?
 
...Learning a new language is a luxury I don't have time for....if that makes sense?
Sad, but true.

unless you're like pibbuR who is retired.

PS. I'm sure, like almost every human, that Python is a good language. But personally, I don't like it. DS.
 
I'm about to start some work on a sabbatical project (no, a sabbatical is *not* a holiday !!!! Sore point ;) ...and I'll have to use Python since most ML stuff these days is Python based. I have always used C++ for projects, and Python...well, I hate not seeing at a glance what the type of any variable is :/ And I don't think Pythonically - Another offender is Numpy - which uses broadcasting rules to reshape matrices etc, but often in ways that are mathematically non-nonsensical (at least to me). I think I understand the conventions mostly, but always fretting about making an error that I don't notice. Somone jokingly suggested using Rust, but that seems like too much of a departure from what I know - I need to be a productive as I can as soon as possible. Learning a new language is a luxury I don't have time for....if that makes sense?
I wouldn't use Rust, because I doubt AI has reached maturity in its ecosystem (https://www.arewelearningyet.com/), but also because it's not the best language for prototyping. Its main advantage is being safe, which comes at the cost of being more careful when writing code (or the compiler will bite you). It's also very fast, but you probably won't need that if you rely on a GPU for most of the processing.

Python seems to have a good support for AI; all the people I know use it to do AI research. I like Python for many things, but I have the same issue as you with dynamic typing. Making large projects based on this is a challenge - even more if you need to work on it with other people, but I suppose it's not the case if you're on holi on a sabbatical. It's also slower if you have big matrices to post-process. But it's interpreted and you can fiddle in real-time with whatever you're doing.

Aren't there good C++ libraries that you can use? I prefer a language I'm comfortable with for that sort of things, so I can focus on the research and not fight against the language.
 
There are a smattering of C++ ML libraries (last time I looked), but simply way less existing support in terms of pre-existing code that I can build on top of. It's possible to write modules in C/C++ and then call them from Python, but from what have heard that is rather painful.... I'm still thinking about the problem I need to tackle, so I'll delay choosing my implementation languages/frameworks until I have a clearer view. Well, to be honest I'm *not* thinking about the problem, I'm avoiding thinking at all and playing games :p (don't mention the H word!) tomorrow - tomorrow I'll start in earnest :cool:
 
It's not too painful. If you need to write a part in C++ and another part in Python, you can use Python bindings. I haven't done that since Python 2, however, so it's a 'take my advice but don't quote me' thing.

For games, you should stick to Unreal Engine ones, since they're native C++. You can then pretend to study the interface to the GPU. ;) Yes, tomorrow sounds good, indeed.

More seriously, when I face those difficult questions of choice, I start by discovering the lie of the land and trying a few things, starting with the solutions I'm most comfortable with (after the customary procrastinating, of course). Experimenting is fun, and I often end up with a mock-up of what I want and more confidence to tackle the real thing.
 
python.png


pibbuR who admits that Python is a good language. But that doesn't mean that he has to like it. Which he doesn't. Just like Java (just as ugly).
 
In D&D 5E, you need to eat and drink each day, so each time you make a long rest. You can actually have less to some extent, but let's simplify.

In Baldur's Gate 3, they simplified it to 10 'supplies' per day per party member. So you need 40 supplies if you want a long rest. You can loot and buy food that count for various units: a salami is 6 units, a bottle is 4, and so on (each being indivisible, but you can have several of them).

They implemented an "auto-select" feature to make it easier. But I noticed it often took 10-20 % in excess, which piqued my curiosity. Why the excess when there are still 15 packs of 40, each fitting perfectly, or when I can fall back to the right sum by removing 2 or 3 items?

It turns out it's one of those NP-complete problems, that's why. A similar problem is the 0-1 Knapsack problem, except the sum must be >= target instead of <= target.

I haven't tried to solve it, but I guess neither has Larian. I bet their solution just adds pseudo-randomly selected stuff until it has enough. What a waste! :D
 

Attachments

  • wasted_supplies.jpg
    wasted_supplies.jpg
    107.4 KB · Views: 1