Browsed by
Category: Problem solutions

Dealing with Time Zones in Code

Dealing with Time Zones in Code

The real answer is to always use seconds since an epoch for logging – like the Unix epoch – with 64 bit integer representation (signed, if you want to allow stamps before the epoch). Any real-world time system has some non-linear, non-monotonic behaviour like leap hours or daylight savings.

Lenovo Yoga 730-13IKB Keyboard Replacement

Lenovo Yoga 730-13IKB Keyboard Replacement

Something I wish I knew before picking the Lenovo 730-13IKB in a super-sale open box deal. The Yoga 730-13IKB has 2 really common, and pretty unforgiveable, problems. One is display flickering issues and keyboards that have keys that are randomly flaky. I got the display fixed while it was under warranty (after trying re-seating of the display cable through the hinge and only getting a little improvement), but it went out of warranty when I started having keyboard issues. I would often have the A,S,D keys stop working, but it wasn’t always consistent and was sometimes different keys. One solution that helped was to pull the bottom off, clean the contacts, and re-seat the keyboard connection. That, however, only worked for a little while until it started again.

Time to replace the keyboard with a new one – fortunately it was only $29 in 2021. As for how to do it, It’s Binh Repaired & Reviewed gives a great disassembly demonstration. The most annoying part is the removal of the black plastic wrap over the keyboard. I actually tore the backlight layer – but since my replacement kit had a new one I just tossed the old one. Once you’ve done that, it seems to go pretty well.

Now it appears to work perfectly, hopefully it will continue to do so.

Update 2022: I gave up. The first keyboard worked ok for a few months, then started loosing different keys. I replaced it with another one, and after a few months that one too started having failed keys. I would recommend buying a full price OEM one if you must try this. But I ended up buying a new laptop instead of dropping $100 on a replacement keyboard. I just put it towards $500 for buying a nice lenovo laptop that works as I need it.

ASUS Maximus Z690 Hero failures

ASUS Maximus Z690 Hero failures

UPDATE: ASUS has issued a recall. You can check the capacitor, or check the serial and part numbers. See the bottom of this article.

I recently bought an ASUS Maximus Z690 Hero for my new i9-12900K build. In the last few weeks since release, some people are reporting their ASUS Z690 motherboards are burning up and quit working. Fortunately for me, I have been unable to find DDR5 memory, so my board is still sitting in the box – which is fortunate because it appears the board I got his this very issue.

What is the issue? Reporters say the system runs for some time, then there is often an audible pop and the system hangs. People report smelling smoke and even seeing the upper corner of the board glowing. After powering down, there is damage to the upper corner of the board by the digital readout. Powering on the board throws code 53 and never reboots.

As more reports came in, they seemed to focus on these two 4C10B MOSFET components getting fried.

Buildzoid started looking at these reports and noticed something strange. The boards that are blowing up have a capacitor that appears to be backwards. These polymer-aluminum polarized capacitors have defined positive and negative electrodes. According to the specs on these types of capacitors, if you reverse the polarity accidently (i.e. if you put them in backwards) then leakage current will increase and ‘the life span may decrease’. This would explain why they might work for a short time, but then burn out.

Here’s a picture of a burned up board with the backwards capacitor. You can see the polarity stripe on the left. All the boards that appear ok have the positive stripe on the right.

There is no official word from ASUS on this yet, but a big reddit thread has basically concluded that this is the issue and discourage anyone from using these boards immediately. If they happen to blow when you are away, the system does not always power down and could present a real fire hazard as people have reported the components becoming glowing hot by the time they can even shut the system down.

Give buildzoid’s whole video a watch:

also JayTwoCents.

12/29/2021 Update: Here’s the recall information from ASUS

We have recently received incident reports regarding the ROG Maximus Z690 Hero motherboard. In our ongoing investigation, we have preliminarily identified a potential reversed memory capacitor issue in the production process from one of the production lines that may cause debug error code 53, no post, or motherboard components damage. The issue potentially affects units manufactured in 2021 with the part number 90MB18E0-MVAAY0 and serial number starting with MA, MB, or MC.

Lenovo Yoga 730 13IKB keys not working well

Lenovo Yoga 730 13IKB keys not working well

This seems to be a common problem. On my keyboard, I’d have ASD intermittently drop out or take a couple hits to register.

I used this technique to re-seat the cable and help it lay a bit better under the battery – but I also used 99% isopropanol alcohol to clean the contacts. I actually got quite a bit of gunk off the contacts. I re-connected things but was still having trouble with f and g keys. I tried once more, and it seems to have perhaps solved it.

Time will tell, but maybe give it a try if you are having trouble.

Denuvo DRM and Intel hybrid core architectures

Denuvo DRM and Intel hybrid core architectures

12th Generation processors are built on a new hybrid core architecture of big and small cores working together. However, it turns out that some DRM software has issues with this hybrid

“Certain third-party gaming Digital Rights Management (DRM) software may incorrectly recognize 12th Generation Intel® Core™ Processors efficient-cores (E-cores) as another system. This prevents games implementing that DRM software from running successfully. Games may crash during launch or gameplay, or unexpectedly shut down.”

However, there is already a workaround for this issue with Denuvo DRM. Give it a try if you find you have one of the affected games:

  • Power-up system and enter system BIOS setup.
  • Enable switch Legacy Game Compatibility Mode to ON (one-time only) in BIOS.
  • Save BIOS setup changes and exit.
  • Boot to OS.
  • Toggle Keyboard Scroll Lock key ON.
  • Launch affected game title.
  • Toggle Keyboard Scroll Lock key OFF after ending game title.
Out of Source CMake Build Example

Out of Source CMake Build Example

Build systems are certainly not the sexy parts of software development. However, no part of the development process impacts your team so much as it’s build system. Build systems that perform poorly, regularly break, or generate inconsistent or confusing output files are one of the fastest ways to introduce bugs, slow releases, and bring a whole team to a screeching halt. That’s why automated reproducible builds are a keystone of agile development.

Out-of-source builds are one way to improve your build system. Out-of-source building is a practice that keeps the generated/compiled intermediate and binary files out of the source file directories. Traditionally, most build systems would generate object, binary, and intermediate files mixed right next to their source files. This leads to a confusing hierarchy of files that made getting a consistent picture of your build and source nearly impossible on big projects.

It turns out CMake can help you create our of source builds with just a few little tricks. Unfortunately, there were few examples and many of them were overly complex. So, to help get folks started, I wrote up a very simple sample. It’s the perfect starting point for your next project. It works with both Linux and Visual Studio builds.

https://github.com/mattfife/BasicOutOfSourceCMake

Optimal Battleship

Optimal Battleship

Nick Berry, president of DataGenetics, meticulously analyzes different strategies to play the classic board game Battleship (he also has done Chutes & LaddersCandyland and Risk)

It’s a great example of how computer scientists often work. He explores a host of techniques and analyzes the results by calculating how often you’ll get a perfect game, median number of guesses, and how bad it gets in the worst case.

He examines 4 major strategies:

  1. Pure random searching
  2. Hunt and Target – Hunt randomly until you get a hit, then proceed methodically to sink the hit ship.
  3. Hunt and Target with parity – since the minimum length of a ship is 2 units, you need only search even or odd squares
  4. Hunt and Target with parity combined with a probability density function.

His fourth approach is the most fascinating. The system calculates every possible configuration of the remaining ships, and then sums up the probability of a ship on each square. At the beginning, all the squares are basically equally probable, but as more and more guesses are made, the number of possible configurations decreases. If you continually calculate the sum of these possibilities, pick the square with the highest probability and repeat this process, you get significantly better results.

How much better? Purely random guessing gives you a median of 97 moves. Using parity with the hunt+target method averages 64 moves. But using the probability density function increases that to a staggering 42 moves on average.

Turns out, I discussed the use of this kind of probability density function by speedrunners who used the same technique to beat the splosh-kaboom minigame in the Legend of Zelda Wind Waker.