General,Software Development

ลง VPython (python-visual) ใน Anaconda

VPython is a visualization python library.
It helps to create environment that can represent a natural phenomenon.
It is used as a tool for Physics tutorial.
To install inside the Anaconda, Python distribution, you need to install the Anaconda firstly at https://www.continuum.io/downloads

After that, please install Conda-build:

conda update conda
conda install conda-build

Then, clone the repository:

git clone https://github.com/mwcraig/conda-vpython-recipes.git

To build VPython by yourself, go inside ‘conda-vpython-recipes’ directory, and, compile its bundle of dependencies.
Please follow the steps below:

cd conda-vpython-recipes
conda build boost-vpython
conda build fonttools polygon2 ttfquery vpython
conda install boost-vpython –use-local
conda install vpython –use-local

Testing by import it inside Python:

import visual

Advertisements
มาตรฐาน
General

Set ให้ Xfce Terminal สามารถเลื่อน Tab ด้วย Shortcut

Set ให้ Xfce Terminal สามารถเลื่อน Tab ด้วย Shortcut นั้นต้องอาศัยความสามารถจากระบบ Xfce เอง
โดยให้ไปที่ App: Appearence เพื่อ Enable-> Shortcut accelerator

จากนั้นไปที่ Menu ของโปรแกรมที่ต้องการกำหนด Shortcut ซึ่งในที่นี้ก็คือ Xfce Terminal
ใช้ Mouse ลากไปวางที่ตำแหน่ง Choice ของ Menu ที่จะต้องการ ( Menu/ Tabs/ Move To Left )
จากนั้นกดปุ่ม ตั้ง Shortcut ตามต้องการ ( ขอให้เป็น Ctrl+Shift+PgUp โดยปริยาย

มาตรฐาน
General,Software Development

Local Webserver Told “Access Forbidden!”, Even Browsing from Same Local Machine

My localhost webserver told me that it could not let me access any pages because I browsed from another machine.

Since I am so sure that I sat down on the same machine, i.e. my notebook, as this webserver, I wondered and think it was unbelievable.

However, using Wireshark to catch packages, I found that it real! .. I used an source IP address of global network to connect with localhost network. How surprising!

After trying for while, I got the cause. The source IP address was changed, so that I set an ‘IPTABLES’ rule wrong.

It masqueraded all packets from my computer without filtering, ever local packets to localhost.

So, I changed it as a following rule.

-t NAT -A POSTROUTING -j MASQUERADE

to

-t NAT -A POSTROUTING -j MASQUERADE -s 192.168.3.0/24

มาตรฐาน
General

Linux Dell Too Slow due to Adapter Wattage Problem

My DELL notebook, E6320, occasionally got a problem for while.

When it booted, its BIOS shown that it could not get wattage information from an adapter.

At the time, I just omitted and used it as usual.

But the notebook did not work fast as it was ,and I did not know why.

Until I lost my patience, then I tried to find out the cause.

Since the problem related to lacking of wattage information, the BIOS tried to save a power consumption as much as possible.

As a result, it reduced the CPU frequency to minimum value.

For problem solving method, please follow the link below:

> http://www.woolie.co.uk/article/dell-laptop-stuck-800mhz-linux-fix/

 

มาตรฐาน
General,Software Development

Linux on Android

    1. On Genymotion 2.0.1: Android image version > 4.2.2 do not work
    2. Install Google play.
    3. Install Linuxonandroid, AndroidVNC, and Terminal Emulator.
    4. Download Ubuntu13.04-x86.zip on Linuxonandroid website.
    5. Copy Ubuntu13.04-x86.zip into the android emulator image.
    6. No need to install ‘busybox’ because it was shipped with the image.
    7. Unzip Unbuntu13.04-x86.zip.
    8. Run Linuxonandroid and Select Ubuntu13.04-x86 as a target.
      1. It will fail at the first time.
      2. Rename the /data/data/com.zpwebsites.linuxonandroid/files/busybox to busybox.old → It’s ARM excution version.
      3. Link /system/xbin/busybox to

/data/data/com.zpwebsites.linuxonandroid/files/busybox

  • > link -s … …
  • Run it again.
  • มาตรฐาน
    General

    Convert Markdown to Textile into a Ubuntu clipboard.

    Convert Markdown to Textile into a Ubuntu clipboard.

    I use this script to convert Zim article (Markdown code) to Textile code for report wrting on Rad mine.

    #!/bin/bash
    # Author: Pasakorn Tiwatthanont, a.k.a. iPAS
    # Revised: 28/01/2014

    if [ $# -eq 0 ]; then
    echo “Markdown to Textile converter via Pandoc.”
    echo \> `basename $0` \<file-markdown\>
    exit 255
    fi

    if [ ! -f $1 ]; then
    echo “File $1 do not exist!”
    exit 255
    fi

    fi=$1
    if [ “$2” != “” ]; then
    fo=$2
    else
    fo=`echo $1 | sed ‘s/\..*$//’`.textile
    fi

    if [ “$fo” == “-” ]; then
    pandoc -f markdown -t textile -o $fo $fi | xclip -selection c
    else
    pandoc -f markdown -t textile -o $fo $fi
    fi

    มาตรฐาน