VMware Acronyms

This is a list of acronyms that I come across while reading VMware documentation.

TPS
Transparent Page Sharing is a memory-saving technique that runs as a background job on the host, and deduplicates the contents of RAM on the hypervisor, page by page. Read more on TPS...

VMware Transparent Page Sharing

Transparent Page Sharing is a memory-saving technique employeed by VMware ESXi hosts, that runs as a background job on the host and removes duplicates pages of memory, by first comparing a hash of the contents of each page, and then comparing pages the hash of which is identical bit by bit.

Card image cap

ISO Date Format in Apache Logs

Apache's mod_log_config module (installed by default on CentOS 6) allows for the CustomLog directive, which in turn takes a log format specification. This post shows how to use ISO format for Apache logs.

Read More →

web.py Subapplications

To better organize your source code in a web.py application, you can break it down in subapplications. Those subapplications will be imported as Python modules in your main web.py script (which, in the below examples is index.py).

Troubleshooting

AttributeError: 'module' object has no attiribute ...

If you get the error:

AttributeError: 'module' object has no attribute 'app'

...then you might be running into Python naming collissions. Check if you have given one of your subapplications the same name as an existing Python module. For example, you shouldn't name a subapplication user, since that is an existing Python module.

ImportError: No module named ...

If you get the error:

ImportError: No module named subapp

... (where subapp is the name of your subapplication), then Python cannot import the subapplication as a module. As a first step, create an empty file named __init__.py in the same directory as your subapplication, and try again. If you still get that error, and assuming your subapplications are in the same directory as your main application, you can try this ugly hack in the very beginning of your main application script:

import inspect
import os
import sys
sys.path.append(os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))))

Create test databases in MySQL

Sometimes you need to create a test database on a development MySQL server, to run some tests on, and you want to populate it with many records, to make your tests more meaningful. This document lists a couple of quick and dirty ways that I use to achieve that.

Using /usr/share/dict/words

On most Linux distributions, there is a file at /usr/share/dict/words which contains a list of words, each on a separate line. On my Linux Mint 15 installation, I count more than 99000 lines. The following commands will put those words in a table called words, in a database called test, one word per table row.

Create the table:

mysql> CREATE TABLE words (id INT AUTO_INCREMENT, word VARCHAR(256));

Populate the table with the words. I 'm using double quotes to wrap the words, since many of them already contain a single quote:

while read word; do mysql test -e "INSERT INTO words (word) VALUES (\"$word\")"; done < /usr/share/dict/words

Using /var/log/messages

I have also used the contents of /var/log/messages to populate a table, and that is documented in the blog post How to create a large MySQL database for tests. That is a painfully slow method, but can create tables that are many GigaBytes in size, which might be necessary for some tests.

virsh

List all VMs:

    virsh list --all

Automatically boot a VM when the host boots:

    virsh autostart vm.zindilis.net

Disable automatic start:

    virsh autostart --disable vm.zindilis.net

Manually power on a VM:

    virsh start vm.zindilis.net

Gracefully shutdown a VM:

    virsh shutdown vm.zindilis.net

Forcefully shutdown a VM:

    virsh destroy vm.zindilis.net
About

Hello, I'm Marios Zindilis and this is my website. Opinions are my own. You also find me on LinkedIn and GitHub.

Unless otherwise specified, content is licensed under CC0.

Search