Wednesday, May 28, 2014

[aix] cpu deallocation

AIX CPU deallocation

1) Activate cpu deallocation 
# chdev -l sys0 -a cpuguard='enable'
check the application
# lsattr -El sys0

2) check the number of processor which try to disable
# lsdev -Cc processor

3) cpu disable
# cpu_deallocate (logical CPU number)


4) check the processor status
# lsattr -El proc##


※ Caution
You need to reboot to reactivate the disabled cpu. 
It needs more than 3 cpu to use cpuguard.

Thursday, May 8, 2014

[python] install easy_install, pip

which easy_install 2>/dev/null
    if [ $? -ne 0 ];then
        wget https://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz
        tar xvfz setuptools-0.6c11.tar.gz
        pushd setuptools-0.6c11
            sudo python setup.py install
        popd
        sudo rm -rf setuptools-0.6c11*
    fi

# running pip

$ sudo easy_install pip

[python] simplejson import

>>> import simplejson
Traceback (most recent call last):
  File "", line 1, in
ImportError: No module named simplejson
>>> import simplejson ?
  File "", line 1
    import simplejson ?
                      ^
SyntaxError: invalid syntax
>>> import json as simplejson
>>> help(json)

Help on package json:

NAME
    json - A simple, fast, extensible JSON encoder and decoder

FILE
    /usr/lib64/python2.6/json/__init__.py

DESCRIPTION
    JSON (JavaScript Object Notation) is a subset of
    JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data
    interchange format.

    json exposes an API familiar to uses of the standard library
    marshal and pickle modules.

    Encoding basic Python object hierarchies::

        >>> import json
        >>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}])
        '["foo", {"bar": ["baz", null, 1.0, 2]}]'
        >>> print json.dumps("\"foo\bar")
        "\"foo\bar"
        >>> print json.dumps(u'\u1234')
        "\u1234"