๐ŸŒธ Mon, May 6, 2024 ๐ŸŒธ

I think studying physics would be a lot more fun if physicists referred to particles as balls. Everything is a ball, and everything is made of balls. “Physics of Elementary Balls.”


๐ŸŒธ Mon, May 6, 2024 ๐ŸŒธ

A well-informed populace, being necessary to the security of a free society, the right of the people to develop, use, and control artificial intelligence technologies, shall not be infringed. ๐Ÿ˜›


๐ŸŒธ Mon, May 6, 2024 ๐ŸŒธ

Just updated the firmware on my laptop, hopefully it will start charging my battery to the level I set, not to some random numbers like 69%. Just checked, nope; it’s stuck on 64%. ๐Ÿ™ƒ


๐ŸŒธ Mon, May 6, 2024 ๐ŸŒธ

Quite often I see the following pattern in C++:

int64_t getSomeValue()
{
    static int64_t cache = 0;
    if (cache)
        return cache;
    // expensive calculation with assigning the calculated value to the cache
    return cache;
}

While this approach might seem effective at first glance, it has several issues:

  1. Magic Value Zero: The code uses 0 as a magic value to indicate that the cache hasn’t been initialized. This can lead to unintended behavior if 0 is a valid result from the expensive calculation. Additionally, using magic values like this is generally considered poor practice as it relies on implicit knowledge.

  2. Not Leveraging Static Variableโ€™s Reentry Protection: The static variable cache is initialized to 0, and the function checks if cache is non-zero to avoid recalculating. However, in C++, static variables are protected from concurrent reentry issues using a mutex during initialization. In the original pattern, the if statement checking cache is not protected with any mutex, so this pattern does not leverage the built-in protection provided by the language.

A better approach would be to use a lambda function for the initialization, like this:

auto getSomeValue()
{
    static auto cache = []() {
        return 314LL; // expensive calculation
    }();
    return cache;
}

With this code:

  1. No Magic Value: The initialization of the static variable cache is done directly through a lambda function that performs the expensive calculation. This avoids the need for a magic value and ensures that the actual result of the calculation is stored in the cache.

  2. Reentry Protection: By leveraging the static variable’s reentry protection, this code is cleaner and safer. The lambda function executes only once, and the resulting value is cached properly. Additionally, this version clearly communicates the intention of performing a one-time calculation.

  3. Improved Readability: In my opinion, this code is easier to read and understand. The use of the lambda function clarifies that the expensive calculation is only performed once, and the result is cached for future use. This clarity enhances maintainability and reduces potential bugs.

In conclusion, the lambda-based initialization pattern is not only cleaner but also takes full advantage of the safety features provided by C++. It’s an excellent way to handle expensive calculations that only need to be done once, while also avoiding the pitfalls of magic values and unnecessary reentry checks. Additionally, it makes the code more readable and understandable, which is always a bonus in software development.

The article was written with the help of ChatGPT 4.


๐ŸŒธ Mon, May 6, 2024 ๐ŸŒธ

My sense of taste changed after wisdom tooth extraction; noticeable change: water has got some hint of metallic taste. I hope I’ll get used to it or my sense of taste will get back to normal.


๐ŸŒธ Mon, May 6, 2024 ๐ŸŒธ

I’ve got an idea for a horror game where the player is an AI assistant, similar to Alexa or Google Mini. Initially, everything seems innocent, with tasks like telling the time or reporting the weather. However, things take a turn as the game starts to gaslight the player into thinking they aren’t a real AI, but a human in a simulation being trained as an AI assistant. The game creates psychological horror by making the player question, “Am I a real human or in a simulation?” There could even be a cutscene where a technician walks into a data center and casually presses the delete button, amplifying the player’s unease.


๐ŸŒธ Sun, May 5, 2024 ๐ŸŒธ

I just noticed I accidentally switched ChatGPT from 4 to 3.5. I literally got angry with ChatGPT earlier today because of how stupid 3.5 is.


๐ŸŒธ Sun, May 5, 2024 ๐ŸŒธ

What’s going on with UI lately? The X and Y coordinates have to be exactly the same on mouse button down and mouse button up. It’s impossible to click on buttons using my Wacom tablet. I remember having struggles on Samsung’s website once, with emoji selection on KDE, and with some UI elements in Bitwig. It’s kind of annoyingโ€”I have to click multiple times and keep my hands extremely steady.

In my opinion, as long as the mouse cursor stays within the area of the button, the button should trigger the on-click event.


๐ŸŒธ Sun, May 5, 2024 ๐ŸŒธ

Elon Musk was advocating for governmental regulation around AI development. I’m not sure what his current stance is. In general, I disagree. Even if he’s right about regulations, if we’re going to have them, they should be worldwide. Again, I want to emphasize that I disagree with regulations altogether.

So, imagine if regulatory laws are created by the US government. And remember, AI is not a toy; it’s a powerful tool. For example, it can influence people’s minds, spread misinformation and hate speech. If the development of AI is banned in the US, other countries can continue to develop AI and deploy AI systems to influence elections in the US, for example. Because AI is regulated in the US, the country wouldn’t have the tools to combat that sort of deployment.


๐ŸŒธ Sat, May 4, 2024 ๐ŸŒธ

I want to have an app that consolidates feeds from multiple microblogging platforms. X is fun, but sometimes it feels one-sided, with everyone praising Elon, dismissing white male privilege, and trolling woke people. At some point, I might get brainwashed. I need some other sources to cleanse my palate, but it takes more effort. If I had an app that allowed me to scroll through X, Threads, and Mastodon simultaneously, that would be great.


๐ŸŒธ Sat, May 4, 2024 ๐ŸŒธ

Use Git, Luke.


๐ŸŒธ Fri, May 3, 2024 ๐ŸŒธ

I have an idea for a game called “Backend Engineer.” The gameplay would be similar to a backrooms experience, but you’d get lost in a data center.


๐ŸŒธ Fri, May 3, 2024 ๐ŸŒธ

Another reminiscence of the early Windows days: We had a “hello world” example for Windows, and everybody was mocking that example for having an extremely heavy amount of boilerplate code. Question to Khronos: Why did you do the same thing to Vulkan?


๐ŸŒธ Fri, May 3, 2024 ๐ŸŒธ

Back in the mid-90s, I heard rumors that Microsoft was adding 3D capabilities to the Windows OS. Retrospectively, we know now that they were working on DirectX, but at that time, I did not understand the motivation behind it. It sparked my imagination; maybe Microsoft was going to make a 3D OS, and I pictured browsing files or the Internet in 3D. Since then, I have been dreaming of that OS.


๐ŸŒธ Fri, May 3, 2024 ๐ŸŒธ

I propose an amendment to the Constitution: Congress shall make no law that abridges the freedom of not listening. ๐Ÿ˜›

Seriously speaking, sometimes I just want to save my time. I have other priorities in my life. So, I appreciate the ability on the internet to mute or ban people. Unfortunately, I can’t do the same in real life. Yesterday, my friend just went into arguing mode, which was completely ridiculous. I wish I could ban him for a day, LOL. Such a waste of time.


๐ŸŒธ Thu, May 2, 2024 ๐ŸŒธ

Look at this from that point of view. Evolution optimized brain consumption to 20W because the source of energyโ€”foodโ€”was the main challenge for millions of years. AI systems are not bound by energy consumption, and we know it is physically possible, as demonstrated by biological systems like the human brain, to be as efficient as using 20W. Currently, I believe AI systems use on the order of magnitude of 200W - 400W just to run inference; training requires way more energy, for example, 10 gigawatt-hours (GWh) for Llama 3. And the results are already very impressive.

AI systems have a lot of headroom; they will not plateau for a long time. They will become better and faster, and this will happen very quickly.

As we witness the rapid advancements in AI-generated music, it’s natural to hold onto the belief that certain realms of creativity, like jamming, remain uniquely human. While it’s true that currently AI may not be able to jam with the spontaneity and emotional depth of humans, history shows us that technological progress often surpasses our expectations. Just as skeptics doubted AI’s capabilities in chess or data analysis, and yet were proven otherwise, we are likely on a similar trajectory with creative pursuits. It’s important to remember that each breakthrough serves not to displace our talents but to expand the boundaries of what is possible. By embracing these advancements, we can open up new forms of artistic expression and collaboration. Letโ€™s stay open to the potential of AI to surprise us, enriching our artistic endeavors rather than diminishing them.


๐ŸŒธ Wed, May 1, 2024 ๐ŸŒธ

It is midnight. Doom-scrolling on X. I should stop doing it.


๐ŸŒธ Wed, May 1, 2024 ๐ŸŒธ

Back in the day, I was trying to understand the meaning of life. It felt like there was no meaning because once you find a meaning, you need to find the meaning of that meaning. For example, if you decide that the meaning of life is to survive, you’ll be stuck with the next question: What is the meaning of survival? And there is no end. You might say the meaning of survival is X, but what is the meaning of X? It’s an endless cycle. At some point, I realized I was asking the wrong question. Perhaps I should be more self-centric and ask, “What is the meaning of my life?” And I think I found the answer: Be happy.

I thought, if someone created me โ€” let’s say God, the Universe, or evolution โ€” there probably was some sense instilled in me that would guide me in determining if I am doing the right or wrong things. And I think that sense is the sense of happiness. Different things make people happy: some enjoy fishing, others hiking; some love caring for children, while others prefer to sit in a dark room programming in C++. As long as you are happy doing what you do, you are doing the right thing and fulfilling the meaning of your life. This discovery motivated me to look into a career in game development because I thought gaming is the best medium to bring happiness to people.

The first year was eye-opening; I discovered that games are not entirely benign. They can cause obesity, addiction, and other harmful effects. I felt bad, possibly for a year or two, and thought I had made the wrong decision. I even considered switching my focus to the music industry. However, at some point, I realized that the harm games cause actually indicates that games have a lot of power, and that power can be channeled for good. This realization is what keeps me in the gaming industry. Games have the power to make people happy.


๐ŸŒธ Wed, May 1, 2024 ๐ŸŒธ

The average human brain consumes 20 W, which equates to 20 Wh per hour, 480 Wh per day, 175 kWh per year, and 3.5 MWh over 20 years. Thus, we have a baseline for training AGI; it should be feasible to train a model using 3.5 MWh of energy, since this is the amount required to support the human brain for the same period. This could cost approximately $600, based on current U.S. electricity rates.


๐ŸŒธ Wed, May 1, 2024 ๐ŸŒธ

The full self-driving (FSD) trial has ended. It feels like the car has lost its soul. One pull down and she comes alive; she has her personality; she makes mistakes, being overly enthusiastic in some cases or extremely cautious in others. Now, it just feels like the car is a soulless metal machine.


๐ŸŒธ Wed, May 1, 2024 ๐ŸŒธ

4.3 in Corona, CA earthquake. The punch was significant.


๐ŸŒธ Mon, Apr 29, 2024 ๐ŸŒธ

Just keep swimming…


๐ŸŒธ Mon, Apr 29, 2024 ๐ŸŒธ

In Unreal Engine, you can hold Alt and drag the right mouse button to zoom in and out. This method works in the viewport, blueprint designer mode, blueprint graph, and possibly many other areas. ChatGPT does not know this, so hopefully, they will include this piece of advice in future iterations of ChatGPT. ๐Ÿ˜œ


๐ŸŒธ Mon, Apr 29, 2024 ๐ŸŒธ

It is really nice here. 83F. But my laptop overheated twice in a row.


๐ŸŒธ Mon, Apr 29, 2024 ๐ŸŒธ

Long time ago, when I had just arrived in the US and was looking for a job, EA Sports contacted me and arranged an on-site test. The test was really hard; it had 10 questions and, as I was not very experienced in programming, I was only more or less confident I had answered 6 out of 10 correctly and felt really bad. I thought: “They will not hire me,” so I asked the recruiter to give me a short tour. He was a little surprised but gave me the tour.

Later on, they contacted me trying to arrange a second round; they were apparently very impressed by my test. Apparently, not too many were even able to answer 6 questions. But I had already accepted the offer from Technicolor. Who knows if Technicolor had been a little slower and EA Sports a little faster, my game development career would have started much earlier.


Previous - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - 15 - 16 - 17 - 18 - 19 - 20 - 21 - 22 - 23 - 24 - 25 - 26 - 27 - 28 - 29 - 30 - 31 - 32 - 33 - 34 - 35 - 36 - 37 - 38 - 39 - 40 - 41 - 42 - 43 - 44 - 45 - 46 - 47 - 48 - 49 - 50 - 51 - 52 - Next