I see dead processor, the first time in my life I've dealt with hundreds if not thousands of PCs since I was a kid

Ever since I got my hands into assembling and troubleshooting PCs when I was a kid, both through my own experience and general consensus in the computer hobbyist community, CPU is almost the last thing to suspect at fault for a non-functioning computer, much less likely if:

  • There are no signs physical damages (mechanical or heat stress)
  • There were no shorts (burning electronic smells)
  • There weren’t any extreme overclocking (at least Vcore was pumped)
  • The computer used to boot, but has some random hangs

After 20+ years (and troubleshooted a few hundreds if not a couple of thousand PCs), today I encountered (actually zeroed-in that it’s the culprit) the first bad processor in my life. It was inside a M815G motherboard from a 54854A oscilloscope that I bought that wouldn’t boot into windows without random ‘file corrupted’ errors. Then after a few tries, the board wouldn’t even boot, not even any code on the POST card.

At first I suspected it’s an aging motherboard, since I checked the RAM and passes Memtest86+ on another board. It’d be either the motherboard or CPU, which I never considered it might be the CPU given how unlikely it is both by other people and myself.

I couldn’t be bothered to dig at the moment so I simply replaced the entire motherboard (with CPU and RAM installed) with another unit and confirmed that the 54854A I bought didn’t have any deeper problems. Then I put this ‘bad M815G motherboard’ on my back burner.


Today I was trying to revive a VP22 motherboard (which boots only if I apply pressure on certain areas of the PCB) that didn’t have the Fan+Heatsink+CPU+RAM. I happen to have a spare Pentium 3 and some PC-133 (SDRAM) lying around, but not the heatsink+fan, so I borrowed it from the M815G in the repair-if-I-feel-like-it pile.

The VP22 booted with pressure on the PCB (beeped, checked POST card) but I couldn’t see any display, so I thought of swapping-in the known-‘good’ CPU from the ‘faulty’ M815G to see if I had the wrong revision that the VP22 didn’t support. The VP22 used to get stuck in the boot process, but at least the POST card has a reading, this time after swapping in the CPU from the M815G, it has no POST code at all. No pulse.

I got suspicious and took the the CPU from the VP22 and put it in the ‘faulty’ M815G. Guess what? The M815G in question boots and runs fine!!! WTF! For all that time I thought my M815G has a difficult fault just because I had a marginally failing an then dead CPU, which I didn’t even consider the possibility given how unlikely the CPU is at fault.

And no, it’s not the thermal compound drying up, it’s freshly applied every time I move it to a different motherboard. The CPU was only used in M815G/VP22 which does not even have any means of overclocking. No burns or smells or physical damage, and the computer used to boot. The CPU just died of natural causes.

A black swan day!

Loading

Watch out for ‘const’ method in Python

One thing I feel a little bit not quite as intuitive when I switch to Python is I constantly have to look up whether the method directly updates the contents or it’ll return a different object (of the same type) that I’ll have to overwrite the input variable myself.

An example would be strings and bytes object. replace() sounded like an updating method, but it’s actually a ‘const’ method (a term borrowed from C++ to say that the method does not have side-effects) that does not change the state of the object.

I initially thought this has to do with whether the object is immutable or not, but I tried it on bytearray objects (which is mutable), replace() behaves consistently with the identically named methods in other immutable objects (bytes object, string object): you’ll need to assign the output to self (basically bind the name to the temporary and throw away the original).

bts = b'test'
bts.replace('es', 'oas')       # dumps the output to workspace (can be accessed by _) and do nothing else
bts = bts.replace('es', 'oas') # actually updates bts

 

Loading

Duracell leaks in original package before being used!

I knew Duracell is known for leaking when left in equipment for too long (too numerous to count: I had it leaked in wireless mouse, remote control, clocks, etc), but I always thought it’s my fault for leaving them in my electronics for a long time.

Today I got my answer: it’s not my fault that the batteries leaked. I just opened a new box of 4 AAA Duracells, and one of the new unused battery (the marking says it expires in 2023. It’s 2019 at the time of writing). I bought them from Tigerdirect so it’s likely to be genuine (on 10/2015). Here’s the pictures:

Not only I am not going to get Duracell batteries even if they are free, I’m going to toss all Duracell I have. It’s nothing but a menace. It’s worse than white label brands as it’s known to leak. It has to be a design or chemical formula or manufacturing process problem they have. By no means it’s an isolated incident.

Loading

Anonymous Functions (MATLAB) vs Lambdas (Python) Anonymous Functions in MATLAB is closure while Lambdas in Python are not

Lambdas in Python does not play by the same rules as anonymous functions in MATLAB

  • MATLAB takes a snapshot of (capture) the workspace variables involved in the anonymous function AT the time the anonymous function handle is created, thus the captured values will live on afterwards (by definition a proper closure).
  • Lambda in Python is NOT closure! [EDIT: I’ll need to investigate the definition of closure more closely before I use the term here] The free variables involved in lambda expressions are simply read on-the-fly (aka, the last state) when the functor is executed.

It’s kind of a mixed love-and-hate situation for both. Either design choice will be confusing for some use cases. I was at first thrown off by MATLAB’s anonymous function’s full variable capture behavior, then after I get used to it, Python’s Lambda’s non-closure tripped me. Even in the official FAQ, it address the surprise that people are not getting what they expected creating lambdas in a for-loop.

To enable capture in Python, you assign the value you wanted to capture to a lambda input argument (aka, using a bound variable as an intermediary and initialize it with the free variable that needs to be captured), then use the intermediary in the expression. For example:

lambda: ser.close()      # does not capture 'ser'
lambda s=ser: s.close()  # 'ser' is captured by s.

I usually keep the usage of nested functions to the minimum, even in MATLAB, because effectively it’s kind of a compromised ‘global’ between nested levels, or a little bit like protected classes in C++. It breaks encapsulation (intentionally) for functions in your inner circle (nest).

It’s often useful for coding up GUI in MATLAB quick because you need to share access to the UI controls within the same group. For GUI that gets more complicated, I actually avoided nested functions altogether and used *appdata() to share UI object handles.

Functors of nested functions are closures in both MATLAB and Python! Only Lambdas in Python behave slightly differently.

Loading