Overriding Default Zenoss Pages

While testing the Layer 2 ZenPack, I noticed that the network map provided by the ZenPack was placed in the same page of the old default Zenoss's network map, replacing the latter which was made using Flash. After the ZenPack is installed, when you click on the Network Map secondary link in the Infrastructure page, you will get the new map instead.

Network Map link

This seemed pretty nice, and I was curious how they achieved this, so I started browsing around the source code. It turns out that this overriding is done in a file called overrides.zcml, which is placed in the ZenPack's top directory.

zenoss zope zenpacks

Getting Started on Contributing to OpenStack

OpenStack

I have started to become interested in contributing to the OpenStack project. Starting to contribute to such a massive project can seem like a daunting task, and it is. It is only by arming yourself with the proper tools and knowledge prior to contributing, that you will have a smoother process. I created this blog post to smooth that process.

Picking a Project

OpenStack is composed of many different projects for different purposes (compute, storage, networking, telemetry, etc.). Before you start contributing, you must have an idea of which project you actually want to contribute to. In my case I have decided on the Telemetry part, more specifically on Ceilometer.

After you have picked a project, it is time to start reading its documentation and developer documentation to understand how it works. The Ceilometer developer documentation offers good explanations and diagrams of its architecture and components.

Here is another nice guide on contributing to Ceilometer.

programming open source openstack ceilometer python

Python Tricks for Better Code

A compilation of very useful Python tricks for better code. All examples are Python 2.7 and Python 3 compatible unless stated otherwise.

Enumerate

When working with items in a list and we want to print or handle each item's index, instead of using a counter variable:

# Bad way
i = 0
for place in places:
    print(i, place)
    i += 1

We can use enumerate to improve our code:

for i, place in enumerate(places):
    print(i, place)

enumerate returns a list of indexes along with each item in the list.

python programming

Integrating TravisCI With Rails and Heroku

Adding TravisCI to your application's deployment flow will enable you to spot any build fails or test fails during deployment without affecting your production environment.

In this post I go over on how to integrate TravisCI with a Rails 4 application that uses Postgresql, Rspec, and is later deployed to Heroku if the Travis build is successful.

Setting up TravisCI

Assuming you already have an account in TravisCI, look for the Github repository of the Rails application and enable it. Then we will want to add a .travis.yml file to the application's root directory with the following contents:

language: Ruby
rvm:
  - 2.3.0

The configuration above tells TravisCI that our application will use Ruby 2.3.0. Once you commit and push the change above to the master branch, Travis will begin creating the build, which might take a few minutes.

Configure Postgresql

Seems our Rails application uses Postgresql, we need to configure TravisCI to run our build with a Postgresql database. To do this we will add the following configuration to .travis.yml:

services:
  - postgresql

Then we will add another configuration that will make Travis create a Postgresql database with username postgres and blank password for the build:

before_script:
  - psql -c 'create database travis_ci_test;' -U postgres
ruby rails rspec web dev travisci github git heroku

Chinese Onomatopoeia in Literature

It's been almost a year since I started reading the Harry Potter series completely in Traditional Chinese, currently I just recently started Harry Potter and the Order of the Phoenix (Book #5).

Through my Chinese reading journey I have come accross a lot of Chinese onomatopoeia that you don't really come across with in other types of writings such as Internet articles, conversations, and newspaper articles.

In this post I go into detail about each of these sounds I encounter in literature.

咕嚕 (gūlū)

Hungry

Definition: rumble, roll.

Used a lot when describing the rumbling sound of the stomach when hungry.

Examples:

  • 他的肚子咕嚕咕嚕直響 - His stomach kept rumbling).
  • 粗大的圓木咕嚕咕嚕地從山坡上滾下來 - Large logs came rolling down the slope

啪啪 (pāpā)

Clapping

Definition: The sound of clapping, slapping, a gunshot.

Examples:

  • 的一聲, 瓶塞飛出來了 - The cork popped and flew out of the bottle.
← Newer Posts Older Posts →