View on GitHub

Quorten Blog 1

First blog for all Quorten's blog-like writings

Reflection on where I am in my blogging

2016-10-06

Categories: misc  
Tags: misc  

I’m kind of lost. I was going to write some additional things down, but I don’t know what. Oh, now I know. See below. Anyways, what I was going to get to first. Wikipedia. It has a huge amount of information, and it is all digital, so it is very easy to download to your computer. The question, then, is why not? Because you might want to use Wikipedia to get the most up-to-date information. I know I sure did in order to get the most up-to-date information on My Little Pony.

Well, anyways, JJJ TODO Get Wikipedia for Schools! That is a good small amount of information that is generally useful and, in a sense, being manually reviewed, is not likely to go out of date too quickly. Compared to other articles on the big Wikipedia.

JJJ TODO. Hung up. Keep the rift raft out, said Dovolis.

I’m still searching for diagnostic pin doucmentation on my Minolta camera, here is what I found.

At first, it looked promising, but at a careful look at the blurred preview page images, it became clear that the actual PDF document (that I could not download without first registering) was actually something else that was fakely marked up as a Minolta camera service manual.

  • And I thought I was really close. I thought I was really close to finding out what those 10 pins inside the film bay of the camera might do. But nope, I wasn’t.

20161001/http://manualslibrary.net/MINOLTA-RIVA-ZOOM-115EX-SERVICE-REPAIR-MANUAL.html

But, anyways, I’m still interested. What if a search for a “Minolta Riva Zoom 115 EX Service & Repair Manual” actually did bring up the correct result? Anyways, I’ll just have to keep remembering this one to follow up for later.

These are some other useful links I’ve found in the present. Note that Manualsparadise.com is really the same as Manualzone.com, and I’m not exactly sure about the trustworthiness of these sites as they appear that they may be using keyword stuffing on constructed separate domains to make them appear higher ranked in search engines.

Read on →

3D scanner notes continued. Okay, after some long and careful thought, I came to some very interesting solutions for the 3D data storage problem.

First of all, let me remind you of the conventional method. The conventional method of 3D data storage is to store a mesh as a list of points and a list of point indices defining the triangles that connect them.

However, I’ve found an alternative method that is not only easier to store via analog means, but also is more intuitive to someone who is not experienced in 3D computer graphics, but is experienced in the current state-of-the-art of “non-technical” or “basic” computer use.

In short, we define a 3D model using a series of 2D images.

The most important 2D images for the definition of the 3D geometry are the depth maps. These are basically 2D images where the color of each pixel defines the distance of a point from the camera, in some sort of way. Note at this point that I am thinking of at least two different ways to define this.

So anyways, you can also store some metadata in addition to that image recording various parameters like focal length, camera position, and camera angle. You see, it is very easy to print out such data, and it may also be possible to perform lossless digital scanning and printing of such data, so it works as both a data storage format and an archival format.

Read on →

Exploring CopyingMock in Python

2016-09-29

Categories: python  
Tags: python  

Okay, now this was an interesting exploration into CopyingMock, class instances, and such of that. Why is it that you can’t mock the class and have the members mocked correctly too?

# This fails.
with patch(__name__ + '.MyTest.get', new_callable=CopyingMock
           ) as mock_get:
    x = MyTest(1)
    x.get(TEST_URL)
    mock_get.assert_called_once_with(x, TEST_URL)

# This works.
with patch(__name__ + '.MyTest.get', new_callable=CopyingMock
           ) as mock_get:
    x = MyTest(1)
    x.get(TEST_URL)
    mock_get.assert_called_once_with(TEST_URL)

# This works.
with patch(__name__ + '.MyTest.get') as mock_get:
    x = MyTest(1)
    x.get(TEST_URL)
    mock_get.assert_called_once_with(TEST_URL)

Okay, let me explain what is going on here. I read the source code, so I have something to reference. First of all, let’s note that we are making assertions on how the function is called, so we technically don’t need to setup a spec for the mocked functions because that is the basic point of the assertions. Second, I have to note a peculiarity of autospecing. Autospecing calls an internal function named _set_signature() that is used to generate a lambda function that verifies the function signature then calls the actual mock, whereas a direct mock does not quite have the equivalent function. That being said, I’m not exactly sure why setting the spec directly must have different behavior than autospecing.

Serverspec? Testinfra says that it is related to that. Is this what I’m looking for?

20160928/http://serverspec.org

Need something more Pythonic than Cucumber? Or, should I put it this way, do you want something like Cucumber, but written in Python rather than Ruby? Well, then you can try this.

20160928/http://stackoverflow.com/questions/9485962/does-python-have-anything-like-capybara-cucumber#9514754

Why does it matter? Oh, here, for some reason, people want to use some “pure Python stack,” whatever that means. Well, okay, fine, there you have it for the motivation. For some reason, we just don’t like Ruby.

Important. How to build SRPM packages into binary packages, possibly with patches and modifications. Though I’ve done this before with Debian distributions, I’ve never done it before with CentOS/Fedora/Red Hat.

20160926/https://wiki.centos.org/HowTos/RebuildSRPM

More useful notes.

How to create patches on top of base sources.

20180403/DuckDuckGo rpm spec patches
20180403/http://wiki.networksecuritytoolkit.org/index.php/HowTo_Create_A_Patch_File_For_A_RPM

Only for very basic use cases, not “official-style” kernel modules: how to create kernel module packages.

20180403/DuckDuckGo rpm spec linux kernel module
20180403/http://karuppuswamy.com/wordpress/2008/09/03/creating-a-kernel-module-rpm-package/

Also, that page has some links to some interesting other pages on electronics gadgets to “play with,” i.e. program.

Is this the “mock import” you were looking for? No, not quite. It goes in the opposite direction, but the name is correct.

20160922/https://github.com/posener/mock-import
20170201/https://pypi.python.org/pypi/mock-import/0.0.2

Important! It would be useful for my Python package integration tests to use something like this as an external module. Unfortunately, the mentioned module’s scope is a little bit narrower than would be desired. The mock import is only setup to cause imports to pass, not to fail.

On the subject of my Python package, using Sphinx for the documentation may also be another good thing to do.

20170201/http://www.sphinx-doc.org/en/1.5.1/tutorial.html

Important! How do you figure out which lines were not executed from a py.test with code coverage? Here’s how:

coverage report -m

20160912/https://coverage.readthedocs.io/en/coverage-4.2/

Now, this is very interesting. How do you unit test import errors? Here’s how:

try: import builtins
except ImportError: import __builtin__ as builtins
realimport = builtins.__import__
def myimport(name, globals, locals, fromlist, level):
   if ... : raise ImportError
   return realimport(name, globals, locals, fromlist, level)
builtins.__import__ = myimport

Of course, make sure you see my actual implemented code for a few practical improvements.

20160912/http://stackoverflow.com/questions/2481511/mocking-importerror-in-python#2481588

Read on →