View on GitHub

Quorten Blog 1

First blog for all Quorten's blog-like writings

Sure, you can run Docker containers on Raspberry Pi, but what about some good traditional full system virtualization? I mean, come on, what better way is there to add a layer of secure isolation against software security vulnerabilities than to run risky software in a virtual machine like is done with web browsers? Really, I heard that Android uses virtual machines already. Okay, okay, let’s take a look.

Firs of all, this is a tough subject to search for because much of the old information is coming in at the angle of virtualizing a Raspberry Pi on an old skool x86 PC or laptop.

20191227/DuckDuckGo raspberry pi 4 virtual machines
20191227/DuckDuckGo raspberry pi 4 arm qemu
20191227/https://lb.raspberrypi.org/forums/viewtopic.php?t=249524
20191227/https://github.com/wimvanderbauwhede/limited-systems/wiki/Raspbian-%22stretch%22-for-Raspberry-Pi-3-on-QEMU
20191227/https://raspberrypi.stackexchange.com/questions/53874/how-can-i-emulate-an-x86-cpu-on-a-raspberry-pi-with-qemu

Here is some info on going the other way, running x86 programs on the Raspberry Pi. Alas, it recommends proprietary software. But we’re interested in native ARM virtualization.

20191227/https://thepi.io/how-to-run-x86-programs-on-the-raspberry-pi/

20191227/https://gist.github.com/stefanozanella/4608873

Read on →

Rsync a hard disk image

2019-12-27

Categories: unix  
Tags: unix  

Okay, so I’ve made a full disk image backup of one disk image before an expected migration, but then the expected migration got delayed while the system was still in use, so now I have to update the full disk image backup. But, I do not want to have to recopy the full thing because that will take a while. Can I rsync the disk image? No, because rsync doesn’t work on block devices, not without a patch from rsync-patches. Yeah, but that sounds kind of finicky, especially considering I was reading articles dated from 2012. If rsync mainline doesn’t want the change applied, it will keep getting knocked back when they update their software in incompatible ways and the patchset doesn’t keep pace.

Luckily, there is an independent third-party solution that builds off of a more stable foundation. bscp is a minimal Python script that uses only Python builtins to synchronize disk images by only copying blocks that have changed. It looks fairly robust, like it should be able to work with both Python 2 and Python 3, so you can use this for a large range of systems from old to new.

20191226/DuckDuckGo rsync disk image
20191226/https://www.linuxquestions.org/questions/linux-general-1/using-rsync-to-clone-hard-drive-921303/
20191226/DuckDuckGo rsync block device
20191226/https://arstechnica.com/civis/viewtopic.php?t=1173708
20191226/https://unix.stackexchange.com/questions/344756/is-there-anything-similar-to-rsync-to-syncing-block-devices
20191226/https://vog.github.io/bscp/
20191226/https://github.com/vog/bscp
20191226/https://github.com/vog/bscp/blob/master/bscp

The solution to amortized cost. When the cost of doing many things together is cheaper than the cost of doing each individually, how do you describe that? The trick is to not think about the individualized cost, but the net cost. Compute the full system net cost of the collectively cheaper method, then compare that to the more individualized method cost, and multiply to compare that with the cheaper system cost.

So then, the solution is simple if you want to do a blunt comparison of the system cost with the individual cost. You simply divide evenly across all the actors in the system, since that is the conversion you use for comparing with the more expensive individual cost. Due to the mathematical identities, this will give you the same totals when you scale. That is, assuming that you do not use a more efficient larger system means of working, of course.

But yeah, really. The point is to think bigger to bring about more optimizations. Your choices for optimizing a small system are necessarily less than the case of optimizing a big system.

And this idea scales with code and software development too… when you have larger code bases, the opportunities for optimization increase. Or, alternatively, the lack thereof optimization in a larger code base can contribute to growing code bloat.

Read on →

So, when working on many projects, often times I find it important to account for costs paid for by someone else. Why? Because if a cost required for a particular project is being paid for by someone else in the present, there is a risk that funding source may no longer be available in the future, and you’ll have to find an alternate funding source. So, I’m trying to figure out how to measure that in my accounting equations. “Economic externalities” is another way of stating a similar thing. Surely, there’s an official way of doing this in the accounting practice, isn’t there?

“Sponsorship” is the word that comes to my mind. So, what does Wikipedia ahve to say about this? Well, it is almost entirely focused on the idea of sponsorship as a means of brand promotion in return.

20191225/https://en.wikipedia.org/wiki/Sponsor_(commercial)

Well… when I think about this, yeah, indeed this is a common trend even when it is not overt and explicit. The jobs you work that build your resume, are, in essence, a form of “sponsorship” by you. You sponsor work at a company in exchange for the ability to put your work experience on your resume.

Also, this extends to corporate donations. Because companies like to publicize donations in a Corporate Social Responsibility (CSR) newsletter or the like, they are not, in fact, pure donations of their own right, but it is in fact sponsorship. Only when people truly want to give without expeect for any reward or recognition can it be recognized as a true donation and only that.

Suppose you make your own hand-wound inductor. How do you measure inductance so you know what kinds of circuits it can be used in? Well, as it turns out, there is a clever trick you can use that involves using an oscilloscope to compare its output curves with a reference input curve at a sine wave frequency. Then once you determine the parameters of these curves, you can plug the numbers into some equations to calculate the inductance, in henrys (H). Typically, microhenrys.

20191222/DuckDuckGo how to measure inductance
20191222/https://www.wikihow.com/Measure-Inductance

This StackExchange question and answer is also insightful.

20191222/https://electronics.stackexchange.com/questions/94354/why-dont-typical-digital-multimeters-measure-inductance

Weight sensors revisited

2019-12-21

Categories: raspberry-pi  
Tags: raspberry-pi  

So, earlier I’ve searched around the Internet for information on electronic weight sensors you can connect directly to a Raspberry Pi. But apparently, I must have been too disappointed to record my findings or immediately label them with the “Raspberry Pi” tag. Well, here I come back full circle to pretty much the same findings, but this time, much more straight from the original sources, Sparkfun. Previously, I’ve found a third-party blog that had the how-to build, but not the explanation of why.

Yes, you do need to buy that weird Z-bar-shaped thing and screw it to platforms for weighing. Why the Z-bar? Because by rotating by a moment, it can sense weight more accurately than a pure compression button cell.

Please note that you do not need to use wood. Cardboard will also work, and give you the advantage of a lower tare weight. Again, feel free to experiment with other platform materials, you may even try thin sheet steel as a means of saving weight. The thing is, not only do you want a light platform material, you also want a platform material that will not deform too much under load, because all deformation is force that is imparted within the material itself and not transferred to your weight sensor.

20191220/https://learn.sparkfun.com/tutorials/load-cell-amplifier-hx711-breakout-hookup-guide

Read on →

Do you see reference to active low and active high in an integrated circuit datasheet? Don’t worry, the intuitive meaning is the correct meaning.

  • Active low: When this input is driven low, “enable” the indicated function.

  • Active high: When this input is driven high, “enable” the indicated function.

20191220/DuckDuckGo active low enable
20191220/https://www.quora.com/What-is-the-meaning-of-active-low-and-active-high-in-digital-circuits-and-logic-design
20191220/https://www.quora.com/Electronics-Why-the-enable-pin-of-most-of-the-ICs-is-active-low-Does-it-have-any-significance

How do you solve a system of equations using only integer arithmetic? At the outset, it doesn’t seem easy or possible. Gaussian elimination with partial pivoting is our first go-to tool for solving a system of equations, and this requires floating point arithmetic and lots of division computations. Sure, you could take this one step simpler by modifying it to define it across rational or fixed-point numbers. However, the fact still remains that you’ve got to do extra book-keeping computations with those kind of numbers that you don’t if you could compute straight off on integer arithmetic. So, is it possible to solve a system of equations using straight integer arithmetic?

Yes, it is. The key is to look at the method by which you are defining your equations, and redefine them at the source. The reason why Gaussian elimination requires floating point arithmetic is because the equation form ax + by + cz + d = 0 is because you must divide each leading coefficient to normalize it to one, so even if you start out with only integer inputs and would be able to receive an integer solution, your computation process necessarily introduces rational numbers. However, the key to realize is that you can rephrase this equation as a vector equation: Ax + b = 0, where A and x are vectors. A is a row vector, x is a column vector, when the two are multiplied together, you get a constant as the output.

Read on →

(1) Do you account for your hobby project time spend/investment? (2) Do you “bill” for the time or have a way of measuring the cost? Or, (3) do you measure the amortized cost?

The proper way to understand is this. You can measure the cost of everything in terms of real resources such as labor, time, energy, materials, etc. But generally, the actual cost is unknown due to undetermined variables about how long particular tools last, and therefore, waht is their corresponding cost share over the length of their service life.

Also, there are market value dynamics: You can’t do anything “for free” without also implicitly influencing the market value. But, remember this. Price is determined by market value. At very minimum, market value is determined by two parties: the seller and the buyer.

Funny thing I realized: In practice, personal electronics hobby projects do in fact have a “market.” When you bust out your electronics tools, you take on a different personality versus when they are stowed away. So, in essence, one person is providing a good/service to another person, though in reality, these are merely different personalities, or workflows, of a single person.

Read on →